From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?ISO-8859-1?Q?Andreas_Bie=DFmann?= Date: Wed, 02 Jun 2010 09:02:05 +0200 Subject: [U-Boot] AVR32 AP700x - I2C somewhere? In-Reply-To: <4C051361.8070300@emk-elektronik.de> References: <4C051361.8070300@emk-elektronik.de> Message-ID: <4C0601ED.8060402@googlemail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Am 01.06.2010 16:04, schrieb Reinhard Meyer (-VC): > Hi, Dear Reinhard Meyer, > has anyone started or completed work on an I2C driver for AP7000x? No ... > > If not, I am at least going to make SOFT I2C defines to read VPD from an > At24C64 EEPROM. But I've working soft-i2c here. There are still some other examples in u-boot how to interface a at24xx eeprom. custom board config file: ---8<--- /* i2c definitions */ #define CONFIG_SOFT_I2C #if defined(CONFIG_SOFT_I2C) #define DEBUG_I2C #ifndef __ASSEMBLY__ #include #define MEDUCORE_SDA_PIN 6 #define MEDUCORE_SCL_PIN 7 #define I2C_ACTIVE portmux_select_gpio(PORTMUX_PORT_A, (1<8--- and in our custom board implementation (only snippet): ---8<--- @@ -29,6 +29,8 @@ #include #include +#include + DECLARE_GLOBAL_DATA_PTR; /* @@ -71,6 +73,38 @@ static const struct sdram_config sdram_config = { int board_early_init_f(void) { + unsigned char val = 0xFF; + unsigned char version = 0x00; + int ret = -1; // assume error + + // first select SCL gpio + portmux_select_gpio(PORTMUX_PORT_A, (1<flags |= GD_FLG_POSTFAIL; + goto out; + } + + ret |= i2c_write(0x27, 0x06, 1, &val, 1); // set GPPU to FF + ret |= i2c_write(0x27, 0x01, 1, &val, 1); // set IPOL to FF (invert palaritiy) + if ( ret != 0 ) { + gd->flags |= GD_FLG_POSTFAIL; + goto out; + } + + ret = i2c_read(0x27, 0x09, 1, &version, 1); // read in the version value + if ( ret != 0 ) { + gd->flags |= GD_FLG_POSTFAIL; + goto out; + } + // version can be used from here --->8--- regards Andreas Bie?mann