9
0
Fork 0

mci: rename capabilities flags

Use MMC_CAP_ names instead of MMC_MODE_. This makes it more
clear that these are capabilities of host/card and do not refer
to the current mode. These are in line with the Linux Kernel
except for MMC_CAP_MMC_HIGHSPEED_52MHZ which could be fixed
later.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2013-06-03 10:59:35 +02:00
parent 56bd91c9a1
commit 2302fc6076
19 changed files with 41 additions and 38 deletions

View File

@ -69,13 +69,13 @@ static iomux_v3_cfg_t ccxmx51js_pads[] = {
static struct esdhc_platform_data sdhc1_pdata = { static struct esdhc_platform_data sdhc1_pdata = {
.cd_type = ESDHC_CD_NONE, .cd_type = ESDHC_CD_NONE,
.wp_type = ESDHC_WP_NONE, .wp_type = ESDHC_WP_NONE,
.caps = MMC_MODE_4BIT, .caps = MMC_CAP_4_BIT_DATA,
}; };
static struct esdhc_platform_data sdhc3_pdata = { static struct esdhc_platform_data sdhc3_pdata = {
.cd_type = ESDHC_CD_NONE, .cd_type = ESDHC_CD_NONE,
.wp_type = ESDHC_WP_NONE, .wp_type = ESDHC_WP_NONE,
.caps = MMC_MODE_4BIT | MMC_MODE_8BIT, .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
}; };
static struct imxusb_platformdata ccxmx51js_usbhost1_pdata = { static struct imxusb_platformdata ccxmx51js_usbhost1_pdata = {

View File

@ -32,7 +32,7 @@
#include <mach/usb.h> #include <mach/usb.h>
static struct mxs_mci_platform_data mci_pdata = { static struct mxs_mci_platform_data mci_pdata = {
.caps = MMC_MODE_4BIT | MMC_MODE_HS | MMC_MODE_HS_52MHz, .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED,
.voltages = MMC_VDD_32_33 | MMC_VDD_33_34, /* fixed to 3.3 V */ .voltages = MMC_VDD_32_33 | MMC_VDD_33_34, /* fixed to 3.3 V */
}; };

View File

@ -72,7 +72,7 @@ static const uint32_t cfa10036_pads[] = {
}; };
static struct mxs_mci_platform_data mci_pdata = { static struct mxs_mci_platform_data mci_pdata = {
.caps = MMC_MODE_8BIT, .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
.voltages = MMC_VDD_32_33 | MMC_VDD_33_34, /* fixed to 3.3 V */ .voltages = MMC_VDD_32_33 | MMC_VDD_33_34, /* fixed to 3.3 V */
.f_min = 400 * 1000, .f_min = 400 * 1000,
.f_max = 25000000, .f_max = 25000000,

View File

@ -312,7 +312,7 @@ static const struct spi_board_info realq7_spi_board_info[] = {
static struct esdhc_platform_data realq7_emmc_data = { static struct esdhc_platform_data realq7_emmc_data = {
.cd_type = ESDHC_CD_PERMANENT, .cd_type = ESDHC_CD_PERMANENT,
.caps = MMC_MODE_8BIT, .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
.devname = "emmc", .devname = "emmc",
}; };

View File

@ -28,7 +28,7 @@
#include <mach/usb.h> #include <mach/usb.h>
static struct mxs_mci_platform_data mci_pdata = { static struct mxs_mci_platform_data mci_pdata = {
.caps = MMC_MODE_4BIT | MMC_MODE_HS | MMC_MODE_HS_52MHz, .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED,
.voltages = MMC_VDD_32_33 | MMC_VDD_33_34, /* fixed to 3.3 V */ .voltages = MMC_VDD_32_33 | MMC_VDD_33_34, /* fixed to 3.3 V */
.f_min = 400000, .f_min = 400000,
}; };

View File

@ -136,7 +136,7 @@ static const uint32_t mx28evk_pads[] = {
}; };
static struct mxs_mci_platform_data mci_pdata = { static struct mxs_mci_platform_data mci_pdata = {
.caps = MMC_MODE_8BIT, .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
.voltages = MMC_VDD_32_33 | MMC_VDD_33_34, /* fixed to 3.3 V */ .voltages = MMC_VDD_32_33 | MMC_VDD_33_34, /* fixed to 3.3 V */
.f_min = 400 * 1000, .f_min = 400 * 1000,
.f_max = 25000000, .f_max = 25000000,

View File

@ -62,7 +62,7 @@ static struct dm9000_platform_data dm9000_data = {
}; };
static struct s3c_mci_platform_data mci_data = { static struct s3c_mci_platform_data mci_data = {
.caps = MMC_MODE_4BIT | MMC_MODE_HS | MMC_MODE_HS_52MHz, .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED,
.voltages = MMC_VDD_32_33 | MMC_VDD_33_34, .voltages = MMC_VDD_32_33 | MMC_VDD_33_34,
.gpio_detect = 232, /* GPG8_GPIO */ .gpio_detect = 232, /* GPG8_GPIO */
.detect_invert = 0, .detect_invert = 0,

View File

@ -37,7 +37,7 @@
#include <mach/mci.h> #include <mach/mci.h>
static struct mxs_mci_platform_data mci_pdata = { static struct mxs_mci_platform_data mci_pdata = {
.caps = MMC_MODE_4BIT | MMC_MODE_HS | MMC_MODE_HS_52MHz, .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED,
.voltages = MMC_VDD_32_33 | MMC_VDD_33_34, /* fixed to 3.3 V */ .voltages = MMC_VDD_32_33 | MMC_VDD_33_34, /* fixed to 3.3 V */
.f_min = 400000, .f_min = 400000,
}; };

View File

@ -30,7 +30,7 @@
#include <mach/ocotp.h> #include <mach/ocotp.h>
static struct mxs_mci_platform_data mci_pdata = { static struct mxs_mci_platform_data mci_pdata = {
.caps = MMC_MODE_4BIT, .caps = MMC_CAP_4_BIT_DATA,
.voltages = MMC_VDD_32_33 | MMC_VDD_33_34, /* fixed to 3.3 V */ .voltages = MMC_VDD_32_33 | MMC_VDD_33_34, /* fixed to 3.3 V */
.f_min = 400 * 1000, .f_min = 400 * 1000,
.f_max = 25000000, .f_max = 25000000,

View File

@ -220,7 +220,7 @@ static struct esdhc_platform_data tqma53_sd2_data = {
static struct esdhc_platform_data tqma53_sd3_data = { static struct esdhc_platform_data tqma53_sd3_data = {
.cd_type = ESDHC_CD_PERMANENT, .cd_type = ESDHC_CD_PERMANENT,
.wp_type = ESDHC_WP_NONE, .wp_type = ESDHC_WP_NONE,
.caps = MMC_MODE_8BIT | MMC_MODE_4BIT, .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
}; };
static int tqma53_devices_init(void) static int tqma53_devices_init(void)

View File

@ -32,7 +32,7 @@ enum cd_types {
* @cd_gpio: gpio for card_detect interrupt * @cd_gpio: gpio for card_detect interrupt
* @wp_type: type of write_protect method (see wp_types enum above) * @wp_type: type of write_protect method (see wp_types enum above)
* @cd_type: type of card_detect method (see cd_types enum above) * @cd_type: type of card_detect method (see cd_types enum above)
* @caps: supported bus width capabilities (MMC_MODE_4BIT | MMC_MODE_8BIT) * @caps: supported bus width capabilities (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)
*/ */
struct esdhc_platform_data { struct esdhc_platform_data {

View File

@ -565,9 +565,9 @@ static int atmci_probe(struct device_d *hw_dev)
host->mci.hw_dev = hw_dev; host->mci.hw_dev = hw_dev;
if (pd->bus_width >= 4) if (pd->bus_width >= 4)
host->mci.host_caps |= MMC_MODE_4BIT; host->mci.host_caps |= MMC_CAP_4_BIT_DATA;
if (pd->bus_width == 8) if (pd->bus_width == 8)
host->mci.host_caps |= MMC_MODE_8BIT; host->mci.host_caps |= MMC_CAP_8_BIT_DATA;
host->slot_b = pd->slot_b; host->slot_b = pd->slot_b;
host->regs = dev_request_mem_region(hw_dev, 0); host->regs = dev_request_mem_region(hw_dev, 0);
@ -594,7 +594,7 @@ static int atmci_probe(struct device_d *hw_dev)
atmci_get_cap(host); atmci_get_cap(host);
if (host->caps.has_highspeed) if (host->caps.has_highspeed)
host->mci.host_caps |= MMC_MODE_HS; host->mci.host_caps |= MMC_CAP_SD_HIGHSPEED;
if (host->slot_b) if (host->slot_b)
host->sdc_reg = ATMCI_SDCSEL_SLOT_B; host->sdc_reg = ATMCI_SDCSEL_SLOT_B;

View File

@ -540,7 +540,7 @@ static int fsl_esdhc_probe(struct device_d *dev)
if (pdata && pdata->caps) if (pdata && pdata->caps)
mci->host_caps = pdata->caps; mci->host_caps = pdata->caps;
else else
mci->host_caps = MMC_MODE_4BIT; mci->host_caps = MMC_CAP_4_BIT_DATA;
if (pdata && pdata->devname) { if (pdata && pdata->devname) {
mci->devname = pdata->devname; mci->devname = pdata->devname;
@ -551,7 +551,7 @@ static int fsl_esdhc_probe(struct device_d *dev)
} }
if (caps & ESDHC_HOSTCAPBLT_HSS) if (caps & ESDHC_HOSTCAPBLT_HSS)
mci->host_caps |= MMC_MODE_HS_52MHz | MMC_MODE_HS; mci->host_caps |= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED;
host->mci.send_cmd = esdhc_send_cmd; host->mci.send_cmd = esdhc_send_cmd;
host->mci.set_ios = esdhc_set_ios; host->mci.set_ios = esdhc_set_ios;

View File

@ -504,7 +504,7 @@ static int mxcmci_probe(struct device_d *dev)
host->mci.send_cmd = mxcmci_request; host->mci.send_cmd = mxcmci_request;
host->mci.set_ios = mxcmci_set_ios; host->mci.set_ios = mxcmci_set_ios;
host->mci.init = mxcmci_init; host->mci.init = mxcmci_init;
host->mci.host_caps = MMC_MODE_4BIT; host->mci.host_caps = MMC_CAP_4_BIT_DATA;
host->mci.hw_dev = dev; host->mci.hw_dev = dev;
host->base = dev_request_mem_region(dev, 0); host->base = dev_request_mem_region(dev, 0);

View File

@ -553,7 +553,8 @@ static int bcm2835_mci_probe(struct device_d *hw_dev)
return -EBUSY; return -EBUSY;
} }
host->mci.host_caps |= MMC_MODE_4BIT | MMC_MODE_HS | MMC_MODE_HS_52MHz; host->mci.host_caps |= MMC_CAP_4_BIT_DATA | MMC_CAP_SD_HIGHSPEED |
MMC_CAP_MMC_HIGHSPEED;
host->mci.voltages = MMC_VDD_32_33 | MMC_VDD_33_34; host->mci.voltages = MMC_VDD_32_33 | MMC_VDD_33_34;

View File

@ -434,7 +434,7 @@ static int mmc_change_freq(struct mci *mci)
if (mci->version < MMC_VERSION_4) if (mci->version < MMC_VERSION_4)
return 0; return 0;
mci->card_caps |= MMC_MODE_4BIT; mci->card_caps |= MMC_CAP_4_BIT_DATA;
err = mci_send_ext_csd(mci, mci->ext_csd); err = mci_send_ext_csd(mci, mci->ext_csd);
if (err) { if (err) {
@ -467,9 +467,9 @@ static int mmc_change_freq(struct mci *mci)
/* High Speed is set, there are two types: 52MHz and 26MHz */ /* High Speed is set, there are two types: 52MHz and 26MHz */
if (cardtype & EXT_CSD_CARD_TYPE_52) if (cardtype & EXT_CSD_CARD_TYPE_52)
mci->card_caps |= MMC_MODE_HS_52MHz | MMC_MODE_HS; mci->card_caps |= MMC_CAP_MMC_HIGHSPEED_52MHZ | MMC_CAP_MMC_HIGHSPEED;
else else
mci->card_caps |= MMC_MODE_HS; mci->card_caps |= MMC_CAP_MMC_HIGHSPEED;
if (IS_ENABLED(CONFIG_MCI_MMC_BOOT_PARTITIONS) && if (IS_ENABLED(CONFIG_MCI_MMC_BOOT_PARTITIONS) &&
mci->ext_csd[EXT_CSD_REV] >= 3 && mci->ext_csd[EXT_CSD_BOOT_MULT]) { mci->ext_csd[EXT_CSD_REV] >= 3 && mci->ext_csd[EXT_CSD_BOOT_MULT]) {
@ -615,7 +615,7 @@ retry_scr:
} }
if (mci->scr[0] & SD_DATA_4BIT) if (mci->scr[0] & SD_DATA_4BIT)
mci->card_caps |= MMC_MODE_4BIT; mci->card_caps |= MMC_CAP_4_BIT_DATA;
/* If high-speed isn't supported, we return */ /* If high-speed isn't supported, we return */
if (!(__be32_to_cpu(switch_status[3]) & SD_HIGHSPEED_SUPPORTED)) if (!(__be32_to_cpu(switch_status[3]) & SD_HIGHSPEED_SUPPORTED))
@ -628,7 +628,7 @@ retry_scr:
} }
if ((__be32_to_cpu(switch_status[4]) & 0x0f000000) == 0x01000000) if ((__be32_to_cpu(switch_status[4]) & 0x0f000000) == 0x01000000)
mci->card_caps |= MMC_MODE_HS; mci->card_caps |= MMC_CAP_SD_HIGHSPEED;
return 0; return 0;
} }
@ -900,7 +900,7 @@ static int mci_startup_sd(struct mci *mci)
struct mci_cmd cmd; struct mci_cmd cmd;
int err; int err;
if (mci->card_caps & MMC_MODE_4BIT) { if (mci->card_caps & MMC_CAP_4_BIT_DATA) {
dev_dbg(&mci->dev, "Prepare for bus width change\n"); dev_dbg(&mci->dev, "Prepare for bus width change\n");
mci_setup_cmd(&cmd, MMC_CMD_APP_CMD, mci->rca << 16, MMC_RSP_R1); mci_setup_cmd(&cmd, MMC_CMD_APP_CMD, mci->rca << 16, MMC_RSP_R1);
err = mci_send_cmd(mci, &cmd, NULL); err = mci_send_cmd(mci, &cmd, NULL);
@ -920,7 +920,7 @@ static int mci_startup_sd(struct mci *mci)
mci_set_bus_width(mci, MMC_BUS_WIDTH_4); mci_set_bus_width(mci, MMC_BUS_WIDTH_4);
} }
/* if possible, speed up the transfer */ /* if possible, speed up the transfer */
if (mci->card_caps & MMC_MODE_HS) if (mci->card_caps & MMC_CAP_SD_HIGHSPEED)
mci_set_clock(mci, 50000000); mci_set_clock(mci, 50000000);
else else
mci_set_clock(mci, 25000000); mci_set_clock(mci, 25000000);
@ -943,8 +943,8 @@ static int mci_startup_mmc(struct mci *mci)
}; };
/* if possible, speed up the transfer */ /* if possible, speed up the transfer */
if (mci->card_caps & MMC_MODE_HS) { if (mci->card_caps & MMC_CAP_MMC_HIGHSPEED) {
if (mci->card_caps & MMC_MODE_HS_52MHz) if (mci->card_caps & MMC_CAP_MMC_HIGHSPEED_52MHZ)
mci_set_clock(mci, 52000000); mci_set_clock(mci, 52000000);
else else
mci_set_clock(mci, 26000000); mci_set_clock(mci, 26000000);
@ -958,7 +958,7 @@ static int mci_startup_mmc(struct mci *mci)
* the supported bus width or compare the ext csd values of current * the supported bus width or compare the ext csd values of current
* bus width and ext csd values of 1 bit mode read earlier. * bus width and ext csd values of 1 bit mode read earlier.
*/ */
if (host->host_caps & MMC_MODE_8BIT) if (host->host_caps & MMC_CAP_8_BIT_DATA)
idx = 1; idx = 1;
for (; idx >= 0; idx--) { for (; idx >= 0; idx--) {
@ -1694,10 +1694,10 @@ void mci_of_parse(struct mci_host *host)
switch (bus_width) { switch (bus_width) {
case 8: case 8:
host->host_caps |= MMC_MODE_8BIT; host->host_caps |= MMC_CAP_8_BIT_DATA;
/* Hosts capable of 8-bit transfers can also do 4 bits */ /* Hosts capable of 8-bit transfers can also do 4 bits */
case 4: case 4:
host->host_caps |= MMC_MODE_4BIT; host->host_caps |= MMC_CAP_4_BIT_DATA;
break; break;
case 1: case 1:
break; break;

View File

@ -592,7 +592,8 @@ static int omap_mmc_probe(struct device_d *dev)
hsmmc->mci.send_cmd = mmc_send_cmd; hsmmc->mci.send_cmd = mmc_send_cmd;
hsmmc->mci.set_ios = mmc_set_ios; hsmmc->mci.set_ios = mmc_set_ios;
hsmmc->mci.init = mmc_init_setup; hsmmc->mci.init = mmc_init_setup;
hsmmc->mci.host_caps = MMC_MODE_4BIT | MMC_MODE_HS_52MHz | MMC_MODE_HS; hsmmc->mci.host_caps = MMC_CAP_4_BIT_DATA | MMC_CAP_SD_HIGHSPEED |
MMC_CAP_MMC_HIGHSPEED;
hsmmc->mci.hw_dev = dev; hsmmc->mci.hw_dev = dev;
hsmmc->iobase = dev_request_mem_region(dev, 0); hsmmc->iobase = dev_request_mem_region(dev, 0);

View File

@ -343,7 +343,7 @@ static int pxamci_probe(struct device_d *dev)
host->mci.init = pxamci_init; host->mci.init = pxamci_init;
host->mci.send_cmd = pxamci_request; host->mci.send_cmd = pxamci_request;
host->mci.set_ios = pxamci_set_ios; host->mci.set_ios = pxamci_set_ios;
host->mci.host_caps = MMC_MODE_4BIT; host->mci.host_caps = MMC_CAP_4_BIT_DATA;
host->mci.hw_dev = dev; host->mci.hw_dev = dev;
host->mci.voltages = MMC_VDD_32_33 | MMC_VDD_33_34; host->mci.voltages = MMC_VDD_32_33 | MMC_VDD_33_34;

View File

@ -44,11 +44,12 @@
#define MMC_VERSION_3 (MMC_VERSION_MMC | 0x30) #define MMC_VERSION_3 (MMC_VERSION_MMC | 0x30)
#define MMC_VERSION_4 (MMC_VERSION_MMC | 0x40) #define MMC_VERSION_4 (MMC_VERSION_MMC | 0x40)
#define MMC_MODE_HS 0x001 #define MMC_CAP_SPI (1 << 0)
#define MMC_MODE_HS_52MHz 0x010 #define MMC_CAP_4_BIT_DATA (1 << 1)
#define MMC_CAP_SPI 0x020 #define MMC_CAP_8_BIT_DATA (1 << 2)
#define MMC_MODE_4BIT 0x100 #define MMC_CAP_SD_HIGHSPEED (1 << 3)
#define MMC_MODE_8BIT 0x200 #define MMC_CAP_MMC_HIGHSPEED (1 << 4)
#define MMC_CAP_MMC_HIGHSPEED_52MHZ (1 << 5)
#define SD_DATA_4BIT 0x00040000 #define SD_DATA_4BIT 0x00040000