Re: [PATCH V2 2/2] ARM: dts: Add dwmmc nodes in SOC specific dts file
--- Original Message --- Sender : yuvaraj...@gmail.comyuvaraj...@gmail.com Date : Aug 21, 2013 12:07 (GMT+05:30) Title : [PATCH V2 2/2] ARM: dts: Add dwmmc nodes in SOC specific dts file From: Yuvaraj Kumar C D Exynos5 series SOC's have different versions of DWMMC controller. So dwmmc device nodes moved from Exynos5 SOC's common dts file to SOC specific dts file. changes since V1: 1.disable node by status = disabled in SOC file 2.enable node by status = okay in board specific file Signed-off-by: Yuvaraj Kumar C D --- arch/arm/boot/dts/exynos5250-smdk5250.dts | 10 ++ arch/arm/boot/dts/exynos5250.dtsi | 16 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts b/arch/arm/boot/dts/exynos5250-smdk5250.dts index 2538b32..bd19d55d 100644 --- a/arch/arm/boot/dts/exynos5250-smdk5250.dts +++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts @@ -141,6 +141,7 @@ }; dwmmc0@1220 { + status = okay; num-slots = 1; supports-highspeed; broken-cd; @@ -158,11 +159,8 @@ }; }; - dwmmc1@1221 { - status = disabled; - }; - dwmmc2@1222 { + status = okay; num-slots = 1; supports-highspeed; fifo-depth = 0x80; @@ -180,10 +178,6 @@ }; }; - dwmmc3@1223 { - status = disabled; - }; - spi_0: spi@12d2 { status = disabled; }; diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi index 1eec646..b1b6f61 100644 --- a/arch/arm/boot/dts/exynos5250.dtsi +++ b/arch/arm/boot/dts/exynos5250.dtsi @@ -387,21 +387,36 @@ }; dwmmc_0: dwmmc0@1220 { + compatible = samsung,exynos5250-dw-mshc; + interrupts = 0 75 0; + #address-cells = 1; + #size-cells = 0; reg = 0x1220 0x1000; clocks = clock 280, clock 139; clock-names = biu, ciu; + status = disabled; }; dwmmc_1: dwmmc1@1221 { + compatible = samsung,exynos5250-dw-mshc; + interrupts = 0 76 0; + #address-cells = 1; + #size-cells = 0; reg = 0x1221 0x1000; clocks = clock 281, clock 140; clock-names = biu, ciu; + status = disabled; }; dwmmc_2: dwmmc2@1222 { + compatible = samsung,exynos5250-dw-mshc; + interrupts = 0 77 0; + #address-cells = 1; + #size-cells = 0; reg = 0x1222 0x1000; clocks = clock 282, clock 141; clock-names = biu, ciu; + status = disabled; }; dwmmc_3: dwmmc3@1223 { @@ -412,6 +427,7 @@ #size-cells = 0; clocks = clock 283, clock 142; clock-names = biu, ciu; + status = disabled; }; i2s0: i2s@0383 { Looks Ok to me. Reviewed By: Girish K S ks.g...@samsung.com -- 1.7.9.5
[PATCH 1/2] ARM: dts: enable spi for EXYNOS5440 SOC
This patch enables the SPI in EXYNOS5440 SoC. The NOR Flash can be accessed by enabling the spi interface Signed-off-by: Girish K S ks.g...@samsung.com --- arch/arm/boot/dts/exynos5440-ssdk5440.dts | 39 +++- arch/arm/boot/dts/exynos5440.dtsi | 16 +++ 2 files changed, 47 insertions(+), 8 deletions(-) diff --git a/arch/arm/boot/dts/exynos5440-ssdk5440.dts b/arch/arm/boot/dts/exynos5440-ssdk5440.dts index d55042b..a85ac0e 100644 --- a/arch/arm/boot/dts/exynos5440-ssdk5440.dts +++ b/arch/arm/boot/dts/exynos5440-ssdk5440.dts @@ -20,8 +20,43 @@ bootargs = root=/dev/sda2 rw rootwait ignore_loglevel early_printk no_console_suspend mem=2048M@0x8000 console=ttySAC0,115200; }; - spi { - status = disabled; + spi_0: spi@D { + + flash: w25q128@0 { + #address-cells = 1; + #size-cells = 1; + compatible = winbond,w25q128; + spi-max-frequency = 15625000; + reg = 0; + controller-data { + samsung,spi-feedback-delay = 0; + }; + + partition@0 { + label = BootLoader; + reg = 0x6 0x8; + read-only; + }; + + partition@e { + label = Recovery-Kernel; + reg = 0xe 0x30; + read-only; + }; + + partition@3e { + label = CRAM-FS; + reg = 0x3e 0x70; + read-only; + }; + + partition@ae { + label = User-Data; + reg = 0xae 0x52; + }; + + }; + }; fixed-rate-clocks { diff --git a/arch/arm/boot/dts/exynos5440.dtsi b/arch/arm/boot/dts/exynos5440.dtsi index f6b1c89..7c5dc38 100644 --- a/arch/arm/boot/dts/exynos5440.dtsi +++ b/arch/arm/boot/dts/exynos5440.dtsi @@ -16,6 +16,10 @@ interrupt-parent = gic; + aliases { + spi0 = spi_0; + }; + clock: clock-controller@0x16 { compatible = samsung,exynos5440-clock; reg = 0x16 0x1000; @@ -101,15 +105,15 @@ clock-names = uart, clk_uart_baud0; }; - spi { - compatible = samsung,exynos4210-spi; - reg = 0xD 0x1000; + spi_0: spi@D { + compatible = samsung,exynos5440-spi; + reg = 0xD 0x100; interrupts = 0 4 0; - tx-dma-channel = pdma0 5; /* preliminary */ - rx-dma-channel = pdma0 4; /* preliminary */ #address-cells = 1; #size-cells = 0; - clocks = clock 21, clock 16; + samsung,spi-src-clk = 0; + num-cs = 1; + clocks = clock 8, clock 3; clock-names = spi, spi_busclk0; }; -- 1.7.5.4 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/2] ARM: dts: add dts node for the ahci sata exynos5440
This patch adds dts support for the sata controller Signed-off-by: Girish K S ks.g...@samsung.com --- arch/arm/boot/dts/exynos5440.dtsi |9 + 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/arch/arm/boot/dts/exynos5440.dtsi b/arch/arm/boot/dts/exynos5440.dtsi index 7c5dc38..2dc4ffa 100644 --- a/arch/arm/boot/dts/exynos5440.dtsi +++ b/arch/arm/boot/dts/exynos5440.dtsi @@ -220,4 +220,13 @@ clock-names = rtc; status = disabled; }; + + sata@21 { + compatible = samsung,exynos5440-ahci; + reg = 0x21 0x1; + interrupts = 0 30 0; + clocks = clock 10; + clock-names = sata; + }; + }; -- 1.7.5.4 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH V2 2/2] ARM: dts: add dts node for the ahci sata exynos5440
This patch adds dts support for the sata controller Signed-off-by: Girish K S ks.g...@samsung.com --- arch/arm/boot/dts/exynos5440.dtsi |9 + 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/arch/arm/boot/dts/exynos5440.dtsi b/arch/arm/boot/dts/exynos5440.dtsi index 7c5dc38..2dc4ffa 100644 --- a/arch/arm/boot/dts/exynos5440.dtsi +++ b/arch/arm/boot/dts/exynos5440.dtsi @@ -220,4 +220,13 @@ clock-names = rtc; status = disabled; }; + + sata@21 { + compatible = snps,exynos5440-ahci; + reg = 0x21 0x1; + interrupts = 0 30 0; + clocks = clock 10; + clock-names = sata; + }; + }; -- 1.7.5.4 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] mmc: dw_mmc: enable controller interrupt before calling mmc_start_host
On 8 October 2012 17:59, Yuvaraj CD yuvaraj...@gmail.com wrote: As mmc_start_host is getting called before enabling the dw_mmc controller interrupt, there is a problem of missing the SDMMC_INT_CMD_DONE for the very first command sent by the sdio_reset. This problem occurs only when we disable MMC debugging i.e, MMC_DEBUG [=n]. Hence this patch enables the dw_mmc controller interrupt before mmc_start_host. Signed-off-by: Yuvaraj CD yuvaraj...@samsung.com --- drivers/mmc/host/dw_mmc.c | 29 +++-- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index a23af77..729c031 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -2233,6 +2233,21 @@ int dw_mci_probe(struct dw_mci *host) else host-num_slots = ((mci_readl(host, HCON) 1) 0x1F) + 1; + /* +* Enable interrupts for command done, data over, data empty, card det, +* receive ready and error such as transmit, receive timeout, crc error +*/ + mci_writel(host, RINTSTS, 0x); + mci_writel(host, INTMASK, SDMMC_INT_CMD_DONE | SDMMC_INT_DATA_OVER | + SDMMC_INT_TXDR | SDMMC_INT_RXDR | + DW_MCI_ERROR_FLAGS | SDMMC_INT_CD); + mci_writel(host, CTRL, SDMMC_CTRL_INT_ENABLE); /* Enable mci interrupt */ + + dev_info(host-dev, DW MMC controller at irq %d, +%d bit host data width, +%u deep fifo\n, +host-irq, width, fifo_size); + Makes sense Reviewed By: Girish K S girish.shivananja...@linaro.org /* We need at least one slot to succeed */ for (i = 0; i host-num_slots; i++) { ret = dw_mci_init_slot(host, i); @@ -2262,20 +2277,6 @@ int dw_mci_probe(struct dw_mci *host) else host-data_offset = DATA_240A_OFFSET; - /* -* Enable interrupts for command done, data over, data empty, card det, -* receive ready and error such as transmit, receive timeout, crc error -*/ - mci_writel(host, RINTSTS, 0x); - mci_writel(host, INTMASK, SDMMC_INT_CMD_DONE | SDMMC_INT_DATA_OVER | - SDMMC_INT_TXDR | SDMMC_INT_RXDR | - DW_MCI_ERROR_FLAGS | SDMMC_INT_CD); - mci_writel(host, CTRL, SDMMC_CTRL_INT_ENABLE); /* Enable mci interrupt */ - - dev_info(host-dev, DW MMC controller at irq %d, -%d bit host data width, -%u deep fifo\n, -host-irq, width, fifo_size); if (host-quirks DW_MCI_QUIRK_IDMAC_DTO) dev_info(host-dev, Internal DMAC interrupt fix enabled.\n); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/3] mmc: sdhci-s3c: Enable only required bus clock
looks good Reviewed by: Girish KS girish.shivananja...@linaro.org On 14 September 2012 14:38, Chander Kashyap chander.kash...@linaro.org wrote: In case of multiple bus clock sources, all the clock sources were getting enabled. As only one clock source is needed at the time hence enable only the required bus clock. This patch does as follows: 1. In sdhci_s3c_probe enable only required bus clock source. 2. Handle the disabling of old bus clock and enables the best clock selected in sdhci_s3c_set_clock(). Signed-off-by: Chander Kashyap chander.kash...@linaro.org --- drivers/mmc/host/sdhci-s3c.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c index 00969ba..0cbb4c2 100644 --- a/drivers/mmc/host/sdhci-s3c.c +++ b/drivers/mmc/host/sdhci-s3c.c @@ -203,10 +203,12 @@ static void sdhci_s3c_set_clock(struct sdhci_host *host, unsigned int clock) best_src, clock, best); /* select the new clock source */ - if (ourhost-cur_clk != best_src) { struct clk *clk = ourhost-clk_bus[best_src]; + clk_enable(clk); + clk_disable(ourhost-clk_bus[ourhost-cur_clk]); + /* turn clock off to card before changing clock source */ writew(0, host-ioaddr + SDHCI_CLOCK_CONTROL); @@ -501,8 +503,6 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev) */ sc-cur_clk = ptr; - clk_enable(clk); - dev_info(dev, clock source %d: %s (%ld Hz)\n, ptr, name, clk_get_rate(clk)); } @@ -513,6 +513,8 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev) goto err_no_busclks; } + clk_enable(sc-clk_bus[sc-cur_clk]); + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); host-ioaddr = devm_request_and_ioremap(pdev-dev, res); if (!host-ioaddr) { @@ -621,9 +623,9 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev) return 0; err_req_regs: + clk_disable(sc-clk_bus[sc-cur_clk]); for (ptr = 0; ptr MAX_BUS_CLK; ptr++) { if (sc-clk_bus[ptr]) { - clk_disable(sc-clk_bus[ptr]); clk_put(sc-clk_bus[ptr]); } } @@ -658,9 +660,9 @@ static int __devexit sdhci_s3c_remove(struct platform_device *pdev) pm_runtime_disable(pdev-dev); + clk_disable(sc-clk_bus[sc-cur_clk]); for (ptr = 0; ptr 3; ptr++) { if (sc-clk_bus[ptr]) { - clk_disable(sc-clk_bus[ptr]); clk_put(sc-clk_bus[ptr]); } } -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/3] mmc: sdhci-s3c: Fix crash on module insertion for second time
good catch Reviewed by: Girish K S girish.shivananja...@linaro.org On 14 September 2012 14:38, Chander Kashyap chander.kash...@linaro.org wrote: If sdhci-s3c driver is built as module, it gives following error if inserted again after removing. This was happening as pm_runtime_use_autosuspend() is called in sdhci_s3c_probe() function but in sdhci_s3c_remove() its complementry pm_runtime_dont_use_autosuspend() is not called. BUG: spinlock bad magic on CPU#1, insmod/955 lock: 0xee771368, .magic: , .owner: insmod/955, .owner_cpu: 1 [c00147e0] (unwind_backtrace+0x0/0xf8) from [c0136b40] (do_raw_spin_unlock+0xa4/0xe4) [c0136b40] (do_raw_spin_unlock+0xa4/0xe4) from [c01be508] (_raw_spin_unlock_irqrestore+0xc/0x38) [c01be508] (_raw_spin_unlock_irqrestore+0xc/0x38) from [c01a9334] (sdhci_runtime_suspend_host+0x54/0x80) [c01a9334] (sdhci_runtime_suspend_host+0x54/0x80) from [bf0060a8] (sdhci_s3c_runtime_suspend+0x14/0x38 [sdhci_s3c]) [bf0060a8] (sdhci_s3c_runtime_suspend+0x14/0x38 [sdhci_s3c]) from [c016cb00] (pm_generic_runtime_suspend+0x2c/0x40) [c016cb00] (pm_generic_runtime_suspend+0x2c/0x40) from [c0170090] (__rpm_callback+0x70/0x98) [c0170090] (__rpm_callback+0x70/0x98) from [c01703f0] (rpm_suspend+0xf0/0x534) [c01703f0] (rpm_suspend+0xf0/0x534) from [c0171670] (__pm_runtime_suspend+0x5c/0x74) [c0171670] (__pm_runtime_suspend+0x5c/0x74) from [c016d018] (pm_generic_runtime_idle+0x44/0x4c) [c016d018] (pm_generic_runtime_idle+0x44/0x4c) from [c0170090] (__rpm_callback+0x70/0x98) [c0170090] (__rpm_callback+0x70/0x98) from [c0170984] (rpm_idle+0xdc/0x18c) [c0170984] (rpm_idle+0xdc/0x18c) from [c0171608] (pm_runtime_set_autosuspend_delay+0x30/0x3c) [c0171608] (pm_runtime_set_autosuspend_delay+0x30/0x3c) from [bf0069c4] (sdhci_s3c_probe+0x35c/0x52c [sdhci_s3c]) [bf0069c4] (sdhci_s3c_probe+0x35c/0x52c [sdhci_s3c]) from [c016a014] (platform_drv_probe+0x18/0x1c) Signed-off-by: Chander Kashyap chander.kash...@linaro.org --- drivers/mmc/host/sdhci-s3c.c |1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c index 0cbb4c2..3f4518d 100644 --- a/drivers/mmc/host/sdhci-s3c.c +++ b/drivers/mmc/host/sdhci-s3c.c @@ -658,6 +658,7 @@ static int __devexit sdhci_s3c_remove(struct platform_device *pdev) sdhci_remove_host(host, 1); + pm_runtime_dont_use_autosuspend(pdev-dev); pm_runtime_disable(pdev-dev); clk_disable(sc-clk_bus[sc-cur_clk]); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] mmc: dw_mmc: add busmode selection support
On 26 July 2012 11:30, Jaehoon Chung jh80.ch...@samsung.com wrote: Hi Girish, I re-tested the your patch. How about locating into dw_mci_setup_bus()? And if compare the previously and current busmode, I think host needs not to re-write at register. For example, if (slot-bus_mode == ios-bus_mode) return; Then this patch looks good to me. Thanks Jaehoon. I will try to test the same and let you know. if relocation is fine then i will send a patch Best Regards, Jaehoon Chung On 07/26/2012 12:41 PM, Girish K S wrote: On 24 July 2012 18:37, Jae hoon Chung jh80.ch...@gmail.com wrote: Hi Girish, Right, it be mentioned about the open-drain mode in synopsys spec. But if didn't work on other board, there is some problem. We can consider the location of set_busmode() . Sure. Currently i am setting the bus mode after sending the command during the clock setting. since the bus mode has affect on the cmd line i will try to move the location of calling bus mode before setting the clock. you can just check whether card gets detected by moving the set mode function just below the switch statement of bus width. On my board irrespective of the set bus mode location it works fine Best Regards, Jaehoon Chung 2012/7/24 Girish K S girish.shivananja...@linaro.org: On 24 July 2012 17:06, Girish K S girish.shivananja...@linaro.org wrote: On 24 July 2012 16:39, Jaehoon Chung jh80.ch...@samsung.com wrote: Hi Girish, Well..just tested on my board. this patch didn't work.(eMMC card didn't initialize) meaning of ios-bus_mode and synosys's bus_mode is same? Yes it is same. synopsys spec says this is specific to MMC initialization. when the card core sets this mode during initialization. the host has to set this bit How did you test this patch? Tested it on exynos5 board using dt patches of thomas (with some modification to his patch) Best Regards, Jaehoon Chung On 07/23/2012 08:16 PM, Girish K S wrote: Synopsis Designware host controller has suppport for open drain mode selection. During the mmc card initialization the host controller can select the open-drain bit to allow the device initialization in the open-drain mode. Once the device enters the standby mode this bit can be reset to enter push-pull mode. Signed-off-by: Girish K S girish.shivananja...@linaro.org --- drivers/mmc/host/dw_mmc.c | 14 ++ drivers/mmc/host/dw_mmc.h |1 + 2 files changed, 15 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 72dc3cd..da11e5a 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -773,6 +773,18 @@ static void dw_mci_request(struct mmc_host *mmc, struct mmc_request *mrq) spin_unlock_bh(host-lock); } +static void dw_mci_set_busmode(struct dw_mci_slot *slot) +{ + struct mmc_ios *ios = slot-mmc-ios; + u32 reg; + + reg = mci_readl(slot-host, CTRL); + if (ios-bus_mode == MMC_BUSMODE_OPENDRAIN) + mci_writel(slot-host, CTRL, reg | SDMMC_CTRL_ENABLE_OD); + else + mci_writel(slot-host, CTRL, reg ~SDMMC_CTRL_ENABLE_OD); +} + static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) { struct dw_mci_slot *slot = mmc_priv(mmc); @@ -818,6 +830,8 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) default: break; } + + dw_mci_set_busmode(slot); } static int dw_mci_get_ro(struct mmc_host *mmc) diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h index 15c27e1..1a53fb2 100644 --- a/drivers/mmc/host/dw_mmc.h +++ b/drivers/mmc/host/dw_mmc.h @@ -67,6 +67,7 @@ /* Control register defines */ #define SDMMC_CTRL_USE_IDMAC BIT(25) +#define SDMMC_CTRL_ENABLE_OD BIT(24) #define SDMMC_CTRL_CEATA_INT_EN BIT(11) #define SDMMC_CTRL_SEND_AS_CCSD BIT(10) #define SDMMC_CTRL_SEND_CCSD BIT(9) -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] mmc: dw_mmc: add busmode selection support
On 24 July 2012 19:14, Jae hoon Chung jh80.ch...@gmail.com wrote: 2012/7/24 Girish K S girish.shivananja...@linaro.org: On 24 July 2012 18:37, Jae hoon Chung jh80.ch...@gmail.com wrote: Hi Girish, Right, it be mentioned about the open-drain mode in synopsys spec. But if didn't work on other board, there is some problem. We can consider the location of set_busmode() . may i know the board on which you are testing. i will try to use the same and simulate the problem Exynos4 board and eMMC4.5 card, Synopsys IP version is 2.40a Just now i tested it on exynos4 board/ eMMC 4.4 card Synopsis 2.40a host controller. Everything works fine. this patch doesnt have any side effect on the exynos4 board please check from ur end. might be some other issue. Best Regards, Jaehoon Chung 2012/7/24 Girish K S girish.shivananja...@linaro.org: On 24 July 2012 17:06, Girish K S girish.shivananja...@linaro.org wrote: On 24 July 2012 16:39, Jaehoon Chung jh80.ch...@samsung.com wrote: Hi Girish, Well..just tested on my board. this patch didn't work.(eMMC card didn't initialize) meaning of ios-bus_mode and synosys's bus_mode is same? Yes it is same. synopsys spec says this is specific to MMC initialization. when the card core sets this mode during initialization. the host has to set this bit How did you test this patch? Tested it on exynos5 board using dt patches of thomas (with some modification to his patch) Best Regards, Jaehoon Chung On 07/23/2012 08:16 PM, Girish K S wrote: Synopsis Designware host controller has suppport for open drain mode selection. During the mmc card initialization the host controller can select the open-drain bit to allow the device initialization in the open-drain mode. Once the device enters the standby mode this bit can be reset to enter push-pull mode. Signed-off-by: Girish K S girish.shivananja...@linaro.org --- drivers/mmc/host/dw_mmc.c | 14 ++ drivers/mmc/host/dw_mmc.h |1 + 2 files changed, 15 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 72dc3cd..da11e5a 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -773,6 +773,18 @@ static void dw_mci_request(struct mmc_host *mmc, struct mmc_request *mrq) spin_unlock_bh(host-lock); } +static void dw_mci_set_busmode(struct dw_mci_slot *slot) +{ + struct mmc_ios *ios = slot-mmc-ios; + u32 reg; + + reg = mci_readl(slot-host, CTRL); + if (ios-bus_mode == MMC_BUSMODE_OPENDRAIN) + mci_writel(slot-host, CTRL, reg | SDMMC_CTRL_ENABLE_OD); + else + mci_writel(slot-host, CTRL, reg ~SDMMC_CTRL_ENABLE_OD); +} + static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) { struct dw_mci_slot *slot = mmc_priv(mmc); @@ -818,6 +830,8 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) default: break; } + + dw_mci_set_busmode(slot); } static int dw_mci_get_ro(struct mmc_host *mmc) diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h index 15c27e1..1a53fb2 100644 --- a/drivers/mmc/host/dw_mmc.h +++ b/drivers/mmc/host/dw_mmc.h @@ -67,6 +67,7 @@ /* Control register defines */ #define SDMMC_CTRL_USE_IDMAC BIT(25) +#define SDMMC_CTRL_ENABLE_OD BIT(24) #define SDMMC_CTRL_CEATA_INT_EN BIT(11) #define SDMMC_CTRL_SEND_AS_CCSD BIT(10) #define SDMMC_CTRL_SEND_CCSD BIT(9) -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] mmc: dw_mmc: add busmode selection support
On 24 July 2012 18:37, Jae hoon Chung jh80.ch...@gmail.com wrote: Hi Girish, Right, it be mentioned about the open-drain mode in synopsys spec. But if didn't work on other board, there is some problem. We can consider the location of set_busmode() . Sure. Currently i am setting the bus mode after sending the command during the clock setting. since the bus mode has affect on the cmd line i will try to move the location of calling bus mode before setting the clock. you can just check whether card gets detected by moving the set mode function just below the switch statement of bus width. On my board irrespective of the set bus mode location it works fine Best Regards, Jaehoon Chung 2012/7/24 Girish K S girish.shivananja...@linaro.org: On 24 July 2012 17:06, Girish K S girish.shivananja...@linaro.org wrote: On 24 July 2012 16:39, Jaehoon Chung jh80.ch...@samsung.com wrote: Hi Girish, Well..just tested on my board. this patch didn't work.(eMMC card didn't initialize) meaning of ios-bus_mode and synosys's bus_mode is same? Yes it is same. synopsys spec says this is specific to MMC initialization. when the card core sets this mode during initialization. the host has to set this bit How did you test this patch? Tested it on exynos5 board using dt patches of thomas (with some modification to his patch) Best Regards, Jaehoon Chung On 07/23/2012 08:16 PM, Girish K S wrote: Synopsis Designware host controller has suppport for open drain mode selection. During the mmc card initialization the host controller can select the open-drain bit to allow the device initialization in the open-drain mode. Once the device enters the standby mode this bit can be reset to enter push-pull mode. Signed-off-by: Girish K S girish.shivananja...@linaro.org --- drivers/mmc/host/dw_mmc.c | 14 ++ drivers/mmc/host/dw_mmc.h |1 + 2 files changed, 15 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 72dc3cd..da11e5a 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -773,6 +773,18 @@ static void dw_mci_request(struct mmc_host *mmc, struct mmc_request *mrq) spin_unlock_bh(host-lock); } +static void dw_mci_set_busmode(struct dw_mci_slot *slot) +{ + struct mmc_ios *ios = slot-mmc-ios; + u32 reg; + + reg = mci_readl(slot-host, CTRL); + if (ios-bus_mode == MMC_BUSMODE_OPENDRAIN) + mci_writel(slot-host, CTRL, reg | SDMMC_CTRL_ENABLE_OD); + else + mci_writel(slot-host, CTRL, reg ~SDMMC_CTRL_ENABLE_OD); +} + static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) { struct dw_mci_slot *slot = mmc_priv(mmc); @@ -818,6 +830,8 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) default: break; } + + dw_mci_set_busmode(slot); } static int dw_mci_get_ro(struct mmc_host *mmc) diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h index 15c27e1..1a53fb2 100644 --- a/drivers/mmc/host/dw_mmc.h +++ b/drivers/mmc/host/dw_mmc.h @@ -67,6 +67,7 @@ /* Control register defines */ #define SDMMC_CTRL_USE_IDMAC BIT(25) +#define SDMMC_CTRL_ENABLE_OD BIT(24) #define SDMMC_CTRL_CEATA_INT_EN BIT(11) #define SDMMC_CTRL_SEND_AS_CCSD BIT(10) #define SDMMC_CTRL_SEND_CCSD BIT(9) -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V2] mmc: dwmmc: Add quirk for broken Hardware Config
On 24 July 2012 10:48, Seungwon Jeon tgih@samsung.com wrote: Hi Girish, July 23, 2012, Girish K S girish.shivananja...@linaro.org wrote: In some Soc'S that integrate Designware mmc host controllers, the HCON register is broken. The hardware configuration is not updated. One specific usecase is the IDMAC. In Exysons5 SoC there exist a internal DMA, but the HCON register's DMA_INTERFACE field is not set to indicate its existance. This quirk can be used in such case to force the existance broken HCON field. changes in v2: -moved the implementation to quirk framework as per venkat's review comment. changes in v1: -modified the caps2 field access per controller index.Reported by Jaehoon Chung jh80.ch...@samsung.com. -replaced the pointer to device with the pointer to platform device in struct dw_mci. Change related to adding pointer of platform_device is needed in this patch seriously? I guess that the purpose is to get id of platform_device in case of non-dt. Although a lot of replace is done throughout dw_mmc, actual usage is only in dw_get_platform_device_id. You can split it into another patch if this change is needed, or it's good to use other way. For example, to_platform_device macro is useful to get pointer of platform_device. I will make the necessary changes as suggested once Thomas's patches gets accepted Best regards, Seungwon Jeon -updated driver data for all 4 mmc controllers of exynos5 SoC. -added non device-tree support for ctrl_id access. Signed-off-by: Girish K S girish.shivananja...@linaro.org --- drivers/mmc/host/dw_mmc-pltfm.c | 10 +++- drivers/mmc/host/dw_mmc.c | 151 --- drivers/mmc/host/dw_mmc.h |1 + include/linux/mmc/dw_mmc.h |4 +- 4 files changed, 107 insertions(+), 59 deletions(-) diff --git a/drivers/mmc/host/dw_mmc-pltfm.c b/drivers/mmc/host/dw_mmc-pltfm.c index 900f412..7d31e90 100644 --- a/drivers/mmc/host/dw_mmc-pltfm.c +++ b/drivers/mmc/host/dw_mmc-pltfm.c @@ -35,9 +35,17 @@ static unsigned long exynos5250_dwmmc_caps[4] = { MMC_CAP_CMD23, }; +static unsigned long exynos5250_dwmmc_quirks[4] = { + DW_MCI_QUIRK_NO_HCON_DMA_INFO, + DW_MCI_QUIRK_NO_HCON_DMA_INFO, + DW_MCI_QUIRK_NO_HCON_DMA_INFO, + DW_MCI_QUIRK_NO_HCON_DMA_INFO, +}; + static struct dw_mci_drv_data exynos5250_drv_data = { .ctrl_type = DW_MCI_TYPE_EXYNOS5250, .caps = exynos5250_dwmmc_caps, + .quirks = exynos5250_dwmmc_quirks, }; static const struct of_device_id dw_mci_pltfm_match[] = { @@ -74,7 +82,7 @@ static int dw_mci_pltfm_probe(struct platform_device *pdev) goto err_free; } - host-dev = pdev-dev; + host-pdev = pdev; host-irq_flags = 0; host-pdata = pdev-dev.platform_data; ret = -ENOMEM; diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 000da16..b32e200 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -283,8 +283,10 @@ static u32 dw_mci_prepare_command(struct mmc_host *mmc, struct mmc_command *cmd) static void dw_mci_start_command(struct dw_mci *host, struct mmc_command *cmd, u32 cmd_flags) { + struct device *dev = host-pdev-dev; + host-cmd = cmd; - dev_vdbg(host-dev, + dev_vdbg(dev, start command: ARGR=0x%08x CMDR=0x%08x\n, cmd-arg, cmd_flags); @@ -323,10 +325,11 @@ static int dw_mci_get_dma_dir(struct mmc_data *data) static void dw_mci_dma_cleanup(struct dw_mci *host) { struct mmc_data *data = host-data; + struct device *dev = host-pdev-dev; if (data) if (!data-host_cookie) - dma_unmap_sg(host-dev, + dma_unmap_sg(dev, data-sg, data-sg_len, dw_mci_get_dma_dir(data)); @@ -351,8 +354,9 @@ static void dw_mci_idmac_stop_dma(struct dw_mci *host) static void dw_mci_idmac_complete_dma(struct dw_mci *host) { struct mmc_data *data = host-data; + struct device *dev = host-pdev-dev; - dev_vdbg(host-dev, DMA complete\n); + dev_vdbg(dev, DMA complete\n); host-dma_ops-cleanup(host); @@ -420,10 +424,27 @@ static void dw_mci_idmac_start_dma(struct dw_mci *host, unsigned int sg_len) mci_writel(host, PLDMND, 1); } +static int dw_get_platform_device_id(struct dw_mci *host) +{ + int ctrl_id; + struct device *dev = host-pdev-dev; + + if (dev-of_node) + ctrl_id = of_alias_get_id(dev-of_node, mshc); + else + ctrl_id = host-pdev-id; + + if (ctrl_id 0) + ctrl_id = 0; + + return ctrl_id; +} + static int dw_mci_idmac_init(struct dw_mci *host) { struct idmac_desc
Re: [PATCH] mmc: dw_mmc: add busmode selection support
On 24 July 2012 16:39, Jaehoon Chung jh80.ch...@samsung.com wrote: Hi Girish, Well..just tested on my board. this patch didn't work.(eMMC card didn't initialize) meaning of ios-bus_mode and synosys's bus_mode is same? How did you test this patch? Tested it on exynos5 board using dt patches of thomas (with some modification to his patch) Best Regards, Jaehoon Chung On 07/23/2012 08:16 PM, Girish K S wrote: Synopsis Designware host controller has suppport for open drain mode selection. During the mmc card initialization the host controller can select the open-drain bit to allow the device initialization in the open-drain mode. Once the device enters the standby mode this bit can be reset to enter push-pull mode. Signed-off-by: Girish K S girish.shivananja...@linaro.org --- drivers/mmc/host/dw_mmc.c | 14 ++ drivers/mmc/host/dw_mmc.h |1 + 2 files changed, 15 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 72dc3cd..da11e5a 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -773,6 +773,18 @@ static void dw_mci_request(struct mmc_host *mmc, struct mmc_request *mrq) spin_unlock_bh(host-lock); } +static void dw_mci_set_busmode(struct dw_mci_slot *slot) +{ + struct mmc_ios *ios = slot-mmc-ios; + u32 reg; + + reg = mci_readl(slot-host, CTRL); + if (ios-bus_mode == MMC_BUSMODE_OPENDRAIN) + mci_writel(slot-host, CTRL, reg | SDMMC_CTRL_ENABLE_OD); + else + mci_writel(slot-host, CTRL, reg ~SDMMC_CTRL_ENABLE_OD); +} + static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) { struct dw_mci_slot *slot = mmc_priv(mmc); @@ -818,6 +830,8 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) default: break; } + + dw_mci_set_busmode(slot); } static int dw_mci_get_ro(struct mmc_host *mmc) diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h index 15c27e1..1a53fb2 100644 --- a/drivers/mmc/host/dw_mmc.h +++ b/drivers/mmc/host/dw_mmc.h @@ -67,6 +67,7 @@ /* Control register defines */ #define SDMMC_CTRL_USE_IDMAC BIT(25) +#define SDMMC_CTRL_ENABLE_OD BIT(24) #define SDMMC_CTRL_CEATA_INT_EN BIT(11) #define SDMMC_CTRL_SEND_AS_CCSD BIT(10) #define SDMMC_CTRL_SEND_CCSD BIT(9) -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] mmc: dw_mmc: add busmode selection support
On 24 July 2012 17:06, Girish K S girish.shivananja...@linaro.org wrote: On 24 July 2012 16:39, Jaehoon Chung jh80.ch...@samsung.com wrote: Hi Girish, Well..just tested on my board. this patch didn't work.(eMMC card didn't initialize) meaning of ios-bus_mode and synosys's bus_mode is same? Yes it is same. synopsys spec says this is specific to MMC initialization. when the card core sets this mode during initialization. the host has to set this bit How did you test this patch? Tested it on exynos5 board using dt patches of thomas (with some modification to his patch) Best Regards, Jaehoon Chung On 07/23/2012 08:16 PM, Girish K S wrote: Synopsis Designware host controller has suppport for open drain mode selection. During the mmc card initialization the host controller can select the open-drain bit to allow the device initialization in the open-drain mode. Once the device enters the standby mode this bit can be reset to enter push-pull mode. Signed-off-by: Girish K S girish.shivananja...@linaro.org --- drivers/mmc/host/dw_mmc.c | 14 ++ drivers/mmc/host/dw_mmc.h |1 + 2 files changed, 15 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 72dc3cd..da11e5a 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -773,6 +773,18 @@ static void dw_mci_request(struct mmc_host *mmc, struct mmc_request *mrq) spin_unlock_bh(host-lock); } +static void dw_mci_set_busmode(struct dw_mci_slot *slot) +{ + struct mmc_ios *ios = slot-mmc-ios; + u32 reg; + + reg = mci_readl(slot-host, CTRL); + if (ios-bus_mode == MMC_BUSMODE_OPENDRAIN) + mci_writel(slot-host, CTRL, reg | SDMMC_CTRL_ENABLE_OD); + else + mci_writel(slot-host, CTRL, reg ~SDMMC_CTRL_ENABLE_OD); +} + static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) { struct dw_mci_slot *slot = mmc_priv(mmc); @@ -818,6 +830,8 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) default: break; } + + dw_mci_set_busmode(slot); } static int dw_mci_get_ro(struct mmc_host *mmc) diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h index 15c27e1..1a53fb2 100644 --- a/drivers/mmc/host/dw_mmc.h +++ b/drivers/mmc/host/dw_mmc.h @@ -67,6 +67,7 @@ /* Control register defines */ #define SDMMC_CTRL_USE_IDMAC BIT(25) +#define SDMMC_CTRL_ENABLE_OD BIT(24) #define SDMMC_CTRL_CEATA_INT_EN BIT(11) #define SDMMC_CTRL_SEND_AS_CCSD BIT(10) #define SDMMC_CTRL_SEND_CCSD BIT(9) -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] mmc: dw_mmc: add busmode selection support
On 24 July 2012 18:37, Jae hoon Chung jh80.ch...@gmail.com wrote: Hi Girish, Right, it be mentioned about the open-drain mode in synopsys spec. But if didn't work on other board, there is some problem. We can consider the location of set_busmode() . may i know the board on which you are testing. i will try to use the same and simulate the problem Best Regards, Jaehoon Chung 2012/7/24 Girish K S girish.shivananja...@linaro.org: On 24 July 2012 17:06, Girish K S girish.shivananja...@linaro.org wrote: On 24 July 2012 16:39, Jaehoon Chung jh80.ch...@samsung.com wrote: Hi Girish, Well..just tested on my board. this patch didn't work.(eMMC card didn't initialize) meaning of ios-bus_mode and synosys's bus_mode is same? Yes it is same. synopsys spec says this is specific to MMC initialization. when the card core sets this mode during initialization. the host has to set this bit How did you test this patch? Tested it on exynos5 board using dt patches of thomas (with some modification to his patch) Best Regards, Jaehoon Chung On 07/23/2012 08:16 PM, Girish K S wrote: Synopsis Designware host controller has suppport for open drain mode selection. During the mmc card initialization the host controller can select the open-drain bit to allow the device initialization in the open-drain mode. Once the device enters the standby mode this bit can be reset to enter push-pull mode. Signed-off-by: Girish K S girish.shivananja...@linaro.org --- drivers/mmc/host/dw_mmc.c | 14 ++ drivers/mmc/host/dw_mmc.h |1 + 2 files changed, 15 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 72dc3cd..da11e5a 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -773,6 +773,18 @@ static void dw_mci_request(struct mmc_host *mmc, struct mmc_request *mrq) spin_unlock_bh(host-lock); } +static void dw_mci_set_busmode(struct dw_mci_slot *slot) +{ + struct mmc_ios *ios = slot-mmc-ios; + u32 reg; + + reg = mci_readl(slot-host, CTRL); + if (ios-bus_mode == MMC_BUSMODE_OPENDRAIN) + mci_writel(slot-host, CTRL, reg | SDMMC_CTRL_ENABLE_OD); + else + mci_writel(slot-host, CTRL, reg ~SDMMC_CTRL_ENABLE_OD); +} + static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) { struct dw_mci_slot *slot = mmc_priv(mmc); @@ -818,6 +830,8 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) default: break; } + + dw_mci_set_busmode(slot); } static int dw_mci_get_ro(struct mmc_host *mmc) diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h index 15c27e1..1a53fb2 100644 --- a/drivers/mmc/host/dw_mmc.h +++ b/drivers/mmc/host/dw_mmc.h @@ -67,6 +67,7 @@ /* Control register defines */ #define SDMMC_CTRL_USE_IDMAC BIT(25) +#define SDMMC_CTRL_ENABLE_OD BIT(24) #define SDMMC_CTRL_CEATA_INT_EN BIT(11) #define SDMMC_CTRL_SEND_AS_CCSD BIT(10) #define SDMMC_CTRL_SEND_CCSD BIT(9) -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] mmc: dw_mmc: add busmode selection support
Synopsis Designware host controller has suppport for open drain mode selection. During the mmc card initialization the host controller can select the open-drain bit to allow the device initialization in the open-drain mode. Once the device enters the standby mode this bit can be reset to enter push-pull mode. Signed-off-by: Girish K S girish.shivananja...@linaro.org --- drivers/mmc/host/dw_mmc.c | 14 ++ drivers/mmc/host/dw_mmc.h |1 + 2 files changed, 15 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 72dc3cd..da11e5a 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -773,6 +773,18 @@ static void dw_mci_request(struct mmc_host *mmc, struct mmc_request *mrq) spin_unlock_bh(host-lock); } +static void dw_mci_set_busmode(struct dw_mci_slot *slot) +{ + struct mmc_ios *ios = slot-mmc-ios; + u32 reg; + + reg = mci_readl(slot-host, CTRL); + if (ios-bus_mode == MMC_BUSMODE_OPENDRAIN) + mci_writel(slot-host, CTRL, reg | SDMMC_CTRL_ENABLE_OD); + else + mci_writel(slot-host, CTRL, reg ~SDMMC_CTRL_ENABLE_OD); +} + static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) { struct dw_mci_slot *slot = mmc_priv(mmc); @@ -818,6 +830,8 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) default: break; } + + dw_mci_set_busmode(slot); } static int dw_mci_get_ro(struct mmc_host *mmc) diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h index 15c27e1..1a53fb2 100644 --- a/drivers/mmc/host/dw_mmc.h +++ b/drivers/mmc/host/dw_mmc.h @@ -67,6 +67,7 @@ /* Control register defines */ #define SDMMC_CTRL_USE_IDMAC BIT(25) +#define SDMMC_CTRL_ENABLE_OD BIT(24) #define SDMMC_CTRL_CEATA_INT_ENBIT(11) #define SDMMC_CTRL_SEND_AS_CCSDBIT(10) #define SDMMC_CTRL_SEND_CCSD BIT(9) -- 1.7.4.1 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH V1] Add Quirk for Broken Configuration
This patch is based on the device tree support of dw_mmc host controller posted by Thomas Abraham. Below is the list of his patch in review stage mmc: dw_mmc: convert copy of struct device in struct dw_mci to a reference mmc: dw_mmc: allow probe to succeed even if one slot is initialized mmc: dw_mmc: lookup for optional biu and ciu clocks mmc: dw_mmc: add quirk to indicate missing write protect line mmc: dw_mmc: add device tree support mmc: dw_mmc: add samsung exynos5250 specific extentions Girish K S (1): mmc: dwmmc: Add quirk for broken Hardware Config drivers/mmc/host/dw_mmc-pltfm.c | 10 +++- drivers/mmc/host/dw_mmc.c | 151 --- drivers/mmc/host/dw_mmc.h |1 + include/linux/mmc/dw_mmc.h |4 +- 4 files changed, 107 insertions(+), 59 deletions(-) -- 1.7.4.1 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH V2] mmc: dwmmc: Add quirk for broken Hardware Config
In some Soc'S that integrate Designware mmc host controllers, the HCON register is broken. The hardware configuration is not updated. One specific usecase is the IDMAC. In Exysons5 SoC there exist a internal DMA, but the HCON register's DMA_INTERFACE field is not set to indicate its existance. This quirk can be used in such case to force the existance broken HCON field. changes in v2: -moved the implementation to quirk framework as per venkat's review comment. changes in v1: -modified the caps2 field access per controller index.Reported by Jaehoon Chung jh80.ch...@samsung.com. -replaced the pointer to device with the pointer to platform device in struct dw_mci. -updated driver data for all 4 mmc controllers of exynos5 SoC. -added non device-tree support for ctrl_id access. Signed-off-by: Girish K S girish.shivananja...@linaro.org --- drivers/mmc/host/dw_mmc-pltfm.c | 10 +++- drivers/mmc/host/dw_mmc.c | 151 --- drivers/mmc/host/dw_mmc.h |1 + include/linux/mmc/dw_mmc.h |4 +- 4 files changed, 107 insertions(+), 59 deletions(-) diff --git a/drivers/mmc/host/dw_mmc-pltfm.c b/drivers/mmc/host/dw_mmc-pltfm.c index 900f412..7d31e90 100644 --- a/drivers/mmc/host/dw_mmc-pltfm.c +++ b/drivers/mmc/host/dw_mmc-pltfm.c @@ -35,9 +35,17 @@ static unsigned long exynos5250_dwmmc_caps[4] = { MMC_CAP_CMD23, }; +static unsigned long exynos5250_dwmmc_quirks[4] = { + DW_MCI_QUIRK_NO_HCON_DMA_INFO, + DW_MCI_QUIRK_NO_HCON_DMA_INFO, + DW_MCI_QUIRK_NO_HCON_DMA_INFO, + DW_MCI_QUIRK_NO_HCON_DMA_INFO, +}; + static struct dw_mci_drv_data exynos5250_drv_data = { .ctrl_type = DW_MCI_TYPE_EXYNOS5250, .caps = exynos5250_dwmmc_caps, + .quirks = exynos5250_dwmmc_quirks, }; static const struct of_device_id dw_mci_pltfm_match[] = { @@ -74,7 +82,7 @@ static int dw_mci_pltfm_probe(struct platform_device *pdev) goto err_free; } - host-dev = pdev-dev; + host-pdev = pdev; host-irq_flags = 0; host-pdata = pdev-dev.platform_data; ret = -ENOMEM; diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 000da16..b32e200 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -283,8 +283,10 @@ static u32 dw_mci_prepare_command(struct mmc_host *mmc, struct mmc_command *cmd) static void dw_mci_start_command(struct dw_mci *host, struct mmc_command *cmd, u32 cmd_flags) { + struct device *dev = host-pdev-dev; + host-cmd = cmd; - dev_vdbg(host-dev, + dev_vdbg(dev, start command: ARGR=0x%08x CMDR=0x%08x\n, cmd-arg, cmd_flags); @@ -323,10 +325,11 @@ static int dw_mci_get_dma_dir(struct mmc_data *data) static void dw_mci_dma_cleanup(struct dw_mci *host) { struct mmc_data *data = host-data; + struct device *dev = host-pdev-dev; if (data) if (!data-host_cookie) - dma_unmap_sg(host-dev, + dma_unmap_sg(dev, data-sg, data-sg_len, dw_mci_get_dma_dir(data)); @@ -351,8 +354,9 @@ static void dw_mci_idmac_stop_dma(struct dw_mci *host) static void dw_mci_idmac_complete_dma(struct dw_mci *host) { struct mmc_data *data = host-data; + struct device *dev = host-pdev-dev; - dev_vdbg(host-dev, DMA complete\n); + dev_vdbg(dev, DMA complete\n); host-dma_ops-cleanup(host); @@ -420,10 +424,27 @@ static void dw_mci_idmac_start_dma(struct dw_mci *host, unsigned int sg_len) mci_writel(host, PLDMND, 1); } +static int dw_get_platform_device_id(struct dw_mci *host) +{ + int ctrl_id; + struct device *dev = host-pdev-dev; + + if (dev-of_node) + ctrl_id = of_alias_get_id(dev-of_node, mshc); + else + ctrl_id = host-pdev-id; + + if (ctrl_id 0) + ctrl_id = 0; + + return ctrl_id; +} + static int dw_mci_idmac_init(struct dw_mci *host) { struct idmac_desc *p; int i, dma_support; + struct device *dev = host-pdev-dev; /* Number of descriptors in the ring buffer */ host-ring_size = PAGE_SIZE / sizeof(struct idmac_desc); @@ -431,14 +452,20 @@ static int dw_mci_idmac_init(struct dw_mci *host) /* Check if Hardware Configuration Register has support for DMA */ dma_support = (mci_readl(host, HCON) 16) 0x3; - if (!dma_support || dma_support 2) { - dev_err(host-dev, + /* +* In Some of the Soc's the HCON Register is broken. Even though the +* Soc's has a internal DMA the HCON register's DMA field doesnt +* show it. So additional quirk is added for such Soc's
[PATCH V2] Add Quirk for Broken Configuration
This patch is based on the device tree support of dw_mmc host controller posted by Thomas Abraham. Below is the list of his patch in review stage mmc: dw_mmc: convert copy of struct device in struct dw_mci to a reference mmc: dw_mmc: allow probe to succeed even if one slot is initialized mmc: dw_mmc: lookup for optional biu and ciu clocks mmc: dw_mmc: add quirk to indicate missing write protect line mmc: dw_mmc: add device tree support mmc: dw_mmc: add samsung exynos5250 specific extentions Girish K S (1): mmc: dwmmc: Add quirk for broken Hardware Config drivers/mmc/host/dw_mmc-pltfm.c | 10 +++- drivers/mmc/host/dw_mmc.c | 151 --- drivers/mmc/host/dw_mmc.h |1 + include/linux/mmc/dw_mmc.h |4 +- 4 files changed, 107 insertions(+), 59 deletions(-) -- 1.7.4.1 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V1] mmc: dwmmc: Add quirk for broken Hardware Config
Any other feedback on this? On 18 July 2012 14:08, Girish K S girish.shivananja...@linaro.org wrote: In some Soc'S that integrate Designware mmc host controllers, the HCON register is broken. The hardware configuration is not updated. One specific usecase is the IDMAC. In Exysons5 SoC there exist a internal DMA, but the HCON register's DMA_INTERFACE field is not set to indicate its existance. This quirk can be used in such case to force the existance broken HCON field. changes in v1: -modified the caps2 field access per controller index.Reported by Jaehoon Chung jh80.ch...@samsung.com. -replaced the pointer to device with the pointer to platform device in struct dw_mci. -updated driver data for all 4 mmc controllers of exynos5 SoC. -added non device-tree support for ctrl_id access. Signed-off-by: Girish K S girish.shivananja...@linaro.org --- drivers/mmc/host/dw_mmc-pltfm.c | 10 +++- drivers/mmc/host/dw_mmc.c | 150 --- drivers/mmc/host/dw_mmc.h |1 + include/linux/mmc/dw_mmc.h |2 +- include/linux/mmc/host.h|1 + 5 files changed, 106 insertions(+), 58 deletions(-) diff --git a/drivers/mmc/host/dw_mmc-pltfm.c b/drivers/mmc/host/dw_mmc-pltfm.c index 900f412..c8eb573 100644 --- a/drivers/mmc/host/dw_mmc-pltfm.c +++ b/drivers/mmc/host/dw_mmc-pltfm.c @@ -35,9 +35,17 @@ static unsigned long exynos5250_dwmmc_caps[4] = { MMC_CAP_CMD23, }; +static unsigned long exynos5250_dwmmc_caps2[4] = { + MMC_CAP2_CONFIG_BROKEN, + MMC_CAP2_CONFIG_BROKEN, + MMC_CAP2_CONFIG_BROKEN, + MMC_CAP2_CONFIG_BROKEN, +}; + static struct dw_mci_drv_data exynos5250_drv_data = { .ctrl_type = DW_MCI_TYPE_EXYNOS5250, .caps = exynos5250_dwmmc_caps, + .caps2 = exynos5250_dwmmc_caps2, }; static const struct of_device_id dw_mci_pltfm_match[] = { @@ -74,7 +82,7 @@ static int dw_mci_pltfm_probe(struct platform_device *pdev) goto err_free; } - host-dev = pdev-dev; + host-pdev = pdev; host-irq_flags = 0; host-pdata = pdev-dev.platform_data; ret = -ENOMEM; diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 000da16..fd9233d 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -283,8 +283,10 @@ static u32 dw_mci_prepare_command(struct mmc_host *mmc, struct mmc_command *cmd) static void dw_mci_start_command(struct dw_mci *host, struct mmc_command *cmd, u32 cmd_flags) { + struct device *dev = host-pdev-dev; + host-cmd = cmd; - dev_vdbg(host-dev, + dev_vdbg(dev, start command: ARGR=0x%08x CMDR=0x%08x\n, cmd-arg, cmd_flags); @@ -323,10 +325,11 @@ static int dw_mci_get_dma_dir(struct mmc_data *data) static void dw_mci_dma_cleanup(struct dw_mci *host) { struct mmc_data *data = host-data; + struct device *dev = host-pdev-dev; if (data) if (!data-host_cookie) - dma_unmap_sg(host-dev, + dma_unmap_sg(dev, data-sg, data-sg_len, dw_mci_get_dma_dir(data)); @@ -351,8 +354,9 @@ static void dw_mci_idmac_stop_dma(struct dw_mci *host) static void dw_mci_idmac_complete_dma(struct dw_mci *host) { struct mmc_data *data = host-data; + struct device *dev = host-pdev-dev; - dev_vdbg(host-dev, DMA complete\n); + dev_vdbg(dev, DMA complete\n); host-dma_ops-cleanup(host); @@ -420,10 +424,27 @@ static void dw_mci_idmac_start_dma(struct dw_mci *host, unsigned int sg_len) mci_writel(host, PLDMND, 1); } +static int dw_get_platform_device_id(struct dw_mci *host) +{ + int ctrl_id; + struct device *dev = host-pdev-dev; + + if (dev-of_node) + ctrl_id = of_alias_get_id(dev-of_node, mshc); + else + ctrl_id = host-pdev-id; + + if (ctrl_id 0) + ctrl_id = 0; + + return ctrl_id; +} + static int dw_mci_idmac_init(struct dw_mci *host) { struct idmac_desc *p; - int i, dma_support; + int i, dma_support, ctrl_id; + struct device *dev = host-pdev-dev; /* Number of descriptors in the ring buffer */ host-ring_size = PAGE_SIZE / sizeof(struct idmac_desc); @@ -431,14 +452,23 @@ static int dw_mci_idmac_init(struct dw_mci *host) /* Check if Hardware Configuration Register has support for DMA */ dma_support = (mci_readl(host, HCON) 16) 0x3; - if (!dma_support || dma_support 2) { - dev_err(host-dev, + /* +* In Some of the Soc's the HCON Register is broken. Even
Re: [PATCH V1] mmc: dwmmc: Add quirk for broken Hardware Config
On 18 July 2012 18:25, S, Venkatraman svenk...@ti.com wrote: On Wed, Jul 18, 2012 at 2:08 PM, Girish K S girish.shivananja...@linaro.org wrote: In some Soc'S that integrate Designware mmc host controllers, the HCON register is broken. The hardware configuration is not updated. One specific usecase is the IDMAC. In Exysons5 SoC there exist a internal DMA, but the HCON register's DMA_INTERFACE field is not set to indicate its existance. This quirk can be used in such case to force the existance broken HCON field. changes in v1: -modified the caps2 field access per controller index.Reported by Jaehoon Chung jh80.ch...@samsung.com. -replaced the pointer to device with the pointer to platform device in struct dw_mci. -updated driver data for all 4 mmc controllers of exynos5 SoC. -added non device-tree support for ctrl_id access. Signed-off-by: Girish K S girish.shivananja...@linaro.org --- drivers/mmc/host/dw_mmc-pltfm.c | 10 +++- drivers/mmc/host/dw_mmc.c | 150 --- drivers/mmc/host/dw_mmc.h |1 + include/linux/mmc/dw_mmc.h |2 +- include/linux/mmc/host.h|1 + 5 files changed, 106 insertions(+), 58 deletions(-) diff --git a/drivers/mmc/host/dw_mmc-pltfm.c b/drivers/mmc/host/dw_mmc-pltfm.c index 900f412..c8eb573 100644 --- a/drivers/mmc/host/dw_mmc-pltfm.c +++ b/drivers/mmc/host/dw_mmc-pltfm.c @@ -35,9 +35,17 @@ static unsigned long exynos5250_dwmmc_caps[4] = { MMC_CAP_CMD23, }; +static unsigned long exynos5250_dwmmc_caps2[4] = { + MMC_CAP2_CONFIG_BROKEN, + MMC_CAP2_CONFIG_BROKEN, + MMC_CAP2_CONFIG_BROKEN, + MMC_CAP2_CONFIG_BROKEN, +}; + static struct dw_mci_drv_data exynos5250_drv_data = { .ctrl_type = DW_MCI_TYPE_EXYNOS5250, .caps = exynos5250_dwmmc_caps, + .caps2 = exynos5250_dwmmc_caps2, }; static const struct of_device_id dw_mci_pltfm_match[] = { @@ -74,7 +82,7 @@ static int dw_mci_pltfm_probe(struct platform_device *pdev) goto err_free; } - host-dev = pdev-dev; + host-pdev = pdev; host-irq_flags = 0; host-pdata = pdev-dev.platform_data; ret = -ENOMEM; diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 000da16..fd9233d 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -283,8 +283,10 @@ static u32 dw_mci_prepare_command(struct mmc_host *mmc, struct mmc_command *cmd) static void dw_mci_start_command(struct dw_mci *host, struct mmc_command *cmd, u32 cmd_flags) { + struct device *dev = host-pdev-dev; + host-cmd = cmd; - dev_vdbg(host-dev, + dev_vdbg(dev, start command: ARGR=0x%08x CMDR=0x%08x\n, cmd-arg, cmd_flags); @@ -323,10 +325,11 @@ static int dw_mci_get_dma_dir(struct mmc_data *data) static void dw_mci_dma_cleanup(struct dw_mci *host) { struct mmc_data *data = host-data; + struct device *dev = host-pdev-dev; if (data) if (!data-host_cookie) - dma_unmap_sg(host-dev, + dma_unmap_sg(dev, data-sg, data-sg_len, dw_mci_get_dma_dir(data)); @@ -351,8 +354,9 @@ static void dw_mci_idmac_stop_dma(struct dw_mci *host) static void dw_mci_idmac_complete_dma(struct dw_mci *host) { struct mmc_data *data = host-data; + struct device *dev = host-pdev-dev; - dev_vdbg(host-dev, DMA complete\n); + dev_vdbg(dev, DMA complete\n); host-dma_ops-cleanup(host); @@ -420,10 +424,27 @@ static void dw_mci_idmac_start_dma(struct dw_mci *host, unsigned int sg_len) mci_writel(host, PLDMND, 1); } +static int dw_get_platform_device_id(struct dw_mci *host) +{ + int ctrl_id; + struct device *dev = host-pdev-dev; + + if (dev-of_node) + ctrl_id = of_alias_get_id(dev-of_node, mshc); + else + ctrl_id = host-pdev-id; + + if (ctrl_id 0) + ctrl_id = 0; + + return ctrl_id; +} + static int dw_mci_idmac_init(struct dw_mci *host) { struct idmac_desc *p; - int i, dma_support; + int i, dma_support, ctrl_id; + struct device *dev = host-pdev-dev; /* Number of descriptors in the ring buffer */ host-ring_size = PAGE_SIZE / sizeof(struct idmac_desc); @@ -431,14 +452,23 @@ static int dw_mci_idmac_init(struct dw_mci *host) /* Check if Hardware Configuration Register has support for DMA */ dma_support = (mci_readl(host, HCON) 16) 0x3; - if (!dma_support || dma_support 2) { - dev_err(host-dev, + /* +* In Some
Re: [PATCH] mmc: dwmmc: Add quirk for broken Hardware Config
On 17 July 2012 13:16, Jaehoon Chung jh80.ch...@samsung.com wrote: Hi Girish, On 07/16/2012 05:45 PM, Girish K S wrote: In some Soc'S that integrate Designware mmc host controllers, the HCON register is broken. The hardware configuration is not updated. One specific usecase is the IDMAC. In Exysons5 SoC there exist a internal DMA, but the HCON register's DMA_INTERFACE field is not set to indicate its existance. This quirk can be used in such case to force the existance broken HCON field. Signed-off-by: Girish K S girish.shivananja...@linaro.org --- drivers/mmc/host/dw_mmc-pltfm.c |5 + drivers/mmc/host/dw_mmc.c | 11 ++- drivers/mmc/host/dw_mmc.h |1 + include/linux/mmc/host.h|1 + 4 files changed, 17 insertions(+), 1 deletions(-) diff --git a/drivers/mmc/host/dw_mmc-pltfm.c b/drivers/mmc/host/dw_mmc-pltfm.c index 900f412..24ea485 100644 --- a/drivers/mmc/host/dw_mmc-pltfm.c +++ b/drivers/mmc/host/dw_mmc-pltfm.c @@ -35,9 +35,14 @@ static unsigned long exynos5250_dwmmc_caps[4] = { MMC_CAP_CMD23, }; +static unsigned long exynos5250_dwmmc_caps2[1] = { + MMC_CAP2_CONFIG_BROKEN, +}; + static struct dw_mci_drv_data exynos5250_drv_data = { .ctrl_type = DW_MCI_TYPE_EXYNOS5250, .caps = exynos5250_dwmmc_caps, + .caps2 = exynos5250_dwmmc_caps2, }; static const struct of_device_id dw_mci_pltfm_match[] = { diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 1a59a92..030224c 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -431,7 +431,13 @@ static int dw_mci_idmac_init(struct dw_mci *host) /* Check if Hardware Configuration Register has support for DMA */ dma_support = (mci_readl(host, HCON) 16) 0x3; - if (!dma_support || dma_support 2) { + /* + * In Some of the Soc's the HCON Register is broken. Even though the + * Soc's has a internal DMA the HCON register's DMA field doesnt + * show it. So additional quirk is added for such Soc's + */ + if ((!dma_support || dma_support 2) + !((u32)host-drv_data-caps2 MMC_CAP2_CONFIG_BROKEN)) { Just caps2? if use the device tree, need to get ctrl_id? ctrl id is available for exynos5 in the parent structure of caps2. I think device tree will be used to only get the platform related information. The platform information that dwmmc expects is only the compatible string. The quirk information is part of the driver data. And the caps2 is embedded inside the driver data. In the above case. IDMAC init is called in probe for every instance of the host controller. It didn't work.. I tested it for exynos5. There is no issue. dev_err(host-dev, Host Controller does not support IDMA Tx.\n); host-dma_ops = NULL; @@ -1957,6 +1963,9 @@ static int __init dw_mci_init_slot(struct dw_mci *host, unsigned int id) if (host-pdata-caps2) mmc-caps2 = host-pdata-caps2; + if (host-drv_data-caps2) + mmc-caps2 |= host-drv_data-caps2[ctrl_id]; + if (host-pdata-get_bus_wd) { if (host-pdata-get_bus_wd(slot-id) = 4) mmc-caps |= MMC_CAP_4_BIT_DATA; diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h index 6c17282..8c4810a 100644 --- a/drivers/mmc/host/dw_mmc.h +++ b/drivers/mmc/host/dw_mmc.h @@ -203,6 +203,7 @@ extern int dw_mci_resume(struct dw_mci *host); struct dw_mci_drv_data { unsigned long ctrl_type; unsigned long *caps; + unsigned long *caps2; }; #endif /* _DW_MMC_H_ */ diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 65c64ee..ab5c7f9 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -261,6 +261,7 @@ struct mmc_host { #define MMC_CAP2_HC_ERASE_SZ (1 9)/* High-capacity erase size */ #define MMC_CAP2_CD_ACTIVE_HIGH (1 10) /* Card-detect signal active high */ #define MMC_CAP2_RO_ACTIVE_HIGH (1 11) /* Write-protect signal active high */ +#define MMC_CAP2_CONFIG_BROKEN (1 12) /* Broken Config Register */ mmc_pm_flag_t pm_caps;/* supported pm features */ unsigned intpower_notify_type; -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] mmc: dwmmc: Add quirk for broken Hardware Config
On 17 July 2012 15:18, Jaehoon Chung jh80.ch...@samsung.com wrote: On 07/17/2012 06:17 PM, Girish K S wrote: On 17 July 2012 13:16, Jaehoon Chung jh80.ch...@samsung.com wrote: Hi Girish, On 07/16/2012 05:45 PM, Girish K S wrote: In some Soc'S that integrate Designware mmc host controllers, the HCON register is broken. The hardware configuration is not updated. One specific usecase is the IDMAC. In Exysons5 SoC there exist a internal DMA, but the HCON register's DMA_INTERFACE field is not set to indicate its existance. This quirk can be used in such case to force the existance broken HCON field. Signed-off-by: Girish K S girish.shivananja...@linaro.org --- drivers/mmc/host/dw_mmc-pltfm.c |5 + drivers/mmc/host/dw_mmc.c | 11 ++- drivers/mmc/host/dw_mmc.h |1 + include/linux/mmc/host.h|1 + 4 files changed, 17 insertions(+), 1 deletions(-) diff --git a/drivers/mmc/host/dw_mmc-pltfm.c b/drivers/mmc/host/dw_mmc-pltfm.c index 900f412..24ea485 100644 --- a/drivers/mmc/host/dw_mmc-pltfm.c +++ b/drivers/mmc/host/dw_mmc-pltfm.c @@ -35,9 +35,14 @@ static unsigned long exynos5250_dwmmc_caps[4] = { MMC_CAP_CMD23, }; +static unsigned long exynos5250_dwmmc_caps2[1] = { + MMC_CAP2_CONFIG_BROKEN, +}; + static struct dw_mci_drv_data exynos5250_drv_data = { .ctrl_type = DW_MCI_TYPE_EXYNOS5250, .caps = exynos5250_dwmmc_caps, + .caps2 = exynos5250_dwmmc_caps2, }; static const struct of_device_id dw_mci_pltfm_match[] = { diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 1a59a92..030224c 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -431,7 +431,13 @@ static int dw_mci_idmac_init(struct dw_mci *host) /* Check if Hardware Configuration Register has support for DMA */ dma_support = (mci_readl(host, HCON) 16) 0x3; - if (!dma_support || dma_support 2) { + /* + * In Some of the Soc's the HCON Register is broken. Even though the + * Soc's has a internal DMA the HCON register's DMA field doesnt + * show it. So additional quirk is added for such Soc's + */ + if ((!dma_support || dma_support 2) + !((u32)host-drv_data-caps2 MMC_CAP2_CONFIG_BROKEN)) { Just caps2? if use the device tree, need to get ctrl_id? but i found one thing. I have initialized only one channel. are you mentioning to initialize all 4 channels of exynos5 You're defined unsigned long *caps2..host-drv_data-caps2?? what's value? .caps2 = exynos5250_dwmmc_caps2 and static unsigned long exynos5250_dwmmc_caps2[1] = { MMC_CAP2_CONFIG_BROKEN, }; hope i answered it It didn't work.. dev_err(host-dev, Host Controller does not support IDMA Tx.\n); host-dma_ops = NULL; @@ -1957,6 +1963,9 @@ static int __init dw_mci_init_slot(struct dw_mci *host, unsigned int id) if (host-pdata-caps2) mmc-caps2 = host-pdata-caps2; + if (host-drv_data-caps2) + mmc-caps2 |= host-drv_data-caps2[ctrl_id]; + if (host-pdata-get_bus_wd) { if (host-pdata-get_bus_wd(slot-id) = 4) mmc-caps |= MMC_CAP_4_BIT_DATA; diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h index 6c17282..8c4810a 100644 --- a/drivers/mmc/host/dw_mmc.h +++ b/drivers/mmc/host/dw_mmc.h @@ -203,6 +203,7 @@ extern int dw_mci_resume(struct dw_mci *host); struct dw_mci_drv_data { unsigned long ctrl_type; unsigned long *caps; + unsigned long *caps2; }; #endif /* _DW_MMC_H_ */ diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 65c64ee..ab5c7f9 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -261,6 +261,7 @@ struct mmc_host { #define MMC_CAP2_HC_ERASE_SZ (1 9)/* High-capacity erase size */ #define MMC_CAP2_CD_ACTIVE_HIGH (1 10) /* Card-detect signal active high */ #define MMC_CAP2_RO_ACTIVE_HIGH (1 11) /* Write-protect signal active high */ +#define MMC_CAP2_CONFIG_BROKEN (1 12) /* Broken Config Register */ mmc_pm_flag_t pm_caps;/* supported pm features */ unsigned intpower_notify_type; -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] mmc: dwmmc: Add quirk for broken Hardware Config
On 17 July 2012 13:16, Jaehoon Chung jh80.ch...@samsung.com wrote: Hi Girish, On 07/16/2012 05:45 PM, Girish K S wrote: In some Soc'S that integrate Designware mmc host controllers, the HCON register is broken. The hardware configuration is not updated. One specific usecase is the IDMAC. In Exysons5 SoC there exist a internal DMA, but the HCON register's DMA_INTERFACE field is not set to indicate its existance. This quirk can be used in such case to force the existance broken HCON field. Signed-off-by: Girish K S girish.shivananja...@linaro.org --- drivers/mmc/host/dw_mmc-pltfm.c |5 + drivers/mmc/host/dw_mmc.c | 11 ++- drivers/mmc/host/dw_mmc.h |1 + include/linux/mmc/host.h|1 + 4 files changed, 17 insertions(+), 1 deletions(-) diff --git a/drivers/mmc/host/dw_mmc-pltfm.c b/drivers/mmc/host/dw_mmc-pltfm.c index 900f412..24ea485 100644 --- a/drivers/mmc/host/dw_mmc-pltfm.c +++ b/drivers/mmc/host/dw_mmc-pltfm.c @@ -35,9 +35,14 @@ static unsigned long exynos5250_dwmmc_caps[4] = { MMC_CAP_CMD23, }; +static unsigned long exynos5250_dwmmc_caps2[1] = { + MMC_CAP2_CONFIG_BROKEN, +}; + static struct dw_mci_drv_data exynos5250_drv_data = { .ctrl_type = DW_MCI_TYPE_EXYNOS5250, .caps = exynos5250_dwmmc_caps, + .caps2 = exynos5250_dwmmc_caps2, }; static const struct of_device_id dw_mci_pltfm_match[] = { diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 1a59a92..030224c 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -431,7 +431,13 @@ static int dw_mci_idmac_init(struct dw_mci *host) /* Check if Hardware Configuration Register has support for DMA */ dma_support = (mci_readl(host, HCON) 16) 0x3; - if (!dma_support || dma_support 2) { + /* + * In Some of the Soc's the HCON Register is broken. Even though the + * Soc's has a internal DMA the HCON register's DMA field doesnt + * show it. So additional quirk is added for such Soc's + */ + if ((!dma_support || dma_support 2) + !((u32)host-drv_data-caps2 MMC_CAP2_CONFIG_BROKEN)) { Just caps2? if use the device tree, need to get ctrl_id? did you mean host-drv_data-caps2[ctrl_id]. Sorry my mistake i ll change it It didn't work.. dev_err(host-dev, Host Controller does not support IDMA Tx.\n); host-dma_ops = NULL; @@ -1957,6 +1963,9 @@ static int __init dw_mci_init_slot(struct dw_mci *host, unsigned int id) if (host-pdata-caps2) mmc-caps2 = host-pdata-caps2; + if (host-drv_data-caps2) + mmc-caps2 |= host-drv_data-caps2[ctrl_id]; + if (host-pdata-get_bus_wd) { if (host-pdata-get_bus_wd(slot-id) = 4) mmc-caps |= MMC_CAP_4_BIT_DATA; diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h index 6c17282..8c4810a 100644 --- a/drivers/mmc/host/dw_mmc.h +++ b/drivers/mmc/host/dw_mmc.h @@ -203,6 +203,7 @@ extern int dw_mci_resume(struct dw_mci *host); struct dw_mci_drv_data { unsigned long ctrl_type; unsigned long *caps; + unsigned long *caps2; }; #endif /* _DW_MMC_H_ */ diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 65c64ee..ab5c7f9 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -261,6 +261,7 @@ struct mmc_host { #define MMC_CAP2_HC_ERASE_SZ (1 9)/* High-capacity erase size */ #define MMC_CAP2_CD_ACTIVE_HIGH (1 10) /* Card-detect signal active high */ #define MMC_CAP2_RO_ACTIVE_HIGH (1 11) /* Write-protect signal active high */ +#define MMC_CAP2_CONFIG_BROKEN (1 12) /* Broken Config Register */ mmc_pm_flag_t pm_caps;/* supported pm features */ unsigned intpower_notify_type; -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] mmc: dwmmc: Add quirk for broken Hardware Config
On 17 July 2012 15:43, Jaehoon Chung jh80.ch...@samsung.com wrote: Hi Girish.. i tested with your patch and applied the device tree patch. But i found the didn't compare with the MMC_CAP2_CONFIG_BROKEN. I think that host-drv_data-caps2 just denote address. So if running the your code, Maybe it's compared like 0xc02a6e54 0x1000. Is it wrong? i got your point Thanks for pointing it. Best Regards, Jaehoon Chung On 07/17/2012 06:54 PM, Girish K S wrote: On 17 July 2012 15:18, Jaehoon Chung jh80.ch...@samsung.com wrote: On 07/17/2012 06:17 PM, Girish K S wrote: On 17 July 2012 13:16, Jaehoon Chung jh80.ch...@samsung.com wrote: Hi Girish, On 07/16/2012 05:45 PM, Girish K S wrote: In some Soc'S that integrate Designware mmc host controllers, the HCON register is broken. The hardware configuration is not updated. One specific usecase is the IDMAC. In Exysons5 SoC there exist a internal DMA, but the HCON register's DMA_INTERFACE field is not set to indicate its existance. This quirk can be used in such case to force the existance broken HCON field. Signed-off-by: Girish K S girish.shivananja...@linaro.org --- drivers/mmc/host/dw_mmc-pltfm.c |5 + drivers/mmc/host/dw_mmc.c | 11 ++- drivers/mmc/host/dw_mmc.h |1 + include/linux/mmc/host.h|1 + 4 files changed, 17 insertions(+), 1 deletions(-) diff --git a/drivers/mmc/host/dw_mmc-pltfm.c b/drivers/mmc/host/dw_mmc-pltfm.c index 900f412..24ea485 100644 --- a/drivers/mmc/host/dw_mmc-pltfm.c +++ b/drivers/mmc/host/dw_mmc-pltfm.c @@ -35,9 +35,14 @@ static unsigned long exynos5250_dwmmc_caps[4] = { MMC_CAP_CMD23, }; +static unsigned long exynos5250_dwmmc_caps2[1] = { + MMC_CAP2_CONFIG_BROKEN, +}; + static struct dw_mci_drv_data exynos5250_drv_data = { .ctrl_type = DW_MCI_TYPE_EXYNOS5250, .caps = exynos5250_dwmmc_caps, + .caps2 = exynos5250_dwmmc_caps2, }; static const struct of_device_id dw_mci_pltfm_match[] = { diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 1a59a92..030224c 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -431,7 +431,13 @@ static int dw_mci_idmac_init(struct dw_mci *host) /* Check if Hardware Configuration Register has support for DMA */ dma_support = (mci_readl(host, HCON) 16) 0x3; - if (!dma_support || dma_support 2) { + /* + * In Some of the Soc's the HCON Register is broken. Even though the + * Soc's has a internal DMA the HCON register's DMA field doesnt + * show it. So additional quirk is added for such Soc's + */ + if ((!dma_support || dma_support 2) + !((u32)host-drv_data-caps2 MMC_CAP2_CONFIG_BROKEN)) { Just caps2? if use the device tree, need to get ctrl_id? but i found one thing. I have initialized only one channel. are you mentioning to initialize all 4 channels of exynos5 You're defined unsigned long *caps2..host-drv_data-caps2?? what's value? .caps2 = exynos5250_dwmmc_caps2 and static unsigned long exynos5250_dwmmc_caps2[1] = { MMC_CAP2_CONFIG_BROKEN, }; hope i answered it It didn't work.. dev_err(host-dev, Host Controller does not support IDMA Tx.\n); host-dma_ops = NULL; @@ -1957,6 +1963,9 @@ static int __init dw_mci_init_slot(struct dw_mci *host, unsigned int id) if (host-pdata-caps2) mmc-caps2 = host-pdata-caps2; + if (host-drv_data-caps2) + mmc-caps2 |= host-drv_data-caps2[ctrl_id]; + if (host-pdata-get_bus_wd) { if (host-pdata-get_bus_wd(slot-id) = 4) mmc-caps |= MMC_CAP_4_BIT_DATA; diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h index 6c17282..8c4810a 100644 --- a/drivers/mmc/host/dw_mmc.h +++ b/drivers/mmc/host/dw_mmc.h @@ -203,6 +203,7 @@ extern int dw_mci_resume(struct dw_mci *host); struct dw_mci_drv_data { unsigned long ctrl_type; unsigned long *caps; + unsigned long *caps2; }; #endif /* _DW_MMC_H_ */ diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 65c64ee..ab5c7f9 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -261,6 +261,7 @@ struct mmc_host { #define MMC_CAP2_HC_ERASE_SZ (1 9)/* High-capacity erase size */ #define MMC_CAP2_CD_ACTIVE_HIGH (1 10) /* Card-detect signal active high */ #define MMC_CAP2_RO_ACTIVE_HIGH (1 11) /* Write-protect signal active high */ +#define MMC_CAP2_CONFIG_BROKEN (1 12) /* Broken Config Register */ mmc_pm_flag_t pm_caps;/* supported pm features */ unsigned intpower_notify_type; -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More
Re: [PATCH] mmc: core: skip mmc_power_up call from start host
On 17 July 2012 16:22, S, Venkatraman svenk...@ti.com wrote: On Fri, Jul 13, 2012 at 6:27 PM, Girish K S girish.shivananja...@linaro.org wrote: The call to the mmc_power_up during the mmc_start_host breaks the card detection in design-ware host controller. This patch removes the call to mmc_power_up function during host start. Please explain why. Which commit introduced it ? dw_mmc card detection is broken by this commit fa5501890d8974301042e0202d342a6cbe8609f4 This fix works fine with sdhci (sdhci compatilble host controller) and dw_mmc (design-ware host controller). and has no side effect due to this removal. How can you be sure ? What about other hosts ? I have tested on the available host controllers. It would be helpful if others test it and let me know whether this change of mine causes any problem. -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] mmc: dwmmc: Add quirk for broken Hardware Config
In some Soc'S that integrate Designware mmc host controllers, the HCON register is broken. The hardware configuration is not updated. One specific usecase is the IDMAC. In Exysons5 SoC there exist a internal DMA, but the HCON register's DMA_INTERFACE field is not set to indicate its existance. This quirk can be used in such case to force the existance broken HCON field. Signed-off-by: Girish K S girish.shivananja...@linaro.org --- drivers/mmc/host/dw_mmc-pltfm.c |5 + drivers/mmc/host/dw_mmc.c | 11 ++- drivers/mmc/host/dw_mmc.h |1 + include/linux/mmc/host.h|1 + 4 files changed, 17 insertions(+), 1 deletions(-) diff --git a/drivers/mmc/host/dw_mmc-pltfm.c b/drivers/mmc/host/dw_mmc-pltfm.c index 900f412..24ea485 100644 --- a/drivers/mmc/host/dw_mmc-pltfm.c +++ b/drivers/mmc/host/dw_mmc-pltfm.c @@ -35,9 +35,14 @@ static unsigned long exynos5250_dwmmc_caps[4] = { MMC_CAP_CMD23, }; +static unsigned long exynos5250_dwmmc_caps2[1] = { + MMC_CAP2_CONFIG_BROKEN, +}; + static struct dw_mci_drv_data exynos5250_drv_data = { .ctrl_type = DW_MCI_TYPE_EXYNOS5250, .caps = exynos5250_dwmmc_caps, + .caps2 = exynos5250_dwmmc_caps2, }; static const struct of_device_id dw_mci_pltfm_match[] = { diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 1a59a92..030224c 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -431,7 +431,13 @@ static int dw_mci_idmac_init(struct dw_mci *host) /* Check if Hardware Configuration Register has support for DMA */ dma_support = (mci_readl(host, HCON) 16) 0x3; - if (!dma_support || dma_support 2) { + /* +* In Some of the Soc's the HCON Register is broken. Even though the +* Soc's has a internal DMA the HCON register's DMA field doesnt +* show it. So additional quirk is added for such Soc's +*/ + if ((!dma_support || dma_support 2) + !((u32)host-drv_data-caps2 MMC_CAP2_CONFIG_BROKEN)) { dev_err(host-dev, Host Controller does not support IDMA Tx.\n); host-dma_ops = NULL; @@ -1957,6 +1963,9 @@ static int __init dw_mci_init_slot(struct dw_mci *host, unsigned int id) if (host-pdata-caps2) mmc-caps2 = host-pdata-caps2; + if (host-drv_data-caps2) + mmc-caps2 |= host-drv_data-caps2[ctrl_id]; + if (host-pdata-get_bus_wd) { if (host-pdata-get_bus_wd(slot-id) = 4) mmc-caps |= MMC_CAP_4_BIT_DATA; diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h index 6c17282..8c4810a 100644 --- a/drivers/mmc/host/dw_mmc.h +++ b/drivers/mmc/host/dw_mmc.h @@ -203,6 +203,7 @@ extern int dw_mci_resume(struct dw_mci *host); struct dw_mci_drv_data { unsigned long ctrl_type; unsigned long *caps; + unsigned long *caps2; }; #endif /* _DW_MMC_H_ */ diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 65c64ee..ab5c7f9 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -261,6 +261,7 @@ struct mmc_host { #define MMC_CAP2_HC_ERASE_SZ (1 9)/* High-capacity erase size */ #define MMC_CAP2_CD_ACTIVE_HIGH(1 10) /* Card-detect signal active high */ #define MMC_CAP2_RO_ACTIVE_HIGH(1 11) /* Write-protect signal active high */ +#define MMC_CAP2_CONFIG_BROKEN (1 12) /* Broken Config Register */ mmc_pm_flag_t pm_caps;/* supported pm features */ unsigned intpower_notify_type; -- 1.7.4.1 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] mmc: dwmmc: Add quirk for broken Hardware Config
On 16 July 2012 14:15, Girish K S girish.shivananja...@linaro.org wrote: In some Soc'S that integrate Designware mmc host controllers, the HCON register is broken. The hardware configuration is not updated. One specific usecase is the IDMAC. In Exysons5 SoC there exist a internal DMA, but the HCON register's DMA_INTERFACE field is not set to indicate its existance. This quirk can be used in such case to force the existance broken HCON field. Signed-off-by: Girish K S girish.shivananja...@linaro.org --- This patch is based on Thomas Abraham's patch series for device tree support drivers/mmc/host/dw_mmc-pltfm.c |5 + drivers/mmc/host/dw_mmc.c | 11 ++- drivers/mmc/host/dw_mmc.h |1 + include/linux/mmc/host.h|1 + 4 files changed, 17 insertions(+), 1 deletions(-) diff --git a/drivers/mmc/host/dw_mmc-pltfm.c b/drivers/mmc/host/dw_mmc-pltfm.c index 900f412..24ea485 100644 --- a/drivers/mmc/host/dw_mmc-pltfm.c +++ b/drivers/mmc/host/dw_mmc-pltfm.c @@ -35,9 +35,14 @@ static unsigned long exynos5250_dwmmc_caps[4] = { MMC_CAP_CMD23, }; +static unsigned long exynos5250_dwmmc_caps2[1] = { + MMC_CAP2_CONFIG_BROKEN, +}; + static struct dw_mci_drv_data exynos5250_drv_data = { .ctrl_type = DW_MCI_TYPE_EXYNOS5250, .caps = exynos5250_dwmmc_caps, + .caps2 = exynos5250_dwmmc_caps2, }; static const struct of_device_id dw_mci_pltfm_match[] = { diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 1a59a92..030224c 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -431,7 +431,13 @@ static int dw_mci_idmac_init(struct dw_mci *host) /* Check if Hardware Configuration Register has support for DMA */ dma_support = (mci_readl(host, HCON) 16) 0x3; - if (!dma_support || dma_support 2) { + /* +* In Some of the Soc's the HCON Register is broken. Even though the +* Soc's has a internal DMA the HCON register's DMA field doesnt +* show it. So additional quirk is added for such Soc's +*/ + if ((!dma_support || dma_support 2) + !((u32)host-drv_data-caps2 MMC_CAP2_CONFIG_BROKEN)) { dev_err(host-dev, Host Controller does not support IDMA Tx.\n); host-dma_ops = NULL; @@ -1957,6 +1963,9 @@ static int __init dw_mci_init_slot(struct dw_mci *host, unsigned int id) if (host-pdata-caps2) mmc-caps2 = host-pdata-caps2; + if (host-drv_data-caps2) + mmc-caps2 |= host-drv_data-caps2[ctrl_id]; + if (host-pdata-get_bus_wd) { if (host-pdata-get_bus_wd(slot-id) = 4) mmc-caps |= MMC_CAP_4_BIT_DATA; diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h index 6c17282..8c4810a 100644 --- a/drivers/mmc/host/dw_mmc.h +++ b/drivers/mmc/host/dw_mmc.h @@ -203,6 +203,7 @@ extern int dw_mci_resume(struct dw_mci *host); struct dw_mci_drv_data { unsigned long ctrl_type; unsigned long *caps; + unsigned long *caps2; }; #endif /* _DW_MMC_H_ */ diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 65c64ee..ab5c7f9 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -261,6 +261,7 @@ struct mmc_host { #define MMC_CAP2_HC_ERASE_SZ (1 9)/* High-capacity erase size */ #define MMC_CAP2_CD_ACTIVE_HIGH(1 10) /* Card-detect signal active high */ #define MMC_CAP2_RO_ACTIVE_HIGH(1 11) /* Write-protect signal active high */ +#define MMC_CAP2_CONFIG_BROKEN (1 12) /* Broken Config Register */ mmc_pm_flag_t pm_caps;/* supported pm features */ unsigned intpower_notify_type; -- 1.7.4.1 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 5/6] mmc: dw_mmc: add device tree support
On 12 July 2012 18:24, Thomas Abraham thomas.abra...@linaro.org wrote: Add device tree based discovery support. Signed-off-by: Thomas Abraham thomas.abra...@linaro.org --- .../devicetree/bindings/mmc/synposis-dw-mshc.txt | 108 +++ drivers/mmc/host/dw_mmc-pltfm.c| 24 +++ drivers/mmc/host/dw_mmc.c | 201 +++- drivers/mmc/host/dw_mmc.h |9 + include/linux/mmc/dw_mmc.h |2 + 5 files changed, 338 insertions(+), 6 deletions(-) create mode 100644 Documentation/devicetree/bindings/mmc/synposis-dw-mshc.txt diff --git a/Documentation/devicetree/bindings/mmc/synposis-dw-mshc.txt b/Documentation/devicetree/bindings/mmc/synposis-dw-mshc.txt new file mode 100644 index 000..3acd6c9 --- /dev/null +++ b/Documentation/devicetree/bindings/mmc/synposis-dw-mshc.txt @@ -0,0 +1,108 @@ +* Synopsis Designware Mobile Storage Host Controller + +The Synopsis designware mobile storage host controller is used to interface +a SoC with storage medium such as eMMC or SD/MMC cards. + +Required Properties: + +* compatible: should be one of the following + - snps,dw-mshc: for controllers compliant with synopsis dw-mshc. + +* reg: physical base address of the dw-mshc controller and size of its memory + region. + +* interrupts: interrupt specifier for the controller. The format and value of + the interrupt specifier depends on the interrupt parent for the controller. + +* #address-cells: should be 1. + +* #size-cells: should be 0. + +# Slots: The slot specific information are contained within child-nodes with + each child-node representing a supported slot. There should be atleast one + child node representing a card slot. The name of the child node representing + the slot is recommended to be slot@n where n is the unique number of the slot + connnected to the controller. The following are optional properties which + can be included in the slot child node. + + * reg: specifies the physical slot number. The valid values of this + property is 0 to (num-slots -1), where num-slots is the value + specified by the num-slots property. + + * bus-width: specifies the width of the data bus connected from the + controller to the card slot. The value should be 1, 4 or 8. In case + this property is not specified, a default value of 1 is assumed for + this property. + + * cd-gpios: specifies the card detect gpio line. The format of the + gpio specifier depends on the gpio controller. + + * wp-gpios: specifies the write protect gpio line. The format of the + gpio specifier depends on the gpio controller. + + * gpios: specifies a list of gpios used for command, clock and data + bus. The first gpio is the command line and the second gpio is the + clock line. The rest of the gpios (depending on the bus-width + property) are the data lines in no particular order. The format of + the gpio specifier depends on the gpio controller. + +Optional properties: + +* num-slots: specifies the number of slots supported by the controller. + The number of physical slots actually used could be equal or less than the + value specified by num-slots. If this property is not specified, the value + of num-slot property is assumed to be 1. + +* fifo-depth: The maximum size of the tx/rx fifo's. If this property is not + specified, the default value of the fifo size is determined from the + controller registers. + +* card-detect-delay: Delay in milli-seconds before detecting card after card + insert event. The default value is 0. + +* supports-highspeed: Enables support for high speed cards (upto 50MHz) + +* card-detection-broken: The card detection functionality is not available on + any of the slots. + +* no-write-protect: The write protect pad of the controller is not connected + to the write protect pin on the slot. + +Aliases: + +- All the MSHC controller nodes should be represented in the aliases node using + the following format 'mshc{n}' where n is a unique number for the alias. + + +Example: + + The MSHC controller node can be split into two portions, SoC specific and + board specific portions as listed below. + + dwmmc0@1220 { + compatible = snps,dw-mshc; + reg = 0x1220 0x1000; + interrupts = 0 75 0; + #address-cells = 1; + #size-cells = 0; + }; + + dwmmc0@1220 { + num-slots = 1; + supports-highspeed; + card-detection-broken; + no-write-protect; + fifo-depth = 0x80; + card-detect-delay = 200; + + slot@0 { + reg = 0; + bus-width = 8;
Re: [PATCH v3 5/6] mmc: dw_mmc: add device tree support
On 16 July 2012 09:45, Girish K S girish.shivananja...@linaro.org wrote: On 12 July 2012 18:24, Thomas Abraham thomas.abra...@linaro.org wrote: Add device tree based discovery support. Signed-off-by: Thomas Abraham thomas.abra...@linaro.org --- .../devicetree/bindings/mmc/synposis-dw-mshc.txt | 108 +++ drivers/mmc/host/dw_mmc-pltfm.c| 24 +++ drivers/mmc/host/dw_mmc.c | 201 +++- drivers/mmc/host/dw_mmc.h |9 + include/linux/mmc/dw_mmc.h |2 + 5 files changed, 338 insertions(+), 6 deletions(-) create mode 100644 Documentation/devicetree/bindings/mmc/synposis-dw-mshc.txt diff --git a/Documentation/devicetree/bindings/mmc/synposis-dw-mshc.txt b/Documentation/devicetree/bindings/mmc/synposis-dw-mshc.txt new file mode 100644 index 000..3acd6c9 --- /dev/null +++ b/Documentation/devicetree/bindings/mmc/synposis-dw-mshc.txt @@ -0,0 +1,108 @@ +* Synopsis Designware Mobile Storage Host Controller + +The Synopsis designware mobile storage host controller is used to interface +a SoC with storage medium such as eMMC or SD/MMC cards. + +Required Properties: + +* compatible: should be one of the following + - snps,dw-mshc: for controllers compliant with synopsis dw-mshc. + +* reg: physical base address of the dw-mshc controller and size of its memory + region. + +* interrupts: interrupt specifier for the controller. The format and value of + the interrupt specifier depends on the interrupt parent for the controller. + +* #address-cells: should be 1. + +* #size-cells: should be 0. + +# Slots: The slot specific information are contained within child-nodes with + each child-node representing a supported slot. There should be atleast one + child node representing a card slot. The name of the child node representing + the slot is recommended to be slot@n where n is the unique number of the slot + connnected to the controller. The following are optional properties which + can be included in the slot child node. + + * reg: specifies the physical slot number. The valid values of this + property is 0 to (num-slots -1), where num-slots is the value + specified by the num-slots property. + + * bus-width: specifies the width of the data bus connected from the + controller to the card slot. The value should be 1, 4 or 8. In case + this property is not specified, a default value of 1 is assumed for + this property. + + * cd-gpios: specifies the card detect gpio line. The format of the + gpio specifier depends on the gpio controller. + + * wp-gpios: specifies the write protect gpio line. The format of the + gpio specifier depends on the gpio controller. + + * gpios: specifies a list of gpios used for command, clock and data + bus. The first gpio is the command line and the second gpio is the + clock line. The rest of the gpios (depending on the bus-width + property) are the data lines in no particular order. The format of + the gpio specifier depends on the gpio controller. + +Optional properties: + +* num-slots: specifies the number of slots supported by the controller. + The number of physical slots actually used could be equal or less than the + value specified by num-slots. If this property is not specified, the value + of num-slot property is assumed to be 1. + +* fifo-depth: The maximum size of the tx/rx fifo's. If this property is not + specified, the default value of the fifo size is determined from the + controller registers. + +* card-detect-delay: Delay in milli-seconds before detecting card after card + insert event. The default value is 0. + +* supports-highspeed: Enables support for high speed cards (upto 50MHz) + +* card-detection-broken: The card detection functionality is not available on + any of the slots. + +* no-write-protect: The write protect pad of the controller is not connected + to the write protect pin on the slot. + +Aliases: + +- All the MSHC controller nodes should be represented in the aliases node using + the following format 'mshc{n}' where n is a unique number for the alias. + + +Example: + + The MSHC controller node can be split into two portions, SoC specific and + board specific portions as listed below. + + dwmmc0@1220 { + compatible = snps,dw-mshc; + reg = 0x1220 0x1000; + interrupts = 0 75 0; + #address-cells = 1; + #size-cells = 0; + }; + + dwmmc0@1220 { + num-slots = 1; + supports-highspeed; + card-detection-broken; + no-write-protect; + fifo-depth = 0x80; + card-detect-delay = 200
Re: [PATCH v3 3/6] mmc: dw_mmc: lookup for optional biu and ciu clocks
On 12 July 2012 18:24, Thomas Abraham thomas.abra...@linaro.org wrote: Some platforms allow for clock gating and control of bus interface unit clock and card interface unit clock. Add support for clock lookup of optional biu and ciu clocks for clock gating and clock speed determination. Signed-off-by: Abhilash Kesavan a.kesa...@samsung.com Signed-off-by: Thomas Abraham thomas.abra...@linaro.org --- drivers/mmc/host/dw_mmc.c | 42 +++--- include/linux/mmc/dw_mmc.h |4 2 files changed, 43 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index cd58063..679473c 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -1953,18 +1953,38 @@ int dw_mci_probe(struct dw_mci *host) return -ENODEV; } - if (!host-pdata-bus_hz) { + host-biu_clk = clk_get(host-dev, biu); + if (IS_ERR(host-biu_clk)) + dev_dbg(host-dev, biu clock not available\n); + else + clk_prepare_enable(host-biu_clk); + + host-ciu_clk = clk_get(host-dev, ciu); + if (IS_ERR(host-ciu_clk)) + dev_dbg(host-dev, ciu clock not available\n); + else + clk_prepare_enable(host-ciu_clk); + + if (IS_ERR(host-ciu_clk)) + host-bus_hz = host-pdata-bus_hz; + else + host-bus_hz = clk_get_rate(host-ciu_clk); + + if (!host-bus_hz) { dev_err(host-dev, Platform data must supply bus speed\n); - return -ENODEV; + ret = -ENODEV; + goto err_clk; } - host-bus_hz = host-pdata-bus_hz; host-quirks = host-pdata-quirks; spin_lock_init(host-lock); INIT_LIST_HEAD(host-queue); + host-dma_ops = host-pdata-dma_ops; + dw_mci_init_dma(host); This initialization is already done. + /* * Get the host data width - this assumes that HCON has been set with * the correct values. @@ -2109,6 +2129,16 @@ err_dmaunmap: regulator_disable(host-vmmc); regulator_put(host-vmmc); } + +err_clk: + if (!IS_ERR(host-ciu_clk)) { + clk_disable_unprepare(host-ciu_clk); + clk_put(host-ciu_clk); + } + if (!IS_ERR(host-biu_clk)) { + clk_disable_unprepare(host-biu_clk); + clk_put(host-biu_clk); + } return ret; } EXPORT_SYMBOL(dw_mci_probe); @@ -2142,6 +2172,12 @@ void dw_mci_remove(struct dw_mci *host) regulator_put(host-vmmc); } + if (!IS_ERR(host-ciu_clk)) + clk_disable_unprepare(host-ciu_clk); + if (!IS_ERR(host-biu_clk)) + clk_disable_unprepare(host-biu_clk); + clk_put(host-ciu_clk); + clk_put(host-biu_clk); } EXPORT_SYMBOL(dw_mci_remove); diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h index a37a573..787ad56 100644 --- a/include/linux/mmc/dw_mmc.h +++ b/include/linux/mmc/dw_mmc.h @@ -78,6 +78,8 @@ struct mmc_data; * @data_offset: Set the offset of DATA register according to VERID. * @dev: Device associated with the MMC controller. * @pdata: Platform data associated with the MMC controller. + * @biu_clk: Pointer to bus interface unit clock instance. + * @ciu_clk: Pointer to card interface unit clock instance. * @slot: Slots sharing this MMC controller. * @fifo_depth: depth of FIFO. * @data_shift: log2 of FIFO item size. @@ -158,6 +160,8 @@ struct dw_mci { u16 data_offset; struct device *dev; struct dw_mci_board *pdata; + struct clk *biu_clk; + struct clk *ciu_clk; struct dw_mci_slot *slot[MAX_MCI_SLOTS]; /* FIFO push and pull */ -- 1.6.6.rc2 -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] mmc: core: skip mmc_power_up call from start host
The call to the mmc_power_up during the mmc_start_host breaks the card detection in design-ware host controller. This patch removes the call to mmc_power_up function during host start. This fix works fine with sdhci (sdhci compatilble host controller) and dw_mmc (design-ware host controller). and has no side effect due to this removal. Tested on : origen-board and smdk-5250 board. Signed-off-by: Girish K S girish.shivananja...@linaro.org Cc: Ulf Hansson ulf.hans...@linaro.org --- drivers/mmc/core/core.c |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 9503cab..503aefc 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -2108,7 +2108,6 @@ void mmc_start_host(struct mmc_host *host) { host-f_init = max(freqs[0], host-f_min); host-rescan_disable = 0; - mmc_power_up(host); mmc_detect_change(host, 0); } -- 1.7.4.1 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V2] mmc: core: Add host capability check for power class
On 29 March 2012 11:17, Girish K S girish.shivananja...@linaro.org wrote: On 28 March 2012 16:39, Subhash Jadavani subha...@codeaurora.org wrote: -Original Message- From: linux-mmc-ow...@vger.kernel.org [mailto:linux-mmc- ow...@vger.kernel.org] On Behalf Of Saugata Das Sent: Thursday, December 15, 2011 6:35 PM To: Girish K S Cc: linux-...@vger.kernel.org; patc...@linaro.org; linux-samsung- s...@vger.kernel.org; subha...@codeaurora.org; Chris Ball Subject: Re: [PATCH V2] mmc: core: Add host capability check for power class On 15 December 2011 16:22, Girish K S girish.shivananja...@linaro.org wrote: On 15 December 2011 15:34, Saugata Das saugata@linaro.org wrote: On 15 December 2011 09:28, Girish K S girish.shivananja...@linaro.org wrote: This patch adds a check whether the host supports maximum current value obtained from the device's extended csd register for a selected interface voltage and frequency. cc: Chris Ball c...@laptop.org Signed-off-by: Girish K S girish.shivananja...@linaro.org --- Changes in v2: deleted a unnecessary if else condition identified by subhash J Changes in v1: reduced the number of comparisons as per Hein's suggestion drivers/mmc/core/mmc.c | 19 +++ include/linux/mmc/card.h | 4 2 files changed, 23 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 006e932..b9ef777 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -688,6 +688,25 @@ static int mmc_select_powerclass(struct mmc_card *card, pwrclass_val = (pwrclass_val EXT_CSD_PWR_CL_4BIT_MASK) EXT_CSD_PWR_CL_4BIT_SHIFT; + if (pwrclass_val = MMC_MAX_CURRENT_800) + pwrclass_val = MMC_MAX_CURRENT_800; + else if (pwrclass_val = MMC_MAX_CURRENT_600) + pwrclass_val = MMC_MAX_CURRENT_600; + else if (pwrclass_val = MMC_MAX_CURRENT_400) + pwrclass_val = MMC_MAX_CURRENT_400; + else + pwrclass_val = MMC_MAX_CURRENT_200; + + if ((pwrclass_val == MMC_MAX_CURRENT_800) + !(card-host-caps MMC_CAP_MAX_CURRENT_800)) + pwrclass_val = MMC_MAX_CURRENT_600; + if ((pwrclass_val == MMC_MAX_CURRENT_600) + !(card-host-caps MMC_CAP_MAX_CURRENT_600)) + pwrclass_val = MMC_MAX_CURRENT_400; + if ((pwrclass_val == MMC_MAX_CURRENT_400) + !(card-host-caps MMC_CAP_MAX_CURRENT_400)) + pwrclass_val = MMC_MAX_CURRENT_200; + /* If the power class is different from the default value */ if (pwrclass_val 0) { err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, It is not allowed to set the POWER_CLASS with any value other than what is mentioned in the PWR_CL_ff_vvv or PWR_CL_DDR_ff_vvv for the corresponding frequency, voltage. That is, if PWR_CL_200_195 is 14 and we want to operate at HS200 then the only value allowed for POWER_CLASS is 14. So, we need to check the PWR_CL numbers and choose the operating mode (HS200/DDR50/..) based on the platform capability to support the current consumption and set the corresponding POWER_CLASS value. Please refer to section 6.6.5 of the 4.5 spec. The upstreamed code reads the extended csd value based on the already set voltage level and frequency of host. So it will get the required power class value which can be set directly. Is my understanding correct? It is not enough to just check the voltage level and frequency. Consider this example, host has capability to support MMC_CAP_MAX_CURRENT_400, the PWR_CL_DDR_52_360 has the value 9 (400mA) and PWR_CL_200_360 has the value 14 (800mA). Then even though the host might be capable to run 200MHz clock and 3.6V, it can only enable DDR at 52MHz and set 9 in POWER_CLASS. I think, in mmc_select_powerclass, we need to loop through the power classes of all supported modes of transfer (HS200, DDR52, ... ) and choose the mode which gives maximum bandwidth but falls within host capability of current consumption. Then set this to POWER_CLASS byte and also use the same information when setting HS_TIMING in mmc_init_card. Hi Saugata, Does the spec mandates you to set the power class to what is needed by frequency/voltage combination? I can't see that mentioned anywhere explicitly in eMMC4.5 spec (if it is mentioned in spec, please let me know section and line number). It may be still possible to set the power class lower than what is needed by frequency/voltage combination. Say for example, 8-bit HS200 (200MHz) with high voltage cards may specify power class (PWR_CL_200_3_6) value of 14 (800 mA) but that doesn't mean if you want the card to work in 8-bit HS200 mode, its POWER_CLASS value must be 14 (800mA). If host's VDD regulator is only capable of say 600mA
Re: [PATCH V2] mmc: core: Add host capability check for power class
On 28 March 2012 16:39, Subhash Jadavani subha...@codeaurora.org wrote: -Original Message- From: linux-mmc-ow...@vger.kernel.org [mailto:linux-mmc- ow...@vger.kernel.org] On Behalf Of Saugata Das Sent: Thursday, December 15, 2011 6:35 PM To: Girish K S Cc: linux-...@vger.kernel.org; patc...@linaro.org; linux-samsung- s...@vger.kernel.org; subha...@codeaurora.org; Chris Ball Subject: Re: [PATCH V2] mmc: core: Add host capability check for power class On 15 December 2011 16:22, Girish K S girish.shivananja...@linaro.org wrote: On 15 December 2011 15:34, Saugata Das saugata@linaro.org wrote: On 15 December 2011 09:28, Girish K S girish.shivananja...@linaro.org wrote: This patch adds a check whether the host supports maximum current value obtained from the device's extended csd register for a selected interface voltage and frequency. cc: Chris Ball c...@laptop.org Signed-off-by: Girish K S girish.shivananja...@linaro.org --- Changes in v2: deleted a unnecessary if else condition identified by subhash J Changes in v1: reduced the number of comparisons as per Hein's suggestion drivers/mmc/core/mmc.c | 19 +++ include/linux/mmc/card.h | 4 2 files changed, 23 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 006e932..b9ef777 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -688,6 +688,25 @@ static int mmc_select_powerclass(struct mmc_card *card, pwrclass_val = (pwrclass_val EXT_CSD_PWR_CL_4BIT_MASK) EXT_CSD_PWR_CL_4BIT_SHIFT; + if (pwrclass_val = MMC_MAX_CURRENT_800) + pwrclass_val = MMC_MAX_CURRENT_800; + else if (pwrclass_val = MMC_MAX_CURRENT_600) + pwrclass_val = MMC_MAX_CURRENT_600; + else if (pwrclass_val = MMC_MAX_CURRENT_400) + pwrclass_val = MMC_MAX_CURRENT_400; + else + pwrclass_val = MMC_MAX_CURRENT_200; + + if ((pwrclass_val == MMC_MAX_CURRENT_800) + !(card-host-caps MMC_CAP_MAX_CURRENT_800)) + pwrclass_val = MMC_MAX_CURRENT_600; + if ((pwrclass_val == MMC_MAX_CURRENT_600) + !(card-host-caps MMC_CAP_MAX_CURRENT_600)) + pwrclass_val = MMC_MAX_CURRENT_400; + if ((pwrclass_val == MMC_MAX_CURRENT_400) + !(card-host-caps MMC_CAP_MAX_CURRENT_400)) + pwrclass_val = MMC_MAX_CURRENT_200; + /* If the power class is different from the default value */ if (pwrclass_val 0) { err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, It is not allowed to set the POWER_CLASS with any value other than what is mentioned in the PWR_CL_ff_vvv or PWR_CL_DDR_ff_vvv for the corresponding frequency, voltage. That is, if PWR_CL_200_195 is 14 and we want to operate at HS200 then the only value allowed for POWER_CLASS is 14. So, we need to check the PWR_CL numbers and choose the operating mode (HS200/DDR50/..) based on the platform capability to support the current consumption and set the corresponding POWER_CLASS value. Please refer to section 6.6.5 of the 4.5 spec. The upstreamed code reads the extended csd value based on the already set voltage level and frequency of host. So it will get the required power class value which can be set directly. Is my understanding correct? It is not enough to just check the voltage level and frequency. Consider this example, host has capability to support MMC_CAP_MAX_CURRENT_400, the PWR_CL_DDR_52_360 has the value 9 (400mA) and PWR_CL_200_360 has the value 14 (800mA). Then even though the host might be capable to run 200MHz clock and 3.6V, it can only enable DDR at 52MHz and set 9 in POWER_CLASS. I think, in mmc_select_powerclass, we need to loop through the power classes of all supported modes of transfer (HS200, DDR52, ... ) and choose the mode which gives maximum bandwidth but falls within host capability of current consumption. Then set this to POWER_CLASS byte and also use the same information when setting HS_TIMING in mmc_init_card. Hi Saugata, Does the spec mandates you to set the power class to what is needed by frequency/voltage combination? I can't see that mentioned anywhere explicitly in eMMC4.5 spec (if it is mentioned in spec, please let me know section and line number). It may be still possible to set the power class lower than what is needed by frequency/voltage combination. Say for example, 8-bit HS200 (200MHz) with high voltage cards may specify power class (PWR_CL_200_3_6) value of 14 (800 mA) but that doesn't mean if you want the card to work in 8-bit HS200 mode, its POWER_CLASS value must be 14 (800mA). If host's VDD regulator is only capable of say 600mA then it may still set the POWER_CLASS to 12 (600 mA) which should be the indication
Re: [PATCH] mmc: core: Fix PowerOff Notify suspend/resume
On 14 March 2012 20:53, Ulf Hansson ulf.hans...@stericsson.com wrote: Hi Girish and Chris, I noticed that this has been pushed for 3.3, I think we need to make a revert of it asap if possible. I were unfortunately not able to review this patch earlier but it has issues I believe. It will break suspend/resume for eMMC devices supporting the SLEEP command and not the poweroff notify from eMMC 4.5. By break do you mean compilation break or system crash. can you please post the log that caused the break. I re checked it on eMMC 4.5, 4.41, high speed mmc card and normal mmc card. I can compile successfully and could test the suspend/ resume functionality without carsh. If you provide the log, i can check more. Please see my comments below. On 01/31/2012 11:14 AM, Girish K S wrote: Modified the mmc_poweroff to resume before sending the poweroff notification command. In sleep mode only AWAKE and RESET commands are allowed, so before sending the poweroff notification command resume from sleep mode and then send the notification command. POwerOff Notify is tested on a Synopsis Designware Host Controller(eMMC 4.5). The suspend to RAM and resume works fine. This patch is successfully applied on the Chris's mmc-next branch cc: Chris Ballc...@laptop.org Signed-off-by: Girish K Sgirish.shivananja...@linaro.org Tested-by: Girish K Sgirish.shivananja...@linaro.org --- drivers/mmc/core/core.c | 28 drivers/mmc/core/mmc.c | 17 - include/linux/mmc/card.h | 4 3 files changed, 36 insertions(+), 13 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index bec0bf2..14ec575 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1239,7 +1239,8 @@ static void mmc_poweroff_notify(struct mmc_host *host) int err = 0; card = host-card; - + mmc_claim_host(host); + /* * Send power notify command only if card * is mmc and notify state is powered ON @@ -1269,6 +1270,7 @@ static void mmc_poweroff_notify(struct mmc_host *host) /* Set the card state to no notification after the poweroff */ card-poweroff_notify_state = MMC_NO_POWER_NOTIFICATION; } + mmc_release_host(host); } /* @@ -1327,12 +1329,28 @@ static void mmc_power_up(struct mmc_host *host) void mmc_power_off(struct mmc_host *host) { + int err = 0; mmc_host_clk_hold(host); host-ios.clock = 0; host-ios.vdd = 0; - mmc_poweroff_notify(host); + /* + * For eMMC 4.5 device send AWAKE command before + * POWER_OFF_NOTIFY command, because in sleep state + * eMMC 4.5 devices respond to only RESET and AWAKE cmd + */ + if (host-card mmc_card_is_sleep(host-card) + host-bus_ops-resume) { + err = host-bus_ops-resume(host); This is just plain wrong. First we may have suspended the host from mmc_suspend_host then we enter this funtion (mmc_power_off) to cut the power to the card. Why do we even want to resume if we just did suspend? for 4.5 case, cards wont respond to any command other than awake and reset. so we resume before executing a switch for poweroff notify. for non 4.5 card, it will resume and wont continue in resume state because of the poweroff executed in the end. Moreover, this will actually mean that for mmc devices which are supporting SLEEP but not the new eMMC 4.5 feature poweroff_notify will leave this function in a resumed state (in other words, not in SLEEP state) which is not OK. non 4.5 devices will not remain in resume state. Because mmc_set_ios will power down the device. + + if (!err) + mmc_poweroff_notify(host); + else + pr_warning(%s: error %d during resume + (continue with poweroff sequence)\n, + mmc_hostname(host), err); + } /* * Reset ocr mask to be the highest possible voltage supported for @@ -2386,12 +2404,6 @@ int mmc_suspend_host(struct mmc_host *host) */ if (mmc_try_claim_host(host)) { if (host-bus_ops-suspend) { - /* - * For eMMC 4.5 device send notify command - * before sleep, because in sleep state eMMC 4.5 - * devices respond to only RESET and AWAKE cmd - */ - mmc_poweroff_notify(host); err = host-bus_ops-suspend(host); } mmc_do_release_host(host); diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 2bc586b..c3f09a2 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core
Re: [PATCH] mmc: core: Fix PowerOff Notify suspend/resume
On 16 March 2012 10:43, Saugata Das saugata@linaro.org wrote: On 16 March 2012 09:19, Girish K S girish.shivananja...@linaro.org wrote: On 14 March 2012 20:53, Ulf Hansson ulf.hans...@stericsson.com wrote: Hi Girish and Chris, I noticed that this has been pushed for 3.3, I think we need to make a revert of it asap if possible. I were unfortunately not able to review this patch earlier but it has issues I believe. It will break suspend/resume for eMMC devices supporting the SLEEP command and not the poweroff notify from eMMC 4.5. By break do you mean compilation break or system crash. can you please post the log that caused the break. I re checked it on eMMC 4.5, 4.41, high speed mmc card and normal mmc card. I can compile successfully and could test the suspend/ resume functionality without carsh. If you provide the log, i can check more. Please see my comments below. On 01/31/2012 11:14 AM, Girish K S wrote: Modified the mmc_poweroff to resume before sending the poweroff notification command. In sleep mode only AWAKE and RESET commands are allowed, so before sending the poweroff notification command resume from sleep mode and then send the notification command. POwerOff Notify is tested on a Synopsis Designware Host Controller(eMMC 4.5). The suspend to RAM and resume works fine. This patch is successfully applied on the Chris's mmc-next branch cc: Chris Ballc...@laptop.org Signed-off-by: Girish K Sgirish.shivananja...@linaro.org Tested-by: Girish K Sgirish.shivananja...@linaro.org --- drivers/mmc/core/core.c | 28 drivers/mmc/core/mmc.c | 17 - include/linux/mmc/card.h | 4 3 files changed, 36 insertions(+), 13 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index bec0bf2..14ec575 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1239,7 +1239,8 @@ static void mmc_poweroff_notify(struct mmc_host *host) int err = 0; card = host-card; - + mmc_claim_host(host); + /* * Send power notify command only if card * is mmc and notify state is powered ON @@ -1269,6 +1270,7 @@ static void mmc_poweroff_notify(struct mmc_host *host) /* Set the card state to no notification after the poweroff */ card-poweroff_notify_state = MMC_NO_POWER_NOTIFICATION; } + mmc_release_host(host); } /* @@ -1327,12 +1329,28 @@ static void mmc_power_up(struct mmc_host *host) void mmc_power_off(struct mmc_host *host) { + int err = 0; mmc_host_clk_hold(host); host-ios.clock = 0; host-ios.vdd = 0; - mmc_poweroff_notify(host); + /* + * For eMMC 4.5 device send AWAKE command before + * POWER_OFF_NOTIFY command, because in sleep state + * eMMC 4.5 devices respond to only RESET and AWAKE cmd + */ + if (host-card mmc_card_is_sleep(host-card) + host-bus_ops-resume) { + err = host-bus_ops-resume(host); This is just plain wrong. First we may have suspended the host from mmc_suspend_host then we enter this funtion (mmc_power_off) to cut the power to the card. Why do we even want to resume if we just did suspend? for 4.5 case, cards wont respond to any command other than awake and reset. so we resume before executing a switch for poweroff notify. for non 4.5 card, it will resume and wont continue in resume state because of the poweroff executed in the end. Moreover, this will actually mean that for mmc devices which are supporting SLEEP but not the new eMMC 4.5 feature poweroff_notify will leave this function in a resumed state (in other words, not in SLEEP state) which is not OK. non 4.5 devices will not remain in resume state. Because mmc_set_ios will power down the device. + + if (!err) + mmc_poweroff_notify(host); + else + pr_warning(%s: error %d during resume + (continue with poweroff sequence)\n, + mmc_hostname(host), err); + } /* * Reset ocr mask to be the highest possible voltage supported for @@ -2386,12 +2404,6 @@ int mmc_suspend_host(struct mmc_host *host) */ if (mmc_try_claim_host(host)) { if (host-bus_ops-suspend) { - /* - * For eMMC 4.5 device send notify command - * before sleep, because in sleep state eMMC 4.5 - * devices respond to only RESET and AWAKE cmd - */ - mmc_poweroff_notify(host); err = host-bus_ops-suspend(host); } mmc_do_release_host
Re: [PATCH] mmc: core: Fix PowerOff Notify suspend/resume
On 16 March 2012 10:43, Saugata Das saugata@linaro.org wrote: On 16 March 2012 09:19, Girish K S girish.shivananja...@linaro.org wrote: On 14 March 2012 20:53, Ulf Hansson ulf.hans...@stericsson.com wrote: Hi Girish and Chris, I noticed that this has been pushed for 3.3, I think we need to make a revert of it asap if possible. I were unfortunately not able to review this patch earlier but it has issues I believe. It will break suspend/resume for eMMC devices supporting the SLEEP command and not the poweroff notify from eMMC 4.5. By break do you mean compilation break or system crash. can you please post the log that caused the break. I re checked it on eMMC 4.5, 4.41, high speed mmc card and normal mmc card. I can compile successfully and could test the suspend/ resume functionality without carsh. If you provide the log, i can check more. Please see my comments below. On 01/31/2012 11:14 AM, Girish K S wrote: Modified the mmc_poweroff to resume before sending the poweroff notification command. In sleep mode only AWAKE and RESET commands are allowed, so before sending the poweroff notification command resume from sleep mode and then send the notification command. POwerOff Notify is tested on a Synopsis Designware Host Controller(eMMC 4.5). The suspend to RAM and resume works fine. This patch is successfully applied on the Chris's mmc-next branch cc: Chris Ballc...@laptop.org Signed-off-by: Girish K Sgirish.shivananja...@linaro.org Tested-by: Girish K Sgirish.shivananja...@linaro.org --- drivers/mmc/core/core.c | 28 drivers/mmc/core/mmc.c | 17 - include/linux/mmc/card.h | 4 3 files changed, 36 insertions(+), 13 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index bec0bf2..14ec575 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1239,7 +1239,8 @@ static void mmc_poweroff_notify(struct mmc_host *host) int err = 0; card = host-card; - + mmc_claim_host(host); + /* * Send power notify command only if card * is mmc and notify state is powered ON @@ -1269,6 +1270,7 @@ static void mmc_poweroff_notify(struct mmc_host *host) /* Set the card state to no notification after the poweroff */ card-poweroff_notify_state = MMC_NO_POWER_NOTIFICATION; } + mmc_release_host(host); } /* @@ -1327,12 +1329,28 @@ static void mmc_power_up(struct mmc_host *host) void mmc_power_off(struct mmc_host *host) { + int err = 0; mmc_host_clk_hold(host); host-ios.clock = 0; host-ios.vdd = 0; - mmc_poweroff_notify(host); + /* + * For eMMC 4.5 device send AWAKE command before + * POWER_OFF_NOTIFY command, because in sleep state + * eMMC 4.5 devices respond to only RESET and AWAKE cmd + */ + if (host-card mmc_card_is_sleep(host-card) + host-bus_ops-resume) { + err = host-bus_ops-resume(host); This is just plain wrong. First we may have suspended the host from mmc_suspend_host then we enter this funtion (mmc_power_off) to cut the power to the card. Why do we even want to resume if we just did suspend? for 4.5 case, cards wont respond to any command other than awake and reset. so we resume before executing a switch for poweroff notify. for non 4.5 card, it will resume and wont continue in resume state because of the poweroff executed in the end. Moreover, this will actually mean that for mmc devices which are supporting SLEEP but not the new eMMC 4.5 feature poweroff_notify will leave this function in a resumed state (in other words, not in SLEEP state) which is not OK. non 4.5 devices will not remain in resume state. Because mmc_set_ios will power down the device. + + if (!err) + mmc_poweroff_notify(host); + else + pr_warning(%s: error %d during resume + (continue with poweroff sequence)\n, + mmc_hostname(host), err); + } /* * Reset ocr mask to be the highest possible voltage supported for @@ -2386,12 +2404,6 @@ int mmc_suspend_host(struct mmc_host *host) */ if (mmc_try_claim_host(host)) { if (host-bus_ops-suspend) { - /* - * For eMMC 4.5 device send notify command - * before sleep, because in sleep state eMMC 4.5 - * devices respond to only RESET and AWAKE cmd - */ - mmc_poweroff_notify(host); err = host-bus_ops-suspend(host); } mmc_do_release_host
Re: [PATCH 2/4] [SCSI] ufshcd: UFS UTP Transfer requests handling
On 2 February 2012 10:27, Vinayak Holikatti vinholika...@gmail.com wrote: From: Santosh Yaraganavi santos...@gmail.com This patch adds support for Transfer request handling. ufshcd includes following implementations: - SCSI queuecommand - Compose UPIU(UFS Protocol information unit) - Issue commands to UFS host controller - Handle completed commands Signed-off-by: Santosh Yaraganavi santos...@gmail.com Signed-off-by: Vinayak Holikatti vinholika...@gmail.com Reviewed-by: Arnd Bergmann a...@arndb.de Reviewed-by: Saugata Das saugata@linaro.org Reviewed-by: Vishak G visha...@samsung.com Reviewed-by: Girish K S girish.shivananja...@linaro.org --- drivers/scsi/ufs/ufshcd.c | 447 + 1 files changed, 447 insertions(+), 0 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index c82eeea..23d758b 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -62,6 +62,7 @@ #include scsi/scsi.h #include scsi/scsi_cmnd.h #include scsi/scsi_host.h +#include scsi/scsi_tcq.h #include scsi/scsi_dbg.h #include ufs.h @@ -81,6 +82,7 @@ enum { UFSHCD_MAX_CHANNEL = 1, UFSHCD_MAX_ID = 1, UFSHCD_MAX_LUNS = 8, + UFSHCD_CMD_PER_LUN = 16, UFSHCD_CAN_QUEUE = 32, BYTES_128 = 128, BYTES_1024 = 1024 @@ -146,6 +148,7 @@ struct uic_command { * @host: Scsi_Host instance of the driver * @pdev: PCI device handle * @lrb: local reference block + * @outstanding_reqs: Bits representing outstanding transfer requests * @capabilities: UFS Controller Capabilities * @nutrs: Transfer Request Queue depth supported by controller * @nutmrs: Task Management Queue depth supported by controller @@ -184,6 +187,8 @@ struct ufs_hba { struct ufshcd_lrb *lrb; + u32 outstanding_reqs; + u32 capabilities; int nutrs; int nutmrs; @@ -204,12 +209,28 @@ struct ufs_hba { * @ucd_cmd_ptr: UCD address of the command * @ucd_rsp_ptr: Response UPIU address for this command * @ucd_prdt_ptr: PRDT address of the command + * @cmd: pointer to scsi command + * @sense_buffer: pointer sense buffer address of the scsi command + * @sense_bufflen: Length of the sense buffer + * @scsi_status: SCSI status of the command + * @command_type: SCSI, UFS, Query. + * @task_tag: Task tag of the command + * @lun: LUN of the command */ struct ufshcd_lrb { struct utp_transfer_req_desc *utr_descriptor_ptr; struct utp_upiu_cmd *ucd_cmd_ptr; struct utp_upiu_rsp *ucd_rsp_ptr; struct ufshcd_sg_entry *ucd_prdt_ptr; + + struct scsi_cmnd *cmd; + u8 *sense_buffer; + unsigned int sense_bufflen; + int scsi_status; + + int command_type; + int task_tag; + int lun; }; /** @@ -236,6 +257,18 @@ static inline int ufshcd_is_device_present(u32 reg_hcs) } /** + * ufshcd_get_tr_ocs - Get the UTRD Overall Command Status + * @lrb: pointer to local command reference block + * + * This function is used to get the OCS field from UTRD + * Returns the OCS field in the UTRD + */ +static inline int ufshcd_get_tr_ocs(struct ufshcd_lrb *lrbp) +{ + return lrbp-utr_descriptor_ptr-header.dword_2 MASK_OCS; +} + +/** * ufshcd_get_lists_status - Check UCRDY, UTRLRDY and UTMRLRDY * @reg: Register value of host controller status * @@ -303,6 +336,36 @@ static inline void ufshcd_free_hba_memory(struct ufs_hba *hba) } /** + * ufshcd_is_valid_req_rsp - checks if controller TR response is valid + * @ucd_rsp_ptr: pointer to response UPIU + * + * This function checks the response UPIU for valid transaction type in + * response field + * Returns 0 on success, non-zero on failure + */ +static inline int +ufshcd_is_valid_req_rsp(struct utp_upiu_rsp *ucd_rsp_ptr) +{ + return ((be32_to_cpu(ucd_rsp_ptr-header.dword_0) 24) == + UPIU_TRANSACTION_RESPONSE) ? 0 : + (DID_ERROR 16 | + COMMAND_COMPLETE 8); +} + +/** + * ufshcd_get_rsp_upiu_result - Get the result from response UPIU + * @ucd_rsp_ptr: pointer to response UPIU + * + * This function gets the response status and scsi_status from response UPIU + * Returns the response result code. + */ +static inline int +ufshcd_get_rsp_upiu_result(struct utp_upiu_rsp *ucd_rsp_ptr) +{ + return be32_to_cpu(ucd_rsp_ptr-header.dword_1) MASK_RSP_UPIU_RESULT; +} + +/** * ufshcd_config_int_aggr - Configure interrupt aggregation values * currently there is no use case where we want to configure * interrupt aggregation dynamically. So to configure interrupt @@ -342,6 +405,34 @@ static inline void ufshcd_hba_stop(struct ufs_hba *hba) } /** + * ufshcd_send_command - Send SCSI or device
[PATCH] mmc: core: Fix PowerOff Notify suspend/resume
Modified the mmc_poweroff to resume before sending the poweroff notification command. In sleep mode only AWAKE and RESET commands are allowed, so before sending the poweroff notification command resume from sleep mode and then send the notification command. POwerOff Notify is tested on a Synopsis Designware Host Controller(eMMC 4.5). The suspend to RAM and resume works fine. This patch is successfully applied on the Chris's mmc-next branch cc: Chris Ball c...@laptop.org Signed-off-by: Girish K S girish.shivananja...@linaro.org Tested-by: Girish K S girish.shivananja...@linaro.org --- drivers/mmc/core/core.c | 28 drivers/mmc/core/mmc.c | 17 - include/linux/mmc/card.h |4 3 files changed, 36 insertions(+), 13 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index bec0bf2..14ec575 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1239,7 +1239,8 @@ static void mmc_poweroff_notify(struct mmc_host *host) int err = 0; card = host-card; - + mmc_claim_host(host); + /* * Send power notify command only if card * is mmc and notify state is powered ON @@ -1269,6 +1270,7 @@ static void mmc_poweroff_notify(struct mmc_host *host) /* Set the card state to no notification after the poweroff */ card-poweroff_notify_state = MMC_NO_POWER_NOTIFICATION; } + mmc_release_host(host); } /* @@ -1327,12 +1329,28 @@ static void mmc_power_up(struct mmc_host *host) void mmc_power_off(struct mmc_host *host) { + int err = 0; mmc_host_clk_hold(host); host-ios.clock = 0; host-ios.vdd = 0; - mmc_poweroff_notify(host); + /* +* For eMMC 4.5 device send AWAKE command before +* POWER_OFF_NOTIFY command, because in sleep state +* eMMC 4.5 devices respond to only RESET and AWAKE cmd +*/ + if (host-card mmc_card_is_sleep(host-card) + host-bus_ops-resume) { + err = host-bus_ops-resume(host); + + if (!err) + mmc_poweroff_notify(host); + else + pr_warning(%s: error %d during resume + (continue with poweroff sequence)\n, + mmc_hostname(host), err); + } /* * Reset ocr mask to be the highest possible voltage supported for @@ -2386,12 +2404,6 @@ int mmc_suspend_host(struct mmc_host *host) */ if (mmc_try_claim_host(host)) { if (host-bus_ops-suspend) { - /* -* For eMMC 4.5 device send notify command -* before sleep, because in sleep state eMMC 4.5 -* devices respond to only RESET and AWAKE cmd -*/ - mmc_poweroff_notify(host); err = host-bus_ops-suspend(host); } mmc_do_release_host(host); diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 2bc586b..c3f09a2 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -1330,11 +1330,13 @@ static int mmc_suspend(struct mmc_host *host) BUG_ON(!host-card); mmc_claim_host(host); - if (mmc_card_can_sleep(host)) + if (mmc_card_can_sleep(host)) { err = mmc_card_sleep(host); - else if (!mmc_host_is_spi(host)) + if (!err) + mmc_card_set_sleep(host-card); + } else if (!mmc_host_is_spi(host)) mmc_deselect_cards(host); - host-card-state = ~MMC_STATE_HIGHSPEED; + host-card-state = ~(MMC_STATE_HIGHSPEED | MMC_STATE_HIGHSPEED_200); mmc_release_host(host); return err; @@ -1354,7 +1356,11 @@ static int mmc_resume(struct mmc_host *host) BUG_ON(!host-card); mmc_claim_host(host); - err = mmc_init_card(host, host-ocr, host-card); + if (mmc_card_is_sleep(host-card)) { + err = mmc_card_awake(host); + mmc_card_clr_sleep(host-card); + } else + err = mmc_init_card(host, host-ocr, host-card); mmc_release_host(host); return err; @@ -1364,7 +1370,8 @@ static int mmc_power_restore(struct mmc_host *host) { int ret; - host-card-state = ~MMC_STATE_HIGHSPEED; + host-card-state = ~(MMC_STATE_HIGHSPEED | MMC_STATE_HIGHSPEED_200); + mmc_card_clr_sleep(host-card); mmc_claim_host(host); ret = mmc_init_card(host, host-ocr, host-card); mmc_release_host(host); diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index f9a0663..1a1ca71 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h @@ -219,6 +219,7 @@ struct
Re: [PATCH] mmc: core: Fix Low speed mmc card detection failure
Hi Chris, can you consider this patch in your next branch. regards Girish K S On 19 January 2012 08:56, Girish K S girish.shivananja...@linaro.org wrote: This patch fixes the failure of low speed mmc card detection Signed-off-by: Girish K S girish.shivananja...@linaro.org --- drivers/mmc/core/mmc.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index dc03291..2bc586b 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -1020,7 +1020,8 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, err = mmc_select_hs200(card); else if (host-caps MMC_CAP_MMC_HIGHSPEED) err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, - EXT_CSD_HS_TIMING, 1, 0); + EXT_CSD_HS_TIMING, 1, + card-ext_csd.generic_cmd6_time); if (err err != -EBADMSG) goto free_card; @@ -1130,7 +1131,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, * Activate wide bus and DDR (if supported). */ if (!mmc_card_hs200(card) - (card-csd.mmca_vsn = CSD_SPEC_VER_3) + (card-csd.mmca_vsn = CSD_SPEC_VER_4) (host-caps (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA))) { static unsigned ext_csd_bits[][2] = { { EXT_CSD_BUS_WIDTH_8, EXT_CSD_DDR_BUS_WIDTH_8 }, -- 1.7.1 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] mmc: core: Fix Low speed mmc card detection failure
This patch fixes the failure of low speed mmc card detection Signed-off-by: Girish K S girish.shivananja...@linaro.org --- drivers/mmc/core/mmc.c |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index dc03291..2bc586b 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -1020,7 +1020,8 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, err = mmc_select_hs200(card); else if (host-caps MMC_CAP_MMC_HIGHSPEED) err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, -EXT_CSD_HS_TIMING, 1, 0); +EXT_CSD_HS_TIMING, 1, +card-ext_csd.generic_cmd6_time); if (err err != -EBADMSG) goto free_card; @@ -1130,7 +1131,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, * Activate wide bus and DDR (if supported). */ if (!mmc_card_hs200(card) - (card-csd.mmca_vsn = CSD_SPEC_VER_3) + (card-csd.mmca_vsn = CSD_SPEC_VER_4) (host-caps (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA))) { static unsigned ext_csd_bits[][2] = { { EXT_CSD_BUS_WIDTH_8, EXT_CSD_DDR_BUS_WIDTH_8 }, -- 1.7.1 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V9 0/2] HS200 Mode support for device and host
HI Chris, Please have a look at this patch series and add it in your next branch if everything seems to be Ok regards Girish K S On 6 January 2012 09:56, Girish K S girish.shivananja...@linaro.org wrote: changes in v9: Updated the changes suggested by Chris for kernel coding comaptibility changes in v8: Updated the changes suggested by Philip for bus mode test. changes in v7: Updated with review comments for minor changes in host conditional handling. added the handling for 4 bit bus width. Changes in v6: split the patch into 2 and classified them as a patch for device and host. Modified to include the review comments. Changes in v5: Reduced the case statements for better code readability. Removed unused macro definitions. Modified the tuning function prototype and definition to support tuning for both SD and eMMC cards. Changes in v4: Rebased onto chris-mmc/mmc-next branch. This patch is successfully applied on commit with id de022ed3fdc14808299b2fa66dbb1ed5ab921912. Changes in v3: In the previous commits of chris-mmc/mmc-next branch, the patch with commit id (c0f22a2c92e357e7cb3988b0b13034d70b7461f9) defines caps2 for more capabilities. This patch version deletes the member ext_caps (created in my earlier patch) from struct mmc_host and reuses already accepted caps2 member. Changes in v2: Rebased to latest chris-mmc/mmc-next branch. Resolved indentation problems identified in review. This patch has to be applied before the patch released for modifying the printk messages. Changes in v1: Case statements in switch that produce same result have been combined to reduce repeated assignments. patch recreated after rebase to chris Balls mmc-next branch. Girish K S (2): mmc: core: HS200 mode support for eMMC 4.5 mmc: host: Adds support for eMMC 4.5 HS200 mode drivers/mmc/core/bus.c | 3 +- drivers/mmc/core/debugfs.c | 3 + drivers/mmc/core/mmc.c | 162 +--- drivers/mmc/core/sd.c | 3 +- drivers/mmc/core/sdio.c | 4 +- drivers/mmc/host/sdhci.c | 45 +--- drivers/mmc/host/sdhci.h | 1 + include/linux/mmc/card.h | 3 + include/linux/mmc/host.h | 11 +++- include/linux/mmc/mmc.h | 66 ++- include/linux/mmc/sdhci.h | 1 + 11 files changed, 277 insertions(+), 25 deletions(-) -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH V9 0/2] HS200 Mode support for device and host
changes in v9: Updated the changes suggested by Chris for kernel coding comaptibility changes in v8: Updated the changes suggested by Philip for bus mode test. changes in v7: Updated with review comments for minor changes in host conditional handling. added the handling for 4 bit bus width. Changes in v6: split the patch into 2 and classified them as a patch for device and host. Modified to include the review comments. Changes in v5: Reduced the case statements for better code readability. Removed unused macro definitions. Modified the tuning function prototype and definition to support tuning for both SD and eMMC cards. Changes in v4: Rebased onto chris-mmc/mmc-next branch. This patch is successfully applied on commit with id de022ed3fdc14808299b2fa66dbb1ed5ab921912. Changes in v3: In the previous commits of chris-mmc/mmc-next branch, the patch with commit id (c0f22a2c92e357e7cb3988b0b13034d70b7461f9) defines caps2 for more capabilities. This patch version deletes the member ext_caps (created in my earlier patch) from struct mmc_host and reuses already accepted caps2 member. Changes in v2: Rebased to latest chris-mmc/mmc-next branch. Resolved indentation problems identified in review. This patch has to be applied before the patch released for modifying the printk messages. Changes in v1: Case statements in switch that produce same result have been combined to reduce repeated assignments. patch recreated after rebase to chris Balls mmc-next branch. Girish K S (2): mmc: core: HS200 mode support for eMMC 4.5 mmc: host: Adds support for eMMC 4.5 HS200 mode drivers/mmc/core/bus.c |3 +- drivers/mmc/core/debugfs.c |3 + drivers/mmc/core/mmc.c | 162 +--- drivers/mmc/core/sd.c |3 +- drivers/mmc/core/sdio.c|4 +- drivers/mmc/host/sdhci.c | 45 +--- drivers/mmc/host/sdhci.h |1 + include/linux/mmc/card.h |3 + include/linux/mmc/host.h | 11 +++- include/linux/mmc/mmc.h| 66 ++- include/linux/mmc/sdhci.h |1 + 11 files changed, 277 insertions(+), 25 deletions(-) -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH V9 2/2] mmc: host: Adds support for eMMC 4.5 HS200 mode
This patch adds support for the HS200 mode on the host side. Also enables the tuning feature required when the HS200 mode is selected. cc: Chris Ball c...@laptop.org Signed-off-by: Girish K S girish.shivananja...@linaro.org --- drivers/mmc/host/sdhci.c | 45 ++--- drivers/mmc/host/sdhci.h |1 + include/linux/mmc/sdhci.h |1 + 3 files changed, 36 insertions(+), 11 deletions(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index a8f1f7e..4be50ea 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -49,7 +49,7 @@ static void sdhci_finish_data(struct sdhci_host *); static void sdhci_send_command(struct sdhci_host *, struct mmc_command *); static void sdhci_finish_command(struct sdhci_host *); -static int sdhci_execute_tuning(struct mmc_host *mmc); +static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode); static void sdhci_tuning_timer(unsigned long data); #ifdef CONFIG_PM_RUNTIME @@ -1014,7 +1014,8 @@ static void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd) flags |= SDHCI_CMD_INDEX; /* CMD19 is special in that the Data Present Select should be set */ - if (cmd-data || (cmd-opcode == MMC_SEND_TUNING_BLOCK)) + if (cmd-data || (cmd-opcode == MMC_SEND_TUNING_BLOCK) || + (cmd-opcode == MMC_SEND_TUNING_BLOCK_HS200)) flags |= SDHCI_CMD_DATA; sdhci_writew(host, SDHCI_MAKE_CMD(cmd-opcode, flags), SDHCI_COMMAND); @@ -1287,7 +1288,7 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq) if ((host-flags SDHCI_NEEDS_RETUNING) !(present_state (SDHCI_DOING_WRITE | SDHCI_DOING_READ))) { spin_unlock_irqrestore(host-lock, flags); - sdhci_execute_tuning(mmc); + sdhci_execute_tuning(mmc, mrq-cmd-opcode); spin_lock_irqsave(host-lock, flags); /* Restore original mmc_request structure */ @@ -1382,7 +1383,8 @@ static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios) unsigned int clock; /* In case of UHS-I modes, set High Speed Enable */ - if ((ios-timing == MMC_TIMING_UHS_SDR50) || + if ((ios-timing == MMC_TIMING_MMC_HS200) || + (ios-timing == MMC_TIMING_UHS_SDR50) || (ios-timing == MMC_TIMING_UHS_SDR104) || (ios-timing == MMC_TIMING_UHS_DDR50) || (ios-timing == MMC_TIMING_UHS_SDR25)) @@ -1435,7 +1437,9 @@ static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios) ctrl_2 = sdhci_readw(host, SDHCI_HOST_CONTROL2); /* Select Bus Speed Mode for host */ ctrl_2 = ~SDHCI_CTRL_UHS_MASK; - if (ios-timing == MMC_TIMING_UHS_SDR12) + if (ios-timing == MMC_TIMING_MMC_HS200) + ctrl_2 |= SDHCI_CTRL_HS_SDR200; + else if (ios-timing == MMC_TIMING_UHS_SDR12) ctrl_2 |= SDHCI_CTRL_UHS_SDR12; else if (ios-timing == MMC_TIMING_UHS_SDR25) ctrl_2 |= SDHCI_CTRL_UHS_SDR25; @@ -1682,7 +1686,7 @@ static int sdhci_start_signal_voltage_switch(struct mmc_host *mmc, return err; } -static int sdhci_execute_tuning(struct mmc_host *mmc) +static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode) { struct sdhci_host *host; u16 ctrl; @@ -1703,10 +1707,13 @@ static int sdhci_execute_tuning(struct mmc_host *mmc) * Host Controller needs tuning only in case of SDR104 mode * and for SDR50 mode when Use Tuning for SDR50 is set in * Capabilities register. +* If the Host Controller supports the HS200 mode then tuning +* function has to be executed. */ if (((ctrl SDHCI_CTRL_UHS_MASK) == SDHCI_CTRL_UHS_SDR104) || (((ctrl SDHCI_CTRL_UHS_MASK) == SDHCI_CTRL_UHS_SDR50) - (host-flags SDHCI_SDR50_NEEDS_TUNING))) + (host-flags SDHCI_SDR50_NEEDS_TUNING)) || + (host-flags SDHCI_HS200_NEEDS_TUNING)) ctrl |= SDHCI_CTRL_EXEC_TUNING; else { spin_unlock(host-lock); @@ -1742,7 +1749,7 @@ static int sdhci_execute_tuning(struct mmc_host *mmc) if (!tuning_loop_counter !timeout) break; - cmd.opcode = MMC_SEND_TUNING_BLOCK; + cmd.opcode = opcode; cmd.arg = 0; cmd.flags = MMC_RSP_R1 | MMC_CMD_ADTC; cmd.retries = 0; @@ -1757,7 +1764,17 @@ static int sdhci_execute_tuning(struct mmc_host *mmc) * block to the Host Controller. So we set the block size * to 64 here
[PATCH V8 0/2] HS200 Mode support for device and host
changes in v7: Updated with review comments for minor changes in host conditional handling. added the handling for 4 bit bus width. Changes in v6: split the patch into 2 and classified them as a patch for device and host. Modified to include the review comments. Changes in v5: Reduced the case statements for better code readability. Removed unused macro definitions. Modified the tuning function prototype and definition to support tuning for both SD and eMMC cards. Changes in v4: Rebased onto chris-mmc/mmc-next branch. This patch is successfully applied on commit with id de022ed3fdc14808299b2fa66dbb1ed5ab921912. Changes in v3: In the previous commits of chris-mmc/mmc-next branch, the patch with commit id (c0f22a2c92e357e7cb3988b0b13034d70b7461f9) defines caps2 for more capabilities. This patch version deletes the member ext_caps(created in my earlier patch) from struct mmc_host and reuses already accepted caps2 member. Changes in v2: Rebased to latest chris-mmc/mmc-next branch. Resolved indentation problems identified in review. This patch has to be applied before the patch released for modifying the printk messages. Changes in v1: Case statements in switch that produce same result have been combined to reduce repeated assignments. patch recreated after rebase to chris balls mmc-next branch. Girish K S (2): mmc: core: HS200 mode support for eMMC 4.5 mmc: host: Adds support for eMMC 4.5 HS200 mode drivers/mmc/core/bus.c |3 +- drivers/mmc/core/debugfs.c |3 + drivers/mmc/core/mmc.c | 163 +--- drivers/mmc/core/sd.c |3 +- drivers/mmc/core/sdio.c|4 +- drivers/mmc/host/sdhci.c | 45 +--- drivers/mmc/host/sdhci.h |1 + include/linux/mmc/card.h |3 + include/linux/mmc/host.h | 11 +++- include/linux/mmc/mmc.h| 66 +- include/linux/mmc/sdhci.h |1 + 11 files changed, 278 insertions(+), 25 deletions(-) -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V7 1/2] mmc: core: HS200 mode support for eMMC 4.5
On 21 December 2011 12:04, Subhash Jadavani subha...@codeaurora.org wrote: -Original Message- From: linux-mmc-ow...@vger.kernel.org [mailto:linux-mmc- ow...@vger.kernel.org] On Behalf Of Girish K S Sent: Wednesday, December 21, 2011 9:43 AM To: linux-...@vger.kernel.org Cc: patc...@linaro.org; linux-samsung-soc@vger.kernel.org; Girish K S; Chris Ball Subject: [PATCH V7 1/2] mmc: core: HS200 mode support for eMMC 4.5 This patch adds the support of the HS200 bus speed for eMMC 4.5 devices. The eMMC 4.5 devices have support for 200MHz bus speed. The function prototype of the tuning function is modified to handle the tuning command number which is different in sd and mmc case. cc: Chris Ball c...@laptop.org Signed-off-by: Girish K S girish.shivananja...@linaro.org --- drivers/mmc/core/bus.c | 3 +- drivers/mmc/core/debugfs.c | 3 + drivers/mmc/core/mmc.c | 142 +--- drivers/mmc/core/sd.c | 3 +- drivers/mmc/core/sdio.c | 4 +- include/linux/mmc/card.h | 3 + include/linux/mmc/mmc.h | 66 - Looks like you have missed to add change in include/linux/mmc/host.h in this patch. yes 7 files changed, 211 insertions(+), 13 deletions(-) diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index f8a228a..5d011a3 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c @@ -303,10 +303,11 @@ int mmc_add_card(struct mmc_card *card) mmc_card_ddr_mode(card) ? DDR : , type); } else { - printk(KERN_INFO %s: new %s%s%s card at address %04x\n, + pr_info(%s: new %s%s%s%s card at address %04x\n, mmc_hostname(card-host), mmc_card_uhs(card) ? ultra high speed : (mmc_card_highspeed(card) ? high speed : ), + (mmc_card_hs200(card) ? HS200 : ), mmc_card_ddr_mode(card) ? DDR : , type, card-rca); } diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c index 027615d..9ab5b17 100644 --- a/drivers/mmc/core/debugfs.c +++ b/drivers/mmc/core/debugfs.c @@ -135,6 +135,9 @@ static int mmc_ios_show(struct seq_file *s, void *data) case MMC_TIMING_UHS_DDR50: str = sd uhs DDR50; break; + case MMC_TIMING_MMC_HS200: + str = mmc high-speed SDR200; + break; default: str = invalid; break; diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index f0a9f1f..4de3416 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -286,6 +286,27 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) } card-ext_csd.raw_card_type = ext_csd[EXT_CSD_CARD_TYPE]; switch (ext_csd[EXT_CSD_CARD_TYPE] EXT_CSD_CARD_TYPE_MASK) { + case EXT_CSD_CARD_TYPE_SDR_ALL: + case EXT_CSD_CARD_TYPE_SDR_ALL_DDR_1_8V: + case EXT_CSD_CARD_TYPE_SDR_ALL_DDR_1_2V: + case EXT_CSD_CARD_TYPE_SDR_ALL_DDR_52: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_200; + break; + case EXT_CSD_CARD_TYPE_SDR_1_2V_ALL: + case EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_1_8V: + case EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_1_2V: + case EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_52: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_1_2V; + break; + case EXT_CSD_CARD_TYPE_SDR_1_8V_ALL: + case EXT_CSD_CARD_TYPE_SDR_1_8V_DDR_1_8V: + case EXT_CSD_CARD_TYPE_SDR_1_8V_DDR_1_2V: + case EXT_CSD_CARD_TYPE_SDR_1_8V_DDR_52: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_1_8V; + break; case EXT_CSD_CARD_TYPE_DDR_52 | EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: card-ext_csd.hs_max_dtr = 5200; @@ -700,6 +721,58 @@ static int mmc_select_powerclass(struct mmc_card *card, } /* + * Selects the desired buswidth and switch to the HS200 mode + * if bus width set without error + */ +static int mmc_select_hs200(struct mmc_card *card) +{ + int err = 0; + struct mmc_host *host; + u32 bus_width = MMC_BUS_WIDTH_4; + + BUG_ON(!card); + + host = card-host; + + if ((card-ext_csd.card_type EXT_CSD_CARD_TYPE_SDR_1_2V) + (host-caps2 MMC_CAP2_HS200_1_2V_SDR)) + err = mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120, 0); + + /* + * Host is capable of 8bit transfer, then switch + * the device to work in 8bit transfer mode. If the + * mmc switch command returns error then switch to + * 4bit transfer mode. On success set the corresponding + * bus width on the host
Re: [RESEND PATCH V7 1/2] mmc: core: HS200 mode support for eMMC 4.5
On 21 December 2011 15:18, Subhash Jadavani subha...@codeaurora.org wrote: On 12/21/2011 3:10 PM, Girish K S wrote: This patch adds the support of the HS200 bus speed for eMMC 4.5 devices. The eMMC 4.5 devices have support for 200MHz bus speed. The function prototype of the tuning function is modified to handle the tuning command number which is different in sd and mmc case. cc: Chris Ballc...@laptop.org Signed-off-by: Girish K Sgirish.shivananja...@linaro.org --- drivers/mmc/core/bus.c | 3 +- drivers/mmc/core/debugfs.c | 3 + drivers/mmc/core/mmc.c | 148 +--- drivers/mmc/core/sd.c | 3 +- drivers/mmc/core/sdio.c | 4 +- include/linux/mmc/card.h | 3 + include/linux/mmc/host.h | 11 +++- include/linux/mmc/mmc.h | 66 +++- 8 files changed, 227 insertions(+), 14 deletions(-) diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index f8a228a..5d011a3 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c @@ -303,10 +303,11 @@ int mmc_add_card(struct mmc_card *card) mmc_card_ddr_mode(card) ? DDR : , type); } else { - printk(KERN_INFO %s: new %s%s%s card at address %04x\n, + pr_info(%s: new %s%s%s%s card at address %04x\n, mmc_hostname(card-host), mmc_card_uhs(card) ? ultra high speed : (mmc_card_highspeed(card) ? high speed : ), + (mmc_card_hs200(card) ? HS200 : ), mmc_card_ddr_mode(card) ? DDR : , type, card-rca); } diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c index 027615d..9ab5b17 100644 --- a/drivers/mmc/core/debugfs.c +++ b/drivers/mmc/core/debugfs.c @@ -135,6 +135,9 @@ static int mmc_ios_show(struct seq_file *s, void *data) case MMC_TIMING_UHS_DDR50: str = sd uhs DDR50; break; + case MMC_TIMING_MMC_HS200: + str = mmc high-speed SDR200; + break; default: str = invalid; break; diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index f0a9f1f..acb0865 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -286,6 +286,27 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) } card-ext_csd.raw_card_type = ext_csd[EXT_CSD_CARD_TYPE]; switch (ext_csd[EXT_CSD_CARD_TYPE] EXT_CSD_CARD_TYPE_MASK) { + case EXT_CSD_CARD_TYPE_SDR_ALL: + case EXT_CSD_CARD_TYPE_SDR_ALL_DDR_1_8V: + case EXT_CSD_CARD_TYPE_SDR_ALL_DDR_1_2V: + case EXT_CSD_CARD_TYPE_SDR_ALL_DDR_52: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_200; + break; + case EXT_CSD_CARD_TYPE_SDR_1_2V_ALL: + case EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_1_8V: + case EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_1_2V: + case EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_52: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_1_2V; + break; + case EXT_CSD_CARD_TYPE_SDR_1_8V_ALL: + case EXT_CSD_CARD_TYPE_SDR_1_8V_DDR_1_8V: + case EXT_CSD_CARD_TYPE_SDR_1_8V_DDR_1_2V: + case EXT_CSD_CARD_TYPE_SDR_1_8V_DDR_52: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_1_8V; + break; case EXT_CSD_CARD_TYPE_DDR_52 | EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: card-ext_csd.hs_max_dtr = 5200; @@ -700,6 +721,64 @@ static int mmc_select_powerclass(struct mmc_card *card, } /* + * Selects the desired buswidth and switch to the HS200 mode + * if bus width set without error + */ +static int mmc_select_hs200(struct mmc_card *card) +{ + int err = 0; + struct mmc_host *host; + u32 bus_width = MMC_BUS_WIDTH_4; + + BUG_ON(!card); + + host = card-host; + + if ((card-ext_csd.card_type EXT_CSD_CARD_TYPE_SDR_1_2V) + (host-caps2 MMC_CAP2_HS200_1_2V_SDR)) + if (mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120, 0)) + err = mmc_set_signal_voltage(host, + MMC_SIGNAL_VOLTAGE_180,0); + + /* If fails try again during next card power cycle */ + if (err) + goto err; + + /* + * Host is capable of 8bit transfer, then switch + * the device to work in 8bit transfer mode. If the + * mmc switch command returns error then switch to + * 4bit transfer mode. On success set the corresponding + * bus width on the host. + */ + if (host-caps MMC_CAP_8_BIT_DATA) { + err
[PATCH V7 0/2] HS200 Mode support for device and host
changes in v7: Updated with review comments for minor changes in host conditional handling. added the handling for 4 bit bus width. Changes in v6: split the patch into 2 and classified them as a patch for device and host. Modified to include the review comments. Changes in v5: Reduced the case statements for better code readability. Removed unused macro definitions. Modified the tuning function prototype and definition to support tuning for both SD and eMMC cards. Changes in v4: Rebased onto chris-mmc/mmc-next branch. This patch is successfully applied on commit with id de022ed3fdc14808299b2fa66dbb1ed5ab921912. Changes in v3: In the previous commits of chris-mmc/mmc-next branch, the patch with commit id (c0f22a2c92e357e7cb3988b0b13034d70b7461f9) defines caps2 for more capabilities. This patch version deletes the member ext_caps(created in my earlier patch) from struct mmc_host and reuses already accepted caps2 member. Changes in v2: Rebased to latest chris-mmc/mmc-next branch. Resolved indentation problems identified in review. This patch has to be applied before the patch released for modifying the printk messages. Changes in v1: Case statements in switch that produce same result have been combined to reduce repeated assignments. patch recreated after rebase to chris balls mmc-next branch. Girish K S (2): mmc: core: HS200 mode support for eMMC 4.5 mmc: host: Adds support for eMMC 4.5 HS200 mode drivers/mmc/core/bus.c |3 +- drivers/mmc/core/debugfs.c |3 + drivers/mmc/core/mmc.c | 142 +--- drivers/mmc/core/sd.c |3 +- drivers/mmc/core/sdio.c|4 +- drivers/mmc/host/sdhci.c | 45 +++ drivers/mmc/host/sdhci.h |1 + include/linux/mmc/card.h |3 + include/linux/mmc/host.h | 11 +++- include/linux/mmc/mmc.h| 66 - include/linux/mmc/sdhci.h |1 + 11 files changed, 257 insertions(+), 25 deletions(-) -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH V7 1/2] mmc: core: HS200 mode support for eMMC 4.5
This patch adds the support of the HS200 bus speed for eMMC 4.5 devices. The eMMC 4.5 devices have support for 200MHz bus speed. The function prototype of the tuning function is modified to handle the tuning command number which is different in sd and mmc case. cc: Chris Ball c...@laptop.org Signed-off-by: Girish K S girish.shivananja...@linaro.org --- drivers/mmc/core/bus.c |3 +- drivers/mmc/core/debugfs.c |3 + drivers/mmc/core/mmc.c | 142 +--- drivers/mmc/core/sd.c |3 +- drivers/mmc/core/sdio.c|4 +- include/linux/mmc/card.h |3 + include/linux/mmc/mmc.h| 66 - 7 files changed, 211 insertions(+), 13 deletions(-) diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index f8a228a..5d011a3 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c @@ -303,10 +303,11 @@ int mmc_add_card(struct mmc_card *card) mmc_card_ddr_mode(card) ? DDR : , type); } else { - printk(KERN_INFO %s: new %s%s%s card at address %04x\n, + pr_info(%s: new %s%s%s%s card at address %04x\n, mmc_hostname(card-host), mmc_card_uhs(card) ? ultra high speed : (mmc_card_highspeed(card) ? high speed : ), + (mmc_card_hs200(card) ? HS200 : ), mmc_card_ddr_mode(card) ? DDR : , type, card-rca); } diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c index 027615d..9ab5b17 100644 --- a/drivers/mmc/core/debugfs.c +++ b/drivers/mmc/core/debugfs.c @@ -135,6 +135,9 @@ static int mmc_ios_show(struct seq_file *s, void *data) case MMC_TIMING_UHS_DDR50: str = sd uhs DDR50; break; + case MMC_TIMING_MMC_HS200: + str = mmc high-speed SDR200; + break; default: str = invalid; break; diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index f0a9f1f..4de3416 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -286,6 +286,27 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) } card-ext_csd.raw_card_type = ext_csd[EXT_CSD_CARD_TYPE]; switch (ext_csd[EXT_CSD_CARD_TYPE] EXT_CSD_CARD_TYPE_MASK) { + case EXT_CSD_CARD_TYPE_SDR_ALL: + case EXT_CSD_CARD_TYPE_SDR_ALL_DDR_1_8V: + case EXT_CSD_CARD_TYPE_SDR_ALL_DDR_1_2V: + case EXT_CSD_CARD_TYPE_SDR_ALL_DDR_52: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_200; + break; + case EXT_CSD_CARD_TYPE_SDR_1_2V_ALL: + case EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_1_8V: + case EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_1_2V: + case EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_52: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_1_2V; + break; + case EXT_CSD_CARD_TYPE_SDR_1_8V_ALL: + case EXT_CSD_CARD_TYPE_SDR_1_8V_DDR_1_8V: + case EXT_CSD_CARD_TYPE_SDR_1_8V_DDR_1_2V: + case EXT_CSD_CARD_TYPE_SDR_1_8V_DDR_52: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_1_8V; + break; case EXT_CSD_CARD_TYPE_DDR_52 | EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: card-ext_csd.hs_max_dtr = 5200; @@ -700,6 +721,58 @@ static int mmc_select_powerclass(struct mmc_card *card, } /* + * Selects the desired buswidth and switch to the HS200 mode + * if bus width set without error + */ +static int mmc_select_hs200(struct mmc_card *card) +{ + int err = 0; + struct mmc_host *host; + u32 bus_width = MMC_BUS_WIDTH_4; + + BUG_ON(!card); + + host = card-host; + + if ((card-ext_csd.card_type EXT_CSD_CARD_TYPE_SDR_1_2V) +(host-caps2 MMC_CAP2_HS200_1_2V_SDR)) + err = mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120, 0); + + /* +* Host is capable of 8bit transfer, then switch +* the device to work in 8bit transfer mode. If the +* mmc switch command returns error then switch to +* 4bit transfer mode. On success set the corresponding +* bus width on the host. +*/ + if (!err host-caps MMC_CAP_8_BIT_DATA) { + err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, +EXT_CSD_BUS_WIDTH, +EXT_CSD_BUS_WIDTH_8, +card-ext_csd.generic_cmd6_time); + bus_width = MMC_BUS_WIDTH_8; + } + + /* If the 8bit mode fails switch to 4 bit mode */ + if (err) { + err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL
Re: [PATCH V6 1/2] mmc: core: HS200 mode support for eMMC 4.5
On 19 December 2011 15:40, Subhash Jadavani subha...@codeaurora.org wrote: Hi Girish, Overall this patch looks good. I have only 2 minor comments inline below. Regards, Subhash -Original Message- From: linux-mmc-ow...@vger.kernel.org [mailto:linux-mmc- ow...@vger.kernel.org] On Behalf Of Girish K S Sent: Monday, December 19, 2011 12:07 PM To: linux-...@vger.kernel.org Cc: patc...@linaro.org; linux-samsung-soc@vger.kernel.org; Girish K S; Chris Ball Subject: [PATCH V6 1/2] mmc: core: HS200 mode support for eMMC 4.5 This patch adds the support of the HS200 bus speed for eMMC 4.5 devices. The eMMC 4.5 devices have support for 200MHz bus speed. The function prototype of the tuning function is modified to handle the tuning command number which is different in sd and mmc case. cc: Chris Ball c...@laptop.org Signed-off-by: Girish K S girish.shivananja...@linaro.org --- drivers/mmc/core/bus.c | 3 +- drivers/mmc/core/debugfs.c | 3 + drivers/mmc/core/mmc.c | 147 +--- drivers/mmc/core/sd.c | 3 +- drivers/mmc/core/sdio.c | 4 +- include/linux/mmc/card.h | 3 + include/linux/mmc/mmc.h | 66 +++- 7 files changed, 216 insertions(+), 13 deletions(-) diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index f8a228a..5d011a3 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c @@ -303,10 +303,11 @@ int mmc_add_card(struct mmc_card *card) mmc_card_ddr_mode(card) ? DDR : , type); } else { - printk(KERN_INFO %s: new %s%s%s card at address %04x\n, + pr_info(%s: new %s%s%s%s card at address %04x\n, mmc_hostname(card-host), mmc_card_uhs(card) ? ultra high speed : (mmc_card_highspeed(card) ? high speed : ), + (mmc_card_hs200(card) ? HS200 : ), mmc_card_ddr_mode(card) ? DDR : , type, card-rca); } diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c index 027615d..9ab5b17 100644 --- a/drivers/mmc/core/debugfs.c +++ b/drivers/mmc/core/debugfs.c @@ -135,6 +135,9 @@ static int mmc_ios_show(struct seq_file *s, void *data) case MMC_TIMING_UHS_DDR50: str = sd uhs DDR50; break; + case MMC_TIMING_MMC_HS200: + str = mmc high-speed SDR200; + break; default: str = invalid; break; diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index f0a9f1f..d5d93de 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -286,6 +286,27 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) } card-ext_csd.raw_card_type = ext_csd[EXT_CSD_CARD_TYPE]; switch (ext_csd[EXT_CSD_CARD_TYPE] EXT_CSD_CARD_TYPE_MASK) { + case EXT_CSD_CARD_TYPE_SDR_ALL: + case EXT_CSD_CARD_TYPE_SDR_ALL_DDR_1_8V: + case EXT_CSD_CARD_TYPE_SDR_ALL_DDR_1_2V: + case EXT_CSD_CARD_TYPE_SDR_ALL_DDR_52: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_200; + break; + case EXT_CSD_CARD_TYPE_SDR_1_2V_ALL: + case EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_1_8V: + case EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_1_2V: + case EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_52: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_1_2V; + break; + case EXT_CSD_CARD_TYPE_SDR_1_8V_ALL: + case EXT_CSD_CARD_TYPE_SDR_1_8V_DDR_1_8V: + case EXT_CSD_CARD_TYPE_SDR_1_8V_DDR_1_2V: + case EXT_CSD_CARD_TYPE_SDR_1_8V_DDR_52: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_1_8V; + break; case EXT_CSD_CARD_TYPE_DDR_52 | EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: card-ext_csd.hs_max_dtr = 5200; @@ -700,6 +721,52 @@ static int mmc_select_powerclass(struct mmc_card *card, } /* + * Selects the desired buswidth and switch to the HS200 mode + * if bus width set without error + */ +static int mmc_select_hs200(struct mmc_card *card) +{ + int err = 0; + struct mmc_host *host; + u32 bus_width = MMC_BUS_WIDTH_4; + + BUG_ON(!card); + + host = card-host; + + /* + * Host is capable of 8bit transfer, then switch + * the device to work in 8bit transfer mode. If the + * mmc switch command returns error then switch to + * 4bit transfer mode. On success set the corresponding + * bus width on the host. + */ + if (host-caps MMC_CAP_8_BIT_DATA) { + err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, + EXT_CSD_BUS_WIDTH
[PATCH V6 0/2] HS200 Mode support for device and host
Changes in v6: split the patch into 2 and classified them as a patch for device and host. Modified to include the review comments. Changes in v5: Reduced the case statements for better code readability. Removed unused macro definitions. Modified the tuning function prototype and definition to support tuning for both SD and eMMC cards. Changes in v4: Rebased onto chris-mmc/mmc-next branch. This patch is successfully applied on commit with id de022ed3fdc14808299b2fa66dbb1ed5ab921912. Changes in v3: In the previous commits of chris-mmc/mmc-next branch, the patch with commit id (c0f22a2c92e357e7cb3988b0b13034d70b7461f9) defines caps2 for more capabilities. This patch version deletes the member ext_caps(created in my earlier patch) from struct mmc_host and reuses already accepted caps2 member. Changes in v2: Rebased to latest chris-mmc/mmc-next branch. Resolved indentation problems identified in review. This patch has to be applied before the patch released for modifying the printk messages. Changes in v1: Case statements in switch that produce same result have been combined to reduce repeated assignments. patch recreated after rebase to chris balls mmc-next branch. Girish K S (2): mmc: core: HS200 mode support for eMMC 4.5 mmc: host: Adds support for eMMC 4.5 HS200 mode drivers/mmc/core/bus.c |3 +- drivers/mmc/core/debugfs.c |3 + drivers/mmc/core/mmc.c | 147 +--- drivers/mmc/core/sd.c |3 +- drivers/mmc/core/sdio.c|4 +- drivers/mmc/host/sdhci.c | 43 ++--- drivers/mmc/host/sdhci.h |1 + include/linux/mmc/card.h |3 + include/linux/mmc/host.h | 11 +++- include/linux/mmc/mmc.h| 66 +++- include/linux/mmc/sdhci.h |1 + 11 files changed, 261 insertions(+), 24 deletions(-) -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH V1] mmc: core: Add host capability check for power class
This patch adds a check whether the host supports maximum current value obtained from the device's extended csd register for a selected interface voltage and frequency. cc: Chris Ball c...@laptop.org Signed-off-by: Girish K S girish.shivananja...@linaro.org --- Changes in v1: reduced the number of comparisons as per Hein's suggestion drivers/mmc/core/mmc.c | 21 + include/linux/mmc/card.h |4 2 files changed, 25 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 006e932..e7f1902 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -688,6 +688,27 @@ static int mmc_select_powerclass(struct mmc_card *card, pwrclass_val = (pwrclass_val EXT_CSD_PWR_CL_4BIT_MASK) EXT_CSD_PWR_CL_4BIT_SHIFT; + if (pwrclass_val = MMC_MAX_CURRENT_800) + pwrclass_val = MMC_MAX_CURRENT_800; + else if (pwrclass_val = MMC_MAX_CURRENT_600) + pwrclass_val = MMC_MAX_CURRENT_600; + else if (pwrclass_val = MMC_MAX_CURRENT_400) + pwrclass_val = MMC_MAX_CURRENT_400; + else if (pwrclass_val = MMC_MAX_CURRENT_200) + pwrclass_val = MMC_MAX_CURRENT_200; + else + pwrclass_val = MMC_MAX_CURRENT_200; + + if ((pwrclass_val == MMC_MAX_CURRENT_800) + !(card-host-caps MMC_CAP_MAX_CURRENT_800)) + pwrclass_val = MMC_MAX_CURRENT_600; + if ((pwrclass_val == MMC_MAX_CURRENT_600) + !(card-host-caps MMC_CAP_MAX_CURRENT_600)) + pwrclass_val = MMC_MAX_CURRENT_400; + if ((pwrclass_val == MMC_MAX_CURRENT_400) + !(card-host-caps MMC_CAP_MAX_CURRENT_400)) + pwrclass_val = MMC_MAX_CURRENT_200; + /* If the power class is different from the default value */ if (pwrclass_val 0) { err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index 9478a6b..c5e031a 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h @@ -195,6 +195,10 @@ struct mmc_part { #define MMC_BLK_DATA_AREA_GP (12) }; +#define MMC_MAX_CURRENT_200(0) +#define MMC_MAX_CURRENT_400(7) +#define MMC_MAX_CURRENT_600(11) +#define MMC_MAX_CURRENT_800(13) /* * MMC device */ -- 1.7.1 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V5] mmc: core: HS200 mode support for eMMC 4.5
On 14 December 2011 20:50, Subhash Jadavani subha...@codeaurora.org wrote: Just a thought (not sure if it's explicitly specified in 4.5 spec or not): Do we really need to perform bus test in HS200 mode? because in HS200, we are anyways going to perform the tuning sequence (which achieves what bus test command does). you are right. i have removed it in the modified version. It does only tuning and power class selection Regards, Subhash -Original Message- From: Saugata Das [mailto:saugata@linaro.org] Sent: Tuesday, December 13, 2011 11:03 AM To: Girish K S Cc: Subhash Jadavani; linux-...@vger.kernel.org; patc...@linaro.org; linux-samsung-soc@vger.kernel.org; Chris Ball Subject: Re: [PATCH V5] mmc: core: HS200 mode support for eMMC 4.5 On 13 December 2011 10:13, Girish K S girish.shivananja...@linaro.org wrote: On 12 December 2011 12:20, Girish K S girish.shivananja...@linaro.org wrote: On 5 December 2011 20:29, Saugata Das saugata@linaro.org wrote: Hi Girish Please refer to Figure 71 (HS200 device output timing) of the MMC- 4.5 spec. It shows that both CMD and DATA[7-0] will have some latency till valid window. This implies that even the CMD line will need tuning for reading the response. The specification talks about identifying sampling point for data lines by reading tuning blocks. Based on host controller capability, even the CMD line will get the good sample point during the same tuning sequence. We need to have the tuning done (execute_tuning) soon after switching to HS200 mode and 200MHz clock. If i make a change as per subhash suggestionset bus width before setting the HS200 mode. then it will affect the entire frame work of mmc which is developed as per Annexure A6.1 A.6.2 A.6.3 (mentions the steps for bus initialization). can any of you suggest a way to do this. Note that, we need to make this modification only for HS200 mode. For DDR mode, it is required that we keep the current way (i.e. setting BUS_WIDTH after HS_TIMING). Any inputs on this Regards Saugata On 5 December 2011 16:59, Subhash Jadavani subha...@codeaurora.org wrote: -Original Message- From: Girish K S [mailto:girish.shivananja...@linaro.org] Sent: Monday, December 05, 2011 12:20 PM To: Subhash Jadavani Cc: linux-...@vger.kernel.org; patc...@linaro.org; linux-samsung- s...@vger.kernel.org; Chris Ball Subject: Re: [PATCH V5] mmc: core: HS200 mode support for eMMC 4.5 On 5 December 2011 11:46, Subhash Jadavani subha...@codeaurora.org wrote: -Original Message- From: Girish K S [mailto:girish.shivananja...@linaro.org] Sent: Friday, December 02, 2011 5:08 PM To: Subhash Jadavani Cc: linux-...@vger.kernel.org; patc...@linaro.org; linux- samsung- s...@vger.kernel.org; Chris Ball Subject: Re: [PATCH V5] mmc: core: HS200 mode support for eMMC 4.5 On 2 December 2011 00:02, Subhash Jadavani subha...@codeaurora.org wrote: -Original Message- From: linux-mmc-ow...@vger.kernel.org [mailto:linux-mmc- ow...@vger.kernel.org] On Behalf Of Girish K S Sent: Thursday, December 01, 2011 7:48 PM To: Subhash Jadavani Cc: linux-...@vger.kernel.org; patc...@linaro.org; linux- samsung- s...@vger.kernel.org; Chris Ball Subject: Re: [PATCH V5] mmc: core: HS200 mode support for eMMC 4.5 On 1 December 2011 16:27, Subhash Jadavani subha...@codeaurora.org wrote: -Original Message- From: linux-mmc-ow...@vger.kernel.org [mailto:linux-mmc- ow...@vger.kernel.org] On Behalf Of Girish K S Sent: Thursday, December 01, 2011 3:58 PM To: Subhash Jadavani Cc: linux-...@vger.kernel.org; patc...@linaro.org; linux- samsung- s...@vger.kernel.org; Chris Ball Subject: Re: [PATCH V5] mmc: core: HS200 mode support for eMMC 4.5 On 1 December 2011 15:33, Subhash Jadavani subha...@codeaurora.org wrote: Hi Girish, -Original Message- From: linux-mmc-ow...@vger.kernel.org [mailto:linux- mmc- ow...@vger.kernel.org] On Behalf Of Girish K S Sent: Wednesday, November 30, 2011 2:24 PM To: linux-...@vger.kernel.org Cc: patc...@linaro.org; linux-samsung- s...@vger.kernel.org; subha...@codeaurora.org; Girish K S; Chris Ball Subject: [PATCH V5] mmc: core: HS200 mode support for eMMC 4.5 This patch adds the support of the HS200 bus speed for eMMC 4.5 devices. The eMMC 4.5 devices have support for 200MHz bus speed.The mmc core and host modules have been touched to add support for this module. It is necessary to know the card type in the sdhci.c file to add support for eMMC tuning function. So card.h file is included to import the card data structure. cc: Chris Ball c...@laptop.org
[PATCH V2] mmc: core: Add host capability check for power class
This patch adds a check whether the host supports maximum current value obtained from the device's extended csd register for a selected interface voltage and frequency. cc: Chris Ball c...@laptop.org Signed-off-by: Girish K S girish.shivananja...@linaro.org --- Changes in v2: deleted a unnecessary if else condition identified by subhash J Changes in v1: reduced the number of comparisons as per Hein's suggestion drivers/mmc/core/mmc.c | 19 +++ include/linux/mmc/card.h |4 2 files changed, 23 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 006e932..b9ef777 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -688,6 +688,25 @@ static int mmc_select_powerclass(struct mmc_card *card, pwrclass_val = (pwrclass_val EXT_CSD_PWR_CL_4BIT_MASK) EXT_CSD_PWR_CL_4BIT_SHIFT; + if (pwrclass_val = MMC_MAX_CURRENT_800) + pwrclass_val = MMC_MAX_CURRENT_800; + else if (pwrclass_val = MMC_MAX_CURRENT_600) + pwrclass_val = MMC_MAX_CURRENT_600; + else if (pwrclass_val = MMC_MAX_CURRENT_400) + pwrclass_val = MMC_MAX_CURRENT_400; + else + pwrclass_val = MMC_MAX_CURRENT_200; + + if ((pwrclass_val == MMC_MAX_CURRENT_800) + !(card-host-caps MMC_CAP_MAX_CURRENT_800)) + pwrclass_val = MMC_MAX_CURRENT_600; + if ((pwrclass_val == MMC_MAX_CURRENT_600) + !(card-host-caps MMC_CAP_MAX_CURRENT_600)) + pwrclass_val = MMC_MAX_CURRENT_400; + if ((pwrclass_val == MMC_MAX_CURRENT_400) + !(card-host-caps MMC_CAP_MAX_CURRENT_400)) + pwrclass_val = MMC_MAX_CURRENT_200; + /* If the power class is different from the default value */ if (pwrclass_val 0) { err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index 9478a6b..c5e031a 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h @@ -195,6 +195,10 @@ struct mmc_part { #define MMC_BLK_DATA_AREA_GP (12) }; +#define MMC_MAX_CURRENT_200(0) +#define MMC_MAX_CURRENT_400(7) +#define MMC_MAX_CURRENT_600(11) +#define MMC_MAX_CURRENT_800(13) /* * MMC device */ -- 1.7.1 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V2] mmc: core: Add host capability check for power class
On 15 December 2011 11:33, amit kachhap amit.kach...@linaro.org wrote: On Thu, Dec 15, 2011 at 9:28 AM, Girish K S girish.shivananja...@linaro.org wrote: This patch adds a check whether the host supports maximum current value obtained from the device's extended csd register for a selected interface voltage and frequency. cc: Chris Ball c...@laptop.org Signed-off-by: Girish K S girish.shivananja...@linaro.org --- Changes in v2: deleted a unnecessary if else condition identified by subhash J Changes in v1: reduced the number of comparisons as per Hein's suggestion drivers/mmc/core/mmc.c | 19 +++ include/linux/mmc/card.h | 4 2 files changed, 23 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 006e932..b9ef777 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -688,6 +688,25 @@ static int mmc_select_powerclass(struct mmc_card *card, pwrclass_val = (pwrclass_val EXT_CSD_PWR_CL_4BIT_MASK) EXT_CSD_PWR_CL_4BIT_SHIFT; + if (pwrclass_val = MMC_MAX_CURRENT_800) Hi girish, These checks can be made like , if (pwrclass_val MMC_MAX_CURRENT_800) pwrclass_val = MMC_MAX_CURRENT_800; Applicable in all below conditional checks. I feel that should be OK. Since there will be no significant improvement or side effects with the current implementation. Thanks, Amit D + pwrclass_val = MMC_MAX_CURRENT_800; + else if (pwrclass_val = MMC_MAX_CURRENT_600) + pwrclass_val = MMC_MAX_CURRENT_600; + else if (pwrclass_val = MMC_MAX_CURRENT_400) + pwrclass_val = MMC_MAX_CURRENT_400; + else + pwrclass_val = MMC_MAX_CURRENT_200; + + if ((pwrclass_val == MMC_MAX_CURRENT_800) + !(card-host-caps MMC_CAP_MAX_CURRENT_800)) + pwrclass_val = MMC_MAX_CURRENT_600; + if ((pwrclass_val == MMC_MAX_CURRENT_600) + !(card-host-caps MMC_CAP_MAX_CURRENT_600)) + pwrclass_val = MMC_MAX_CURRENT_400; + if ((pwrclass_val == MMC_MAX_CURRENT_400) + !(card-host-caps MMC_CAP_MAX_CURRENT_400)) + pwrclass_val = MMC_MAX_CURRENT_200; + /* If the power class is different from the default value */ if (pwrclass_val 0) { err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index 9478a6b..c5e031a 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h @@ -195,6 +195,10 @@ struct mmc_part { #define MMC_BLK_DATA_AREA_GP (12) }; +#define MMC_MAX_CURRENT_200 (0) +#define MMC_MAX_CURRENT_400 (7) +#define MMC_MAX_CURRENT_600 (11) +#define MMC_MAX_CURRENT_800 (13) /* * MMC device */ -- 1.7.1 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V6] mmc: core: Add host capability check for power class
Ignore this patch On 14 December 2011 11:44, Girish K S girish.shivananja...@linaro.org wrote: This patch adds a check whether the host supports maximum current value obtained from the device's extended csd register for a selected interface voltage and frequency. cc: Chris Ball c...@laptop.org Signed-off-by: Girish K S girish.shivananja...@linaro.org --- Changes in v6: Added the check whehter the host supports the max current value read from the extended csd register. Changes in v5: Replace break statement with appropriate return error value in drivers/mmc/core/mmc.c for unsupported voltage range. Changes in v4: updated with review comments. Changes in v3: updated with review comments made by chris ball. patch generated by rebasing to chris balls mmc-next branch. Changes in v2: This patch version removes some checkpatch error Changes in v1: This version modifies the power_class_select function prototype. During device enumeration, when the host tries to read the extended csd register after switching to higher bus width, the read fails at higher bus width. So the power_class_select function is modified to reuse the extended csd register values read with 1 bit bus width. drivers/mmc/core/mmc.c | 27 +++ include/linux/mmc/card.h | 4 2 files changed, 31 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 006e932..30d1cbc 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -688,6 +688,33 @@ static int mmc_select_powerclass(struct mmc_card *card, pwrclass_val = (pwrclass_val EXT_CSD_PWR_CL_4BIT_MASK) EXT_CSD_PWR_CL_4BIT_SHIFT; + if (card-host-caps MMC_CAP_MAX_CURRENT_800) { + if (pwrclass_val = MMC_MAX_CURRENT_800) + pwrclass_val = MMC_MAX_CURRENT_800; + else if (pwrclass_val = MMC_MAX_CURRENT_600) + pwrclass_val = MMC_MAX_CURRENT_600; + else if (pwrclass_val = MMC_MAX_CURRENT_400) + pwrclass_val = MMC_MAX_CURRENT_400; + else if (pwrclass_val = MMC_MAX_CURRENT_200) + pwrclass_val = MMC_MAX_CURRENT_200; + } else if (card-host-caps MMC_CAP_MAX_CURRENT_600) { + if (pwrclass_val = MMC_MAX_CURRENT_600) + pwrclass_val = MMC_MAX_CURRENT_600; + else if (pwrclass_val = MMC_MAX_CURRENT_400) + pwrclass_val = MMC_MAX_CURRENT_400; + else if (pwrclass_val = MMC_MAX_CURRENT_200) + pwrclass_val = MMC_MAX_CURRENT_200; + } else if (card-host-caps MMC_CAP_MAX_CURRENT_400) { + if (pwrclass_val = MMC_MAX_CURRENT_400) + pwrclass_val = MMC_MAX_CURRENT_400; + else if (pwrclass_val = MMC_MAX_CURRENT_200) + pwrclass_val = MMC_MAX_CURRENT_200; + } else if (card-host-caps MMC_CAP_MAX_CURRENT_200) { + if (pwrclass_val = MMC_MAX_CURRENT_200) + pwrclass_val = MMC_MAX_CURRENT_200; + } else + pwrclass_val = MMC_MAX_CURRENT_200; + /* If the power class is different from the default value */ if (pwrclass_val 0) { err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index 9478a6b..c5e031a 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h @@ -195,6 +195,10 @@ struct mmc_part { #define MMC_BLK_DATA_AREA_GP (12) }; +#define MMC_MAX_CURRENT_200 (0) +#define MMC_MAX_CURRENT_400 (7) +#define MMC_MAX_CURRENT_600 (11) +#define MMC_MAX_CURRENT_800 (13) /* * MMC device */ -- 1.7.1 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] mmc: core: Add host capability check for power class
This patch adds a check whether the host supports maximum current value obtained from the device's extended csd register for a selected interface voltage and frequency. Signed-off-by: Girish K S girish.shivananja...@linaro.org --- drivers/mmc/core/mmc.c | 27 +++ include/linux/mmc/card.h |4 2 files changed, 31 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 006e932..30d1cbc 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -688,6 +688,33 @@ static int mmc_select_powerclass(struct mmc_card *card, pwrclass_val = (pwrclass_val EXT_CSD_PWR_CL_4BIT_MASK) EXT_CSD_PWR_CL_4BIT_SHIFT; + if (card-host-caps MMC_CAP_MAX_CURRENT_800) { + if (pwrclass_val = MMC_MAX_CURRENT_800) + pwrclass_val = MMC_MAX_CURRENT_800; + else if (pwrclass_val = MMC_MAX_CURRENT_600) + pwrclass_val = MMC_MAX_CURRENT_600; + else if (pwrclass_val = MMC_MAX_CURRENT_400) + pwrclass_val = MMC_MAX_CURRENT_400; + else if (pwrclass_val = MMC_MAX_CURRENT_200) + pwrclass_val = MMC_MAX_CURRENT_200; + } else if (card-host-caps MMC_CAP_MAX_CURRENT_600) { + if (pwrclass_val = MMC_MAX_CURRENT_600) + pwrclass_val = MMC_MAX_CURRENT_600; + else if (pwrclass_val = MMC_MAX_CURRENT_400) + pwrclass_val = MMC_MAX_CURRENT_400; + else if (pwrclass_val = MMC_MAX_CURRENT_200) + pwrclass_val = MMC_MAX_CURRENT_200; + } else if (card-host-caps MMC_CAP_MAX_CURRENT_400) { + if (pwrclass_val = MMC_MAX_CURRENT_400) + pwrclass_val = MMC_MAX_CURRENT_400; + else if (pwrclass_val = MMC_MAX_CURRENT_200) + pwrclass_val = MMC_MAX_CURRENT_200; + } else if (card-host-caps MMC_CAP_MAX_CURRENT_200) { + if (pwrclass_val = MMC_MAX_CURRENT_200) + pwrclass_val = MMC_MAX_CURRENT_200; + } else + pwrclass_val = MMC_MAX_CURRENT_200; + /* If the power class is different from the default value */ if (pwrclass_val 0) { err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index 9478a6b..c5e031a 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h @@ -195,6 +195,10 @@ struct mmc_part { #define MMC_BLK_DATA_AREA_GP (12) }; +#define MMC_MAX_CURRENT_200(0) +#define MMC_MAX_CURRENT_400(7) +#define MMC_MAX_CURRENT_600(11) +#define MMC_MAX_CURRENT_800(13) /* * MMC device */ -- 1.7.1 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V5] mmc: core: HS200 mode support for eMMC 4.5
On 5 December 2011 20:29, Saugata Das saugata@linaro.org wrote: Hi Girish Please refer to Figure 71 (HS200 device output timing) of the MMC-4.5 spec. It shows that both CMD and DATA[7-0] will have some latency till valid window. This implies that even the CMD line will need tuning for reading the response. The specification talks about identifying sampling point for data lines by reading tuning blocks. Based on host controller capability, even the CMD line will get the good sample point during the same tuning sequence. We need to have the tuning done (execute_tuning) soon after switching to HS200 mode and 200MHz clock. If i make a change as per subhash suggestionset bus width before setting the HS200 mode. then it will affect the entire frame work of mmc which is developed as per Annexure A6.1 A.6.2 A.6.3 (mentions the steps for bus initialization). can any of you suggest a way to do this. Regards Saugata On 5 December 2011 16:59, Subhash Jadavani subha...@codeaurora.org wrote: -Original Message- From: Girish K S [mailto:girish.shivananja...@linaro.org] Sent: Monday, December 05, 2011 12:20 PM To: Subhash Jadavani Cc: linux-...@vger.kernel.org; patc...@linaro.org; linux-samsung- s...@vger.kernel.org; Chris Ball Subject: Re: [PATCH V5] mmc: core: HS200 mode support for eMMC 4.5 On 5 December 2011 11:46, Subhash Jadavani subha...@codeaurora.org wrote: -Original Message- From: Girish K S [mailto:girish.shivananja...@linaro.org] Sent: Friday, December 02, 2011 5:08 PM To: Subhash Jadavani Cc: linux-...@vger.kernel.org; patc...@linaro.org; linux-samsung- s...@vger.kernel.org; Chris Ball Subject: Re: [PATCH V5] mmc: core: HS200 mode support for eMMC 4.5 On 2 December 2011 00:02, Subhash Jadavani subha...@codeaurora.org wrote: -Original Message- From: linux-mmc-ow...@vger.kernel.org [mailto:linux-mmc- ow...@vger.kernel.org] On Behalf Of Girish K S Sent: Thursday, December 01, 2011 7:48 PM To: Subhash Jadavani Cc: linux-...@vger.kernel.org; patc...@linaro.org; linux-samsung- s...@vger.kernel.org; Chris Ball Subject: Re: [PATCH V5] mmc: core: HS200 mode support for eMMC 4.5 On 1 December 2011 16:27, Subhash Jadavani subha...@codeaurora.org wrote: -Original Message- From: linux-mmc-ow...@vger.kernel.org [mailto:linux-mmc- ow...@vger.kernel.org] On Behalf Of Girish K S Sent: Thursday, December 01, 2011 3:58 PM To: Subhash Jadavani Cc: linux-...@vger.kernel.org; patc...@linaro.org; linux- samsung- s...@vger.kernel.org; Chris Ball Subject: Re: [PATCH V5] mmc: core: HS200 mode support for eMMC 4.5 On 1 December 2011 15:33, Subhash Jadavani subha...@codeaurora.org wrote: Hi Girish, -Original Message- From: linux-mmc-ow...@vger.kernel.org [mailto:linux-mmc- ow...@vger.kernel.org] On Behalf Of Girish K S Sent: Wednesday, November 30, 2011 2:24 PM To: linux-...@vger.kernel.org Cc: patc...@linaro.org; linux-samsung-soc@vger.kernel.org; subha...@codeaurora.org; Girish K S; Chris Ball Subject: [PATCH V5] mmc: core: HS200 mode support for eMMC 4.5 This patch adds the support of the HS200 bus speed for eMMC 4.5 devices. The eMMC 4.5 devices have support for 200MHz bus speed.The mmc core and host modules have been touched to add support for this module. It is necessary to know the card type in the sdhci.c file to add support for eMMC tuning function. So card.h file is included to import the card data structure. cc: Chris Ball c...@laptop.org Signed-off-by: Girish K S girish.shivananja...@linaro.org --- Changes in v5: Reduced the case statements for better code readability. Removed unused macro definitions. Modified the tuning function prototype and definition to support tuning for both SD and eMMC cards. Changes in v4: Rebased onto chris-mmc/mmc-next branch. This patch is successfully applied on commit with id de022ed3fdc14808299b2fa66dbb1ed5ab921912. Changes in v3: In the previous commits of chris-mmc/mmc-next branch, the patch with commit id (c0f22a2c92e357e7cb3988b0b13034d70b7461f9) defines caps2 for more capabilities. This patch version deletes the member ext_caps(created in my earlier patch) from struct mmc_host and reuses already accepted caps2 member. Changes in v2: Rebased to latest chris-mmc/mmc-next branch. Resolved indentation problems identified in review. This patch has to be applied before the patch released for modifying the printk messages. Changes in v1: Case statements in switch that produce same result have been combined
Re: [PATCH V5] mmc: core: HS200 mode support for eMMC 4.5
On 5 December 2011 11:46, Subhash Jadavani subha...@codeaurora.org wrote: -Original Message- From: Girish K S [mailto:girish.shivananja...@linaro.org] Sent: Friday, December 02, 2011 5:08 PM To: Subhash Jadavani Cc: linux-...@vger.kernel.org; patc...@linaro.org; linux-samsung- s...@vger.kernel.org; Chris Ball Subject: Re: [PATCH V5] mmc: core: HS200 mode support for eMMC 4.5 On 2 December 2011 00:02, Subhash Jadavani subha...@codeaurora.org wrote: -Original Message- From: linux-mmc-ow...@vger.kernel.org [mailto:linux-mmc- ow...@vger.kernel.org] On Behalf Of Girish K S Sent: Thursday, December 01, 2011 7:48 PM To: Subhash Jadavani Cc: linux-...@vger.kernel.org; patc...@linaro.org; linux-samsung- s...@vger.kernel.org; Chris Ball Subject: Re: [PATCH V5] mmc: core: HS200 mode support for eMMC 4.5 On 1 December 2011 16:27, Subhash Jadavani subha...@codeaurora.org wrote: -Original Message- From: linux-mmc-ow...@vger.kernel.org [mailto:linux-mmc- ow...@vger.kernel.org] On Behalf Of Girish K S Sent: Thursday, December 01, 2011 3:58 PM To: Subhash Jadavani Cc: linux-...@vger.kernel.org; patc...@linaro.org; linux-samsung- s...@vger.kernel.org; Chris Ball Subject: Re: [PATCH V5] mmc: core: HS200 mode support for eMMC 4.5 On 1 December 2011 15:33, Subhash Jadavani subha...@codeaurora.org wrote: Hi Girish, -Original Message- From: linux-mmc-ow...@vger.kernel.org [mailto:linux-mmc- ow...@vger.kernel.org] On Behalf Of Girish K S Sent: Wednesday, November 30, 2011 2:24 PM To: linux-...@vger.kernel.org Cc: patc...@linaro.org; linux-samsung-soc@vger.kernel.org; subha...@codeaurora.org; Girish K S; Chris Ball Subject: [PATCH V5] mmc: core: HS200 mode support for eMMC 4.5 This patch adds the support of the HS200 bus speed for eMMC 4.5 devices. The eMMC 4.5 devices have support for 200MHz bus speed.The mmc core and host modules have been touched to add support for this module. It is necessary to know the card type in the sdhci.c file to add support for eMMC tuning function. So card.h file is included to import the card data structure. cc: Chris Ball c...@laptop.org Signed-off-by: Girish K S girish.shivananja...@linaro.org --- Changes in v5: Reduced the case statements for better code readability. Removed unused macro definitions. Modified the tuning function prototype and definition to support tuning for both SD and eMMC cards. Changes in v4: Rebased onto chris-mmc/mmc-next branch. This patch is successfully applied on commit with id de022ed3fdc14808299b2fa66dbb1ed5ab921912. Changes in v3: In the previous commits of chris-mmc/mmc-next branch, the patch with commit id (c0f22a2c92e357e7cb3988b0b13034d70b7461f9) defines caps2 for more capabilities. This patch version deletes the member ext_caps(created in my earlier patch) from struct mmc_host and reuses already accepted caps2 member. Changes in v2: Rebased to latest chris-mmc/mmc-next branch. Resolved indentation problems identified in review. This patch has to be applied before the patch released for modifying the printk messages. Changes in v1: Case statements in switch that produce same result have been combined to reduce repeated assignments. patch recreated after rebase to chris balls mmc-next branch. drivers/mmc/core/bus.c | 3 +- drivers/mmc/core/mmc.c | 77 drivers/mmc/core/sd.c | 3 +- drivers/mmc/core/sdio.c | 4 ++- drivers/mmc/host/sdhci.c | 38 +- include/linux/mmc/card.h | 3 ++ include/linux/mmc/host.h | 11 ++- include/linux/mmc/mmc.h | 66 ++- include/linux/mmc/sdhci.h | 1 + 9 files changed, 185 insertions(+), 21 deletions(-) diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index 5639fdf..83c9f8d 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c @@ -301,10 +301,11 @@ int mmc_add_card(struct mmc_card *card) mmc_card_ddr_mode(card) ? DDR : , type); } else { - printk(KERN_INFO %s: new %s%s%s card at address %04x\n, + pr_info(%s: new %s%s%s%s card at address %04x\n, mmc_hostname(card-host), mmc_card_uhs(card) ? ultra high speed : (mmc_card_highspeed(card) ? high speed : ), + (mmc_card_hs200(card) ? HS200 : ), mmc_card_ddr_mode(card) ? DDR
[PATCH RESEND V5] mmc: core: HS200 mode support for eMMC 4.5
This patch adds the support of the HS200 bus speed for eMMC 4.5 devices. The eMMC 4.5 devices have support for 200MHz bus speed.The mmc core and host modules have been touched to add support for this module. It is necessary to know the card type in the sdhci.c file to add support for eMMC tuning function. So card.h file is included to import the card data structure. cc: Chris Ball c...@laptop.org Signed-off-by: Girish K S girish.shivananja...@linaro.org --- Changes in v5: Reduced the case statements for better code readability. Removed unused macro definitions. Modified the tuning function prototype and definition to support tuning for both SD and eMMC cards. Rebased to the latest chris-mmc branch. Changes in v4: Rebased onto chris-mmc/mmc-next branch. This patch is successfully applied on commit with id de022ed3fdc14808299b2fa66dbb1ed5ab921912. Changes in v3: In the previous commits of chris-mmc/mmc-next branch, the patch with commit id (c0f22a2c92e357e7cb3988b0b13034d70b7461f9) defines caps2 for more capabilities. This patch version deletes the member ext_caps(created in my earlier patch) from struct mmc_host and reuses already accepted caps2 member. Changes in v2: Rebased to latest chris-mmc/mmc-next branch. Resolved indentation problems identified in review. This patch has to be applied before the patch released for modifying the printk messages. Changes in v1: Case statements in switch that produce same result have been combined to reduce repeated assignments. patch recreated after rebase to chris balls mmc-next branch. drivers/mmc/core/bus.c|3 +- drivers/mmc/core/mmc.c| 77 drivers/mmc/core/sd.c |3 +- drivers/mmc/core/sdio.c |4 ++- drivers/mmc/host/sdhci.c | 38 +- include/linux/mmc/card.h |3 ++ include/linux/mmc/host.h | 11 ++- include/linux/mmc/mmc.h | 66 ++- include/linux/mmc/sdhci.h |1 + 9 files changed, 185 insertions(+), 21 deletions(-) diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index 5639fdf..83c9f8d 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c @@ -301,10 +301,11 @@ int mmc_add_card(struct mmc_card *card) mmc_card_ddr_mode(card) ? DDR : , type); } else { - printk(KERN_INFO %s: new %s%s%s card at address %04x\n, + pr_info(%s: new %s%s%s%s card at address %04x\n, mmc_hostname(card-host), mmc_card_uhs(card) ? ultra high speed : (mmc_card_highspeed(card) ? high speed : ), + (mmc_card_hs200(card) ? HS200 : ), mmc_card_ddr_mode(card) ? DDR : , type, card-rca); } diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index e8b6b5d..d1e85ba 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -285,6 +285,27 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) } card-ext_csd.raw_card_type = ext_csd[EXT_CSD_CARD_TYPE]; switch (ext_csd[EXT_CSD_CARD_TYPE] EXT_CSD_CARD_TYPE_MASK) { + case EXT_CSD_CARD_TYPE_SDR_ALL: + case EXT_CSD_CARD_TYPE_SDR_ALL_DDR_1_8V: + case EXT_CSD_CARD_TYPE_SDR_ALL_DDR_1_2V: + case EXT_CSD_CARD_TYPE_SDR_ALL_DDR_52: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_200; + break; + case EXT_CSD_CARD_TYPE_SDR_1_2V_ALL: + case EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_1_8V: + case EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_1_2V: + case EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_52: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_1_2V; + break; + case EXT_CSD_CARD_TYPE_SDR_1_8V_ALL: + case EXT_CSD_CARD_TYPE_SDR_1_8V_DDR_1_8V: + case EXT_CSD_CARD_TYPE_SDR_1_8V_DDR_1_2V: + case EXT_CSD_CARD_TYPE_SDR_1_8V_DDR_52: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_1_8V; + break; case EXT_CSD_CARD_TYPE_DDR_52 | EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: card-ext_csd.hs_max_dtr = 5200; @@ -699,6 +720,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, { struct mmc_card *card; int err, ddr = 0; + int hs_sdr = 0; u32 cid[4]; unsigned int max_dtr; u32 rocr; @@ -894,11 +916,16 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, /* * Activate high speed (if supported) */ - if ((card-ext_csd.hs_max_dtr != 0) - (host-caps MMC_CAP_MMC_HIGHSPEED
Re: [PATCH V5] mmc: core: HS200 mode support for eMMC 4.5
On 2 December 2011 00:02, Subhash Jadavani subha...@codeaurora.org wrote: -Original Message- From: linux-mmc-ow...@vger.kernel.org [mailto:linux-mmc- ow...@vger.kernel.org] On Behalf Of Girish K S Sent: Thursday, December 01, 2011 7:48 PM To: Subhash Jadavani Cc: linux-...@vger.kernel.org; patc...@linaro.org; linux-samsung- s...@vger.kernel.org; Chris Ball Subject: Re: [PATCH V5] mmc: core: HS200 mode support for eMMC 4.5 On 1 December 2011 16:27, Subhash Jadavani subha...@codeaurora.org wrote: -Original Message- From: linux-mmc-ow...@vger.kernel.org [mailto:linux-mmc- ow...@vger.kernel.org] On Behalf Of Girish K S Sent: Thursday, December 01, 2011 3:58 PM To: Subhash Jadavani Cc: linux-...@vger.kernel.org; patc...@linaro.org; linux-samsung- s...@vger.kernel.org; Chris Ball Subject: Re: [PATCH V5] mmc: core: HS200 mode support for eMMC 4.5 On 1 December 2011 15:33, Subhash Jadavani subha...@codeaurora.org wrote: Hi Girish, -Original Message- From: linux-mmc-ow...@vger.kernel.org [mailto:linux-mmc- ow...@vger.kernel.org] On Behalf Of Girish K S Sent: Wednesday, November 30, 2011 2:24 PM To: linux-...@vger.kernel.org Cc: patc...@linaro.org; linux-samsung-soc@vger.kernel.org; subha...@codeaurora.org; Girish K S; Chris Ball Subject: [PATCH V5] mmc: core: HS200 mode support for eMMC 4.5 This patch adds the support of the HS200 bus speed for eMMC 4.5 devices. The eMMC 4.5 devices have support for 200MHz bus speed.The mmc core and host modules have been touched to add support for this module. It is necessary to know the card type in the sdhci.c file to add support for eMMC tuning function. So card.h file is included to import the card data structure. cc: Chris Ball c...@laptop.org Signed-off-by: Girish K S girish.shivananja...@linaro.org --- Changes in v5: Reduced the case statements for better code readability. Removed unused macro definitions. Modified the tuning function prototype and definition to support tuning for both SD and eMMC cards. Changes in v4: Rebased onto chris-mmc/mmc-next branch. This patch is successfully applied on commit with id de022ed3fdc14808299b2fa66dbb1ed5ab921912. Changes in v3: In the previous commits of chris-mmc/mmc-next branch, the patch with commit id (c0f22a2c92e357e7cb3988b0b13034d70b7461f9) defines caps2 for more capabilities. This patch version deletes the member ext_caps(created in my earlier patch) from struct mmc_host and reuses already accepted caps2 member. Changes in v2: Rebased to latest chris-mmc/mmc-next branch. Resolved indentation problems identified in review. This patch has to be applied before the patch released for modifying the printk messages. Changes in v1: Case statements in switch that produce same result have been combined to reduce repeated assignments. patch recreated after rebase to chris balls mmc-next branch. drivers/mmc/core/bus.c | 3 +- drivers/mmc/core/mmc.c | 77 drivers/mmc/core/sd.c | 3 +- drivers/mmc/core/sdio.c | 4 ++- drivers/mmc/host/sdhci.c | 38 +- include/linux/mmc/card.h | 3 ++ include/linux/mmc/host.h | 11 ++- include/linux/mmc/mmc.h | 66 ++- include/linux/mmc/sdhci.h | 1 + 9 files changed, 185 insertions(+), 21 deletions(-) diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index 5639fdf..83c9f8d 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c @@ -301,10 +301,11 @@ int mmc_add_card(struct mmc_card *card) mmc_card_ddr_mode(card) ? DDR : , type); } else { - printk(KERN_INFO %s: new %s%s%s card at address %04x\n, + pr_info(%s: new %s%s%s%s card at address %04x\n, mmc_hostname(card-host), mmc_card_uhs(card) ? ultra high speed : (mmc_card_highspeed(card) ? high speed : ), + (mmc_card_hs200(card) ? HS200 : ), mmc_card_ddr_mode(card) ? DDR : , type, card-rca); } diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index a1223bd..f4124d6 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -285,6 +285,27 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) } card-ext_csd.raw_card_type = ext_csd[EXT_CSD_CARD_TYPE]; switch (ext_csd[EXT_CSD_CARD_TYPE] EXT_CSD_CARD_TYPE_MASK) { + case EXT_CSD_CARD_TYPE_SDR_ALL: + case
Re: [PATCH V5] mmc: core: HS200 mode support for eMMC 4.5
On 1 December 2011 15:33, Subhash Jadavani subha...@codeaurora.org wrote: Hi Girish, -Original Message- From: linux-mmc-ow...@vger.kernel.org [mailto:linux-mmc- ow...@vger.kernel.org] On Behalf Of Girish K S Sent: Wednesday, November 30, 2011 2:24 PM To: linux-...@vger.kernel.org Cc: patc...@linaro.org; linux-samsung-soc@vger.kernel.org; subha...@codeaurora.org; Girish K S; Chris Ball Subject: [PATCH V5] mmc: core: HS200 mode support for eMMC 4.5 This patch adds the support of the HS200 bus speed for eMMC 4.5 devices. The eMMC 4.5 devices have support for 200MHz bus speed.The mmc core and host modules have been touched to add support for this module. It is necessary to know the card type in the sdhci.c file to add support for eMMC tuning function. So card.h file is included to import the card data structure. cc: Chris Ball c...@laptop.org Signed-off-by: Girish K S girish.shivananja...@linaro.org --- Changes in v5: Reduced the case statements for better code readability. Removed unused macro definitions. Modified the tuning function prototype and definition to support tuning for both SD and eMMC cards. Changes in v4: Rebased onto chris-mmc/mmc-next branch. This patch is successfully applied on commit with id de022ed3fdc14808299b2fa66dbb1ed5ab921912. Changes in v3: In the previous commits of chris-mmc/mmc-next branch, the patch with commit id (c0f22a2c92e357e7cb3988b0b13034d70b7461f9) defines caps2 for more capabilities. This patch version deletes the member ext_caps(created in my earlier patch) from struct mmc_host and reuses already accepted caps2 member. Changes in v2: Rebased to latest chris-mmc/mmc-next branch. Resolved indentation problems identified in review. This patch has to be applied before the patch released for modifying the printk messages. Changes in v1: Case statements in switch that produce same result have been combined to reduce repeated assignments. patch recreated after rebase to chris balls mmc-next branch. drivers/mmc/core/bus.c | 3 +- drivers/mmc/core/mmc.c | 77 drivers/mmc/core/sd.c | 3 +- drivers/mmc/core/sdio.c | 4 ++- drivers/mmc/host/sdhci.c | 38 +- include/linux/mmc/card.h | 3 ++ include/linux/mmc/host.h | 11 ++- include/linux/mmc/mmc.h | 66 ++- include/linux/mmc/sdhci.h | 1 + 9 files changed, 185 insertions(+), 21 deletions(-) diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index 5639fdf..83c9f8d 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c @@ -301,10 +301,11 @@ int mmc_add_card(struct mmc_card *card) mmc_card_ddr_mode(card) ? DDR : , type); } else { - printk(KERN_INFO %s: new %s%s%s card at address %04x\n, + pr_info(%s: new %s%s%s%s card at address %04x\n, mmc_hostname(card-host), mmc_card_uhs(card) ? ultra high speed : (mmc_card_highspeed(card) ? high speed : ), + (mmc_card_hs200(card) ? HS200 : ), mmc_card_ddr_mode(card) ? DDR : , type, card-rca); } diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index a1223bd..f4124d6 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -285,6 +285,27 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) } card-ext_csd.raw_card_type = ext_csd[EXT_CSD_CARD_TYPE]; switch (ext_csd[EXT_CSD_CARD_TYPE] EXT_CSD_CARD_TYPE_MASK) { + case EXT_CSD_CARD_TYPE_SDR_ALL: + case EXT_CSD_CARD_TYPE_SDR_ALL_DDR_1_8V: + case EXT_CSD_CARD_TYPE_SDR_ALL_DDR_1_2V: + case EXT_CSD_CARD_TYPE_SDR_ALL_DDR_52: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_200; + break; + case EXT_CSD_CARD_TYPE_SDR_1_2V_ALL: + case EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_1_8V: + case EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_1_2V: + case EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_52: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_1_2V; + break; + case EXT_CSD_CARD_TYPE_SDR_1_8V_ALL: + case EXT_CSD_CARD_TYPE_SDR_1_8V_DDR_1_8V: + case EXT_CSD_CARD_TYPE_SDR_1_8V_DDR_1_2V: + case EXT_CSD_CARD_TYPE_SDR_1_8V_DDR_52: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_1_8V; + break; case EXT_CSD_CARD_TYPE_DDR_52 | EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: card-ext_csd.hs_max_dtr = 5200; @@ -699,6 +720,7 @@ static int mmc_init_card(struct mmc_host
Re: [PATCH V5] mmc: core: HS200 mode support for eMMC 4.5
On 1 December 2011 16:27, Subhash Jadavani subha...@codeaurora.org wrote: -Original Message- From: linux-mmc-ow...@vger.kernel.org [mailto:linux-mmc- ow...@vger.kernel.org] On Behalf Of Girish K S Sent: Thursday, December 01, 2011 3:58 PM To: Subhash Jadavani Cc: linux-...@vger.kernel.org; patc...@linaro.org; linux-samsung- s...@vger.kernel.org; Chris Ball Subject: Re: [PATCH V5] mmc: core: HS200 mode support for eMMC 4.5 On 1 December 2011 15:33, Subhash Jadavani subha...@codeaurora.org wrote: Hi Girish, -Original Message- From: linux-mmc-ow...@vger.kernel.org [mailto:linux-mmc- ow...@vger.kernel.org] On Behalf Of Girish K S Sent: Wednesday, November 30, 2011 2:24 PM To: linux-...@vger.kernel.org Cc: patc...@linaro.org; linux-samsung-soc@vger.kernel.org; subha...@codeaurora.org; Girish K S; Chris Ball Subject: [PATCH V5] mmc: core: HS200 mode support for eMMC 4.5 This patch adds the support of the HS200 bus speed for eMMC 4.5 devices. The eMMC 4.5 devices have support for 200MHz bus speed.The mmc core and host modules have been touched to add support for this module. It is necessary to know the card type in the sdhci.c file to add support for eMMC tuning function. So card.h file is included to import the card data structure. cc: Chris Ball c...@laptop.org Signed-off-by: Girish K S girish.shivananja...@linaro.org --- Changes in v5: Reduced the case statements for better code readability. Removed unused macro definitions. Modified the tuning function prototype and definition to support tuning for both SD and eMMC cards. Changes in v4: Rebased onto chris-mmc/mmc-next branch. This patch is successfully applied on commit with id de022ed3fdc14808299b2fa66dbb1ed5ab921912. Changes in v3: In the previous commits of chris-mmc/mmc-next branch, the patch with commit id (c0f22a2c92e357e7cb3988b0b13034d70b7461f9) defines caps2 for more capabilities. This patch version deletes the member ext_caps(created in my earlier patch) from struct mmc_host and reuses already accepted caps2 member. Changes in v2: Rebased to latest chris-mmc/mmc-next branch. Resolved indentation problems identified in review. This patch has to be applied before the patch released for modifying the printk messages. Changes in v1: Case statements in switch that produce same result have been combined to reduce repeated assignments. patch recreated after rebase to chris balls mmc-next branch. drivers/mmc/core/bus.c | 3 +- drivers/mmc/core/mmc.c | 77 drivers/mmc/core/sd.c | 3 +- drivers/mmc/core/sdio.c | 4 ++- drivers/mmc/host/sdhci.c | 38 +- include/linux/mmc/card.h | 3 ++ include/linux/mmc/host.h | 11 ++- include/linux/mmc/mmc.h | 66 ++- include/linux/mmc/sdhci.h | 1 + 9 files changed, 185 insertions(+), 21 deletions(-) diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index 5639fdf..83c9f8d 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c @@ -301,10 +301,11 @@ int mmc_add_card(struct mmc_card *card) mmc_card_ddr_mode(card) ? DDR : , type); } else { - printk(KERN_INFO %s: new %s%s%s card at address %04x\n, + pr_info(%s: new %s%s%s%s card at address %04x\n, mmc_hostname(card-host), mmc_card_uhs(card) ? ultra high speed : (mmc_card_highspeed(card) ? high speed : ), + (mmc_card_hs200(card) ? HS200 : ), mmc_card_ddr_mode(card) ? DDR : , type, card-rca); } diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index a1223bd..f4124d6 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -285,6 +285,27 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) } card-ext_csd.raw_card_type = ext_csd[EXT_CSD_CARD_TYPE]; switch (ext_csd[EXT_CSD_CARD_TYPE] EXT_CSD_CARD_TYPE_MASK) { + case EXT_CSD_CARD_TYPE_SDR_ALL: + case EXT_CSD_CARD_TYPE_SDR_ALL_DDR_1_8V: + case EXT_CSD_CARD_TYPE_SDR_ALL_DDR_1_2V: + case EXT_CSD_CARD_TYPE_SDR_ALL_DDR_52: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_200; + break; + case EXT_CSD_CARD_TYPE_SDR_1_2V_ALL: + case EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_1_8V: + case EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_1_2V: + case EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_52: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_1_2V
[PATCH V5] mmc: core: HS200 mode support for eMMC 4.5
This patch adds the support of the HS200 bus speed for eMMC 4.5 devices. The eMMC 4.5 devices have support for 200MHz bus speed.The mmc core and host modules have been touched to add support for this module. It is necessary to know the card type in the sdhci.c file to add support for eMMC tuning function. So card.h file is included to import the card data structure. cc: Chris Ball c...@laptop.org Signed-off-by: Girish K S girish.shivananja...@linaro.org --- Changes in v5: Reduced the case statements for better code readability. Removed unused macro definitions. Modified the tuning function prototype and definition to support tuning for both SD and eMMC cards. Changes in v4: Rebased onto chris-mmc/mmc-next branch. This patch is successfully applied on commit with id de022ed3fdc14808299b2fa66dbb1ed5ab921912. Changes in v3: In the previous commits of chris-mmc/mmc-next branch, the patch with commit id (c0f22a2c92e357e7cb3988b0b13034d70b7461f9) defines caps2 for more capabilities. This patch version deletes the member ext_caps(created in my earlier patch) from struct mmc_host and reuses already accepted caps2 member. Changes in v2: Rebased to latest chris-mmc/mmc-next branch. Resolved indentation problems identified in review. This patch has to be applied before the patch released for modifying the printk messages. Changes in v1: Case statements in switch that produce same result have been combined to reduce repeated assignments. patch recreated after rebase to chris balls mmc-next branch. drivers/mmc/core/bus.c|3 +- drivers/mmc/core/mmc.c| 77 drivers/mmc/core/sd.c |3 +- drivers/mmc/core/sdio.c |4 ++- drivers/mmc/host/sdhci.c | 38 +- include/linux/mmc/card.h |3 ++ include/linux/mmc/host.h | 11 ++- include/linux/mmc/mmc.h | 66 ++- include/linux/mmc/sdhci.h |1 + 9 files changed, 185 insertions(+), 21 deletions(-) diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index 5639fdf..83c9f8d 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c @@ -301,10 +301,11 @@ int mmc_add_card(struct mmc_card *card) mmc_card_ddr_mode(card) ? DDR : , type); } else { - printk(KERN_INFO %s: new %s%s%s card at address %04x\n, + pr_info(%s: new %s%s%s%s card at address %04x\n, mmc_hostname(card-host), mmc_card_uhs(card) ? ultra high speed : (mmc_card_highspeed(card) ? high speed : ), + (mmc_card_hs200(card) ? HS200 : ), mmc_card_ddr_mode(card) ? DDR : , type, card-rca); } diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index a1223bd..f4124d6 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -285,6 +285,27 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) } card-ext_csd.raw_card_type = ext_csd[EXT_CSD_CARD_TYPE]; switch (ext_csd[EXT_CSD_CARD_TYPE] EXT_CSD_CARD_TYPE_MASK) { + case EXT_CSD_CARD_TYPE_SDR_ALL: + case EXT_CSD_CARD_TYPE_SDR_ALL_DDR_1_8V: + case EXT_CSD_CARD_TYPE_SDR_ALL_DDR_1_2V: + case EXT_CSD_CARD_TYPE_SDR_ALL_DDR_52: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_200; + break; + case EXT_CSD_CARD_TYPE_SDR_1_2V_ALL: + case EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_1_8V: + case EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_1_2V: + case EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_52: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_1_2V; + break; + case EXT_CSD_CARD_TYPE_SDR_1_8V_ALL: + case EXT_CSD_CARD_TYPE_SDR_1_8V_DDR_1_8V: + case EXT_CSD_CARD_TYPE_SDR_1_8V_DDR_1_2V: + case EXT_CSD_CARD_TYPE_SDR_1_8V_DDR_52: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_1_8V; + break; case EXT_CSD_CARD_TYPE_DDR_52 | EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: card-ext_csd.hs_max_dtr = 5200; @@ -699,6 +720,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, { struct mmc_card *card; int err, ddr = 0; + int hs_sdr = 0; u32 cid[4]; unsigned int max_dtr; u32 rocr; @@ -894,11 +916,16 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, /* * Activate high speed (if supported) */ - if ((card-ext_csd.hs_max_dtr != 0) - (host-caps MMC_CAP_MMC_HIGHSPEED)) { - err = mmc_switch(card
Re: [PATCH RESEND V4] mmc: core: HS200 mode support for eMMC 4.5
On 24 November 2011 11:43, Subhash Jadavani subha...@codeaurora.org wrote: Hi Girish, -Original Message- From: Girish K S [mailto:girish.shivananja...@linaro.org] Sent: Monday, November 21, 2011 4:12 PM To: Subhash Jadavani Cc: linux-...@vger.kernel.org; c...@laptop.org; patc...@linaro.org; linux-samsung-soc@vger.kernel.org Subject: Re: [PATCH RESEND V4] mmc: core: HS200 mode support for eMMC 4.5 On 19 November 2011 00:29, Subhash Jadavani subha...@codeaurora.org wrote: Hi Girish, -Original Message- From: linux-mmc-ow...@vger.kernel.org [mailto:linux-mmc- ow...@vger.kernel.org] On Behalf Of Girish K S Sent: Wednesday, October 26, 2011 10:30 AM To: linux-...@vger.kernel.org Cc: c...@laptop.org; patc...@linaro.org; linux-samsung- s...@vger.kernel.org; Girish K S Subject: [PATCH RESEND V4] mmc: core: HS200 mode support for eMMC 4.5 This patch adds the support of the HS200 bus speed for eMMC 4.5 devices. The eMMC 4.5 devices have support for 200MHz bus speed.The mmc core and host modules have been touched to add support for this module. It is necessary to know the card type in the sdhci.c file to add support for eMMC tuning function. So card.h file is included to import the card data structure. We don't need to know the card type in the host controller driver if we pass the command opcode as the 2nd argument to execute_tuning() ops. Command opcode can have have either CMD19 or CMD21 as it's value depending on the card type (whether it's SD3.0 card or eMMC4.5 card). Can you see if we can implement this? I have considered this and made the patch cc: Chris Ball c...@laptop.org Signed-off-by: Girish K S girish.shivananja...@linaro.org --- Changes in v4: Rebased onto chris-mmc/mmc-next branch. This patch is successfully applied on commit with id de022ed3fdc14808299b2fa66dbb1ed5ab921912. Changes in v3: In the previous commits of chris-mmc/mmc-next branch, the patch with commit id (c0f22a2c92e357e7cb3988b0b13034d70b7461f9) defines caps2 for more capabilities. This patch version deletes the member ext_caps(created in my earlier patch) from struct mmc_host and reuses already accepted caps2 member. Changes in v2: Rebased to latest chris-mmc/mmc-next branch. Resolved indentation problems identified in review. This patch has to be applied before the patch released for modifying the printk messages. Changes in v1: Case statements in switch that produce same result have been combined to reduce repeated assignments. patch recreated after rebase to chris balls mmc-next branch. drivers/mmc/core/bus.c | 3 +- drivers/mmc/core/mmc.c | 92 drivers/mmc/host/sdhci.c | 36 +++--- include/linux/mmc/card.h | 3 + include/linux/mmc/host.h | 6 +++ include/linux/mmc/mmc.h | 8 +++- include/linux/mmc/sdhci.h | 1 + 7 files changed, 132 insertions(+), 17 deletions(-) diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index 46b6e84..2f82f6b 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c @@ -301,10 +301,11 @@ int mmc_add_card(struct mmc_card *card) mmc_card_ddr_mode(card) ? DDR : , type); } else { - printk(KERN_INFO %s: new %s%s%s card at address %04x\n, + pr_info(%s: new %s%s%s%s card at address %04x\n, mmc_hostname(card-host), mmc_sd_card_uhs(card) ? ultra high speed : (mmc_card_highspeed(card) ? high speed : ), + (mmc_card_hs200(card) ? HS200 : ), mmc_card_ddr_mode(card) ? DDR : , type, card-rca); } diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 3627044..4db248c 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -285,6 +285,39 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) } card-ext_csd.raw_card_type = ext_csd[EXT_CSD_CARD_TYPE]; switch (ext_csd[EXT_CSD_CARD_TYPE] EXT_CSD_CARD_TYPE_MASK) { + case EXT_CSD_CARD_TYPE_SDR_200 | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_200 | EXT_CSD_CARD_TYPE_DDR_1_8V | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_200 | EXT_CSD_CARD_TYPE_DDR_1_2V | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_200 | EXT_CSD_CARD_TYPE_DDR_52 | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_200; + break; + case
Re: [PATCH RESEND V4] mmc: core: HS200 mode support for eMMC 4.5
On 19 November 2011 00:29, Subhash Jadavani subha...@codeaurora.org wrote: Hi Girish, -Original Message- From: linux-mmc-ow...@vger.kernel.org [mailto:linux-mmc- ow...@vger.kernel.org] On Behalf Of Girish K S Sent: Wednesday, October 26, 2011 10:30 AM To: linux-...@vger.kernel.org Cc: c...@laptop.org; patc...@linaro.org; linux-samsung- s...@vger.kernel.org; Girish K S Subject: [PATCH RESEND V4] mmc: core: HS200 mode support for eMMC 4.5 This patch adds the support of the HS200 bus speed for eMMC 4.5 devices. The eMMC 4.5 devices have support for 200MHz bus speed.The mmc core and host modules have been touched to add support for this module. It is necessary to know the card type in the sdhci.c file to add support for eMMC tuning function. So card.h file is included to import the card data structure. We don't need to know the card type in the host controller driver if we pass the command opcode as the 2nd argument to execute_tuning() ops. Command opcode can have have either CMD19 or CMD21 as it's value depending on the card type (whether it's SD3.0 card or eMMC4.5 card). cc: Chris Ball c...@laptop.org Signed-off-by: Girish K S girish.shivananja...@linaro.org --- Changes in v4: Rebased onto chris-mmc/mmc-next branch. This patch is successfully applied on commit with id de022ed3fdc14808299b2fa66dbb1ed5ab921912. Changes in v3: In the previous commits of chris-mmc/mmc-next branch, the patch with commit id (c0f22a2c92e357e7cb3988b0b13034d70b7461f9) defines caps2 for more capabilities. This patch version deletes the member ext_caps(created in my earlier patch) from struct mmc_host and reuses already accepted caps2 member. Changes in v2: Rebased to latest chris-mmc/mmc-next branch. Resolved indentation problems identified in review. This patch has to be applied before the patch released for modifying the printk messages. Changes in v1: Case statements in switch that produce same result have been combined to reduce repeated assignments. patch recreated after rebase to chris balls mmc-next branch. drivers/mmc/core/bus.c | 3 +- drivers/mmc/core/mmc.c | 92 drivers/mmc/host/sdhci.c | 36 +++--- include/linux/mmc/card.h | 3 + include/linux/mmc/host.h | 6 +++ include/linux/mmc/mmc.h | 8 +++- include/linux/mmc/sdhci.h | 1 + 7 files changed, 132 insertions(+), 17 deletions(-) diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index 46b6e84..2f82f6b 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c @@ -301,10 +301,11 @@ int mmc_add_card(struct mmc_card *card) mmc_card_ddr_mode(card) ? DDR : , type); } else { - printk(KERN_INFO %s: new %s%s%s card at address %04x\n, + pr_info(%s: new %s%s%s%s card at address %04x\n, mmc_hostname(card-host), mmc_sd_card_uhs(card) ? ultra high speed : (mmc_card_highspeed(card) ? high speed : ), + (mmc_card_hs200(card) ? HS200 : ), mmc_card_ddr_mode(card) ? DDR : , type, card-rca); } diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 3627044..4db248c 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -285,6 +285,39 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) } card-ext_csd.raw_card_type = ext_csd[EXT_CSD_CARD_TYPE]; switch (ext_csd[EXT_CSD_CARD_TYPE] EXT_CSD_CARD_TYPE_MASK) { + case EXT_CSD_CARD_TYPE_SDR_200 | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_200 | EXT_CSD_CARD_TYPE_DDR_1_8V | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_200 | EXT_CSD_CARD_TYPE_DDR_1_2V | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_200 | EXT_CSD_CARD_TYPE_DDR_52 | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_200; + break; + case EXT_CSD_CARD_TYPE_SDR_1_2V | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_2V | EXT_CSD_CARD_TYPE_DDR_1_8V | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_2V | EXT_CSD_CARD_TYPE_DDR_1_2V | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_2V | EXT_CSD_CARD_TYPE_DDR_52 | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_1_2V; + break; + case
Re: [PATCH RESEND V4] mmc: core: HS200 mode support for eMMC 4.5
On 17 November 2011 11:06, Subhash Jadavani subha...@codeaurora.org wrote: Hi Girish, -Original Message- From: linux-mmc-ow...@vger.kernel.org [mailto:linux-mmc- ow...@vger.kernel.org] On Behalf Of Sahitya Tummala Sent: Tuesday, November 08, 2011 2:10 PM To: Girish K S Cc: linux-...@vger.kernel.org; c...@laptop.org; patc...@linaro.org; linux-samsung-soc@vger.kernel.org Subject: Re: [PATCH RESEND V4] mmc: core: HS200 mode support for eMMC 4.5 Hi Girish, On 10/26/2011 10:29 AM, Girish K S wrote: This patch adds the support of the HS200 bus speed for eMMC 4.5 devices. The eMMC 4.5 devices have support for 200MHz bus speed.The mmc core and host modules have been touched to add support for this module. It is necessary to know the card type in the sdhci.c file to add support for eMMC tuning function. So card.h file is included to import the card data structure. cc: Chris Ballc...@laptop.org Signed-off-by: Girish K Sgirish.shivananja...@linaro.org --- Changes in v4: Rebased onto chris-mmc/mmc-next branch. This patch is successfully applied on commit with id de022ed3fdc14808299b2fa66dbb1ed5ab921912. Changes in v3: In the previous commits of chris-mmc/mmc-next branch, the patch with commit id (c0f22a2c92e357e7cb3988b0b13034d70b7461f9) defines caps2 for more capabilities. This patch version deletes the member ext_caps(created in my earlier patch) from struct mmc_host and reuses already accepted caps2 member. Changes in v2: Rebased to latest chris-mmc/mmc-next branch. Resolved indentation problems identified in review. This patch has to be applied before the patch released for modifying the printk messages. Changes in v1: Case statements in switch that produce same result have been combined to reduce repeated assignments. patch recreated after rebase to chris balls mmc-next branch. drivers/mmc/core/bus.c | 3 +- drivers/mmc/core/mmc.c | 92 drivers/mmc/host/sdhci.c | 36 +++--- include/linux/mmc/card.h | 3 + include/linux/mmc/host.h | 6 +++ include/linux/mmc/mmc.h | 8 +++- include/linux/mmc/sdhci.h | 1 + 7 files changed, 132 insertions(+), 17 deletions(-) diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index 46b6e84..2f82f6b 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c @@ -301,10 +301,11 @@ int mmc_add_card(struct mmc_card *card) mmc_card_ddr_mode(card) ? DDR : , type); } else { - printk(KERN_INFO %s: new %s%s%s card at address %04x\n, + pr_info(%s: new %s%s%s%s card at address %04x\n, mmc_hostname(card-host), mmc_sd_card_uhs(card) ? ultra high speed : (mmc_card_highspeed(card) ? high speed : ), + (mmc_card_hs200(card) ? HS200 : ), mmc_card_ddr_mode(card) ? DDR : , type, card-rca); } diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 3627044..4db248c 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -285,6 +285,39 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) } card-ext_csd.raw_card_type = ext_csd[EXT_CSD_CARD_TYPE]; switch (ext_csd[EXT_CSD_CARD_TYPE] EXT_CSD_CARD_TYPE_MASK) { + case EXT_CSD_CARD_TYPE_SDR_200 | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_200 | EXT_CSD_CARD_TYPE_DDR_1_8V | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_200 | EXT_CSD_CARD_TYPE_DDR_1_2V | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_200 | EXT_CSD_CARD_TYPE_DDR_52 | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_200; + break; + case EXT_CSD_CARD_TYPE_SDR_1_2V | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_2V | EXT_CSD_CARD_TYPE_DDR_1_8V | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_2V | EXT_CSD_CARD_TYPE_DDR_1_2V | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_2V | EXT_CSD_CARD_TYPE_DDR_52 | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_1_2V; + break; + case EXT_CSD_CARD_TYPE_SDR_1_8V | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_8V | EXT_CSD_CARD_TYPE_DDR_1_8V | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_8V
[PATCH] mmc: core: Fix power_off_notify during suspend
The eMMC 4.5 devices respond to only RESET and AWAKE command in the sleep state. Hence the mmc switch command to notify power off state should be sent before the device enters sleep state. This patch fixes the same. Signed-off-by: Girish K S girish.shivananja...@linaro.org --- drivers/mmc/core/core.c | 81 -- drivers/mmc/core/mmc.c |2 +- 2 files changed, 50 insertions(+), 33 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 74a012a..7ee2e07 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1225,6 +1225,46 @@ void mmc_set_driver_type(struct mmc_host *host, unsigned int drv_type) mmc_host_clk_release(host); } +static void mmc_poweroff_notify(struct mmc_host *host) +{ + struct mmc_card *card; + unsigned int timeout; + unsigned int notify_type = EXT_CSD_NO_POWER_NOTIFICATION; + int err = 0; + + card = host-card; + + /* +* Send power notify command only if card +* is mmc and notify state is powered ON +*/ + if (card mmc_card_mmc(card) + (card-poweroff_notify_state == MMC_POWERED_ON)) { + + if (host-power_notify_type == MMC_HOST_PW_NOTIFY_SHORT) { + notify_type = EXT_CSD_POWER_OFF_SHORT; + timeout = card-ext_csd.generic_cmd6_time; + card-poweroff_notify_state = MMC_POWEROFF_SHORT; + } else { + notify_type = EXT_CSD_POWER_OFF_LONG; + timeout = card-ext_csd.power_off_longtime; + card-poweroff_notify_state = MMC_POWEROFF_LONG; + } + + err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, +EXT_CSD_POWER_OFF_NOTIFICATION, +notify_type, timeout); + + if (err err != -EBADMSG) + pr_err(Device failed to respond within %d poweroff + time. Forcefully powering down the device\n, + timeout); + + /* Set the card state to no notification after the poweroff */ + card-poweroff_notify_state = MMC_NO_POWER_NOTIFICATION; + } +} + /* * Apply power to the MMC stack. This is a two-stage process. * First, we enable power to the card without the clock running. @@ -1281,42 +1321,12 @@ static void mmc_power_up(struct mmc_host *host) void mmc_power_off(struct mmc_host *host) { - struct mmc_card *card; - unsigned int notify_type; - unsigned int timeout; - int err; - mmc_host_clk_hold(host); - card = host-card; host-ios.clock = 0; host-ios.vdd = 0; - if (card mmc_card_mmc(card) - (card-poweroff_notify_state == MMC_POWERED_ON)) { - - if (host-power_notify_type == MMC_HOST_PW_NOTIFY_SHORT) { - notify_type = EXT_CSD_POWER_OFF_SHORT; - timeout = card-ext_csd.generic_cmd6_time; - card-poweroff_notify_state = MMC_POWEROFF_SHORT; - } else { - notify_type = EXT_CSD_POWER_OFF_LONG; - timeout = card-ext_csd.power_off_longtime; - card-poweroff_notify_state = MMC_POWEROFF_LONG; - } - - err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, -EXT_CSD_POWER_OFF_NOTIFICATION, -notify_type, timeout); - - if (err err != -EBADMSG) - pr_err(Device failed to respond within %d poweroff - time. Forcefully powering down the device\n, - timeout); - - /* Set the card state to no notification after the poweroff */ - card-poweroff_notify_state = MMC_NO_POWER_NOTIFICATION; - } + mmc_poweroff_notify(host); /* * Reset ocr mask to be the highest possible voltage supported for @@ -2314,8 +2324,15 @@ int mmc_suspend_host(struct mmc_host *host) * pre-claim the host. */ if (mmc_try_claim_host(host)) { - if (host-bus_ops-suspend) + if (host-bus_ops-suspend) { + /* +* For eMMC 4.5 device send notify command +* before sleep, because in sleep state eMMC 4.5 +* devices respond to only RESET and AWAKE cmd +*/ + mmc_poweroff_notify(host); err = host-bus_ops-suspend(host); + } if (err == -ENOSYS || !host-bus_ops-resume
Re: [PATCH V9] mmc: core: Add Power Off Notify Feature eMMC 4.5
On 8 November 2011 15:18, Sahitya Tummala stumm...@codeaurora.org wrote: Hi Girish, On 10/18/2011 10:35 AM, Girish K S wrote: This patch adds the support for power off notify feature, available in eMMC 4.5 devices. If the the host has support for this feature, then the mmc core will notify it to the device by setting the POWER_OFF_NOTIFICATION byte in the extended csd register with a value 1(POWER_ON). For suspend mode short timeout is used, whereas for the normal poweroff long timeout is used. cc: Chris Ballc...@laptop.org Signed-off-by: Girish K Sgirish.shivananja...@linaro.org Signed-off-by: Jaehoon Chungjh80.ch...@samsung.com --- Changes in V9: Removed the macros not related with the PowerOff notify feature. The previous patch with commit id bd3151f6c55c553bed2c0df72792841457b75bb5 should be deleted before applying this patch. Changes in V8: Updated with review comments of Chris Ball and rebased to chris-mmc/mmc-next branch. Changes in V7: Rebased to chris-mmc/mmc-next branch. merged to patches to single patch. Changes in V6: Fixes checkpatch errors. The patches are generated after rebasing to chris's mmc-next branch. Changes in V5: This patch version fixes the problem with power off notify function, when called for the first time and card is not yet initialised. Changes in V4: Updated with review comments of Jeon Changes in V2: Adds poweroff notification handling in suspend/normal. drivers/mmc/core/core.c | 34 ++ drivers/mmc/core/mmc.c | 23 +-- drivers/mmc/host/sdhci.c | 9 + include/linux/mmc/card.h | 6 ++ include/linux/mmc/host.h | 5 + include/linux/mmc/mmc.h | 6 ++ 6 files changed, 81 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 61d7730..b1eca96 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1212,11 +1212,43 @@ static void mmc_power_up(struct mmc_host *host) void mmc_power_off(struct mmc_host *host) { + struct mmc_card *card; + unsigned int notify_type; + unsigned int timeout; + int err; + mmc_host_clk_hold(host); + card = host-card; host-ios.clock = 0; host-ios.vdd = 0; + if (card mmc_card_mmc(card) + card-poweroff_notify_state == MMC_POWERED_ON) { + + if (host-power_notify_type == MMC_HOST_PW_NOTIFY_SHORT) { + notify_type = EXT_CSD_POWER_OFF_SHORT; + timeout = card-ext_csd.generic_cmd6_time; + card-poweroff_notify_state = MMC_POWEROFF_SHORT; + } else { + notify_type = EXT_CSD_POWER_OFF_LONG; + timeout = card-ext_csd.power_off_longtime; + card-poweroff_notify_state = MMC_POWEROFF_LONG; + } + + err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, + EXT_CSD_POWER_OFF_NOTIFICATION, + notify_type, timeout); During suspend, the device can already be in sleep state (CMD5) before mmc_power_off() is called from mmc_suspend_host(). As per eMMC specification, when the device is in sleep state, it can only respond to RESET commands (CMD0 with argument of either 0x or 0xF0F0F0F0 or H/W reset) and awake command (CMD5). So, how does this switch going to happen (CMD6) if it is in sleep state? Thanks Sahitya. Will handle the situation of sending the switch command in mmc_suspend_host function before the device goes to sleep. Thanks, Sahitya. -- Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum. -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] mmc: core: Fix setting power notify state variable for non eMMC
This patch skips the setting of the power notify state variable for non eMMC 4.5 devices. Also fixes the problem of omap_hsmmc noisy/broken for suspend resume reported by kevin Hilman. cc: Chris Ball c...@laptop.org Signed-off-by: Girish K S girish.shivananja...@linaro.org --- drivers/mmc/core/mmc.c | 10 +++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 3627044..4db73a9 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -882,10 +882,14 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, card-ext_csd.generic_cmd6_time); if (err err != -EBADMSG) goto free_card; - } - if (!err) - card-poweroff_notify_state = MMC_POWERED_ON; + /* +* The err can be -EBADMSG or 0, +* so check for success and update the flag +*/ + if (!err) + card-poweroff_notify_state = MMC_POWERED_ON; + } /* * Activate high speed (if supported) -- 1.7.4.1 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] mmc: core: Fix setting power notify state variable for non eMMC
On 4 November 2011 06:52, Girish K S girish.shivananja...@linaro.org wrote: This patch skips the setting of the power notify state variable for non eMMC 4.5 devices. Also fixes the problem of omap_hsmmc noisy/broken for suspend resume reported by kevin Hilman. cc: Chris Ball c...@laptop.org Signed-off-by: Girish K S girish.shivananja...@linaro.org --- drivers/mmc/core/mmc.c | 10 +++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 3627044..4db73a9 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -882,10 +882,14 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, card-ext_csd.generic_cmd6_time); if (err err != -EBADMSG) goto free_card; - } - if (!err) - card-poweroff_notify_state = MMC_POWERED_ON; + /* + * The err can be -EBADMSG or 0, + * so check for success and update the flag + */ + if (!err) + card-poweroff_notify_state = MMC_POWERED_ON; + } /* * Activate high speed (if supported) -- 1.7.4.1 Hi Chris, this patch is based on for-linus branch. Regards Girish K S -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/2] mmc: core: Support packed command for eMMC4.5 device
On 2 November 2011 04:03, Seungwon Jeon tgih@samsung.com wrote: This patch supports packed command of eMMC4.5 device. Several reads(or writes) can be grouped in packed command and all data of the individual commands can be sent in a single transfer on the bus. Signed-off-by: Seungwon Jeon tgih@samsung.com --- drivers/mmc/card/block.c | 355 -- drivers/mmc/card/queue.c | 48 ++- drivers/mmc/card/queue.h | 12 ++ include/linux/mmc/core.h | 3 + 4 files changed, 404 insertions(+), 14 deletions(-) diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index a1cb21f..6c49656 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c @@ -59,6 +59,13 @@ MODULE_ALIAS(mmc:block); #define INAND_CMD38_ARG_SECTRIM1 0x81 #define INAND_CMD38_ARG_SECTRIM2 0x88 +#define mmc_req_rel_wr(req) (((req-cmd_flags REQ_FUA) || \ + (req-cmd_flags REQ_META)) \ + (rq_data_dir(req) == WRITE)) +#define PACKED_CMD_VER 0x01 +#define PACKED_CMD_RD 0x01 +#define PACKED_CMD_WR 0x02 + static DEFINE_MUTEX(block_mutex); /* @@ -943,7 +950,8 @@ static int mmc_blk_err_check(struct mmc_card *card, * kind. If it was a write, we may have transitioned to * program mode, which we have to wait for it to complete. */ - if (!mmc_host_is_spi(card-host) rq_data_dir(req) != READ) { + if ((!mmc_host_is_spi(card-host) rq_data_dir(req) != READ) || + (mq_mrq-packed_cmd == MMC_PACKED_WR_HDR)) { u32 status; do { int err = get_card_status(card, status, 5); @@ -980,12 +988,67 @@ static int mmc_blk_err_check(struct mmc_card *card, if (!brq-data.bytes_xfered) return MMC_BLK_RETRY; + if (mq_mrq-packed_cmd != MMC_PACKED_NONE) { + if (unlikely(brq-data.blocks 9 != brq-data.bytes_xfered)) + return MMC_BLK_PARTIAL; + else + return MMC_BLK_SUCCESS; + } + if (blk_rq_bytes(req) != brq-data.bytes_xfered) return MMC_BLK_PARTIAL; return MMC_BLK_SUCCESS; } +static int mmc_blk_packed_err_check(struct mmc_card *card, + struct mmc_async_req *areq) +{ + struct mmc_queue_req *mq_mrq = container_of(areq, struct mmc_queue_req, + mmc_active); + int err, check, status; + u8 ext_csd[512]; + + check = mmc_blk_err_check(card, areq); + + if (check == MMC_BLK_SUCCESS) + return check; + + if (check == MMC_BLK_PARTIAL) { + err = get_card_status(card, status, 0); + if (err) + return MMC_BLK_ABORT; + + if (status R1_EXP_EVENT) { + err = mmc_send_ext_csd(card, ext_csd); + if (err) + return MMC_BLK_ABORT; + + if ((ext_csd[EXT_CSD_EXP_EVENTS_STATUS + 0] + EXT_CSD_PACKED_FAILURE) + (ext_csd[EXT_CSD_PACKED_CMD_STATUS] + EXT_CSD_PACKED_GENERIC_ERROR)) { + if (ext_csd[EXT_CSD_PACKED_CMD_STATUS] + EXT_CSD_PACKED_INDEXED_ERROR) { + /* Make be 0-based */ + mq_mrq-packed_fail_idx = + ext_csd[EXT_CSD_PACKED_FAILURE_INDEX] - 1; + return MMC_BLK_PARTIAL; + } else { + return MMC_BLK_RETRY; + } + } + } else { + return MMC_BLK_RETRY; + } + } + + if (check != MMC_BLK_ABORT) + return MMC_BLK_RETRY; + else + return MMC_BLK_ABORT; +} + static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq, struct mmc_card *card, int disable_multi, @@ -1129,6 +1192,211 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq, mmc_queue_bounce_pre(mqrq); } +static u8 mmc_blk_chk_packable(struct mmc_queue *mq, struct request *req) +{ + struct request_queue *q = mq-queue; + struct mmc_card *card = mq-card; + struct request *cur = req, *next = NULL; + struct mmc_blk_data *md = mq-data; + bool en_rel_wr = card-ext_csd.rel_param EXT_CSD_WR_REL_PARAM_EN; + unsigned int req_sectors = 0, phys_segments = 0; + unsigned int max_blk_count,
[PATCH RESEND V4] mmc: core: HS200 mode support for eMMC 4.5
This patch adds the support of the HS200 bus speed for eMMC 4.5 devices. The eMMC 4.5 devices have support for 200MHz bus speed.The mmc core and host modules have been touched to add support for this module. It is necessary to know the card type in the sdhci.c file to add support for eMMC tuning function. So card.h file is included to import the card data structure. cc: Chris Ball c...@laptop.org Signed-off-by: Girish K S girish.shivananja...@linaro.org --- Changes in v4: Rebased onto chris-mmc/mmc-next branch. This patch is successfully applied on commit with id de022ed3fdc14808299b2fa66dbb1ed5ab921912. Changes in v3: In the previous commits of chris-mmc/mmc-next branch, the patch with commit id (c0f22a2c92e357e7cb3988b0b13034d70b7461f9) defines caps2 for more capabilities. This patch version deletes the member ext_caps(created in my earlier patch) from struct mmc_host and reuses already accepted caps2 member. Changes in v2: Rebased to latest chris-mmc/mmc-next branch. Resolved indentation problems identified in review. This patch has to be applied before the patch released for modifying the printk messages. Changes in v1: Case statements in switch that produce same result have been combined to reduce repeated assignments. patch recreated after rebase to chris balls mmc-next branch. drivers/mmc/core/bus.c|3 +- drivers/mmc/core/mmc.c| 92 drivers/mmc/host/sdhci.c | 36 +++--- include/linux/mmc/card.h |3 + include/linux/mmc/host.h |6 +++ include/linux/mmc/mmc.h |8 +++- include/linux/mmc/sdhci.h |1 + 7 files changed, 132 insertions(+), 17 deletions(-) diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index 46b6e84..2f82f6b 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c @@ -301,10 +301,11 @@ int mmc_add_card(struct mmc_card *card) mmc_card_ddr_mode(card) ? DDR : , type); } else { - printk(KERN_INFO %s: new %s%s%s card at address %04x\n, + pr_info(%s: new %s%s%s%s card at address %04x\n, mmc_hostname(card-host), mmc_sd_card_uhs(card) ? ultra high speed : (mmc_card_highspeed(card) ? high speed : ), + (mmc_card_hs200(card) ? HS200 : ), mmc_card_ddr_mode(card) ? DDR : , type, card-rca); } diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 3627044..4db248c 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -285,6 +285,39 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) } card-ext_csd.raw_card_type = ext_csd[EXT_CSD_CARD_TYPE]; switch (ext_csd[EXT_CSD_CARD_TYPE] EXT_CSD_CARD_TYPE_MASK) { + case EXT_CSD_CARD_TYPE_SDR_200 | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_200 | EXT_CSD_CARD_TYPE_DDR_1_8V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_200 | EXT_CSD_CARD_TYPE_DDR_1_2V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_200 | EXT_CSD_CARD_TYPE_DDR_52 | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_200; + break; + case EXT_CSD_CARD_TYPE_SDR_1_2V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_2V | EXT_CSD_CARD_TYPE_DDR_1_8V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_2V | EXT_CSD_CARD_TYPE_DDR_1_2V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_2V | EXT_CSD_CARD_TYPE_DDR_52 | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_1_2V; + break; + case EXT_CSD_CARD_TYPE_SDR_1_8V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_8V | EXT_CSD_CARD_TYPE_DDR_1_8V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_8V | EXT_CSD_CARD_TYPE_DDR_1_2V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_8V | EXT_CSD_CARD_TYPE_DDR_52 | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_1_8V; + break; case EXT_CSD_CARD_TYPE_DDR_52 | EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: card
Re: [PATCH] mmc: core: Separate the timeout value for cache-ctrl
On 24 October 2011 15:40, Seungwon Jeon tgih@samsung.com wrote: Turning the cache off implies flushing cache which doesn't define maximum timeout unlike cache-on. This patch will apply the generic CMD6 timeout only for cache-on. Additionally the kernel message is added for checking failure case of cache-on. Signed-off-by: Seungwon Jeon tgih@samsung.com --- drivers/mmc/core/core.c | 22 +- drivers/mmc/core/mmc.c | 10 -- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 5278ffb..65b5643 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -2248,6 +2248,7 @@ EXPORT_SYMBOL(mmc_flush_cache); int mmc_cache_ctrl(struct mmc_host *host, u8 enable) { struct mmc_card *card = host-card; + unsigned int timeout; int err = 0; if (!(host-caps2 MMC_CAP2_CACHE_CTRL) || @@ -2258,16 +2259,19 @@ int mmc_cache_ctrl(struct mmc_host *host, u8 enable) (card-ext_csd.cache_size 0)) { enable = !!enable; - if (card-ext_csd.cache_ctrl ^ enable) + if (card-ext_csd.cache_ctrl ^ enable) { + timeout = enable ? card-ext_csd.generic_cmd6_time : 0; err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, - EXT_CSD_CACHE_CTRL, enable, 0); Here timeout value used is 0. If it has to be 0 then why should you check timeout = enable ? card-ext_csd.generic_cmd6_time : 0; I think it should be card-ext_csd.generic_cmd6_time instead of 0 - if (err) - pr_err(%s: cache %s error %d\n, - mmc_hostname(card-host), - enable ? on : off, - err); - else - card-ext_csd.cache_ctrl = enable; + EXT_CSD_CACHE_CTRL, enable, timeout); + + if (err) + pr_err(%s: cache %s error %d\n, + mmc_hostname(card-host), + enable ? on : off, + err); + else + card-ext_csd.cache_ctrl = enable; + } } return err; diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index fb5bf01..6354eb3 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -1064,14 +1064,20 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, if ((host-caps2 MMC_CAP2_CACHE_CTRL) card-ext_csd.cache_size 0) { err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, - EXT_CSD_CACHE_CTRL, 1, 0); + EXT_CSD_CACHE_CTRL, 1, + card-ext_csd.generic_cmd6_time); if (err err != -EBADMSG) goto free_card; /* * Only if no error, cache is turned on successfully. */ - card-ext_csd.cache_ctrl = err ? 0 : 1; + if (err) { + pr_warning(%s: Cache is supported, but enabling failed\n, + mmc_hostname(card-host)); + err = 0; + } else + card-ext_csd.cache_ctrl = 1; } if (!oldcard) -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] mmc: core: Assemble the codes of related to eMMC4.5
On 24 October 2011 16:39, Chris Ball c...@laptop.org wrote: Hi Seungwon, On Mon, Oct 24 2011, Seungwon Jeon wrote: Code cleanup. The codes of related to eMMC4.5 are scattered. This patch removes a duplicate if-statement and assembles all. Signed-off-by: Seungwon Jeon tgih@samsung.com --- drivers/mmc/core/mmc.c | 20 +--- 1 files changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index fb5bf01..3627044 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -467,29 +467,27 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) card-ext_csd.rst_n_function = ext_csd[EXT_CSD_RST_N_FUNCTION]; } - /* eMMC v4.5 or later */ - if (card-ext_csd.rev = 6) - card-ext_csd.feature_support |= MMC_DISCARD_FEATURE; - card-ext_csd.raw_erased_mem_count = ext_csd[EXT_CSD_ERASED_MEM_CONT]; if (ext_csd[EXT_CSD_ERASED_MEM_CONT]) card-erased_byte = 0xFF; else card-erased_byte = 0x0; + /* eMMC v4.5 or later */ if (card-ext_csd.rev = 6) { + card-ext_csd.feature_support |= MMC_DISCARD_FEATURE; + card-ext_csd.generic_cmd6_time = 10 * ext_csd[EXT_CSD_GENERIC_CMD6_TIME]; card-ext_csd.power_off_longtime = 10 * ext_csd[EXT_CSD_POWER_OFF_LONG_TIME]; - } else - card-ext_csd.generic_cmd6_time = 0; Your patch removes this line completely. Why is that? You should explain it in the commit message. By tracing the code what i understand is mmc_read_ext_csd is called from mmc_card_init. In the init function the card instance is created. When the card instance is created kzalloc is used. This will initialize all the card structure members to 0. So the deleted line is implicit. - card-ext_csd.cache_size = - ext_csd[EXT_CSD_CACHE_SIZE + 0] 0 | - ext_csd[EXT_CSD_CACHE_SIZE + 1] 8 | - ext_csd[EXT_CSD_CACHE_SIZE + 2] 16 | - ext_csd[EXT_CSD_CACHE_SIZE + 3] 24; + card-ext_csd.cache_size = + ext_csd[EXT_CSD_CACHE_SIZE + 0] 0 | + ext_csd[EXT_CSD_CACHE_SIZE + 1] 8 | + ext_csd[EXT_CSD_CACHE_SIZE + 2] 16 | + ext_csd[EXT_CSD_CACHE_SIZE + 3] 24; + } out: return err; The rest looks good, thanks, - Chris. -- Chris Ball c...@laptop.org http://printf.net/ One Laptop Per Child -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH V4] mmc: core: HS200 mode support for eMMC 4.5
This patch adds the support of the HS200 bus speed for eMMC 4.5 devices. The eMMC 4.5 devices have support for 200MHz bus speed.The mmc core and host modules have been touched to add support for this module. It is necessary to know the card type in the sdhci.c file to add support for eMMC tuning function. So card.h file is included to import the card data structure. cc: Chris Ball c...@laptop.org Signed-off-by: Girish K S girish.shivananja...@linaro.org --- Changes in v4: Rebased onto chris-mmc/mmc-next branch. This patch is successfully applied on commit with id de022ed3fdc14808299b2fa66dbb1ed5ab921912. Changes in v3: In the previous commits of chris-mmc/mmc-next branch, the patch with commit id (c0f22a2c92e357e7cb3988b0b13034d70b7461f9) defines caps2 for more capabilities. This patch version deletes the member ext_caps(created in my earlier patch) from struct mmc_host and reuses already accepted caps2 member. Changes in v2: Rebased to latest chris-mmc/mmc-next branch. Resolved indentation problems identified in review. This patch has to be applied before the patch released for modifying the printk messages. Changes in v1: Case statements in switch that produce same result have been combined to reduce repeated assignments. patch recreated after rebase to chris balls mmc-next branch. drivers/mmc/core/bus.c|3 +- drivers/mmc/core/mmc.c| 92 drivers/mmc/host/sdhci.c | 36 +++--- include/linux/mmc/card.h |3 + include/linux/mmc/host.h |6 +++ include/linux/mmc/mmc.h |8 +++- include/linux/mmc/sdhci.h |1 + 7 files changed, 132 insertions(+), 17 deletions(-) diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index 46b6e84..2f82f6b 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c @@ -301,10 +301,11 @@ int mmc_add_card(struct mmc_card *card) mmc_card_ddr_mode(card) ? DDR : , type); } else { - printk(KERN_INFO %s: new %s%s%s card at address %04x\n, + pr_info(%s: new %s%s%s%s card at address %04x\n, mmc_hostname(card-host), mmc_sd_card_uhs(card) ? ultra high speed : (mmc_card_highspeed(card) ? high speed : ), + (mmc_card_hs200(card) ? HS200 : ), mmc_card_ddr_mode(card) ? DDR : , type, card-rca); } diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index fb5bf01..d5fb9ca 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -285,6 +285,39 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) } card-ext_csd.raw_card_type = ext_csd[EXT_CSD_CARD_TYPE]; switch (ext_csd[EXT_CSD_CARD_TYPE] EXT_CSD_CARD_TYPE_MASK) { + case EXT_CSD_CARD_TYPE_SDR_200 | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_200 | EXT_CSD_CARD_TYPE_DDR_1_8V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_200 | EXT_CSD_CARD_TYPE_DDR_1_2V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_200 | EXT_CSD_CARD_TYPE_DDR_52 | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_200; + break; + case EXT_CSD_CARD_TYPE_SDR_1_2V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_2V | EXT_CSD_CARD_TYPE_DDR_1_8V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_2V | EXT_CSD_CARD_TYPE_DDR_1_2V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_2V | EXT_CSD_CARD_TYPE_DDR_52 | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_1_2V; + break; + case EXT_CSD_CARD_TYPE_SDR_1_8V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_8V | EXT_CSD_CARD_TYPE_DDR_1_8V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_8V | EXT_CSD_CARD_TYPE_DDR_1_2V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_8V | EXT_CSD_CARD_TYPE_DDR_52 | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_1_8V; + break; case EXT_CSD_CARD_TYPE_DDR_52 | EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: card
Re: [PATCH V8] mmc: core: Add Power Off Notify Feature eMMC 4.5
On 17 October 2011 18:17, Chris Ball c...@laptop.org wrote: Hi Girish, On Mon, Oct 17 2011, Girish K S wrote: + if (card != NULL mmc_card_mmc(card) != NULL is unnecessary. This is required. Let me explain the scenario where i felt it is necessary. I'm not saying that you shouldn't test whether card is NULL -- I'm saying that if (card mmc_card_mmc(card) would perform this test with fewer characters, and be idiomatic for the kernel. After fetching your mmc-next branch. i can see that this patch is already applied. How about the changes that have been pointed here? Thanks, - Chris. -- Chris Ball c...@laptop.org http://printf.net/ One Laptop Per Child -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH V8 RESEND] mmc: core: Add Power Off Notify Feature eMMC 4.5
This patch adds the support for power off notify feature, available in eMMC 4.5 devices. If the the host has support for this feature, then the mmc core will notify it to the device by setting the POWER_OFF_NOTIFICATION byte in the extended csd register with a value 1(POWER_ON). For suspend mode short timeout is used, whereas for the normal poweroff long timeout is used. cc: Chris Ball c...@laptop.org Signed-off-by: Girish K S girish.shivananja...@linaro.org Signed-off-by: Jaehoon Chung jh80.ch...@samsung.com --- Changes in V8: Updated with review comments of Chris Ball and rebased to chris-mmc/mmc-next branch. Changes in V7: Rebased to chris-mmc/mmc-next branch. merged to patches to single patch. Changes in V6: Fixes checkpatch errors. The patches are generated after rebasing to chris's mmc-next branch. Changes in V5: This patch version fixes the problem with power off notify function, when called for the first time and card is not yet initialised. Changes in V4: Updated with review comments of Jeon Changes in V2: Adds poweroff notification handling in suspend/normal. drivers/mmc/core/core.c |6 ++ include/linux/mmc/host.h |2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index db368b2..b1eca96 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1217,16 +1217,14 @@ void mmc_power_off(struct mmc_host *host) unsigned int timeout; int err; - BUG_ON(!host); - mmc_host_clk_hold(host); card = host-card; host-ios.clock = 0; host-ios.vdd = 0; - if (card != NULL mmc_card_mmc(card) - (card-poweroff_notify_state == MMC_POWERED_ON)) { + if (card mmc_card_mmc(card) + card-poweroff_notify_state == MMC_POWERED_ON) { if (host-power_notify_type == MMC_HOST_PW_NOTIFY_SHORT) { notify_type = EXT_CSD_POWER_OFF_SHORT; diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 65c47fc..a991ae7 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -243,7 +243,7 @@ struct mmc_host { #define MMC_CAP2_POWEROFF_NOTIFY (1 2) /* Notify poweroff supported */ mmc_pm_flag_t pm_caps;/* supported pm features */ - unsigned intpower_notify_type; + unsigned intpower_notify_type; #define MMC_HOST_PW_NOTIFY_NONE0 #define MMC_HOST_PW_NOTIFY_SHORT 1 #define MMC_HOST_PW_NOTIFY_LONG2 -- 1.7.1 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V8 RESEND] mmc: core: Add Power Off Notify Feature eMMC 4.5
On 17 October 2011 20:17, Girish K S girish.shivananja...@linaro.org wrote: This patch adds the support for power off notify feature, available in eMMC 4.5 devices. If the the host has support for this feature, then the mmc core will notify it to the device by setting the POWER_OFF_NOTIFICATION byte in the extended csd register with a value 1(POWER_ON). For suspend mode short timeout is used, whereas for the normal poweroff long timeout is used. cc: Chris Ball c...@laptop.org Signed-off-by: Girish K S girish.shivananja...@linaro.org Signed-off-by: Jaehoon Chung jh80.ch...@samsung.com --- Changes in V8: Updated with review comments of Chris Ball and rebased to chris-mmc/mmc-next branch. Changes in V7: Rebased to chris-mmc/mmc-next branch. merged to patches to single patch. Changes in V6: Fixes checkpatch errors. The patches are generated after rebasing to chris's mmc-next branch. Changes in V5: This patch version fixes the problem with power off notify function, when called for the first time and card is not yet initialised. Changes in V4: Updated with review comments of Jeon Changes in V2: Adds poweroff notification handling in suspend/normal. drivers/mmc/core/core.c | 6 ++ include/linux/mmc/host.h | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index db368b2..b1eca96 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1217,16 +1217,14 @@ void mmc_power_off(struct mmc_host *host) unsigned int timeout; int err; - BUG_ON(!host); - mmc_host_clk_hold(host); card = host-card; host-ios.clock = 0; host-ios.vdd = 0; - if (card != NULL mmc_card_mmc(card) - (card-poweroff_notify_state == MMC_POWERED_ON)) { + if (card mmc_card_mmc(card) + card-poweroff_notify_state == MMC_POWERED_ON) { if (host-power_notify_type == MMC_HOST_PW_NOTIFY_SHORT) { notify_type = EXT_CSD_POWER_OFF_SHORT; diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 65c47fc..a991ae7 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -243,7 +243,7 @@ struct mmc_host { #define MMC_CAP2_POWEROFF_NOTIFY (1 2) /* Notify poweroff supported */ mmc_pm_flag_t pm_caps; /* supported pm features */ - unsigned int power_notify_type; + unsigned int power_notify_type; #define MMC_HOST_PW_NOTIFY_NONE 0 #define MMC_HOST_PW_NOTIFY_SHORT 1 #define MMC_HOST_PW_NOTIFY_LONG 2 -- Ignore this patch. this just gives only the diff with previous patch. i will resend the complete patch 1.7.1 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH V9] mmc: core: Add Power Off Notify Feature eMMC 4.5
This patch adds the support for power off notify feature, available in eMMC 4.5 devices. If the the host has support for this feature, then the mmc core will notify it to the device by setting the POWER_OFF_NOTIFICATION byte in the extended csd register with a value 1(POWER_ON). For suspend mode short timeout is used, whereas for the normal poweroff long timeout is used. cc: Chris Ball c...@laptop.org Signed-off-by: Girish K S girish.shivananja...@linaro.org Signed-off-by: Jaehoon Chung jh80.ch...@samsung.com --- Changes in V9: Removed the macros not related with the PowerOff notify feature. The previous patch with commit id bd3151f6c55c553bed2c0df72792841457b75bb5 should be deleted before applying this patch. Changes in V8: Updated with review comments of Chris Ball and rebased to chris-mmc/mmc-next branch. Changes in V7: Rebased to chris-mmc/mmc-next branch. merged to patches to single patch. Changes in V6: Fixes checkpatch errors. The patches are generated after rebasing to chris's mmc-next branch. Changes in V5: This patch version fixes the problem with power off notify function, when called for the first time and card is not yet initialised. Changes in V4: Updated with review comments of Jeon Changes in V2: Adds poweroff notification handling in suspend/normal. drivers/mmc/core/core.c | 34 ++ drivers/mmc/core/mmc.c | 23 +-- drivers/mmc/host/sdhci.c |9 + include/linux/mmc/card.h |6 ++ include/linux/mmc/host.h |5 + include/linux/mmc/mmc.h |6 ++ 6 files changed, 81 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 61d7730..b1eca96 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1212,11 +1212,43 @@ static void mmc_power_up(struct mmc_host *host) void mmc_power_off(struct mmc_host *host) { + struct mmc_card *card; + unsigned int notify_type; + unsigned int timeout; + int err; + mmc_host_clk_hold(host); + card = host-card; host-ios.clock = 0; host-ios.vdd = 0; + if (card mmc_card_mmc(card) + card-poweroff_notify_state == MMC_POWERED_ON) { + + if (host-power_notify_type == MMC_HOST_PW_NOTIFY_SHORT) { + notify_type = EXT_CSD_POWER_OFF_SHORT; + timeout = card-ext_csd.generic_cmd6_time; + card-poweroff_notify_state = MMC_POWEROFF_SHORT; + } else { + notify_type = EXT_CSD_POWER_OFF_LONG; + timeout = card-ext_csd.power_off_longtime; + card-poweroff_notify_state = MMC_POWEROFF_LONG; + } + + err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, +EXT_CSD_POWER_OFF_NOTIFICATION, +notify_type, timeout); + + if (err err != -EBADMSG) + pr_err(Device failed to respond within %d poweroff + time. Forcefully powering down the device\n, + timeout); + + /* Set the card state to no notification after the poweroff */ + card-poweroff_notify_state = MMC_NO_POWER_NOTIFICATION; + } + /* * Reset ocr mask to be the highest possible voltage supported for * this mmc host. This value will be used at next power up. @@ -2208,6 +2240,7 @@ int mmc_pm_notify(struct notifier_block *notify_block, spin_lock_irqsave(host-lock, flags); host-rescan_disable = 1; + host-power_notify_type = MMC_HOST_PW_NOTIFY_SHORT; spin_unlock_irqrestore(host-lock, flags); cancel_delayed_work_sync(host-detect); @@ -2231,6 +2264,7 @@ int mmc_pm_notify(struct notifier_block *notify_block, spin_lock_irqsave(host-lock, flags); host-rescan_disable = 0; + host-power_notify_type = MMC_HOST_PW_NOTIFY_LONG; spin_unlock_irqrestore(host-lock, flags); mmc_detect_change(host, 0); diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 4e869d3..f8ea938 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -458,10 +458,12 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) else card-erased_byte = 0x0; - if (card-ext_csd.rev = 6) + if (card-ext_csd.rev = 6) { card-ext_csd.generic_cmd6_time = 10 * ext_csd[EXT_CSD_GENERIC_CMD6_TIME]; - else + card-ext_csd.power_off_longtime = 10 * + ext_csd[EXT_CSD_POWER_OFF_LONG_TIME]; + } else card-ext_csd.generic_cmd6_time = 0; out: @@ -846,6
Re: [PATCH V9] mmc: core: Add Power Off Notify Feature eMMC 4.5
On 18 October 2011 10:49, Girish K S girish.shivananja...@linaro.org wrote: On 18 October 2011 10:46, Jaehoon Chung jh80.ch...@samsung.com wrote: Hi Girish. This patch is merged on mmc-next..did you know that? And if deleted commit id bd3151f6c55c553bed2c0df72792841457b75bb5, I will re-work for eMMC feature4.5. git://git.infradead.org/users/kmpark/linux-2.6-samsung emmc4.5 To Chris. If you re-commit this patch, i also change git pull request. there are duplicated code in Notify patch, so i didn't add to cache patch. HI Jaehoon, I have already bought it to the notice of Chris. After discussing with Chris i am resending the complete patch. Regards, Jaehoon Chung Adding to it. In your mail with subject [GIT PULL v2] Add eMMC4.5 feature for v3.2, for version 2 changes it is mentioned that power notify feature is removed. Thats the reason i rebased my patch to Chris's mmc-next branch and resent. On 10/18/2011 02:05 PM, Girish K S wrote: This patch adds the support for power off notify feature, available in eMMC 4.5 devices. If the the host has support for this feature, then the mmc core will notify it to the device by setting the POWER_OFF_NOTIFICATION byte in the extended csd register with a value 1(POWER_ON). For suspend mode short timeout is used, whereas for the normal poweroff long timeout is used. cc: Chris Ball c...@laptop.org Signed-off-by: Girish K S girish.shivananja...@linaro.org Signed-off-by: Jaehoon Chung jh80.ch...@samsung.com --- Changes in V9: Removed the macros not related with the PowerOff notify feature. The previous patch with commit id bd3151f6c55c553bed2c0df72792841457b75bb5 should be deleted before applying this patch. Changes in V8: Updated with review comments of Chris Ball and rebased to chris-mmc/mmc-next branch. Changes in V7: Rebased to chris-mmc/mmc-next branch. merged to patches to single patch. Changes in V6: Fixes checkpatch errors. The patches are generated after rebasing to chris's mmc-next branch. Changes in V5: This patch version fixes the problem with power off notify function, when called for the first time and card is not yet initialised. Changes in V4: Updated with review comments of Jeon Changes in V2: Adds poweroff notification handling in suspend/normal. drivers/mmc/core/core.c | 34 ++ drivers/mmc/core/mmc.c | 23 +-- drivers/mmc/host/sdhci.c | 9 + include/linux/mmc/card.h | 6 ++ include/linux/mmc/host.h | 5 + include/linux/mmc/mmc.h | 6 ++ 6 files changed, 81 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 61d7730..b1eca96 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1212,11 +1212,43 @@ static void mmc_power_up(struct mmc_host *host) void mmc_power_off(struct mmc_host *host) { + struct mmc_card *card; + unsigned int notify_type; + unsigned int timeout; + int err; + mmc_host_clk_hold(host); + card = host-card; host-ios.clock = 0; host-ios.vdd = 0; + if (card mmc_card_mmc(card) + card-poweroff_notify_state == MMC_POWERED_ON) { + + if (host-power_notify_type == MMC_HOST_PW_NOTIFY_SHORT) { + notify_type = EXT_CSD_POWER_OFF_SHORT; + timeout = card-ext_csd.generic_cmd6_time; + card-poweroff_notify_state = MMC_POWEROFF_SHORT; + } else { + notify_type = EXT_CSD_POWER_OFF_LONG; + timeout = card-ext_csd.power_off_longtime; + card-poweroff_notify_state = MMC_POWEROFF_LONG; + } + + err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, + EXT_CSD_POWER_OFF_NOTIFICATION, + notify_type, timeout); + + if (err err != -EBADMSG) + pr_err(Device failed to respond within %d poweroff + time. Forcefully powering down the device\n, + timeout); + + /* Set the card state to no notification after the poweroff */ + card-poweroff_notify_state = MMC_NO_POWER_NOTIFICATION; + } + /* * Reset ocr mask to be the highest possible voltage supported for * this mmc host. This value will be used at next power up. @@ -2208,6 +2240,7 @@ int mmc_pm_notify(struct notifier_block *notify_block, spin_lock_irqsave(host-lock, flags); host-rescan_disable = 1; + host-power_notify_type = MMC_HOST_PW_NOTIFY_SHORT; spin_unlock_irqrestore(host-lock, flags); cancel_delayed_work_sync(host-detect); @@ -2231,6 +2264,7 @@ int mmc_pm_notify(struct notifier_block *notify_block
Re: [PATCH V8] mmc: core: Add Power Off Notify Feature eMMC 4.5
On 14 October 2011 03:41, Chris Ball c...@laptop.org wrote: Hi Girish, just trivial changes below. Does anyone have a Tested-by: to add to the patch? No not yet. On Thu, Oct 13 2011, Girish K S wrote: This patch adds the support for power off notify feature, available in eMMC 4.5 devices. If the the host has support for this feature, then the mmc core will notify it to the device by setting the POWER_OFF_NOTIFICATION byte in the extended csd register with a value 1(POWER_ON). For suspend mode short timeout is used, whereas for the normal poweroff long timeout is used. cc: Chris Ball c...@laptop.org Signed-off-by: Girish K S girish.shivananja...@linaro.org Signed-off-by: Jaehoon Chung jh80.ch...@samsung.com --- Changes in V8: Updated with review comments of Chris Ball and rebased to chris-mmc/mmc-next branch. Changes in V7: Rebased to chris-mmc/mmc-next branch. merged to patches to single patch. Changes in V6: Fixes checkpatch errors. The patches are generated after rebasing to chris's mmc-next branch. Changes in V5: This patch version fixes the problem with power off notify function, when called for the first time and card is not yet initialised. Changes in V4: Updated with review comments of Jeon Changes in V2: Adds poweroff notification handling in suspend/normal. drivers/mmc/core/core.c | 36 drivers/mmc/core/mmc.c | 23 +-- drivers/mmc/host/sdhci.c | 9 + include/linux/mmc/card.h | 6 ++ include/linux/mmc/host.h | 6 ++ include/linux/mmc/mmc.h | 8 6 files changed, 86 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 61d7730..db368b2 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1212,11 +1212,45 @@ static void mmc_power_up(struct mmc_host *host) void mmc_power_off(struct mmc_host *host) { + struct mmc_card *card; struct mmc_card *card = host-card; + unsigned int notify_type; + unsigned int timeout; + int err; + + BUG_ON(!host); Not necessary. OK + mmc_host_clk_hold(host); + card = host-card; host-ios.clock = 0; host-ios.vdd = 0; + if (card != NULL mmc_card_mmc(card) != NULL is unnecessary. This is required. Let me explain the scenario where i felt it is necessary. The card resource will be allocated when the delayed work is scheduled i.e.(on invocation of the function mmc_rescan) The call trace for card instance creation is given below in the called sequence. mmc_rescan-mmc_rescan_try_freq-mmc_attach_mmc-mmc_init_card. Before the above card resource is allocated, the power_off function is invoked in the function mmc_start_host (invoked by the add_host) At this point of time the card == NULL and system crashes. So i check for NULL first and then the card state. + (card-poweroff_notify_state == MMC_POWERED_ON)) { Extra set of parens unnecessary. OK + + if (host-power_notify_type == MMC_HOST_PW_NOTIFY_SHORT) { + notify_type = EXT_CSD_POWER_OFF_SHORT; + timeout = card-ext_csd.generic_cmd6_time; + card-poweroff_notify_state = MMC_POWEROFF_SHORT; + } else { + notify_type = EXT_CSD_POWER_OFF_LONG; + timeout = card-ext_csd.power_off_longtime; + card-poweroff_notify_state = MMC_POWEROFF_LONG; + } + + err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, + EXT_CSD_POWER_OFF_NOTIFICATION, + notify_type, timeout); + + if (err err != -EBADMSG) + pr_err(Device failed to respond within %d poweroff + time. Forcefully powering down the device\n, + timeout); + + /* Set the card state to no notification after the poweroff */ + card-poweroff_notify_state = MMC_NO_POWER_NOTIFICATION; + } + /* * Reset ocr mask to be the highest possible voltage supported for * this mmc host. This value will be used at next power up. @@ -2208,6 +2242,7 @@ int mmc_pm_notify(struct notifier_block *notify_block, spin_lock_irqsave(host-lock, flags); host-rescan_disable = 1; + host-power_notify_type = MMC_HOST_PW_NOTIFY_SHORT; spin_unlock_irqrestore(host-lock, flags); cancel_delayed_work_sync(host-detect); @@ -2231,6 +2266,7 @@ int mmc_pm_notify(struct notifier_block *notify_block, spin_lock_irqsave(host-lock, flags); host-rescan_disable = 0; + host-power_notify_type = MMC_HOST_PW_NOTIFY_LONG; spin_unlock_irqrestore(host-lock, flags
[PATCH V8] mmc: core: Add Power Off Notify Feature eMMC 4.5
This patch adds the support for power off notify feature, available in eMMC 4.5 devices. If the the host has support for this feature, then the mmc core will notify it to the device by setting the POWER_OFF_NOTIFICATION byte in the extended csd register with a value 1(POWER_ON). For suspend mode short timeout is used, whereas for the normal poweroff long timeout is used. cc: Chris Ball c...@laptop.org Signed-off-by: Girish K S girish.shivananja...@linaro.org Signed-off-by: Jaehoon Chung jh80.ch...@samsung.com --- Changes in V8: Updated with review comments of Chris Ball and rebased to chris-mmc/mmc-next branch. Changes in V7: Rebased to chris-mmc/mmc-next branch. merged to patches to single patch. Changes in V6: Fixes checkpatch errors. The patches are generated after rebasing to chris's mmc-next branch. Changes in V5: This patch version fixes the problem with power off notify function, when called for the first time and card is not yet initialised. Changes in V4: Updated with review comments of Jeon Changes in V2: Adds poweroff notification handling in suspend/normal. drivers/mmc/core/core.c | 36 drivers/mmc/core/mmc.c | 23 +-- drivers/mmc/host/sdhci.c |9 + include/linux/mmc/card.h |6 ++ include/linux/mmc/host.h |6 ++ include/linux/mmc/mmc.h |8 6 files changed, 86 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 61d7730..db368b2 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1212,11 +1212,45 @@ static void mmc_power_up(struct mmc_host *host) void mmc_power_off(struct mmc_host *host) { + struct mmc_card *card; + unsigned int notify_type; + unsigned int timeout; + int err; + + BUG_ON(!host); + mmc_host_clk_hold(host); + card = host-card; host-ios.clock = 0; host-ios.vdd = 0; + if (card != NULL mmc_card_mmc(card) + (card-poweroff_notify_state == MMC_POWERED_ON)) { + + if (host-power_notify_type == MMC_HOST_PW_NOTIFY_SHORT) { + notify_type = EXT_CSD_POWER_OFF_SHORT; + timeout = card-ext_csd.generic_cmd6_time; + card-poweroff_notify_state = MMC_POWEROFF_SHORT; + } else { + notify_type = EXT_CSD_POWER_OFF_LONG; + timeout = card-ext_csd.power_off_longtime; + card-poweroff_notify_state = MMC_POWEROFF_LONG; + } + + err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, +EXT_CSD_POWER_OFF_NOTIFICATION, +notify_type, timeout); + + if (err err != -EBADMSG) + pr_err(Device failed to respond within %d poweroff + time. Forcefully powering down the device\n, + timeout); + + /* Set the card state to no notification after the poweroff */ + card-poweroff_notify_state = MMC_NO_POWER_NOTIFICATION; + } + /* * Reset ocr mask to be the highest possible voltage supported for * this mmc host. This value will be used at next power up. @@ -2208,6 +2242,7 @@ int mmc_pm_notify(struct notifier_block *notify_block, spin_lock_irqsave(host-lock, flags); host-rescan_disable = 1; + host-power_notify_type = MMC_HOST_PW_NOTIFY_SHORT; spin_unlock_irqrestore(host-lock, flags); cancel_delayed_work_sync(host-detect); @@ -2231,6 +2266,7 @@ int mmc_pm_notify(struct notifier_block *notify_block, spin_lock_irqsave(host-lock, flags); host-rescan_disable = 0; + host-power_notify_type = MMC_HOST_PW_NOTIFY_LONG; spin_unlock_irqrestore(host-lock, flags); mmc_detect_change(host, 0); diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 4e869d3..f8ea938 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -458,10 +458,12 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) else card-erased_byte = 0x0; - if (card-ext_csd.rev = 6) + if (card-ext_csd.rev = 6) { card-ext_csd.generic_cmd6_time = 10 * ext_csd[EXT_CSD_GENERIC_CMD6_TIME]; - else + card-ext_csd.power_off_longtime = 10 * + ext_csd[EXT_CSD_POWER_OFF_LONG_TIME]; + } else card-ext_csd.generic_cmd6_time = 0; out: @@ -846,6 +848,23 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, } /* +* If the host supports the power_off_notify capability then +* set
[PATCH RESEND V3] mmc: core: HS200 mode support for eMMC 4.5
This patch adds the support of the HS200 bus speed for eMMC 4.5 devices. The eMMC 4.5 devices have support for 200MHz bus speed. The mmc core and host modules have been touched to add support for this module. It is necessary to know the card type in the sdhci.c file to add support for eMMC tuning function. So card.h file is included to import the card data structure. cc: Chris Ball c...@laptop.org Signed-off-by: Girish K S girish.shivananja...@linaro.org --- Changes in v1: Case statements in switch that produce same result have been combined to reduce repeated assignments. patch recreated after rebase to chris balls mmc-next branch. Changes in v2: Rebased to latest chris-mmc/mmc-next branch. Resolved indentation problems identified in review. This patch has to be applied before the patch released for modifying the printk messages. Changes in v3: In the previous commits of chris-mmc/mmc-next branch, the patch with commit id (c0f22a2c92e357e7cb3988b0b13034d70b7461f9) defines caps2 for more capabilities. This patch version deletes the member ext_caps(created in my earlier patch) from struct mmc_host and reuses already accepted caps2 member. drivers/mmc/core/bus.c|3 +- drivers/mmc/core/mmc.c| 92 drivers/mmc/host/sdhci.c | 36 +++--- include/linux/mmc/card.h |3 + include/linux/mmc/host.h |6 +++ include/linux/mmc/mmc.h |8 +++- include/linux/mmc/sdhci.h |1 + 7 files changed, 132 insertions(+), 17 deletions(-) diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index 393d817..a0aa7ab 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c @@ -301,10 +301,11 @@ int mmc_add_card(struct mmc_card *card) mmc_card_ddr_mode(card) ? DDR : , type); } else { - printk(KERN_INFO %s: new %s%s%s card at address %04x\n, + pr_info(%s: new %s%s%s%s card at address %04x\n, mmc_hostname(card-host), mmc_sd_card_uhs(card) ? ultra high speed : (mmc_card_highspeed(card) ? high speed : ), + (mmc_card_hs200(card) ? HS200 : ), mmc_card_ddr_mode(card) ? DDR : , type, card-rca); } diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 7dde373..da8cfb0 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -285,6 +285,39 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) } card-ext_csd.raw_card_type = ext_csd[EXT_CSD_CARD_TYPE]; switch (ext_csd[EXT_CSD_CARD_TYPE] EXT_CSD_CARD_TYPE_MASK) { + case EXT_CSD_CARD_TYPE_SDR_200 | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_200 | EXT_CSD_CARD_TYPE_DDR_1_8V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_200 | EXT_CSD_CARD_TYPE_DDR_1_2V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_200 | EXT_CSD_CARD_TYPE_DDR_52 | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_200; + break; + case EXT_CSD_CARD_TYPE_SDR_1_2V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_2V | EXT_CSD_CARD_TYPE_DDR_1_8V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_2V | EXT_CSD_CARD_TYPE_DDR_1_2V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_2V | EXT_CSD_CARD_TYPE_DDR_52 | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_1_2V; + break; + case EXT_CSD_CARD_TYPE_SDR_1_8V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_8V | EXT_CSD_CARD_TYPE_DDR_1_8V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_8V | EXT_CSD_CARD_TYPE_DDR_1_2V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_8V | EXT_CSD_CARD_TYPE_DDR_52 | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_1_8V; + break; case EXT_CSD_CARD_TYPE_DDR_52 | EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: card-ext_csd.hs_max_dtr = 5200; @@ -674,6 +707,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, { struct mmc_card *card; int err, ddr = 0; + int
Re: [PATCH V6 RESEND 2/2] mmc: core: Add Poweroff Notify handling eMMC 4.5
On 11 October 2011 04:39, Chris Ball c...@laptop.org wrote: Hi Girish, On Fri, Sep 16 2011, Girish K S wrote: This patch adds the power off notification handling during suspend and system poweroff. For suspend mode short timeout is used, whereas for the normal poweroff long timeout is used. Signed-off-by: Girish K S girish.shivananja...@linaro.org --- drivers/mmc/core/core.c | 34 ++ drivers/mmc/core/mmc.c | 5 - drivers/mmc/host/sdhci.c | 10 ++ include/linux/mmc/card.h | 19 +++ include/linux/mmc/host.h | 4 5 files changed, 71 insertions(+), 1 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 91a0a74..157060f 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1130,9 +1130,41 @@ static void mmc_power_up(struct mmc_host *host) static void mmc_power_off(struct mmc_host *host) { + struct mmc_card *card = host-card; + unsigned int notify_type; + unsigned int timeout; + int err; + host-ios.clock = 0; host-ios.vdd = 0; + if (card != NULL mmc_card_mmc(card) + (mmc_card_powernotify_on(card))) { + + if (host-power_notify_type == MMC_HOST_PW_NOTIFY_SHORT) { + notify_type = EXT_CSD_POWER_OFF_SHORT; + timeout = card-ext_csd.generic_cmd6_time; + mmc_card_set_powernotify_short(card); + } else { + notify_type = EXT_CSD_POWER_OFF_LONG; + timeout = card-ext_csd.power_off_longtime; + mmc_card_set_powernotify_long(card); + } + + err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, + EXT_CSD_POWER_OFF_NOTIFICATION, + notify_type, timeout); + + if (err err != -EBADMSG) + printk(KERN_ERR Device failed to respond + within %d poweroff time. + forcefully powering down + the device\n, timeout); You don't have any space between .f in the message. I suggest: pr_err(Device failed to respond within %d poweroff time. Forcefully powering down the device\n, timeout); + + /*Set the card state to no notification after the poweroff*/ A space between /* */. + mmc_card_set_powernotify_off(card); + } + /* * Reset ocr mask to be the highest possible voltage supported for * this mmc host. This value will be used at next power up. @@ -2022,6 +2054,7 @@ int mmc_pm_notify(struct notifier_block *notify_block, spin_lock_irqsave(host-lock, flags); host-rescan_disable = 1; + host-power_notify_type = MMC_HOST_PW_NOTIFY_SHORT; spin_unlock_irqrestore(host-lock, flags); cancel_delayed_work_sync(host-detect); @@ -2044,6 +2077,7 @@ int mmc_pm_notify(struct notifier_block *notify_block, spin_lock_irqsave(host-lock, flags); host-rescan_disable = 0; + host-power_notify_type = MMC_HOST_PW_NOTIFY_LONG; spin_unlock_irqrestore(host-lock, flags); mmc_detect_change(host, 0); diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 2f06b37..63cc77b 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -715,7 +715,8 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, * If the host supports the power_off_notify capability then * set the notification byte in the ext_csd register of device */ - if (host-caps MMC_CAP_POWER_OFF_NOTIFY) { + if ((host-caps MMC_CAP_POWER_OFF_NOTIFY) The is indented weirdly. Just use a space between ) . + (mmc_card_powernotify_off(card))) { err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_POWER_OFF_NOTIFICATION, EXT_CSD_POWER_ON, @@ -724,6 +725,8 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, goto free_card; } + if (!err) + mmc_card_set_powernotify_on(card); Extra newline needed here, as there was before you added these two lines. /* * Activate high speed (if supported) */ diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 0e02cc1..92ea734 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -2566,6 +2566,16 @@ int sdhci_add_host(struct sdhci_host *host) if (caps[1] SDHCI_DRIVER_TYPE_D) mmc-caps |= MMC_CAP_DRIVER_TYPE_D; + /* + * If Notify capability is enabled and + * notify type is not initialised by host, set
[PATCH RESEND V3] mmc: core: HS200 mode support for eMMC 4.5
This patch adds the support of the HS200 bus speed for eMMC 4.5 devices. The eMMC 4.5 devices have support for 200MHz bus speed. The mmc core and host modules have been touched to add support for this module. It is necessary to know the card type in the sdhci.c file to add support for eMMC tuning function. So card.h file is included to import the card data structure. cc: Chris Ball c...@laptop.org Signed-off-by: Girish K S girish.shivananja...@linaro.org --- Changes in v1: Case statements in switch that produce same result have been combined to reduce repeated assignments. patch recreated after rebase to chris balls mmc-next branch. Changes in v2: Rebased to latest chris-mmc/mmc-next branch. Resolved indentation problems identified in review. This patch has to be applied before the patch released for modifying the printk messages. Changes in v3: In the previous commits of chris-mmc/mmc-next branch, the patch with commit id (c0f22a2c92e357e7cb3988b0b13034d70b7461f9) defines caps2 for more capabilities. This patch version deletes the member ext_caps(created in my earlier patch) from struct mmc_host and reuses already accepted caps2 member. drivers/mmc/core/bus.c|3 +- drivers/mmc/core/mmc.c| 92 drivers/mmc/host/sdhci.c | 36 +++--- include/linux/mmc/card.h |3 + include/linux/mmc/host.h |6 +++ include/linux/mmc/mmc.h |8 +++- include/linux/mmc/sdhci.h |1 + 7 files changed, 132 insertions(+), 17 deletions(-) diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index 393d817..a0aa7ab 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c @@ -301,10 +301,11 @@ int mmc_add_card(struct mmc_card *card) mmc_card_ddr_mode(card) ? DDR : , type); } else { - printk(KERN_INFO %s: new %s%s%s card at address %04x\n, + pr_info(%s: new %s%s%s%s card at address %04x\n, mmc_hostname(card-host), mmc_sd_card_uhs(card) ? ultra high speed : (mmc_card_highspeed(card) ? high speed : ), + (mmc_card_hs200(card) ? HS200 : ), mmc_card_ddr_mode(card) ? DDR : , type, card-rca); } diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 7dde373..da8cfb0 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -285,6 +285,39 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) } card-ext_csd.raw_card_type = ext_csd[EXT_CSD_CARD_TYPE]; switch (ext_csd[EXT_CSD_CARD_TYPE] EXT_CSD_CARD_TYPE_MASK) { + case EXT_CSD_CARD_TYPE_SDR_200 | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_200 | EXT_CSD_CARD_TYPE_DDR_1_8V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_200 | EXT_CSD_CARD_TYPE_DDR_1_2V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_200 | EXT_CSD_CARD_TYPE_DDR_52 | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_200; + break; + case EXT_CSD_CARD_TYPE_SDR_1_2V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_2V | EXT_CSD_CARD_TYPE_DDR_1_8V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_2V | EXT_CSD_CARD_TYPE_DDR_1_2V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_2V | EXT_CSD_CARD_TYPE_DDR_52 | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_1_2V; + break; + case EXT_CSD_CARD_TYPE_SDR_1_8V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_8V | EXT_CSD_CARD_TYPE_DDR_1_8V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_8V | EXT_CSD_CARD_TYPE_DDR_1_2V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_8V | EXT_CSD_CARD_TYPE_DDR_52 | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_1_8V; + break; case EXT_CSD_CARD_TYPE_DDR_52 | EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: card-ext_csd.hs_max_dtr = 5200; @@ -674,6 +707,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, { struct mmc_card *card; int err, ddr = 0; + int
Re: [PATCH V4] mmc: core: HS200 mode support for eMMC 4.5
On 4 October 2011 19:51, Girish K S girish.shivananja...@linaro.org wrote: This patch adds the support of the HS200 bus speed for eMMC 4.5 devices. The eMMC 4.5 devices have support for 200MHz bus speed. The mmc core and host modules have been touched to add support for this module. It is necessary to know the card type in the sdhci.c file to add support for eMMC tuning function. So card.h file is included to import the card data structure. Signed-off-by: Girish K S girish.shivananja...@linaro.org --- Changes in v1: Case statements in switch that produce same result have been combined to reduce repeated assignments. patch recreated after rebase to chris balls mmc-next branch. Changes in v2: Rebased to latest chris-mmc/mmc-next branch. Resolved indentation problems identified in review. This patch has to be applied before the patch released for modifying the printk messages. Changes in v3: In the previous commits of chris-mmc/mmc-next branch, the patch with commit id (c0f22a2c92e357e7cb3988b0b13034d70b7461f9) defines caps2 for more capabilities. This patch version deletes the member ext_caps(created in my earlier patch) from struct mmc_host and reuses already accepted caps2 member. Changes in v4: This patch is based on commit id d762b9bedaa1a5c720ecb4d56ba41f8cfc10d8e7 of Jaehoon Chung's repository at git://git.infradead.org/users/kmpark/linux-2.6-samsung emmc4.5 drivers/mmc/core/bus.c | 3 +- drivers/mmc/core/mmc.c | 92 drivers/mmc/host/sdhci.c | 36 +++--- include/linux/mmc/card.h | 3 + include/linux/mmc/host.h | 6 +++ include/linux/mmc/mmc.h | 8 +++- include/linux/mmc/sdhci.h | 1 + 7 files changed, 132 insertions(+), 17 deletions(-) diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index 393d817..a0aa7ab 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c @@ -301,10 +301,11 @@ int mmc_add_card(struct mmc_card *card) mmc_card_ddr_mode(card) ? DDR : , type); } else { - printk(KERN_INFO %s: new %s%s%s card at address %04x\n, + printk(KERN_INFO %s: new %s%s%s%s card at address %04x\n, mmc_hostname(card-host), mmc_sd_card_uhs(card) ? ultra high speed : (mmc_card_highspeed(card) ? high speed : ), + (mmc_card_hs200(card) ? HS200 : ), mmc_card_ddr_mode(card) ? DDR : , type, card-rca); } diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 297bbff..36aa662 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -283,6 +283,39 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) } card-ext_csd.raw_card_type = ext_csd[EXT_CSD_CARD_TYPE]; switch (ext_csd[EXT_CSD_CARD_TYPE] EXT_CSD_CARD_TYPE_MASK) { + case EXT_CSD_CARD_TYPE_SDR_200 | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_200 | EXT_CSD_CARD_TYPE_DDR_1_8V | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_200 | EXT_CSD_CARD_TYPE_DDR_1_2V | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_200 | EXT_CSD_CARD_TYPE_DDR_52 | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_200; + break; + case EXT_CSD_CARD_TYPE_SDR_1_2V | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_2V | EXT_CSD_CARD_TYPE_DDR_1_8V | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_2V | EXT_CSD_CARD_TYPE_DDR_1_2V | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_2V | EXT_CSD_CARD_TYPE_DDR_52 | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_1_2V; + break; + case EXT_CSD_CARD_TYPE_SDR_1_8V | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_8V | EXT_CSD_CARD_TYPE_DDR_1_8V | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_8V | EXT_CSD_CARD_TYPE_DDR_1_2V | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_8V | EXT_CSD_CARD_TYPE_DDR_52 | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type
[PATCH] arm: mm: Fix infinite looping issue
This patch fixes the problem of infinite looping while booting. The bne instruction expects the z flag to be set to break the loop. The (mov r1, r1, lsr #1) doesn't behave in the expected way. If replaced with the movs instruction then the execution will exit the loop. Signed-off-by: Girish K S girish.shivananja...@linaro.org --- arch/arm/mm/proc-arm740.S |4 ++-- arch/arm/mm/proc-arm940.S |4 ++-- arch/arm/mm/proc-arm946.S |4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/arm/mm/proc-arm740.S b/arch/arm/mm/proc-arm740.S index 4506be3..9284f10 100644 --- a/arch/arm/mm/proc-arm740.S +++ b/arch/arm/mm/proc-arm740.S @@ -77,7 +77,7 @@ __arm740_setup: ldr r1, =(CONFIG_DRAM_SIZE 12) @ size of RAM (must be = 4KB) mov r2, #10 @ 11 is the minimum (4KB) 1: add r2, r2, #1 @ area size *= 2 - mov r1, r1, lsr #1 + movsr1, r1, lsr #1 @ set zero bit if r1=0 bne 1b @ count not zero r-shift orr r0, r0, r2, lsl #1 @ the area register value orr r0, r0, #1 @ set enable bit @@ -87,7 +87,7 @@ __arm740_setup: ldr r1, =(CONFIG_FLASH_SIZE 12) @ size of FLASH (must be = 4KB) mov r2, #10 @ 11 is the minimum (4KB) 1: add r2, r2, #1 @ area size *= 2 - mov r1, r1, lsr #1 + movsr1, r1, lsr #1 @ set zero bit if r1=0 bne 1b @ count not zero r-shift orr r0, r0, r2, lsl #1 @ the area register value orr r0, r0, #1 @ set enable bit diff --git a/arch/arm/mm/proc-arm940.S b/arch/arm/mm/proc-arm940.S index ac750d5..e639034 100644 --- a/arch/arm/mm/proc-arm940.S +++ b/arch/arm/mm/proc-arm940.S @@ -296,7 +296,7 @@ __arm940_setup: ldr r1, =(CONFIG_DRAM_SIZE 12) @ size of RAM (must be = 4KB) mov r2, #10 @ 11 is the minimum (4KB) 1: add r2, r2, #1 @ area size *= 2 - mov r1, r1, lsr #1 + movsr1, r1, lsr #1 @ set zero bit if r1=0 bne 1b @ count not zero r-shift orr r0, r0, r2, lsl #1 @ the area register value orr r0, r0, #1 @ set enable bit @@ -307,7 +307,7 @@ __arm940_setup: ldr r1, =(CONFIG_FLASH_SIZE 12) @ size of FLASH (must be = 4KB) mov r2, #10 @ 11 is the minimum (4KB) 1: add r2, r2, #1 @ area size *= 2 - mov r1, r1, lsr #1 + movsr1, r1, lsr #1 @ set zero bit if r1=0 bne 1b @ count not zero r-shift orr r0, r0, r2, lsl #1 @ the area register value orr r0, r0, #1 @ set enable bit diff --git a/arch/arm/mm/proc-arm946.S b/arch/arm/mm/proc-arm946.S index 683af3a..731388a 100644 --- a/arch/arm/mm/proc-arm946.S +++ b/arch/arm/mm/proc-arm946.S @@ -341,7 +341,7 @@ __arm946_setup: ldr r1, =(CONFIG_DRAM_SIZE 12) @ size of RAM (must be = 4KB) mov r2, #10 @ 11 is the minimum (4KB) 1: add r2, r2, #1 @ area size *= 2 - mov r1, r1, lsr #1 + movsr1, r1, lsr #1 @ set zero bit if r1=0 bne 1b @ count not zero r-shift orr r0, r0, r2, lsl #1 @ the region register value orr r0, r0, #1 @ set enable bit @@ -351,7 +351,7 @@ __arm946_setup: ldr r1, =(CONFIG_FLASH_SIZE 12) @ size of FLASH (must be = 4KB) mov r2, #10 @ 11 is the minimum (4KB) 1: add r2, r2, #1 @ area size *= 2 - mov r1, r1, lsr #1 + movsr1, r1, lsr #1 @ set zero bit if r1=0 bne 1b @ count not zero r-shift orr r0, r0, r2, lsl #1 @ the region register value orr r0, r0, #1 @ set enable bit -- 1.7.1 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V7] mmc: core: Add Power Off Notify Feature eMMC 4.5
Hello Mr Chung, Kindly apply my HS200 feature patch before this patch. then it will work fine. can you check and let me know if it applies after HS200 patch. If it can be applied i will modify and resend regards Girish K S On 4 October 2011 16:22, Jaehoon Chung jh80.ch...@samsung.com wrote: Hi Girish.. i think this patch didn't base on latest for mmc-next.. i commented the below. Regards, Jaehoon Chung On 09/29/2011 07:46 PM, Girish K S wrote: This patch adds the support for power off notify feature available in eMMC 4.5 devices. If the the host has support for this feature, then the mmc core will notify it to the device by setting the POWER_OFF_NOTIFICATION byte in the extended csd register with a value 1(POWER_ON). For suspend mode short timeout is used, whereas for the normal poweroff long timeout is used. This patch is dependent on Seungwon Jeon's patch for CMD6 timeout. Signed-off-by: Girish K S girish.shivananja...@linaro.org --- Changes in V2: Adds poweroff notification handling in suspend/normal Changes in V4: Updated with review comments of Jeon Changes in V5: This patch version fixes the problem with power off notify function, when called for the first time and card is not yet initialised. Changes in V6: Fixes checkpatch errors. The patches are generated after rebasing to chris's mmc-next branch. Changes in V7: Rebased to chris-mmc/mmc-next branch. merged to patches to single patch. drivers/mmc/core/core.c | 37 + drivers/mmc/core/mmc.c | 22 ++ drivers/mmc/host/sdhci.c | 10 ++ include/linux/mmc/card.h | 21 + include/linux/mmc/host.h | 5 + include/linux/mmc/mmc.h | 6 ++ 6 files changed, 101 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 9698d8a..5fb2120 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1198,11 +1198,46 @@ static void mmc_power_up(struct mmc_host *host) void mmc_power_off(struct mmc_host *host) { + struct mmc_card *card; + unsigned int notify_type; + unsigned int timeout; + int err; + + BUG_ON(!host); + mmc_host_clk_hold(host); + card = host-card; host-ios.clock = 0; host-ios.vdd = 0; + if (card != NULL mmc_card_mmc(card) + (mmc_card_powernotify_on(card))) { + + if (host-power_notify_type == MMC_HOST_PW_NOTIFY_SHORT) { + notify_type = EXT_CSD_POWER_OFF_SHORT; + timeout = card-ext_csd.generic_cmd6_time; + mmc_card_set_powernotify_short(card); + } else { + notify_type = EXT_CSD_POWER_OFF_LONG; + timeout = card-ext_csd.power_off_longtime; + mmc_card_set_powernotify_long(card); + } + + err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, + EXT_CSD_POWER_OFF_NOTIFICATION, + notify_type, timeout); + + if (err err != -EBADMSG) + pr_err(Device failed to respond + within %d poweroff time. + forcefully powering down + the device\n, timeout); + + /* Set the card state to no notification after the poweroff */ + mmc_card_set_powernotify_off(card); + } + /* * Reset ocr mask to be the highest possible voltage supported for * this mmc host. This value will be used at next power up. @@ -2194,6 +2230,7 @@ int mmc_pm_notify(struct notifier_block *notify_block, spin_lock_irqsave(host-lock, flags); host-rescan_disable = 1; + host-power_notify_type = MMC_HOST_PW_NOTIFY_SHORT; spin_unlock_irqrestore(host-lock, flags); cancel_delayed_work_sync(host-detect); @@ -2217,6 +2254,7 @@ int mmc_pm_notify(struct notifier_block *notify_block, spin_lock_irqsave(host-lock, flags); host-rescan_disable = 0; + host-power_notify_type = MMC_HOST_PW_NOTIFY_LONG; spin_unlock_irqrestore(host-lock, flags); mmc_detect_change(host, 0); diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index f28aa4f..25ba7f5 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -447,6 +447,11 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) else card-erased_byte = 0x0; + if (card-ext_csd.rev = 6) { + card-ext_csd.power_off_longtime = 10 * + ext_csd[EXT_CSD_POWER_OFF_LONG_TIME]; + } + out: return err; } @@ -829,6 +834,23 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr
Re: [PATCH V7] mmc: core: Add Power Off Notify Feature eMMC 4.5
Hello Mr Chung, I got your point. My reply was for your comment on cannot apply this patch on mmc-next branch. regards Girish K S On 4 October 2011 16:46, Jaehoon Chung jh80.ch...@samsung.com wrote: Hi Girish.. My means if you use host-caps2, i think right that should be define MMC_CAP2_XXX. Am i wrong? Best regards, Jaehoon Chung On 10/04/2011 08:03 PM, Girish K S wrote: Hello Mr Chung, Kindly apply my HS200 feature patch before this patch. then it will work fine. can you check and let me know if it applies after HS200 patch. If it can be applied i will modify and resend regards Girish K S On 4 October 2011 16:22, Jaehoon Chung jh80.ch...@samsung.com wrote: Hi Girish.. i think this patch didn't base on latest for mmc-next.. i commented the below. Regards, Jaehoon Chung On 09/29/2011 07:46 PM, Girish K S wrote: This patch adds the support for power off notify feature available in eMMC 4.5 devices. If the the host has support for this feature, then the mmc core will notify it to the device by setting the POWER_OFF_NOTIFICATION byte in the extended csd register with a value 1(POWER_ON). For suspend mode short timeout is used, whereas for the normal poweroff long timeout is used. This patch is dependent on Seungwon Jeon's patch for CMD6 timeout. Signed-off-by: Girish K S girish.shivananja...@linaro.org --- Changes in V2: Adds poweroff notification handling in suspend/normal Changes in V4: Updated with review comments of Jeon Changes in V5: This patch version fixes the problem with power off notify function, when called for the first time and card is not yet initialised. Changes in V6: Fixes checkpatch errors. The patches are generated after rebasing to chris's mmc-next branch. Changes in V7: Rebased to chris-mmc/mmc-next branch. merged to patches to single patch. drivers/mmc/core/core.c | 37 + drivers/mmc/core/mmc.c | 22 ++ drivers/mmc/host/sdhci.c | 10 ++ include/linux/mmc/card.h | 21 + include/linux/mmc/host.h | 5 + include/linux/mmc/mmc.h | 6 ++ 6 files changed, 101 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 9698d8a..5fb2120 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1198,11 +1198,46 @@ static void mmc_power_up(struct mmc_host *host) void mmc_power_off(struct mmc_host *host) { + struct mmc_card *card; + unsigned int notify_type; + unsigned int timeout; + int err; + + BUG_ON(!host); + mmc_host_clk_hold(host); + card = host-card; host-ios.clock = 0; host-ios.vdd = 0; + if (card != NULL mmc_card_mmc(card) + (mmc_card_powernotify_on(card))) { + + if (host-power_notify_type == MMC_HOST_PW_NOTIFY_SHORT) { + notify_type = EXT_CSD_POWER_OFF_SHORT; + timeout = card-ext_csd.generic_cmd6_time; + mmc_card_set_powernotify_short(card); + } else { + notify_type = EXT_CSD_POWER_OFF_LONG; + timeout = card-ext_csd.power_off_longtime; + mmc_card_set_powernotify_long(card); + } + + err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, + EXT_CSD_POWER_OFF_NOTIFICATION, + notify_type, timeout); + + if (err err != -EBADMSG) + pr_err(Device failed to respond + within %d poweroff time. + forcefully powering down + the device\n, timeout); + + /* Set the card state to no notification after the poweroff */ + mmc_card_set_powernotify_off(card); + } + /* * Reset ocr mask to be the highest possible voltage supported for * this mmc host. This value will be used at next power up. @@ -2194,6 +2230,7 @@ int mmc_pm_notify(struct notifier_block *notify_block, spin_lock_irqsave(host-lock, flags); host-rescan_disable = 1; + host-power_notify_type = MMC_HOST_PW_NOTIFY_SHORT; spin_unlock_irqrestore(host-lock, flags); cancel_delayed_work_sync(host-detect); @@ -2217,6 +2254,7 @@ int mmc_pm_notify(struct notifier_block *notify_block, spin_lock_irqsave(host-lock, flags); host-rescan_disable = 0; + host-power_notify_type = MMC_HOST_PW_NOTIFY_LONG; spin_unlock_irqrestore(host-lock, flags); mmc_detect_change(host, 0); diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index f28aa4f..25ba7f5 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c
Re: [PATCH V7] mmc: core: Add Power Off Notify Feature eMMC 4.5
Hello Mr Chung, Since my both patches are dependent on each other. i will generate a patch series of HS200 and Power notify. So that they can be applied sequentially. Will update with your mentioned comment. kindly review it after my release. regards Girish K S On 4 October 2011 16:50, Girish K S girish.shivananja...@linaro.org wrote: Hello Mr Chung, I got your point. My reply was for your comment on cannot apply this patch on mmc-next branch. regards Girish K S On 4 October 2011 16:46, Jaehoon Chung jh80.ch...@samsung.com wrote: Hi Girish.. My means if you use host-caps2, i think right that should be define MMC_CAP2_XXX. Am i wrong? Best regards, Jaehoon Chung On 10/04/2011 08:03 PM, Girish K S wrote: Hello Mr Chung, Kindly apply my HS200 feature patch before this patch. then it will work fine. can you check and let me know if it applies after HS200 patch. If it can be applied i will modify and resend regards Girish K S On 4 October 2011 16:22, Jaehoon Chung jh80.ch...@samsung.com wrote: Hi Girish.. i think this patch didn't base on latest for mmc-next.. i commented the below. Regards, Jaehoon Chung On 09/29/2011 07:46 PM, Girish K S wrote: This patch adds the support for power off notify feature available in eMMC 4.5 devices. If the the host has support for this feature, then the mmc core will notify it to the device by setting the POWER_OFF_NOTIFICATION byte in the extended csd register with a value 1(POWER_ON). For suspend mode short timeout is used, whereas for the normal poweroff long timeout is used. This patch is dependent on Seungwon Jeon's patch for CMD6 timeout. Signed-off-by: Girish K S girish.shivananja...@linaro.org --- Changes in V2: Adds poweroff notification handling in suspend/normal Changes in V4: Updated with review comments of Jeon Changes in V5: This patch version fixes the problem with power off notify function, when called for the first time and card is not yet initialised. Changes in V6: Fixes checkpatch errors. The patches are generated after rebasing to chris's mmc-next branch. Changes in V7: Rebased to chris-mmc/mmc-next branch. merged to patches to single patch. drivers/mmc/core/core.c | 37 + drivers/mmc/core/mmc.c | 22 ++ drivers/mmc/host/sdhci.c | 10 ++ include/linux/mmc/card.h | 21 + include/linux/mmc/host.h | 5 + include/linux/mmc/mmc.h | 6 ++ 6 files changed, 101 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 9698d8a..5fb2120 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1198,11 +1198,46 @@ static void mmc_power_up(struct mmc_host *host) void mmc_power_off(struct mmc_host *host) { + struct mmc_card *card; + unsigned int notify_type; + unsigned int timeout; + int err; + + BUG_ON(!host); + mmc_host_clk_hold(host); + card = host-card; host-ios.clock = 0; host-ios.vdd = 0; + if (card != NULL mmc_card_mmc(card) + (mmc_card_powernotify_on(card))) { + + if (host-power_notify_type == MMC_HOST_PW_NOTIFY_SHORT) { + notify_type = EXT_CSD_POWER_OFF_SHORT; + timeout = card-ext_csd.generic_cmd6_time; + mmc_card_set_powernotify_short(card); + } else { + notify_type = EXT_CSD_POWER_OFF_LONG; + timeout = card-ext_csd.power_off_longtime; + mmc_card_set_powernotify_long(card); + } + + err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, + EXT_CSD_POWER_OFF_NOTIFICATION, + notify_type, timeout); + + if (err err != -EBADMSG) + pr_err(Device failed to respond + within %d poweroff time. + forcefully powering down + the device\n, timeout); + + /* Set the card state to no notification after the poweroff */ + mmc_card_set_powernotify_off(card); + } + /* * Reset ocr mask to be the highest possible voltage supported for * this mmc host. This value will be used at next power up. @@ -2194,6 +2230,7 @@ int mmc_pm_notify(struct notifier_block *notify_block, spin_lock_irqsave(host-lock, flags); host-rescan_disable = 1; + host-power_notify_type = MMC_HOST_PW_NOTIFY_SHORT; spin_unlock_irqrestore(host-lock, flags); cancel_delayed_work_sync(host-detect); @@ -2217,6 +2254,7 @@ int mmc_pm_notify(struct notifier_block *notify_block, spin_lock_irqsave(host-lock, flags); host
Re: [PATCH V7] mmc: core: Add Power Off Notify Feature eMMC 4.5
Dear Mr Chung, i saw your pull request with poweroff notify feature. did you modify anything in the Power Notify feature. I am preparing the patch with your review comment. regards Girish K S On 4 October 2011 17:11, Girish K S girish.shivananja...@linaro.org wrote: Hello Mr Chung, Since my both patches are dependent on each other. i will generate a patch series of HS200 and Power notify. So that they can be applied sequentially. Will update with your mentioned comment. kindly review it after my release. regards Girish K S On 4 October 2011 16:50, Girish K S girish.shivananja...@linaro.org wrote: Hello Mr Chung, I got your point. My reply was for your comment on cannot apply this patch on mmc-next branch. regards Girish K S On 4 October 2011 16:46, Jaehoon Chung jh80.ch...@samsung.com wrote: Hi Girish.. My means if you use host-caps2, i think right that should be define MMC_CAP2_XXX. Am i wrong? Best regards, Jaehoon Chung On 10/04/2011 08:03 PM, Girish K S wrote: Hello Mr Chung, Kindly apply my HS200 feature patch before this patch. then it will work fine. can you check and let me know if it applies after HS200 patch. If it can be applied i will modify and resend regards Girish K S On 4 October 2011 16:22, Jaehoon Chung jh80.ch...@samsung.com wrote: Hi Girish.. i think this patch didn't base on latest for mmc-next.. i commented the below. Regards, Jaehoon Chung On 09/29/2011 07:46 PM, Girish K S wrote: This patch adds the support for power off notify feature available in eMMC 4.5 devices. If the the host has support for this feature, then the mmc core will notify it to the device by setting the POWER_OFF_NOTIFICATION byte in the extended csd register with a value 1(POWER_ON). For suspend mode short timeout is used, whereas for the normal poweroff long timeout is used. This patch is dependent on Seungwon Jeon's patch for CMD6 timeout. Signed-off-by: Girish K S girish.shivananja...@linaro.org --- Changes in V2: Adds poweroff notification handling in suspend/normal Changes in V4: Updated with review comments of Jeon Changes in V5: This patch version fixes the problem with power off notify function, when called for the first time and card is not yet initialised. Changes in V6: Fixes checkpatch errors. The patches are generated after rebasing to chris's mmc-next branch. Changes in V7: Rebased to chris-mmc/mmc-next branch. merged to patches to single patch. drivers/mmc/core/core.c | 37 + drivers/mmc/core/mmc.c | 22 ++ drivers/mmc/host/sdhci.c | 10 ++ include/linux/mmc/card.h | 21 + include/linux/mmc/host.h | 5 + include/linux/mmc/mmc.h | 6 ++ 6 files changed, 101 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 9698d8a..5fb2120 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1198,11 +1198,46 @@ static void mmc_power_up(struct mmc_host *host) void mmc_power_off(struct mmc_host *host) { + struct mmc_card *card; + unsigned int notify_type; + unsigned int timeout; + int err; + + BUG_ON(!host); + mmc_host_clk_hold(host); + card = host-card; host-ios.clock = 0; host-ios.vdd = 0; + if (card != NULL mmc_card_mmc(card) + (mmc_card_powernotify_on(card))) { + + if (host-power_notify_type == MMC_HOST_PW_NOTIFY_SHORT) { + notify_type = EXT_CSD_POWER_OFF_SHORT; + timeout = card-ext_csd.generic_cmd6_time; + mmc_card_set_powernotify_short(card); + } else { + notify_type = EXT_CSD_POWER_OFF_LONG; + timeout = card-ext_csd.power_off_longtime; + mmc_card_set_powernotify_long(card); + } + + err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, + EXT_CSD_POWER_OFF_NOTIFICATION, + notify_type, timeout); + + if (err err != -EBADMSG) + pr_err(Device failed to respond + within %d poweroff time. + forcefully powering down + the device\n, timeout); + + /* Set the card state to no notification after the poweroff */ + mmc_card_set_powernotify_off(card); + } + /* * Reset ocr mask to be the highest possible voltage supported for * this mmc host. This value will be used at next power up. @@ -2194,6 +2230,7 @@ int mmc_pm_notify(struct notifier_block *notify_block, spin_lock_irqsave(host-lock, flags); host-rescan_disable = 1; + host-power_notify_type
Re: [PATCH V2] mmc: core: HS200 mode support for eMMC 4.5
Dear all, Since the member host-ext_caps is a duplicate of host-caps2 which is already accepted in mainline by maintainer. I will resend my patch by using the existing caps2 member of struct mmc_host . regards Girish K S On 28 September 2011 10:30, Girish K S girish.shivananja...@linaro.org wrote: This patch adds the support of the HS200 bus speed for eMMC 4.5 devices. The eMMC 4.5 devices have support for 200MHz bus speed. The mmc core and host modules have been touched to add support for this module. It is necessary to know the card type in the sdhci.c file to add support for eMMC tuning function. So card.h file is included to import the card data structure. Signed-off-by: Girish K S girish.shivananja...@linaro.org --- Changes in v1: Case statements in switch that produce same result have been combined to reduce repeated assignments. patch recreated after rebase to chris balls mmc-next branch. Changes in v2: Rebased to latest chris-mmc/mmc-next branch. Resolved indentation problems identified in review. This patch has to be applied before the patch released for modifying the printk messages. drivers/mmc/core/bus.c | 3 +- drivers/mmc/core/mmc.c | 91 + drivers/mmc/host/sdhci.c | 36 +++--- include/linux/mmc/card.h | 3 + include/linux/mmc/host.h | 8 include/linux/mmc/mmc.h | 8 +++- include/linux/mmc/sdhci.h | 1 + 7 files changed, 134 insertions(+), 16 deletions(-) diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index 393d817..a0aa7ab 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c @@ -301,10 +301,11 @@ int mmc_add_card(struct mmc_card *card) mmc_card_ddr_mode(card) ? DDR : , type); } else { - printk(KERN_INFO %s: new %s%s%s card at address %04x\n, + printk(KERN_INFO %s: new %s%s%s%s card at address %04x\n, mmc_hostname(card-host), mmc_sd_card_uhs(card) ? ultra high speed : (mmc_card_highspeed(card) ? high speed : ), + (mmc_card_hs200(card) ? HS200 : ), mmc_card_ddr_mode(card) ? DDR : , type, card-rca); } diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index c632b1f..382bf39 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -283,6 +283,39 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) } card-ext_csd.raw_card_type = ext_csd[EXT_CSD_CARD_TYPE]; switch (ext_csd[EXT_CSD_CARD_TYPE] EXT_CSD_CARD_TYPE_MASK) { + case EXT_CSD_CARD_TYPE_SDR_200 | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_200 | EXT_CSD_CARD_TYPE_DDR_1_8V | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_200 | EXT_CSD_CARD_TYPE_DDR_1_2V | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_200 | EXT_CSD_CARD_TYPE_DDR_52 | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_200; + break; + case EXT_CSD_CARD_TYPE_SDR_1_2V | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_2V | EXT_CSD_CARD_TYPE_DDR_1_8V | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_2V | EXT_CSD_CARD_TYPE_DDR_1_2V | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_2V | EXT_CSD_CARD_TYPE_DDR_52 | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_1_2V; + break; + case EXT_CSD_CARD_TYPE_SDR_1_8V | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_8V | EXT_CSD_CARD_TYPE_DDR_1_8V | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_8V | EXT_CSD_CARD_TYPE_DDR_1_2V | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_8V | EXT_CSD_CARD_TYPE_DDR_52 | + EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_1_8V; + break; case EXT_CSD_CARD_TYPE_DDR_52 | EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: card-ext_csd.hs_max_dtr = 5200; @@ -624,6 +657,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, { struct mmc_card *card; int err, ddr = 0; + int
[PATCH V3] mmc: core: HS200 mode support for eMMC 4.5
This patch adds the support of the HS200 bus speed for eMMC 4.5 devices. The eMMC 4.5 devices have support for 200MHz bus speed. The mmc core and host modules have been touched to add support for this module. It is necessary to know the card type in the sdhci.c file to add support for eMMC tuning function. So card.h file is included to import the card data structure. Signed-off-by: Girish K S girish.shivananja...@linaro.org --- Changes in v1: Case statements in switch that produce same result have been combined to reduce repeated assignments. patch recreated after rebase to chris balls mmc-next branch. Changes in v2: Rebased to latest chris-mmc/mmc-next branch. Resolved indentation problems identified in review. This patch has to be applied before the patch released for modifying the printk messages. Changes in v3: In the previous commits of chris-mmc/mmc-next branch, the patch with commit id (c0f22a2c92e357e7cb3988b0b13034d70b7461f9) defines caps2 for more capabilities. This patch version deletes the member ext_caps(created in my earlier patch) from struct mmc_host and reuses already accepted caps2 member. drivers/mmc/core/bus.c|3 +- drivers/mmc/core/mmc.c| 91 + drivers/mmc/host/sdhci.c | 36 +++--- include/linux/mmc/card.h |3 + include/linux/mmc/host.h |6 +++ include/linux/mmc/mmc.h |8 +++- include/linux/mmc/sdhci.h |1 + 7 files changed, 132 insertions(+), 16 deletions(-) diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index 393d817..a0aa7ab 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c @@ -301,10 +301,11 @@ int mmc_add_card(struct mmc_card *card) mmc_card_ddr_mode(card) ? DDR : , type); } else { - printk(KERN_INFO %s: new %s%s%s card at address %04x\n, + printk(KERN_INFO %s: new %s%s%s%s card at address %04x\n, mmc_hostname(card-host), mmc_sd_card_uhs(card) ? ultra high speed : (mmc_card_highspeed(card) ? high speed : ), + (mmc_card_hs200(card) ? HS200 : ), mmc_card_ddr_mode(card) ? DDR : , type, card-rca); } diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index c632b1f..f28aa4f 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -283,6 +283,39 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) } card-ext_csd.raw_card_type = ext_csd[EXT_CSD_CARD_TYPE]; switch (ext_csd[EXT_CSD_CARD_TYPE] EXT_CSD_CARD_TYPE_MASK) { + case EXT_CSD_CARD_TYPE_SDR_200 | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_200 | EXT_CSD_CARD_TYPE_DDR_1_8V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_200 | EXT_CSD_CARD_TYPE_DDR_1_2V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_200 | EXT_CSD_CARD_TYPE_DDR_52 | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_200; + break; + case EXT_CSD_CARD_TYPE_SDR_1_2V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_2V | EXT_CSD_CARD_TYPE_DDR_1_8V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_2V | EXT_CSD_CARD_TYPE_DDR_1_2V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_2V | EXT_CSD_CARD_TYPE_DDR_52 | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_1_2V; + break; + case EXT_CSD_CARD_TYPE_SDR_1_8V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_8V | EXT_CSD_CARD_TYPE_DDR_1_8V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_8V | EXT_CSD_CARD_TYPE_DDR_1_2V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_8V | EXT_CSD_CARD_TYPE_DDR_52 | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_1_8V; + break; case EXT_CSD_CARD_TYPE_DDR_52 | EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: card-ext_csd.hs_max_dtr = 5200; @@ -624,6 +657,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, { struct mmc_card *card; int err, ddr = 0; + int hs_sdr = 0; u32
[PATCH V7] mmc: core: Add Power Off Notify Feature eMMC 4.5
This patch adds the support for power off notify feature available in eMMC 4.5 devices. If the the host has support for this feature, then the mmc core will notify it to the device by setting the POWER_OFF_NOTIFICATION byte in the extended csd register with a value 1(POWER_ON). For suspend mode short timeout is used, whereas for the normal poweroff long timeout is used. This patch is dependent on Seungwon Jeon's patch for CMD6 timeout. Signed-off-by: Girish K S girish.shivananja...@linaro.org --- Changes in V2: Adds poweroff notification handling in suspend/normal Changes in V4: Updated with review comments of Jeon Changes in V5: This patch version fixes the problem with power off notify function, when called for the first time and card is not yet initialised. Changes in V6: Fixes checkpatch errors. The patches are generated after rebasing to chris's mmc-next branch. Changes in V7: Rebased to chris-mmc/mmc-next branch. merged to patches to single patch. drivers/mmc/core/core.c | 37 + drivers/mmc/core/mmc.c | 22 ++ drivers/mmc/host/sdhci.c | 10 ++ include/linux/mmc/card.h | 21 + include/linux/mmc/host.h |5 + include/linux/mmc/mmc.h |6 ++ 6 files changed, 101 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 9698d8a..5fb2120 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1198,11 +1198,46 @@ static void mmc_power_up(struct mmc_host *host) void mmc_power_off(struct mmc_host *host) { + struct mmc_card *card; + unsigned int notify_type; + unsigned int timeout; + int err; + + BUG_ON(!host); + mmc_host_clk_hold(host); + card = host-card; host-ios.clock = 0; host-ios.vdd = 0; + if (card != NULL mmc_card_mmc(card) + (mmc_card_powernotify_on(card))) { + + if (host-power_notify_type == MMC_HOST_PW_NOTIFY_SHORT) { + notify_type = EXT_CSD_POWER_OFF_SHORT; + timeout = card-ext_csd.generic_cmd6_time; + mmc_card_set_powernotify_short(card); + } else { + notify_type = EXT_CSD_POWER_OFF_LONG; + timeout = card-ext_csd.power_off_longtime; + mmc_card_set_powernotify_long(card); + } + + err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, +EXT_CSD_POWER_OFF_NOTIFICATION, +notify_type, timeout); + + if (err err != -EBADMSG) + pr_err(Device failed to respond + within %d poweroff time. + forcefully powering down + the device\n, timeout); + + /* Set the card state to no notification after the poweroff */ + mmc_card_set_powernotify_off(card); + } + /* * Reset ocr mask to be the highest possible voltage supported for * this mmc host. This value will be used at next power up. @@ -2194,6 +2230,7 @@ int mmc_pm_notify(struct notifier_block *notify_block, spin_lock_irqsave(host-lock, flags); host-rescan_disable = 1; + host-power_notify_type = MMC_HOST_PW_NOTIFY_SHORT; spin_unlock_irqrestore(host-lock, flags); cancel_delayed_work_sync(host-detect); @@ -2217,6 +2254,7 @@ int mmc_pm_notify(struct notifier_block *notify_block, spin_lock_irqsave(host-lock, flags); host-rescan_disable = 0; + host-power_notify_type = MMC_HOST_PW_NOTIFY_LONG; spin_unlock_irqrestore(host-lock, flags); mmc_detect_change(host, 0); diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index f28aa4f..25ba7f5 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -447,6 +447,11 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) else card-erased_byte = 0x0; + if (card-ext_csd.rev = 6) { + card-ext_csd.power_off_longtime = 10 * + ext_csd[EXT_CSD_POWER_OFF_LONG_TIME]; + } + out: return err; } @@ -829,6 +834,23 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, } /* +* If the host supports the power_off_notify capability then +* set the notification byte in the ext_csd register of device +*/ + if (host-caps2 MMC_CAP_POWEROFF_NOTIFY + (mmc_card_powernotify_off(card))) { + err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, +EXT_CSD_POWER_OFF_NOTIFICATION
Re: [PATCH v2] mmc: core: Add default timeout value for CMD6.
Hi Jeon, I tried to apply your patch to the latest Chris-mmc/mmc-next branch. but the patch fails. can you please check err message. error: patch failed: include/linux/mmc/card.h:52 error: include/linux/mmc/card.h: patch does not apply error: patch failed: include/linux/mmc/mmc.h:293 error: include/linux/mmc/mmc.h: patch does not apply Patch failed at 0001 mmc: core: Add default timeout value for CMD6. regards Girish K S EXT_CSD[248] includes the default maximum timeout for CMD6. This field is added at eMMC4.5 Spec. And it can be used for default timeout except for some operations which don't define the timeout(i.e. background operation, sanitize, flush cache) in eMMC4.5 Spec. Signed-off-by: Seungwon Jeon tgih@samsung.com --- v2 : apply default maximum timeout of CMD6 which specific timeout is not defined. drivers/mmc/core/mmc.c | 14 ++ include/linux/mmc/card.h | 1 + include/linux/mmc/mmc.h | 1 + 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 5700b1c..b148bb1 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -410,6 +410,10 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) else card-erased_byte = 0x0; + if (card-ext_csd.rev = 6) + card-ext_csd.generic_cmd6_time = 10 * + ext_csd[EXT_CSD_GENERIC_CMD6_TIME]; + out: return err; } @@ -668,7 +672,8 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, */ if (card-ext_csd.enhanced_area_en) { err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, - EXT_CSD_ERASE_GROUP_DEF, 1, 0); + EXT_CSD_ERASE_GROUP_DEF, 1, + card-ext_csd.generic_cmd6_time); if (err err != -EBADMSG) goto free_card; @@ -711,7 +716,8 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, if ((card-ext_csd.hs_max_dtr != 0) (host-caps MMC_CAP_MMC_HIGHSPEED)) { err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, - EXT_CSD_HS_TIMING, 1, 0); + EXT_CSD_HS_TIMING, 1, + card-ext_csd.generic_cmd6_time); if (err err != -EBADMSG) goto free_card; @@ -783,7 +789,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BUS_WIDTH, ext_csd_bits[idx][0], - 0); + card-ext_csd.generic_cmd6_time); if (!err) { mmc_set_bus_width(card-host, bus_width); @@ -806,7 +812,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BUS_WIDTH, ext_csd_bits[idx][1], - 0); + card-ext_csd.generic_cmd6_time); } if (err) { printk(KERN_WARNING %s: switch to bus width %d ddr %d diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index b460fc2..e992fe3 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h @@ -52,6 +52,7 @@ struct mmc_ext_csd { u8 part_config; unsigned int part_time; /* Units: ms */ unsigned int sa_timeout; /* Units: 100ns */ + unsigned int generic_cmd6_time; /* Units: ms */ unsigned int hs_max_dtr; unsigned int sectors; unsigned int card_type; diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h index 5a794cb..e869f00 100644 --- a/include/linux/mmc/mmc.h +++ b/include/linux/mmc/mmc.h @@ -293,6 +293,7 @@ struct _mmc_csd { #define EXT_CSD_SEC_ERASE_MULT 230 /* RO */ #define EXT_CSD_SEC_FEATURE_SUPPORT 231 /* RO */ #define EXT_CSD_TRIM_MULT 232 /* RO */ +#define EXT_CSD_GENERIC_CMD6_TIME 248 /* RO */ /* * EXT_CSD field definitions -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-mmc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH V2] mmc: core: HS200 mode support for eMMC 4.5
This patch adds the support of the HS200 bus speed for eMMC 4.5 devices. The eMMC 4.5 devices have support for 200MHz bus speed. The mmc core and host modules have been touched to add support for this module. It is necessary to know the card type in the sdhci.c file to add support for eMMC tuning function. So card.h file is included to import the card data structure. Signed-off-by: Girish K S girish.shivananja...@linaro.org --- Changes in v1: Case statements in switch that produce same result have been combined to reduce repeated assignments. patch recreated after rebase to chris balls mmc-next branch. Changes in v2: Rebased to latest chris-mmc/mmc-next branch. Resolved indentation problems identified in review. This patch has to be applied before the patch released for modifying the printk messages. drivers/mmc/core/bus.c|3 +- drivers/mmc/core/mmc.c| 91 + drivers/mmc/host/sdhci.c | 36 +++--- include/linux/mmc/card.h |3 + include/linux/mmc/host.h |8 include/linux/mmc/mmc.h |8 +++- include/linux/mmc/sdhci.h |1 + 7 files changed, 134 insertions(+), 16 deletions(-) diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index 393d817..a0aa7ab 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c @@ -301,10 +301,11 @@ int mmc_add_card(struct mmc_card *card) mmc_card_ddr_mode(card) ? DDR : , type); } else { - printk(KERN_INFO %s: new %s%s%s card at address %04x\n, + printk(KERN_INFO %s: new %s%s%s%s card at address %04x\n, mmc_hostname(card-host), mmc_sd_card_uhs(card) ? ultra high speed : (mmc_card_highspeed(card) ? high speed : ), + (mmc_card_hs200(card) ? HS200 : ), mmc_card_ddr_mode(card) ? DDR : , type, card-rca); } diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index c632b1f..382bf39 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -283,6 +283,39 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) } card-ext_csd.raw_card_type = ext_csd[EXT_CSD_CARD_TYPE]; switch (ext_csd[EXT_CSD_CARD_TYPE] EXT_CSD_CARD_TYPE_MASK) { + case EXT_CSD_CARD_TYPE_SDR_200 | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_200 | EXT_CSD_CARD_TYPE_DDR_1_8V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_200 | EXT_CSD_CARD_TYPE_DDR_1_2V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_200 | EXT_CSD_CARD_TYPE_DDR_52 | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_200; + break; + case EXT_CSD_CARD_TYPE_SDR_1_2V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_2V | EXT_CSD_CARD_TYPE_DDR_1_8V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_2V | EXT_CSD_CARD_TYPE_DDR_1_2V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_2V | EXT_CSD_CARD_TYPE_DDR_52 | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_1_2V; + break; + case EXT_CSD_CARD_TYPE_SDR_1_8V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_8V | EXT_CSD_CARD_TYPE_DDR_1_8V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_8V | EXT_CSD_CARD_TYPE_DDR_1_2V | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + case EXT_CSD_CARD_TYPE_SDR_1_8V | EXT_CSD_CARD_TYPE_DDR_52 | +EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: + card-ext_csd.hs_max_dtr = 2; + card-ext_csd.card_type = EXT_CSD_CARD_TYPE_SDR_1_8V; + break; case EXT_CSD_CARD_TYPE_DDR_52 | EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: card-ext_csd.hs_max_dtr = 5200; @@ -624,6 +657,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, { struct mmc_card *card; int err, ddr = 0; + int hs_sdr = 0; u32 cid[4]; unsigned int max_dtr; u32 rocr; @@ -797,10 +831,15 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, /* * Activate high speed (if supported) */ - if ((card-ext_csd.hs_max_dtr != 0) - (host-caps MMC_CAP_MMC_HIGHSPEED)) { - err = mmc_switch(card
[PATCH V4] mmc: core: eMMC 4.5 Power Class Selection Feature
This patch adds the power class selection feature available for mmc versions 4.0 and above. During the enumeration stage before switching to the lower data bus, check if the power class is supported for the current bus width. If the power class is available then switch to the power class and use the higher data bus. If power class is not supported then switch to the lower data bus in a worst case. Signed-off-by: Girish K S girish.shivananja...@linaro.org --- Changes in v1: This version modifies the power_class_select function prototype. During device enumeration, when the host tries to read the extended csd register after switching to higher bus width, the read fails at higher bus width. So the power_class_select function is modified to reuse the extended csd register values read with 1 bit bus width. Changes in v2: This patch version removes some checkpatch error Changes in v3: updated with review comments made by chris ball. patch generated by rebasing to chris balls mmc-next branch. Changes in v4: updated with review comments. drivers/mmc/core/mmc.c | 96 +++ include/linux/mmc/mmc.h | 14 +++ 2 files changed, 110 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 7adc30d..f226ae4 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -532,6 +532,86 @@ static struct device_type mmc_type = { }; /* + * Select the PowerClass for the current bus width + * If power class is defined for 4/8 bit bus in the + * extended CSD register, select it by executing the + * mmc_switch command. + */ +static int mmc_select_powerclass(struct mmc_card *card, + unsigned int bus_width, u8 *ext_csd) +{ + int err = 0; + unsigned int pwrclass_val; + unsigned int index = 0; + struct mmc_host *host; + + BUG_ON(!card); + + host = card-host; + BUG_ON(!host); + + if (ext_csd == NULL) + return 0; + + /* Power class selection is supported for versions = 4.0 */ + if (card-csd.mmca_vsn CSD_SPEC_VER_4) + return 0; + + /* Power class values are defined only for 4/8 bit bus */ + if (bus_width == EXT_CSD_BUS_WIDTH_1) + return 0; + + switch (1 host-ios.vdd) { + case MMC_VDD_165_195: + if (host-ios.clock = 2600) + index = EXT_CSD_PWR_CL_26_195; + else if (host-ios.clock = 5200) + index = (bus_width = EXT_CSD_BUS_WIDTH_8) ? + EXT_CSD_PWR_CL_52_195 : + EXT_CSD_PWR_CL_DDR_52_195; + else if (host-ios.clock = 2) + index = EXT_CSD_PWR_CL_200_195; + break; + case MMC_VDD_32_33: + case MMC_VDD_33_34: + case MMC_VDD_34_35: + case MMC_VDD_35_36: + if (host-ios.clock = 2600) + index = EXT_CSD_PWR_CL_26_360; + else if (host-ios.clock = 5200) + index = (bus_width = EXT_CSD_BUS_WIDTH_8) ? + EXT_CSD_PWR_CL_52_360 : + EXT_CSD_PWR_CL_DDR_52_360; + else if (host-ios.clock = 2) + index = EXT_CSD_PWR_CL_200_360; + break; + default: + pr_warning(%s: Voltage range not supported + for power class.\n, mmc_hostname(host)); + break; + } + + pwrclass_val = ext_csd[index]; + + if (bus_width (EXT_CSD_BUS_WIDTH_8 | EXT_CSD_DDR_BUS_WIDTH_8)) + pwrclass_val = (pwrclass_val EXT_CSD_PWR_CL_8BIT_MASK) + EXT_CSD_PWR_CL_8BIT_SHIFT; + else + pwrclass_val = (pwrclass_val EXT_CSD_PWR_CL_4BIT_MASK) + EXT_CSD_PWR_CL_4BIT_SHIFT; + + /* If the power class is different from the default value */ + if (pwrclass_val 0) { + err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, +EXT_CSD_POWER_CLASS, +pwrclass_val, +0); + } + + return err; +} + +/* * Handle the detection and initialisation of a card. * * In the case of a resume, oldcard will contain the card @@ -787,6 +867,14 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, bus_width = bus_widths[idx]; if (bus_width == MMC_BUS_WIDTH_1) ddr = 0; /* no DDR for 1-bit width */ + err = mmc_select_powerclass(card, ext_csd_bits[idx][0], + ext_csd); + if (err) + pr_err(%s: power class
Re: [PATCH V4] mmc: core: eMMC 4.5 Power Class Selection Feature
Hi Chris, On 23 September 2011 20:09, Chris Ball c...@laptop.org wrote: Hi Girish, On Fri, Sep 23 2011, Girish K S wrote: + default: + pr_warning(%s: Voltage range not supported + for power class.\n, mmc_hostname(host)); + break; + } I suggested replacing your BUG(); here with a return, but you just have a break here. Is having the function continue in this case intentional? sorry for that. will update with a return -EBADMSG + + pwrclass_val = ext_csd[index]; + + if (bus_width (EXT_CSD_BUS_WIDTH_8 | EXT_CSD_DDR_BUS_WIDTH_8)) + pwrclass_val = (pwrclass_val EXT_CSD_PWR_CL_8BIT_MASK) + EXT_CSD_PWR_CL_8BIT_SHIFT; + else + pwrclass_val = (pwrclass_val EXT_CSD_PWR_CL_4BIT_MASK) + EXT_CSD_PWR_CL_4BIT_SHIFT; + + /* If the power class is different from the default value */ + if (pwrclass_val 0) { + err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, + EXT_CSD_POWER_CLASS, + pwrclass_val, + 0); + } + + return err; +} Thanks, - Chris. -- Chris Ball c...@laptop.org http://printf.net/ One Laptop Per Child -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH V5] mmc: core: eMMC 4.5 Power Class Selection Feature
This patch adds the power class selection feature available for mmc versions 4.0 and above. During the enumeration stage before switching to the lower data bus, check if the power class is supported for the current bus width. If the power class is available then switch to the power class and use the higher data bus. If power class is not supported then switch to the lower data bus in a worst case. Signed-off-by: Girish K S girish.shivananja...@linaro.org --- Changes in v1: This version modifies the power_class_select function prototype. During device enumeration, when the host tries to read the extended csd register after switching to higher bus width, the read fails at higher bus width. So the power_class_select function is modified to reuse the extended csd register values read with 1 bit bus width. Changes in v2: This patch version removes some checkpatch error Changes in v3: updated with review comments made by chris ball. patch generated by rebasing to chris balls mmc-next branch. Changes in v4: updated with review comments. Changes in v5: Replace break statement with appropriate return error value in drivers/mmc/core/mmc.c for unsupported voltage range. drivers/mmc/core/mmc.c | 96 +++ include/linux/mmc/mmc.h | 14 +++ 2 files changed, 110 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 7adc30d..c2334d6 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -532,6 +532,86 @@ static struct device_type mmc_type = { }; /* + * Select the PowerClass for the current bus width + * If power class is defined for 4/8 bit bus in the + * extended CSD register, select it by executing the + * mmc_switch command. + */ +static int mmc_select_powerclass(struct mmc_card *card, + unsigned int bus_width, u8 *ext_csd) +{ + int err = 0; + unsigned int pwrclass_val; + unsigned int index = 0; + struct mmc_host *host; + + BUG_ON(!card); + + host = card-host; + BUG_ON(!host); + + if (ext_csd == NULL) + return 0; + + /* Power class selection is supported for versions = 4.0 */ + if (card-csd.mmca_vsn CSD_SPEC_VER_4) + return 0; + + /* Power class values are defined only for 4/8 bit bus */ + if (bus_width == EXT_CSD_BUS_WIDTH_1) + return 0; + + switch (1 host-ios.vdd) { + case MMC_VDD_165_195: + if (host-ios.clock = 2600) + index = EXT_CSD_PWR_CL_26_195; + else if (host-ios.clock = 5200) + index = (bus_width = EXT_CSD_BUS_WIDTH_8) ? + EXT_CSD_PWR_CL_52_195 : + EXT_CSD_PWR_CL_DDR_52_195; + else if (host-ios.clock = 2) + index = EXT_CSD_PWR_CL_200_195; + break; + case MMC_VDD_32_33: + case MMC_VDD_33_34: + case MMC_VDD_34_35: + case MMC_VDD_35_36: + if (host-ios.clock = 2600) + index = EXT_CSD_PWR_CL_26_360; + else if (host-ios.clock = 5200) + index = (bus_width = EXT_CSD_BUS_WIDTH_8) ? + EXT_CSD_PWR_CL_52_360 : + EXT_CSD_PWR_CL_DDR_52_360; + else if (host-ios.clock = 2) + index = EXT_CSD_PWR_CL_200_360; + break; + default: + pr_warning(%s: Voltage range not supported + for power class.\n, mmc_hostname(host)); + return -EINVAL; + } + + pwrclass_val = ext_csd[index]; + + if (bus_width (EXT_CSD_BUS_WIDTH_8 | EXT_CSD_DDR_BUS_WIDTH_8)) + pwrclass_val = (pwrclass_val EXT_CSD_PWR_CL_8BIT_MASK) + EXT_CSD_PWR_CL_8BIT_SHIFT; + else + pwrclass_val = (pwrclass_val EXT_CSD_PWR_CL_4BIT_MASK) + EXT_CSD_PWR_CL_4BIT_SHIFT; + + /* If the power class is different from the default value */ + if (pwrclass_val 0) { + err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, +EXT_CSD_POWER_CLASS, +pwrclass_val, +0); + } + + return err; +} + +/* * Handle the detection and initialisation of a card. * * In the case of a resume, oldcard will contain the card @@ -787,6 +867,14 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, bus_width = bus_widths[idx]; if (bus_width == MMC_BUS_WIDTH_1) ddr = 0; /* no DDR for 1-bit width */ + err = mmc_select_powerclass(card, ext_csd_bits[idx
[no subject]
This patch adds the support for power off notify feature available in eMMC 4.5 devices. If the the host has support for this feature, then the mmc core will notify it to the device by setting the POWER_OFF_NOTIFICATION byte in the extended csd register with a value 1(POWER_ON). This patch should be applied after Seungwon Jeon's patch for cmd6 timeout. Signed-off-by: Girish K S girish.shivananja...@linaro.org --- v2: adds poweroff notification handling in suspend/normal v4: updated with review comments of Jeon v5: This patch version fixes the problem with power off notify function, when called for the first time and card is not yet initialised. v6: fixes checkpatch errors. The patches are generated after rebasing to chris's mmc-next branch. drivers/mmc/core/mmc.c | 17 + include/linux/mmc/card.h |1 + include/linux/mmc/host.h |1 + include/linux/mmc/mmc.h |6 ++ 4 files changed, 25 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 7adc30d..a547f49 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -412,6 +412,10 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) else card-erased_byte = 0x0; + if (card-ext_csd.rev = 6) { + card-ext_csd.power_off_longtime = 10 * + ext_csd[EXT_CSD_POWER_OFF_LONG_TIME]; + } out: return err; } @@ -713,6 +717,19 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, } /* +* If the host supports the power_off_notify capability then +* set the notification byte in the ext_csd register of device +*/ + if (host-caps MMC_CAP_POWER_OFF_NOTIFY) { + err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, + EXT_CSD_POWER_OFF_NOTIFICATION, + EXT_CSD_POWER_ON, + card-ext_csd.generic_cmd6_time); + if (err err != -EBADMSG) + goto free_card; + } + + /* * Activate high speed (if supported) */ if ((card-ext_csd.hs_max_dtr != 0) diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index 5294ddf..0f9dbd6 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h @@ -53,6 +53,7 @@ struct mmc_ext_csd { u8 rst_n_function; unsigned intpart_time; /* Units: ms */ unsigned intsa_timeout; /* Units: 100ns */ + unsigned intpower_off_longtime; /* Units: ms */ unsigned inths_max_dtr; unsigned intsectors; unsigned intcard_type; diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index b2aefea..ed49e88 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -235,6 +235,7 @@ struct mmc_host { #define MMC_CAP_MAX_CURRENT_800(1 29) /* Host max current limit is 800mA */ #define MMC_CAP_CMD23 (1 30) /* CMD23 supported. */ #define MMC_CAP_HW_RESET (1 31) /* Hardware reset */ +#define MMC_CAP_POWER_OFF_NOTIFY(1 31)/*Notify poweroff supported */ mmc_pm_flag_t pm_caps;/* supported pm features */ diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h index ed8fca8..95912da 100644 --- a/include/linux/mmc/mmc.h +++ b/include/linux/mmc/mmc.h @@ -270,6 +270,7 @@ struct _mmc_csd { * EXT_CSD fields */ +#define EXT_CSD_POWER_OFF_NOTIFICATION 34 /* R/W */ #define EXT_CSD_PARTITION_ATTRIBUTE156 /* R/W */ #define EXT_CSD_PARTITION_SUPPORT 160 /* RO */ #define EXT_CSD_RST_N_FUNCTION 162 /* R/W */ @@ -294,6 +295,7 @@ struct _mmc_csd { #define EXT_CSD_SEC_ERASE_MULT 230 /* RO */ #define EXT_CSD_SEC_FEATURE_SUPPORT231 /* RO */ #define EXT_CSD_TRIM_MULT 232 /* RO */ +#define EXT_CSD_POWER_OFF_LONG_TIME247 /*RO*/ /* * EXT_CSD field definitions @@ -331,6 +333,10 @@ struct _mmc_csd { #define EXT_CSD_RST_N_EN_MASK 0x3 #define EXT_CSD_RST_N_ENABLED 1 /* RST_n is enabled on card */ +#define EXT_CSD_NO_POWER_NOTIFICATION 0 +#define EXT_CSD_POWER_ON 1 +#define EXT_CSD_POWER_OFF_SHORT2 +#define EXT_CSD_POWER_OFF_LONG 3 /* * MMC_SWITCH access modes -- 1.7.1 -- To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html