From patchwork Fri Apr 12 23:34:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 2439331 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork1.kernel.org (Postfix) with ESMTP id 7CB443FD40 for ; Fri, 12 Apr 2013 23:35:08 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UQnUp-0001iP-36; Fri, 12 Apr 2013 23:35:07 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UQnUm-0006Y4-M0; Fri, 12 Apr 2013 23:35:04 +0000 Received: from mail-lb0-f169.google.com ([209.85.217.169]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UQnUj-0006Xg-7C for linux-arm-kernel@lists.infradead.org; Fri, 12 Apr 2013 23:35:02 +0000 Received: by mail-lb0-f169.google.com with SMTP id p11so3123654lbi.14 for ; Fri, 12 Apr 2013 16:34:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:to:subject:from:organization:date:mime-version :content-type:content-transfer-encoding:message-id :x-gm-message-state; bh=q6EnlDqlOQZ6EirYE1+gtoL4c+HqWll6KiP9riXV+oc=; b=ghkHX0sAa3n/fJFgIVAqsRevtLa9YDL5nYW8zhPFL+I/bcMFGr1QaVjKTTff20zvZA zsi2HEVTwY22QlLEyoHokVX81SvbK438qMElToYzA9ufIavYoSg8Jo4YHEeoxs7AV8dv yKQnsWxh4YqCDK7WJRYAPaay8hVmXkdSfY5ZErla+bqgNUsW4/XxgNPc0Yz+OY4ijdBG p+KpQLmCQAiCRVqz5VxSUwNqQn6/lt5qDlqn5eyIho2vTA8nxdi6tMYpDuPbS7pOzWb+ 6dHj3qcGi2GorE2Ys8PvZ2+Ch4/ZG63+wy14SxYbSuyQxk42f+S0Mv4c1iTh+91Q9YFZ XItA== X-Received: by 10.112.180.65 with SMTP id dm1mr6043030lbc.83.1365809698910; Fri, 12 Apr 2013 16:34:58 -0700 (PDT) Received: from wasted.dev.rtsoft.ru (ppp91-79-80-224.pppoe.mtu-net.ru. [91.79.80.224]) by mx.google.com with ESMTPS id fz10sm4025068lbb.12.2013.04.12.16.34.56 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 12 Apr 2013 16:34:57 -0700 (PDT) To: horms@verge.net.au, magnus.damm@gmail.com, linux@arm.linux.org.uk, linux-sh@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org, gregkh@linuxfoundation.org, balbi@ti.com Subject: [PATCH v4 6/9] rcar-phy: correct base address From: Sergei Shtylyov Organization: Cogent Embedded Date: Sat, 13 Apr 2013 03:34:02 +0400 MIME-Version: 1.0 Message-Id: <201304130334.02826.sergei.shtylyov@cogentembedded.com> X-Gm-Message-State: ALoCoQml10U+u7auZVEv8a6BWAEuALkFarnUzHujxmFYiumJ7PpHNOzZptFKxMLMR34Dwp1Roe66 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130412_193501_423472_459DE1A6 X-CRM114-Status: GOOD ( 16.80 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.217.169 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The memory region that is used by the driver overlaps EHCI and OHCI register regions for absolutely no reason now -- fix it by adding offset of 0x800 to the base address, changing the register #define's accordingly. This has extra positive effect that we now can use devm_ioremap_resource()... Note that the driver and the SoC code have to be in one patch to keep the code bisectable... The patch has been tested on the Marzen board. Signed-off-by: Sergei Shtylyov Acked-by: Kuninori Morimoto Acked-by: Simon Horman --- Changes since version 2: - refreshed atop of the prior patches; - added a note about testing to the changelog; - added ACKs from Simon Horman and Kuninori Morimoto. Changes since the original posting: - added a note about bisectability to the changelog. arch/arm/mach-shmobile/setup-r8a7779.c | 2 +- drivers/usb/phy/rcar-phy.c | 28 ++++++++++------------------ 2 files changed, 11 insertions(+), 19 deletions(-) Index: renesas/arch/arm/mach-shmobile/setup-r8a7779.c =================================================================== --- renesas.orig/arch/arm/mach-shmobile/setup-r8a7779.c +++ renesas/arch/arm/mach-shmobile/setup-r8a7779.c @@ -402,7 +402,7 @@ static struct platform_device sata_devic /* USB PHY */ static struct resource usb_phy_resources[] = { [0] = { - .start = 0xffe70000, + .start = 0xffe70800, .end = 0xffe70900 - 1, .flags = IORESOURCE_MEM, }, Index: renesas/drivers/usb/phy/rcar-phy.c =================================================================== --- renesas.orig/drivers/usb/phy/rcar-phy.c +++ renesas/drivers/usb/phy/rcar-phy.c @@ -16,13 +16,13 @@ #include #include -/* USBH common register */ -#define USBPCTRL0 0x0800 -#define USBPCTRL1 0x0804 -#define USBST 0x0808 -#define USBEH0 0x080C -#define USBOH0 0x081C -#define USBCTL0 0x0858 +/* REGS block */ +#define USBPCTRL0 0x00 +#define USBPCTRL1 0x04 +#define USBST 0x08 +#define USBEH0 0x0C +#define USBOH0 0x1C +#define USBCTL0 0x58 /* USBPCTRL1 */ #define PHY_RST (1 << 2) @@ -139,17 +139,9 @@ static int rcar_usb_phy_probe(struct pla return -EINVAL; } - /* - * CAUTION - * - * Because this phy address is also mapped under OHCI/EHCI address area, - * this driver can't use devm_request_and_ioremap(dev, res) here - */ - reg0 = devm_ioremap_nocache(dev, res0->start, resource_size(res0)); - if (!reg0) { - dev_err(dev, "ioremap error\n"); - return -ENOMEM; - } + reg0 = devm_ioremap_resource(dev, res0); + if (IS_ERR(reg0)) + return PTR_ERR(reg0); priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) {