Skip to content

Conversation

@lsj123lsjlsj
Copy link

net: dsa: add support for reading port MAC addresses from EEPROM

Signed-off-by: SongJun Li <lisongjun@radxa.com>
Signed-off-by: SongJun Li <lisongjun@radxa.com>
Copy link
Member

@RadxaYuntian RadxaYuntian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我感觉怎么又在弄一个新实现,之前不是说有一个基于starfive的eeprom格式么?那个不是已经写过了一个配置mac的实现了

Signed-off-by: SongJun Li <lisongjun@radxa.com>
Copy link
Member

@RadxaYuntian RadxaYuntian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

所以这个local-mac-address/mac-at-eeprom是我们自己加的一个值咯?这个应该很难让第三方系统支持
phy的mac应该可以从uboot配置吧?

net/dsa/dsa2.c Outdated
}

/* 24c16 uses 1-byte address */
if (offset > 0xff) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

应该还有offset+len > 0xff

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

那这里多加一个if (offset + len - 1 > 0xff)么

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我的意思是最好是看看下面uboot那个实现,用上游支持比较好的接口

goto out_put_np;
}

if (len != ETH_ALEN) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果len的数值是固定的那为什么设备树里面还要写?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里是比如 dts 配置成 local-mac-address = [00 48 54 20 00 ]; 或者 local-mac-address = [00 48 54 20 00 02 03]; 那驱动会检测这个长度

@lsj123lsjlsj
Copy link
Author

所以这个local-mac-address/mac-at-eeprom是我们自己加的一个值咯?这个应该很难让第三方系统支持 phy的mac应该可以从uboot配置吧?

这个是针对交换机芯片的 PORT, u-boot 传递的 mac 地址没法传递给 SWITCH PORT

@RadxaYuntian
Copy link
Member

@RadxaStephen RadxaStephen marked this pull request as draft December 26, 2025 11:21
Signed-off-by: SongJun Li <lisongjun@radxa.com>
@lsj123lsjlsj
Copy link
Author

在 u-boot 那里根据 mac 环境变量修改内核 dtb 的做法有个缺陷,无法知道如 rtl8367rb 是挂在哪个 gmac 控制器下,我们的 mac addr 环境变量是 ethaddr\eth1addr\eth2addr->ethaddr,需要匹配到对应的 ethaddr 才行,但是流程上做不到

Signed-off-by: SongJun Li <lisongjun@radxa.com>
@RadxaYuntian
Copy link
Member

do_fixup_by_prop(void *fdt, const char *pname, ...
第二个参数就是用来指定的啊

@lsj123lsjlsj
Copy link
Author

do_fixup_by_prop(void *fdt, const char *pname, ... 第二个参数就是用来指定的啊

但是我们的环境变量是 ethaddr/eth1addr/eth2addr...,我们没法动态绑定到哪个 eth*addr 上,除非增加新环境变量名

@lsj123lsjlsj
Copy link
Author

do_fixup_by_prop(void *fdt, const char *pname, ... 第二个参数就是用来指定的啊

像参考的:https://github.com/u-boot/u-boot/blob/56cac250b0839ddbad1311d3ca4231f532b5aadf/board/Marvell/mvebu_armada-37xx/board.c#L574-L586 它有环境变量:downlink 和 uplink

@RadxaYuntian
Copy link
Member

所以加上不行么?实例代码是直接修改port的,也跟gmac phy无关呀:
https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/marvell/armada-3720-eDPU.dts#L43-L56

@RadxaYuntian
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants