lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJF2gTSeKnB=Zc6o1wJAOyax7d=RmDJ0o8PSOfkVo5BYVc=sAw@mail.gmail.com>
Date:   Sat, 23 Sep 2023 16:10:11 +0800
From:   Guo Ren <guoren@...nel.org>
To:     Drew Fustini <dfustini@...libre.com>
Cc:     Conor Dooley <conor@...nel.org>,
        Ulf Hansson <ulf.hansson@...aro.org>,
        Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        Conor Dooley <conor+dt@...nel.org>,
        Jisheng Zhang <jszhang@...nel.org>,
        Adrian Hunter <adrian.hunter@...el.com>,
        Fu Wei <wefu@...hat.com>,
        Paul Walmsley <paul.walmsley@...ive.com>,
        Palmer Dabbelt <palmer@...belt.com>,
        Albert Ou <aou@...s.berkeley.edu>,
        Robert Nelson <robertcnelson@...gleboard.org>,
        Jason Kridner <jkridner@...gleboard.org>,
        Xi Ruoyao <xry111@...111.site>, Han Gao <gaohan@...as.ac.cn>,
        Icenowy Zheng <uwu@...nowy.me>, linux-mmc@...r.kernel.org,
        devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-riscv@...ts.infradead.org
Subject: Re: [PATCH 1/6] dt-bindings: mmc: sdhci-of-dwcmhsc: Add T-Head TH1520 support

On Fri, Sep 22, 2023 at 11:18 PM Drew Fustini <dfustini@...libre.com> wrote:
>
> On Fri, Sep 22, 2023 at 10:57:36AM +0100, Conor Dooley wrote:
> > Hey Drew,
> >
> > On Thu, Sep 21, 2023 at 06:49:48PM -0700, Drew Fustini wrote:
> > > Add compatible value for the T-Head TH1520 dwcmshc controller and add
> > > thead,phy-pull-up property.
> > >
> > > Signed-off-by: Drew Fustini <dfustini@...libre.com>
> > > ---
> > >  Documentation/devicetree/bindings/mmc/snps,dwcmshc-sdhci.yaml | 4 ++++
> > >  1 file changed, 4 insertions(+)
> > >
> > > diff --git a/Documentation/devicetree/bindings/mmc/snps,dwcmshc-sdhci.yaml b/Documentation/devicetree/bindings/mmc/snps,dwcmshc-sdhci.yaml
> > > index a43eb837f8da..46b768d46712 100644
> > > --- a/Documentation/devicetree/bindings/mmc/snps,dwcmshc-sdhci.yaml
> > > +++ b/Documentation/devicetree/bindings/mmc/snps,dwcmshc-sdhci.yaml
> > > @@ -19,6 +19,7 @@ properties:
> > >        - rockchip,rk3568-dwcmshc
> > >        - rockchip,rk3588-dwcmshc
> > >        - snps,dwcmshc-sdhci
> > > +      - thead,th1520-dwcmshc
> > >
> > >    reg:
> > >      maxItems: 1
> > > @@ -60,6 +61,9 @@ properties:
> > >      description: Specify the number of delay for tx sampling.
> > >      $ref: /schemas/types.yaml#/definitions/uint8
> > >
> > > +  thead,phy-pull-up:
> > > +    description: Enable weak pull-up on PHY pads
> > > +    type: boolean
> >
> > Why is the weak pull-up required? How would the dts author know if they
> > need to use this property?
>
> This is a good question, and I don't have a good reason beyond it is
> what the vendor SDK was doing.
>
> There are only two boards right now using the TH1520 that I know of.
> Both the LPi4a [1] and the Ahead [2] have the pull-up property set on
> all the mmc controller nodes their downstream device trees.
>
> Rob suggested on #devicetree that it would be simpler to just enable it
> in the driver and disable support when needed. I like this idea as it
> will simplify this binding patch and the code in the driver patch.
It's for the PHY debug. You could directly remove them, or keep it
with no-pull-up flag, then no pull-up flag in the dts for default..

static void sdhci_phy_1_8v_init_no_pull(struct sdhci_host *host)
{
        uint32_t val;
        sdhci_writel(host, 1, DWC_MSHC_PTR_PHY_R);
        sdhci_writeb(host, 1 << 4, PHY_SDCLKDL_CNFG_R);
        sdhci_writeb(host, 0x40, PHY_SDCLKDL_DC_R);

        val = sdhci_readb(host, PHY_SDCLKDL_CNFG_R);
        val &= ~(1 << 4);
        sdhci_writeb(host, val, PHY_SDCLKDL_CNFG_R);


        val = sdhci_readw(host, PHY_CMDPAD_CNFG_R);
        sdhci_writew(host, val | 1, PHY_CMDPAD_CNFG_R);

        val = sdhci_readw(host, PHY_DATAPAD_CNFG_R);
        sdhci_writew(host, val | 1, PHY_DATAPAD_CNFG_R);

        val = sdhci_readw(host, PHY_RSTNPAD_CNFG_R);
        sdhci_writew(host, val | 1, PHY_RSTNPAD_CNFG_R);

        val = sdhci_readw(host, PHY_STBPAD_CNFG_R);
        sdhci_writew(host, val | 1, PHY_STBPAD_CNFG_R);

        val = sdhci_readb(host, PHY_DLL_CTRL_R);
        sdhci_writeb(host, val | 1, PHY_DLL_CTRL_R);
}

static void sdhci_phy_3_3v_init_no_pull(struct sdhci_host *host)
{
        uint32_t val;
        sdhci_writel(host, 1, DWC_MSHC_PTR_PHY_R);
        sdhci_writeb(host, 1 << 4, PHY_SDCLKDL_CNFG_R);
        sdhci_writeb(host, 0x40, PHY_SDCLKDL_DC_R);

        val = sdhci_readb(host, PHY_SDCLKDL_CNFG_R);
        val &= ~(1 << 4);
        sdhci_writeb(host, val, PHY_SDCLKDL_CNFG_R);

        val = sdhci_readw(host, PHY_CMDPAD_CNFG_R);
        sdhci_writew(host, val | 2, PHY_CMDPAD_CNFG_R);

        val = sdhci_readw(host, PHY_DATAPAD_CNFG_R);
        sdhci_writew(host, val | 2, PHY_DATAPAD_CNFG_R);

        val = sdhci_readw(host, PHY_RSTNPAD_CNFG_R);
        sdhci_writew(host, val | 2, PHY_RSTNPAD_CNFG_R);

        val = sdhci_readw(host, PHY_STBPAD_CNFG_R);
        sdhci_writew(host, val | 2, PHY_STBPAD_CNFG_R);

        val = sdhci_readb(host, PHY_DLL_CTRL_R);
        sdhci_writeb(host, val | 1, PHY_DLL_CTRL_R);
}

>
> Thanks,
> Drew
>
> [1] https://git.beagleboard.org/beaglev-ahead/BeagleBoard-DeviceTrees/-/blob/v5.10.x-ti-unified/src/riscv/light-beagle-ref.dts
> [2] https://github.com/revyos/thead-kernel/blob/lpi4a/arch/riscv/boot/dts/thead/light-lpi4a-ref.dts



-- 
Best Regards
 Guo Ren

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ