Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set mac address from eeprom #110

Open
wants to merge 5 commits into
base: next-dev-v2024.10
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions arch/arm/dts/rk3528-rock-2a.dts
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,26 @@
vref-supply = <&vdd_1v8_s3>;
status = "okay";
};

&i2c1 {
status = "okay";
u-boot,dm-pre-reloc;
pinctrl-names = "default";
pinctrl-0 = <&i2c1m0_xfer>;
compatible = "rockchip,rk3528-i2c", "rockchip,rk3399-i2c", "i2c-eeprom";
};

&pinctrl {
i2c1 {
u-boot,dm-spl;
};
};

&i2c1m0_xfer {
u-boot,dm-spl;
rockchip,pins =
/* i2c1_scl_m0 */
<4 RK_PA3 2 &pcfg_pull_up>,
/* i2c1_sda_m0 */
<4 RK_PA2 2 &pcfg_pull_up>;
};
7 changes: 7 additions & 0 deletions arch/arm/mach-rockchip/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,18 @@
#include <misc.h>
#include <u-boot/crc.h>
#include <u-boot/sha256.h>
#include <radxa-i2c-eeprom.h>

#include <asm/arch-rockchip/misc.h>

int rockchip_setup_macaddr(void)
{

#ifdef CONFIG_RADXA_ID_EEPROM
if(!radxa_mac_read_from_eeprom())
return 0;
#endif

#if CONFIG_IS_ENABLED(HASH) && CONFIG_IS_ENABLED(SHA256)
int ret;
const char *cpuid = env_get("cpuid#");
Expand Down
1 change: 1 addition & 0 deletions configs/rock-2-rk3528_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ CONFIG_MISC=y
CONFIG_SPL_MISC=y
CONFIG_ROCKCHIP_OTP=y
CONFIG_SPL_ROCKCHIP_SECURE_OTP=y
CONFIG_RADXA_ID_EEPROM=y
CONFIG_MMC_DW=y
CONFIG_MMC_DW_ROCKCHIP=y
CONFIG_MMC_SDHCI=y
Expand Down
9 changes: 8 additions & 1 deletion drivers/misc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ config ATSHA204A
board.

config ROCKCHIP_EFUSE
bool "Rockchip e-fuse support"
bool "Rockchip e-fuse support"

Choose a reason for hiding this comment

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

这里的缩进好像和其他行不一致?

depends on MISC
help
Enable (read-only) access for the e-fuse block found in Rockchip
Expand Down Expand Up @@ -266,6 +266,13 @@ config I2C_EEPROM
help
Enable a generic driver for EEPROMs attached via I2C.

config RADXA_ID_EEPROM
bool "Enable Radxa ID EEPROM driver"
depends on MISC
help
Enable support for Radxa ID EEPROM.
This EEPROM is used to store persistent platform data, such as MAC address.

if I2C_EEPROM

config SYS_I2C_EEPROM_ADDR
Expand Down
1 change: 1 addition & 0 deletions drivers/misc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ obj-$(CONFIG_WINBOND_W83627) += winbond_w83627.o
obj-$(CONFIG_QFW) += qfw.o
obj-$(CONFIG_ROCKCHIP_EFUSE) += rockchip-efuse.o
obj-$(CONFIG_ROCKCHIP_OTP) += rockchip-otp.o
obj-$(CONFIG_RADXA_ID_EEPROM) += radxa-i2c-eeprom.o

ifeq ($(CONFIG_$(SPL_TPL_)ROCKCHIP_SECURE_OTP),y)
obj-$(CONFIG_ROCKCHIP_RK3308) += rk3308-secure-otp.o
Expand Down
Loading