Some platforms initialize their eUSB2 to USB repeater in the previous
stage bootloader and leave it in a working state for linux. Make the
repeater optional in order to allow for reusing that state until
proper repeater drivers are introduced.
Signed-off-by: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
---
drivers/phy/phy-snps-eusb2.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/phy/phy-snps-eusb2.c b/drivers/phy/phy-snps-eusb2.c
index 4e5914a76..dcc69c00a 100644
--- a/drivers/phy/phy-snps-eusb2.c
+++ b/drivers/phy/phy-snps-eusb2.c
@@ -461,7 +461,7 @@ static int snps_eusb2_hsphy_probe(struct platform_device *pdev)
return dev_err_probe(dev, ret,
"failed to get regulator supplies\n");
- phy->repeater = devm_of_phy_get_by_index(dev, np, 0);
+ phy->repeater = devm_of_phy_optional_get(dev, np, 0);
if (IS_ERR(phy->repeater))
return dev_err_probe(dev, PTR_ERR(phy->repeater),
"failed to get repeater\n");
--
2.43.0
On Sun, Feb 23, 2025 at 02:22:24PM +0200, Ivaylo Ivanov wrote: > Some platforms initialize their eUSB2 to USB repeater in the previous > stage bootloader and leave it in a working state for linux. Make the > repeater optional in order to allow for reusing that state until > proper repeater drivers are introduced. Generally "works as it is setup by the bootloader" is a very invalid justification. Please don't do that. We should not be depending on the way the bootlader sets up the devices, unless that _really_ makes sense. > > Signed-off-by: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com> > --- > drivers/phy/phy-snps-eusb2.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/phy/phy-snps-eusb2.c b/drivers/phy/phy-snps-eusb2.c > index 4e5914a76..dcc69c00a 100644 > --- a/drivers/phy/phy-snps-eusb2.c > +++ b/drivers/phy/phy-snps-eusb2.c > @@ -461,7 +461,7 @@ static int snps_eusb2_hsphy_probe(struct platform_device *pdev) > return dev_err_probe(dev, ret, > "failed to get regulator supplies\n"); > > - phy->repeater = devm_of_phy_get_by_index(dev, np, 0); > + phy->repeater = devm_of_phy_optional_get(dev, np, 0); > if (IS_ERR(phy->repeater)) > return dev_err_probe(dev, PTR_ERR(phy->repeater), > "failed to get repeater\n"); > -- > 2.43.0 > -- With best wishes Dmitry
On 3/19/25 13:08, Dmitry Baryshkov wrote: > On Sun, Feb 23, 2025 at 02:22:24PM +0200, Ivaylo Ivanov wrote: >> Some platforms initialize their eUSB2 to USB repeater in the previous >> stage bootloader and leave it in a working state for linux. Make the >> repeater optional in order to allow for reusing that state until >> proper repeater drivers are introduced. > Generally "works as it is setup by the bootloader" is a very invalid > justification. Please don't do that. We should not be depending on the > way the bootlader sets up the devices, unless that _really_ makes sense. It does, doesn't it? We still don't even have i2c up on Exynos2200, so bringing up the repeater before this patchset gets merged is a no-go. Either way, we should follow what bindings say. I will change the commit description a bit. Best regards, Ivaylo > >> Signed-off-by: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com> >> --- >> drivers/phy/phy-snps-eusb2.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/phy/phy-snps-eusb2.c b/drivers/phy/phy-snps-eusb2.c >> index 4e5914a76..dcc69c00a 100644 >> --- a/drivers/phy/phy-snps-eusb2.c >> +++ b/drivers/phy/phy-snps-eusb2.c >> @@ -461,7 +461,7 @@ static int snps_eusb2_hsphy_probe(struct platform_device *pdev) >> return dev_err_probe(dev, ret, >> "failed to get regulator supplies\n"); >> >> - phy->repeater = devm_of_phy_get_by_index(dev, np, 0); >> + phy->repeater = devm_of_phy_optional_get(dev, np, 0); >> if (IS_ERR(phy->repeater)) >> return dev_err_probe(dev, PTR_ERR(phy->repeater), >> "failed to get repeater\n"); >> -- >> 2.43.0 >>
Hi Ivaylo,
kernel test robot noticed the following build warnings:
[auto build test WARNING on robh/for-next]
[also build test WARNING on linus/master v6.14-rc4 next-20250228]
[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#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Ivaylo-Ivanov/dt-bindings-phy-rename-qcom-snps-eusb2-phy-binding-to-snps-eusb2-phy/20250223-202709
base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
patch link: https://lore.kernel.org/r/20250223122227.725233-6-ivo.ivanov.ivanov1%40gmail.com
patch subject: [PATCH v2 5/8] phy: phy-snps-eusb2: make repeater optional
config: microblaze-randconfig-r123-20250302 (https://download.01.org/0day-ci/archive/20250302/202503020920.Kw0H8Acs-lkp@intel.com/config)
compiler: microblaze-linux-gcc (GCC) 14.2.0
reproduce: (https://download.01.org/0day-ci/archive/20250302/202503020920.Kw0H8Acs-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202503020920.Kw0H8Acs-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
>> drivers/phy/phy-snps-eusb2.c:464:59: sparse: sparse: Using plain integer as NULL pointer
vim +464 drivers/phy/phy-snps-eusb2.c
398
399 static int snps_eusb2_hsphy_probe(struct platform_device *pdev)
400 {
401 struct device *dev = &pdev->dev;
402 struct device_node *np = dev->of_node;
403 struct snps_eusb2_hsphy *phy;
404 struct phy_provider *phy_provider;
405 struct phy *generic_phy;
406 const struct snps_eusb2_phy_drvdata *drv_data;
407 int ret, i;
408 int num;
409
410 phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL);
411 if (!phy)
412 return -ENOMEM;
413
414 drv_data = of_device_get_match_data(dev);
415 if (!drv_data)
416 return -EINVAL;
417 phy->data = drv_data;
418
419 phy->base = devm_platform_ioremap_resource(pdev, 0);
420 if (IS_ERR(phy->base))
421 return PTR_ERR(phy->base);
422
423 phy->phy_reset = devm_reset_control_get_exclusive(dev, NULL);
424 if (IS_ERR(phy->phy_reset))
425 return PTR_ERR(phy->phy_reset);
426
427 phy->clks = devm_kcalloc(dev,
428 phy->data->num_clks,
429 sizeof(*phy->clks),
430 GFP_KERNEL);
431 if (!phy->clks)
432 return -ENOMEM;
433
434 for (int i = 0; i < phy->data->num_clks; ++i)
435 phy->clks[i].id = phy->data->clk_names[i];
436
437 ret = devm_clk_bulk_get(dev, phy->data->num_clks,
438 phy->clks);
439 if (ret)
440 return dev_err_probe(dev, ret,
441 "failed to get phy clock(s)\n");
442
443 phy->ref_clk = NULL;
444 for (int i = 0; i < phy->data->num_clks; ++i) {
445 if (!strcmp(phy->clks[i].id, "ref")) {
446 phy->ref_clk = phy->clks[i].clk;
447 break;
448 }
449 }
450
451 if (IS_ERR_OR_NULL(phy->ref_clk))
452 return dev_err_probe(dev, PTR_ERR(phy->ref_clk),
453 "failed to get ref clk\n");
454
455 num = ARRAY_SIZE(phy->vregs);
456 for (i = 0; i < num; i++)
457 phy->vregs[i].supply = eusb2_hsphy_vreg_names[i];
458
459 ret = devm_regulator_bulk_get(dev, num, phy->vregs);
460 if (ret)
461 return dev_err_probe(dev, ret,
462 "failed to get regulator supplies\n");
463
> 464 phy->repeater = devm_of_phy_optional_get(dev, np, 0);
465 if (IS_ERR(phy->repeater))
466 return dev_err_probe(dev, PTR_ERR(phy->repeater),
467 "failed to get repeater\n");
468
469 generic_phy = devm_phy_create(dev, NULL, &snps_eusb2_hsphy_ops);
470 if (IS_ERR(generic_phy)) {
471 dev_err(dev, "failed to create phy %d\n", ret);
472 return PTR_ERR(generic_phy);
473 }
474
475 dev_set_drvdata(dev, phy);
476 phy_set_drvdata(generic_phy, phy);
477
478 phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
479 if (IS_ERR(phy_provider))
480 return PTR_ERR(phy_provider);
481
482 dev_info(dev, "Registered Snps-eUSB2 phy\n");
483
484 return 0;
485 }
486
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
On 25-02-23 14:22:24, Ivaylo Ivanov wrote: > Some platforms initialize their eUSB2 to USB repeater in the previous > stage bootloader and leave it in a working state for linux. Make the > repeater optional in order to allow for reusing that state until > proper repeater drivers are introduced. > > Signed-off-by: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com> > --- > drivers/phy/phy-snps-eusb2.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/phy/phy-snps-eusb2.c b/drivers/phy/phy-snps-eusb2.c > index 4e5914a76..dcc69c00a 100644 > --- a/drivers/phy/phy-snps-eusb2.c > +++ b/drivers/phy/phy-snps-eusb2.c > @@ -461,7 +461,7 @@ static int snps_eusb2_hsphy_probe(struct platform_device *pdev) > return dev_err_probe(dev, ret, > "failed to get regulator supplies\n"); > > - phy->repeater = devm_of_phy_get_by_index(dev, np, 0); > + phy->repeater = devm_of_phy_optional_get(dev, np, 0); Maybe make it optional based on compatible or something? > if (IS_ERR(phy->repeater)) > return dev_err_probe(dev, PTR_ERR(phy->repeater), > "failed to get repeater\n"); > -- > 2.43.0 >
On 24/02/2025 11:11, Abel Vesa wrote: > On 25-02-23 14:22:24, Ivaylo Ivanov wrote: >> Some platforms initialize their eUSB2 to USB repeater in the previous >> stage bootloader and leave it in a working state for linux. Make the >> repeater optional in order to allow for reusing that state until >> proper repeater drivers are introduced. >> >> Signed-off-by: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com> >> --- >> drivers/phy/phy-snps-eusb2.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/phy/phy-snps-eusb2.c b/drivers/phy/phy-snps-eusb2.c >> index 4e5914a76..dcc69c00a 100644 >> --- a/drivers/phy/phy-snps-eusb2.c >> +++ b/drivers/phy/phy-snps-eusb2.c >> @@ -461,7 +461,7 @@ static int snps_eusb2_hsphy_probe(struct platform_device *pdev) >> return dev_err_probe(dev, ret, >> "failed to get regulator supplies\n"); >> >> - phy->repeater = devm_of_phy_get_by_index(dev, np, 0); >> + phy->repeater = devm_of_phy_optional_get(dev, np, 0); > > Maybe make it optional based on compatible or something? It's already optional in the bindings: Documentation/devicetree/bindings/phy/qcom,snps-eusb2-phy.yaml So it's: Acked-by: Neil Armstrong <neil.armstrong@linaro.org> > >> if (IS_ERR(phy->repeater)) >> return dev_err_probe(dev, PTR_ERR(phy->repeater), >> "failed to get repeater\n"); >> -- >> 2.43.0 >> >
© 2016 - 2025 Red Hat, Inc.