mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 4/4] mci: make write support optional
Date: Fri,  8 Apr 2011 16:48:36 +0200	[thread overview]
Message-ID: <1302274116-9215-5-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1302274116-9215-1-git-send-email-s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/mci/Kconfig    |    5 +++++
 drivers/mci/mci-core.c |    6 ++++++
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/drivers/mci/Kconfig b/drivers/mci/Kconfig
index 9cb7eb6..cfed72f 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 8fd948c..4752b3d 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;
 
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      parent reply	other threads:[~2011-04-08 14:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-08 14:48 Sascha Hauer
2011-04-08 14:48 ` [PATCH 1/4] add block support Sascha Hauer
2011-04-08 14:48 ` [PATCH 2/4] ata: use " Sascha Hauer
2011-04-08 14:48 ` [PATCH 3/4] ata: make write support optional Sascha Hauer
2011-04-08 14:48 ` Sascha Hauer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1302274116-9215-5-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox