* [U-Boot] switch to generic PMIX driver for i.MX boards
@ 2011-10-08 10:06 Stefano Babic
2011-10-08 10:06 ` [U-Boot] [PATCH 01/11] MX3: qong: use new pmic driver Stefano Babic
` (10 more replies)
0 siblings, 11 replies; 17+ messages in thread
From: Stefano Babic @ 2011-10-08 10:06 UTC (permalink / raw)
To: u-boot
This patchset is based on ?ukasz Majewski's patches that
introduce a generic PMIC (Power Microcontroller) driver:
http://patchwork.ozlabs.org/patch/117565/
http://patchwork.ozlabs.org/patch/117563/
http://patchwork.ozlabs.org/patch/117818/
http://patchwork.ozlabs.org/patch/118071/
The patchset replaced the old driver used on i.MX boards
(Freescale PMIC) and switches to the new generic driver.
board/davedenx/qong/qong.c | 11 ++-
board/efikamx/efikamx.c | 49 ++++----
board/freescale/mx35pdk/mx35pdk.c | 18 ++-
board/freescale/mx51evk/mx51evk.c | 45 ++++----
board/freescale/mx53evk/mx53evk.c | 15 ++-
board/ttcontrol/vision2/vision2.c | 31 +++---
drivers/i2c/mxc_i2c.c | 5 +
drivers/misc/Makefile | 2 +-
drivers/misc/fsl_pmic.c | 235 -------------------------------------
drivers/misc/pmic_fsl.c | 67 +++++++++++
drivers/rtc/mc13783-rtc.c | 20 ++--
include/configs/efikamx.h | 5 +-
include/configs/imx31_litekit.h | 9 +-
include/configs/mx31ads.h | 8 +-
include/configs/mx31pdk.h | 6 +-
include/configs/mx35pdk.h | 5 +-
include/configs/mx51evk.h | 6 +-
include/configs/mx53evk.h | 5 +-
include/configs/qong.h | 5 +-
include/configs/vision2.h | 5 +-
include/fsl_pmic.h | 5 +-
21 files changed, 222 insertions(+), 335 deletions(-)
^ permalink raw reply [flat|nested] 17+ messages in thread
* [U-Boot] [PATCH 01/11] MX3: qong: use new pmic driver
2011-10-08 10:06 [U-Boot] switch to generic PMIX driver for i.MX boards Stefano Babic
@ 2011-10-08 10:06 ` Stefano Babic
2011-10-08 10:06 ` [U-Boot] [PATCH 02/11] MX5: efikamx/efikasb: " Stefano Babic
` (9 subsequent siblings)
10 siblings, 0 replies; 17+ messages in thread
From: Stefano Babic @ 2011-10-08 10:06 UTC (permalink / raw)
To: u-boot
Switch to new pmic generic driver.
Signed-off-by: Stefano Babic <sbabic@denx.de>
---
board/davedenx/qong/qong.c | 11 ++++++++---
include/configs/qong.h | 5 ++++-
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/board/davedenx/qong/qong.c b/board/davedenx/qong/qong.c
index 9fca1f8..a9f2ef0 100644
--- a/board/davedenx/qong/qong.c
+++ b/board/davedenx/qong/qong.c
@@ -28,6 +28,7 @@
#include <asm/arch/sys_proto.h>
#include <asm/io.h>
#include <nand.h>
+#include <pmic.h>
#include <fsl_pmic.h>
#include <asm/gpio.h>
#include "qong_fpga.h"
@@ -176,11 +177,15 @@ int board_init (void)
int board_late_init(void)
{
u32 val;
+ struct pmic *p;
+
+ pmic_init();
+ p = get_pmic();
/* Enable RTC battery */
- val = pmic_reg_read(REG_POWER_CTL0);
- pmic_reg_write(REG_POWER_CTL0, val | COINCHEN);
- pmic_reg_write(REG_INT_STATUS1, RTCRSTI);
+ pmic_reg_read(p, REG_POWER_CTL0, &val);
+ pmic_reg_write(p, REG_POWER_CTL0, val | COINCHEN);
+ pmic_reg_write(p, REG_INT_STATUS1, RTCRSTI);
#ifdef CONFIG_HW_WATCHDOG
mxc_hw_watchdog_enable();
diff --git a/include/configs/qong.h b/include/configs/qong.h
index 78b3701..ec99021 100644
--- a/include/configs/qong.h
+++ b/include/configs/qong.h
@@ -60,11 +60,14 @@
#define CONFIG_DEFAULT_SPI_MODE (SPI_MODE_0 | SPI_CS_HIGH)
#define CONFIG_RTC_MC13783
-#define CONFIG_FSL_PMIC
+#define CONFIG_PMIC
+#define CONFIG_PMIC_SPI
+#define CONFIG_PMIC_FSL
#define CONFIG_FSL_PMIC_BUS 1
#define CONFIG_FSL_PMIC_CS 0
#define CONFIG_FSL_PMIC_CLK 100000
#define CONFIG_FSL_PMIC_MODE (SPI_MODE_0 | SPI_CS_HIGH)
+#define CONFIG_FSL_PMIC_BITLEN 32
/* FPGA */
#define CONFIG_FPGA
--
1.7.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [U-Boot] [PATCH 02/11] MX5: efikamx/efikasb: use new pmic driver
2011-10-08 10:06 [U-Boot] switch to generic PMIX driver for i.MX boards Stefano Babic
2011-10-08 10:06 ` [U-Boot] [PATCH 01/11] MX3: qong: use new pmic driver Stefano Babic
@ 2011-10-08 10:06 ` Stefano Babic
2011-10-08 11:31 ` Marek Vasut
2011-10-08 10:07 ` [U-Boot] [PATCH 03/11] I2c: add missing i2c_set_bus_num to mxc_i2c Stefano Babic
` (8 subsequent siblings)
10 siblings, 1 reply; 17+ messages in thread
From: Stefano Babic @ 2011-10-08 10:06 UTC (permalink / raw)
To: u-boot
Switch to new pmic generic driver.
Signed-off-by: Stefano Babic <sbabic@denx.de>
CC: Marek Vasut <marek.vasut@gmail.com>
---
board/efikamx/efikamx.c | 49 +++++++++++++++++++++++---------------------
include/configs/efikamx.h | 5 +++-
2 files changed, 30 insertions(+), 24 deletions(-)
diff --git a/board/efikamx/efikamx.c b/board/efikamx/efikamx.c
index 0c4e24b..befb8ad 100644
--- a/board/efikamx/efikamx.c
+++ b/board/efikamx/efikamx.c
@@ -34,6 +34,7 @@
#include <i2c.h>
#include <mmc.h>
#include <fsl_esdhc.h>
+#include <pmic.h>
#include <fsl_pmic.h>
#include <mc13892.h>
@@ -205,34 +206,35 @@ static void power_init(void)
{
unsigned int val;
struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)MXC_CCM_BASE;
+ struct pmic *p = get_pmic();
/* Write needed to Power Gate 2 register */
- val = pmic_reg_read(REG_POWER_MISC);
+ pmic_reg_read(p, REG_POWER_MISC, &val);
val &= ~PWGT2SPIEN;
- pmic_reg_write(REG_POWER_MISC, val);
+ pmic_reg_write(p, REG_POWER_MISC, val);
/* Externally powered */
- val = pmic_reg_read(REG_CHARGE);
+ pmic_reg_read(p, REG_CHARGE, &val);
val |= ICHRG0 | ICHRG1 | ICHRG2 | ICHRG3 | CHGAUTOB;
- pmic_reg_write(REG_CHARGE, val);
+ pmic_reg_write(p, REG_CHARGE, val);
/* power up the system first */
- pmic_reg_write(REG_POWER_MISC, PWUP);
+ pmic_reg_write(p, REG_POWER_MISC, PWUP);
/* Set core voltage to 1.1V */
- val = pmic_reg_read(REG_SW_0);
+ pmic_reg_read(p, REG_SW_0, &val);
val = (val & ~SWx_VOLT_MASK) | SWx_1_100V;
- pmic_reg_write(REG_SW_0, val);
+ pmic_reg_write(p, REG_SW_0, val);
/* Setup VCC (SW2) to 1.25 */
- val = pmic_reg_read(REG_SW_1);
+ pmic_reg_read(p, REG_SW_1, &val);
val = (val & ~SWx_VOLT_MASK) | SWx_1_250V;
- pmic_reg_write(REG_SW_1, val);
+ pmic_reg_write(p, REG_SW_1, val);
/* Setup 1V2_DIG1 (SW3) to 1.25 */
- val = pmic_reg_read(REG_SW_2);
+ pmic_reg_read(p, REG_SW_2, &val);
val = (val & ~SWx_VOLT_MASK) | SWx_1_250V;
- pmic_reg_write(REG_SW_2, val);
+ pmic_reg_write(p, REG_SW_2, val);
udelay(50);
/* Raise the core frequency to 800MHz */
@@ -240,46 +242,46 @@ static void power_init(void)
/* Set switchers in Auto in NORMAL mode & STANDBY mode */
/* Setup the switcher mode for SW1 & SW2*/
- val = pmic_reg_read(REG_SW_4);
+ pmic_reg_read(p, REG_SW_4, &val);
val = (val & ~((SWMODE_MASK << SWMODE1_SHIFT) |
(SWMODE_MASK << SWMODE2_SHIFT)));
val |= (SWMODE_AUTO_AUTO << SWMODE1_SHIFT) |
(SWMODE_AUTO_AUTO << SWMODE2_SHIFT);
- pmic_reg_write(REG_SW_4, val);
+ pmic_reg_write(p, REG_SW_4, val);
/* Setup the switcher mode for SW3 & SW4 */
- val = pmic_reg_read(REG_SW_5);
+ pmic_reg_read(p, REG_SW_5, &val);
val = (val & ~((SWMODE_MASK << SWMODE3_SHIFT) |
(SWMODE_MASK << SWMODE4_SHIFT)));
val |= (SWMODE_AUTO_AUTO << SWMODE3_SHIFT) |
(SWMODE_AUTO_AUTO << SWMODE4_SHIFT);
- pmic_reg_write(REG_SW_5, val);
+ pmic_reg_write(p, REG_SW_5, val);
/* Set VDIG to 1.65V, VGEN3 to 1.8V, VCAM to 2.6V */
- val = pmic_reg_read(REG_SETTING_0);
+ pmic_reg_read(p, REG_SETTING_0, &val);
val &= ~(VCAM_MASK | VGEN3_MASK | VDIG_MASK);
val |= VDIG_1_65 | VGEN3_1_8 | VCAM_2_6;
- pmic_reg_write(REG_SETTING_0, val);
+ pmic_reg_write(p, REG_SETTING_0, val);
/* Set VVIDEO to 2.775V, VAUDIO to 3V, VSD to 3.15V */
- val = pmic_reg_read(REG_SETTING_1);
+ pmic_reg_read(p, REG_SETTING_1, &val);
val &= ~(VVIDEO_MASK | VSD_MASK | VAUDIO_MASK);
val |= VSD_3_15 | VAUDIO_3_0 | VVIDEO_2_775;
- pmic_reg_write(REG_SETTING_1, val);
+ pmic_reg_write(p, REG_SETTING_1, val);
/* Configure VGEN3 and VCAM regulators to use external PNP */
val = VGEN3CONFIG | VCAMCONFIG;
- pmic_reg_write(REG_MODE_1, val);
+ pmic_reg_write(p, REG_MODE_1, val);
udelay(200);
/* Enable VGEN3, VCAM, VAUDIO, VVIDEO, VSD regulators */
val = VGEN3EN | VGEN3CONFIG | VCAMEN | VCAMCONFIG |
VVIDEOEN | VAUDIOEN | VSDEN;
- pmic_reg_write(REG_MODE_1, val);
+ pmic_reg_write(p, REG_MODE_1, val);
- val = pmic_reg_read(REG_POWER_CTL2);
+ pmic_reg_read(p, REG_POWER_CTL2, &val);
val |= WDIRESET;
- pmic_reg_write(REG_POWER_CTL2, val);
+ pmic_reg_write(p, REG_POWER_CTL2, val);
udelay(2500);
}
@@ -674,6 +676,7 @@ int board_late_init(void)
{
setup_iomux_spi();
+ pmic_init();
power_init();
setup_iomux_led();
diff --git a/include/configs/efikamx.h b/include/configs/efikamx.h
index 54f48e4..7e4b424 100644
--- a/include/configs/efikamx.h
+++ b/include/configs/efikamx.h
@@ -124,11 +124,14 @@
#endif
/* SPI PMIC */
-#define CONFIG_FSL_PMIC
+#define CONFIG_PMIC
+#define CONFIG_PMIC_SPI
+#define CONFIG_PMIC_FSL
#define CONFIG_FSL_PMIC_BUS 0
#define CONFIG_FSL_PMIC_CS (0 | 120 << 8)
#define CONFIG_FSL_PMIC_CLK 25000000
#define CONFIG_FSL_PMIC_MODE (SPI_MODE_0 | SPI_CS_HIGH)
+#define CONFIG_FSL_PMIC_BITLEN 32
#define CONFIG_RTC_MC13783
#endif
--
1.7.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [U-Boot] [PATCH 03/11] I2c: add missing i2c_set_bus_num to mxc_i2c
2011-10-08 10:06 [U-Boot] switch to generic PMIX driver for i.MX boards Stefano Babic
2011-10-08 10:06 ` [U-Boot] [PATCH 01/11] MX3: qong: use new pmic driver Stefano Babic
2011-10-08 10:06 ` [U-Boot] [PATCH 02/11] MX5: efikamx/efikasb: " Stefano Babic
@ 2011-10-08 10:07 ` Stefano Babic
2011-10-08 10:07 ` [U-Boot] [PATCH 04/11] misc: pmic: addI2C support to pmic_fsl driver Stefano Babic
` (7 subsequent siblings)
10 siblings, 0 replies; 17+ messages in thread
From: Stefano Babic @ 2011-10-08 10:07 UTC (permalink / raw)
To: u-boot
The function i2c_set_bus_num() is used on most SOCs.
The driver does not support multiple I2C busses, and
an empty function is added to be compatible with general code
(example: PMIC driver).
Signed-off-by: Stefano Babic <sbabic@denx.de>
Cc: Heiko Schocher <hs@denx.de>
---
drivers/i2c/mxc_i2c.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/drivers/i2c/mxc_i2c.c b/drivers/i2c/mxc_i2c.c
index 2869d7c..de878ce 100644
--- a/drivers/i2c/mxc_i2c.c
+++ b/drivers/i2c/mxc_i2c.c
@@ -450,4 +450,9 @@ int i2c_write(uchar chip, uint addr, int alen, uchar *buf, int len)
return ret;
}
+
+int i2c_set_bus_num(unsigned int bus)
+{
+ return 0;
+}
#endif /* CONFIG_HARD_I2C */
--
1.7.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [U-Boot] [PATCH 04/11] misc: pmic: addI2C support to pmic_fsl driver
2011-10-08 10:06 [U-Boot] switch to generic PMIX driver for i.MX boards Stefano Babic
` (2 preceding siblings ...)
2011-10-08 10:07 ` [U-Boot] [PATCH 03/11] I2c: add missing i2c_set_bus_num to mxc_i2c Stefano Babic
@ 2011-10-08 10:07 ` Stefano Babic
2011-10-08 13:57 ` Sergei Shtylyov
2011-10-08 10:07 ` [U-Boot] [PATCH 05/11] MX35: mx35pdk: use new pmic driver Stefano Babic
` (6 subsequent siblings)
10 siblings, 1 reply; 17+ messages in thread
From: Stefano Babic @ 2011-10-08 10:07 UTC (permalink / raw)
To: u-boot
Signed-off-by: Stefano Babic <sbabic@denx.de>
---
drivers/misc/pmic_fsl.c | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/drivers/misc/pmic_fsl.c b/drivers/misc/pmic_fsl.c
index 13dde47..2945dfb 100644
--- a/drivers/misc/pmic_fsl.c
+++ b/drivers/misc/pmic_fsl.c
@@ -26,6 +26,7 @@
#include <pmic.h>
#include <fsl_pmic.h>
+#if defined(CONFIG_PMIC_SPI)
static u32 pmic_spi_prepare_tx(u32 reg, u32 *val, u32 write)
{
if ((val == NULL) && (write))
@@ -33,25 +34,34 @@ static u32 pmic_spi_prepare_tx(u32 reg, u32 *val, u32 write)
else
return (write << 31) | (reg << 25) | (*val & 0x00FFFFFF);
}
+#endif
int pmic_init(void)
{
struct pmic *p = get_pmic();
static const char name[] = "FSL_PMIC";
- puts("Board PMIC init\n");
-
p->name = name;
- p->interface = PMIC_SPI;
p->number_of_regs = PMIC_NUM_OF_REGS;
- p->bus = CONFIG_FSL_PMIC_BUS;
+#if defined(CONFIG_PMIC_SPI)
+ p->interface = PMIC_SPI;
+ p->bus = CONFIG_FSL_PMIC_BUS;
p->hw.spi.cs = CONFIG_FSL_PMIC_CS;
p->hw.spi.clk = CONFIG_FSL_PMIC_CLK;
p->hw.spi.mode = CONFIG_FSL_PMIC_MODE;
p->hw.spi.bitlen = CONFIG_FSL_PMIC_BITLEN;
p->hw.spi.flags = SPI_XFER_BEGIN | SPI_XFER_END;
p->hw.spi.prepare_tx = pmic_spi_prepare_tx;
+#elif defined(CONFIG_PMIC_I2C)
+ p->interface = PMIC_SPI;
+ p->interface = PMIC_I2C;
+ p->hw.i2c.addr = CONFIG_SYS_FSL_PMIC_I2C_ADDR;
+ p->hw.i2c.tx_num = 3;
+ p->bus = I2C_PMIC;
+#else
+#error "You must select CONFIG_PMIC_SPI or CONFIG_PMIC_I2C"
+#endif
return 0;
}
--
1.7.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [U-Boot] [PATCH 05/11] MX35: mx35pdk: use new pmic driver
2011-10-08 10:06 [U-Boot] switch to generic PMIX driver for i.MX boards Stefano Babic
` (3 preceding siblings ...)
2011-10-08 10:07 ` [U-Boot] [PATCH 04/11] misc: pmic: addI2C support to pmic_fsl driver Stefano Babic
@ 2011-10-08 10:07 ` Stefano Babic
2011-10-08 10:07 ` [U-Boot] [PATCH 06/11] MX5: mx51evk: " Stefano Babic
` (5 subsequent siblings)
10 siblings, 0 replies; 17+ messages in thread
From: Stefano Babic @ 2011-10-08 10:07 UTC (permalink / raw)
To: u-boot
Switch to new pmic generic driver.
Signed-off-by: Stefano Babic <sbabic@denx.de>
---
board/freescale/mx35pdk/mx35pdk.c | 18 ++++++++++++------
include/configs/mx35pdk.h | 5 +++--
2 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/board/freescale/mx35pdk/mx35pdk.c b/board/freescale/mx35pdk/mx35pdk.c
index 9eefe5e..f6da51a 100644
--- a/board/freescale/mx35pdk/mx35pdk.c
+++ b/board/freescale/mx35pdk/mx35pdk.c
@@ -30,6 +30,7 @@
#include <asm/arch/mx35_pins.h>
#include <asm/arch/iomux.h>
#include <i2c.h>
+#include <pmic.h>
#include <fsl_pmic.h>
#include <mc9sdz60.h>
#include <mc13892.h>
@@ -204,9 +205,10 @@ int board_init(void)
static inline int pmic_detect(void)
{
- int id;
+ unsigned int id;
+ struct pmic *p = get_pmic();
- id = pmic_reg_read(REG_IDENTIFICATION);
+ pmic_reg_read(p, REG_IDENTIFICATION, &id);
id = (id >> 6) & 0x7;
if (id == 0x7)
@@ -227,15 +229,19 @@ int board_late_init(void)
{
u8 val;
u32 pmic_val;
+ struct pmic *p;
+ pmic_init();
if (pmic_detect()) {
+ p = get_pmic();
mxc_request_iomux(MX35_PIN_WATCHDOG_RST, MUX_CONFIG_SION |
MUX_CONFIG_ALT1);
- pmic_val = pmic_reg_read(REG_SETTING_0);
- pmic_reg_write(REG_SETTING_0, pmic_val | VO_1_30V | VO_1_50V);
- pmic_val = pmic_reg_read(REG_MODE_0);
- pmic_reg_write(REG_MODE_0, pmic_val | VGEN3EN);
+ pmic_reg_read(p, REG_SETTING_0, &pmic_val);
+ pmic_reg_write(p, REG_SETTING_0,
+ pmic_val | VO_1_30V | VO_1_50V);
+ pmic_reg_read(p, REG_MODE_0, &pmic_val);
+ pmic_reg_write(p, REG_MODE_0, pmic_val | VGEN3EN);
mxc_request_iomux(MX35_PIN_COMPARE, MUX_CONFIG_GPIO);
mxc_iomux_set_input(MUX_IN_GPIO1_IN_5, INPUT_CTL_PATH0);
diff --git a/include/configs/mx35pdk.h b/include/configs/mx35pdk.h
index 4e9022d..946e64b 100644
--- a/include/configs/mx35pdk.h
+++ b/include/configs/mx35pdk.h
@@ -69,8 +69,9 @@
/*
* PMIC Configs
*/
-#define CONFIG_FSL_PMIC
-#define CONFIG_FSL_PMIC_I2C
+#define CONFIG_PMIC
+#define CONFIG_PMIC_I2C
+#define CONFIG_PMIC_FSL
#define CONFIG_SYS_FSL_PMIC_I2C_ADDR 0x08
/*
--
1.7.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [U-Boot] [PATCH 06/11] MX5: mx51evk: use new pmic driver
2011-10-08 10:06 [U-Boot] switch to generic PMIX driver for i.MX boards Stefano Babic
` (4 preceding siblings ...)
2011-10-08 10:07 ` [U-Boot] [PATCH 05/11] MX35: mx35pdk: use new pmic driver Stefano Babic
@ 2011-10-08 10:07 ` Stefano Babic
2011-10-08 10:07 ` [U-Boot] [PATCH 07/11] MX5: mx53evk: " Stefano Babic
` (4 subsequent siblings)
10 siblings, 0 replies; 17+ messages in thread
From: Stefano Babic @ 2011-10-08 10:07 UTC (permalink / raw)
To: u-boot
Switch to new pmic generic driver.
Signed-off-by: Stefano Babic <sbabic@denx.de>
---
board/freescale/mx51evk/mx51evk.c | 45 +++++++++++++++++++-----------------
include/configs/mx51evk.h | 6 ++++-
2 files changed, 29 insertions(+), 22 deletions(-)
diff --git a/board/freescale/mx51evk/mx51evk.c b/board/freescale/mx51evk/mx51evk.c
index 8da1ee8..fe76e20 100644
--- a/board/freescale/mx51evk/mx51evk.c
+++ b/board/freescale/mx51evk/mx51evk.c
@@ -32,6 +32,7 @@
#include <i2c.h>
#include <mmc.h>
#include <fsl_esdhc.h>
+#include <pmic.h>
#include <fsl_pmic.h>
#include <mc13892.h>
@@ -182,34 +183,35 @@ static void power_init(void)
{
unsigned int val;
struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)MXC_CCM_BASE;
+ struct pmic *p = get_pmic();
/* Write needed to Power Gate 2 register */
- val = pmic_reg_read(REG_POWER_MISC);
+ pmic_reg_read(p, REG_POWER_MISC, &val);
val &= ~PWGT2SPIEN;
- pmic_reg_write(REG_POWER_MISC, val);
+ pmic_reg_write(p, REG_POWER_MISC, val);
/* Externally powered */
- val = pmic_reg_read(REG_CHARGE);
+ pmic_reg_read(p, REG_CHARGE, &val);
val |= ICHRG0 | ICHRG1 | ICHRG2 | ICHRG3 | CHGAUTOB;
- pmic_reg_write(REG_CHARGE, val);
+ pmic_reg_write(p, REG_CHARGE, val);
/* power up the system first */
- pmic_reg_write(REG_POWER_MISC, PWUP);
+ pmic_reg_write(p, REG_POWER_MISC, PWUP);
/* Set core voltage to 1.1V */
- val = pmic_reg_read(REG_SW_0);
+ pmic_reg_read(p, REG_SW_0, &val);
val = (val & ~SWx_VOLT_MASK) | SWx_1_100V;
- pmic_reg_write(REG_SW_0, val);
+ pmic_reg_write(p, REG_SW_0, val);
/* Setup VCC (SW2) to 1.25 */
- val = pmic_reg_read(REG_SW_1);
+ pmic_reg_read(p, REG_SW_1, &val);
val = (val & ~SWx_VOLT_MASK) | SWx_1_250V;
- pmic_reg_write(REG_SW_1, val);
+ pmic_reg_write(p, REG_SW_1, val);
/* Setup 1V2_DIG1 (SW3) to 1.25 */
- val = pmic_reg_read(REG_SW_2);
+ pmic_reg_read(p, REG_SW_2, &val);
val = (val & ~SWx_VOLT_MASK) | SWx_1_250V;
- pmic_reg_write(REG_SW_2, val);
+ pmic_reg_write(p, REG_SW_2, val);
udelay(50);
/* Raise the core frequency to 800MHz */
@@ -217,36 +219,36 @@ static void power_init(void)
/* Set switchers in Auto in NORMAL mode & STANDBY mode */
/* Setup the switcher mode for SW1 & SW2*/
- val = pmic_reg_read(REG_SW_4);
+ pmic_reg_read(p, REG_SW_4, &val);
val = (val & ~((SWMODE_MASK << SWMODE1_SHIFT) |
(SWMODE_MASK << SWMODE2_SHIFT)));
val |= (SWMODE_AUTO_AUTO << SWMODE1_SHIFT) |
(SWMODE_AUTO_AUTO << SWMODE2_SHIFT);
- pmic_reg_write(REG_SW_4, val);
+ pmic_reg_write(p, REG_SW_4, val);
/* Setup the switcher mode for SW3 & SW4 */
- val = pmic_reg_read(REG_SW_5);
+ pmic_reg_read(p, REG_SW_5, &val);
val = (val & ~((SWMODE_MASK << SWMODE3_SHIFT) |
(SWMODE_MASK << SWMODE4_SHIFT)));
val |= (SWMODE_AUTO_AUTO << SWMODE3_SHIFT) |
(SWMODE_AUTO_AUTO << SWMODE4_SHIFT);
- pmic_reg_write(REG_SW_5, val);
+ pmic_reg_write(p, REG_SW_5, val);
/* Set VDIG to 1.65V, VGEN3 to 1.8V, VCAM to 2.6V */
- val = pmic_reg_read(REG_SETTING_0);
+ pmic_reg_read(p, REG_SETTING_0, &val);
val &= ~(VCAM_MASK | VGEN3_MASK | VDIG_MASK);
val |= VDIG_1_65 | VGEN3_1_8 | VCAM_2_6;
- pmic_reg_write(REG_SETTING_0, val);
+ pmic_reg_write(p, REG_SETTING_0, val);
/* Set VVIDEO to 2.775V, VAUDIO to 3V, VSD to 3.15V */
- val = pmic_reg_read(REG_SETTING_1);
+ pmic_reg_read(p, REG_SETTING_1, &val);
val &= ~(VVIDEO_MASK | VSD_MASK | VAUDIO_MASK);
val |= VSD_3_15 | VAUDIO_3_0 | VVIDEO_2_775;
- pmic_reg_write(REG_SETTING_1, val);
+ pmic_reg_write(p, REG_SETTING_1, val);
/* Configure VGEN3 and VCAM regulators to use external PNP */
val = VGEN3CONFIG | VCAMCONFIG;
- pmic_reg_write(REG_MODE_1, val);
+ pmic_reg_write(p, REG_MODE_1, val);
udelay(200);
gpio_direction_output(46, 0);
@@ -257,7 +259,7 @@ static void power_init(void)
/* Enable VGEN3, VCAM, VAUDIO, VVIDEO, VSD regulators */
val = VGEN3EN | VGEN3CONFIG | VCAMEN | VCAMCONFIG |
VVIDEOEN | VAUDIOEN | VSDEN;
- pmic_reg_write(REG_MODE_1, val);
+ pmic_reg_write(p, REG_MODE_1, val);
udelay(500);
@@ -414,6 +416,7 @@ int board_late_init(void)
{
#ifdef CONFIG_MXC_SPI
setup_iomux_spi();
+ pmic_init();
power_init();
#endif
return 0;
diff --git a/include/configs/mx51evk.h b/include/configs/mx51evk.h
index d62a4f2..6faaa6c 100644
--- a/include/configs/mx51evk.h
+++ b/include/configs/mx51evk.h
@@ -70,11 +70,15 @@
#define CONFIG_MXC_SPI
-#define CONFIG_FSL_PMIC
+/* PMIC Controller */
+#define CONFIG_PMIC
+#define CONFIG_PMIC_SPI
+#define CONFIG_PMIC_FSL
#define CONFIG_FSL_PMIC_BUS 0
#define CONFIG_FSL_PMIC_CS 0
#define CONFIG_FSL_PMIC_CLK 2500000
#define CONFIG_FSL_PMIC_MODE (SPI_MODE_0 | SPI_CS_HIGH)
+#define CONFIG_FSL_PMIC_BITLEN 32
/*
* MMC Configs
--
1.7.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [U-Boot] [PATCH 07/11] MX5: mx53evk: use new pmic driver
2011-10-08 10:06 [U-Boot] switch to generic PMIX driver for i.MX boards Stefano Babic
` (5 preceding siblings ...)
2011-10-08 10:07 ` [U-Boot] [PATCH 06/11] MX5: mx51evk: " Stefano Babic
@ 2011-10-08 10:07 ` Stefano Babic
2011-10-09 8:40 ` Jason Hui
2011-10-08 10:07 ` [U-Boot] [PATCH 08/11] MX31: mx31_litekit: " Stefano Babic
` (3 subsequent siblings)
10 siblings, 1 reply; 17+ messages in thread
From: Stefano Babic @ 2011-10-08 10:07 UTC (permalink / raw)
To: u-boot
Switch to new pmic generic driver.
Signed-off-by: Stefano Babic <sbabic@denx.de>
CC: Jason Liu <jason.hui@linaro.org>
---
board/freescale/mx53evk/mx53evk.c | 15 +++++++++------
include/configs/mx53evk.h | 5 +++--
2 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/board/freescale/mx53evk/mx53evk.c b/board/freescale/mx53evk/mx53evk.c
index fd821c0..af0948f 100644
--- a/board/freescale/mx53evk/mx53evk.c
+++ b/board/freescale/mx53evk/mx53evk.c
@@ -32,6 +32,7 @@
#include <i2c.h>
#include <mmc.h>
#include <fsl_esdhc.h>
+#include <pmic.h>
#include <fsl_pmic.h>
#include <asm/gpio.h>
#include <mc13892.h>
@@ -124,12 +125,13 @@ static void setup_i2c(unsigned int port_number)
void power_init(void)
{
unsigned int val;
+ struct pmic *p = get_pmic();
/* Set VDDA to 1.25V */
- val = pmic_reg_read(REG_SW_2);
+ pmic_reg_read(p, REG_SW_2, &val);
val &= ~SWX_OUT_MASK;
val |= SWX_OUT_1_25;
- pmic_reg_write(REG_SW_2, val);
+ pmic_reg_write(p, REG_SW_2, val);
/*
* Need increase VCC and VDDA to 1.3V
@@ -137,16 +139,16 @@ void power_init(void)
*/
if (is_soc_rev(CHIP_REV_2_0) == 0) {
/* Set VCC to 1.3V for TO2 */
- val = pmic_reg_read(REG_SW_1);
+ pmic_reg_read(p, REG_SW_1, &val);
val &= ~SWX_OUT_MASK;
val |= SWX_OUT_1_30;
- pmic_reg_write(REG_SW_1, val);
+ pmic_reg_write(p, REG_SW_1, val);
/* Set VDDA to 1.3V for TO2 */
- val = pmic_reg_read(REG_SW_2);
+ pmic_reg_read(p, REG_SW_2, &val);
val &= ~SWX_OUT_MASK;
val |= SWX_OUT_1_30;
- pmic_reg_write(REG_SW_2, val);
+ pmic_reg_write(p, REG_SW_2, val);
}
}
@@ -364,6 +366,7 @@ int board_init(void)
int board_late_init(void)
{
setup_i2c(1);
+ pmic_init();
power_init();
return 0;
diff --git a/include/configs/mx53evk.h b/include/configs/mx53evk.h
index b127b06..dfe07bf 100644
--- a/include/configs/mx53evk.h
+++ b/include/configs/mx53evk.h
@@ -59,8 +59,9 @@
#define CONFIG_SYS_I2C_SLAVE 0xfe
/* PMIC Configs */
-#define CONFIG_FSL_PMIC
-#define CONFIG_FSL_PMIC_I2C
+#define CONFIG_PMIC
+#define CONFIG_PMIC_I2C
+#define CONFIG_PMIC_FSL
#define CONFIG_SYS_FSL_PMIC_I2C_ADDR 8
/* MMC Configs */
--
1.7.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [U-Boot] [PATCH 08/11] MX31: mx31_litekit: use new pmic driver
2011-10-08 10:06 [U-Boot] switch to generic PMIX driver for i.MX boards Stefano Babic
` (6 preceding siblings ...)
2011-10-08 10:07 ` [U-Boot] [PATCH 07/11] MX5: mx53evk: " Stefano Babic
@ 2011-10-08 10:07 ` Stefano Babic
2011-10-08 10:07 ` [U-Boot] [PATCH 09/11] MX31: mx31ads: " Stefano Babic
` (2 subsequent siblings)
10 siblings, 0 replies; 17+ messages in thread
From: Stefano Babic @ 2011-10-08 10:07 UTC (permalink / raw)
To: u-boot
Switch to new pmic generic driver.
Signed-off-by: Stefano Babic <sbabic@denx.de>
---
include/configs/imx31_litekit.h | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/include/configs/imx31_litekit.h b/include/configs/imx31_litekit.h
index 5e976bc..65e301e 100644
--- a/include/configs/imx31_litekit.h
+++ b/include/configs/imx31_litekit.h
@@ -72,13 +72,16 @@
#define CONFIG_DEFAULT_SPI_BUS 1
#define CONFIG_DEFAULT_SPI_MODE (SPI_MODE_0 | SPI_CS_HIGH)
-#define CONFIG_FSL_PMIC
+/* PMIC Controller */
+#define CONFIG_PMIC
+#define CONFIG_PMIC_SPI
+#define CONFIG_PMIC_FSL
#define CONFIG_FSL_PMIC_BUS 1
#define CONFIG_FSL_PMIC_CS 0
#define CONFIG_FSL_PMIC_CLK 1000000
#define CONFIG_FSL_PMIC_MODE (SPI_MODE_0 | SPI_CS_HIGH)
-
-#define CONFIG_RTC_MC13783 1
+#define CONFIG_FSL_PMIC_BITLEN 32
+#define CONFIG_RTC_MC13783
/* allow to overwrite serial and ethaddr */
#define CONFIG_ENV_OVERWRITE
--
1.7.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [U-Boot] [PATCH 09/11] MX31: mx31ads: use new pmic driver
2011-10-08 10:06 [U-Boot] switch to generic PMIX driver for i.MX boards Stefano Babic
` (7 preceding siblings ...)
2011-10-08 10:07 ` [U-Boot] [PATCH 08/11] MX31: mx31_litekit: " Stefano Babic
@ 2011-10-08 10:07 ` Stefano Babic
2011-10-08 10:07 ` [U-Boot] [PATCH 10/11] MX31: mx31pdk: " Stefano Babic
2011-10-08 10:07 ` [U-Boot] [PATCH 11/11] misc: pmic: drop old Freescale's " Stefano Babic
10 siblings, 0 replies; 17+ messages in thread
From: Stefano Babic @ 2011-10-08 10:07 UTC (permalink / raw)
To: u-boot
Switch to new pmic generic driver.
Signed-off-by: Stefano Babic <sbabic@denx.de>
CC: Fabio Estevam <fabio.estevam@freescale.com>
---
include/configs/mx31ads.h | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/include/configs/mx31ads.h b/include/configs/mx31ads.h
index 0bea858..fcc5316 100644
--- a/include/configs/mx31ads.h
+++ b/include/configs/mx31ads.h
@@ -69,12 +69,16 @@
#define CONFIG_DEFAULT_SPI_MODE (SPI_MODE_0 | SPI_CS_HIGH)
#define CONFIG_MXC_GPIO
-#define CONFIG_FSL_PMIC
+/* PMIC Controller */
+#define CONFIG_PMIC
+#define CONFIG_PMIC_SPI
+#define CONFIG_PMIC_FSL
#define CONFIG_FSL_PMIC_BUS 1
#define CONFIG_FSL_PMIC_CS 0
#define CONFIG_FSL_PMIC_CLK 1000000
#define CONFIG_FSL_PMIC_MODE (SPI_MODE_0 | SPI_CS_HIGH)
-#define CONFIG_RTC_MC13783 1
+#define CONFIG_FSL_PMIC_BITLEN 32
+#define CONFIG_RTC_MC13783
/* allow to overwrite serial and ethaddr */
#define CONFIG_ENV_OVERWRITE
--
1.7.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [U-Boot] [PATCH 10/11] MX31: mx31pdk: use new pmic driver
2011-10-08 10:06 [U-Boot] switch to generic PMIX driver for i.MX boards Stefano Babic
` (8 preceding siblings ...)
2011-10-08 10:07 ` [U-Boot] [PATCH 09/11] MX31: mx31ads: " Stefano Babic
@ 2011-10-08 10:07 ` Stefano Babic
2011-10-08 10:07 ` [U-Boot] [PATCH 11/11] misc: pmic: drop old Freescale's " Stefano Babic
10 siblings, 0 replies; 17+ messages in thread
From: Stefano Babic @ 2011-10-08 10:07 UTC (permalink / raw)
To: u-boot
Switch to new pmic generic driver.
Signed-off-by: Stefano Babic <sbabic@denx.de>
CC: Fabio Estevam <fabio.estevam@freescale.com>
---
include/configs/mx31pdk.h | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/include/configs/mx31pdk.h b/include/configs/mx31pdk.h
index cd156d8..08c06e1 100644
--- a/include/configs/mx31pdk.h
+++ b/include/configs/mx31pdk.h
@@ -70,11 +70,15 @@
#define CONFIG_DEFAULT_SPI_BUS 1
#define CONFIG_DEFAULT_SPI_MODE (SPI_MODE_0 | SPI_CS_HIGH)
-#define CONFIG_FSL_PMIC
+/* PMIC Controller */
+#define CONFIG_PMIC
+#define CONFIG_PMIC_SPI
+#define CONFIG_PMIC_FSL
#define CONFIG_FSL_PMIC_BUS 1
#define CONFIG_FSL_PMIC_CS 2
#define CONFIG_FSL_PMIC_CLK 1000000
#define CONFIG_FSL_PMIC_MODE (SPI_MODE_0 | SPI_CS_HIGH)
+#define CONFIG_FSL_PMIC_BITLEN 32
#define CONFIG_RTC_MC13783
/* allow to overwrite serial and ethaddr */
--
1.7.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [U-Boot] [PATCH 11/11] misc: pmic: drop old Freescale's pmic driver
2011-10-08 10:06 [U-Boot] switch to generic PMIX driver for i.MX boards Stefano Babic
` (9 preceding siblings ...)
2011-10-08 10:07 ` [U-Boot] [PATCH 10/11] MX31: mx31pdk: " Stefano Babic
@ 2011-10-08 10:07 ` Stefano Babic
10 siblings, 0 replies; 17+ messages in thread
From: Stefano Babic @ 2011-10-08 10:07 UTC (permalink / raw)
To: u-boot
Signed-off-by: Stefano Babic <sbabic@denx.de>
---
drivers/misc/Makefile | 1 -
drivers/misc/fsl_pmic.c | 235 -----------------------------------------------
2 files changed, 0 insertions(+), 236 deletions(-)
delete mode 100644 drivers/misc/fsl_pmic.c
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index f732a95..a709707 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -28,7 +28,6 @@ LIB := $(obj)libmisc.o
COBJS-$(CONFIG_ALI152X) += ali512x.o
COBJS-$(CONFIG_DS4510) += ds4510.o
COBJS-$(CONFIG_FSL_LAW) += fsl_law.o
-COBJS-$(CONFIG_FSL_PMIC) += fsl_pmic.o
COBJS-$(CONFIG_GPIO_LED) += gpio_led.o
COBJS-$(CONFIG_FSL_MC9SDZ60) += mc9sdz60.o
COBJS-$(CONFIG_NS87308) += ns87308.o
diff --git a/drivers/misc/fsl_pmic.c b/drivers/misc/fsl_pmic.c
deleted file mode 100644
index 23255a5..0000000
--- a/drivers/misc/fsl_pmic.c
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- * (C) Copyright 2008-2009 Freescale Semiconductor, Inc.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * 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.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <config.h>
-#include <common.h>
-#include <asm/errno.h>
-#include <linux/types.h>
-#include <fsl_pmic.h>
-
-static int check_param(u32 reg, u32 write)
-{
- if (reg > 63 || write > 1) {
- printf("<reg num> = %d is invalid. Should be less then 63\n",
- reg);
- return -1;
- }
-
- return 0;
-}
-
-#ifdef CONFIG_FSL_PMIC_I2C
-#include <i2c.h>
-
-u32 pmic_reg(u32 reg, u32 val, u32 write)
-{
- unsigned char buf[4] = { 0 };
- u32 ret_val = 0;
-
- if (check_param(reg, write))
- return -1;
-
- if (write) {
- buf[0] = (val >> 16) & 0xff;
- buf[1] = (val >> 8) & 0xff;
- buf[2] = (val) & 0xff;
- if (i2c_write(CONFIG_SYS_FSL_PMIC_I2C_ADDR, reg, 1, buf, 3))
- return -1;
- } else {
- if (i2c_read(CONFIG_SYS_FSL_PMIC_I2C_ADDR, reg, 1, buf, 3))
- return -1;
- ret_val = buf[0] << 16 | buf[1] << 8 | buf[2];
- }
-
- return ret_val;
-}
-#else /* SPI interface */
-#include <spi.h>
-static struct spi_slave *slave;
-
-struct spi_slave *pmic_spi_probe(void)
-{
- return spi_setup_slave(CONFIG_FSL_PMIC_BUS,
- CONFIG_FSL_PMIC_CS,
- CONFIG_FSL_PMIC_CLK,
- CONFIG_FSL_PMIC_MODE);
-}
-
-void pmic_spi_free(struct spi_slave *slave)
-{
- if (slave)
- spi_free_slave(slave);
-}
-
-u32 pmic_reg(u32 reg, u32 val, u32 write)
-{
- u32 pmic_tx, pmic_rx;
- u32 tmp;
-
- if (!slave) {
- slave = pmic_spi_probe();
-
- if (!slave)
- return -1;
- }
-
- if (check_param(reg, write))
- return -1;
-
- if (spi_claim_bus(slave))
- return -1;
-
- pmic_tx = (write << 31) | (reg << 25) | (val & 0x00FFFFFF);
-
- tmp = cpu_to_be32(pmic_tx);
-
- if (spi_xfer(slave, 4 << 3, &tmp, &pmic_rx,
- SPI_XFER_BEGIN | SPI_XFER_END)) {
- spi_release_bus(slave);
- return -1;
- }
-
- if (write) {
- pmic_tx &= ~(1 << 31);
- tmp = cpu_to_be32(pmic_tx);
- if (spi_xfer(slave, 4 << 3, &tmp, &pmic_rx,
- SPI_XFER_BEGIN | SPI_XFER_END)) {
- spi_release_bus(slave);
- return -1;
- }
- }
-
- spi_release_bus(slave);
- return cpu_to_be32(pmic_rx);
-}
-#endif
-
-void pmic_reg_write(u32 reg, u32 value)
-{
- pmic_reg(reg, value, 1);
-}
-
-u32 pmic_reg_read(u32 reg)
-{
- return pmic_reg(reg, 0, 0);
-}
-
-void pmic_show_pmic_info(void)
-{
- u32 rev_id;
-
- rev_id = pmic_reg_read(REG_IDENTIFICATION);
- printf("PMIC ID: 0x%08x [Rev: ", rev_id);
- switch (rev_id & 0x1F) {
- case 0x1:
- puts("1.0");
- break;
- case 0x9:
- puts("1.1");
- break;
- case 0xA:
- puts("1.2");
- break;
- case 0x10:
- puts("2.0");
- break;
- case 0x11:
- puts("2.1");
- break;
- case 0x18:
- puts("3.0");
- break;
- case 0x19:
- puts("3.1");
- break;
- case 0x1A:
- puts("3.2");
- break;
- case 0x2:
- puts("3.2A");
- break;
- case 0x1B:
- puts("3.3");
- break;
- case 0x1D:
- puts("3.5");
- break;
- default:
- puts("unknown");
- break;
- }
- puts("]\n");
-}
-
-static void pmic_dump(int numregs)
-{
- u32 val;
- int i;
-
- pmic_show_pmic_info();
- for (i = 0; i < numregs; i++) {
- val = pmic_reg_read(i);
- if (!(i % 8))
- printf ("\n0x%02x: ", i);
- printf("%08x ", val);
- }
- puts("\n");
-}
-
-int do_pmic(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
- char *cmd;
- int nregs;
- u32 val;
-
- /*@least two arguments please */
- if (argc < 2)
- return cmd_usage(cmdtp);
-
- cmd = argv[1];
- if (strcmp(cmd, "dump") == 0) {
- if (argc < 3)
- return cmd_usage(cmdtp);
-
- nregs = simple_strtoul(argv[2], NULL, 16);
- pmic_dump(nregs);
- return 0;
- }
- if (strcmp(cmd, "write") == 0) {
- if (argc < 4)
- return cmd_usage(cmdtp);
-
- nregs = simple_strtoul(argv[2], NULL, 16);
- val = simple_strtoul(argv[3], NULL, 16);
- pmic_reg_write(nregs, val);
- return 0;
- }
- /* No subcommand found */
- return 1;
-}
-
-U_BOOT_CMD(
- pmic, CONFIG_SYS_MAXARGS, 1, do_pmic,
- "Freescale PMIC (Atlas)",
- "dump [numregs] - dump registers\n"
- "pmic write <reg> <value> - write register"
-);
--
1.7.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [U-Boot] [PATCH 02/11] MX5: efikamx/efikasb: use new pmic driver
2011-10-08 10:06 ` [U-Boot] [PATCH 02/11] MX5: efikamx/efikasb: " Stefano Babic
@ 2011-10-08 11:31 ` Marek Vasut
2011-10-08 14:38 ` Stefano Babic
0 siblings, 1 reply; 17+ messages in thread
From: Marek Vasut @ 2011-10-08 11:31 UTC (permalink / raw)
To: u-boot
On Saturday, October 08, 2011 12:06:59 PM Stefano Babic wrote:
> Switch to new pmic generic driver.
>
> Signed-off-by: Stefano Babic <sbabic@denx.de>
> CC: Marek Vasut <marek.vasut@gmail.com>
> ---
[...]
Hi Stefano,
> @@ -674,6 +676,7 @@ int board_late_init(void)
> {
> setup_iomux_spi();
>
> + pmic_init();
> power_init();
Can you move the pmic_init() to power_init(), it seems more logical.
Cheers
^ permalink raw reply [flat|nested] 17+ messages in thread
* [U-Boot] [PATCH 04/11] misc: pmic: addI2C support to pmic_fsl driver
2011-10-08 10:07 ` [U-Boot] [PATCH 04/11] misc: pmic: addI2C support to pmic_fsl driver Stefano Babic
@ 2011-10-08 13:57 ` Sergei Shtylyov
2011-10-08 14:37 ` Stefano Babic
0 siblings, 1 reply; 17+ messages in thread
From: Sergei Shtylyov @ 2011-10-08 13:57 UTC (permalink / raw)
To: u-boot
Hello.
On 08-10-2011 14:07, Stefano Babic wrote:
> Signed-off-by: Stefano Babic<sbabic@denx.de>
> ---
> drivers/misc/pmic_fsl.c | 18 ++++++++++++++----
> 1 files changed, 14 insertions(+), 4 deletions(-)
> diff --git a/drivers/misc/pmic_fsl.c b/drivers/misc/pmic_fsl.c
> index 13dde47..2945dfb 100644
> --- a/drivers/misc/pmic_fsl.c
> +++ b/drivers/misc/pmic_fsl.c
[...]
> @@ -33,25 +34,34 @@ static u32 pmic_spi_prepare_tx(u32 reg, u32 *val, u32 write)
> else
> return (write<< 31) | (reg<< 25) | (*val& 0x00FFFFFF);
> }
> +#endif
>
> int pmic_init(void)
> {
> struct pmic *p = get_pmic();
> static const char name[] = "FSL_PMIC";
>
> - puts("Board PMIC init\n");
> -
> p->name = name;
> - p->interface = PMIC_SPI;
> p->number_of_regs = PMIC_NUM_OF_REGS;
> - p->bus = CONFIG_FSL_PMIC_BUS;
>
> +#if defined(CONFIG_PMIC_SPI)
> + p->interface = PMIC_SPI;
> + p->bus = CONFIG_FSL_PMIC_BUS;
> p->hw.spi.cs = CONFIG_FSL_PMIC_CS;
> p->hw.spi.clk = CONFIG_FSL_PMIC_CLK;
> p->hw.spi.mode = CONFIG_FSL_PMIC_MODE;
> p->hw.spi.bitlen = CONFIG_FSL_PMIC_BITLEN;
> p->hw.spi.flags = SPI_XFER_BEGIN | SPI_XFER_END;
> p->hw.spi.prepare_tx = pmic_spi_prepare_tx;
> +#elif defined(CONFIG_PMIC_I2C)
> + p->interface = PMIC_SPI;
> + p->interface = PMIC_I2C;
You assign one value and immediately assign the other. First assignment
shouldn't be here.
WBR, Sergei
^ permalink raw reply [flat|nested] 17+ messages in thread
* [U-Boot] [PATCH 04/11] misc: pmic: addI2C support to pmic_fsl driver
2011-10-08 13:57 ` Sergei Shtylyov
@ 2011-10-08 14:37 ` Stefano Babic
0 siblings, 0 replies; 17+ messages in thread
From: Stefano Babic @ 2011-10-08 14:37 UTC (permalink / raw)
To: u-boot
On 10/08/2011 03:57 PM, Sergei Shtylyov wrote:
> Hello.
>
> On 08-10-2011 14:07, Stefano Babic wrote:
>
>> Signed-off-by: Stefano Babic<sbabic@denx.de>
>> ---
>> +#elif defined(CONFIG_PMIC_I2C)
>> + p->interface = PMIC_SPI;
>> + p->interface = PMIC_I2C;
>
> You assign one value and immediately assign the other. First
> assignment shouldn't be here.
Right - I drop it in V2, thanks.
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-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================
^ permalink raw reply [flat|nested] 17+ messages in thread
* [U-Boot] [PATCH 02/11] MX5: efikamx/efikasb: use new pmic driver
2011-10-08 11:31 ` Marek Vasut
@ 2011-10-08 14:38 ` Stefano Babic
0 siblings, 0 replies; 17+ messages in thread
From: Stefano Babic @ 2011-10-08 14:38 UTC (permalink / raw)
To: u-boot
On 10/08/2011 01:31 PM, Marek Vasut wrote:
> On Saturday, October 08, 2011 12:06:59 PM Stefano Babic wrote:
>> Switch to new pmic generic driver.
>>
>> Signed-off-by: Stefano Babic <sbabic@denx.de>
>> CC: Marek Vasut <marek.vasut@gmail.com>
>> ---
>
> [...]
>
> Hi Stefano,
>
>> @@ -674,6 +676,7 @@ int board_late_init(void)
>> {
>> setup_iomux_spi();
>>
>> + pmic_init();
>> power_init();
>
> Can you move the pmic_init() to power_init(), it seems more logical.
Ok - will be done in V2
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-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================
^ permalink raw reply [flat|nested] 17+ messages in thread
* [U-Boot] [PATCH 07/11] MX5: mx53evk: use new pmic driver
2011-10-08 10:07 ` [U-Boot] [PATCH 07/11] MX5: mx53evk: " Stefano Babic
@ 2011-10-09 8:40 ` Jason Hui
0 siblings, 0 replies; 17+ messages in thread
From: Jason Hui @ 2011-10-09 8:40 UTC (permalink / raw)
To: u-boot
Hi, Stefano,
On Sat, Oct 8, 2011 at 6:07 PM, Stefano Babic <sbabic@denx.de> wrote:
> Switch to new pmic generic driver.
>
> Signed-off-by: Stefano Babic <sbabic@denx.de>
> CC: Jason Liu <jason.hui@linaro.org>
> ---
> ?board/freescale/mx53evk/mx53evk.c | ? 15 +++++++++------
> ?include/configs/mx53evk.h ? ? ? ? | ? ?5 +++--
> ?2 files changed, 12 insertions(+), 8 deletions(-)
>
> diff --git a/board/freescale/mx53evk/mx53evk.c b/board/freescale/mx53evk/mx53evk.c
> index fd821c0..af0948f 100644
> --- a/board/freescale/mx53evk/mx53evk.c
> +++ b/board/freescale/mx53evk/mx53evk.c
> @@ -32,6 +32,7 @@
> ?#include <i2c.h>
> ?#include <mmc.h>
> ?#include <fsl_esdhc.h>
> +#include <pmic.h>
> ?#include <fsl_pmic.h>
> ?#include <asm/gpio.h>
> ?#include <mc13892.h>
> @@ -124,12 +125,13 @@ static void setup_i2c(unsigned int port_number)
> ?void power_init(void)
> ?{
> ? ? ? ?unsigned int val;
> + ? ? ? struct pmic *p = get_pmic();
>
> ? ? ? ?/* Set VDDA to 1.25V */
> - ? ? ? val = pmic_reg_read(REG_SW_2);
> + ? ? ? pmic_reg_read(p, REG_SW_2, &val);
> ? ? ? ?val &= ~SWX_OUT_MASK;
> ? ? ? ?val |= SWX_OUT_1_25;
> - ? ? ? pmic_reg_write(REG_SW_2, val);
> + ? ? ? pmic_reg_write(p, REG_SW_2, val);
>
> ? ? ? ?/*
> ? ? ? ? * Need increase VCC and VDDA to 1.3V
> @@ -137,16 +139,16 @@ void power_init(void)
> ? ? ? ? */
> ? ? ? ?if (is_soc_rev(CHIP_REV_2_0) == 0) {
> ? ? ? ? ? ? ? ?/* Set VCC to 1.3V for TO2 */
> - ? ? ? ? ? ? ? val = pmic_reg_read(REG_SW_1);
> + ? ? ? ? ? ? ? pmic_reg_read(p, REG_SW_1, &val);
> ? ? ? ? ? ? ? ?val &= ~SWX_OUT_MASK;
> ? ? ? ? ? ? ? ?val |= SWX_OUT_1_30;
> - ? ? ? ? ? ? ? pmic_reg_write(REG_SW_1, val);
> + ? ? ? ? ? ? ? pmic_reg_write(p, REG_SW_1, val);
>
> ? ? ? ? ? ? ? ?/* Set VDDA to 1.3V for TO2 */
> - ? ? ? ? ? ? ? val = pmic_reg_read(REG_SW_2);
> + ? ? ? ? ? ? ? pmic_reg_read(p, REG_SW_2, &val);
> ? ? ? ? ? ? ? ?val &= ~SWX_OUT_MASK;
> ? ? ? ? ? ? ? ?val |= SWX_OUT_1_30;
> - ? ? ? ? ? ? ? pmic_reg_write(REG_SW_2, val);
> + ? ? ? ? ? ? ? pmic_reg_write(p, REG_SW_2, val);
> ? ? ? ?}
> ?}
>
> @@ -364,6 +366,7 @@ int board_init(void)
> ?int board_late_init(void)
> ?{
> ? ? ? ?setup_i2c(1);
> + ? ? ? pmic_init();
> ? ? ? ?power_init();
>
> ? ? ? ?return 0;
> diff --git a/include/configs/mx53evk.h b/include/configs/mx53evk.h
> index b127b06..dfe07bf 100644
> --- a/include/configs/mx53evk.h
> +++ b/include/configs/mx53evk.h
> @@ -59,8 +59,9 @@
> ?#define CONFIG_SYS_I2C_SLAVE ? ? ? ? ? ?0xfe
>
> ?/* PMIC Configs */
> -#define CONFIG_FSL_PMIC
> -#define CONFIG_FSL_PMIC_I2C
> +#define CONFIG_PMIC
> +#define CONFIG_PMIC_I2C
> +#define CONFIG_PMIC_FSL
> ?#define CONFIG_SYS_FSL_PMIC_I2C_ADDR ? ?8
>
> ?/* MMC Configs */
Acked-by: Jason Liu <jason.hui@linaro.org>
> --
> 1.7.1
>
>
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2011-10-09 8:40 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-08 10:06 [U-Boot] switch to generic PMIX driver for i.MX boards Stefano Babic
2011-10-08 10:06 ` [U-Boot] [PATCH 01/11] MX3: qong: use new pmic driver Stefano Babic
2011-10-08 10:06 ` [U-Boot] [PATCH 02/11] MX5: efikamx/efikasb: " Stefano Babic
2011-10-08 11:31 ` Marek Vasut
2011-10-08 14:38 ` Stefano Babic
2011-10-08 10:07 ` [U-Boot] [PATCH 03/11] I2c: add missing i2c_set_bus_num to mxc_i2c Stefano Babic
2011-10-08 10:07 ` [U-Boot] [PATCH 04/11] misc: pmic: addI2C support to pmic_fsl driver Stefano Babic
2011-10-08 13:57 ` Sergei Shtylyov
2011-10-08 14:37 ` Stefano Babic
2011-10-08 10:07 ` [U-Boot] [PATCH 05/11] MX35: mx35pdk: use new pmic driver Stefano Babic
2011-10-08 10:07 ` [U-Boot] [PATCH 06/11] MX5: mx51evk: " Stefano Babic
2011-10-08 10:07 ` [U-Boot] [PATCH 07/11] MX5: mx53evk: " Stefano Babic
2011-10-09 8:40 ` Jason Hui
2011-10-08 10:07 ` [U-Boot] [PATCH 08/11] MX31: mx31_litekit: " Stefano Babic
2011-10-08 10:07 ` [U-Boot] [PATCH 09/11] MX31: mx31ads: " Stefano Babic
2011-10-08 10:07 ` [U-Boot] [PATCH 10/11] MX31: mx31pdk: " Stefano Babic
2011-10-08 10:07 ` [U-Boot] [PATCH 11/11] misc: pmic: drop old Freescale's " Stefano Babic
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox