mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-23 07:31:32 +00:00
ARM: dts: stm32: Use DT alias for the configuration EEPROM
Use DT /aliases node to establish a stable phandle to the configuration EEPROM. This permits the configuration EEPROM to be moved e.g. to a different address or a different bus. Adjust the board code to handle new phandle lookup. Reviewed-by: Patrice Chotard <patrice.chotard@st.com> Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com> Signed-off-by: Marek Vasut <marex@denx.de> Cc: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Cc: Patrick Delaunay <patrick.delaunay@st.com> Cc: Patrice Chotard <patrice.chotard@st.com>
This commit is contained in:
parent
2f0b5d930d
commit
f19312e5f4
2 changed files with 12 additions and 9 deletions
|
@ -10,6 +10,10 @@
|
||||||
#include <dt-bindings/mfd/st,stpmic1.h>
|
#include <dt-bindings/mfd/st,stpmic1.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
|
aliases {
|
||||||
|
eeprom0 = &eeprom0;
|
||||||
|
};
|
||||||
|
|
||||||
memory@c0000000 {
|
memory@c0000000 {
|
||||||
device_type = "memory";
|
device_type = "memory";
|
||||||
reg = <0xC0000000 0x40000000>;
|
reg = <0xC0000000 0x40000000>;
|
||||||
|
@ -187,7 +191,7 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
eeprom@50 {
|
eeprom0: eeprom@50 {
|
||||||
compatible = "atmel,24c02";
|
compatible = "atmel,24c02";
|
||||||
reg = <0x50>;
|
reg = <0x50>;
|
||||||
pagesize = <16>;
|
pagesize = <16>;
|
||||||
|
|
|
@ -78,22 +78,21 @@ DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
||||||
int setup_mac_address(void)
|
int setup_mac_address(void)
|
||||||
{
|
{
|
||||||
struct udevice *dev;
|
|
||||||
ofnode eeprom;
|
|
||||||
unsigned char enetaddr[6];
|
unsigned char enetaddr[6];
|
||||||
int ret;
|
struct udevice *dev;
|
||||||
|
int off, ret;
|
||||||
|
|
||||||
ret = eth_env_get_enetaddr("ethaddr", enetaddr);
|
ret = eth_env_get_enetaddr("ethaddr", enetaddr);
|
||||||
if (ret) /* ethaddr is already set */
|
if (ret) /* ethaddr is already set */
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
eeprom = ofnode_path("/soc/i2c@5c002000/eeprom@50");
|
off = fdt_path_offset(gd->fdt_blob, "eeprom0");
|
||||||
if (!ofnode_valid(eeprom)) {
|
if (off < 0) {
|
||||||
printf("Invalid hardware path to EEPROM!\n");
|
printf("%s: No eeprom0 path offset\n", __func__);
|
||||||
return -ENODEV;
|
return off;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = uclass_get_device_by_ofnode(UCLASS_I2C_EEPROM, eeprom, &dev);
|
ret = uclass_get_device_by_of_offset(UCLASS_I2C_EEPROM, off, &dev);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
printf("Cannot find EEPROM!\n");
|
printf("Cannot find EEPROM!\n");
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Add table
Reference in a new issue