From: Anton Vorontsov <hidden> Date: 2009-08-07 19:57:25
In v2:
- Addressed David Vrabel's comments;
- New patches added:
powerpc: Introduce and document sdhci,wp-inverted property for eSDHC
sdhci-of: Don't hard-code inverted write-protect quirk
powerpc/85xx: Add eSDHC support for MPC8536DS boards
From: Anton Vorontsov <hidden> Date: 2009-08-07 19:58:07
Linear divisor's values in a register start at 0 (zero means
"divide by 1"). Before this patch the code didn't account that
fact, so SD cards were running underclocked.
Signed-off-by: Anton Vorontsov <redacted>
---
drivers/mmc/host/sdhci-of.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
From: Anton Vorontsov <hidden> Date: 2009-08-07 19:58:11
eSDHC fails to recognize some SDHS cards, throwing timeout errors:
mmc0: error -110 whilst initialising SD card
That's because we calculate timeout value in a wrong way: on eSDHC
hosts the timeout clock is derivied from the SD clock, which is set
dynamically.
As David Vrabel suggested, deriving timeout clock from SD clock is
a common scheme, so let's implement DATA_TIMEOUT_USES_SDCLK quirk
and use it for eSDHC hosts.
Also, from now on we don't need esdhc_get_timeout_clock() callback,
so remove it.
Signed-off-by: Anton Vorontsov <redacted>
---
drivers/mmc/host/sdhci-of.c | 9 +--------
drivers/mmc/host/sdhci.c | 9 +++++++--
drivers/mmc/host/sdhci.h | 2 ++
3 files changed, 10 insertions(+), 10 deletions(-)
@@ -173,6 +173,7 @@reg=<0x2e0000x1000>;interrupts=<420x8>;interrupt-parent=<&ipic>;+sdhci,wp-inverted;/* Filled in by U-Boot */clock-frequency=<111111111>;};
@@ -173,6 +173,7 @@reg=<0x2e0000x1000>;interrupts=<420x8>;interrupt-parent=<&ipic>;+sdhci,wp-inverted;/* Filled in by U-Boot */clock-frequency=<111111111>;};
@@ -171,6 +171,7 @@reg=<0x2e0000x1000>;interrupts=<420x8>;interrupt-parent=<&ipic>;+sdhci,wp-inverted;/* Filled in by U-Boot */clock-frequency=<111111111>;};
From: Anton Vorontsov <hidden> Date: 2009-08-07 19:58:17
- Get rid of incomprehensible "if { for { if } }" construction for the
exponential divisor calculation. The first if statement isn't correct
at all, since it should check for "host->max_clk / pre_div / 16 >
clock". The error doesn't cause any bugs because the check in the for
loop does the right thing, and so the outer check becomes useless;
- For the linear divisor do the same: a single while statement is more
readable than for + if construction;
- Add dev_dbg() that prints desired and actual clock frequency.
Signed-off-by: Anton Vorontsov <redacted>
---
drivers/mmc/host/sdhci-of.c | 19 ++++++++-----------
1 files changed, 8 insertions(+), 11 deletions(-)
From: Anton Vorontsov <hidden> Date: 2009-08-07 19:58:18
MPC85xx SOCs have normal write-protect state reporting, so we shouldn't
hard-code the quirk.
Instead, look for "sdhci,wp-inverted" property, plus check for
mpc837x_{rdb,mds} machines since older device trees don't specify the
new property.
Signed-off-by: Anton Vorontsov <redacted>
---
drivers/mmc/host/sdhci-of.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
@@ -175,7 +176,6 @@ static unsigned int esdhc_get_min_clock(struct sdhci_host *host)staticstructsdhci_of_datasdhci_esdhc={.quirks=SDHCI_QUIRK_FORCE_BLK_SZ_2048|SDHCI_QUIRK_BROKEN_CARD_DETECTION|-SDHCI_QUIRK_INVERTED_WRITE_PROTECT|SDHCI_QUIRK_NO_BUSY_IRQ|SDHCI_QUIRK_NONSTANDARD_CLOCK|SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK|
@@ -219,6 +219,15 @@ static int sdhci_of_resume(struct of_device *ofdev)#endif+staticbool__devinitsdhci_of_wp_inverted(structdevice_node*np)+{+if(of_get_property(np,"sdhci,wp-inverted",NULL))+returntrue;++/* Old device trees don't have the wp-inverted property. */+returnmachine_is(mpc837x_rdb)||machine_is(mpc837x_mds);+}+staticint__devinitsdhci_of_probe(structof_device*ofdev,conststructof_device_id*match){
@@ -261,6 +270,9 @@ static int __devinit sdhci_of_probe(struct of_device *ofdev,if(of_get_property(np,"sdhci,1-bit-only",NULL))host->quirks|=SDHCI_QUIRK_FORCE_1_BIT_DATA;+if(sdhci_of_wp_inverted(np))+host->quirks|=SDHCI_QUIRK_INVERTED_WRITE_PROTECT;+clk=of_get_property(np,"clock-frequency",&size);if(clk&&size==sizeof(*clk)&&*clk)of_host->clock=*clk;
From: Anton Vorontsov <hidden> Date: 2009-08-07 19:58:25
This patch simply adds sdhci node to the device tree.
We specify clock-frequency manually, so that eSDHC will work without
upgrading U-Boot. Though, that'll only work for default setup (1500
MHz) on new board revisions. For non-default setups, it's recommended
to upgrade U-Boot, since it will fixup clock-frequency automatically.
Signed-off-by: Anton Vorontsov <redacted>
---
arch/powerpc/boot/dts/mpc8536ds.dts | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
From: Anton Vorontsov <hidden> Date: 2009-08-07 19:59:09
SDHCI core tries to write HISPD bit into the host control register,
but the eSDHC controllers don't have that bit, and that causes
all sorts of misbehaviour when using 4-bit mode capable SD cards.
Signed-off-by: Anton Vorontsov <redacted>
---
drivers/mmc/host/sdhci-of.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
From: Kumar Gala <hidden> Date: 2009-08-11 13:50:40
On Aug 7, 2009, at 2:58 PM, Anton Vorontsov wrote:
This patch simply adds sdhci node to the device tree.
We specify clock-frequency manually, so that eSDHC will work without
upgrading U-Boot. Though, that'll only work for default setup (1500
MHz) on new board revisions. For non-default setups, it's recommended
to upgrade U-Boot, since it will fixup clock-frequency automatically.
Signed-off-by: Anton Vorontsov <redacted>
---
arch/powerpc/boot/dts/mpc8536ds.dts | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
Can you update the mpc8536ds_36b.dts as well (its in my next branch)
- k
From: Anton Vorontsov <hidden> Date: 2009-08-18 23:38:21
This patch simply adds sdhci node to the device tree.
We specify clock-frequency manually, so that eSDHC will work without
upgrading U-Boot. Though, that'll only work for default setup (1500
MHz) on new board revisions. For non-default setups, it's recommended
to upgrade U-Boot, since it will fixup clock-frequency automatically.
Signed-off-by: Anton Vorontsov <redacted>
---
On Tue, Aug 11, 2009 at 08:48:32AM -0500, Kumar Gala wrote:
On Aug 7, 2009, at 2:58 PM, Anton Vorontsov wrote:
quoted
This patch simply adds sdhci node to the device tree.
We specify clock-frequency manually, so that eSDHC will work without
upgrading U-Boot. Though, that'll only work for default setup (1500
MHz) on new board revisions. For non-default setups, it's recommended
to upgrade U-Boot, since it will fixup clock-frequency automatically.
Signed-off-by: Anton Vorontsov <redacted>
---
arch/powerpc/boot/dts/mpc8536ds.dts | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
Can you update the mpc8536ds_36b.dts as well (its in my next branch)
From: Kumar Gala <hidden> Date: 2009-08-19 01:25:58
On Aug 18, 2009, at 6:38 PM, Anton Vorontsov wrote:
This patch simply adds sdhci node to the device tree.
We specify clock-frequency manually, so that eSDHC will work without
upgrading U-Boot. Though, that'll only work for default setup (1500
MHz) on new board revisions. For non-default setups, it's recommended
to upgrade U-Boot, since it will fixup clock-frequency automatically.
Signed-off-by: Anton Vorontsov <redacted>
out of interest the 85xx eSDHC don't need the sdhci,wp-inverted
property?
- k
From: Anton Vorontsov <hidden> Date: 2009-08-19 01:51:01
On Tue, Aug 18, 2009 at 08:24:17PM -0500, Kumar Gala wrote:
On Aug 18, 2009, at 6:38 PM, Anton Vorontsov wrote:
quoted
This patch simply adds sdhci node to the device tree.
We specify clock-frequency manually, so that eSDHC will work without
upgrading U-Boot. Though, that'll only work for default setup (1500
MHz) on new board revisions. For non-default setups, it's recommended
to upgrade U-Boot, since it will fixup clock-frequency automatically.
Signed-off-by: Anton Vorontsov <redacted>
out of interest the 85xx eSDHC don't need the sdhci,wp-inverted
property?
Yes, eSDHC controllers in MPC85xx report normal state in its
registers.
But the funny thing is that the switch itself is inverted,
so to enable writing, on MPC8569E-MDS and MPC8536DS boards
we have to place card's write protect tab into "lock" position.
Unfortunately we can't fix that in software since controller
doesn't permit write operations if it detects write-protected
state. On the bright side, IIRC MPC8536DS revision history
says that WP line level is fixed via BCSR upgrade. Not sure
if it is possible to fix it for MPC8569E-MDS.
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
From: Kumar Gala <hidden> Date: 2009-08-25 14:46:20
On Aug 18, 2009, at 6:38 PM, Anton Vorontsov wrote:
This patch simply adds sdhci node to the device tree.
We specify clock-frequency manually, so that eSDHC will work without
upgrading U-Boot. Though, that'll only work for default setup (1500
MHz) on new board revisions. For non-default setups, it's recommended
to upgrade U-Boot, since it will fixup clock-frequency automatically.
Signed-off-by: Anton Vorontsov <redacted>
---
On Tue, Aug 11, 2009 at 08:48:32AM -0500, Kumar Gala wrote:
quoted
On Aug 7, 2009, at 2:58 PM, Anton Vorontsov wrote:
quoted
This patch simply adds sdhci node to the device tree.
We specify clock-frequency manually, so that eSDHC will work without
upgrading U-Boot. Though, that'll only work for default setup (1500
MHz) on new board revisions. For non-default setups, it's
recommended
to upgrade U-Boot, since it will fixup clock-frequency
automatically.
Signed-off-by: Anton Vorontsov <redacted>
---
arch/powerpc/boot/dts/mpc8536ds.dts | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
Can you update the mpc8536ds_36b.dts as well (its in my next branch)
From: Hu Mingkai-B21284 <hidden> Date: 2009-08-28 11:03:12
=20
-----Original Message-----
From:=20
linuxppc-dev-bounces+b21284=3Dfreescale.com@lists.ozlabs.org=20
[mailto:linuxppc-dev-bounces+b21284=3Dfreescale.com@lists.ozlabs
.org] On Behalf Of Anton Vorontsov
Sent: Wednesday, August 19, 2009 9:51 AM
To: Kumar Gala
Cc: Ben Dooks; linux-kernel@vger.kernel.org;=20
sdhci-devel@lists.ossman.eu; linuxppc-dev@ozlabs.org; Andrew=20
Morton; Pierre Ossman; David Vrabel
Subject: Re: [PATCH v2] powerpc/85xx: Add eSDHC support for=20
MPC8536DS boards
=20
On Tue, Aug 18, 2009 at 08:24:17PM -0500, Kumar Gala wrote:
quoted
=20
On Aug 18, 2009, at 6:38 PM, Anton Vorontsov wrote:
=20
quoted
This patch simply adds sdhci node to the device tree.
We specify clock-frequency manually, so that eSDHC will=20
work without=20
quoted
quoted
upgrading U-Boot. Though, that'll only work for default setup (1500
MHz) on new board revisions. For non-default setups, it's=20
recommended=20
quoted
quoted
to upgrade U-Boot, since it will fixup clock-frequency=20
automatically.
quoted
quoted
Signed-off-by: Anton Vorontsov <redacted>
=20
out of interest the 85xx eSDHC don't need the sdhci,wp-inverted=20
property?
=20
Yes, eSDHC controllers in MPC85xx report normal state in its=20
registers.
=20
Hi Anton,
The eSDHC controller in different silicon version on MPC8536 reports
different WP state in the register PRSSTAT:
Silicon 1.0:
Card WP pos PRSSTAT[WPSPL] RMMCR[SDHC_WP] GENCFG[SDHC_WP_INV]
------------------------------------------------------------------------
---------------------------------------------
unLock 1 1
/
Lock 0 1
/
Silicon 1.1:
Card WP pos PRSSTAT[WPSPL] RMMCR[SDHC_WP] GENCFG[SDHC_WP_INV]
------------------------------------------------------------------------
---------------------------------------------
unLock 0 1
0
Lock 1 1
0
Note: the register GENCFG is added on silicon 1.1 to invert the WP
state.
For silicon 1.0, the macro SDHCI_QUIRK_INVERTED_WRITE_PROTECT is also
defined,
so the dirver will report the error WP state in function sdhci_get_ro.
Best regards,
Mingkai
From: Anton Vorontsov <hidden> Date: 2009-08-28 15:19:53
On Fri, Aug 28, 2009 at 07:02:51PM +0800, Hu Mingkai-B21284 wrote:
quoted
On Tue, Aug 18, 2009 at 08:24:17PM -0500, Kumar Gala wrote:
quoted
On Aug 18, 2009, at 6:38 PM, Anton Vorontsov wrote:
quoted
This patch simply adds sdhci node to the device tree.
We specify clock-frequency manually, so that eSDHC will
work without
quoted
quoted
upgrading U-Boot. Though, that'll only work for default setup (1500
MHz) on new board revisions. For non-default setups, it's
recommended
quoted
quoted
to upgrade U-Boot, since it will fixup clock-frequency
automatically.
quoted
quoted
Signed-off-by: Anton Vorontsov <redacted>
out of interest the 85xx eSDHC don't need the sdhci,wp-inverted
property?
Yes, eSDHC controllers in MPC85xx report normal state in its
registers.
Hi Anton,
The eSDHC controller in different silicon version on MPC8536 reports
different WP state in the register PRSSTAT:
Thanks a million for the heads up!
Yes, the manual I used ("MPC8536ERM Rev. 0 10/2008") doesn't mention
that, but the newer manual that I just downloaded ("MPC8536ERM Rev. 1
05/2009") does.
[...]
For silicon 1.0, the macro SDHCI_QUIRK_INVERTED_WRITE_PROTECT is also
defined,
so the dirver will report the error WP state in function sdhci_get_ro.
Not any longer. We don't actually define it for any 85xx CPUs.
I need to think how should we handle all these WP inversions. :-)
So, we have inversion in BCSR (depending on the BCSR revision),
configurable inversion in CPU via GENCFGR for 1.1 silicon, and
non-configurable non-inverted reporting for 1.0 silicon...
Do you know if there are any plans to fix the WP inversion for
MPC8569E-MDS boards, or make something like GENCFGR for MPC8569
CPUs?
Thanks,
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
From: Hu Mingkai-B21284 <hidden> Date: 2009-08-31 07:51:53
=20
-----Original Message-----
From: Anton Vorontsov [mailto:avorontsov@ru.mvista.com]=20
Sent: Friday, August 28, 2009 11:20 PM
To: Hu Mingkai-B21284
Cc: Kumar Gala; Ben Dooks; linux-kernel@vger.kernel.org;=20
sdhci-devel@lists.ossman.eu; linuxppc-dev@ozlabs.org; Andrew=20
Morton; Pierre Ossman; David Vrabel
Subject: Re: [PATCH v2] powerpc/85xx: Add eSDHC support for=20
MPC8536DS boards
=20
On Fri, Aug 28, 2009 at 07:02:51PM +0800, Hu Mingkai-B21284 wrote:
quoted
quoted
On Tue, Aug 18, 2009 at 08:24:17PM -0500, Kumar Gala wrote:
quoted
=20
On Aug 18, 2009, at 6:38 PM, Anton Vorontsov wrote:
=20
quoted
This patch simply adds sdhci node to the device tree.
We specify clock-frequency manually, so that eSDHC will
work without
quoted
quoted
upgrading U-Boot. Though, that'll only work for default setup=20
(1500
MHz) on new board revisions. For non-default setups, it's
recommended
quoted
quoted
to upgrade U-Boot, since it will fixup clock-frequency
automatically.
quoted
quoted
Signed-off-by: Anton Vorontsov <redacted>
=20
out of interest the 85xx eSDHC don't need the sdhci,wp-inverted=20
property?
=20
Yes, eSDHC controllers in MPC85xx report normal state in its=20
registers.
=20
=20
Hi Anton,
=20
The eSDHC controller in different silicon version on=20
MPC8536 reports=20
quoted
different WP state in the register PRSSTAT:
=20
Thanks a million for the heads up!
=20
Yes, the manual I used ("MPC8536ERM Rev. 0 10/2008") doesn't=20
mention that, but the newer manual that I just downloaded=20
("MPC8536ERM Rev. 1
05/2009") does.
=20
[...]
quoted
For silicon 1.0, the macro=20
SDHCI_QUIRK_INVERTED_WRITE_PROTECT is also=20
quoted
defined, so the dirver will report the error WP state in function=20
sdhci_get_ro.
=20
Not any longer. We don't actually define it for any 85xx CPUs.
=20
I need to think how should we handle all these WP inversions. :-)
=20
So, we have inversion in BCSR (depending on the BCSR=20
revision), configurable inversion in CPU via GENCFGR for 1.1=20
silicon, and non-configurable non-inverted reporting for 1.0=20
silicon...
=20
Do you know if there are any plans to fix the WP inversion=20
for MPC8569E-MDS boards, or make something like GENCFGR for=20
MPC8569 CPUs?
=20
Thanks,
=20
Sorry, I also don't know the plan to MPC8569 CPU, but if I get any info,
I'll inform you ASAP. :-)
Best regards,
Mingkai
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
=20
=20