Writable SD-Card

      Writable SD-Card

      Hi,

      after successfully mounting the sd-card I've realized that it's mounted read-only.

      I've tried to mount it rw but that didn't worked.... (Physical write protection is off)

      Source Code

      1. mount -t vfat -o rw /dev/mmcblk0p1 /sdcard/


      The result is the same as when I didn't specify the options:

      Source Code

      1. /dev/mmcblk0p1 on /sdcard type vfat (ro,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=cp437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)


      What do I have to do when I'd like to write on the card?? Is there another hidden switch?!? ;)

      Thanks

      Marc

      Re: Writable SD-Card

      Thanks for pointing this out. Yes, apparently Samsung has implemented this write-protect detection bit wrongly in the hardware. The following patch should fix this in software.

      Difference-File

      1. Write-protect detection is inverted on Samsung CPUs. In fact there
      2. is no write-protect detection at all on these CPUs, but this bit is
      3. fixed to High, which is by definition write-protected. But we want
      4. write-enabled by default. So use the inverted value of this bit.
      5. ---
      6. drivers/mmc/host/sdhci-s3c.c | 6 ++++++
      7. 1 files changed, 6 insertions(+), 0 deletions(-)
      8. diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
      9. index c9ce748..4f3442c 100644
      10. --- a/drivers/mmc/host/sdhci-s3c.c
      11. +++ b/drivers/mmc/host/sdhci-s3c.c
      12. @@ -520,6 +520,12 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
      13. * SDHCI block, or a missing configuration that needs to be set. */
      14. host->quirks |= SDHCI_QUIRK_NO_BUSY_IRQ;
      15. + /* Write-protect detection is inverted on Samsung CPUs. In fact there
      16. + is no write-protect detection at all on these CPUs, but this bit is
      17. + fixed to High, which is by definition write-protected. But we want
      18. + write-enabled by default. So use the inverted value of this bit. */
      19. + host->quirks |= SDHCI_QUIRK_INVERTED_WRITE_PROTECT;
      20. +
      21. if (pdata->cd_type == S3C_SDHCI_CD_NONE ||
      22. pdata->cd_type == S3C_SDHCI_CD_PERMANENT)
      23. host->quirks |= SDHCI_QUIRK_BROKEN_CARD_DETECTION;


      The patch is also attached to this posting for download. Then go to the top level directory of the Linux kernel source and apply the patch with the following command

      Source Code

      1. patch -p1 < Invert-SD-Card-write-protect-detection-on-Samsung-CPUs.patch


      Your F&S Support Team
      F&S Elektronik Systeme GmbH
      As this is an international forum, please try to post in English.
      Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.