diff options
-rw-r--r-- | arch/arm/mach-omap2/ssi.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/arch/arm/mach-omap2/ssi.c b/arch/arm/mach-omap2/ssi.c index adf342dd20c7..6f751c366455 100644 --- a/arch/arm/mach-omap2/ssi.c +++ b/arch/arm/mach-omap2/ssi.c @@ -26,6 +26,8 @@ #include <linux/gpio.h> #include <linux/platform_device.h> #include <linux/platform_data/hsi-omap-ssi.h> +#include "omap_hwmod.h" +#include "omap_device.h" #include "omap-pm.h" static struct omap_ssi_platform_data ssi_pdata = { @@ -34,14 +36,6 @@ static struct omap_ssi_platform_data ssi_pdata = { .get_dev_context_loss_count = omap_pm_get_dev_context_loss_count, }; -static struct platform_device ssi_pdev = { - .name = "omap_ssi", - .id = 0, - .dev = { - .platform_data = &ssi_pdata, - }, -}; - int __init omap_ssi_config(struct omap_ssi_board_config *ssi_config) { unsigned int port, offset, cawake_gpio; @@ -64,15 +58,25 @@ int __init omap_ssi_config(struct omap_ssi_board_config *ssi_config) return 0; rback: - dev_err(&ssi_pdev.dev, "Request cawake (gpio%d) failed\n", cawake_gpio); + pr_err("omap-ssi: Request cawake (gpio%d) failed\n", cawake_gpio); while (port > 0) gpio_free(ssi_config->cawake_gpio[--port]); return err; } -static int __init ssi_init(void) +static int __init omap_ssi_init(void) { - return platform_device_register(&ssi_pdev); + struct omap_hwmod *oh; + struct platform_device *pdev; + + oh = omap_hwmod_lookup("ssi"); + if (!oh) + return -EINVAL; + + pdev = omap_device_build("omap_ssi", -1, oh, &ssi_pdata, sizeof(struct omap_ssi_platform_data)); + WARN(IS_ERR(pdev), "Can't build omap_device for omap_ssi\n"); + + return 0; } -subsys_initcall(ssi_init); +subsys_initcall(omap_ssi_init); |