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 28/55] dm: pmic: max77686: Support all BUCK regulators
Date: Thu, 30 Jul 2015 10:22:26 +0200	[thread overview]
Message-ID: <55B9DEC2.3060304@samsung.com> (raw)
In-Reply-To: <CAPnjgZ3-SgBYGLDBTQDczKS_KzPBdrfu69D2OH4TJvm+CDHZiA@mail.gmail.com>

Hello Simon,

On 07/30/2015 04:05 AM, Simon Glass wrote:
> Hi Przemyslaw,
>
> On 10 July 2015 at 05:53, Przemyslaw Marczak <p.marczak@samsung.com> wrote:
>>
>> Hello Simon,
>>
>> On 07/03/2015 02:16 AM, Simon Glass wrote:
>>>
>>> Add support for all BUCK regulators, now that the correct register is
>>> accessed for each.
>>>
>>> Signed-off-by: Simon Glass <sjg@chromium.org>
>>>
>>> ---
>>>
>>>    drivers/power/regulator/max77686.c | 10 +++-------
>>>    1 file changed, 3 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/drivers/power/regulator/max77686.c b/drivers/power/regulator/max77686.c
>>> index 21173fc..427b717 100644
>>> --- a/drivers/power/regulator/max77686.c
>>> +++ b/drivers/power/regulator/max77686.c
>>> @@ -81,11 +81,7 @@ static int max77686_buck_volt2hex(int buck, int uV)
>>>                  /* hex = (uV - 600000) / 12500; */
>>>                  hex = (uV - MAX77686_BUCK_UV_LMIN) / MAX77686_BUCK_UV_LSTEP;
>>>                  hex_max = MAX77686_BUCK234_VOLT_MAX_HEX;
>>> -               /**
>>> -                * Those use voltage scaller - temporary not implemented
>>> -                * so return just 0
>>> -                */
>>> -               return -ENOSYS;
>>> +               break;
>>>          default:
>>>                  /* hex = (uV - 750000) / 50000; */
>>>                  hex = (uV - MAX77686_BUCK_UV_HMIN) / MAX77686_BUCK_UV_HSTEP;
>>> @@ -379,11 +375,11 @@ static int max77686_buck_val(struct udevice *dev, int op, int *uV)
>>>          case 2:
>>>          case 3:
>>>          case 4:
>>> -               /* Those use voltage scallers - will support in the future */
>>>                  mask = MAX77686_BUCK234_VOLT_MASK;
>>> -               return -ENOSYS;
>>> +               break;
>>>          default:
>>>                  mask = MAX77686_BUCK_VOLT_MASK;
>>> +               break;
>>>          }
>>>
>>>          ret = pmic_read(dev->parent, adr, &val, 1);
>>>
>>
>> The bucks 2,3,4 can work in DVS mode, which allows select one of eight DVS regulators for each output. The default selection at power-on is DVS1 for each output, and it corresponds to the currently defined output register addresses.
>>
>> The selection can be done by six PMIC's GPIOs:
>> - DVS1/2/3 - output selection: 0x0=DVS1...0x7=DVS8
>> - SELB2/3/4 - mode switch: 'DVS' or 'no DVS'
>>
>> Reading or writing the default registers is proper only in case:
>> - for the default PMIC's power-up setting - may conflict with bl1/bl2
>> - when DVS1/2/3 GPIOs are set to LOW - DVS1 selected
>> - SELB2/3/4 - are set to LOW - no DVS mode
>>
>> The documentation is poor, but if I good understand, the SELB is used as "latch" for the DVS selection.
>>
>> So the driver, could be unreliable for these outputs if it doesn't check the PMIC's GPIOs.
>>
>> It's quite confusing, since the PMIC, doesn't provide registers to check those GPIOs. It should be checked by the driver and can be delivered by device-tree.
>>
>> This is also confusing, since it depends on board design, because the PMIC's GPIOs can be connected to the SoCs GPIOs and also just pulled to POWER/GND signals.
>>
>> The documentation says, that those GPIOs should be set accordingly, and for example Odroid U3 has connected the SELB to VDD_IO(LDO3) power line, so actually this state can not be changed or can be changed by accident when changing the VDD_IO - which is HIGH at PMIC's power-up.
>>
>> The switching is impossible, since the VDD_IO line is shared with few other peripherals.
>>
>> In this case, maybe you should add config to allow use of the BUCK234 only for case in which DVS mode is disabled by board design (SELB2/3/4 set to LOW). This may also work, when the GPIOs of Exynos stays in the reset state.
>>
>> Then, using the default 'buck_out' registers: 0x14, 0x1e, 0x28 is reasonable.
>
> I don't see anything in the binding. I have added a comment in the
> driver to explain this limitation. However I haven't actually seen
> hardware that makes use of it. Are you saying that Odroid U3 does use
> it, or just that it has the lines connected up incorrectly?
>

Right, the binding for those GPIOs don't exists, since change of those 
registers values was not supported by the driver before.

I looked into the bl2 code from the Hardkernel's U-Boot (we are using 
it's signed bl2 binary for U3). There is a code for smdk4212/smdk4412, 
which is reused for Odroid U3 and the bl2 MAX77686 driver configures the 
DVS/SELB gpios. Unfortunately the GPIO is invalid, probably it is valid 
for smdk.

Code:
https://github.com/hardkernel/u-boot/blob/odroid-v2010.12/board/samsung/smdk4212/pmic.c#L707


In the hardkernel's code we can also see the MAX77686 driver for 
smdk5250, which also sets the DVS/SELB by GPD/GPX pins in a proper way.

Code:
https://github.com/hardkernel/u-boot/blob/odroid-v2010.12/board/samsung/smdk5250/pmic.c#L546


>>
>> Did you tried measure the output voltage, after its change?
>
> No I have not measured it, only verified that the code looks correct.
> If you are able to do that I think it would be a good test.
>

At present I can't measure it, but it should be verified in the future.
But if you can notice a stability change after setting those registers, 
then we can assume, that it works.

>>
>> Regards,
>> --
>> Przemyslaw Marczak
>> Samsung R&D Institute Poland
>> Samsung Electronics
>> p.marczak at samsung.com
>
> Regards,
> Simon
>

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

  reply	other threads:[~2015-07-30  8:22 UTC|newest]

Thread overview: 139+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-03  0:15 [U-Boot] [PATCH 00/55] dm: exynos: Driver model improvements leading to spring support Simon Glass
2015-07-03  0:15 ` [U-Boot] [PATCH 01/55] dm: core: Support finding a device by phandle Simon Glass
2015-07-27 23:28   ` Simon Glass
2015-07-03  0:15 ` [U-Boot] [PATCH 02/55] dm: i2c: Add a message debug function Simon Glass
2015-07-03  6:52   ` Heiko Schocher denx
2015-07-27 23:28     ` Simon Glass
2015-07-03  0:15 ` [U-Boot] [PATCH 03/55] dm: i2c: Correct comment nits in dm_i2c_reg_read/write() Simon Glass
2015-07-03  6:53   ` Heiko Schocher denx
2015-07-27 23:28     ` Simon Glass
2015-07-03  0:15 ` [U-Boot] [PATCH 04/55] dm: i2c: Move definitions to the top of the header file Simon Glass
2015-07-03  6:55   ` Heiko Schocher denx
2015-07-27 23:28     ` Simon Glass
2015-07-03  0:15 ` [U-Boot] [PATCH 05/55] dm: i2c: Add a function to transfer messages Simon Glass
2015-07-03  6:58   ` Heiko Schocher denx
2015-07-27 23:28     ` Simon Glass
2015-07-03  0:15 ` [U-Boot] [PATCH 06/55] dm: i2c: Add support for multiplexed I2C buses Simon Glass
2015-07-05  6:10   ` Heiko Schocher
2015-07-06 16:38     ` Simon Glass
2015-07-03  0:15 ` [U-Boot] [PATCH 07/55] exynos: i2c: Correct bug in pinmux selection Simon Glass
2015-07-05  6:15   ` Heiko Schocher
2015-07-06 15:27     ` Simon Glass
2015-07-07  1:36       ` Minkyu Kang
2015-07-08  2:38         ` Simon Glass
2015-07-10  1:43           ` Minkyu Kang
2015-07-10  1:46             ` Simon Glass
2015-07-10  8:56               ` Przemyslaw Marczak
2015-07-10 12:14               ` Minkyu Kang
2015-07-07  6:51   ` Przemyslaw Marczak
2015-07-03  0:15 ` [U-Boot] [PATCH 08/55] i2c: Add a mux for GPIO-based I2C bus arbitration Simon Glass
2015-07-05  6:43   ` Heiko Schocher
2015-07-06 16:38     ` Simon Glass
2015-07-03  0:15 ` [U-Boot] [PATCH 09/55] exynos: i2c: Fix code style with ReadWriteByte() Simon Glass
2015-07-05  6:45   ` Heiko Schocher
2015-07-27 23:29     ` Simon Glass
2015-07-03  0:15 ` [U-Boot] [PATCH 10/55] exynos: i2c: Tidy up the driver model code Simon Glass
2015-07-06  5:40   ` Heiko Schocher
2015-07-27 23:28     ` Simon Glass
2015-07-03  0:15 ` [U-Boot] [PATCH 11/55] exynos: dts: Sync up I2C ports with the kernel Simon Glass
2015-07-10 11:51   ` Przemyslaw Marczak
2015-07-27 23:29     ` Simon Glass
2015-07-03  0:15 ` [U-Boot] [PATCH 12/55] exynos: dts: Add PMIC and regulator definitions Simon Glass
2015-07-10 11:51   ` Przemyslaw Marczak
2015-07-27 23:29     ` Simon Glass
2015-07-03  0:15 ` [U-Boot] [PATCH 13/55] exynos: dts: Support EC tunnel and main TPS65090 regulator Simon Glass
2015-07-27 23:29   ` Simon Glass
2015-07-03  0:15 ` [U-Boot] [PATCH 14/55] dm: cros_ec: Convert the I2C tunnel code to use driver model Simon Glass
2015-07-03  0:15 ` [U-Boot] [PATCH 15/55] cros_ec: Support the LDO access method used by spring Simon Glass
2015-07-03  0:15 ` [U-Boot] [PATCH 16/55] exynos: serial: Refactor init code for debug UART Simon Glass
2015-07-27 23:29   ` Simon Glass
2015-07-03  0:15 ` [U-Boot] [PATCH 17/55] exynos: Add debug UART support for Samsung S5P serial Simon Glass
2015-07-27 23:29   ` Simon Glass
2015-07-03  0:15 ` [U-Boot] [PATCH 18/55] exynos: Enable the debug UART in SPL Simon Glass
2015-07-27 23:30   ` Simon Glass
2015-07-03  0:15 ` [U-Boot] [PATCH 19/55] dm: gpio: Add support for setting a GPIO's pull direction Simon Glass
2015-07-05  4:55   ` Masahiro Yamada
2015-07-06 16:39     ` Simon Glass
2015-07-06 17:20       ` Masahiro Yamada
2015-07-06 17:33         ` Simon Glass
2015-07-03  0:15 ` [U-Boot] [PATCH 20/55] dm: exynos: gpio: Support pull-up/down in GPIOs Simon Glass
2015-07-03  0:15 ` [U-Boot] [PATCH 21/55] dm: power: Add a new driver for the TPS65090 PMIC Simon Glass
2015-07-10 11:52   ` Przemyslaw Marczak
2015-07-27 23:30     ` Simon Glass
2015-07-03  0:15 ` [U-Boot] [PATCH 22/55] dm: power: Add support for TPS65090 FETs Simon Glass
2015-07-10 11:52   ` Przemyslaw Marczak
2015-07-27 23:30     ` Simon Glass
2015-07-03  0:16 ` [U-Boot] [PATCH 23/55] dm: power: Add support for the S5M8767 PMIC Simon Glass
2015-07-10 11:52   ` Przemyslaw Marczak
2015-07-27 23:30     ` Simon Glass
2015-07-03  0:16 ` [U-Boot] [PATCH 24/55] dm: power: Add support for S5M8767 regulators Simon Glass
2015-07-10 11:52   ` Przemyslaw Marczak
2015-07-27 23:30     ` Simon Glass
2015-07-03  0:16 ` [U-Boot] [PATCH 25/55] dm: pmic: max77686: Correct a few nits Simon Glass
2015-07-10 11:53   ` Przemyslaw Marczak
2015-07-27 23:30     ` Simon Glass
2015-07-28  6:19       ` Przemyslaw Marczak
2015-08-03 14:02         ` Simon Glass
2015-07-03  0:16 ` [U-Boot] [PATCH 26/55] dm: pmic: Correct the pmic_reg_write() implementation Simon Glass
2015-07-10 11:53   ` Przemyslaw Marczak
2015-07-27 23:30     ` Simon Glass
2015-07-03  0:16 ` [U-Boot] [PATCH 27/55] dm: power: max77686: Correct BUCK register access Simon Glass
2015-07-10 11:53   ` Przemyslaw Marczak
2015-07-27 23:30     ` Simon Glass
2015-07-03  0:16 ` [U-Boot] [PATCH 28/55] dm: pmic: max77686: Support all BUCK regulators Simon Glass
2015-07-10 11:53   ` Przemyslaw Marczak
2015-07-30  2:05     ` Simon Glass
2015-07-30  8:22       ` Przemyslaw Marczak [this message]
2015-08-03 14:05         ` Simon Glass
2015-07-03  0:16 ` [U-Boot] [PATCH 29/55] dm: power: Don't return an error when regulators are not autoset Simon Glass
2015-07-10 11:54   ` Przemyslaw Marczak
2015-07-27 23:30     ` Simon Glass
2015-07-03  0:16 ` [U-Boot] [PATCH 30/55] dm: pmic: Display the regulator limits on error Simon Glass
2015-07-10 11:54   ` Przemyslaw Marczak
2015-07-27 23:30     ` Simon Glass
2015-07-03  0:16 ` [U-Boot] [PATCH 31/55] dm: video: Add support for video bridges Simon Glass
2015-07-27 23:30   ` Simon Glass
2015-07-03  0:16 ` [U-Boot] [PATCH 32/55] dm: video: Add support for the Parade PS8622/625 bridge Simon Glass
2015-07-27 23:30   ` Simon Glass
2015-07-03  0:16 ` [U-Boot] [PATCH 33/55] dm: video: Add support for the NXP PTN3460 bridge Simon Glass
2015-07-27 23:30   ` Simon Glass
2015-07-03  0:16 ` [U-Boot] [PATCH 34/55] exynos: spi: Convert the timeout to debug() Simon Glass
2015-07-27 23:30   ` Simon Glass
2015-07-03  0:16 ` [U-Boot] [PATCH 35/55] exynos: Correct return value in exynos_mmc_init() Simon Glass
2015-07-27 23:31   ` Simon Glass
2015-07-03  0:16 ` [U-Boot] [PATCH 36/55] exynos: Add support for the DisplayPort hotplug detect Simon Glass
2015-07-27 23:31   ` Simon Glass
2015-07-03  0:16 ` [U-Boot] [PATCH 37/55] exynos: video: Correct debug output Simon Glass
2015-07-27 23:31   ` Simon Glass
2015-07-03  0:16 ` [U-Boot] [PATCH 38/55] exynos: Tidy up CPU frequency display Simon Glass
2015-07-27 23:31   ` Simon Glass
2015-07-03  0:16 ` [U-Boot] [PATCH 39/55] dm: gpio: Check a GPIO is valid before using it Simon Glass
2015-07-27 23:31   ` Simon Glass
2015-07-03  0:16 ` [U-Boot] [PATCH 40/55] dts: exynos: snow: Add memory layout description Simon Glass
2015-07-27 23:31   ` Simon Glass
2015-07-03  0:16 ` [U-Boot] [PATCH 41/55] dts: exynos: pit: Add a new node for the parade video bridge driver Simon Glass
2015-07-27 23:31   ` Simon Glass
2015-07-03  0:16 ` [U-Boot] [PATCH 42/55] dts: exynos: snow: Add a new node for the NXP " Simon Glass
2015-07-27 23:31   ` Simon Glass
2015-07-03  0:16 ` [U-Boot] [PATCH 43/55] exynos: dts: Drop the old TPS65090 I2C node Simon Glass
2015-07-03  0:16 ` [U-Boot] [PATCH 44/55] exynos: Add common board code for exynos5 boards that use device tree Simon Glass
2015-07-03  0:16 ` [U-Boot] [PATCH 45/55] exynos: Enable new features for exynos5 boards Simon Glass
2015-07-10 11:55   ` Przemyslaw Marczak
2015-07-28 16:29     ` Simon Glass
2015-07-03  0:16 ` [U-Boot] [PATCH 46/55] exynos: Remove unneeded device tree control #ifdefs Simon Glass
2015-07-27 23:31   ` Simon Glass
2015-07-03  0:16 ` [U-Boot] [PATCH 47/55] exynos: config: Move common options to the common headers and tidy up Simon Glass
2015-07-10 11:56   ` Przemyslaw Marczak
2015-07-03  0:16 ` [U-Boot] [PATCH 48/55] exynos: Drop old exynos5420-specific board code Simon Glass
2015-07-10 11:56   ` Przemyslaw Marczak
2015-07-03  0:16 ` [U-Boot] [PATCH 49/55] exynos: Drop old exynos5250-specific " Simon Glass
2015-07-03  0:16 ` [U-Boot] [PATCH 50/55] power: Remove old TPS65090 drivers Simon Glass
2015-07-10 11:56   ` Przemyslaw Marczak
2015-07-03  0:16 ` [U-Boot] [PATCH 51/55] cros_ec: Remove the old tunnel code Simon Glass
2015-07-03  0:16 ` [U-Boot] [PATCH 52/55] video: Remove the old parade driver Simon Glass
2015-07-03  0:16 ` [U-Boot] [PATCH 53/55] dts: Drop unused compatible ID for the NXP video bridge Simon Glass
2015-07-03  0:16 ` [U-Boot] [PATCH 54/55] exynos: video: Remove non-device-tree code Simon Glass
2015-07-03  0:16 ` [U-Boot] [PATCH 55/55] exynos: Add support for spring Simon Glass
2015-07-20 14:19 ` [U-Boot] [PATCH 00/55] dm: exynos: Driver model improvements leading to spring support Simon Glass
2015-07-22  4:52   ` Minkyu Kang
2015-07-23  2:08     ` Simon Glass

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=55B9DEC2.3060304@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