All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bin Meng <bmeng.cn@gmail.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Simon Glass <sjg@chromium.org>,
	U-Boot Mailing List <u-boot@lists.denx.de>
Subject: Re: [PATCH v1 1/2] x86: tangier: Enable support for SD/SDIO family in the pinmux driver
Date: Wed, 27 Oct 2021 10:49:10 +0800	[thread overview]
Message-ID: <CAEUhbmXYCZg1e2PF5fQz7_Wd7TQd4Cta8de4PdPcux2qnPG5SQ@mail.gmail.com> (raw)
In-Reply-To: <20211015171147.51948-1-andriy.shevchenko@linux.intel.com>

Hi Andy,

On Sat, Oct 16, 2021 at 1:27 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> We would need to quirk out Card Detect case and for that we allow
> configuring SD/SDIO family of pins.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  arch/x86/cpu/tangier/pinmux.c | 39 ++++++++++++++++++++++++++++++-----
>  1 file changed, 34 insertions(+), 5 deletions(-)
>
> diff --git a/arch/x86/cpu/tangier/pinmux.c b/arch/x86/cpu/tangier/pinmux.c
> index acf97e3af51d..8385167b2b6b 100644
> --- a/arch/x86/cpu/tangier/pinmux.c
> +++ b/arch/x86/cpu/tangier/pinmux.c
> @@ -37,8 +37,9 @@ struct mrfld_family {
>                 .npins = (e) - (s) + 1,                 \
>         }
>
> -/* Now we only support I2C family of pins */
> +/* Now we only support SD/SDIO and I2C families of pins */
>  static struct mrfld_family mrfld_families[] = {
> +       MRFLD_FAMILY(3, 37, 56),
>         MRFLD_FAMILY(7, 101, 114),
>  };
>
> @@ -125,6 +126,34 @@ static int mrfld_pinconfig_protected(unsigned int pin, u32 mask, u32 bits)
>         return ret;
>  }
>
> +static int mrfld_pinconfig(unsigned int pin, u32 mask, u32 bits)
> +{
> +       struct mrfld_pinctrl *pinctrl;
> +       struct udevice *dev;
> +       void __iomem *bufcfg;
> +       u32 v, value;
> +       int ret;
> +
> +       ret = syscon_get_by_driver_data(X86_SYSCON_PINCONF, &dev);
> +       if (ret)
> +               return ret;
> +
> +       pinctrl = dev_get_priv(dev);
> +
> +       bufcfg = mrfld_get_bufcfg(pinctrl, pin);
> +       if (!bufcfg)
> +               return -EINVAL;
> +
> +       value = readl(bufcfg);
> +       v = (value & ~mask) | (bits & mask);
> +       writel(v, bufcfg);
> +
> +       debug("v: 0x%x p: 0x%x bits: %d, mask: %d bufcfg: 0x%p\n",
> +             v, (u32)bufcfg, bits, mask, bufcfg);
> +
> +       return 0;

This function can be consolidated with mrfld_pinconfig_protected(),
ie: updating mrfld_pinconfig_protected() to call mrfld_pinconfig().

> +}
> +
>  static int mrfld_pinctrl_cfg_pin(ofnode pin_node)
>  {
>         bool is_protected;
> @@ -133,10 +162,7 @@ static int mrfld_pinctrl_cfg_pin(ofnode pin_node)
>         u32 mask;
>         int ret;
>
> -       /* For now we only support just protected Family of pins */
>         is_protected = ofnode_read_bool(pin_node, "protected");
> -       if (!is_protected)
> -               return -ENOTSUPP;
>
>         pad_offset = ofnode_read_s32_default(pin_node, "pad-offset", -1);
>         if (pad_offset == -1)
> @@ -152,7 +178,10 @@ static int mrfld_pinctrl_cfg_pin(ofnode pin_node)
>         if (mode & ~mask)
>                 return -ENOTSUPP;
>
> -       ret = mrfld_pinconfig_protected(pad_offset, mask, mode);
> +       if (is_protected)
> +               ret = mrfld_pinconfig_protected(pad_offset, mask, mode);
> +       else
> +               ret = mrfld_pinconfig(pad_offset, mask, mode);
>
>         return ret;
>  }

Regards,
Bin

  parent reply	other threads:[~2021-10-27  2:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-15 17:11 [PATCH v1 1/2] x86: tangier: Enable support for SD/SDIO family in the pinmux driver Andy Shevchenko
2021-10-15 17:11 ` [PATCH v1 2/2] x86: edison: Don't take SD card detect pin into consideration Andy Shevchenko
2021-10-20 21:00   ` Ferry Toth
2021-10-21  8:20     ` Andy Shevchenko
2021-10-27  2:56   ` Bin Meng
2021-10-27  8:51     ` Andy Shevchenko
2021-10-27 10:10       ` Bin Meng
2021-10-27 11:16         ` Andy Shevchenko
2021-10-27  2:49 ` Bin Meng [this message]
2021-10-27  8:53   ` [PATCH v1 1/2] x86: tangier: Enable support for SD/SDIO family in the pinmux driver Andy Shevchenko
2021-10-27 10:14     ` Bin Meng
2021-10-27 10:55       ` Andy Shevchenko

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=CAEUhbmXYCZg1e2PF5fQz7_Wd7TQd4Cta8de4PdPcux2qnPG5SQ@mail.gmail.com \
    --to=bmeng.cn@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=sjg@chromium.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.