public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v3 0/3] imx: mx6slevk add pmic support
@ 2015-02-12  1:36 Peng Fan
  2015-02-12  1:36 ` [U-Boot] [PATCH v3 1/3] imx:mx6sl add I2c pad settings Peng Fan
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Peng Fan @ 2015-02-12  1:36 UTC (permalink / raw)
  To: u-boot

This patch set is extracted from the previous "imx:mx6 add ldo bypass"
patch set, with only one return value change.

patch 1/3 is add pad settings for I2C1
patch 2/3 is add I2C and PMIC support in board header file
patch 3/3 is to add pmic support for mx6slevk.

patch 3/3 is from patch 3/12 in previous "imx:mx6 add ldo bypass" patch,
with only one small change is return value.

Changes v3:
 Take Fabio's suggestion, for patch 3/3, remove ret variable, and directly
 "return pfuze_mode_init(xxx)"

Changes v2:
 Changing "return -EIO" to "return ret".

Peng Fan (3):
  imx:mx6sl add I2c pad settings
  imx:mx6slevk add pmic and i2c configuration
  imx:mx6slevk implement power init board

 arch/arm/include/asm/arch-mx6/mx6sl_pins.h |  5 ++++
 board/freescale/mx6slevk/mx6slevk.c        | 42 ++++++++++++++++++++++++++++++
 include/configs/mx6slevk.h                 | 12 +++++++++
 3 files changed, 59 insertions(+)

-- 
1.8.4

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

* [U-Boot] [PATCH v3 1/3] imx:mx6sl add I2c pad settings
  2015-02-12  1:36 [U-Boot] [PATCH v3 0/3] imx: mx6slevk add pmic support Peng Fan
@ 2015-02-12  1:36 ` Peng Fan
  2015-02-23  8:19   ` Stefano Babic
  2015-02-12  1:36 ` [U-Boot] [PATCH v3 2/3] imx:mx6slevk add pmic and i2c configuration Peng Fan
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Peng Fan @ 2015-02-12  1:36 UTC (permalink / raw)
  To: u-boot

A few pad settings are I2C1

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
---
 arch/arm/include/asm/arch-mx6/mx6sl_pins.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/include/asm/arch-mx6/mx6sl_pins.h b/arch/arm/include/asm/arch-mx6/mx6sl_pins.h
index 9ded3d8..0475203 100644
--- a/arch/arm/include/asm/arch-mx6/mx6sl_pins.h
+++ b/arch/arm/include/asm/arch-mx6/mx6sl_pins.h
@@ -58,5 +58,10 @@ enum {
 
 	MX6_PAD_KEY_COL4__USB_USBOTG1_PWR			= IOMUX_PAD(0x0484, 0x017C, 6, 0x0000, 0, 0),
 	MX6_PAD_KEY_COL5__USB_USBOTG2_PWR			= IOMUX_PAD(0x0488, 0x0180, 6, 0x0000, 0, 0),
+
+	MX6_PAD_I2C1_SDA__I2C1_SDA				= IOMUX_PAD(0x0450, 0x0160, 0x10, 0x0720, 2, 0),
+	MX6_PAD_I2C1_SDA__GPIO_3_13				= IOMUX_PAD(0x0450, 0x0160, 5, 0x0000, 0, 0),
+	MX6_PAD_I2C1_SCL__I2C1_SCL				= IOMUX_PAD(0x044C, 0x015C, 0x10, 0x071C, 2, 0),
+	MX6_PAD_I2C1_SCL__GPIO_3_12				= IOMUX_PAD(0x044C, 0x015C, 5, 0x0000, 0, 0),
 };
 #endif	/* __ASM_ARCH_MX6_MX6SL_PINS_H__ */
-- 
1.8.4

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

* [U-Boot] [PATCH v3 2/3] imx:mx6slevk add pmic and i2c configuration
  2015-02-12  1:36 [U-Boot] [PATCH v3 0/3] imx: mx6slevk add pmic support Peng Fan
  2015-02-12  1:36 ` [U-Boot] [PATCH v3 1/3] imx:mx6sl add I2c pad settings Peng Fan
@ 2015-02-12  1:36 ` Peng Fan
  2015-02-23  8:18   ` Stefano Babic
  2015-02-12  1:36 ` [U-Boot] [PATCH v3 3/3] imx:mx6slevk implement power init board Peng Fan
  2015-02-12 10:37 ` [U-Boot] [PATCH v3 0/3] imx: mx6slevk add pmic support Stefano Babic
  3 siblings, 1 reply; 8+ messages in thread
From: Peng Fan @ 2015-02-12  1:36 UTC (permalink / raw)
  To: u-boot

Add pmic and i2c configuration in board header file.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
---
 include/configs/mx6slevk.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/include/configs/mx6slevk.h b/include/configs/mx6slevk.h
index c567d9d..1221418 100644
--- a/include/configs/mx6slevk.h
+++ b/include/configs/mx6slevk.h
@@ -48,6 +48,18 @@
 #define CONFIG_CMD_FAT
 #define CONFIG_DOS_PARTITION
 
+/* I2C Configs */
+#define CONFIG_CMD_I2C
+#define CONFIG_SYS_I2C
+#define CONFIG_SYS_I2C_MXC
+#define CONFIG_SYS_I2C_SPEED		  100000
+
+/* PMIC */
+#define CONFIG_POWER
+#define CONFIG_POWER_I2C
+#define CONFIG_POWER_PFUZE100
+#define CONFIG_POWER_PFUZE100_I2C_ADDR	0x08
+
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_DHCP
 #define CONFIG_CMD_MII
-- 
1.8.4

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

* [U-Boot] [PATCH v3 3/3] imx:mx6slevk implement power init board
  2015-02-12  1:36 [U-Boot] [PATCH v3 0/3] imx: mx6slevk add pmic support Peng Fan
  2015-02-12  1:36 ` [U-Boot] [PATCH v3 1/3] imx:mx6sl add I2c pad settings Peng Fan
  2015-02-12  1:36 ` [U-Boot] [PATCH v3 2/3] imx:mx6slevk add pmic and i2c configuration Peng Fan
@ 2015-02-12  1:36 ` Peng Fan
  2015-02-23  8:18   ` Stefano Babic
  2015-02-12 10:37 ` [U-Boot] [PATCH v3 0/3] imx: mx6slevk add pmic support Stefano Babic
  3 siblings, 1 reply; 8+ messages in thread
From: Peng Fan @ 2015-02-12  1:36 UTC (permalink / raw)
  To: u-boot

Implement power_init_board and related I2C interface configuration.

After adding this, uboot can successfully detect and configure pmic.

"
U-Boot 2015.01-00281-ge29eddf (Feb 12 2015 - 09:24:01)

CPU:   Freescale i.MX6SL rev1.0 at 396 MHz
Reset cause: POR
Board: MX6SLEVK
I2C:   ready
DRAM:  1 GiB
PMIC:  PFUZE100 ID=0x10
MMC:   FSL_SDHC: 0, FSL_SDHC: 1, FSL_SDHC: 2
"

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
---
 board/freescale/mx6slevk/mx6slevk.c | 42 +++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/board/freescale/mx6slevk/mx6slevk.c b/board/freescale/mx6slevk/mx6slevk.c
index 838ea6c..c65f72b 100644
--- a/board/freescale/mx6slevk/mx6slevk.c
+++ b/board/freescale/mx6slevk/mx6slevk.c
@@ -13,13 +13,18 @@
 #include <asm/arch/sys_proto.h>
 #include <asm/gpio.h>
 #include <asm/imx-common/iomux-v3.h>
+#include <asm/imx-common/mxc_i2c.h>
 #include <asm/imx-common/spi.h>
 #include <asm/io.h>
 #include <linux/sizes.h>
 #include <common.h>
 #include <fsl_esdhc.h>
+#include <i2c.h>
 #include <mmc.h>
 #include <netdev.h>
+#include <power/pmic.h>
+#include <power/pfuze100_pmic.h>
+#include "../common/pfuze.h"
 #include <usb.h>
 #include <usb/ehci-fsl.h>
 
@@ -40,6 +45,11 @@ DECLARE_GLOBAL_DATA_PTR;
 #define SPI_PAD_CTRL (PAD_CTL_HYS | PAD_CTL_SPEED_MED | \
 		      PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST)
 
+#define I2C_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE |		\
+		      PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED |	\
+		      PAD_CTL_DSE_40ohm | PAD_CTL_HYS |		\
+		      PAD_CTL_ODE | PAD_CTL_SRE_FAST)
+
 #define ETH_PHY_RESET	IMX_GPIO_NR(4, 21)
 
 int dram_init(void)
@@ -221,6 +231,34 @@ int board_mmc_init(bd_t *bis)
 	return 0;
 }
 
+#ifdef CONFIG_SYS_I2C_MXC
+#define PC	MUX_PAD_CTRL(I2C_PAD_CTRL)
+/* I2C1 for PMIC */
+struct i2c_pads_info i2c_pad_info1 = {
+	.sda = {
+		.i2c_mode = MX6_PAD_I2C1_SDA__I2C1_SDA | PC,
+		.gpio_mode = MX6_PAD_I2C1_SDA__GPIO_3_13 | PC,
+		.gp = IMX_GPIO_NR(3, 13),
+	},
+	.scl = {
+		.i2c_mode = MX6_PAD_I2C1_SCL__I2C1_SCL | PC,
+		.gpio_mode = MX6_PAD_I2C1_SCL__GPIO_3_12 | PC,
+		.gp = IMX_GPIO_NR(3, 12),
+	},
+};
+
+int power_init_board(void)
+{
+	struct pmic *p;
+
+	p = pfuze_common_init(I2C_PMIC);
+	if (!p)
+		return -ENODEV;
+
+	return pfuze_mode_init(p, APS_PFM);
+}
+#endif
+
 #ifdef CONFIG_FEC_MXC
 int board_eth_init(bd_t *bis)
 {
@@ -297,6 +335,10 @@ int board_init(void)
 	/* address of boot parameters */
 	gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
 
+#ifdef CONFIG_SYS_I2C_MXC
+	setup_i2c(0, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info1);
+#endif
+
 #ifdef	CONFIG_FEC_MXC
 	setup_fec();
 #endif
-- 
1.8.4

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

* [U-Boot] [PATCH v3 0/3] imx: mx6slevk add pmic support
  2015-02-12  1:36 [U-Boot] [PATCH v3 0/3] imx: mx6slevk add pmic support Peng Fan
                   ` (2 preceding siblings ...)
  2015-02-12  1:36 ` [U-Boot] [PATCH v3 3/3] imx:mx6slevk implement power init board Peng Fan
@ 2015-02-12 10:37 ` Stefano Babic
  3 siblings, 0 replies; 8+ messages in thread
From: Stefano Babic @ 2015-02-12 10:37 UTC (permalink / raw)
  To: u-boot

Hi Peng,

On 12/02/2015 02:36, Peng Fan wrote:
> This patch set is extracted from the previous "imx:mx6 add ldo bypass"
> patch set, with only one return value change.
> 
> patch 1/3 is add pad settings for I2C1
> patch 2/3 is add I2C and PMIC support in board header file
> patch 3/3 is to add pmic support for mx6slevk.
> 
> patch 3/3 is from patch 3/12 in previous "imx:mx6 add ldo bypass" patch,
> with only one small change is return value.
> 
> Changes v3:
>  Take Fabio's suggestion, for patch 3/3, remove ret variable, and directly
>  "return pfuze_mode_init(xxx)"
> 
> Changes v2:
>  Changing "return -EIO" to "return ret".
> 
> Peng Fan (3):
>   imx:mx6sl add I2c pad settings
>   imx:mx6slevk add pmic and i2c configuration
>   imx:mx6slevk implement power init board
> 
>  arch/arm/include/asm/arch-mx6/mx6sl_pins.h |  5 ++++
>  board/freescale/mx6slevk/mx6slevk.c        | 42 ++++++++++++++++++++++++++++++
>  include/configs/mx6slevk.h                 | 12 +++++++++
>  3 files changed, 59 insertions(+)
> 

They look good for me - if no comments will be posted, they will be
merge by next iteration.

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================

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

* [U-Boot] [PATCH v3 2/3] imx:mx6slevk add pmic and i2c configuration
  2015-02-12  1:36 ` [U-Boot] [PATCH v3 2/3] imx:mx6slevk add pmic and i2c configuration Peng Fan
@ 2015-02-23  8:18   ` Stefano Babic
  0 siblings, 0 replies; 8+ messages in thread
From: Stefano Babic @ 2015-02-23  8:18 UTC (permalink / raw)
  To: u-boot

On 12/02/2015 02:36, Peng Fan wrote:
> Add pmic and i2c configuration in board header file.
> 
> Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
> ---

Applied to u-boot-imx, thanks !

Best regards,
Stefano Babic


-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================

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

* [U-Boot] [PATCH v3 3/3] imx:mx6slevk implement power init board
  2015-02-12  1:36 ` [U-Boot] [PATCH v3 3/3] imx:mx6slevk implement power init board Peng Fan
@ 2015-02-23  8:18   ` Stefano Babic
  0 siblings, 0 replies; 8+ messages in thread
From: Stefano Babic @ 2015-02-23  8:18 UTC (permalink / raw)
  To: u-boot

On 12/02/2015 02:36, Peng Fan wrote:
> Implement power_init_board and related I2C interface configuration.
> 
> After adding this, uboot can successfully detect and configure pmic.
> 
> "
> U-Boot 2015.01-00281-ge29eddf (Feb 12 2015 - 09:24:01)
> 
> CPU:   Freescale i.MX6SL rev1.0 at 396 MHz
> Reset cause: POR
> Board: MX6SLEVK
> I2C:   ready
> DRAM:  1 GiB
> PMIC:  PFUZE100 ID=0x10
> MMC:   FSL_SDHC: 0, FSL_SDHC: 1, FSL_SDHC: 2
> "
> 
> Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
> ---


Applied to u-boot-imx, thanks !

Best regards,
Stefano Babic



-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================

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

* [U-Boot] [PATCH v3 1/3] imx:mx6sl add I2c pad settings
  2015-02-12  1:36 ` [U-Boot] [PATCH v3 1/3] imx:mx6sl add I2c pad settings Peng Fan
@ 2015-02-23  8:19   ` Stefano Babic
  0 siblings, 0 replies; 8+ messages in thread
From: Stefano Babic @ 2015-02-23  8:19 UTC (permalink / raw)
  To: u-boot

On 12/02/2015 02:36, Peng Fan wrote:
> A few pad settings are I2C1
> 
> Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
> ---


Applied to u-boot-imx, thanks !

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================

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

end of thread, other threads:[~2015-02-23  8:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-12  1:36 [U-Boot] [PATCH v3 0/3] imx: mx6slevk add pmic support Peng Fan
2015-02-12  1:36 ` [U-Boot] [PATCH v3 1/3] imx:mx6sl add I2c pad settings Peng Fan
2015-02-23  8:19   ` Stefano Babic
2015-02-12  1:36 ` [U-Boot] [PATCH v3 2/3] imx:mx6slevk add pmic and i2c configuration Peng Fan
2015-02-23  8:18   ` Stefano Babic
2015-02-12  1:36 ` [U-Boot] [PATCH v3 3/3] imx:mx6slevk implement power init board Peng Fan
2015-02-23  8:18   ` Stefano Babic
2015-02-12 10:37 ` [U-Boot] [PATCH v3 0/3] imx: mx6slevk add pmic support Stefano Babic

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox