[OpenWrt-Devel] AsiaRF MT7620a mounting sdhci drive readonly
Luis Soltero
lsoltero at globalmarinenet.com
Sun Aug 24 02:46:15 EDT 2014
hello john,
thanks for looking into this... just so that you know I forced is_readonly = 0
in sdhci.c as in ...
static int sdhci_check_ro(struct sdhci_host *host)
{
unsigned long flags;
int is_readonly;
spin_lock_irqsave(&host->lock, flags);
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
is_readonly = !(sdhci_readl(host, SDHCI_PRESENT_STATE)
& SDHCI_WRITE_PROTECT);
is_readonly = 0;
spin_unlock_irqrestore(&host->lock, flags);
return 0;
and yet...
root at Optimizer:~# e2fsck /dev/mmcblk0p2
e2fsck 1.42.4 (12-June-2012)
e2fsck: Read-only file system while trying to open /dev/mmcblk0p2
Disk write-protected; use the -n option to do a read-only
check of the device.
so unsure at this time why the driver thinks that this is a read only file system.
look forward to your findings.
--luis
On 8/24/14, 2:07 AM, John Crispin wrote:
> 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 */
>>
--
Luis Soltero, Ph.D., MCS
Director of Software Development, CTO
Global Marine Networks, LLC
StarPilot, LLC
Tel: +1.865.379.8723
Fax: +1.865.681.5017
E-Mail: lsoltero at globalmarinenet.net
Web: http://www.globalmarinenet.net
Web: http://www.redportglobal.com
Web: http://www.starpilotllc.com
_______________________________________________
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