1 // SPDX-License-Identifier: GPL-2.0+
3 * Texas Instruments K3 AM65 Ethernet Switch SubSystem Driver
5 * Copyright (C) 2019, Texas Instruments, Incorporated
11 #include <asm/processor.h>
15 #include <dma-uclass.h>
16 #include <dm/of_access.h>
20 #include <power-domain.h>
21 #include <linux/soc/ti/ti-udma.h>
23 #include "cpsw_mdio.h"
25 #define AM65_CPSW_CPSWNU_MAX_PORTS 2
27 #define AM65_CPSW_SS_BASE 0x0
28 #define AM65_CPSW_SGMII_BASE 0x100
29 #define AM65_CPSW_MDIO_BASE 0xf00
30 #define AM65_CPSW_XGMII_BASE 0x2100
31 #define AM65_CPSW_CPSW_NU_BASE 0x20000
32 #define AM65_CPSW_CPSW_NU_ALE_BASE 0x1e000
34 #define AM65_CPSW_CPSW_NU_PORTS_OFFSET 0x1000
35 #define AM65_CPSW_CPSW_NU_PORT_MACSL_OFFSET 0x330
37 #define AM65_CPSW_MDIO_BUS_FREQ_DEF 1000000
39 #define AM65_CPSW_CTL_REG 0x4
40 #define AM65_CPSW_STAT_PORT_EN_REG 0x14
41 #define AM65_CPSW_PTYPE_REG 0x18
43 #define AM65_CPSW_CTL_REG_P0_ENABLE BIT(2)
44 #define AM65_CPSW_CTL_REG_P0_TX_CRC_REMOVE BIT(13)
45 #define AM65_CPSW_CTL_REG_P0_RX_PAD BIT(14)
47 #define AM65_CPSW_P0_FLOW_ID_REG 0x8
48 #define AM65_CPSW_PN_RX_MAXLEN_REG 0x24
49 #define AM65_CPSW_PN_REG_SA_L 0x308
50 #define AM65_CPSW_PN_REG_SA_H 0x30c
52 #define AM65_CPSW_ALE_CTL_REG 0x8
53 #define AM65_CPSW_ALE_CTL_REG_ENABLE BIT(31)
54 #define AM65_CPSW_ALE_CTL_REG_RESET_TBL BIT(30)
55 #define AM65_CPSW_ALE_CTL_REG_BYPASS BIT(4)
56 #define AM65_CPSW_ALE_PN_CTL_REG(x) (0x40 + (x) * 4)
57 #define AM65_CPSW_ALE_PN_CTL_REG_MODE_FORWARD 0x3
58 #define AM65_CPSW_ALE_PN_CTL_REG_MAC_ONLY BIT(11)
60 #define AM65_CPSW_MACSL_CTL_REG 0x0
61 #define AM65_CPSW_MACSL_CTL_REG_IFCTL_A BIT(15)
62 #define AM65_CPSW_MACSL_CTL_REG_GIG BIT(7)
63 #define AM65_CPSW_MACSL_CTL_REG_GMII_EN BIT(5)
64 #define AM65_CPSW_MACSL_CTL_REG_LOOPBACK BIT(1)
65 #define AM65_CPSW_MACSL_CTL_REG_FULL_DUPLEX BIT(0)
66 #define AM65_CPSW_MACSL_RESET_REG 0x8
67 #define AM65_CPSW_MACSL_RESET_REG_RESET BIT(0)
68 #define AM65_CPSW_MACSL_STATUS_REG 0x4
69 #define AM65_CPSW_MACSL_RESET_REG_PN_IDLE BIT(31)
70 #define AM65_CPSW_MACSL_RESET_REG_PN_E_IDLE BIT(30)
71 #define AM65_CPSW_MACSL_RESET_REG_PN_P_IDLE BIT(29)
72 #define AM65_CPSW_MACSL_RESET_REG_PN_TX_IDLE BIT(28)
73 #define AM65_CPSW_MACSL_RESET_REG_IDLE_MASK \
74 (AM65_CPSW_MACSL_RESET_REG_PN_IDLE | \
75 AM65_CPSW_MACSL_RESET_REG_PN_E_IDLE | \
76 AM65_CPSW_MACSL_RESET_REG_PN_P_IDLE | \
77 AM65_CPSW_MACSL_RESET_REG_PN_TX_IDLE)
79 #define AM65_CPSW_CPPI_PKT_TYPE 0x7
81 struct am65_cpsw_port {
83 fdt_addr_t macsl_base;
88 struct am65_cpsw_common {
98 struct power_domain pwrdmn;
101 struct am65_cpsw_port ports[AM65_CPSW_CPSWNU_MAX_PORTS];
113 struct am65_cpsw_priv {
115 struct am65_cpsw_common *cpsw_common;
118 struct phy_device *phydev;
125 #define UDMA_RX_BUF_SIZE PKTSIZE_ALIGN
127 #define UDMA_RX_BUF_SIZE ALIGN(1522, ARCH_DMA_MINALIGN)
131 #define UDMA_RX_DESC_NUM PKTBUFSRX
133 #define UDMA_RX_DESC_NUM 4
136 #define mac_hi(mac) (((mac)[0] << 0) | ((mac)[1] << 8) | \
137 ((mac)[2] << 16) | ((mac)[3] << 24))
138 #define mac_lo(mac) (((mac)[4] << 0) | ((mac)[5] << 8))
140 static void am65_cpsw_set_sl_mac(struct am65_cpsw_port *slave,
144 slave->port_base + AM65_CPSW_PN_REG_SA_H);
146 slave->port_base + AM65_CPSW_PN_REG_SA_L);
149 int am65_cpsw_macsl_reset(struct am65_cpsw_port *slave)
153 /* Set the soft reset bit */
154 writel(AM65_CPSW_MACSL_RESET_REG_RESET,
155 slave->macsl_base + AM65_CPSW_MACSL_RESET_REG);
157 while ((readl(slave->macsl_base + AM65_CPSW_MACSL_RESET_REG) &
158 AM65_CPSW_MACSL_RESET_REG_RESET) && i--)
161 /* Timeout on the reset */
165 static int am65_cpsw_macsl_wait_for_idle(struct am65_cpsw_port *slave)
169 while ((readl(slave->macsl_base + AM65_CPSW_MACSL_STATUS_REG) &
170 AM65_CPSW_MACSL_RESET_REG_IDLE_MASK) && i--)
176 static int am65_cpsw_update_link(struct am65_cpsw_priv *priv)
178 struct am65_cpsw_common *common = priv->cpsw_common;
179 struct am65_cpsw_port *port = &common->ports[priv->port_id];
180 struct phy_device *phy = priv->phydev;
183 if (phy->link) { /* link up */
184 mac_control = /*AM65_CPSW_MACSL_CTL_REG_LOOPBACK |*/
185 AM65_CPSW_MACSL_CTL_REG_GMII_EN;
186 if (phy->speed == 1000)
187 mac_control |= AM65_CPSW_MACSL_CTL_REG_GIG;
188 if (phy->duplex == DUPLEX_FULL)
189 mac_control |= AM65_CPSW_MACSL_CTL_REG_FULL_DUPLEX;
190 if (phy->speed == 100)
191 mac_control |= AM65_CPSW_MACSL_CTL_REG_IFCTL_A;
194 if (mac_control == port->mac_control)
198 printf("link up on port %d, speed %d, %s duplex\n",
199 priv->port_id, phy->speed,
200 (phy->duplex == DUPLEX_FULL) ? "full" : "half");
202 printf("link down on port %d\n", priv->port_id);
205 writel(mac_control, port->macsl_base + AM65_CPSW_MACSL_CTL_REG);
206 port->mac_control = mac_control;
212 #define AM65_GMII_SEL_MODE_MII 0
213 #define AM65_GMII_SEL_MODE_RMII 1
214 #define AM65_GMII_SEL_MODE_RGMII 2
216 #define AM65_GMII_SEL_RGMII_IDMODE BIT(4)
218 static void am65_cpsw_gmii_sel_k3(struct am65_cpsw_priv *priv,
219 phy_interface_t phy_mode, int slave)
221 struct am65_cpsw_common *common = priv->cpsw_common;
224 bool rgmii_id = false;
226 reg = readl(common->gmii_sel);
228 dev_dbg(common->dev, "old gmii_sel: %08x\n", reg);
231 case PHY_INTERFACE_MODE_RMII:
232 mode = AM65_GMII_SEL_MODE_RMII;
235 case PHY_INTERFACE_MODE_RGMII:
236 case PHY_INTERFACE_MODE_RGMII_RXID:
237 mode = AM65_GMII_SEL_MODE_RGMII;
240 case PHY_INTERFACE_MODE_RGMII_ID:
241 case PHY_INTERFACE_MODE_RGMII_TXID:
242 mode = AM65_GMII_SEL_MODE_RGMII;
247 dev_warn(common->dev,
248 "Unsupported PHY mode: %u. Defaulting to MII.\n",
251 case PHY_INTERFACE_MODE_MII:
252 mode = AM65_GMII_SEL_MODE_MII;
257 mode |= AM65_GMII_SEL_RGMII_IDMODE;
260 dev_dbg(common->dev, "gmii_sel PHY mode: %u, new gmii_sel: %08x\n",
262 writel(reg, common->gmii_sel);
264 reg = readl(common->gmii_sel);
267 "gmii_sel PHY mode NOT SET!: requested: %08x, gmii_sel: %08x\n",
271 static int am65_cpsw_start(struct udevice *dev)
273 struct eth_pdata *pdata = dev_get_platdata(dev);
274 struct am65_cpsw_priv *priv = dev_get_priv(dev);
275 struct am65_cpsw_common *common = priv->cpsw_common;
276 struct am65_cpsw_port *port = &common->ports[priv->port_id];
277 struct am65_cpsw_port *port0 = &common->ports[0];
278 struct ti_udma_drv_chan_cfg_data *dma_rx_cfg_data;
281 ret = power_domain_on(&common->pwrdmn);
283 dev_err(dev, "power_domain_on() failed %d\n", ret);
287 ret = clk_enable(&common->fclk);
289 dev_err(dev, "clk enabled failed %d\n", ret);
295 ret = dma_get_by_name(common->dev, "tx0", &common->dma_tx);
297 dev_err(dev, "TX dma get failed %d\n", ret);
300 ret = dma_get_by_name(common->dev, "rx", &common->dma_rx);
302 dev_err(dev, "RX dma get failed %d\n", ret);
306 for (i = 0; i < UDMA_RX_DESC_NUM; i++) {
307 ret = dma_prepare_rcv_buf(&common->dma_rx,
311 dev_err(dev, "RX dma add buf failed %d\n", ret);
316 ret = dma_enable(&common->dma_tx);
318 dev_err(dev, "TX dma_enable failed %d\n", ret);
321 ret = dma_enable(&common->dma_rx);
323 dev_err(dev, "RX dma_enable failed %d\n", ret);
327 /* Control register */
328 writel(AM65_CPSW_CTL_REG_P0_ENABLE |
329 AM65_CPSW_CTL_REG_P0_TX_CRC_REMOVE |
330 AM65_CPSW_CTL_REG_P0_RX_PAD,
331 common->cpsw_base + AM65_CPSW_CTL_REG);
333 /* disable priority elevation */
334 writel(0, common->cpsw_base + AM65_CPSW_PTYPE_REG);
336 /* enable statistics */
337 writel(BIT(0) | BIT(priv->port_id),
338 common->cpsw_base + AM65_CPSW_STAT_PORT_EN_REG);
340 /* Port 0 length register */
341 writel(PKTSIZE_ALIGN, port0->port_base + AM65_CPSW_PN_RX_MAXLEN_REG);
343 /* set base flow_id */
344 dma_get_cfg(&common->dma_rx, 0, (void **)&dma_rx_cfg_data);
345 writel(dma_rx_cfg_data->flow_id_base,
346 port0->port_base + AM65_CPSW_P0_FLOW_ID_REG);
347 dev_info(dev, "K3 CPSW: rflow_id_base: %u\n",
348 dma_rx_cfg_data->flow_id_base);
350 /* Reset and enable the ALE */
351 writel(AM65_CPSW_ALE_CTL_REG_ENABLE | AM65_CPSW_ALE_CTL_REG_RESET_TBL |
352 AM65_CPSW_ALE_CTL_REG_BYPASS,
353 common->ale_base + AM65_CPSW_ALE_CTL_REG);
355 /* port 0 put into forward mode */
356 writel(AM65_CPSW_ALE_PN_CTL_REG_MODE_FORWARD,
357 common->ale_base + AM65_CPSW_ALE_PN_CTL_REG(0));
359 /* PORT x configuration */
361 /* Port x Max length register */
362 writel(PKTSIZE_ALIGN, port->port_base + AM65_CPSW_PN_RX_MAXLEN_REG);
365 am65_cpsw_set_sl_mac(port, pdata->enetaddr);
367 /* Port x ALE: mac_only, Forwarding */
368 writel(AM65_CPSW_ALE_PN_CTL_REG_MAC_ONLY |
369 AM65_CPSW_ALE_PN_CTL_REG_MODE_FORWARD,
370 common->ale_base + AM65_CPSW_ALE_PN_CTL_REG(priv->port_id));
372 port->mac_control = 0;
373 if (!am65_cpsw_macsl_reset(port)) {
374 dev_err(dev, "mac_sl reset failed\n");
379 ret = phy_startup(priv->phydev);
381 dev_err(dev, "phy_startup failed\n");
385 ret = am65_cpsw_update_link(priv);
388 goto err_phy_shutdown;
391 common->started = true;
396 phy_shutdown(priv->phydev);
399 writel(0, common->ale_base + AM65_CPSW_ALE_PN_CTL_REG(priv->port_id));
400 writel(0, common->ale_base + AM65_CPSW_ALE_PN_CTL_REG(0));
401 if (!am65_cpsw_macsl_wait_for_idle(port))
402 dev_err(dev, "mac_sl idle timeout\n");
403 writel(0, port->macsl_base + AM65_CPSW_MACSL_CTL_REG);
404 writel(0, common->ale_base + AM65_CPSW_ALE_CTL_REG);
405 writel(0, common->cpsw_base + AM65_CPSW_CTL_REG);
407 dma_disable(&common->dma_rx);
409 dma_disable(&common->dma_tx);
411 dma_free(&common->dma_rx);
413 dma_free(&common->dma_tx);
415 clk_disable(&common->fclk);
417 power_domain_off(&common->pwrdmn);
419 dev_err(dev, "%s end error\n", __func__);
424 static int am65_cpsw_send(struct udevice *dev, void *packet, int length)
426 struct am65_cpsw_priv *priv = dev_get_priv(dev);
427 struct am65_cpsw_common *common = priv->cpsw_common;
428 struct ti_udma_drv_packet_data packet_data;
431 packet_data.pkt_type = AM65_CPSW_CPPI_PKT_TYPE;
432 packet_data.dest_tag = priv->port_id;
433 ret = dma_send(&common->dma_tx, packet, length, &packet_data);
435 dev_err(dev, "TX dma_send failed %d\n", ret);
442 static int am65_cpsw_recv(struct udevice *dev, int flags, uchar **packetp)
444 struct am65_cpsw_priv *priv = dev_get_priv(dev);
445 struct am65_cpsw_common *common = priv->cpsw_common;
447 /* try to receive a new packet */
448 return dma_receive(&common->dma_rx, (void **)packetp, NULL);
451 static int am65_cpsw_free_pkt(struct udevice *dev, uchar *packet, int length)
453 struct am65_cpsw_priv *priv = dev_get_priv(dev);
454 struct am65_cpsw_common *common = priv->cpsw_common;
458 u32 pkt = common->rx_next % UDMA_RX_DESC_NUM;
460 ret = dma_prepare_rcv_buf(&common->dma_rx,
464 dev_err(dev, "RX dma free_pkt failed %d\n", ret);
471 static void am65_cpsw_stop(struct udevice *dev)
473 struct am65_cpsw_priv *priv = dev_get_priv(dev);
474 struct am65_cpsw_common *common = priv->cpsw_common;
475 struct am65_cpsw_port *port = &common->ports[priv->port_id];
477 if (!common->started)
480 phy_shutdown(priv->phydev);
482 writel(0, common->ale_base + AM65_CPSW_ALE_PN_CTL_REG(priv->port_id));
483 writel(0, common->ale_base + AM65_CPSW_ALE_PN_CTL_REG(0));
484 if (!am65_cpsw_macsl_wait_for_idle(port))
485 dev_err(dev, "mac_sl idle timeout\n");
486 writel(0, port->macsl_base + AM65_CPSW_MACSL_CTL_REG);
487 writel(0, common->ale_base + AM65_CPSW_ALE_CTL_REG);
488 writel(0, common->cpsw_base + AM65_CPSW_CTL_REG);
490 dma_disable(&common->dma_tx);
491 dma_free(&common->dma_tx);
493 dma_disable(&common->dma_rx);
494 dma_free(&common->dma_rx);
496 common->started = false;
499 static int am65_cpsw_read_rom_hwaddr(struct udevice *dev)
501 struct am65_cpsw_priv *priv = dev_get_priv(dev);
502 struct am65_cpsw_common *common = priv->cpsw_common;
503 struct eth_pdata *pdata = dev_get_platdata(dev);
506 if (common->mac_efuse == FDT_ADDR_T_NONE)
509 mac_lo = readl(common->mac_efuse);
510 mac_hi = readl(common->mac_efuse + 4);
511 pdata->enetaddr[0] = (mac_hi >> 8) & 0xff;
512 pdata->enetaddr[1] = mac_hi & 0xff;
513 pdata->enetaddr[2] = (mac_lo >> 24) & 0xff;
514 pdata->enetaddr[3] = (mac_lo >> 16) & 0xff;
515 pdata->enetaddr[4] = (mac_lo >> 8) & 0xff;
516 pdata->enetaddr[5] = mac_lo & 0xff;
521 static const struct eth_ops am65_cpsw_ops = {
522 .start = am65_cpsw_start,
523 .send = am65_cpsw_send,
524 .recv = am65_cpsw_recv,
525 .free_pkt = am65_cpsw_free_pkt,
526 .stop = am65_cpsw_stop,
527 .read_rom_hwaddr = am65_cpsw_read_rom_hwaddr,
530 static int am65_cpsw_mdio_init(struct udevice *dev)
532 struct am65_cpsw_priv *priv = dev_get_priv(dev);
533 struct am65_cpsw_common *cpsw_common = priv->cpsw_common;
535 if (!priv->has_phy || cpsw_common->bus)
538 cpsw_common->bus = cpsw_mdio_init(dev->name,
539 cpsw_common->mdio_base,
540 cpsw_common->bus_freq,
541 clk_get_rate(&cpsw_common->fclk));
542 if (!cpsw_common->bus)
548 static int am65_cpsw_phy_init(struct udevice *dev)
550 struct am65_cpsw_priv *priv = dev_get_priv(dev);
551 struct am65_cpsw_common *cpsw_common = priv->cpsw_common;
552 struct eth_pdata *pdata = dev_get_platdata(dev);
553 struct phy_device *phydev;
554 u32 supported = PHY_GBIT_FEATURES;
557 phydev = phy_connect(cpsw_common->bus,
560 pdata->phy_interface);
563 dev_err(dev, "phy_connect() failed\n");
567 phydev->supported &= supported;
568 if (pdata->max_speed) {
569 ret = phy_set_supported(phydev, pdata->max_speed);
573 phydev->advertising = phydev->supported;
575 if (ofnode_valid(priv->phy_node))
576 phydev->node = priv->phy_node;
578 priv->phydev = phydev;
579 ret = phy_config(phydev);
581 pr_err("phy_config() failed: %d", ret);
586 static int am65_cpsw_ofdata_parse_phy(struct udevice *dev, ofnode port_np)
588 struct eth_pdata *pdata = dev_get_platdata(dev);
589 struct am65_cpsw_priv *priv = dev_get_priv(dev);
590 struct ofnode_phandle_args out_args;
591 const char *phy_mode;
594 phy_mode = ofnode_read_string(port_np, "phy-mode");
596 pdata->phy_interface =
597 phy_get_interface_by_name(phy_mode);
598 if (pdata->phy_interface == -1) {
599 dev_err(dev, "Invalid PHY mode '%s', port %u\n",
600 phy_mode, priv->port_id);
606 ofnode_read_u32(port_np, "max-speed", (u32 *)&pdata->max_speed);
607 if (pdata->max_speed)
608 dev_err(dev, "Port %u speed froced to %uMbit\n",
609 priv->port_id, pdata->max_speed);
611 priv->has_phy = true;
612 ret = ofnode_parse_phandle_with_args(port_np, "phy-handle",
613 NULL, 0, 0, &out_args);
615 dev_err(dev, "can't parse phy-handle port %u (%d)\n",
617 priv->has_phy = false;
621 priv->phy_node = out_args.node;
623 ret = ofnode_read_u32(priv->phy_node, "reg", &priv->phy_addr);
625 dev_err(dev, "failed to get phy_addr port %u (%d)\n",
635 static int am65_cpsw_probe_cpsw(struct udevice *dev)
637 struct am65_cpsw_priv *priv = dev_get_priv(dev);
638 struct eth_pdata *pdata = dev_get_platdata(dev);
639 struct am65_cpsw_common *cpsw_common;
640 ofnode ports_np, node;
645 cpsw_common = calloc(1, sizeof(*priv->cpsw_common));
648 priv->cpsw_common = cpsw_common;
650 cpsw_common->dev = dev;
651 cpsw_common->ss_base = dev_read_addr(dev);
652 if (cpsw_common->ss_base == FDT_ADDR_T_NONE)
654 cpsw_common->mac_efuse = devfdt_get_addr_name(dev, "mac_efuse");
655 /* no err check - optional */
657 ret = power_domain_get_by_index(dev, &cpsw_common->pwrdmn, 0);
659 dev_err(dev, "failed to get pwrdmn: %d\n", ret);
663 ret = clk_get_by_name(dev, "fck", &cpsw_common->fclk);
665 power_domain_free(&cpsw_common->pwrdmn);
666 dev_err(dev, "failed to get clock %d\n", ret);
670 cpsw_common->cpsw_base = cpsw_common->ss_base + AM65_CPSW_CPSW_NU_BASE;
671 cpsw_common->ale_base = cpsw_common->cpsw_base +
672 AM65_CPSW_CPSW_NU_ALE_BASE;
673 cpsw_common->mdio_base = cpsw_common->ss_base + AM65_CPSW_MDIO_BASE;
675 ports_np = dev_read_subnode(dev, "ports");
676 if (!ofnode_valid(ports_np)) {
681 ofnode_for_each_subnode(node, ports_np) {
682 const char *node_name;
686 node_name = ofnode_get_name(node);
688 disabled = !ofnode_is_available(node);
690 ret = ofnode_read_u32(node, "reg", &port_id);
692 dev_err(dev, "%s: failed to get port_id (%d)\n",
697 if (port_id >= AM65_CPSW_CPSWNU_MAX_PORTS) {
698 dev_err(dev, "%s: invalid port_id (%d)\n",
703 cpsw_common->port_num++;
708 priv->port_id = port_id;
709 cpsw_common->ports[port_id].disabled = disabled;
713 ret = am65_cpsw_ofdata_parse_phy(dev, node);
718 for (i = 0; i < AM65_CPSW_CPSWNU_MAX_PORTS; i++) {
719 struct am65_cpsw_port *port = &cpsw_common->ports[i];
721 port->port_base = cpsw_common->cpsw_base +
722 AM65_CPSW_CPSW_NU_PORTS_OFFSET +
723 (i * AM65_CPSW_CPSW_NU_PORTS_OFFSET);
724 port->macsl_base = port->port_base +
725 AM65_CPSW_CPSW_NU_PORT_MACSL_OFFSET;
728 node = dev_read_subnode(dev, "cpsw-phy-sel");
729 if (!ofnode_valid(node)) {
730 dev_err(dev, "can't find cpsw-phy-sel\n");
735 cpsw_common->gmii_sel = ofnode_get_addr(node);
736 if (cpsw_common->gmii_sel == FDT_ADDR_T_NONE) {
737 dev_err(dev, "failed to get gmii_sel base\n");
741 node = dev_read_subnode(dev, "mdio");
742 if (!ofnode_valid(node)) {
743 dev_err(dev, "can't find mdio\n");
748 cpsw_common->bus_freq =
749 dev_read_u32_default(dev, "bus_freq",
750 AM65_CPSW_MDIO_BUS_FREQ_DEF);
752 am65_cpsw_gmii_sel_k3(priv, pdata->phy_interface, priv->port_id);
754 ret = am65_cpsw_mdio_init(dev);
758 ret = am65_cpsw_phy_init(dev);
762 dev_info(dev, "K3 CPSW: nuss_ver: 0x%08X cpsw_ver: 0x%08X ale_ver: 0x%08X Ports:%u mdio_freq:%u\n",
763 readl(cpsw_common->ss_base),
764 readl(cpsw_common->cpsw_base),
765 readl(cpsw_common->ale_base),
766 cpsw_common->port_num,
767 cpsw_common->bus_freq);
770 clk_free(&cpsw_common->fclk);
771 power_domain_free(&cpsw_common->pwrdmn);
775 static const struct udevice_id am65_cpsw_nuss_ids[] = {
776 { .compatible = "ti,am654-cpsw-nuss" },
777 { .compatible = "ti,j721e-cpsw-nuss" },
781 U_BOOT_DRIVER(am65_cpsw_nuss_slave) = {
782 .name = "am65_cpsw_nuss_slave",
784 .of_match = am65_cpsw_nuss_ids,
785 .probe = am65_cpsw_probe_cpsw,
786 .ops = &am65_cpsw_ops,
787 .priv_auto_alloc_size = sizeof(struct am65_cpsw_priv),
788 .platdata_auto_alloc_size = sizeof(struct eth_pdata),
789 .flags = DM_FLAG_ALLOC_PRIV_DMA,