All of lore.kernel.org
 help / color / mirror / Atom feed
From: Troy Kisky <troy.kisky@boundarydevices.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V5 02/18] usb: ehci-mx6: add support for host mode otg port
Date: Fri, 27 Sep 2013 12:47:39 -0700	[thread overview]
Message-ID: <5245E0DB.2040009@boundarydevices.com> (raw)
In-Reply-To: <201309271950.54857.marex@denx.de>

On 9/27/2013 10:50 AM, Marek Vasut wrote:
> Dear Troy Kisky,
>
>> Previously, only host1 was supported using an index of 0.
>> Now, otg has index 0, host1 is 1, host2 is 2, host3 is 3.
>> Since OTG requires usbmode to be set after reset, I added
>> CONFIG_EHCI_HCD_INIT_AFTER_RESET to nitrogen6x.h and
>> mx6qsabreauto.h.
>>
>> I also added a weak function board_ehci_power to handle
>> turning power on/off for otg.
>>
>> Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
>>
>> ---
>> V4: new patch, replaces "usb: gadget: mv_udc: fix hardware udc address for
>> i.MX6" and has the bonus of giving OTG host mode support
>>
>> V5: use CONFIG_EHCI_HCD_INIT_AFTER_RESET instead of a weak function.
>> Return error if otg_id is high.
>> ---
>>   drivers/usb/host/ehci-mx6.c     | 123
>> +++++++++++++++++++++++++++------------- include/configs/mx6qsabreauto.h |
>>    3 +-
>>   include/configs/nitrogen6x.h    |   3 +-
>>   3 files changed, 87 insertions(+), 42 deletions(-)
>>
>> diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c
>> index eb24af5..ff4424d 100644
>> --- a/drivers/usb/host/ehci-mx6.c
>> +++ b/drivers/usb/host/ehci-mx6.c
>> @@ -35,6 +35,7 @@
>>   #define USBPHY_CTRL_CLKGATE			0x40000000
>>   #define USBPHY_CTRL_ENUTMILEVEL3		0x00008000
>>   #define USBPHY_CTRL_ENUTMILEVEL2		0x00004000
>> +#define USBPHY_CTRL_OTD_ID_BIT			27
> Why is this anarchism used here? Why is it not defined as the rest of the
> values? Btw. its OTG_ID_VALUE , not OTD.

Good catch on the typo!

> [...]
>
>> @@ -123,31 +156,36 @@ static int usbh1_phy_enable(void)
>>   	/* Power up the PHY */
>>   	__raw_writel(0, phy_reg + USBPHY_PWD);
>>   	/* enable FS/LS device */
>> -	val = __raw_readl(phy_reg + USBPHY_CTRL);
>> +	val = __raw_readl(phy_ctrl);
>>   	val |= (USBPHY_CTRL_ENUTMILEVEL2 | USBPHY_CTRL_ENUTMILEVEL3);
>> -	__raw_writel(val, phy_reg + USBPHY_CTRL);
>> +	__raw_writel(val, phy_ctrl);
>>
>> -	return 0;
>> +	return (val >> USBPHY_CTRL_OTD_ID_BIT) & 1;
> See above, you can use return (val & USBPHY_CTRL_OTG_ID_VALUE); here instead.

Yes, I can do that, and also change my documentation along with it.

>
>>   }
>>
>> -static void usbh1_oc_config(void)
>> +struct usbnc_regs {
>> +	u32	ctrl[4];	/* otg/host1-3 */
> This won't scale. Align this with the # of controllers you claim you have here,
> why dont you?

You've lost me here. Can you post the struct you'd like to see?

>
> [...]
>
>> diff --git a/include/configs/mx6qsabreauto.h
>> b/include/configs/mx6qsabreauto.h index 5530fc6..9e48a49 100644
>> --- a/include/configs/mx6qsabreauto.h
>> +++ b/include/configs/mx6qsabreauto.h
>> @@ -23,7 +23,8 @@
>>   #define CONFIG_USB_STORAGE
>>   #define CONFIG_USB_HOST_ETHER
>>   #define CONFIG_USB_ETHER_ASIX
>> -#define CONFIG_MXC_USB_PORT	1
>> +#define CONFIG_USB_MAX_CONTROLLER_COUNT 2
>> +#define CONFIG_EHCI_HCD_INIT_AFTER_RESET	/* For OTG port */
>>   #define CONFIG_MXC_USB_PORTSC	(PORT_PTS_UTMI | PORT_PTS_PTW)
>>   #define CONFIG_MXC_USB_FLAGS	0
>>
>> diff --git a/include/configs/nitrogen6x.h b/include/configs/nitrogen6x.h
>> index 3454b86..2e5ae13 100644
>> --- a/include/configs/nitrogen6x.h
>> +++ b/include/configs/nitrogen6x.h
>> @@ -119,7 +119,8 @@
>>   #define CONFIG_USB_HOST_ETHER
>>   #define CONFIG_USB_ETHER_ASIX
>>   #define CONFIG_USB_ETHER_SMSC95XX
>> -#define CONFIG_MXC_USB_PORT	1
>> +#define CONFIG_USB_MAX_CONTROLLER_COUNT 2
>> +#define CONFIG_EHCI_HCD_INIT_AFTER_RESET	/* For OTG port */
>>   #define CONFIG_MXC_USB_PORTSC	(PORT_PTS_UTMI | PORT_PTS_PTW)
>>   #define CONFIG_MXC_USB_FLAGS	0
> Does this patch do two things here ? I think it does, if I'm right, split this
> board adjustment away please.
>
>

If I split this, USB will stop working between the 2 patches. The OTG 
port will be initialized
instead of the main USB port, and it won't work because it requires 
CONFIG_EHCI_HCD_INIT_AFTER_RESET.

BR

Troy

  reply	other threads:[~2013-09-27 19:47 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-26  1:41 [U-Boot] [PATCH V5 00/18] Make mv_udc work for i.mx6 Troy Kisky
2013-09-26  1:41 ` [U-Boot] [PATCH V5 01/18] usb: gadget: mv_udc: don't check CONFIG_USB_MAX_CONTROLLER_COUNT Troy Kisky
2013-09-26  1:41 ` [U-Boot] [PATCH V5 02/18] usb: ehci-mx6: add support for host mode otg port Troy Kisky
2013-09-27 17:50   ` Marek Vasut
2013-09-27 19:47     ` Troy Kisky [this message]
2013-09-27 20:42       ` Marek Vasut
2013-09-27 22:22         ` Troy Kisky
2013-09-28  0:57           ` Marek Vasut
2013-09-26  1:41 ` [U-Boot] [PATCH V5 03/18] usb: echi-hcd: add usb_lowlevel_init_device Troy Kisky
2013-09-27 17:54   ` Marek Vasut
2013-09-27 20:03     ` Troy Kisky
2013-09-27 20:41       ` Marek Vasut
2013-09-26  1:41 ` [U-Boot] [PATCH V5 04/18] usb: gadget: ether set wMaxPacketSize Troy Kisky
2013-09-27 17:54   ` Marek Vasut
2013-09-26  1:41 ` [U-Boot] [PATCH V5 05/18] usb: gadget: ether: return error from rx_submit if no request Troy Kisky
2013-09-27 17:55   ` Marek Vasut
2013-09-26  1:41 ` [U-Boot] [PATCH V5 06/18] usb: gadget: mv_udc: split mv_udc.h file Troy Kisky
2013-09-26  1:41 ` [U-Boot] [PATCH V5 07/18] usb: udc: add udc.h include file Troy Kisky
2013-09-27 17:57   ` Marek Vasut
2013-09-27 20:07     ` Troy Kisky
2013-09-26  1:41 ` [U-Boot] [PATCH V5 08/18] usb: gadget: mv_udc: fix typo in error message Troy Kisky
2013-09-27 17:58   ` Marek Vasut
2013-09-26  1:41 ` [U-Boot] [PATCH V5 09/18] usb: gadget: mv_udc: set is_dualspeed = 1 Troy Kisky
2013-09-27 17:58   ` Marek Vasut
2013-09-26  1:41 ` [U-Boot] [PATCH V5 10/18] usb: gadget: mv_udc: fix full speed connections Troy Kisky
2013-09-27 18:00   ` Marek Vasut
2013-09-27 20:13     ` Troy Kisky
2013-09-27 20:38       ` Marek Vasut
2013-09-26  1:41 ` [U-Boot] [PATCH V5 11/18] usb: gadget: mv_udc: optimize bounce Troy Kisky
2013-09-26  1:41 ` [U-Boot] [PATCH V5 12/18] usb: gadget: mv_udc: flush item before head Troy Kisky
2013-09-27 18:01   ` Marek Vasut
2013-09-26  1:41 ` [U-Boot] [PATCH V5 13/18] usb: gadget: mv_udc: optimize ep_enable Troy Kisky
2013-09-26  1:41 ` [U-Boot] [PATCH V5 14/18] usb: gadget: mv_udc: zero transfer descriptor memory on probe Troy Kisky
2013-09-27 18:01   ` Marek Vasut
2013-09-26  1:41 ` [U-Boot] [PATCH V5 15/18] usb: gadget: mv_udc: clear desc upon ep_disable Troy Kisky
2013-09-27 18:02   ` Marek Vasut
2013-09-26  1:41 ` [U-Boot] [PATCH V5 16/18] mx6: iomux: add GPR1 defines for use with nitrogen6x Troy Kisky
2013-09-26  1:41 ` [U-Boot] [PATCH V5 17/18] nitrogen6x: add otg usb host/device mode support Troy Kisky
2013-09-26  1:41 ` [U-Boot] [PATCH V5 18/18] nitrogen6x: add CONFIG_MV_UDC Troy Kisky
2013-09-26 16:18 ` [U-Boot] [PATCH V5 00/18] Make mv_udc work for i.mx6 Stefano Babic
2013-09-26 19:13   ` Troy Kisky
2013-09-26 20:24     ` Marek Vasut
2013-09-27 18:03 ` Marek Vasut
2013-09-27 20:14   ` Troy Kisky

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=5245E0DB.2040009@boundarydevices.com \
    --to=troy.kisky@boundarydevices.com \
    --cc=u-boot@lists.denx.de \
    /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 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.