On Mon, May 15, 2017 at 02:18:06PM +0200, Olliver Schinagl wrote: > Hey Maxime, > > On 15-05-17 10:18, Maxime Ripard wrote: > > On Mon, May 15, 2017 at 10:02:28AM +0200, Olliver Schinagl wrote: > > > This patch allows Kconfig to enable and set parameters to make it > > > possible to read the MAC address from an EEPROM. The net core layer then > > > uses this information to read MAC addresses from this EEPROM. > > > > > > Besides the various tuneables as to how to access the eeprom (bus, > > > address, addressing mode/length, 2 configurable that are EEPROM generic > > > (e.g. SPI or some other form of access) which are: > > > > > > NET_ETHADDR_EEPROM_OFFSET, indicating where in the EEPROM the start of > > > the MAC address is. The default is 8 allowing for 8 bytes before the MAC > > > for other purposes (header MAGIC for example). > > > > > > NET_ETHADDR_EEPROM_CRC8, indicating the MAC is appended with a CRC8-CCIT > > > checksum that should be verified. > > > > > > Currently only I2C eeproms have been tested and thus only those options > > > are available, but shouldn't be a limit. NET_ETHADDR_EEPROM_SPI can be > > > just as created and added. > > > > > > The code currently first checks if there is a non-zero MAC address in > > > the eeprom. If that fails to be the case, the read_rom_hwaddr can be > > > used by a board to supply the MAC in other ways. > > > > > > If both these fails, the other code is still in place to query the > > > environent, which then can be used to override the hardware supplied > > > data. > > > > > > Signed-off-by: Olliver Schinagl <oli...@schinagl.nl> > > > --- > > > arch/arm/mach-sunxi/Kconfig | 8 +-- > > > configs/A10-OLinuXino-Lime_defconfig | 1 - > > > configs/A20-OLinuXino-Lime2-eMMC_defconfig | 1 - > > > configs/A20-OLinuXino-Lime2_defconfig | 1 - > > > configs/A20-OLinuXino-Lime_defconfig | 1 - > > > configs/A20-OLinuXino_MICRO_defconfig | 1 - > > > doc/README.enetaddr | 95 > > > ++++++++++++++++++++++++++++++ > > > include/net.h | 14 +++++ > > > net/Kconfig | 59 +++++++++++++++++++ > > > net/eth-uclass.c | 42 +++++++------ > > > net/eth_common.c | 37 ++++++++++++ > > > net/eth_legacy.c | 2 + > > > 12 files changed, 231 insertions(+), 31 deletions(-) > > > > > > diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig > > > index be060b65dc..cf5af4fe18 100644 > > > --- a/arch/arm/mach-sunxi/Kconfig > > > +++ b/arch/arm/mach-sunxi/Kconfig > > > @@ -479,14 +479,14 @@ config I2C0_ENABLE > > > > > > config I2C1_ENABLE > > > bool "Enable I2C/TWI controller 1" > > > - default n > > > + default y if (NET_ETHADDR_EEPROM_I2C_BUS = 1) > > > select CMD_I2C > > > ---help--- > > > See I2C0_ENABLE help text. > > > > > > config I2C2_ENABLE > > > bool "Enable I2C/TWI controller 2" > > > - default n > > > + default y if (NET_ETHADDR_EEPROM_I2C_BUS = 2) > > > select CMD_I2C > > > ---help--- > > > See I2C0_ENABLE help text. > > > @@ -494,7 +494,7 @@ config I2C2_ENABLE > > > if MACH_SUN6I || MACH_SUN7I > > > config I2C3_ENABLE > > > bool "Enable I2C/TWI controller 3" > > > - default n > > > + default y if (NET_ETHADDR_EEPROM_I2C_BUS = 3) > > > select CMD_I2C > > > ---help--- > > > See I2C0_ENABLE help text. > > > @@ -513,7 +513,7 @@ endif > > > if MACH_SUN7I > > > config I2C4_ENABLE > > > bool "Enable I2C/TWI controller 4" > > > - default n > > > + default y if (NET_ETHADDR_EEPROM_I2C_BUS = 4) > > > select CMD_I2C > > > ---help--- > > > See I2C0_ENABLE help text. > > > diff --git a/configs/A10-OLinuXino-Lime_defconfig > > > b/configs/A10-OLinuXino-Lime_defconfig > > > index ec16a44fbd..d4513144eb 100644 > > > --- a/configs/A10-OLinuXino-Lime_defconfig > > > +++ b/configs/A10-OLinuXino-Lime_defconfig > > > @@ -5,7 +5,6 @@ CONFIG_DRAM_CLK=480 > > > CONFIG_DRAM_EMR1=4 > > > CONFIG_SYS_CLK_FREQ=912000000 > > > CONFIG_MMC0_CD_PIN="PH1" > > > -CONFIG_I2C1_ENABLE=y > > > > Didn't that just remove the option if NET_ETHADDR_EEPROM is disabled > > (which is its default) ? > I initially forced I2C1_ENABLE on all the Olimex boards before finding that > I could do: > > default y if (NET_ETHADDR_EEPROM_I2C_BUS = 1) > > So by defining NET_ETHADDR_EEPROM_I2C_BUS = x in the defconfig, the correct > I2C1_ENABLE is being set, so we do not need to hardcode this in the > defconfig anymore. > > Or am I miss-understanding you?
My point is: before, you had the I2C enabled using the defconfig (and the defconfig alone), and you don't have that anymore. Maxime -- Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
signature.asc
Description: PGP signature