Rajeshwari Shinde | 57da3e3 | 2012-06-06 19:54:29 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2012 Samsung Electronics. |
| 3 | * Abhilash Kesavan <a.kesavan@samsung.com> |
| 4 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
Rajeshwari Shinde | 57da3e3 | 2012-06-06 19:54:29 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #include <common.h> |
Rajeshwari Shinde | 28bae82 | 2012-12-26 20:03:11 +0000 | [diff] [blame] | 9 | #include <fdtdec.h> |
Simon Glass | 37f1162 | 2014-10-20 19:48:37 -0600 | [diff] [blame] | 10 | #include <asm/gpio.h> |
Rajeshwari Shinde | 57da3e3 | 2012-06-06 19:54:29 +0000 | [diff] [blame] | 11 | #include <asm/arch/pinmux.h> |
| 12 | #include <asm/arch/sromc.h> |
| 13 | |
| 14 | static void exynos5_uart_config(int peripheral) |
| 15 | { |
Rajeshwari Shinde | 57da3e3 | 2012-06-06 19:54:29 +0000 | [diff] [blame] | 16 | int i, start, count; |
| 17 | |
| 18 | switch (peripheral) { |
| 19 | case PERIPH_ID_UART0: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 20 | start = EXYNOS5_GPIO_A00; |
Rajeshwari Shinde | 57da3e3 | 2012-06-06 19:54:29 +0000 | [diff] [blame] | 21 | count = 4; |
| 22 | break; |
| 23 | case PERIPH_ID_UART1: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 24 | start = EXYNOS5_GPIO_D00; |
Rajeshwari Shinde | 57da3e3 | 2012-06-06 19:54:29 +0000 | [diff] [blame] | 25 | count = 4; |
| 26 | break; |
| 27 | case PERIPH_ID_UART2: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 28 | start = EXYNOS5_GPIO_A10; |
Rajeshwari Shinde | 57da3e3 | 2012-06-06 19:54:29 +0000 | [diff] [blame] | 29 | count = 4; |
| 30 | break; |
| 31 | case PERIPH_ID_UART3: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 32 | start = EXYNOS5_GPIO_A14; |
Rajeshwari Shinde | 57da3e3 | 2012-06-06 19:54:29 +0000 | [diff] [blame] | 33 | count = 2; |
| 34 | break; |
Marek Vasut | e382be9 | 2014-03-10 20:04:31 +0100 | [diff] [blame] | 35 | default: |
| 36 | debug("%s: invalid peripheral %d", __func__, peripheral); |
| 37 | return; |
Rajeshwari Shinde | 57da3e3 | 2012-06-06 19:54:29 +0000 | [diff] [blame] | 38 | } |
| 39 | for (i = start; i < start + count; i++) { |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 40 | gpio_set_pull(i, S5P_GPIO_PULL_NONE); |
| 41 | gpio_cfg_pin(i, S5P_GPIO_FUNC(0x2)); |
Rajeshwari Shinde | 57da3e3 | 2012-06-06 19:54:29 +0000 | [diff] [blame] | 42 | } |
| 43 | } |
| 44 | |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 45 | static void exynos5420_uart_config(int peripheral) |
| 46 | { |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 47 | int i, start, count; |
| 48 | |
| 49 | switch (peripheral) { |
| 50 | case PERIPH_ID_UART0: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 51 | start = EXYNOS5420_GPIO_A00; |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 52 | count = 4; |
| 53 | break; |
| 54 | case PERIPH_ID_UART1: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 55 | start = EXYNOS5420_GPIO_A04; |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 56 | count = 4; |
| 57 | break; |
| 58 | case PERIPH_ID_UART2: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 59 | start = EXYNOS5420_GPIO_A10; |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 60 | count = 4; |
| 61 | break; |
| 62 | case PERIPH_ID_UART3: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 63 | start = EXYNOS5420_GPIO_A14; |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 64 | count = 2; |
| 65 | break; |
Marek Vasut | e382be9 | 2014-03-10 20:04:31 +0100 | [diff] [blame] | 66 | default: |
| 67 | debug("%s: invalid peripheral %d", __func__, peripheral); |
| 68 | return; |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 69 | } |
| 70 | |
| 71 | for (i = start; i < start + count; i++) { |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 72 | gpio_set_pull(i, S5P_GPIO_PULL_NONE); |
| 73 | gpio_cfg_pin(i, S5P_GPIO_FUNC(0x2)); |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 74 | } |
| 75 | } |
| 76 | |
Rajeshwari Shinde | 57da3e3 | 2012-06-06 19:54:29 +0000 | [diff] [blame] | 77 | static int exynos5_mmc_config(int peripheral, int flags) |
| 78 | { |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 79 | int i, start, start_ext, gpio_func = 0; |
Rajeshwari Shinde | 57da3e3 | 2012-06-06 19:54:29 +0000 | [diff] [blame] | 80 | |
| 81 | switch (peripheral) { |
| 82 | case PERIPH_ID_SDMMC0: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 83 | start = EXYNOS5_GPIO_C00; |
| 84 | start_ext = EXYNOS5_GPIO_C10; |
| 85 | gpio_func = S5P_GPIO_FUNC(0x2); |
Rajeshwari Shinde | 57da3e3 | 2012-06-06 19:54:29 +0000 | [diff] [blame] | 86 | break; |
| 87 | case PERIPH_ID_SDMMC1: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 88 | start = EXYNOS5_GPIO_C20; |
| 89 | start_ext = 0; |
Rajeshwari Shinde | 57da3e3 | 2012-06-06 19:54:29 +0000 | [diff] [blame] | 90 | break; |
| 91 | case PERIPH_ID_SDMMC2: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 92 | start = EXYNOS5_GPIO_C30; |
| 93 | start_ext = EXYNOS5_GPIO_C43; |
| 94 | gpio_func = S5P_GPIO_FUNC(0x3); |
Rajeshwari Shinde | 57da3e3 | 2012-06-06 19:54:29 +0000 | [diff] [blame] | 95 | break; |
| 96 | case PERIPH_ID_SDMMC3: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 97 | start = EXYNOS5_GPIO_C40; |
| 98 | start_ext = 0; |
Rajeshwari Shinde | 57da3e3 | 2012-06-06 19:54:29 +0000 | [diff] [blame] | 99 | break; |
Marek Vasut | e382be9 | 2014-03-10 20:04:31 +0100 | [diff] [blame] | 100 | default: |
| 101 | debug("%s: invalid peripheral %d", __func__, peripheral); |
| 102 | return -1; |
Rajeshwari Shinde | 57da3e3 | 2012-06-06 19:54:29 +0000 | [diff] [blame] | 103 | } |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 104 | if ((flags & PINMUX_FLAG_8BIT_MODE) && !start_ext) { |
Rajeshwari Shinde | 57da3e3 | 2012-06-06 19:54:29 +0000 | [diff] [blame] | 105 | debug("SDMMC device %d does not support 8bit mode", |
| 106 | peripheral); |
| 107 | return -1; |
| 108 | } |
| 109 | if (flags & PINMUX_FLAG_8BIT_MODE) { |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 110 | for (i = start_ext; i <= (start_ext + 3); i++) { |
| 111 | gpio_cfg_pin(i, gpio_func); |
| 112 | gpio_set_pull(i, S5P_GPIO_PULL_UP); |
| 113 | gpio_set_drv(i, S5P_GPIO_DRV_4X); |
Rajeshwari Shinde | 57da3e3 | 2012-06-06 19:54:29 +0000 | [diff] [blame] | 114 | } |
| 115 | } |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 116 | for (i = start; i < (start + 2); i++) { |
| 117 | gpio_cfg_pin(i, S5P_GPIO_FUNC(0x2)); |
| 118 | gpio_set_pull(i, S5P_GPIO_PULL_NONE); |
| 119 | gpio_set_drv(i, S5P_GPIO_DRV_4X); |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 120 | } |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 121 | for (i = (start + 3); i <= (start + 6); i++) { |
| 122 | gpio_cfg_pin(i, S5P_GPIO_FUNC(0x2)); |
| 123 | gpio_set_pull(i, S5P_GPIO_PULL_UP); |
| 124 | gpio_set_drv(i, S5P_GPIO_DRV_4X); |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 125 | } |
| 126 | |
| 127 | return 0; |
| 128 | } |
| 129 | |
| 130 | static int exynos5420_mmc_config(int peripheral, int flags) |
| 131 | { |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 132 | int i, start = 0, start_ext = 0; |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 133 | |
| 134 | switch (peripheral) { |
| 135 | case PERIPH_ID_SDMMC0: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 136 | start = EXYNOS5420_GPIO_C00; |
| 137 | start_ext = EXYNOS5420_GPIO_C30; |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 138 | break; |
| 139 | case PERIPH_ID_SDMMC1: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 140 | start = EXYNOS5420_GPIO_C10; |
| 141 | start_ext = EXYNOS5420_GPIO_D14; |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 142 | break; |
| 143 | case PERIPH_ID_SDMMC2: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 144 | start = EXYNOS5420_GPIO_C20; |
| 145 | start_ext = 0; |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 146 | break; |
| 147 | default: |
| 148 | start = 0; |
| 149 | debug("%s: invalid peripheral %d", __func__, peripheral); |
| 150 | return -1; |
| 151 | } |
| 152 | |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 153 | if ((flags & PINMUX_FLAG_8BIT_MODE) && !start_ext) { |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 154 | debug("SDMMC device %d does not support 8bit mode", |
| 155 | peripheral); |
| 156 | return -1; |
| 157 | } |
| 158 | |
| 159 | if (flags & PINMUX_FLAG_8BIT_MODE) { |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 160 | for (i = start_ext; i <= (start_ext + 3); i++) { |
| 161 | gpio_cfg_pin(i, S5P_GPIO_FUNC(0x2)); |
| 162 | gpio_set_pull(i, S5P_GPIO_PULL_UP); |
| 163 | gpio_set_drv(i, S5P_GPIO_DRV_4X); |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 164 | } |
| 165 | } |
| 166 | |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 167 | for (i = start; i < (start + 3); i++) { |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 168 | /* |
| 169 | * MMC0 is intended to be used for eMMC. The |
| 170 | * card detect pin is used as a VDDEN signal to |
| 171 | * power on the eMMC. The 5420 iROM makes |
| 172 | * this same assumption. |
| 173 | */ |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 174 | if ((peripheral == PERIPH_ID_SDMMC0) && (i == (start + 2))) { |
Simon Glass | 4f83d3d | 2014-10-20 19:48:39 -0600 | [diff] [blame^] | 175 | #ifndef CONFIG_SPL_BUILD |
| 176 | gpio_request(i, "sdmmc0_vdden"); |
| 177 | #endif |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 178 | gpio_set_value(i, 1); |
| 179 | gpio_cfg_pin(i, S5P_GPIO_OUTPUT); |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 180 | } else { |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 181 | gpio_cfg_pin(i, S5P_GPIO_FUNC(0x2)); |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 182 | } |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 183 | gpio_set_pull(i, S5P_GPIO_PULL_NONE); |
| 184 | gpio_set_drv(i, S5P_GPIO_DRV_4X); |
Rajeshwari Shinde | 57da3e3 | 2012-06-06 19:54:29 +0000 | [diff] [blame] | 185 | } |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 186 | |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 187 | for (i = (start + 3); i <= (start + 6); i++) { |
| 188 | gpio_cfg_pin(i, S5P_GPIO_FUNC(0x2)); |
| 189 | gpio_set_pull(i, S5P_GPIO_PULL_UP); |
| 190 | gpio_set_drv(i, S5P_GPIO_DRV_4X); |
Rajeshwari Shinde | 57da3e3 | 2012-06-06 19:54:29 +0000 | [diff] [blame] | 191 | } |
Rajeshwari Shinde | 8d909f3 | 2012-10-28 19:32:54 +0000 | [diff] [blame] | 192 | |
Rajeshwari Shinde | 57da3e3 | 2012-06-06 19:54:29 +0000 | [diff] [blame] | 193 | return 0; |
| 194 | } |
| 195 | |
| 196 | static void exynos5_sromc_config(int flags) |
| 197 | { |
Rajeshwari Shinde | 57da3e3 | 2012-06-06 19:54:29 +0000 | [diff] [blame] | 198 | int i; |
| 199 | |
| 200 | /* |
| 201 | * SROM:CS1 and EBI |
| 202 | * |
| 203 | * GPY0[0] SROM_CSn[0] |
| 204 | * GPY0[1] SROM_CSn[1](2) |
| 205 | * GPY0[2] SROM_CSn[2] |
| 206 | * GPY0[3] SROM_CSn[3] |
| 207 | * GPY0[4] EBI_OEn(2) |
| 208 | * GPY0[5] EBI_EEn(2) |
| 209 | * |
| 210 | * GPY1[0] EBI_BEn[0](2) |
| 211 | * GPY1[1] EBI_BEn[1](2) |
| 212 | * GPY1[2] SROM_WAIT(2) |
| 213 | * GPY1[3] EBI_DATA_RDn(2) |
| 214 | */ |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 215 | gpio_cfg_pin(EXYNOS5_GPIO_Y00 + (flags & PINMUX_FLAG_BANK), |
| 216 | S5P_GPIO_FUNC(2)); |
| 217 | gpio_cfg_pin(EXYNOS5_GPIO_Y04, S5P_GPIO_FUNC(2)); |
| 218 | gpio_cfg_pin(EXYNOS5_GPIO_Y05, S5P_GPIO_FUNC(2)); |
Rajeshwari Shinde | 57da3e3 | 2012-06-06 19:54:29 +0000 | [diff] [blame] | 219 | |
| 220 | for (i = 0; i < 4; i++) |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 221 | gpio_cfg_pin(EXYNOS5_GPIO_Y10 + i, S5P_GPIO_FUNC(2)); |
Rajeshwari Shinde | 57da3e3 | 2012-06-06 19:54:29 +0000 | [diff] [blame] | 222 | |
| 223 | /* |
| 224 | * EBI: 8 Addrss Lines |
| 225 | * |
| 226 | * GPY3[0] EBI_ADDR[0](2) |
| 227 | * GPY3[1] EBI_ADDR[1](2) |
| 228 | * GPY3[2] EBI_ADDR[2](2) |
| 229 | * GPY3[3] EBI_ADDR[3](2) |
| 230 | * GPY3[4] EBI_ADDR[4](2) |
| 231 | * GPY3[5] EBI_ADDR[5](2) |
| 232 | * GPY3[6] EBI_ADDR[6](2) |
| 233 | * GPY3[7] EBI_ADDR[7](2) |
| 234 | * |
| 235 | * EBI: 16 Data Lines |
| 236 | * |
| 237 | * GPY5[0] EBI_DATA[0](2) |
| 238 | * GPY5[1] EBI_DATA[1](2) |
| 239 | * GPY5[2] EBI_DATA[2](2) |
| 240 | * GPY5[3] EBI_DATA[3](2) |
| 241 | * GPY5[4] EBI_DATA[4](2) |
| 242 | * GPY5[5] EBI_DATA[5](2) |
| 243 | * GPY5[6] EBI_DATA[6](2) |
| 244 | * GPY5[7] EBI_DATA[7](2) |
| 245 | * |
| 246 | * GPY6[0] EBI_DATA[8](2) |
| 247 | * GPY6[1] EBI_DATA[9](2) |
| 248 | * GPY6[2] EBI_DATA[10](2) |
| 249 | * GPY6[3] EBI_DATA[11](2) |
| 250 | * GPY6[4] EBI_DATA[12](2) |
| 251 | * GPY6[5] EBI_DATA[13](2) |
| 252 | * GPY6[6] EBI_DATA[14](2) |
| 253 | * GPY6[7] EBI_DATA[15](2) |
| 254 | */ |
| 255 | for (i = 0; i < 8; i++) { |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 256 | gpio_cfg_pin(EXYNOS5_GPIO_Y30 + i, S5P_GPIO_FUNC(2)); |
| 257 | gpio_set_pull(EXYNOS5_GPIO_Y30 + i, S5P_GPIO_PULL_UP); |
Rajeshwari Shinde | 57da3e3 | 2012-06-06 19:54:29 +0000 | [diff] [blame] | 258 | |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 259 | gpio_cfg_pin(EXYNOS5_GPIO_Y50 + i, S5P_GPIO_FUNC(2)); |
| 260 | gpio_set_pull(EXYNOS5_GPIO_Y50 + i, S5P_GPIO_PULL_UP); |
Rajeshwari Shinde | 57da3e3 | 2012-06-06 19:54:29 +0000 | [diff] [blame] | 261 | |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 262 | gpio_cfg_pin(EXYNOS5_GPIO_Y60 + i, S5P_GPIO_FUNC(2)); |
| 263 | gpio_set_pull(EXYNOS5_GPIO_Y60 + i, S5P_GPIO_PULL_UP); |
Rajeshwari Shinde | 57da3e3 | 2012-06-06 19:54:29 +0000 | [diff] [blame] | 264 | } |
| 265 | } |
| 266 | |
Rajeshwari Shinde | 6c313f9 | 2012-07-23 21:23:51 +0000 | [diff] [blame] | 267 | static void exynos5_i2c_config(int peripheral, int flags) |
| 268 | { |
Rajeshwari Shinde | 6c313f9 | 2012-07-23 21:23:51 +0000 | [diff] [blame] | 269 | switch (peripheral) { |
| 270 | case PERIPH_ID_I2C0: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 271 | gpio_cfg_pin(EXYNOS5_GPIO_B30, S5P_GPIO_FUNC(0x2)); |
| 272 | gpio_cfg_pin(EXYNOS5_GPIO_B31, S5P_GPIO_FUNC(0x2)); |
Rajeshwari Shinde | 6c313f9 | 2012-07-23 21:23:51 +0000 | [diff] [blame] | 273 | break; |
| 274 | case PERIPH_ID_I2C1: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 275 | gpio_cfg_pin(EXYNOS5_GPIO_B32, S5P_GPIO_FUNC(0x2)); |
| 276 | gpio_cfg_pin(EXYNOS5_GPIO_B33, S5P_GPIO_FUNC(0x2)); |
Rajeshwari Shinde | 6c313f9 | 2012-07-23 21:23:51 +0000 | [diff] [blame] | 277 | break; |
| 278 | case PERIPH_ID_I2C2: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 279 | gpio_cfg_pin(EXYNOS5_GPIO_A06, S5P_GPIO_FUNC(0x3)); |
| 280 | gpio_cfg_pin(EXYNOS5_GPIO_A07, S5P_GPIO_FUNC(0x3)); |
Rajeshwari Shinde | 6c313f9 | 2012-07-23 21:23:51 +0000 | [diff] [blame] | 281 | break; |
| 282 | case PERIPH_ID_I2C3: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 283 | gpio_cfg_pin(EXYNOS5_GPIO_A12, S5P_GPIO_FUNC(0x3)); |
| 284 | gpio_cfg_pin(EXYNOS5_GPIO_A13, S5P_GPIO_FUNC(0x3)); |
Rajeshwari Shinde | 6c313f9 | 2012-07-23 21:23:51 +0000 | [diff] [blame] | 285 | break; |
| 286 | case PERIPH_ID_I2C4: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 287 | gpio_cfg_pin(EXYNOS5_GPIO_A20, S5P_GPIO_FUNC(0x3)); |
| 288 | gpio_cfg_pin(EXYNOS5_GPIO_A21, S5P_GPIO_FUNC(0x3)); |
Rajeshwari Shinde | 6c313f9 | 2012-07-23 21:23:51 +0000 | [diff] [blame] | 289 | break; |
| 290 | case PERIPH_ID_I2C5: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 291 | gpio_cfg_pin(EXYNOS5_GPIO_A22, S5P_GPIO_FUNC(0x3)); |
| 292 | gpio_cfg_pin(EXYNOS5_GPIO_A23, S5P_GPIO_FUNC(0x3)); |
Rajeshwari Shinde | 6c313f9 | 2012-07-23 21:23:51 +0000 | [diff] [blame] | 293 | break; |
| 294 | case PERIPH_ID_I2C6: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 295 | gpio_cfg_pin(EXYNOS5_GPIO_B13, S5P_GPIO_FUNC(0x4)); |
| 296 | gpio_cfg_pin(EXYNOS5_GPIO_B14, S5P_GPIO_FUNC(0x4)); |
Rajeshwari Shinde | 6c313f9 | 2012-07-23 21:23:51 +0000 | [diff] [blame] | 297 | break; |
| 298 | case PERIPH_ID_I2C7: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 299 | gpio_cfg_pin(EXYNOS5_GPIO_B22, S5P_GPIO_FUNC(0x3)); |
| 300 | gpio_cfg_pin(EXYNOS5_GPIO_B23, S5P_GPIO_FUNC(0x3)); |
Rajeshwari Shinde | 6c313f9 | 2012-07-23 21:23:51 +0000 | [diff] [blame] | 301 | break; |
| 302 | } |
| 303 | } |
| 304 | |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 305 | static void exynos5420_i2c_config(int peripheral) |
| 306 | { |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 307 | switch (peripheral) { |
| 308 | case PERIPH_ID_I2C0: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 309 | gpio_cfg_pin(EXYNOS5420_GPIO_B30, S5P_GPIO_FUNC(0x2)); |
| 310 | gpio_cfg_pin(EXYNOS5420_GPIO_B31, S5P_GPIO_FUNC(0x2)); |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 311 | break; |
| 312 | case PERIPH_ID_I2C1: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 313 | gpio_cfg_pin(EXYNOS5420_GPIO_B32, S5P_GPIO_FUNC(0x2)); |
| 314 | gpio_cfg_pin(EXYNOS5420_GPIO_B33, S5P_GPIO_FUNC(0x2)); |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 315 | break; |
| 316 | case PERIPH_ID_I2C2: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 317 | gpio_cfg_pin(EXYNOS5420_GPIO_A06, S5P_GPIO_FUNC(0x3)); |
| 318 | gpio_cfg_pin(EXYNOS5420_GPIO_A07, S5P_GPIO_FUNC(0x3)); |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 319 | break; |
| 320 | case PERIPH_ID_I2C3: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 321 | gpio_cfg_pin(EXYNOS5420_GPIO_A12, S5P_GPIO_FUNC(0x3)); |
| 322 | gpio_cfg_pin(EXYNOS5420_GPIO_A13, S5P_GPIO_FUNC(0x3)); |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 323 | break; |
| 324 | case PERIPH_ID_I2C4: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 325 | gpio_cfg_pin(EXYNOS5420_GPIO_A20, S5P_GPIO_FUNC(0x3)); |
| 326 | gpio_cfg_pin(EXYNOS5420_GPIO_A21, S5P_GPIO_FUNC(0x3)); |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 327 | break; |
| 328 | case PERIPH_ID_I2C5: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 329 | gpio_cfg_pin(EXYNOS5420_GPIO_A22, S5P_GPIO_FUNC(0x3)); |
| 330 | gpio_cfg_pin(EXYNOS5420_GPIO_A23, S5P_GPIO_FUNC(0x3)); |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 331 | break; |
| 332 | case PERIPH_ID_I2C6: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 333 | gpio_cfg_pin(EXYNOS5420_GPIO_B13, S5P_GPIO_FUNC(0x4)); |
| 334 | gpio_cfg_pin(EXYNOS5420_GPIO_B14, S5P_GPIO_FUNC(0x4)); |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 335 | break; |
| 336 | case PERIPH_ID_I2C7: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 337 | gpio_cfg_pin(EXYNOS5420_GPIO_B22, S5P_GPIO_FUNC(0x3)); |
| 338 | gpio_cfg_pin(EXYNOS5420_GPIO_B23, S5P_GPIO_FUNC(0x3)); |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 339 | break; |
| 340 | case PERIPH_ID_I2C8: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 341 | gpio_cfg_pin(EXYNOS5420_GPIO_B34, S5P_GPIO_FUNC(0x2)); |
| 342 | gpio_cfg_pin(EXYNOS5420_GPIO_B35, S5P_GPIO_FUNC(0x2)); |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 343 | break; |
| 344 | case PERIPH_ID_I2C9: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 345 | gpio_cfg_pin(EXYNOS5420_GPIO_B36, S5P_GPIO_FUNC(0x2)); |
| 346 | gpio_cfg_pin(EXYNOS5420_GPIO_B37, S5P_GPIO_FUNC(0x2)); |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 347 | break; |
| 348 | case PERIPH_ID_I2C10: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 349 | gpio_cfg_pin(EXYNOS5420_GPIO_B40, S5P_GPIO_FUNC(0x2)); |
| 350 | gpio_cfg_pin(EXYNOS5420_GPIO_B41, S5P_GPIO_FUNC(0x2)); |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 351 | break; |
| 352 | } |
| 353 | } |
| 354 | |
Rajeshwari Shinde | 7cf89a2 | 2012-10-25 19:49:27 +0000 | [diff] [blame] | 355 | static void exynos5_i2s_config(int peripheral) |
| 356 | { |
| 357 | int i; |
Rajeshwari Shinde | 7cf89a2 | 2012-10-25 19:49:27 +0000 | [diff] [blame] | 358 | |
Dani Krishna Mohan | 65c7ee6 | 2013-09-11 16:38:48 +0530 | [diff] [blame] | 359 | switch (peripheral) { |
| 360 | case PERIPH_ID_I2S0: |
| 361 | for (i = 0; i < 5; i++) |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 362 | gpio_cfg_pin(EXYNOS5_GPIO_Z0 + i, S5P_GPIO_FUNC(0x02)); |
Dani Krishna Mohan | 65c7ee6 | 2013-09-11 16:38:48 +0530 | [diff] [blame] | 363 | break; |
| 364 | case PERIPH_ID_I2S1: |
| 365 | for (i = 0; i < 5; i++) |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 366 | gpio_cfg_pin(EXYNOS5_GPIO_B00 + i, S5P_GPIO_FUNC(0x02)); |
Dani Krishna Mohan | 65c7ee6 | 2013-09-11 16:38:48 +0530 | [diff] [blame] | 367 | break; |
| 368 | } |
Rajeshwari Shinde | 7cf89a2 | 2012-10-25 19:49:27 +0000 | [diff] [blame] | 369 | } |
| 370 | |
Rajeshwari Shinde | 8d909f3 | 2012-10-28 19:32:54 +0000 | [diff] [blame] | 371 | void exynos5_spi_config(int peripheral) |
| 372 | { |
| 373 | int cfg = 0, pin = 0, i; |
Rajeshwari Shinde | 8d909f3 | 2012-10-28 19:32:54 +0000 | [diff] [blame] | 374 | |
| 375 | switch (peripheral) { |
| 376 | case PERIPH_ID_SPI0: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 377 | cfg = S5P_GPIO_FUNC(0x2); |
| 378 | pin = EXYNOS5_GPIO_A20; |
Rajeshwari Shinde | 8d909f3 | 2012-10-28 19:32:54 +0000 | [diff] [blame] | 379 | break; |
| 380 | case PERIPH_ID_SPI1: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 381 | cfg = S5P_GPIO_FUNC(0x2); |
| 382 | pin = EXYNOS5_GPIO_A24; |
Rajeshwari Shinde | 8d909f3 | 2012-10-28 19:32:54 +0000 | [diff] [blame] | 383 | break; |
| 384 | case PERIPH_ID_SPI2: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 385 | cfg = S5P_GPIO_FUNC(0x5); |
| 386 | pin = EXYNOS5_GPIO_B11; |
Rajeshwari Shinde | 8d909f3 | 2012-10-28 19:32:54 +0000 | [diff] [blame] | 387 | break; |
| 388 | case PERIPH_ID_SPI3: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 389 | cfg = S5P_GPIO_FUNC(0x2); |
| 390 | pin = EXYNOS5_GPIO_F10; |
Rajeshwari Shinde | 8d909f3 | 2012-10-28 19:32:54 +0000 | [diff] [blame] | 391 | break; |
| 392 | case PERIPH_ID_SPI4: |
| 393 | for (i = 0; i < 2; i++) { |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 394 | gpio_cfg_pin(EXYNOS5_GPIO_F02 + i, S5P_GPIO_FUNC(0x4)); |
| 395 | gpio_cfg_pin(EXYNOS5_GPIO_E04 + i, S5P_GPIO_FUNC(0x4)); |
Rajeshwari Shinde | 8d909f3 | 2012-10-28 19:32:54 +0000 | [diff] [blame] | 396 | } |
| 397 | break; |
| 398 | } |
| 399 | if (peripheral != PERIPH_ID_SPI4) { |
| 400 | for (i = pin; i < pin + 4; i++) |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 401 | gpio_cfg_pin(i, cfg); |
Rajeshwari Shinde | 8d909f3 | 2012-10-28 19:32:54 +0000 | [diff] [blame] | 402 | } |
| 403 | } |
| 404 | |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 405 | void exynos5420_spi_config(int peripheral) |
| 406 | { |
| 407 | int cfg, pin, i; |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 408 | |
| 409 | switch (peripheral) { |
| 410 | case PERIPH_ID_SPI0: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 411 | pin = EXYNOS5420_GPIO_A20; |
| 412 | cfg = S5P_GPIO_FUNC(0x2); |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 413 | break; |
| 414 | case PERIPH_ID_SPI1: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 415 | pin = EXYNOS5420_GPIO_A24; |
| 416 | cfg = S5P_GPIO_FUNC(0x2); |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 417 | break; |
| 418 | case PERIPH_ID_SPI2: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 419 | pin = EXYNOS5420_GPIO_B11; |
| 420 | cfg = S5P_GPIO_FUNC(0x5); |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 421 | break; |
| 422 | case PERIPH_ID_SPI3: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 423 | pin = EXYNOS5420_GPIO_F10; |
| 424 | cfg = S5P_GPIO_FUNC(0x2); |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 425 | break; |
| 426 | case PERIPH_ID_SPI4: |
| 427 | cfg = 0; |
| 428 | pin = 0; |
| 429 | break; |
| 430 | default: |
| 431 | cfg = 0; |
| 432 | pin = 0; |
| 433 | debug("%s: invalid peripheral %d", __func__, peripheral); |
| 434 | return; |
| 435 | } |
| 436 | |
| 437 | if (peripheral != PERIPH_ID_SPI4) { |
| 438 | for (i = pin; i < pin + 4; i++) |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 439 | gpio_cfg_pin(i, cfg); |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 440 | } else { |
| 441 | for (i = 0; i < 2; i++) { |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 442 | gpio_cfg_pin(EXYNOS5420_GPIO_F02 + i, |
| 443 | S5P_GPIO_FUNC(0x4)); |
| 444 | gpio_cfg_pin(EXYNOS5420_GPIO_E04 + i, |
| 445 | S5P_GPIO_FUNC(0x4)); |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 446 | } |
| 447 | } |
| 448 | } |
| 449 | |
Rajeshwari Shinde | 57da3e3 | 2012-06-06 19:54:29 +0000 | [diff] [blame] | 450 | static int exynos5_pinmux_config(int peripheral, int flags) |
| 451 | { |
| 452 | switch (peripheral) { |
| 453 | case PERIPH_ID_UART0: |
| 454 | case PERIPH_ID_UART1: |
| 455 | case PERIPH_ID_UART2: |
| 456 | case PERIPH_ID_UART3: |
| 457 | exynos5_uart_config(peripheral); |
| 458 | break; |
| 459 | case PERIPH_ID_SDMMC0: |
| 460 | case PERIPH_ID_SDMMC1: |
| 461 | case PERIPH_ID_SDMMC2: |
| 462 | case PERIPH_ID_SDMMC3: |
| 463 | return exynos5_mmc_config(peripheral, flags); |
| 464 | case PERIPH_ID_SROMC: |
| 465 | exynos5_sromc_config(flags); |
| 466 | break; |
Rajeshwari Shinde | 6c313f9 | 2012-07-23 21:23:51 +0000 | [diff] [blame] | 467 | case PERIPH_ID_I2C0: |
| 468 | case PERIPH_ID_I2C1: |
| 469 | case PERIPH_ID_I2C2: |
| 470 | case PERIPH_ID_I2C3: |
| 471 | case PERIPH_ID_I2C4: |
| 472 | case PERIPH_ID_I2C5: |
| 473 | case PERIPH_ID_I2C6: |
| 474 | case PERIPH_ID_I2C7: |
| 475 | exynos5_i2c_config(peripheral, flags); |
| 476 | break; |
Dani Krishna Mohan | 65c7ee6 | 2013-09-11 16:38:48 +0530 | [diff] [blame] | 477 | case PERIPH_ID_I2S0: |
Rajeshwari Shinde | 7cf89a2 | 2012-10-25 19:49:27 +0000 | [diff] [blame] | 478 | case PERIPH_ID_I2S1: |
| 479 | exynos5_i2s_config(peripheral); |
| 480 | break; |
Rajeshwari Shinde | 8d909f3 | 2012-10-28 19:32:54 +0000 | [diff] [blame] | 481 | case PERIPH_ID_SPI0: |
| 482 | case PERIPH_ID_SPI1: |
| 483 | case PERIPH_ID_SPI2: |
| 484 | case PERIPH_ID_SPI3: |
| 485 | case PERIPH_ID_SPI4: |
| 486 | exynos5_spi_config(peripheral); |
| 487 | break; |
Rajeshwari Shinde | 57da3e3 | 2012-06-06 19:54:29 +0000 | [diff] [blame] | 488 | default: |
| 489 | debug("%s: invalid peripheral %d", __func__, peripheral); |
| 490 | return -1; |
| 491 | } |
| 492 | |
| 493 | return 0; |
| 494 | } |
| 495 | |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 496 | static int exynos5420_pinmux_config(int peripheral, int flags) |
| 497 | { |
| 498 | switch (peripheral) { |
| 499 | case PERIPH_ID_UART0: |
| 500 | case PERIPH_ID_UART1: |
| 501 | case PERIPH_ID_UART2: |
| 502 | case PERIPH_ID_UART3: |
| 503 | exynos5420_uart_config(peripheral); |
| 504 | break; |
| 505 | case PERIPH_ID_SDMMC0: |
| 506 | case PERIPH_ID_SDMMC1: |
| 507 | case PERIPH_ID_SDMMC2: |
| 508 | case PERIPH_ID_SDMMC3: |
| 509 | return exynos5420_mmc_config(peripheral, flags); |
| 510 | case PERIPH_ID_SPI0: |
| 511 | case PERIPH_ID_SPI1: |
| 512 | case PERIPH_ID_SPI2: |
| 513 | case PERIPH_ID_SPI3: |
| 514 | case PERIPH_ID_SPI4: |
| 515 | exynos5420_spi_config(peripheral); |
| 516 | break; |
| 517 | case PERIPH_ID_I2C0: |
| 518 | case PERIPH_ID_I2C1: |
| 519 | case PERIPH_ID_I2C2: |
| 520 | case PERIPH_ID_I2C3: |
| 521 | case PERIPH_ID_I2C4: |
| 522 | case PERIPH_ID_I2C5: |
| 523 | case PERIPH_ID_I2C6: |
| 524 | case PERIPH_ID_I2C7: |
| 525 | case PERIPH_ID_I2C8: |
| 526 | case PERIPH_ID_I2C9: |
| 527 | case PERIPH_ID_I2C10: |
| 528 | exynos5420_i2c_config(peripheral); |
| 529 | break; |
| 530 | default: |
| 531 | debug("%s: invalid peripheral %d", __func__, peripheral); |
| 532 | return -1; |
| 533 | } |
| 534 | |
| 535 | return 0; |
| 536 | } |
| 537 | |
Piotr Wilczek | edad217 | 2012-11-20 02:19:04 +0000 | [diff] [blame] | 538 | static void exynos4_i2c_config(int peripheral, int flags) |
Piotr Wilczek | 7318b29 | 2012-09-20 00:19:57 +0000 | [diff] [blame] | 539 | { |
Piotr Wilczek | 7318b29 | 2012-09-20 00:19:57 +0000 | [diff] [blame] | 540 | switch (peripheral) { |
Piotr Wilczek | edad217 | 2012-11-20 02:19:04 +0000 | [diff] [blame] | 541 | case PERIPH_ID_I2C0: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 542 | gpio_cfg_pin(EXYNOS4_GPIO_D10, S5P_GPIO_FUNC(0x2)); |
| 543 | gpio_cfg_pin(EXYNOS4_GPIO_D11, S5P_GPIO_FUNC(0x2)); |
Piotr Wilczek | 7318b29 | 2012-09-20 00:19:57 +0000 | [diff] [blame] | 544 | break; |
Piotr Wilczek | edad217 | 2012-11-20 02:19:04 +0000 | [diff] [blame] | 545 | case PERIPH_ID_I2C1: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 546 | gpio_cfg_pin(EXYNOS4_GPIO_D12, S5P_GPIO_FUNC(0x2)); |
| 547 | gpio_cfg_pin(EXYNOS4_GPIO_D13, S5P_GPIO_FUNC(0x2)); |
Piotr Wilczek | 7318b29 | 2012-09-20 00:19:57 +0000 | [diff] [blame] | 548 | break; |
Piotr Wilczek | edad217 | 2012-11-20 02:19:04 +0000 | [diff] [blame] | 549 | case PERIPH_ID_I2C2: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 550 | gpio_cfg_pin(EXYNOS4_GPIO_A06, S5P_GPIO_FUNC(0x3)); |
| 551 | gpio_cfg_pin(EXYNOS4_GPIO_A07, S5P_GPIO_FUNC(0x3)); |
Piotr Wilczek | edad217 | 2012-11-20 02:19:04 +0000 | [diff] [blame] | 552 | break; |
| 553 | case PERIPH_ID_I2C3: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 554 | gpio_cfg_pin(EXYNOS4_GPIO_A12, S5P_GPIO_FUNC(0x3)); |
| 555 | gpio_cfg_pin(EXYNOS4_GPIO_A13, S5P_GPIO_FUNC(0x3)); |
Piotr Wilczek | edad217 | 2012-11-20 02:19:04 +0000 | [diff] [blame] | 556 | break; |
| 557 | case PERIPH_ID_I2C4: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 558 | gpio_cfg_pin(EXYNOS4_GPIO_B2, S5P_GPIO_FUNC(0x3)); |
| 559 | gpio_cfg_pin(EXYNOS4_GPIO_B3, S5P_GPIO_FUNC(0x3)); |
Piotr Wilczek | edad217 | 2012-11-20 02:19:04 +0000 | [diff] [blame] | 560 | break; |
| 561 | case PERIPH_ID_I2C5: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 562 | gpio_cfg_pin(EXYNOS4_GPIO_B6, S5P_GPIO_FUNC(0x3)); |
| 563 | gpio_cfg_pin(EXYNOS4_GPIO_B7, S5P_GPIO_FUNC(0x3)); |
Piotr Wilczek | edad217 | 2012-11-20 02:19:04 +0000 | [diff] [blame] | 564 | break; |
| 565 | case PERIPH_ID_I2C6: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 566 | gpio_cfg_pin(EXYNOS4_GPIO_C13, S5P_GPIO_FUNC(0x4)); |
| 567 | gpio_cfg_pin(EXYNOS4_GPIO_C14, S5P_GPIO_FUNC(0x4)); |
Piotr Wilczek | edad217 | 2012-11-20 02:19:04 +0000 | [diff] [blame] | 568 | break; |
| 569 | case PERIPH_ID_I2C7: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 570 | gpio_cfg_pin(EXYNOS4_GPIO_D02, S5P_GPIO_FUNC(0x3)); |
| 571 | gpio_cfg_pin(EXYNOS4_GPIO_D03, S5P_GPIO_FUNC(0x3)); |
Piotr Wilczek | edad217 | 2012-11-20 02:19:04 +0000 | [diff] [blame] | 572 | break; |
Piotr Wilczek | 7318b29 | 2012-09-20 00:19:57 +0000 | [diff] [blame] | 573 | } |
Piotr Wilczek | 7318b29 | 2012-09-20 00:19:57 +0000 | [diff] [blame] | 574 | } |
| 575 | |
Piotr Wilczek | a90efe9 | 2013-01-02 21:31:00 +0000 | [diff] [blame] | 576 | static int exynos4_mmc_config(int peripheral, int flags) |
| 577 | { |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 578 | int i, start = 0, start_ext = 0; |
Beomho Seo | 06d1b16 | 2014-05-16 13:59:46 +0900 | [diff] [blame] | 579 | unsigned int func, ext_func; |
Piotr Wilczek | a90efe9 | 2013-01-02 21:31:00 +0000 | [diff] [blame] | 580 | |
| 581 | switch (peripheral) { |
| 582 | case PERIPH_ID_SDMMC0: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 583 | start = EXYNOS4_GPIO_K00; |
| 584 | start_ext = EXYNOS4_GPIO_K13; |
Beomho Seo | 06d1b16 | 2014-05-16 13:59:46 +0900 | [diff] [blame] | 585 | func = S5P_GPIO_FUNC(0x2); |
| 586 | ext_func = S5P_GPIO_FUNC(0x3); |
Piotr Wilczek | a90efe9 | 2013-01-02 21:31:00 +0000 | [diff] [blame] | 587 | break; |
| 588 | case PERIPH_ID_SDMMC2: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 589 | start = EXYNOS4_GPIO_K20; |
| 590 | start_ext = EXYNOS4_GPIO_K33; |
Beomho Seo | 06d1b16 | 2014-05-16 13:59:46 +0900 | [diff] [blame] | 591 | func = S5P_GPIO_FUNC(0x2); |
| 592 | ext_func = S5P_GPIO_FUNC(0x3); |
| 593 | break; |
| 594 | case PERIPH_ID_SDMMC4: |
| 595 | start = EXYNOS4_GPIO_K00; |
| 596 | start_ext = EXYNOS4_GPIO_K13; |
| 597 | func = S5P_GPIO_FUNC(0x3); |
| 598 | ext_func = S5P_GPIO_FUNC(0x4); |
Piotr Wilczek | a90efe9 | 2013-01-02 21:31:00 +0000 | [diff] [blame] | 599 | break; |
| 600 | default: |
| 601 | return -1; |
| 602 | } |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 603 | for (i = start; i < (start + 7); i++) { |
| 604 | if (i == (start + 2)) |
Piotr Wilczek | a90efe9 | 2013-01-02 21:31:00 +0000 | [diff] [blame] | 605 | continue; |
Beomho Seo | 06d1b16 | 2014-05-16 13:59:46 +0900 | [diff] [blame] | 606 | gpio_cfg_pin(i, func); |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 607 | gpio_set_pull(i, S5P_GPIO_PULL_NONE); |
| 608 | gpio_set_drv(i, S5P_GPIO_DRV_4X); |
Piotr Wilczek | a90efe9 | 2013-01-02 21:31:00 +0000 | [diff] [blame] | 609 | } |
Beomho Seo | 06d1b16 | 2014-05-16 13:59:46 +0900 | [diff] [blame] | 610 | /* SDMMC2 do not use 8bit mode at exynos4 */ |
Piotr Wilczek | a90efe9 | 2013-01-02 21:31:00 +0000 | [diff] [blame] | 611 | if (flags & PINMUX_FLAG_8BIT_MODE) { |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 612 | for (i = start_ext; i < (start_ext + 4); i++) { |
Beomho Seo | 06d1b16 | 2014-05-16 13:59:46 +0900 | [diff] [blame] | 613 | gpio_cfg_pin(i, ext_func); |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 614 | gpio_set_pull(i, S5P_GPIO_PULL_NONE); |
| 615 | gpio_set_drv(i, S5P_GPIO_DRV_4X); |
Piotr Wilczek | a90efe9 | 2013-01-02 21:31:00 +0000 | [diff] [blame] | 616 | } |
| 617 | } |
| 618 | |
| 619 | return 0; |
| 620 | } |
| 621 | |
Rajeshwari Shinde | 99ae9b8 | 2013-07-04 12:29:16 +0530 | [diff] [blame] | 622 | static void exynos4_uart_config(int peripheral) |
| 623 | { |
Rajeshwari Shinde | 99ae9b8 | 2013-07-04 12:29:16 +0530 | [diff] [blame] | 624 | int i, start, count; |
| 625 | |
| 626 | switch (peripheral) { |
| 627 | case PERIPH_ID_UART0: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 628 | start = EXYNOS4_GPIO_A00; |
Rajeshwari Shinde | 99ae9b8 | 2013-07-04 12:29:16 +0530 | [diff] [blame] | 629 | count = 4; |
| 630 | break; |
| 631 | case PERIPH_ID_UART1: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 632 | start = EXYNOS4_GPIO_A04; |
Rajeshwari Shinde | 99ae9b8 | 2013-07-04 12:29:16 +0530 | [diff] [blame] | 633 | count = 4; |
| 634 | break; |
| 635 | case PERIPH_ID_UART2: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 636 | start = EXYNOS4_GPIO_A10; |
Rajeshwari Shinde | 99ae9b8 | 2013-07-04 12:29:16 +0530 | [diff] [blame] | 637 | count = 4; |
| 638 | break; |
| 639 | case PERIPH_ID_UART3: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 640 | start = EXYNOS4_GPIO_A14; |
Rajeshwari Shinde | 99ae9b8 | 2013-07-04 12:29:16 +0530 | [diff] [blame] | 641 | count = 2; |
| 642 | break; |
Marek Vasut | e382be9 | 2014-03-10 20:04:31 +0100 | [diff] [blame] | 643 | default: |
| 644 | debug("%s: invalid peripheral %d", __func__, peripheral); |
| 645 | return; |
Rajeshwari Shinde | 99ae9b8 | 2013-07-04 12:29:16 +0530 | [diff] [blame] | 646 | } |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 647 | for (i = start; i < (start + count); i++) { |
| 648 | gpio_set_pull(i, S5P_GPIO_PULL_NONE); |
| 649 | gpio_cfg_pin(i, S5P_GPIO_FUNC(0x2)); |
| 650 | } |
| 651 | } |
| 652 | |
| 653 | static void exynos4x12_i2c_config(int peripheral, int flags) |
| 654 | { |
| 655 | switch (peripheral) { |
| 656 | case PERIPH_ID_I2C0: |
| 657 | gpio_cfg_pin(EXYNOS4X12_GPIO_D10, S5P_GPIO_FUNC(0x2)); |
| 658 | gpio_cfg_pin(EXYNOS4X12_GPIO_D11, S5P_GPIO_FUNC(0x2)); |
| 659 | break; |
| 660 | case PERIPH_ID_I2C1: |
| 661 | gpio_cfg_pin(EXYNOS4X12_GPIO_D12, S5P_GPIO_FUNC(0x2)); |
| 662 | gpio_cfg_pin(EXYNOS4X12_GPIO_D13, S5P_GPIO_FUNC(0x2)); |
| 663 | break; |
| 664 | case PERIPH_ID_I2C2: |
| 665 | gpio_cfg_pin(EXYNOS4X12_GPIO_A06, S5P_GPIO_FUNC(0x3)); |
| 666 | gpio_cfg_pin(EXYNOS4X12_GPIO_A07, S5P_GPIO_FUNC(0x3)); |
| 667 | break; |
| 668 | case PERIPH_ID_I2C3: |
| 669 | gpio_cfg_pin(EXYNOS4X12_GPIO_A12, S5P_GPIO_FUNC(0x3)); |
| 670 | gpio_cfg_pin(EXYNOS4X12_GPIO_A13, S5P_GPIO_FUNC(0x3)); |
| 671 | break; |
| 672 | case PERIPH_ID_I2C4: |
| 673 | gpio_cfg_pin(EXYNOS4X12_GPIO_B2, S5P_GPIO_FUNC(0x3)); |
| 674 | gpio_cfg_pin(EXYNOS4X12_GPIO_B3, S5P_GPIO_FUNC(0x3)); |
| 675 | break; |
| 676 | case PERIPH_ID_I2C5: |
| 677 | gpio_cfg_pin(EXYNOS4X12_GPIO_B6, S5P_GPIO_FUNC(0x3)); |
| 678 | gpio_cfg_pin(EXYNOS4X12_GPIO_B7, S5P_GPIO_FUNC(0x3)); |
| 679 | break; |
| 680 | case PERIPH_ID_I2C6: |
| 681 | gpio_cfg_pin(EXYNOS4X12_GPIO_C13, S5P_GPIO_FUNC(0x4)); |
| 682 | gpio_cfg_pin(EXYNOS4X12_GPIO_C14, S5P_GPIO_FUNC(0x4)); |
| 683 | break; |
| 684 | case PERIPH_ID_I2C7: |
| 685 | gpio_cfg_pin(EXYNOS4X12_GPIO_D02, S5P_GPIO_FUNC(0x3)); |
| 686 | gpio_cfg_pin(EXYNOS4X12_GPIO_D03, S5P_GPIO_FUNC(0x3)); |
| 687 | break; |
| 688 | } |
| 689 | } |
| 690 | |
| 691 | static int exynos4x12_mmc_config(int peripheral, int flags) |
| 692 | { |
| 693 | int i, start = 0, start_ext = 0; |
Beomho Seo | 06d1b16 | 2014-05-16 13:59:46 +0900 | [diff] [blame] | 694 | unsigned int func, ext_func; |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 695 | |
| 696 | switch (peripheral) { |
| 697 | case PERIPH_ID_SDMMC0: |
| 698 | start = EXYNOS4X12_GPIO_K00; |
| 699 | start_ext = EXYNOS4X12_GPIO_K13; |
Beomho Seo | 06d1b16 | 2014-05-16 13:59:46 +0900 | [diff] [blame] | 700 | func = S5P_GPIO_FUNC(0x2); |
| 701 | ext_func = S5P_GPIO_FUNC(0x3); |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 702 | break; |
| 703 | case PERIPH_ID_SDMMC2: |
| 704 | start = EXYNOS4X12_GPIO_K20; |
| 705 | start_ext = EXYNOS4X12_GPIO_K33; |
Beomho Seo | 06d1b16 | 2014-05-16 13:59:46 +0900 | [diff] [blame] | 706 | func = S5P_GPIO_FUNC(0x2); |
| 707 | ext_func = S5P_GPIO_FUNC(0x3); |
| 708 | break; |
| 709 | case PERIPH_ID_SDMMC4: |
Przemyslaw Marczak | 64c7da5 | 2014-09-01 13:50:43 +0200 | [diff] [blame] | 710 | start = EXYNOS4X12_GPIO_K00; |
| 711 | start_ext = EXYNOS4X12_GPIO_K13; |
Beomho Seo | 06d1b16 | 2014-05-16 13:59:46 +0900 | [diff] [blame] | 712 | func = S5P_GPIO_FUNC(0x3); |
| 713 | ext_func = S5P_GPIO_FUNC(0x4); |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 714 | break; |
| 715 | default: |
| 716 | return -1; |
Rajeshwari Shinde | 99ae9b8 | 2013-07-04 12:29:16 +0530 | [diff] [blame] | 717 | } |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 718 | for (i = start; i < (start + 7); i++) { |
| 719 | if (i == (start + 2)) |
| 720 | continue; |
Beomho Seo | 06d1b16 | 2014-05-16 13:59:46 +0900 | [diff] [blame] | 721 | gpio_cfg_pin(i, func); |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 722 | gpio_set_pull(i, S5P_GPIO_PULL_NONE); |
| 723 | gpio_set_drv(i, S5P_GPIO_DRV_4X); |
| 724 | } |
| 725 | if (flags & PINMUX_FLAG_8BIT_MODE) { |
| 726 | for (i = start_ext; i < (start_ext + 4); i++) { |
Beomho Seo | 06d1b16 | 2014-05-16 13:59:46 +0900 | [diff] [blame] | 727 | gpio_cfg_pin(i, ext_func); |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 728 | gpio_set_pull(i, S5P_GPIO_PULL_NONE); |
| 729 | gpio_set_drv(i, S5P_GPIO_DRV_4X); |
| 730 | } |
| 731 | } |
| 732 | |
| 733 | return 0; |
Rajeshwari Shinde | 99ae9b8 | 2013-07-04 12:29:16 +0530 | [diff] [blame] | 734 | } |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 735 | |
| 736 | static void exynos4x12_uart_config(int peripheral) |
| 737 | { |
| 738 | int i, start, count; |
| 739 | |
| 740 | switch (peripheral) { |
| 741 | case PERIPH_ID_UART0: |
| 742 | start = EXYNOS4X12_GPIO_A00; |
| 743 | count = 4; |
| 744 | break; |
| 745 | case PERIPH_ID_UART1: |
| 746 | start = EXYNOS4X12_GPIO_A04; |
| 747 | count = 4; |
| 748 | break; |
| 749 | case PERIPH_ID_UART2: |
| 750 | start = EXYNOS4X12_GPIO_A10; |
| 751 | count = 4; |
| 752 | break; |
| 753 | case PERIPH_ID_UART3: |
| 754 | start = EXYNOS4X12_GPIO_A14; |
| 755 | count = 2; |
| 756 | break; |
| 757 | default: |
| 758 | debug("%s: invalid peripheral %d", __func__, peripheral); |
| 759 | return; |
| 760 | } |
| 761 | for (i = start; i < (start + count); i++) { |
| 762 | gpio_set_pull(i, S5P_GPIO_PULL_NONE); |
| 763 | gpio_cfg_pin(i, S5P_GPIO_FUNC(0x2)); |
| 764 | } |
| 765 | } |
| 766 | |
Piotr Wilczek | 7318b29 | 2012-09-20 00:19:57 +0000 | [diff] [blame] | 767 | static int exynos4_pinmux_config(int peripheral, int flags) |
| 768 | { |
| 769 | switch (peripheral) { |
Rajeshwari Shinde | 99ae9b8 | 2013-07-04 12:29:16 +0530 | [diff] [blame] | 770 | case PERIPH_ID_UART0: |
| 771 | case PERIPH_ID_UART1: |
| 772 | case PERIPH_ID_UART2: |
| 773 | case PERIPH_ID_UART3: |
| 774 | exynos4_uart_config(peripheral); |
| 775 | break; |
Piotr Wilczek | edad217 | 2012-11-20 02:19:04 +0000 | [diff] [blame] | 776 | case PERIPH_ID_I2C0: |
| 777 | case PERIPH_ID_I2C1: |
| 778 | case PERIPH_ID_I2C2: |
| 779 | case PERIPH_ID_I2C3: |
| 780 | case PERIPH_ID_I2C4: |
| 781 | case PERIPH_ID_I2C5: |
| 782 | case PERIPH_ID_I2C6: |
| 783 | case PERIPH_ID_I2C7: |
| 784 | exynos4_i2c_config(peripheral, flags); |
| 785 | break; |
Piotr Wilczek | a90efe9 | 2013-01-02 21:31:00 +0000 | [diff] [blame] | 786 | case PERIPH_ID_SDMMC0: |
| 787 | case PERIPH_ID_SDMMC2: |
Beomho Seo | 06d1b16 | 2014-05-16 13:59:46 +0900 | [diff] [blame] | 788 | case PERIPH_ID_SDMMC4: |
Piotr Wilczek | a90efe9 | 2013-01-02 21:31:00 +0000 | [diff] [blame] | 789 | return exynos4_mmc_config(peripheral, flags); |
| 790 | case PERIPH_ID_SDMMC1: |
| 791 | case PERIPH_ID_SDMMC3: |
Rajeshwari Shinde | 507f892 | 2013-10-08 18:42:22 +0530 | [diff] [blame] | 792 | debug("SDMMC device %d not implemented\n", peripheral); |
Piotr Wilczek | a90efe9 | 2013-01-02 21:31:00 +0000 | [diff] [blame] | 793 | return -1; |
Piotr Wilczek | 7318b29 | 2012-09-20 00:19:57 +0000 | [diff] [blame] | 794 | default: |
| 795 | debug("%s: invalid peripheral %d", __func__, peripheral); |
| 796 | return -1; |
| 797 | } |
| 798 | |
| 799 | return 0; |
| 800 | } |
| 801 | |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 802 | static int exynos4x12_pinmux_config(int peripheral, int flags) |
| 803 | { |
| 804 | switch (peripheral) { |
| 805 | case PERIPH_ID_UART0: |
| 806 | case PERIPH_ID_UART1: |
| 807 | case PERIPH_ID_UART2: |
| 808 | case PERIPH_ID_UART3: |
| 809 | exynos4x12_uart_config(peripheral); |
| 810 | break; |
| 811 | case PERIPH_ID_I2C0: |
| 812 | case PERIPH_ID_I2C1: |
| 813 | case PERIPH_ID_I2C2: |
| 814 | case PERIPH_ID_I2C3: |
| 815 | case PERIPH_ID_I2C4: |
| 816 | case PERIPH_ID_I2C5: |
| 817 | case PERIPH_ID_I2C6: |
| 818 | case PERIPH_ID_I2C7: |
| 819 | exynos4x12_i2c_config(peripheral, flags); |
| 820 | break; |
| 821 | case PERIPH_ID_SDMMC0: |
| 822 | case PERIPH_ID_SDMMC2: |
Beomho Seo | 06d1b16 | 2014-05-16 13:59:46 +0900 | [diff] [blame] | 823 | case PERIPH_ID_SDMMC4: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 824 | return exynos4x12_mmc_config(peripheral, flags); |
| 825 | case PERIPH_ID_SDMMC1: |
| 826 | case PERIPH_ID_SDMMC3: |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 827 | debug("SDMMC device %d not implemented\n", peripheral); |
| 828 | return -1; |
| 829 | default: |
| 830 | debug("%s: invalid peripheral %d", __func__, peripheral); |
| 831 | return -1; |
| 832 | } |
| 833 | |
| 834 | return 0; |
| 835 | } |
| 836 | |
Rajeshwari Shinde | 57da3e3 | 2012-06-06 19:54:29 +0000 | [diff] [blame] | 837 | int exynos_pinmux_config(int peripheral, int flags) |
| 838 | { |
Dani Krishna Mohan | 65c7ee6 | 2013-09-11 16:38:48 +0530 | [diff] [blame] | 839 | if (cpu_is_exynos5()) { |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 840 | if (proid_is_exynos5420()) |
| 841 | return exynos5420_pinmux_config(peripheral, flags); |
| 842 | else if (proid_is_exynos5250()) |
| 843 | return exynos5_pinmux_config(peripheral, flags); |
Dani Krishna Mohan | 65c7ee6 | 2013-09-11 16:38:48 +0530 | [diff] [blame] | 844 | } else if (cpu_is_exynos4()) { |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 845 | if (proid_is_exynos4412()) |
| 846 | return exynos4x12_pinmux_config(peripheral, flags); |
| 847 | else |
| 848 | return exynos4_pinmux_config(peripheral, flags); |
Rajeshwari Shinde | 57da3e3 | 2012-06-06 19:54:29 +0000 | [diff] [blame] | 849 | } |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 850 | |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 851 | debug("pinmux functionality not supported\n"); |
| 852 | |
Rajeshwari Birje | f0ce84f | 2013-12-26 09:44:23 +0530 | [diff] [blame] | 853 | return -1; |
Rajeshwari Shinde | 57da3e3 | 2012-06-06 19:54:29 +0000 | [diff] [blame] | 854 | } |
Rajeshwari Shinde | 28bae82 | 2012-12-26 20:03:11 +0000 | [diff] [blame] | 855 | |
| 856 | #ifdef CONFIG_OF_CONTROL |
Piotr Wilczek | 246ec3a | 2014-03-07 14:59:38 +0100 | [diff] [blame] | 857 | static int exynos4_pinmux_decode_periph_id(const void *blob, int node) |
| 858 | { |
| 859 | int err; |
| 860 | u32 cell[3]; |
| 861 | |
| 862 | err = fdtdec_get_int_array(blob, node, "interrupts", cell, |
| 863 | ARRAY_SIZE(cell)); |
| 864 | if (err) { |
| 865 | debug(" invalid peripheral id\n"); |
| 866 | return PERIPH_ID_NONE; |
| 867 | } |
| 868 | |
| 869 | return cell[1]; |
| 870 | } |
| 871 | |
Rajeshwari Shinde | 28bae82 | 2012-12-26 20:03:11 +0000 | [diff] [blame] | 872 | static int exynos5_pinmux_decode_periph_id(const void *blob, int node) |
| 873 | { |
| 874 | int err; |
| 875 | u32 cell[3]; |
| 876 | |
| 877 | err = fdtdec_get_int_array(blob, node, "interrupts", cell, |
| 878 | ARRAY_SIZE(cell)); |
| 879 | if (err) |
| 880 | return PERIPH_ID_NONE; |
| 881 | |
Minkyu Kang | dcc9917 | 2014-01-29 17:04:17 +0900 | [diff] [blame] | 882 | return cell[1]; |
Rajeshwari Shinde | 28bae82 | 2012-12-26 20:03:11 +0000 | [diff] [blame] | 883 | } |
| 884 | |
| 885 | int pinmux_decode_periph_id(const void *blob, int node) |
| 886 | { |
| 887 | if (cpu_is_exynos5()) |
| 888 | return exynos5_pinmux_decode_periph_id(blob, node); |
Piotr Wilczek | 246ec3a | 2014-03-07 14:59:38 +0100 | [diff] [blame] | 889 | else if (cpu_is_exynos4()) |
| 890 | return exynos4_pinmux_decode_periph_id(blob, node); |
Akshay Saraswat | 1376cdd | 2014-05-13 10:30:14 +0530 | [diff] [blame] | 891 | |
| 892 | return PERIPH_ID_NONE; |
Rajeshwari Shinde | 28bae82 | 2012-12-26 20:03:11 +0000 | [diff] [blame] | 893 | } |
| 894 | #endif |