From mboxrd@z Thu Jan 1 00:00:00 1970 From: Heiko Schocher Date: Tue, 18 Mar 2014 08:54:41 +0100 Subject: [U-Boot] [PATCH u-boot sunxi 07/12] sunxi: Add i2c support In-Reply-To: <1395097256-7593-8-git-send-email-hdegoede@redhat.com> References: <1395097256-7593-1-git-send-email-hdegoede@redhat.com> <1395097256-7593-8-git-send-email-hdegoede@redhat.com> Message-ID: <5327FBC1.70206@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hello Hans, Am 18.03.2014 00:00, schrieb Hans de Goede: > From: Henrik Nordstrom > > Based linux-sunxi#sunxi commit d854c4de2f57 "arm: Handle .gnu.hash section in > ldscripts" vs v2014.01. > > As well as the following signed-off-by the sunxi branch shows commits to > the sunxi_i2c.c file by: > > Stefan Roese > > Signed-off-by: Henrik Nordstrom > Signed-off-by: Oliver Schinagl > Signed-off-by: Hans de Goede > --- > arch/arm/cpu/armv7/sunxi/board.c | 6 + > arch/arm/include/asm/arch-sunxi/i2c.h | 169 ++++++++++++++++++++++ > drivers/i2c/Makefile | 1 + > drivers/i2c/sunxi_i2c.c | 260 ++++++++++++++++++++++++++++++++++ > include/configs/sunxi-common.h | 8 ++ > 5 files changed, 444 insertions(+) > create mode 100644 arch/arm/include/asm/arch-sunxi/i2c.h > create mode 100644 drivers/i2c/sunxi_i2c.c > [...] > diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile > index fa3a875..2a44db4 100644 > --- a/drivers/i2c/Makefile > +++ b/drivers/i2c/Makefile > @@ -15,6 +15,7 @@ obj-$(CONFIG_PCA9564_I2C) += pca9564_i2c.o > obj-$(CONFIG_TSI108_I2C) += tsi108_i2c.o > obj-$(CONFIG_U8500_I2C) += u8500_i2c.o > obj-$(CONFIG_SH_SH7734_I2C) += sh_sh7734_i2c.o > +obj-$(CONFIG_SUNXI_I2C) += sunxi_i2c.o please use: CONFIG_SYS_I2C_SUNXI > obj-$(CONFIG_SYS_I2C) += i2c_core.o > obj-$(CONFIG_SYS_I2C_FSL) += fsl_i2c.o > obj-$(CONFIG_SYS_I2C_FTI2C010) += fti2c010.o > diff --git a/drivers/i2c/sunxi_i2c.c b/drivers/i2c/sunxi_i2c.c > new file mode 100644 > index 0000000..9a542f6 > --- /dev/null > +++ b/drivers/i2c/sunxi_i2c.c > @@ -0,0 +1,260 @@ > +/* > + * (C) Copyright 2012 Henrik Nordstrom > + * > + * SPDX-License-Identifier: GPL-2.0+ > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +static struct i2c __attribute__ ((section(".data"))) *i2c_base = > + (struct i2c *)0x1c2ac00; Please no magic numbers, use a define instead. > +void i2c_init(int speed, int slaveaddr) [...] > +int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len) > +{ > + int rc = i2c_do_write(chip, addr, alen, buffer, len); > + > + i2c_stop(); > + > + return rc; > +} Please update to the new i2c multibus/multiadpater framework Dummy question, there is another "twi" driver in drivers/i2c bfin-twi_i2c.c are they compatible? > diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h > index fe41b89..1f2bcb5 100644 > --- a/include/configs/sunxi-common.h > +++ b/include/configs/sunxi-common.h > @@ -176,6 +176,14 @@ > #undef CONFIG_CMD_NET > #undef CONFIG_CMD_NFS > > +/* I2C */ > +#define CONFIG_SPL_I2C_SUPPORT > +#define CONFIG_SYS_I2C_SPEED 400000 > +#define CONFIG_HARD_I2C NACK, please use no longer HARD_I2C, switch instead to CONFIG_SYS_I2C > +#define CONFIG_SUNXI_I2C > +#define CONFIG_SYS_I2C_SLAVE 0x7f > +#define CONFIG_CMD_I2C > + > #ifndef CONFIG_CONS_INDEX > #define CONFIG_CONS_INDEX 1 /* UART0 */ > #endif bye, Heiko -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany