#include "dw_mmc-pltfm.h"
#include "rk_sdmmc_of.h"
-u32 mmc_debug_level = MMC_DBG_BOOT | MMC_DBG_ERROR;//|MMC_DBG_WARN|MMC_DBG_ALL;
+//u32 mmc_debug_level = MMC_DBG_ALL;
#define NUM_PINS(x) (x + 2)
static void dw_mci_rockchip_set_ios(struct dw_mci *host, struct mmc_ios *ios)
{
- struct dw_mci_rockchip_priv_data *priv = host->priv;
+ //struct dw_mci_rockchip_priv_data *priv = host->priv;
/*
if (ios->timing == MMC_TIMING_UHS_DDR50)
mci_writel(host, CLKSEL, priv->ddr_timing);
static int dw_mci_rockchip_parse_dt(struct dw_mci *host)
{
+/*
struct dw_mci_rockchip_priv_data *priv = host->priv;
struct device_node *np = host->dev->of_node;
u32 timing[2];
u32 div = 0;
int ret;
-/*rk set the timing in CRU
+ //rk set the timing in CRU
of_property_read_u32(np, "samsung,dw-mshc-ciu-div", &div);
priv->ciu_div = div;
#define DW_MCI_RECV_STATUS 2
#define DW_MCI_DMA_THRESHOLD 16
-#define DW_MCI_FREQ_MAX 200000000 /* unit: HZ */
-#define DW_MCI_FREQ_MIN 400000 /* unit: HZ */
+#define DW_MCI_FREQ_MAX 50000000//200000000 /* unit: HZ */
+#define DW_MCI_FREQ_MIN 300000//400000 /* unit: HZ */
#ifdef CONFIG_MMC_DW_IDMAC
struct idmac_desc {
slot->quirks = dw_mci_of_get_slot_quirks(host->dev, slot->id);
mmc->ops = &dw_mci_ops;
+#if 0
+ mmc->f_min = DIV_ROUND_UP(host->bus_hz, 510);
+ mmc->f_max = host->bus_hz;
+printk("%d..%s: fmin=%d, fmax=%d, bus_hz=%d \n", __LINE__,__FUNCTION__,mmc->f_min, mmc->f_max, host->bus_hz);
+#else
if (of_property_read_u32_array(host->dev->of_node,
"clock-freq-min-max", freq, 2)) {
mmc->f_min = DW_MCI_FREQ_MIN;
mmc->f_max = DW_MCI_FREQ_MAX;
+
+ printk("%d..%s: fmin=%d, fmax=%d \n", __LINE__,__FUNCTION__,mmc->f_min, mmc->f_max);
} else {
mmc->f_min = freq[0];
mmc->f_max = freq[1];
+
+ printk("%d..%s: fmin=%d, fmax=%d \n", __LINE__,__FUNCTION__,mmc->f_min, mmc->f_max);
}
-
+#endif
if (host->pdata->get_ocr)
mmc->ocr_avail = host->pdata->get_ocr(id);
else
* Copyright (C) 2009 NXP Semiconductors
* Copyright (C) 2009, 2010 Imagination Technologies Ltd.
*
+ * Copyright (C) 2014 Fuzhou Rockchip Electronics Co.Ltd.
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
+\r
+\r
#include "rk_sdmmc_of.h"\r
\r
+u32 mmc_debug_level;\r
+\r
static void rockchip_mmc_of_dump(struct rk_sdmmc_of *rk_mmc_property)\r
{\r
-printk("%d..%s: =====test 2014-03-04 ====\n", __LINE__, __FUNCTION__);\r
-//dump_stack();\r
-\r
- mmc_debug(MMC_DBG_BOOT,"=========rockchip mmc dts dump info start==============\n");\r
- mmc_debug(MMC_DBG_BOOT,"mmc,caps: 0x%x\n",rk_mmc_property->mmc_caps);\r
- mmc_debug(MMC_DBG_BOOT,"mmc,ocr: 0x%x\n",rk_mmc_property->mmc_ocr);\r
- mmc_debug(MMC_DBG_BOOT,"mmc,int: 0x%x\n",rk_mmc_property->mmc_int_type);\r
- mmc_debug(MMC_DBG_BOOT,"mmc,emmc_is_selected: 0x%x\n",rk_mmc_property->emmc_is_selected);\r
- mmc_debug(MMC_DBG_BOOT,"mmc,use_dma: %d %d\n",rk_mmc_property->mmc_dma_is_used[0],\r
- rk_mmc_property->mmc_dma_is_used[1]);\r
- mmc_debug(MMC_DBG_BOOT,"mmc,dma_ch: %d\n",rk_mmc_property->mmc_dma_chn);\r
- mmc_debug(MMC_DBG_BOOT,"=========rockchip mmc dts dump info end================\n");\r
- /*\r
- printk("=========rockchip mmc dts dump info start==============\n");\r
- printk("mmc,caps: 0x%x\n",rk_mmc_property->mmc_caps);\r
- printk("mmc,ocr: 0x%x\n",rk_mmc_property->mmc_ocr);\r
- printk("mmc,int: 0x%x\n",rk_mmc_property->mmc_int_type);\r
- printk("mmc,emmc_is_selected: 0x%x\n",rk_mmc_property->emmc_is_selected);\r
- printk("mmc,use_dma: %d %d\n",rk_mmc_property->mmc_dma_is_used[0],\r
+\r
+printk("%d..%s: ===test ==\n", __LINE__, __FUNCTION__);\r
+ MMC_DBG_BOOT_FUNC("=========rockchip mmc dts dump info start== 2014-03-05 16:08 ======\n");\r
+ MMC_DBG_BOOT_FUNC("mmc,caps: 0x%x\n",rk_mmc_property->mmc_caps);\r
+ MMC_DBG_BOOT_FUNC("mmc,ocr: 0x%x\n",rk_mmc_property->mmc_ocr);\r
+ MMC_DBG_BOOT_FUNC("mmc,int: 0x%x\n",rk_mmc_property->mmc_int_type);\r
+ MMC_DBG_BOOT_FUNC("mmc,emmc_is_selected: 0x%x\n",rk_mmc_property->emmc_is_selected);\r
+ MMC_DBG_BOOT_FUNC("mmc,use_dma: %d %d\n",rk_mmc_property->mmc_dma_is_used[0],\r
rk_mmc_property->mmc_dma_is_used[1]);\r
- printk("mmc,dma_ch: %d\n",rk_mmc_property->mmc_dma_chn);\r
- printk("=========rockchip mmc dts dump info end================\n");\r
-*/ \r
+ MMC_DBG_BOOT_FUNC("mmc,dma_ch: %d\n",rk_mmc_property->mmc_dma_chn);\r
+ MMC_DBG_BOOT_FUNC("=========rockchip mmc dts dump info end================\n");\r
}\r
\r
\r
of_property_read_u32(np, "mmc,dma_ch", &rk_mmc_property->mmc_dma_chn);\r
\r
}else{\r
- mmc_debug(MMC_DBG_WARN,"Device Tree configure mmc drivers to use pio!\n");\r
+ MMC_DBG_WARN_FUNC("Device Tree configure mmc drivers to use pio!\n");\r
}\r
rockchip_mmc_of_dump(rk_mmc_property);\r
return ;\r
\r
enum MMC_DBG_MASK{\r
MMC_DBG_NONE = 0,\r
- MMC_DBG_BOOT = BIT(0),\r
- MMC_DBG_INFO = BIT(1),\r
- MMC_DBG_ERROR= BIT(2), \r
- MMC_DBG_WARN = BIT(3),\r
+ MMC_DBG_BOOT = BIT(0), \r
+ MMC_DBG_ERROR= BIT(1), \r
+ MMC_DBG_WARN = BIT(2),\r
+ MMC_DBG_INFO = BIT(3),\r
MMC_DBG_CMD = BIT(4),\r
+ MMC_DBG_DBG = BIT(5),\r
MMC_DBG_ALL = ~0,\r
\r
};\r
+//extern u32 mmc_debug_level = MMC_DBG_ALL;\r
\r
-extern u32 mmc_debug_level ;//= MMC_DBG_BOOT | MMC_DBG_ERROR;/* | MMC_DBG_CMD | ...*/\r
-\r
-#define mmc_error(fmt, arg...) \\r
- pr_err(DRIVER_PREFIX "ERROR " fmt "\n", ##arg)\r
-#define mmc_warning(fmt, arg...) \\r
- pr_warning(DRIVER_PREFIX "WARNING " fmt "\n", ##arg)\r
- \r
-#define mmc_cmd(fmt, arg...) \\r
- pr_info(DRIVER_PREFIX "CMD" fmt "\n", ##arg)\r
+#define MMC_DBG_BOOT_FUNC(fmt, arg...) \\r
+ if(mmc_debug_level >= MMC_DBG_BOOT){ printk(DRIVER_PREFIX "BOOT " fmt "\n", ##arg);}\r
+#define MMC_DBG_ERR_FUNC(fmt, arg...) \\r
+ if(mmc_debug_level >= MMC_DBG_ERROR){ printk(DRIVER_PREFIX "ERROR " fmt "\n", ##arg);}\r
+#define MMC_DBG_WARN_FUNC(fmt, arg...) \\r
+ if(mmc_debug_level >= MMC_DBG_WARN){ printk(DRIVER_PREFIX "WARNING " fmt "\n", ##arg);} \r
+#define MMC_DBG_INFO_FUNC(fmt, arg...) \\r
+ if(mmc_debug_level >= MMC_DBG_INFO){ printk(DRIVER_PREFIX fmt "\n", ##arg);} \r
+#define MMC_DBG_CMD_FUNC(fmt, arg...) \\r
+ if(mmc_debug_level >= MMC_DBG_CMD){ printk(DRIVER_PREFIX "CMD" fmt "\n", ##arg);}\r
\r
-#define mmc_info(fmt, arg...) \\r
- pr_info(DRIVER_PREFIX fmt "\n", ##arg)\r
+\r
\r
#if defined(CONFIG_DYNAMIC_DEBUG)\r
- #define mmc_debug(level, fmt, arg...) \\r
+ #define MMC_DBG_DEBUG_FUNC(level, fmt, arg...) \\r
do { \\r
if (unlikely(level & mmc_debug_level)) \\r
dynamic_pr_debug(DRIVER_PREFIX fmt "\n", ##arg); \\r
} while (0)\r
#else\r
- #define mmc_debug(level, fmt, arg...) \\r
+ #define MMC_DBG_DEBUG_FUNC(level, fmt, arg...) \\r
do { \\r
if (unlikely(level & mmc_debug_level)) \\r
- printk(KERN_DEBUG pr_fmt(DRIVER_PREFIX fmt "\n"), \\r
- ##arg); \\r
+ if(mmc_debug_level >= MMC_DBG_DBG){ printk(DRIVER_PREFIX fmt "\n"), ##arg);} \\r
} while (0)\r
#endif\r
\r