Message ID | c14607ff57fca419dc9d7e0beaea197e001f4e25.1346846464.git.afzal@ti.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Afzal, On 09/05/2012 07:37 AM, Afzal Mohammed wrote: > Create API for platforms to adapt GPMC to HWMOD > > Signed-off-by: Afzal Mohammed <afzal@ti.com> > --- > arch/arm/mach-omap2/gpmc.c | 26 ++++++++++++++++++++++++++ > 1 files changed, 26 insertions(+), 0 deletions(-) > > diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c > index dbc1ebc..c45f185 100644 > --- a/arch/arm/mach-omap2/gpmc.c > +++ b/arch/arm/mach-omap2/gpmc.c > @@ -29,11 +29,14 @@ > > #include <plat/gpmc.h> > #include <plat/sdrc.h> > +#include <plat/omap_device.h> > > #include "soc.h" > > #include "common.h" > > +#define DEVICE_NAME "omap-gpmc" > + > /* GPMC register offsets */ > #define GPMC_REVISION 0x00 > #define GPMC_SYSCONFIG 0x10 > @@ -897,6 +900,29 @@ static int __init gpmc_init(void) > } > postcore_initcall(gpmc_init); > > +static int __init omap_gpmc_init(void) > +{ > + struct omap_hwmod *oh; > + struct platform_device *pdev; > + char *oh_name = "gpmc"; > + > + oh = omap_hwmod_lookup(oh_name); > + if (!oh) { > + pr_err("Could not look up %s\n", oh_name); > + return -ENODEV; > + } > + > + pdev = omap_device_build(DEVICE_NAME, -1, oh, NULL, 0, NULL, 0, 0); > + if (IS_ERR(pdev)) { > + WARN(1, "Can't build omap_device for %s:%s.\n", > + DEVICE_NAME, oh->name); > + return PTR_ERR(pdev); > + } > + > + return 0; Nit-pick, I see some devices writing the above as ... WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name); return IS_ERR(pdev) ? PTR_ERR(pdev) : 0; > +} > +postcore_initcall(omap_gpmc_init); > + > static irqreturn_t gpmc_handle_irq(int irq, void *dev) > { > int i; > Otherwise ... Reviewed-by: Jon Hunter <jon-hunter@ti.com> Cheers Jon -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Jon, On Thu, Sep 06, 2012 at 01:25:23, Hunter, Jon wrote: > Nit-pick, I see some devices writing the above as ... > > WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name); > > return IS_ERR(pdev) ? PTR_ERR(pdev) : 0; > Otherwise ... > > Reviewed-by: Jon Hunter <jon-hunter@ti.com> Thanks for your reviews, updated series has been posted Regards Afzal
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c index dbc1ebc..c45f185 100644 --- a/arch/arm/mach-omap2/gpmc.c +++ b/arch/arm/mach-omap2/gpmc.c @@ -29,11 +29,14 @@ #include <plat/gpmc.h> #include <plat/sdrc.h> +#include <plat/omap_device.h> #include "soc.h" #include "common.h" +#define DEVICE_NAME "omap-gpmc" + /* GPMC register offsets */ #define GPMC_REVISION 0x00 #define GPMC_SYSCONFIG 0x10 @@ -897,6 +900,29 @@ static int __init gpmc_init(void) } postcore_initcall(gpmc_init); +static int __init omap_gpmc_init(void) +{ + struct omap_hwmod *oh; + struct platform_device *pdev; + char *oh_name = "gpmc"; + + oh = omap_hwmod_lookup(oh_name); + if (!oh) { + pr_err("Could not look up %s\n", oh_name); + return -ENODEV; + } + + pdev = omap_device_build(DEVICE_NAME, -1, oh, NULL, 0, NULL, 0, 0); + if (IS_ERR(pdev)) { + WARN(1, "Can't build omap_device for %s:%s.\n", + DEVICE_NAME, oh->name); + return PTR_ERR(pdev); + } + + return 0; +} +postcore_initcall(omap_gpmc_init); + static irqreturn_t gpmc_handle_irq(int irq, void *dev) { int i;
Create API for platforms to adapt GPMC to HWMOD Signed-off-by: Afzal Mohammed <afzal@ti.com> --- arch/arm/mach-omap2/gpmc.c | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+), 0 deletions(-)