Hi, On 05/16/2014 01:32 PM, Jonathan Liu wrote: > This allows accessing the EEPROM on the Olimex A20-OLinuXino-MICRO > using the i2c command. > > Signed-off-by: Jonathan Liu <[email protected]>
p.s. I don't know what you want this for, but if it is for the purpose of getting fixed MAC addresses for the NIC, please consider implementing this: https://github.com/linux-sunxi/linux-sunxi/commit/e7d46d2c Instead (I've this on my todo for u-boot, so that the kernel and u-boot behave the same). This way you will not only help getting a fixed MAC address on the A20-OLinuXino-MICRO, but everywhere. Thanks, Hans > --- > arch/arm/include/asm/arch-sunxi/gpio.h | 2 ++ > arch/arm/include/asm/arch-sunxi/i2c.h | 4 ++++ > board/sunxi/board.c | 6 ++++++ > include/configs/sunxi-common.h | 4 ++++ > 4 files changed, 16 insertions(+) > > diff --git a/arch/arm/include/asm/arch-sunxi/gpio.h > b/arch/arm/include/asm/arch-sunxi/gpio.h > index 46a111e..7a866b4 100644 > --- a/arch/arm/include/asm/arch-sunxi/gpio.h > +++ b/arch/arm/include/asm/arch-sunxi/gpio.h > @@ -123,6 +123,8 @@ enum sunxi_gpio_number { > #define SUN7I_GPA0_GMAC 5 > > #define SUNXI_GPB0_TWI0 2 > +#define SUNXI_GPB0_TWI1 2 > +#define SUNXI_GPB0_TWI2 2 > > #define SUN4I_GPB22_UART0_TX 2 > #define SUN4I_GPB23_UART0_RX 2 > diff --git a/arch/arm/include/asm/arch-sunxi/i2c.h > b/arch/arm/include/asm/arch-sunxi/i2c.h > index dc5406b..d1708d1 100644 > --- a/arch/arm/include/asm/arch-sunxi/i2c.h > +++ b/arch/arm/include/asm/arch-sunxi/i2c.h > @@ -8,7 +8,11 @@ > > #include <asm/arch/cpu.h> > > +#ifdef CONFIG_SPL_BUILD > #define CONFIG_I2C_MVTWSI_BASE SUNXI_TWI0_BASE > +#else > +#define CONFIG_I2C_MVTWSI_BASE SUNXI_TWI1_BASE > +#endif > /* This is abp0-clk on sun4i/5i/7i / abp1-clk on sun6i/sun8i which is 24MHz > */ > #define CONFIG_SYS_TCLK 24000000 > > diff --git a/board/sunxi/board.c b/board/sunxi/board.c > index 6c362a3..c9035ba 100644 > --- a/board/sunxi/board.c > +++ b/board/sunxi/board.c > @@ -129,9 +129,15 @@ int board_mmc_init(bd_t *bis) > > void i2c_init_board(void) > { > +#ifdef CONFIG_SPL_BUILD > sunxi_gpio_set_cfgpin(SUNXI_GPB(0), SUNXI_GPB0_TWI0); > sunxi_gpio_set_cfgpin(SUNXI_GPB(1), SUNXI_GPB0_TWI0); > clock_twi_onoff(0, 1); > +#else > + sunxi_gpio_set_cfgpin(SUNXI_GPB(18), SUNXI_GPB0_TWI1); > + sunxi_gpio_set_cfgpin(SUNXI_GPB(19), SUNXI_GPB0_TWI1); > + clock_twi_onoff(1, 1); > +#endif > } > > #if defined(CONFIG_SPL_BUILD) || defined(CONFIG_SUN6I) || > defined(CONFIG_SUN8I) > diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h > index e11c4ee..19ae9c9 100644 > --- a/include/configs/sunxi-common.h > +++ b/include/configs/sunxi-common.h > @@ -320,7 +320,11 @@ > /* No CONFIG_SYS_I2C as we use the non converted mvtwsi driver */ > #define CONFIG_HARD_I2C > #define CONFIG_SYS_I2C_SUNXI > +#ifdef CONFIG_SPL_BUILD > #define CONFIG_SYS_I2C_SPEED 400000 > +#else > +#define CONFIG_SYS_I2C_SPEED 100000 > +#endif > #define CONFIG_SYS_I2C_SLAVE 0x7f > #define CONFIG_CMD_I2C > > -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
