From: Markus Stockhausen Date: Wed, 8 Apr 2026 18:28:08 +0000 (+0200) Subject: realtek: eth: convert to regmap/msleep X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0ab3b047f153109fde1c5e4176d466dabcaf5982;p=thirdparty%2Fopenwrt.git realtek: eth: convert to regmap/msleep Convert some coding - from sw() macros to regmap and - from mdelay() to msleep() Signed-off-by: Markus Stockhausen Link: https://github.com/openwrt/openwrt/pull/22853 Signed-off-by: Robert Marko --- diff --git a/target/linux/realtek/files-6.18/drivers/net/ethernet/rtl838x_eth.c b/target/linux/realtek/files-6.18/drivers/net/ethernet/rtl838x_eth.c index 33e1f115631..3239c05506d 100644 --- a/target/linux/realtek/files-6.18/drivers/net/ethernet/rtl838x_eth.c +++ b/target/linux/realtek/files-6.18/drivers/net/ethernet/rtl838x_eth.c @@ -244,7 +244,7 @@ static void rteth_93xx_update_counter(struct rteth_ctrl *ctrl, int ring, int rel int pos = (ring % 3) * 10; /* writing x to the ring counter increases ring free space by x */ - sw_w32(released << pos, ctrl->r->dma_if_rx_ring_cntr(ring)); + regmap_write(ctrl->map, ctrl->r->dma_if_rx_ring_cntr(ring), released << pos); } struct dsa_tag { @@ -392,16 +392,18 @@ static irqreturn_t rteth_net_irq(int irq, void *dev_id) static void rteth_nic_reset(struct rteth_ctrl *ctrl, int reset_mask) { + int val; + pr_info("RESETTING CPU_PORT %d\n", ctrl->r->cpu_port); - sw_w32_mask(0x3, 0, ctrl->r->mac_l2_port_ctrl); - mdelay(100); + regmap_update_bits(ctrl->map, ctrl->r->mac_l2_port_ctrl, 0x3, 0x0); + msleep(100); /* Reset NIC (SW_NIC_RST) and queues (SW_Q_RST) */ - sw_w32_mask(0, reset_mask, ctrl->r->rst_glb_ctrl); - while (sw_r32(ctrl->r->rst_glb_ctrl) & reset_mask) - udelay(20); + regmap_update_bits(ctrl->map, ctrl->r->rst_glb_ctrl, reset_mask, reset_mask); + regmap_read_poll_timeout(ctrl->map, ctrl->r->rst_glb_ctrl, val, + !(val & reset_mask), 1000, 1000000); - mdelay(100); + msleep(100); } static void rteth_838x_hw_reset(struct rteth_ctrl *ctrl) @@ -409,7 +411,7 @@ static void rteth_838x_hw_reset(struct rteth_ctrl *ctrl) rteth_nic_reset(ctrl, 0xc); /* Free floating rings without space tracking */ - sw_w32(0, RTL838X_DMA_IF_RX_RING_SIZE); + regmap_write(ctrl->map, RTL838X_DMA_IF_RX_RING_SIZE, 0); } static void rteth_839x_hw_reset(struct rteth_ctrl *ctrl)