#include <linux/of_gpio.h>
#include <linux/slab.h>
#include <linux/rockchip/cpu.h>
+#include <linux/rockchip/cru.h>
#include "rk_sdmmc.h"
#include "dw_mmc-pltfm.h"
* sdmmc,sdio0,sdio1,emmc id=0~3
* cclk_in_drv, cclk_in_sample i=0,1
*/
-#define CRU_SDMMC_CON(id, tuning_type) (0x200 + ((id) * 8) + ((tuning_type) * 4))
+
+static u32 cru_tuning_base = 0;
+
+#define CRU_SDMMC_CON(id, tuning_type) (cru_tuning_base + ((id) * 8) + ((tuning_type) * 4))
#define MAX_DELAY_LINE (0xff)
#define FREQ_REF_150MHZ (150000000)
enum dw_mci_rockchip_type {
DW_MCI_TYPE_RK3188,
DW_MCI_TYPE_RK3288,
+ DW_MCI_TYPE_RK3036,
};
/* Rockchip implementation specific driver private data */
},{
.compatible = "rockchip,rk32xx-sdmmc",
.ctrl_type = DW_MCI_TYPE_RK3288,
+ },{
+ .compatible = "rockchip,rk3036-sdmmc",
+ .ctrl_type = DW_MCI_TYPE_RK3036,
},
};
return val;
}
+static void dw_mci_rockchip_load_tuning_base(void)
+{
+ if(cpu_is_rk3288())
+ cru_tuning_base = RK3288_CRU_SDMMC_CON0;
-
-
+ /* Fixme: 3036
+ else if(cpu_is_rk3036())
+ cru_tuning_base = RK3036_CRU_SDMMC_CON0;
+ */
+}
static int inline __dw_mci_rockchip_execute_tuning(struct dw_mci_slot *slot, u32 opcode,
u8 *blk_test, unsigned int blksz)
int ref = 0;
unsigned int blksz = tuning_data->blksz;
- MMC_DBG_INFO_FUNC(host->mmc,"execute tuning: [%s]", mmc_hostname(host->mmc));
+ MMC_DBG_INFO_FUNC(host->mmc,"execute tuning: [%s]", mmc_hostname(host->mmc));
+
+ dw_mci_rockchip_load_tuning_base();
blk_test = kmalloc(blksz, GFP_KERNEL);
if (!blk_test)
So we take average --- 60ps, (1.66ns/ 2) = 0.83(middle-value),TAKE 0.9
0.9 / 60ps = 15 delayline
*/
- if(cpu_is_rk3288()){
+ if(cpu_is_rk3288()){
+ /*
+ Fixme: 3036: dose it compatitable?
+ */
ref = ((FREQ_REF_150MHZ + host->bus_hz - 1) / host->bus_hz);
step = (15 * ref);
#include <linux/regulator/rockchip_io_vol_domain.h>
#include "../../clk/rockchip/clk-ops.h"
+/*
+ Fixme: 3036: RK_GRF_VIRT compatitable?
+*/
#define grf_writel(v, offset) do { writel_relaxed(v, RK_GRF_VIRT + offset); dsb(); } while (0)
#define RK_SDMMC_DRIVER_VERSION "Ver 1.11 2014-06-05"
IO_DOMAIN_33 = 3300,
};
static void dw_mci_do_grf_io_domain_switch(struct dw_mci *host, u32 voltage)
-{
+{
+ /*
+ Fixme: 3036: RK3288_GRF_IO_VSEL compatitable?
+ */
+
if(cpu_is_rk3288()){
if(voltage == IO_DOMAIN_33)
voltage = 0;
printk("%s: Warning : Default pinctrl setting failed!\n", mmc_hostname(host->mmc));
host->mmc->rescan_disable = 0;
if(cpu_is_rk3288()) {
+ /*
+ Fixme: 3036: RK3288_GRF_SOC_CON0 compatitable?
+ */
grf_writel(((1<<12)<<16)|(0<<12), RK3288_GRF_SOC_CON0);//disable jtag
}
}