[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 13/30] hw/net: cadence_gem: Add a new 'phy-addr' property
From: |
Alistair Francis |
Subject: |
[PULL 13/30] hw/net: cadence_gem: Add a new 'phy-addr' property |
Date: |
Thu, 10 Sep 2020 11:09:21 -0700 |
From: Bin Meng <bin.meng@windriver.com>
At present the PHY address of the PHY connected to GEM is hard-coded
to either 23 (BOARD_PHY_ADDRESS) or 0. This might not be the case for
all boards. Add a new 'phy-addr' property so that board can specify
the PHY address for each GEM instance.
Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <1598924352-89526-12-git-send-email-bmeng.cn@gmail.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
include/hw/net/cadence_gem.h | 2 ++
hw/net/cadence_gem.c | 5 +++--
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/include/hw/net/cadence_gem.h b/include/hw/net/cadence_gem.h
index 54e646ff79..01c6189a24 100644
--- a/include/hw/net/cadence_gem.h
+++ b/include/hw/net/cadence_gem.h
@@ -73,6 +73,8 @@ typedef struct CadenceGEMState {
/* Mask of register bits which are write 1 to clear */
uint32_t regs_w1c[CADENCE_GEM_MAXREG];
+ /* PHY address */
+ uint8_t phy_addr;
/* PHY registers backing store */
uint16_t phy_regs[32];
diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c
index a93b5c07ce..d80096bbe8 100644
--- a/hw/net/cadence_gem.c
+++ b/hw/net/cadence_gem.c
@@ -1446,7 +1446,7 @@ static uint64_t gem_read(void *opaque, hwaddr offset,
unsigned size)
uint32_t phy_addr, reg_num;
phy_addr = (retval & GEM_PHYMNTNC_ADDR) >> GEM_PHYMNTNC_ADDR_SHFT;
- if (phy_addr == BOARD_PHY_ADDRESS || phy_addr == 0) {
+ if (phy_addr == s->phy_addr || phy_addr == 0) {
reg_num = (retval & GEM_PHYMNTNC_REG) >>
GEM_PHYMNTNC_REG_SHIFT;
retval &= 0xFFFF0000;
retval |= gem_phy_read(s, reg_num);
@@ -1569,7 +1569,7 @@ static void gem_write(void *opaque, hwaddr offset,
uint64_t val,
uint32_t phy_addr, reg_num;
phy_addr = (val & GEM_PHYMNTNC_ADDR) >> GEM_PHYMNTNC_ADDR_SHFT;
- if (phy_addr == BOARD_PHY_ADDRESS || phy_addr == 0) {
+ if (phy_addr == s->phy_addr || phy_addr == 0) {
reg_num = (val & GEM_PHYMNTNC_REG) >> GEM_PHYMNTNC_REG_SHIFT;
gem_phy_write(s, reg_num, val);
}
@@ -1682,6 +1682,7 @@ static Property gem_properties[] = {
DEFINE_NIC_PROPERTIES(CadenceGEMState, conf),
DEFINE_PROP_UINT32("revision", CadenceGEMState, revision,
GEM_MODID_VALUE),
+ DEFINE_PROP_UINT8("phy-addr", CadenceGEMState, phy_addr,
BOARD_PHY_ADDRESS),
DEFINE_PROP_UINT8("num-priority-queues", CadenceGEMState,
num_priority_queues, 1),
DEFINE_PROP_UINT8("num-type1-screeners", CadenceGEMState,
--
2.28.0
- [PULL 03/30] target/riscv: cpu: Add a new 'resetvec' property, (continued)
- [PULL 03/30] target/riscv: cpu: Add a new 'resetvec' property, Alistair Francis, 2020/09/10
- [PULL 05/30] target/riscv: cpu: Set reset vector based on the configured property value, Alistair Francis, 2020/09/10
- [PULL 04/30] hw/riscv: hart: Add a new 'resetvec' property, Alistair Francis, 2020/09/10
- [PULL 07/30] hw/char: Add Microchip PolarFire SoC MMUART emulation, Alistair Francis, 2020/09/10
- [PULL 08/30] hw/riscv: microchip_pfsoc: Connect 5 MMUARTs, Alistair Francis, 2020/09/10
- [PULL 09/30] hw/sd: Add Cadence SDHCI emulation, Alistair Francis, 2020/09/10
- [PULL 06/30] hw/riscv: Initial support for Microchip PolarFire SoC Icicle Kit board, Alistair Francis, 2020/09/10
- [PULL 11/30] hw/dma: Add SiFive platform DMA controller emulation, Alistair Francis, 2020/09/10
- [PULL 10/30] hw/riscv: microchip_pfsoc: Connect a Cadence SDHCI controller and an SD card, Alistair Francis, 2020/09/10
- [PULL 12/30] hw/riscv: microchip_pfsoc: Connect a DMA controller, Alistair Francis, 2020/09/10
- [PULL 13/30] hw/net: cadence_gem: Add a new 'phy-addr' property,
Alistair Francis <=
- [PULL 14/30] hw/arm: xlnx: Set all boards' GEM 'phy-addr' property value to 23, Alistair Francis, 2020/09/10
- [PULL 15/30] hw/riscv: microchip_pfsoc: Connect 2 Cadence GEMs, Alistair Francis, 2020/09/10
- [PULL 16/30] hw/riscv: microchip_pfsoc: Hook GPIO controllers, Alistair Francis, 2020/09/10
- [PULL 18/30] hw/riscv: sifive_u: Connect a DMA controller, Alistair Francis, 2020/09/10
- [PULL 17/30] hw/riscv: clint: Avoid using hard-coded timebase frequency, Alistair Francis, 2020/09/10
- [PULL 19/30] hw/riscv: Move sifive_e_prci model to hw/misc, Alistair Francis, 2020/09/10
- [PULL 20/30] hw/riscv: Move sifive_u_prci model to hw/misc, Alistair Francis, 2020/09/10
- [PULL 21/30] hw/riscv: Move sifive_u_otp model to hw/misc, Alistair Francis, 2020/09/10
- [PULL 22/30] hw/riscv: Move sifive_gpio model to hw/gpio, Alistair Francis, 2020/09/10
- [PULL 25/30] hw/riscv: Move riscv_htif model to hw/char, Alistair Francis, 2020/09/10