[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFBinCAYNvBtNwZdKJVUpObogjaiAx0W0Y-cnOL7RtARhYOW_g@mail.gmail.com>
Date: Sat, 11 May 2019 18:46:19 +0200
From: Martin Blumenstingl <martin.blumenstingl@...glemail.com>
To: Guillaume La Roque <glaroque@...libre.com>
Cc: linus.walleij@...aro.org, khilman@...libre.com,
linux-gpio@...r.kernel.org, devicetree@...r.kernel.org,
linux-amlogic@...ts.infradead.org, linux-kernel@...r.kernel.org,
jbrunet@...libre.com
Subject: Re: [PATCH v5 5/6] pinctrl: meson: add support of drive-strength-microamp
Hi Guillaume,
On Fri, May 10, 2019 at 10:23 AM Guillaume La Roque
<glaroque@...libre.com> wrote:
>
> drive-strength-microamp is a new feature needed for G12A SoC.
> the default DS setting after boot is usually 500uA and it is not enough for
> many functions. We need to be able to set the drive strength to reliably
> enable things like MMC, I2C, etc ...
>
> Signed-off-by: Guillaume La Roque <glaroque@...libre.com>
Reviewed-by: Martin Blumenstingl<martin.blumenstingl@...glemail.com>
the warning messages when printing pinconf-pins (in debugfs) are gone
on my Meson8m2 board so:
Tested-by: Martin Blumenstingl<martin.blumenstingl@...glemail.com>
[...]
> +static int meson_pinconf_set_drive_strength(struct meson_pinctrl *pc,
> + unsigned int pin,
> + u16 drive_strength_ua)
> +{
> + struct meson_bank *bank;
> + unsigned int reg, bit, ds_val;
> + int ret;
> +
> + if (!pc->reg_ds) {
> + dev_err(pc->dev, "drive-strength not supported\n");
> + return -ENOTSUPP;
> + }
> +
> + ret = meson_get_bank(pc, pin, &bank);
> + if (ret)
> + return ret;
> +
> + meson_calc_reg_and_bit(bank, pin, REG_DS, ®, &bit);
> + bit = bit << 1;
I was confused by this shifting (not sure why I haven't noticed this
in earlier revisions). however, it all made sense after I did the
maths for two examples:
BOOT_0 uses drive-strength register 0x0 bits [1:0] so the result
should be "bit = 0"
meson_calc_reg_and_bit returns bit = 0
0 << 1 = 0, so this seems right
BOOT_15 uses drive-strength register 0x0 bits [31:30] so the result
should be "bit = 30"
meson_calc_reg_and_bit returns bit = 15
15 << 1 = 30
so all seems fine, even though it wasn't obvious to me at first sight
that it's all good
Martin
Powered by blists - more mailing lists