Hanumath Prasad | 008f8a2 | 2010-08-19 12:06:32 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) ST-Ericsson SA 2010 |
| 3 | * |
| 4 | * Author: Hanumath Prasad <hanumath.prasad@stericsson.com> |
| 5 | * License terms: GNU General Public License (GPL) version 2 |
| 6 | */ |
| 7 | |
| 8 | #include <linux/kernel.h> |
| 9 | #include <linux/gpio.h> |
| 10 | #include <linux/amba/bus.h> |
| 11 | #include <linux/amba/mmci.h> |
| 12 | #include <linux/mmc/host.h> |
| 13 | #include <linux/platform_device.h> |
Linus Walleij | 865fab6 | 2012-10-18 14:20:16 +0200 | [diff] [blame] | 14 | #include <linux/platform_data/dma-ste-dma40.h> |
Hanumath Prasad | 008f8a2 | 2010-08-19 12:06:32 +0100 | [diff] [blame] | 15 | |
Linus Walleij | 4b4f757 | 2011-02-15 15:01:35 +0100 | [diff] [blame] | 16 | #include <asm/mach-types.h> |
Arnd Bergmann | e657bcf | 2013-03-21 22:51:12 +0100 | [diff] [blame] | 17 | #include "devices.h" |
Hanumath Prasad | 008f8a2 | 2010-08-19 12:06:32 +0100 | [diff] [blame] | 18 | |
Linus Walleij | 174e779 | 2013-03-19 15:41:55 +0100 | [diff] [blame] | 19 | #include "db8500-regs.h" |
Rabin Vincent | fbf1ead | 2010-09-29 19:46:32 +0530 | [diff] [blame] | 20 | #include "devices-db8500.h" |
Hanumath Prasad | 008f8a2 | 2010-08-19 12:06:32 +0100 | [diff] [blame] | 21 | #include "board-mop500.h" |
Linus Walleij | 5d7b846 | 2010-10-14 13:57:59 +0200 | [diff] [blame] | 22 | #include "ste-dma40-db8500.h" |
Hanumath Prasad | 008f8a2 | 2010-08-19 12:06:32 +0100 | [diff] [blame] | 23 | |
Hanumath Prasad | 008f8a2 | 2010-08-19 12:06:32 +0100 | [diff] [blame] | 24 | /* |
Linus Walleij | c15def1 | 2011-12-15 13:38:40 +0100 | [diff] [blame] | 25 | * v2 has a new version of this block that need to be forced, the number found |
| 26 | * in hardware is incorrect |
| 27 | */ |
| 28 | #define U8500_SDI_V2_PERIPHID 0x10480180 |
| 29 | |
| 30 | /* |
Rabin Vincent | b8410a1 | 2010-08-09 19:18:17 +0530 | [diff] [blame] | 31 | * SDI 0 (MicroSD slot) |
| 32 | */ |
| 33 | |
Linus Walleij | 5d7b846 | 2010-10-14 13:57:59 +0200 | [diff] [blame] | 34 | #ifdef CONFIG_STE_DMA40 |
| 35 | struct stedma40_chan_cfg mop500_sdi0_dma_cfg_rx = { |
| 36 | .mode = STEDMA40_MODE_LOGICAL, |
Lee Jones | 98b68ab | 2013-05-15 10:51:53 +0100 | [diff] [blame] | 37 | .dir = DMA_DEV_TO_MEM, |
Lee Jones | 26955c07d | 2013-05-03 15:31:56 +0100 | [diff] [blame] | 38 | .dev_type = DB8500_DMA_DEV29_SD_MM0, |
Linus Walleij | 5d7b846 | 2010-10-14 13:57:59 +0200 | [diff] [blame] | 39 | }; |
| 40 | |
| 41 | static struct stedma40_chan_cfg mop500_sdi0_dma_cfg_tx = { |
| 42 | .mode = STEDMA40_MODE_LOGICAL, |
Lee Jones | 98b68ab | 2013-05-15 10:51:53 +0100 | [diff] [blame] | 43 | .dir = DMA_MEM_TO_DEV, |
Lee Jones | 26955c07d | 2013-05-03 15:31:56 +0100 | [diff] [blame] | 44 | .dev_type = DB8500_DMA_DEV29_SD_MM0, |
Linus Walleij | 5d7b846 | 2010-10-14 13:57:59 +0200 | [diff] [blame] | 45 | }; |
| 46 | #endif |
| 47 | |
Lee Jones | 5e1ac7d | 2012-05-29 14:40:04 +0800 | [diff] [blame] | 48 | struct mmci_platform_data mop500_sdi0_data = { |
Ulf Hansson | b6ff56a | 2013-05-23 15:13:45 +0200 | [diff] [blame] | 49 | .f_max = 100000000, |
Linus Walleij | 02a7343 | 2011-03-30 16:00:39 +0200 | [diff] [blame] | 50 | .capabilities = MMC_CAP_4_BIT_DATA | |
| 51 | MMC_CAP_SD_HIGHSPEED | |
Ulf Hansson | fd1cc1b | 2013-05-23 15:13:48 +0200 | [diff] [blame] | 52 | MMC_CAP_MMC_HIGHSPEED | |
Ulf Hansson | 714c0b0 | 2013-05-23 15:13:50 +0200 | [diff] [blame] | 53 | MMC_CAP_ERASE | |
| 54 | MMC_CAP_UHS_SDR12 | |
| 55 | MMC_CAP_UHS_SDR25, |
Rabin Vincent | b8410a1 | 2010-08-09 19:18:17 +0530 | [diff] [blame] | 56 | .gpio_wp = -1, |
Ulf Hansson | bc52181 | 2011-12-13 16:57:55 +0100 | [diff] [blame] | 57 | .sigdir = MCI_ST_FBCLKEN | |
| 58 | MCI_ST_CMDDIREN | |
| 59 | MCI_ST_DATA0DIREN | |
| 60 | MCI_ST_DATA2DIREN, |
Linus Walleij | 5d7b846 | 2010-10-14 13:57:59 +0200 | [diff] [blame] | 61 | #ifdef CONFIG_STE_DMA40 |
| 62 | .dma_filter = stedma40_filter, |
| 63 | .dma_rx_param = &mop500_sdi0_dma_cfg_rx, |
| 64 | .dma_tx_param = &mop500_sdi0_dma_cfg_tx, |
| 65 | #endif |
Rabin Vincent | b8410a1 | 2010-08-09 19:18:17 +0530 | [diff] [blame] | 66 | }; |
| 67 | |
Rabin Vincent | b8410a1 | 2010-08-09 19:18:17 +0530 | [diff] [blame] | 68 | /* |
Stefan Nilsson XK | 76d6717 | 2011-10-26 10:50:42 +0200 | [diff] [blame] | 69 | * SDI1 (SDIO WLAN) |
| 70 | */ |
| 71 | #ifdef CONFIG_STE_DMA40 |
| 72 | static struct stedma40_chan_cfg sdi1_dma_cfg_rx = { |
| 73 | .mode = STEDMA40_MODE_LOGICAL, |
Lee Jones | 98b68ab | 2013-05-15 10:51:53 +0100 | [diff] [blame] | 74 | .dir = DMA_DEV_TO_MEM, |
Lee Jones | 26955c07d | 2013-05-03 15:31:56 +0100 | [diff] [blame] | 75 | .dev_type = DB8500_DMA_DEV32_SD_MM1, |
Stefan Nilsson XK | 76d6717 | 2011-10-26 10:50:42 +0200 | [diff] [blame] | 76 | }; |
| 77 | |
| 78 | static struct stedma40_chan_cfg sdi1_dma_cfg_tx = { |
| 79 | .mode = STEDMA40_MODE_LOGICAL, |
Lee Jones | 98b68ab | 2013-05-15 10:51:53 +0100 | [diff] [blame] | 80 | .dir = DMA_MEM_TO_DEV, |
Lee Jones | 26955c07d | 2013-05-03 15:31:56 +0100 | [diff] [blame] | 81 | .dev_type = DB8500_DMA_DEV32_SD_MM1, |
Stefan Nilsson XK | 76d6717 | 2011-10-26 10:50:42 +0200 | [diff] [blame] | 82 | }; |
| 83 | #endif |
| 84 | |
Lee Jones | 9cf24b1 | 2012-08-30 16:11:08 +0100 | [diff] [blame] | 85 | struct mmci_platform_data mop500_sdi1_data = { |
Stefan Nilsson XK | 76d6717 | 2011-10-26 10:50:42 +0200 | [diff] [blame] | 86 | .ocr_mask = MMC_VDD_29_30, |
Ulf Hansson | b6ff56a | 2013-05-23 15:13:45 +0200 | [diff] [blame] | 87 | .f_max = 100000000, |
Ulf Hansson | a7de8b30 | 2013-05-23 15:13:49 +0200 | [diff] [blame] | 88 | .capabilities = MMC_CAP_4_BIT_DATA | |
| 89 | MMC_CAP_NONREMOVABLE, |
Stefan Nilsson XK | 76d6717 | 2011-10-26 10:50:42 +0200 | [diff] [blame] | 90 | .gpio_cd = -1, |
| 91 | .gpio_wp = -1, |
| 92 | #ifdef CONFIG_STE_DMA40 |
| 93 | .dma_filter = stedma40_filter, |
| 94 | .dma_rx_param = &sdi1_dma_cfg_rx, |
| 95 | .dma_tx_param = &sdi1_dma_cfg_tx, |
| 96 | #endif |
| 97 | }; |
| 98 | |
| 99 | /* |
Hanumath Prasad | 008f8a2 | 2010-08-19 12:06:32 +0100 | [diff] [blame] | 100 | * SDI 2 (POP eMMC, not on DB8500ed) |
| 101 | */ |
| 102 | |
Linus Walleij | 5d7b846 | 2010-10-14 13:57:59 +0200 | [diff] [blame] | 103 | #ifdef CONFIG_STE_DMA40 |
| 104 | struct stedma40_chan_cfg mop500_sdi2_dma_cfg_rx = { |
| 105 | .mode = STEDMA40_MODE_LOGICAL, |
Lee Jones | 98b68ab | 2013-05-15 10:51:53 +0100 | [diff] [blame] | 106 | .dir = DMA_DEV_TO_MEM, |
Lee Jones | 26955c07d | 2013-05-03 15:31:56 +0100 | [diff] [blame] | 107 | .dev_type = DB8500_DMA_DEV28_SD_MM2, |
Linus Walleij | 5d7b846 | 2010-10-14 13:57:59 +0200 | [diff] [blame] | 108 | }; |
| 109 | |
| 110 | static struct stedma40_chan_cfg mop500_sdi2_dma_cfg_tx = { |
| 111 | .mode = STEDMA40_MODE_LOGICAL, |
Lee Jones | 98b68ab | 2013-05-15 10:51:53 +0100 | [diff] [blame] | 112 | .dir = DMA_MEM_TO_DEV, |
Lee Jones | 26955c07d | 2013-05-03 15:31:56 +0100 | [diff] [blame] | 113 | .dev_type = DB8500_DMA_DEV28_SD_MM2, |
Linus Walleij | 5d7b846 | 2010-10-14 13:57:59 +0200 | [diff] [blame] | 114 | }; |
| 115 | #endif |
| 116 | |
Lee Jones | 9cf24b1 | 2012-08-30 16:11:08 +0100 | [diff] [blame] | 117 | struct mmci_platform_data mop500_sdi2_data = { |
Hanumath Prasad | 008f8a2 | 2010-08-19 12:06:32 +0100 | [diff] [blame] | 118 | .ocr_mask = MMC_VDD_165_195, |
Ulf Hansson | b6ff56a | 2013-05-23 15:13:45 +0200 | [diff] [blame] | 119 | .f_max = 100000000, |
Ulf Hansson | a2be776 | 2013-05-23 15:13:47 +0200 | [diff] [blame] | 120 | .capabilities = MMC_CAP_4_BIT_DATA | |
| 121 | MMC_CAP_8_BIT_DATA | |
Ulf Hansson | a7de8b30 | 2013-05-23 15:13:49 +0200 | [diff] [blame] | 122 | MMC_CAP_NONREMOVABLE | |
Ulf Hansson | a2be776 | 2013-05-23 15:13:47 +0200 | [diff] [blame] | 123 | MMC_CAP_MMC_HIGHSPEED | |
Ulf Hansson | fd1cc1b | 2013-05-23 15:13:48 +0200 | [diff] [blame] | 124 | MMC_CAP_ERASE | |
Ulf Hansson | a2be776 | 2013-05-23 15:13:47 +0200 | [diff] [blame] | 125 | MMC_CAP_CMD23, |
Hanumath Prasad | 008f8a2 | 2010-08-19 12:06:32 +0100 | [diff] [blame] | 126 | .gpio_cd = -1, |
| 127 | .gpio_wp = -1, |
Linus Walleij | 5d7b846 | 2010-10-14 13:57:59 +0200 | [diff] [blame] | 128 | #ifdef CONFIG_STE_DMA40 |
| 129 | .dma_filter = stedma40_filter, |
| 130 | .dma_rx_param = &mop500_sdi2_dma_cfg_rx, |
| 131 | .dma_tx_param = &mop500_sdi2_dma_cfg_tx, |
| 132 | #endif |
Hanumath Prasad | 008f8a2 | 2010-08-19 12:06:32 +0100 | [diff] [blame] | 133 | }; |
| 134 | |
| 135 | /* |
| 136 | * SDI 4 (on-board eMMC) |
| 137 | */ |
| 138 | |
Linus Walleij | 5d7b846 | 2010-10-14 13:57:59 +0200 | [diff] [blame] | 139 | #ifdef CONFIG_STE_DMA40 |
| 140 | struct stedma40_chan_cfg mop500_sdi4_dma_cfg_rx = { |
| 141 | .mode = STEDMA40_MODE_LOGICAL, |
Lee Jones | 98b68ab | 2013-05-15 10:51:53 +0100 | [diff] [blame] | 142 | .dir = DMA_DEV_TO_MEM, |
Lee Jones | 26955c07d | 2013-05-03 15:31:56 +0100 | [diff] [blame] | 143 | .dev_type = DB8500_DMA_DEV42_SD_MM4, |
Linus Walleij | 5d7b846 | 2010-10-14 13:57:59 +0200 | [diff] [blame] | 144 | }; |
| 145 | |
| 146 | static struct stedma40_chan_cfg mop500_sdi4_dma_cfg_tx = { |
| 147 | .mode = STEDMA40_MODE_LOGICAL, |
Lee Jones | 98b68ab | 2013-05-15 10:51:53 +0100 | [diff] [blame] | 148 | .dir = DMA_MEM_TO_DEV, |
Lee Jones | 26955c07d | 2013-05-03 15:31:56 +0100 | [diff] [blame] | 149 | .dev_type = DB8500_DMA_DEV42_SD_MM4, |
Linus Walleij | 5d7b846 | 2010-10-14 13:57:59 +0200 | [diff] [blame] | 150 | }; |
| 151 | #endif |
| 152 | |
Lee Jones | 5e1ac7d | 2012-05-29 14:40:04 +0800 | [diff] [blame] | 153 | struct mmci_platform_data mop500_sdi4_data = { |
Ulf Hansson | b6ff56a | 2013-05-23 15:13:45 +0200 | [diff] [blame] | 154 | .f_max = 100000000, |
Ulf Hansson | a2be776 | 2013-05-23 15:13:47 +0200 | [diff] [blame] | 155 | .capabilities = MMC_CAP_4_BIT_DATA | |
| 156 | MMC_CAP_8_BIT_DATA | |
Ulf Hansson | a7de8b30 | 2013-05-23 15:13:49 +0200 | [diff] [blame] | 157 | MMC_CAP_NONREMOVABLE | |
Ulf Hansson | a2be776 | 2013-05-23 15:13:47 +0200 | [diff] [blame] | 158 | MMC_CAP_MMC_HIGHSPEED | |
Ulf Hansson | fd1cc1b | 2013-05-23 15:13:48 +0200 | [diff] [blame] | 159 | MMC_CAP_ERASE | |
Ulf Hansson | a2be776 | 2013-05-23 15:13:47 +0200 | [diff] [blame] | 160 | MMC_CAP_CMD23, |
Hanumath Prasad | 008f8a2 | 2010-08-19 12:06:32 +0100 | [diff] [blame] | 161 | .gpio_cd = -1, |
| 162 | .gpio_wp = -1, |
Linus Walleij | 5d7b846 | 2010-10-14 13:57:59 +0200 | [diff] [blame] | 163 | #ifdef CONFIG_STE_DMA40 |
| 164 | .dma_filter = stedma40_filter, |
| 165 | .dma_rx_param = &mop500_sdi4_dma_cfg_rx, |
| 166 | .dma_tx_param = &mop500_sdi4_dma_cfg_tx, |
| 167 | #endif |
Hanumath Prasad | 008f8a2 | 2010-08-19 12:06:32 +0100 | [diff] [blame] | 168 | }; |