aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/sdhci.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mmc/host/sdhci.h')
-rw-r--r--drivers/mmc/host/sdhci.h95
1 files changed, 95 insertions, 0 deletions
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index 43c37c68d07a..d9733f841061 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -10,6 +10,9 @@
10 */ 10 */
11 11
12#include <linux/scatterlist.h> 12#include <linux/scatterlist.h>
13#include <linux/compiler.h>
14#include <linux/types.h>
15#include <linux/io.h>
13 16
14/* 17/*
15 * Controller registers 18 * Controller registers
@@ -267,9 +270,101 @@ struct sdhci_host {
267 270
268 271
269struct sdhci_ops { 272struct sdhci_ops {
273#ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS
274 u32 (*readl)(struct sdhci_host *host, int reg);
275 u16 (*readw)(struct sdhci_host *host, int reg);
276 u8 (*readb)(struct sdhci_host *host, int reg);
277 void (*writel)(struct sdhci_host *host, u32 val, int reg);
278 void (*writew)(struct sdhci_host *host, u16 val, int reg);
279 void (*writeb)(struct sdhci_host *host, u8 val, int reg);
280#endif
281
270 int (*enable_dma)(struct sdhci_host *host); 282 int (*enable_dma)(struct sdhci_host *host);
271}; 283};
272 284
285#ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS
286
287static inline void sdhci_writel(struct sdhci_host *host, u32 val, int reg)
288{
289 if (unlikely(host->ops->writel))
290 host->ops->writel(host, val, reg);
291 else
292 writel(val, host->ioaddr + reg);
293}
294
295static inline void sdhci_writew(struct sdhci_host *host, u16 val, int reg)
296{
297 if (unlikely(host->ops->writew))
298 host->ops->writew(host, val, reg);
299 else
300 writew(val, host->ioaddr + reg);
301}
302
303static inline void sdhci_writeb(struct sdhci_host *host, u8 val, int reg)
304{
305 if (unlikely(host->ops->writeb))
306 host->ops->writeb(host, val, reg);
307 else
308 writeb(val, host->ioaddr + reg);
309}
310
311static inline u32 sdhci_readl(struct sdhci_host *host, int reg)
312{
313 if (unlikely(host->ops->readl))
314 return host->ops->readl(host, reg);
315 else
316 return readl(host->ioaddr + reg);
317}
318
319static inline u16 sdhci_readw(struct sdhci_host *host, int reg)
320{
321 if (unlikely(host->ops->readw))
322 return host->ops->readw(host, reg);
323 else
324 return readw(host->ioaddr + reg);
325}
326
327static inline u8 sdhci_readb(struct sdhci_host *host, int reg)
328{
329 if (unlikely(host->ops->readb))
330 return host->ops->readb(host, reg);
331 else
332 return readb(host->ioaddr + reg);
333}
334
335#else
336
337static inline void sdhci_writel(struct sdhci_host *host, u32 val, int reg)
338{
339 writel(val, host->ioaddr + reg);
340}
341
342static inline void sdhci_writew(struct sdhci_host *host, u16 val, int reg)
343{
344 writew(val, host->ioaddr + reg);
345}
346
347static inline void sdhci_writeb(struct sdhci_host *host, u8 val, int reg)
348{
349 writeb(val, host->ioaddr + reg);
350}
351
352static inline u32 sdhci_readl(struct sdhci_host *host, int reg)
353{
354 return readl(host->ioaddr + reg);
355}
356
357static inline u16 sdhci_readw(struct sdhci_host *host, int reg)
358{
359 return readw(host->ioaddr + reg);
360}
361
362static inline u8 sdhci_readb(struct sdhci_host *host, int reg)
363{
364 return readb(host->ioaddr + reg);
365}
366
367#endif /* CONFIG_MMC_SDHCI_IO_ACCESSORS */
273 368
274extern struct sdhci_host *sdhci_alloc_host(struct device *dev, 369extern struct sdhci_host *sdhci_alloc_host(struct device *dev,
275 size_t priv_size); 370 size_t priv_size);