linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: cjb@laptop.org (Chris Ball)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] dw_mmc: Add Synopsys DesignWare mmc host driver.
Date: Sun, 12 Dec 2010 13:52:24 +0000	[thread overview]
Message-ID: <20101212135224.GA31812@void.printf.net> (raw)
In-Reply-To: <AANLkTin5aVPz5Y=jS89V00XS=rje3gqeUb2VTYt2A_9=@mail.gmail.com>

Hi Will,

On Sun, Dec 12, 2010 at 10:57:44AM +0000, Will Newton wrote:
> > drivers/mmc/host/dw_mmc.c: In function ?dw_mci_pull_data64?:
> > drivers/mmc/host/dw_mmc.c:998: error: implicit declaration of function ?__raw_readq?
> >
> > because arch/arm doesn't implement raw versions of these 64-bit accesses.
> > I'm surprised that this driver hasn't been compiled on ARM before! ?What
> 
> That particular bit of code has been added since it was last built for
> arm. Our architecture can do 64bit accesses so we implement readq.
> Unfortunately there doesn't seem to be a sane way to conditionalize
> code for architectures that have or don't have readq, so I suspect
> I'll have to just remove that branch of the if statement for now.

(Russell, thanks for the excellent explanation.)

Other drivers (MTD, gpio/basic_mmio_gpio.c, fs/fuse, pcm_oss.c)
conditionalize uses of {read,write}q on BITS_PER_LONG >= 64, so
something like this:

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 7de6b42..526b5cb 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -988,10 +988,11 @@ static void dw_mci_pull_data32(struct dw_mci *host, void *buf, int cnt)
 		*pData++ = mci_readl(host, DATA);
 		cnt--;
 	}
 }
 
+#if BITS_PER_LONG >= 64
 static void dw_mci_push_data64(struct dw_mci *host, void *buf, int cnt)
 {
 	u64 *pData = (u64 *)buf;
 
 	WARN_ON(cnt % 8 != 0);
@@ -1013,10 +1014,11 @@ static void dw_mci_pull_data64(struct dw_mci *host, void *buf, int cnt)
 	while (cnt > 0) {
 		*pData++ = mci_readq(host, DATA);
 		cnt--;
 	}
 }
+#endif
 
 static void dw_mci_read_data_pio(struct dw_mci *host)
 {
 	struct scatterlist *sg = host->sg;
 	void *buf = sg_virt(sg);
@@ -1591,15 +1593,17 @@ static int dw_mci_probe(struct platform_device *pdev)
 	if (!i) {
 		host->push_data = dw_mci_push_data16;
 		host->pull_data = dw_mci_pull_data16;
 		width = 16;
 		host->data_shift = 1;
+#if BITS_PER_LONG >= 64
 	} else if (i == 2) {
 		host->push_data = dw_mci_push_data64;
 		host->pull_data = dw_mci_pull_data64;
 		width = 64;
 		host->data_shift = 3;
+#endif
 	} else {
 		/* Check for a reserved value, and warn if it is */
 		WARN((i != 1),
 			"HCON reports a reserved host data width!\n"
 			"Defaulting to 32-bit access.\n");


This is only useful if you just want the driver to compile (it compiles
on ARM after the above) and don't expect a working device if you find
the HCON programmed with 64-bit width on an ARM board, though.

Thanks,

-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

  reply	other threads:[~2010-12-12 13:52 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AANLkTi=0RtvsGX+Q3goL3mdG6oKeNidYtiudTZ8ZTpRP@mail.gmail.com>
     [not found] ` <20101208115510.GD10998@console-pimps.org>
     [not found]   ` <AANLkTi=KqOa-MRQiptCtZGvoafRCgULfE3QFs=hmGpdi@mail.gmail.com>
     [not found]     ` <AANLkTi=PpTi1_JO9Q=ph7w9Jim8iXMf9LbCfmEkWuo-h@mail.gmail.com>
     [not found]       ` <20101209064751.GA21128@void.printf.net>
     [not found]         ` <AANLkTimMgrawcndvUTYYjq9BGFqs-sbRsZkwVQ0Uvhvb@mail.gmail.com>
     [not found]           ` <20101209160157.GA28586@void.printf.net>
2010-12-09 17:35             ` [PATCH] dw_mmc: Add Synopsys DesignWare mmc host driver Chris Ball
2010-12-09 17:46               ` Will Newton
     [not found]             ` <AANLkTim3Rj2tTbqvT8nM4L=p=Wx8bdOnGq=EDv+cs02g@mail.gmail.com>
2010-12-11 19:23               ` Chris Ball
2010-12-12  8:41                 ` Russell King - ARM Linux
2010-12-12 11:15                   ` Russell King - ARM Linux
2010-12-12 10:57                 ` Will Newton
2010-12-12 13:52                   ` Chris Ball [this message]
2010-12-12 14:03                     ` Will Newton
2010-12-12 14:11                       ` Russell King - ARM Linux
2010-12-12 14:31                         ` Will Newton
2010-12-12 14:47                           ` Russell King - ARM Linux
2010-12-12 15:17                             ` Will Newton
2010-12-16 17:04                 ` [PATCH v4] " Will Newton
2011-01-02  6:20                   ` Chris Ball
2011-01-18  7:54                   ` Jaehoon Chung
2011-01-18 10:21                     ` Will Newton
2011-02-08  6:38                       ` Jaehoon Chung
2011-02-08 10:29                         ` Will Newton
2011-02-08 10:49                           ` Jaehoon Chung
2011-02-08 12:06                             ` Will Newton

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=20101212135224.GA31812@void.printf.net \
    --to=cjb@laptop.org \
    --cc=linux-arm-kernel@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;
as well as URLs for NNTP newsgroup(s).