Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e8cc37b8 authored by Shawn Lin's avatar Shawn Lin Committed by Ulf Hansson
Browse files

mmc: dw_mmc: remove DW_MCI_QUIRK_BROKEN_CARD_DETECTION quirk



dw_mmc already use mmc_of_parse to get "broken-cd" property,
but it considered "broken-cd" to be a quirk in its driver. We
don't need this quirk here, and just take what we need from
mmc->caps.

Signed-off-by: default avatarShawn Lin <shawn.lin@rock-chips.com>
Tested-by: default avatarJaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: default avatarJaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent 13c3d474
Loading
Loading
Loading
Loading
+10 −25
Original line number Original line Diff line number Diff line
@@ -1447,12 +1447,11 @@ static int dw_mci_get_cd(struct mmc_host *mmc)
{
{
	int present;
	int present;
	struct dw_mci_slot *slot = mmc_priv(mmc);
	struct dw_mci_slot *slot = mmc_priv(mmc);
	struct dw_mci_board *brd = slot->host->pdata;
	struct dw_mci *host = slot->host;
	struct dw_mci *host = slot->host;
	int gpio_cd = mmc_gpio_get_cd(mmc);
	int gpio_cd = mmc_gpio_get_cd(mmc);


	/* Use platform get_cd function, else try onboard card detect */
	/* Use platform get_cd function, else try onboard card detect */
	if ((brd->quirks & DW_MCI_QUIRK_BROKEN_CARD_DETECTION) ||
	if ((mmc->caps & MMC_CAP_NEEDS_POLL) ||
	    (mmc->caps & MMC_CAP_NONREMOVABLE))
	    (mmc->caps & MMC_CAP_NONREMOVABLE))
		present = 1;
		present = 1;
	else if (!IS_ERR_VALUE(gpio_cd))
	else if (!IS_ERR_VALUE(gpio_cd))
@@ -2866,23 +2865,13 @@ static void dw_mci_dto_timer(unsigned long arg)
}
}


#ifdef CONFIG_OF
#ifdef CONFIG_OF
static struct dw_mci_of_quirks {
	char *quirk;
	int id;
} of_quirks[] = {
	{
		.quirk	= "broken-cd",
		.id	= DW_MCI_QUIRK_BROKEN_CARD_DETECTION,
	},
};

static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host)
static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host)
{
{
	struct dw_mci_board *pdata;
	struct dw_mci_board *pdata;
	struct device *dev = host->dev;
	struct device *dev = host->dev;
	struct device_node *np = dev->of_node;
	struct device_node *np = dev->of_node;
	const struct dw_mci_drv_data *drv_data = host->drv_data;
	const struct dw_mci_drv_data *drv_data = host->drv_data;
	int idx, ret;
	int ret;
	u32 clock_frequency;
	u32 clock_frequency;


	pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
	pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
@@ -2897,11 +2886,6 @@ static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host)
		pdata->num_slots = 1;
		pdata->num_slots = 1;
	}
	}


	/* get quirks */
	for (idx = 0; idx < ARRAY_SIZE(of_quirks); idx++)
		if (of_get_property(np, of_quirks[idx].quirk, NULL))
			pdata->quirks |= of_quirks[idx].id;

	if (of_property_read_u32(np, "fifo-depth", &pdata->fifo_depth))
	if (of_property_read_u32(np, "fifo-depth", &pdata->fifo_depth))
		dev_info(dev,
		dev_info(dev,
			 "fifo-depth property not found, using value of FIFOTH register as default\n");
			 "fifo-depth property not found, using value of FIFOTH register as default\n");
@@ -2934,18 +2918,19 @@ static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host)


static void dw_mci_enable_cd(struct dw_mci *host)
static void dw_mci_enable_cd(struct dw_mci *host)
{
{
	struct dw_mci_board *brd = host->pdata;
	unsigned long irqflags;
	unsigned long irqflags;
	u32 temp;
	u32 temp;
	int i;
	int i;
	struct dw_mci_slot *slot;


	/* No need for CD if broken card detection */
	/*
	if (brd->quirks & DW_MCI_QUIRK_BROKEN_CARD_DETECTION)
	 * No need for CD if all slots have a non-error GPIO
		return;
	 * as well as broken card detection is found.

	 */
	/* No need for CD if all slots have a non-error GPIO */
	for (i = 0; i < host->num_slots; i++) {
	for (i = 0; i < host->num_slots; i++) {
		struct dw_mci_slot *slot = host->slot[i];
		slot = host->slot[i];
		if (slot->mmc->caps & MMC_CAP_NEEDS_POLL)
			return;


		if (IS_ERR_VALUE(mmc_gpio_get_cd(slot->mmc)))
		if (IS_ERR_VALUE(mmc_gpio_get_cd(slot->mmc)))
			break;
			break;
+1 −3
Original line number Original line Diff line number Diff line
@@ -235,10 +235,8 @@ struct dw_mci_dma_ops {
};
};


/* IP Quirks/flags. */
/* IP Quirks/flags. */
/* Unreliable card detection */
#define DW_MCI_QUIRK_BROKEN_CARD_DETECTION	BIT(0)
/* Timer for broken data transfer over scheme */
/* Timer for broken data transfer over scheme */
#define DW_MCI_QUIRK_BROKEN_DTO			BIT(1)
#define DW_MCI_QUIRK_BROKEN_DTO			BIT(0)


struct dma_pdata;
struct dma_pdata;