[U-Boot] [PATCH 2/2] fsl_esdhc: Remove cache snooping for i.MX

2012-08-13 Thread Benoît Thébaudeau
The cache snooping feature of Freescale's eSDHC IP is not available on i.MX, so
disable it globally for this architecture. This avoids setting no_snoop for all
i.MX boards, and it prevents setting a reserved bit of a reserved register if
fsl_esdhc_mmc_init() were used for an i.MX board.

Signed-off-by: Benoît Thébaudeau 
Cc: Andy Fleming 
Cc: Stefano Babic 
Cc: Kim Phillips 
---
 .../board/efikamx/efikamx.c|4 ++--
 .../board/esg/ima3-mx53/ima3-mx53.c|2 +-
 .../board/freescale/mx51evk/mx51evk.c  |4 ++--
 .../board/freescale/mx53ard/mx53ard.c  |4 ++--
 .../board/freescale/mx53evk/mx53evk.c  |4 ++--
 .../board/freescale/mx53loco/mx53loco.c|4 ++--
 .../board/freescale/mx53smd/mx53smd.c  |2 +-
 .../board/freescale/mx6qarm2/mx6qarm2.c|4 ++--
 .../board/freescale/mx6qsabrelite/mx6qsabrelite.c  |4 ++--
 .../board/ttcontrol/vision2/vision2.c  |2 +-
 .../drivers/mmc/fsl_esdhc.c|2 ++
 .../include/fsl_esdhc.h|3 +++
 12 files changed, 22 insertions(+), 17 deletions(-)

diff --git u-boot-4d3c95f.orig/board/efikamx/efikamx.c 
u-boot-4d3c95f/board/efikamx/efikamx.c
index e88b2ed..1e643d7 100644
--- u-boot-4d3c95f.orig/board/efikamx/efikamx.c
+++ u-boot-4d3c95f/board/efikamx/efikamx.c
@@ -302,8 +302,8 @@ static inline void power_init(void) { }
  */
 #ifdef CONFIG_FSL_ESDHC
 struct fsl_esdhc_cfg esdhc_cfg[2] = {
-   {MMC_SDHC1_BASE_ADDR, 1},
-   {MMC_SDHC2_BASE_ADDR, 1},
+   {MMC_SDHC1_BASE_ADDR},
+   {MMC_SDHC2_BASE_ADDR},
 };
 
 static inline uint32_t efika_mmc_cd(void)
diff --git u-boot-4d3c95f.orig/board/esg/ima3-mx53/ima3-mx53.c 
u-boot-4d3c95f/board/esg/ima3-mx53/ima3-mx53.c
index 9ecf31d..e947330 100644
--- u-boot-4d3c95f.orig/board/esg/ima3-mx53/ima3-mx53.c
+++ u-boot-4d3c95f/board/esg/ima3-mx53/ima3-mx53.c
@@ -172,7 +172,7 @@ static void setup_iomux_fec(void)
 }
 
 #ifdef CONFIG_FSL_ESDHC
-struct fsl_esdhc_cfg esdhc_cfg = { MMC_SDHC1_BASE_ADDR, 1 };
+struct fsl_esdhc_cfg esdhc_cfg = { MMC_SDHC1_BASE_ADDR };
 
 int board_mmc_getcd(struct mmc *mmc)
 {
diff --git u-boot-4d3c95f.orig/board/freescale/mx51evk/mx51evk.c 
u-boot-4d3c95f/board/freescale/mx51evk/mx51evk.c
index 514a7ac..7e50688 100644
--- u-boot-4d3c95f.orig/board/freescale/mx51evk/mx51evk.c
+++ u-boot-4d3c95f/board/freescale/mx51evk/mx51evk.c
@@ -47,8 +47,8 @@ DECLARE_GLOBAL_DATA_PTR;
 
 #ifdef CONFIG_FSL_ESDHC
 struct fsl_esdhc_cfg esdhc_cfg[2] = {
-   {MMC_SDHC1_BASE_ADDR, 1},
-   {MMC_SDHC2_BASE_ADDR, 1},
+   {MMC_SDHC1_BASE_ADDR},
+   {MMC_SDHC2_BASE_ADDR},
 };
 #endif
 
diff --git u-boot-4d3c95f.orig/board/freescale/mx53ard/mx53ard.c 
u-boot-4d3c95f/board/freescale/mx53ard/mx53ard.c
index 2d21584..6fea7e5 100644
--- u-boot-4d3c95f.orig/board/freescale/mx53ard/mx53ard.c
+++ u-boot-4d3c95f/board/freescale/mx53ard/mx53ard.c
@@ -79,8 +79,8 @@ static void setup_iomux_uart(void)
 
 #ifdef CONFIG_FSL_ESDHC
 struct fsl_esdhc_cfg esdhc_cfg[2] = {
-   {MMC_SDHC1_BASE_ADDR, 1 },
-   {MMC_SDHC2_BASE_ADDR, 1 },
+   {MMC_SDHC1_BASE_ADDR},
+   {MMC_SDHC2_BASE_ADDR},
 };
 
 int board_mmc_getcd(struct mmc *mmc)
diff --git u-boot-4d3c95f.orig/board/freescale/mx53evk/mx53evk.c 
u-boot-4d3c95f/board/freescale/mx53evk/mx53evk.c
index 8a6e31d..2a90a4c 100644
--- u-boot-4d3c95f.orig/board/freescale/mx53evk/mx53evk.c
+++ u-boot-4d3c95f/board/freescale/mx53evk/mx53evk.c
@@ -204,8 +204,8 @@ static void setup_iomux_fec(void)
 
 #ifdef CONFIG_FSL_ESDHC
 struct fsl_esdhc_cfg esdhc_cfg[2] = {
-   {MMC_SDHC1_BASE_ADDR, 1},
-   {MMC_SDHC3_BASE_ADDR, 1},
+   {MMC_SDHC1_BASE_ADDR},
+   {MMC_SDHC3_BASE_ADDR},
 };
 
 int board_mmc_getcd(struct mmc *mmc)
diff --git u-boot-4d3c95f.orig/board/freescale/mx53loco/mx53loco.c 
u-boot-4d3c95f/board/freescale/mx53loco/mx53loco.c
index cbdcfad..3195b22 100644
--- u-boot-4d3c95f.orig/board/freescale/mx53loco/mx53loco.c
+++ u-boot-4d3c95f/board/freescale/mx53loco/mx53loco.c
@@ -165,8 +165,8 @@ static void setup_iomux_fec(void)
 
 #ifdef CONFIG_FSL_ESDHC
 struct fsl_esdhc_cfg esdhc_cfg[2] = {
-   {MMC_SDHC1_BASE_ADDR, 1},
-   {MMC_SDHC3_BASE_ADDR, 1},
+   {MMC_SDHC1_BASE_ADDR},
+   {MMC_SDHC3_BASE_ADDR},
 };
 
 int board_mmc_getcd(struct mmc *mmc)
diff --git u-boot-4d3c95f.orig/board/freescale/mx53smd/mx53smd.c 
u-boot-4d3c95f/board/freescale/mx53smd/mx53smd.c
index c237980..b816377 100644
--- u-boot-4d3c95f.orig/board/freescale/mx53smd/mx53smd.c
+++ u-boot-4d3c95f/board/freescale/mx53smd/mx53smd.c
@@ -129,7 +129,7 @@ static void setup_iomux_fec(void)
 
 #ifdef CONFIG_FSL_ESDHC
 struct fsl_esdhc_cfg esdhc_cfg[1] = {
-   {MMC_SDHC1_BASE_ADDR, 1},
+   {MMC_SDHC1_BASE_ADDR},
 };
 
 int board_mmc_getcd(struct mmc *mmc)
diff --git u-boot-4d3c95f.orig/board/freescale/mx6qarm2/mx6qarm2.c 
u-boot-4d3c95f/board/freescale/mx6qarm2/mx6qarm2.c
index 340c4c

Re: [U-Boot] [PATCH 2/2] fsl_esdhc: Remove cache snooping for i.MX

2012-08-13 Thread Stefano Babic
On 13/08/2012 16:18, Benoît Thébaudeau wrote:
> The cache snooping feature of Freescale's eSDHC IP is not available on i.MX, 
> so
> disable it globally for this architecture. This avoids setting no_snoop for 
> all
> i.MX boards, and it prevents setting a reserved bit of a reserved register if
> fsl_esdhc_mmc_init() were used for an i.MX board.
> 
> Signed-off-by: Benoît Thébaudeau 
> Cc: Andy Fleming 
> Cc: Stefano Babic 
> Cc: Kim Phillips 
> ---
>  .../board/efikamx/efikamx.c|4 ++--
>  .../board/esg/ima3-mx53/ima3-mx53.c|2 +-
>  .../board/freescale/mx51evk/mx51evk.c  |4 ++--
>  .../board/freescale/mx53ard/mx53ard.c  |4 ++--
>  .../board/freescale/mx53evk/mx53evk.c  |4 ++--
>  .../board/freescale/mx53loco/mx53loco.c|4 ++--
>  .../board/freescale/mx53smd/mx53smd.c  |2 +-
>  .../board/freescale/mx6qarm2/mx6qarm2.c|4 ++--
>  .../board/freescale/mx6qsabrelite/mx6qsabrelite.c  |4 ++--
>  .../board/ttcontrol/vision2/vision2.c  |2 +-
>  .../drivers/mmc/fsl_esdhc.c|2 ++
>  .../include/fsl_esdhc.h|3 +++
>  12 files changed, 22 insertions(+), 17 deletions(-)
> 

Hi Benoît,


> diff --git u-boot-4d3c95f.orig/drivers/mmc/fsl_esdhc.c 
> u-boot-4d3c95f/drivers/mmc/fsl_esdhc.c
> index b6c969d..efdc6be 100644
> --- u-boot-4d3c95f.orig/drivers/mmc/fsl_esdhc.c
> +++ u-boot-4d3c95f/drivers/mmc/fsl_esdhc.c
> @@ -479,9 +479,11 @@ static int esdhc_init(struct mmc *mmc)
>   while ((esdhc_read32(®s->sysctl) & SYSCTL_RSTA) && --timeout)
>   udelay(1000);
>  
> +#ifndef ARCH_IMX
>   /* Enable cache snooping */
>   if (cfg && !cfg->no_snoop)
>   esdhc_write32(®s->scr, 0x0040);
> +#endif
>  
>   esdhc_write32(®s->sysctl, SYSCTL_HCKEN | SYSCTL_IPGEN);
>  
> diff --git u-boot-4d3c95f.orig/include/fsl_esdhc.h 
> u-boot-4d3c95f/include/fsl_esdhc.h
> index 0e26558..44f9f06 100644
> --- u-boot-4d3c95f.orig/include/fsl_esdhc.h
> +++ u-boot-4d3c95f/include/fsl_esdhc.h
> @@ -26,6 +26,7 @@
>  #ifndef  __FSL_ESDHC_H__
>  #define  __FSL_ESDHC_H__
>  
> +#include 
>  #include 
>  #include 
>  
> @@ -167,7 +168,9 @@
>  
>  struct fsl_esdhc_cfg {
>   u32 esdhc_base;
> +#ifndef ARCH_IMX
>   u32 no_snoop;
> +#endif
>  };

Why don't you get rid of no_snoop at all ? Using  ARCH_IMX is not needed
anymore.

Best regards,
Stefano Babic

-- 
=
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/2] fsl_esdhc: Remove cache snooping for i.MX

2012-08-13 Thread Benoît Thébaudeau
Hi Stefano,

On 08/13/2012 16:24, Stefano Babic wrote:
> On 13/08/2012 16:18, Benoît Thébaudeau wrote:
> > The cache snooping feature of Freescale's eSDHC IP is not available
> > on i.MX, so
> > disable it globally for this architecture. This avoids setting
> > no_snoop for all
> > i.MX boards, and it prevents setting a reserved bit of a reserved
> > register if
> > fsl_esdhc_mmc_init() were used for an i.MX board.
> > 
> > Signed-off-by: Benoît Thébaudeau 
> > Cc: Andy Fleming 
> > Cc: Stefano Babic 
> > Cc: Kim Phillips 
> > ---
> >  .../board/efikamx/efikamx.c|4 ++--
> >  .../board/esg/ima3-mx53/ima3-mx53.c|2 +-
> >  .../board/freescale/mx51evk/mx51evk.c  |4 ++--
> >  .../board/freescale/mx53ard/mx53ard.c  |4 ++--
> >  .../board/freescale/mx53evk/mx53evk.c  |4 ++--
> >  .../board/freescale/mx53loco/mx53loco.c|4 ++--
> >  .../board/freescale/mx53smd/mx53smd.c  |2 +-
> >  .../board/freescale/mx6qarm2/mx6qarm2.c|4 ++--
> >  .../board/freescale/mx6qsabrelite/mx6qsabrelite.c  |4 ++--
> >  .../board/ttcontrol/vision2/vision2.c  |2 +-
> >  .../drivers/mmc/fsl_esdhc.c|2 ++
> >  .../include/fsl_esdhc.h|3 +++
> >  12 files changed, 22 insertions(+), 17 deletions(-)
> > 
> 
> Hi Benoît,
> 
> 
> > diff --git u-boot-4d3c95f.orig/drivers/mmc/fsl_esdhc.c
> > u-boot-4d3c95f/drivers/mmc/fsl_esdhc.c
> > index b6c969d..efdc6be 100644
> > --- u-boot-4d3c95f.orig/drivers/mmc/fsl_esdhc.c
> > +++ u-boot-4d3c95f/drivers/mmc/fsl_esdhc.c
> > @@ -479,9 +479,11 @@ static int esdhc_init(struct mmc *mmc)
> > while ((esdhc_read32(®s->sysctl) & SYSCTL_RSTA) && --timeout)
> > udelay(1000);
> >  
> > +#ifndef ARCH_IMX
> > /* Enable cache snooping */
> > if (cfg && !cfg->no_snoop)
> > esdhc_write32(®s->scr, 0x0040);
> > +#endif
> >  
> > esdhc_write32(®s->sysctl, SYSCTL_HCKEN | SYSCTL_IPGEN);
> >  
> > diff --git u-boot-4d3c95f.orig/include/fsl_esdhc.h
> > u-boot-4d3c95f/include/fsl_esdhc.h
> > index 0e26558..44f9f06 100644
> > --- u-boot-4d3c95f.orig/include/fsl_esdhc.h
> > +++ u-boot-4d3c95f/include/fsl_esdhc.h
> > @@ -26,6 +26,7 @@
> >  #ifndef  __FSL_ESDHC_H__
> >  #define__FSL_ESDHC_H__
> >  
> > +#include 
> >  #include 
> >  #include 
> >  
> > @@ -167,7 +168,9 @@
> >  
> >  struct fsl_esdhc_cfg {
> > u32 esdhc_base;
> > +#ifndef ARCH_IMX
> > u32 no_snoop;
> > +#endif
> >  };
> 
> Why don't you get rid of no_snoop at all ? Using  ARCH_IMX is not
> needed
> anymore.

Because I didn't know if disabling cache snooping could be a useful option or
not for architectures other than i.MX, so I preferred to leave it just in case,
even if it seems to be unused.

But if you are certain that disabling cache snooping can not be useful for
architectures other than i.MX (now or in the future, for boards in or out of
tree), I can completely remove no_snoop. Just tell me.

Perhaps you have a rule such as "remove any stuff that is unused in mainstream".

Best regards,
Benoît
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/2] fsl_esdhc: Remove cache snooping for i.MX

2012-08-13 Thread Stefano Babic
On 13/08/2012 16:39, Benoît Thébaudeau wrote:

>>
>> Why don't you get rid of no_snoop at all ? Using  ARCH_IMX is not
>> needed
>> anymore.
> 
> Because I didn't know if disabling cache snooping could be a useful option or
> not for architectures other than i.MX, so I preferred to leave it just in 
> case,
> even if it seems to be unused.

I introduce no_snoop when I adapted the driver for iMX. I do not see
PowerPC boards setting this bit.

And checking this, it seems to me that code in
arch/arm/cpu/armv7/imx-common/cpu.c is wrong, because cpu_mmc_init()
does not set the bit and the scr register is set (or could be set) even
for i.MX6 SOCs. Maybe writing at this adress does not cause problems,
but it seems wrong. You patch then fixes also this issue.

> But if you are certain that disabling cache snooping can not be useful for
> architectures other than i.MX (now or in the future, for boards in or out of
> tree), I can completely remove no_snoop. Just tell me.

IMHO you can drop it.

> 
> Perhaps you have a rule such as "remove any stuff that is unused in 
> mainstream".

It would be nice to have it ;-)

Best regards,
Stefano

-- 
=
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot