mmc: mmci: add datactrl block size variant property
[platform/kernel/linux-rpi.git] / drivers / mmc / host / mmci.h
index 21aaf9a..d5979e8 100644 (file)
@@ -217,6 +217,7 @@ struct mmci_host;
  * @blksz_datactrl4: true if Block size is at b4..b16 position in datactrl
  *                  register
  * @datactrl_mask_sdio: SDIO enable mask in datactrl register
+ * @datactrl_blksz: block size in power of two
  * @pwrreg_powerup: power up value for MMCIPOWER register
  * @f_max: maximum clk frequency supported by the controller.
  * @signal_direction: input/out direction of bus signals can be indicated
@@ -248,24 +249,25 @@ struct variant_data {
        unsigned int            data_cmd_enable;
        unsigned int            datactrl_mask_ddrmode;
        unsigned int            datactrl_mask_sdio;
-       bool                    st_sdio;
-       bool                    st_clkdiv;
-       bool                    blksz_datactrl16;
-       bool                    blksz_datactrl4;
+       unsigned int            datactrl_blocksz;
+       u8                      st_sdio:1;
+       u8                      st_clkdiv:1;
+       u8                      blksz_datactrl16:1;
+       u8                      blksz_datactrl4:1;
        u32                     pwrreg_powerup;
        u32                     f_max;
-       bool                    signal_direction;
-       bool                    pwrreg_clkgate;
-       bool                    busy_detect;
+       u8                      signal_direction:1;
+       u8                      pwrreg_clkgate:1;
+       u8                      busy_detect:1;
        u32                     busy_dpsm_flag;
        u32                     busy_detect_flag;
        u32                     busy_detect_mask;
-       bool                    pwrreg_nopower;
-       bool                    explicit_mclk_control;
-       bool                    qcom_fifo;
-       bool                    qcom_dml;
-       bool                    reversed_irq_handling;
-       bool                    mmcimask1;
+       u8                      pwrreg_nopower:1;
+       u8                      explicit_mclk_control:1;
+       u8                      qcom_fifo:1;
+       u8                      qcom_dml:1;
+       u8                      reversed_irq_handling:1;
+       u8                      mmcimask1:1;
        u32                     start_err;
        u32                     opendrain;
        void (*init)(struct mmci_host *host);
@@ -273,13 +275,19 @@ struct variant_data {
 
 /* mmci variant callbacks */
 struct mmci_host_ops {
-       void (*dma_setup)(struct mmci_host *host);
-};
-
-struct mmci_host_next {
-       struct dma_async_tx_descriptor  *dma_desc;
-       struct dma_chan                 *dma_chan;
-       s32                             cookie;
+       int (*validate_data)(struct mmci_host *host, struct mmc_data *data);
+       int (*prep_data)(struct mmci_host *host, struct mmc_data *data,
+                        bool next);
+       void (*unprep_data)(struct mmci_host *host, struct mmc_data *data,
+                           int err);
+       void (*get_next_data)(struct mmci_host *host, struct mmc_data *data);
+       int (*dma_setup)(struct mmci_host *host);
+       void (*dma_release)(struct mmci_host *host);
+       int (*dma_start)(struct mmci_host *host, unsigned int *datactrl);
+       void (*dma_finalize)(struct mmci_host *host, struct mmc_data *data);
+       void (*dma_error)(struct mmci_host *host);
+       void (*set_clkreg)(struct mmci_host *host, unsigned int desired);
+       void (*set_pwrreg)(struct mmci_host *host, unsigned int pwr);
 };
 
 struct mmci_host {
@@ -290,7 +298,7 @@ struct mmci_host {
        struct mmc_data         *data;
        struct mmc_host         *mmc;
        struct clk              *clk;
-       bool                    singleirq;
+       u8                      singleirq:1;
 
        spinlock_t              lock;
 
@@ -304,7 +312,7 @@ struct mmci_host {
        u32                     datactrl_reg;
        u32                     busy_status;
        u32                     mask1_reg;
-       bool                    vqmmc_enabled;
+       u8                      vqmmc_enabled:1;
        struct mmci_platform_data *plat;
        struct mmci_host_ops    *ops;
        struct variant_data     *variant;
@@ -323,16 +331,25 @@ struct mmci_host {
        unsigned int            size;
        int (*get_rx_fifocnt)(struct mmci_host *h, u32 status, int remain);
 
-#ifdef CONFIG_DMA_ENGINE
-       /* DMA stuff */
-       struct dma_chan         *dma_current;
-       struct dma_chan         *dma_rx_channel;
-       struct dma_chan         *dma_tx_channel;
-       struct dma_async_tx_descriptor  *dma_desc_current;
-       struct mmci_host_next   next_data;
-       bool                    dma_in_progress;
+       u8                      use_dma:1;
+       u8                      dma_in_progress:1;
+       void                    *dma_priv;
 
-#define dma_inprogress(host)   ((host)->dma_in_progress)
-#endif
+       s32                     next_cookie;
 };
 
+#define dma_inprogress(host)   ((host)->dma_in_progress)
+
+void mmci_write_clkreg(struct mmci_host *host, u32 clk);
+void mmci_write_pwrreg(struct mmci_host *host, u32 pwr);
+
+int mmci_dmae_prep_data(struct mmci_host *host, struct mmc_data *data,
+                       bool next);
+void mmci_dmae_unprep_data(struct mmci_host *host, struct mmc_data *data,
+                          int err);
+void mmci_dmae_get_next_data(struct mmci_host *host, struct mmc_data *data);
+int mmci_dmae_setup(struct mmci_host *host);
+void mmci_dmae_release(struct mmci_host *host);
+int mmci_dmae_start(struct mmci_host *host, unsigned int *datactrl);
+void mmci_dmae_finalize(struct mmci_host *host, struct mmc_data *data);
+void mmci_dmae_error(struct mmci_host *host);