All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2 1/5] mx25pdk: Include CONFIG_MX25
@ 2012-10-15 23:32 Fabio Estevam
  2012-10-15 23:32 ` [U-Boot] [PATCH v2 2/5] mx25pdk: Add esdhc support Fabio Estevam
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Fabio Estevam @ 2012-10-15 23:32 UTC (permalink / raw)
  To: u-boot

From: Fabio Estevam <fabio.estevam@freescale.com>

It is necessary to include CONFIG_MX25 as several i.mx drivers handle the SoC
differences based on the this config option.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
Changes since v1:
- No changes
 include/configs/mx25pdk.h |    1 +
 1 file changed, 1 insertion(+)

diff --git a/include/configs/mx25pdk.h b/include/configs/mx25pdk.h
index 96c143e..2087502 100644
--- a/include/configs/mx25pdk.h
+++ b/include/configs/mx25pdk.h
@@ -17,6 +17,7 @@
 
 /* High Level Configuration Options */
 
+#define CONFIG_MX25
 #define CONFIG_SYS_HZ			1000
 #define CONFIG_SYS_TEXT_BASE		0x81200000
 
-- 
1.7.9.5

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

* [U-Boot] [PATCH v2 2/5] mx25pdk: Add esdhc support
  2012-10-15 23:32 [U-Boot] [PATCH v2 1/5] mx25pdk: Include CONFIG_MX25 Fabio Estevam
@ 2012-10-15 23:32 ` Fabio Estevam
  2012-10-15 23:32 ` [U-Boot] [PATCH v2 3/5] pmic_fsl: Introduce CONFIG_SYS_FSL_PMIC_I2C_LENGTH Fabio Estevam
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: Fabio Estevam @ 2012-10-15 23:32 UTC (permalink / raw)
  To: u-boot

From: Fabio Estevam <fabio.estevam@freescale.com>

mx25pdk has a SD/MMC slot connected to esdhc1.

Add support for it and allow the environment variables to be saved into SD/MMC.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
Changes since v2:
- Use "esdhc_cfg[0].sdhc_clk"

 board/freescale/mx25pdk/mx25pdk.c |   53 +++++++++++++++++++++++++++++++++++++
 include/configs/mx25pdk.h         |   16 ++++++++++-
 2 files changed, 68 insertions(+), 1 deletion(-)

diff --git a/board/freescale/mx25pdk/mx25pdk.c b/board/freescale/mx25pdk/mx25pdk.c
index 4a8352f..5f7c982 100644
--- a/board/freescale/mx25pdk/mx25pdk.c
+++ b/board/freescale/mx25pdk/mx25pdk.c
@@ -19,12 +19,24 @@
 
 #include <common.h>
 #include <asm/io.h>
+#include <asm/gpio.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/imx25-pinmux.h>
 #include <asm/arch/sys_proto.h>
+#include <asm/arch/clock.h>
+#include <mmc.h>
+#include <fsl_esdhc.h>
+
+#define CARD_DETECT		IMX_GPIO_NR(2, 1)
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#ifdef CONFIG_FSL_ESDHC
+struct fsl_esdhc_cfg esdhc_cfg[1] = {
+	{IMX_MMC_SDHC1_BASE},
+};
+#endif
+
 int dram_init(void)
 {
 	/* dram_init must store complete ramsize in gd->ram_size */
@@ -48,6 +60,47 @@ int board_init(void)
 	return 0;
 }
 
+#ifdef CONFIG_FSL_ESDHC
+int board_mmc_getcd(struct mmc *mmc)
+{
+	struct iomuxc_mux_ctl *muxctl;
+	struct iomuxc_pad_ctl *padctl;
+	u32 gpio_mux_mode = MX25_PIN_MUX_MODE(5);
+
+	/*
+	 * Set up the Card Detect pin.
+	 *
+	 * SD1_GPIO_CD: gpio2_1 is ALT 5 mode of pin A15
+	 *
+	 */
+	muxctl = (struct iomuxc_mux_ctl *)IMX_IOPADMUX_BASE;
+	padctl = (struct iomuxc_pad_ctl *)IMX_IOPADCTL_BASE;
+
+	writel(gpio_mux_mode, &muxctl->pad_a15);
+	writel(0x0, &padctl->pad_a15);
+
+	gpio_direction_input(CARD_DETECT);
+	return !gpio_get_value(CARD_DETECT);
+}
+
+int board_mmc_init(bd_t *bis)
+{
+	struct iomuxc_mux_ctl *muxctl;
+	u32 sdhc1_mux_mode = MX25_PIN_MUX_MODE(0) | MX25_PIN_MUX_SION;
+
+	muxctl = (struct iomuxc_mux_ctl *)IMX_IOPADMUX_BASE;
+	writel(sdhc1_mux_mode, &muxctl->pad_sd1_cmd);
+	writel(sdhc1_mux_mode, &muxctl->pad_sd1_clk);
+	writel(sdhc1_mux_mode, &muxctl->pad_sd1_data0);
+	writel(sdhc1_mux_mode, &muxctl->pad_sd1_data1);
+	writel(sdhc1_mux_mode, &muxctl->pad_sd1_data2);
+	writel(sdhc1_mux_mode, &muxctl->pad_sd1_data3);
+
+	esdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC1_CLK);
+	return fsl_esdhc_initialize(bis, &esdhc_cfg[0]);
+}
+#endif
+
 int checkboard(void)
 {
 	puts("Board: MX25PDK\n");
diff --git a/include/configs/mx25pdk.h b/include/configs/mx25pdk.h
index 2087502..1770521 100644
--- a/include/configs/mx25pdk.h
+++ b/include/configs/mx25pdk.h
@@ -20,6 +20,7 @@
 #define CONFIG_MX25
 #define CONFIG_SYS_HZ			1000
 #define CONFIG_SYS_TEXT_BASE		0x81200000
+#define CONFIG_MXC_GPIO
 
 #define CONFIG_DISPLAY_CPUINFO
 #define CONFIG_DISPLAY_BOARDINFO
@@ -58,9 +59,10 @@
 /* No NOR flash present */
 #define CONFIG_ENV_OFFSET      (6 * 64 * 1024)
 #define CONFIG_ENV_SIZE        (8 * 1024)
-#define CONFIG_ENV_IS_NOWHERE
 
 #define CONFIG_SYS_NO_FLASH
+#define CONFIG_ENV_IS_IN_MMC
+#define CONFIG_SYS_MMC_ENV_DEV 0
 
 /* U-Boot general configuration */
 #define CONFIG_SYS_PROMPT	"MX25PDK U-Boot > "
@@ -78,6 +80,9 @@
 /* U-Boot commands */
 #include <config_cmd_default.h>
 #define CONFIG_CMD_CACHE
+#define CONFIG_CMD_MMC
+#define CONFIG_CMD_EXT2
+#define CONFIG_CMD_FAT
 
 /* Ethernet */
 #define CONFIG_FEC_MXC
@@ -86,6 +91,15 @@
 #define CONFIG_CMD_NET
 #define CONFIG_ENV_OVERWRITE
 
+/* ESDHC driver */
+#define CONFIG_MMC
+#define CONFIG_GENERIC_MMC
+#define CONFIG_FSL_ESDHC
+#define CONFIG_SYS_FSL_ESDHC_ADDR	0
+#define CONFIG_SYS_FSL_ESDHC_NUM	1
+
+#define CONFIG_DOS_PARTITION
+
 #define CONFIG_BOOTDELAY	3
 
 #define CONFIG_LOADADDR		0x81000000	/* loadaddr env var */
-- 
1.7.9.5

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

* [U-Boot] [PATCH v2 3/5] pmic_fsl: Introduce CONFIG_SYS_FSL_PMIC_I2C_LENGTH
  2012-10-15 23:32 [U-Boot] [PATCH v2 1/5] mx25pdk: Include CONFIG_MX25 Fabio Estevam
  2012-10-15 23:32 ` [U-Boot] [PATCH v2 2/5] mx25pdk: Add esdhc support Fabio Estevam
@ 2012-10-15 23:32 ` Fabio Estevam
  2012-10-16 14:39   ` Stefano Babic
  2012-10-15 23:32 ` [U-Boot] [PATCH v2 4/5] pmic: Add support for mc34704 Fabio Estevam
  2012-10-15 23:32 ` [U-Boot] [PATCH v2 5/5] mx25pdk: Add Ethernet support Fabio Estevam
  3 siblings, 1 reply; 10+ messages in thread
From: Fabio Estevam @ 2012-10-15 23:32 UTC (permalink / raw)
  To: u-boot

From: Fabio Estevam <fabio.estevam@freescale.com>

Introduce CONFIG_SYS_FSL_PMIC_I2C_LENGTH to configure the number of bytes
that are used to communicate with the PMIC via I2C.

Instead of hardcoding the value, pass the number via a config option.

This will be useful for adding support for PMIC MC34704 from Freescale, which 
uses only one byte in its I2C protocol.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
Changes since v2:
- No changes. Newly introduced in this series

 drivers/misc/pmic_fsl.c    |    2 +-
 include/configs/mx35pdk.h  |    1 +
 include/configs/mx53evk.h  |    1 +
 include/configs/mx53loco.h |    1 +
 4 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/pmic_fsl.c b/drivers/misc/pmic_fsl.c
index 0ff75ed..40c448b 100644
--- a/drivers/misc/pmic_fsl.c
+++ b/drivers/misc/pmic_fsl.c
@@ -53,7 +53,7 @@ int pmic_init(void)
 #elif defined(CONFIG_PMIC_I2C)
 	p->interface = PMIC_I2C;
 	p->hw.i2c.addr = CONFIG_SYS_FSL_PMIC_I2C_ADDR;
-	p->hw.i2c.tx_num = 3;
+	p->hw.i2c.tx_num = CONFIG_SYS_FSL_PMIC_I2C_LENGTH;
 	p->bus = I2C_PMIC;
 #else
 #error "You must select CONFIG_PMIC_SPI or CONFIG_PMIC_I2C"
diff --git a/include/configs/mx35pdk.h b/include/configs/mx35pdk.h
index 69bd654..3998d76 100644
--- a/include/configs/mx35pdk.h
+++ b/include/configs/mx35pdk.h
@@ -69,6 +69,7 @@
 #define CONFIG_PMIC_I2C
 #define CONFIG_PMIC_FSL
 #define CONFIG_SYS_FSL_PMIC_I2C_ADDR	0x08
+#define CONFIG_SYS_FSL_PMIC_I2C_LENGTH	3
 #define CONFIG_RTC_MC13XXX
 
 /*
diff --git a/include/configs/mx53evk.h b/include/configs/mx53evk.h
index 832050e..f7b11c0 100644
--- a/include/configs/mx53evk.h
+++ b/include/configs/mx53evk.h
@@ -59,6 +59,7 @@
 #define CONFIG_PMIC_I2C
 #define CONFIG_PMIC_FSL
 #define CONFIG_SYS_FSL_PMIC_I2C_ADDR    8
+#define CONFIG_SYS_FSL_PMIC_I2C_LENGTH	3
 #define CONFIG_RTC_MC13XXX
 
 /* MMC Configs */
diff --git a/include/configs/mx53loco.h b/include/configs/mx53loco.h
index 6a6aaa1..fd454d5 100644
--- a/include/configs/mx53loco.h
+++ b/include/configs/mx53loco.h
@@ -96,6 +96,7 @@
 #define CONFIG_PMIC_FSL
 #define CONFIG_SYS_DIALOG_PMIC_I2C_ADDR	0x48
 #define CONFIG_SYS_FSL_PMIC_I2C_ADDR	0x8
+#define CONFIG_SYS_FSL_PMIC_I2C_LENGTH	3
 
 /* allow to overwrite serial and ethaddr */
 #define CONFIG_ENV_OVERWRITE
-- 
1.7.9.5

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

* [U-Boot] [PATCH v2 4/5] pmic: Add support for mc34704
  2012-10-15 23:32 [U-Boot] [PATCH v2 1/5] mx25pdk: Include CONFIG_MX25 Fabio Estevam
  2012-10-15 23:32 ` [U-Boot] [PATCH v2 2/5] mx25pdk: Add esdhc support Fabio Estevam
  2012-10-15 23:32 ` [U-Boot] [PATCH v2 3/5] pmic_fsl: Introduce CONFIG_SYS_FSL_PMIC_I2C_LENGTH Fabio Estevam
@ 2012-10-15 23:32 ` Fabio Estevam
  2012-10-15 23:32 ` [U-Boot] [PATCH v2 5/5] mx25pdk: Add Ethernet support Fabio Estevam
  3 siblings, 0 replies; 10+ messages in thread
From: Fabio Estevam @ 2012-10-15 23:32 UTC (permalink / raw)
  To: u-boot

From: Fabio Estevam <fabio.estevam@freescale.com>

Add the register layout for the MC34704 PMIC from Freescale.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
Changes since v2:
- No changes. Newly introduced in this series

 include/mc34704.h |   49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 include/mc34704.h

diff --git a/include/mc34704.h b/include/mc34704.h
new file mode 100644
index 0000000..a0bb91a
--- /dev/null
+++ b/include/mc34704.h
@@ -0,0 +1,49 @@
+/*
+ * (C) Copyright 2012 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ */
+
+#ifndef __MC34704_H__
+#define __MC34704_H__
+
+enum {
+	MC34704_RESERVED0_REG = 0,	/* 0x00 */
+	MC34704_GENERAL1_REG,		/* 0x01 */
+	MC34704_GENERAL2_REG,		/* 0x02 */
+	MC34704_GENERAL3_REG,		/* 0x03 */
+	MC34704_RESERVED4_REG,		/* 0x04 */
+	MC34704_VGSET2_REG,		/* 0x05 */
+	MC34704_REG2SET1_REG,		/* 0x06 */
+	MC34704_REG2SET2_REG,		/* 0x07 */
+	MC34704_REG3SET1_REG,		/* 0x08 */
+	MC34704_REG3SET2_REG,		/* 0x09 */
+	MC34704_REG4SET1_REG,		/* 0x0a */
+	MC34704_REG4SET2_REG,		/* 0x0b */
+	MC34704_REG5SET1_REG,		/* 0x0c */
+	MC34704_REG5SET2_REG,		/* 0x0d */
+	MC34704_REG5SET3_REG,		/* 0x0e */
+	MC34704_RESERVEDF_REG,		/* 0x0f */
+	MC34704_RESERVED10_REG,		/* 0x10 */
+	MC34704_RESERVED11_REG,		/* 0x11 */
+	MC34704_RESERVED12_REG,		/* 0x12 */
+	MC34704_FSW2SET_REG,		/* 0x13 */
+	MC34704_RESERVED14_REG,		/* 0x14 */
+	MC34704_REG8SET1_REG,		/* 0x15 */
+	MC34704_REG8SET2_REG,		/* 0x16 */
+	MC34704_REG8SET3_REG,		/* 0x17 */
+	MC34704_FAULTS_REG,		/* 0x18 */
+	MC34704_I2CSET1,		/* 0x19 */
+	MC34704_NUM_OF_REGS,
+};
+
+/* GENERAL2 register fields */
+#define ONOFFE		(1 << 0)
+#define ONOFFD		(1 << 1)
+#define ALLOFF		(1 << 4)
+
+#endif /* __MC34704_H__ */
-- 
1.7.9.5

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

* [U-Boot] [PATCH v2 5/5] mx25pdk: Add Ethernet support
  2012-10-15 23:32 [U-Boot] [PATCH v2 1/5] mx25pdk: Include CONFIG_MX25 Fabio Estevam
                   ` (2 preceding siblings ...)
  2012-10-15 23:32 ` [U-Boot] [PATCH v2 4/5] pmic: Add support for mc34704 Fabio Estevam
@ 2012-10-15 23:32 ` Fabio Estevam
  3 siblings, 0 replies; 10+ messages in thread
From: Fabio Estevam @ 2012-10-15 23:32 UTC (permalink / raw)
  To: u-boot

From: Fabio Estevam <fabio.estevam@freescale.com>

mx25pdk has a Ethernet port that is connected to its internal FEC controller.

In order to power up the Ethernet PHY (DP83640) it is necessary to communicate
with the MC34704 PMIC via I2C.

Make the FEC ethernet port functional.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
Changes since v1:
- Use pmic api

 board/freescale/mx25pdk/mx25pdk.c |   61 +++++++++++++++++++++++++++++++++++++
 include/configs/mx25pdk.h         |   22 +++++++++++++
 2 files changed, 83 insertions(+)

diff --git a/board/freescale/mx25pdk/mx25pdk.c b/board/freescale/mx25pdk/mx25pdk.c
index 5f7c982..c63b96f 100644
--- a/board/freescale/mx25pdk/mx25pdk.c
+++ b/board/freescale/mx25pdk/mx25pdk.c
@@ -26,7 +26,13 @@
 #include <asm/arch/clock.h>
 #include <mmc.h>
 #include <fsl_esdhc.h>
+#include <i2c.h>
+#include <pmic.h>
+#include <fsl_pmic.h>
+#include <mc34704.h>
 
+#define FEC_RESET_B		IMX_GPIO_NR(2, 3)
+#define FEC_ENABLE_B		IMX_GPIO_NR(4, 8)
 #define CARD_DETECT		IMX_GPIO_NR(2, 1)
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -37,6 +43,47 @@ struct fsl_esdhc_cfg esdhc_cfg[1] = {
 };
 #endif
 
+static void mx25pdk_fec_init(void)
+{
+	struct iomuxc_mux_ctl *muxctl;
+	struct iomuxc_pad_ctl *padctl;
+	u32 gpio_mux_mode = MX25_PIN_MUX_MODE(5);
+	u32 gpio_mux_mode0_sion = MX25_PIN_MUX_MODE(0) | MX25_PIN_MUX_SION;
+
+	/* FEC pin init is generic */
+	mx25_fec_init_pins();
+
+	muxctl = (struct iomuxc_mux_ctl *)IMX_IOPADMUX_BASE;
+	padctl = (struct iomuxc_pad_ctl *)IMX_IOPADCTL_BASE;
+	/*
+	 * Set up FEC_RESET_B and FEC_ENABLE_B
+	 *
+	 * FEC_RESET_B: gpio2_3 is ALT 5 mode of pin D12
+	 * FEC_ENABLE_B: gpio4_8 is ALT 5 mode of pin A17
+	 */
+	writel(gpio_mux_mode, &muxctl->pad_d12);
+	writel(gpio_mux_mode, &muxctl->pad_a17);
+
+	writel(0x0, &padctl->pad_d12);
+	writel(0x0, &padctl->pad_a17);
+
+	/* Assert RESET and ENABLE low */
+	gpio_direction_output(FEC_RESET_B, 0);
+	gpio_direction_output(FEC_ENABLE_B, 0);
+
+	udelay(10);
+
+	/* Deassert RESET and ENABLE */
+	gpio_set_value(FEC_RESET_B, 1);
+	gpio_set_value(FEC_ENABLE_B, 1);
+
+	/* Setup I2C pins so that PMIC can turn on PHY supply */
+	writel(gpio_mux_mode0_sion, &muxctl->pad_i2c1_clk);
+	writel(gpio_mux_mode0_sion, &muxctl->pad_i2c1_dat);
+	writel(0x1E8, &padctl->pad_i2c1_clk);
+	writel(0x1E8, &padctl->pad_i2c1_dat);
+}
+
 int dram_init(void)
 {
 	/* dram_init must store complete ramsize in gd->ram_size */
@@ -60,6 +107,20 @@ int board_init(void)
 	return 0;
 }
 
+int board_late_init(void)
+{
+	struct pmic *p;
+
+	mx25pdk_fec_init();
+
+	pmic_init();
+	p = get_pmic();
+	/* Turn on Ethernet PHY supply */
+	pmic_reg_write(p, MC34704_GENERAL2_REG, ONOFFE);
+
+	return 0;
+}
+
 #ifdef CONFIG_FSL_ESDHC
 int board_mmc_getcd(struct mmc *mmc)
 {
diff --git a/include/configs/mx25pdk.h b/include/configs/mx25pdk.h
index 1770521..8d0ea7f 100644
--- a/include/configs/mx25pdk.h
+++ b/include/configs/mx25pdk.h
@@ -41,6 +41,7 @@
 #define PHYS_SDRAM_1_SIZE	(64 * 1024 * 1024)
 
 #define CONFIG_BOARD_EARLY_INIT_F
+#define CONFIG_BOARD_LATE_INIT
 
 #define CONFIG_SYS_SDRAM_BASE		PHYS_SDRAM_1
 #define CONFIG_SYS_INIT_SP_ADDR		(CONFIG_SYS_SDRAM_BASE + 0x1000 - \
@@ -98,8 +99,29 @@
 #define CONFIG_SYS_FSL_ESDHC_ADDR	0
 #define CONFIG_SYS_FSL_ESDHC_NUM	1
 
+/* PMIC Configs */
+#define CONFIG_PMIC
+#define CONFIG_PMIC_I2C
+#define CONFIG_PMIC_FSL
+#define CONFIG_SYS_FSL_PMIC_I2C_ADDR	0x54
+#define CONFIG_SYS_FSL_PMIC_I2C_LENGTH	1
+
 #define CONFIG_DOS_PARTITION
 
+/* I2C Configs */
+#define CONFIG_CMD_I2C
+#define CONFIG_HARD_I2C
+#define CONFIG_I2C_MXC
+#define CONFIG_SYS_I2C_BASE		IMX_I2C_BASE
+#define CONFIG_SYS_I2C_SPEED		100000
+
+/* Ethernet Configs */
+
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_NET
+
 #define CONFIG_BOOTDELAY	3
 
 #define CONFIG_LOADADDR		0x81000000	/* loadaddr env var */
-- 
1.7.9.5

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

* [U-Boot] [PATCH v2 3/5] pmic_fsl: Introduce CONFIG_SYS_FSL_PMIC_I2C_LENGTH
  2012-10-15 23:32 ` [U-Boot] [PATCH v2 3/5] pmic_fsl: Introduce CONFIG_SYS_FSL_PMIC_I2C_LENGTH Fabio Estevam
@ 2012-10-16 14:39   ` Stefano Babic
  2012-10-16 16:12     ` Lukasz Majewski
  2012-10-22 15:22     ` Fabio Estevam
  0 siblings, 2 replies; 10+ messages in thread
From: Stefano Babic @ 2012-10-16 14:39 UTC (permalink / raw)
  To: u-boot

Am 16/10/2012 01:32, schrieb Fabio Estevam:
> From: Fabio Estevam <fabio.estevam@freescale.com>
> 
> Introduce CONFIG_SYS_FSL_PMIC_I2C_LENGTH to configure the number of bytes
> that are used to communicate with the PMIC via I2C.
> 
> Instead of hardcoding the value, pass the number via a config option.
> 
> This will be useful for adding support for PMIC MC34704 from Freescale, which 
> uses only one byte in its I2C protocol.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---

Hi Fabio,

> Changes since v2:
> - No changes. Newly introduced in this series
> 
>  drivers/misc/pmic_fsl.c    |    2 +-
>  include/configs/mx35pdk.h  |    1 +
>  include/configs/mx53evk.h  |    1 +
>  include/configs/mx53loco.h |    1 +
>  4 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/misc/pmic_fsl.c b/drivers/misc/pmic_fsl.c
> index 0ff75ed..40c448b 100644
> --- a/drivers/misc/pmic_fsl.c
> +++ b/drivers/misc/pmic_fsl.c
> @@ -53,7 +53,7 @@ int pmic_init(void)
>  #elif defined(CONFIG_PMIC_I2C)
>  	p->interface = PMIC_I2C;
>  	p->hw.i2c.addr = CONFIG_SYS_FSL_PMIC_I2C_ADDR;
> -	p->hw.i2c.tx_num = 3;
> +	p->hw.i2c.tx_num = CONFIG_SYS_FSL_PMIC_I2C_LENGTH;

The bad thing with it is that it seems that each board can have a
different value. However, this is bound to the selected pmic and not to
the board. So IMHO it should not go into the board configuration file,
but in the pmic specific initialization.

We share the same general code for all FSL PMIcs, so I am not sure which
is the best way to do.  Maybe at the pmic initialization ?

I added Lucasz in CC, because he is working on the PMIC framework making
it more flexible and with the possibility to have multiple PMIC (he has
a board with more as one PMIC, even if they are integrated in teh same
chip).

Lucasz changed (not yet merged) the pmic startup passing the number of
I2C bus. So with the new interface, we could have something like:

	pmic_init(I2C_PMIC);
 	if (pmic_detect()) {
		p = pmic_get("FSL_PMIC");

The question is if it makes sense to pass also the tx_num to the init
function, and moving to a
	pmic_init(i2cbus, txnum);

or is there a more elegant way ?

Best regards,
Stefano

-- 
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
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] 10+ messages in thread

* [U-Boot] [PATCH v2 3/5] pmic_fsl: Introduce CONFIG_SYS_FSL_PMIC_I2C_LENGTH
  2012-10-16 14:39   ` Stefano Babic
@ 2012-10-16 16:12     ` Lukasz Majewski
  2012-10-22 15:22     ` Fabio Estevam
  1 sibling, 0 replies; 10+ messages in thread
From: Lukasz Majewski @ 2012-10-16 16:12 UTC (permalink / raw)
  To: u-boot

Hi Stefano,

> Am 16/10/2012 01:32, schrieb Fabio Estevam:
> > From: Fabio Estevam <fabio.estevam@freescale.com>
> > 
> > Introduce CONFIG_SYS_FSL_PMIC_I2C_LENGTH to configure the number of
> > bytes that are used to communicate with the PMIC via I2C.
> > 
> > Instead of hardcoding the value, pass the number via a config
> > option.
> > 
> > This will be useful for adding support for PMIC MC34704 from
> > Freescale, which uses only one byte in its I2C protocol.
> > 
> > Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> > ---
> 
> Hi Fabio,
> 
> > Changes since v2:
> > - No changes. Newly introduced in this series
> > 
> >  drivers/misc/pmic_fsl.c    |    2 +-
> >  include/configs/mx35pdk.h  |    1 +
> >  include/configs/mx53evk.h  |    1 +
> >  include/configs/mx53loco.h |    1 +
> >  4 files changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/misc/pmic_fsl.c b/drivers/misc/pmic_fsl.c
> > index 0ff75ed..40c448b 100644
> > --- a/drivers/misc/pmic_fsl.c
> > +++ b/drivers/misc/pmic_fsl.c
> > @@ -53,7 +53,7 @@ int pmic_init(void)
> >  #elif defined(CONFIG_PMIC_I2C)
> >  	p->interface = PMIC_I2C;
> >  	p->hw.i2c.addr = CONFIG_SYS_FSL_PMIC_I2C_ADDR;
> > -	p->hw.i2c.tx_num = 3;
> > +	p->hw.i2c.tx_num = CONFIG_SYS_FSL_PMIC_I2C_LENGTH;
> 
> The bad thing with it is that it seems that each board can have a
> different value. However, this is bound to the selected pmic and not
> to the board. So IMHO it should not go into the board configuration
> file, but in the pmic specific initialization.
> 
> We share the same general code for all FSL PMIcs, so I am not sure
> which is the best way to do.  Maybe at the pmic initialization ?
> 
> I added Lucasz in CC, because he is working on the PMIC framework
> making it more flexible and with the possibility to have multiple
> PMIC (he has a board with more as one PMIC, even if they are
> integrated in teh same chip).
> 
> Lucasz changed (not yet merged) the pmic startup passing the number of
> I2C bus. So with the new interface, we could have something like:

I'm going to post another version of the patch in a few days.

> 
> 	pmic_init(I2C_PMIC);
>  	if (pmic_detect()) {
> 		p = pmic_get("FSL_PMIC");
> 
> The question is if it makes sense to pass also the tx_num to the init
> function, and moving to a
> 	pmic_init(i2cbus, txnum);

I'd like to avoid passing more data than necessary for the pmic_init.
I will investigate how it can be solved.

> 
> or is there a more elegant way ?
> 
> Best regards,
> Stefano
> 



-- 
Best regards,

Lukasz Majewski

Samsung Poland R&D Center | Linux Platform Group

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

* [U-Boot] [PATCH v2 3/5] pmic_fsl: Introduce CONFIG_SYS_FSL_PMIC_I2C_LENGTH
  2012-10-16 14:39   ` Stefano Babic
  2012-10-16 16:12     ` Lukasz Majewski
@ 2012-10-22 15:22     ` Fabio Estevam
  2012-10-22 16:05       ` Lukasz Majewski
  2012-10-22 16:16       ` Stefano Babic
  1 sibling, 2 replies; 10+ messages in thread
From: Fabio Estevam @ 2012-10-22 15:22 UTC (permalink / raw)
  To: u-boot

On Tue, Oct 16, 2012 at 11:39 AM, Stefano Babic <sbabic@denx.de> wrote:

>> --- a/drivers/misc/pmic_fsl.c
>> +++ b/drivers/misc/pmic_fsl.c
>> @@ -53,7 +53,7 @@ int pmic_init(void)
>>  #elif defined(CONFIG_PMIC_I2C)
>>       p->interface = PMIC_I2C;
>>       p->hw.i2c.addr = CONFIG_SYS_FSL_PMIC_I2C_ADDR;
>> -     p->hw.i2c.tx_num = 3;
>> +     p->hw.i2c.tx_num = CONFIG_SYS_FSL_PMIC_I2C_LENGTH;
>
> The bad thing with it is that it seems that each board can have a
> different value. However, this is bound to the selected pmic and not to
> the board. So IMHO it should not go into the board configuration file,
> but in the pmic specific initialization.

Ok, understood.

What about putting CONFIG_SYS_FSL_PMIC_I2C_LENGTH inside the PMIC
include file, such as
include/dialog_pmic.h
include/mc13783.h
include/mc13892.h ?

Thanks,

Fabio Estevam

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

* [U-Boot] [PATCH v2 3/5] pmic_fsl: Introduce CONFIG_SYS_FSL_PMIC_I2C_LENGTH
  2012-10-22 15:22     ` Fabio Estevam
@ 2012-10-22 16:05       ` Lukasz Majewski
  2012-10-22 16:16       ` Stefano Babic
  1 sibling, 0 replies; 10+ messages in thread
From: Lukasz Majewski @ 2012-10-22 16:05 UTC (permalink / raw)
  To: u-boot

Hi Fabio,

> On Tue, Oct 16, 2012 at 11:39 AM, Stefano Babic <sbabic@denx.de>
> wrote:
> 
> >> --- a/drivers/misc/pmic_fsl.c
> >> +++ b/drivers/misc/pmic_fsl.c
> >> @@ -53,7 +53,7 @@ int pmic_init(void)
> >>  #elif defined(CONFIG_PMIC_I2C)
> >>       p->interface = PMIC_I2C;
> >>       p->hw.i2c.addr = CONFIG_SYS_FSL_PMIC_I2C_ADDR;
> >> -     p->hw.i2c.tx_num = 3;
> >> +     p->hw.i2c.tx_num = CONFIG_SYS_FSL_PMIC_I2C_LENGTH;
> >
> > The bad thing with it is that it seems that each board can have a
> > different value. However, this is bound to the selected pmic and
> > not to the board. So IMHO it should not go into the board
> > configuration file, but in the pmic specific initialization.
> 
> Ok, understood.
> 
> What about putting CONFIG_SYS_FSL_PMIC_I2C_LENGTH inside the PMIC
> include file, such as
> include/dialog_pmic.h
> include/mc13783.h
> include/mc13892.h ?
>

I totally agree.

This definition looks like PMIC device specific and shall be defined at
proper *.h file (as you proposed).

Moreover the
p->hw.i2c.tx_num = CONFIG_SYS_FSL_PMIC_I2C_LENGTH;

shall be assigned at per pmic instantiation:

int pmic_init(bus)
{
...
p->hw.i2c.tx_num = CONFIG_SYS_FSL_PMIC_I2C_LENGTH;
...

}

This should solve your problem.

 


-- 
Best regards,

Lukasz Majewski

Samsung Poland R&D Center | Linux Platform Group

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

* [U-Boot] [PATCH v2 3/5] pmic_fsl: Introduce CONFIG_SYS_FSL_PMIC_I2C_LENGTH
  2012-10-22 15:22     ` Fabio Estevam
  2012-10-22 16:05       ` Lukasz Majewski
@ 2012-10-22 16:16       ` Stefano Babic
  1 sibling, 0 replies; 10+ messages in thread
From: Stefano Babic @ 2012-10-22 16:16 UTC (permalink / raw)
  To: u-boot

Am 22/10/2012 17:22, schrieb Fabio Estevam:
> On Tue, Oct 16, 2012 at 11:39 AM, Stefano Babic <sbabic@denx.de> wrote:
> 
>>> --- a/drivers/misc/pmic_fsl.c
>>> +++ b/drivers/misc/pmic_fsl.c
>>> @@ -53,7 +53,7 @@ int pmic_init(void)
>>>  #elif defined(CONFIG_PMIC_I2C)
>>>       p->interface = PMIC_I2C;
>>>       p->hw.i2c.addr = CONFIG_SYS_FSL_PMIC_I2C_ADDR;
>>> -     p->hw.i2c.tx_num = 3;
>>> +     p->hw.i2c.tx_num = CONFIG_SYS_FSL_PMIC_I2C_LENGTH;
>>
>> The bad thing with it is that it seems that each board can have a
>> different value. However, this is bound to the selected pmic and not to
>> the board. So IMHO it should not go into the board configuration file,
>> but in the pmic specific initialization.
> 
> Ok, understood.
> 
> What about putting CONFIG_SYS_FSL_PMIC_I2C_LENGTH inside the PMIC
> include file, such as
> include/dialog_pmic.h
> include/mc13783.h
> include/mc13892.h ?

Apart changing the name (the prefix CONFIG_SYS_ should be not used), I
think it is a praticable solution.

Best regards,
Stefano Babic


-- 
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
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] 10+ messages in thread

end of thread, other threads:[~2012-10-22 16:16 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-15 23:32 [U-Boot] [PATCH v2 1/5] mx25pdk: Include CONFIG_MX25 Fabio Estevam
2012-10-15 23:32 ` [U-Boot] [PATCH v2 2/5] mx25pdk: Add esdhc support Fabio Estevam
2012-10-15 23:32 ` [U-Boot] [PATCH v2 3/5] pmic_fsl: Introduce CONFIG_SYS_FSL_PMIC_I2C_LENGTH Fabio Estevam
2012-10-16 14:39   ` Stefano Babic
2012-10-16 16:12     ` Lukasz Majewski
2012-10-22 15:22     ` Fabio Estevam
2012-10-22 16:05       ` Lukasz Majewski
2012-10-22 16:16       ` Stefano Babic
2012-10-15 23:32 ` [U-Boot] [PATCH v2 4/5] pmic: Add support for mc34704 Fabio Estevam
2012-10-15 23:32 ` [U-Boot] [PATCH v2 5/5] mx25pdk: Add Ethernet support Fabio Estevam

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.