diff mbox

[U-Boot,2/4] MMC: EXYNOS: Added call back function for clock get

Message ID 1354714297-11568-3-git-send-email-amarendra.xt@samsung.com
State Changes Requested
Delegated to: Minkyu Kang
Headers show

Commit Message

Amar Dec. 5, 2012, 1:31 p.m. UTC
This patch defines the call back required by dw mmc driver to get the
clock value. It also adds function to set the dw mmc clock divider ratio.

Signed-off-by: Amarendra Reddy <amarendra.xt@samsung.com>
---
 drivers/mmc/exynos_dw_mmc.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

Comments

Jaehoon Chung Dec. 6, 2012, 4:03 a.m. UTC | #1
On 12/05/2012 10:31 PM, Amar wrote:
> This patch defines the call back required by dw mmc driver to get the
> clock value. It also adds function to set the dw mmc clock divider ratio.
> 
> Signed-off-by: Amarendra Reddy <amarendra.xt@samsung.com>
> ---
>  drivers/mmc/exynos_dw_mmc.c |   14 +++++++++++++-
>  1 files changed, 13 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c
> index 72a31b7..7cc8aba 100644
> --- a/drivers/mmc/exynos_dw_mmc.c
> +++ b/drivers/mmc/exynos_dw_mmc.c
> @@ -30,25 +30,37 @@ static void exynos_dwmci_clksel(struct dwmci_host *host)
>  {
>  	u32 val;
>  	val = DWMCI_SET_SAMPLE_CLK(DWMCI_SHIFT_0) |
> -		DWMCI_SET_DRV_CLK(DWMCI_SHIFT_0) | DWMCI_SET_DIV_RATIO(0);
> +		DWMCI_SET_DRV_CLK(DWMCI_SHIFT_0) |
> +		DWMCI_SET_DIV_RATIO(DWMCI_SHIFT_0);
>  
>  	dwmci_writel(host, DWMCI_CLKSEL, val);
>  }
>  
> +unsigned int exynos_dwmci_get_clk(int dev_index)
> +{
> +	return get_mmc_clk(dev_index);
> +}
> +
>  int exynos_dwmci_init(u32 regbase, int bus_width, int index)
>  {
>  	struct dwmci_host *host = NULL;
> +	int div = 0;
Why didn't initialize to 1? div is assigned to 1 at the below.
>  	host = malloc(sizeof(struct dwmci_host));
>  	if (!host) {
>  		printf("dwmci_host malloc fail!\n");
>  		return 1;
>  	}
>  
> +	div = 1;
> +	/* Set the mmc clock divider ratio & pre-ratio */
> +	set_mmc_clk(index, div);
Then if div set to 1, what value is set?
Can this code adjust to every board?
> +
>  	host->name = EXYNOS_NAME;
>  	host->ioaddr = (void *)regbase;
>  	host->buswidth = bus_width;
>  	host->clksel = exynos_dwmci_clksel;
>  	host->dev_index = index;
> +	host->mmc_clk = exynos_dwmci_get_clk;
>  
>  	add_dwmci(host, 52000000, 400000);
>  
>
Minkyu Kang March 27, 2013, 5:14 a.m. UTC | #2
Dear Amar,

On 05/12/12 22:31, Amar wrote:
> This patch defines the call back required by dw mmc driver to get the
> clock value. It also adds function to set the dw mmc clock divider ratio.
> 
> Signed-off-by: Amarendra Reddy <amarendra.xt@samsung.com>
> ---
>  drivers/mmc/exynos_dw_mmc.c |   14 +++++++++++++-
>  1 files changed, 13 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c
> index 72a31b7..7cc8aba 100644
> --- a/drivers/mmc/exynos_dw_mmc.c
> +++ b/drivers/mmc/exynos_dw_mmc.c
> @@ -30,25 +30,37 @@ static void exynos_dwmci_clksel(struct dwmci_host *host)
>  {
>  	u32 val;
>  	val = DWMCI_SET_SAMPLE_CLK(DWMCI_SHIFT_0) |
> -		DWMCI_SET_DRV_CLK(DWMCI_SHIFT_0) | DWMCI_SET_DIV_RATIO(0);
> +		DWMCI_SET_DRV_CLK(DWMCI_SHIFT_0) |
> +		DWMCI_SET_DIV_RATIO(DWMCI_SHIFT_0);
>  
>  	dwmci_writel(host, DWMCI_CLKSEL, val);
>  }
>  
> +unsigned int exynos_dwmci_get_clk(int dev_index)
> +{
> +	return get_mmc_clk(dev_index);
> +}
> +
>  int exynos_dwmci_init(u32 regbase, int bus_width, int index)
>  {
>  	struct dwmci_host *host = NULL;
> +	int div = 0;

please add a blank line here.

>  	host = malloc(sizeof(struct dwmci_host));
>  	if (!host) {
>  		printf("dwmci_host malloc fail!\n");
>  		return 1;
>  	}
>  
> +	div = 1;

ditto.

> +	/* Set the mmc clock divider ratio & pre-ratio */
> +	set_mmc_clk(index, div);

If the div is constant value, then just put 1.
I think.. it's better.
set_mmc_clk(index, 1);

> +
>  	host->name = EXYNOS_NAME;
>  	host->ioaddr = (void *)regbase;
>  	host->buswidth = bus_width;
>  	host->clksel = exynos_dwmci_clksel;
>  	host->dev_index = index;
> +	host->mmc_clk = exynos_dwmci_get_clk;
>  
>  	add_dwmci(host, 52000000, 400000);
>  
> 

Thanks,
Minkyu Kang.
Amarendra Reddy March 27, 2013, 5:38 a.m. UTC | #3
Dear Minkyu,

Please refer to the latest version of emmc patchset, which is V7 patchset.

The function definition 'exynos_dwmci_init()' has been changed when
compared to V1 patchset.

Here is the URL for latest version.
http://www.mail-archive.com/u-boot@lists.denx.de/msg107511.html

Thanks & Regards
Amarendra

On 27 March 2013 10:44, Minkyu Kang <mk7.kang@samsung.com> wrote:

> Dear Amar,
>
> On 05/12/12 22:31, Amar wrote:
> > This patch defines the call back required by dw mmc driver to get the
> > clock value. It also adds function to set the dw mmc clock divider ratio.
> >
> > Signed-off-by: Amarendra Reddy <amarendra.xt@samsung.com>
> > ---
> >  drivers/mmc/exynos_dw_mmc.c |   14 +++++++++++++-
> >  1 files changed, 13 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c
> > index 72a31b7..7cc8aba 100644
> > --- a/drivers/mmc/exynos_dw_mmc.c
> > +++ b/drivers/mmc/exynos_dw_mmc.c
> > @@ -30,25 +30,37 @@ static void exynos_dwmci_clksel(struct dwmci_host
> *host)
> >  {
> >       u32 val;
> >       val = DWMCI_SET_SAMPLE_CLK(DWMCI_SHIFT_0) |
> > -             DWMCI_SET_DRV_CLK(DWMCI_SHIFT_0) | DWMCI_SET_DIV_RATIO(0);
> > +             DWMCI_SET_DRV_CLK(DWMCI_SHIFT_0) |
> > +             DWMCI_SET_DIV_RATIO(DWMCI_SHIFT_0);
> >
> >       dwmci_writel(host, DWMCI_CLKSEL, val);
> >  }
> >
> > +unsigned int exynos_dwmci_get_clk(int dev_index)
> > +{
> > +     return get_mmc_clk(dev_index);
> > +}
> > +
> >  int exynos_dwmci_init(u32 regbase, int bus_width, int index)
> >  {
> >       struct dwmci_host *host = NULL;
> > +     int div = 0;
>
> please add a blank line here.
>
> >       host = malloc(sizeof(struct dwmci_host));
> >       if (!host) {
> >               printf("dwmci_host malloc fail!\n");
> >               return 1;
> >       }
> >
> > +     div = 1;
>
> ditto.
>
> > +     /* Set the mmc clock divider ratio & pre-ratio */
> > +     set_mmc_clk(index, div);
>
> If the div is constant value, then just put 1.
> I think.. it's better.
> set_mmc_clk(index, 1);
>
> > +
> >       host->name = EXYNOS_NAME;
> >       host->ioaddr = (void *)regbase;
> >       host->buswidth = bus_width;
> >       host->clksel = exynos_dwmci_clksel;
> >       host->dev_index = index;
> > +     host->mmc_clk = exynos_dwmci_get_clk;
> >
> >       add_dwmci(host, 52000000, 400000);
> >
> >
>
> Thanks,
> Minkyu Kang.
>
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
Minkyu Kang March 27, 2013, 7:40 a.m. UTC | #4
Dear Amar,

On 27/03/13 14:38, Amarendra Reddy wrote:
> Dear Minkyu,
> 
> Please refer to the latest version of emmc patchset, which is V7 patchset.
> 
> The function definition 'exynos_dwmci_init()' has been changed when compared to V1 patchset.

It means.. should I ignore this patchset?

> 
> Here is the URL for latest version.
> http://www.mail-archive.com/u-boot@lists.denx.de/msg107511.html
> 
> Thanks & Regards
> Amarendra
> 

Thanks,
Minkyu Kang.
Amarendra Reddy March 27, 2013, 8:01 a.m. UTC | #5
Dear Minkyu,

Yes, the patchset you referred needs to be ignored as it is V1 patchset.

You need to refer to V7 patchset present at the URL
http://www.mail-archive.com/u-boot@lists.denx.de/msg107511.html

Thanks & Regards
Amarendra

On 27 March 2013 13:10, Minkyu Kang <mk7.kang@samsung.com> wrote:

> Dear Amar,
>
> On 27/03/13 14:38, Amarendra Reddy wrote:
> > Dear Minkyu,
> >
> > Please refer to the latest version of emmc patchset, which is V7
> patchset.
> >
> > The function definition 'exynos_dwmci_init()' has been changed when
> compared to V1 patchset.
>
> It means.. should I ignore this patchset?
>
> >
> > Here is the URL for latest version.
> > http://www.mail-archive.com/u-boot@lists.denx.de/msg107511.html
> >
> > Thanks & Regards
> > Amarendra
> >
>
> Thanks,
> Minkyu Kang.
>
>
diff mbox

Patch

diff --git a/drivers/mmc/exynos_dw_mmc.c b/drivers/mmc/exynos_dw_mmc.c
index 72a31b7..7cc8aba 100644
--- a/drivers/mmc/exynos_dw_mmc.c
+++ b/drivers/mmc/exynos_dw_mmc.c
@@ -30,25 +30,37 @@  static void exynos_dwmci_clksel(struct dwmci_host *host)
 {
 	u32 val;
 	val = DWMCI_SET_SAMPLE_CLK(DWMCI_SHIFT_0) |
-		DWMCI_SET_DRV_CLK(DWMCI_SHIFT_0) | DWMCI_SET_DIV_RATIO(0);
+		DWMCI_SET_DRV_CLK(DWMCI_SHIFT_0) |
+		DWMCI_SET_DIV_RATIO(DWMCI_SHIFT_0);
 
 	dwmci_writel(host, DWMCI_CLKSEL, val);
 }
 
+unsigned int exynos_dwmci_get_clk(int dev_index)
+{
+	return get_mmc_clk(dev_index);
+}
+
 int exynos_dwmci_init(u32 regbase, int bus_width, int index)
 {
 	struct dwmci_host *host = NULL;
+	int div = 0;
 	host = malloc(sizeof(struct dwmci_host));
 	if (!host) {
 		printf("dwmci_host malloc fail!\n");
 		return 1;
 	}
 
+	div = 1;
+	/* Set the mmc clock divider ratio & pre-ratio */
+	set_mmc_clk(index, div);
+
 	host->name = EXYNOS_NAME;
 	host->ioaddr = (void *)regbase;
 	host->buswidth = bus_width;
 	host->clksel = exynos_dwmci_clksel;
 	host->dev_index = index;
+	host->mmc_clk = exynos_dwmci_get_clk;
 
 	add_dwmci(host, 52000000, 400000);