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 AS |
16 | #include <linux/interrupt.h> |
17 | #include <linux/platform_device.h> | |
e917ba44 AS |
18 | #include <linux/pwm.h> |
19 | #include <linux/pwm_backlight.h> | |
1c2f87c2 | 20 | #include <linux/memblock.h> |
1da177e4 | 21 | |
96754a1f AS |
22 | #include <linux/mtd/physmap.h> |
23 | #include <linux/mtd/partitions.h> | |
24 | ||
1da177e4 | 25 | #include <asm/setup.h> |
2a552891 | 26 | #include <asm/mach/map.h> |
1da177e4 | 27 | #include <asm/mach/arch.h> |
2a552891 AS |
28 | #include <asm/mach-types.h> |
29 | ||
87c37b51 AS |
30 | #include <video/platform_lcd.h> |
31 | ||
2a552891 | 32 | #include <mach/hardware.h> |
1da177e4 LT |
33 | |
34 | #include "common.h" | |
e328b880 | 35 | #include "devices.h" |
1da177e4 | 36 | |
200daa36 AS |
37 | #define VIDEORAM_SIZE SZ_128K |
38 | ||
87c37b51 AS |
39 | #define EDB7211_LCD_DC_DC_EN CLPS711X_GPIO(3, 1) |
40 | #define EDB7211_LCDEN CLPS711X_GPIO(3, 2) | |
94760bf2 | 41 | #define EDB7211_LCDBL CLPS711X_GPIO(3, 3) |
87c37b51 | 42 | |
362168f8 AS |
43 | #define EDB7211_I2C_SDA CLPS711X_GPIO(3, 4) |
44 | #define EDB7211_I2C_SCL CLPS711X_GPIO(3, 5) | |
45 | ||
96754a1f AS |
46 | #define EDB7211_FLASH0_BASE (CS0_PHYS_BASE) |
47 | #define EDB7211_FLASH1_BASE (CS1_PHYS_BASE) | |
7e4615cd | 48 | |
200daa36 AS |
49 | #define EDB7211_CS8900_BASE (CS2_PHYS_BASE + 0x300) |
50 | #define EDB7211_CS8900_IRQ (IRQ_EINT3) | |
51 | ||
7e4615cd AS |
52 | /* The extra 8 lines of the keyboard matrix */ |
53 | #define EDB7211_EXTKBD_BASE (CS3_PHYS_BASE) | |
54 | ||
362168f8 AS |
55 | static struct i2c_gpio_platform_data edb7211_i2c_pdata __initdata = { |
56 | .sda_pin = EDB7211_I2C_SDA, | |
57 | .scl_pin = EDB7211_I2C_SCL, | |
58 | .scl_is_output_only = 1, | |
59 | }; | |
60 | ||
200daa36 AS |
61 | static struct resource edb7211_cs8900_resource[] __initdata = { |
62 | DEFINE_RES_MEM(EDB7211_CS8900_BASE, SZ_1K), | |
63 | DEFINE_RES_IRQ(EDB7211_CS8900_IRQ), | |
64 | }; | |
2a552891 | 65 | |
96754a1f AS |
66 | static struct mtd_partition edb7211_flash_partitions[] __initdata = { |
67 | { | |
68 | .name = "Flash", | |
69 | .offset = 0, | |
70 | .size = MTDPART_SIZ_FULL, | |
71 | }, | |
72 | }; | |
73 | ||
74 | static struct physmap_flash_data edb7211_flash_pdata __initdata = { | |
75 | .width = 4, | |
76 | .parts = edb7211_flash_partitions, | |
77 | .nr_parts = ARRAY_SIZE(edb7211_flash_partitions), | |
78 | }; | |
79 | ||
80 | static struct resource edb7211_flash_resources[] __initdata = { | |
81 | DEFINE_RES_MEM(EDB7211_FLASH0_BASE, SZ_8M), | |
82 | DEFINE_RES_MEM(EDB7211_FLASH1_BASE, SZ_8M), | |
83 | }; | |
84 | ||
85 | static struct platform_device edb7211_flash_pdev __initdata = { | |
86 | .name = "physmap-flash", | |
87 | .id = 0, | |
88 | .resource = edb7211_flash_resources, | |
89 | .num_resources = ARRAY_SIZE(edb7211_flash_resources), | |
90 | .dev = { | |
91 | .platform_data = &edb7211_flash_pdata, | |
92 | }, | |
93 | }; | |
94 | ||
87c37b51 AS |
95 | static void edb7211_lcd_power_set(struct plat_lcd_data *pd, unsigned int power) |
96 | { | |
97 | if (power) { | |
98 | gpio_set_value(EDB7211_LCDEN, 1); | |
99 | udelay(100); | |
100 | gpio_set_value(EDB7211_LCD_DC_DC_EN, 1); | |
101 | } else { | |
102 | gpio_set_value(EDB7211_LCD_DC_DC_EN, 0); | |
103 | udelay(100); | |
104 | gpio_set_value(EDB7211_LCDEN, 0); | |
105 | } | |
106 | } | |
107 | ||
108 | static struct plat_lcd_data edb7211_lcd_power_pdata = { | |
109 | .set_power = edb7211_lcd_power_set, | |
110 | }; | |
111 | ||
e917ba44 AS |
112 | static struct pwm_lookup edb7211_pwm_lookup[] = { |
113 | PWM_LOOKUP("clps711x-pwm", 0, "pwm-backlight.0", NULL, | |
114 | 0, PWM_POLARITY_NORMAL), | |
115 | }; | |
94760bf2 | 116 | |
e917ba44 AS |
117 | static struct platform_pwm_backlight_data pwm_bl_pdata = { |
118 | .dft_brightness = 0x01, | |
119 | .max_brightness = 0x0f, | |
120 | .enable_gpio = EDB7211_LCDBL, | |
94760bf2 AS |
121 | }; |
122 | ||
e917ba44 AS |
123 | static struct resource clps711x_pwm_res = |
124 | DEFINE_RES_MEM(CLPS711X_PHYS_BASE + PMPCON, SZ_4); | |
125 | ||
87c37b51 AS |
126 | static struct gpio edb7211_gpios[] __initconst = { |
127 | { EDB7211_LCD_DC_DC_EN, GPIOF_OUT_INIT_LOW, "LCD DC-DC" }, | |
128 | { EDB7211_LCDEN, GPIOF_OUT_INIT_LOW, "LCD POWER" }, | |
129 | }; | |
130 | ||
98c672cf RK |
131 | /* Reserve screen memory region at the start of main system memory. */ |
132 | static void __init edb7211_reserve(void) | |
133 | { | |
2a552891 | 134 | memblock_reserve(PHYS_OFFSET, VIDEORAM_SIZE); |
98c672cf RK |
135 | } |
136 | ||
1da177e4 | 137 | static void __init |
1c2f87c2 | 138 | fixup_edb7211(struct tag *tags, char **cmdline) |
1da177e4 LT |
139 | { |
140 | /* | |
141 | * Bank start addresses are not present in the information | |
142 | * passed in from the boot loader. We could potentially | |
143 | * detect them, but instead we hard-code them. | |
144 | * | |
145 | * Banks sizes _are_ present in the param block, but we're | |
146 | * not using that information yet. | |
147 | */ | |
1c2f87c2 LA |
148 | memblock_add(0xc0000000, SZ_8M); |
149 | memblock_add(0xc1000000, SZ_8M); | |
1da177e4 LT |
150 | } |
151 | ||
e328b880 | 152 | static void __init edb7211_init_late(void) |
200daa36 | 153 | { |
87c37b51 AS |
154 | gpio_request_array(edb7211_gpios, ARRAY_SIZE(edb7211_gpios)); |
155 | ||
96754a1f | 156 | platform_device_register(&edb7211_flash_pdev); |
e917ba44 | 157 | |
d2168146 | 158 | platform_device_register_data(NULL, "platform-lcd", 0, |
87c37b51 AS |
159 | &edb7211_lcd_power_pdata, |
160 | sizeof(edb7211_lcd_power_pdata)); | |
e917ba44 AS |
161 | |
162 | platform_device_register_simple("clps711x-pwm", PLATFORM_DEVID_NONE, | |
163 | &clps711x_pwm_res, 1); | |
164 | pwm_add_table(edb7211_pwm_lookup, ARRAY_SIZE(edb7211_pwm_lookup)); | |
165 | ||
166 | platform_device_register_data(&platform_bus, "pwm-backlight", 0, | |
167 | &pwm_bl_pdata, sizeof(pwm_bl_pdata)); | |
168 | ||
dd850f12 | 169 | platform_device_register_simple("video-clps711x", 0, NULL, 0); |
200daa36 AS |
170 | platform_device_register_simple("cs89x0", 0, edb7211_cs8900_resource, |
171 | ARRAY_SIZE(edb7211_cs8900_resource)); | |
d2168146 | 172 | platform_device_register_data(NULL, "i2c-gpio", 0, |
362168f8 AS |
173 | &edb7211_i2c_pdata, |
174 | sizeof(edb7211_i2c_pdata)); | |
200daa36 AS |
175 | } |
176 | ||
1da177e4 | 177 | MACHINE_START(EDB7211, "CL-EDB7211 (EP7211 eval board)") |
e9dea0c6 | 178 | /* Maintainer: Jon McClintock */ |
2a552891 | 179 | .atag_offset = VIDEORAM_SIZE + 0x100, |
e9dea0c6 | 180 | .fixup = fixup_edb7211, |
98c672cf | 181 | .reserve = edb7211_reserve, |
ea04dd3b | 182 | .map_io = clps711x_map_io, |
e9dea0c6 | 183 | .init_irq = clps711x_init_irq, |
6bb27d73 | 184 | .init_time = clps711x_timer_init, |
402277e0 | 185 | .init_machine = clps711x_devices_init, |
e328b880 | 186 | .init_late = edb7211_init_late, |
6c000712 | 187 | .restart = clps711x_restart, |
1da177e4 | 188 | MACHINE_END |