public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* Re: SDHCI - Add QUIRK2_BROKEN_WRITE_PROTEXT - Support Xilinx Zynq (Linux 3.9.0)
       [not found] <BEDA323D25EF6045A68DAB9FD91A0BF14A5E84DB@AMSPRD0411MB426.eurprd04.prod.outlook.com>
@ 2013-08-20 12:54 ` Michal Simek
  2013-08-20 18:13   ` Chris Ball
  0 siblings, 1 reply; 2+ messages in thread
From: Michal Simek @ 2013-08-20 12:54 UTC (permalink / raw)
  To: James Walmsley, Chris Ball; +Cc: linux-kernel@vger.kernel.org, linux-mmc

[-- Attachment #1: Type: text/plain, Size: 3086 bytes --]

Hi James,

isn't it better to implement host->ops->get_ro() function for it?
It seems me better choice than introducing new quirk option.

Chris: What do you think?

Thanks,
Michal


On 08/16/2013 02:14 PM, James Walmsley wrote:
> Hi Michal,
> 
> I have built a Xilinx Zynq based design which doesn't use the SDHCI Write-protect line.
> However, we use the MIO_0 pin for configuring a multiplexer and consequently the
> SDHCI driver thinks that the card is read-only (RO).
> 
> In the patch below I have proposed a new quirk, similar to the QUIRK_BROKEN_CARD_DETECTION
> flag, which causes the sdhci driver to assume a card with RW access.
> 
> This patch was made against the latest tree from Xilinx (github.com/Xilinx/linux-xlnx), Kernel 3.9.0
> and I have attached it to the LKML to propose the additional quirk which may be useful on other platforms.
> 
> Kind regards,
> 
> James Walmsley
> 
> ---
>  drivers/mmc/host/sdhci-of-xilinxps.c | 4 ++++
>  drivers/mmc/host/sdhci.c             | 4 ++++
>  include/linux/mmc/sdhci.h            | 1 +
>  3 files changed, 9 insertions(+)
> 
> diff --git a/drivers/mmc/host/sdhci-of-xilinxps.c b/drivers/mmc/host/sdhci-of-xilinxps.c
> index f79e0db..5553bc0 100644
> --- a/drivers/mmc/host/sdhci-of-xilinxps.c
> +++ b/drivers/mmc/host/sdhci-of-xilinxps.c
> @@ -211,6 +211,10 @@ static int sdhci_zynq_probe(struct platform_device *pdev)
>  	if (prop == NULL || (!(u32) be32_to_cpup(prop)))
>  		host->quirks |= SDHCI_QUIRK_BROKEN_CARD_DETECTION;
>  
> +	prop = of_get_property(np, "xlnx,has-wp", NULL);
> +	if (prop == NULL || (!(u32) be32_to_cpup(prop)))
> +		host->quirks2 |= SDHCI_QUIRK2_BROKEN_WRITE_PROTECT;
> +
>  	return 0;
>  
>  clk_notif_unreg:
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 51bbba4..c40365f 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -1609,6 +1609,10 @@ static int sdhci_do_get_ro(struct sdhci_host *host)
>  {
>  	int i, ro_count;
>  
> +	if(host->quirks2 & SDHCI_QUIRK2_BROKEN_WRITE_PROTECT) {
> +		return 0;	// Return zero to assume RW.
> +	}
> +
>  	if (!(host->quirks & SDHCI_QUIRK_UNSTABLE_RO_DETECT))
>  		return sdhci_check_ro(host);
>  
> diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
> index b838ffc..3eccf12 100644
> --- a/include/linux/mmc/sdhci.h
> +++ b/include/linux/mmc/sdhci.h
> @@ -95,6 +95,7 @@ struct sdhci_host {
>  /* The system physically doesn't support 1.8v, even if the host does */
>  #define SDHCI_QUIRK2_NO_1_8_V				(1<<2)
>  #define SDHCI_QUIRK2_PRESET_VALUE_BROKEN		(1<<3)
> +#define SDHCI_QUIRK2_BROKEN_WRITE_PROTECT		(1<<4)
>  
>  	int irq;		/* Device IRQ */
>  	void __iomem *ioaddr;	/* Mapped address */
> 


-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: SDHCI - Add QUIRK2_BROKEN_WRITE_PROTEXT - Support Xilinx Zynq (Linux 3.9.0)
  2013-08-20 12:54 ` SDHCI - Add QUIRK2_BROKEN_WRITE_PROTEXT - Support Xilinx Zynq (Linux 3.9.0) Michal Simek
@ 2013-08-20 18:13   ` Chris Ball
  0 siblings, 0 replies; 2+ messages in thread
From: Chris Ball @ 2013-08-20 18:13 UTC (permalink / raw)
  To: monstr; +Cc: James Walmsley, linux-kernel@vger.kernel.org, linux-mmc

Hi,

On Tue, Aug 20 2013, Michal Simek wrote:
> Hi James,
>
> isn't it better to implement host->ops->get_ro() function for it?
> It seems me better choice than introducing new quirk option.

Yes, I agree.  Thanks,

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-08-20 18:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <BEDA323D25EF6045A68DAB9FD91A0BF14A5E84DB@AMSPRD0411MB426.eurprd04.prod.outlook.com>
2013-08-20 12:54 ` SDHCI - Add QUIRK2_BROKEN_WRITE_PROTEXT - Support Xilinx Zynq (Linux 3.9.0) Michal Simek
2013-08-20 18:13   ` Chris Ball

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox