From patchwork Thu Jun 30 10:41:56 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 102741 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 64A47B6F54 for ; Thu, 30 Jun 2011 20:42:36 +1000 (EST) Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QcEhU-0003XE-S1; Thu, 30 Jun 2011 10:42:25 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QcEhU-00082O-Ay; Thu, 30 Jun 2011 10:42:24 +0000 Received: from metis.ext.pengutronix.de ([2001:6f8:1178:4:290:27ff:fe1d:cc33]) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QcEh8-0007yD-EE for linux-arm-kernel@lists.infradead.org; Thu, 30 Jun 2011 10:42:03 +0000 Received: from octopus.hi.pengutronix.de ([2001:6f8:1178:2:215:17ff:fe12:23b0]) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1QcEh6-00036w-EU; Thu, 30 Jun 2011 12:42:00 +0200 Received: from sha by octopus.hi.pengutronix.de with local (Exim 4.76) (envelope-from ) id 1QcEh5-0006JI-2J; Thu, 30 Jun 2011 12:41:59 +0200 From: Sascha Hauer To: linux-kernel@vger.kernel.org Subject: [PATCH 2/3] ARM mxs: adjust pwm resources to what the driver expects Date: Thu, 30 Jun 2011 12:41:56 +0200 Message-Id: <1309430517-23821-3-git-send-email-s.hauer@pengutronix.de> X-Mailer: git-send-email 1.7.5.3 In-Reply-To: <1309430517-23821-1-git-send-email-s.hauer@pengutronix.de> References: <1309430517-23821-1-git-send-email-s.hauer@pengutronix.de> X-SA-Exim-Connect-IP: 2001:6f8:1178:2:215:17ff:fe12:23b0 X-SA-Exim-Mail-From: sha@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110630_064202_705941_F91FFCAE X-CRM114-Status: GOOD ( 20.68 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain Cc: Arnd Bergmann , Sascha Hauer , Ryan Mallon , Shawn Guo , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org 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 Acked-by: Arnd Bergmann --- 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 #include +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); }