Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1586840

Re: [PATCH 2/2] [2/2] mmc: sdhci-cadence: Update PHY delay configuration

Path csiph.com!news.redatomik.org!newsfeed.datemas.de!weretis.net!feeder4.news.weretis.net!news.unit0.net!news.panservice.it!bofh.it!news.nic.it!robomod
From Masahiro Yamada <yamada.masahiro@socionext.com>
Newsgroups linux.kernel
Subject Re: [PATCH 2/2] [2/2] mmc: sdhci-cadence: Update PHY delay configuration
Date Thu, 23 Feb 2017 12:50:02 +0100
Message-ID <te04i-HT-5@gated-at.bofh.it> (permalink)
References <tbuBA-6P1-11@gated-at.bofh.it> <tbuBB-6P1-17@gated-at.bofh.it> <tbw0F-82M-7@gated-at.bofh.it> <tbRya-5mq-27@gated-at.bofh.it>
Dkim-Filter OpenDKIM Filter v2.10.3 conssluserg-06.nifty.com v1NBlB39001546
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1487850432; bh=finaLfr8i/WnRQOr0mQTbKoLBGrmHCIC2lKdkCz3Sh8=; h=In-Reply-To:References:From:Date:Subject:To:Cc:From; b=QiGKh6Dl7YsH2Vinu0IPlCERS2Jko/dakyzvGXr8xo8yOapzjPQJ4fNkmxTYW6NfC DMTXPSNK2lhQ98yNgQnQf6MDE2HWCCGwkh8wfMZtSJwQWEbTbqCNoAqm9jyVJ4L4YH Nwk55cvay9YSBc1dIRdmGTntja8cA7RrRSD0qVZj5isJlNWe3zs2Yl2v+6crITtxu7 GIQuWi2PWu6rLqnMsnyV3Q6IU90aK5wZxPcwoxwC+u64skxIQyNPuKcqAYw1ga6dYs 4lv1MKlkozElKLvpxDLP1SHrDzc3UbvJm0mwnGKGgliDcK3dEE/TEPYUbtYUacvdfj flbxu6ZO/nUAw==
X-Nifty-Srcip [209.85.213.179]
X-Gm-Message-State AMke39nwqu/GF3JmpV/ERzuzjzYIGie0Y6wm6rfS9k30uIZCPP8ec8uDpYo64ZnSAudcWCLEJDnPKTkf5w/b1Q==
X-Received by 10.37.181.154 with SMTP id q26mr26163965ybj.69.1487850430598; Thu, 23 Feb 2017 03:47:10 -0800 (PST)
MIME-Version 1.0
X-Gmail-Original-Message-ID <CAK7LNARh=cNON0ufHKzcxs2C9Brw+_hSiFj-SUh3GCpRpGqjkw@mail.gmail.com>
Content-Type text/plain; charset=UTF-8
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 143
Organization linux.* mail to news gateway
X-Original-Cc Ulf Hansson <ulf.hansson@linaro.org>, "linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>, Rob Herring <robh+dt@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Adrian Hunter <adrian.hunter@intel.com>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, "devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
X-Original-Date Thu, 23 Feb 2017 20:47:10 +0900
X-Original-Message-ID <CAK7LNARh=cNON0ufHKzcxs2C9Brw+_hSiFj-SUh3GCpRpGqjkw@mail.gmail.com>
X-Original-References <1487250413-5769-1-git-send-email-piotrs@cadence.com> <1487250413-5769-2-git-send-email-piotrs@cadence.com> <CAPDyKFqsuzT9NXARMJtey_kZ0y2GsdOxZGsjbodWA1EXw_ZSzw@mail.gmail.com> <MWHPR07MB308848FCAB0C9A6A7976B09BDD5D0@MWHPR07MB3088.namprd07.prod.outlook.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1586840

Show key headers only | View raw


Hi.

2017-02-17 23:12 GMT+09:00 Piotr Sroka <piotrs@cadence.com>:
>> -----Original Message-----
>> From: Ulf Hansson [mailto:ulf.hansson@linaro.org]
>> Sent: 16 February, 2017 4:10 PM
>> Subject: Re: [PATCH 2/2] [2/2] mmc: sdhci-cadence: Update PHY delay
>> configuration
>>
>> On 16 February 2017 at 14:06, Piotr Sroka <piotrs@cadence.com> wrote:
>> > DTS properties are used instead of fixed data because PHY settings can
>> > be different for different platforms.
>> > Configuration of new three PHY delays were added
>> >
>> > Signed-off-by: Piotr Sroka <piotrs@cadence.com>
>> > ---
>> >  .../devicetree/bindings/mmc/sdhci-cadence.txt      | 54 ++++++++++++++
>>
>> Please split this patch.
>>
>> DT docs should be a separate patch and make sure it precedes the changes
>> where the new bindings are being parsed in the driver code.
>>
>
> Ok I will do it in next version of patch.
>
>> >  drivers/mmc/host/sdhci-cadence.c                   | 83 +++++++++++++++++++-
>> --
>> >  2 files changed, 129 insertions(+), 8 deletions(-)
>> >
>> > diff --git a/Documentation/devicetree/bindings/mmc/sdhci-cadence.txt
>> > b/Documentation/devicetree/bindings/mmc/sdhci-cadence.txt
>> > index c0f37cb..221d3fe 100644
>> > --- a/Documentation/devicetree/bindings/mmc/sdhci-cadence.txt
>> > +++ b/Documentation/devicetree/bindings/mmc/sdhci-cadence.txt
>> > @@ -19,6 +19,59 @@ if supported.  See mmc.txt for details.
>> >  - mmc-hs400-1_8v
>> >  - mmc-hs400-1_2v
>> >
>> > +- phy-input-delay-sd-hs:
>> > +  Value of the delay in the input path for High Speed work mode.
>> > +  Valid range = [0:0x1F].

Instead of bunch of new bindings,
a data associated with an SoC specific compatible will do in most cases.


static const struct of_device_id sdhci_cdns_match[] = {
        {
                .compatible = "socionext,uniphier-sd4hc",
                .data = sdhci_cdns_uniphier_phy_data,
        },
        { .compatible = "cdns,sd4hc" },
        { /* sentinel */ }
};


Strictly speaking, the DLL delays will depend on board design as well as SoC.
So, DT bindings would be more flexible, though.





>> Please specify what unit this in. And then also a suffix, like "-ns"
>> to the name of the binding.
>
> The delay starts from 5ns (for delay parameter equal to 0), and it is increased by 2.5ns.
> 0 - means 5ns, 1 means 7.5 ns etc.


In short, all the DT values here are
kind of mysterious register values for the PHY.



>
>> > +               if (ret)
>> > +                       return ret;
>> > +       }
>> > +       if (!of_property_read_u32(np, "phy-dll-delay-sdclk-hsmmc", &tmp)) {
>> > +               ret = sdhci_cdns_write_phy_reg(priv,
>> > +                                              SDHCI_CDNS_PHY_DLY_HSMMC, tmp);
>> > +               if (ret)
>> > +                       return ret;
>> > +       }
>> > +       if (!of_property_read_u32(np, "phy-dll-delay-strobe", &tmp)) {
>> > +               ret = sdhci_cdns_write_phy_reg(priv,
>> > +                                              SDHCI_CDNS_PHY_DLY_STROBE, tmp);
>> > +               if (ret)
>> > +                       return ret;
>> > +       }
>> > +       return 0;


The repeat of the same pattern,
"look up a DT property, then if it exists, set it to a register."


Maybe, is it better to describe it with data array + loop, like this?


struct sdhci_cdns_phy_cfg {
        const char *property;
        u8 addr;
};

static const struct sdhci_cdns_phy_cfg sdhci_cdns_phy_cfgs[] =  {
        { "phy-input-delay-sd-hs", SDHCI_CDNS_PHY_DLY_SD_HS, },
        { "phy-input-delay-sd-default", SDHCI_CDNS_PHY_DLY_SD_DEFAULT, },
        { "phy-input-delay-sd-sdr12", SDHCI_CDNS_PHY_DLY_UHS_SDR12, },
        { "phy-input-delay-sd-sdr25", SDHCI_CDNS_PHY_DLY_UHS_SDR25, },
        { "phy-input-delay-sd-sdr50", SDHCI_CDNS_PHY_DLY_UHS_SDR50, },
        ...
};

static int sdhci_cdns_phy_init(struct device_node *np,
                               struct sdhci_cdns_priv *priv)
{
        u32 val;
        int i;

        for (i = 0; i < ARRAY_SIZE(sdhci_cdns_phy_cfgs), i++) {
                ret = of_property_read_u32(np, sdhci_cdns_phy_cfgs[i].property,
                                           &val);
                if (ret)
                        continue;

                ret = sdhci_cdns_write_phy_reg(priv,
                                               sdhci_cdns_phy_cfgs[i].addr,
                                               val);
                if (ret)
                        return ret;
        }
}





-- 
Best Regards
Masahiro Yamada

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] [1/2] mmc: sdhci-cadence: Fix writing PHY delay Piotr Sroka <piotrs@cadence.com> - 2017-02-16 14:50 +0100
  [PATCH 2/2] [2/2] mmc: sdhci-cadence: Update PHY delay configuration Piotr Sroka <piotrs@cadence.com> - 2017-02-16 14:50 +0100
    Re: [PATCH 2/2] [2/2] mmc: sdhci-cadence: Update PHY delay configuration Ulf Hansson <ulf.hansson@linaro.org> - 2017-02-16 16:20 +0100
      RE: [PATCH 2/2] [2/2] mmc: sdhci-cadence: Update PHY delay  configuration Piotr Sroka <piotrs@cadence.com> - 2017-02-17 15:20 +0100
        Re: [PATCH 2/2] [2/2] mmc: sdhci-cadence: Update PHY delay configuration Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-02-23 12:50 +0100
  Re: [PATCH 1/2] [1/2] mmc: sdhci-cadence: Fix writing PHY delay Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-02-23 12:40 +0100
    RE: [PATCH 1/2] [1/2] mmc: sdhci-cadence: Fix writing PHY delay Piotr Sroka <piotrs@cadence.com> - 2017-02-23 14:30 +0100

csiph-web