public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Przemyslaw Marczak <p.marczak@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/4] imx: mx6slevk: Add PMIC Pfuze support
Date: Wed, 05 Nov 2014 10:41:55 +0100	[thread overview]
Message-ID: <5459F0E3.80202@samsung.com> (raw)
In-Reply-To: <5459E0C3.5010207@freescale.com>

Hello,

On 11/05/2014 09:33 AM, Li Ye-B37916 wrote:
> Hi Przemyslaw,
>
> On 11/4/2014 11:56 PM, Przemyslaw Marczak wrote:
>> Hello Ye Li,
>>
>> On 09/10/2014 11:08 AM, Ye.Li wrote:
>>> Initialize the Pfuze on I2C1 at board late init. The mx6slevk board
>>> has Pfuze100 or Pfuze200, print the chip type by parsing the ID.
>>>
>>> Signed-off-by: Ye.Li <B37916@freescale.com>
>>> ---
>>>    board/freescale/mx6slevk/mx6slevk.c |   57 +++++++++++++++++++++++++++++++++++
>>>    include/configs/mx6slevk.h          |    7 ++++
>>>    2 files changed, 64 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/board/freescale/mx6slevk/mx6slevk.c b/board/freescale/mx6slevk/mx6slevk.c
>>> index fedd5c3..8b6a79c 100644
>>> --- a/board/freescale/mx6slevk/mx6slevk.c
>>> +++ b/board/freescale/mx6slevk/mx6slevk.c
>>> @@ -21,6 +21,8 @@
>>>    #include <mmc.h>
>>>    #include <netdev.h>
>>>    #include <i2c.h>
>>> +#include <power/pmic.h>
>>> +#include <power/pfuze100_pmic.h>
>>>
>>>    DECLARE_GLOBAL_DATA_PTR;
>>>
>>> @@ -48,6 +50,8 @@ DECLARE_GLOBAL_DATA_PTR;
>>>
>>>    #define PC MUX_PAD_CTRL(I2C_PAD_CTRL)
>>>
>>> +#define I2C_PMIC    0
>>> +
>>>    /* I2C1 for PMIC */
>>>    struct i2c_pads_info i2c_pad_info0 = {
>>>        .sda = {
>>> @@ -191,6 +195,59 @@ int board_init(void)
>>>        return 0;
>>>    }
>>>
>>> +static int pfuze_init(void)
>>> +{
>>> +    struct pmic *p;
>>> +    int ret;
>>> +    unsigned int reg;
>>> +
>>> +    ret = power_pfuze100_init(I2C_PMIC);
>>> +    if (ret)
>>> +        return ret;
>>> +
>>> +    p = pmic_get("PFUZE100");
>>> +    ret = pmic_probe(p);
>>> +    if (ret)
>>> +        return ret;
>>> +
>>> +    pmic_reg_read(p, PFUZE100_DEVICEID, &reg);
>>> +    printf("PMIC:  PFUZE%s ID=0x%02x\n",
>>> +        ((reg & 0xf) == 0) ? "100" : "200", reg);
>>> +
>>> +    /* Set SW1AB stanby volage to 0.975V */
>>> +    pmic_reg_read(p, PFUZE100_SW1ABSTBY, &reg);
>>> +    reg &= ~0x3f;
>>> +    reg |= 0x1b;
>>> +    pmic_reg_write(p, PFUZE100_SW1ABSTBY, reg);
>>> +
>>> +    /* Set SW1AB/VDDARM step ramp up time from 16us to 4us/25mV */
>>> +    pmic_reg_read(p, PUZE_100_SW1ABCONF, &reg);
>>> +    reg &= ~0xc0;
>>> +    reg |= 0x40;
>>> +    pmic_reg_write(p, PUZE_100_SW1ABCONF, reg);
>>> +
>>> +    /* Set SW1C standby voltage to 0.975V */
>>> +    pmic_reg_read(p, PFUZE100_SW1CSTBY, &reg);
>>> +    reg &= ~0x3f;
>>> +    reg |= 0x1b;
>>> +    pmic_reg_write(p, PFUZE100_SW1CSTBY, reg);
>>> +
>>> +    /* Set SW1C/VDDSOC step ramp up time from 16us to 4us/25mV */
>>> +    pmic_reg_read(p, PFUZE100_SW1CCONF, &reg);
>>> +    reg &= ~0xc0;
>>> +    reg |= 0x40;
>>> +    pmic_reg_write(p, PFUZE100_SW1CCONF, reg);
>>> +
>>> +    return 0;
>>> +}
>>> +
>>> +int board_late_init(void)
>>> +{
>>> +    pfuze_init();
>>> +
>>> +    return 0;
>>> +}
>>
>> Why not use power_init_board()?
>> It's dedicated and called at common/board_r.c.
>>
> Good suggestion, will change to use the power_init_board in v2.
>

The power_init_board is called much more earlier, then please make sure 
that everything will work for you.

>>> +
>>>    u32 get_board_rev(void)
>>>    {
>>>        return get_cpu_rev();
>>> diff --git a/include/configs/mx6slevk.h b/include/configs/mx6slevk.h
>>> index bf5066f..09d0896 100644
>>> --- a/include/configs/mx6slevk.h
>>> +++ b/include/configs/mx6slevk.h
>>> @@ -30,6 +30,7 @@
>>>    #define CONFIG_SYS_MALLOC_LEN        (3 * SZ_1M)
>>>
>>>    #define CONFIG_BOARD_EARLY_INIT_F
>>> +#define CONFIG_BOARD_LATE_INIT
>>>    #define CONFIG_MXC_GPIO
>>>
>>>    #define CONFIG_MXC_UART
>>> @@ -66,6 +67,12 @@
>>>    #define CONFIG_SYS_I2C_MXC
>>>    #define CONFIG_SYS_I2C_SPEED          100000
>>>
>>> +/* PMIC */
>>> +#define CONFIG_POWER
>>> +#define CONFIG_POWER_I2C
>>> +#define CONFIG_POWER_PFUZE100
>>> +#define CONFIG_POWER_PFUZE100_I2C_ADDR    0x08
>>
>> I assume that the I2C addr is const, if yes then it should be moved to the PFUZE100 header.
>>
> It is not const. The default I2C address is 0x08.  But it can be programmed from 0x08 to 0x0F by setting
> OTP_I2C_ADDR register.
>

Yes, so the PMIC header is a good place for the default definitions. But 
I see that each board defines the same address for it. So leave it as it 
is.

>>> +
>>>    /* allow to overwrite serial and ethaddr */
>>>    #define CONFIG_ENV_OVERWRITE
>>>    #define CONFIG_CONS_INDEX        1
>>>
>>
>> Thank you,
>
> Best regards,
> Ye Li
>

Best regards,
-- 
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com

  reply	other threads:[~2014-11-05  9:41 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-10  9:08 [U-Boot] [PATCH 1/4] imx: mx6slevk: Add I2C1 support Ye.Li
2014-09-10  9:08 ` [U-Boot] [PATCH 2/4] imx: mx6slevk: Add PMIC Pfuze support Ye.Li
2014-10-30 10:36   ` Stefano Babic
2014-11-04  9:24     ` Li Ye-B37916
2014-11-04  9:37       ` Li Ye-B37916
2014-11-04 14:09         ` Przemyslaw Marczak
2014-11-05  8:28           ` Li Ye-B37916
2014-11-05  9:27             ` Przemyslaw Marczak
2014-11-04 15:56   ` Przemyslaw Marczak
2014-11-05  8:33     ` Li Ye-B37916
2014-11-05  9:41       ` Przemyslaw Marczak [this message]
2014-12-22 12:25       ` Fabio Estevam
2014-09-10  9:08 ` [U-Boot] [PATCH 3/4] imx: mx6sabresd: Add clear print for pfuze200 Ye.Li
2014-09-10  9:08 ` [U-Boot] [PATCH 4/4] imx: mx6: Set Pfuze mode to decrease power number for DSM Ye.Li
2014-09-10 12:14   ` Fabio Estevam
2014-11-04 15:57   ` Przemyslaw Marczak
2014-11-05  9:34     ` Li Ye-B37916

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5459F0E3.80202@samsung.com \
    --to=p.marczak@samsung.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox