1 // SPDX-License-Identifier: GPL-2.0+
5 * Actions DWMAC specific glue layer
9 #include <asm/global_data.h>
17 #include "designware.h"
18 #include <asm/arch-owl/regs_s700.h>
19 #include <linux/bitops.h>
21 /* pin control for MAC */
22 #define RMII_TXD01_MFP_CTL0 (0x0 << 16)
23 #define RMII_RXD01_MFP_CTL0 (0x0 << 8)
24 #define RMII_TXEN_TXER_MFP_CTL0 (0x0 << 13)
25 #define RMII_REF_CLK_MFP_CTL0 (0x0 << 6)
26 #define CLKO_25M_EN_MFP_CTL3 BIT(30)
28 DECLARE_GLOBAL_DATA_PTR;
30 static void dwmac_board_setup(void)
32 clrbits_le32(MFP_CTL0, (RMII_TXD01_MFP_CTL0 | RMII_RXD01_MFP_CTL0 |
33 RMII_TXEN_TXER_MFP_CTL0 | RMII_REF_CLK_MFP_CTL0));
35 setbits_le32(MFP_CTL3, CLKO_25M_EN_MFP_CTL3);
38 static int dwmac_s700_probe(struct udevice *dev)
42 /* This is undocumented, phy interface select register */
43 writel(0x4, 0xe024c0a0);
45 return designware_eth_probe(dev);
48 static int dwmac_s700_of_to_plat(struct udevice *dev)
50 return designware_eth_of_to_plat(dev);
53 static const struct udevice_id dwmac_s700_ids[] = {
54 {.compatible = "actions,s700-ethernet"},
58 U_BOOT_DRIVER(dwmac_s700) = {
61 .of_match = dwmac_s700_ids,
62 .of_to_plat = dwmac_s700_of_to_plat,
63 .probe = dwmac_s700_probe,
64 .ops = &designware_eth_ops,
65 .priv_auto = sizeof(struct dw_eth_dev),
66 .plat_auto = sizeof(struct eth_pdata),
67 .flags = DM_FLAG_ALLOC_PRIV_DMA,