* [U-Boot] [PATCH] usb: dwc2_udc_otg: Add gotgctl customization
@ 2018-03-16 12:27 Patrice Chotard
2018-03-16 16:28 ` Marek Vasut
0 siblings, 1 reply; 5+ messages in thread
From: Patrice Chotard @ 2018-03-16 12:27 UTC (permalink / raw)
To: u-boot
Allow passing in a custom configuration of the gotgctl
register via platform data.
This allows for example to override the A/B session valid signals
by setting AvalidOvEn / AvalidOvVal and BvalidOvEn / BvalidOvVal
bits in GOTGCTL reg.
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
---
drivers/usb/gadget/dwc2_udc_otg.c | 3 +++
include/usb/dwc2_udc.h | 1 +
2 files changed, 4 insertions(+)
diff --git a/drivers/usb/gadget/dwc2_udc_otg.c b/drivers/usb/gadget/dwc2_udc_otg.c
index 088811c19136..c6c2edf7affa 100644
--- a/drivers/usb/gadget/dwc2_udc_otg.c
+++ b/drivers/usb/gadget/dwc2_udc_otg.c
@@ -426,6 +426,9 @@ static void reconfig_usbd(struct dwc2_udc *dev)
writel(dflt_gusbcfg, ®->gusbcfg);
+ if (dev->pdata->usb_gotgctl)
+ writel(dev->pdata->usb_gotgctl, ®->gotgctl);
+
/* 3. Put the OTG device core in the disconnected state.*/
uTemp = readl(®->dctl);
uTemp |= SOFT_DISCONNECT;
diff --git a/include/usb/dwc2_udc.h b/include/usb/dwc2_udc.h
index 1a370e0e86b5..36ab78dfb7e8 100644
--- a/include/usb/dwc2_udc.h
+++ b/include/usb/dwc2_udc.h
@@ -20,6 +20,7 @@ struct dwc2_plat_otg_data {
unsigned int usb_phy_ctrl;
unsigned int usb_flags;
unsigned int usb_gusbcfg;
+ unsigned int usb_gotgctl;
unsigned int rx_fifo_sz;
unsigned int np_tx_fifo_sz;
unsigned int tx_fifo_sz;
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH] usb: dwc2_udc_otg: Add gotgctl customization
2018-03-16 12:27 [U-Boot] [PATCH] usb: dwc2_udc_otg: Add gotgctl customization Patrice Chotard
@ 2018-03-16 16:28 ` Marek Vasut
2018-03-19 8:05 ` Patrice CHOTARD
0 siblings, 1 reply; 5+ messages in thread
From: Marek Vasut @ 2018-03-16 16:28 UTC (permalink / raw)
To: u-boot
On 03/16/2018 01:27 PM, Patrice Chotard wrote:
> Allow passing in a custom configuration of the gotgctl
> register via platform data.
> This allows for example to override the A/B session valid signals
> by setting AvalidOvEn / AvalidOvVal and BvalidOvEn / BvalidOvVal
> bits in GOTGCTL reg.
If you need to override those, doesn't it mean the device is broken?
btw can we start moving this to DT instead ?
> Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
> ---
>
> drivers/usb/gadget/dwc2_udc_otg.c | 3 +++
> include/usb/dwc2_udc.h | 1 +
> 2 files changed, 4 insertions(+)
>
> diff --git a/drivers/usb/gadget/dwc2_udc_otg.c b/drivers/usb/gadget/dwc2_udc_otg.c
> index 088811c19136..c6c2edf7affa 100644
> --- a/drivers/usb/gadget/dwc2_udc_otg.c
> +++ b/drivers/usb/gadget/dwc2_udc_otg.c
> @@ -426,6 +426,9 @@ static void reconfig_usbd(struct dwc2_udc *dev)
>
> writel(dflt_gusbcfg, ®->gusbcfg);
>
> + if (dev->pdata->usb_gotgctl)
> + writel(dev->pdata->usb_gotgctl, ®->gotgctl);
> +
> /* 3. Put the OTG device core in the disconnected state.*/
> uTemp = readl(®->dctl);
> uTemp |= SOFT_DISCONNECT;
> diff --git a/include/usb/dwc2_udc.h b/include/usb/dwc2_udc.h
> index 1a370e0e86b5..36ab78dfb7e8 100644
> --- a/include/usb/dwc2_udc.h
> +++ b/include/usb/dwc2_udc.h
> @@ -20,6 +20,7 @@ struct dwc2_plat_otg_data {
> unsigned int usb_phy_ctrl;
> unsigned int usb_flags;
> unsigned int usb_gusbcfg;
> + unsigned int usb_gotgctl;
> unsigned int rx_fifo_sz;
> unsigned int np_tx_fifo_sz;
> unsigned int tx_fifo_sz;
>
--
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH] usb: dwc2_udc_otg: Add gotgctl customization
2018-03-16 16:28 ` Marek Vasut
@ 2018-03-19 8:05 ` Patrice CHOTARD
2018-03-19 9:52 ` Marek Vasut
0 siblings, 1 reply; 5+ messages in thread
From: Patrice CHOTARD @ 2018-03-19 8:05 UTC (permalink / raw)
To: u-boot
Hi Marek
On 03/16/2018 05:28 PM, Marek Vasut wrote:
> On 03/16/2018 01:27 PM, Patrice Chotard wrote:
>> Allow passing in a custom configuration of the gotgctl
>> register via platform data.
>> This allows for example to override the A/B session valid signals
>> by setting AvalidOvEn / AvalidOvVal and BvalidOvEn / BvalidOvVal
>> bits in GOTGCTL reg.
>
> If you need to override those, doesn't it mean the device is broken?
We have a board with a specific wiring. Forcing A/B session valid
signals is the solution to make device mode working on this setup.
>
> btw can we start moving this to DT instead ?
Yes for sure, i will send a v2
Thanks
Patrice
>
>> Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
>> ---
>>
>> drivers/usb/gadget/dwc2_udc_otg.c | 3 +++
>> include/usb/dwc2_udc.h | 1 +
>> 2 files changed, 4 insertions(+)
>>
>> diff --git a/drivers/usb/gadget/dwc2_udc_otg.c b/drivers/usb/gadget/dwc2_udc_otg.c
>> index 088811c19136..c6c2edf7affa 100644
>> --- a/drivers/usb/gadget/dwc2_udc_otg.c
>> +++ b/drivers/usb/gadget/dwc2_udc_otg.c
>> @@ -426,6 +426,9 @@ static void reconfig_usbd(struct dwc2_udc *dev)
>>
>> writel(dflt_gusbcfg, ®->gusbcfg);
>>
>> + if (dev->pdata->usb_gotgctl)
>> + writel(dev->pdata->usb_gotgctl, ®->gotgctl);
>> +
>> /* 3. Put the OTG device core in the disconnected state.*/
>> uTemp = readl(®->dctl);
>> uTemp |= SOFT_DISCONNECT;
>> diff --git a/include/usb/dwc2_udc.h b/include/usb/dwc2_udc.h
>> index 1a370e0e86b5..36ab78dfb7e8 100644
>> --- a/include/usb/dwc2_udc.h
>> +++ b/include/usb/dwc2_udc.h
>> @@ -20,6 +20,7 @@ struct dwc2_plat_otg_data {
>> unsigned int usb_phy_ctrl;
>> unsigned int usb_flags;
>> unsigned int usb_gusbcfg;
>> + unsigned int usb_gotgctl;
>> unsigned int rx_fifo_sz;
>> unsigned int np_tx_fifo_sz;
>> unsigned int tx_fifo_sz;
>>
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH] usb: dwc2_udc_otg: Add gotgctl customization
2018-03-19 8:05 ` Patrice CHOTARD
@ 2018-03-19 9:52 ` Marek Vasut
2018-03-21 10:28 ` Patrice CHOTARD
0 siblings, 1 reply; 5+ messages in thread
From: Marek Vasut @ 2018-03-19 9:52 UTC (permalink / raw)
To: u-boot
On 03/19/2018 09:05 AM, Patrice CHOTARD wrote:
> Hi Marek
Hi,
> On 03/16/2018 05:28 PM, Marek Vasut wrote:
>> On 03/16/2018 01:27 PM, Patrice Chotard wrote:
>>> Allow passing in a custom configuration of the gotgctl
>>> register via platform data.
>>> This allows for example to override the A/B session valid signals
>>> by setting AvalidOvEn / AvalidOvVal and BvalidOvEn / BvalidOvVal
>>> bits in GOTGCTL reg.
>>
>> If you need to override those, doesn't it mean the device is broken?
>
> We have a board with a specific wiring. Forcing A/B session valid
> signals is the solution to make device mode working on this setup.
Meaning your OTG ID detection is broken, right ?
>> btw can we start moving this to DT instead ?
>
> Yes for sure, i will send a v2
Thanks
--
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH] usb: dwc2_udc_otg: Add gotgctl customization
2018-03-19 9:52 ` Marek Vasut
@ 2018-03-21 10:28 ` Patrice CHOTARD
0 siblings, 0 replies; 5+ messages in thread
From: Patrice CHOTARD @ 2018-03-21 10:28 UTC (permalink / raw)
To: u-boot
Hi Marek
On 03/19/2018 10:52 AM, Marek Vasut wrote:
> On 03/19/2018 09:05 AM, Patrice CHOTARD wrote:
>> Hi Marek
>
> Hi,
>
>> On 03/16/2018 05:28 PM, Marek Vasut wrote:
>>> On 03/16/2018 01:27 PM, Patrice Chotard wrote:
>>>> Allow passing in a custom configuration of the gotgctl
>>>> register via platform data.
>>>> This allows for example to override the A/B session valid signals
>>>> by setting AvalidOvEn / AvalidOvVal and BvalidOvEn / BvalidOvVal
>>>> bits in GOTGCTL reg.
>>>
>>> If you need to override those, doesn't it mean the device is broken?
>>
>> We have a board with a specific wiring. Forcing A/B session valid
>> signals is the solution to make device mode working on this setup.
>
> Meaning your OTG ID detection is broken, right ?
Right
>
>>> btw can we start moving this to DT instead ?
>>
>> Yes for sure, i will send a v2
I got a look at this point, but unfortunately dwc2_udc_otg.c is not
converted to DM/DT. I will try to propose a DM/DT transition patch for
this driver by keeping compatibility with current usage by all platforms.
Patrice
> Thanks
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-03-21 10:28 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-16 12:27 [U-Boot] [PATCH] usb: dwc2_udc_otg: Add gotgctl customization Patrice Chotard
2018-03-16 16:28 ` Marek Vasut
2018-03-19 8:05 ` Patrice CHOTARD
2018-03-19 9:52 ` Marek Vasut
2018-03-21 10:28 ` Patrice CHOTARD
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.