summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2011-04-07 17:40:00 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2011-04-11 15:57:51 +0200
commit64cc568eda4c72d5e1fc05b5fc3a3792a8f7c22e (patch)
tree46a470e4ee8a921f21e08fe2e98b38e1d9f0188b
parent99b9ca240ddccf63ab0e3eefbcf5e466220bb7c0 (diff)
downloadbarebox-64cc568eda4c72d5e1fc05b5fc3a3792a8f7c22e.tar.gz
barebox-64cc568eda4c72d5e1fc05b5fc3a3792a8f7c22e.tar.xz
mci: make write support optional
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--drivers/mci/Kconfig5
-rw-r--r--drivers/mci/mci-core.c6
2 files changed, 11 insertions, 0 deletions
diff --git a/drivers/mci/Kconfig b/drivers/mci/Kconfig
index 9cb7eb6f85..cfed72f71d 100644
--- a/drivers/mci/Kconfig
+++ b/drivers/mci/Kconfig
@@ -25,6 +25,11 @@ config MCI_INFO
This entry adds more info about the attached MCI card, when the
'devinfo' command is used on the mci device.
+config MCI_WRITE
+ bool "Support writing to MCI cards"
+ default y
+ select ATA_WRITE
+
comment "--- MCI host drivers ---"
config MCI_MXS
diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index 8fd948c33b..4752b3ddb2 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -106,6 +106,7 @@ static void *sector_buf;
* @param blocknum Block number to write
* @return Transaction status (0 on success)
*/
+#ifdef CONFIG_MCI_WRITE
static int mci_block_write(struct device_d *mci_dev, const void *src, unsigned blocknum)
{
struct mci *mci = GET_MCI_DATA(mci_dev);
@@ -132,6 +133,7 @@ static int mci_block_write(struct device_d *mci_dev, const void *src, unsigned b
return mci_send_cmd(mci_dev, &cmd, &data);
}
+#endif
/**
* Read one block of data from the card
@@ -944,6 +946,7 @@ static int sd_send_if_cond(struct device_d *mci_dev)
*
* This routine expects the buffer has the correct size to read all data!
*/
+#ifdef CONFIG_MCI_WRITE
static int mci_sd_write(struct device_d *disk_dev, uint64_t sector_start,
unsigned sector_count, const void *buffer)
{
@@ -980,6 +983,7 @@ static int mci_sd_write(struct device_d *disk_dev, uint64_t sector_start,
return 0;
}
+#endif
/**
* Read a chunk of sectors from media
@@ -1218,7 +1222,9 @@ static int mci_card_probe(struct device_d *mci_dev)
disk_dev = xzalloc(sizeof(struct device_d) + sizeof(struct ata_interface));
p = (struct ata_interface*)&disk_dev[1];
+#ifdef CONFIG_MCI_WRITE
p->write = mci_sd_write;
+#endif
p->read = mci_sd_read;
p->priv = mci_dev;