* [PATCH v3 0/3] arm64: add ethernet to orange pi 3
@ 2022-05-23 5:28 ` Corentin Labbe
0 siblings, 0 replies; 18+ messages in thread
From: Corentin Labbe @ 2022-05-23 5:28 UTC (permalink / raw)
To: andrew, broonie, calvin.johnson, davem, edumazet, hkallweit1,
jernej.skrabec, krzysztof.kozlowski+dt, kuba, lgirdwood, linux,
pabeni, robh+dt, samuel, wens
Cc: devicetree, linux-arm-kernel, linux-kernel, linux-sunxi, netdev,
Corentin Labbe
Hello
2 sunxi board still does not have ethernet working, orangepi 1+ and
orangepi 3.
This is due to the fact thoses boards have a PHY which need 2 regulators.
A first attempt by Ondřej Jirman was made to support them was made by adding support in
stmmac driver:
https://lore.kernel.org/lkml/20190820145343.29108-6-megous@megous.com/
Proposal rejected, since regulators need to be handled by the PHY core.
My first tentative was to just add handling of phy and phy-io in
phy-core:
https://lore.kernel.org/netdev/20220509074857.195302-7-clabbe@baylibre.com/T/
But having hard-coded phy names was rejected.
Second tentative tryed the same path than clocks and clock-names for
regulators.
https://lore.kernel.org/netdev/0518eef1-75a6-fbfe-96d8-bb1fc4e5178a@linaro.org/t/
But using this was rejected by DT maintainers.
So v3 use a new regulator_bulk_get_all() which grab all supplies
properties in a DT node.
But this way could have some problem, a netdev driver could handle
already its PHY (like dwmac-sun8i already do) and so both phy-core and
the netdev will use both.
It is why phy-supply was renamed in ephy-supply in patch #3.
This serie was tested on whole range of board and PHY architecture:
- internal PHY
* sun8i-h3-orangepi-pc
- external PHY
* sun50i-h6-pine-h64
* sun8i-r40-bananapi-m2-ultra
* sun8i-a83t-bananapi-m3
* sun50i-a64-bananapi-m64
* sun50i-h6-orangepi-3
* sun50i-h5-nanopi-neo-plus2
The resume/suspend of PHY was tested.
Regards
changes since v1:
- Add regulator_bulk_get_all for ease handling of PHY regulators
- Removed all convertion patchs to keep DT compatibility.
Changes since v2:
- removed use of regulator-names and regulators list.
Corentin Labbe (2):
regulator: Add regulator_bulk_get_all
phy: handle optional regulator for PHY
Ondřej Jirman (1):
arm64: dts: allwinner: orange-pi-3: Enable ethernet
.../dts/allwinner/sun50i-h6-orangepi-3.dts | 38 ++++++++
drivers/net/mdio/Kconfig | 1 +
drivers/net/mdio/fwnode_mdio.c | 36 +++++++-
drivers/net/phy/phy_device.c | 10 ++
drivers/regulator/core.c | 92 +++++++++++++++++++
include/linux/phy.h | 3 +
include/linux/regulator/consumer.h | 2 +
7 files changed, 178 insertions(+), 4 deletions(-)
--
2.35.1
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH v3 0/3] arm64: add ethernet to orange pi 3
@ 2022-05-23 5:28 ` Corentin Labbe
0 siblings, 0 replies; 18+ messages in thread
From: Corentin Labbe @ 2022-05-23 5:28 UTC (permalink / raw)
To: andrew, broonie, calvin.johnson, davem, edumazet, hkallweit1,
jernej.skrabec, krzysztof.kozlowski+dt, kuba, lgirdwood, linux,
pabeni, robh+dt, samuel, wens
Cc: devicetree, linux-arm-kernel, linux-kernel, linux-sunxi, netdev,
Corentin Labbe
Hello
2 sunxi board still does not have ethernet working, orangepi 1+ and
orangepi 3.
This is due to the fact thoses boards have a PHY which need 2 regulators.
A first attempt by Ondřej Jirman was made to support them was made by adding support in
stmmac driver:
https://lore.kernel.org/lkml/20190820145343.29108-6-megous@megous.com/
Proposal rejected, since regulators need to be handled by the PHY core.
My first tentative was to just add handling of phy and phy-io in
phy-core:
https://lore.kernel.org/netdev/20220509074857.195302-7-clabbe@baylibre.com/T/
But having hard-coded phy names was rejected.
Second tentative tryed the same path than clocks and clock-names for
regulators.
https://lore.kernel.org/netdev/0518eef1-75a6-fbfe-96d8-bb1fc4e5178a@linaro.org/t/
But using this was rejected by DT maintainers.
So v3 use a new regulator_bulk_get_all() which grab all supplies
properties in a DT node.
But this way could have some problem, a netdev driver could handle
already its PHY (like dwmac-sun8i already do) and so both phy-core and
the netdev will use both.
It is why phy-supply was renamed in ephy-supply in patch #3.
This serie was tested on whole range of board and PHY architecture:
- internal PHY
* sun8i-h3-orangepi-pc
- external PHY
* sun50i-h6-pine-h64
* sun8i-r40-bananapi-m2-ultra
* sun8i-a83t-bananapi-m3
* sun50i-a64-bananapi-m64
* sun50i-h6-orangepi-3
* sun50i-h5-nanopi-neo-plus2
The resume/suspend of PHY was tested.
Regards
changes since v1:
- Add regulator_bulk_get_all for ease handling of PHY regulators
- Removed all convertion patchs to keep DT compatibility.
Changes since v2:
- removed use of regulator-names and regulators list.
Corentin Labbe (2):
regulator: Add regulator_bulk_get_all
phy: handle optional regulator for PHY
Ondřej Jirman (1):
arm64: dts: allwinner: orange-pi-3: Enable ethernet
.../dts/allwinner/sun50i-h6-orangepi-3.dts | 38 ++++++++
drivers/net/mdio/Kconfig | 1 +
drivers/net/mdio/fwnode_mdio.c | 36 +++++++-
drivers/net/phy/phy_device.c | 10 ++
drivers/regulator/core.c | 92 +++++++++++++++++++
include/linux/phy.h | 3 +
include/linux/regulator/consumer.h | 2 +
7 files changed, 178 insertions(+), 4 deletions(-)
--
2.35.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH v3 1/3] regulator: Add regulator_bulk_get_all
2022-05-23 5:28 ` Corentin Labbe
@ 2022-05-23 5:28 ` Corentin Labbe
-1 siblings, 0 replies; 18+ messages in thread
From: Corentin Labbe @ 2022-05-23 5:28 UTC (permalink / raw)
To: andrew, broonie, calvin.johnson, davem, edumazet, hkallweit1,
jernej.skrabec, krzysztof.kozlowski+dt, kuba, lgirdwood, linux,
pabeni, robh+dt, samuel, wens
Cc: devicetree, linux-arm-kernel, linux-kernel, linux-sunxi, netdev,
Corentin Labbe
It work exactly like regulator_bulk_get() but instead of working on a
provided list of names, it seek all consumers properties matching
xxx-supply.
Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
---
drivers/regulator/core.c | 92 ++++++++++++++++++++++++++++++
include/linux/regulator/consumer.h | 2 +
2 files changed, 94 insertions(+)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 1e54a833f2cf..7286bcf3821a 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -4813,6 +4813,98 @@ static void regulator_bulk_enable_async(void *data, async_cookie_t cookie)
bulk->ret = regulator_enable(bulk->consumer);
}
+/*
+ * Check if name is a supply name according to the '*-supply' pattern
+ * return 0 if false
+ * return length of supply name without the -supply
+ */
+static int is_supply_name(const char *name)
+{
+ int strs, i;
+
+ strs = strlen(name);
+ /* string need to be at minimum len(x-supply) */
+ if (strs < 8)
+ return 0;
+ for (i = strs - 6; i > 0; i--) {
+ /* find first '-' and check if right part is supply */
+ if (name[i] != '-')
+ continue;
+ if (strcmp(name + i + 1, "supply") != 0)
+ return 0;
+ return i;
+ }
+ return 0;
+}
+
+/*
+ * regulator_bulk_get_all - get multiple regulator consumers
+ *
+ * @dev: Device to supply
+ * @np: device node to search for consumers
+ * @consumers: Configuration of consumers; clients are stored here.
+ *
+ * @return number of regulators on success, an errno on failure.
+ *
+ * This helper function allows drivers to get several regulator
+ * consumers in one operation. If any of the regulators cannot be
+ * acquired then any regulators that were allocated will be freed
+ * before returning to the caller.
+ */
+int regulator_bulk_get_all(struct device *dev, struct device_node *np,
+ struct regulator_bulk_data **consumers)
+{
+ int num_consumers = 0;
+ struct regulator *tmp;
+ struct property *prop;
+ int i, n = 0, ret;
+ char name[64];
+
+ *consumers = NULL;
+
+/*
+ * first pass: get numbers of xxx-supply
+ * second pass: fill consumers
+ * */
+restart:
+ for_each_property_of_node(np, prop) {
+ i = is_supply_name(prop->name);
+ if (i == 0)
+ continue;
+ if (!*consumers) {
+ num_consumers++;
+ continue;
+ } else {
+ memcpy(name, prop->name, i);
+ name[i] = '\0';
+ tmp = regulator_get(dev, name);
+ if (!tmp) {
+ ret = -EINVAL;
+ goto error;
+ }
+ (*consumers)[n].consumer = tmp;
+ n++;
+ continue;
+ }
+ }
+ if (*consumers)
+ return num_consumers;
+ if (num_consumers == 0)
+ return 0;
+ *consumers = kmalloc_array(num_consumers,
+ sizeof(struct regulator_bulk_data),
+ GFP_KERNEL);
+ if (!*consumers)
+ return -ENOMEM;
+ goto restart;
+
+error:
+ while (--n >= 0)
+ regulator_put(consumers[n]->consumer);
+ return ret;
+}
+EXPORT_SYMBOL_GPL(regulator_bulk_get_all);
+
/**
* regulator_bulk_enable - enable multiple regulator consumers
*
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index bbf6590a6dec..b9b1d1cbdd07 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -238,6 +238,8 @@ int regulator_disable_deferred(struct regulator *regulator, int ms);
int __must_check regulator_bulk_get(struct device *dev, int num_consumers,
struct regulator_bulk_data *consumers);
+int __must_check regulator_bulk_get_all(struct device *dev, struct device_node *np,
+ struct regulator_bulk_data **consumers);
int __must_check devm_regulator_bulk_get(struct device *dev, int num_consumers,
struct regulator_bulk_data *consumers);
int __must_check regulator_bulk_enable(int num_consumers,
--
2.35.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v3 1/3] regulator: Add regulator_bulk_get_all
@ 2022-05-23 5:28 ` Corentin Labbe
0 siblings, 0 replies; 18+ messages in thread
From: Corentin Labbe @ 2022-05-23 5:28 UTC (permalink / raw)
To: andrew, broonie, calvin.johnson, davem, edumazet, hkallweit1,
jernej.skrabec, krzysztof.kozlowski+dt, kuba, lgirdwood, linux,
pabeni, robh+dt, samuel, wens
Cc: devicetree, linux-arm-kernel, linux-kernel, linux-sunxi, netdev,
Corentin Labbe
It work exactly like regulator_bulk_get() but instead of working on a
provided list of names, it seek all consumers properties matching
xxx-supply.
Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
---
drivers/regulator/core.c | 92 ++++++++++++++++++++++++++++++
include/linux/regulator/consumer.h | 2 +
2 files changed, 94 insertions(+)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 1e54a833f2cf..7286bcf3821a 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -4813,6 +4813,98 @@ static void regulator_bulk_enable_async(void *data, async_cookie_t cookie)
bulk->ret = regulator_enable(bulk->consumer);
}
+/*
+ * Check if name is a supply name according to the '*-supply' pattern
+ * return 0 if false
+ * return length of supply name without the -supply
+ */
+static int is_supply_name(const char *name)
+{
+ int strs, i;
+
+ strs = strlen(name);
+ /* string need to be at minimum len(x-supply) */
+ if (strs < 8)
+ return 0;
+ for (i = strs - 6; i > 0; i--) {
+ /* find first '-' and check if right part is supply */
+ if (name[i] != '-')
+ continue;
+ if (strcmp(name + i + 1, "supply") != 0)
+ return 0;
+ return i;
+ }
+ return 0;
+}
+
+/*
+ * regulator_bulk_get_all - get multiple regulator consumers
+ *
+ * @dev: Device to supply
+ * @np: device node to search for consumers
+ * @consumers: Configuration of consumers; clients are stored here.
+ *
+ * @return number of regulators on success, an errno on failure.
+ *
+ * This helper function allows drivers to get several regulator
+ * consumers in one operation. If any of the regulators cannot be
+ * acquired then any regulators that were allocated will be freed
+ * before returning to the caller.
+ */
+int regulator_bulk_get_all(struct device *dev, struct device_node *np,
+ struct regulator_bulk_data **consumers)
+{
+ int num_consumers = 0;
+ struct regulator *tmp;
+ struct property *prop;
+ int i, n = 0, ret;
+ char name[64];
+
+ *consumers = NULL;
+
+/*
+ * first pass: get numbers of xxx-supply
+ * second pass: fill consumers
+ * */
+restart:
+ for_each_property_of_node(np, prop) {
+ i = is_supply_name(prop->name);
+ if (i == 0)
+ continue;
+ if (!*consumers) {
+ num_consumers++;
+ continue;
+ } else {
+ memcpy(name, prop->name, i);
+ name[i] = '\0';
+ tmp = regulator_get(dev, name);
+ if (!tmp) {
+ ret = -EINVAL;
+ goto error;
+ }
+ (*consumers)[n].consumer = tmp;
+ n++;
+ continue;
+ }
+ }
+ if (*consumers)
+ return num_consumers;
+ if (num_consumers == 0)
+ return 0;
+ *consumers = kmalloc_array(num_consumers,
+ sizeof(struct regulator_bulk_data),
+ GFP_KERNEL);
+ if (!*consumers)
+ return -ENOMEM;
+ goto restart;
+
+error:
+ while (--n >= 0)
+ regulator_put(consumers[n]->consumer);
+ return ret;
+}
+EXPORT_SYMBOL_GPL(regulator_bulk_get_all);
+
/**
* regulator_bulk_enable - enable multiple regulator consumers
*
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index bbf6590a6dec..b9b1d1cbdd07 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -238,6 +238,8 @@ int regulator_disable_deferred(struct regulator *regulator, int ms);
int __must_check regulator_bulk_get(struct device *dev, int num_consumers,
struct regulator_bulk_data *consumers);
+int __must_check regulator_bulk_get_all(struct device *dev, struct device_node *np,
+ struct regulator_bulk_data **consumers);
int __must_check devm_regulator_bulk_get(struct device *dev, int num_consumers,
struct regulator_bulk_data *consumers);
int __must_check regulator_bulk_enable(int num_consumers,
--
2.35.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH v3 1/3] regulator: Add regulator_bulk_get_all
2022-05-23 5:28 ` Corentin Labbe
@ 2022-05-23 9:54 ` kernel test robot
-1 siblings, 0 replies; 18+ messages in thread
From: kernel test robot @ 2022-05-23 9:54 UTC (permalink / raw)
To: Corentin Labbe, andrew, broonie, calvin.johnson, davem, edumazet,
hkallweit1, jernej.skrabec, krzysztof.kozlowski+dt, kuba,
lgirdwood, linux, pabeni, robh+dt, samuel, wens
Cc: llvm, kbuild-all, devicetree, linux-arm-kernel, linux-kernel,
linux-sunxi, netdev, Corentin Labbe
Hi Corentin,
I love your patch! Yet something to improve:
[auto build test ERROR on broonie-regulator/for-next]
[also build test ERROR on sunxi/sunxi/for-next linus/master v5.18 next-20220520]
[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/intel-lab-lkp/linux/commits/Corentin-Labbe/arm64-add-ethernet-to-orange-pi-3/20220523-133344
base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next
config: i386-randconfig-a012-20220523 (https://download.01.org/0day-ci/archive/20220523/202205231748.IZoXf2Sf-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 768a1ca5eccb678947f4155e38a5f5744dcefb56)
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/intel-lab-lkp/linux/commit/179be86f748a2cce87423bb16f4f967c97bf5d9b
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Corentin-Labbe/arm64-add-ethernet-to-orange-pi-3/20220523-133344
git checkout 179be86f748a2cce87423bb16f4f967c97bf5d9b
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
>> drivers/regulator/core.c:4870:2: error: call to undeclared function 'for_each_property_of_node'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
for_each_property_of_node(np, prop) {
^
>> drivers/regulator/core.c:4870:37: error: expected ';' after expression
for_each_property_of_node(np, prop) {
^
;
>> drivers/regulator/core.c:4873:4: error: 'continue' statement not in loop statement
continue;
^
drivers/regulator/core.c:4876:4: error: 'continue' statement not in loop statement
continue;
^
drivers/regulator/core.c:4887:4: error: 'continue' statement not in loop statement
continue;
^
5 errors generated.
vim +/for_each_property_of_node +4870 drivers/regulator/core.c
4839
4840 /*
4841 * regulator_bulk_get_all - get multiple regulator consumers
4842 *
4843 * @dev: Device to supply
4844 * @np: device node to search for consumers
4845 * @consumers: Configuration of consumers; clients are stored here.
4846 *
4847 * @return number of regulators on success, an errno on failure.
4848 *
4849 * This helper function allows drivers to get several regulator
4850 * consumers in one operation. If any of the regulators cannot be
4851 * acquired then any regulators that were allocated will be freed
4852 * before returning to the caller.
4853 */
4854 int regulator_bulk_get_all(struct device *dev, struct device_node *np,
4855 struct regulator_bulk_data **consumers)
4856 {
4857 int num_consumers = 0;
4858 struct regulator *tmp;
4859 struct property *prop;
4860 int i, n = 0, ret;
4861 char name[64];
4862
4863 *consumers = NULL;
4864
4865 /*
4866 * first pass: get numbers of xxx-supply
4867 * second pass: fill consumers
4868 * */
4869 restart:
> 4870 for_each_property_of_node(np, prop) {
4871 i = is_supply_name(prop->name);
4872 if (i == 0)
> 4873 continue;
4874 if (!*consumers) {
4875 num_consumers++;
4876 continue;
4877 } else {
4878 memcpy(name, prop->name, i);
4879 name[i] = '\0';
4880 tmp = regulator_get(dev, name);
4881 if (!tmp) {
4882 ret = -EINVAL;
4883 goto error;
4884 }
4885 (*consumers)[n].consumer = tmp;
4886 n++;
4887 continue;
4888 }
4889 }
4890 if (*consumers)
4891 return num_consumers;
4892 if (num_consumers == 0)
4893 return 0;
4894 *consumers = kmalloc_array(num_consumers,
4895 sizeof(struct regulator_bulk_data),
4896 GFP_KERNEL);
4897 if (!*consumers)
4898 return -ENOMEM;
4899 goto restart;
4900
4901 error:
4902 while (--n >= 0)
4903 regulator_put(consumers[n]->consumer);
4904 return ret;
4905 }
4906 EXPORT_SYMBOL_GPL(regulator_bulk_get_all);
4907
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v3 1/3] regulator: Add regulator_bulk_get_all
@ 2022-05-23 9:54 ` kernel test robot
0 siblings, 0 replies; 18+ messages in thread
From: kernel test robot @ 2022-05-23 9:54 UTC (permalink / raw)
To: Corentin Labbe, andrew, broonie, calvin.johnson, davem, edumazet,
hkallweit1, jernej.skrabec, krzysztof.kozlowski+dt, kuba,
lgirdwood, linux, pabeni, robh+dt, samuel, wens
Cc: llvm, kbuild-all, devicetree, linux-arm-kernel, linux-kernel,
linux-sunxi, netdev, Corentin Labbe
Hi Corentin,
I love your patch! Yet something to improve:
[auto build test ERROR on broonie-regulator/for-next]
[also build test ERROR on sunxi/sunxi/for-next linus/master v5.18 next-20220520]
[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/intel-lab-lkp/linux/commits/Corentin-Labbe/arm64-add-ethernet-to-orange-pi-3/20220523-133344
base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next
config: i386-randconfig-a012-20220523 (https://download.01.org/0day-ci/archive/20220523/202205231748.IZoXf2Sf-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 768a1ca5eccb678947f4155e38a5f5744dcefb56)
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/intel-lab-lkp/linux/commit/179be86f748a2cce87423bb16f4f967c97bf5d9b
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Corentin-Labbe/arm64-add-ethernet-to-orange-pi-3/20220523-133344
git checkout 179be86f748a2cce87423bb16f4f967c97bf5d9b
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
>> drivers/regulator/core.c:4870:2: error: call to undeclared function 'for_each_property_of_node'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
for_each_property_of_node(np, prop) {
^
>> drivers/regulator/core.c:4870:37: error: expected ';' after expression
for_each_property_of_node(np, prop) {
^
;
>> drivers/regulator/core.c:4873:4: error: 'continue' statement not in loop statement
continue;
^
drivers/regulator/core.c:4876:4: error: 'continue' statement not in loop statement
continue;
^
drivers/regulator/core.c:4887:4: error: 'continue' statement not in loop statement
continue;
^
5 errors generated.
vim +/for_each_property_of_node +4870 drivers/regulator/core.c
4839
4840 /*
4841 * regulator_bulk_get_all - get multiple regulator consumers
4842 *
4843 * @dev: Device to supply
4844 * @np: device node to search for consumers
4845 * @consumers: Configuration of consumers; clients are stored here.
4846 *
4847 * @return number of regulators on success, an errno on failure.
4848 *
4849 * This helper function allows drivers to get several regulator
4850 * consumers in one operation. If any of the regulators cannot be
4851 * acquired then any regulators that were allocated will be freed
4852 * before returning to the caller.
4853 */
4854 int regulator_bulk_get_all(struct device *dev, struct device_node *np,
4855 struct regulator_bulk_data **consumers)
4856 {
4857 int num_consumers = 0;
4858 struct regulator *tmp;
4859 struct property *prop;
4860 int i, n = 0, ret;
4861 char name[64];
4862
4863 *consumers = NULL;
4864
4865 /*
4866 * first pass: get numbers of xxx-supply
4867 * second pass: fill consumers
4868 * */
4869 restart:
> 4870 for_each_property_of_node(np, prop) {
4871 i = is_supply_name(prop->name);
4872 if (i == 0)
> 4873 continue;
4874 if (!*consumers) {
4875 num_consumers++;
4876 continue;
4877 } else {
4878 memcpy(name, prop->name, i);
4879 name[i] = '\0';
4880 tmp = regulator_get(dev, name);
4881 if (!tmp) {
4882 ret = -EINVAL;
4883 goto error;
4884 }
4885 (*consumers)[n].consumer = tmp;
4886 n++;
4887 continue;
4888 }
4889 }
4890 if (*consumers)
4891 return num_consumers;
4892 if (num_consumers == 0)
4893 return 0;
4894 *consumers = kmalloc_array(num_consumers,
4895 sizeof(struct regulator_bulk_data),
4896 GFP_KERNEL);
4897 if (!*consumers)
4898 return -ENOMEM;
4899 goto restart;
4900
4901 error:
4902 while (--n >= 0)
4903 regulator_put(consumers[n]->consumer);
4904 return ret;
4905 }
4906 EXPORT_SYMBOL_GPL(regulator_bulk_get_all);
4907
--
0-DAY CI Kernel Test Service
https://01.org/lkp
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v3 1/3] regulator: Add regulator_bulk_get_all
2022-05-23 5:28 ` Corentin Labbe
@ 2022-05-23 10:04 ` kernel test robot
-1 siblings, 0 replies; 18+ messages in thread
From: kernel test robot @ 2022-05-23 10:04 UTC (permalink / raw)
To: Corentin Labbe, andrew, broonie, calvin.johnson, davem, edumazet,
hkallweit1, jernej.skrabec, krzysztof.kozlowski+dt, kuba,
lgirdwood, linux, pabeni, robh+dt, samuel, wens
Cc: llvm, kbuild-all, devicetree, linux-arm-kernel, linux-kernel,
linux-sunxi, netdev, Corentin Labbe
Hi Corentin,
I love your patch! Yet something to improve:
[auto build test ERROR on broonie-regulator/for-next]
[also build test ERROR on sunxi/sunxi/for-next linus/master v5.18 next-20220520]
[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/intel-lab-lkp/linux/commits/Corentin-Labbe/arm64-add-ethernet-to-orange-pi-3/20220523-133344
base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next
config: hexagon-buildonly-randconfig-r002-20220522 (https://download.01.org/0day-ci/archive/20220523/202205231709.3Wo0pW9z-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 768a1ca5eccb678947f4155e38a5f5744dcefb56)
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/intel-lab-lkp/linux/commit/179be86f748a2cce87423bb16f4f967c97bf5d9b
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Corentin-Labbe/arm64-add-ethernet-to-orange-pi-3/20220523-133344
git checkout 179be86f748a2cce87423bb16f4f967c97bf5d9b
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
>> drivers/regulator/core.c:4870:2: error: call to undeclared function 'for_each_property_of_node'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
for_each_property_of_node(np, prop) {
^
>> drivers/regulator/core.c:4870:37: error: expected ';' after expression
for_each_property_of_node(np, prop) {
^
;
>> drivers/regulator/core.c:4873:4: error: 'continue' statement not in loop statement
continue;
^
drivers/regulator/core.c:4876:4: error: 'continue' statement not in loop statement
continue;
^
drivers/regulator/core.c:4887:4: error: 'continue' statement not in loop statement
continue;
^
5 errors generated.
vim +/for_each_property_of_node +4870 drivers/regulator/core.c
4839
4840 /*
4841 * regulator_bulk_get_all - get multiple regulator consumers
4842 *
4843 * @dev: Device to supply
4844 * @np: device node to search for consumers
4845 * @consumers: Configuration of consumers; clients are stored here.
4846 *
4847 * @return number of regulators on success, an errno on failure.
4848 *
4849 * This helper function allows drivers to get several regulator
4850 * consumers in one operation. If any of the regulators cannot be
4851 * acquired then any regulators that were allocated will be freed
4852 * before returning to the caller.
4853 */
4854 int regulator_bulk_get_all(struct device *dev, struct device_node *np,
4855 struct regulator_bulk_data **consumers)
4856 {
4857 int num_consumers = 0;
4858 struct regulator *tmp;
4859 struct property *prop;
4860 int i, n = 0, ret;
4861 char name[64];
4862
4863 *consumers = NULL;
4864
4865 /*
4866 * first pass: get numbers of xxx-supply
4867 * second pass: fill consumers
4868 * */
4869 restart:
> 4870 for_each_property_of_node(np, prop) {
4871 i = is_supply_name(prop->name);
4872 if (i == 0)
> 4873 continue;
4874 if (!*consumers) {
4875 num_consumers++;
4876 continue;
4877 } else {
4878 memcpy(name, prop->name, i);
4879 name[i] = '\0';
4880 tmp = regulator_get(dev, name);
4881 if (!tmp) {
4882 ret = -EINVAL;
4883 goto error;
4884 }
4885 (*consumers)[n].consumer = tmp;
4886 n++;
4887 continue;
4888 }
4889 }
4890 if (*consumers)
4891 return num_consumers;
4892 if (num_consumers == 0)
4893 return 0;
4894 *consumers = kmalloc_array(num_consumers,
4895 sizeof(struct regulator_bulk_data),
4896 GFP_KERNEL);
4897 if (!*consumers)
4898 return -ENOMEM;
4899 goto restart;
4900
4901 error:
4902 while (--n >= 0)
4903 regulator_put(consumers[n]->consumer);
4904 return ret;
4905 }
4906 EXPORT_SYMBOL_GPL(regulator_bulk_get_all);
4907
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v3 1/3] regulator: Add regulator_bulk_get_all
@ 2022-05-23 10:04 ` kernel test robot
0 siblings, 0 replies; 18+ messages in thread
From: kernel test robot @ 2022-05-23 10:04 UTC (permalink / raw)
To: Corentin Labbe, andrew, broonie, calvin.johnson, davem, edumazet,
hkallweit1, jernej.skrabec, krzysztof.kozlowski+dt, kuba,
lgirdwood, linux, pabeni, robh+dt, samuel, wens
Cc: llvm, kbuild-all, devicetree, linux-arm-kernel, linux-kernel,
linux-sunxi, netdev, Corentin Labbe
Hi Corentin,
I love your patch! Yet something to improve:
[auto build test ERROR on broonie-regulator/for-next]
[also build test ERROR on sunxi/sunxi/for-next linus/master v5.18 next-20220520]
[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/intel-lab-lkp/linux/commits/Corentin-Labbe/arm64-add-ethernet-to-orange-pi-3/20220523-133344
base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next
config: hexagon-buildonly-randconfig-r002-20220522 (https://download.01.org/0day-ci/archive/20220523/202205231709.3Wo0pW9z-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 768a1ca5eccb678947f4155e38a5f5744dcefb56)
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/intel-lab-lkp/linux/commit/179be86f748a2cce87423bb16f4f967c97bf5d9b
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Corentin-Labbe/arm64-add-ethernet-to-orange-pi-3/20220523-133344
git checkout 179be86f748a2cce87423bb16f4f967c97bf5d9b
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
>> drivers/regulator/core.c:4870:2: error: call to undeclared function 'for_each_property_of_node'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
for_each_property_of_node(np, prop) {
^
>> drivers/regulator/core.c:4870:37: error: expected ';' after expression
for_each_property_of_node(np, prop) {
^
;
>> drivers/regulator/core.c:4873:4: error: 'continue' statement not in loop statement
continue;
^
drivers/regulator/core.c:4876:4: error: 'continue' statement not in loop statement
continue;
^
drivers/regulator/core.c:4887:4: error: 'continue' statement not in loop statement
continue;
^
5 errors generated.
vim +/for_each_property_of_node +4870 drivers/regulator/core.c
4839
4840 /*
4841 * regulator_bulk_get_all - get multiple regulator consumers
4842 *
4843 * @dev: Device to supply
4844 * @np: device node to search for consumers
4845 * @consumers: Configuration of consumers; clients are stored here.
4846 *
4847 * @return number of regulators on success, an errno on failure.
4848 *
4849 * This helper function allows drivers to get several regulator
4850 * consumers in one operation. If any of the regulators cannot be
4851 * acquired then any regulators that were allocated will be freed
4852 * before returning to the caller.
4853 */
4854 int regulator_bulk_get_all(struct device *dev, struct device_node *np,
4855 struct regulator_bulk_data **consumers)
4856 {
4857 int num_consumers = 0;
4858 struct regulator *tmp;
4859 struct property *prop;
4860 int i, n = 0, ret;
4861 char name[64];
4862
4863 *consumers = NULL;
4864
4865 /*
4866 * first pass: get numbers of xxx-supply
4867 * second pass: fill consumers
4868 * */
4869 restart:
> 4870 for_each_property_of_node(np, prop) {
4871 i = is_supply_name(prop->name);
4872 if (i == 0)
> 4873 continue;
4874 if (!*consumers) {
4875 num_consumers++;
4876 continue;
4877 } else {
4878 memcpy(name, prop->name, i);
4879 name[i] = '\0';
4880 tmp = regulator_get(dev, name);
4881 if (!tmp) {
4882 ret = -EINVAL;
4883 goto error;
4884 }
4885 (*consumers)[n].consumer = tmp;
4886 n++;
4887 continue;
4888 }
4889 }
4890 if (*consumers)
4891 return num_consumers;
4892 if (num_consumers == 0)
4893 return 0;
4894 *consumers = kmalloc_array(num_consumers,
4895 sizeof(struct regulator_bulk_data),
4896 GFP_KERNEL);
4897 if (!*consumers)
4898 return -ENOMEM;
4899 goto restart;
4900
4901 error:
4902 while (--n >= 0)
4903 regulator_put(consumers[n]->consumer);
4904 return ret;
4905 }
4906 EXPORT_SYMBOL_GPL(regulator_bulk_get_all);
4907
--
0-DAY CI Kernel Test Service
https://01.org/lkp
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v3 1/3] regulator: Add regulator_bulk_get_all
2022-05-23 5:28 ` Corentin Labbe
@ 2022-05-23 13:17 ` Mark Brown
-1 siblings, 0 replies; 18+ messages in thread
From: Mark Brown @ 2022-05-23 13:17 UTC (permalink / raw)
To: Corentin Labbe
Cc: andrew, calvin.johnson, davem, edumazet, hkallweit1,
jernej.skrabec, krzysztof.kozlowski+dt, kuba, lgirdwood, linux,
pabeni, robh+dt, samuel, wens, devicetree, linux-arm-kernel,
linux-kernel, linux-sunxi, netdev
[-- Attachment #1: Type: text/plain, Size: 414 bytes --]
On Mon, May 23, 2022 at 05:28:05AM +0000, Corentin Labbe wrote:
> + *consumers = NULL;
> +
> +/*
> + * first pass: get numbers of xxx-supply
> + * second pass: fill consumers
> + * */
> +restart:
Please fix the identation of this comment so it looks less like an
error. TBH I'm not sure it isn't easier to just use krealloc() and have
one loop here, or just write two separate loops given how little is
shared.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v3 1/3] regulator: Add regulator_bulk_get_all
@ 2022-05-23 13:17 ` Mark Brown
0 siblings, 0 replies; 18+ messages in thread
From: Mark Brown @ 2022-05-23 13:17 UTC (permalink / raw)
To: Corentin Labbe
Cc: andrew, calvin.johnson, davem, edumazet, hkallweit1,
jernej.skrabec, krzysztof.kozlowski+dt, kuba, lgirdwood, linux,
pabeni, robh+dt, samuel, wens, devicetree, linux-arm-kernel,
linux-kernel, linux-sunxi, netdev
[-- Attachment #1.1: Type: text/plain, Size: 414 bytes --]
On Mon, May 23, 2022 at 05:28:05AM +0000, Corentin Labbe wrote:
> + *consumers = NULL;
> +
> +/*
> + * first pass: get numbers of xxx-supply
> + * second pass: fill consumers
> + * */
> +restart:
Please fix the identation of this comment so it looks less like an
error. TBH I'm not sure it isn't easier to just use krealloc() and have
one loop here, or just write two separate loops given how little is
shared.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH v3 2/3] phy: handle optional regulator for PHY
2022-05-23 5:28 ` Corentin Labbe
@ 2022-05-23 5:28 ` Corentin Labbe
-1 siblings, 0 replies; 18+ messages in thread
From: Corentin Labbe @ 2022-05-23 5:28 UTC (permalink / raw)
To: andrew, broonie, calvin.johnson, davem, edumazet, hkallweit1,
jernej.skrabec, krzysztof.kozlowski+dt, kuba, lgirdwood, linux,
pabeni, robh+dt, samuel, wens
Cc: devicetree, linux-arm-kernel, linux-kernel, linux-sunxi, netdev,
Corentin Labbe
Add handling of optional regulators for PHY.
Regulators need to be enabled before PHY scanning, so MDIO bus
initiate this task.
Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
---
drivers/net/mdio/Kconfig | 1 +
drivers/net/mdio/fwnode_mdio.c | 36 ++++++++++++++++++++++++++++++----
drivers/net/phy/phy_device.c | 10 ++++++++++
include/linux/phy.h | 3 +++
4 files changed, 46 insertions(+), 4 deletions(-)
diff --git a/drivers/net/mdio/Kconfig b/drivers/net/mdio/Kconfig
index bfa16826a6e1..3f8098fac74b 100644
--- a/drivers/net/mdio/Kconfig
+++ b/drivers/net/mdio/Kconfig
@@ -22,6 +22,7 @@ config MDIO_BUS
config FWNODE_MDIO
def_tristate PHYLIB
depends on (ACPI || OF) || COMPILE_TEST
+ depends on REGULATOR
select FIXED_PHY
help
FWNODE MDIO bus (Ethernet PHY) accessors
diff --git a/drivers/net/mdio/fwnode_mdio.c b/drivers/net/mdio/fwnode_mdio.c
index 1c1584fca632..7f0d3bc81c52 100644
--- a/drivers/net/mdio/fwnode_mdio.c
+++ b/drivers/net/mdio/fwnode_mdio.c
@@ -10,6 +10,7 @@
#include <linux/fwnode_mdio.h>
#include <linux/of.h>
#include <linux/phy.h>
+#include <linux/regulator/consumer.h>
MODULE_AUTHOR("Calvin Johnson <calvin.johnson@oss.nxp.com>");
MODULE_LICENSE("GPL");
@@ -94,7 +95,10 @@ int fwnode_mdiobus_register_phy(struct mii_bus *bus,
struct phy_device *phy;
bool is_c45 = false;
u32 phy_id;
- int rc;
+ int rc, reg_cnt = 0;
+ struct regulator_bulk_data *consumers;
+ struct device_node *nchild = NULL;
+ u32 reg;
mii_ts = fwnode_find_mii_timestamper(child);
if (IS_ERR(mii_ts))
@@ -105,15 +109,35 @@ int fwnode_mdiobus_register_phy(struct mii_bus *bus,
if (rc >= 0)
is_c45 = true;
+ for_each_child_of_node(bus->dev.of_node, nchild) {
+ of_property_read_u32(nchild, "reg", ®);
+ if (reg != addr)
+ continue;
+ reg_cnt = regulator_bulk_get_all(&bus->dev, nchild, &consumers);
+ if (reg_cnt > 0) {
+ rc = regulator_bulk_enable(reg_cnt, consumers);
+ if (rc)
+ return rc;
+ }
+ if (reg_cnt < 0) {
+ dev_err(&bus->dev, "Fail to regulator_bulk_get_all err=%d\n", reg_cnt);
+ return reg_cnt;
+ }
+ }
+
if (is_c45 || fwnode_get_phy_id(child, &phy_id))
phy = get_phy_device(bus, addr, is_c45);
else
phy = phy_device_create(bus, addr, phy_id, 0, NULL);
if (IS_ERR(phy)) {
unregister_mii_timestamper(mii_ts);
- return PTR_ERR(phy);
+ rc = PTR_ERR(phy);
+ goto error;
}
+ phy->regulator_cnt = reg_cnt;
+ phy->consumers = consumers;
+
if (is_acpi_node(child)) {
phy->irq = bus->irq[addr];
@@ -127,14 +151,14 @@ int fwnode_mdiobus_register_phy(struct mii_bus *bus,
if (rc) {
phy_device_free(phy);
fwnode_handle_put(phy->mdio.dev.fwnode);
- return rc;
+ goto error;
}
} else if (is_of_node(child)) {
rc = fwnode_mdiobus_phy_device_register(bus, phy, child, addr);
if (rc) {
unregister_mii_timestamper(mii_ts);
phy_device_free(phy);
- return rc;
+ goto error;
}
}
@@ -145,5 +169,9 @@ int fwnode_mdiobus_register_phy(struct mii_bus *bus,
if (mii_ts)
phy->mii_ts = mii_ts;
return 0;
+error:
+ if (reg_cnt > 0)
+ regulator_bulk_disable(reg_cnt, consumers);
+ return rc;
}
EXPORT_SYMBOL(fwnode_mdiobus_register_phy);
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 431a8719c635..711919e40ef7 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -27,6 +27,7 @@
#include <linux/phy.h>
#include <linux/phy_led_triggers.h>
#include <linux/property.h>
+#include <linux/regulator/consumer.h>
#include <linux/sfp.h>
#include <linux/skbuff.h>
#include <linux/slab.h>
@@ -1785,6 +1786,9 @@ int phy_suspend(struct phy_device *phydev)
if (!ret)
phydev->suspended = true;
+ if (phydev->regulator_cnt > 0)
+ regulator_bulk_disable(phydev->regulator_cnt, phydev->consumers);
+
return ret;
}
EXPORT_SYMBOL(phy_suspend);
@@ -1811,6 +1815,12 @@ int phy_resume(struct phy_device *phydev)
{
int ret;
+ if (phydev->regulator_cnt > 0) {
+ ret = regulator_bulk_enable(phydev->regulator_cnt, phydev->consumers);
+ if (ret)
+ return ret;
+ }
+
mutex_lock(&phydev->lock);
ret = __phy_resume(phydev);
mutex_unlock(&phydev->lock);
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 508f1149665b..ef4e0ce67194 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -704,6 +704,9 @@ struct phy_device {
void (*phy_link_change)(struct phy_device *phydev, bool up);
void (*adjust_link)(struct net_device *dev);
+ int regulator_cnt;
+ struct regulator_bulk_data *consumers;
+
#if IS_ENABLED(CONFIG_MACSEC)
/* MACsec management functions */
const struct macsec_ops *macsec_ops;
--
2.35.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v3 2/3] phy: handle optional regulator for PHY
@ 2022-05-23 5:28 ` Corentin Labbe
0 siblings, 0 replies; 18+ messages in thread
From: Corentin Labbe @ 2022-05-23 5:28 UTC (permalink / raw)
To: andrew, broonie, calvin.johnson, davem, edumazet, hkallweit1,
jernej.skrabec, krzysztof.kozlowski+dt, kuba, lgirdwood, linux,
pabeni, robh+dt, samuel, wens
Cc: devicetree, linux-arm-kernel, linux-kernel, linux-sunxi, netdev,
Corentin Labbe
Add handling of optional regulators for PHY.
Regulators need to be enabled before PHY scanning, so MDIO bus
initiate this task.
Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
---
drivers/net/mdio/Kconfig | 1 +
drivers/net/mdio/fwnode_mdio.c | 36 ++++++++++++++++++++++++++++++----
drivers/net/phy/phy_device.c | 10 ++++++++++
include/linux/phy.h | 3 +++
4 files changed, 46 insertions(+), 4 deletions(-)
diff --git a/drivers/net/mdio/Kconfig b/drivers/net/mdio/Kconfig
index bfa16826a6e1..3f8098fac74b 100644
--- a/drivers/net/mdio/Kconfig
+++ b/drivers/net/mdio/Kconfig
@@ -22,6 +22,7 @@ config MDIO_BUS
config FWNODE_MDIO
def_tristate PHYLIB
depends on (ACPI || OF) || COMPILE_TEST
+ depends on REGULATOR
select FIXED_PHY
help
FWNODE MDIO bus (Ethernet PHY) accessors
diff --git a/drivers/net/mdio/fwnode_mdio.c b/drivers/net/mdio/fwnode_mdio.c
index 1c1584fca632..7f0d3bc81c52 100644
--- a/drivers/net/mdio/fwnode_mdio.c
+++ b/drivers/net/mdio/fwnode_mdio.c
@@ -10,6 +10,7 @@
#include <linux/fwnode_mdio.h>
#include <linux/of.h>
#include <linux/phy.h>
+#include <linux/regulator/consumer.h>
MODULE_AUTHOR("Calvin Johnson <calvin.johnson@oss.nxp.com>");
MODULE_LICENSE("GPL");
@@ -94,7 +95,10 @@ int fwnode_mdiobus_register_phy(struct mii_bus *bus,
struct phy_device *phy;
bool is_c45 = false;
u32 phy_id;
- int rc;
+ int rc, reg_cnt = 0;
+ struct regulator_bulk_data *consumers;
+ struct device_node *nchild = NULL;
+ u32 reg;
mii_ts = fwnode_find_mii_timestamper(child);
if (IS_ERR(mii_ts))
@@ -105,15 +109,35 @@ int fwnode_mdiobus_register_phy(struct mii_bus *bus,
if (rc >= 0)
is_c45 = true;
+ for_each_child_of_node(bus->dev.of_node, nchild) {
+ of_property_read_u32(nchild, "reg", ®);
+ if (reg != addr)
+ continue;
+ reg_cnt = regulator_bulk_get_all(&bus->dev, nchild, &consumers);
+ if (reg_cnt > 0) {
+ rc = regulator_bulk_enable(reg_cnt, consumers);
+ if (rc)
+ return rc;
+ }
+ if (reg_cnt < 0) {
+ dev_err(&bus->dev, "Fail to regulator_bulk_get_all err=%d\n", reg_cnt);
+ return reg_cnt;
+ }
+ }
+
if (is_c45 || fwnode_get_phy_id(child, &phy_id))
phy = get_phy_device(bus, addr, is_c45);
else
phy = phy_device_create(bus, addr, phy_id, 0, NULL);
if (IS_ERR(phy)) {
unregister_mii_timestamper(mii_ts);
- return PTR_ERR(phy);
+ rc = PTR_ERR(phy);
+ goto error;
}
+ phy->regulator_cnt = reg_cnt;
+ phy->consumers = consumers;
+
if (is_acpi_node(child)) {
phy->irq = bus->irq[addr];
@@ -127,14 +151,14 @@ int fwnode_mdiobus_register_phy(struct mii_bus *bus,
if (rc) {
phy_device_free(phy);
fwnode_handle_put(phy->mdio.dev.fwnode);
- return rc;
+ goto error;
}
} else if (is_of_node(child)) {
rc = fwnode_mdiobus_phy_device_register(bus, phy, child, addr);
if (rc) {
unregister_mii_timestamper(mii_ts);
phy_device_free(phy);
- return rc;
+ goto error;
}
}
@@ -145,5 +169,9 @@ int fwnode_mdiobus_register_phy(struct mii_bus *bus,
if (mii_ts)
phy->mii_ts = mii_ts;
return 0;
+error:
+ if (reg_cnt > 0)
+ regulator_bulk_disable(reg_cnt, consumers);
+ return rc;
}
EXPORT_SYMBOL(fwnode_mdiobus_register_phy);
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 431a8719c635..711919e40ef7 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -27,6 +27,7 @@
#include <linux/phy.h>
#include <linux/phy_led_triggers.h>
#include <linux/property.h>
+#include <linux/regulator/consumer.h>
#include <linux/sfp.h>
#include <linux/skbuff.h>
#include <linux/slab.h>
@@ -1785,6 +1786,9 @@ int phy_suspend(struct phy_device *phydev)
if (!ret)
phydev->suspended = true;
+ if (phydev->regulator_cnt > 0)
+ regulator_bulk_disable(phydev->regulator_cnt, phydev->consumers);
+
return ret;
}
EXPORT_SYMBOL(phy_suspend);
@@ -1811,6 +1815,12 @@ int phy_resume(struct phy_device *phydev)
{
int ret;
+ if (phydev->regulator_cnt > 0) {
+ ret = regulator_bulk_enable(phydev->regulator_cnt, phydev->consumers);
+ if (ret)
+ return ret;
+ }
+
mutex_lock(&phydev->lock);
ret = __phy_resume(phydev);
mutex_unlock(&phydev->lock);
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 508f1149665b..ef4e0ce67194 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -704,6 +704,9 @@ struct phy_device {
void (*phy_link_change)(struct phy_device *phydev, bool up);
void (*adjust_link)(struct net_device *dev);
+ int regulator_cnt;
+ struct regulator_bulk_data *consumers;
+
#if IS_ENABLED(CONFIG_MACSEC)
/* MACsec management functions */
const struct macsec_ops *macsec_ops;
--
2.35.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH v3 2/3] phy: handle optional regulator for PHY
2022-05-23 5:28 ` Corentin Labbe
@ 2022-05-23 9:13 ` kernel test robot
-1 siblings, 0 replies; 18+ messages in thread
From: kernel test robot @ 2022-05-23 9:13 UTC (permalink / raw)
To: Corentin Labbe, andrew, broonie, calvin.johnson, davem, edumazet,
hkallweit1, jernej.skrabec, krzysztof.kozlowski+dt, kuba,
lgirdwood, linux, pabeni, robh+dt, samuel, wens
Cc: llvm, kbuild-all, devicetree, linux-arm-kernel, linux-kernel,
linux-sunxi, netdev, Corentin Labbe
Hi Corentin,
I love your patch! Perhaps something to improve:
[auto build test WARNING on broonie-regulator/for-next]
[also build test WARNING on sunxi/sunxi/for-next linus/master v5.18 next-20220520]
[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/intel-lab-lkp/linux/commits/Corentin-Labbe/arm64-add-ethernet-to-orange-pi-3/20220523-133344
base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next
config: mips-cu1830-neo_defconfig (https://download.01.org/0day-ci/archive/20220523/202205231735.QGDB1Mcy-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 768a1ca5eccb678947f4155e38a5f5744dcefb56)
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
# install mips cross compiling tool for clang build
# apt-get install binutils-mips-linux-gnu
# https://github.com/intel-lab-lkp/linux/commit/7ae2ab7d1efe8091f6b7ea048a7ac495afba9e46
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Corentin-Labbe/arm64-add-ethernet-to-orange-pi-3/20220523-133344
git checkout 7ae2ab7d1efe8091f6b7ea048a7ac495afba9e46
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash drivers/net/mdio/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
In file included from drivers/net/mdio/of_mdio.c:13:
>> include/linux/fwnode_mdio.h:20:5: warning: no previous prototype for function 'fwnode_mdiobus_phy_device_register' [-Wmissing-prototypes]
int fwnode_mdiobus_phy_device_register(struct mii_bus *mdio,
^
include/linux/fwnode_mdio.h:20:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int fwnode_mdiobus_phy_device_register(struct mii_bus *mdio,
^
static
1 warning generated.
vim +/fwnode_mdiobus_phy_device_register +20 include/linux/fwnode_mdio.h
bc1bee3b87ee48b Calvin Johnson 2021-06-11 10
bc1bee3b87ee48b Calvin Johnson 2021-06-11 11 #if IS_ENABLED(CONFIG_FWNODE_MDIO)
bc1bee3b87ee48b Calvin Johnson 2021-06-11 12 int fwnode_mdiobus_phy_device_register(struct mii_bus *mdio,
bc1bee3b87ee48b Calvin Johnson 2021-06-11 13 struct phy_device *phy,
bc1bee3b87ee48b Calvin Johnson 2021-06-11 14 struct fwnode_handle *child, u32 addr);
bc1bee3b87ee48b Calvin Johnson 2021-06-11 15
bc1bee3b87ee48b Calvin Johnson 2021-06-11 16 int fwnode_mdiobus_register_phy(struct mii_bus *bus,
bc1bee3b87ee48b Calvin Johnson 2021-06-11 17 struct fwnode_handle *child, u32 addr);
bc1bee3b87ee48b Calvin Johnson 2021-06-11 18
bc1bee3b87ee48b Calvin Johnson 2021-06-11 19 #else /* CONFIG_FWNODE_MDIO */
bc1bee3b87ee48b Calvin Johnson 2021-06-11 @20 int fwnode_mdiobus_phy_device_register(struct mii_bus *mdio,
bc1bee3b87ee48b Calvin Johnson 2021-06-11 21 struct phy_device *phy,
bc1bee3b87ee48b Calvin Johnson 2021-06-11 22 struct fwnode_handle *child, u32 addr)
bc1bee3b87ee48b Calvin Johnson 2021-06-11 23 {
bc1bee3b87ee48b Calvin Johnson 2021-06-11 24 return -EINVAL;
bc1bee3b87ee48b Calvin Johnson 2021-06-11 25 }
bc1bee3b87ee48b Calvin Johnson 2021-06-11 26
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v3 2/3] phy: handle optional regulator for PHY
@ 2022-05-23 9:13 ` kernel test robot
0 siblings, 0 replies; 18+ messages in thread
From: kernel test robot @ 2022-05-23 9:13 UTC (permalink / raw)
To: Corentin Labbe, andrew, broonie, calvin.johnson, davem, edumazet,
hkallweit1, jernej.skrabec, krzysztof.kozlowski+dt, kuba,
lgirdwood, linux, pabeni, robh+dt, samuel, wens
Cc: llvm, kbuild-all, devicetree, linux-arm-kernel, linux-kernel,
linux-sunxi, netdev, Corentin Labbe
Hi Corentin,
I love your patch! Perhaps something to improve:
[auto build test WARNING on broonie-regulator/for-next]
[also build test WARNING on sunxi/sunxi/for-next linus/master v5.18 next-20220520]
[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/intel-lab-lkp/linux/commits/Corentin-Labbe/arm64-add-ethernet-to-orange-pi-3/20220523-133344
base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next
config: mips-cu1830-neo_defconfig (https://download.01.org/0day-ci/archive/20220523/202205231735.QGDB1Mcy-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 768a1ca5eccb678947f4155e38a5f5744dcefb56)
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
# install mips cross compiling tool for clang build
# apt-get install binutils-mips-linux-gnu
# https://github.com/intel-lab-lkp/linux/commit/7ae2ab7d1efe8091f6b7ea048a7ac495afba9e46
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Corentin-Labbe/arm64-add-ethernet-to-orange-pi-3/20220523-133344
git checkout 7ae2ab7d1efe8091f6b7ea048a7ac495afba9e46
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash drivers/net/mdio/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
In file included from drivers/net/mdio/of_mdio.c:13:
>> include/linux/fwnode_mdio.h:20:5: warning: no previous prototype for function 'fwnode_mdiobus_phy_device_register' [-Wmissing-prototypes]
int fwnode_mdiobus_phy_device_register(struct mii_bus *mdio,
^
include/linux/fwnode_mdio.h:20:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int fwnode_mdiobus_phy_device_register(struct mii_bus *mdio,
^
static
1 warning generated.
vim +/fwnode_mdiobus_phy_device_register +20 include/linux/fwnode_mdio.h
bc1bee3b87ee48b Calvin Johnson 2021-06-11 10
bc1bee3b87ee48b Calvin Johnson 2021-06-11 11 #if IS_ENABLED(CONFIG_FWNODE_MDIO)
bc1bee3b87ee48b Calvin Johnson 2021-06-11 12 int fwnode_mdiobus_phy_device_register(struct mii_bus *mdio,
bc1bee3b87ee48b Calvin Johnson 2021-06-11 13 struct phy_device *phy,
bc1bee3b87ee48b Calvin Johnson 2021-06-11 14 struct fwnode_handle *child, u32 addr);
bc1bee3b87ee48b Calvin Johnson 2021-06-11 15
bc1bee3b87ee48b Calvin Johnson 2021-06-11 16 int fwnode_mdiobus_register_phy(struct mii_bus *bus,
bc1bee3b87ee48b Calvin Johnson 2021-06-11 17 struct fwnode_handle *child, u32 addr);
bc1bee3b87ee48b Calvin Johnson 2021-06-11 18
bc1bee3b87ee48b Calvin Johnson 2021-06-11 19 #else /* CONFIG_FWNODE_MDIO */
bc1bee3b87ee48b Calvin Johnson 2021-06-11 @20 int fwnode_mdiobus_phy_device_register(struct mii_bus *mdio,
bc1bee3b87ee48b Calvin Johnson 2021-06-11 21 struct phy_device *phy,
bc1bee3b87ee48b Calvin Johnson 2021-06-11 22 struct fwnode_handle *child, u32 addr)
bc1bee3b87ee48b Calvin Johnson 2021-06-11 23 {
bc1bee3b87ee48b Calvin Johnson 2021-06-11 24 return -EINVAL;
bc1bee3b87ee48b Calvin Johnson 2021-06-11 25 }
bc1bee3b87ee48b Calvin Johnson 2021-06-11 26
--
0-DAY CI Kernel Test Service
https://01.org/lkp
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH v3 3/3] arm64: dts: allwinner: orange-pi-3: Enable ethernet
2022-05-23 5:28 ` Corentin Labbe
@ 2022-05-23 5:28 ` Corentin Labbe
-1 siblings, 0 replies; 18+ messages in thread
From: Corentin Labbe @ 2022-05-23 5:28 UTC (permalink / raw)
To: andrew, broonie, calvin.johnson, davem, edumazet, hkallweit1,
jernej.skrabec, krzysztof.kozlowski+dt, kuba, lgirdwood, linux,
pabeni, robh+dt, samuel, wens
Cc: devicetree, linux-arm-kernel, linux-kernel, linux-sunxi, netdev,
Ondřej Jirman, Corentin Labbe
From: Ondřej Jirman <megi@xff.cz>
Orange Pi 3 has two regulators that power the Realtek RTL8211E
PHY. According to the datasheet, both regulators need to be enabled
at the same time, or that "phy-io" should be enabled slightly earlier
than "phy" regulator.
RTL8211E/RTL8211EG datasheet says:
Note 4: 2.5V (or 1.8/1.5V) RGMII power should be risen simultaneously
or slightly earlier than 3.3V power. Rising 2.5V (or 1.8/1.5V) power
later than 3.3V power may lead to errors.
The timing is set in DT via startup-delay-us.
Signed-off-by: Ondrej Jirman <megi@xff.cz>
Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
---
.../dts/allwinner/sun50i-h6-orangepi-3.dts | 38 +++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts b/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts
index c45d7b7fb39a..2760a0bf76d5 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts
@@ -13,6 +13,7 @@ / {
compatible = "xunlong,orangepi-3", "allwinner,sun50i-h6";
aliases {
+ ethernet0 = &emac;
serial0 = &uart0;
serial1 = &uart1;
};
@@ -55,6 +56,15 @@ led-1 {
};
};
+ reg_gmac_2v5: gmac-2v5 {
+ compatible = "regulator-fixed";
+ regulator-name = "gmac-2v5";
+ regulator-min-microvolt = <2500000>;
+ regulator-max-microvolt = <2500000>;
+ enable-active-high;
+ gpio = <&pio 3 6 GPIO_ACTIVE_HIGH>; /* PD6 */
+ };
+
reg_vcc5v: vcc5v {
/* board wide 5V supply directly from the DC jack */
compatible = "regulator-fixed";
@@ -113,6 +123,33 @@ &ehci3 {
status = "okay";
};
+&emac {
+ pinctrl-names = "default";
+ pinctrl-0 = <&ext_rgmii_pins>;
+ phy-mode = "rgmii-id";
+ phy-handle = <&ext_rgmii_phy>;
+ status = "okay";
+};
+
+&mdio {
+ ext_rgmii_phy: ethernet-phy@1 {
+ compatible = "ethernet-phy-ieee802.3-c22";
+ reg = <1>;
+ /*
+ * The board uses 2.5V RGMII signalling. Power sequence to enable
+ * the phy is to enable GMAC-2V5 and GMAC-3V (aldo2) power rails
+ * at the same time and to wait 100ms. The driver enables phy-io
+ * first. Delay is achieved with enable-ramp-delay on reg_aldo2.
+ */
+ phy-io-supply = <®_gmac_2v5>;
+ ephy-supply = <®_aldo2>;
+
+ reset-gpios = <&pio 3 14 GPIO_ACTIVE_LOW>; /* PD14 */
+ reset-assert-us = <15000>;
+ reset-deassert-us = <40000>;
+ };
+};
+
&gpu {
mali-supply = <®_dcdcc>;
status = "okay";
@@ -211,6 +248,7 @@ reg_aldo2: aldo2 {
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-name = "vcc33-audio-tv-ephy-mac";
+ regulator-enable-ramp-delay = <100000>;
};
/* ALDO3 is shorted to CLDO1 */
--
2.35.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v3 3/3] arm64: dts: allwinner: orange-pi-3: Enable ethernet
@ 2022-05-23 5:28 ` Corentin Labbe
0 siblings, 0 replies; 18+ messages in thread
From: Corentin Labbe @ 2022-05-23 5:28 UTC (permalink / raw)
To: andrew, broonie, calvin.johnson, davem, edumazet, hkallweit1,
jernej.skrabec, krzysztof.kozlowski+dt, kuba, lgirdwood, linux,
pabeni, robh+dt, samuel, wens
Cc: devicetree, linux-arm-kernel, linux-kernel, linux-sunxi, netdev,
Ondřej Jirman, Corentin Labbe
From: Ondřej Jirman <megi@xff.cz>
Orange Pi 3 has two regulators that power the Realtek RTL8211E
PHY. According to the datasheet, both regulators need to be enabled
at the same time, or that "phy-io" should be enabled slightly earlier
than "phy" regulator.
RTL8211E/RTL8211EG datasheet says:
Note 4: 2.5V (or 1.8/1.5V) RGMII power should be risen simultaneously
or slightly earlier than 3.3V power. Rising 2.5V (or 1.8/1.5V) power
later than 3.3V power may lead to errors.
The timing is set in DT via startup-delay-us.
Signed-off-by: Ondrej Jirman <megi@xff.cz>
Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
---
.../dts/allwinner/sun50i-h6-orangepi-3.dts | 38 +++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts b/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts
index c45d7b7fb39a..2760a0bf76d5 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts
@@ -13,6 +13,7 @@ / {
compatible = "xunlong,orangepi-3", "allwinner,sun50i-h6";
aliases {
+ ethernet0 = &emac;
serial0 = &uart0;
serial1 = &uart1;
};
@@ -55,6 +56,15 @@ led-1 {
};
};
+ reg_gmac_2v5: gmac-2v5 {
+ compatible = "regulator-fixed";
+ regulator-name = "gmac-2v5";
+ regulator-min-microvolt = <2500000>;
+ regulator-max-microvolt = <2500000>;
+ enable-active-high;
+ gpio = <&pio 3 6 GPIO_ACTIVE_HIGH>; /* PD6 */
+ };
+
reg_vcc5v: vcc5v {
/* board wide 5V supply directly from the DC jack */
compatible = "regulator-fixed";
@@ -113,6 +123,33 @@ &ehci3 {
status = "okay";
};
+&emac {
+ pinctrl-names = "default";
+ pinctrl-0 = <&ext_rgmii_pins>;
+ phy-mode = "rgmii-id";
+ phy-handle = <&ext_rgmii_phy>;
+ status = "okay";
+};
+
+&mdio {
+ ext_rgmii_phy: ethernet-phy@1 {
+ compatible = "ethernet-phy-ieee802.3-c22";
+ reg = <1>;
+ /*
+ * The board uses 2.5V RGMII signalling. Power sequence to enable
+ * the phy is to enable GMAC-2V5 and GMAC-3V (aldo2) power rails
+ * at the same time and to wait 100ms. The driver enables phy-io
+ * first. Delay is achieved with enable-ramp-delay on reg_aldo2.
+ */
+ phy-io-supply = <®_gmac_2v5>;
+ ephy-supply = <®_aldo2>;
+
+ reset-gpios = <&pio 3 14 GPIO_ACTIVE_LOW>; /* PD14 */
+ reset-assert-us = <15000>;
+ reset-deassert-us = <40000>;
+ };
+};
+
&gpu {
mali-supply = <®_dcdcc>;
status = "okay";
@@ -211,6 +248,7 @@ reg_aldo2: aldo2 {
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-name = "vcc33-audio-tv-ephy-mac";
+ regulator-enable-ramp-delay = <100000>;
};
/* ALDO3 is shorted to CLDO1 */
--
2.35.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH v3 2/3] phy: handle optional regulator for PHY
@ 2022-05-23 12:06 kernel test robot
0 siblings, 0 replies; 18+ messages in thread
From: kernel test robot @ 2022-05-23 12:06 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 5758 bytes --]
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
In-Reply-To: <20220523052807.4044800-3-clabbe@baylibre.com>
References: <20220523052807.4044800-3-clabbe@baylibre.com>
TO: Corentin Labbe <clabbe@baylibre.com>
TO: andrew(a)lunn.ch
TO: broonie(a)kernel.org
TO: calvin.johnson(a)oss.nxp.com
TO: davem(a)davemloft.net
TO: edumazet(a)google.com
TO: hkallweit1(a)gmail.com
TO: jernej.skrabec(a)gmail.com
TO: krzysztof.kozlowski+dt(a)linaro.org
TO: kuba(a)kernel.org
TO: lgirdwood(a)gmail.com
TO: linux(a)armlinux.org.uk
TO: pabeni(a)redhat.com
TO: robh+dt(a)kernel.org
TO: samuel(a)sholland.org
TO: wens(a)csie.org
CC: devicetree(a)vger.kernel.org
CC: linux-arm-kernel(a)lists.infradead.org
CC: linux-kernel(a)vger.kernel.org
CC: linux-sunxi(a)lists.linux.dev
CC: netdev(a)vger.kernel.org
CC: Corentin Labbe <clabbe@baylibre.com>
Hi Corentin,
I love your patch! Perhaps something to improve:
[auto build test WARNING on broonie-regulator/for-next]
[also build test WARNING on sunxi/sunxi/for-next linus/master v5.18]
[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/intel-lab-lkp/linux/commits/Corentin-Labbe/arm64-add-ethernet-to-orange-pi-3/20220523-133344
base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next
:::::: branch date: 7 hours ago
:::::: commit date: 7 hours ago
config: s390-randconfig-m031-20220522 (https://download.01.org/0day-ci/archive/20220523/202205231956.1Gkpf9qU-lkp(a)intel.com/config)
compiler: s390-linux-gcc (GCC) 11.3.0
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
drivers/net/mdio/fwnode_mdio.c:134 fwnode_mdiobus_register_phy() error: uninitialized symbol 'consumers'.
vim +/consumers +134 drivers/net/mdio/fwnode_mdio.c
bc1bee3b87ee48 Calvin Johnson 2021-06-11 85
bc1bee3b87ee48 Calvin Johnson 2021-06-11 86 int fwnode_mdiobus_register_phy(struct mii_bus *bus,
bc1bee3b87ee48 Calvin Johnson 2021-06-11 87 struct fwnode_handle *child, u32 addr)
bc1bee3b87ee48 Calvin Johnson 2021-06-11 88 {
bc1bee3b87ee48 Calvin Johnson 2021-06-11 89 struct mii_timestamper *mii_ts = NULL;
bc1bee3b87ee48 Calvin Johnson 2021-06-11 90 struct phy_device *phy;
bc1bee3b87ee48 Calvin Johnson 2021-06-11 91 bool is_c45 = false;
bc1bee3b87ee48 Calvin Johnson 2021-06-11 92 u32 phy_id;
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 93 int rc, reg_cnt = 0;
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 94 struct regulator_bulk_data *consumers;
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 95 struct device_node *nchild = NULL;
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 96 u32 reg;
bc1bee3b87ee48 Calvin Johnson 2021-06-11 97
bc1bee3b87ee48 Calvin Johnson 2021-06-11 98 mii_ts = fwnode_find_mii_timestamper(child);
bc1bee3b87ee48 Calvin Johnson 2021-06-11 99 if (IS_ERR(mii_ts))
bc1bee3b87ee48 Calvin Johnson 2021-06-11 100 return PTR_ERR(mii_ts);
bc1bee3b87ee48 Calvin Johnson 2021-06-11 101
bc1bee3b87ee48 Calvin Johnson 2021-06-11 102 rc = fwnode_property_match_string(child, "compatible",
bc1bee3b87ee48 Calvin Johnson 2021-06-11 103 "ethernet-phy-ieee802.3-c45");
bc1bee3b87ee48 Calvin Johnson 2021-06-11 104 if (rc >= 0)
bc1bee3b87ee48 Calvin Johnson 2021-06-11 105 is_c45 = true;
bc1bee3b87ee48 Calvin Johnson 2021-06-11 106
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 107 for_each_child_of_node(bus->dev.of_node, nchild) {
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 108 of_property_read_u32(nchild, "reg", ®);
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 109 if (reg != addr)
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 110 continue;
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 111 reg_cnt = regulator_bulk_get_all(&bus->dev, nchild, &consumers);
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 112 if (reg_cnt > 0) {
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 113 rc = regulator_bulk_enable(reg_cnt, consumers);
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 114 if (rc)
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 115 return rc;
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 116 }
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 117 if (reg_cnt < 0) {
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 118 dev_err(&bus->dev, "Fail to regulator_bulk_get_all err=%d\n", reg_cnt);
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 119 return reg_cnt;
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 120 }
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 121 }
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 122
bc1bee3b87ee48 Calvin Johnson 2021-06-11 123 if (is_c45 || fwnode_get_phy_id(child, &phy_id))
bc1bee3b87ee48 Calvin Johnson 2021-06-11 124 phy = get_phy_device(bus, addr, is_c45);
bc1bee3b87ee48 Calvin Johnson 2021-06-11 125 else
bc1bee3b87ee48 Calvin Johnson 2021-06-11 126 phy = phy_device_create(bus, addr, phy_id, 0, NULL);
bc1bee3b87ee48 Calvin Johnson 2021-06-11 127 if (IS_ERR(phy)) {
bc1bee3b87ee48 Calvin Johnson 2021-06-11 128 unregister_mii_timestamper(mii_ts);
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 129 rc = PTR_ERR(phy);
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 130 goto error;
bc1bee3b87ee48 Calvin Johnson 2021-06-11 131 }
bc1bee3b87ee48 Calvin Johnson 2021-06-11 132
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 133 phy->regulator_cnt = reg_cnt;
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 @134 phy->consumers = consumers;
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v3 2/3] phy: handle optional regulator for PHY
@ 2022-05-26 13:30 kernel test robot
0 siblings, 0 replies; 18+ messages in thread
From: kernel test robot @ 2022-05-26 13:30 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 25787 bytes --]
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
In-Reply-To: <20220523052807.4044800-3-clabbe@baylibre.com>
References: <20220523052807.4044800-3-clabbe@baylibre.com>
TO: Corentin Labbe <clabbe@baylibre.com>
TO: andrew(a)lunn.ch
TO: broonie(a)kernel.org
TO: calvin.johnson(a)oss.nxp.com
TO: davem(a)davemloft.net
TO: edumazet(a)google.com
TO: hkallweit1(a)gmail.com
TO: jernej.skrabec(a)gmail.com
TO: krzysztof.kozlowski+dt(a)linaro.org
TO: kuba(a)kernel.org
TO: lgirdwood(a)gmail.com
TO: linux(a)armlinux.org.uk
TO: pabeni(a)redhat.com
TO: robh+dt(a)kernel.org
TO: samuel(a)sholland.org
TO: wens(a)csie.org
CC: devicetree(a)vger.kernel.org
CC: linux-arm-kernel(a)lists.infradead.org
CC: linux-kernel(a)vger.kernel.org
CC: linux-sunxi(a)lists.linux.dev
CC: netdev(a)vger.kernel.org
CC: Corentin Labbe <clabbe@baylibre.com>
Hi Corentin,
I love your patch! Perhaps something to improve:
[auto build test WARNING on broonie-regulator/for-next]
[also build test WARNING on sunxi/sunxi/for-next linus/master v5.18 next-20220525]
[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/intel-lab-lkp/linux/commits/Corentin-Labbe/arm64-add-ethernet-to-orange-pi-3/20220523-133344
base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next
:::::: branch date: 3 days ago
:::::: commit date: 3 days ago
config: arm-randconfig-c002-20220522 (https://download.01.org/0day-ci/archive/20220526/202205262148.yIpMLEH0-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 10c9ecce9f6096e18222a331c5e7d085bd813f75)
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
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://github.com/intel-lab-lkp/linux/commit/7ae2ab7d1efe8091f6b7ea048a7ac495afba9e46
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Corentin-Labbe/arm64-add-ethernet-to-orange-pi-3/20220523-133344
git checkout 7ae2ab7d1efe8091f6b7ea048a7ac495afba9e46
# save the config file
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm clang-analyzer
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
^
kernel/bpf/lpm_trie.c:704:24: note: Access to field 'prefixlen' results in a dereference of a null pointer (loaded from variable 'next_node')
next_key->prefixlen = next_node->prefixlen;
^~~~~~~~~
kernel/bpf/lpm_trie.c:705:2: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
memcpy((void *)next_key + offsetof(struct bpf_lpm_trie_key, data),
^~~~~~
kernel/bpf/lpm_trie.c:705:2: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11
memcpy((void *)next_key + offsetof(struct bpf_lpm_trie_key, data),
^~~~~~
Suppressed 94 warnings (94 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
58 warnings generated.
arch/arm/kernel/signal.c:173:2: warning: Value stored to 'aux' is never read [clang-analyzer-deadcode.DeadStores]
aux = (char __user *) sf->uc.uc_regspace;
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/arm/kernel/signal.c:173:2: note: Value stored to 'aux' is never read
aux = (char __user *) sf->uc.uc_regspace;
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/arm/kernel/signal.c:662:2: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
memcpy(addr + offset, sigreturn_codes, sizeof(sigreturn_codes));
^~~~~~
arch/arm/kernel/signal.c:662:2: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11
memcpy(addr + offset, sigreturn_codes, sizeof(sigreturn_codes));
^~~~~~
Suppressed 56 warnings (52 in non-user code, 4 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
43 warnings generated.
Suppressed 43 warnings (43 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
44 warnings generated.
Suppressed 44 warnings (43 in non-user code, 1 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
16 warnings generated.
Suppressed 16 warnings (15 in non-user code, 1 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
61 warnings generated.
arch/arm/kernel/traps.c:105:9: warning: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
p += sprintf(p, " r%d:%08x", reg, *stack--);
^~~~~~~
arch/arm/kernel/traps.c:105:9: note: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11
p += sprintf(p, " r%d:%08x", reg, *stack--);
^~~~~~~
arch/arm/kernel/traps.c:149:3: warning: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
memset(str, ' ', sizeof(str));
^~~~~~
arch/arm/kernel/traps.c:149:3: note: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11
memset(str, ' ', sizeof(str));
^~~~~~
arch/arm/kernel/traps.c:156:6: warning: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
sprintf(str + i * 9, " %08lx", val);
^~~~~~~
arch/arm/kernel/traps.c:156:6: note: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11
sprintf(str + i * 9, " %08lx", val);
^~~~~~~
arch/arm/kernel/traps.c:158:6: warning: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
sprintf(str + i * 9, " ????????");
^~~~~~~
arch/arm/kernel/traps.c:158:6: note: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11
sprintf(str + i * 9, " ????????");
^~~~~~~
arch/arm/kernel/traps.c:197:9: warning: Call to function 'sprintf' is insecure as it does not provide bounding of the memory buffer or security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
p += sprintf(p, i == 0 ? "(%0*x) " : "%0*x ",
^~~~~~~
arch/arm/kernel/traps.c:197:9: note: Call to function 'sprintf' is insecure as it does not provide bounding of the memory buffer or security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11
p += sprintf(p, i == 0 ? "(%0*x) " : "%0*x ",
^~~~~~~
arch/arm/kernel/traps.c:200:4: warning: Value stored to 'p' is never read [clang-analyzer-deadcode.DeadStores]
p += sprintf(p, "bad PC value");
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/arm/kernel/traps.c:200:4: note: Value stored to 'p' is never read
p += sprintf(p, "bad PC value");
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/arm/kernel/traps.c:200:9: warning: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
p += sprintf(p, "bad PC value");
^~~~~~~
arch/arm/kernel/traps.c:200:9: note: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11
p += sprintf(p, "bad PC value");
^~~~~~~
arch/arm/kernel/traps.c:792:2: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
memcpy(vectors + 0x1000 - kuser_sz, __kuser_helper_start, kuser_sz);
^~~~~~
arch/arm/kernel/traps.c:792:2: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11
memcpy(vectors + 0x1000 - kuser_sz, __kuser_helper_start, kuser_sz);
^~~~~~
arch/arm/kernel/traps.c:799:3: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
memcpy(vectors + 0xfe0, vectors + 0xfe8, 4);
^~~~~~
arch/arm/kernel/traps.c:799:3: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11
memcpy(vectors + 0xfe0, vectors + 0xfe8, 4);
^~~~~~
arch/arm/kernel/traps.c:810:2: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
memcpy(vma, lma_start, lma_end - lma_start);
^~~~~~
arch/arm/kernel/traps.c:810:2: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11
memcpy(vma, lma_start, lma_end - lma_start);
^~~~~~
Suppressed 51 warnings (44 in non-user code, 7 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
71 warnings generated.
>> drivers/net/mdio/fwnode_mdio.c:134:17: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
phy->consumers = consumers;
^ ~~~~~~~~~
drivers/net/mdio/fwnode_mdio.c:94:2: note: 'consumers' declared without an initial value
struct regulator_bulk_data *consumers;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/mdio/fwnode_mdio.c:99:2: note: Taking false branch
if (IS_ERR(mii_ts))
^
drivers/net/mdio/fwnode_mdio.c:104:6: note: Assuming 'rc' is >= 0
if (rc >= 0)
^~~~~~~
drivers/net/mdio/fwnode_mdio.c:104:2: note: Taking true branch
if (rc >= 0)
^
drivers/net/mdio/fwnode_mdio.c:107:43: note: Assuming 'nchild' is equal to null
for_each_child_of_node(bus->dev.of_node, nchild) {
^
include/linux/of.h:1358:48: note: expanded from macro 'for_each_child_of_node'
for (child = of_get_next_child(parent, NULL); child != NULL; \
^~~~~~~~~~~~~
drivers/net/mdio/fwnode_mdio.c:107:2: note: Loop condition is false. Execution continues on line 123
for_each_child_of_node(bus->dev.of_node, nchild) {
^
include/linux/of.h:1358:2: note: expanded from macro 'for_each_child_of_node'
for (child = of_get_next_child(parent, NULL); child != NULL; \
^
drivers/net/mdio/fwnode_mdio.c:123:6: note: 'is_c45' is true
if (is_c45 || fwnode_get_phy_id(child, &phy_id))
^~~~~~
drivers/net/mdio/fwnode_mdio.c:123:13: note: Left side of '||' is true
if (is_c45 || fwnode_get_phy_id(child, &phy_id))
^
drivers/net/mdio/fwnode_mdio.c:127:2: note: Taking false branch
if (IS_ERR(phy)) {
^
drivers/net/mdio/fwnode_mdio.c:134:17: note: Assigned value is garbage or undefined
phy->consumers = consumers;
^ ~~~~~~~~~
Suppressed 70 warnings (70 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
71 warnings generated.
Suppressed 71 warnings (71 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
71 warnings generated.
drivers/net/mdio/mdio-hisi-femac.c:86:2: warning: Call to function 'snprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'snprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
snprintf(bus->id, MII_BUS_ID_SIZE, "%s", pdev->name);
^~~~~~~~
drivers/net/mdio/mdio-hisi-femac.c:86:2: note: Call to function 'snprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'snprintf_s' in case of C11
snprintf(bus->id, MII_BUS_ID_SIZE, "%s", pdev->name);
^~~~~~~~
Suppressed 70 warnings (70 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
70 warnings generated.
Suppressed 70 warnings (70 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
44 warnings generated.
crypto/ecdh.c:40:2: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
memcpy(ctx->private_key, params.key, params.key_size);
^~~~~~
crypto/ecdh.c:40:2: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11
memcpy(ctx->private_key, params.key, params.key_size);
^~~~~~
Suppressed 43 warnings (43 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
crypto/ecdh_helper.c:17:2: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
memcpy(dst, src, sz);
^~~~~~
crypto/ecdh_helper.c:17:2: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11
memcpy(dst, src, sz);
^~~~~~
crypto/ecdh_helper.c:23:2: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
memcpy(dst, src, sz);
^~~~~~
crypto/ecdh_helper.c:23:2: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11
memcpy(dst, src, sz);
^~~~~~
Suppressed 7 warnings (7 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
10 warnings generated.
crypto/xor.c:156:9: warning: Access to field 'name' results in a dereference of a null pointer (loaded from variable 'fastest') [clang-analyzer-core.NullDereference]
fastest->name, fastest->speed);
^
include/linux/printk.h:519:34: note: expanded from macro 'pr_info'
printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
^~~~~~~~~~~
include/linux/printk.h:446:60: note: expanded from macro 'printk'
#define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
^~~~~~~~~~~
include/linux/printk.h:418:19: note: expanded from macro 'printk_index_wrap'
_p_func(_fmt, ##__VA_ARGS__); \
^~~~~~~~~~~
crypto/xor.c:126:6: note: 'fastest' is null
if (fastest) {
^~~~~~~
crypto/xor.c:126:2: note: Taking false branch
if (fastest) {
^
crypto/xor.c:134:6: note: Assuming 'b1' is non-null
if (!b1) {
vim +134 drivers/net/mdio/fwnode_mdio.c
bc1bee3b87ee48 Calvin Johnson 2021-06-11 85
bc1bee3b87ee48 Calvin Johnson 2021-06-11 86 int fwnode_mdiobus_register_phy(struct mii_bus *bus,
bc1bee3b87ee48 Calvin Johnson 2021-06-11 87 struct fwnode_handle *child, u32 addr)
bc1bee3b87ee48 Calvin Johnson 2021-06-11 88 {
bc1bee3b87ee48 Calvin Johnson 2021-06-11 89 struct mii_timestamper *mii_ts = NULL;
bc1bee3b87ee48 Calvin Johnson 2021-06-11 90 struct phy_device *phy;
bc1bee3b87ee48 Calvin Johnson 2021-06-11 91 bool is_c45 = false;
bc1bee3b87ee48 Calvin Johnson 2021-06-11 92 u32 phy_id;
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 93 int rc, reg_cnt = 0;
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 94 struct regulator_bulk_data *consumers;
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 95 struct device_node *nchild = NULL;
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 96 u32 reg;
bc1bee3b87ee48 Calvin Johnson 2021-06-11 97
bc1bee3b87ee48 Calvin Johnson 2021-06-11 98 mii_ts = fwnode_find_mii_timestamper(child);
bc1bee3b87ee48 Calvin Johnson 2021-06-11 99 if (IS_ERR(mii_ts))
bc1bee3b87ee48 Calvin Johnson 2021-06-11 100 return PTR_ERR(mii_ts);
bc1bee3b87ee48 Calvin Johnson 2021-06-11 101
bc1bee3b87ee48 Calvin Johnson 2021-06-11 102 rc = fwnode_property_match_string(child, "compatible",
bc1bee3b87ee48 Calvin Johnson 2021-06-11 103 "ethernet-phy-ieee802.3-c45");
bc1bee3b87ee48 Calvin Johnson 2021-06-11 104 if (rc >= 0)
bc1bee3b87ee48 Calvin Johnson 2021-06-11 105 is_c45 = true;
bc1bee3b87ee48 Calvin Johnson 2021-06-11 106
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 107 for_each_child_of_node(bus->dev.of_node, nchild) {
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 108 of_property_read_u32(nchild, "reg", ®);
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 109 if (reg != addr)
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 110 continue;
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 111 reg_cnt = regulator_bulk_get_all(&bus->dev, nchild, &consumers);
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 112 if (reg_cnt > 0) {
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 113 rc = regulator_bulk_enable(reg_cnt, consumers);
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 114 if (rc)
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 115 return rc;
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 116 }
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 117 if (reg_cnt < 0) {
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 118 dev_err(&bus->dev, "Fail to regulator_bulk_get_all err=%d\n", reg_cnt);
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 119 return reg_cnt;
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 120 }
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 121 }
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 122
bc1bee3b87ee48 Calvin Johnson 2021-06-11 123 if (is_c45 || fwnode_get_phy_id(child, &phy_id))
bc1bee3b87ee48 Calvin Johnson 2021-06-11 124 phy = get_phy_device(bus, addr, is_c45);
bc1bee3b87ee48 Calvin Johnson 2021-06-11 125 else
bc1bee3b87ee48 Calvin Johnson 2021-06-11 126 phy = phy_device_create(bus, addr, phy_id, 0, NULL);
bc1bee3b87ee48 Calvin Johnson 2021-06-11 127 if (IS_ERR(phy)) {
bc1bee3b87ee48 Calvin Johnson 2021-06-11 128 unregister_mii_timestamper(mii_ts);
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 129 rc = PTR_ERR(phy);
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 130 goto error;
bc1bee3b87ee48 Calvin Johnson 2021-06-11 131 }
bc1bee3b87ee48 Calvin Johnson 2021-06-11 132
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 133 phy->regulator_cnt = reg_cnt;
7ae2ab7d1efe80 Corentin Labbe 2022-05-23 @134 phy->consumers = consumers;
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2022-05-26 13:30 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-23 5:28 [PATCH v3 0/3] arm64: add ethernet to orange pi 3 Corentin Labbe
2022-05-23 5:28 ` Corentin Labbe
2022-05-23 5:28 ` [PATCH v3 1/3] regulator: Add regulator_bulk_get_all Corentin Labbe
2022-05-23 5:28 ` Corentin Labbe
2022-05-23 9:54 ` kernel test robot
2022-05-23 9:54 ` kernel test robot
2022-05-23 10:04 ` kernel test robot
2022-05-23 10:04 ` kernel test robot
2022-05-23 13:17 ` Mark Brown
2022-05-23 13:17 ` Mark Brown
2022-05-23 5:28 ` [PATCH v3 2/3] phy: handle optional regulator for PHY Corentin Labbe
2022-05-23 5:28 ` Corentin Labbe
2022-05-23 9:13 ` kernel test robot
2022-05-23 9:13 ` kernel test robot
2022-05-23 5:28 ` [PATCH v3 3/3] arm64: dts: allwinner: orange-pi-3: Enable ethernet Corentin Labbe
2022-05-23 5:28 ` Corentin Labbe
2022-05-23 12:06 [PATCH v3 2/3] phy: handle optional regulator for PHY kernel test robot
2022-05-26 13:30 kernel test robot
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.