dts: Exposing local-mac-address to dm9000 from external eeprom

Mathieu Malaterre mathieu.malaterre at gmail.com
Tue Dec 5 06:32:49 EST 2017


Hi there,

I am trying to setup local-mac-address reading for the dm9000 ethernet
on a MIPS Creator CI20. The efuse block contains the actual mac
address, so I exposed it using nvmem framework:

efuse: efuse at 134100d0 {
  compatible = "ingenic,jz4780-efuse";
  reg = <0x134100d0 0xff>;
  clocks = <&cgu JZ4780_CLK_AHB2>;
  clock-names = "bus_clk";
  #address-cells = <1>;
  #size-cells = <1>;
  eth_mac: eth_mac at 12 {
    /* six byte/48bit MAC address stored as 8-bit integers */
    reg = <0x12 0x6>;
  };
};

while dm9000 is defined by (boring stuff trimmed):

dm9000 at 6 {
  compatible = "davicom,dm9000";
  davicom,no-eeprom;
  /* local-mac-address = [00 00 00 00 00 00]; */
};

dm9000 driver handles platform data (dm9000_parse_dt ->
of_get_mac_address) just fine.

On this SOC there is no eeprom attached to dm9000, so I could
potentially hack my way using C code and pretend there is an attached
eeprom, using the dm9000 pdata API:

$ cat include/linux/dm9000.h
[...]
struct dm9000_plat_data {
/* allow replacement IO routines */
void (*inblk)(void __iomem *reg, void *data, int len);
void (*outblk)(void __iomem *reg, void *data, int len);
void (*dumpblk)(void __iomem *reg, int len);
};

but it feels like there should be a simpler way using DTS declaration
only, right ?

Maybe I am missing the whole point and local-mac-address should only
be setup by U-Boot in this case.

Thanks for comments,
--
Mathieu



More information about the Kernelnewbies mailing list