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: <ed9e54d5-b069-9899-6664-b07dbd0a5d54@amd.com>
Date:   Wed, 31 Aug 2022 23:29:36 +0000
From:   "Larson, Bradley" <Bradley.Larson@....com>
To:     Ulf Hansson <ulf.hansson@...aro.org>,
        Brad Larson <brad@...sando.io>
CC:     "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-mmc@...r.kernel.org" <linux-mmc@...r.kernel.org>,
        "adrian.hunter@...el.com" <adrian.hunter@...el.com>,
        "alcooperx@...il.com" <alcooperx@...il.com>,
        "andy.shevchenko@...il.com" <andy.shevchenko@...il.com>,
        "arnd@...db.de" <arnd@...db.de>,
        "brijeshkumar.singh@....com" <brijeshkumar.singh@....com>,
        "catalin.marinas@....com" <catalin.marinas@....com>,
        "gsomlo@...il.com" <gsomlo@...il.com>,
        "gerg@...ux-m68k.org" <gerg@...ux-m68k.org>,
        "krzk@...nel.org" <krzk@...nel.org>,
        "krzysztof.kozlowski+dt@...aro.org" 
        <krzysztof.kozlowski+dt@...aro.org>,
        "lee.jones@...aro.org" <lee.jones@...aro.org>,
        "broonie@...nel.org" <broonie@...nel.org>,
        "yamada.masahiro@...ionext.com" <yamada.masahiro@...ionext.com>,
        "p.zabel@...gutronix.de" <p.zabel@...gutronix.de>,
        "piotrs@...ence.com" <piotrs@...ence.com>,
        "p.yadav@...com" <p.yadav@...com>,
        "rdunlap@...radead.org" <rdunlap@...radead.org>,
        "robh+dt@...nel.org" <robh+dt@...nel.org>,
        "samuel@...lland.org" <samuel@...lland.org>,
        "fancer.lancer@...il.com" <fancer.lancer@...il.com>,
        "Suthikulpanit, Suravee" <Suravee.Suthikulpanit@....com>,
        "Lendacky, Thomas" <Thomas.Lendacky@....com>,
        "will@...nel.org" <will@...nel.org>,
        "devicetree@...r.kernel.org" <devicetree@...r.kernel.org>
Subject: Re: [PATCH v6 17/17] mmc: sdhci-cadence: Support mmc hardware reset

On 8/22/22 3:53 AM, Ulf Hansson wrote:
> On Sat, 20 Aug 2022 at 21:58, Brad Larson <brad@...sando.io> wrote:
>> From: Brad Larson <blarson@....com>
>>
>> Add support for mmc hardware reset with a reset-controller
>> which would need to be enabled in the device tree with
>> a supporting driver.  The default is disabled for all
>> existing designs.
>>
>> Signed-off-by: Brad Larson <blarson@....com>
>> ---
>>   drivers/mmc/host/sdhci-cadence.c | 29 +++++++++++++++++++++++++++++
>>   1 file changed, 29 insertions(+)
>>
>> diff --git a/drivers/mmc/host/sdhci-cadence.c b/drivers/mmc/host/sdhci-cadence.c
>> index c662c63d49fa..35d37b9aba63 100644
>> --- a/drivers/mmc/host/sdhci-cadence.c
>> +++ b/drivers/mmc/host/sdhci-cadence.c
>> @@ -12,6 +12,7 @@
>>   #include <linux/mmc/mmc.h>
>>   #include <linux/of.h>
>>   #include <linux/of_device.h>
>> +#include <linux/reset.h>
>>
>>   #include "sdhci-pltfm.h"
>>
>> @@ -70,6 +71,7 @@ struct sdhci_cdns_priv {
>>          spinlock_t wrlock;      /* write lock */
>>          bool enhanced_strobe;
>>          void (*priv_writel)(struct sdhci_cdns_priv *priv, u32 val, void __iomem *reg);
>> +       struct reset_control *rst_hw;
>>          unsigned int nr_phy_params;
>>          struct sdhci_cdns_phy_param phy_params[];
>>   };
>> @@ -458,6 +460,22 @@ static void sdhci_cdns_hs400_enhanced_strobe(struct mmc_host *mmc,
>>                                           SDHCI_CDNS_HRS06_MODE_MMC_HS400);
>>   }
>>
>> +static void sdhci_mmc_hw_reset(struct mmc_host *mmc)
> Nitpick: Probably better to be consistent with the prefixes for
> function names. So, I suggest changing this to
> "sdhci_cdns_mmc_hw_reset".

Changing to sdhci_cdns_mmc_hw_reset().


>> +{
>> +       struct sdhci_host *host = mmc_priv(mmc);
>> +       struct sdhci_cdns_priv *priv = sdhci_cdns_priv(host);
>> +
>> +       dev_info(mmc_dev(host->mmc), "emmc hardware reset\n");
> Maybe it's sufficient with dev_dbg?

Changing to dev_dbg().


>> +
>> +       reset_control_assert(priv->rst_hw);
>> +       /* For eMMC, minimum is 1us but give it 9us for good measure */
>> +       udelay(9);
>> +
>> +       reset_control_deassert(priv->rst_hw);
>> +       /* For eMMC, minimum is 200us but give it 300us for good measure */
>> +       usleep_range(300, 1000);
>> +}
>> +
>>   static int sdhci_cdns_probe(struct platform_device *pdev)
>>   {
>>          struct sdhci_host *host;
>> @@ -520,6 +538,17 @@ static int sdhci_cdns_probe(struct platform_device *pdev)
>>          if (ret)
>>                  goto free;
>>
>> +       if (host->mmc->caps & MMC_CAP_HW_RESET) {
>> +               priv->rst_hw = devm_reset_control_get_optional_exclusive(dev, "hw");
>> +               if (IS_ERR(priv->rst_hw)) {
>> +                       ret = PTR_ERR(priv->rst_hw);
>> +                       if (ret == -ENOENT)
>> +                               priv->rst_hw = NULL;
>> +               } else {
>> +                       host->mmc_host_ops.card_hw_reset = sdhci_mmc_hw_reset;
>> +               }
>> +       }
>> +
>>          ret = sdhci_add_host(host);
>>          if (ret)
>>                  goto free;
>> --
> Other than the comments above, I wonder about what merging strategy we
> should use for the series. I believe it looks fine for me to pick up
> the mmc related patches, thus we can apply patches on a per subsystem
> basis, right?


Yes I think so and I'll be looking for guidance on this.


Regards,
Brad

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ