Re: [U-Boot] [PATCH 4/5] mmc: Add support for HI3660 SoC reusing hi6220_dw_mmc driver

2019-08-13 Thread Tom Rini
On Fri, Aug 02, 2019 at 08:40:10PM +0530, Manivannan Sadhasivam wrote:

> This commit adds MMC driver support for HI3660 SoC reusing hi6220_dw_mmc
> driver. Since HI3660 operates at different clock rate and uses fifo
> mode now, let's introduce the platform data and utilize it for different
> SoCs supported by this driver.
> 
> Signed-off-by: Manivannan Sadhasivam 

Applied to u-boot/master, thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 4/5] mmc: Add support for HI3660 SoC reusing hi6220_dw_mmc driver

2019-08-02 Thread Manivannan Sadhasivam
This commit adds MMC driver support for HI3660 SoC reusing hi6220_dw_mmc
driver. Since HI3660 operates at different clock rate and uses fifo
mode now, let's introduce the platform data and utilize it for different
SoCs supported by this driver.

Signed-off-by: Manivannan Sadhasivam 
---
 drivers/mmc/hi6220_dw_mmc.c | 29 ++---
 1 file changed, 26 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/hi6220_dw_mmc.c b/drivers/mmc/hi6220_dw_mmc.c
index effd1e4c7c..6de7924383 100644
--- a/drivers/mmc/hi6220_dw_mmc.c
+++ b/drivers/mmc/hi6220_dw_mmc.c
@@ -22,6 +22,11 @@ struct hi6220_dwmmc_priv_data {
struct dwmci_host host;
 };
 
+struct hisi_mmc_data {
+   unsigned int clock;
+   bool use_fifo;
+};
+
 static int hi6220_dwmmc_ofdata_to_platdata(struct udevice *dev)
 {
struct hi6220_dwmmc_priv_data *priv = dev_get_priv(dev);
@@ -49,13 +54,17 @@ static int hi6220_dwmmc_probe(struct udevice *dev)
struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
struct hi6220_dwmmc_priv_data *priv = dev_get_priv(dev);
struct dwmci_host *host = >host;
+   struct hisi_mmc_data *mmc_data;
+
+   mmc_data = (struct hisi_mmc_data *)dev_get_driver_data(dev);
 
/* Use default bus speed due to absence of clk driver */
-   host->bus_hz = 5000;
+   host->bus_hz = mmc_data->clock;
 
dwmci_setup_cfg(>cfg, host, host->bus_hz, 40);
host->mmc = >mmc;
 
+   host->fifo_mode = mmc_data->use_fifo;
host->mmc->priv = >host;
upriv->mmc = host->mmc;
host->mmc->dev = dev;
@@ -75,9 +84,23 @@ static int hi6220_dwmmc_bind(struct udevice *dev)
return 0;
 }
 
+static const struct hisi_mmc_data hi3660_mmc_data = {
+   .clock = 320,
+   .use_fifo = true,
+};
+
+static const struct hisi_mmc_data hi6220_mmc_data = {
+   .clock = 5000,
+   .use_fifo = false,
+};
+
 static const struct udevice_id hi6220_dwmmc_ids[] = {
-   { .compatible = "hisilicon,hi6220-dw-mshc" },
-   { .compatible = "hisilicon,hi3798cv200-dw-mshc" },
+   { .compatible = "hisilicon,hi6220-dw-mshc",
+ .data = (ulong)_mmc_data },
+   { .compatible = "hisilicon,hi3798cv200-dw-mshc",
+ .data = (ulong)_mmc_data },
+   { .compatible = "hisilicon,hi3660-dw-mshc",
+ .data = (ulong)_mmc_data },
{ }
 };
 
-- 
2.17.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot