Disable SD Card Write Protect

I have a custom board which is very similar to Rev C4/C5. Since I
only use a Micro SD Card on my board it does not make sense for me to
have a Hardware Write Protect pin. So I have excluded it from my
design and am running into the issue of linux telling me the sd card
is write protected. I'm running ubuntu. Can anyone tell me where I
need to look in order to force the operating system into thinking the
Write Protect pin (GPIO_23) is always high?

Do something like this in your board support file:

static struct omap2_hsmmc_info mmc[] = {
  {
                 .name = "external",
    .mmc = 1,
      .caps = MMC_CAP_4_BIT_DATA,
    .gpio_cd = -EINVAL, // Filled in at boot time
    .gpio_wp = -EINVAL, // MicroSD - no WP available
  },
  {} /* Terminator */
};

Gary, thanks for the quick reply. I'm mainly the hardware guy so I'm
not sure which file is the board support file. Is this part of uboot?

Gary, thanks for the quick reply. I'm mainly the hardware guy so I'm
not sure which file is the board support file. Is this part of uboot?

No, in the Linux kernel. If you have a custom board, you'll probably have
a customized board file, or you'll be using [possibly modified] version of
the file .../arch/arm/mach-omap2/board-omap3beagle.c

n.b. Please don't top-post :slight_smile:

Thank you. Makes perfect sense now.

Gary and anyone else:

Where can I go to learn more about the "Board support file"? If I
wanted to create this file from scratch (which I don't) where would I
go to figure out for example what the MACHINE_START() function is
doing.

Sorry for the multiple e-mails but...

I made the change but I'm still getting the read-only messages. The
only thing I changed was the .gpio_wp assignment. This is what I have:

static struct omap2_hsmmc_info mmc[] = {
  {
    .mmc = 1,
    .wires = 8,
    .gpio_wp = -EINVAL,
  },
  {
    .mmc = 2,
    .wires = 4,
    .transceiver = true,
    .ocr_mask = 0x00100000, /* 3.3V */
  },
  {} /* Terminator */
};

Sorry for the multiple e-mails but...

I made the change but I'm still getting the read-only messages. The
only thing I changed was the .gpio_wp assignment. This is what I have:

static struct omap2_hsmmc_info mmc[] = {
  {
    .mmc = 1,
    .wires = 8,
    .gpio_wp = -EINVAL,
  },
  {
    .mmc = 2,
    .wires = 4,
    .transceiver = true,
    .ocr_mask = 0x00100000, /* 3.3V */
  },
  {} /* Terminator */
};

Looks like you have two separate MMC devices and have only disabled
the WP on one. Exactly what does your board look like?