]>
Commit | Line | Data |
---|---|---|
1da177e4 | 1 | /* |
1da177e4 LT |
2 | * Copyright (C) 2000, 2001 Blue Mug, Inc. All Rights Reserved. |
3 | * | |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License, or | |
7 | * (at your option) any later version. | |
1da177e4 | 8 | */ |
2a552891 | 9 | |
1da177e4 | 10 | #include <linux/init.h> |
87c37b51 AS |
11 | #include <linux/gpio.h> |
12 | #include <linux/delay.h> | |
8d717a52 | 13 | #include <linux/memblock.h> |
1da177e4 | 14 | #include <linux/types.h> |
362168f8 | 15 | #include <linux/i2c-gpio.h> |
200daa36 | 16 | #include <linux/interrupt.h> |
94760bf2 | 17 | #include <linux/backlight.h> |
200daa36 | 18 | #include <linux/platform_device.h> |
1da177e4 | 19 | |
96754a1f AS |
20 | #include <linux/mtd/physmap.h> |
21 | #include <linux/mtd/partitions.h> | |
22 | ||
1da177e4 | 23 | #include <asm/setup.h> |
2a552891 | 24 | #include <asm/mach/map.h> |
1da177e4 | 25 | #include <asm/mach/arch.h> |
2a552891 AS |
26 | #include <asm/mach-types.h> |
27 | ||
87c37b51 AS |
28 | #include <video/platform_lcd.h> |
29 | ||
2a552891 | 30 | #include <mach/hardware.h> |
1da177e4 LT |
31 | |
32 | #include "common.h" | |
e328b880 | 33 | #include "devices.h" |
1da177e4 | 34 | |
200daa36 AS |
35 | #define VIDEORAM_SIZE SZ_128K |
36 | ||
87c37b51 AS |
37 | #define EDB7211_LCD_DC_DC_EN CLPS711X_GPIO(3, 1) |
38 | #define EDB7211_LCDEN CLPS711X_GPIO(3, 2) | |
94760bf2 | 39 | #define EDB7211_LCDBL CLPS711X_GPIO(3, 3) |
87c37b51 | 40 | |
362168f8 AS |
41 | #define EDB7211_I2C_SDA CLPS711X_GPIO(3, 4) |
42 | #define EDB7211_I2C_SCL CLPS711X_GPIO(3, 5) | |
43 | ||
96754a1f AS |
44 | #define EDB7211_FLASH0_BASE (CS0_PHYS_BASE) |
45 | #define EDB7211_FLASH1_BASE (CS1_PHYS_BASE) | |
7e4615cd | 46 | |
200daa36 AS |
47 | #define EDB7211_CS8900_BASE (CS2_PHYS_BASE + 0x300) |
48 | #define EDB7211_CS8900_IRQ (IRQ_EINT3) | |
49 | ||
7e4615cd AS |
50 | /* The extra 8 lines of the keyboard matrix */ |
51 | #define EDB7211_EXTKBD_BASE (CS3_PHYS_BASE) | |
52 | ||
362168f8 AS |
53 | static struct i2c_gpio_platform_data edb7211_i2c_pdata __initdata = { |
54 | .sda_pin = EDB7211_I2C_SDA, | |
55 | .scl_pin = EDB7211_I2C_SCL, | |
56 | .scl_is_output_only = 1, | |
57 | }; | |
58 | ||
200daa36 AS |
59 | static struct resource edb7211_cs8900_resource[] __initdata = { |
60 | DEFINE_RES_MEM(EDB7211_CS8900_BASE, SZ_1K), | |
61 | DEFINE_RES_IRQ(EDB7211_CS8900_IRQ), | |
62 | }; | |
2a552891 | 63 | |
96754a1f AS |
64 | static struct mtd_partition edb7211_flash_partitions[] __initdata = { |
65 | { | |
66 | .name = "Flash", | |
67 | .offset = 0, | |
68 | .size = MTDPART_SIZ_FULL, | |
69 | }, | |
70 | }; | |
71 | ||
72 | static struct physmap_flash_data edb7211_flash_pdata __initdata = { | |
73 | .width = 4, | |
74 | .parts = edb7211_flash_partitions, | |
75 | .nr_parts = ARRAY_SIZE(edb7211_flash_partitions), | |
76 | }; | |
77 | ||
78 | static struct resource edb7211_flash_resources[] __initdata = { | |
79 | DEFINE_RES_MEM(EDB7211_FLASH0_BASE, SZ_8M), | |
80 | DEFINE_RES_MEM(EDB7211_FLASH1_BASE, SZ_8M), | |
81 | }; | |
82 | ||
83 | static struct platform_device edb7211_flash_pdev __initdata = { | |
84 | .name = "physmap-flash", | |
85 | .id = 0, | |
86 | .resource = edb7211_flash_resources, | |
87 | .num_resources = ARRAY_SIZE(edb7211_flash_resources), | |
88 | .dev = { | |
89 | .platform_data = &edb7211_flash_pdata, | |
90 | }, | |
91 | }; | |
92 | ||
87c37b51 AS |
93 | static void edb7211_lcd_power_set(struct plat_lcd_data *pd, unsigned int power) |
94 | { | |
95 | if (power) { | |
96 | gpio_set_value(EDB7211_LCDEN, 1); | |
97 | udelay(100); | |
98 | gpio_set_value(EDB7211_LCD_DC_DC_EN, 1); | |
99 | } else { | |
100 | gpio_set_value(EDB7211_LCD_DC_DC_EN, 0); | |
101 | udelay(100); | |
102 | gpio_set_value(EDB7211_LCDEN, 0); | |
103 | } | |
104 | } | |
105 | ||
106 | static struct plat_lcd_data edb7211_lcd_power_pdata = { | |
107 | .set_power = edb7211_lcd_power_set, | |
108 | }; | |
109 | ||
94760bf2 AS |
110 | static void edb7211_lcd_backlight_set_intensity(int intensity) |
111 | { | |
e337d724 AS |
112 | gpio_set_value(EDB7211_LCDBL, !!intensity); |
113 | clps_writel((clps_readl(PMPCON) & 0xf0ff) | (intensity << 8), PMPCON); | |
94760bf2 AS |
114 | } |
115 | ||
116 | static struct generic_bl_info edb7211_lcd_backlight_pdata = { | |
117 | .name = "lcd-backlight.0", | |
118 | .default_intensity = 0x01, | |
e337d724 | 119 | .max_intensity = 0x0f, |
94760bf2 AS |
120 | .set_bl_intensity = edb7211_lcd_backlight_set_intensity, |
121 | }; | |
122 | ||
87c37b51 AS |
123 | static struct gpio edb7211_gpios[] __initconst = { |
124 | { EDB7211_LCD_DC_DC_EN, GPIOF_OUT_INIT_LOW, "LCD DC-DC" }, | |
125 | { EDB7211_LCDEN, GPIOF_OUT_INIT_LOW, "LCD POWER" }, | |
94760bf2 | 126 | { EDB7211_LCDBL, GPIOF_OUT_INIT_LOW, "LCD BACKLIGHT" }, |
87c37b51 AS |
127 | }; |
128 | ||
2a552891 AS |
129 | static struct map_desc edb7211_io_desc[] __initdata = { |
130 | { /* Memory-mapped extra keyboard row */ | |
7e4615cd AS |
131 | .virtual = IO_ADDRESS(EDB7211_EXTKBD_BASE), |
132 | .pfn = __phys_to_pfn(EDB7211_EXTKBD_BASE), | |
2a552891 AS |
133 | .length = SZ_1M, |
134 | .type = MT_DEVICE, | |
2a552891 AS |
135 | }, |
136 | }; | |
137 | ||
138 | void __init edb7211_map_io(void) | |
139 | { | |
140 | clps711x_map_io(); | |
141 | iotable_init(edb7211_io_desc, ARRAY_SIZE(edb7211_io_desc)); | |
142 | } | |
1da177e4 | 143 | |
98c672cf RK |
144 | /* Reserve screen memory region at the start of main system memory. */ |
145 | static void __init edb7211_reserve(void) | |
146 | { | |
2a552891 | 147 | memblock_reserve(PHYS_OFFSET, VIDEORAM_SIZE); |
98c672cf RK |
148 | } |
149 | ||
1da177e4 | 150 | static void __init |
0744a3ee | 151 | fixup_edb7211(struct tag *tags, char **cmdline, struct meminfo *mi) |
1da177e4 LT |
152 | { |
153 | /* | |
154 | * Bank start addresses are not present in the information | |
155 | * passed in from the boot loader. We could potentially | |
156 | * detect them, but instead we hard-code them. | |
157 | * | |
158 | * Banks sizes _are_ present in the param block, but we're | |
159 | * not using that information yet. | |
160 | */ | |
161 | mi->bank[0].start = 0xc0000000; | |
2a552891 | 162 | mi->bank[0].size = SZ_8M; |
1da177e4 | 163 | mi->bank[1].start = 0xc1000000; |
2a552891 | 164 | mi->bank[1].size = SZ_8M; |
1da177e4 LT |
165 | mi->nr_banks = 2; |
166 | } | |
167 | ||
200daa36 | 168 | static void __init edb7211_init(void) |
e328b880 AS |
169 | { |
170 | clps711x_devices_init(); | |
171 | } | |
172 | ||
173 | static void __init edb7211_init_late(void) | |
200daa36 | 174 | { |
87c37b51 AS |
175 | gpio_request_array(edb7211_gpios, ARRAY_SIZE(edb7211_gpios)); |
176 | ||
96754a1f | 177 | platform_device_register(&edb7211_flash_pdev); |
87c37b51 AS |
178 | platform_device_register_data(&platform_bus, "platform-lcd", 0, |
179 | &edb7211_lcd_power_pdata, | |
180 | sizeof(edb7211_lcd_power_pdata)); | |
94760bf2 AS |
181 | platform_device_register_data(&platform_bus, "generic-bl", 0, |
182 | &edb7211_lcd_backlight_pdata, | |
183 | sizeof(edb7211_lcd_backlight_pdata)); | |
dd850f12 | 184 | platform_device_register_simple("video-clps711x", 0, NULL, 0); |
200daa36 AS |
185 | platform_device_register_simple("cs89x0", 0, edb7211_cs8900_resource, |
186 | ARRAY_SIZE(edb7211_cs8900_resource)); | |
362168f8 AS |
187 | platform_device_register_data(&platform_bus, "i2c-gpio", 0, |
188 | &edb7211_i2c_pdata, | |
189 | sizeof(edb7211_i2c_pdata)); | |
200daa36 AS |
190 | } |
191 | ||
1da177e4 | 192 | MACHINE_START(EDB7211, "CL-EDB7211 (EP7211 eval board)") |
e9dea0c6 | 193 | /* Maintainer: Jon McClintock */ |
2a552891 | 194 | .atag_offset = VIDEORAM_SIZE + 0x100, |
0d8be81c | 195 | .nr_irqs = CLPS711X_NR_IRQS, |
e9dea0c6 | 196 | .fixup = fixup_edb7211, |
98c672cf | 197 | .reserve = edb7211_reserve, |
200daa36 | 198 | .map_io = edb7211_map_io, |
d0ad52a6 | 199 | .init_early = clps711x_init_early, |
e9dea0c6 | 200 | .init_irq = clps711x_init_irq, |
6bb27d73 | 201 | .init_time = clps711x_timer_init, |
200daa36 | 202 | .init_machine = edb7211_init, |
e328b880 | 203 | .init_late = edb7211_init_late, |
99f04c8f | 204 | .handle_irq = clps711x_handle_irq, |
6c000712 | 205 | .restart = clps711x_restart, |
1da177e4 | 206 | MACHINE_END |