Patchwork [U-Boot,2/2,v3] FSL/eSDHC: enable the clock to detect the SD card

login
register
mail settings
Submitter Jerry Huang
Date May 18, 2012, 9:57 a.m.
Message ID <1337335022-18501-2-git-send-email-Chang-Ming.Huang@freescale.com>
Download mbox | patch
Permalink /patch/160055/
State Accepted
Commit 975324a7d9abd26423594b596d8cd7b83699171a
Delegated to: Andy Fleming
Headers show

Comments

Jerry Huang - May 18, 2012, 9:57 a.m.
From: Jerry Huang <Chang-Ming.Huang@freescale.com>

For FSL low-end processors (VVN2.2), in order to detect the SD card,
we should enable PEREN, HCKEN and IPGEN to enable the clock.
Otherwise, after booting the u-boot, and then inserting the SD card,
the SD card can't be detected.
For SDHC VVN2.3 IP, these bits are reserved, and SDCLKEN is used.
And when accessing to these reserved bit, no any impact happened.

Signed-off-by: Jerry Huang <Chang-Ming.Huang@freescale.com>
CC: Andy Fleming <afleming@gmail.com>
CC: Marek Vasut <marex@denx.de>
---
changes for v2:
	- correct the typo
changes for v3:
	- enable all clock bits for VVN2.3 and VVN2.2
	- use funciton esdhc_setbits32
	- tested on p1022ds, p1025rdb, p1020mbg-pc, mpc8536ds, p3041ds

 drivers/mmc/fsl_esdhc.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
Scott Wood - May 18, 2012, 3:55 p.m.
On 05/18/2012 04:57 AM, Chang-Ming.Huang@freescale.com wrote:
> From: Jerry Huang <Chang-Ming.Huang@freescale.com>
> 
> For FSL low-end processors (VVN2.2), in order to detect the SD card,
> we should enable PEREN, HCKEN and IPGEN to enable the clock.
> Otherwise, after booting the u-boot, and then inserting the SD card,
> the SD card can't be detected.
> For SDHC VVN2.3 IP, these bits are reserved, and SDCLKEN is used.
> And when accessing to these reserved bit, no any impact happened.

Again, have you talked to a hardware designer and confirmed that there's
no impact from setting these bits on chips where they're reserved?  Just
because you don't notice any obvious impact doesn't mean it's totally safe.

-Scott
Marek Vasut - May 18, 2012, 4:03 p.m.
Dear Chang-Ming.Huang@freescale.com,

> From: Jerry Huang <Chang-Ming.Huang@freescale.com>
> 
> For FSL low-end processors (VVN2.2)

What's VVN2.2 ?

> , in order to detect the SD card,
> we should enable PEREN, HCKEN and IPGEN to enable the clock.
> Otherwise, after booting the u-boot, and then inserting the SD card,
> the SD card can't be detected.
> For SDHC VVN2.3 IP

VVN2.3 ?

> , these bits are reserved, and SDCLKEN is used.
> And when accessing to these reserved bit, no any impact happened.
> 
> Signed-off-by: Jerry Huang <Chang-Ming.Huang@freescale.com>
> CC: Andy Fleming <afleming@gmail.com>
> CC: Marek Vasut <marex@denx.de>
> ---
> changes for v2:
> 	- correct the typo
> changes for v3:
> 	- enable all clock bits for VVN2.3 and VVN2.2
> 	- use funciton esdhc_setbits32
> 	- tested on p1022ds, p1025rdb, p1020mbg-pc, mpc8536ds, p3041ds
> 
>  drivers/mmc/fsl_esdhc.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
> index a2f35e3..930a5c5 100644
> --- a/drivers/mmc/fsl_esdhc.c
> +++ b/drivers/mmc/fsl_esdhc.c
> @@ -491,6 +491,9 @@ int fsl_esdhc_initialize(bd_t *bis, struct
> fsl_esdhc_cfg *cfg) /* First reset the eSDHC controller */
>  	esdhc_reset(regs);
> 
> +	esdhc_setbits32(&regs->sysctl, SYSCTL_PEREN | SYSCTL_HCKEN
> +				| SYSCTL_IPGEN | SYSCTL_CKEN);
> +
>  	mmc->priv = cfg;
>  	mmc->send_cmd = esdhc_send_cmd;
>  	mmc->set_ios = esdhc_set_ios;

Best regards,
Marek Vasut
Changming Huang - May 21, 2012, 2:19 a.m.
VVN2.2/VVN2.3 is the vendor version number, that is the FSL SDHC IP verion.

Best Regards
Jerry Huang


> -----Original Message-----
> From: Marek Vasut [mailto:marex@denx.de]
> Sent: Saturday, May 19, 2012 12:03 AM
> To: Huang Changming-R66093
> Cc: u-boot@lists.denx.de; Andy Fleming
> Subject: Re: [PATCH 2/2 v3] FSL/eSDHC: enable the clock to detect the SD
> card
> 
> Dear Chang-Ming.Huang@freescale.com,
> 
> > From: Jerry Huang <Chang-Ming.Huang@freescale.com>
> >
> > For FSL low-end processors (VVN2.2)
> 
> What's VVN2.2 ?
> 
> > , in order to detect the SD card,
> > we should enable PEREN, HCKEN and IPGEN to enable the clock.
> > Otherwise, after booting the u-boot, and then inserting the SD card,
> > the SD card can't be detected.
> > For SDHC VVN2.3 IP
> 
> VVN2.3 ?
> 
> > , these bits are reserved, and SDCLKEN is used.
> > And when accessing to these reserved bit, no any impact happened.
> >
> > Signed-off-by: Jerry Huang <Chang-Ming.Huang@freescale.com>
> > CC: Andy Fleming <afleming@gmail.com>
> > CC: Marek Vasut <marex@denx.de>
> > ---
> > changes for v2:
> > 	- correct the typo
> > changes for v3:
> > 	- enable all clock bits for VVN2.3 and VVN2.2
> > 	- use funciton esdhc_setbits32
> > 	- tested on p1022ds, p1025rdb, p1020mbg-pc, mpc8536ds, p3041ds
> >
> >  drivers/mmc/fsl_esdhc.c |    3 +++
> >  1 files changed, 3 insertions(+), 0 deletions(-)
> >
> > diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c index
> > a2f35e3..930a5c5 100644
> > --- a/drivers/mmc/fsl_esdhc.c
> > +++ b/drivers/mmc/fsl_esdhc.c
> > @@ -491,6 +491,9 @@ int fsl_esdhc_initialize(bd_t *bis, struct
> > fsl_esdhc_cfg *cfg) /* First reset the eSDHC controller */
> >  	esdhc_reset(regs);
> >
> > +	esdhc_setbits32(&regs->sysctl, SYSCTL_PEREN | SYSCTL_HCKEN
> > +				| SYSCTL_IPGEN | SYSCTL_CKEN);
> > +
> >  	mmc->priv = cfg;
> >  	mmc->send_cmd = esdhc_send_cmd;
> >  	mmc->set_ios = esdhc_set_ios;
> 
> Best regards,
> Marek Vasut
Changming Huang - May 21, 2012, 2:34 a.m.
Best Regards
Jerry Huang


> -----Original Message-----
> From: Wood Scott-B07421
> Sent: Friday, May 18, 2012 11:55 PM
> To: Huang Changming-R66093
> Cc: u-boot@lists.denx.de; Marek Vasut; Andy Fleming
> Subject: Re: [U-Boot] [PATCH 2/2 v3] FSL/eSDHC: enable the clock to
> detect the SD card
> 
> On 05/18/2012 04:57 AM, Chang-Ming.Huang@freescale.com wrote:
> > From: Jerry Huang <Chang-Ming.Huang@freescale.com>
> >
> > For FSL low-end processors (VVN2.2), in order to detect the SD card,
> > we should enable PEREN, HCKEN and IPGEN to enable the clock.
> > Otherwise, after booting the u-boot, and then inserting the SD card,
> > the SD card can't be detected.
> > For SDHC VVN2.3 IP, these bits are reserved, and SDCLKEN is used.
> > And when accessing to these reserved bit, no any impact happened.
> 
> Again, have you talked to a hardware designer and confirmed that there's
> no impact from setting these bits on chips where they're reserved?  Just
> because you don't notice any obvious impact doesn't mean it's totally
> safe.
> 
Do you read the FSL SDHC driver? If not, please read it first.
Without my this patch, FSL SDHC driver has done it as I mentioned. 
The committer provided the patch to support VVN2.3 should talk to the hardware designer,
And he think it is safe. Otherwise he should detect the VVN to do the different thing.
The below is the code driver enable these bit:
In function set_sysctl:
clk = SYSCTL_PEREN | SYSCTL_CKEN; 
in function esdhc_init:
esdhc_write32(&regs->sysctl, SYSCTL_HCKEN | SYSCTL_IPGEN);

My work is just to pick up the codes from the driver and do it again in function fsl_esdhc_initialize:
esdhc_setbits32(&regs->sysctl, SYSCTL_PEREN | SYSCTL_HCKEN
                                | SYSCTL_IPGEN | SYSCTL_CKEN);
Changming Huang - July 11, 2012, 9:31 a.m.
Hi, Andy
There is not any feedback for very long time,
Could it be applied to u-boot?

Best Regards
Jerry Huang


> -----Original Message-----
> From: u-boot-bounces@lists.denx.de [mailto:u-boot-bounces@lists.denx.de]
> On Behalf Of Huang Changming-R66093
> Sent: Monday, May 21, 2012 10:35 AM
> To: Wood Scott-B07421
> Cc: Marek Vasut; u-boot@lists.denx.de; Andy Fleming
> Subject: Re: [U-Boot] [PATCH 2/2 v3] FSL/eSDHC: enable the clock to
> detect the SD card
> 
> 
> 
> Best Regards
> Jerry Huang
> 
> 
> > -----Original Message-----
> > From: Wood Scott-B07421
> > Sent: Friday, May 18, 2012 11:55 PM
> > To: Huang Changming-R66093
> > Cc: u-boot@lists.denx.de; Marek Vasut; Andy Fleming
> > Subject: Re: [U-Boot] [PATCH 2/2 v3] FSL/eSDHC: enable the clock to
> > detect the SD card
> >
> > On 05/18/2012 04:57 AM, Chang-Ming.Huang@freescale.com wrote:
> > > From: Jerry Huang <Chang-Ming.Huang@freescale.com>
> > >
> > > For FSL low-end processors (VVN2.2), in order to detect the SD card,
> > > we should enable PEREN, HCKEN and IPGEN to enable the clock.
> > > Otherwise, after booting the u-boot, and then inserting the SD card,
> > > the SD card can't be detected.
> > > For SDHC VVN2.3 IP, these bits are reserved, and SDCLKEN is used.
> > > And when accessing to these reserved bit, no any impact happened.
> >
> > Again, have you talked to a hardware designer and confirmed that
> > there's no impact from setting these bits on chips where they're
> > reserved?  Just because you don't notice any obvious impact doesn't
> > mean it's totally safe.
> >
> Do you read the FSL SDHC driver? If not, please read it first.
> Without my this patch, FSL SDHC driver has done it as I mentioned.
> The committer provided the patch to support VVN2.3 should talk to the
> hardware designer, And he think it is safe. Otherwise he should detect
> the VVN to do the different thing.
> The below is the code driver enable these bit:
> In function set_sysctl:
> clk = SYSCTL_PEREN | SYSCTL_CKEN;
> in function esdhc_init:
> esdhc_write32(&regs->sysctl, SYSCTL_HCKEN | SYSCTL_IPGEN);
> 
> My work is just to pick up the codes from the driver and do it again in
> function fsl_esdhc_initialize:
> esdhc_setbits32(&regs->sysctl, SYSCTL_PEREN | SYSCTL_HCKEN
>                                 | SYSCTL_IPGEN | SYSCTL_CKEN);
> 
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
Marek Vasut - July 13, 2012, 10:36 a.m.
Dear Huang Changming-R66093,

> Hi, Andy
> There is not any feedback for very long time,
> Could it be applied to u-boot?

Could it be we have a maintainer problem and unhappy contributor problem in 
here?

> Best Regards
> Jerry Huang
> 
> > -----Original Message-----
> > From: u-boot-bounces@lists.denx.de [mailto:u-boot-bounces@lists.denx.de]
> > On Behalf Of Huang Changming-R66093
> > Sent: Monday, May 21, 2012 10:35 AM
> > To: Wood Scott-B07421
> > Cc: Marek Vasut; u-boot@lists.denx.de; Andy Fleming
> > Subject: Re: [U-Boot] [PATCH 2/2 v3] FSL/eSDHC: enable the clock to
> > detect the SD card
> > 
> > 
> > 
> > Best Regards
> > Jerry Huang
> > 
> > > -----Original Message-----
> > > From: Wood Scott-B07421
> > > Sent: Friday, May 18, 2012 11:55 PM
> > > To: Huang Changming-R66093
> > > Cc: u-boot@lists.denx.de; Marek Vasut; Andy Fleming
> > > Subject: Re: [U-Boot] [PATCH 2/2 v3] FSL/eSDHC: enable the clock to
> > > detect the SD card
> > > 
> > > On 05/18/2012 04:57 AM, Chang-Ming.Huang@freescale.com wrote:
> > > > From: Jerry Huang <Chang-Ming.Huang@freescale.com>
> > > > 
> > > > For FSL low-end processors (VVN2.2), in order to detect the SD card,
> > > > we should enable PEREN, HCKEN and IPGEN to enable the clock.
> > > > Otherwise, after booting the u-boot, and then inserting the SD card,
> > > > the SD card can't be detected.
> > > > For SDHC VVN2.3 IP, these bits are reserved, and SDCLKEN is used.
> > > > And when accessing to these reserved bit, no any impact happened.
> > > 
> > > Again, have you talked to a hardware designer and confirmed that
> > > there's no impact from setting these bits on chips where they're
> > > reserved?  Just because you don't notice any obvious impact doesn't
> > > mean it's totally safe.
> > 
> > Do you read the FSL SDHC driver? If not, please read it first.
> > Without my this patch, FSL SDHC driver has done it as I mentioned.
> > The committer provided the patch to support VVN2.3 should talk to the
> > hardware designer, And he think it is safe. Otherwise he should detect
> > the VVN to do the different thing.
> > The below is the code driver enable these bit:
> > In function set_sysctl:
> > clk = SYSCTL_PEREN | SYSCTL_CKEN;
> > in function esdhc_init:
> > esdhc_write32(&regs->sysctl, SYSCTL_HCKEN | SYSCTL_IPGEN);
> > 
> > My work is just to pick up the codes from the driver and do it again in
> > function fsl_esdhc_initialize:
> > esdhc_setbits32(&regs->sysctl, SYSCTL_PEREN | SYSCTL_HCKEN
> > 
> >                                 | SYSCTL_IPGEN | SYSCTL_CKEN);
> > 
> > _______________________________________________
> > U-Boot mailing list
> > U-Boot@lists.denx.de
> > http://lists.denx.de/mailman/listinfo/u-boot

Best regards,
Marek Vasut

Patch

diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
index a2f35e3..930a5c5 100644
--- a/drivers/mmc/fsl_esdhc.c
+++ b/drivers/mmc/fsl_esdhc.c
@@ -491,6 +491,9 @@  int fsl_esdhc_initialize(bd_t *bis, struct fsl_esdhc_cfg *cfg)
 	/* First reset the eSDHC controller */
 	esdhc_reset(regs);
 
+	esdhc_setbits32(&regs->sysctl, SYSCTL_PEREN | SYSCTL_HCKEN
+				| SYSCTL_IPGEN | SYSCTL_CKEN);
+
 	mmc->priv = cfg;
 	mmc->send_cmd = esdhc_send_cmd;
 	mmc->set_ios = esdhc_set_ios;