From patchwork Mon Nov 11 06:10:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Ruehl X-Patchwork-Id: 3166411 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 99FFE9F690 for ; Mon, 11 Nov 2013 06:11:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6FAF120377 for ; Mon, 11 Nov 2013 06:11:01 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2C16F202E6 for ; Mon, 11 Nov 2013 06:11:00 +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 1Vfki2-0001iQ-Rf; Mon, 11 Nov 2013 06:10:50 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vfki0-0005om-Dy; Mon, 11 Nov 2013 06:10:48 +0000 Received: from mail.fpasia.hk ([202.130.89.98] helo=fpa01n0.fpasia.hk) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vfkhw-0005oI-NP for linux-arm-kernel@lists.infradead.org; Mon, 11 Nov 2013 06:10:46 +0000 Received: from localhost (localhost [127.0.0.1]) by fpa01n0.fpasia.hk (Postfix) with ESMTP id 00C52CFA760; Mon, 11 Nov 2013 14:10:12 +0800 (HKT) X-Virus-Scanned: FPASIA amavisd-new at fpasia.hk Received: from fpa01n0.fpasia.hk ([127.0.0.1]) by localhost (fpa01n0.office.fpa.com.hk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Cc80coavsb3N; Mon, 11 Nov 2013 14:10:11 +0800 (HKT) Received: from s01.gtsys.com.hk (gtsnode.office.fpasia.hk [10.10.37.40]) by fpa01n0.fpasia.hk (Postfix) with ESMTP id 18B0ACFA75F; Mon, 11 Nov 2013 14:10:11 +0800 (HKT) Received: from [10.128.2.32] (pcd423049.netvigator.com [203.218.213.49]) by s01.gtsys.com.hk (Postfix) with ESMTPSA id D25FCC019EB; Mon, 11 Nov 2013 14:10:08 +0800 (HKT) Message-ID: <528074C2.9070707@gtsys.com.hk> Date: Mon, 11 Nov 2013 14:10:10 +0800 From: Chris Ruehl User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20121215 Icedove/3.0.11 ThunderBrowse/3.8 MIME-Version: 1.0 To: Alexander Shiyan Subject: Re: [PATCH 1/2] usb: chipidea: usbmisc: Add support for i.MX27/i.MX31 CPUs References: <1384067901-9377-1-git-send-email-shc_work@mail.ru> <1384145140.400290349@f353.i.mail.ru> <52806C24.8040100@gtsys.com.hk> <1384148852.19743495@f117.i.mail.ru> In-Reply-To: <1384148852.19743495@f117.i.mail.ru> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131111_011045_260961_C6F5F378 X-CRM114-Status: GOOD ( 18.44 ) X-Spam-Score: -1.9 (-) Cc: Alexander Shishkin , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Sascha Hauer 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 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Monday, November 11, 2013 01:47 PM, Alexander Shiyan wrote: >> On Monday, November 11, 2013 12:45 PM, Alexander Shiyan wrote: >>>> Hi Alexander, >>>> >>>> On Sunday, November 10, 2013 03:18 PM, Alexander Shiyan wrote: >>>>> This adds i.MX27 and i.MX31 as the next user of the usbmisc driver. >>>>> >>>>> Signed-off-by: Alexander Shiyan >>>>> --- >>>>> drivers/usb/chipidea/usbmisc_imx.c | 42 ++++++++++++++++++++++++++++++++++++++ >>>>> 1 file changed, 42 insertions(+) >>>>> >>>>> diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c >>> ... >>>>> +static int usbmisc_imx27_init(struct imx_usbmisc_data *data) >>>>> +{ >>>>> + unsigned long flags; >>>>> + u32 val; >>>>> + >>>>> + switch (data->index) { >>>>> + case 0: >>>>> + val = MX27_OTG_PM_BIT; >>>>> + break; >>>>> + case 1: >>>>> + val = MX27_H1_PM_BIT; >>>>> + break; >>>>> + case 2: >>>>> + val = MX27_H2_PM_BIT; >>>>> + break; >>>>> + default: >>>>> + return -EINVAL; >>>>> + }; >>>>> + >>>> >>>> From my understanding this can not work, the usbmisc->base not point into the >>>> usb control register (USB_CTRL). Reference manual 30.5.1.1 says >>>> BASE + 0x600 >>>> you must add the offset to the readl instruction. >>> >>> Why not work? >>> usbotg: usb@10024000 >>> usbh1: usb@10024200 >>> usbh2: usb@10024400 >>> usbmisc: usbmisc@10024600 >>> So, offset to USB_CTRL should already be defined by DTS. >> >> in the usbmisc_imx_probe() the base pointer is loaded from >> >> res = platform_get_resource(pdev, IORESOURCE_MEM, 0); >> data->base = devm_ioremap_resource(&pdev->dev, res); >> >> (and I did not see any of_ operations) > > Yes, and this is an address of usbmisc node, not otg. Sorry, you are right. I misunderstood because I didn't see any of sample DTS files define usbmisc yet. At this point might be good to patch the imx27.dtsi with the usb defines. iram = <&iram>; }; + usbotg: usb@10024000 { + compatible = "fsl,imx27-usb"; + reg = <0x10024000 0x200>; + interrupts = <56>; + clocks = <&clks 75>, <&clks 62>; + clock-names = "ipg", "ahb"; + dr_mode = "host"; + phy_type = "ulpi"; + status = "disabled"; + }; + + usbh1: usb@10024200 { + compatible = "fsl,imx27-usb"; + reg = <0x10024200 0x200>; + interrupts = <54>; + clocks = <&clks 75>, <&clks 62>; + clock-names = "ipg", "ahb"; + dr_mode = "host"; + phy_type = "serial"; + status = "disabled"; + }; + + usbh2: usb@10024400 { + compatible = "fsl,imx27-usb"; + reg = <0x10024400 0x200>; + interrupts = <55>; + clocks = <&clks 75>, <&clks 62>; + clock-names = "ipg", "ahb"; + dr_mode = "host"; + phy_type = "ulpi"; + status = "disabled"; + }; + + usbmisc: usbmisc@10024600 { + compatible = "fsl,imx27-usb"; + reg = <0x10024600 0x4>; + }; + Regards Chris > >> usbmisc = data; >> >> base is set to 0x10024000 >> >> when I look around all other functions init functions did a offset calculation. > > Can you point me on this? > For example, for i.MX5 CPUs we calculate only offset to PHY_CTRL_X register > relative to basic offset 0x800, which is already defined in DTS. > > ... > r --- a/arch/arm/boot/dts/imx27.dtsi +++ b/arch/arm/boot/dts/imx27.dtsi @@ -30,6 +30,9 @@ spi0 = &cspi1; spi1 = &cspi2; spi2 = &cspi3; + usb0 = &usbotg; + usb1 = &usbh1; + usb2 = &usbh2; }; @@ -404,6 +419,44 @@