Re: [U-Boot] [PATCH v2 1/3] Move CONFIG_PHY_ADDR to Kconfig

2018-03-30 Thread Joe Hershberger
On Fri, Mar 30, 2018 at 2:49 AM, Bin Meng  wrote:
> Hi Joe,
>
> On Thu, Mar 29, 2018 at 2:17 AM, Joe Hershberger  
> wrote:
>> On Sun, Mar 25, 2018 at 8:40 PM, Bin Meng  wrote:
>>> Hi Joe,
>>>
>>> On Sat, Mar 24, 2018 at 1:11 AM, Joe Hershberger  
>>> wrote:
 On Thu, Mar 22, 2018 at 9:46 AM, Bin Meng  wrote:
> Hi,
>
> On Fri, Feb 2, 2018 at 9:53 PM, Stefan Mavrodiev  
> wrote:
>> CONFIG_PHY_ADDR is used for old-style configuration. This makes
>> impossible changing the PHY address, if multiple boards share a same
>> config header file (for example include/configs/sunxi-common.h).
>>
>> Moving this to Kconfig helps overcoming this issue. It's defined
>> as entry inside PHYLIB section.
>>
>> After the implemention, moveconfig was run. The issues are:
>> - edb9315a  - CONFIG_PHYLIB is not enabled. Entry is
>>   deleted.
>>
>> - ds414 - CONFIG_PHYLIB is in incompatible format:
>>   { 0x1, 0x0 }. This entry is also deleted.
>>
>> - devkit3250- The PHY_ADDR is in hex format (0x1F).
>>   Manually CONFIG_PHY_ADDR=31 is added in
>>   the defconfig.
>>
>> After the changes the suspicious defconfigs passes building.
>>
>> Signed-off-by: Stefan Mavrodiev 
>> Acked-by: Maxime Ripard 
>> ---
>>  Changes for v2:
>>- Replaced CONFIG_SUNXI_PHY_ADDR with a common one
>>  CONFIG_PHY_ADDR, using moveconfig.
>>
>>  README | 4 
>>  configs/devkit3250_defconfig   | 1 +
>>  configs/khadas-vim_defconfig   | 1 +
>>  configs/libretech-cc_defconfig | 1 +
>>  configs/p212_defconfig | 1 +
>>  drivers/net/phy/Kconfig| 7 +++
>>  include/configs/am335x_shc.h   | 1 -
>>  include/configs/baltos.h   | 1 -
>>  include/configs/devkit3250.h   | 1 -
>>  include/configs/ds414.h| 1 -
>>  include/configs/edb93xx.h  | 1 -
>>  include/configs/khadas-vim.h   | 2 --
>>  include/configs/libretech-cc.h | 2 --
>>  include/configs/p212.h | 2 --
>>  include/configs/pepper.h   | 1 -
>>  include/configs/sunxi-common.h | 2 --
>>  include/configs/work_92105.h   | 1 -
>>  include/configs/x600.h | 1 -
>>  scripts/config_whitelist.txt   | 1 -
>>  19 files changed, 11 insertions(+), 21 deletions(-)
>>
>
> [snip]
>
>> diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
>> index 95b7534..c934aed 100644
>> --- a/drivers/net/phy/Kconfig
>> +++ b/drivers/net/phy/Kconfig
>> @@ -12,6 +12,13 @@ menuconfig PHYLIB
>>
>>  if PHYLIB
>>
>> +config PHY_ADDR
>> +   int "PHY address"
>> +   default 1 if ARCH_SUNXI
>> +   default 0
>> +   help
>> + The address of PHY on MII bus. Usually in range of 0 to 31.
>> +
>
> Sorry for jumping out so late, but this commit breaks Intel Galileo
> ethernet. Previously the board boots with the following log:
>
> Net: eth0: eth_designware#0, eth1: eth_designware#1
>
> With this commit it becomes:
>
> Net:   No ethernet found.
>
> The reason is that the board has two designware ethernet controllers,
> and PHY_ADDR has been set to zero for both. A simple fix is to:
>
> diff --git a/drivers/net/designware.c b/drivers/net/designware.c
> index 43670a7..1394119 100644
> --- a/drivers/net/designware.c
> +++ b/drivers/net/designware.c
> @@ -471,10 +471,6 @@ static int dw_phy_init(struct dw_eth_dev *priv, void 
> *dev)
> struct phy_device *phydev;
> int mask = 0x, ret;
>
> -#ifdef CONFIG_PHY_ADDR
> -   mask = 1 << CONFIG_PHY_ADDR;
> -#endif
> -
> phydev = phy_find_by_mask(priv->bus, mask, priv->interface);
> if (!phydev)
> return -ENODEV;
>
> But the real question is that: why do we introduce this PHY_ADDR
> Kconfig? It for sure won't work for multiple ethernet controllers.This
> should be eliminated IMHO. Comments?

 This should be able to come from the device tree, ultimately. Can you
 undefine the phy addr for the Galileo board?

> [snip]
>
>>>
>>> #undf the PHY_ADDR in Galileo board looks weird. This to me is a workaround.
>>
>> I didn't mean to add a #undef. I was just saying that if the "default
>> 0" in the Kconfig were instead "default 0 if !X86" or something (or
>> maybe if the board defconfig explicitly does unselects it).
>>
>
> This cannot be done as CONFIG_PHY_ADDR is an "int", not a "bool". We
> cannot do "# 

Re: [U-Boot] [PATCH v2 1/3] Move CONFIG_PHY_ADDR to Kconfig

2018-03-30 Thread Bin Meng
Hi Joe,

On Thu, Mar 29, 2018 at 2:17 AM, Joe Hershberger  wrote:
> On Sun, Mar 25, 2018 at 8:40 PM, Bin Meng  wrote:
>> Hi Joe,
>>
>> On Sat, Mar 24, 2018 at 1:11 AM, Joe Hershberger  
>> wrote:
>>> On Thu, Mar 22, 2018 at 9:46 AM, Bin Meng  wrote:
 Hi,

 On Fri, Feb 2, 2018 at 9:53 PM, Stefan Mavrodiev  wrote:
> CONFIG_PHY_ADDR is used for old-style configuration. This makes
> impossible changing the PHY address, if multiple boards share a same
> config header file (for example include/configs/sunxi-common.h).
>
> Moving this to Kconfig helps overcoming this issue. It's defined
> as entry inside PHYLIB section.
>
> After the implemention, moveconfig was run. The issues are:
> - edb9315a  - CONFIG_PHYLIB is not enabled. Entry is
>   deleted.
>
> - ds414 - CONFIG_PHYLIB is in incompatible format:
>   { 0x1, 0x0 }. This entry is also deleted.
>
> - devkit3250- The PHY_ADDR is in hex format (0x1F).
>   Manually CONFIG_PHY_ADDR=31 is added in
>   the defconfig.
>
> After the changes the suspicious defconfigs passes building.
>
> Signed-off-by: Stefan Mavrodiev 
> Acked-by: Maxime Ripard 
> ---
>  Changes for v2:
>- Replaced CONFIG_SUNXI_PHY_ADDR with a common one
>  CONFIG_PHY_ADDR, using moveconfig.
>
>  README | 4 
>  configs/devkit3250_defconfig   | 1 +
>  configs/khadas-vim_defconfig   | 1 +
>  configs/libretech-cc_defconfig | 1 +
>  configs/p212_defconfig | 1 +
>  drivers/net/phy/Kconfig| 7 +++
>  include/configs/am335x_shc.h   | 1 -
>  include/configs/baltos.h   | 1 -
>  include/configs/devkit3250.h   | 1 -
>  include/configs/ds414.h| 1 -
>  include/configs/edb93xx.h  | 1 -
>  include/configs/khadas-vim.h   | 2 --
>  include/configs/libretech-cc.h | 2 --
>  include/configs/p212.h | 2 --
>  include/configs/pepper.h   | 1 -
>  include/configs/sunxi-common.h | 2 --
>  include/configs/work_92105.h   | 1 -
>  include/configs/x600.h | 1 -
>  scripts/config_whitelist.txt   | 1 -
>  19 files changed, 11 insertions(+), 21 deletions(-)
>

 [snip]

> diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
> index 95b7534..c934aed 100644
> --- a/drivers/net/phy/Kconfig
> +++ b/drivers/net/phy/Kconfig
> @@ -12,6 +12,13 @@ menuconfig PHYLIB
>
>  if PHYLIB
>
> +config PHY_ADDR
> +   int "PHY address"
> +   default 1 if ARCH_SUNXI
> +   default 0
> +   help
> + The address of PHY on MII bus. Usually in range of 0 to 31.
> +

 Sorry for jumping out so late, but this commit breaks Intel Galileo
 ethernet. Previously the board boots with the following log:

 Net: eth0: eth_designware#0, eth1: eth_designware#1

 With this commit it becomes:

 Net:   No ethernet found.

 The reason is that the board has two designware ethernet controllers,
 and PHY_ADDR has been set to zero for both. A simple fix is to:

 diff --git a/drivers/net/designware.c b/drivers/net/designware.c
 index 43670a7..1394119 100644
 --- a/drivers/net/designware.c
 +++ b/drivers/net/designware.c
 @@ -471,10 +471,6 @@ static int dw_phy_init(struct dw_eth_dev *priv, void 
 *dev)
 struct phy_device *phydev;
 int mask = 0x, ret;

 -#ifdef CONFIG_PHY_ADDR
 -   mask = 1 << CONFIG_PHY_ADDR;
 -#endif
 -
 phydev = phy_find_by_mask(priv->bus, mask, priv->interface);
 if (!phydev)
 return -ENODEV;

 But the real question is that: why do we introduce this PHY_ADDR
 Kconfig? It for sure won't work for multiple ethernet controllers.This
 should be eliminated IMHO. Comments?
>>>
>>> This should be able to come from the device tree, ultimately. Can you
>>> undefine the phy addr for the Galileo board?
>>>
 [snip]

>>
>> #undf the PHY_ADDR in Galileo board looks weird. This to me is a workaround.
>
> I didn't mean to add a #undef. I was just saying that if the "default
> 0" in the Kconfig were instead "default 0 if !X86" or something (or
> maybe if the board defconfig explicitly does unselects it).
>

This cannot be done as CONFIG_PHY_ADDR is an "int", not a "bool". We
cannot do "# CONFIG_PHY_ADDR is not set" in the galileo_defconfig.

>> Since the designware ethernet controller driver supports finding any
>> PHY attached to its mdio bus, the changes suggested above can be a
>> proper fix.
>
> 

Re: [U-Boot] [PATCH v2 1/3] Move CONFIG_PHY_ADDR to Kconfig

2018-03-28 Thread Joe Hershberger
On Sun, Mar 25, 2018 at 8:40 PM, Bin Meng  wrote:
> Hi Joe,
>
> On Sat, Mar 24, 2018 at 1:11 AM, Joe Hershberger  
> wrote:
>> On Thu, Mar 22, 2018 at 9:46 AM, Bin Meng  wrote:
>>> Hi,
>>>
>>> On Fri, Feb 2, 2018 at 9:53 PM, Stefan Mavrodiev  wrote:
 CONFIG_PHY_ADDR is used for old-style configuration. This makes
 impossible changing the PHY address, if multiple boards share a same
 config header file (for example include/configs/sunxi-common.h).

 Moving this to Kconfig helps overcoming this issue. It's defined
 as entry inside PHYLIB section.

 After the implemention, moveconfig was run. The issues are:
 - edb9315a  - CONFIG_PHYLIB is not enabled. Entry is
   deleted.

 - ds414 - CONFIG_PHYLIB is in incompatible format:
   { 0x1, 0x0 }. This entry is also deleted.

 - devkit3250- The PHY_ADDR is in hex format (0x1F).
   Manually CONFIG_PHY_ADDR=31 is added in
   the defconfig.

 After the changes the suspicious defconfigs passes building.

 Signed-off-by: Stefan Mavrodiev 
 Acked-by: Maxime Ripard 
 ---
  Changes for v2:
- Replaced CONFIG_SUNXI_PHY_ADDR with a common one
  CONFIG_PHY_ADDR, using moveconfig.

  README | 4 
  configs/devkit3250_defconfig   | 1 +
  configs/khadas-vim_defconfig   | 1 +
  configs/libretech-cc_defconfig | 1 +
  configs/p212_defconfig | 1 +
  drivers/net/phy/Kconfig| 7 +++
  include/configs/am335x_shc.h   | 1 -
  include/configs/baltos.h   | 1 -
  include/configs/devkit3250.h   | 1 -
  include/configs/ds414.h| 1 -
  include/configs/edb93xx.h  | 1 -
  include/configs/khadas-vim.h   | 2 --
  include/configs/libretech-cc.h | 2 --
  include/configs/p212.h | 2 --
  include/configs/pepper.h   | 1 -
  include/configs/sunxi-common.h | 2 --
  include/configs/work_92105.h   | 1 -
  include/configs/x600.h | 1 -
  scripts/config_whitelist.txt   | 1 -
  19 files changed, 11 insertions(+), 21 deletions(-)

>>>
>>> [snip]
>>>
 diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
 index 95b7534..c934aed 100644
 --- a/drivers/net/phy/Kconfig
 +++ b/drivers/net/phy/Kconfig
 @@ -12,6 +12,13 @@ menuconfig PHYLIB

  if PHYLIB

 +config PHY_ADDR
 +   int "PHY address"
 +   default 1 if ARCH_SUNXI
 +   default 0
 +   help
 + The address of PHY on MII bus. Usually in range of 0 to 31.
 +
>>>
>>> Sorry for jumping out so late, but this commit breaks Intel Galileo
>>> ethernet. Previously the board boots with the following log:
>>>
>>> Net: eth0: eth_designware#0, eth1: eth_designware#1
>>>
>>> With this commit it becomes:
>>>
>>> Net:   No ethernet found.
>>>
>>> The reason is that the board has two designware ethernet controllers,
>>> and PHY_ADDR has been set to zero for both. A simple fix is to:
>>>
>>> diff --git a/drivers/net/designware.c b/drivers/net/designware.c
>>> index 43670a7..1394119 100644
>>> --- a/drivers/net/designware.c
>>> +++ b/drivers/net/designware.c
>>> @@ -471,10 +471,6 @@ static int dw_phy_init(struct dw_eth_dev *priv, void 
>>> *dev)
>>> struct phy_device *phydev;
>>> int mask = 0x, ret;
>>>
>>> -#ifdef CONFIG_PHY_ADDR
>>> -   mask = 1 << CONFIG_PHY_ADDR;
>>> -#endif
>>> -
>>> phydev = phy_find_by_mask(priv->bus, mask, priv->interface);
>>> if (!phydev)
>>> return -ENODEV;
>>>
>>> But the real question is that: why do we introduce this PHY_ADDR
>>> Kconfig? It for sure won't work for multiple ethernet controllers.This
>>> should be eliminated IMHO. Comments?
>>
>> This should be able to come from the device tree, ultimately. Can you
>> undefine the phy addr for the Galileo board?
>>
>>> [snip]
>>>
>
> #undf the PHY_ADDR in Galileo board looks weird. This to me is a workaround.

I didn't mean to add a #undef. I was just saying that if the "default
0" in the Kconfig were instead "default 0 if !X86" or something (or
maybe if the board defconfig explicitly does unselects it).

> Since the designware ethernet controller driver supports finding any
> PHY attached to its mdio bus, the changes suggested above can be a
> proper fix.

That is good for your board, but some board may have more than one phy
and want to specify which to use in U-Boot.

Ultimately it should be possible to read it from the DT.

Cheers,
-Joe

> Regards,
> Bin
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot

Re: [U-Boot] [PATCH v2 1/3] Move CONFIG_PHY_ADDR to Kconfig

2018-03-25 Thread Bin Meng
Hi Joe,

On Sat, Mar 24, 2018 at 1:11 AM, Joe Hershberger  wrote:
> On Thu, Mar 22, 2018 at 9:46 AM, Bin Meng  wrote:
>> Hi,
>>
>> On Fri, Feb 2, 2018 at 9:53 PM, Stefan Mavrodiev  wrote:
>>> CONFIG_PHY_ADDR is used for old-style configuration. This makes
>>> impossible changing the PHY address, if multiple boards share a same
>>> config header file (for example include/configs/sunxi-common.h).
>>>
>>> Moving this to Kconfig helps overcoming this issue. It's defined
>>> as entry inside PHYLIB section.
>>>
>>> After the implemention, moveconfig was run. The issues are:
>>> - edb9315a  - CONFIG_PHYLIB is not enabled. Entry is
>>>   deleted.
>>>
>>> - ds414 - CONFIG_PHYLIB is in incompatible format:
>>>   { 0x1, 0x0 }. This entry is also deleted.
>>>
>>> - devkit3250- The PHY_ADDR is in hex format (0x1F).
>>>   Manually CONFIG_PHY_ADDR=31 is added in
>>>   the defconfig.
>>>
>>> After the changes the suspicious defconfigs passes building.
>>>
>>> Signed-off-by: Stefan Mavrodiev 
>>> Acked-by: Maxime Ripard 
>>> ---
>>>  Changes for v2:
>>>- Replaced CONFIG_SUNXI_PHY_ADDR with a common one
>>>  CONFIG_PHY_ADDR, using moveconfig.
>>>
>>>  README | 4 
>>>  configs/devkit3250_defconfig   | 1 +
>>>  configs/khadas-vim_defconfig   | 1 +
>>>  configs/libretech-cc_defconfig | 1 +
>>>  configs/p212_defconfig | 1 +
>>>  drivers/net/phy/Kconfig| 7 +++
>>>  include/configs/am335x_shc.h   | 1 -
>>>  include/configs/baltos.h   | 1 -
>>>  include/configs/devkit3250.h   | 1 -
>>>  include/configs/ds414.h| 1 -
>>>  include/configs/edb93xx.h  | 1 -
>>>  include/configs/khadas-vim.h   | 2 --
>>>  include/configs/libretech-cc.h | 2 --
>>>  include/configs/p212.h | 2 --
>>>  include/configs/pepper.h   | 1 -
>>>  include/configs/sunxi-common.h | 2 --
>>>  include/configs/work_92105.h   | 1 -
>>>  include/configs/x600.h | 1 -
>>>  scripts/config_whitelist.txt   | 1 -
>>>  19 files changed, 11 insertions(+), 21 deletions(-)
>>>
>>
>> [snip]
>>
>>> diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
>>> index 95b7534..c934aed 100644
>>> --- a/drivers/net/phy/Kconfig
>>> +++ b/drivers/net/phy/Kconfig
>>> @@ -12,6 +12,13 @@ menuconfig PHYLIB
>>>
>>>  if PHYLIB
>>>
>>> +config PHY_ADDR
>>> +   int "PHY address"
>>> +   default 1 if ARCH_SUNXI
>>> +   default 0
>>> +   help
>>> + The address of PHY on MII bus. Usually in range of 0 to 31.
>>> +
>>
>> Sorry for jumping out so late, but this commit breaks Intel Galileo
>> ethernet. Previously the board boots with the following log:
>>
>> Net: eth0: eth_designware#0, eth1: eth_designware#1
>>
>> With this commit it becomes:
>>
>> Net:   No ethernet found.
>>
>> The reason is that the board has two designware ethernet controllers,
>> and PHY_ADDR has been set to zero for both. A simple fix is to:
>>
>> diff --git a/drivers/net/designware.c b/drivers/net/designware.c
>> index 43670a7..1394119 100644
>> --- a/drivers/net/designware.c
>> +++ b/drivers/net/designware.c
>> @@ -471,10 +471,6 @@ static int dw_phy_init(struct dw_eth_dev *priv, void 
>> *dev)
>> struct phy_device *phydev;
>> int mask = 0x, ret;
>>
>> -#ifdef CONFIG_PHY_ADDR
>> -   mask = 1 << CONFIG_PHY_ADDR;
>> -#endif
>> -
>> phydev = phy_find_by_mask(priv->bus, mask, priv->interface);
>> if (!phydev)
>> return -ENODEV;
>>
>> But the real question is that: why do we introduce this PHY_ADDR
>> Kconfig? It for sure won't work for multiple ethernet controllers.This
>> should be eliminated IMHO. Comments?
>
> This should be able to come from the device tree, ultimately. Can you
> undefine the phy addr for the Galileo board?
>
>> [snip]
>>

#undf the PHY_ADDR in Galileo board looks weird. This to me is a workaround.

Since the designware ethernet controller driver supports finding any
PHY attached to its mdio bus, the changes suggested above can be a
proper fix.

Regards,
Bin
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 1/3] Move CONFIG_PHY_ADDR to Kconfig

2018-03-23 Thread Joe Hershberger
On Thu, Mar 22, 2018 at 9:46 AM, Bin Meng  wrote:
> Hi,
>
> On Fri, Feb 2, 2018 at 9:53 PM, Stefan Mavrodiev  wrote:
>> CONFIG_PHY_ADDR is used for old-style configuration. This makes
>> impossible changing the PHY address, if multiple boards share a same
>> config header file (for example include/configs/sunxi-common.h).
>>
>> Moving this to Kconfig helps overcoming this issue. It's defined
>> as entry inside PHYLIB section.
>>
>> After the implemention, moveconfig was run. The issues are:
>> - edb9315a  - CONFIG_PHYLIB is not enabled. Entry is
>>   deleted.
>>
>> - ds414 - CONFIG_PHYLIB is in incompatible format:
>>   { 0x1, 0x0 }. This entry is also deleted.
>>
>> - devkit3250- The PHY_ADDR is in hex format (0x1F).
>>   Manually CONFIG_PHY_ADDR=31 is added in
>>   the defconfig.
>>
>> After the changes the suspicious defconfigs passes building.
>>
>> Signed-off-by: Stefan Mavrodiev 
>> Acked-by: Maxime Ripard 
>> ---
>>  Changes for v2:
>>- Replaced CONFIG_SUNXI_PHY_ADDR with a common one
>>  CONFIG_PHY_ADDR, using moveconfig.
>>
>>  README | 4 
>>  configs/devkit3250_defconfig   | 1 +
>>  configs/khadas-vim_defconfig   | 1 +
>>  configs/libretech-cc_defconfig | 1 +
>>  configs/p212_defconfig | 1 +
>>  drivers/net/phy/Kconfig| 7 +++
>>  include/configs/am335x_shc.h   | 1 -
>>  include/configs/baltos.h   | 1 -
>>  include/configs/devkit3250.h   | 1 -
>>  include/configs/ds414.h| 1 -
>>  include/configs/edb93xx.h  | 1 -
>>  include/configs/khadas-vim.h   | 2 --
>>  include/configs/libretech-cc.h | 2 --
>>  include/configs/p212.h | 2 --
>>  include/configs/pepper.h   | 1 -
>>  include/configs/sunxi-common.h | 2 --
>>  include/configs/work_92105.h   | 1 -
>>  include/configs/x600.h | 1 -
>>  scripts/config_whitelist.txt   | 1 -
>>  19 files changed, 11 insertions(+), 21 deletions(-)
>>
>
> [snip]
>
>> diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
>> index 95b7534..c934aed 100644
>> --- a/drivers/net/phy/Kconfig
>> +++ b/drivers/net/phy/Kconfig
>> @@ -12,6 +12,13 @@ menuconfig PHYLIB
>>
>>  if PHYLIB
>>
>> +config PHY_ADDR
>> +   int "PHY address"
>> +   default 1 if ARCH_SUNXI
>> +   default 0
>> +   help
>> + The address of PHY on MII bus. Usually in range of 0 to 31.
>> +
>
> Sorry for jumping out so late, but this commit breaks Intel Galileo
> ethernet. Previously the board boots with the following log:
>
> Net: eth0: eth_designware#0, eth1: eth_designware#1
>
> With this commit it becomes:
>
> Net:   No ethernet found.
>
> The reason is that the board has two designware ethernet controllers,
> and PHY_ADDR has been set to zero for both. A simple fix is to:
>
> diff --git a/drivers/net/designware.c b/drivers/net/designware.c
> index 43670a7..1394119 100644
> --- a/drivers/net/designware.c
> +++ b/drivers/net/designware.c
> @@ -471,10 +471,6 @@ static int dw_phy_init(struct dw_eth_dev *priv, void 
> *dev)
> struct phy_device *phydev;
> int mask = 0x, ret;
>
> -#ifdef CONFIG_PHY_ADDR
> -   mask = 1 << CONFIG_PHY_ADDR;
> -#endif
> -
> phydev = phy_find_by_mask(priv->bus, mask, priv->interface);
> if (!phydev)
> return -ENODEV;
>
> But the real question is that: why do we introduce this PHY_ADDR
> Kconfig? It for sure won't work for multiple ethernet controllers.This
> should be eliminated IMHO. Comments?

This should be able to come from the device tree, ultimately. Can you
undefine the phy addr for the Galileo board?

> [snip]
>
> Regards,
> Bin
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 1/3] Move CONFIG_PHY_ADDR to Kconfig

2018-03-23 Thread Bin Meng
Hi,

On Fri, Feb 2, 2018 at 9:53 PM, Stefan Mavrodiev  wrote:
> CONFIG_PHY_ADDR is used for old-style configuration. This makes
> impossible changing the PHY address, if multiple boards share a same
> config header file (for example include/configs/sunxi-common.h).
>
> Moving this to Kconfig helps overcoming this issue. It's defined
> as entry inside PHYLIB section.
>
> After the implemention, moveconfig was run. The issues are:
> - edb9315a  - CONFIG_PHYLIB is not enabled. Entry is
>   deleted.
>
> - ds414 - CONFIG_PHYLIB is in incompatible format:
>   { 0x1, 0x0 }. This entry is also deleted.
>
> - devkit3250- The PHY_ADDR is in hex format (0x1F).
>   Manually CONFIG_PHY_ADDR=31 is added in
>   the defconfig.
>
> After the changes the suspicious defconfigs passes building.
>
> Signed-off-by: Stefan Mavrodiev 
> Acked-by: Maxime Ripard 
> ---
>  Changes for v2:
>- Replaced CONFIG_SUNXI_PHY_ADDR with a common one
>  CONFIG_PHY_ADDR, using moveconfig.
>
>  README | 4 
>  configs/devkit3250_defconfig   | 1 +
>  configs/khadas-vim_defconfig   | 1 +
>  configs/libretech-cc_defconfig | 1 +
>  configs/p212_defconfig | 1 +
>  drivers/net/phy/Kconfig| 7 +++
>  include/configs/am335x_shc.h   | 1 -
>  include/configs/baltos.h   | 1 -
>  include/configs/devkit3250.h   | 1 -
>  include/configs/ds414.h| 1 -
>  include/configs/edb93xx.h  | 1 -
>  include/configs/khadas-vim.h   | 2 --
>  include/configs/libretech-cc.h | 2 --
>  include/configs/p212.h | 2 --
>  include/configs/pepper.h   | 1 -
>  include/configs/sunxi-common.h | 2 --
>  include/configs/work_92105.h   | 1 -
>  include/configs/x600.h | 1 -
>  scripts/config_whitelist.txt   | 1 -
>  19 files changed, 11 insertions(+), 21 deletions(-)
>

[snip]

> diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
> index 95b7534..c934aed 100644
> --- a/drivers/net/phy/Kconfig
> +++ b/drivers/net/phy/Kconfig
> @@ -12,6 +12,13 @@ menuconfig PHYLIB
>
>  if PHYLIB
>
> +config PHY_ADDR
> +   int "PHY address"
> +   default 1 if ARCH_SUNXI
> +   default 0
> +   help
> + The address of PHY on MII bus. Usually in range of 0 to 31.
> +

Sorry for jumping out so late, but this commit breaks Intel Galileo
ethernet. Previously the board boots with the following log:

Net: eth0: eth_designware#0, eth1: eth_designware#1

With this commit it becomes:

Net:   No ethernet found.

The reason is that the board has two designware ethernet controllers,
and PHY_ADDR has been set to zero for both. A simple fix is to:

diff --git a/drivers/net/designware.c b/drivers/net/designware.c
index 43670a7..1394119 100644
--- a/drivers/net/designware.c
+++ b/drivers/net/designware.c
@@ -471,10 +471,6 @@ static int dw_phy_init(struct dw_eth_dev *priv, void *dev)
struct phy_device *phydev;
int mask = 0x, ret;

-#ifdef CONFIG_PHY_ADDR
-   mask = 1 << CONFIG_PHY_ADDR;
-#endif
-
phydev = phy_find_by_mask(priv->bus, mask, priv->interface);
if (!phydev)
return -ENODEV;

But the real question is that: why do we introduce this PHY_ADDR
Kconfig? It for sure won't work for multiple ethernet controllers.This
should be eliminated IMHO. Comments?

[snip]

Regards,
Bin
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 1/3] Move CONFIG_PHY_ADDR to Kconfig

2018-03-13 Thread Jagan Teki
On Fri, Feb 2, 2018 at 7:23 PM, Stefan Mavrodiev  wrote:
> CONFIG_PHY_ADDR is used for old-style configuration. This makes
> impossible changing the PHY address, if multiple boards share a same
> config header file (for example include/configs/sunxi-common.h).
>
> Moving this to Kconfig helps overcoming this issue. It's defined
> as entry inside PHYLIB section.
>
> After the implemention, moveconfig was run. The issues are:
> - edb9315a  - CONFIG_PHYLIB is not enabled. Entry is
>   deleted.
>
> - ds414 - CONFIG_PHYLIB is in incompatible format:
>   { 0x1, 0x0 }. This entry is also deleted.
>
> - devkit3250- The PHY_ADDR is in hex format (0x1F).
>   Manually CONFIG_PHY_ADDR=31 is added in
>   the defconfig.
>
> After the changes the suspicious defconfigs passes building.
>
> Signed-off-by: Stefan Mavrodiev 
> Acked-by: Maxime Ripard 
> ---

rebased on master and

Applied to u-boot-sunxi/master
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 1/3] Move CONFIG_PHY_ADDR to Kconfig

2018-02-05 Thread Calvin Johnson
Hi,

> -Original Message-
> From: Tom Rini [mailto:tr...@konsulko.com]
> 
> On Mon, Feb 05, 2018 at 09:07:40AM +0100, Maxime Ripard wrote:
> > On Sat, Feb 03, 2018 at 04:37:15AM +, Calvin Johnson wrote:
> > > > Hi,
> > > >
> > > > > From: U-Boot [mailto:u-boot-boun...@lists.denx.de] On Behalf Of
> > > > > Stefan Mavrodiev
> > > > > Sent: Friday, February 2, 2018 7:24 PM
> > > >
> > > > 
> > > >
> > > > > diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
> > > > > index 95b7534..c934aed 100644
> > > > > --- a/drivers/net/phy/Kconfig
> > > > > +++ b/drivers/net/phy/Kconfig
> > > > > @@ -12,6 +12,13 @@ menuconfig PHYLIB
> > > > >
> > > > >  if PHYLIB
> > > > >
> > > > > +config PHY_ADDR
> > > > > + int "PHY address"
> > > > > + default 1 if ARCH_SUNXI
> > >
> > > Sorry, I meant the  default value can be defined in board/sunxi/Kconfig.
> > > Remaining definition of PHY_ADDR config can be here.
> >
> > Tom has asked a few times not to do this but to put the defaults where
> > the Kconfig option is defined. I'm not sure I remember the details
> > though.
> 
> For now, yes, the preferred way of dealing with this is 'default FOO if BAR' 
> in
> the main Kconfig entry line.  What I wish for long term is for 'imply' to get
> extended to support 'imply FOO BAR' but I've not had more to add there
> other than "Gee, this would make life easier".

Got it. Thanks!

Calvin
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 1/3] Move CONFIG_PHY_ADDR to Kconfig

2018-02-05 Thread Tom Rini
On Mon, Feb 05, 2018 at 09:07:40AM +0100, Maxime Ripard wrote:
> On Sat, Feb 03, 2018 at 04:37:15AM +, Calvin Johnson wrote:
> > > Hi,
> > > 
> > > > From: U-Boot [mailto:u-boot-boun...@lists.denx.de] On Behalf Of Stefan
> > > > Mavrodiev
> > > > Sent: Friday, February 2, 2018 7:24 PM
> > > 
> > > 
> > > 
> > > > diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index
> > > > 95b7534..c934aed 100644
> > > > --- a/drivers/net/phy/Kconfig
> > > > +++ b/drivers/net/phy/Kconfig
> > > > @@ -12,6 +12,13 @@ menuconfig PHYLIB
> > > >
> > > >  if PHYLIB
> > > >
> > > > +config PHY_ADDR
> > > > +   int "PHY address"
> > > > +   default 1 if ARCH_SUNXI
> > 
> > Sorry, I meant the  default value can be defined in board/sunxi/Kconfig.
> > Remaining definition of PHY_ADDR config can be here.
> 
> Tom has asked a few times not to do this but to put the defaults where
> the Kconfig option is defined. I'm not sure I remember the details
> though.

For now, yes, the preferred way of dealing with this is 'default FOO if
BAR' in the main Kconfig entry line.  What I wish for long term is for
'imply' to get extended to support 'imply FOO BAR' but I've not had more
to add there other than "Gee, this would make life easier".

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 1/3] Move CONFIG_PHY_ADDR to Kconfig

2018-02-05 Thread Maxime Ripard
On Sat, Feb 03, 2018 at 04:37:15AM +, Calvin Johnson wrote:
> > Hi,
> > 
> > > From: U-Boot [mailto:u-boot-boun...@lists.denx.de] On Behalf Of Stefan
> > > Mavrodiev
> > > Sent: Friday, February 2, 2018 7:24 PM
> > 
> > 
> > 
> > > diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index
> > > 95b7534..c934aed 100644
> > > --- a/drivers/net/phy/Kconfig
> > > +++ b/drivers/net/phy/Kconfig
> > > @@ -12,6 +12,13 @@ menuconfig PHYLIB
> > >
> > >  if PHYLIB
> > >
> > > +config PHY_ADDR
> > > + int "PHY address"
> > > + default 1 if ARCH_SUNXI
> 
> Sorry, I meant the  default value can be defined in board/sunxi/Kconfig.
> Remaining definition of PHY_ADDR config can be here.

Tom has asked a few times not to do this but to put the defaults where
the Kconfig option is defined. I'm not sure I remember the details
though.

Maxime

-- 
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
http://bootlin.com


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 1/3] Move CONFIG_PHY_ADDR to Kconfig

2018-02-02 Thread Calvin Johnson
> Hi,
> 
> > From: U-Boot [mailto:u-boot-boun...@lists.denx.de] On Behalf Of Stefan
> > Mavrodiev
> > Sent: Friday, February 2, 2018 7:24 PM
> 
> 
> 
> > diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index
> > 95b7534..c934aed 100644
> > --- a/drivers/net/phy/Kconfig
> > +++ b/drivers/net/phy/Kconfig
> > @@ -12,6 +12,13 @@ menuconfig PHYLIB
> >
> >  if PHYLIB
> >
> > +config PHY_ADDR
> > +   int "PHY address"
> > +   default 1 if ARCH_SUNXI

Sorry, I meant the  default value can be defined in board/sunxi/Kconfig.
Remaining definition of PHY_ADDR config can be here.

> > +   default 0
> > +   help
> > + The address of PHY on MII bus. Usually in range of 0 to 31.
> 
> Isn't board Kconfig, the right place to keep this?
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 1/3] Move CONFIG_PHY_ADDR to Kconfig

2018-02-02 Thread Calvin Johnson
Hi,

> From: U-Boot [mailto:u-boot-boun...@lists.denx.de] On Behalf Of Stefan
> Mavrodiev
> Sent: Friday, February 2, 2018 7:24 PM



> diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index
> 95b7534..c934aed 100644
> --- a/drivers/net/phy/Kconfig
> +++ b/drivers/net/phy/Kconfig
> @@ -12,6 +12,13 @@ menuconfig PHYLIB
> 
>  if PHYLIB
> 
> +config PHY_ADDR
> + int "PHY address"
> + default 1 if ARCH_SUNXI
> + default 0
> + help
> +   The address of PHY on MII bus. Usually in range of 0 to 31.

Isn't board Kconfig, the right place to keep this?

Regards
Calvin
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 1/3] Move CONFIG_PHY_ADDR to Kconfig

2018-02-02 Thread Stefan Mavrodiev
CONFIG_PHY_ADDR is used for old-style configuration. This makes
impossible changing the PHY address, if multiple boards share a same
config header file (for example include/configs/sunxi-common.h).

Moving this to Kconfig helps overcoming this issue. It's defined
as entry inside PHYLIB section.

After the implemention, moveconfig was run. The issues are:
- edb9315a  - CONFIG_PHYLIB is not enabled. Entry is
  deleted.

- ds414 - CONFIG_PHYLIB is in incompatible format:
  { 0x1, 0x0 }. This entry is also deleted.

- devkit3250- The PHY_ADDR is in hex format (0x1F).
  Manually CONFIG_PHY_ADDR=31 is added in
  the defconfig.

After the changes the suspicious defconfigs passes building.

Signed-off-by: Stefan Mavrodiev 
Acked-by: Maxime Ripard 
---
 Changes for v2:
   - Replaced CONFIG_SUNXI_PHY_ADDR with a common one
 CONFIG_PHY_ADDR, using moveconfig.

 README | 4 
 configs/devkit3250_defconfig   | 1 +
 configs/khadas-vim_defconfig   | 1 +
 configs/libretech-cc_defconfig | 1 +
 configs/p212_defconfig | 1 +
 drivers/net/phy/Kconfig| 7 +++
 include/configs/am335x_shc.h   | 1 -
 include/configs/baltos.h   | 1 -
 include/configs/devkit3250.h   | 1 -
 include/configs/ds414.h| 1 -
 include/configs/edb93xx.h  | 1 -
 include/configs/khadas-vim.h   | 2 --
 include/configs/libretech-cc.h | 2 --
 include/configs/p212.h | 2 --
 include/configs/pepper.h   | 1 -
 include/configs/sunxi-common.h | 2 --
 include/configs/work_92105.h   | 1 -
 include/configs/x600.h | 1 -
 scripts/config_whitelist.txt   | 1 -
 19 files changed, 11 insertions(+), 21 deletions(-)

diff --git a/README b/README
index b53ea7d..499184d 100644
--- a/README
+++ b/README
@@ -1436,10 +1436,6 @@ The following options need to be configured:
be at least 4MB.
 
 - MII/PHY support:
-   CONFIG_PHY_ADDR
-
-   The address of PHY on MII bus.
-
CONFIG_PHY_CLOCK_FREQ (ppc4xx)
 
The clock frequency of the MII bus
diff --git a/configs/devkit3250_defconfig b/configs/devkit3250_defconfig
index 2ad08ae..930b631 100644
--- a/configs/devkit3250_defconfig
+++ b/configs/devkit3250_defconfig
@@ -36,6 +36,7 @@ CONFIG_MTD_NOR_FLASH=y
 CONFIG_NAND=y
 CONFIG_SPL_NAND_SIMPLE=y
 CONFIG_PHYLIB=y
+CONFIG_PHY_ADDR=31
 CONFIG_DM_SERIAL=y
 CONFIG_SYS_NS16550=y
 CONFIG_USB=y
diff --git a/configs/khadas-vim_defconfig b/configs/khadas-vim_defconfig
index 4ceab90..e9a96d3 100644
--- a/configs/khadas-vim_defconfig
+++ b/configs/khadas-vim_defconfig
@@ -20,6 +20,7 @@ CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_DM_GPIO=y
 CONFIG_DM_MMC=y
 CONFIG_MMC_MESON_GX=y
+CONFIG_PHY_ADDR=8
 CONFIG_PHY_MESON_GXL=y
 CONFIG_DM_ETH=y
 CONFIG_ETH_DESIGNWARE=y
diff --git a/configs/libretech-cc_defconfig b/configs/libretech-cc_defconfig
index 3bccff1..86852b1 100644
--- a/configs/libretech-cc_defconfig
+++ b/configs/libretech-cc_defconfig
@@ -20,6 +20,7 @@ CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_DM_GPIO=y
 CONFIG_DM_MMC=y
 CONFIG_MMC_MESON_GX=y
+CONFIG_PHY_ADDR=8
 CONFIG_PHY_MESON_GXL=y
 CONFIG_DM_ETH=y
 CONFIG_ETH_DESIGNWARE=y
diff --git a/configs/p212_defconfig b/configs/p212_defconfig
index cb9be4a..9466238 100644
--- a/configs/p212_defconfig
+++ b/configs/p212_defconfig
@@ -20,6 +20,7 @@ CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_DM_GPIO=y
 CONFIG_DM_MMC=y
 CONFIG_MMC_MESON_GX=y
+CONFIG_PHY_ADDR=8
 CONFIG_PHY_MESON_GXL=y
 CONFIG_DM_ETH=y
 CONFIG_ETH_DESIGNWARE=y
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index 95b7534..c934aed 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -12,6 +12,13 @@ menuconfig PHYLIB
 
 if PHYLIB
 
+config PHY_ADDR
+   int "PHY address"
+   default 1 if ARCH_SUNXI
+   default 0
+   help
+ The address of PHY on MII bus. Usually in range of 0 to 31.
+
 config B53_SWITCH
bool "Broadcom BCM53xx (RoboSwitch) Ethernet switch PHY support."
help
diff --git a/include/configs/am335x_shc.h b/include/configs/am335x_shc.h
index e2d329a..2b705fc 100644
--- a/include/configs/am335x_shc.h
+++ b/include/configs/am335x_shc.h
@@ -264,7 +264,6 @@
 #define CONFIG_BOOTP_GATEWAY
 #define CONFIG_BOOTP_SUBNETMASK
 #define CONFIG_NET_RETRY_COUNT 10
-#define CONFIG_PHY_ADDR0
 #define CONFIG_PHY_SMSC
 
 /* I2C configuration */
diff --git a/include/configs/baltos.h b/include/configs/baltos.h
index 75dd0c5..31ae20c 100644
--- a/include/configs/baltos.h
+++ b/include/configs/baltos.h
@@ -285,7 +285,6 @@
 #endif
 
 /* Network. */
-#define CONFIG_PHY_ADDR0
 #define CONFIG_PHY_SMSC
 #define CONFIG_MII
 #define CONFIG_PHY_ATHEROS
diff --git a/include/configs/devkit3250.h b/include/configs/devkit3250.h
index 526a81a..b66b90e 100644
---