Skip to content

Instantly share code, notes, and snippets.

@znuh
Created November 19, 2019 18:48
Show Gist options
  • Save znuh/bfea1690291795c421f64a6b4b1904c0 to your computer and use it in GitHub Desktop.
Save znuh/bfea1690291795c421f64a6b4b1904c0 to your computer and use it in GitHub Desktop.
devicetree excerpt for reading a MAC address from an EEPROM
i2c2: i2c@f8024000 {
status = "okay";
id: eeprom@50 {
compatible = "microchip,24c02"; /* actually it's a 24AA025E48 */
pagesize = <16>;
read-only;
reg = <0x50>;
#address-cells = <1>;
#size-cells = <1>;
eth0_macaddress: eth0_macaddress@FA {
reg = <0xFA 0x06>;
};
};
};
macb0: ethernet@f8020000 {
phy-mode = "rmii";
status = "okay";
nvmem-cells = <&eth0_macaddress>; /* custom nvmem reference */
nvmem-cell-names = "mac-address"; /* see ethernet-controller.yaml */
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_macb0_rmii &pinctrl_macb0_phy_irq>;
phy0: ethernet-phy@0 {
interrupt-parent = <&pioB>;
interrupts = <31 IRQ_TYPE_LEVEL_LOW>;
reg = <0>;
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment