From f2a655587cb722c715c9208e7ad1587d69d3e8fb Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 5 Oct 2009 14:56:25 +0200 Subject: gta02: Add glamo device --- arch/arm/mach-s3c2442/Kconfig | 1 + arch/arm/mach-s3c2442/include/mach/gta02.h | 3 + arch/arm/mach-s3c2442/mach-gta02.c | 123 +++++++++++++++++++++++++++++ 3 files changed, 127 insertions(+) diff --git a/arch/arm/mach-s3c2442/Kconfig b/arch/arm/mach-s3c2442/Kconfig index 26c14b1b835..550f6492f32 100644 --- a/arch/arm/mach-s3c2442/Kconfig +++ b/arch/arm/mach-s3c2442/Kconfig @@ -34,6 +34,7 @@ config MACH_NEO1973_GTA02 select MACH_NEO1973 select S3C2410_PWM select S3C_DEV_USB_HOST + select S3C24XX_GPIO_EXTRA64 help Say Y here if you are using the Openmoko GTA02 / Freerunner GSM Phone diff --git a/arch/arm/mach-s3c2442/include/mach/gta02.h b/arch/arm/mach-s3c2442/include/mach/gta02.h index 953331d8d56..43310a3c199 100644 --- a/arch/arm/mach-s3c2442/include/mach/gta02.h +++ b/arch/arm/mach-s3c2442/include/mach/gta02.h @@ -79,6 +79,9 @@ #define GTA02_PCB_ID2_0 S3C2410_GPD(3) #define GTA02_PCB_ID2_1 S3C2410_GPD(4) +#define GTA02_GPIO_GLAMO_BASE S3C_GPIO_END +#define GTA02_GPIO_GLAMO(x) (GTA02_GPIO_GLAMO_BASE + (x)) + int gta02_get_pcb_revision(void); #endif /* _GTA02_H */ diff --git a/arch/arm/mach-s3c2442/mach-gta02.c b/arch/arm/mach-s3c2442/mach-gta02.c index 0fb385bd9cd..8fa94ef405a 100644 --- a/arch/arm/mach-s3c2442/mach-gta02.c +++ b/arch/arm/mach-s3c2442/mach-gta02.c @@ -38,6 +38,7 @@ #include #include #include +#include #include @@ -87,6 +88,9 @@ #include #include +#include +#include + static struct pcf50633 *gta02_pcf; /* @@ -149,6 +153,124 @@ static struct s3c2410_uartcfg gta02_uartcfgs[] = { }, }; +/* + * we crank down SD Card clock dynamically when GPS is powered + */ + +static int gta02_glamo_mci_use_slow(void) +{ + return gta02_pm_gps_is_on(); +} + +static void gta02_glamo_external_reset(int level) +{ + s3c2410_gpio_setpin(GTA02_GPIO_3D_RESET, level); + s3c2410_gpio_cfgpin(GTA02_GPIO_3D_RESET, S3C2410_GPIO_OUTPUT); +} + +struct spi_gpio_platform_data spigpio_platform_data = { + .sck = GTA02_GPIO_GLAMO(10), + .mosi = GTA02_GPIO_GLAMO(11), + .miso = GTA02_GPIO_GLAMO(5), + .num_chipselect = 1, +}; + +static struct platform_device spigpio_device = { + .name = "spi_gpio", + .id = 2, + .dev = { + .platform_data = &spigpio_platform_data, + }, +}; + +static void gta02_glamo_registered(struct device *dev) +{ + spigpio_device.dev.parent = dev; + platform_device_register(&spigpio_device); +} + +static struct fb_videomode gta02_glamo_modes[] = { + { + .name = "480x640", + .xres = 480, + .yres = 640, + .pixclock = 40816, + .left_margin = 8, + .right_margin = 16, + .upper_margin = 2, + .lower_margin = 16, + .hsync_len = 8, + .vsync_len = 2, + .vmode = FB_VMODE_NONINTERLACED, + }, { + .name = "240x320", + .xres = 240, + .yres = 320, + .pixclock = 40816, + .left_margin = 8, + .right_margin = 16, + .upper_margin = 2, + .lower_margin = 16, + .hsync_len = 8, + .vsync_len = 2, + .vmode = FB_VMODE_NONINTERLACED, + } +}; + + +static struct glamo_fb_platform_data gta02_glamo_fb_pdata = { + .width = 43, + .height = 58, + + .num_modes = ARRAY_SIZE(gta02_glamo_modes), + .modes = gta02_glamo_modes, +}; + +static struct glamo_mmc_platform_data gta02_glamo_mmc_pdata = { + .glamo_mmc_use_slow = gta02_glamo_mci_use_slow, +}; + +static struct glamo_gpio_platform_data gta02_glamo_gpio_pdata = { + .base = GTA02_GPIO_GLAMO_BASE, + .registered = gta02_glamo_registered, +}; + +static struct glamo_platform_data gta02_glamo_pdata = { + .fb_data = >a02_glamo_fb_pdata, + .mmc_data = >a02_glamo_mmc_pdata, + .gpio_data = >a02_glamo_gpio_pdata, + + .osci_clock_rate = 32768, + + .glamo_external_reset = gta02_glamo_external_reset, +}; + +static struct resource gta02_glamo_resources[] = { + [0] = { + .start = S3C2410_CS1, + .end = S3C2410_CS1 + 0x1000000 - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = GTA02_IRQ_3D, + .end = GTA02_IRQ_3D, + .flags = IORESOURCE_IRQ, + }, + [2] = { + .start = GTA02_GPIO_3D_RESET, + .end = GTA02_GPIO_3D_RESET, + }, +}; + +static struct platform_device gta02_glamo_dev = { + .name = "glamo3362", + .num_resources = ARRAY_SIZE(gta02_glamo_resources), + .resource = gta02_glamo_resources, + .dev = { + .platform_data = >a02_glamo_pdata, + }, +}; + #ifdef CONFIG_CHARGER_PCF50633 /* * On GTA02 the 1A charger features a 48K resistor to 0V on the ID pin. @@ -577,6 +699,7 @@ static struct platform_device *gta02_devices[] __initdata = { static struct platform_device *gta02_devices_pmu_children[] = { >a02_bl_dev, + >a02_glamo_dev, }; -- cgit v1.2.3