Re: [RFC PATCH v3 02/16] ARM: davinci: move private EDMA API to arm/common
On 10/18/2012 6:56 PM, Matt Porter wrote: Move mach-davinci/dma.c to common/edma.c so it can be used by OMAP (specifically AM33xx) as well. This just moves the private EDMA API but does not support OMAP. Signed-off-by: Matt Porter mpor...@ti.com --- diff --git a/arch/arm/mach-davinci/devices.c b/arch/arm/mach-davinci/devices.c index 4c48a36..f45d591 100644 --- a/arch/arm/mach-davinci/devices.c +++ b/arch/arm/mach-davinci/devices.c @@ -19,9 +19,10 @@ #include mach/irqs.h #include mach/cputype.h #include mach/mux.h -#include mach/edma.h #include linux/platform_data/mmc-davinci.h #include mach/time.h +#include linux/platform_data/edma.h Can you please introduce a patch to clean this mixture of linux/ and mach/ includes? + #include davinci.h #include clock.h @@ -141,10 +142,10 @@ static struct resource mmcsd0_resources[] = { }, /* DMA channels: RX, then TX */ { - .start = EDMA_CTLR_CHAN(0, DAVINCI_DMA_MMCRXEVT), + .start = EDMA_CTLR_CHAN(0, 26), Instead of just replacing the event #defines with plain numbers, can you introduce a mach-davinci local edma.h which can then be included in the davinci platform files which refer to edma channel numbers? diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig index 7cd56ed..153fab8 100644 --- a/arch/arm/plat-omap/Kconfig +++ b/arch/arm/plat-omap/Kconfig @@ -28,6 +28,7 @@ config ARCH_OMAP2PLUS select OMAP_DM_TIMER select PROC_DEVICETREE if PROC_FS select SPARSE_IRQ + select TI_PRIV_EDMA This hunk does not seem to belong to subject of this patch. select USE_OF help Systems based on OMAP2, OMAP3, OMAP4 or OMAP5 diff --git a/include/linux/platform_data/edma.h b/include/linux/platform_data/edma.h new file mode 100644 index 000..7396f0b3 --- /dev/null +++ b/include/linux/platform_data/edma.h @@ -0,0 +1,198 @@ +/* + * TI DAVINCI dma definitions + * + * Copyright (C) 2006-2009 Texas Instruments. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN + * NO EVENT SHALL THE AUTHOR BELIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 675 Mass Ave, Cambridge, MA 02139, USA. This part can be dropped, I suppose ;-) Thanks, Sekhar -- 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
Re: [RFC PATCH v3 05/16] ARM: edma: add AM33XX crossbar event support
On 10/18/2012 6:56 PM, Matt Porter wrote: Adds support for the per-EDMA channel event mux. This is required for any peripherals using DMA crossbar mapped events. Signed-off-by: Matt Porter mpor...@ti.com --- arch/arm/common/edma.c | 63 +++- include/linux/platform_data/edma.h |1 + 2 files changed, 63 insertions(+), 1 deletion(-) diff --git a/arch/arm/common/edma.c b/arch/arm/common/edma.c index 6d2a590..b761b7a 100644 --- a/arch/arm/common/edma.c +++ b/arch/arm/common/edma.c @@ -1425,6 +1425,53 @@ static int edma_of_read_u32_to_s16_array(const struct device_node *np, return 0; } +static int edma_xbar_event_map(struct device *dev, +struct device_node *node, +struct edma_soc_info *pdata, int len) +{ + int ret = 0; + int i; + struct resource res; + void *xbar; + s16 (*xbar_chans)[2]; + u32 shift, offset, mux; + + xbar_chans = devm_kzalloc(dev, + len/sizeof(s16) + 2*sizeof(s16), + GFP_KERNEL); + if (!xbar_chans) + return -ENOMEM; + + ret = of_address_to_resource(node, 1, res); + if (IS_ERR_VALUE(ret)) + return -EIO; + + xbar = devm_ioremap(dev, res.start, resource_size(res)); + if (!xbar) + return -EIO; -ENOMEM is more appropiate for ioremap failures. + + ret = edma_of_read_u32_to_s16_array(node, + ti,edma-xbar-event-map, + (s16 *)xbar_chans, + len/sizeof(u32)); + if (IS_ERR_VALUE(ret)) + return -EIO; + + for (i = 0; xbar_chans[i][0] != -1; i++) { + shift = (xbar_chans[i][1] % 4) * 8; + offset = xbar_chans[i][1] 2; + offset = 2; + mux = __raw_readl((void *)((u32)xbar + offset)); Dont use __raw* variants of io accessors. There will be ordering issues on ARMv7. + mux = (~(0xff shift)); + mux |= (xbar_chans[i][0] shift); Unnecessary parens above. + __raw_writel(mux, (void *)((u32)xbar + offset)); + } + + pdata-xbar_chans = xbar_chans; + + return 0; +} + static int edma_of_parse_dt(struct device *dev, struct device_node *node, struct edma_soc_info *pdata) @@ -1453,7 +1500,6 @@ static int edma_of_parse_dt(struct device *dev, pdata-n_slot = value; pdata-n_cc = 1; - /* This is unused */ The comment should have not been part of 4/16? Thanks, Sekhar -- 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
Re: [RFC PATCH v3 08/16] ARM: dts: add AM33XX EDMA support
On 10/18/2012 6:56 PM, Matt Porter wrote: Adds AM33XX EDMA support to the am33xx.dtsi as documented in Documentation/devicetree/bindings/dma/ti-edma.txt Signed-off-by: Matt Porter mpor...@ti.com --- arch/arm/boot/dts/am33xx.dtsi | 31 +++ 1 file changed, 31 insertions(+) diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi index bb31bff..ab9c78f 100644 --- a/arch/arm/boot/dts/am33xx.dtsi +++ b/arch/arm/boot/dts/am33xx.dtsi @@ -62,6 +62,37 @@ reg = 0x4820 0x1000; }; + edma: edma@4900 { + compatible = ti,edma3; + ti,hwmods = tpcc, tptc0, tptc1, tptc2; + reg = 0x4900 0x1, + 0x44e10f90 0x10; + interrupt-parent = intc; + interrupts = 12 13 14; + #dma-cells = 1; + dma-channels = 64; + ti,edma-regions = 4; + ti,edma-slots = 256; + ti,edma-reserved-channels = 0 2 + 14 2 + 26 6 + 48 4 + 56 8; + ti,edma-reserved-slots = 0 2 + 14 2 + 26 6 + 48 4 + 56 8 + 64 127; No need to reserve any channels or slots on AM335x, I think. This is used on DaVinci devices to share channels with DSP. I am not sure the cortex-M3 or PRU on the AM335x need to (or even can) have EDMA access. Thanks, Sekhar -- 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
Re: [RFC PATCH v3 16/16] ARM: dts: add AM33XX SPI support
On 10/18/2012 6:56 PM, Matt Porter wrote: Adds AM33XX SPI support for am335x-bone and am335x-evm. Signed-off-by: Matt Porter mpor...@ti.com --- arch/arm/boot/dts/am335x-bone.dts | 17 +++ arch/arm/boot/dts/am335x-evm.dts |9 arch/arm/boot/dts/am33xx.dtsi | 43 + 3 files changed, 69 insertions(+) diff --git a/arch/arm/boot/dts/am335x-bone.dts b/arch/arm/boot/dts/am335x-bone.dts index 5510979..23edfd8 100644 --- a/arch/arm/boot/dts/am335x-bone.dts +++ b/arch/arm/boot/dts/am335x-bone.dts @@ -18,6 +18,17 @@ reg = 0x8000 0x1000; /* 256 MB */ }; + am3358_pinmux: pinmux@44e10800 { + spi1_pins: pinmux_spi1_pins { + pinctrl-single,pins = + 0x190 0x13 /* mcasp0_aclkx.spi1_sclk, OUTPUT_PULLUP | MODE3 */ + 0x194 0x33 /* mcasp0_fsx.spi1_d0, INPUT_PULLUP | MODE3 */ + 0x198 0x13 /* mcasp0_axr0.spi1_d1, OUTPUT_PULLUP | MODE3 */ + 0x19c 0x13 /* mcasp0_ahclkr.spi1_cs0, OUTPUT_PULLUP | MODE3 */ + ; Is there a single pinmux setting that provides SPI functionality on the bone headers? Or this is specific to a cape you tested with? Thanks, Sekhar -- 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
Re: [PATCH v1] mmc: fix async request mechanism for sequential read scenarios
Hello, On 10/26/2012 02:07 PM, Venkatraman S wrote: Actually there could a lot of reasons why block layer or CFQ would not have inserted the request into the queue. i.e. you can see a lot of exit paths where blk_peek_request returns NULL, even though there could be any request pending in one of the CFQ requests queues. Essentially you need to check what makes blk_fetch_request (cfq_dispatch_requests() ) return NULL when there is an element in queue, if at all. This is not important why block layer causes to blk_fetch_request() (or blk_peek_request()) to return NULL to the MMC layer, but what is really important - MMC layer should always be able to fetch the new arrived request ASAP, after block layer notification (mmc_request() ) and this is what my fix goes to implement. And the fix is not changing block layer behavior. Thanks -- Konstantin Dorfman, QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation -- 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
RE: [PATCH] powerpc/esdhc: enable the card insert/remove interrupt
Hello Huang, On Fri, Oct 26, 2012 at 02:42:36AM +, Huang Changming-R66093 wrote: For the current polling mode, driver will send CMD13 to poll the card status periodically , which will cause too many interrupts. Once I sent patches to detect the card when using polling mode last year: read the state register, instead of send CMD13. But, these patches were not accepted. Now I attach them for you. Was there any specific reason why the patches didn't get accepted? I very briefly looked at them, and they seem to be OK (there are a few cosmetic details I'd comment on, tho -- but please send them in a normal way (i.e. not as attachments). Thanks, Anton. I don't know why. I will resend these patches based on latest kernel. N�r��yb�X��ǧv�^�){.n�+{��g��^n�r���z���h����G���h�(�階�ݢj���m��z�ޖ���f���h���~�m�
[PATCH v2] mmc: dw-mmc: relocate the position called dw_mci_setup_bus()
After power-on, must be ensured at least 74~80 clocks before sending any first command. To ensure, it's good that dw_mci_setup_bus() is located at dw_mci_set_ios instead of __dw_mci_start_request() Signed-off-by: Jaehoon Chung jh80.ch...@samsung.com Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com Acked-by: Seungwon Jeon tgih@samsung.com -- Changelog V2: - Modified the commit-message. --- drivers/mmc/host/dw_mmc.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 4b2bedc..de79093 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -682,9 +682,6 @@ static void __dw_mci_start_request(struct dw_mci *host, if (host-pdata-select_slot) host-pdata-select_slot(slot-id); - /* Slot specific timing and width adjustment */ - dw_mci_setup_bus(slot); - host-cur_slot = slot; host-mrq = mrq; @@ -810,6 +807,9 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) if (slot-host-drv_data-set_ios) slot-host-drv_data-set_ios(slot-host, ios); + /* Slot specific timing and width adjustment */ + dw_mci_setup_bus(slot); + switch (ios-power_mode) { case MMC_POWER_UP: set_bit(DW_MMC_CARD_NEED_INIT, slot-flags); -- 1.7.4.1 -- 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
[PATCH v7 0/3] Add modules to support realtek PCIE card reader
From: Wei WANG wei_w...@realsil.com.cn Support for Realtek PCI-Express driver-based card readers including rts5209, rts5229 and rtl8411. v2: 1. Using platform device to replace realtek slot bus v3: 1. Fix a bug that DMA out of SW-IOMMU space in Lenovo Thinkpad x121e 2. Tested by Borislav Petkov b...@alien8.de v4: 1. Fulfill power management callbacks v5: 1. Support Memstick card v6: 1. Fix some coding style v7: 1. Acked-by: Alex Dubov oa...@yahoo.com 2. Support RTL8411 3. Use mfd_cell in rtsx_pcr.c 4. Use default workqueue in rtsx_pcr.c 5. Use delayed_work to handle idle event, instead of timer Wei WANG (3): drivers/mfd: Add realtek pcie card reader driver drivers/mmc: Add realtek pcie sdmmc host driver drivers/memstick: Add realtek pcie memstick host driver drivers/memstick/host/Kconfig | 10 + drivers/memstick/host/Makefile |1 + drivers/memstick/host/rtsx_pci_ms.c | 641 + drivers/mfd/Kconfig |9 + drivers/mfd/Makefile|3 + drivers/mfd/rtl8411.c | 251 +++ drivers/mfd/rts5209.c | 223 ++ drivers/mfd/rts5229.c | 205 ++ drivers/mfd/rtsx_pcr.c | 1251 drivers/mfd/rtsx_pcr.h | 32 + drivers/mmc/host/Kconfig|7 + drivers/mmc/host/Makefile |2 + drivers/mmc/host/rtsx_pci_sdmmc.c | 1348 +++ include/linux/mfd/rtsx_common.h | 48 ++ include/linux/mfd/rtsx_pci.h| 794 + 15 files changed, 4825 insertions(+) create mode 100644 drivers/memstick/host/rtsx_pci_ms.c create mode 100644 drivers/mfd/rtl8411.c create mode 100644 drivers/mfd/rts5209.c create mode 100644 drivers/mfd/rts5229.c create mode 100644 drivers/mfd/rtsx_pcr.c create mode 100644 drivers/mfd/rtsx_pcr.h create mode 100644 drivers/mmc/host/rtsx_pci_sdmmc.c create mode 100644 include/linux/mfd/rtsx_common.h create mode 100644 include/linux/mfd/rtsx_pci.h -- 1.7.9.5 -- 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
[PATCH v7 3/3] drivers/memstick: Add realtek pcie memstick host driver
From: Wei WANG wei_w...@realsil.com.cn Realtek PCI-E Memstick card host driver is used to access Memstick card, with the help of Realtek PCI-E card reader MFD driver. Signed-off-by: Wei WANG wei_w...@realsil.com.cn Acked-by: Alex Dubov oa...@yahoo.com --- drivers/memstick/host/Kconfig | 10 + drivers/memstick/host/Makefile |1 + drivers/memstick/host/rtsx_pci_ms.c | 641 +++ 3 files changed, 652 insertions(+) create mode 100644 drivers/memstick/host/rtsx_pci_ms.c diff --git a/drivers/memstick/host/Kconfig b/drivers/memstick/host/Kconfig index cc0997a..4f7a17f 100644 --- a/drivers/memstick/host/Kconfig +++ b/drivers/memstick/host/Kconfig @@ -42,3 +42,13 @@ config MEMSTICK_R592 To compile this driver as a module, choose M here: the module will be called r592. + +config MEMSTICK_REALTEK_PCI + tristate Realtek PCI-E Memstick Card Interface Driver + depends on MFD_RTSX_PCI + help + Say Y here to include driver code to support Memstick card interface + of Realtek PCI-E card reader + + To compile this driver as a module, choose M here: the module will + be called rtsx_pci_ms. diff --git a/drivers/memstick/host/Makefile b/drivers/memstick/host/Makefile index 31ba8d3..af3459d 100644 --- a/drivers/memstick/host/Makefile +++ b/drivers/memstick/host/Makefile @@ -5,3 +5,4 @@ obj-$(CONFIG_MEMSTICK_TIFM_MS) += tifm_ms.o obj-$(CONFIG_MEMSTICK_JMICRON_38X) += jmb38x_ms.o obj-$(CONFIG_MEMSTICK_R592)+= r592.o +obj-$(CONFIG_MEMSTICK_REALTEK_PCI) += rtsx_pci_ms.o diff --git a/drivers/memstick/host/rtsx_pci_ms.c b/drivers/memstick/host/rtsx_pci_ms.c new file mode 100644 index 000..f5ddb82 --- /dev/null +++ b/drivers/memstick/host/rtsx_pci_ms.c @@ -0,0 +1,641 @@ +/* Realtek PCI-Express Memstick Card Interface driver + * + * Copyright(c) 2009 Realtek Semiconductor Corp. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, see http://www.gnu.org/licenses/. + * + * Author: + * Wei WANG wei_w...@realsil.com.cn + * No. 450, Shenhu Road, Suzhou Industry Park, Suzhou, China + */ + +#include linux/module.h +#include linux/highmem.h +#include linux/delay.h +#include linux/platform_device.h +#include linux/memstick.h +#include linux/mfd/rtsx_pci.h +#include asm/unaligned.h + +struct realtek_pci_ms { + struct platform_device *pdev; + struct rtsx_pcr *pcr; + struct memstick_host*msh; + struct memstick_request *req; + + struct mutexhost_mutex; + struct work_struct handle_req; + + u8 ssc_depth; + unsigned intclock; + unsigned char ifmode; + booleject; +}; + +static inline struct device *ms_dev(struct realtek_pci_ms *host) +{ + return (host-pdev-dev); +} + +static inline void ms_clear_error(struct realtek_pci_ms *host) +{ + rtsx_pci_write_register(host-pcr, CARD_STOP, + MS_STOP | MS_CLR_ERR, MS_STOP | MS_CLR_ERR); +} + +#ifdef DEBUG + +static void ms_print_debug_regs(struct realtek_pci_ms *host) +{ + struct rtsx_pcr *pcr = host-pcr; + u16 i; + u8 *ptr; + + /* Print MS host internal registers */ + rtsx_pci_init_cmd(pcr); + for (i = 0xFD40; i = 0xFD44; i++) + rtsx_pci_add_cmd(pcr, READ_REG_CMD, i, 0, 0); + for (i = 0xFD52; i = 0xFD69; i++) + rtsx_pci_add_cmd(pcr, READ_REG_CMD, i, 0, 0); + rtsx_pci_send_cmd(pcr, 100); + + ptr = rtsx_pci_get_cmd_data(pcr); + for (i = 0xFD40; i = 0xFD44; i++) + dev_dbg(ms_dev(host), 0x%04X: 0x%02x\n, i, *(ptr++)); + for (i = 0xFD52; i = 0xFD69; i++) + dev_dbg(ms_dev(host), 0x%04X: 0x%02x\n, i, *(ptr++)); +} + +#else + +#define ms_print_debug_regs(host) + +#endif + +static int ms_power_on(struct realtek_pci_ms *host) +{ + struct rtsx_pcr *pcr = host-pcr; + int err; + + rtsx_pci_init_cmd(pcr); + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CARD_SELECT, 0x07, MS_MOD_SEL); + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CARD_SHARE_MODE, + CARD_SHARE_MASK, CARD_SHARE_48_MS); + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CARD_CLK_EN, + MS_CLK_EN, MS_CLK_EN); + err = rtsx_pci_send_cmd(pcr, 100); + if (err 0) +
[PATCH v7 2/3] drivers/mmc: Add realtek pcie sdmmc host driver
From: Wei WANG wei_w...@realsil.com.cn Realtek PCI-E SD/MMC card host driver is used to access SD/MMC card, with the help of Realtek PCI-E card reader MFD driver. Signed-off-by: Wei WANG wei_w...@realsil.com.cn Reviewed-by: Arnd Bergmann a...@arndb.de Tested-by: Borislav Petkov b...@alien8.de --- drivers/mmc/host/Kconfig |7 + drivers/mmc/host/Makefile |2 + drivers/mmc/host/rtsx_pci_sdmmc.c | 1348 + 3 files changed, 1357 insertions(+) create mode 100644 drivers/mmc/host/rtsx_pci_sdmmc.c diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig index 9bf10e7..dfa6d56 100644 --- a/drivers/mmc/host/Kconfig +++ b/drivers/mmc/host/Kconfig @@ -621,3 +621,10 @@ config MMC_USHC Note: These controllers only support SDIO cards and do not support MMC or SD memory cards. + +config MMC_REALTEK_PCI + tristate Realtek PCI-E SD/MMC Card Interface Driver + depends on MFD_RTSX_PCI + help + Say Y here to include driver code to support SD/MMC card interface + of Realtek PCI-E card reader diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile index 17ad0a7..8aa592d 100644 --- a/drivers/mmc/host/Makefile +++ b/drivers/mmc/host/Makefile @@ -46,6 +46,8 @@ obj-$(CONFIG_MMC_JZ4740) += jz4740_mmc.o obj-$(CONFIG_MMC_VUB300) += vub300.o obj-$(CONFIG_MMC_USHC) += ushc.o +obj-$(CONFIG_MMC_REALTEK_PCI) += rtsx_pci_sdmmc.o + obj-$(CONFIG_MMC_SDHCI_PLTFM) += sdhci-pltfm.o obj-$(CONFIG_MMC_SDHCI_CNS3XXX)+= sdhci-cns3xxx.o obj-$(CONFIG_MMC_SDHCI_ESDHC_IMX) += sdhci-esdhc-imx.o diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c b/drivers/mmc/host/rtsx_pci_sdmmc.c new file mode 100644 index 000..12eff6f --- /dev/null +++ b/drivers/mmc/host/rtsx_pci_sdmmc.c @@ -0,0 +1,1348 @@ +/* Realtek PCI-Express SD/MMC Card Interface driver + * + * Copyright(c) 2009 Realtek Semiconductor Corp. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, see http://www.gnu.org/licenses/. + * + * Author: + * Wei WANG wei_w...@realsil.com.cn + * No. 450, Shenhu Road, Suzhou Industry Park, Suzhou, China + */ + +#include linux/module.h +#include linux/highmem.h +#include linux/delay.h +#include linux/platform_device.h +#include linux/mmc/host.h +#include linux/mmc/mmc.h +#include linux/mmc/sd.h +#include linux/mmc/card.h +#include linux/mfd/rtsx_pci.h +#include asm/unaligned.h + +/* SD Tuning Data Structure + * Record continuous timing phase path + */ +struct timing_phase_path { + int start; + int end; + int mid; + int len; +}; + +struct realtek_pci_sdmmc { + struct platform_device *pdev; + struct rtsx_pcr *pcr; + struct mmc_host *mmc; + struct mmc_request *mrq; + + struct mutexhost_mutex; + + u8 ssc_depth; + unsigned intclock; + boolvpclk; + booldouble_clk; + booleject; + boolinitial_mode; + boolddr_mode; +}; + +static inline struct device *sdmmc_dev(struct realtek_pci_sdmmc *host) +{ + return (host-pdev-dev); +} + +static inline void sd_clear_error(struct realtek_pci_sdmmc *host) +{ + rtsx_pci_write_register(host-pcr, CARD_STOP, + SD_STOP | SD_CLR_ERR, SD_STOP | SD_CLR_ERR); +} + +#ifdef DEBUG +static void sd_print_debug_regs(struct realtek_pci_sdmmc *host) +{ + struct rtsx_pcr *pcr = host-pcr; + u16 i; + u8 *ptr; + + /* Print SD host internal registers */ + rtsx_pci_init_cmd(pcr); + for (i = 0xFDA0; i = 0xFDAE; i++) + rtsx_pci_add_cmd(pcr, READ_REG_CMD, i, 0, 0); + for (i = 0xFD52; i = 0xFD69; i++) + rtsx_pci_add_cmd(pcr, READ_REG_CMD, i, 0, 0); + rtsx_pci_send_cmd(pcr, 100); + + ptr = rtsx_pci_get_cmd_data(pcr); + for (i = 0xFDA0; i = 0xFDAE; i++) + dev_dbg(sdmmc_dev(host), 0x%04X: 0x%02x\n, i, *(ptr++)); + for (i = 0xFD52; i = 0xFD69; i++) + dev_dbg(sdmmc_dev(host), 0x%04X: 0x%02x\n, i, *(ptr++)); +} +#else +#define sd_print_debug_regs(host) +#endif /* DEBUG */ + +static int sd_read_data(struct realtek_pci_sdmmc *host, u8 *cmd, u16 byte_cnt, + u8 *buf, int buf_len, int