diff options
Diffstat (limited to 'arch/arm/mach-s3c2410/mach-h1940.c')
-rw-r--r-- | arch/arm/mach-s3c2410/mach-h1940.c | 105 |
1 files changed, 100 insertions, 5 deletions
diff --git a/arch/arm/mach-s3c2410/mach-h1940.c b/arch/arm/mach-s3c2410/mach-h1940.c index d9cd5ddecf4a..49053254c98d 100644 --- a/arch/arm/mach-s3c2410/mach-h1940.c +++ b/arch/arm/mach-s3c2410/mach-h1940.c | |||
@@ -21,6 +21,11 @@ | |||
21 | #include <linux/serial_core.h> | 21 | #include <linux/serial_core.h> |
22 | #include <linux/platform_device.h> | 22 | #include <linux/platform_device.h> |
23 | #include <linux/io.h> | 23 | #include <linux/io.h> |
24 | #include <linux/gpio.h> | ||
25 | #include <linux/pwm_backlight.h> | ||
26 | #include <video/platform_lcd.h> | ||
27 | |||
28 | #include <linux/mmc/host.h> | ||
24 | 29 | ||
25 | #include <asm/mach/arch.h> | 30 | #include <asm/mach/arch.h> |
26 | #include <asm/mach/map.h> | 31 | #include <asm/mach/map.h> |
@@ -32,9 +37,12 @@ | |||
32 | 37 | ||
33 | #include <plat/regs-serial.h> | 38 | #include <plat/regs-serial.h> |
34 | #include <mach/regs-lcd.h> | 39 | #include <mach/regs-lcd.h> |
35 | #include <mach/regs-gpio.h> | ||
36 | #include <mach/regs-clock.h> | 40 | #include <mach/regs-clock.h> |
37 | 41 | ||
42 | #include <mach/regs-gpio.h> | ||
43 | #include <mach/gpio-fns.h> | ||
44 | #include <mach/gpio-nrs.h> | ||
45 | |||
38 | #include <mach/h1940.h> | 46 | #include <mach/h1940.h> |
39 | #include <mach/h1940-latch.h> | 47 | #include <mach/h1940-latch.h> |
40 | #include <mach/fb.h> | 48 | #include <mach/fb.h> |
@@ -46,6 +54,7 @@ | |||
46 | #include <plat/cpu.h> | 54 | #include <plat/cpu.h> |
47 | #include <plat/pll.h> | 55 | #include <plat/pll.h> |
48 | #include <plat/pm.h> | 56 | #include <plat/pm.h> |
57 | #include <plat/mci.h> | ||
49 | 58 | ||
50 | static struct map_desc h1940_iodesc[] __initdata = { | 59 | static struct map_desc h1940_iodesc[] __initdata = { |
51 | [0] = { | 60 | [0] = { |
@@ -171,16 +180,90 @@ static struct s3c2410fb_mach_info h1940_fb_info __initdata = { | |||
171 | .gpdup_mask= 0xffffffff, | 180 | .gpdup_mask= 0xffffffff, |
172 | }; | 181 | }; |
173 | 182 | ||
174 | static struct platform_device s3c_device_leds = { | 183 | static struct platform_device h1940_device_leds = { |
175 | .name = "h1940-leds", | 184 | .name = "h1940-leds", |
176 | .id = -1, | 185 | .id = -1, |
177 | }; | 186 | }; |
178 | 187 | ||
179 | static struct platform_device s3c_device_bluetooth = { | 188 | static struct platform_device h1940_device_bluetooth = { |
180 | .name = "h1940-bt", | 189 | .name = "h1940-bt", |
181 | .id = -1, | 190 | .id = -1, |
182 | }; | 191 | }; |
183 | 192 | ||
193 | static struct s3c24xx_mci_pdata h1940_mmc_cfg = { | ||
194 | .gpio_detect = S3C2410_GPF(5), | ||
195 | .gpio_wprotect = S3C2410_GPH(8), | ||
196 | .set_power = NULL, | ||
197 | .ocr_avail = MMC_VDD_32_33, | ||
198 | }; | ||
199 | |||
200 | static int h1940_backlight_init(struct device *dev) | ||
201 | { | ||
202 | gpio_request(S3C2410_GPB(0), "Backlight"); | ||
203 | |||
204 | s3c2410_gpio_setpin(S3C2410_GPB(0), 0); | ||
205 | s3c2410_gpio_pullup(S3C2410_GPB(0), 0); | ||
206 | s3c2410_gpio_cfgpin(S3C2410_GPB(0), S3C2410_GPB0_TOUT0); | ||
207 | |||
208 | return 0; | ||
209 | } | ||
210 | |||
211 | static void h1940_backlight_exit(struct device *dev) | ||
212 | { | ||
213 | s3c2410_gpio_cfgpin(S3C2410_GPB(0), 1/*S3C2410_GPB0_OUTP*/); | ||
214 | } | ||
215 | |||
216 | static struct platform_pwm_backlight_data backlight_data = { | ||
217 | .pwm_id = 0, | ||
218 | .max_brightness = 100, | ||
219 | .dft_brightness = 50, | ||
220 | /* tcnt = 0x31 */ | ||
221 | .pwm_period_ns = 36296, | ||
222 | .init = h1940_backlight_init, | ||
223 | .exit = h1940_backlight_exit, | ||
224 | }; | ||
225 | |||
226 | static struct platform_device h1940_backlight = { | ||
227 | .name = "pwm-backlight", | ||
228 | .dev = { | ||
229 | .parent = &s3c_device_timer[0].dev, | ||
230 | .platform_data = &backlight_data, | ||
231 | }, | ||
232 | .id = -1, | ||
233 | }; | ||
234 | |||
235 | static void h1940_lcd_power_set(struct plat_lcd_data *pd, | ||
236 | unsigned int power) | ||
237 | { | ||
238 | int value; | ||
239 | |||
240 | if (!power) { | ||
241 | /* set to 3ec */ | ||
242 | s3c2410_gpio_setpin(S3C2410_GPC(0), 0); | ||
243 | /* wait for 3ac */ | ||
244 | do { | ||
245 | value = s3c2410_gpio_getpin(S3C2410_GPC(6)); | ||
246 | } while (value); | ||
247 | /* set to 38c */ | ||
248 | s3c2410_gpio_setpin(S3C2410_GPC(5), 0); | ||
249 | } else { | ||
250 | /* Set to 3ac */ | ||
251 | s3c2410_gpio_setpin(S3C2410_GPC(5), 1); | ||
252 | /* Set to 3ad */ | ||
253 | s3c2410_gpio_setpin(S3C2410_GPC(0), 1); | ||
254 | } | ||
255 | } | ||
256 | |||
257 | static struct plat_lcd_data h1940_lcd_power_data = { | ||
258 | .set_power = h1940_lcd_power_set, | ||
259 | }; | ||
260 | |||
261 | static struct platform_device h1940_lcd_powerdev = { | ||
262 | .name = "platform-lcd", | ||
263 | .dev.parent = &s3c_device_lcd.dev, | ||
264 | .dev.platform_data = &h1940_lcd_power_data, | ||
265 | }; | ||
266 | |||
184 | static struct platform_device *h1940_devices[] __initdata = { | 267 | static struct platform_device *h1940_devices[] __initdata = { |
185 | &s3c_device_usb, | 268 | &s3c_device_usb, |
186 | &s3c_device_lcd, | 269 | &s3c_device_lcd, |
@@ -188,8 +271,13 @@ static struct platform_device *h1940_devices[] __initdata = { | |||
188 | &s3c_device_i2c0, | 271 | &s3c_device_i2c0, |
189 | &s3c_device_iis, | 272 | &s3c_device_iis, |
190 | &s3c_device_usbgadget, | 273 | &s3c_device_usbgadget, |
191 | &s3c_device_leds, | 274 | &h1940_device_leds, |
192 | &s3c_device_bluetooth, | 275 | &h1940_device_bluetooth, |
276 | &s3c_device_sdi, | ||
277 | &s3c_device_rtc, | ||
278 | &s3c_device_timer[0], | ||
279 | &h1940_backlight, | ||
280 | &h1940_lcd_powerdev, | ||
193 | }; | 281 | }; |
194 | 282 | ||
195 | static void __init h1940_map_io(void) | 283 | static void __init h1940_map_io(void) |
@@ -219,6 +307,8 @@ static void __init h1940_init(void) | |||
219 | s3c24xx_udc_set_platdata(&h1940_udc_cfg); | 307 | s3c24xx_udc_set_platdata(&h1940_udc_cfg); |
220 | s3c_i2c0_set_platdata(NULL); | 308 | s3c_i2c0_set_platdata(NULL); |
221 | 309 | ||
310 | s3c_device_sdi.dev.platform_data = &h1940_mmc_cfg; | ||
311 | |||
222 | /* Turn off suspend on both USB ports, and switch the | 312 | /* Turn off suspend on both USB ports, and switch the |
223 | * selectable USB port to USB device mode. */ | 313 | * selectable USB port to USB device mode. */ |
224 | 314 | ||
@@ -231,6 +321,11 @@ static void __init h1940_init(void) | |||
231 | | (0x03 << S3C24XX_PLLCON_SDIVSHIFT); | 321 | | (0x03 << S3C24XX_PLLCON_SDIVSHIFT); |
232 | writel(tmp, S3C2410_UPLLCON); | 322 | writel(tmp, S3C2410_UPLLCON); |
233 | 323 | ||
324 | gpio_request(S3C2410_GPC(0), "LCD power"); | ||
325 | gpio_request(S3C2410_GPC(5), "LCD power"); | ||
326 | gpio_request(S3C2410_GPC(6), "LCD power"); | ||
327 | |||
328 | |||
234 | platform_add_devices(h1940_devices, ARRAY_SIZE(h1940_devices)); | 329 | platform_add_devices(h1940_devices, ARRAY_SIZE(h1940_devices)); |
235 | } | 330 | } |
236 | 331 | ||