diff options
author | Kumar Sanghvi <kumar.sanghvi@stericsson.com> | 2011-05-16 21:00:49 +0530 |
---|---|---|
committer | Robert Marklund <robert.marklund@stericsson.com> | 2011-10-05 12:17:29 +0200 |
commit | 88c4c58a74c5b36bf1a35ecc783027ee8d71e5e1 (patch) | |
tree | bca607bed44ef88e0392a092e9d70fb822f7ce0d | |
parent | 5e24d77148fcaca55864b508cd6019c807527557 (diff) |
drivers: modem: Add modem access driver for STE U8500
Adds platform driver which implements mechanism for accessing
modem on STE U8500 platform which uses Shared Memory for
communicating between Modem and Application processor.
The driver also registers itself with the Modem Access framework.
ST-Ericsson ID: CR329459
Change-Id: Id5bc18f6f974b026f9be2d3e2756e03417e01e07
Signed-off-by: Kumar Sanghvi <kumar.sanghvi@stericsson.com>
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/23554
Reviewed-by: QATEST
Reviewed-by: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
-rw-r--r-- | arch/arm/mach-ux500/board-mop500.c | 13 | ||||
-rw-r--r-- | drivers/modem/Kconfig | 19 | ||||
-rw-r--r-- | drivers/modem/Makefile | 3 | ||||
-rw-r--r-- | drivers/modem/modem_u8500.c | 94 |
4 files changed, 125 insertions, 4 deletions
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c index 2e7a2a4639b..ce303bbabec 100644 --- a/arch/arm/mach-ux500/board-mop500.c +++ b/arch/arm/mach-ux500/board-mop500.c @@ -231,6 +231,16 @@ static struct platform_device snowball_sbnet_dev = { }, }; +#ifdef CONFIG_MODEM_U8500 +static struct platform_device u8500_modem_dev = { + .name = "u8500-modem", + .id = 0, + .dev = { + .platform_data = NULL, + }, +}; +#endif + static struct ab8500_platform_data ab8500_platdata = { .irq_base = MOP500_AB8500_IRQ_BASE, .regulator_reg_init = ab8500_regulator_reg_init, @@ -672,6 +682,9 @@ static struct platform_device *mop500_platform_devs[] __initdata = { #ifdef CONFIG_HSI &u8500_hsi_device, #endif +#ifdef CONFIG_MODEM_U8500 + &u8500_modem_dev, +#endif }; /* diff --git a/drivers/modem/Kconfig b/drivers/modem/Kconfig index 000181cdb3d..a23b5c90e5e 100644 --- a/drivers/modem/Kconfig +++ b/drivers/modem/Kconfig @@ -2,6 +2,19 @@ config MODEM bool "Modem Access Framework" default n help - Add support for Modem Access Framework. It allows different - platform specific drivers to register modem access mechanisms - and allows transparent access to modem to the client drivers. + Add support for Modem Access Framework. It allows different + platform specific drivers to register modem access mechanisms + and allows transparent access to modem to the client drivers. + + If unsure, say N. + +config MODEM_U8500 + bool "Modem Access driver for STE U8500 platform" + depends on MODEM + default n + help + Add support for Modem Access driver on STE U8500 platform which + uses Shared Memroy as IPC mechanism between Modem processor and + Application processor. + + If unsure, say N. diff --git a/drivers/modem/Makefile b/drivers/modem/Makefile index 0526714bebd..57b50916c79 100644 --- a/drivers/modem/Makefile +++ b/drivers/modem/Makefile @@ -1,2 +1,3 @@ -obj-$(CONFIG_MODEM) := modem_access.o +obj-$(CONFIG_MODEM) := modem_access.o +obj-$(CONFIG_MODEM_U8500) += modem_u8500.o diff --git a/drivers/modem/modem_u8500.c b/drivers/modem/modem_u8500.c new file mode 100644 index 00000000000..20b5fe78ef7 --- /dev/null +++ b/drivers/modem/modem_u8500.c @@ -0,0 +1,94 @@ +/* + * Copyright (C) ST-Ericsson SA 2011 + * + * License Terms: GNU General Public License v2 + * Author: Kumar Sanghvi <kumar.sanghvi@stericsson.com> + * + * Platform driver implementing access mechanisms to modem + * on U8500 which uses Shared Memroy as IPC between Application + * Processor and Modem processor. + */ +#include <linux/modem/modem.h> +#include <linux/platform_device.h> +#include <linux/err.h> +#include <mach/prcmu.h> + +static void u8500_modem_request(struct modem_dev *mdev) +{ + prcmu_ac_wake_req(); +} + +static void u8500_modem_release(struct modem_dev *mdev) +{ + prcmu_ac_sleep_req(); +} + +static int u8500_modem_is_requested(struct modem_dev *mdev) +{ + return prcmu_is_ac_wake_requested(); +} + +static struct modem_ops u8500_modem_ops = { + .request = u8500_modem_request, + .release = u8500_modem_release, + .is_requested = u8500_modem_is_requested, +}; + +static struct modem_desc u8500_modem_desc = { + .name = "u8500-shrm-modem", + .id = 0, + .ops = &u8500_modem_ops, + .owner = THIS_MODULE, +}; + + +static int __devinit u8500_modem_probe(struct platform_device *pdev) +{ + struct modem_dev *mdev; + int err; + + mdev = modem_register(&u8500_modem_desc, &pdev->dev, + NULL); + if (IS_ERR(mdev)) { + err = PTR_ERR(mdev); + pr_err("failed to register %s: err %i\n", + u8500_modem_desc.name, err); + } + + return 0; +} + +static int __devexit u8500_modem_remove(struct platform_device *pdev) +{ + + return 0; +} + +static struct platform_driver u8500_modem_driver = { + .driver = { + .name = "u8500-modem", + .owner = THIS_MODULE, + }, + .probe = u8500_modem_probe, + .remove = __devexit_p(u8500_modem_remove), +}; + +static int __init u8500_modem_init(void) +{ + int ret; + + ret = platform_driver_register(&u8500_modem_driver); + if (ret < 0) { + printk(KERN_ERR "u8500_modem: platform driver reg failed\n"); + return -ENODEV; + } + + return 0; +} + +static void __exit u8500_modem_exit(void) +{ + platform_driver_unregister(&u8500_modem_driver); +} + +arch_initcall(u8500_modem_init); |