[OpenWrt-Devel] AsiaRF MT7620a mounting sdhci drive readonly

John Crispin blogic at openwrt.org
Sun Aug 24 02:07:33 EDT 2014


Hi Luis,

i have a awm0003 on my desk and will have a look during the week.

	John

On 23/08/2014 23:26, Luis Soltero wrote:
> 
> Hello All,
> 
> Been trying to get an AsiaRF based MT7620a board running using CC
> r42230 and having issue getting the MMC SD card reader to mount
> rw.
> 
> I have been in communication with the manufacturer to discover the
> GPIO (if any) used for the WP line for the SDHCI card reader on the
> board.  They have not gotten back to me.  In the mean time I have
> attempted to use some of the mmc driver properties such as
> wp-inverted to no avail.  In desperation I implemented a patch
> based on http://permalink.gmane.org/gmane.linux.kernel.mmc/25615 
> which tells the driver to ignore the write protect line and assume
> r/w always... yet the card still mounts read only. note that when
> mounting the same SD card using a USB based reader the file system
> mounts rw as expected.
> 
> here is the mount table showing the ro mount
> 
> root at OpenWRT:~# mount rootfs on / type rootfs (rw) snip... 
> /dev/mmcblk0p2 on /wxa type ext4 (ro,relatime,data=ordered)
> 
> 
> here is the DTS definition for the board
> 
> sdhci at 10130000 { status = "okay"; broken-wp; };
> 
> following is the patch (some of you might find it useful).  Any
> thoughts would greatly be appreciated.
> 
> $ cat
> target/linux/ramips/patches-3.10/0402-mmc-add-broken-wp.patch ---
> a/Documentation/devicetree/bindings/mmc/mmc.txt    2014-08-23
> 12:39:54.816004290 -0700 +++
> b/Documentation/devicetree/bindings/mmc/mmc.txt    2014-08-23
> 12:40:56.574123135 -0700 @@ -21,6 +21,8 @@ below for the case, when
> a GPIO is used for the CD line - wp-inverted: when present,
> polarity on the WP line is inverted. See the note below for the
> case, when a GPIO is used for the WP line +- broken-wp: when
> present, no indication of write protection is available, +  and
> write protection is assumed always off. - max-frequency: maximum
> operating clock frequency - no-1-8-v: when present, denotes that
> 1.8v card voltage is not supported on this system, even if the
> controller claims it is. --- a/drivers/mmc/host/sdhci-pltfm.c
> 2014-08-23 12:44:02.648454500 -0700 +++
> b/drivers/mmc/host/sdhci-pltfm.c    2014-08-23 12:45:52.009124011
> -0700 @@ -80,7 +80,9 @@ bus_width == 1)) host->quirks |=
> SDHCI_QUIRK_FORCE_1_BIT_DATA;
> 
> -        if (sdhci_of_wp_inverted(np)) +        if
> (of_get_property(np, "sdhci,broken-wp", NULL) ||
> of_get_property(np, "broken-wp", NULL)) +            host->quirks2
> |= SDHCI_QUIRK2_BROKEN_WRITE_PROTECT; +        else if
> (sdhci_of_wp_inverted(np)) host->quirks |=
> SDHCI_QUIRK_INVERTED_WRITE_PROTECT;
> 
> if (of_get_property(np, "broken-cd", NULL)) ---
> a/drivers/mmc/host/sdhci.c    2014-08-23 12:46:10.028575138 -0700 
> +++ b/drivers/mmc/host/sdhci.c    2014-08-23 12:48:23.588506665
> -0700 @@ -1621,6 +1621,8 @@
> 
> if (host->flags & SDHCI_DEVICE_DEAD) is_readonly = 0; +    else if
> (host->quirks2 & SDHCI_QUIRK2_BROKEN_WRITE_PROTECT) +
> is_readonly = 0; else if (host->ops->get_ro) is_readonly =
> host->ops->get_ro(host); else --- a/include/linux/mmc/sdhci.h
> 2014-08-23 12:56:38.005445877 -0700 +++ b/include/linux/mmc/sdhci.h
> 2014-08-23 12:58:58.113178602 -0700 @@ -95,6 +95,8 @@ /* 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) +/* There is no
> indication for write protection at all, assume RW */ +#define
> SDHCI_QUIRK2_BROKEN_WRITE_PROTECT        (1<<4)
> 
> int irq;        /* Device IRQ */ void __iomem *ioaddr;    /* Mapped
> address */
> 
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list