From cb6d9e74582940cd5ca723f3fe28b5f300da7551 Mon Sep 17 00:00:00 2001 From: CMY Date: Sun, 1 Apr 2012 11:35:55 +0800 Subject: [PATCH] move 3g's io resource to board --- arch/arm/mach-rk30/board-rk30-sdk.c | 32 +++++++++++++++++++ arch/arm/plat-rk/include/plat/board.h | 7 ++++ drivers/misc/rk29_modem/modem_rockchip_demo.c | 29 +++++++++++------ drivers/misc/rk29_modem/rk29_modem.h | 7 +--- 4 files changed, 59 insertions(+), 16 deletions(-) diff --git a/arch/arm/mach-rk30/board-rk30-sdk.c b/arch/arm/mach-rk30/board-rk30-sdk.c index ac76af17aab2..18d4693b483a 100755 --- a/arch/arm/mach-rk30/board-rk30-sdk.c +++ b/arch/arm/mach-rk30/board-rk30-sdk.c @@ -449,6 +449,35 @@ static struct platform_device rk29_device_backlight = { #endif +#ifdef CONFIG_RK29_SUPPORT_MODEM + +#define RK30_MODEM_POWER RK30_PIN4_PD1 +#define RK30_MODEM_POWER_IOMUX rk29_mux_api_set(GPIO4D1_SMCDATA9_TRACEDATA9_NAME, GPIO4D_GPIO4D1) + +static int rk30_modem_io_init(void) +{ + printk("%s\n", __FUNCTION__); + RK30_MODEM_POWER_IOMUX; + + return 0; +} + +static struct rk29_io_t rk30_modem_io = { + .io_addr = RK30_MODEM_POWER, + .enable = GPIO_HIGH, + .disable = GPIO_LOW, + .io_init = rk30_modem_io_init, +}; + +static struct platform_device rk30_device_modem = { + .name = "rk30_modem", + .id = -1, + .dev = { + .platform_data = &rk30_modem_io, + } +}; +#endif + /*MMA8452 gsensor*/ #if defined (CONFIG_GS_MMA8452) #define MMA8452_INT_PIN RK30_PIN4_PC0 @@ -965,6 +994,9 @@ static struct platform_device *devices[] __initdata = { #ifdef CONFIG_BT &rk29sdk_rfkill, #endif +#ifdef CONFIG_RK29_SUPPORT_MODEM + &rk30_device_modem, +#endif }; // i2c diff --git a/arch/arm/plat-rk/include/plat/board.h b/arch/arm/plat-rk/include/plat/board.h index 42d7da899755..bb34d0ba5a99 100755 --- a/arch/arm/plat-rk/include/plat/board.h +++ b/arch/arm/plat-rk/include/plat/board.h @@ -32,6 +32,13 @@ struct rk29_bl_info { unsigned int delay_ms; /* in milliseconds */ }; +struct rk29_io_t { + unsigned long io_addr; + unsigned long enable; + unsigned long disable; + int (*io_init)(void); +}; + struct rk29lcd_info { u32 lcd_id; u32 txd_pin; diff --git a/drivers/misc/rk29_modem/modem_rockchip_demo.c b/drivers/misc/rk29_modem/modem_rockchip_demo.c index 47e65cfda890..0a3d5e239e87 100644 --- a/drivers/misc/rk29_modem/modem_rockchip_demo.c +++ b/drivers/misc/rk29_modem/modem_rockchip_demo.c @@ -24,21 +24,18 @@ #include "rk29_modem.h" -static struct rk29_io_t demo_io_power = { - .io_addr = RK30_PIN4_PD1, //RK29_PIN6_PB1, - .enable = GPIO_HIGH, - .disable = GPIO_LOW, -}; +static int rk30_modem_probe(struct platform_device *pdev); static struct platform_driver demo_platform_driver = { - .driver = { - .name = "rk29_demo", - }, + .probe = rk30_modem_probe, + .driver = { + .name = "rk30_modem", + }, }; static struct rk29_modem_t demo_driver = { .driver = &demo_platform_driver, - .modem_power = &demo_io_power, + .modem_power = NULL,//&demo_io_power, .ap_ready = NULL, .bp_wakeup_ap = NULL, .status = MODEM_ENABLE, @@ -52,6 +49,18 @@ static struct rk29_modem_t demo_driver = { .wakeup = NULL, }; +static int rk30_modem_probe(struct platform_device *pdev) +{ + int ret = 0; + struct rk29_io_t *rk29_io_info = pdev->dev.platform_data; + + printk("%s\n", __FUNCTION__); + demo_driver.modem_power = rk29_io_info; + demo_driver.modem_power->io_init(); + + return 0; +} + static int __init demo_init(void) { printk("%s[%d]: %s\n", __FILE__, __LINE__, __FUNCTION__); @@ -70,7 +79,7 @@ static void __exit demo_exit(void) module_init(demo_init); module_exit(demo_exit); -MODULE_AUTHOR("lintao lintao@rock-chips.com"); +MODULE_AUTHOR("lintao lintao@rock-chips.com, cmy@rock-chips.com"); MODULE_DESCRIPTION("ROCKCHIP modem driver"); MODULE_LICENSE("GPL"); diff --git a/drivers/misc/rk29_modem/rk29_modem.h b/drivers/misc/rk29_modem/rk29_modem.h index 0e5f402ca7c8..09516ec342b2 100644 --- a/drivers/misc/rk29_modem/rk29_modem.h +++ b/drivers/misc/rk29_modem/rk29_modem.h @@ -1,4 +1,5 @@ #include +#include /* Modem states */ #define MODEM_DISABLE 0 @@ -7,12 +8,6 @@ #define MODEM_WAKEUP 3 #define MODEM_MAX_STATUS 4 -struct rk29_io_t { - unsigned long io_addr; - unsigned long enable; - unsigned long disable; -}; - struct rk29_irq_t { unsigned long irq_addr; unsigned long irq_trigger; -- 2.34.1