From: Sascha Hauer <s.hauer@pengutronix.de> To: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Arnd Bergmann <arnd@arndb.de>, viresh kumar <viresh.kumar@st.com>, Shawn Guo <shawn.guo@linaro.org>, Ryan Mallon <ryan@bluewatersys.com>, Sascha Hauer <s.hauer@pengutronix.de> Subject: [PATCH 2/3] ARM mxs: adjust pwm resources to what the driver expects Date: Thu, 30 Jun 2011 12:41:56 +0200 [thread overview] Message-ID: <1309430517-23821-3-git-send-email-s.hauer@pengutronix.de> (raw) In-Reply-To: <1309430517-23821-1-git-send-email-s.hauer@pengutronix.de> The PWMs on i.MX23/28 have almost seperated register spaces but share a common enable register. To reflect this register a parent device to the PWMs which handles the enable register. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- arch/arm/mach-mxs/devices/platform-mxs-pwm.c | 32 +++++++++++++++++++++++-- 1 files changed, 29 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-mxs/devices/platform-mxs-pwm.c b/arch/arm/mach-mxs/devices/platform-mxs-pwm.c index 680f5a9..36580b7 100644 --- a/arch/arm/mach-mxs/devices/platform-mxs-pwm.c +++ b/arch/arm/mach-mxs/devices/platform-mxs-pwm.c @@ -9,14 +9,40 @@ #include <asm/sizes.h> #include <mach/devices-common.h> +static struct platform_device *__init mxs_add_pwm_core(resource_size_t iobase) +{ + struct resource res = { + .flags = IORESOURCE_MEM, + .start = iobase, + .end = iobase + 0xff, + }; + + return mxs_add_platform_device("mxs-pwm-core", 0, &res, 1, NULL, 0); +} + struct platform_device *__init mxs_add_mxs_pwm(resource_size_t iobase, int id) { + struct resource *r; + + static struct platform_device *pwm_core; struct resource res = { .flags = IORESOURCE_MEM, + .start = iobase + 0x10 + 0x20 * id, + .end = iobase + 0x10 + 0x20 * id + 0x1f, }; - res.start = iobase + 0x10 + 0x20 * id; - res.end = res.start + 0x1f; + if (!pwm_core) { + pwm_core = mxs_add_pwm_core(iobase); + if (!pwm_core) + return NULL; + } + + r = platform_get_resource(pwm_core, IORESOURCE_MEM, 0); + if (!r) + return NULL; + + res.parent = r; - return mxs_add_platform_device("mxs-pwm", id, &res, 1, NULL, 0); + return platform_device_register_resndata(&pwm_core->dev, "mxs-pwm", + id, &res, 1, NULL, 0); } -- 1.7.5.3
WARNING: multiple messages have this Message-ID (diff)
From: s.hauer@pengutronix.de (Sascha Hauer) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/3] ARM mxs: adjust pwm resources to what the driver expects Date: Thu, 30 Jun 2011 12:41:56 +0200 [thread overview] Message-ID: <1309430517-23821-3-git-send-email-s.hauer@pengutronix.de> (raw) In-Reply-To: <1309430517-23821-1-git-send-email-s.hauer@pengutronix.de> The PWMs on i.MX23/28 have almost seperated register spaces but share a common enable register. To reflect this register a parent device to the PWMs which handles the enable register. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- arch/arm/mach-mxs/devices/platform-mxs-pwm.c | 32 +++++++++++++++++++++++-- 1 files changed, 29 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-mxs/devices/platform-mxs-pwm.c b/arch/arm/mach-mxs/devices/platform-mxs-pwm.c index 680f5a9..36580b7 100644 --- a/arch/arm/mach-mxs/devices/platform-mxs-pwm.c +++ b/arch/arm/mach-mxs/devices/platform-mxs-pwm.c @@ -9,14 +9,40 @@ #include <asm/sizes.h> #include <mach/devices-common.h> +static struct platform_device *__init mxs_add_pwm_core(resource_size_t iobase) +{ + struct resource res = { + .flags = IORESOURCE_MEM, + .start = iobase, + .end = iobase + 0xff, + }; + + return mxs_add_platform_device("mxs-pwm-core", 0, &res, 1, NULL, 0); +} + struct platform_device *__init mxs_add_mxs_pwm(resource_size_t iobase, int id) { + struct resource *r; + + static struct platform_device *pwm_core; struct resource res = { .flags = IORESOURCE_MEM, + .start = iobase + 0x10 + 0x20 * id, + .end = iobase + 0x10 + 0x20 * id + 0x1f, }; - res.start = iobase + 0x10 + 0x20 * id; - res.end = res.start + 0x1f; + if (!pwm_core) { + pwm_core = mxs_add_pwm_core(iobase); + if (!pwm_core) + return NULL; + } + + r = platform_get_resource(pwm_core, IORESOURCE_MEM, 0); + if (!r) + return NULL; + + res.parent = r; - return mxs_add_platform_device("mxs-pwm", id, &res, 1, NULL, 0); + return platform_device_register_resndata(&pwm_core->dev, "mxs-pwm", + id, &res, 1, NULL, 0); } -- 1.7.5.3
next prev parent reply other threads:[~2011-06-30 10:42 UTC|newest] Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-06-30 10:41 [PATCH v3] implement a generic PWM framework Sascha Hauer 2011-06-30 10:41 ` Sascha Hauer 2011-06-30 10:41 ` [PATCH 1/3] PWM: add pwm framework support Sascha Hauer 2011-06-30 10:41 ` Sascha Hauer 2011-06-30 11:07 ` Bill Gatliff 2011-06-30 11:07 ` Bill Gatliff 2011-06-30 12:41 ` Arnd Bergmann 2011-06-30 12:41 ` Arnd Bergmann 2011-06-30 16:17 ` Bill Gatliff 2011-06-30 16:17 ` Bill Gatliff 2011-06-30 17:02 ` Sascha Hauer 2011-06-30 17:02 ` Sascha Hauer 2011-06-30 19:45 ` Bill Gatliff 2011-06-30 19:45 ` Bill Gatliff 2011-06-30 23:24 ` Ryan Mallon 2011-06-30 23:24 ` Ryan Mallon 2011-07-01 0:33 ` H Hartley Sweeten 2011-07-01 0:33 ` H Hartley Sweeten 2011-07-01 0:55 ` Mike Frysinger 2011-07-01 0:55 ` Mike Frysinger 2011-07-01 7:37 ` Sascha Hauer 2011-07-01 7:37 ` Sascha Hauer 2011-07-01 8:28 ` Ryan Mallon 2011-07-01 8:28 ` Ryan Mallon 2011-07-01 8:54 ` Sascha Hauer 2011-07-01 8:54 ` Sascha Hauer 2011-07-02 0:40 ` Ryan Mallon 2011-07-02 0:40 ` Ryan Mallon 2011-07-04 7:55 ` Sascha Hauer 2011-07-04 7:55 ` Sascha Hauer 2011-07-04 8:50 ` Dmitry Eremin-Solenikov 2011-07-04 10:43 ` Ryan Mallon 2011-07-04 10:43 ` Ryan Mallon 2011-07-04 11:05 ` Kurt Van Dijck 2011-07-04 13:53 ` Arnd Bergmann 2011-07-04 13:53 ` Arnd Bergmann 2011-07-04 14:19 ` Kurt Van Dijck 2011-07-04 12:43 ` Sascha Hauer 2011-07-04 12:43 ` Sascha Hauer 2011-07-04 14:07 ` Arnd Bergmann 2011-07-04 14:07 ` Arnd Bergmann 2011-12-07 8:53 ` Thierry Reding 2011-12-07 8:53 ` Thierry Reding 2011-12-07 9:07 ` Sascha Hauer 2011-12-07 9:07 ` Sascha Hauer 2011-12-14 10:03 ` Thierry Reding 2011-12-14 10:03 ` Thierry Reding 2011-12-14 11:37 ` Sascha Hauer 2011-12-14 11:37 ` Sascha Hauer 2011-07-01 9:49 ` Dmitry Eremin-Solenikov 2011-06-30 10:41 ` Sascha Hauer [this message] 2011-06-30 10:41 ` [PATCH 2/3] ARM mxs: adjust pwm resources to what the driver expects Sascha Hauer 2011-06-30 11:30 ` Arnd Bergmann 2011-06-30 11:30 ` Arnd Bergmann 2011-06-30 10:41 ` [PATCH 3/3] pwm: Add a i.MX23/28 pwm driver Sascha Hauer 2011-06-30 10:41 ` Sascha Hauer 2011-06-30 11:42 ` Arnd Bergmann 2011-06-30 11:42 ` Arnd Bergmann 2011-06-30 15:11 ` Sascha Hauer 2011-06-30 15:11 ` Sascha Hauer
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=1309430517-23821-3-git-send-email-s.hauer@pengutronix.de \ --to=s.hauer@pengutronix.de \ --cc=arnd@arndb.de \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=ryan@bluewatersys.com \ --cc=shawn.guo@linaro.org \ --cc=viresh.kumar@st.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.