From a36274e0184193e393fb82957925c3981a6b0477 Mon Sep 17 00:00:00 2001 From: "Martin K. Petersen" Date: Fri, 10 Sep 2010 01:33:59 -0400 Subject: mmc: Remove distinction between hw and phys segments We have deprecated the distinction between hardware and physical segments in the block layer. Consolidate the two limits into one in drivers/mmc/. Signed-off-by: Martin K. Petersen Signed-off-by: Chris Ball --- include/linux/mmc/host.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'include') diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 1575b52..ded4017 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -162,8 +162,7 @@ struct mmc_host { /* host specific block data */ unsigned int max_seg_size; /* see blk_queue_max_segment_size */ - unsigned short max_hw_segs; /* see blk_queue_max_hw_segments */ - unsigned short max_phys_segs; /* see blk_queue_max_phys_segments */ + unsigned short max_segs; /* see blk_queue_max_segments */ unsigned short unused; unsigned int max_req_size; /* maximum number of bytes in one req */ unsigned int max_blk_size; /* maximum size of one mmc block */ -- cgit v1.1 From 453722b9f7366e5b8b46101358dd7bcaef62b59d Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Fri, 20 Aug 2010 10:46:46 +0300 Subject: mmc: make mmc_dev_to_card() macro public Conversion from struct device to struct mmc_card is used more than in one place. Due to this it's better to have public macro for such thing. Signed-off-by: Andy Shevchenko Cc: Adrian Hunter Cc: Signed-off-by: Andrew Morton Signed-off-by: Chris Ball --- include/linux/mmc/card.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index 6b75250..71acf19 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h @@ -173,6 +173,8 @@ static inline int mmc_blksz_for_byte_mode(const struct mmc_card *c) #define mmc_card_name(c) ((c)->cid.prod_name) #define mmc_card_id(c) (dev_name(&(c)->dev)) +#define dev_to_mmc_card(d) container_of(d, struct mmc_card, dev) + #define mmc_list_to_card(l) container_of(l, struct mmc_card, node) #define mmc_get_drvdata(c) dev_get_drvdata(&(c)->dev) #define mmc_set_drvdata(c,d) dev_set_drvdata(&(c)->dev, d) -- cgit v1.1 From 265cdc900ce93c0cd2465d751fe75ff2e55e126e Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Fri, 17 Sep 2010 20:32:25 -0400 Subject: mmc: rename dev_to_mmc_card() to mmc_dev_to_card() Global symbols should use their subsystem name in a prefixed fashion. Signed-off-by: Andy Shevchenko Cc: Signed-off-by: Andrew Morton Signed-off-by: Chris Ball --- include/linux/mmc/card.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index 71acf19..7bd4923 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h @@ -173,7 +173,7 @@ static inline int mmc_blksz_for_byte_mode(const struct mmc_card *c) #define mmc_card_name(c) ((c)->cid.prod_name) #define mmc_card_id(c) (dev_name(&(c)->dev)) -#define dev_to_mmc_card(d) container_of(d, struct mmc_card, dev) +#define mmc_dev_to_card(d) container_of(d, struct mmc_card, dev) #define mmc_list_to_card(l) container_of(l, struct mmc_card, node) #define mmc_get_drvdata(c) dev_get_drvdata(&(c)->dev) -- cgit v1.1 From 71d7d3d190fe77588269a8febf93cd739bd91eb3 Mon Sep 17 00:00:00 2001 From: Matt Fleming Date: Mon, 27 Sep 2010 09:42:19 +0100 Subject: mmc: Add helper function to check if a card is removable There are two checks that need to be made when determining whether a card is removable. A host controller may set MMC_CAP_NONREMOVABLE if the controller does not support removing cards (e.g. eMMC), in which case the card is physically non-removable. Also the 'mmc_assume_removable' module parameter can be configured at module load time, in which case the card may be logically non-removable. A helper function keeps the logic in one place so that code always checks both conditions. Because this new function is likely to be called from modules we now need to export the mmc_assume_removable symbol. Signed-off-by: Matt Fleming Acked-by: Kyungmin Park Tested-by: Jaehoon Chung Acked-by: Wolfram Sang Signed-off-by: Chris Ball --- include/linux/mmc/host.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include') diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index ded4017..2e0fe62 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -267,5 +267,13 @@ static inline void mmc_set_disable_delay(struct mmc_host *host, host->disable_delay = disable_delay; } +/* Module parameter */ +extern int mmc_assume_removable; + +static inline int mmc_card_is_removable(struct mmc_host *host) +{ + return !(host->caps & MMC_CAP_NONREMOVABLE) && mmc_assume_removable; +} + #endif -- cgit v1.1 From 88ae8b866488031b0e2fc05a27440fefec5e6927 Mon Sep 17 00:00:00 2001 From: Hein Tibosch Date: Mon, 6 Sep 2010 09:37:19 +0800 Subject: mmc: Make ID freq configurable In the latest releases of the mmc driver, the freq during initialization is set to a fixed 400 Khz. This was reportedly too fast for several users. As there doesn't seem to be an ideal frequency which-works-for-all, Pierre suggested to let the driver try several frequencies. This patch implements that idea. It will try mmc-initialization using several frequencies from an array 400, 300, 200 and 100. In case SDIO is broken, it'll still try to detect SDMEM, also at different freqs. Signed-off-by: Hein Tibosch Cc: Pierre Ossman Reviewed-by: Chris Ball Tested-by: Chris Ball Cc: Ben Nizette Cc: Sascha Hauer Cc: Adrian Hunter Cc: Matt Fleming Cc: Signed-off-by: Andrew Morton Signed-off-by: Chris Ball --- include/linux/mmc/host.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 2e0fe62..20be040 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -123,6 +123,7 @@ struct mmc_host { const struct mmc_host_ops *ops; unsigned int f_min; unsigned int f_max; + unsigned int f_init; u32 ocr_avail; struct notifier_block pm_notify; -- cgit v1.1 From 99fc5131018cbdc3cf42ce09fb394a4e8b053c74 Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Wed, 29 Sep 2010 01:08:27 -0400 Subject: mmc: Move regulator handling closer to core After discovering a problem in regulator reference counting I took Mark Brown's advice to move the reference count into the MMC core by making the regulator status a member of struct mmc_host. I took this opportunity to also implement NULL versions of the regulator functions so as to rid the driver code from some ugly #ifdef CONFIG_REGULATOR clauses. Signed-off-by: Linus Walleij Reviewed-by: Mark Brown Cc: Liam Girdwood Cc: Tony Lindgren Cc: Adrian Hunter Cc: Robert Jarzmik Cc: Sundar Iyer Cc: Daniel Mack Cc: Pierre Ossman Cc: Matt Fleming Cc: David Brownell Cc: Russell King Cc: Eric Miao Cc: Cliff Brake Cc: Jarkko Lavinen Cc: Signed-off-by: Andrew Morton Signed-off-by: Chris Ball --- include/linux/mmc/host.h | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 20be040..ccac56a 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -212,6 +212,10 @@ struct mmc_host { struct led_trigger *led; /* activity led */ #endif +#ifdef CONFIG_REGULATOR + bool regulator_enabled; /* regulator state */ +#endif + struct dentry *debugfs_root; unsigned long private[0] ____cacheline_aligned; @@ -250,8 +254,24 @@ static inline void mmc_signal_sdio_irq(struct mmc_host *host) struct regulator; +#ifdef CONFIG_REGULATOR int mmc_regulator_get_ocrmask(struct regulator *supply); -int mmc_regulator_set_ocr(struct regulator *supply, unsigned short vdd_bit); +int mmc_regulator_set_ocr(struct mmc_host *mmc, + struct regulator *supply, + unsigned short vdd_bit); +#else +static inline int mmc_regulator_get_ocrmask(struct regulator *supply) +{ + return 0; +} + +static inline int mmc_regulator_set_ocr(struct mmc_host *mmc, + struct regulator *supply, + unsigned short vdd_bit) +{ + return 0; +} +#endif int mmc_card_awake(struct mmc_host *host); int mmc_card_sleep(struct mmc_host *host); -- cgit v1.1 From dfc13e8402c75e7c2e0a52e123c0500a3259866b Mon Sep 17 00:00:00 2001 From: Hanumath Prasad Date: Thu, 30 Sep 2010 17:37:23 -0400 Subject: mmc: MMC 4.4 DDR support Add support for Dual Data Rate MMC cards as defined in the 4.4 specification. Signed-off-by: Hanumath Prasad Cc: linux-mmc@vger.kernel.org Acked-by: Linus Walleij Tested-by Zhangfei Gao Signed-off-by: Chris Ball --- include/linux/mmc/card.h | 4 ++++ include/linux/mmc/core.h | 1 + include/linux/mmc/host.h | 4 ++++ include/linux/mmc/mmc.h | 10 +++++++++- 4 files changed, 18 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index 7bd4923..8ce0827 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h @@ -48,6 +48,7 @@ struct mmc_ext_csd { unsigned int sa_timeout; /* Units: 100ns */ unsigned int hs_max_dtr; unsigned int sectors; + unsigned int card_type; unsigned int hc_erase_size; /* In sectors */ unsigned int hc_erase_timeout; /* In milliseconds */ unsigned int sec_trim_mult; /* Secure trim multiplier */ @@ -113,6 +114,7 @@ struct mmc_card { #define MMC_STATE_READONLY (1<<1) /* card is read-only */ #define MMC_STATE_HIGHSPEED (1<<2) /* card is in high speed mode */ #define MMC_STATE_BLOCKADDR (1<<3) /* card uses block-addressing */ +#define MMC_STATE_HIGHSPEED_DDR (1<<4) /* card is in high speed mode */ unsigned int quirks; /* card quirks */ #define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */ #define MMC_QUIRK_BLKSZ_FOR_BYTE_MODE (1<<1) /* use func->cur_blksize */ @@ -154,11 +156,13 @@ struct mmc_card { #define mmc_card_readonly(c) ((c)->state & MMC_STATE_READONLY) #define mmc_card_highspeed(c) ((c)->state & MMC_STATE_HIGHSPEED) #define mmc_card_blockaddr(c) ((c)->state & MMC_STATE_BLOCKADDR) +#define mmc_card_ddr_mode(c) ((c)->state & MMC_STATE_HIGHSPEED_DDR) #define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT) #define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY) #define mmc_card_set_highspeed(c) ((c)->state |= MMC_STATE_HIGHSPEED) #define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR) +#define mmc_card_set_ddr_mode(c) ((c)->state |= MMC_STATE_HIGHSPEED_DDR) static inline int mmc_card_lenient_fn0(const struct mmc_card *c) { diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h index 7429033..d0fbcac 100644 --- a/include/linux/mmc/core.h +++ b/include/linux/mmc/core.h @@ -109,6 +109,7 @@ struct mmc_data { #define MMC_DATA_WRITE (1 << 8) #define MMC_DATA_READ (1 << 9) #define MMC_DATA_STREAM (1 << 10) +#define MMC_DDR_MODE (1 << 11) unsigned int bytes_xfered; diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index ccac56a..6711eb8 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -158,6 +158,10 @@ struct mmc_host { #define MMC_CAP_NONREMOVABLE (1 << 8) /* Nonremovable e.g. eMMC */ #define MMC_CAP_WAIT_WHILE_BUSY (1 << 9) /* Waits while card is busy */ #define MMC_CAP_ERASE (1 << 10) /* Allow erase/trim commands */ +#define MMC_CAP_1_8V_DDR (1 << 11) /* can support */ + /* DDR mode at 1.8V */ +#define MMC_CAP_1_2V_DDR (1 << 12) /* can support */ + /* DDR mode at 1.2V */ mmc_pm_flag_t pm_caps; /* supported pm features */ diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h index dd11ae5..956fbd87 100644 --- a/include/linux/mmc/mmc.h +++ b/include/linux/mmc/mmc.h @@ -277,11 +277,19 @@ struct _mmc_csd { #define EXT_CSD_CARD_TYPE_26 (1<<0) /* Card can run at 26MHz */ #define EXT_CSD_CARD_TYPE_52 (1<<1) /* Card can run at 52MHz */ -#define EXT_CSD_CARD_TYPE_MASK 0x3 /* Mask out reserved and DDR bits */ +#define EXT_CSD_CARD_TYPE_MASK 0xF /* Mask out reserved bits */ +#define EXT_CSD_CARD_TYPE_DDR_1_8V (1<<2) /* Card can run at 52MHz */ + /* DDR mode @1.8V or 3V I/O */ +#define EXT_CSD_CARD_TYPE_DDR_1_2V (1<<3) /* Card can run at 52MHz */ + /* DDR mode @1.2V I/O */ +#define EXT_CSD_CARD_TYPE_DDR_52 (EXT_CSD_CARD_TYPE_DDR_1_8V \ + | EXT_CSD_CARD_TYPE_DDR_1_2V) #define EXT_CSD_BUS_WIDTH_1 0 /* Card is in 1 bit mode */ #define EXT_CSD_BUS_WIDTH_4 1 /* Card is in 4 bit mode */ #define EXT_CSD_BUS_WIDTH_8 2 /* Card is in 8 bit mode */ +#define EXT_CSD_DDR_BUS_WIDTH_4 5 /* Card is in 4 bit DDR mode */ +#define EXT_CSD_DDR_BUS_WIDTH_8 6 /* Card is in 8 bit DDR mode */ #define EXT_CSD_SEC_ER_EN BIT(0) #define EXT_CSD_SEC_BD_BLK_EN BIT(2) -- cgit v1.1 From 0f8d8ea64ec7c77ca5beb59534d386fe0235961a Mon Sep 17 00:00:00 2001 From: Adrian Hunter Date: Tue, 24 Aug 2010 13:20:26 +0300 Subject: mmc: Fixes for Dual Data Rate (DDR) support The DDR support patch needs the following fixes: - The block driver does not need to know about DDR, any more than it needs to know about bus width. - Not only the card must be switched to DDR mode. The host controller must also be configured, which is done through the 'set_ios()' function. - Do not set the DDR mode state until after the switch command is successful. - Setting block length is not supported in DDR mode. Make that a core function and change the other place it is used (mmc_test) also. Signed-off-by: Adrian Hunter Signed-off-by: Chris Ball --- include/linux/mmc/core.h | 3 ++- include/linux/mmc/host.h | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h index d0fbcac..64e013f 100644 --- a/include/linux/mmc/core.h +++ b/include/linux/mmc/core.h @@ -109,7 +109,6 @@ struct mmc_data { #define MMC_DATA_WRITE (1 << 8) #define MMC_DATA_READ (1 << 9) #define MMC_DATA_STREAM (1 << 10) -#define MMC_DDR_MODE (1 << 11) unsigned int bytes_xfered; @@ -154,6 +153,8 @@ extern int mmc_can_secure_erase_trim(struct mmc_card *card); extern int mmc_erase_group_aligned(struct mmc_card *card, unsigned int from, unsigned int nr); +extern int mmc_set_blocklen(struct mmc_card *card, unsigned int blocklen); + extern void mmc_set_data_timeout(struct mmc_data *, const struct mmc_card *); extern unsigned int mmc_align_data_size(struct mmc_card *, unsigned int); diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 6711eb8..c4fb1c5 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -50,6 +50,11 @@ struct mmc_ios { #define MMC_TIMING_LEGACY 0 #define MMC_TIMING_MMC_HS 1 #define MMC_TIMING_SD_HS 2 + + unsigned char ddr; /* dual data rate used */ + +#define MMC_SDR_MODE 0 +#define MMC_DDR_MODE 1 }; struct mmc_host_ops { -- cgit v1.1 From 49e3b5a44f8abd33c8693edc575c6d06a210d778 Mon Sep 17 00:00:00 2001 From: Adrian Hunter Date: Mon, 11 Oct 2010 12:43:50 +0300 Subject: mmc: refine DDR support One flaw with DDR support is that MMC core does not inform the driver which DDR mode it has selected. This patch expands the ios->ddr flag to do that. Signed-off-by: Adrian Hunter Signed-off-by: Chris Ball --- include/linux/mmc/host.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index c4fb1c5..69ee1eb 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -54,7 +54,8 @@ struct mmc_ios { unsigned char ddr; /* dual data rate used */ #define MMC_SDR_MODE 0 -#define MMC_DDR_MODE 1 +#define MMC_1_2V_DDR_MODE 1 +#define MMC_1_8V_DDR_MODE 2 }; struct mmc_host_ops { -- cgit v1.1 From 1978fda85dfdb53623dddb4ec126163a61ab3933 Mon Sep 17 00:00:00 2001 From: Giuseppe Cavallaro Date: Tue, 28 Sep 2010 10:41:29 +0200 Subject: mmc: sdhci: split up sdhci.h for sdhci-pltfm users Some platforms based on sdhci-pltfm need to set their own quirks. Previously to this patch, the quirks were in drivers/mmc/host/sdhci.h. This patch splits drivers/mmc/host/sdhci.h into two parts: * drivers/mmc/host/sdhci.h includes the HC registers and I/O accessors. * include/linux/mmc/sdhci.h includes the sdhci structure and quirks. Instead of including drivers/mmc/host/sdhci.h, -pltfm drivers should now include include/linux/mmc/sdhci.h and include/linux/sdhci-pltfm.h. This patch avoids adding/changing the calls/flags in the sdhci_pltfm_data structure. It has been tested on STM platforms (e.g. STx7106, STx7108, STx5206) where the driver is configured and used as shown in the example below: [snip] static int mmc_pad_resources(struct sdhci_host *sdhci) { if (!devm_stm_pad_claim(sdhci->mmc->parent, &stx7108_mmc_pad_config, dev_name(sdhci->mmc->parent))) return -ENODEV; return 0; } static struct sdhci_pltfm_data stx7108_mmc_platform_data = { .init = mmc_pad_resources, .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC, }; static struct platform_device stx7108_mmc_device = { .name = "sdhci", [snip] Note: drivers/mmc/host/sdhci.h now also includes linux/mmc/sdhci.h, and no modifications should be needed on other sdhci- drivers. Signed-off-by: Giuseppe Cavallaro Reviewed-by: Wolfram Sang Signed-off-by: Chris Ball --- include/linux/mmc/sdhci.h | 144 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 include/linux/mmc/sdhci.h (limited to 'include') diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h new file mode 100644 index 0000000..1fdc673 --- /dev/null +++ b/include/linux/mmc/sdhci.h @@ -0,0 +1,144 @@ +/* + * linux/include/linux/mmc/sdhci.h - Secure Digital Host Controller Interface + * + * Copyright (C) 2005-2008 Pierre Ossman, All Rights Reserved. + * + * 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 (at + * your option) any later version. + */ +#ifndef __SDHCI_H +#define __SDHCI_H + +#include +#include +#include +#include +#include + +struct sdhci_host { + /* Data set by hardware interface driver */ + const char *hw_name; /* Hardware bus name */ + + unsigned int quirks; /* Deviations from spec. */ + +/* Controller doesn't honor resets unless we touch the clock register */ +#define SDHCI_QUIRK_CLOCK_BEFORE_RESET (1<<0) +/* Controller has bad caps bits, but really supports DMA */ +#define SDHCI_QUIRK_FORCE_DMA (1<<1) +/* Controller doesn't like to be reset when there is no card inserted. */ +#define SDHCI_QUIRK_NO_CARD_NO_RESET (1<<2) +/* Controller doesn't like clearing the power reg before a change */ +#define SDHCI_QUIRK_SINGLE_POWER_WRITE (1<<3) +/* Controller has flaky internal state so reset it on each ios change */ +#define SDHCI_QUIRK_RESET_CMD_DATA_ON_IOS (1<<4) +/* Controller has an unusable DMA engine */ +#define SDHCI_QUIRK_BROKEN_DMA (1<<5) +/* Controller has an unusable ADMA engine */ +#define SDHCI_QUIRK_BROKEN_ADMA (1<<6) +/* Controller can only DMA from 32-bit aligned addresses */ +#define SDHCI_QUIRK_32BIT_DMA_ADDR (1<<7) +/* Controller can only DMA chunk sizes that are a multiple of 32 bits */ +#define SDHCI_QUIRK_32BIT_DMA_SIZE (1<<8) +/* Controller can only ADMA chunks that are a multiple of 32 bits */ +#define SDHCI_QUIRK_32BIT_ADMA_SIZE (1<<9) +/* Controller needs to be reset after each request to stay stable */ +#define SDHCI_QUIRK_RESET_AFTER_REQUEST (1<<10) +/* Controller needs voltage and power writes to happen separately */ +#define SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER (1<<11) +/* Controller provides an incorrect timeout value for transfers */ +#define SDHCI_QUIRK_BROKEN_TIMEOUT_VAL (1<<12) +/* Controller has an issue with buffer bits for small transfers */ +#define SDHCI_QUIRK_BROKEN_SMALL_PIO (1<<13) +/* Controller does not provide transfer-complete interrupt when not busy */ +#define SDHCI_QUIRK_NO_BUSY_IRQ (1<<14) +/* Controller has unreliable card detection */ +#define SDHCI_QUIRK_BROKEN_CARD_DETECTION (1<<15) +/* Controller reports inverted write-protect state */ +#define SDHCI_QUIRK_INVERTED_WRITE_PROTECT (1<<16) +/* Controller has nonstandard clock management */ +#define SDHCI_QUIRK_NONSTANDARD_CLOCK (1<<17) +/* Controller does not like fast PIO transfers */ +#define SDHCI_QUIRK_PIO_NEEDS_DELAY (1<<18) +/* Controller losing signal/interrupt enable states after reset */ +#define SDHCI_QUIRK_RESTORE_IRQS_AFTER_RESET (1<<19) +/* Controller has to be forced to use block size of 2048 bytes */ +#define SDHCI_QUIRK_FORCE_BLK_SZ_2048 (1<<20) +/* Controller cannot do multi-block transfers */ +#define SDHCI_QUIRK_NO_MULTIBLOCK (1<<21) +/* Controller can only handle 1-bit data transfers */ +#define SDHCI_QUIRK_FORCE_1_BIT_DATA (1<<22) +/* Controller needs 10ms delay between applying power and clock */ +#define SDHCI_QUIRK_DELAY_AFTER_POWER (1<<23) +/* Controller uses SDCLK instead of TMCLK for data timeouts */ +#define SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK (1<<24) +/* Controller reports wrong base clock capability */ +#define SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN (1<<25) +/* Controller cannot support End Attribute in NOP ADMA descriptor */ +#define SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC (1<<26) +/* Controller is missing device caps. Use caps provided by host */ +#define SDHCI_QUIRK_MISSING_CAPS (1<<27) +/* Controller uses Auto CMD12 command to stop the transfer */ +#define SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12 (1<<28) +/* Controller doesn't have HISPD bit field in HI-SPEED SD card */ +#define SDHCI_QUIRK_NO_HISPD_BIT (1<<29) + + int irq; /* Device IRQ */ + void __iomem *ioaddr; /* Mapped address */ + + const struct sdhci_ops *ops; /* Low level hw interface */ + + struct regulator *vmmc; /* Power regulator */ + + /* Internal data */ + struct mmc_host *mmc; /* MMC structure */ + u64 dma_mask; /* custom DMA mask */ + +#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE) + struct led_classdev led; /* LED control */ + char led_name[32]; +#endif + + spinlock_t lock; /* Mutex */ + + int flags; /* Host attributes */ +#define SDHCI_USE_SDMA (1<<0) /* Host is SDMA capable */ +#define SDHCI_USE_ADMA (1<<1) /* Host is ADMA capable */ +#define SDHCI_REQ_USE_DMA (1<<2) /* Use DMA for this req. */ +#define SDHCI_DEVICE_DEAD (1<<3) /* Device unresponsive */ + + unsigned int version; /* SDHCI spec. version */ + + unsigned int max_clk; /* Max possible freq (MHz) */ + unsigned int timeout_clk; /* Timeout freq (KHz) */ + + unsigned int clock; /* Current clock (MHz) */ + u8 pwr; /* Current voltage */ + + struct mmc_request *mrq; /* Current request */ + struct mmc_command *cmd; /* Current command */ + struct mmc_data *data; /* Current data request */ + unsigned int data_early:1; /* Data finished before cmd */ + + struct sg_mapping_iter sg_miter; /* SG state for PIO */ + unsigned int blocks; /* remaining PIO blocks */ + + int sg_count; /* Mapped sg entries */ + + u8 *adma_desc; /* ADMA descriptor table */ + u8 *align_buffer; /* Bounce buffer */ + + dma_addr_t adma_addr; /* Mapped ADMA descr. table */ + dma_addr_t align_addr; /* Mapped bounce buffer */ + + struct tasklet_struct card_tasklet; /* Tasklet structures */ + struct tasklet_struct finish_tasklet; + + struct timer_list timer; /* Timer for timeouts */ + + unsigned int caps; /* Alternative capabilities */ + + unsigned long private[0] ____cacheline_aligned; +}; +#endif /* __SDHCI_H */ -- cgit v1.1 From 12ae637f081a7a05144af65802a7b492b9162660 Mon Sep 17 00:00:00 2001 From: Ohad Ben-Cohen Date: Sat, 2 Oct 2010 13:54:06 +0200 Subject: mmc: propagate power save/restore ops return value Allow power save/restore and their relevant mmc_bus_ops handlers exit with a return value. Signed-off-by: Ohad Ben-Cohen Tested-by: Luciano Coelho Signed-off-by: Chris Ball --- include/linux/mmc/host.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 69ee1eb..6d87f68 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -250,8 +250,8 @@ static inline void *mmc_priv(struct mmc_host *host) extern int mmc_suspend_host(struct mmc_host *); extern int mmc_resume_host(struct mmc_host *); -extern void mmc_power_save_host(struct mmc_host *host); -extern void mmc_power_restore_host(struct mmc_host *host); +extern int mmc_power_save_host(struct mmc_host *host); +extern int mmc_power_restore_host(struct mmc_host *host); extern void mmc_detect_change(struct mmc_host *, unsigned long delay); extern void mmc_request_done(struct mmc_host *, struct mmc_request *); -- cgit v1.1 From 292290524e54724cab78e7e79a27a3b9a8b11483 Mon Sep 17 00:00:00 2001 From: Xiaochen Shen Date: Mon, 4 Oct 2010 15:24:52 +0100 Subject: mmc: sdhci: Intel Medfield support Basic support for the Intel Medfield devices Give them their own quirks as we will need to update this later. Signed-off-by: Xiaochen Shen Signed-off-by: Alan Cox Signed-off-by: Chris Ball --- include/linux/pci_ids.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include') diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index e4471b2..1196d42 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -2420,6 +2420,13 @@ #define PCI_DEVICE_ID_INTEL_82375 0x0482 #define PCI_DEVICE_ID_INTEL_82424 0x0483 #define PCI_DEVICE_ID_INTEL_82378 0x0484 +#define PCI_DEVICE_ID_INTEL_MRST_SD0 0x0807 +#define PCI_DEVICE_ID_INTEL_MRST_SD1 0x0808 +#define PCI_DEVICE_ID_INTEL_MFD_SD 0x0820 +#define PCI_DEVICE_ID_INTEL_MFD_SDIO1 0x0821 +#define PCI_DEVICE_ID_INTEL_MFD_SDIO2 0x0822 +#define PCI_DEVICE_ID_INTEL_MFD_EMMC0 0x0823 +#define PCI_DEVICE_ID_INTEL_MFD_EMMC1 0x0824 #define PCI_DEVICE_ID_INTEL_I960 0x0960 #define PCI_DEVICE_ID_INTEL_I960RM 0x0962 #define PCI_DEVICE_ID_INTEL_8257X_SOL 0x1062 -- cgit v1.1 From d3b993dcc11cd291e6908ed02b9db99970220952 Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Fri, 15 Oct 2010 12:21:00 +0200 Subject: mmc: sdhci-pltfm: move .h file into appropriate subdir MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make use of the include/linux/mmc directory. Signed-off-by: Wolfram Sang Acked-by: Anton Vorontsov Tested-by: Eric Bénard Signed-off-by: Chris Ball --- include/linux/mmc/sdhci-pltfm.h | 35 +++++++++++++++++++++++++++++++++++ include/linux/sdhci-pltfm.h | 35 ----------------------------------- 2 files changed, 35 insertions(+), 35 deletions(-) create mode 100644 include/linux/mmc/sdhci-pltfm.h delete mode 100644 include/linux/sdhci-pltfm.h (limited to 'include') diff --git a/include/linux/mmc/sdhci-pltfm.h b/include/linux/mmc/sdhci-pltfm.h new file mode 100644 index 0000000..0239bd7 --- /dev/null +++ b/include/linux/mmc/sdhci-pltfm.h @@ -0,0 +1,35 @@ +/* + * Platform data declarations for the sdhci-pltfm driver. + * + * Copyright (c) 2010 MontaVista Software, LLC. + * + * Author: Anton Vorontsov + * + * 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 (at + * your option) any later version. + */ + +#ifndef _SDHCI_PLTFM_H +#define _SDHCI_PLTFM_H + +struct sdhci_ops; +struct sdhci_host; + +/** + * struct sdhci_pltfm_data - SDHCI platform-specific information & hooks + * @ops: optional pointer to the platform-provided SDHCI ops + * @quirks: optional SDHCI quirks + * @init: optional hook that is called during device probe, before the + * driver tries to access any SDHCI registers + * @exit: optional hook that is called during device removal + */ +struct sdhci_pltfm_data { + struct sdhci_ops *ops; + unsigned int quirks; + int (*init)(struct sdhci_host *host); + void (*exit)(struct sdhci_host *host); +}; + +#endif /* _SDHCI_PLTFM_H */ diff --git a/include/linux/sdhci-pltfm.h b/include/linux/sdhci-pltfm.h deleted file mode 100644 index 0239bd7..0000000 --- a/include/linux/sdhci-pltfm.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Platform data declarations for the sdhci-pltfm driver. - * - * Copyright (c) 2010 MontaVista Software, LLC. - * - * Author: Anton Vorontsov - * - * 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 (at - * your option) any later version. - */ - -#ifndef _SDHCI_PLTFM_H -#define _SDHCI_PLTFM_H - -struct sdhci_ops; -struct sdhci_host; - -/** - * struct sdhci_pltfm_data - SDHCI platform-specific information & hooks - * @ops: optional pointer to the platform-provided SDHCI ops - * @quirks: optional SDHCI quirks - * @init: optional hook that is called during device probe, before the - * driver tries to access any SDHCI registers - * @exit: optional hook that is called during device removal - */ -struct sdhci_pltfm_data { - struct sdhci_ops *ops; - unsigned int quirks; - int (*init)(struct sdhci_host *host); - void (*exit)(struct sdhci_host *host); -}; - -#endif /* _SDHCI_PLTFM_H */ -- cgit v1.1 From 012994f4fa5fc7663b51fa921c85c0a352339b24 Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Fri, 15 Oct 2010 12:21:02 +0200 Subject: mmc: sdhci_pltfm: pass more data on custom init call MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The custom init call may need more data to perform its job, so we pass it a pointer to pdata, too. Also, always use the platform_id specific data even if platform_data is present. Doing that, platform_data can additionally be parsed by init() for board-specific information (via sdhci->mmc->parent). (Note: the old behaviour was that you could override the platform_id specific data with your own. However, one can still do this by using the "sdhci" id instead of "sdhci-".) Signed-off-by: Wolfram Sang Tested-by: Eric Bénard Signed-off-by: Chris Ball --- include/linux/mmc/sdhci-pltfm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/mmc/sdhci-pltfm.h b/include/linux/mmc/sdhci-pltfm.h index 0239bd7..548d59d 100644 --- a/include/linux/mmc/sdhci-pltfm.h +++ b/include/linux/mmc/sdhci-pltfm.h @@ -28,7 +28,7 @@ struct sdhci_host; struct sdhci_pltfm_data { struct sdhci_ops *ops; unsigned int quirks; - int (*init)(struct sdhci_host *host); + int (*init)(struct sdhci_host *host, struct sdhci_pltfm_data *pdata); void (*exit)(struct sdhci_host *host); }; -- cgit v1.1