* [PATCH] usb: dwc3: qcom: add URS Host support for sdm845 ACPI boot
@ 2020-12-30 12:49 Shawn Guo
2020-12-30 16:00 ` kernel test robot
2021-01-15 3:53 ` Shawn Guo
0 siblings, 2 replies; 4+ messages in thread
From: Shawn Guo @ 2020-12-30 12:49 UTC (permalink / raw)
To: Bjorn Andersson, Felipe Balbi; +Cc: linux-arm-msm, linux-usb, Shawn Guo
For sdm845 ACPI boot, the URS (USB Role Switch) node in ACPI DSDT table
holds the memory resource, while interrupt resources reside in the child
nodes USB0 and UFN0. It adds USB0 host support by probing URS node,
creating platform device for USB0 node, and then retrieve interrupt
resources from USB0 platform device.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
drivers/usb/dwc3/dwc3-qcom.c | 50 +++++++++++++++++++++++++++++++++---
1 file changed, 47 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
index c703d552bbcf..5b70d34e75ab 100644
--- a/drivers/usb/dwc3/dwc3-qcom.c
+++ b/drivers/usb/dwc3/dwc3-qcom.c
@@ -60,12 +60,14 @@ struct dwc3_acpi_pdata {
int dp_hs_phy_irq_index;
int dm_hs_phy_irq_index;
int ss_phy_irq_index;
+ bool is_urs;
};
struct dwc3_qcom {
struct device *dev;
void __iomem *qscratch_base;
struct platform_device *dwc3;
+ struct platform_device *urs_usb;
struct clk **clks;
int num_clocks;
struct reset_control *resets;
@@ -429,13 +431,15 @@ static void dwc3_qcom_select_utmi_clk(struct dwc3_qcom *qcom)
static int dwc3_qcom_get_irq(struct platform_device *pdev,
const char *name, int num)
{
+ struct dwc3_qcom *qcom = platform_get_drvdata(pdev);
+ struct platform_device *pdev_irq = qcom->urs_usb ? qcom->urs_usb : pdev;
struct device_node *np = pdev->dev.of_node;
int ret;
if (np)
- ret = platform_get_irq_byname(pdev, name);
+ ret = platform_get_irq_byname(pdev_irq, name);
else
- ret = platform_get_irq(pdev, num);
+ ret = platform_get_irq(pdev_irq, num);
return ret;
}
@@ -568,6 +572,8 @@ static int dwc3_qcom_acpi_register_core(struct platform_device *pdev)
struct dwc3_qcom *qcom = platform_get_drvdata(pdev);
struct device *dev = &pdev->dev;
struct resource *res, *child_res = NULL;
+ struct platform_device *pdev_irq = qcom->urs_usb ? qcom->urs_usb :
+ pdev;
int irq;
int ret;
@@ -597,7 +603,7 @@ static int dwc3_qcom_acpi_register_core(struct platform_device *pdev)
child_res[0].end = child_res[0].start +
qcom->acpi_pdata->dwc3_core_base_size;
- irq = platform_get_irq(pdev, 0);
+ irq = platform_get_irq(pdev_irq, 0);
child_res[1].flags = IORESOURCE_IRQ;
child_res[1].start = child_res[1].end = irq;
@@ -651,6 +657,24 @@ static int dwc3_qcom_of_register_core(struct platform_device *pdev)
return 0;
}
+static struct platform_device *
+dwc3_qcom_create_urs_usb_platdev(struct device *dev)
+{
+ struct fwnode_handle *fwh;
+ struct acpi_device *adev;
+
+ /* Find the first child of URS node */
+ fwh = fwnode_call_ptr_op(dev->fwnode, get_next_child_node, NULL);
+ if (!fwh)
+ return NULL;
+
+ adev = to_acpi_device_node(fwh);
+ if (!adev)
+ return NULL;
+
+ return acpi_create_platform_device(adev, NULL);
+}
+
static int dwc3_qcom_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
@@ -715,6 +739,14 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
qcom->acpi_pdata->qscratch_base_offset;
parent_res->end = parent_res->start +
qcom->acpi_pdata->qscratch_base_size;
+
+ if (qcom->acpi_pdata->is_urs) {
+ qcom->urs_usb = dwc3_qcom_create_urs_usb_platdev(dev);
+ if (!qcom->urs_usb) {
+ dev_err(dev, "failed to create URS USB platdev\n");
+ return -ENODEV;
+ }
+ }
}
qcom->qscratch_base = devm_ioremap_resource(dev, parent_res);
@@ -877,8 +909,20 @@ static const struct dwc3_acpi_pdata sdm845_acpi_pdata = {
.ss_phy_irq_index = 2
};
+static const struct dwc3_acpi_pdata sdm845_acpi_urs_pdata = {
+ .qscratch_base_offset = SDM845_QSCRATCH_BASE_OFFSET,
+ .qscratch_base_size = SDM845_QSCRATCH_SIZE,
+ .dwc3_core_base_size = SDM845_DWC3_CORE_SIZE,
+ .hs_phy_irq_index = 1,
+ .dp_hs_phy_irq_index = 4,
+ .dm_hs_phy_irq_index = 3,
+ .ss_phy_irq_index = 2,
+ .is_urs = true,
+};
+
static const struct acpi_device_id dwc3_qcom_acpi_match[] = {
{ "QCOM2430", (unsigned long)&sdm845_acpi_pdata },
+ { "QCOM0304", (unsigned long)&sdm845_acpi_urs_pdata },
{ },
};
MODULE_DEVICE_TABLE(acpi, dwc3_qcom_acpi_match);
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] usb: dwc3: qcom: add URS Host support for sdm845 ACPI boot
2020-12-30 12:49 [PATCH] usb: dwc3: qcom: add URS Host support for sdm845 ACPI boot Shawn Guo
@ 2020-12-30 16:00 ` kernel test robot
2020-12-31 13:47 ` Shawn Guo
2021-01-15 3:53 ` Shawn Guo
1 sibling, 1 reply; 4+ messages in thread
From: kernel test robot @ 2020-12-30 16:00 UTC (permalink / raw)
To: Shawn Guo, Bjorn Andersson, Felipe Balbi
Cc: kbuild-all, linux-arm-msm, linux-usb, Shawn Guo
[-- Attachment #1: Type: text/plain, Size: 2833 bytes --]
Hi Shawn,
I love your patch! Perhaps something to improve:
[auto build test WARNING on balbi-usb/testing/next]
[also build test WARNING on v5.11-rc1 next-20201223]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Shawn-Guo/usb-dwc3-qcom-add-URS-Host-support-for-sdm845-ACPI-boot/20201230-205430
base: https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git testing/next
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/c3faeb501efb31e035beca1c0fee1cca6ec16392
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Shawn-Guo/usb-dwc3-qcom-add-URS-Host-support-for-sdm845-ACPI-boot/20201230-205430
git checkout c3faeb501efb31e035beca1c0fee1cca6ec16392
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=xtensa
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
drivers/usb/dwc3/dwc3-qcom.c: In function 'dwc3_qcom_create_urs_usb_platdev':
drivers/usb/dwc3/dwc3-qcom.c:675:9: error: implicit declaration of function 'acpi_create_platform_device' [-Werror=implicit-function-declaration]
675 | return acpi_create_platform_device(adev, NULL);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/usb/dwc3/dwc3-qcom.c:675:9: warning: returning 'int' from a function with return type 'struct platform_device *' makes pointer from integer without a cast [-Wint-conversion]
675 | return acpi_create_platform_device(adev, NULL);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +675 drivers/usb/dwc3/dwc3-qcom.c
659
660 static struct platform_device *
661 dwc3_qcom_create_urs_usb_platdev(struct device *dev)
662 {
663 struct fwnode_handle *fwh;
664 struct acpi_device *adev;
665
666 /* Find the first child of URS node */
667 fwh = fwnode_call_ptr_op(dev->fwnode, get_next_child_node, NULL);
668 if (!fwh)
669 return NULL;
670
671 adev = to_acpi_device_node(fwh);
672 if (!adev)
673 return NULL;
674
> 675 return acpi_create_platform_device(adev, NULL);
676 }
677
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 66235 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] usb: dwc3: qcom: add URS Host support for sdm845 ACPI boot
2020-12-30 16:00 ` kernel test robot
@ 2020-12-31 13:47 ` Shawn Guo
0 siblings, 0 replies; 4+ messages in thread
From: Shawn Guo @ 2020-12-31 13:47 UTC (permalink / raw)
To: kernel test robot
Cc: Bjorn Andersson, Felipe Balbi, kbuild-all, linux-arm-msm, linux-usb
On Thu, Dec 31, 2020 at 12:01 AM kernel test robot <lkp@intel.com> wrote:
>
> Hi Shawn,
>
> I love your patch! Perhaps something to improve:
>
> [auto build test WARNING on balbi-usb/testing/next]
> [also build test WARNING on v5.11-rc1 next-20201223]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch]
>
> url: https://github.com/0day-ci/linux/commits/Shawn-Guo/usb-dwc3-qcom-add-URS-Host-support-for-sdm845-ACPI-boot/20201230-205430
> base: https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git testing/next
> config: xtensa-allyesconfig (attached as .config)
> compiler: xtensa-linux-gcc (GCC) 9.3.0
> reproduce (this is a W=1 build):
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # https://github.com/0day-ci/linux/commit/c3faeb501efb31e035beca1c0fee1cca6ec16392
> git remote add linux-review https://github.com/0day-ci/linux
> git fetch --no-tags linux-review Shawn-Guo/usb-dwc3-qcom-add-URS-Host-support-for-sdm845-ACPI-boot/20201230-205430
> git checkout c3faeb501efb31e035beca1c0fee1cca6ec16392
> # save the attached .config to linux build tree
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=xtensa
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
>
> All warnings (new ones prefixed by >>):
>
> drivers/usb/dwc3/dwc3-qcom.c: In function 'dwc3_qcom_create_urs_usb_platdev':
> drivers/usb/dwc3/dwc3-qcom.c:675:9: error: implicit declaration of function 'acpi_create_platform_device' [-Werror=implicit-function-declaration]
> 675 | return acpi_create_platform_device(adev, NULL);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> >> drivers/usb/dwc3/dwc3-qcom.c:675:9: warning: returning 'int' from a function with return type 'struct platform_device *' makes pointer from integer without a cast [-Wint-conversion]
> 675 | return acpi_create_platform_device(adev, NULL);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> cc1: some warnings being treated as errors
Just sent out a patch [1] to address the problem in ACPI core.
Shawn
[1] https://lkml.org/lkml/2020/12/31/60
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] usb: dwc3: qcom: add URS Host support for sdm845 ACPI boot
2020-12-30 12:49 [PATCH] usb: dwc3: qcom: add URS Host support for sdm845 ACPI boot Shawn Guo
2020-12-30 16:00 ` kernel test robot
@ 2021-01-15 3:53 ` Shawn Guo
1 sibling, 0 replies; 4+ messages in thread
From: Shawn Guo @ 2021-01-15 3:53 UTC (permalink / raw)
To: Bjorn Andersson, Felipe Balbi; +Cc: linux-arm-msm, linux-usb
On Wed, Dec 30, 2020 at 08:49:25PM +0800, Shawn Guo wrote:
> For sdm845 ACPI boot, the URS (USB Role Switch) node in ACPI DSDT table
> holds the memory resource, while interrupt resources reside in the child
> nodes USB0 and UFN0. It adds USB0 host support by probing URS node,
> creating platform device for USB0 node, and then retrieve interrupt
> resources from USB0 platform device.
>
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Just sent out v2 to search child using node name rather than assuming
it's always the first one.
Shawn
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-01-15 3:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-30 12:49 [PATCH] usb: dwc3: qcom: add URS Host support for sdm845 ACPI boot Shawn Guo
2020-12-30 16:00 ` kernel test robot
2020-12-31 13:47 ` Shawn Guo
2021-01-15 3:53 ` Shawn Guo
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).