* [PATCH 0/2] Add DWC3 controller suppport for AMD's platforms @ 2021-08-23 18:44 Nehal Bakulchandra Shah 2021-08-23 18:44 ` [PATCH 1/2] usb: dwc3: pci: add support for AMD's newer generation platform Nehal Bakulchandra Shah 2021-08-23 18:44 ` [PATCH 2/2] usb: dwc3: pci add property to allow user space role switch Nehal Bakulchandra Shah 0 siblings, 2 replies; 9+ messages in thread From: Nehal Bakulchandra Shah @ 2021-08-23 18:44 UTC (permalink / raw) To: balbi, gregkh Cc: linux-usb, linux-kernel, kun.liu2, alexander.deucher, Nehal Bakulchandra Shah Newer generation of AMD's platform has DWC3 controller. Also there is a requirement to support user space role switch control. This patch series addresses the same. Nehal Bakulchandra Shah (2): usb: dwc3: pci: add support for AMD's newer generation platform. usb: dwc3: pci add property to allow user space role switch drivers/usb/dwc3/drd.c | 2 ++ drivers/usb/dwc3/dwc3-pci.c | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) -- 2.25.1 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/2] usb: dwc3: pci: add support for AMD's newer generation platform. 2021-08-23 18:44 [PATCH 0/2] Add DWC3 controller suppport for AMD's platforms Nehal Bakulchandra Shah @ 2021-08-23 18:44 ` Nehal Bakulchandra Shah 2021-08-24 8:19 ` Felipe Balbi 2021-08-23 18:44 ` [PATCH 2/2] usb: dwc3: pci add property to allow user space role switch Nehal Bakulchandra Shah 1 sibling, 1 reply; 9+ messages in thread From: Nehal Bakulchandra Shah @ 2021-08-23 18:44 UTC (permalink / raw) To: balbi, gregkh Cc: linux-usb, linux-kernel, kun.liu2, alexander.deucher, Nehal Bakulchandra Shah AMD's latest platforms has DWC3 controller. Add the PCI ID and properties for the same. Signed-off-by: Nehal Bakulchandra Shah <Nehal-Bakulchandra.shah@amd.com> --- drivers/usb/dwc3/dwc3-pci.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c index 2b37bdd39a74..7ff8fc8f79a9 100644 --- a/drivers/usb/dwc3/dwc3-pci.c +++ b/drivers/usb/dwc3/dwc3-pci.c @@ -44,6 +44,7 @@ #define PCI_DEVICE_ID_INTEL_ADLM 0x54ee #define PCI_DEVICE_ID_INTEL_ADLS 0x7ae1 #define PCI_DEVICE_ID_INTEL_TGL 0x9a15 +#define PCI_DEVICE_ID_AMD_MR 0x163a #define PCI_INTEL_BXT_DSM_GUID "732b85d5-b7a7-4a1b-9ba0-4bbd00ffd511" #define PCI_INTEL_BXT_FUNC_PMU_PWR 4 @@ -148,6 +149,14 @@ static const struct property_entry dwc3_pci_amd_properties[] = { {} }; +static const struct property_entry dwc3_pci_mr_properties[] = { + PROPERTY_ENTRY_STRING("dr_mode", "otg"), + PROPERTY_ENTRY_BOOL("usb-role-switch"), + PROPERTY_ENTRY_STRING("role-switch-default-mode", "host"), + PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"), + {} +}; + static const struct software_node dwc3_pci_intel_swnode = { .properties = dwc3_pci_intel_properties, }; @@ -160,6 +169,10 @@ static const struct software_node dwc3_pci_amd_swnode = { .properties = dwc3_pci_amd_properties, }; +static const struct software_node dwc3_pci_amd_mr_swnode = { + .properties = dwc3_pci_mr_properties, +}; + static int dwc3_pci_quirks(struct dwc3_pci *dwc) { struct pci_dev *pdev = dwc->pci; @@ -401,6 +414,10 @@ static const struct pci_device_id dwc3_pci_id_table[] = { { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_NL_USB), (kernel_ulong_t) &dwc3_pci_amd_swnode, }, + + { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_MR), + (kernel_ulong_t)&dwc3_pci_amd_mr_swnode, }, + { } /* Terminating Entry */ }; MODULE_DEVICE_TABLE(pci, dwc3_pci_id_table); -- 2.25.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] usb: dwc3: pci: add support for AMD's newer generation platform. 2021-08-23 18:44 ` [PATCH 1/2] usb: dwc3: pci: add support for AMD's newer generation platform Nehal Bakulchandra Shah @ 2021-08-24 8:19 ` Felipe Balbi 0 siblings, 0 replies; 9+ messages in thread From: Felipe Balbi @ 2021-08-24 8:19 UTC (permalink / raw) To: Nehal Bakulchandra Shah Cc: gregkh, linux-usb, linux-kernel, kun.liu2, alexander.deucher Nehal Bakulchandra Shah <Nehal-Bakulchandra.shah@amd.com> writes: > AMD's latest platforms has DWC3 controller. Add the PCI ID and > properties for the same. > > Signed-off-by: Nehal Bakulchandra Shah <Nehal-Bakulchandra.shah@amd.com> Acked-by: Felipe Balbi <balbi@kernel.org> -- balbi ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/2] usb: dwc3: pci add property to allow user space role switch 2021-08-23 18:44 [PATCH 0/2] Add DWC3 controller suppport for AMD's platforms Nehal Bakulchandra Shah 2021-08-23 18:44 ` [PATCH 1/2] usb: dwc3: pci: add support for AMD's newer generation platform Nehal Bakulchandra Shah @ 2021-08-23 18:44 ` Nehal Bakulchandra Shah 2021-08-24 8:19 ` Felipe Balbi 1 sibling, 1 reply; 9+ messages in thread From: Nehal Bakulchandra Shah @ 2021-08-23 18:44 UTC (permalink / raw) To: balbi, gregkh Cc: linux-usb, linux-kernel, kun.liu2, alexander.deucher, Nehal Bakulchandra Shah For AMD platform there is a requirement to enable user space role switch from host to device and device to host by means of running following commands. HOST: echo host > /sys/class/usb_role/dwc3.0.auto-role-switch/role DEVICE: echo device > /sys/class/usb_role/dwc3.0.auto-role-switch/role Signed-off-by: Nehal Bakulchandra Shah <Nehal-Bakulchandra.shah@amd.com> --- drivers/usb/dwc3/drd.c | 2 ++ drivers/usb/dwc3/dwc3-pci.c | 1 + 2 files changed, 3 insertions(+) diff --git a/drivers/usb/dwc3/drd.c b/drivers/usb/dwc3/drd.c index 8fcbac10510c..6d579780ffcc 100644 --- a/drivers/usb/dwc3/drd.c +++ b/drivers/usb/dwc3/drd.c @@ -555,6 +555,8 @@ static int dwc3_setup_role_switch(struct dwc3 *dwc) mode = DWC3_GCTL_PRTCAP_DEVICE; } + if (device_property_read_bool(dwc->dev, "allow-userspace-role-switch")) + dwc3_role_switch.allow_userspace_control = true; dwc3_role_switch.fwnode = dev_fwnode(dwc->dev); dwc3_role_switch.set = dwc3_usb_role_switch_set; dwc3_role_switch.get = dwc3_usb_role_switch_get; diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c index 7ff8fc8f79a9..c1412a6e85b6 100644 --- a/drivers/usb/dwc3/dwc3-pci.c +++ b/drivers/usb/dwc3/dwc3-pci.c @@ -153,6 +153,7 @@ static const struct property_entry dwc3_pci_mr_properties[] = { PROPERTY_ENTRY_STRING("dr_mode", "otg"), PROPERTY_ENTRY_BOOL("usb-role-switch"), PROPERTY_ENTRY_STRING("role-switch-default-mode", "host"), + PROPERTY_ENTRY_BOOL("allow-userspace-role-switch"), PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"), {} }; -- 2.25.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] usb: dwc3: pci add property to allow user space role switch 2021-08-23 18:44 ` [PATCH 2/2] usb: dwc3: pci add property to allow user space role switch Nehal Bakulchandra Shah @ 2021-08-24 8:19 ` Felipe Balbi 2021-08-24 16:02 ` Shah, Nehal-bakulchandra 0 siblings, 1 reply; 9+ messages in thread From: Felipe Balbi @ 2021-08-24 8:19 UTC (permalink / raw) To: Nehal Bakulchandra Shah Cc: gregkh, linux-usb, linux-kernel, kun.liu2, alexander.deucher Nehal Bakulchandra Shah <Nehal-Bakulchandra.shah@amd.com> writes: > For AMD platform there is a requirement to enable user space role > switch from host to device and device to host by means of running > following commands. > > HOST: echo host > /sys/class/usb_role/dwc3.0.auto-role-switch/role > DEVICE: echo device > /sys/class/usb_role/dwc3.0.auto-role-switch/role A more important question that needs to be answered: why? -- balbi ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] usb: dwc3: pci add property to allow user space role switch 2021-08-24 8:19 ` Felipe Balbi @ 2021-08-24 16:02 ` Shah, Nehal-bakulchandra 2021-08-24 16:17 ` Felipe Balbi 0 siblings, 1 reply; 9+ messages in thread From: Shah, Nehal-bakulchandra @ 2021-08-24 16:02 UTC (permalink / raw) To: Felipe Balbi; +Cc: gregkh, linux-usb, linux-kernel, kun.liu2, alexander.deucher Hi On 8/24/2021 1:49 PM, Felipe Balbi wrote: > > Nehal Bakulchandra Shah <Nehal-Bakulchandra.shah@amd.com> writes: > >> For AMD platform there is a requirement to enable user space role >> switch from host to device and device to host by means of running >> following commands. >> >> HOST: echo host > /sys/class/usb_role/dwc3.0.auto-role-switch/role >> DEVICE: echo device > /sys/class/usb_role/dwc3.0.auto-role-switch/role > > A more important question that needs to be answered: why? > Our customer platform is not completely capable of OTG i.e with type C controller it does not have PD to support role switching. Hence, they have script which triggers the role switch based on ACPI/EC interrupt. Regards Nehal Shah ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] usb: dwc3: pci add property to allow user space role switch 2021-08-24 16:02 ` Shah, Nehal-bakulchandra @ 2021-08-24 16:17 ` Felipe Balbi 2021-08-24 16:28 ` Shah, Nehal-bakulchandra 0 siblings, 1 reply; 9+ messages in thread From: Felipe Balbi @ 2021-08-24 16:17 UTC (permalink / raw) To: Shah, Nehal-bakulchandra Cc: gregkh, linux-usb, linux-kernel, kun.liu2, alexander.deucher "Shah, Nehal-bakulchandra" <nehal-bakulchandra.shah@amd.com> writes: > Hi > On 8/24/2021 1:49 PM, Felipe Balbi wrote: >> Nehal Bakulchandra Shah <Nehal-Bakulchandra.shah@amd.com> writes: >> >>> For AMD platform there is a requirement to enable user space role >>> switch from host to device and device to host by means of running >>> following commands. >>> >>> HOST: echo host > /sys/class/usb_role/dwc3.0.auto-role-switch/role >>> DEVICE: echo device > /sys/class/usb_role/dwc3.0.auto-role-switch/role >> A more important question that needs to be answered: why? >> > Our customer platform is not completely capable of OTG i.e with type C > controller it does not have PD to support role switching. Hence, they > have script which triggers the role switch based on ACPI/EC interrupt. sounds like some generalized version of this text should be added to commit log. -- balbi ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] usb: dwc3: pci add property to allow user space role switch 2021-08-24 16:17 ` Felipe Balbi @ 2021-08-24 16:28 ` Shah, Nehal-bakulchandra 2021-08-24 16:54 ` Felipe Balbi 0 siblings, 1 reply; 9+ messages in thread From: Shah, Nehal-bakulchandra @ 2021-08-24 16:28 UTC (permalink / raw) To: Felipe Balbi; +Cc: gregkh, linux-usb, linux-kernel, kun.liu2, alexander.deucher On 8/24/2021 9:47 PM, Felipe Balbi wrote: > > "Shah, Nehal-bakulchandra" <nehal-bakulchandra.shah@amd.com> writes: > >> Hi >> On 8/24/2021 1:49 PM, Felipe Balbi wrote: >>> Nehal Bakulchandra Shah <Nehal-Bakulchandra.shah@amd.com> writes: >>> >>>> For AMD platform there is a requirement to enable user space role >>>> switch from host to device and device to host by means of running >>>> following commands. >>>> >>>> HOST: echo host > /sys/class/usb_role/dwc3.0.auto-role-switch/role >>>> DEVICE: echo device > /sys/class/usb_role/dwc3.0.auto-role-switch/role >>> A more important question that needs to be answered: why? >>> >> Our customer platform is not completely capable of OTG i.e with type C >> controller it does not have PD to support role switching. Hence, they >> have script which triggers the role switch based on ACPI/EC interrupt. > > sounds like some generalized version of this text should be added to > commit log. > Sure i will resubmit this patch with this description should be ok? Nehal ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] usb: dwc3: pci add property to allow user space role switch 2021-08-24 16:28 ` Shah, Nehal-bakulchandra @ 2021-08-24 16:54 ` Felipe Balbi 0 siblings, 0 replies; 9+ messages in thread From: Felipe Balbi @ 2021-08-24 16:54 UTC (permalink / raw) To: Shah, Nehal-bakulchandra Cc: gregkh, linux-usb, linux-kernel, kun.liu2, alexander.deucher Hi, "Shah, Nehal-bakulchandra" <nehal-bakulchandra.shah@amd.com> writes: > On 8/24/2021 9:47 PM, Felipe Balbi wrote: >> "Shah, Nehal-bakulchandra" <nehal-bakulchandra.shah@amd.com> writes: >> >>> Hi >>> On 8/24/2021 1:49 PM, Felipe Balbi wrote: >>>> Nehal Bakulchandra Shah <Nehal-Bakulchandra.shah@amd.com> writes: >>>> >>>>> For AMD platform there is a requirement to enable user space role >>>>> switch from host to device and device to host by means of running >>>>> following commands. >>>>> >>>>> HOST: echo host > /sys/class/usb_role/dwc3.0.auto-role-switch/role >>>>> DEVICE: echo device > /sys/class/usb_role/dwc3.0.auto-role-switch/role >>>> A more important question that needs to be answered: why? >>>> >>> Our customer platform is not completely capable of OTG i.e with type C >>> controller it does not have PD to support role switching. Hence, they >>> have script which triggers the role switch based on ACPI/EC interrupt. >> sounds like some generalized version of this text should be added to >> commit log. >> > Sure i will resubmit this patch with this description should be ok? yup, sounds good. Thank you -- balbi ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2021-08-24 16:55 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-08-23 18:44 [PATCH 0/2] Add DWC3 controller suppport for AMD's platforms Nehal Bakulchandra Shah 2021-08-23 18:44 ` [PATCH 1/2] usb: dwc3: pci: add support for AMD's newer generation platform Nehal Bakulchandra Shah 2021-08-24 8:19 ` Felipe Balbi 2021-08-23 18:44 ` [PATCH 2/2] usb: dwc3: pci add property to allow user space role switch Nehal Bakulchandra Shah 2021-08-24 8:19 ` Felipe Balbi 2021-08-24 16:02 ` Shah, Nehal-bakulchandra 2021-08-24 16:17 ` Felipe Balbi 2021-08-24 16:28 ` Shah, Nehal-bakulchandra 2021-08-24 16:54 ` Felipe Balbi
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).