From: chris.ruehl@gtsys.com.hk (Chris Ruehl)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] usb: chipidea: usbmisc: Add support for i.MX27/i.MX31 CPUs
Date: Mon, 11 Nov 2013 14:10:10 +0800 [thread overview]
Message-ID: <528074C2.9070707@gtsys.com.hk> (raw)
In-Reply-To: <1384148852.19743495@f117.i.mail.ru>
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<shc_work@mail.ru>
>>>>> ---
>>>>> 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 at 10024000
>>> usbh1: usb at 10024200
>>> usbh2: usb at 10024400
>>> usbmisc: usbmisc at 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.
--- 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 @@
iram = <&iram>;
};
+ usbotg: usb at 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 at 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 at 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 at 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
next prev parent reply other threads:[~2013-11-11 6:10 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-10 7:18 [PATCH 1/2] usb: chipidea: usbmisc: Add support for i.MX27/i.MX31 CPUs Alexander Shiyan
2013-11-10 7:18 ` [PATCH 2/2] usb: chipidea: usbmisc: Add support for i.MX51 CPU Alexander Shiyan
2013-11-14 11:42 ` Peter Chen
2013-11-14 18:07 ` Matt Sealey
2013-11-16 13:35 ` Peter Chen
2013-11-16 13:46 ` Alexander Shiyan
2013-11-17 4:52 ` Peter Chen
2013-11-11 2:30 ` [PATCH 1/2] usb: chipidea: usbmisc: Add support for i.MX27/i.MX31 CPUs Chris Ruehl
2013-11-11 4:45 ` Alexander Shiyan
2013-11-11 5:33 ` Chris Ruehl
2013-11-11 5:47 ` Alexander Shiyan
2013-11-11 6:10 ` Chris Ruehl [this message]
2013-11-11 7:09 ` Alexander Shiyan
2014-01-11 12:55 ` Uwe Kleine-König
2014-01-11 14:01 ` Alexander Shiyan
2014-01-13 21:31 ` Uwe Kleine-König
2014-01-14 3:30 ` Alexander Shiyan
2014-01-14 3:53 ` Chris Ruehl
2014-01-14 13:49 ` Uwe Kleine-König
2014-01-15 1:52 ` Chris Ruehl
2014-01-16 9:03 ` Uwe Kleine-König
2014-01-14 13:47 ` Uwe Kleine-König
2014-01-14 13:54 ` Uwe Kleine-König
2014-01-11 12:59 ` Uwe Kleine-König
2013-11-14 11:41 ` Peter Chen
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=528074C2.9070707@gtsys.com.hk \
--to=chris.ruehl@gtsys.com.hk \
--cc=linux-arm-kernel@lists.infradead.org \
/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).