From: Jon Hunter <jon-hunter@ti.com>
To: Afzal Mohammed <afzal@ti.com>
Cc: tony@atomide.com, linux@arm.linux.org.uk, khilman@ti.com,
balbi@ti.com, dwmw2@infradead.org, kyungmin.park@samsung.com,
gregkh@linuxfoundation.org, nm@ti.com, grinberg@compulab.co.il,
notasas@gmail.com, artem.bityutskiy@linux.intel.com,
vimal.newwork@gmail.com, dbaryshkov@gmail.com,
linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-usb@vger.kernel.org, linux-mtd@lists.infradead.org
Subject: Re: [PATCH v4 02/39] ARM: OMAP2+: gpmc: Adapt to HWMOD
Date: Tue, 1 May 2012 15:41:48 -0500 [thread overview]
Message-ID: <4FA04A8C.4050703@ti.com> (raw)
In-Reply-To: <e0cf9678cb9a44d2a16401383ab8496eb825c291.1335874494.git.afzal@ti.com>
Hi Afzal,
On 05/01/2012 07:19 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 | 52 +++++++++++++++++++++++---------
> arch/arm/plat-omap/include/plat/gpmc.h | 1 +
> 2 files changed, 38 insertions(+), 15 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
> index 12916f3..c8d07bb 100644
> --- a/arch/arm/mach-omap2/gpmc.c
> +++ b/arch/arm/mach-omap2/gpmc.c
> @@ -33,6 +33,8 @@
>
> #include <plat/sdrc.h>
>
> +#include <plat/omap_device.h>
> +
> /* GPMC register offsets */
> #define GPMC_REVISION 0x00
> #define GPMC_SYSCONFIG 0x10
> @@ -276,6 +278,31 @@ unsigned int gpmc_round_ns_to_ticks(unsigned int time_ns)
> return ticks * gpmc_get_fclk_period() / 1000;
> }
>
> +int __init omap_init_gpmc(struct gpmc_pdata *pdata)
> +{
> + struct omap_hwmod *oh;
> + struct platform_device *pdev;
> + char *name = "omap-gpmc";
> + char *oh_name = "gpmc";
> +
> + pdata->clk_prd = gpmc_get_fclk_period();
Does this need to be done here? May be this should be done in the probe
function. You could store the handle to the main clk in the pdata.
> +
> + oh = omap_hwmod_lookup(oh_name);
> + if (!oh) {
> + pr_err("Could not look up %s\n", oh_name);
> + return -ENODEV;
> + }
> +
> + pdev = omap_device_build(name, -1, oh, pdata,
> + sizeof(*pdata), NULL, 0, 0);
> + if (IS_ERR(pdev)) {
> + WARN(1, "Can't build omap_device for %s:%s.\n",
> + name, oh->name);
> + return PTR_ERR(pdev);
> + }
> +
> + return 0;
> +}
> #ifdef DEBUG
> static int set_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit,
> int time, const char *name)
> @@ -843,24 +870,19 @@ static __devinit void gpmc_mem_init(void)
>
> static int __init gpmc_init(void)
> {
> - int ret = -EINVAL;
> - char *ck = NULL;
> -
> - if (cpu_is_omap24xx()) {
> - ck = "core_l3_ck";
> - } else if (cpu_is_omap34xx()) {
> - ck = "gpmc_fck";
> - } else if (cpu_is_omap44xx()) {
> - ck = "gpmc_ck";
> - }
> + char *oh_name = "gpmc";
> + struct omap_hwmod *oh;
>
> - if (WARN_ON(!ck))
> - return ret;
> + oh = omap_hwmod_lookup(oh_name);
> + if (!oh) {
> + pr_err("Could not look up %s\n", oh_name);
> + return -ENODEV;
> + }
>
> - gpmc_l3_clk = clk_get(NULL, ck);
> + gpmc_l3_clk = clk_get(NULL, oh->main_clk);
> if (IS_ERR(gpmc_l3_clk)) {
> - printk(KERN_ERR "Could not get GPMC clock %s\n", ck);
> - BUG();
> + pr_err("error: clk_get on %s\n", oh->main_clk);
> + return -EINVAL;
> }
>
> clk_enable(gpmc_l3_clk);
I would have thought we should be able to remove the gpmc_init function
completely by now. Most of the code should be moved to the probe function.
Also now with hwmod in place, we should be able to remove the
clk_enable/disable functions and use the pm_runtime APIs instead.
Cheers
Jon
next prev parent reply other threads:[~2012-05-01 20:42 UTC|newest]
Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-01 12:19 [PATCH v4 00/39] OMAP GPMC driver conversion Afzal Mohammed
2012-05-01 12:19 ` [PATCH v4 02/39] ARM: OMAP2+: gpmc: Adapt to HWMOD Afzal Mohammed
2012-05-01 20:41 ` Jon Hunter [this message]
2012-05-03 8:37 ` Mohammed, Afzal
2012-05-04 16:30 ` Jon Hunter
2012-05-07 11:02 ` Mohammed, Afzal
[not found] ` <C8443D0743D26F4388EA172BF4E2A7A93E987159-Er742YJ7I/eIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2012-05-07 16:12 ` Jon Hunter
2012-05-08 6:24 ` Mohammed, Afzal
2012-05-08 15:13 ` Jon Hunter
[not found] ` <4FA9380F.90700-l0cyMroinI0@public.gmane.org>
2012-05-10 5:17 ` Mohammed, Afzal
2012-05-01 12:20 ` [PATCH v4 04/39] ARM: OMAP2+: gpmc: Acquire NAND CS value Afzal Mohammed
2012-05-01 21:16 ` Jon Hunter
2012-05-03 8:42 ` Mohammed, Afzal
2012-05-14 10:33 ` Mohammed, Afzal
2012-05-15 6:30 ` Thomas Weber
2012-05-15 6:37 ` Mohammed, Afzal
2012-05-25 9:50 ` Tony Lindgren
2012-05-01 12:20 ` [PATCH v4 05/39] ARM: OMAP2+: nand: create platform data structure Afzal Mohammed
2012-05-01 12:20 ` [PATCH v4 06/39] ARM: OMAP2+: onenand: return value in init function Afzal Mohammed
2012-05-01 16:49 ` Sergei Shtylyov
2012-05-03 8:54 ` Mohammed, Afzal
2012-05-01 12:20 ` [PATCH v4 08/39] ARM: OMAP2+: gpmc-onenand: Adapt to use gpmc driver Afzal Mohammed
2012-05-01 12:20 ` [PATCH v4 10/39] ARM: OMAP2+: gpmc-smsc911x: " Afzal Mohammed
2012-05-01 12:20 ` [PATCH v4 11/39] ARM: OMAP2+: gpmc-smc91x: " Afzal Mohammed
2012-05-01 12:21 ` [PATCH v4 12/39] ARM: OMAP2+: gpmc-tusb6010: Adapt to " Afzal Mohammed
2012-05-01 12:21 ` [PATCH v4 13/39] ARM: OMAP3: hwmod data: add gpmc Afzal Mohammed
[not found] ` <1d1a0ae293834061a15f1b19f903b81bfa01befc.1335874494.git.afzal-l0cyMroinI0@public.gmane.org>
2012-05-06 2:09 ` Paul Walmsley
2012-05-01 12:21 ` [PATCH v4 14/39] ARM: OMAP2xxx: " Afzal Mohammed
2012-05-06 2:09 ` Paul Walmsley
2012-05-01 12:21 ` [PATCH v4 17/39] mtd: nand: omap2: handle nand on gpmc Afzal Mohammed
2012-05-01 12:21 ` [PATCH v4 19/39] ARM: OMAP2+: board omap3evm: gpmc driver adaptation Afzal Mohammed
[not found] ` <cover.1335874494.git.afzal-l0cyMroinI0@public.gmane.org>
2012-05-01 12:19 ` [PATCH v4 01/39] ARM: OMAP2+: gpmc: driver conversion Afzal Mohammed
[not found] ` <363273a9ef82d6836197929157aa9a8eb8f5171a.1335874494.git.afzal-l0cyMroinI0@public.gmane.org>
2012-05-01 17:53 ` Jon Hunter
[not found] ` <4FA022FC.5040703-l0cyMroinI0@public.gmane.org>
2012-05-03 8:23 ` Mohammed, Afzal
[not found] ` <C8443D0743D26F4388EA172BF4E2A7A93E982967-Er742YJ7I/eIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2012-05-04 16:20 ` Jon Hunter
2012-05-07 10:57 ` Mohammed, Afzal
2012-05-07 16:23 ` Jon Hunter
2012-05-08 6:27 ` Mohammed, Afzal
2012-05-04 16:27 ` Jon Hunter
[not found] ` <4FA4035E.6020308-l0cyMroinI0@public.gmane.org>
2012-05-07 11:01 ` Mohammed, Afzal
2012-05-07 16:02 ` Jon Hunter
2012-05-08 6:18 ` Mohammed, Afzal
[not found] ` <C8443D0743D26F4388EA172BF4E2A7A93E9878EC-Er742YJ7I/eIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2012-05-08 15:08 ` Jon Hunter
2012-05-10 5:10 ` Mohammed, Afzal
2012-05-01 12:19 ` [PATCH v4 03/39] ARM: OMAP2+: gpmc: register details for nand driver Afzal Mohammed
2012-05-01 12:20 ` [PATCH v4 07/39] ARM: OMAP2+: gpmc-nand: Adapt to use gpmc driver Afzal Mohammed
2012-05-01 12:20 ` [PATCH v4 09/39] ARM: OMAP2+: flash: Adapt to " Afzal Mohammed
2012-05-01 12:21 ` [PATCH v4 15/39] mtd: nand: omap2: obtain memory from resource Afzal Mohammed
2012-05-01 12:21 ` [PATCH v4 16/39] mtd: nand: omap2: use gpmc provided irqs Afzal Mohammed
2012-05-01 12:21 ` [PATCH v4 18/39] mtd: onenand: omap: obtain memory from resource Afzal Mohammed
2012-05-01 12:21 ` [PATCH v4 20/39] ARM: OMAP2+: board omap3beagle: gpmc driver adaptation Afzal Mohammed
2012-05-01 12:22 ` [PATCH v4 21/39] ARM: OMAP2+: board apollon: " Afzal Mohammed
2012-05-01 12:22 ` [PATCH v4 22/39] ARM: OMAP2+: board h4: " Afzal Mohammed
2012-05-01 12:22 ` [PATCH v4 28/39] ARM: OMAP2+: board ldp: " Afzal Mohammed
2012-05-01 12:22 ` [PATCH v4 29/39] ARM: OMAP2+: board n8x0: " Afzal Mohammed
2012-05-01 12:23 ` [PATCH v4 30/39] ARM: OMAP2+: board omap3logic: " Afzal Mohammed
2012-05-01 12:23 ` [PATCH v4 34/39] ARM: OMAP2+: board overo: " Afzal Mohammed
2012-05-08 11:27 ` [PATCH v4 00/39] OMAP GPMC driver conversion Mohammed, Afzal
2012-05-01 12:22 ` [PATCH v4 23/39] ARM: OMAP2+: board 3630sdp: gpmc driver adaptation Afzal Mohammed
2012-05-01 12:22 ` [PATCH v4 24/39] ARM: OMAP2+: board 3430sdp: " Afzal Mohammed
2012-05-01 12:22 ` [PATCH v4 25/39] ARM: OMAP2+: board 2430sdp: " Afzal Mohammed
2012-05-01 12:22 ` [PATCH v4 26/39] ARM: OMAP2+: board cm-t3517: " Afzal Mohammed
2012-05-01 12:22 ` [PATCH v4 27/39] ARM: OMAP2+: board cm-t35: " Afzal Mohammed
2012-05-01 12:23 ` [PATCH v4 31/39] ARM: OMAP2+: board omap3pandora: " Afzal Mohammed
2012-05-01 12:23 ` [PATCH v4 32/39] ARM: OMAP2+: board omap3stalker: " Afzal Mohammed
2012-05-01 12:23 ` [PATCH v4 33/39] ARM: OMAP2+: board omap4pcm049: " Afzal Mohammed
2012-05-01 12:23 ` [PATCH v4 35/39] ARM: OMAP2+: board rm680: " Afzal Mohammed
2012-05-01 12:23 ` [PATCH v4 36/39] ARM: OMAP2+: board rx51: " Afzal Mohammed
2012-05-01 12:23 ` [PATCH v4 37/39] ARM: OMAP2+: board zoom-debugboard: " Afzal Mohammed
2012-05-01 12:23 ` [PATCH v4 38/39] OMAP3: igep0020: Add support for Micron NAND Flash storage memory Afzal Mohammed
2012-05-01 12:23 ` [PATCH v4 39/39] ARM: OMAP2+: board igep0020: gpmc driver adaptation Afzal Mohammed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4FA04A8C.4050703@ti.com \
--to=jon-hunter@ti.com \
--cc=afzal@ti.com \
--cc=artem.bityutskiy@linux.intel.com \
--cc=balbi@ti.com \
--cc=dbaryshkov@gmail.com \
--cc=dwmw2@infradead.org \
--cc=gregkh@linuxfoundation.org \
--cc=grinberg@compulab.co.il \
--cc=khilman@ti.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=nm@ti.com \
--cc=notasas@gmail.com \
--cc=tony@atomide.com \
--cc=vimal.newwork@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).