diff options
Diffstat (limited to 'drivers/mmc/host/atmel-mci.c')
-rw-r--r-- | drivers/mmc/host/atmel-mci.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c index 14ab28da7fa8..8170905a0401 100644 --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c | |||
@@ -508,9 +508,10 @@ static void atmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
508 | { | 508 | { |
509 | struct atmel_mci *host = mmc_priv(mmc); | 509 | struct atmel_mci *host = mmc_priv(mmc); |
510 | 510 | ||
511 | host->sdc_reg &= ~MCI_SDCBUS_MASK; | ||
511 | switch (ios->bus_width) { | 512 | switch (ios->bus_width) { |
512 | case MMC_BUS_WIDTH_1: | 513 | case MMC_BUS_WIDTH_1: |
513 | host->sdc_reg = 0; | 514 | host->sdc_reg |= MCI_SDCBUS_1BIT; |
514 | break; | 515 | break; |
515 | case MMC_BUS_WIDTH_4: | 516 | case MMC_BUS_WIDTH_4: |
516 | host->sdc_reg = MCI_SDCBUS_4BIT; | 517 | host->sdc_reg = MCI_SDCBUS_4BIT; |
@@ -1014,9 +1015,11 @@ static irqreturn_t atmci_detect_interrupt(int irq, void *dev_id) | |||
1014 | static int __init atmci_probe(struct platform_device *pdev) | 1015 | static int __init atmci_probe(struct platform_device *pdev) |
1015 | { | 1016 | { |
1016 | struct mci_platform_data *pdata; | 1017 | struct mci_platform_data *pdata; |
1018 | struct mci_slot_pdata *slot; | ||
1017 | struct atmel_mci *host; | 1019 | struct atmel_mci *host; |
1018 | struct mmc_host *mmc; | 1020 | struct mmc_host *mmc; |
1019 | struct resource *regs; | 1021 | struct resource *regs; |
1022 | u32 sdc_reg; | ||
1020 | int irq; | 1023 | int irq; |
1021 | int ret; | 1024 | int ret; |
1022 | 1025 | ||
@@ -1030,6 +1033,17 @@ static int __init atmci_probe(struct platform_device *pdev) | |||
1030 | if (irq < 0) | 1033 | if (irq < 0) |
1031 | return irq; | 1034 | return irq; |
1032 | 1035 | ||
1036 | /* TODO: Allow using several slots at once */ | ||
1037 | if (pdata->slot[0].bus_width) { | ||
1038 | sdc_reg = MCI_SDCSEL_SLOT_A; | ||
1039 | slot = &pdata->slot[0]; | ||
1040 | } else if (pdata->slot[1].bus_width) { | ||
1041 | sdc_reg = MCI_SDCSEL_SLOT_B; | ||
1042 | slot = &pdata->slot[1]; | ||
1043 | } else { | ||
1044 | return -EINVAL; | ||
1045 | } | ||
1046 | |||
1033 | mmc = mmc_alloc_host(sizeof(struct atmel_mci), &pdev->dev); | 1047 | mmc = mmc_alloc_host(sizeof(struct atmel_mci), &pdev->dev); |
1034 | if (!mmc) | 1048 | if (!mmc) |
1035 | return -ENOMEM; | 1049 | return -ENOMEM; |
@@ -1037,8 +1051,9 @@ static int __init atmci_probe(struct platform_device *pdev) | |||
1037 | host = mmc_priv(mmc); | 1051 | host = mmc_priv(mmc); |
1038 | host->pdev = pdev; | 1052 | host->pdev = pdev; |
1039 | host->mmc = mmc; | 1053 | host->mmc = mmc; |
1040 | host->detect_pin = pdata->detect_pin; | 1054 | host->detect_pin = slot->detect_pin; |
1041 | host->wp_pin = pdata->wp_pin; | 1055 | host->wp_pin = slot->wp_pin; |
1056 | host->sdc_reg = sdc_reg; | ||
1042 | 1057 | ||
1043 | host->mck = clk_get(&pdev->dev, "mci_clk"); | 1058 | host->mck = clk_get(&pdev->dev, "mci_clk"); |
1044 | if (IS_ERR(host->mck)) { | 1059 | if (IS_ERR(host->mck)) { |
@@ -1062,7 +1077,8 @@ static int __init atmci_probe(struct platform_device *pdev) | |||
1062 | mmc->f_min = (host->bus_hz + 511) / 512; | 1077 | mmc->f_min = (host->bus_hz + 511) / 512; |
1063 | mmc->f_max = host->bus_hz / 2; | 1078 | mmc->f_max = host->bus_hz / 2; |
1064 | mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; | 1079 | mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; |
1065 | mmc->caps |= MMC_CAP_4_BIT_DATA; | 1080 | if (slot->bus_width >= 4) |
1081 | mmc->caps |= MMC_CAP_4_BIT_DATA; | ||
1066 | 1082 | ||
1067 | mmc->max_hw_segs = 64; | 1083 | mmc->max_hw_segs = 64; |
1068 | mmc->max_phys_segs = 64; | 1084 | mmc->max_phys_segs = 64; |