1.to support eMMC.

2.Resolve conflicts pin used to wifi-sdio-det.
3.Resolve the clock conflict between sd and sdio.
This commit is contained in:
xbw
2014-03-11 10:01:46 +08:00
parent 3ec8c040a9
commit 7dcb2b4f0a
9 changed files with 42 additions and 22 deletions

View File

@@ -32,6 +32,8 @@
num-slots = <1>;
supports-highspeed;
supports-emmc;
bootpart-no-access;
fifo-depth = <0x80>;
@@ -57,10 +59,11 @@
pinctrl-1 = <&sd0_cd_gpio>; //for int gpio?
clocks = <&clk_gates2 11>;
clock-frequency = <50000000>;
clock-freq-min-max = <200000 50000000>;
clock-freq-min-max = <400000 50000000>;
num-slots = <1>;
supports-highspeed;
supports-sd;
broken-cd;
card-detect-delay = <200>;
pwr-gpios = <&gpio3 GPIO_A1 GPIO_ACTIVE_LOW>; /*pwr_en = GPIO3_A1*/
@@ -94,6 +97,7 @@
num-slots = <1>;
supports-highspeed;
supports-sdio;
fifo-depth = <0x100>;
mmc,caps = <(MMC_CAP_4_BIT_DATA | MMC_CAP_SDIO_IRQ |MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED)>;

View File

@@ -18,3 +18,6 @@ obj-$(CONFIG_IBM_PARTITION) += ibm.o
obj-$(CONFIG_EFI_PARTITION) += efi.o
obj-$(CONFIG_KARMA_PARTITION) += karma.o
obj-$(CONFIG_SYSV68_PARTITION) += sysv68.o
#added for emmc in Rockchip project.
obj-$(CONFIG_MMC_DW_ROCKCHIP) += mtdpart.o

6
block/partitions/check.c Normal file → Executable file
View File

@@ -19,6 +19,7 @@
#include <linux/genhd.h>
#include "check.h"
#include "mtdpart.h"
#include "acorn.h"
#include "amiga.h"
@@ -104,6 +105,11 @@ static int (*check_part[])(struct parsed_partitions *) = {
#ifdef CONFIG_SYSV68_PARTITION
sysv68_partition,
#endif
#if CONFIG_MMC_DW_ROCKCHIP
mtdpart_partition,
#endif
NULL
};

0
drivers/mmc/card/block.c Normal file → Executable file
View File

View File

@@ -349,10 +349,6 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd)
* There are two boot regions of equal size, defined in
* multiples of 128K.
*/
#if 0
//emmc: We do NOT alloc boot partition now. noted by xbw, at 2014-03-09
card->ext_csd.boot_size = 0;
#else
if (ext_csd[EXT_CSD_BOOT_MULT] && mmc_boot_partition_access(card->host)) {
for (idx = 0; idx < MMC_NUM_BOOT_PARTITION; idx++) {
part_size = ext_csd[EXT_CSD_BOOT_MULT] << 17;
@@ -362,7 +358,6 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd)
MMC_BLK_DATA_AREA_BOOT);
}
}
#endif
}
card->ext_csd.raw_hc_erase_gap_size =
@@ -507,12 +502,14 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd)
* RPMB regions are defined in multiples of 128K.
*/
card->ext_csd.raw_rpmb_size_mult = ext_csd[EXT_CSD_RPMB_MULT];
#if 0 //noted by xbw,2014-03-11
if (ext_csd[EXT_CSD_RPMB_MULT] && mmc_host_cmd23(card->host)) {
mmc_part_add(card, ext_csd[EXT_CSD_RPMB_MULT] << 17,
EXT_CSD_PART_CONFIG_ACC_RPMB,
"rpmb", 0, false,
MMC_BLK_DATA_AREA_RPMB);
}
#endif
}
card->ext_csd.raw_erased_mem_count = ext_csd[EXT_CSD_ERASED_MEM_CONT];

View File

@@ -1056,6 +1056,14 @@ static int dw_mci_get_cd(struct mmc_host *mmc)
struct dw_mci_board *brd = slot->host->pdata;
struct dw_mci *host = slot->host;
int gpio_cd = mmc_gpio_get_cd(mmc);
if (mmc->cardtype_restrict & RESTRICT_CARD_TYPE_SDIO){
spin_lock_bh(&host->lock);
set_bit(DW_MMC_CARD_PRESENT, &slot->flags);
spin_unlock_bh(&host->lock);
return 1;
}
/* Use platform get_cd function, else try onboard card detect */
if (brd->quirks & DW_MCI_QUIRK_BROKEN_CARD_DETECTION)
@@ -1458,13 +1466,11 @@ static void dw_mci_tasklet_func(unsigned long priv)
dw_mci_request_end(host, host->mrq);
goto unlock;
printk("%d..%s: ===test===\n", __LINE__, __FUNCTION__);
case STATE_DATA_ERROR:
if (!test_and_clear_bit(EVENT_XFER_COMPLETE,
&host->pending_events))
break;
printk("%d..%s: ===test===\n", __LINE__, __FUNCTION__);
state = STATE_DATA_BUSY;
break;
@@ -2289,6 +2295,14 @@ static int dw_mci_init_slot(struct dw_mci *host, unsigned int id)
printk("%d..%s: fmin=%d, fmax=%d \n", __LINE__,__FUNCTION__,mmc->f_min, mmc->f_max);
}
#endif
if (of_find_property(host->dev->of_node, "supports-sd", NULL))
mmc->cardtype_restrict |= RESTRICT_CARD_TYPE_SD;
if (of_find_property(host->dev->of_node, "supports-sdio", NULL))
mmc->cardtype_restrict |= RESTRICT_CARD_TYPE_SDIO;
if (of_find_property(host->dev->of_node, "supports-emmc", NULL))
mmc->cardtype_restrict |= RESTRICT_CARD_TYPE_EMMC;
if (host->pdata->get_ocr)
mmc->ocr_avail = host->pdata->get_ocr(id);
else
@@ -2528,6 +2542,8 @@ static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host)
if (of_find_property(np, "keep-power-in-suspend", NULL))
pdata->pm_caps |= MMC_PM_KEEP_POWER;
if (of_find_property(np, "enable-sdio-wakeup", NULL))
pdata->pm_caps |= MMC_PM_WAKE_SDIO_IRQ;
@@ -2543,6 +2559,8 @@ static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host)
if (of_get_property(np, "cd-inverted", NULL))
pdata->caps2 |= MMC_CAP2_CD_ACTIVE_HIGH;
if (of_get_property(np, "bootpart-no-access", NULL))
pdata->caps2 |= MMC_CAP2_BOOTPART_NOACC;
return pdata;
}

View File

@@ -196,10 +196,6 @@ struct mmc_supply {
struct regulator *vqmmc; /* Optional Vccq supply */
};
#define HOST_IS_EMMC(host) (host->unused)
#define SDMMC_SUPPORT_EMMC(host) (host->rk_sdmmc_emmc_used)
struct mmc_host {
struct device *parent;
struct device class_dev;
@@ -289,6 +285,11 @@ struct mmc_host {
#define MMC_CAP2_SANITIZE (1 << 15) /* Support Sanitize */
mmc_pm_flag_t pm_caps; /* supported pm features */
u32 cardtype_restrict; /*restrict the SDMMC controller to support card type;1--SD card; 2--sdio; 4--eMMC */
#define RESTRICT_CARD_TYPE_SD (1 << 0) /*noted by XBW, Rockchip Co.Ld*/
#define RESTRICT_CARD_TYPE_SDIO (1 << 1)
#define RESTRICT_CARD_TYPE_EMMC (1 << 2)
#ifdef CONFIG_MMC_CLKGATE
int clk_requests; /* internal reference counter */
@@ -310,8 +311,6 @@ struct mmc_host {
unsigned int max_blk_size; /* maximum size of one mmc block */
unsigned int max_blk_count; /* maximum number of blocks in one req */
unsigned int max_discard_to; /* max. discard timeout in ms */
unsigned short rk_sdmmc_emmc_used; //rk29_sdmmc driver support emmc
int host_dev_id;
/* private data */
spinlock_t lock; /* lock for claim and bus ops */

View File

@@ -418,12 +418,4 @@ struct _mmc_csd {
#define MMC_SWITCH_MODE_CLEAR_BITS 0x02 /* Clear bits which are 1 in value */
#define MMC_SWITCH_MODE_WRITE_BYTE 0x03 /* Set target to value */
#define FOD_FREQ (300000) // in the identify stage, unit: hz, max is 400Khz, // the least frequency is FREQ_HCLK_MAX/8
#define SD_FPP_FREQ (24000000) // normal sd freq, 25Mhz
#define SDHC_FPP_FREQ (49500000) // SDHC in the highspeed. unit is hz, max is 50Mhz.
#define MMC_FPP_FREQ (19000000) // MMC freq, unit is hz, max is 20MHz
#define MMCHS_26_FPP_FREQ (24500000) // highspeed mode support 26M HS-MMC, unit is hz, max is 26Mhz,
#define MMCHS_52_FPP_FREQ (51500000) // highspeed support 52M HS-MMC, unit is hz, max is 52Mhz,
#endif /* LINUX_MMC_MMC_H */

View File

@@ -239,6 +239,7 @@ struct dw_mci_board {
u32 caps; /* Capabilities */
u32 caps2; /* More capabilities */
u32 pm_caps; /* PM capabilities */
u32 cardtype_restrict; /*restrict the SDMMC controller to support card type;1--SD card; 2--sdio; 4--eMMC */
/*
* Override fifo depth. If 0, autodetect it from the FIFOTH register,
* but note that this may not be reliable after a bootloader has used