From 3a242b3d5130f55bb857dd319da895b19159e513 Mon Sep 17 00:00:00 2001 From: lars Date: Thu, 30 Jul 2009 12:04:01 +0000 Subject: [s3c24xx] glamo: Implement gpiolib for the glamo. Get rid of glamo-spi-gpio and use the generic spi-gpio driver instead. git-svn-id: svn://svn.openwrt.org/openwrt/trunk@17048 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../arch/arm/mach-s3c2442/include/mach/gta02.h | 4 + .../arch/arm/mach-s3c2442/mach-gta02.c | 87 ++++++++++++++++------ 2 files changed, 70 insertions(+), 21 deletions(-) (limited to 'target/linux/s3c24xx/files-2.6.30/arch/arm') diff --git a/target/linux/s3c24xx/files-2.6.30/arch/arm/mach-s3c2442/include/mach/gta02.h b/target/linux/s3c24xx/files-2.6.30/arch/arm/mach-s3c2442/include/mach/gta02.h index d8d9d9053..3d7606e9b 100644 --- a/target/linux/s3c24xx/files-2.6.30/arch/arm/mach-s3c2442/include/mach/gta02.h +++ b/target/linux/s3c24xx/files-2.6.30/arch/arm/mach-s3c2442/include/mach/gta02.h @@ -2,6 +2,7 @@ #define _GTA02_H #include +#include #include /* Different hardware revisions, passed in ATAG_REVISION by u-boot */ @@ -78,6 +79,9 @@ #define GTA02_PCB_ID2_0 S3C2410_GPD3 #define GTA02_PCB_ID2_1 S3C2410_GPD4 +#define GTA02_GPIO_GLAMO_BASE S3C_GPIO_END +#define GTA02_GPIO_GLAMO(x) (GTA02_GPIO_GLAMO_BASE + x) + int gta02_get_pcb_revision(void); extern struct pcf50633 *gta02_pcf; diff --git a/target/linux/s3c24xx/files-2.6.30/arch/arm/mach-s3c2442/mach-gta02.c b/target/linux/s3c24xx/files-2.6.30/arch/arm/mach-s3c2442/mach-gta02.c index 64b6b0d2e..30405ad80 100644 --- a/target/linux/s3c24xx/files-2.6.30/arch/arm/mach-s3c2442/mach-gta02.c +++ b/target/linux/s3c24xx/files-2.6.30/arch/arm/mach-s3c2442/mach-gta02.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -74,7 +75,6 @@ #include #include #include -#include #include #include @@ -97,7 +97,6 @@ #include #include #include -#include #include #include @@ -1081,7 +1080,7 @@ static struct platform_device gta02_bl_dev = { static void gta02_jbt6k74_reset(int devidx, int level) { - glamo_lcm_reset(>a02_glamo_dev, level); + gpio_set_value(GTA02_GPIO_GLAMO(4), level); } static void gta02_jbt6k74_probe_completed(struct device *dev) @@ -1160,13 +1159,12 @@ struct lis302dl_platform_data lis302_pdata_bottom = { static struct spi_board_info gta02_spi_board_info[] = { { .modalias = "jbt6k74", - /* platform_data */ .platform_data = &jbt6k74_pdata, - /* controller_data */ + .controller_data = (void*)GTA02_GPIO_GLAMO(12), /* irq */ .max_speed_hz = 100 * 1000, .bus_num = 2, - /* chip_select */ + .chip_select = 0 }, { .modalias = "lis302dl", @@ -1363,6 +1361,35 @@ static void gta02_glamo_external_reset(int level) s3c2410_gpio_cfgpin(GTA02_GPIO_3D_RESET, S3C2410_GPIO_OUTPUT); } +/* +static struct fb_videomode gta02_glamo_modes[] = { + { + .name = "480x640", + .xres = 480, + .yres = 640, + .pixclock = 40816, + .left_margin = 8, + .right_margin = 63, + .upper_margin = 2, + .lower_margin = 4, + .hsync_len = 8, + .vsync_len = 2, + .vmode = FB_VMODE_NONINTERLACED, + }, { + .name = "240x320", + .xres = 240, + .yres = 320, + .pixclock = 40816, + .left_margin = 8, + .right_margin = 88, + .upper_margin = 2, + .lower_margin = 2, + .hsync_len = 8, + .vsync_len = 2, + .vmode = FB_VMODE_NONINTERLACED, + } +};*/ + static struct fb_videomode gta02_glamo_modes[] = { { .name = "480x640", @@ -1391,6 +1418,7 @@ static struct fb_videomode gta02_glamo_modes[] = { } }; + static struct glamo_fb_platform_data gta02_glamo_fb_pdata = { .width = 43, .height = 58, @@ -1399,22 +1427,14 @@ static struct glamo_fb_platform_data gta02_glamo_fb_pdata = { .modes = gta02_glamo_modes, }; -static struct glamo_spigpio_platform_data gta02_glamo_spigpio_pdata = { - .pin_clk = GLAMO_GPIO10_OUTPUT, - .pin_mosi = GLAMO_GPIO11_OUTPUT, - .pin_cs = GLAMO_GPIO12_OUTPUT, - .pin_miso = 0, - .bus_num = 2, -}; - static struct glamo_mmc_platform_data gta02_glamo_mmc_pdata = { .glamo_mmc_use_slow = gta02_glamo_mci_use_slow, }; static struct glamo_platform_data gta02_glamo_pdata = { - .fb_data = >a02_glamo_fb_pdata, - .spigpio_data = >a02_glamo_spigpio_pdata, - .mmc_data = >a02_glamo_mmc_pdata, + .fb_data = >a02_glamo_fb_pdata, + .mmc_data = >a02_glamo_mmc_pdata, + .gpio_base = GTA02_GPIO_GLAMO_BASE, .osci_clock_rate = 32768, @@ -1472,6 +1492,22 @@ static void mangle_glamo_res_by_system_rev(void) } } +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, + .parent = >a02_glamo_dev.dev, + }, +}; + static void __init gta02_map_io(void) { s3c24xx_init_io(gta02_iodesc, ARRAY_SIZE(gta02_iodesc)); @@ -1519,7 +1555,6 @@ static struct platform_device *gta02_devices[] __initdata = { &s3c24xx_pwm_device, >a02_led_dev, >a02_pm_wlan_dev, /* not dependent on PMU */ - &s3c_device_iis, &s3c_device_i2c0, }; @@ -1535,6 +1570,15 @@ static struct platform_device *gta02_devices_pmu_children[] = { >a02_resume_reason_device, }; +static void gta02_register_glamo() { + platform_device_register(>a02_glamo_dev); + if (!gpio_request(GTA02_GPIO_GLAMO(4), "jbt6k74 reset")) + printk("gta02: Failed to request jbt6k74 reset pin\n"); + if (!gpio_direction_output(GTA02_GPIO_GLAMO(4), 1)) + printk("gta02: Failed to configure jbt6k74 reset pin\n"); + platform_device_register(&spigpio_device); +} + static void gta02_pmu_regulator_registered(struct pcf50633 *pcf, int id) { struct platform_device *regulator, *pdev; @@ -1551,8 +1595,8 @@ static void gta02_pmu_regulator_registered(struct pcf50633 *pcf, int id) pdev = >a02_pm_gps_dev; break; case PCF50633_REGULATOR_HCLDO: - pdev = >a02_glamo_dev; - break; + gta02_register_glamo(); + return; default: return; } @@ -1628,10 +1672,11 @@ static void __init gta02_machine_init(void) s3c2410_gpio_setpin(S3C2410_GPD13, 1); s3c2410_gpio_cfgpin(S3C2410_GPD13, S3C2410_GPIO_OUTPUT); + s3c24xx_udc_set_platdata(>a02_udc_cfg); s3c_i2c0_set_platdata(NULL); set_s3c2410ts_info(>a02_ts_cfg); - + mangle_glamo_res_by_system_rev(); i2c_register_board_info(0, gta02_i2c_devs, ARRAY_SIZE(gta02_i2c_devs)); -- cgit v1.2.3