qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hw/arm/xlnx: Fix PHY address for xilinx-zynq-a9
@ 2021-05-04 12:41 Guenter Roeck
  2021-05-06  1:58 ` Bin Meng
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Guenter Roeck @ 2021-05-04 12:41 UTC (permalink / raw)
  To: Edgar E . Iglesias
  Cc: Peter Maydell, Alistair Francis, Bin Meng, qemu-devel, qemu-arm,
	Guenter Roeck

Commit dfc388797cc4 ("hw/arm: xlnx: Set all boards' GEM 'phy-addr'
property value to 23") configured the PHY address for xilinx-zynq-a9
to 23. When trying to boot xilinx-zynq-a9 with zynq-zc702.dtb or
zynq-zc706.dtb, this results in the following error message when
trying to use the Ethernet interface.

macb e000b000.ethernet eth0: Could not attach PHY (-19)

The devicetree files for ZC702 and ZC706 configure PHY address 7. The
documentation for the ZC702 and ZC706 evaluation boards suggest that the
PHY address is 7, not 23. Other boards use PHY address 0, 1, 3, or 7.
I was unable to find a documentation or a devicetree file suggesting
or using PHY address 23. The Ethernet interface starts working with
zynq-zc702.dtb and zynq-zc706.dtb when setting the PHY address to 7,
so let's use it.

Cc: Bin Meng <bin.meng@windriver.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 hw/arm/xilinx_zynq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c
index 8db6cfd47f..5ac0294f9e 100644
--- a/hw/arm/xilinx_zynq.c
+++ b/hw/arm/xilinx_zynq.c
@@ -119,7 +119,7 @@ static void gem_init(NICInfo *nd, uint32_t base, qemu_irq irq)
         qemu_check_nic_model(nd, TYPE_CADENCE_GEM);
         qdev_set_nic_properties(dev, nd);
     }
-    object_property_set_int(OBJECT(dev), "phy-addr", 23, &error_abort);
+    object_property_set_int(OBJECT(dev), "phy-addr", 7, &error_abort);
     s = SYS_BUS_DEVICE(dev);
     sysbus_realize_and_unref(s, &error_fatal);
     sysbus_mmio_map(s, 0, base);
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] hw/arm/xlnx: Fix PHY address for xilinx-zynq-a9
  2021-05-04 12:41 [PATCH] hw/arm/xlnx: Fix PHY address for xilinx-zynq-a9 Guenter Roeck
@ 2021-05-06  1:58 ` Bin Meng
  2021-05-06  2:26   ` Guenter Roeck
  2021-05-07 11:52 ` Edgar E. Iglesias
  2021-05-10 11:26 ` Peter Maydell
  2 siblings, 1 reply; 5+ messages in thread
From: Bin Meng @ 2021-05-06  1:58 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Peter Maydell, Alistair Francis, Bin Meng,
	qemu-devel@nongnu.org Developers, qemu-arm, Edgar E . Iglesias

Hi Guenter,

On Tue, May 4, 2021 at 8:41 PM Guenter Roeck <linux@roeck-us.net> wrote:
>
> Commit dfc388797cc4 ("hw/arm: xlnx: Set all boards' GEM 'phy-addr'
> property value to 23") configured the PHY address for xilinx-zynq-a9
> to 23. When trying to boot xilinx-zynq-a9 with zynq-zc702.dtb or
> zynq-zc706.dtb, this results in the following error message when
> trying to use the Ethernet interface.
>
> macb e000b000.ethernet eth0: Could not attach PHY (-19)
>
> The devicetree files for ZC702 and ZC706 configure PHY address 7. The
> documentation for the ZC702 and ZC706 evaluation boards suggest that the
> PHY address is 7, not 23. Other boards use PHY address 0, 1, 3, or 7.
> I was unable to find a documentation or a devicetree file suggesting
> or using PHY address 23.

I can't find one neither :(

> The Ethernet interface starts working with
> zynq-zc702.dtb and zynq-zc706.dtb when setting the PHY address to 7,
> so let's use it.
>
> Cc: Bin Meng <bin.meng@windriver.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
>  hw/arm/xilinx_zynq.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c
> index 8db6cfd47f..5ac0294f9e 100644
> --- a/hw/arm/xilinx_zynq.c
> +++ b/hw/arm/xilinx_zynq.c
> @@ -119,7 +119,7 @@ static void gem_init(NICInfo *nd, uint32_t base, qemu_irq irq)
>          qemu_check_nic_model(nd, TYPE_CADENCE_GEM);
>          qdev_set_nic_properties(dev, nd);
>      }
> -    object_property_set_int(OBJECT(dev), "phy-addr", 23, &error_abort);
> +    object_property_set_int(OBJECT(dev), "phy-addr", 7, &error_abort);
>      s = SYS_BUS_DEVICE(dev);
>      sysbus_realize_and_unref(s, &error_fatal);
>      sysbus_mmio_map(s, 0, base);
> --

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

While we are here, could you please create a doc for the target you
are testing with Linux/U-Boot/etc?

I was having a hard time booting upstream U-Boot/Linux on QEMU zynqmp before.

Regards,
Bin


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] hw/arm/xlnx: Fix PHY address for xilinx-zynq-a9
  2021-05-06  1:58 ` Bin Meng
@ 2021-05-06  2:26   ` Guenter Roeck
  0 siblings, 0 replies; 5+ messages in thread
From: Guenter Roeck @ 2021-05-06  2:26 UTC (permalink / raw)
  To: Bin Meng
  Cc: Peter Maydell, Alistair Francis, Bin Meng,
	qemu-devel@nongnu.org Developers, qemu-arm, Edgar E . Iglesias

On 5/5/21 6:58 PM, Bin Meng wrote:
> Hi Guenter,
> 
> On Tue, May 4, 2021 at 8:41 PM Guenter Roeck <linux@roeck-us.net> wrote:
>>
>> Commit dfc388797cc4 ("hw/arm: xlnx: Set all boards' GEM 'phy-addr'
>> property value to 23") configured the PHY address for xilinx-zynq-a9
>> to 23. When trying to boot xilinx-zynq-a9 with zynq-zc702.dtb or
>> zynq-zc706.dtb, this results in the following error message when
>> trying to use the Ethernet interface.
>>
>> macb e000b000.ethernet eth0: Could not attach PHY (-19)
>>
>> The devicetree files for ZC702 and ZC706 configure PHY address 7. The
>> documentation for the ZC702 and ZC706 evaluation boards suggest that the
>> PHY address is 7, not 23. Other boards use PHY address 0, 1, 3, or 7.
>> I was unable to find a documentation or a devicetree file suggesting
>> or using PHY address 23.
> 
> I can't find one neither :(
> 
>> The Ethernet interface starts working with
>> zynq-zc702.dtb and zynq-zc706.dtb when setting the PHY address to 7,
>> so let's use it.
>>
>> Cc: Bin Meng <bin.meng@windriver.com>
>> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
>> ---
>>  hw/arm/xilinx_zynq.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c
>> index 8db6cfd47f..5ac0294f9e 100644
>> --- a/hw/arm/xilinx_zynq.c
>> +++ b/hw/arm/xilinx_zynq.c
>> @@ -119,7 +119,7 @@ static void gem_init(NICInfo *nd, uint32_t base, qemu_irq irq)
>>          qemu_check_nic_model(nd, TYPE_CADENCE_GEM);
>>          qdev_set_nic_properties(dev, nd);
>>      }
>> -    object_property_set_int(OBJECT(dev), "phy-addr", 23, &error_abort);
>> +    object_property_set_int(OBJECT(dev), "phy-addr", 7, &error_abort);
>>      s = SYS_BUS_DEVICE(dev);
>>      sysbus_realize_and_unref(s, &error_fatal);
>>      sysbus_mmio_map(s, 0, base);
>> --
> 
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
> 
> While we are here, could you please create a doc for the target you
> are testing with Linux/U-Boot/etc?
> 
> I was having a hard time booting upstream U-Boot/Linux on QEMU zynqmp before.
> 

Everything I have is in my repository at
    https://github.com/groeck/linux-build-test
My clone of qemu is at
    https://github.com/groeck/qemu

The v6.0.0-local branch in the qemu repository is probably the most relevant.
There are two caveats when trying to boot zynqmp images:
- You may need commit 9bfbe02879 from that branch to boot Linux directly,
  ie without u-boot. That patch was rejected a long time ago (the argument,
  if I recall correctly, was that u-boot should set the clock rates as
  needed).
- Booting zynqmp based images on arm64 with linux 5.6 and later doesn't work
  anymore. This is due to Linux commit 9c8a47b484ed ("arm64: dts: xilinx:
  Add the clock nodes for zynqmp"). Unfortunately, those clocks are tied
  to zynqmq firmware which is not emulated by qemu, so all the drivers
  needed to do anything useful in Linux won't load.

Hope this helps,
Guenter


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] hw/arm/xlnx: Fix PHY address for xilinx-zynq-a9
  2021-05-04 12:41 [PATCH] hw/arm/xlnx: Fix PHY address for xilinx-zynq-a9 Guenter Roeck
  2021-05-06  1:58 ` Bin Meng
@ 2021-05-07 11:52 ` Edgar E. Iglesias
  2021-05-10 11:26 ` Peter Maydell
  2 siblings, 0 replies; 5+ messages in thread
From: Edgar E. Iglesias @ 2021-05-07 11:52 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Bin Meng, Peter Maydell, Alistair Francis, qemu-devel, qemu-arm

On Tue, May 04, 2021 at 05:41:40AM -0700, Guenter Roeck wrote:
> Commit dfc388797cc4 ("hw/arm: xlnx: Set all boards' GEM 'phy-addr'
> property value to 23") configured the PHY address for xilinx-zynq-a9
> to 23. When trying to boot xilinx-zynq-a9 with zynq-zc702.dtb or
> zynq-zc706.dtb, this results in the following error message when
> trying to use the Ethernet interface.
> 
> macb e000b000.ethernet eth0: Could not attach PHY (-19)
> 
> The devicetree files for ZC702 and ZC706 configure PHY address 7. The
> documentation for the ZC702 and ZC706 evaluation boards suggest that the
> PHY address is 7, not 23. Other boards use PHY address 0, 1, 3, or 7.
> I was unable to find a documentation or a devicetree file suggesting
> or using PHY address 23. The Ethernet interface starts working with
> zynq-zc702.dtb and zynq-zc706.dtb when setting the PHY address to 7,
> so let's use it.
> 
> Cc: Bin Meng <bin.meng@windriver.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>

Acked-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>




> ---
>  hw/arm/xilinx_zynq.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c
> index 8db6cfd47f..5ac0294f9e 100644
> --- a/hw/arm/xilinx_zynq.c
> +++ b/hw/arm/xilinx_zynq.c
> @@ -119,7 +119,7 @@ static void gem_init(NICInfo *nd, uint32_t base, qemu_irq irq)
>          qemu_check_nic_model(nd, TYPE_CADENCE_GEM);
>          qdev_set_nic_properties(dev, nd);
>      }
> -    object_property_set_int(OBJECT(dev), "phy-addr", 23, &error_abort);
> +    object_property_set_int(OBJECT(dev), "phy-addr", 7, &error_abort);
>      s = SYS_BUS_DEVICE(dev);
>      sysbus_realize_and_unref(s, &error_fatal);
>      sysbus_mmio_map(s, 0, base);
> -- 
> 2.25.1
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] hw/arm/xlnx: Fix PHY address for xilinx-zynq-a9
  2021-05-04 12:41 [PATCH] hw/arm/xlnx: Fix PHY address for xilinx-zynq-a9 Guenter Roeck
  2021-05-06  1:58 ` Bin Meng
  2021-05-07 11:52 ` Edgar E. Iglesias
@ 2021-05-10 11:26 ` Peter Maydell
  2 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2021-05-10 11:26 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Bin Meng, Edgar E . Iglesias, Alistair Francis, QEMU Developers,
	qemu-arm

On Tue, 4 May 2021 at 13:41, Guenter Roeck <linux@roeck-us.net> wrote:
>
> Commit dfc388797cc4 ("hw/arm: xlnx: Set all boards' GEM 'phy-addr'
> property value to 23") configured the PHY address for xilinx-zynq-a9
> to 23. When trying to boot xilinx-zynq-a9 with zynq-zc702.dtb or
> zynq-zc706.dtb, this results in the following error message when
> trying to use the Ethernet interface.
>
> macb e000b000.ethernet eth0: Could not attach PHY (-19)
>
> The devicetree files for ZC702 and ZC706 configure PHY address 7. The
> documentation for the ZC702 and ZC706 evaluation boards suggest that the
> PHY address is 7, not 23. Other boards use PHY address 0, 1, 3, or 7.
> I was unable to find a documentation or a devicetree file suggesting
> or using PHY address 23. The Ethernet interface starts working with
> zynq-zc702.dtb and zynq-zc706.dtb when setting the PHY address to 7,
> so let's use it.
>
> Cc: Bin Meng <bin.meng@windriver.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
>  hw/arm/xilinx_zynq.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c
> index 8db6cfd47f..5ac0294f9e 100644
> --- a/hw/arm/xilinx_zynq.c
> +++ b/hw/arm/xilinx_zynq.c
> @@ -119,7 +119,7 @@ static void gem_init(NICInfo *nd, uint32_t base, qemu_irq irq)
>          qemu_check_nic_model(nd, TYPE_CADENCE_GEM);
>          qdev_set_nic_properties(dev, nd);
>      }
> -    object_property_set_int(OBJECT(dev), "phy-addr", 23, &error_abort);
> +    object_property_set_int(OBJECT(dev), "phy-addr", 7, &error_abort);
>      s = SYS_BUS_DEVICE(dev);
>      sysbus_realize_and_unref(s, &error_fatal);
>      sysbus_mmio_map(s, 0, base);
> --
> 2.25.1



Applied to target-arm.next, thanks.

-- PMM


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-05-10 11:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-04 12:41 [PATCH] hw/arm/xlnx: Fix PHY address for xilinx-zynq-a9 Guenter Roeck
2021-05-06  1:58 ` Bin Meng
2021-05-06  2:26   ` Guenter Roeck
2021-05-07 11:52 ` Edgar E. Iglesias
2021-05-10 11:26 ` Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).