]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/mmc/host/tmio_mmc.h
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
[mv-sheeva.git] / drivers / mmc / host / tmio_mmc.h
index 9c831ab2ece6d37af2bbfadce6311b85bc011c22..9fa9985949743be7920eccb0a1627036ea8dcc37 100644 (file)
                TMIO_STAT_CARD_REMOVE | TMIO_STAT_CARD_INSERT)
 #define TMIO_MASK_IRQ     (TMIO_MASK_READOP | TMIO_MASK_WRITEOP | TMIO_MASK_CMD)
 
-#define enable_mmc_irqs(ctl, i) \
+
+#define enable_mmc_irqs(host, i) \
        do { \
                u32 mask;\
-               mask  = tmio_ioread32((ctl) + CTL_IRQ_MASK); \
+               mask  = sd_ctrl_read32((host), CTL_IRQ_MASK); \
                mask &= ~((i) & TMIO_MASK_IRQ); \
-               tmio_iowrite32(mask, (ctl) + CTL_IRQ_MASK); \
+               sd_ctrl_write32((host), CTL_IRQ_MASK, mask); \
        } while (0)
 
-#define disable_mmc_irqs(ctl, i) \
+#define disable_mmc_irqs(host, i) \
        do { \
                u32 mask;\
-               mask  = tmio_ioread32((ctl) + CTL_IRQ_MASK); \
+               mask  = sd_ctrl_read32((host), CTL_IRQ_MASK); \
                mask |= ((i) & TMIO_MASK_IRQ); \
-               tmio_iowrite32(mask, (ctl) + CTL_IRQ_MASK); \
+               sd_ctrl_write32((host), CTL_IRQ_MASK, mask); \
        } while (0)
 
-#define ack_mmc_irqs(ctl, i) \
+#define ack_mmc_irqs(host, i) \
        do { \
                u32 mask;\
-               mask  = tmio_ioread32((ctl) + CTL_STATUS); \
+               mask  = sd_ctrl_read32((host), CTL_STATUS); \
                mask &= ~((i) & TMIO_MASK_IRQ); \
-               tmio_iowrite32(mask, (ctl) + CTL_STATUS); \
+               sd_ctrl_write32((host), CTL_STATUS, mask); \
        } while (0)
 
 
 struct tmio_mmc_host {
        void __iomem *cnf;
        void __iomem *ctl;
+       unsigned long bus_shift;
        struct mmc_command      *cmd;
        struct mmc_request      *mrq;
        struct mmc_data         *data;
@@ -123,6 +125,63 @@ struct tmio_mmc_host {
        unsigned int            sg_off;
 };
 
+#include <linux/io.h>
+
+static inline u16 sd_ctrl_read16(struct tmio_mmc_host *host, int addr)
+{
+       return readw(host->ctl + (addr << host->bus_shift));
+}
+
+static inline void sd_ctrl_read16_rep(struct tmio_mmc_host *host, int addr,
+               u16 *buf, int count)
+{
+       readsw(host->ctl + (addr << host->bus_shift), buf, count);
+}
+
+static inline u32 sd_ctrl_read32(struct tmio_mmc_host *host, int addr)
+{
+       return readw(host->ctl + (addr << host->bus_shift)) |
+              readw(host->ctl + ((addr + 2) << host->bus_shift)) << 16;
+}
+
+static inline void sd_ctrl_write16(struct tmio_mmc_host *host, int addr,
+               u16 val)
+{
+       writew(val, host->ctl + (addr << host->bus_shift));
+}
+
+static inline void sd_ctrl_write16_rep(struct tmio_mmc_host *host, int addr,
+               u16 *buf, int count)
+{
+       writesw(host->ctl + (addr << host->bus_shift), buf, count);
+}
+
+static inline void sd_ctrl_write32(struct tmio_mmc_host *host, int addr,
+               u32 val)
+{
+       writew(val, host->ctl + (addr << host->bus_shift));
+       writew(val >> 16, host->ctl + ((addr + 2) << host->bus_shift));
+}
+
+static inline void sd_config_write8(struct tmio_mmc_host *host, int addr,
+               u8 val)
+{
+       writeb(val, host->cnf + (addr << host->bus_shift));
+}
+
+static inline void sd_config_write16(struct tmio_mmc_host *host, int addr,
+               u16 val)
+{
+       writew(val, host->cnf + (addr << host->bus_shift));
+}
+
+static inline void sd_config_write32(struct tmio_mmc_host *host, int addr,
+               u32 val)
+{
+       writew(val, host->cnf + (addr << host->bus_shift));
+       writew(val >> 16, host->cnf + ((addr + 2) << host->bus_shift));
+}
+
 #include <linux/scatterlist.h>
 #include <linux/blkdev.h>