hw/net: Add npcm7xx emc model
PATCH 1/1 hw/net: Add npcm7xx emc model
This is a 10/100 ethernet device that has several features. Only the ones needed by the Linux driver have been implemented. See npcm7xx_emc.c for a list of unimplemented features.
--- docs/system/arm/nuvoton.rst | 3 +- hw/arm/npcm7xx.c | 50 +- hw/net/meson.build | 1 + hw/net/npcm7xx_emc.c | 852 +++++++++++++++++++++++++++++++++ hw/net/trace-events | 17 + include/hw/arm/npcm7xx.h | 2 + include/hw/net/npcm7xx_emc.h | 286 +++++++++++ tests/qtest/meson.build | 1 + tests/qtest/npcm7xx_emc-test.c | 793 ++++++++++++++++++++++++++++++ 9 files changed, 2002 insertions(+), 3 deletions(-) create mode 100644 hw/net/npcm7xx_emc.c create mode 100644 include/hw/net/npcm7xx_emc.h create mode 100644 tests/qtest/npcm7xx_emc-test.c
docs/system/arm/nuvoton.rst +2 -1
@@ -43,6 +43,7 @@ Supported devices * GPIO controller * Analog to Digital Converter (ADC) * Pulse Width Modulation (PWM) + * Ethernet controller (EMC) Missing devices ---------------
@@ -56,7 +57,7 @@ Missing devices * Shared memory (SHM) * eSPI slave interface - * Ethernet controllers (GMAC and EMC) + * Ethernet controller (GMAC) * USB device (USBD) * SMBus controller (SMBF) * Peripheral SPI controller (PSPI)
hw/arm/npcm7xx.c +48 -2
86 lines not on this page · raw message
hw/net/meson.build +1 -0
@@ -35,6 +35,7 @@ softmmu_ss.add(when: 'CONFIG_I82596_COMMON', if_true: files('i82596.c')) softmmu_ss.add(when: 'CONFIG_SUNHME', if_true: files('sunhme.c')) softmmu_ss.add(when: 'CONFIG_FTGMAC100', if_true: files('ftgmac100.c')) softmmu_ss.add(when: 'CONFIG_SUNGEM', if_true: files('sungem.c')) +softmmu_ss.add(when: 'CONFIG_NPCM7XX', if_true: files('npcm7xx_emc.c')) softmmu_ss.add(when: 'CONFIG_ETRAXFS', if_true: files('etraxfs_eth.c')) softmmu_ss.add(when: 'CONFIG_COLDFIRE', if_true: files('mcf_fec.c'))
hw/net/npcm7xx_emc.c new file +852 -0
852 lines not on this page · raw message
hw/net/trace-events +17 -0
@@ -429,3 +429,20 @@ imx_fec_receive_last(int last) "rx frame flags 0x%04x" imx_enet_receive(size_t size) "len %zu" imx_enet_receive_len(uint64_t addr, int len) "rx_bd 0x%"PRIx64" length %d" imx_enet_receive_last(int last) "rx frame flags 0x%04x" + +# npcm7xx_emc.c +npcm7xx_emc_reset(int emc_num) "Resetting emc%d" +npcm7xx_emc_update_tx_irq(int level) "Setting tx irq to %d" +npcm7xx_emc_update_rx_irq(int level) "Setting rx irq to %d" +npcm7xx_emc_set_mista(uint32_t flags) "ORing 0x%x into MISTA" +npcm7xx_emc_cpu_owned_desc(uint32_t addr) "Can't process cpu-owned descriptor @0x%x" +npcm7xx_emc_sent_packet(uint32_t len) "Sent %u byte packet" +npcm7xx_emc_tx_done(uint32_t ctxdsa) "TX done, CTXDSA=0x%x" +npcm7xx_emc_can_receive(int can_receive) "Can receive: %d" +npcm7xx_emc_packet_filtered_out(const char* fail_reason) "Packet filtered out: %s" +npcm7xx_emc_packet_dropped(uint32_t len) "%u byte packet dropped" +npcm7xx_emc_receiving_packet(uint32_t len) "Receiving %u byte packet" +npcm7xx_emc_received_packet(uint32_t len) "Received %u byte packet" +npcm7xx_emc_rx_done(uint32_t crxdsa) "RX done, CRXDSA=0x%x" +npcm7xx_emc_reg_read(int emc_num, uint32_t result, const char *name, int regno) "emc%d: 0x%x = reg[%s/%d]" +npcm7xx_emc_reg_write(int emc_num, const char *name, int regno, uint32_t value) "emc%d: reg[%s/%d] = 0x%x"
include/hw/arm/npcm7xx.h +2 -0
@@ -25,6 +25,7 @@#include "hw/misc/npcm7xx_gcr.h" #include "hw/misc/npcm7xx_pwm.h" #include "hw/misc/npcm7xx_rng.h" +#include "hw/net/npcm7xx_emc.h" #include "hw/nvram/npcm7xx_otp.h" #include "hw/timer/npcm7xx_timer.h" #include "hw/ssi/npcm7xx_fiu.h"
@@ -88,6 +89,7 @@ typedef struct NPCM7xxState {EHCISysBusState ehci;OHCISysBusState ohci;NPCM7xxFIUState fiu[2 ]; +NPCM7xxEMCState emc[2 ]; } NPCM7xxState;#define TYPE_NPCM7XX "npcm7xx"
include/hw/net/npcm7xx_emc.h new file +286 -0
286 lines not on this page · raw message
tests/qtest/meson.build +1 -0
@@ -135,6 +135,7 @@ qtests_sparc64 = \ qtests_npcm7xx = \ ['npcm7xx_adc-test', + 'npcm7xx_emc-test', 'npcm7xx_gpio-test', 'npcm7xx_pwm-test', 'npcm7xx_rng-test',
tests/qtest/npcm7xx_emc-test.c new file +793 -0
793 lines not on this page · raw message
Signature · 1 line
2.30.0.280.ga3ce27912f-goog
Quoted 8 lines · dje--- via
This is a 10/100 ethernet device that has several features. Only the ones needed by the Linux driver have been implemented. See
npcm7xx_emc.cfor a list of unimplemented features.Reviewed-by Hao Wu <[email protected]>Reviewed-by Avi Fishman <[email protected]>Signed-off-by Doug Evans <[email protected]>
Quoted 14 lines
--- docs/system/arm/nuvoton.rst | 3 +- hw/arm/npcm7xx.c | 50 +- hw/net/meson.build | 1 + hw/net/npcm7xx_emc.c | 852 +++++++++++++++++++++++++++++++++ hw/net/trace-events | 17 + include/hw/arm/npcm7xx.h | 2 + include/hw/net/npcm7xx_emc.h | 286 +++++++++++ tests/qtest/meson.build | 1 + tests/qtest/npcm7xx_emc-test.c | 793 ++++++++++++++++++++++++++++++ 9 files changed, 2002 insertions(+), 3 deletions(-) create mode 100644 hw/net/npcm7xx_emc.c create mode 100644 include/hw/net/npcm7xx_emc.h create mode 100644 tests/qtest/npcm7xx_emc-test.c
Hi; could you split this into a multi-patch series so it's a bit more digestible to review, please ?
patch 1: new device
patch 2: add new device to the npcm7xx board patch 3: device test case
thanks
-- PMM
Quoted 24 lines · Peter Maydell
Quoted 8 lines · dje--- via
This is a 10/100 ethernet device that has several features. Only the ones needed by the Linux driver have been implemented. See
npcm7xx_emc.cfor a list of unimplemented features.Reviewed-by Hao Wu <[email protected]>Reviewed-by Avi Fishman <[email protected]>Signed-off-by Doug Evans <[email protected]>Quoted 14 lines
--- docs/system/arm/nuvoton.rst | 3 +- hw/arm/npcm7xx.c | 50 +- hw/net/meson.build | 1 + hw/net/npcm7xx_emc.c | 852 +++++++++++++++++++++++++++++++++ hw/net/trace-events | 17 + include/hw/arm/npcm7xx.h | 2 + include/hw/net/npcm7xx_emc.h | 286 +++++++++++ tests/qtest/meson.build | 1 + tests/qtest/npcm7xx_emc-test.c | 793 ++++++++++++++++++++++++++++++ 9 files changed, 2002 insertions(+), 3 deletions(-) create mode 100644 hw/net/npcm7xx_emc.c create mode 100644 include/hw/net/npcm7xx_emc.h create mode 100644 tests/qtest/npcm7xx_emc-test.c
Quoted 9 lines
Hi; could you split this into a multi-patch series so it's a bit more digestible to review, please ?
patch 1: new device
patch 2: add new device to the npcm7xx board patch 3: device test casethanks
-- PMM
Done, thx.
https://lists.nongnu.org/archive/html/qemu-devel/2021-02/msg00804.html