Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/drzeus/mmc

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/drzeus/mmc:
mmc: extend ricoh_mmc to support Ricoh RL5c476
at91_mci: use generic GPIO calls
sdhci: add num index for multi controllers case
MAINTAINERS: remove non-existant URLs
mmc: remove sdhci and mmc_spi experimental markers
mmc: Handle suspend/resume in Ricoh MMC disabler

+231 -70
-3
MAINTAINERS
··· 2682 2682 P: Pavel Pisa 2683 2683 M: ppisa@pikron.com 2684 2684 L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only) 2685 - W: http://mmc.drzeus.cx/wiki/Controllers/Freescale/SDHC 2686 2685 S: Maintained 2687 2686 2688 2687 MOUSE AND MISC DEVICES [GENERAL] ··· 3715 3716 P: Pierre Ossman 3716 3717 M: drzeus-sdhci@drzeus.cx 3717 3718 L: sdhci-devel@list.drzeus.cx 3718 - W: http://mmc.drzeus.cx/wiki/Linux/Drivers/sdhci 3719 3719 S: Maintained 3720 3720 3721 3721 SKGE, SKY2 10/100/1000 GIGABIT ETHERNET DRIVERS ··· 4284 4286 P: Pierre Ossman 4285 4287 M: drzeus-wbsd@drzeus.cx 4286 4288 L: linux-kernel@vger.kernel.org 4287 - W: http://projects.drzeus.cx/wbsd 4288 4289 S: Maintained 4289 4290 4290 4291 WATCHDOG DEVICE DRIVERS
+4 -4
drivers/mmc/host/Kconfig
··· 25 25 If unsure, say N. 26 26 27 27 config MMC_SDHCI 28 - tristate "Secure Digital Host Controller Interface support (EXPERIMENTAL)" 29 - depends on PCI && EXPERIMENTAL 28 + tristate "Secure Digital Host Controller Interface support" 29 + depends on PCI 30 30 help 31 31 This select the generic Secure Digital Host Controller Interface. 32 32 It is used by manufacturers such as Texas Instruments(R), Ricoh(R) ··· 118 118 module will be called tifm_sd. 119 119 120 120 config MMC_SPI 121 - tristate "MMC/SD over SPI (EXPERIMENTAL)" 122 - depends on MMC && SPI_MASTER && !HIGHMEM && EXPERIMENTAL 121 + tristate "MMC/SD over SPI" 122 + depends on MMC && SPI_MASTER && !HIGHMEM 123 123 select CRC7 124 124 select CRC_ITU_T 125 125 help
+80 -34
drivers/mmc/host/at91_mci.c
··· 70 70 71 71 #include <asm/io.h> 72 72 #include <asm/irq.h> 73 + #include <asm/gpio.h> 74 + 73 75 #include <asm/mach/mmc.h> 74 76 #include <asm/arch/board.h> 75 77 #include <asm/arch/cpu.h> 76 - #include <asm/arch/gpio.h> 77 78 #include <asm/arch/at91_mci.h> 78 79 79 80 #define DRIVER_NAME "at91_mci" ··· 660 659 if (host->board->vcc_pin) { 661 660 switch (ios->power_mode) { 662 661 case MMC_POWER_OFF: 663 - at91_set_gpio_value(host->board->vcc_pin, 0); 662 + gpio_set_value(host->board->vcc_pin, 0); 664 663 break; 665 664 case MMC_POWER_UP: 666 665 case MMC_POWER_ON: 667 - at91_set_gpio_value(host->board->vcc_pin, 1); 666 + gpio_set_value(host->board->vcc_pin, 1); 668 667 break; 669 668 } 670 669 } ··· 769 768 static irqreturn_t at91_mmc_det_irq(int irq, void *_host) 770 769 { 771 770 struct at91mci_host *host = _host; 772 - int present = !at91_get_gpio_value(irq); 771 + int present = !gpio_get_value(irq_to_gpio(irq)); 773 772 774 773 /* 775 774 * we expect this irq on both insert and remove, ··· 794 793 struct at91mci_host *host = mmc_priv(mmc); 795 794 796 795 if (host->board->wp_pin) { 797 - read_only = at91_get_gpio_value(host->board->wp_pin); 796 + read_only = gpio_get_value(host->board->wp_pin); 798 797 printk(KERN_WARNING "%s: card is %s\n", mmc_hostname(mmc), 799 798 (read_only ? "read-only" : "read-write") ); 800 799 } ··· 821 820 struct resource *res; 822 821 int ret; 823 822 824 - pr_debug("Probe MCI devices\n"); 825 - 826 823 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 827 824 if (!res) 828 825 return -ENXIO; ··· 830 831 831 832 mmc = mmc_alloc_host(sizeof(struct at91mci_host), &pdev->dev); 832 833 if (!mmc) { 833 - pr_debug("Failed to allocate mmc host\n"); 834 - release_mem_region(res->start, res->end - res->start + 1); 835 - return -ENOMEM; 834 + ret = -ENOMEM; 835 + dev_dbg(&pdev->dev, "couldn't allocate mmc host\n"); 836 + goto fail6; 836 837 } 837 838 838 839 mmc->ops = &at91_mci_ops; ··· 852 853 if (cpu_is_at91sam9260() || cpu_is_at91sam9263()) 853 854 mmc->caps |= MMC_CAP_4_BIT_DATA; 854 855 else 855 - printk("AT91 MMC: 4 wire bus mode not supported" 856 + dev_warn(&pdev->dev, "4 wire bus mode not supported" 856 857 " - using 1 wire\n"); 858 + } 859 + 860 + /* 861 + * Reserve GPIOs ... board init code makes sure these pins are set 862 + * up as GPIOs with the right direction (input, except for vcc) 863 + */ 864 + if (host->board->det_pin) { 865 + ret = gpio_request(host->board->det_pin, "mmc_detect"); 866 + if (ret < 0) { 867 + dev_dbg(&pdev->dev, "couldn't claim card detect pin\n"); 868 + goto fail5; 869 + } 870 + } 871 + if (host->board->wp_pin) { 872 + ret = gpio_request(host->board->wp_pin, "mmc_wp"); 873 + if (ret < 0) { 874 + dev_dbg(&pdev->dev, "couldn't claim wp sense pin\n"); 875 + goto fail4; 876 + } 877 + } 878 + if (host->board->vcc_pin) { 879 + ret = gpio_request(host->board->vcc_pin, "mmc_vcc"); 880 + if (ret < 0) { 881 + dev_dbg(&pdev->dev, "couldn't claim vcc switch pin\n"); 882 + goto fail3; 883 + } 857 884 } 858 885 859 886 /* ··· 887 862 */ 888 863 host->mci_clk = clk_get(&pdev->dev, "mci_clk"); 889 864 if (IS_ERR(host->mci_clk)) { 890 - printk(KERN_ERR "AT91 MMC: no clock defined.\n"); 891 - mmc_free_host(mmc); 892 - release_mem_region(res->start, res->end - res->start + 1); 893 - return -ENODEV; 865 + ret = -ENODEV; 866 + dev_dbg(&pdev->dev, "no mci_clk?\n"); 867 + goto fail2; 894 868 } 895 869 896 870 /* ··· 897 873 */ 898 874 host->baseaddr = ioremap(res->start, res->end - res->start + 1); 899 875 if (!host->baseaddr) { 900 - clk_put(host->mci_clk); 901 - mmc_free_host(mmc); 902 - release_mem_region(res->start, res->end - res->start + 1); 903 - return -ENOMEM; 876 + ret = -ENOMEM; 877 + goto fail1; 904 878 } 905 879 906 880 /* ··· 912 890 * Allocate the MCI interrupt 913 891 */ 914 892 host->irq = platform_get_irq(pdev, 0); 915 - ret = request_irq(host->irq, at91_mci_irq, IRQF_SHARED, DRIVER_NAME, host); 893 + ret = request_irq(host->irq, at91_mci_irq, IRQF_SHARED, 894 + mmc_hostname(mmc), host); 916 895 if (ret) { 917 - printk(KERN_ERR "AT91 MMC: Failed to request MCI interrupt\n"); 918 - clk_disable(host->mci_clk); 919 - clk_put(host->mci_clk); 920 - mmc_free_host(mmc); 921 - iounmap(host->baseaddr); 922 - release_mem_region(res->start, res->end - res->start + 1); 923 - return ret; 896 + dev_dbg(&pdev->dev, "request MCI interrupt failed\n"); 897 + goto fail0; 924 898 } 925 899 926 900 platform_set_drvdata(pdev, mmc); ··· 925 907 * Add host to MMC layer 926 908 */ 927 909 if (host->board->det_pin) { 928 - host->present = !at91_get_gpio_value(host->board->det_pin); 929 - device_init_wakeup(&pdev->dev, 1); 910 + host->present = !gpio_get_value(host->board->det_pin); 930 911 } 931 912 else 932 913 host->present = -1; ··· 936 919 * monitor card insertion/removal if we can 937 920 */ 938 921 if (host->board->det_pin) { 939 - ret = request_irq(host->board->det_pin, at91_mmc_det_irq, 940 - 0, DRIVER_NAME, host); 922 + ret = request_irq(gpio_to_irq(host->board->det_pin), 923 + at91_mmc_det_irq, 0, mmc_hostname(mmc), host); 941 924 if (ret) 942 - printk(KERN_ERR "AT91 MMC: Couldn't allocate MMC detect irq\n"); 925 + dev_warn(&pdev->dev, "request MMC detect irq failed\n"); 926 + else 927 + device_init_wakeup(&pdev->dev, 1); 943 928 } 944 929 945 930 pr_debug("Added MCI driver\n"); 946 931 947 932 return 0; 933 + 934 + fail0: 935 + clk_disable(host->mci_clk); 936 + iounmap(host->baseaddr); 937 + fail1: 938 + clk_put(host->mci_clk); 939 + fail2: 940 + if (host->board->vcc_pin) 941 + gpio_free(host->board->vcc_pin); 942 + fail3: 943 + if (host->board->wp_pin) 944 + gpio_free(host->board->wp_pin); 945 + fail4: 946 + if (host->board->det_pin) 947 + gpio_free(host->board->det_pin); 948 + fail5: 949 + mmc_free_host(mmc); 950 + fail6: 951 + release_mem_region(res->start, res->end - res->start + 1); 952 + dev_err(&pdev->dev, "probe failed, err %d\n", ret); 953 + return ret; 948 954 } 949 955 950 956 /* ··· 985 945 host = mmc_priv(mmc); 986 946 987 947 if (host->board->det_pin) { 948 + if (device_can_wakeup(&pdev->dev)) 949 + free_irq(gpio_to_irq(host->board->det_pin), host); 988 950 device_init_wakeup(&pdev->dev, 0); 989 - free_irq(host->board->det_pin, host); 990 - cancel_delayed_work(&host->mmc->detect); 951 + gpio_free(host->board->det_pin); 991 952 } 992 953 993 954 at91_mci_disable(host); ··· 997 956 998 957 clk_disable(host->mci_clk); /* Disable the peripheral clock */ 999 958 clk_put(host->mci_clk); 959 + 960 + if (host->board->vcc_pin) 961 + gpio_free(host->board->vcc_pin); 962 + if (host->board->wp_pin) 963 + gpio_free(host->board->wp_pin); 1000 964 1001 965 iounmap(host->baseaddr); 1002 966 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+134 -28
drivers/mmc/host/ricoh_mmc.c
··· 41 41 42 42 MODULE_DEVICE_TABLE(pci, pci_ids); 43 43 44 + static int ricoh_mmc_disable(struct pci_dev *fw_dev) 45 + { 46 + u8 write_enable; 47 + u8 write_target; 48 + u8 disable; 49 + 50 + if (fw_dev->device == PCI_DEVICE_ID_RICOH_RL5C476) { 51 + /* via RL5C476 */ 52 + 53 + pci_read_config_byte(fw_dev, 0xB7, &disable); 54 + if (disable & 0x02) { 55 + printk(KERN_INFO DRIVER_NAME 56 + ": Controller already disabled. " \ 57 + "Nothing to do.\n"); 58 + return -ENODEV; 59 + } 60 + 61 + pci_read_config_byte(fw_dev, 0x8E, &write_enable); 62 + pci_write_config_byte(fw_dev, 0x8E, 0xAA); 63 + pci_read_config_byte(fw_dev, 0x8D, &write_target); 64 + pci_write_config_byte(fw_dev, 0x8D, 0xB7); 65 + pci_write_config_byte(fw_dev, 0xB7, disable | 0x02); 66 + pci_write_config_byte(fw_dev, 0x8E, write_enable); 67 + pci_write_config_byte(fw_dev, 0x8D, write_target); 68 + } else { 69 + /* via R5C832 */ 70 + 71 + pci_read_config_byte(fw_dev, 0xCB, &disable); 72 + if (disable & 0x02) { 73 + printk(KERN_INFO DRIVER_NAME 74 + ": Controller already disabled. " \ 75 + "Nothing to do.\n"); 76 + return -ENODEV; 77 + } 78 + 79 + pci_read_config_byte(fw_dev, 0xCA, &write_enable); 80 + pci_write_config_byte(fw_dev, 0xCA, 0x57); 81 + pci_write_config_byte(fw_dev, 0xCB, disable | 0x02); 82 + pci_write_config_byte(fw_dev, 0xCA, write_enable); 83 + } 84 + 85 + printk(KERN_INFO DRIVER_NAME 86 + ": Controller is now disabled.\n"); 87 + 88 + return 0; 89 + } 90 + 91 + static int ricoh_mmc_enable(struct pci_dev *fw_dev) 92 + { 93 + u8 write_enable; 94 + u8 write_target; 95 + u8 disable; 96 + 97 + if (fw_dev->device == PCI_DEVICE_ID_RICOH_RL5C476) { 98 + /* via RL5C476 */ 99 + 100 + pci_read_config_byte(fw_dev, 0x8E, &write_enable); 101 + pci_write_config_byte(fw_dev, 0x8E, 0xAA); 102 + pci_read_config_byte(fw_dev, 0x8D, &write_target); 103 + pci_write_config_byte(fw_dev, 0x8D, 0xB7); 104 + pci_read_config_byte(fw_dev, 0xB7, &disable); 105 + pci_write_config_byte(fw_dev, 0xB7, disable & ~0x02); 106 + pci_write_config_byte(fw_dev, 0x8E, write_enable); 107 + pci_write_config_byte(fw_dev, 0x8D, write_target); 108 + } else { 109 + /* via R5C832 */ 110 + 111 + pci_read_config_byte(fw_dev, 0xCA, &write_enable); 112 + pci_read_config_byte(fw_dev, 0xCB, &disable); 113 + pci_write_config_byte(fw_dev, 0xCA, 0x57); 114 + pci_write_config_byte(fw_dev, 0xCB, disable & ~0x02); 115 + pci_write_config_byte(fw_dev, 0xCA, write_enable); 116 + } 117 + 118 + printk(KERN_INFO DRIVER_NAME 119 + ": Controller is now re-enabled.\n"); 120 + 121 + return 0; 122 + } 123 + 44 124 static int __devinit ricoh_mmc_probe(struct pci_dev *pdev, 45 125 const struct pci_device_id *ent) 46 126 { 47 127 u8 rev; 128 + u8 ctrlfound = 0; 48 129 49 130 struct pci_dev *fw_dev = NULL; 50 131 ··· 139 58 pci_name(pdev), (int)pdev->vendor, (int)pdev->device, 140 59 (int)rev); 141 60 142 - while ((fw_dev = pci_get_device(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, fw_dev))) { 61 + while ((fw_dev = 62 + pci_get_device(PCI_VENDOR_ID_RICOH, 63 + PCI_DEVICE_ID_RICOH_RL5C476, fw_dev))) { 143 64 if (PCI_SLOT(pdev->devfn) == PCI_SLOT(fw_dev->devfn) && 144 65 pdev->bus == fw_dev->bus) { 145 - u8 write_enable; 146 - u8 disable; 147 - 148 - pci_read_config_byte(fw_dev, 0xCB, &disable); 149 - if (disable & 0x02) { 150 - printk(KERN_INFO DRIVER_NAME 151 - ": Controller already disabled. Nothing to do.\n"); 66 + if (ricoh_mmc_disable(fw_dev) != 0) 152 67 return -ENODEV; 153 - } 154 - 155 - pci_read_config_byte(fw_dev, 0xCA, &write_enable); 156 - pci_write_config_byte(fw_dev, 0xCA, 0x57); 157 - pci_write_config_byte(fw_dev, 0xCB, disable | 0x02); 158 - pci_write_config_byte(fw_dev, 0xCA, write_enable); 159 68 160 69 pci_set_drvdata(pdev, fw_dev); 161 70 162 - printk(KERN_INFO DRIVER_NAME 163 - ": Controller is now disabled.\n"); 164 - 71 + ++ctrlfound; 165 72 break; 166 73 } 167 74 } 168 75 169 - if (pci_get_drvdata(pdev) == NULL) { 76 + fw_dev = NULL; 77 + 78 + while (!ctrlfound && 79 + (fw_dev = pci_get_device(PCI_VENDOR_ID_RICOH, 80 + PCI_DEVICE_ID_RICOH_R5C832, fw_dev))) { 81 + if (PCI_SLOT(pdev->devfn) == PCI_SLOT(fw_dev->devfn) && 82 + pdev->bus == fw_dev->bus) { 83 + if (ricoh_mmc_disable(fw_dev) != 0) 84 + return -ENODEV; 85 + 86 + pci_set_drvdata(pdev, fw_dev); 87 + 88 + ++ctrlfound; 89 + } 90 + } 91 + 92 + if (!ctrlfound) { 170 93 printk(KERN_WARNING DRIVER_NAME 171 94 ": Main firewire function not found. Cannot disable controller.\n"); 172 95 return -ENODEV; ··· 181 96 182 97 static void __devexit ricoh_mmc_remove(struct pci_dev *pdev) 183 98 { 184 - u8 write_enable; 185 - u8 disable; 186 99 struct pci_dev *fw_dev = NULL; 187 100 188 101 fw_dev = pci_get_drvdata(pdev); 189 102 BUG_ON(fw_dev == NULL); 190 103 191 - pci_read_config_byte(fw_dev, 0xCA, &write_enable); 192 - pci_read_config_byte(fw_dev, 0xCB, &disable); 193 - pci_write_config_byte(fw_dev, 0xCA, 0x57); 194 - pci_write_config_byte(fw_dev, 0xCB, disable & ~0x02); 195 - pci_write_config_byte(fw_dev, 0xCA, write_enable); 196 - 197 - printk(KERN_INFO DRIVER_NAME 198 - ": Controller is now re-enabled.\n"); 104 + ricoh_mmc_enable(fw_dev); 199 105 200 106 pci_set_drvdata(pdev, NULL); 107 + } 108 + 109 + static int ricoh_mmc_suspend(struct pci_dev *pdev, pm_message_t state) 110 + { 111 + struct pci_dev *fw_dev = NULL; 112 + 113 + fw_dev = pci_get_drvdata(pdev); 114 + BUG_ON(fw_dev == NULL); 115 + 116 + printk(KERN_INFO DRIVER_NAME ": Suspending.\n"); 117 + 118 + ricoh_mmc_enable(fw_dev); 119 + 120 + return 0; 121 + } 122 + 123 + static int ricoh_mmc_resume(struct pci_dev *pdev) 124 + { 125 + struct pci_dev *fw_dev = NULL; 126 + 127 + fw_dev = pci_get_drvdata(pdev); 128 + BUG_ON(fw_dev == NULL); 129 + 130 + printk(KERN_INFO DRIVER_NAME ": Resuming.\n"); 131 + 132 + ricoh_mmc_disable(fw_dev); 133 + 134 + return 0; 201 135 } 202 136 203 137 static struct pci_driver ricoh_mmc_driver = { ··· 224 120 .id_table = pci_ids, 225 121 .probe = ricoh_mmc_probe, 226 122 .remove = __devexit_p(ricoh_mmc_remove), 123 + .suspend = ricoh_mmc_suspend, 124 + .resume = ricoh_mmc_resume, 227 125 }; 228 126 229 127 /*****************************************************************************\
+12 -1
drivers/mmc/host/sdhci.c
··· 30 30 31 31 static unsigned int debug_quirks = 0; 32 32 33 + /* For multi controllers in one platform case */ 34 + static u16 chip_index = 0; 35 + static spinlock_t index_lock; 36 + 33 37 /* 34 38 * Different quirks to handle when the hardware deviates from a strict 35 39 * interpretation of the SDHCI specification. ··· 1324 1320 1325 1321 DBG("slot %d at 0x%08lx, irq %d\n", slot, host->addr, host->irq); 1326 1322 1327 - snprintf(host->slot_descr, 20, "sdhci:slot%d", slot); 1323 + snprintf(host->slot_descr, 20, "sdhc%d:slot%d", chip->index, slot); 1328 1324 1329 1325 ret = pci_request_region(pdev, host->bar, host->slot_descr); 1330 1326 if (ret) ··· 1589 1585 chip->num_slots = slots; 1590 1586 pci_set_drvdata(pdev, chip); 1591 1587 1588 + /* Add for multi controller case */ 1589 + spin_lock(&index_lock); 1590 + chip->index = chip_index++; 1591 + spin_unlock(&index_lock); 1592 + 1592 1593 for (i = 0;i < slots;i++) { 1593 1594 ret = sdhci_probe_slot(pdev, i); 1594 1595 if (ret) { ··· 1653 1644 printk(KERN_INFO DRIVER_NAME 1654 1645 ": Secure Digital Host Controller Interface driver\n"); 1655 1646 printk(KERN_INFO DRIVER_NAME ": Copyright(c) Pierre Ossman\n"); 1647 + 1648 + spin_lock_init(&index_lock); 1656 1649 1657 1650 return pci_register_driver(&sdhci_driver); 1658 1651 }
+1
drivers/mmc/host/sdhci.h
··· 208 208 209 209 unsigned long quirks; 210 210 211 + int index; /* Index for chip0, chip1 ...*/ 211 212 int num_slots; /* Slots on controller */ 212 213 struct sdhci_host *hosts[0]; /* Pointers to hosts */ 213 214 };