All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/5] sunxi: i2c and pmic support
@ 2014-06-09 15:15 Hans de Goede
  2014-06-09 15:15 ` [U-Boot] [PATCH 1/5] mvtwsi: convert to CONFIG_SYS_I2C framework Hans de Goede
                   ` (4 more replies)
  0 siblings, 5 replies; 18+ messages in thread
From: Hans de Goede @ 2014-06-09 15:15 UTC (permalink / raw)
  To: u-boot

Hi Albert, Heiko,

Here is a new attempt at getting i2c and pmic support added to the sunxi
u-boot support.

Heiko, as you requested I've added a patch to convert the mvtwsi driver to
CONFIG_SYS_I2C, can you please review this patch ?

Once this patch has been reviewed, I think it would be best for this
series to go upstream through the u-boot-arm tree, since all the other changes
are sunxi specific.

Note patch 5/5 is an unrelated sunxi bugfix for a bug I found while testing
the i2c + pmic support. 

Regards,

Hans

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [U-Boot] [PATCH 1/5] mvtwsi: convert to CONFIG_SYS_I2C framework
  2014-06-09 15:15 [U-Boot] [PATCH 0/5] sunxi: i2c and pmic support Hans de Goede
@ 2014-06-09 15:15 ` Hans de Goede
  2014-06-10  8:05   ` [U-Boot] [U-Boot, " Heiko Schocher
  2014-06-10 15:28   ` [U-Boot] [PATCH " Prafulla Wadaskar
  2014-06-09 15:15 ` [U-Boot] [PATCH 2/5] sunxi: Add i2c support Hans de Goede
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 18+ messages in thread
From: Hans de Goede @ 2014-06-09 15:15 UTC (permalink / raw)
  To: u-boot

Note this has only been tested on Allwinner sunxi devices (support for which
gets introduced by a later patch).

The kirkwood changes have been compile tested using the wireless_space board
config, the orion5x changes have been compile tested using the edminiv2 board
config.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 arch/arm/include/asm/arch-kirkwood/config.h |  3 +-
 drivers/i2c/Makefile                        |  2 +-
 drivers/i2c/mvtwsi.c                        | 69 +++++++++++++----------------
 include/configs/edminiv2.h                  |  3 +-
 4 files changed, 36 insertions(+), 41 deletions(-)

diff --git a/arch/arm/include/asm/arch-kirkwood/config.h b/arch/arm/include/asm/arch-kirkwood/config.h
index 7a688e4..f7bfa0e 100644
--- a/arch/arm/include/asm/arch-kirkwood/config.h
+++ b/arch/arm/include/asm/arch-kirkwood/config.h
@@ -129,7 +129,8 @@
  */
 #ifdef CONFIG_CMD_I2C
 #ifndef CONFIG_SYS_I2C_SOFT
-#define CONFIG_I2C_MVTWSI
+#define CONFIG_SYS_I2C
+#define CONFIG_SYS_I2C_MVTWSI
 #endif
 #define CONFIG_SYS_I2C_SLAVE		0x0
 #define CONFIG_SYS_I2C_SPEED		100000
diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile
index e33586d..61e9f3c 100644
--- a/drivers/i2c/Makefile
+++ b/drivers/i2c/Makefile
@@ -7,7 +7,6 @@
 
 obj-$(CONFIG_BFIN_TWI_I2C) += bfin-twi_i2c.o
 obj-$(CONFIG_DW_I2C) += designware_i2c.o
-obj-$(CONFIG_I2C_MVTWSI) += mvtwsi.o
 obj-$(CONFIG_I2C_MV) += mv_i2c.o
 obj-$(CONFIG_I2C_MXS) += mxs_i2c.o
 obj-$(CONFIG_PCA9564_I2C) += pca9564_i2c.o
@@ -19,6 +18,7 @@ obj-$(CONFIG_SYS_I2C_DAVINCI) += davinci_i2c.o
 obj-$(CONFIG_SYS_I2C_FSL) += fsl_i2c.o
 obj-$(CONFIG_SYS_I2C_FTI2C010) += fti2c010.o
 obj-$(CONFIG_SYS_I2C_KONA) += kona_i2c.o
+obj-$(CONFIG_SYS_I2C_MVTWSI) += mvtwsi.o
 obj-$(CONFIG_SYS_I2C_MXC) += mxc_i2c.o
 obj-$(CONFIG_SYS_I2C_OMAP24XX) += omap24xx_i2c.o
 obj-$(CONFIG_SYS_I2C_OMAP34XX) += omap24xx_i2c.o
diff --git a/drivers/i2c/mvtwsi.c b/drivers/i2c/mvtwsi.c
index 5ba0e03..d3457b9 100644
--- a/drivers/i2c/mvtwsi.c
+++ b/drivers/i2c/mvtwsi.c
@@ -220,11 +220,10 @@ static int twsi_stop(int status)
 
 /*
  * Reset controller.
- * Called at end of i2c_init unsuccessful i2c transactions.
  * Controller reset also resets the baud rate and slave address, so
- * re-establish them.
+ * they must be re-established afterwards.
  */
-static void twsi_reset(u8 baud_rate, u8 slave_address)
+static void twsi_reset(struct i2c_adapter *adap)
 {
 	/* ensure controller will be enabled by any twsi*() function */
 	twsi_control_flags = MVTWSI_CONTROL_TWSIEN;
@@ -232,23 +231,17 @@ static void twsi_reset(u8 baud_rate, u8 slave_address)
 	writel(0, &twsi->soft_reset);
 	/* wait 2 ms -- this is what the Marvell LSP does */
 	udelay(20000);
-	/* set baud rate */
-	writel(baud_rate, &twsi->baudrate);
-	/* set slave address even though we don't use it */
-	writel(slave_address, &twsi->slave_address);
-	writel(0, &twsi->xtnd_slave_addr);
-	/* assert STOP but don't care for the result */
-	(void) twsi_stop(0);
 }
 
 /*
  * I2C init called by cmd_i2c when doing 'i2c reset'.
  * Sets baud to the highest possible value not exceeding requested one.
  */
-void i2c_init(int requested_speed, int slaveadd)
+static unsigned int twsi_i2c_set_bus_speed(struct i2c_adapter *adap,
+					   unsigned int requested_speed)
 {
-	int	tmp_speed, highest_speed, n, m;
-	int	baud = 0x44; /* baudrate at controller reset */
+	unsigned int tmp_speed, highest_speed, n, m;
+	unsigned int baud = 0x44; /* baudrate at controller reset */
 
 	/* use actual speed to collect progressively higher values */
 	highest_speed = 0;
@@ -263,8 +256,21 @@ void i2c_init(int requested_speed, int slaveadd)
 			}
 		}
 	}
+	writel(baud, &twsi->baudrate);
+	return 0;
+}
+
+static void twsi_i2c_init(struct i2c_adapter *adap, int speed, int slaveadd)
+{
 	/* reset controller */
-	twsi_reset(baud, slaveadd);
+	twsi_reset(adap);
+	/* set speed */
+	twsi_i2c_set_bus_speed(adap, speed);
+	/* set slave address even though we don't use it */
+	writel(slaveadd, &twsi->slave_address);
+	writel(0, &twsi->xtnd_slave_addr);
+	/* assert STOP but don't care for the result */
+	(void) twsi_stop(0);
 }
 
 /*
@@ -294,7 +300,7 @@ static int i2c_begin(int expected_start_status, u8 addr)
  * I2C probe called by cmd_i2c when doing 'i2c probe'.
  * Begin read, nak data byte, end.
  */
-int i2c_probe(uchar chip)
+static int twsi_i2c_probe(struct i2c_adapter *adap, uchar chip)
 {
 	u8 dummy_byte;
 	int status;
@@ -320,12 +326,13 @@ int i2c_probe(uchar chip)
  * cmd_eeprom, so we have to choose here, and for the moment that'll be
  * a repeated start without a preceding stop.
  */
-int i2c_read(u8 dev, uint addr, int alen, u8 *data, int length)
+static int twsi_i2c_read(struct i2c_adapter *adap, uchar chip, uint addr,
+			int alen, uchar *data, int length)
 {
 	int status;
 
 	/* begin i2c write to send the address bytes */
-	status = i2c_begin(MVTWSI_STATUS_START, (dev << 1));
+	status = i2c_begin(MVTWSI_STATUS_START, (chip << 1));
 	/* send addr bytes */
 	while ((status == 0) && alen--)
 		status = twsi_send(addr >> (8*alen),
@@ -333,7 +340,7 @@ int i2c_read(u8 dev, uint addr, int alen, u8 *data, int length)
 	/* begin i2c read to receive eeprom data bytes */
 	if (status == 0)
 		status = i2c_begin(
-			MVTWSI_STATUS_REPEATED_START, (dev << 1) | 1);
+			MVTWSI_STATUS_REPEATED_START, (chip << 1) | 1);
 	/* prepare ACK if@least one byte must be received */
 	if (length > 0)
 		twsi_control_flags |= MVTWSI_CONTROL_ACK;
@@ -355,12 +362,13 @@ int i2c_read(u8 dev, uint addr, int alen, u8 *data, int length)
  * I2C write called by cmd_i2c when doing 'i2c write' and by cmd_eeprom.c
  * Begin write, send address byte(s), send data bytes, end.
  */
-int i2c_write(u8 dev, uint addr, int alen, u8 *data, int length)
+static int twsi_i2c_write(struct i2c_adapter *adap, uchar chip, uint addr,
+			int alen, uchar *data, int length)
 {
 	int status;
 
 	/* begin i2c write to send the eeprom adress bytes then data bytes */
-	status = i2c_begin(MVTWSI_STATUS_START, (dev << 1));
+	status = i2c_begin(MVTWSI_STATUS_START, (chip << 1));
 	/* send addr bytes */
 	while ((status == 0) && alen--)
 		status = twsi_send(addr >> (8*alen),
@@ -374,21 +382,6 @@ int i2c_write(u8 dev, uint addr, int alen, u8 *data, int length)
 	return status;
 }
 
-/*
- * Bus set routine: we only support bus 0.
- */
-int i2c_set_bus_num(unsigned int bus)
-{
-	if (bus > 0) {
-		return -1;
-	}
-	return 0;
-}
-
-/*
- * Bus get routine: hard-return bus 0.
- */
-unsigned int i2c_get_bus_num(void)
-{
-	return 0;
-}
+U_BOOT_I2C_ADAP_COMPLETE(twsi0, twsi_i2c_init, twsi_i2c_probe,
+			 twsi_i2c_read, twsi_i2c_write,
+			 twsi_i2c_set_bus_speed, 100000, 0, 0)
diff --git a/include/configs/edminiv2.h b/include/configs/edminiv2.h
index 8b9f66a..77717a8 100644
--- a/include/configs/edminiv2.h
+++ b/include/configs/edminiv2.h
@@ -187,7 +187,8 @@
  * I2C related stuff
  */
 #ifdef CONFIG_CMD_I2C
-#define CONFIG_I2C_MVTWSI
+#define CONFIG_SYS_I2C
+#define CONFIG_SYS_I2C_MVTWSI
 #define CONFIG_I2C_MVTWSI_BASE		ORION5X_TWSI_BASE
 #define CONFIG_SYS_I2C_SLAVE		0x0
 #define CONFIG_SYS_I2C_SPEED		100000
-- 
2.0.0

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [U-Boot] [PATCH 2/5] sunxi: Add i2c support
  2014-06-09 15:15 [U-Boot] [PATCH 0/5] sunxi: i2c and pmic support Hans de Goede
  2014-06-09 15:15 ` [U-Boot] [PATCH 1/5] mvtwsi: convert to CONFIG_SYS_I2C framework Hans de Goede
@ 2014-06-09 15:15 ` Hans de Goede
  2014-06-09 16:09   ` Albert ARIBAUD
  2014-06-10  6:33   ` Heiko Schocher
  2014-06-09 15:15 ` [U-Boot] [PATCH 3/5] sunxi: Add axp209 pmic support Hans de Goede
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 18+ messages in thread
From: Hans de Goede @ 2014-06-09 15:15 UTC (permalink / raw)
  To: u-boot

Add support for the i2c controller found on all Allwinner sunxi SoCs,
this is the same controller as found on the Marvell orion5x and kirkwood
SoC families, with a slightly different register layout, so this patch uses
the existing mvtwsi code.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
---
 arch/arm/cpu/armv7/sunxi/board.c        |  6 ++++++
 arch/arm/cpu/armv7/sunxi/u-boot-spl.lds |  5 +++++
 arch/arm/include/asm/arch-sunxi/i2c.h   | 15 +++++++++++++++
 board/sunxi/board.c                     |  7 +++++++
 drivers/i2c/mvtwsi.c                    | 18 ++++++++++++++++++
 include/configs/sunxi-common.h          |  8 ++++++++
 6 files changed, 59 insertions(+)
 create mode 100644 arch/arm/include/asm/arch-sunxi/i2c.h

diff --git a/arch/arm/cpu/armv7/sunxi/board.c b/arch/arm/cpu/armv7/sunxi/board.c
index 1e506b5..024c8c1 100644
--- a/arch/arm/cpu/armv7/sunxi/board.c
+++ b/arch/arm/cpu/armv7/sunxi/board.c
@@ -11,6 +11,7 @@
  */
 
 #include <common.h>
+#include <i2c.h>
 #include <netdev.h>
 #include <miiphy.h>
 #include <serial.h>
@@ -91,11 +92,16 @@ void s_init(void)
 	clock_init();
 	timer_init();
 	gpio_init();
+	i2c_init_board();
 
 #ifdef CONFIG_SPL_BUILD
 	gd = &gdata;
 	preloader_console_init();
 
+#ifdef CONFIG_SPL_I2C_SUPPORT
+	/* Needed early by sunxi_board_init if PMU is enabled */
+	i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+#endif
 	sunxi_board_init();
 #endif
 }
diff --git a/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds b/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds
index c1ae227..53f0cbd 100644
--- a/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds
+++ b/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds
@@ -39,6 +39,11 @@ SECTIONS
 	.data : { *(SORT_BY_ALIGNMENT(.data*)) } >.sram
 
 	. = ALIGN(4);
+	.u_boot_list : {
+		KEEP(*(SORT(.u_boot_list*)));
+	} > .sram
+
+	. = ALIGN(4);
 	__image_copy_end = .;
 	_end = .;
 
diff --git a/arch/arm/include/asm/arch-sunxi/i2c.h b/arch/arm/include/asm/arch-sunxi/i2c.h
new file mode 100644
index 0000000..dc5406b
--- /dev/null
+++ b/arch/arm/include/asm/arch-sunxi/i2c.h
@@ -0,0 +1,15 @@
+/*
+ * Copyright 2014 - Hans de Goede <hdegoede@redhat.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+#ifndef _SUNXI_I2C_H_
+#define _SUNXI_I2C_H_
+
+#include <asm/arch/cpu.h>
+
+#define CONFIG_I2C_MVTWSI_BASE	SUNXI_TWI0_BASE
+/* This is abp0-clk on sun4i/5i/7i / abp1-clk on sun6i/sun8i which is 24MHz */
+#define CONFIG_SYS_TCLK		24000000
+
+#endif
diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index b05d0b9..543b809 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -106,6 +106,13 @@ int board_mmc_init(bd_t *bis)
 }
 #endif
 
+void i2c_init_board(void)
+{
+	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);
+}
+
 #ifdef CONFIG_SPL_BUILD
 void sunxi_board_init(void)
 {
diff --git a/drivers/i2c/mvtwsi.c b/drivers/i2c/mvtwsi.c
index d3457b9..ad1ce8f 100644
--- a/drivers/i2c/mvtwsi.c
+++ b/drivers/i2c/mvtwsi.c
@@ -22,6 +22,8 @@
 #include <asm/arch/orion5x.h>
 #elif defined(CONFIG_KIRKWOOD)
 #include <asm/arch/kirkwood.h>
+#elif defined(CONFIG_SUNXI)
+#include <asm/arch/i2c.h>
 #else
 #error Driver mvtwsi not supported by SoC or board
 #endif
@@ -30,6 +32,20 @@
  * TWSI register structure
  */
 
+#ifdef CONFIG_SUNXI
+
+struct  mvtwsi_registers {
+	u32 slave_address;
+	u32 xtnd_slave_addr;
+	u32 data;
+	u32 control;
+	u32 status;
+	u32 baudrate;
+	u32 soft_reset;
+};
+
+#else
+
 struct  mvtwsi_registers {
 	u32 slave_address;
 	u32 data;
@@ -43,6 +59,8 @@ struct  mvtwsi_registers {
 	u32 soft_reset;
 };
 
+#endif
+
 /*
  * Control register fields
  */
diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index 3f04890..42b0d2e 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -161,6 +161,14 @@
 #undef CONFIG_CMD_NET
 #undef CONFIG_CMD_NFS
 
+/* I2C */
+#define CONFIG_SPL_I2C_SUPPORT
+#define CONFIG_SYS_I2C
+#define CONFIG_SYS_I2C_MVTWSI
+#define CONFIG_SYS_I2C_SPEED		400000
+#define CONFIG_SYS_I2C_SLAVE		0x7f
+#define CONFIG_CMD_I2C
+
 #ifndef CONFIG_CONS_INDEX
 #define CONFIG_CONS_INDEX              1       /* UART0 */
 #endif
-- 
2.0.0

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [U-Boot] [PATCH 3/5] sunxi: Add axp209 pmic support
  2014-06-09 15:15 [U-Boot] [PATCH 0/5] sunxi: i2c and pmic support Hans de Goede
  2014-06-09 15:15 ` [U-Boot] [PATCH 1/5] mvtwsi: convert to CONFIG_SYS_I2C framework Hans de Goede
  2014-06-09 15:15 ` [U-Boot] [PATCH 2/5] sunxi: Add i2c support Hans de Goede
@ 2014-06-09 15:15 ` Hans de Goede
  2014-06-09 18:22   ` Ian Campbell
  2014-06-09 15:15 ` [U-Boot] [PATCH 4/5] sunxi: Add axp152 " Hans de Goede
  2014-06-09 15:15 ` [U-Boot] [PATCH 5/5] sunxi: Fix reset hang on sun5i Hans de Goede
  4 siblings, 1 reply; 18+ messages in thread
From: Hans de Goede @ 2014-06-09 15:15 UTC (permalink / raw)
  To: u-boot

From: Henrik Nordstrom <henrik@henriknordstrom.net>

Add support for the x-powers axp209 pmic which is found on most A10, A13 and
A20 boards.

And enable AXP209 support for the Cubietruck and Cubieboard boards.

While changing the boards.cfg lines for the Cubietruck, add Ian and me as board
maintainers for the Cubietruck.

Signed-off-by: Henrik Nordstrom <henrik@henriknordstrom.net>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 board/sunxi/board.c            |  22 ++++++
 boards.cfg                     |   6 +-
 drivers/power/Makefile         |   1 +
 drivers/power/axp209.c         | 167 +++++++++++++++++++++++++++++++++++++++++
 include/axp209.h               |  14 ++++
 include/configs/sun4i.h        |   1 +
 include/configs/sun5i.h        |   1 +
 include/configs/sun7i.h        |   1 +
 include/configs/sunxi-common.h |   5 ++
 9 files changed, 215 insertions(+), 3 deletions(-)
 create mode 100644 drivers/power/axp209.c
 create mode 100644 include/axp209.h

diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 543b809..8375711 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -12,6 +12,9 @@
  */
 
 #include <common.h>
+#ifdef CONFIG_AXP209_POWER
+#include <axp209.h>
+#endif
 #include <asm/arch/clock.h>
 #include <asm/arch/dram.h>
 #include <asm/arch/gpio.h>
@@ -116,12 +119,31 @@ void i2c_init_board(void)
 #ifdef CONFIG_SPL_BUILD
 void sunxi_board_init(void)
 {
+	int power_failed = 0;
 	unsigned long ramsize;
 
+#ifdef CONFIG_AXP209_POWER
+	power_failed |= axp209_init();
+	power_failed |= axp209_set_dcdc2(1400);
+	power_failed |= axp209_set_dcdc3(1250);
+	power_failed |= axp209_set_ldo2(3000);
+	power_failed |= axp209_set_ldo3(2800);
+	power_failed |= axp209_set_ldo4(2800);
+#endif
+
 	printf("DRAM:");
 	ramsize = sunxi_dram_init();
 	printf(" %lu MiB\n", ramsize >> 20);
 	if (!ramsize)
 		hang();
+
+	/*
+	 * Only clock up the CPU to full speed if we are reasonably
+	 * assured it's being powered with suitable core voltage
+	 */
+	if (!power_failed)
+		clock_set_pll1(CONFIG_CLK_FULL_SPEED);
+	else
+		printf("Failed to set core voltage! Can't set CPU frequency\n");
 }
 #endif
diff --git a/boards.cfg b/boards.cfg
index 983189e..ec17557 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -375,9 +375,9 @@ Active  arm         armv7          s5pc1xx     samsung         goni
 Active  arm         armv7          s5pc1xx     samsung         smdkc100            smdkc100                              -                                                                                                                                 Minkyu Kang <mk7.kang@samsung.com>
 Active  arm         armv7          socfpga     altera          socfpga             socfpga_cyclone5                      -                                                                                                                                 -
 Active  arm         armv7          sunxi       -               sunxi               A13-OLinuXinoM                        sun5i:A13_OLINUXINOM,SPL,CONS_INDEX=2                                                                                             Hans de Goede <hdegoede@redhat.com>
-Active  arm         armv7          sunxi       -               sunxi               Cubieboard                            sun4i:CUBIEBOARD,SPL,SUNXI_EMAC                                                                                                   Hans de Goede <hdegoede@redhat.com>
-Active  arm         armv7          sunxi       -               sunxi               Cubietruck                            sun7i:CUBIETRUCK,SPL,SUNXI_GMAC,RGMII                                                                                             Ian Campbell <ijc@hellion.org.uk>:Hans de Goede <hdegoede@redhat.com>
-Active  arm         armv7          sunxi       -               sunxi               Cubietruck_FEL                        sun7i:CUBIETRUCK,SPL_FEL,SUNXI_GMAC,RGMII                                                                                         Ian Campbell <ijc@hellion.org.uk>:Hans de Goede <hdegoede@redhat.com>
+Active  arm         armv7          sunxi       -               sunxi               Cubieboard                            sun4i:CUBIEBOARD,SPL,AXP209_POWER,SUNXI_EMAC                                                                                      Hans de Goede <hdegoede@redhat.com>
+Active  arm         armv7          sunxi       -               sunxi               Cubietruck                            sun7i:CUBIETRUCK,SPL,AXP209_POWER,SUNXI_GMAC,RGMII                                                                                Ian Campbell <ijc@hellion.org.uk>:Hans de Goede <hdegoede@redhat.com>
+Active  arm         armv7          sunxi       -               sunxi               Cubietruck_FEL                        sun7i:CUBIETRUCK,SPL_FEL,AXP209_POWER,SUNXI_GMAC,RGMII                                                                            Ian Campbell <ijc@hellion.org.uk>:Hans de Goede <hdegoede@redhat.com>
 Active  arm         armv7          sunxi       -               sunxi               r7-tv-dongle                          sun5i:R7DONGLE,SPL                                                                                                                Hans de Goede <hdegoede@redhat.com>
 Active  arm         armv7          u8500       st-ericsson     snowball            snowball                              -                                                                                                                                 Mathieu Poirier <mathieu.poirier@linaro.org>
 Active  arm         armv7          u8500       st-ericsson     u8500               u8500_href                            -                                                                                                                                 -
diff --git a/drivers/power/Makefile b/drivers/power/Makefile
index 53ff97d..063ac8f 100644
--- a/drivers/power/Makefile
+++ b/drivers/power/Makefile
@@ -5,6 +5,7 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
+obj-$(CONFIG_AXP209_POWER)	+= axp209.o
 obj-$(CONFIG_EXYNOS_TMU)	+= exynos-tmu.o
 obj-$(CONFIG_FTPMU010_POWER)	+= ftpmu010.o
 obj-$(CONFIG_TPS6586X_POWER)	+= tps6586x.o
diff --git a/drivers/power/axp209.c b/drivers/power/axp209.c
new file mode 100644
index 0000000..9798e5b
--- /dev/null
+++ b/drivers/power/axp209.c
@@ -0,0 +1,167 @@
+/*
+ * (C) Copyright 2012
+ * Henrik Nordstrom <henrik@henriknordstrom.net>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <i2c.h>
+#include <axp209.h>
+
+enum axp209_reg {
+	AXP209_POWER_STATUS = 0x00,
+	AXP209_CHIP_VERSION = 0x03,
+	AXP209_DCDC2_VOLTAGE = 0x23,
+	AXP209_DCDC3_VOLTAGE = 0x27,
+	AXP209_LDO24_VOLTAGE = 0x28,
+	AXP209_LDO3_VOLTAGE = 0x29,
+	AXP209_IRQ_STATUS5 = 0x4c,
+	AXP209_SHUTDOWN = 0x32,
+};
+
+#define AXP209_POWER_STATUS_ON_BY_DC	(1 << 0)
+
+#define AXP209_IRQ5_PEK_UP		(1 << 6)
+#define AXP209_IRQ5_PEK_DOWN		(1 << 5)
+
+#define AXP209_POWEROFF			(1 << 7)
+
+static int axp209_write(enum axp209_reg reg, u8 val)
+{
+	return i2c_write(0x34, reg, 1, &val, 1);
+}
+
+static int axp209_read(enum axp209_reg reg, u8 *val)
+{
+	return i2c_read(0x34, reg, 1, val, 1);
+}
+
+static u8 axp209_mvolt_to_cfg(int mvolt, int min, int max, int div)
+{
+	if (mvolt < min)
+		mvolt = min;
+	else if (mvolt > max)
+		mvolt = max;
+
+	return (mvolt - min) / div;
+}
+
+int axp209_set_dcdc2(int mvolt)
+{
+	int rc;
+	u8 cfg, current;
+
+	cfg = axp209_mvolt_to_cfg(mvolt, 700, 2275, 25);
+
+	/* Do we really need to be this gentle? It has built-in voltage slope */
+	while ((rc = axp209_read(AXP209_DCDC2_VOLTAGE, &current)) == 0 &&
+	       current != cfg) {
+		if (current < cfg)
+			current++;
+		else
+			current--;
+
+		rc = axp209_write(AXP209_DCDC2_VOLTAGE, current);
+		if (rc)
+			break;
+	}
+
+	return rc;
+}
+
+int axp209_set_dcdc3(int mvolt)
+{
+	u8 cfg = axp209_mvolt_to_cfg(mvolt, 700, 3500, 25);
+
+	return axp209_write(AXP209_DCDC3_VOLTAGE, cfg);
+}
+
+int axp209_set_ldo2(int mvolt)
+{
+	int rc;
+	u8 cfg, reg;
+
+	cfg = axp209_mvolt_to_cfg(mvolt, 1800, 3300, 100);
+
+	rc = axp209_read(AXP209_LDO24_VOLTAGE, &reg);
+	if (rc)
+		return rc;
+
+	/* LDO2 configuration is in upper 4 bits */
+	reg = (reg & 0x0f) | (cfg << 4);
+	return axp209_write(AXP209_LDO24_VOLTAGE, reg);
+}
+
+int axp209_set_ldo3(int mvolt)
+{
+	u8 cfg;
+
+	if (mvolt == -1)
+		cfg = 0x80;	/* determined by LDO3IN pin */
+	else
+		cfg = axp209_mvolt_to_cfg(mvolt, 700, 2275, 25);
+
+	return axp209_write(AXP209_LDO3_VOLTAGE, cfg);
+}
+
+int axp209_set_ldo4(int mvolt)
+{
+	int rc;
+	static const int vindex[] = {
+		1250, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000, 2500,
+		2700, 2800, 3000, 3100, 3200, 3300
+	};
+	u8 cfg, reg;
+
+	/* Translate mvolt to register cfg value, requested <= selected */
+	for (cfg = 15; vindex[cfg] > mvolt && cfg > 0; cfg--);
+
+	rc = axp209_read(AXP209_LDO24_VOLTAGE, &reg);
+	if (rc)
+		return rc;
+
+	/* LDO4 configuration is in lower 4 bits */
+	reg = (reg & 0xf0) | (cfg << 0);
+	return axp209_write(AXP209_LDO24_VOLTAGE, reg);
+}
+
+int axp209_init(void)
+{
+	u8 ver;
+	int rc;
+
+	rc = axp209_read(AXP209_CHIP_VERSION, &ver);
+	if (rc)
+		return rc;
+
+	/* Low 4 bits is chip version */
+	ver &= 0x0f;
+
+	if (ver != 0x1)
+		return -1;
+
+	return 0;
+}
+
+int axp209_poweron_by_dc(void)
+{
+	u8 v;
+
+	if (axp209_read(AXP209_POWER_STATUS, &v))
+		return 0;
+
+	return (v & AXP209_POWER_STATUS_ON_BY_DC);
+}
+
+int axp209_power_button(void)
+{
+	u8 v;
+
+	if (axp209_read(AXP209_IRQ_STATUS5, &v))
+		return 0;
+
+	axp209_write(AXP209_IRQ_STATUS5, AXP209_IRQ5_PEK_DOWN);
+
+	return v & AXP209_IRQ5_PEK_DOWN;
+}
diff --git a/include/axp209.h b/include/axp209.h
new file mode 100644
index 0000000..21efce6
--- /dev/null
+++ b/include/axp209.h
@@ -0,0 +1,14 @@
+/*
+ * (C) Copyright 2012 Henrik Nordstrom <henrik@henriknordstrom.net>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+extern int axp209_set_dcdc2(int mvolt);
+extern int axp209_set_dcdc3(int mvolt);
+extern int axp209_set_ldo2(int mvolt);
+extern int axp209_set_ldo3(int mvolt);
+extern int axp209_set_ldo4(int mvolt);
+extern int axp209_init(void);
+extern int axp209_poweron_by_dc(void);
+extern int axp209_power_button(void);
diff --git a/include/configs/sun4i.h b/include/configs/sun4i.h
index 6560b65..037f995 100644
--- a/include/configs/sun4i.h
+++ b/include/configs/sun4i.h
@@ -12,6 +12,7 @@
  * A10 specific configuration
  */
 #define CONFIG_SUN4I		/* sun4i SoC generation */
+#define CONFIG_CLK_FULL_SPEED		1008000000
 
 #define CONFIG_SYS_PROMPT		"sun4i# "
 
diff --git a/include/configs/sun5i.h b/include/configs/sun5i.h
index 43f0d67..c6138b7 100644
--- a/include/configs/sun5i.h
+++ b/include/configs/sun5i.h
@@ -12,6 +12,7 @@
  * High Level Configuration Options
  */
 #define CONFIG_SUN5I		/* sun5i SoC generation */
+#define CONFIG_CLK_FULL_SPEED		1008000000
 
 #define CONFIG_SYS_PROMPT		"sun5i# "
 
diff --git a/include/configs/sun7i.h b/include/configs/sun7i.h
index 9b693f7..d9be104 100644
--- a/include/configs/sun7i.h
+++ b/include/configs/sun7i.h
@@ -13,6 +13,7 @@
  * A20 specific configuration
  */
 #define CONFIG_SUN7I		/* sun7i SoC generation */
+#define CONFIG_CLK_FULL_SPEED		912000000
 
 #define CONFIG_SYS_PROMPT		"sun7i# "
 
diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index 42b0d2e..4083388 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -169,6 +169,11 @@
 #define CONFIG_SYS_I2C_SLAVE		0x7f
 #define CONFIG_CMD_I2C
 
+/* PMU */
+#if defined CONFIG_AXP152_POWER || defined CONFIG_AXP209_POWER || defined CONFIG_AXP221_POWER
+#define CONFIG_SPL_POWER_SUPPORT
+#endif
+
 #ifndef CONFIG_CONS_INDEX
 #define CONFIG_CONS_INDEX              1       /* UART0 */
 #endif
-- 
2.0.0

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [U-Boot] [PATCH 4/5] sunxi: Add axp152 pmic support
  2014-06-09 15:15 [U-Boot] [PATCH 0/5] sunxi: i2c and pmic support Hans de Goede
                   ` (2 preceding siblings ...)
  2014-06-09 15:15 ` [U-Boot] [PATCH 3/5] sunxi: Add axp209 pmic support Hans de Goede
@ 2014-06-09 15:15 ` Hans de Goede
  2014-06-09 18:22   ` Ian Campbell
  2014-06-09 15:15 ` [U-Boot] [PATCH 5/5] sunxi: Fix reset hang on sun5i Hans de Goede
  4 siblings, 1 reply; 18+ messages in thread
From: Hans de Goede @ 2014-06-09 15:15 UTC (permalink / raw)
  To: u-boot

Add support for the x-powers axp152 pmic which is found on most A10s boards
and enable it for the r7-tv-dongle board.

Signed-off-by: Henrik Nordstrom <henrik@henriknordstrom.net>
Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 board/sunxi/board.c    | 10 ++++++
 boards.cfg             |  2 +-
 drivers/power/Makefile |  1 +
 drivers/power/axp152.c | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++
 include/axp152.h       | 10 ++++++
 5 files changed, 119 insertions(+), 1 deletion(-)
 create mode 100644 drivers/power/axp152.c
 create mode 100644 include/axp152.h

diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 8375711..8607eb3 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -12,6 +12,9 @@
  */
 
 #include <common.h>
+#ifdef CONFIG_AXP152_POWER
+#include <axp152.h>
+#endif
 #ifdef CONFIG_AXP209_POWER
 #include <axp209.h>
 #endif
@@ -122,6 +125,13 @@ void sunxi_board_init(void)
 	int power_failed = 0;
 	unsigned long ramsize;
 
+#ifdef CONFIG_AXP152_POWER
+	power_failed = axp152_init();
+	power_failed |= axp152_set_dcdc2(1400);
+	power_failed |= axp152_set_dcdc3(1500);
+	power_failed |= axp152_set_dcdc4(1250);
+	power_failed |= axp152_set_ldo2(3000);
+#endif
 #ifdef CONFIG_AXP209_POWER
 	power_failed |= axp209_init();
 	power_failed |= axp209_set_dcdc2(1400);
diff --git a/boards.cfg b/boards.cfg
index ec17557..aaea8f4 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -378,7 +378,7 @@ Active  arm         armv7          sunxi       -               sunxi
 Active  arm         armv7          sunxi       -               sunxi               Cubieboard                            sun4i:CUBIEBOARD,SPL,AXP209_POWER,SUNXI_EMAC                                                                                      Hans de Goede <hdegoede@redhat.com>
 Active  arm         armv7          sunxi       -               sunxi               Cubietruck                            sun7i:CUBIETRUCK,SPL,AXP209_POWER,SUNXI_GMAC,RGMII                                                                                Ian Campbell <ijc@hellion.org.uk>:Hans de Goede <hdegoede@redhat.com>
 Active  arm         armv7          sunxi       -               sunxi               Cubietruck_FEL                        sun7i:CUBIETRUCK,SPL_FEL,AXP209_POWER,SUNXI_GMAC,RGMII                                                                            Ian Campbell <ijc@hellion.org.uk>:Hans de Goede <hdegoede@redhat.com>
-Active  arm         armv7          sunxi       -               sunxi               r7-tv-dongle                          sun5i:R7DONGLE,SPL                                                                                                                Hans de Goede <hdegoede@redhat.com>
+Active  arm         armv7          sunxi       -               sunxi               r7-tv-dongle                          sun5i:R7DONGLE,SPL,AXP152_POWER                                                                                                   Hans de Goede <hdegoede@redhat.com>
 Active  arm         armv7          u8500       st-ericsson     snowball            snowball                              -                                                                                                                                 Mathieu Poirier <mathieu.poirier@linaro.org>
 Active  arm         armv7          u8500       st-ericsson     u8500               u8500_href                            -                                                                                                                                 -
 Active  arm         armv7          vf610       freescale       vf610twr            vf610twr                              vf610twr:IMX_CONFIG=board/freescale/vf610twr/imximage.cfg                                                                         Alison Wang <b18965@freescale.com>
diff --git a/drivers/power/Makefile b/drivers/power/Makefile
index 063ac8f..dc64e4d 100644
--- a/drivers/power/Makefile
+++ b/drivers/power/Makefile
@@ -5,6 +5,7 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
+obj-$(CONFIG_AXP152_POWER)	+= axp152.o
 obj-$(CONFIG_AXP209_POWER)	+= axp209.o
 obj-$(CONFIG_EXYNOS_TMU)	+= exynos-tmu.o
 obj-$(CONFIG_FTPMU010_POWER)	+= ftpmu010.o
diff --git a/drivers/power/axp152.c b/drivers/power/axp152.c
new file mode 100644
index 0000000..fa4ea05
--- /dev/null
+++ b/drivers/power/axp152.c
@@ -0,0 +1,97 @@
+/*
+ * (C) Copyright 2012
+ * Henrik Nordstrom <henrik@henriknordstrom.net>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+#include <common.h>
+#include <i2c.h>
+#include <axp152.h>
+
+enum axp152_reg {
+	AXP152_CHIP_VERSION = 0x3,
+	AXP152_DCDC2_VOLTAGE = 0x23,
+	AXP152_DCDC3_VOLTAGE = 0x27,
+	AXP152_DCDC4_VOLTAGE = 0x2B,
+	AXP152_LDO2_VOLTAGE = 0x2A,
+	AXP152_SHUTDOWN = 0x32,
+};
+
+#define AXP152_POWEROFF			(1 << 7)
+
+static int axp152_write(enum axp152_reg reg, u8 val)
+{
+	return i2c_write(0x30, reg, 1, &val, 1);
+}
+
+static int axp152_read(enum axp152_reg reg, u8 *val)
+{
+	return i2c_read(0x30, reg, 1, val, 1);
+}
+
+static u8 axp152_mvolt_to_target(int mvolt, int min, int max, int div)
+{
+	if (mvolt < min)
+		mvolt = min;
+	else if (mvolt > max)
+		mvolt = max;
+
+	return (mvolt - min) / div;
+}
+
+int axp152_set_dcdc2(int mvolt)
+{
+	int rc;
+	u8 current, target;
+
+	target = axp152_mvolt_to_target(mvolt, 700, 2275, 25);
+
+	/* Do we really need to be this gentle? It has built-in voltage slope */
+	while ((rc = axp152_read(AXP152_DCDC2_VOLTAGE, &current)) == 0 &&
+	       current != target) {
+		if (current < target)
+			current++;
+		else
+			current--;
+		rc = axp152_write(AXP152_DCDC2_VOLTAGE, current);
+		if (rc)
+			break;
+	}
+	return rc;
+}
+
+int axp152_set_dcdc3(int mvolt)
+{
+	u8 target = axp152_mvolt_to_target(mvolt, 700, 3500, 25);
+
+	return axp152_write(AXP152_DCDC3_VOLTAGE, target);
+}
+
+int axp152_set_dcdc4(int mvolt)
+{
+	u8 target = axp152_mvolt_to_target(mvolt, 700, 3500, 25);
+
+	return axp152_write(AXP152_DCDC4_VOLTAGE, target);
+}
+
+int axp152_set_ldo2(int mvolt)
+{
+	u8 target = axp152_mvolt_to_target(mvolt, 700, 3500, 100);
+
+	return axp152_write(AXP152_LDO2_VOLTAGE, target);
+}
+
+int axp152_init(void)
+{
+	u8 ver;
+	int rc;
+
+	rc = axp152_read(AXP152_CHIP_VERSION, &ver);
+	if (rc)
+		return rc;
+
+	if (ver != 0x05)
+		return -1;
+
+	return 0;
+}
diff --git a/include/axp152.h b/include/axp152.h
new file mode 100644
index 0000000..3e5ccbd
--- /dev/null
+++ b/include/axp152.h
@@ -0,0 +1,10 @@
+/*
+ * (C) Copyright 2012 Henrik Nordstrom <henrik@henriknordstrom.net>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+int axp152_set_dcdc2(int mvolt);
+int axp152_set_dcdc3(int mvolt);
+int axp152_set_dcdc4(int mvolt);
+int axp152_set_ldo2(int mvolt);
+int axp152_init(void);
-- 
2.0.0

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [U-Boot] [PATCH 5/5] sunxi: Fix reset hang on sun5i
  2014-06-09 15:15 [U-Boot] [PATCH 0/5] sunxi: i2c and pmic support Hans de Goede
                   ` (3 preceding siblings ...)
  2014-06-09 15:15 ` [U-Boot] [PATCH 4/5] sunxi: Add axp152 " Hans de Goede
@ 2014-06-09 15:15 ` Hans de Goede
  2014-06-09 18:23   ` Ian Campbell
  4 siblings, 1 reply; 18+ messages in thread
From: Hans de Goede @ 2014-06-09 15:15 UTC (permalink / raw)
  To: u-boot

Do the same as the Linux kernel does, this fixes the SoC hanging on reset
about 50% of the time.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 arch/arm/cpu/armv7/sunxi/board.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/arm/cpu/armv7/sunxi/board.c b/arch/arm/cpu/armv7/sunxi/board.c
index 024c8c1..2898833 100644
--- a/arch/arm/cpu/armv7/sunxi/board.c
+++ b/arch/arm/cpu/armv7/sunxi/board.c
@@ -75,7 +75,11 @@ void reset_cpu(ulong addr)
 	/* Set the watchdog for its shortest interval (.5s) and wait */
 	writel(WDT_MODE_RESET_EN | WDT_MODE_EN, &wdog->mode);
 	writel(WDT_CTRL_KEY | WDT_CTRL_RESTART, &wdog->ctl);
-	while (1);
+
+	while (1) {
+		/* sun5i sometimes gets stuck without this */
+		writel(WDT_MODE_RESET_EN | WDT_MODE_EN, &wdog->mode);
+	}
 }
 
 /* do some early init */
-- 
2.0.0

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [U-Boot] [PATCH 2/5] sunxi: Add i2c support
  2014-06-09 15:15 ` [U-Boot] [PATCH 2/5] sunxi: Add i2c support Hans de Goede
@ 2014-06-09 16:09   ` Albert ARIBAUD
  2014-06-09 17:13     ` Hans de Goede
  2014-06-10  6:33   ` Heiko Schocher
  1 sibling, 1 reply; 18+ messages in thread
From: Albert ARIBAUD @ 2014-06-09 16:09 UTC (permalink / raw)
  To: u-boot

Hi Hans,

On Mon,  9 Jun 2014 17:15:27 +0200, Hans de Goede <hdegoede@redhat.com>
wrote:

> Add support for the i2c controller found on all Allwinner sunxi SoCs,
> this is the same controller as found on the Marvell orion5x and kirkwood
> SoC families, with a slightly different register layout, so this patch uses
> the existing mvtwsi code.

Should not affect orion or kirkwood, since you're just adding a
variant to the "include switch case" where it was intended; but just in
case, I'm Cc:ing Prafulla here.

> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> Acked-by: Ian Campbell <ijc@hellion.org.uk>
> ---
>  arch/arm/cpu/armv7/sunxi/board.c        |  6 ++++++
>  arch/arm/cpu/armv7/sunxi/u-boot-spl.lds |  5 +++++
>  arch/arm/include/asm/arch-sunxi/i2c.h   | 15 +++++++++++++++
>  board/sunxi/board.c                     |  7 +++++++
>  drivers/i2c/mvtwsi.c                    | 18 ++++++++++++++++++
>  include/configs/sunxi-common.h          |  8 ++++++++
>  6 files changed, 59 insertions(+)
>  create mode 100644 arch/arm/include/asm/arch-sunxi/i2c.h
> 
> diff --git a/arch/arm/cpu/armv7/sunxi/board.c b/arch/arm/cpu/armv7/sunxi/board.c
> index 1e506b5..024c8c1 100644
> --- a/arch/arm/cpu/armv7/sunxi/board.c
> +++ b/arch/arm/cpu/armv7/sunxi/board.c
> @@ -11,6 +11,7 @@
>   */
>  
>  #include <common.h>
> +#include <i2c.h>
>  #include <netdev.h>
>  #include <miiphy.h>
>  #include <serial.h>
> @@ -91,11 +92,16 @@ void s_init(void)
>  	clock_init();
>  	timer_init();
>  	gpio_init();
> +	i2c_init_board();
>  
>  #ifdef CONFIG_SPL_BUILD
>  	gd = &gdata;
>  	preloader_console_init();
>  
> +#ifdef CONFIG_SPL_I2C_SUPPORT
> +	/* Needed early by sunxi_board_init if PMU is enabled */
> +	i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
> +#endif
>  	sunxi_board_init();
>  #endif
>  }
> diff --git a/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds b/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds
> index c1ae227..53f0cbd 100644
> --- a/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds
> +++ b/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds
> @@ -39,6 +39,11 @@ SECTIONS
>  	.data : { *(SORT_BY_ALIGNMENT(.data*)) } >.sram
>  
>  	. = ALIGN(4);
> +	.u_boot_list : {
> +		KEEP(*(SORT(.u_boot_list*)));
> +	} > .sram
> +
> +	. = ALIGN(4);

This adds the U-Boot commands section to an SPL linker script, which
seems to imply it was not there before. Are you actually adding command
line to the SPL of this board family?

>  	__image_copy_end = .;
>  	_end = .;
>  
> diff --git a/arch/arm/include/asm/arch-sunxi/i2c.h b/arch/arm/include/asm/arch-sunxi/i2c.h
> new file mode 100644
> index 0000000..dc5406b
> --- /dev/null
> +++ b/arch/arm/include/asm/arch-sunxi/i2c.h
> @@ -0,0 +1,15 @@
> +/*
> + * Copyright 2014 - Hans de Goede <hdegoede@redhat.com>
> + *
> + * SPDX-License-Identifier:	GPL-2.0+
> + */
> +#ifndef _SUNXI_I2C_H_
> +#define _SUNXI_I2C_H_
> +
> +#include <asm/arch/cpu.h>
> +
> +#define CONFIG_I2C_MVTWSI_BASE	SUNXI_TWI0_BASE
> +/* This is abp0-clk on sun4i/5i/7i / abp1-clk on sun6i/sun8i which is 24MHz */
> +#define CONFIG_SYS_TCLK		24000000
> +
> +#endif
> diff --git a/board/sunxi/board.c b/board/sunxi/board.c
> index b05d0b9..543b809 100644
> --- a/board/sunxi/board.c
> +++ b/board/sunxi/board.c
> @@ -106,6 +106,13 @@ int board_mmc_init(bd_t *bis)
>  }
>  #endif
>  
> +void i2c_init_board(void)
> +{
> +	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);
> +}
> +
>  #ifdef CONFIG_SPL_BUILD
>  void sunxi_board_init(void)
>  {
> diff --git a/drivers/i2c/mvtwsi.c b/drivers/i2c/mvtwsi.c
> index d3457b9..ad1ce8f 100644
> --- a/drivers/i2c/mvtwsi.c
> +++ b/drivers/i2c/mvtwsi.c
> @@ -22,6 +22,8 @@
>  #include <asm/arch/orion5x.h>
>  #elif defined(CONFIG_KIRKWOOD)
>  #include <asm/arch/kirkwood.h>
> +#elif defined(CONFIG_SUNXI)
> +#include <asm/arch/i2c.h>
>  #else
>  #error Driver mvtwsi not supported by SoC or board
>  #endif
> @@ -30,6 +32,20 @@
>   * TWSI register structure
>   */
>  
> +#ifdef CONFIG_SUNXI
> +
> +struct  mvtwsi_registers {
> +	u32 slave_address;
> +	u32 xtnd_slave_addr;
> +	u32 data;
> +	u32 control;
> +	u32 status;
> +	u32 baudrate;
> +	u32 soft_reset;
> +};
> +
> +#else
> +
>  struct  mvtwsi_registers {
>  	u32 slave_address;
>  	u32 data;
> @@ -43,6 +59,8 @@ struct  mvtwsi_registers {
>  	u32 soft_reset;
>  };
>  
> +#endif
> +
>  /*
>   * Control register fields
>   */
> diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
> index 3f04890..42b0d2e 100644
> --- a/include/configs/sunxi-common.h
> +++ b/include/configs/sunxi-common.h
> @@ -161,6 +161,14 @@
>  #undef CONFIG_CMD_NET
>  #undef CONFIG_CMD_NFS
>  
> +/* I2C */
> +#define CONFIG_SPL_I2C_SUPPORT
> +#define CONFIG_SYS_I2C
> +#define CONFIG_SYS_I2C_MVTWSI
> +#define CONFIG_SYS_I2C_SPEED		400000
> +#define CONFIG_SYS_I2C_SLAVE		0x7f
> +#define CONFIG_CMD_I2C
> +
>  #ifndef CONFIG_CONS_INDEX
>  #define CONFIG_CONS_INDEX              1       /* UART0 */
>  #endif


Amicalement,
-- 
Albert.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [U-Boot] [PATCH 2/5] sunxi: Add i2c support
  2014-06-09 16:09   ` Albert ARIBAUD
@ 2014-06-09 17:13     ` Hans de Goede
  2014-06-10 14:18       ` Prafulla Wadaskar
  0 siblings, 1 reply; 18+ messages in thread
From: Hans de Goede @ 2014-06-09 17:13 UTC (permalink / raw)
  To: u-boot

Hi,

On 06/09/2014 06:09 PM, Albert ARIBAUD wrote:
> Hi Hans,
>
> On Mon,  9 Jun 2014 17:15:27 +0200, Hans de Goede <hdegoede@redhat.com>
> wrote:
>
>> Add support for the i2c controller found on all Allwinner sunxi SoCs,
>> this is the same controller as found on the Marvell orion5x and kirkwood
>> SoC families, with a slightly different register layout, so this patch uses
>> the existing mvtwsi code.
>
> Should not affect orion or kirkwood, since you're just adding a
> variant to the "include switch case" where it was intended; but just in
> case, I'm Cc:ing Prafulla here.

Ah, good idea, thanks. Prafulla, this patch indeed does not affect
orion or kirkwood, but the previous patch in the series does, if you
could review and/or test it that would be great. And sorry for not
CC-ing you on that patch from the get go.

Regards,

Hans

>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>> Acked-by: Ian Campbell <ijc@hellion.org.uk>
>> ---
>>   arch/arm/cpu/armv7/sunxi/board.c        |  6 ++++++
>>   arch/arm/cpu/armv7/sunxi/u-boot-spl.lds |  5 +++++
>>   arch/arm/include/asm/arch-sunxi/i2c.h   | 15 +++++++++++++++
>>   board/sunxi/board.c                     |  7 +++++++
>>   drivers/i2c/mvtwsi.c                    | 18 ++++++++++++++++++
>>   include/configs/sunxi-common.h          |  8 ++++++++
>>   6 files changed, 59 insertions(+)
>>   create mode 100644 arch/arm/include/asm/arch-sunxi/i2c.h
>>
>> diff --git a/arch/arm/cpu/armv7/sunxi/board.c b/arch/arm/cpu/armv7/sunxi/board.c
>> index 1e506b5..024c8c1 100644
>> --- a/arch/arm/cpu/armv7/sunxi/board.c
>> +++ b/arch/arm/cpu/armv7/sunxi/board.c
>> @@ -11,6 +11,7 @@
>>    */
>>
>>   #include <common.h>
>> +#include <i2c.h>
>>   #include <netdev.h>
>>   #include <miiphy.h>
>>   #include <serial.h>
>> @@ -91,11 +92,16 @@ void s_init(void)
>>   	clock_init();
>>   	timer_init();
>>   	gpio_init();
>> +	i2c_init_board();
>>
>>   #ifdef CONFIG_SPL_BUILD
>>   	gd = &gdata;
>>   	preloader_console_init();
>>
>> +#ifdef CONFIG_SPL_I2C_SUPPORT
>> +	/* Needed early by sunxi_board_init if PMU is enabled */
>> +	i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
>> +#endif
>>   	sunxi_board_init();
>>   #endif
>>   }
>> diff --git a/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds b/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds
>> index c1ae227..53f0cbd 100644
>> --- a/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds
>> +++ b/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds
>> @@ -39,6 +39,11 @@ SECTIONS
>>   	.data : { *(SORT_BY_ALIGNMENT(.data*)) } >.sram
>>
>>   	. = ALIGN(4);
>> +	.u_boot_list : {
>> +		KEEP(*(SORT(.u_boot_list*)));
>> +	} > .sram
>> +
>> +	. = ALIGN(4);
>
> This adds the U-Boot commands section to an SPL linker script, which
> seems to imply it was not there before. Are you actually adding command
> line to the SPL of this board family?
>
>>   	__image_copy_end = .;
>>   	_end = .;
>>
>> diff --git a/arch/arm/include/asm/arch-sunxi/i2c.h b/arch/arm/include/asm/arch-sunxi/i2c.h
>> new file mode 100644
>> index 0000000..dc5406b
>> --- /dev/null
>> +++ b/arch/arm/include/asm/arch-sunxi/i2c.h
>> @@ -0,0 +1,15 @@
>> +/*
>> + * Copyright 2014 - Hans de Goede <hdegoede@redhat.com>
>> + *
>> + * SPDX-License-Identifier:	GPL-2.0+
>> + */
>> +#ifndef _SUNXI_I2C_H_
>> +#define _SUNXI_I2C_H_
>> +
>> +#include <asm/arch/cpu.h>
>> +
>> +#define CONFIG_I2C_MVTWSI_BASE	SUNXI_TWI0_BASE
>> +/* This is abp0-clk on sun4i/5i/7i / abp1-clk on sun6i/sun8i which is 24MHz */
>> +#define CONFIG_SYS_TCLK		24000000
>> +
>> +#endif
>> diff --git a/board/sunxi/board.c b/board/sunxi/board.c
>> index b05d0b9..543b809 100644
>> --- a/board/sunxi/board.c
>> +++ b/board/sunxi/board.c
>> @@ -106,6 +106,13 @@ int board_mmc_init(bd_t *bis)
>>   }
>>   #endif
>>
>> +void i2c_init_board(void)
>> +{
>> +	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);
>> +}
>> +
>>   #ifdef CONFIG_SPL_BUILD
>>   void sunxi_board_init(void)
>>   {
>> diff --git a/drivers/i2c/mvtwsi.c b/drivers/i2c/mvtwsi.c
>> index d3457b9..ad1ce8f 100644
>> --- a/drivers/i2c/mvtwsi.c
>> +++ b/drivers/i2c/mvtwsi.c
>> @@ -22,6 +22,8 @@
>>   #include <asm/arch/orion5x.h>
>>   #elif defined(CONFIG_KIRKWOOD)
>>   #include <asm/arch/kirkwood.h>
>> +#elif defined(CONFIG_SUNXI)
>> +#include <asm/arch/i2c.h>
>>   #else
>>   #error Driver mvtwsi not supported by SoC or board
>>   #endif
>> @@ -30,6 +32,20 @@
>>    * TWSI register structure
>>    */
>>
>> +#ifdef CONFIG_SUNXI
>> +
>> +struct  mvtwsi_registers {
>> +	u32 slave_address;
>> +	u32 xtnd_slave_addr;
>> +	u32 data;
>> +	u32 control;
>> +	u32 status;
>> +	u32 baudrate;
>> +	u32 soft_reset;
>> +};
>> +
>> +#else
>> +
>>   struct  mvtwsi_registers {
>>   	u32 slave_address;
>>   	u32 data;
>> @@ -43,6 +59,8 @@ struct  mvtwsi_registers {
>>   	u32 soft_reset;
>>   };
>>
>> +#endif
>> +
>>   /*
>>    * Control register fields
>>    */
>> diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
>> index 3f04890..42b0d2e 100644
>> --- a/include/configs/sunxi-common.h
>> +++ b/include/configs/sunxi-common.h
>> @@ -161,6 +161,14 @@
>>   #undef CONFIG_CMD_NET
>>   #undef CONFIG_CMD_NFS
>>
>> +/* I2C */
>> +#define CONFIG_SPL_I2C_SUPPORT
>> +#define CONFIG_SYS_I2C
>> +#define CONFIG_SYS_I2C_MVTWSI
>> +#define CONFIG_SYS_I2C_SPEED		400000
>> +#define CONFIG_SYS_I2C_SLAVE		0x7f
>> +#define CONFIG_CMD_I2C
>> +
>>   #ifndef CONFIG_CONS_INDEX
>>   #define CONFIG_CONS_INDEX              1       /* UART0 */
>>   #endif
>
>
> Amicalement,
>

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [U-Boot] [PATCH 3/5] sunxi: Add axp209 pmic support
  2014-06-09 15:15 ` [U-Boot] [PATCH 3/5] sunxi: Add axp209 pmic support Hans de Goede
@ 2014-06-09 18:22   ` Ian Campbell
  0 siblings, 0 replies; 18+ messages in thread
From: Ian Campbell @ 2014-06-09 18:22 UTC (permalink / raw)
  To: u-boot

On Mon, 2014-06-09 at 17:15 +0200, Hans de Goede wrote:
> From: Henrik Nordstrom <henrik@henriknordstrom.net>
> 
> Add support for the x-powers axp209 pmic which is found on most A10, A13 and
> A20 boards.
> 
> And enable AXP209 support for the Cubietruck and Cubieboard boards.
> 
> While changing the boards.cfg lines for the Cubietruck, add Ian and me as board
> maintainers for the Cubietruck.
> 
> Signed-off-by: Henrik Nordstrom <henrik@henriknordstrom.net>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Acked-by: Ian Campbell <ijc@hellion.org.uk>

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [U-Boot] [PATCH 4/5] sunxi: Add axp152 pmic support
  2014-06-09 15:15 ` [U-Boot] [PATCH 4/5] sunxi: Add axp152 " Hans de Goede
@ 2014-06-09 18:22   ` Ian Campbell
  0 siblings, 0 replies; 18+ messages in thread
From: Ian Campbell @ 2014-06-09 18:22 UTC (permalink / raw)
  To: u-boot

On Mon, 2014-06-09 at 17:15 +0200, Hans de Goede wrote:
> Add support for the x-powers axp152 pmic which is found on most A10s boards
> and enable it for the r7-tv-dongle board.
> 
> Signed-off-by: Henrik Nordstrom <henrik@henriknordstrom.net>
> Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Looks good. Seems like my Ack would be redundant with my S-o-b but you
can add it if you like...

Ian.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [U-Boot] [PATCH 5/5] sunxi: Fix reset hang on sun5i
  2014-06-09 15:15 ` [U-Boot] [PATCH 5/5] sunxi: Fix reset hang on sun5i Hans de Goede
@ 2014-06-09 18:23   ` Ian Campbell
  0 siblings, 0 replies; 18+ messages in thread
From: Ian Campbell @ 2014-06-09 18:23 UTC (permalink / raw)
  To: u-boot

On Mon, 2014-06-09 at 17:15 +0200, Hans de Goede wrote:
> Do the same as the Linux kernel does, this fixes the SoC hanging on reset
> about 50% of the time.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Acked-by: Ian Campbell <ijc@hellion.org.uk>

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [U-Boot] [PATCH 2/5] sunxi: Add i2c support
  2014-06-09 15:15 ` [U-Boot] [PATCH 2/5] sunxi: Add i2c support Hans de Goede
  2014-06-09 16:09   ` Albert ARIBAUD
@ 2014-06-10  6:33   ` Heiko Schocher
  2014-06-10  7:44     ` Hans de Goede
  1 sibling, 1 reply; 18+ messages in thread
From: Heiko Schocher @ 2014-06-10  6:33 UTC (permalink / raw)
  To: u-boot

Hello Hans,

Am 09.06.2014 17:15, schrieb Hans de Goede:
> Add support for the i2c controller found on all Allwinner sunxi SoCs,
> this is the same controller as found on the Marvell orion5x and kirkwood
> SoC families, with a slightly different register layout, so this patch uses
> the existing mvtwsi code.
>
> Signed-off-by: Hans de Goede<hdegoede@redhat.com>
> Acked-by: Ian Campbell<ijc@hellion.org.uk>
> ---

as this is a newer version, your commit subject should contain a "v2",
and please add here a short info, what has changed ... look here for
an explanation how this should look like:
http://www.denx.de/wiki/view/U-Boot/Patches#Sending_updated_patch_versions

>   arch/arm/cpu/armv7/sunxi/board.c        |  6 ++++++
>   arch/arm/cpu/armv7/sunxi/u-boot-spl.lds |  5 +++++
>   arch/arm/include/asm/arch-sunxi/i2c.h   | 15 +++++++++++++++
>   board/sunxi/board.c                     |  7 +++++++
>   drivers/i2c/mvtwsi.c                    | 18 ++++++++++++++++++
>   include/configs/sunxi-common.h          |  8 ++++++++
>   6 files changed, 59 insertions(+)
>   create mode 100644 arch/arm/include/asm/arch-sunxi/i2c.h
>
> diff --git a/arch/arm/cpu/armv7/sunxi/board.c b/arch/arm/cpu/armv7/sunxi/board.c
> index 1e506b5..024c8c1 100644
> --- a/arch/arm/cpu/armv7/sunxi/board.c
> +++ b/arch/arm/cpu/armv7/sunxi/board.c
> @@ -11,6 +11,7 @@
>    */
>
>   #include<common.h>
> +#include<i2c.h>
>   #include<netdev.h>
>   #include<miiphy.h>
>   #include<serial.h>
> @@ -91,11 +92,16 @@ void s_init(void)
>   	clock_init();
>   	timer_init();
>   	gpio_init();
> +	i2c_init_board();
>
>   #ifdef CONFIG_SPL_BUILD
>   	gd =&gdata;
>   	preloader_console_init();
>
> +#ifdef CONFIG_SPL_I2C_SUPPORT
> +	/* Needed early by sunxi_board_init if PMU is enabled */
> +	i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
> +#endif
>   	sunxi_board_init();
>   #endif
>   }
> diff --git a/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds b/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds
> index c1ae227..53f0cbd 100644
> --- a/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds
> +++ b/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds
> @@ -39,6 +39,11 @@ SECTIONS
>   	.data : { *(SORT_BY_ALIGNMENT(.data*)) }>.sram
>
>   	. = ALIGN(4);
> +	.u_boot_list : {
> +		KEEP(*(SORT(.u_boot_list*)));
> +	}>  .sram
> +
> +	. = ALIGN(4);
>   	__image_copy_end = .;
>   	_end = .;
>

Do you really need this change?

[...]
> diff --git a/board/sunxi/board.c b/board/sunxi/board.c
> index b05d0b9..543b809 100644
> --- a/board/sunxi/board.c
> +++ b/board/sunxi/board.c
> @@ -106,6 +106,13 @@ int board_mmc_init(bd_t *bis)
>   }
>   #endif
>
> +void i2c_init_board(void)
> +{
> +	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);
> +}
> +
>   #ifdef CONFIG_SPL_BUILD
>   void sunxi_board_init(void)
>   {

I accept this here, but i2c_init_board() hysterically intention was
to deblock the bus ... I think we need here another approach ...
board specific initialization should be called from i2c_driver->init() when
the bus is really used ... (and if not used longer a i2c_driver->deinit()
should be called, so for example the pins could be used as gpio ... but
this is a step, I would introduce, if all i2c drivers use the new
framework ... or we have switched complete to the DM approach)

> diff --git a/drivers/i2c/mvtwsi.c b/drivers/i2c/mvtwsi.c
> index d3457b9..ad1ce8f 100644
> --- a/drivers/i2c/mvtwsi.c
> +++ b/drivers/i2c/mvtwsi.c
> @@ -22,6 +22,8 @@
>   #include<asm/arch/orion5x.h>
>   #elif defined(CONFIG_KIRKWOOD)
>   #include<asm/arch/kirkwood.h>
> +#elif defined(CONFIG_SUNXI)
> +#include<asm/arch/i2c.h>
>   #else
>   #error Driver mvtwsi not supported by SoC or board
>   #endif
> @@ -30,6 +32,20 @@
>    * TWSI register structure
>    */
>
> +#ifdef CONFIG_SUNXI
> +
> +struct  mvtwsi_registers {
> +	u32 slave_address;
> +	u32 xtnd_slave_addr;
> +	u32 data;
> +	u32 control;
> +	u32 status;
> +	u32 baudrate;
> +	u32 soft_reset;
> +};
> +
> +#else
> +
>   struct  mvtwsi_registers {
>   	u32 slave_address;
>   	u32 data;
> @@ -43,6 +59,8 @@ struct  mvtwsi_registers {
>   	u32 soft_reset;
>   };
>
> +#endif
> +
>   /*
>    * Control register fields
>    */

? Thats all? I thought you convert this driver to the new i2c framework?

At least, there should be a change from the i2c_xx() functions to static
and a prefix add to them ... and a "U_BOOT_I2C_ADAP_COMPLETE" at the end ...

> diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
> index 3f04890..42b0d2e 100644
> --- a/include/configs/sunxi-common.h
> +++ b/include/configs/sunxi-common.h
> @@ -161,6 +161,14 @@
>   #undef CONFIG_CMD_NET
>   #undef CONFIG_CMD_NFS
>
> +/* I2C */
> +#define CONFIG_SPL_I2C_SUPPORT
> +#define CONFIG_SYS_I2C
> +#define CONFIG_SYS_I2C_MVTWSI

This define is not in current ML, nor in your patch ... ?

Do this really work?

> +#define CONFIG_SYS_I2C_SPEED		400000
> +#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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [U-Boot] [PATCH 2/5] sunxi: Add i2c support
  2014-06-10  6:33   ` Heiko Schocher
@ 2014-06-10  7:44     ` Hans de Goede
  2014-06-10  7:53       ` Heiko Schocher
  0 siblings, 1 reply; 18+ messages in thread
From: Hans de Goede @ 2014-06-10  7:44 UTC (permalink / raw)
  To: u-boot

Hi,

On 06/10/2014 08:33 AM, Heiko Schocher wrote:
> Hello Hans,
> 
> Am 09.06.2014 17:15, schrieb Hans de Goede:
>> Add support for the i2c controller found on all Allwinner sunxi SoCs,
>> this is the same controller as found on the Marvell orion5x and kirkwood
>> SoC families, with a slightly different register layout, so this patch uses
>> the existing mvtwsi code.
>>
>> Signed-off-by: Hans de Goede<hdegoede@redhat.com>
>> Acked-by: Ian Campbell<ijc@hellion.org.uk>
>> ---
> 
> as this is a newer version, your commit subject should contain a "v2",
> and please add here a short info, what has changed ... look here for
> an explanation how this should look like:
> http://www.denx.de/wiki/view/U-Boot/Patches#Sending_updated_patch_versions

Ok, will do.

> 
>>   arch/arm/cpu/armv7/sunxi/board.c        |  6 ++++++
>>   arch/arm/cpu/armv7/sunxi/u-boot-spl.lds |  5 +++++
>>   arch/arm/include/asm/arch-sunxi/i2c.h   | 15 +++++++++++++++
>>   board/sunxi/board.c                     |  7 +++++++
>>   drivers/i2c/mvtwsi.c                    | 18 ++++++++++++++++++
>>   include/configs/sunxi-common.h          |  8 ++++++++
>>   6 files changed, 59 insertions(+)
>>   create mode 100644 arch/arm/include/asm/arch-sunxi/i2c.h
>>
>> diff --git a/arch/arm/cpu/armv7/sunxi/board.c b/arch/arm/cpu/armv7/sunxi/board.c
>> index 1e506b5..024c8c1 100644
>> --- a/arch/arm/cpu/armv7/sunxi/board.c
>> +++ b/arch/arm/cpu/armv7/sunxi/board.c
>> @@ -11,6 +11,7 @@
>>    */
>>
>>   #include<common.h>
>> +#include<i2c.h>
>>   #include<netdev.h>
>>   #include<miiphy.h>
>>   #include<serial.h>
>> @@ -91,11 +92,16 @@ void s_init(void)
>>       clock_init();
>>       timer_init();
>>       gpio_init();
>> +    i2c_init_board();
>>
>>   #ifdef CONFIG_SPL_BUILD
>>       gd =&gdata;
>>       preloader_console_init();
>>
>> +#ifdef CONFIG_SPL_I2C_SUPPORT
>> +    /* Needed early by sunxi_board_init if PMU is enabled */
>> +    i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
>> +#endif
>>       sunxi_board_init();
>>   #endif
>>   }
>> diff --git a/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds b/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds
>> index c1ae227..53f0cbd 100644
>> --- a/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds
>> +++ b/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds
>> @@ -39,6 +39,11 @@ SECTIONS
>>       .data : { *(SORT_BY_ALIGNMENT(.data*)) }>.sram
>>
>>       . = ALIGN(4);
>> +    .u_boot_list : {
>> +        KEEP(*(SORT(.u_boot_list*)));
>> +    }>  .sram
>> +
>> +    . = ALIGN(4);
>>       __image_copy_end = .;
>>       _end = .;
>>
> 
> Do you really need this change?

Yes, the sunxi spl uses the i2c bus to program the pmic
voltages before enabling dram.

> 
> [...]
>> diff --git a/board/sunxi/board.c b/board/sunxi/board.c
>> index b05d0b9..543b809 100644
>> --- a/board/sunxi/board.c
>> +++ b/board/sunxi/board.c
>> @@ -106,6 +106,13 @@ int board_mmc_init(bd_t *bis)
>>   }
>>   #endif
>>
>> +void i2c_init_board(void)
>> +{
>> +    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);
>> +}
>> +
>>   #ifdef CONFIG_SPL_BUILD
>>   void sunxi_board_init(void)
>>   {
> 
> I accept this here, but i2c_init_board() hysterically intention was
> to deblock the bus ... I think we need here another approach ...
> board specific initialization should be called from i2c_driver->init() when
> the bus is really used ... (and if not used longer a i2c_driver->deinit()
> should be called, so for example the pins could be used as gpio ... but
> this is a step, I would introduce, if all i2c drivers use the new
> framework ... or we have switched complete to the DM approach)
> 
>> diff --git a/drivers/i2c/mvtwsi.c b/drivers/i2c/mvtwsi.c
>> index d3457b9..ad1ce8f 100644
>> --- a/drivers/i2c/mvtwsi.c
>> +++ b/drivers/i2c/mvtwsi.c
>> @@ -22,6 +22,8 @@
>>   #include<asm/arch/orion5x.h>
>>   #elif defined(CONFIG_KIRKWOOD)
>>   #include<asm/arch/kirkwood.h>
>> +#elif defined(CONFIG_SUNXI)
>> +#include<asm/arch/i2c.h>
>>   #else
>>   #error Driver mvtwsi not supported by SoC or board
>>   #endif
>> @@ -30,6 +32,20 @@
>>    * TWSI register structure
>>    */
>>
>> +#ifdef CONFIG_SUNXI
>> +
>> +struct  mvtwsi_registers {
>> +    u32 slave_address;
>> +    u32 xtnd_slave_addr;
>> +    u32 data;
>> +    u32 control;
>> +    u32 status;
>> +    u32 baudrate;
>> +    u32 soft_reset;
>> +};
>> +
>> +#else
>> +
>>   struct  mvtwsi_registers {
>>       u32 slave_address;
>>       u32 data;
>> @@ -43,6 +59,8 @@ struct  mvtwsi_registers {
>>       u32 soft_reset;
>>   };
>>
>> +#endif
>> +
>>   /*
>>    * Control register fields
>>    */
> 
> ? Thats all? I thought you convert this driver to the new i2c framework?

I did a separate patch for that:
"[PATCH 1/5] mvtwsi: convert to CONFIG_SYS_I2C framework"

http://lists.denx.de/pipermail/u-boot/2014-June/181352.html

Which was also send directly to you.

> At least, there should be a change from the i2c_xx() functions to static
> and a prefix add to them ... and a "U_BOOT_I2C_ADAP_COMPLETE" at the end ...

Yes this is all done in the "[PATCH 1/5] mvtwsi: convert to CONFIG_SYS_I2C framework"
patch.

> 
>> diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
>> index 3f04890..42b0d2e 100644
>> --- a/include/configs/sunxi-common.h
>> +++ b/include/configs/sunxi-common.h
>> @@ -161,6 +161,14 @@
>>   #undef CONFIG_CMD_NET
>>   #undef CONFIG_CMD_NFS
>>
>> +/* I2C */
>> +#define CONFIG_SPL_I2C_SUPPORT
>> +#define CONFIG_SYS_I2C
>> +#define CONFIG_SYS_I2C_MVTWSI
> 
> This define is not in current ML, nor in your patch ... ?

"[PATCH 1/5] mvtwsi: convert to CONFIG_SYS_I2C framework"

Renames CONFIG_I2C_MVTWSI to CONFIG_SYS_I2C_MVTWSI

> Do this really work?

With the above patch applied first, yes it does.

>> +#define CONFIG_SYS_I2C_SPEED        400000
>> +#define CONFIG_SYS_I2C_SLAVE        0x7f
>> +#define CONFIG_CMD_I2C
>> +
>>   #ifndef CONFIG_CONS_INDEX
>>   #define CONFIG_CONS_INDEX              1       /* UART0 */
>>   #endif

Regards,

Hans

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [U-Boot] [PATCH 2/5] sunxi: Add i2c support
  2014-06-10  7:44     ` Hans de Goede
@ 2014-06-10  7:53       ` Heiko Schocher
  0 siblings, 0 replies; 18+ messages in thread
From: Heiko Schocher @ 2014-06-10  7:53 UTC (permalink / raw)
  To: u-boot

Hello Hans,

Am 10.06.2014 09:44, schrieb Hans de Goede:
> Hi,
>
> On 06/10/2014 08:33 AM, Heiko Schocher wrote:
>> Hello Hans,
>>
>> Am 09.06.2014 17:15, schrieb Hans de Goede:
>>> Add support for the i2c controller found on all Allwinner sunxi SoCs,
>>> this is the same controller as found on the Marvell orion5x and kirkwood
>>> SoC families, with a slightly different register layout, so this patch uses
>>> the existing mvtwsi code.
>>>
>>> Signed-off-by: Hans de Goede<hdegoede@redhat.com>
>>> Acked-by: Ian Campbell<ijc@hellion.org.uk>
>>> ---
>>
>> as this is a newer version, your commit subject should contain a "v2",
>> and please add here a short info, what has changed ... look here for
>> an explanation how this should look like:
>> http://www.denx.de/wiki/view/U-Boot/Patches#Sending_updated_patch_versions
>
> Ok, will do.
>
>>
>>>    arch/arm/cpu/armv7/sunxi/board.c        |  6 ++++++
>>>    arch/arm/cpu/armv7/sunxi/u-boot-spl.lds |  5 +++++
>>>    arch/arm/include/asm/arch-sunxi/i2c.h   | 15 +++++++++++++++
>>>    board/sunxi/board.c                     |  7 +++++++
>>>    drivers/i2c/mvtwsi.c                    | 18 ++++++++++++++++++
>>>    include/configs/sunxi-common.h          |  8 ++++++++
>>>    6 files changed, 59 insertions(+)
>>>    create mode 100644 arch/arm/include/asm/arch-sunxi/i2c.h
[...]
>>> diff --git a/drivers/i2c/mvtwsi.c b/drivers/i2c/mvtwsi.c
>>> index d3457b9..ad1ce8f 100644
>>> --- a/drivers/i2c/mvtwsi.c
>>> +++ b/drivers/i2c/mvtwsi.c
>>> @@ -22,6 +22,8 @@
>>>    #include<asm/arch/orion5x.h>
>>>    #elif defined(CONFIG_KIRKWOOD)
>>>    #include<asm/arch/kirkwood.h>
>>> +#elif defined(CONFIG_SUNXI)
>>> +#include<asm/arch/i2c.h>
>>>    #else
>>>    #error Driver mvtwsi not supported by SoC or board
>>>    #endif
>>> @@ -30,6 +32,20 @@
>>>     * TWSI register structure
>>>     */
>>>
>>> +#ifdef CONFIG_SUNXI
>>> +
>>> +struct  mvtwsi_registers {
>>> +    u32 slave_address;
>>> +    u32 xtnd_slave_addr;
>>> +    u32 data;
>>> +    u32 control;
>>> +    u32 status;
>>> +    u32 baudrate;
>>> +    u32 soft_reset;
>>> +};
>>> +
>>> +#else
>>> +
>>>    struct  mvtwsi_registers {
>>>        u32 slave_address;
>>>        u32 data;
>>> @@ -43,6 +59,8 @@ struct  mvtwsi_registers {
>>>        u32 soft_reset;
>>>    };
>>>
>>> +#endif
>>> +
>>>    /*
>>>     * Control register fields
>>>     */
>>
>> ? Thats all? I thought you convert this driver to the new i2c framework?
>
> I did a separate patch for that:
> "[PATCH 1/5] mvtwsi: convert to CONFIG_SYS_I2C framework"
>
> http://lists.denx.de/pipermail/u-boot/2014-June/181352.html
>
> Which was also send directly to you.
>
>> At least, there should be a change from the i2c_xx() functions to static
>> and a prefix add to them ... and a "U_BOOT_I2C_ADAP_COMPLETE" at the end ...
>
> Yes this is all done in the "[PATCH 1/5] mvtwsi: convert to CONFIG_SYS_I2C framework"
> patch.

Hups... Sorry ... I didn;t find it in my inbox ... so, this patch
seems fine to me:

Acked-by: Heiko Schocher <hs@denx.de>

bye,
Heiko
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [U-Boot] [U-Boot, 1/5] mvtwsi: convert to CONFIG_SYS_I2C framework
  2014-06-09 15:15 ` [U-Boot] [PATCH 1/5] mvtwsi: convert to CONFIG_SYS_I2C framework Hans de Goede
@ 2014-06-10  8:05   ` Heiko Schocher
  2014-06-13 20:52     ` Hans de Goede
  2014-06-10 15:28   ` [U-Boot] [PATCH " Prafulla Wadaskar
  1 sibling, 1 reply; 18+ messages in thread
From: Heiko Schocher @ 2014-06-10  8:05 UTC (permalink / raw)
  To: u-boot

Hello Hans,

Am 09.06.2014 17:15, schrieb Hans de Goede:
> Note this has only been tested on Allwinner sunxi devices (support for which
> gets introduced by a later patch).
>
> The kirkwood changes have been compile tested using the wireless_space board
> config, the orion5x changes have been compile tested using the edminiv2 board
> config.
>
> Signed-off-by: Hans de Goede<hdegoede@redhat.com>
>
> ---
> arch/arm/include/asm/arch-kirkwood/config.h |  3 +-
>   drivers/i2c/Makefile                        |  2 +-
>   drivers/i2c/mvtwsi.c                        | 69 +++++++++++++----------------
>   include/configs/edminiv2.h                  |  3 +-
>   4 files changed, 36 insertions(+), 41 deletions(-)

just a nitpick ...

[...]
> diff --git a/drivers/i2c/mvtwsi.c b/drivers/i2c/mvtwsi.c
> index 5ba0e03..d3457b9 100644
> --- a/drivers/i2c/mvtwsi.c
> +++ b/drivers/i2c/mvtwsi.c
> @@ -220,11 +220,10 @@ static int twsi_stop(int status)
>
>   /*
>    * Reset controller.
> - * Called at end of i2c_init unsuccessful i2c transactions.
>    * Controller reset also resets the baud rate and slave address, so
> - * re-establish them.
> + * they must be re-established afterwards.
>    */
> -static void twsi_reset(u8 baud_rate, u8 slave_address)
> +static void twsi_reset(struct i2c_adapter *adap)
>   {
>   	/* ensure controller will be enabled by any twsi*() function */
>   	twsi_control_flags = MVTWSI_CONTROL_TWSIEN;
> @@ -232,23 +231,17 @@ static void twsi_reset(u8 baud_rate, u8 slave_address)
>   	writel(0,&twsi->soft_reset);
>   	/* wait 2 ms -- this is what the Marvell LSP does */
>   	udelay(20000);
> -	/* set baud rate */
> -	writel(baud_rate,&twsi->baudrate);
> -	/* set slave address even though we don't use it */
> -	writel(slave_address,&twsi->slave_address);
> -	writel(0,&twsi->xtnd_slave_addr);
> -	/* assert STOP but don't care for the result */
> -	(void) twsi_stop(0);
>   }
>
>   /*
>    * I2C init called by cmd_i2c when doing 'i2c reset'.
>    * Sets baud to the highest possible value not exceeding requested one.
>    */
> -void i2c_init(int requested_speed, int slaveadd)
> +static unsigned int twsi_i2c_set_bus_speed(struct i2c_adapter *adap,
> +					   unsigned int requested_speed)
>   {
> -	int	tmp_speed, highest_speed, n, m;
> -	int	baud = 0x44; /* baudrate at controller reset */
> +	unsigned int tmp_speed, highest_speed, n, m;
> +	unsigned int baud = 0x44; /* baudrate at controller reset */
>
>   	/* use actual speed to collect progressively higher values */
>   	highest_speed = 0;
> @@ -263,8 +256,21 @@ void i2c_init(int requested_speed, int slaveadd)
>   			}
>   		}
>   	}
> +	writel(baud,&twsi->baudrate);
> +	return 0;
> +}
> +
> +static void twsi_i2c_init(struct i2c_adapter *adap, int speed, int slaveadd)
> +{
>   	/* reset controller */
> -	twsi_reset(baud, slaveadd);
> +	twsi_reset(adap);
> +	/* set speed */
> +	twsi_i2c_set_bus_speed(adap, speed);
> +	/* set slave address even though we don't use it */
> +	writel(slaveadd,&twsi->slave_address);
> +	writel(0,&twsi->xtnd_slave_addr);
> +	/* assert STOP but don't care for the result */
> +	(void) twsi_stop(0);
>   }
>
>   /*
> @@ -294,7 +300,7 @@ static int i2c_begin(int expected_start_status, u8 addr)
>    * I2C probe called by cmd_i2c when doing 'i2c probe'.
>    * Begin read, nak data byte, end.
>    */
> -int i2c_probe(uchar chip)
> +static int twsi_i2c_probe(struct i2c_adapter *adap, uchar chip)
>   {
>   	u8 dummy_byte;
>   	int status;
> @@ -320,12 +326,13 @@ int i2c_probe(uchar chip)
>    * cmd_eeprom, so we have to choose here, and for the moment that'll be
>    * a repeated start without a preceding stop.
>    */
> -int i2c_read(u8 dev, uint addr, int alen, u8 *data, int length)
> +static int twsi_i2c_read(struct i2c_adapter *adap, uchar chip, uint addr,
> +			int alen, uchar *data, int length)
>   {
>   	int status;
>
>   	/* begin i2c write to send the address bytes */
> -	status = i2c_begin(MVTWSI_STATUS_START, (dev<<  1));
> +	status = i2c_begin(MVTWSI_STATUS_START, (chip<<  1));
>   	/* send addr bytes */
>   	while ((status == 0)&&  alen--)
>   		status = twsi_send(addr>>  (8*alen),
> @@ -333,7 +340,7 @@ int i2c_read(u8 dev, uint addr, int alen, u8 *data, int length)
>   	/* begin i2c read to receive eeprom data bytes */
>   	if (status == 0)
>   		status = i2c_begin(
> -			MVTWSI_STATUS_REPEATED_START, (dev<<  1) | 1);
> +			MVTWSI_STATUS_REPEATED_START, (chip<<  1) | 1);
>   	/* prepare ACK if at least one byte must be received */
>   	if (length>  0)
>   		twsi_control_flags |= MVTWSI_CONTROL_ACK;
> @@ -355,12 +362,13 @@ int i2c_read(u8 dev, uint addr, int alen, u8 *data, int length)
>    * I2C write called by cmd_i2c when doing 'i2c write' and by cmd_eeprom.c
>    * Begin write, send address byte(s), send data bytes, end.
>    */
> -int i2c_write(u8 dev, uint addr, int alen, u8 *data, int length)
> +static int twsi_i2c_write(struct i2c_adapter *adap, uchar chip, uint addr,
> +			int alen, uchar *data, int length)
>   {
>   	int status;
>
>   	/* begin i2c write to send the eeprom adress bytes then data bytes */
> -	status = i2c_begin(MVTWSI_STATUS_START, (dev<<  1));
> +	status = i2c_begin(MVTWSI_STATUS_START, (chip<<  1));
>   	/* send addr bytes */
>   	while ((status == 0)&&  alen--)
>   		status = twsi_send(addr>>  (8*alen),
> @@ -374,21 +382,6 @@ int i2c_write(u8 dev, uint addr, int alen, u8 *data, int length)
>   	return status;
>   }
>
> -/*
> - * Bus set routine: we only support bus 0.
> - */
> -int i2c_set_bus_num(unsigned int bus)
> -{
> -	if (bus>  0) {
> -		return -1;
> -	}
> -	return 0;
> -}
> -
> -/*
> - * Bus get routine: hard-return bus 0.
> - */
> -unsigned int i2c_get_bus_num(void)
> -{
> -	return 0;
> -}
> +U_BOOT_I2C_ADAP_COMPLETE(twsi0, twsi_i2c_init, twsi_i2c_probe,
> +			 twsi_i2c_read, twsi_i2c_write,
> +			 twsi_i2c_set_bus_speed, 100000, 0, 0)
                                                  ^
Should we have here defines for SPEED and SLAVE address ? ...

> diff --git a/include/configs/edminiv2.h b/include/configs/edminiv2.h
> index 8b9f66a..77717a8 100644
> --- a/include/configs/edminiv2.h
> +++ b/include/configs/edminiv2.h
> @@ -187,7 +187,8 @@
>    * I2C related stuff
>    */
>   #ifdef CONFIG_CMD_I2C
> -#define CONFIG_I2C_MVTWSI
> +#define CONFIG_SYS_I2C
> +#define CONFIG_SYS_I2C_MVTWSI
>   #define CONFIG_I2C_MVTWSI_BASE		ORION5X_TWSI_BASE
>   #define CONFIG_SYS_I2C_SLAVE		0x0
>   #define CONFIG_SYS_I2C_SPEED		100000

... and use them here instead CONFIG_SYS_I2C_SLAVE and CONFIG_SYS_I2C_SPEED ?

and please add a description for it in the README.

Beside of that, you can add my:
Acked-by: Heiko Schocher <hs@denx.de>

Thanks!

bye,
Heiko
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [U-Boot] [PATCH 2/5] sunxi: Add i2c support
  2014-06-09 17:13     ` Hans de Goede
@ 2014-06-10 14:18       ` Prafulla Wadaskar
  0 siblings, 0 replies; 18+ messages in thread
From: Prafulla Wadaskar @ 2014-06-10 14:18 UTC (permalink / raw)
  To: u-boot



> -----Original Message-----
> From: Hans de Goede [mailto:hdegoede at redhat.com]
> Sent: 09 June 2014 22:44
> To: Albert ARIBAUD
> Cc: Heiko Schocher; Henrik Nordstr?m; Ian Campbell; u-
> boot at lists.denx.de; Prafulla Wadaskar
> Subject: Re: [PATCH 2/5] sunxi: Add i2c support
> 
> Hi,
> 
> On 06/09/2014 06:09 PM, Albert ARIBAUD wrote:
> > Hi Hans,
> >
> > On Mon,  9 Jun 2014 17:15:27 +0200, Hans de Goede
> <hdegoede@redhat.com>
> > wrote:
> >
> >> Add support for the i2c controller found on all
> Allwinner sunxi SoCs,
> >> this is the same controller as found on the Marvell
> orion5x and kirkwood
> >> SoC families, with a slightly different register
> layout, so this patch uses
> >> the existing mvtwsi code.
> >
> > Should not affect orion or kirkwood, since you're
> just adding a
> > variant to the "include switch case" where it was
> intended; but just in
> > case, I'm Cc:ing Prafulla here.
> 
> Ah, good idea, thanks. Prafulla, this patch indeed does
> not affect
> orion or kirkwood, but the previous patch in the series
> does, if you
> could review and/or test it that would be great. And
> sorry for not
> CC-ing you on that patch from the get go.

That's okay Hans

> 
> Regards,
> 
> Hans
> 
> >
> >> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> >> Acked-by: Ian Campbell <ijc@hellion.org.uk>
> >> ---
> >>   arch/arm/cpu/armv7/sunxi/board.c        |  6
> ++++++
> >>   arch/arm/cpu/armv7/sunxi/u-boot-spl.lds |  5 +++++
> >>   arch/arm/include/asm/arch-sunxi/i2c.h   | 15
> +++++++++++++++
> >>   board/sunxi/board.c                     |  7
> +++++++
> >>   drivers/i2c/mvtwsi.c                    | 18
> ++++++++++++++++++
> >>   include/configs/sunxi-common.h          |  8
> ++++++++
> >>   6 files changed, 59 insertions(+)
> >>   create mode 100644 arch/arm/include/asm/arch-
> sunxi/i2c.h
> >>
> >> diff --git a/arch/arm/cpu/armv7/sunxi/board.c
> b/arch/arm/cpu/armv7/sunxi/board.c
> >> index 1e506b5..024c8c1 100644
> >> --- a/arch/arm/cpu/armv7/sunxi/board.c
> >> +++ b/arch/arm/cpu/armv7/sunxi/board.c
> >> @@ -11,6 +11,7 @@
> >>    */
> >>
> >>   #include <common.h>
> >> +#include <i2c.h>
> >>   #include <netdev.h>
> >>   #include <miiphy.h>
> >>   #include <serial.h>
> >> @@ -91,11 +92,16 @@ void s_init(void)
> >>   	clock_init();
> >>   	timer_init();
> >>   	gpio_init();
> >> +	i2c_init_board();
> >>
> >>   #ifdef CONFIG_SPL_BUILD
> >>   	gd = &gdata;
> >>   	preloader_console_init();
> >>
> >> +#ifdef CONFIG_SPL_I2C_SUPPORT
> >> +	/* Needed early by sunxi_board_init if PMU is
> enabled */
> >> +	i2c_init(CONFIG_SYS_I2C_SPEED,
> CONFIG_SYS_I2C_SLAVE);
> >> +#endif
> >>   	sunxi_board_init();
> >>   #endif
> >>   }
> >> diff --git a/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds
> b/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds
> >> index c1ae227..53f0cbd 100644
> >> --- a/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds
> >> +++ b/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds
> >> @@ -39,6 +39,11 @@ SECTIONS
> >>   	.data : { *(SORT_BY_ALIGNMENT(.data*)) } >.sram
> >>
> >>   	. = ALIGN(4);
> >> +	.u_boot_list : {
> >> +		KEEP(*(SORT(.u_boot_list*)));
> >> +	} > .sram
> >> +
> >> +	. = ALIGN(4);
> >
> > This adds the U-Boot commands section to an SPL
> linker script, which
> > seems to imply it was not there before. Are you
> actually adding command
> > line to the SPL of this board family?
> >
> >>   	__image_copy_end = .;
> >>   	_end = .;
> >>
> >> diff --git a/arch/arm/include/asm/arch-sunxi/i2c.h
> b/arch/arm/include/asm/arch-sunxi/i2c.h
> >> new file mode 100644
> >> index 0000000..dc5406b
> >> --- /dev/null
> >> +++ b/arch/arm/include/asm/arch-sunxi/i2c.h
> >> @@ -0,0 +1,15 @@
> >> +/*
> >> + * Copyright 2014 - Hans de Goede
> <hdegoede@redhat.com>
> >> + *
> >> + * SPDX-License-Identifier:	GPL-2.0+
> >> + */
> >> +#ifndef _SUNXI_I2C_H_
> >> +#define _SUNXI_I2C_H_
> >> +
> >> +#include <asm/arch/cpu.h>
> >> +
> >> +#define CONFIG_I2C_MVTWSI_BASE	SUNXI_TWI0_BASE
> >> +/* This is abp0-clk on sun4i/5i/7i / abp1-clk on
> sun6i/sun8i which is 24MHz */
> >> +#define CONFIG_SYS_TCLK		24000000
> >> +
> >> +#endif
> >> diff --git a/board/sunxi/board.c
> b/board/sunxi/board.c
> >> index b05d0b9..543b809 100644
> >> --- a/board/sunxi/board.c
> >> +++ b/board/sunxi/board.c
> >> @@ -106,6 +106,13 @@ int board_mmc_init(bd_t *bis)
> >>   }
> >>   #endif
> >>
> >> +void i2c_init_board(void)
> >> +{
> >> +	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);
> >> +}
> >> +
> >>   #ifdef CONFIG_SPL_BUILD
> >>   void sunxi_board_init(void)
> >>   {
> >> diff --git a/drivers/i2c/mvtwsi.c
> b/drivers/i2c/mvtwsi.c
> >> index d3457b9..ad1ce8f 100644
> >> --- a/drivers/i2c/mvtwsi.c
> >> +++ b/drivers/i2c/mvtwsi.c
> >> @@ -22,6 +22,8 @@
> >>   #include <asm/arch/orion5x.h>
> >>   #elif defined(CONFIG_KIRKWOOD)
> >>   #include <asm/arch/kirkwood.h>
> >> +#elif defined(CONFIG_SUNXI)
> >> +#include <asm/arch/i2c.h>
> >>   #else
> >>   #error Driver mvtwsi not supported by SoC or board
> >>   #endif
> >> @@ -30,6 +32,20 @@
> >>    * TWSI register structure
> >>    */
> >>
> >> +#ifdef CONFIG_SUNXI
> >> +
> >> +struct  mvtwsi_registers {
> >> +	u32 slave_address;
> >> +	u32 xtnd_slave_addr;
> >> +	u32 data;
> >> +	u32 control;
> >> +	u32 status;
> >> +	u32 baudrate;
> >> +	u32 soft_reset;
> >> +};
> >> +
> >> +#else
> >> +
> >>   struct  mvtwsi_registers {
> >>   	u32 slave_address;
> >>   	u32 data;
> >> @@ -43,6 +59,8 @@ struct  mvtwsi_registers {
> >>   	u32 soft_reset;
> >>   };
> >>
> >> +#endif
> >> +
> >>   /*
> >>    * Control register fields
> >>    */

I ack the changes to this file in this patch.
Acked-By: Prafulla Wadaskar <prafulla@marvell.com>

Regards...
Prafulla . . .

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [U-Boot] [PATCH 1/5] mvtwsi: convert to CONFIG_SYS_I2C framework
  2014-06-09 15:15 ` [U-Boot] [PATCH 1/5] mvtwsi: convert to CONFIG_SYS_I2C framework Hans de Goede
  2014-06-10  8:05   ` [U-Boot] [U-Boot, " Heiko Schocher
@ 2014-06-10 15:28   ` Prafulla Wadaskar
  1 sibling, 0 replies; 18+ messages in thread
From: Prafulla Wadaskar @ 2014-06-10 15:28 UTC (permalink / raw)
  To: u-boot



> -----Original Message-----
> From: u-boot-bounces at lists.denx.de [mailto:u-boot-
> bounces at lists.denx.de] On Behalf Of Hans de Goede
> Sent: 09 June 2014 20:45
> To: Albert ARIBAUD; Heiko Schocher
> Cc: u-boot at lists.denx.de; Ian Campbell
> Subject: [U-Boot] [PATCH 1/5] mvtwsi: convert to
> CONFIG_SYS_I2C framework
> 
> Note this has only been tested on Allwinner sunxi
> devices (support for which
> gets introduced by a later patch).
> 
> The kirkwood changes have been compile tested using the
> wireless_space board
> config, the orion5x changes have been compile tested
> using the edminiv2 board
> config.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>  arch/arm/include/asm/arch-kirkwood/config.h |  3 +-
>  drivers/i2c/Makefile                        |  2 +-
>  drivers/i2c/mvtwsi.c                        | 69
> +++++++++++++----------------
>  include/configs/edminiv2.h                  |  3 +-
>  4 files changed, 36 insertions(+), 41 deletions(-)
> 
> diff --git a/arch/arm/include/asm/arch-
> kirkwood/config.h b/arch/arm/include/asm/arch-
> kirkwood/config.h
> index 7a688e4..f7bfa0e 100644
> --- a/arch/arm/include/asm/arch-kirkwood/config.h
> +++ b/arch/arm/include/asm/arch-kirkwood/config.h
> @@ -129,7 +129,8 @@
>   */
>  #ifdef CONFIG_CMD_I2C
>  #ifndef CONFIG_SYS_I2C_SOFT
> -#define CONFIG_I2C_MVTWSI
> +#define CONFIG_SYS_I2C
> +#define CONFIG_SYS_I2C_MVTWSI

These are bit risky changes, I hope it do not break the compatibility with other boards like guruplug, openrd and so on...

Unfortunately I do not have boards to validate..

So please kindly make sure you test them well.

Regards...
Prafulla . . .

>  #endif
>  #define CONFIG_SYS_I2C_SLAVE		0x0
>  #define CONFIG_SYS_I2C_SPEED		100000
> diff --git a/drivers/i2c/Makefile
> b/drivers/i2c/Makefile
> index e33586d..61e9f3c 100644
> --- a/drivers/i2c/Makefile
> +++ b/drivers/i2c/Makefile
> @@ -7,7 +7,6 @@
> 
>  obj-$(CONFIG_BFIN_TWI_I2C) += bfin-twi_i2c.o
>  obj-$(CONFIG_DW_I2C) += designware_i2c.o
> -obj-$(CONFIG_I2C_MVTWSI) += mvtwsi.o
>  obj-$(CONFIG_I2C_MV) += mv_i2c.o
>  obj-$(CONFIG_I2C_MXS) += mxs_i2c.o
>  obj-$(CONFIG_PCA9564_I2C) += pca9564_i2c.o
> @@ -19,6 +18,7 @@ obj-$(CONFIG_SYS_I2C_DAVINCI) +=
> davinci_i2c.o
>  obj-$(CONFIG_SYS_I2C_FSL) += fsl_i2c.o
>  obj-$(CONFIG_SYS_I2C_FTI2C010) += fti2c010.o
>  obj-$(CONFIG_SYS_I2C_KONA) += kona_i2c.o
> +obj-$(CONFIG_SYS_I2C_MVTWSI) += mvtwsi.o
>  obj-$(CONFIG_SYS_I2C_MXC) += mxc_i2c.o
>  obj-$(CONFIG_SYS_I2C_OMAP24XX) += omap24xx_i2c.o
>  obj-$(CONFIG_SYS_I2C_OMAP34XX) += omap24xx_i2c.o
> diff --git a/drivers/i2c/mvtwsi.c
> b/drivers/i2c/mvtwsi.c
> index 5ba0e03..d3457b9 100644
> --- a/drivers/i2c/mvtwsi.c
> +++ b/drivers/i2c/mvtwsi.c
> @@ -220,11 +220,10 @@ static int twsi_stop(int status)
> 
>  /*
>   * Reset controller.
> - * Called at end of i2c_init unsuccessful i2c
> transactions.
>   * Controller reset also resets the baud rate and
> slave address, so
> - * re-establish them.
> + * they must be re-established afterwards.
>   */
> -static void twsi_reset(u8 baud_rate, u8 slave_address)
> +static void twsi_reset(struct i2c_adapter *adap)
>  {
>  	/* ensure controller will be enabled by any twsi*()
> function */
>  	twsi_control_flags = MVTWSI_CONTROL_TWSIEN;
> @@ -232,23 +231,17 @@ static void twsi_reset(u8
> baud_rate, u8 slave_address)
>  	writel(0, &twsi->soft_reset);
>  	/* wait 2 ms -- this is what the Marvell LSP does
> */
>  	udelay(20000);
> -	/* set baud rate */
> -	writel(baud_rate, &twsi->baudrate);
> -	/* set slave address even though we don't use it */
> -	writel(slave_address, &twsi->slave_address);
> -	writel(0, &twsi->xtnd_slave_addr);
> -	/* assert STOP but don't care for the result */
> -	(void) twsi_stop(0);
>  }
> 
>  /*
>   * I2C init called by cmd_i2c when doing 'i2c reset'.
>   * Sets baud to the highest possible value not
> exceeding requested one.
>   */
> -void i2c_init(int requested_speed, int slaveadd)
> +static unsigned int twsi_i2c_set_bus_speed(struct
> i2c_adapter *adap,
> +					   unsigned int requested_speed)
>  {
> -	int	tmp_speed, highest_speed, n, m;
> -	int	baud = 0x44; /* baudrate at controller reset */
> +	unsigned int tmp_speed, highest_speed, n, m;
> +	unsigned int baud = 0x44; /* baudrate at controller
> reset */
> 
>  	/* use actual speed to collect progressively higher
> values */
>  	highest_speed = 0;
> @@ -263,8 +256,21 @@ void i2c_init(int requested_speed,
> int slaveadd)
>  			}
>  		}
>  	}
> +	writel(baud, &twsi->baudrate);
> +	return 0;
> +}
> +
> +static void twsi_i2c_init(struct i2c_adapter *adap,
> int speed, int slaveadd)
> +{
>  	/* reset controller */
> -	twsi_reset(baud, slaveadd);
> +	twsi_reset(adap);
> +	/* set speed */
> +	twsi_i2c_set_bus_speed(adap, speed);
> +	/* set slave address even though we don't use it */
> +	writel(slaveadd, &twsi->slave_address);
> +	writel(0, &twsi->xtnd_slave_addr);
> +	/* assert STOP but don't care for the result */
> +	(void) twsi_stop(0);
>  }
> 
>  /*
> @@ -294,7 +300,7 @@ static int i2c_begin(int
> expected_start_status, u8 addr)
>   * I2C probe called by cmd_i2c when doing 'i2c probe'.
>   * Begin read, nak data byte, end.
>   */
> -int i2c_probe(uchar chip)
> +static int twsi_i2c_probe(struct i2c_adapter *adap,
> uchar chip)
>  {
>  	u8 dummy_byte;
>  	int status;
> @@ -320,12 +326,13 @@ int i2c_probe(uchar chip)
>   * cmd_eeprom, so we have to choose here, and for the
> moment that'll be
>   * a repeated start without a preceding stop.
>   */
> -int i2c_read(u8 dev, uint addr, int alen, u8 *data,
> int length)
> +static int twsi_i2c_read(struct i2c_adapter *adap,
> uchar chip, uint addr,
> +			int alen, uchar *data, int length)
>  {
>  	int status;
> 
>  	/* begin i2c write to send the address bytes */
> -	status = i2c_begin(MVTWSI_STATUS_START, (dev <<
> 1));
> +	status = i2c_begin(MVTWSI_STATUS_START, (chip <<
> 1));
>  	/* send addr bytes */
>  	while ((status == 0) && alen--)
>  		status = twsi_send(addr >> (8*alen),
> @@ -333,7 +340,7 @@ int i2c_read(u8 dev, uint addr, int
> alen, u8 *data, int length)
>  	/* begin i2c read to receive eeprom data bytes */
>  	if (status == 0)
>  		status = i2c_begin(
> -			MVTWSI_STATUS_REPEATED_START, (dev << 1) |
> 1);
> +			MVTWSI_STATUS_REPEATED_START, (chip << 1) |
> 1);
>  	/* prepare ACK if at least one byte must be
> received */
>  	if (length > 0)
>  		twsi_control_flags |= MVTWSI_CONTROL_ACK;
> @@ -355,12 +362,13 @@ int i2c_read(u8 dev, uint addr,
> int alen, u8 *data, int length)
>   * I2C write called by cmd_i2c when doing 'i2c write'
> and by cmd_eeprom.c
>   * Begin write, send address byte(s), send data bytes,
> end.
>   */
> -int i2c_write(u8 dev, uint addr, int alen, u8 *data,
> int length)
> +static int twsi_i2c_write(struct i2c_adapter *adap,
> uchar chip, uint addr,
> +			int alen, uchar *data, int length)
>  {
>  	int status;
> 
>  	/* begin i2c write to send the eeprom adress bytes
> then data bytes */
> -	status = i2c_begin(MVTWSI_STATUS_START, (dev <<
> 1));
> +	status = i2c_begin(MVTWSI_STATUS_START, (chip <<
> 1));
>  	/* send addr bytes */
>  	while ((status == 0) && alen--)
>  		status = twsi_send(addr >> (8*alen),
> @@ -374,21 +382,6 @@ int i2c_write(u8 dev, uint addr,
> int alen, u8 *data, int length)
>  	return status;
>  }
> 
> -/*
> - * Bus set routine: we only support bus 0.
> - */
> -int i2c_set_bus_num(unsigned int bus)
> -{
> -	if (bus > 0) {
> -		return -1;
> -	}
> -	return 0;
> -}
> -
> -/*
> - * Bus get routine: hard-return bus 0.
> - */
> -unsigned int i2c_get_bus_num(void)
> -{
> -	return 0;
> -}
> +U_BOOT_I2C_ADAP_COMPLETE(twsi0, twsi_i2c_init,
> twsi_i2c_probe,
> +			 twsi_i2c_read, twsi_i2c_write,
> +			 twsi_i2c_set_bus_speed, 100000, 0, 0)
> diff --git a/include/configs/edminiv2.h
> b/include/configs/edminiv2.h
> index 8b9f66a..77717a8 100644
> --- a/include/configs/edminiv2.h
> +++ b/include/configs/edminiv2.h
> @@ -187,7 +187,8 @@
>   * I2C related stuff
>   */
>  #ifdef CONFIG_CMD_I2C
> -#define CONFIG_I2C_MVTWSI
> +#define CONFIG_SYS_I2C
> +#define CONFIG_SYS_I2C_MVTWSI
>  #define CONFIG_I2C_MVTWSI_BASE		ORION5X_TWSI_BASE
>  #define CONFIG_SYS_I2C_SLAVE		0x0
>  #define CONFIG_SYS_I2C_SPEED		100000
> --
> 2.0.0
> 
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [U-Boot] [U-Boot, 1/5] mvtwsi: convert to CONFIG_SYS_I2C framework
  2014-06-10  8:05   ` [U-Boot] [U-Boot, " Heiko Schocher
@ 2014-06-13 20:52     ` Hans de Goede
  0 siblings, 0 replies; 18+ messages in thread
From: Hans de Goede @ 2014-06-13 20:52 UTC (permalink / raw)
  To: u-boot

Hi,

On 06/10/2014 10:05 AM, Heiko Schocher wrote:
> Hello Hans,
>
> Am 09.06.2014 17:15, schrieb Hans de Goede:
>> Note this has only been tested on Allwinner sunxi devices (support for which
>> gets introduced by a later patch).
>>
>> The kirkwood changes have been compile tested using the wireless_space board
>> config, the orion5x changes have been compile tested using the edminiv2 board
>> config.
>>
>> Signed-off-by: Hans de Goede<hdegoede@redhat.com>
>>
>> ---
>> arch/arm/include/asm/arch-kirkwood/config.h |  3 +-
>>   drivers/i2c/Makefile                        |  2 +-
>>   drivers/i2c/mvtwsi.c                        | 69 +++++++++++++----------------
>>   include/configs/edminiv2.h                  |  3 +-
>>   4 files changed, 36 insertions(+), 41 deletions(-)
>
> just a nitpick ...
>
> [...]
>> diff --git a/drivers/i2c/mvtwsi.c b/drivers/i2c/mvtwsi.c
>> index 5ba0e03..d3457b9 100644
>> --- a/drivers/i2c/mvtwsi.c
>> +++ b/drivers/i2c/mvtwsi.c
>> @@ -220,11 +220,10 @@ static int twsi_stop(int status)
>>
>>   /*
>>    * Reset controller.
>> - * Called at end of i2c_init unsuccessful i2c transactions.
>>    * Controller reset also resets the baud rate and slave address, so
>> - * re-establish them.
>> + * they must be re-established afterwards.
>>    */
>> -static void twsi_reset(u8 baud_rate, u8 slave_address)
>> +static void twsi_reset(struct i2c_adapter *adap)
>>   {
>>       /* ensure controller will be enabled by any twsi*() function */
>>       twsi_control_flags = MVTWSI_CONTROL_TWSIEN;
>> @@ -232,23 +231,17 @@ static void twsi_reset(u8 baud_rate, u8 slave_address)
>>       writel(0,&twsi->soft_reset);
>>       /* wait 2 ms -- this is what the Marvell LSP does */
>>       udelay(20000);
>> -    /* set baud rate */
>> -    writel(baud_rate,&twsi->baudrate);
>> -    /* set slave address even though we don't use it */
>> -    writel(slave_address,&twsi->slave_address);
>> -    writel(0,&twsi->xtnd_slave_addr);
>> -    /* assert STOP but don't care for the result */
>> -    (void) twsi_stop(0);
>>   }
>>
>>   /*
>>    * I2C init called by cmd_i2c when doing 'i2c reset'.
>>    * Sets baud to the highest possible value not exceeding requested one.
>>    */
>> -void i2c_init(int requested_speed, int slaveadd)
>> +static unsigned int twsi_i2c_set_bus_speed(struct i2c_adapter *adap,
>> +                       unsigned int requested_speed)
>>   {
>> -    int    tmp_speed, highest_speed, n, m;
>> -    int    baud = 0x44; /* baudrate at controller reset */
>> +    unsigned int tmp_speed, highest_speed, n, m;
>> +    unsigned int baud = 0x44; /* baudrate at controller reset */
>>
>>       /* use actual speed to collect progressively higher values */
>>       highest_speed = 0;
>> @@ -263,8 +256,21 @@ void i2c_init(int requested_speed, int slaveadd)
>>               }
>>           }
>>       }
>> +    writel(baud,&twsi->baudrate);
>> +    return 0;
>> +}
>> +
>> +static void twsi_i2c_init(struct i2c_adapter *adap, int speed, int slaveadd)
>> +{
>>       /* reset controller */
>> -    twsi_reset(baud, slaveadd);
>> +    twsi_reset(adap);
>> +    /* set speed */
>> +    twsi_i2c_set_bus_speed(adap, speed);
>> +    /* set slave address even though we don't use it */
>> +    writel(slaveadd,&twsi->slave_address);
>> +    writel(0,&twsi->xtnd_slave_addr);
>> +    /* assert STOP but don't care for the result */
>> +    (void) twsi_stop(0);
>>   }
>>
>>   /*
>> @@ -294,7 +300,7 @@ static int i2c_begin(int expected_start_status, u8 addr)
>>    * I2C probe called by cmd_i2c when doing 'i2c probe'.
>>    * Begin read, nak data byte, end.
>>    */
>> -int i2c_probe(uchar chip)
>> +static int twsi_i2c_probe(struct i2c_adapter *adap, uchar chip)
>>   {
>>       u8 dummy_byte;
>>       int status;
>> @@ -320,12 +326,13 @@ int i2c_probe(uchar chip)
>>    * cmd_eeprom, so we have to choose here, and for the moment that'll be
>>    * a repeated start without a preceding stop.
>>    */
>> -int i2c_read(u8 dev, uint addr, int alen, u8 *data, int length)
>> +static int twsi_i2c_read(struct i2c_adapter *adap, uchar chip, uint addr,
>> +            int alen, uchar *data, int length)
>>   {
>>       int status;
>>
>>       /* begin i2c write to send the address bytes */
>> -    status = i2c_begin(MVTWSI_STATUS_START, (dev<<  1));
>> +    status = i2c_begin(MVTWSI_STATUS_START, (chip<<  1));
>>       /* send addr bytes */
>>       while ((status == 0)&&  alen--)
>>           status = twsi_send(addr>>  (8*alen),
>> @@ -333,7 +340,7 @@ int i2c_read(u8 dev, uint addr, int alen, u8 *data, int length)
>>       /* begin i2c read to receive eeprom data bytes */
>>       if (status == 0)
>>           status = i2c_begin(
>> -            MVTWSI_STATUS_REPEATED_START, (dev<<  1) | 1);
>> +            MVTWSI_STATUS_REPEATED_START, (chip<<  1) | 1);
>>       /* prepare ACK if at least one byte must be received */
>>       if (length>  0)
>>           twsi_control_flags |= MVTWSI_CONTROL_ACK;
>> @@ -355,12 +362,13 @@ int i2c_read(u8 dev, uint addr, int alen, u8 *data, int length)
>>    * I2C write called by cmd_i2c when doing 'i2c write' and by cmd_eeprom.c
>>    * Begin write, send address byte(s), send data bytes, end.
>>    */
>> -int i2c_write(u8 dev, uint addr, int alen, u8 *data, int length)
>> +static int twsi_i2c_write(struct i2c_adapter *adap, uchar chip, uint addr,
>> +            int alen, uchar *data, int length)
>>   {
>>       int status;
>>
>>       /* begin i2c write to send the eeprom adress bytes then data bytes */
>> -    status = i2c_begin(MVTWSI_STATUS_START, (dev<<  1));
>> +    status = i2c_begin(MVTWSI_STATUS_START, (chip<<  1));
>>       /* send addr bytes */
>>       while ((status == 0)&&  alen--)
>>           status = twsi_send(addr>>  (8*alen),
>> @@ -374,21 +382,6 @@ int i2c_write(u8 dev, uint addr, int alen, u8 *data, int length)
>>       return status;
>>   }
>>
>> -/*
>> - * Bus set routine: we only support bus 0.
>> - */
>> -int i2c_set_bus_num(unsigned int bus)
>> -{
>> -    if (bus>  0) {
>> -        return -1;
>> -    }
>> -    return 0;
>> -}
>> -
>> -/*
>> - * Bus get routine: hard-return bus 0.
>> - */
>> -unsigned int i2c_get_bus_num(void)
>> -{
>> -    return 0;
>> -}
>> +U_BOOT_I2C_ADAP_COMPLETE(twsi0, twsi_i2c_init, twsi_i2c_probe,
>> +             twsi_i2c_read, twsi_i2c_write,
>> +             twsi_i2c_set_bus_speed, 100000, 0, 0)
>                                                   ^
> Should we have here defines for SPEED and SLAVE address ? ...

I copied this from tegra, but I see that all other converted drivers
use CONFIG_SYS_I2C_SPEED and CONFIG_SYS_I2C_SLAVE here, will fix
for v2.

>
>> diff --git a/include/configs/edminiv2.h b/include/configs/edminiv2.h
>> index 8b9f66a..77717a8 100644
>> --- a/include/configs/edminiv2.h
>> +++ b/include/configs/edminiv2.h
>> @@ -187,7 +187,8 @@
>>    * I2C related stuff
>>    */
>>   #ifdef CONFIG_CMD_I2C
>> -#define CONFIG_I2C_MVTWSI
>> +#define CONFIG_SYS_I2C
>> +#define CONFIG_SYS_I2C_MVTWSI
>>   #define CONFIG_I2C_MVTWSI_BASE        ORION5X_TWSI_BASE
>>   #define CONFIG_SYS_I2C_SLAVE        0x0
>>   #define CONFIG_SYS_I2C_SPEED        100000
>
> ... and use them here instead CONFIG_SYS_I2C_SLAVE and CONFIG_SYS_I2C_SPEED ?

Since mvtwsi.c only supports a single host (for now at least), and
since the existing kirkwood and orion code already use
the standard CONFIG_SYS_I2C_SLAVE and CONFIG_SYS_I2C_SPEED
defines I've opted to simply go with those instead of adding
mvtwsi specific defines.

v2 of this set coming up.


>
> and please add a description for it in the README.
>
> Beside of that, you can add my:
> Acked-by: Heiko Schocher <hs@denx.de>

Regards,

Hans

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2014-06-13 20:52 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-09 15:15 [U-Boot] [PATCH 0/5] sunxi: i2c and pmic support Hans de Goede
2014-06-09 15:15 ` [U-Boot] [PATCH 1/5] mvtwsi: convert to CONFIG_SYS_I2C framework Hans de Goede
2014-06-10  8:05   ` [U-Boot] [U-Boot, " Heiko Schocher
2014-06-13 20:52     ` Hans de Goede
2014-06-10 15:28   ` [U-Boot] [PATCH " Prafulla Wadaskar
2014-06-09 15:15 ` [U-Boot] [PATCH 2/5] sunxi: Add i2c support Hans de Goede
2014-06-09 16:09   ` Albert ARIBAUD
2014-06-09 17:13     ` Hans de Goede
2014-06-10 14:18       ` Prafulla Wadaskar
2014-06-10  6:33   ` Heiko Schocher
2014-06-10  7:44     ` Hans de Goede
2014-06-10  7:53       ` Heiko Schocher
2014-06-09 15:15 ` [U-Boot] [PATCH 3/5] sunxi: Add axp209 pmic support Hans de Goede
2014-06-09 18:22   ` Ian Campbell
2014-06-09 15:15 ` [U-Boot] [PATCH 4/5] sunxi: Add axp152 " Hans de Goede
2014-06-09 18:22   ` Ian Campbell
2014-06-09 15:15 ` [U-Boot] [PATCH 5/5] sunxi: Fix reset hang on sun5i Hans de Goede
2014-06-09 18:23   ` Ian Campbell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.