All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Doug Anderson <dianders@chromium.org>
Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
	Andy Gross <agross@kernel.org>,
	linux-arm-msm <linux-arm-msm@vger.kernel.org>
Subject: Re: [PATCH 1/2] arm64: dts: qcom: sm8250: add pinctrl for SPI using GPIO as a CS
Date: Mon, 8 Feb 2021 12:04:44 -0600	[thread overview]
Message-ID: <YCF9PKJl0HZrKBz1@builder.lan> (raw)
In-Reply-To: <CAD=FV=UY_AFRrAY0tef5jP698LEng6oN652LcX3B4nG=aWh0gA@mail.gmail.com>

On Mon 08 Feb 09:58 CST 2021, Doug Anderson wrote:

> Hi,
> 
> On Fri, Feb 5, 2021 at 8:48 AM Bjorn Andersson
> <bjorn.andersson@linaro.org> wrote:
> >
> > On Fri 05 Feb 09:00 CST 2021, Doug Anderson wrote:
> >
> > > Hi,
> > >
> > > On Thu, Feb 4, 2021 at 4:25 PM Bjorn Andersson
> > > <bjorn.andersson@linaro.org> wrote:
> > > >
> > > > > > > +                             mux {
> > > > > >
> > > > > > Rather than splitting the properties in {mux, cs, config} I think it
> > > > > > makes more sense to split them in {spi, cs} or something like that.
> > > > >
> > > > > In general pinconf doesn't belong in the SoC dts file.  If there's no
> > > > > reason to change it seems like this should match what sc7180 did.
> > > > >
> > > >
> > > > Right, but I still would prefer the pinctrl state to be split by
> > > > function/pins, rather than pinmux vs pinconf. That way it's natural to
> > > > add pinconf properties to the various functional parts (i.e. bias or
> > > > drive-strength for the spi pins vs cs).
> > > >
> > > > Do you have any concerns with this?
> > >
> > > I read this a few times and I'm not exactly sure what you're
> > > proposing.  Can you provide an example of what you want it to look
> > > like in this case?
> > >
> >
> > Today in most cases we group pinctrl properties by being a "conf" of a
> > "mux" property, so we end up with:
> >
> > the_state: spi-state {
> >         all-the-mux-properties {
> >                 pins = "gpio40", gpio41", "gpio42", "gpio43";
> >                 function = qup14";
> >         };
> >
> >         repeat-pins-and-add-all-conf-properties {
> >                 pins = "gpio40", gpio41", "gpio42", "gpio43";
> >                 drive-strength = <6>;
> >                 bias-disable;
> >         };
> > };
> >
> > This made sense to me after implementing the driver, there's muxing to
> > be done and there's electrical configuration to configure.
> >
> > But what's actually trying to describe is a hardware state; i.e. that
> > miso, mosi, clk and cs should be acting in a particular fashion.
> >
> > In particular this lends itself useful when the hardware state consists
> > of different functions, a good example being the Bluetooth UART, or in
> > the SPI-with-separate-GPIO:
> >
> > the_state: spi-state {
> >         miso-mosi-clk {
> >                 pins = "gpio40", gpio41", "gpio42"
> >                 function = qup14";
> >                 drive-strength = <6>;
> >                 bias-disable;
> >         };
> >
> >         cs {
> >                 pins = "gpio43";
> >                 function = "gpio";
> >                 drive-strength = <6>;
> >                 bias-disable;
> >         };
> > };
> >
> >
> > For the case of uniform configuration across the state we've come to
> > sprinkle a few different synonyms for "pinconf" and "pinmux" in the
> > state nodes. But a few years ago someone updated the state parser to
> > handle cases either directly in the state or in subnodes. So we can
> > avoid these boilerplate nodes with a simple:
> >
> > the_state: spi-state {
> >         pins = "gpio40", gpio41", "gpio42", "gpio43";
> >         function = qup14";
> >         drive-strength = <6>;
> >         bias-disable;
> > };
> 
> OK, this makes sense to me.  I always felt like the extra "pinconf" /
> "pinmux" made things awkward.

I'm happy to hear that :)

> I guess someone should try to convert some SoC dtsi fully over so we
> can see how it looks?

Sounds good. I feel fairly confident, so let's pick SM8250 and aim to
land this patch in the "new" form.

> In this case I think you'd have something like this, right?
> 
> SoC dtsi:
> 
> tlmm: pinctrl@... {
>   qup_spi0_data_clk: qup-spi0-data-clk {
>     pins = "gpio28", "gpio29", "gpio30";
>     function = "qup0";
>   };
> 
>   qup_spi0_cs: qup-spi0-cs {
>     pins = "gpio31";
>     function = "qup0";
>   };
> 
>   qup_spi0_cs_gpio: qup-spi0-cs-gpio {
>     pins = "gpio31";
>     function = "gpio";
>   };
> };
> 
> Board dts:
> 
> &spi0 {
>   pinctrl-0 = <&qup_spi0_data_clk>, &<qup_spi0_cs_gpio>;
> };
> 
> &qup_spi0_data_clk {
>   drive-strength = <6>;
>   bias-disable;
> };
> 
> &qup_spi0_cs_gpio {
>   drive-strength = <6>;
>   bias-disable;
> };

Correct. And providing a common state for the 3 non-cs pins and using
the pinctrl-0 to select which kind of cs we want looks even better.

Regards,
Bjorn

  reply	other threads:[~2021-02-08 18:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-04 20:49 [PATCH 1/2] arm64: dts: qcom: sm8250: add pinctrl for SPI using GPIO as a CS Dmitry Baryshkov
2021-02-04 20:49 ` [PATCH 2/2] arm64: dts: qcom: qrb5165-rb5: switch into using GPIO for SPI0 CS Dmitry Baryshkov
2021-02-04 23:07 ` [PATCH 1/2] arm64: dts: qcom: sm8250: add pinctrl for SPI using GPIO as a CS Bjorn Andersson
2021-02-04 23:31   ` Doug Anderson
2021-02-05  0:08     ` Dmitry Baryshkov
2021-02-05  0:25     ` Bjorn Andersson
2021-02-05 15:00       ` Doug Anderson
2021-02-05 16:48         ` Bjorn Andersson
2021-02-08 15:58           ` Doug Anderson
2021-02-08 18:04             ` Bjorn Andersson [this message]
2021-02-09 10:21               ` Dmitry Baryshkov

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=YCF9PKJl0HZrKBz1@builder.lan \
    --to=bjorn.andersson@linaro.org \
    --cc=agross@kernel.org \
    --cc=dianders@chromium.org \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    /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.