Message ID | 1484666853-19282-11-git-send-email-stefan.herbrechtsmeier@weidmueller.com |
---|---|
State | Accepted |
Commit | 61e745d1311532a90de537cc470da12d306ee193 |
Delegated to: | Michal Simek |
Headers | show |
On 01/18/2017 12:27 AM, stefan.herbrechtsmeier@weidmueller.com wrote: > From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> > > The maximum supported peripheral clock frequency of the zynq depends on > the IO routing. The MIO and EMIO support a maximum frequency of 50 MHz > respectively 25 MHz. Use the max-frequency value of the device tree to > determine the maximal supported peripheral clock frequency. > > Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> > Acked-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com> Best Regards, Jaehoon Chung > > --- > > Changes in v2: > - Add patch to add fdt max-frequency support to zynq mmc driver > > drivers/mmc/zynq_sdhci.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c > index c73a4d3..28cedf0 100644 > --- a/drivers/mmc/zynq_sdhci.c > +++ b/drivers/mmc/zynq_sdhci.c > @@ -14,6 +14,8 @@ > #include <malloc.h> > #include <sdhci.h> > > +DECLARE_GLOBAL_DATA_PTR; > + > #ifndef CONFIG_ZYNQ_SDHCI_MIN_FREQ > # define CONFIG_ZYNQ_SDHCI_MIN_FREQ 0 > #endif > @@ -21,6 +23,7 @@ > struct arasan_sdhci_plat { > struct mmc_config cfg; > struct mmc mmc; > + unsigned int f_max; > }; > > static int arasan_sdhci_probe(struct udevice *dev) > @@ -60,7 +63,7 @@ static int arasan_sdhci_probe(struct udevice *dev) > > host->max_clk = clock; > > - ret = sdhci_setup_cfg(&plat->cfg, host, CONFIG_ZYNQ_SDHCI_MAX_FREQ, > + ret = sdhci_setup_cfg(&plat->cfg, host, plat->f_max, > CONFIG_ZYNQ_SDHCI_MIN_FREQ); > host->mmc = &plat->mmc; > if (ret) > @@ -74,11 +77,15 @@ static int arasan_sdhci_probe(struct udevice *dev) > > static int arasan_sdhci_ofdata_to_platdata(struct udevice *dev) > { > + struct arasan_sdhci_plat *plat = dev_get_platdata(dev); > struct sdhci_host *host = dev_get_priv(dev); > > host->name = dev->name; > host->ioaddr = (void *)dev_get_addr(dev); > > + plat->f_max = fdtdec_get_int(gd->fdt_blob, dev->of_offset, > + "max-frequency", CONFIG_ZYNQ_SDHCI_MAX_FREQ); > + > return 0; > } > >
diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c index c73a4d3..28cedf0 100644 --- a/drivers/mmc/zynq_sdhci.c +++ b/drivers/mmc/zynq_sdhci.c @@ -14,6 +14,8 @@ #include <malloc.h> #include <sdhci.h> +DECLARE_GLOBAL_DATA_PTR; + #ifndef CONFIG_ZYNQ_SDHCI_MIN_FREQ # define CONFIG_ZYNQ_SDHCI_MIN_FREQ 0 #endif @@ -21,6 +23,7 @@ struct arasan_sdhci_plat { struct mmc_config cfg; struct mmc mmc; + unsigned int f_max; }; static int arasan_sdhci_probe(struct udevice *dev) @@ -60,7 +63,7 @@ static int arasan_sdhci_probe(struct udevice *dev) host->max_clk = clock; - ret = sdhci_setup_cfg(&plat->cfg, host, CONFIG_ZYNQ_SDHCI_MAX_FREQ, + ret = sdhci_setup_cfg(&plat->cfg, host, plat->f_max, CONFIG_ZYNQ_SDHCI_MIN_FREQ); host->mmc = &plat->mmc; if (ret) @@ -74,11 +77,15 @@ static int arasan_sdhci_probe(struct udevice *dev) static int arasan_sdhci_ofdata_to_platdata(struct udevice *dev) { + struct arasan_sdhci_plat *plat = dev_get_platdata(dev); struct sdhci_host *host = dev_get_priv(dev); host->name = dev->name; host->ioaddr = (void *)dev_get_addr(dev); + plat->f_max = fdtdec_get_int(gd->fdt_blob, dev->of_offset, + "max-frequency", CONFIG_ZYNQ_SDHCI_MAX_FREQ); + return 0; }