Open Ykidia opened 2 years ago
P.S.
[ 0.821523] oxnas-dwmac 40400000.ethernet: Got valid mac_adr from cmdline
goes from my patch to get MAC address from kernel command line as in original NAS (see log). Here are the patch contents:
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c
@@ -54,6 +54,25 @@
struct regmap *regmap;
};
+/* Ethernet MAC adr to assign to interface */
+static u8 mac_adr[ETH_ALEN] = {0};
+
+static int __init set_mac_adr(char *addr)
+{
+ const int eth_sz = ETH_ALEN + 1;
+ int eth_octets[eth_sz], i = 1;
+ if (get_options(addr, eth_sz, eth_octets)) {
+ while (i <= eth_octets[0]) {
+ mac_adr[i - 1] = eth_octets[i];
+ if (++i >= eth_sz)
+ break;
+ }
+ return 1;
+ }
+ return 0;
+}
+__setup("mac_adr=", set_mac_adr);
+
static int oxnas_dwmac_init(struct platform_device *pdev, void *priv)
{
struct oxnas_dwmac *dwmac = priv;
@@ -112,7 +141,7 @@
struct plat_stmmacenet_data *plat_dat;
struct stmmac_resources stmmac_res;
struct oxnas_dwmac *dwmac;
- int ret;
+ int i, ret;
ret = stmmac_get_platform_resources(pdev, &stmmac_res);
if (ret)
@@ -155,6 +185,13 @@
ret = oxnas_dwmac_init(pdev, plat_dat->bsp_priv);
if (ret)
goto err_remove_config_dt;
+
+ if (is_valid_ether_addr(mac_adr)) {
+ dev_info(&pdev->dev, "Got valid mac_adr from cmdline\n");
+ for (i = 0; i < ETH_ALEN; i++) {
+ stmmac_res.mac[i] = (unsigned char)mac_adr[i];
+ }
+ }
ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
if (ret)
Hello! Again I need your help. Now I can not get ethernet working on my WD MBWE II with kernel 5.15. I performed all, I think, your recommendations (some of them described here) about how to enable the networking adapter incorporated in OX810(D)SE, previously was as Synopsys GMAC and now it is STMMAC, Oxford variation.
This is my ox810se.dtsi:
and ox810se-wd-mbwe.dts:
Then I selected in kernel configurator:
And also I had to turn on MDIO, because without this there was additional error in kernel log:
After turning on MDIO there is a resulting kernel log:
And that's it. No matter ethernet cable is plugged in or not. Also earlier I tried all manipulations with 5.10 - result is almost the same.
What am I doing wrong? Thanks!