switch to generic PMIX driver for i.MX boards
Subsystems (3)
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(-)
PATCH 1/11 MX3: qong: use new pmic driver
Switch to new pmic generic driver.
--- board/davedenx/qong/qong.c | 11 ++++++++--- include/configs/qong.h | 5 ++++- 2 files changed, 12 insertions(+), 4 deletions(-)
board/davedenx/qong/qong.c +8 -3
@@ -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 ();
include/configs/qong.h +4 -1
@@ -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
Signature · 1 line
1.7.1
PATCH 2/11 MX5: efikamx/efikasb: use new pmic driver
In reply to Stefano BabicSwitch to new pmic generic driver.
--- board/efikamx/efikamx.c | 49 +++++++++++++++++++++++--------------------- include/configs/efikamx.h | 5 +++- 2 files changed, 30 insertions(+), 24 deletions(-)
board/efikamx/efikamx.c +26 -23
@@ -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 ();
include/configs/efikamx.h +4 -1
@@ -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
Signature · 1 line
1.7.1
PATCH 2/11 MX5: efikamx/efikasb: use new pmic driver
Quoted 5 lines · Stefano Babic
Switch to new pmic generic driver.
Signed-off-by Stefano Babic <[email protected]>CC Marek Vasut <[email protected]>---
[...]
Hi Stefano,
board/efikamx/efikamx.c int board_late_init(void) · line 680
Quoted 6 lines
board/efikamx/efikamx.c +1
-0@@ -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
PATCH 2/11 MX5: efikamx/efikasb: use new pmic driver
Quoted 11 lines · Marek Vasut
Quoted 5 lines · Stefano Babic
Switch to new pmic generic driver.
Signed-off-by Stefano Babic <[email protected]>CC Marek Vasut <[email protected]>---
[...]
Hi Stefano,
Quoted 8 lines
board/efikamx/efikamx.c int board_late_init(void) · line 680
Quoted 6 lines
board/efikamx/efikamx.c +1
-0@@ -674,6 +676,7 @@ int board_late_init(void) {setup_iomux_spi (); +pmic_init ();power_init ();Can you move the
pmic_init()topower_init(), it seems more logical.
Ok - will be done in V2
Best regards,
Stefano babic
Signature · 5 lines
===================================================================== 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 =====================================================================
PATCH 3/11 I2c: add missing i2c_set_bus_num to mxc_i2c
In reply to Stefano BabicThe 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).
--- drivers/i2c/mxc_i2c.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/i2c/mxc_i2c.c +5 -0
@@ -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 */
Signature · 1 line
1.7.1
PATCH 4/11 misc: pmic: addI2C support to pmic_fsl driver
In reply to Stefano Babic--- drivers/misc/pmic_fsl.c | 18 ++++++++++++++---- 1 files changed, 14 insertions(+), 4 deletions(-)
drivers/misc/pmic_fsl.c +14 -4
@@ -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 ; }
Signature · 1 line
1.7.1
PATCH 4/11 misc: pmic: addI2C support to pmic_fsl driver
Hello.
Quoted 9 lines · Stefano Babic
Signed-off-by Stefano Babic<[email protected]>--- drivers/misc/pmic_fsl.c | 18 ++++++++++++++---- 1 files changed, 14 insertions(+), 4 deletions(-)drivers/misc/pmic_fsl.c +0
-0
[...]
Quoted 20 lines
drivers/misc/pmic_fsl.c +3
-4@@ -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 ;
drivers/misc/pmic_fsl.c static u32 pmic_spi_prepare_tx(u32 reg, u32 *val, u32 write) · line 58
Quoted 10 lines
drivers/misc/pmic_fsl.c +4
-0+ 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
PATCH 4/11 misc: pmic: addI2C support to pmic_fsl driver
Quoted 4 lines · Sergei Shtylyov
Hello.
On 08-10-2011 14:07, Stefano Babic wrote:
Quoted 8 lines
drivers/misc/pmic_fsl.c static u32 pmic_spi_prepare_tx(u32 reg, u32 *val, u32 write) · line 58
Quoted 5 lines
Signed-off-by Stefano Babic<[email protected]>---
drivers/misc/pmic_fsl.c +3
-0+#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
Signature · 5 lines
===================================================================== 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 =====================================================================
PATCH 5/11 MX35: mx35pdk: use new pmic driver
In reply to Stefano BabicSwitch to new pmic generic driver.
--- board/freescale/mx35pdk/mx35pdk.c | 18 ++++++++++++------ include/configs/mx35pdk.h | 5 +++-- 2 files changed, 15 insertions(+), 8 deletions(-)
board/freescale/mx35pdk/mx35pdk.c +12 -6
@@ -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 );
include/configs/mx35pdk.h +3 -2
@@ -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/*
Signature · 1 line
1.7.1
PATCH 6/11 MX5: mx51evk: use new pmic driver
In reply to Stefano BabicSwitch to new pmic generic driver.
--- board/freescale/mx51evk/mx51evk.c | 45 +++++++++++++++++++----------------- include/configs/mx51evk.h | 6 ++++- 2 files changed, 29 insertions(+), 22 deletions(-)
board/freescale/mx51evk/mx51evk.c +24 -21
@@ -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 ;
include/configs/mx51evk.h +5 -1
@@ -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
Signature · 1 line
1.7.1
PATCH 7/11 MX5: mx53evk: use new pmic driver
In reply to Stefano BabicSwitch to new pmic generic driver.
--- board/freescale/mx53evk/mx53evk.c | 15 +++++++++------ include/configs/mx53evk.h | 5 +++-- 2 files changed, 12 insertions(+), 8 deletions(-)
board/freescale/mx53evk/mx53evk.c +9 -6
@@ -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 ;
include/configs/mx53evk.h +3 -2
@@ -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 */
Signature · 1 line
1.7.1
PATCH 7/11 MX5: mx53evk: use new pmic driver
Hi, Stefano,
Quoted 81 lines · Stefano Babic
Switch to new pmic generic driver.
Signed-off-by Stefano Babic <[email protected]>CC Jason Liu <[email protected]>---
?board/freescale/mx53evk/mx53evk.c | ? 15 +++++++++------ ?include/configs/mx53evk.h ? ? ? ? | ? ?5 +++-- ?2 files changed, 12 insertions(+), 8 deletions(-)board/freescale/mx53evk/mx53evk.c +0
-0@@ -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>board/freescale/mx53evk/mx53evk.c +1
-0@@ -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.3Vboard/freescale/mx53evk/mx53evk.c +0
-0@@ -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);
? ? ? ?}
?}board/freescale/mx53evk/mx53evk.c +1
-0@@ -364,6 +366,7 @@ int board_init(void) ?int board_late_init(void) ?{ ? ? ? ?setup_i2c(1); + ? ? ? pmic_init(); ? ? ? ?power_init(); ? ? ? ?return 0;include/configs/mx53evk.h +0
-0@@ -59,8 +59,9 @@?#define
CONFIG_SYS_I2C_SLAVE? ? ? ? ? ?0xfe?/* PMIC Configs */
include/configs/mx53evk.h +3
-2-#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
Quoted 1 line
?/* MMC Configs */
Quoted 4 lines
--
1.7.1
PATCH 8/11 MX31: mx31_litekit: use new pmic driver
In reply to Stefano BabicSwitch to new pmic generic driver.
--- include/configs/imx31_litekit.h | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-)
include/configs/imx31_litekit.h +6 -3
@@ -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
Signature · 1 line
1.7.1
PATCH 9/11 MX31: mx31ads: use new pmic driver
In reply to Stefano BabicSwitch to new pmic generic driver.
--- include/configs/mx31ads.h | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-)
include/configs/mx31ads.h +6 -2
@@ -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
Signature · 1 line
1.7.1
PATCH 10/11 MX31: mx31pdk: use new pmic driver
In reply to Stefano BabicSwitch to new pmic generic driver.
--- include/configs/mx31pdk.h | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
include/configs/mx31pdk.h +5 -1
@@ -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 */
Signature · 1 line
1.7.1
PATCH 11/11 misc: pmic: drop old Freescale's pmic driver
In reply to Stefano Babic--- 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
drivers/misc/Makefile +0 -1
@@ -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
drivers/misc/fsl_pmic.c deleted +0 -235
235 lines not on this page · raw message
Signature · 1 line
1.7.1