From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aswath Govindraju Date: Thu, 28 Jan 2021 14:45:12 +0530 Subject: [PATCH v3 05/20] mmc: am654_sdhci: Add support for AM65x SR2.0 In-Reply-To: References: <20210121124052.3454-1-a-govindraju@ti.com> <20210121124052.3454-6-a-govindraju@ti.com> Message-ID: <2d8c40a6-873b-6087-1a1c-d90a46f8631c@ti.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Jaehoon, On 26/01/21 3:49 am, Jaehoon Chung wrote: > On 1/21/21 9:40 PM, Aswath Govindraju wrote: >> From: Faiz Abbas >> >> Add Support for AM65x PG2.0. Use the SoC bus framework to fixup >> the platform data and do DLL calibration if the revision is 1.0 > > Is there no method to get the revision from H/W? > If not, looks good tome. > Even in this case the revision is being read from the hardware. This data is populated after reading soc jtag id register. Thanks, Aswath >> >> Signed-off-by: Faiz Abbas >> Signed-off-by: Aswath Govindraju > > Reviewed-by: Jaehoon Chung > > Best Regards, > Jaehoon Chung > >> --- >> drivers/mmc/am654_sdhci.c | 30 ++++++++++++++++++++++++++++++ >> 1 file changed, 30 insertions(+) >> >> diff --git a/drivers/mmc/am654_sdhci.c b/drivers/mmc/am654_sdhci.c >> index 1e0654183811..5790fa3d0dbf 100644 >> --- a/drivers/mmc/am654_sdhci.c >> +++ b/drivers/mmc/am654_sdhci.c >> @@ -12,6 +12,7 @@ >> #include >> #include >> #include >> +#include >> #include >> #include >> #include >> @@ -292,6 +293,11 @@ const struct sdhci_ops am654_sdhci_ops = { >> }; >> >> const struct am654_driver_data am654_drv_data = { >> + .ops = &am654_sdhci_ops, >> + .flags = DLL_PRESENT | IOMUX_PRESENT | FREQSEL_2_BIT | STRBSEL_4_BIT, >> +}; >> + >> +const struct am654_driver_data am654_sr1_drv_data = { >> .ops = &am654_sdhci_ops, >> .flags = IOMUX_PRESENT | FREQSEL_2_BIT | DLL_PRESENT | DLL_CALIB | >> STRBSEL_4_BIT, >> @@ -326,6 +332,11 @@ const struct am654_driver_data j721e_4bit_drv_data = { >> .flags = IOMUX_PRESENT, >> }; >> >> +const struct soc_attr am654_sdhci_soc_attr[] = { >> + { .family = "AM65X", .revision = "SR1.0", .data = &am654_sr1_drv_data}, >> + {/* sentinel */} >> +}; >> + >> static int sdhci_am654_get_otap_delay(struct udevice *dev, >> struct mmc_config *cfg) >> { >> @@ -365,6 +376,8 @@ static int am654_sdhci_probe(struct udevice *dev) >> struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); >> struct sdhci_host *host = dev_get_priv(dev); >> struct mmc_config *cfg = &plat->cfg; >> + const struct soc_attr *soc; >> + const struct am654_driver_data *soc_drv_data; >> struct clk clk; >> unsigned long clock; >> int ret; >> @@ -394,6 +407,14 @@ static int am654_sdhci_probe(struct udevice *dev) >> return ret; >> >> host->ops = drv_data->ops; >> + >> + /* Update ops based on SoC revision */ >> + soc = soc_device_match(am654_sdhci_soc_attr); >> + if (soc && soc->data) { >> + soc_drv_data = soc->data; >> + host->ops = soc_drv_data->ops; >> + } >> + >> host->mmc->priv = host; >> upriv->mmc = host->mmc; >> >> @@ -458,9 +479,18 @@ static int am654_sdhci_bind(struct udevice *dev) >> struct am654_driver_data *drv_data = >> (struct am654_driver_data *)dev_get_driver_data(dev); >> struct am654_sdhci_plat *plat = dev_get_plat(dev); >> + const struct soc_attr *soc; >> + const struct am654_driver_data *soc_drv_data; >> >> plat->flags = drv_data->flags; >> >> + /* Update flags based on SoC revision */ >> + soc = soc_device_match(am654_sdhci_soc_attr); >> + if (soc && soc->data) { >> + soc_drv_data = soc->data; >> + plat->flags = soc_drv_data->flags; >> + } >> + >> return sdhci_bind(dev, &plat->mmc, &plat->cfg); >> } >> >> >