[U-Boot] [PATCH 3/3] imx: mx6sllevk: add usb support

Marek Vasut marex at denx.de
Thu Dec 22 09:46:02 CET 2016


On 12/22/2016 09:38 AM, Peng Fan wrote:
> 
> 
>> -----Original Message-----
>> From: Marek Vasut [mailto:marex at denx.de]
>> Sent: Thursday, December 22, 2016 3:12 PM
>> To: Peng Fan <peng.fan at nxp.com>; sbabic at denx.de
>> Cc: u-boot at lists.denx.de; van.freenix at gmail.com
>> Subject: Re: [PATCH 3/3] imx: mx6sllevk: add usb support
>>
>> On 12/22/2016 07:38 AM, Peng Fan wrote:
>>>
>>>
>>>> -----Original Message-----
>>>> From: Marek Vasut [mailto:marex at denx.de]
>>>> Sent: Thursday, December 22, 2016 2:12 PM
>>>> To: Peng Fan <peng.fan at nxp.com>; sbabic at denx.de
>>>> Cc: u-boot at lists.denx.de; van.freenix at gmail.com
>>>> Subject: Re: [PATCH 3/3] imx: mx6sllevk: add usb support
>>>>
>>>> On 12/22/2016 07:03 AM, Peng Fan wrote:
>>>>>
>>>>> Hi Marek,
>>>>>
>>>>>> -----Original Message-----
>>>>>> From: Marek Vasut [mailto:marex at denx.de]
>>>>>> Sent: Thursday, December 22, 2016 12:40 PM
>>>>>> To: Peng Fan <peng.fan at nxp.com>; sbabic at denx.de
>>>>>> Cc: u-boot at lists.denx.de; van.freenix at gmail.com
>>>>>> Subject: Re: [PATCH 3/3] imx: mx6sllevk: add usb support
>>>>>>
>>>>>> On 12/22/2016 02:13 AM, Peng Fan wrote:
>>>>>>>
>>>>>>>
>>>>>>>> -----Original Message-----
>>>>>>>> From: Marek Vasut [mailto:marex at denx.de]
>>>>>>>> Sent: Wednesday, December 21, 2016 10:10 PM
>>>>>>>> To: Peng Fan <peng.fan at nxp.com>; sbabic at denx.de
>>>>>>>> Cc: u-boot at lists.denx.de; van.freenix at gmail.com
>>>>>>>> Subject: Re: [PATCH 3/3] imx: mx6sllevk: add usb support
>>>>>>>>
>>>>>>>> On 12/21/2016 09:14 AM, Peng Fan wrote:
>>>>>>>>> Add usb support for mx6sllevk board.
>>>>>>>>>
>>>>>>>>> Signed-off-by: Peng Fan <peng.fan at nxp.com>
>>>>>>>>> Cc: Stefano Babic <sbabic at denx.de>
>>>>>>>>> ---
>>>>>>> [......]
>>>>>>>
>>>>>>>>> +
>>>>>>>>> +#define USB_OTHERREGS_OFFSET   0x800
>>>>>>>>> +#define UCTRL_PWR_POL          (1 << 9)
>>>>>>>>> +
>>>>>>>>> +int board_ehci_hcd_init(int port) {
>>>>>>>>> +	u32 *usbnc_usb_ctrl;
>>>>>>>>> +
>>>>>>>>> +	if (port > 1)
>>>>>>>>> +		return -EINVAL;
>>>>>>>>> +
>>>>>>>>> +	usbnc_usb_ctrl = (u32 *)(USB_BASE_ADDR +
>>>> USB_OTHERREGS_OFFSET
>>>>>>>> +
>>>>>>>>> +				 port * 4);
>>>>>>>>> +
>>>>>>>>> +	/* Set Power polarity */
>>>>>>>>> +	setbits_le32(usbnc_usb_ctrl, UCTRL_PWR_POL);
>>>>>>>>> +	return 0;
>>>>>>>>> +}
>>>>>>>>
>>>>>>>> Is this function similar to what usb_oc_config() does ?
>>>>>>>
>>>>>>> No, this bit is not for overcurrent. According to RM, this is OTG
>>>>>>> Power Polarity This bit should be set according to power switch's
>>>>>>> enable
>>>>>> polarity.
>>>>>>> 1 Power switch has an active-high enable input
>>>>>>> 0 Power switch has an active-low enable input
>>>>>>>
>>>>>>> This is board specific.
>>>>>>
>>>>>> Great, except it should also be part of the driver , the same way
>>>>>> as polarity is configured, yes ?
>>>>>
>>>>> I just found that there is code for mx7,
>>>>> http://lists.denx.de/pipermail/u-boot/2016-July/260321.html
>>>>>
>>>>> Then do you agree I add such piece code in usb_power_config for mx6?
>>>>> "
>>>>> #ifdef CONFIG_MXC_USB_OTG_HACTIVE
>>>>>         setbits_le32(ctrl, UCTRL_PWR_POL); #else
>>>>>         clrbits_le32(ctrl, UCTRL_PWR_POL); #endif "
>>>>
>>>> Didn't you add DT support in a patch sent like ... yesterday ? :)
>>>> Just use DT property instead of ifdef.
>>>
>>> There is no property for otg power polatiry in upstream Linux. I would
>>> not like to introduce one in U-Boot. We can drop the ifdef when there is an
>> property in upstream. What do you think?
>>
>> So uh, how can the USB work in mainline Linux on that board ?
> 
> Confirmed with IC, if using gpio to control vbus power, no need to configure this bit.
> Since in dts, we are using gpio regulator to control vbus, this piece code in patch 3/3
> can be discarded. I'll drop it in V2.

Hum, OK. Let's revisit this when we need this then ?

-- 
Best regards,
Marek Vasut


More information about the U-Boot mailing list