Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Michal Simek | 0dd222b | 2013-04-22 14:56:49 +0200 | [diff] [blame] | 2 | /* |
Michal Simek | 9ecd268 | 2015-11-30 16:13:03 +0100 | [diff] [blame] | 3 | * (C) Copyright 2013 - 2015 Xilinx, Inc. |
Michal Simek | 0dd222b | 2013-04-22 14:56:49 +0200 | [diff] [blame] | 4 | * |
| 5 | * Xilinx Zynq SD Host Controller Interface |
Michal Simek | 0dd222b | 2013-04-22 14:56:49 +0200 | [diff] [blame] | 6 | */ |
| 7 | |
Stefan Herbrechtsmeier | 739ae40 | 2017-01-17 16:27:32 +0100 | [diff] [blame] | 8 | #include <clk.h> |
Michal Simek | 0dd222b | 2013-04-22 14:56:49 +0200 | [diff] [blame] | 9 | #include <common.h> |
Michal Simek | 9ecd268 | 2015-11-30 16:13:03 +0100 | [diff] [blame] | 10 | #include <dm.h> |
Michal Simek | c57ba04 | 2014-02-24 11:16:31 +0100 | [diff] [blame] | 11 | #include <fdtdec.h> |
Simon Glass | dbd7954 | 2020-05-10 11:40:11 -0600 | [diff] [blame] | 12 | #include <linux/delay.h> |
Siva Durga Prasad Paladugu | cad14a8 | 2018-04-19 12:37:09 +0530 | [diff] [blame] | 13 | #include "mmc_private.h" |
Simon Glass | 0f2af88 | 2020-05-10 11:40:05 -0600 | [diff] [blame] | 14 | #include <log.h> |
Ashok Reddy Soma | ca7d847 | 2022-02-23 15:36:05 +0100 | [diff] [blame^] | 15 | #include <reset.h> |
Simon Glass | 9bc1564 | 2020-02-03 07:36:16 -0700 | [diff] [blame] | 16 | #include <dm/device_compat.h> |
Simon Glass | d66c5f7 | 2020-02-03 07:36:15 -0700 | [diff] [blame] | 17 | #include <linux/err.h> |
Masahiro Yamada | 75f82d0 | 2018-03-05 01:20:11 +0900 | [diff] [blame] | 18 | #include <linux/libfdt.h> |
Ashok Reddy Soma | ca7d847 | 2022-02-23 15:36:05 +0100 | [diff] [blame^] | 19 | #include <asm/types.h> |
| 20 | #include <linux/math64.h> |
Ashok Reddy Soma | 7a5f810 | 2021-08-02 23:20:44 -0600 | [diff] [blame] | 21 | #include <asm/cache.h> |
Michal Simek | 0dd222b | 2013-04-22 14:56:49 +0200 | [diff] [blame] | 22 | #include <malloc.h> |
| 23 | #include <sdhci.h> |
Ashok Reddy Soma | 467d078 | 2021-08-02 23:20:43 -0600 | [diff] [blame] | 24 | #include <zynqmp_firmware.h> |
Michal Simek | 0dd222b | 2013-04-22 14:56:49 +0200 | [diff] [blame] | 25 | |
Ashok Reddy Soma | 24a5107 | 2021-07-09 05:53:41 -0600 | [diff] [blame] | 26 | #define SDHCI_ARASAN_ITAPDLY_REGISTER 0xF0F8 |
| 27 | #define SDHCI_ARASAN_ITAPDLY_SEL_MASK GENMASK(7, 0) |
| 28 | #define SDHCI_ARASAN_OTAPDLY_REGISTER 0xF0FC |
| 29 | #define SDHCI_ARASAN_OTAPDLY_SEL_MASK GENMASK(5, 0) |
| 30 | #define SDHCI_ITAPDLY_CHGWIN BIT(9) |
| 31 | #define SDHCI_ITAPDLY_ENABLE BIT(8) |
| 32 | #define SDHCI_OTAPDLY_ENABLE BIT(6) |
Ashok Reddy Soma | 568edfd | 2020-10-23 04:59:02 -0600 | [diff] [blame] | 33 | |
Michal Simek | 5b5101e | 2020-10-23 04:58:59 -0600 | [diff] [blame] | 34 | #define SDHCI_TUNING_LOOP_COUNT 40 |
Michal Simek | 33a6b77 | 2020-10-23 04:59:00 -0600 | [diff] [blame] | 35 | #define MMC_BANK2 0x2 |
| 36 | |
Ashok Reddy Soma | 7a5f810 | 2021-08-02 23:20:44 -0600 | [diff] [blame] | 37 | #define SD_DLL_CTRL 0xFF180358 |
| 38 | #define SD_ITAP_DLY 0xFF180314 |
| 39 | #define SD_OTAP_DLY 0xFF180318 |
| 40 | #define SD0_DLL_RST BIT(2) |
| 41 | #define SD1_DLL_RST BIT(18) |
| 42 | #define SD0_ITAPCHGWIN BIT(9) |
| 43 | #define SD1_ITAPCHGWIN BIT(25) |
| 44 | #define SD0_ITAPDLYENA BIT(8) |
| 45 | #define SD1_ITAPDLYENA BIT(24) |
| 46 | #define SD0_ITAPDLYSEL_MASK GENMASK(7, 0) |
| 47 | #define SD1_ITAPDLYSEL_MASK GENMASK(23, 16) |
| 48 | #define SD0_OTAPDLYSEL_MASK GENMASK(5, 0) |
| 49 | #define SD1_OTAPDLYSEL_MASK GENMASK(21, 16) |
| 50 | |
Michal Simek | 33a6b77 | 2020-10-23 04:59:00 -0600 | [diff] [blame] | 51 | struct arasan_sdhci_clk_data { |
| 52 | int clk_phase_in[MMC_TIMING_MMC_HS400 + 1]; |
| 53 | int clk_phase_out[MMC_TIMING_MMC_HS400 + 1]; |
| 54 | }; |
Michal Simek | 5b5101e | 2020-10-23 04:58:59 -0600 | [diff] [blame] | 55 | |
Simon Glass | 4cc87fb | 2016-07-05 17:10:15 -0600 | [diff] [blame] | 56 | struct arasan_sdhci_plat { |
| 57 | struct mmc_config cfg; |
| 58 | struct mmc mmc; |
| 59 | }; |
| 60 | |
Siva Durga Prasad Paladugu | cad14a8 | 2018-04-19 12:37:09 +0530 | [diff] [blame] | 61 | struct arasan_sdhci_priv { |
| 62 | struct sdhci_host *host; |
Michal Simek | 33a6b77 | 2020-10-23 04:59:00 -0600 | [diff] [blame] | 63 | struct arasan_sdhci_clk_data clk_data; |
Siva Durga Prasad Paladugu | cad14a8 | 2018-04-19 12:37:09 +0530 | [diff] [blame] | 64 | u8 deviceid; |
| 65 | u8 bank; |
Ashok Reddy Soma | 61e0df9 | 2020-10-23 04:58:57 -0600 | [diff] [blame] | 66 | u8 no_1p8; |
Ashok Reddy Soma | ca7d847 | 2022-02-23 15:36:05 +0100 | [diff] [blame^] | 67 | struct reset_ctl_bulk resets; |
Siva Durga Prasad Paladugu | cad14a8 | 2018-04-19 12:37:09 +0530 | [diff] [blame] | 68 | }; |
| 69 | |
Ashok Reddy Soma | 7a5f810 | 2021-08-02 23:20:44 -0600 | [diff] [blame] | 70 | /* For Versal platforms zynqmp_mmio_write() won't be available */ |
| 71 | __weak int zynqmp_mmio_write(const u32 address, const u32 mask, const u32 value) |
| 72 | { |
| 73 | return 0; |
| 74 | } |
| 75 | |
T Karthik Reddy | d061827 | 2021-10-01 16:38:38 +0530 | [diff] [blame] | 76 | __weak int xilinx_pm_request(u32 api_id, u32 arg0, u32 arg1, u32 arg2, |
| 77 | u32 arg3, u32 *ret_payload) |
| 78 | { |
| 79 | return 0; |
| 80 | } |
| 81 | |
Ashok Reddy Soma | 568edfd | 2020-10-23 04:59:02 -0600 | [diff] [blame] | 82 | #if defined(CONFIG_ARCH_ZYNQMP) || defined(CONFIG_ARCH_VERSAL) |
Michal Simek | 33a6b77 | 2020-10-23 04:59:00 -0600 | [diff] [blame] | 83 | /* Default settings for ZynqMP Clock Phases */ |
Michal Simek | 635cf4a | 2021-07-09 05:53:44 -0600 | [diff] [blame] | 84 | static const u32 zynqmp_iclk_phases[] = {0, 63, 63, 0, 63, 0, |
| 85 | 0, 183, 54, 0, 0}; |
| 86 | static const u32 zynqmp_oclk_phases[] = {0, 72, 60, 0, 60, 72, |
| 87 | 135, 48, 72, 135, 0}; |
Michal Simek | 33a6b77 | 2020-10-23 04:59:00 -0600 | [diff] [blame] | 88 | |
Ashok Reddy Soma | 568edfd | 2020-10-23 04:59:02 -0600 | [diff] [blame] | 89 | /* Default settings for Versal Clock Phases */ |
Michal Simek | 635cf4a | 2021-07-09 05:53:44 -0600 | [diff] [blame] | 90 | static const u32 versal_iclk_phases[] = {0, 132, 132, 0, 132, |
| 91 | 0, 0, 162, 90, 0, 0}; |
| 92 | static const u32 versal_oclk_phases[] = {0, 60, 48, 0, 48, 72, |
| 93 | 90, 36, 60, 90, 0}; |
Ashok Reddy Soma | 568edfd | 2020-10-23 04:59:02 -0600 | [diff] [blame] | 94 | |
Siva Durga Prasad Paladugu | cad14a8 | 2018-04-19 12:37:09 +0530 | [diff] [blame] | 95 | static const u8 mode2timing[] = { |
Ashok Reddy Soma | 0afdfe3 | 2020-10-23 04:58:58 -0600 | [diff] [blame] | 96 | [MMC_LEGACY] = MMC_TIMING_LEGACY, |
| 97 | [MMC_HS] = MMC_TIMING_MMC_HS, |
| 98 | [SD_HS] = MMC_TIMING_SD_HS, |
| 99 | [MMC_HS_52] = MMC_TIMING_UHS_SDR50, |
| 100 | [MMC_DDR_52] = MMC_TIMING_UHS_DDR50, |
| 101 | [UHS_SDR12] = MMC_TIMING_UHS_SDR12, |
| 102 | [UHS_SDR25] = MMC_TIMING_UHS_SDR25, |
| 103 | [UHS_SDR50] = MMC_TIMING_UHS_SDR50, |
| 104 | [UHS_DDR50] = MMC_TIMING_UHS_DDR50, |
| 105 | [UHS_SDR104] = MMC_TIMING_UHS_SDR104, |
| 106 | [MMC_HS_200] = MMC_TIMING_MMC_HS200, |
Siva Durga Prasad Paladugu | cad14a8 | 2018-04-19 12:37:09 +0530 | [diff] [blame] | 107 | }; |
| 108 | |
Ashok Reddy Soma | 7a5f810 | 2021-08-02 23:20:44 -0600 | [diff] [blame] | 109 | static inline int arasan_zynqmp_set_in_tapdelay(u8 node_id, u32 itap_delay) |
| 110 | { |
| 111 | int ret; |
| 112 | |
| 113 | if (IS_ENABLED(CONFIG_SPL_BUILD) || current_el() == 3) { |
| 114 | if (node_id == NODE_SD_0) { |
| 115 | ret = zynqmp_mmio_write(SD_ITAP_DLY, SD0_ITAPCHGWIN, |
| 116 | SD0_ITAPCHGWIN); |
| 117 | if (ret) |
| 118 | return ret; |
| 119 | |
| 120 | ret = zynqmp_mmio_write(SD_ITAP_DLY, SD0_ITAPDLYENA, |
| 121 | SD0_ITAPDLYENA); |
| 122 | if (ret) |
| 123 | return ret; |
| 124 | |
| 125 | ret = zynqmp_mmio_write(SD_ITAP_DLY, SD0_ITAPDLYSEL_MASK, |
| 126 | itap_delay); |
| 127 | if (ret) |
| 128 | return ret; |
| 129 | |
| 130 | ret = zynqmp_mmio_write(SD_ITAP_DLY, SD0_ITAPCHGWIN, 0); |
| 131 | if (ret) |
| 132 | return ret; |
| 133 | } |
| 134 | ret = zynqmp_mmio_write(SD_ITAP_DLY, SD1_ITAPCHGWIN, |
| 135 | SD1_ITAPCHGWIN); |
| 136 | if (ret) |
| 137 | return ret; |
| 138 | |
| 139 | ret = zynqmp_mmio_write(SD_ITAP_DLY, SD1_ITAPDLYENA, |
| 140 | SD1_ITAPDLYENA); |
| 141 | if (ret) |
| 142 | return ret; |
| 143 | |
| 144 | ret = zynqmp_mmio_write(SD_ITAP_DLY, SD1_ITAPDLYSEL_MASK, |
| 145 | (itap_delay << 16)); |
| 146 | if (ret) |
| 147 | return ret; |
| 148 | |
| 149 | ret = zynqmp_mmio_write(SD_ITAP_DLY, SD1_ITAPCHGWIN, 0); |
| 150 | if (ret) |
| 151 | return ret; |
| 152 | } else { |
| 153 | return xilinx_pm_request(PM_IOCTL, (u32)node_id, |
| 154 | IOCTL_SET_SD_TAPDELAY, |
| 155 | PM_TAPDELAY_INPUT, itap_delay, NULL); |
| 156 | } |
| 157 | |
| 158 | return 0; |
| 159 | } |
| 160 | |
| 161 | static inline int arasan_zynqmp_set_out_tapdelay(u8 node_id, u32 otap_delay) |
| 162 | { |
| 163 | if (IS_ENABLED(CONFIG_SPL_BUILD) || current_el() == 3) { |
| 164 | if (node_id == NODE_SD_0) |
| 165 | return zynqmp_mmio_write(SD_OTAP_DLY, |
| 166 | SD0_OTAPDLYSEL_MASK, |
| 167 | otap_delay); |
| 168 | |
| 169 | return zynqmp_mmio_write(SD_OTAP_DLY, SD1_OTAPDLYSEL_MASK, |
| 170 | (otap_delay << 16)); |
| 171 | } else { |
| 172 | return xilinx_pm_request(PM_IOCTL, (u32)node_id, |
| 173 | IOCTL_SET_SD_TAPDELAY, |
| 174 | PM_TAPDELAY_OUTPUT, otap_delay, NULL); |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | static inline int zynqmp_dll_reset(u8 node_id, u32 type) |
| 179 | { |
| 180 | if (IS_ENABLED(CONFIG_SPL_BUILD) || current_el() == 3) { |
| 181 | if (node_id == NODE_SD_0) |
| 182 | return zynqmp_mmio_write(SD_DLL_CTRL, SD0_DLL_RST, |
| 183 | type == PM_DLL_RESET_ASSERT ? |
| 184 | SD0_DLL_RST : 0); |
| 185 | |
| 186 | return zynqmp_mmio_write(SD_DLL_CTRL, SD1_DLL_RST, |
| 187 | type == PM_DLL_RESET_ASSERT ? |
| 188 | SD1_DLL_RST : 0); |
| 189 | } else { |
| 190 | return xilinx_pm_request(PM_IOCTL, (u32)node_id, |
| 191 | IOCTL_SD_DLL_RESET, type, 0, NULL); |
| 192 | } |
| 193 | } |
| 194 | |
Ashok Reddy Soma | 467d078 | 2021-08-02 23:20:43 -0600 | [diff] [blame] | 195 | static int arasan_zynqmp_dll_reset(struct sdhci_host *host, u8 node_id) |
Siva Durga Prasad Paladugu | cad14a8 | 2018-04-19 12:37:09 +0530 | [diff] [blame] | 196 | { |
Ashok Reddy Soma | 467d078 | 2021-08-02 23:20:43 -0600 | [diff] [blame] | 197 | struct mmc *mmc = (struct mmc *)host->mmc; |
| 198 | struct udevice *dev = mmc->dev; |
Siva Durga Prasad Paladugu | cad14a8 | 2018-04-19 12:37:09 +0530 | [diff] [blame] | 199 | unsigned long timeout; |
Ashok Reddy Soma | 467d078 | 2021-08-02 23:20:43 -0600 | [diff] [blame] | 200 | int ret; |
| 201 | u16 clk; |
Siva Durga Prasad Paladugu | cad14a8 | 2018-04-19 12:37:09 +0530 | [diff] [blame] | 202 | |
| 203 | clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL); |
| 204 | clk &= ~(SDHCI_CLOCK_CARD_EN); |
| 205 | sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL); |
| 206 | |
| 207 | /* Issue DLL Reset */ |
Ashok Reddy Soma | 467d078 | 2021-08-02 23:20:43 -0600 | [diff] [blame] | 208 | ret = zynqmp_dll_reset(node_id, PM_DLL_RESET_ASSERT); |
| 209 | if (ret) { |
| 210 | dev_err(dev, "dll_reset assert failed with err: %d\n", ret); |
| 211 | return ret; |
| 212 | } |
| 213 | |
| 214 | /* Allow atleast 1ms delay for proper DLL reset */ |
| 215 | mdelay(1); |
| 216 | ret = zynqmp_dll_reset(node_id, PM_DLL_RESET_RELEASE); |
| 217 | if (ret) { |
| 218 | dev_err(dev, "dll_reset release failed with err: %d\n", ret); |
| 219 | return ret; |
| 220 | } |
Siva Durga Prasad Paladugu | cad14a8 | 2018-04-19 12:37:09 +0530 | [diff] [blame] | 221 | |
| 222 | /* Wait max 20 ms */ |
| 223 | timeout = 100; |
| 224 | while (!((clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL)) |
| 225 | & SDHCI_CLOCK_INT_STABLE)) { |
| 226 | if (timeout == 0) { |
Ashok Reddy Soma | 467d078 | 2021-08-02 23:20:43 -0600 | [diff] [blame] | 227 | dev_err(dev, ": Internal clock never stabilised.\n"); |
| 228 | return -EBUSY; |
Siva Durga Prasad Paladugu | cad14a8 | 2018-04-19 12:37:09 +0530 | [diff] [blame] | 229 | } |
| 230 | timeout--; |
| 231 | udelay(1000); |
| 232 | } |
| 233 | |
| 234 | clk |= SDHCI_CLOCK_CARD_EN; |
| 235 | sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL); |
Ashok Reddy Soma | 467d078 | 2021-08-02 23:20:43 -0600 | [diff] [blame] | 236 | |
| 237 | return 0; |
Siva Durga Prasad Paladugu | cad14a8 | 2018-04-19 12:37:09 +0530 | [diff] [blame] | 238 | } |
| 239 | |
| 240 | static int arasan_sdhci_execute_tuning(struct mmc *mmc, u8 opcode) |
| 241 | { |
| 242 | struct mmc_cmd cmd; |
| 243 | struct mmc_data data; |
| 244 | u32 ctrl; |
| 245 | struct sdhci_host *host; |
| 246 | struct arasan_sdhci_priv *priv = dev_get_priv(mmc->dev); |
Michal Simek | 91e95ff | 2018-06-13 09:12:29 +0200 | [diff] [blame] | 247 | char tuning_loop_counter = SDHCI_TUNING_LOOP_COUNT; |
Ashok Reddy Soma | 467d078 | 2021-08-02 23:20:43 -0600 | [diff] [blame] | 248 | u8 node_id = priv->deviceid ? NODE_SD_1 : NODE_SD_0; |
Siva Durga Prasad Paladugu | cad14a8 | 2018-04-19 12:37:09 +0530 | [diff] [blame] | 249 | |
Ashok Reddy Soma | ca7d847 | 2022-02-23 15:36:05 +0100 | [diff] [blame^] | 250 | dev_dbg(mmc->dev, "%s\n", __func__); |
Siva Durga Prasad Paladugu | cad14a8 | 2018-04-19 12:37:09 +0530 | [diff] [blame] | 251 | |
| 252 | host = priv->host; |
Siva Durga Prasad Paladugu | cad14a8 | 2018-04-19 12:37:09 +0530 | [diff] [blame] | 253 | |
Faiz Abbas | 2eddc00 | 2019-06-11 00:43:40 +0530 | [diff] [blame] | 254 | ctrl = sdhci_readw(host, SDHCI_HOST_CONTROL2); |
Siva Durga Prasad Paladugu | cad14a8 | 2018-04-19 12:37:09 +0530 | [diff] [blame] | 255 | ctrl |= SDHCI_CTRL_EXEC_TUNING; |
Faiz Abbas | 2eddc00 | 2019-06-11 00:43:40 +0530 | [diff] [blame] | 256 | sdhci_writew(host, ctrl, SDHCI_HOST_CONTROL2); |
Siva Durga Prasad Paladugu | cad14a8 | 2018-04-19 12:37:09 +0530 | [diff] [blame] | 257 | |
| 258 | mdelay(1); |
| 259 | |
Ashok Reddy Soma | 467d078 | 2021-08-02 23:20:43 -0600 | [diff] [blame] | 260 | arasan_zynqmp_dll_reset(host, node_id); |
Siva Durga Prasad Paladugu | cad14a8 | 2018-04-19 12:37:09 +0530 | [diff] [blame] | 261 | |
| 262 | sdhci_writel(host, SDHCI_INT_DATA_AVAIL, SDHCI_INT_ENABLE); |
| 263 | sdhci_writel(host, SDHCI_INT_DATA_AVAIL, SDHCI_SIGNAL_ENABLE); |
| 264 | |
| 265 | do { |
| 266 | cmd.cmdidx = opcode; |
| 267 | cmd.resp_type = MMC_RSP_R1; |
| 268 | cmd.cmdarg = 0; |
| 269 | |
| 270 | data.blocksize = 64; |
| 271 | data.blocks = 1; |
| 272 | data.flags = MMC_DATA_READ; |
| 273 | |
| 274 | if (tuning_loop_counter-- == 0) |
| 275 | break; |
| 276 | |
| 277 | if (cmd.cmdidx == MMC_CMD_SEND_TUNING_BLOCK_HS200 && |
| 278 | mmc->bus_width == 8) |
| 279 | data.blocksize = 128; |
| 280 | |
| 281 | sdhci_writew(host, SDHCI_MAKE_BLKSZ(SDHCI_DEFAULT_BOUNDARY_ARG, |
| 282 | data.blocksize), |
| 283 | SDHCI_BLOCK_SIZE); |
| 284 | sdhci_writew(host, data.blocks, SDHCI_BLOCK_COUNT); |
| 285 | sdhci_writew(host, SDHCI_TRNS_READ, SDHCI_TRANSFER_MODE); |
| 286 | |
| 287 | mmc_send_cmd(mmc, &cmd, NULL); |
Faiz Abbas | 2eddc00 | 2019-06-11 00:43:40 +0530 | [diff] [blame] | 288 | ctrl = sdhci_readw(host, SDHCI_HOST_CONTROL2); |
Siva Durga Prasad Paladugu | cad14a8 | 2018-04-19 12:37:09 +0530 | [diff] [blame] | 289 | |
| 290 | if (cmd.cmdidx == MMC_CMD_SEND_TUNING_BLOCK) |
| 291 | udelay(1); |
| 292 | |
| 293 | } while (ctrl & SDHCI_CTRL_EXEC_TUNING); |
| 294 | |
| 295 | if (tuning_loop_counter < 0) { |
| 296 | ctrl &= ~SDHCI_CTRL_TUNED_CLK; |
Faiz Abbas | 2eddc00 | 2019-06-11 00:43:40 +0530 | [diff] [blame] | 297 | sdhci_writel(host, ctrl, SDHCI_HOST_CONTROL2); |
Siva Durga Prasad Paladugu | cad14a8 | 2018-04-19 12:37:09 +0530 | [diff] [blame] | 298 | } |
| 299 | |
| 300 | if (!(ctrl & SDHCI_CTRL_TUNED_CLK)) { |
| 301 | printf("%s:Tuning failed\n", __func__); |
| 302 | return -1; |
| 303 | } |
| 304 | |
| 305 | udelay(1); |
Ashok Reddy Soma | 467d078 | 2021-08-02 23:20:43 -0600 | [diff] [blame] | 306 | arasan_zynqmp_dll_reset(host, node_id); |
Siva Durga Prasad Paladugu | cad14a8 | 2018-04-19 12:37:09 +0530 | [diff] [blame] | 307 | |
| 308 | /* Enable only interrupts served by the SD controller */ |
| 309 | sdhci_writel(host, SDHCI_INT_DATA_MASK | SDHCI_INT_CMD_MASK, |
| 310 | SDHCI_INT_ENABLE); |
| 311 | /* Mask all sdhci interrupt sources */ |
| 312 | sdhci_writel(host, 0x0, SDHCI_SIGNAL_ENABLE); |
| 313 | |
| 314 | return 0; |
| 315 | } |
| 316 | |
Ashok Reddy Soma | 8f62986 | 2020-10-23 04:59:01 -0600 | [diff] [blame] | 317 | /** |
| 318 | * sdhci_zynqmp_sdcardclk_set_phase - Set the SD Output Clock Tap Delays |
| 319 | * |
Ashok Reddy Soma | 8f62986 | 2020-10-23 04:59:01 -0600 | [diff] [blame] | 320 | * @host: Pointer to the sdhci_host structure. |
| 321 | * @degrees: The clock phase shift between 0 - 359. |
Ashok Reddy Soma | 94a755d | 2021-07-09 05:53:39 -0600 | [diff] [blame] | 322 | * Return: 0 |
Michal Simek | 2a43ab8 | 2021-07-09 05:53:43 -0600 | [diff] [blame] | 323 | * |
| 324 | * Set the SD Output Clock Tap Delays for Output path |
Ashok Reddy Soma | 8f62986 | 2020-10-23 04:59:01 -0600 | [diff] [blame] | 325 | */ |
| 326 | static int sdhci_zynqmp_sdcardclk_set_phase(struct sdhci_host *host, |
| 327 | int degrees) |
| 328 | { |
Ashok Reddy Soma | 8f62986 | 2020-10-23 04:59:01 -0600 | [diff] [blame] | 329 | struct mmc *mmc = (struct mmc *)host->mmc; |
Ashok Reddy Soma | 467d078 | 2021-08-02 23:20:43 -0600 | [diff] [blame] | 330 | struct udevice *dev = mmc->dev; |
| 331 | struct arasan_sdhci_priv *priv = dev_get_priv(mmc->dev); |
| 332 | u8 node_id = priv->deviceid ? NODE_SD_1 : NODE_SD_0; |
Ashok Reddy Soma | 8f62986 | 2020-10-23 04:59:01 -0600 | [diff] [blame] | 333 | u8 tap_delay, tap_max = 0; |
Ashok Reddy Soma | 8f62986 | 2020-10-23 04:59:01 -0600 | [diff] [blame] | 334 | int timing = mode2timing[mmc->selected_mode]; |
Ashok Reddy Soma | 467d078 | 2021-08-02 23:20:43 -0600 | [diff] [blame] | 335 | int ret; |
Ashok Reddy Soma | 8f62986 | 2020-10-23 04:59:01 -0600 | [diff] [blame] | 336 | |
| 337 | /* |
| 338 | * This is applicable for SDHCI_SPEC_300 and above |
| 339 | * ZynqMP does not set phase for <=25MHz clock. |
| 340 | * If degrees is zero, no need to do anything. |
| 341 | */ |
Ashok Reddy Soma | 6f64538 | 2021-07-09 05:53:40 -0600 | [diff] [blame] | 342 | if (SDHCI_GET_VERSION(host) < SDHCI_SPEC_300) |
Ashok Reddy Soma | 8f62986 | 2020-10-23 04:59:01 -0600 | [diff] [blame] | 343 | return 0; |
| 344 | |
| 345 | switch (timing) { |
| 346 | case MMC_TIMING_MMC_HS: |
| 347 | case MMC_TIMING_SD_HS: |
| 348 | case MMC_TIMING_UHS_SDR25: |
| 349 | case MMC_TIMING_UHS_DDR50: |
| 350 | case MMC_TIMING_MMC_DDR52: |
| 351 | /* For 50MHz clock, 30 Taps are available */ |
| 352 | tap_max = 30; |
| 353 | break; |
| 354 | case MMC_TIMING_UHS_SDR50: |
| 355 | /* For 100MHz clock, 15 Taps are available */ |
| 356 | tap_max = 15; |
| 357 | break; |
| 358 | case MMC_TIMING_UHS_SDR104: |
| 359 | case MMC_TIMING_MMC_HS200: |
| 360 | /* For 200MHz clock, 8 Taps are available */ |
| 361 | tap_max = 8; |
| 362 | default: |
| 363 | break; |
| 364 | } |
| 365 | |
| 366 | tap_delay = (degrees * tap_max) / 360; |
| 367 | |
Ashok Reddy Soma | 39a177a | 2021-07-09 05:53:42 -0600 | [diff] [blame] | 368 | /* Limit output tap_delay value to 6 bits */ |
| 369 | tap_delay &= SDHCI_ARASAN_OTAPDLY_SEL_MASK; |
| 370 | |
Ashok Reddy Soma | 467d078 | 2021-08-02 23:20:43 -0600 | [diff] [blame] | 371 | /* Set the Clock Phase */ |
| 372 | ret = arasan_zynqmp_set_out_tapdelay(node_id, tap_delay); |
| 373 | if (ret) { |
| 374 | dev_err(dev, "Error setting output Tap Delay\n"); |
| 375 | return ret; |
| 376 | } |
| 377 | |
| 378 | /* Release DLL Reset */ |
| 379 | ret = zynqmp_dll_reset(node_id, PM_DLL_RESET_RELEASE); |
| 380 | if (ret) { |
| 381 | dev_err(dev, "dll_reset release failed with err: %d\n", ret); |
| 382 | return ret; |
| 383 | } |
Ashok Reddy Soma | 8f62986 | 2020-10-23 04:59:01 -0600 | [diff] [blame] | 384 | |
Ashok Reddy Soma | 94a755d | 2021-07-09 05:53:39 -0600 | [diff] [blame] | 385 | return 0; |
Ashok Reddy Soma | 8f62986 | 2020-10-23 04:59:01 -0600 | [diff] [blame] | 386 | } |
| 387 | |
| 388 | /** |
| 389 | * sdhci_zynqmp_sampleclk_set_phase - Set the SD Input Clock Tap Delays |
| 390 | * |
Ashok Reddy Soma | 8f62986 | 2020-10-23 04:59:01 -0600 | [diff] [blame] | 391 | * @host: Pointer to the sdhci_host structure. |
| 392 | * @degrees: The clock phase shift between 0 - 359. |
Ashok Reddy Soma | 94a755d | 2021-07-09 05:53:39 -0600 | [diff] [blame] | 393 | * Return: 0 |
Michal Simek | 2a43ab8 | 2021-07-09 05:53:43 -0600 | [diff] [blame] | 394 | * |
| 395 | * Set the SD Input Clock Tap Delays for Input path |
Ashok Reddy Soma | 8f62986 | 2020-10-23 04:59:01 -0600 | [diff] [blame] | 396 | */ |
| 397 | static int sdhci_zynqmp_sampleclk_set_phase(struct sdhci_host *host, |
| 398 | int degrees) |
| 399 | { |
Ashok Reddy Soma | 8f62986 | 2020-10-23 04:59:01 -0600 | [diff] [blame] | 400 | struct mmc *mmc = (struct mmc *)host->mmc; |
Ashok Reddy Soma | 467d078 | 2021-08-02 23:20:43 -0600 | [diff] [blame] | 401 | struct udevice *dev = mmc->dev; |
| 402 | struct arasan_sdhci_priv *priv = dev_get_priv(mmc->dev); |
| 403 | u8 node_id = priv->deviceid ? NODE_SD_1 : NODE_SD_0; |
Ashok Reddy Soma | 8f62986 | 2020-10-23 04:59:01 -0600 | [diff] [blame] | 404 | u8 tap_delay, tap_max = 0; |
Ashok Reddy Soma | 8f62986 | 2020-10-23 04:59:01 -0600 | [diff] [blame] | 405 | int timing = mode2timing[mmc->selected_mode]; |
Ashok Reddy Soma | 467d078 | 2021-08-02 23:20:43 -0600 | [diff] [blame] | 406 | int ret; |
Ashok Reddy Soma | 8f62986 | 2020-10-23 04:59:01 -0600 | [diff] [blame] | 407 | |
| 408 | /* |
| 409 | * This is applicable for SDHCI_SPEC_300 and above |
| 410 | * ZynqMP does not set phase for <=25MHz clock. |
| 411 | * If degrees is zero, no need to do anything. |
| 412 | */ |
Ashok Reddy Soma | 6f64538 | 2021-07-09 05:53:40 -0600 | [diff] [blame] | 413 | if (SDHCI_GET_VERSION(host) < SDHCI_SPEC_300) |
Ashok Reddy Soma | 8f62986 | 2020-10-23 04:59:01 -0600 | [diff] [blame] | 414 | return 0; |
| 415 | |
Ashok Reddy Soma | 467d078 | 2021-08-02 23:20:43 -0600 | [diff] [blame] | 416 | /* Assert DLL Reset */ |
| 417 | ret = zynqmp_dll_reset(node_id, PM_DLL_RESET_ASSERT); |
| 418 | if (ret) { |
| 419 | dev_err(dev, "dll_reset assert failed with err: %d\n", ret); |
| 420 | return ret; |
| 421 | } |
| 422 | |
Ashok Reddy Soma | 8f62986 | 2020-10-23 04:59:01 -0600 | [diff] [blame] | 423 | switch (timing) { |
| 424 | case MMC_TIMING_MMC_HS: |
| 425 | case MMC_TIMING_SD_HS: |
| 426 | case MMC_TIMING_UHS_SDR25: |
| 427 | case MMC_TIMING_UHS_DDR50: |
| 428 | case MMC_TIMING_MMC_DDR52: |
| 429 | /* For 50MHz clock, 120 Taps are available */ |
| 430 | tap_max = 120; |
| 431 | break; |
| 432 | case MMC_TIMING_UHS_SDR50: |
| 433 | /* For 100MHz clock, 60 Taps are available */ |
| 434 | tap_max = 60; |
| 435 | break; |
| 436 | case MMC_TIMING_UHS_SDR104: |
| 437 | case MMC_TIMING_MMC_HS200: |
| 438 | /* For 200MHz clock, 30 Taps are available */ |
| 439 | tap_max = 30; |
| 440 | default: |
| 441 | break; |
| 442 | } |
| 443 | |
| 444 | tap_delay = (degrees * tap_max) / 360; |
| 445 | |
Ashok Reddy Soma | 39a177a | 2021-07-09 05:53:42 -0600 | [diff] [blame] | 446 | /* Limit input tap_delay value to 8 bits */ |
| 447 | tap_delay &= SDHCI_ARASAN_ITAPDLY_SEL_MASK; |
| 448 | |
Ashok Reddy Soma | 467d078 | 2021-08-02 23:20:43 -0600 | [diff] [blame] | 449 | ret = arasan_zynqmp_set_in_tapdelay(node_id, tap_delay); |
| 450 | if (ret) { |
| 451 | dev_err(dev, "Error setting Input Tap Delay\n"); |
| 452 | return ret; |
| 453 | } |
Ashok Reddy Soma | 8f62986 | 2020-10-23 04:59:01 -0600 | [diff] [blame] | 454 | |
Ashok Reddy Soma | 94a755d | 2021-07-09 05:53:39 -0600 | [diff] [blame] | 455 | return 0; |
Ashok Reddy Soma | 8f62986 | 2020-10-23 04:59:01 -0600 | [diff] [blame] | 456 | } |
| 457 | |
Ashok Reddy Soma | 568edfd | 2020-10-23 04:59:02 -0600 | [diff] [blame] | 458 | /** |
| 459 | * sdhci_versal_sdcardclk_set_phase - Set the SD Output Clock Tap Delays |
| 460 | * |
Ashok Reddy Soma | 568edfd | 2020-10-23 04:59:02 -0600 | [diff] [blame] | 461 | * @host: Pointer to the sdhci_host structure. |
Michal Simek | 2a43ab8 | 2021-07-09 05:53:43 -0600 | [diff] [blame] | 462 | * @degrees: The clock phase shift between 0 - 359. |
Ashok Reddy Soma | 94a755d | 2021-07-09 05:53:39 -0600 | [diff] [blame] | 463 | * Return: 0 |
Michal Simek | 2a43ab8 | 2021-07-09 05:53:43 -0600 | [diff] [blame] | 464 | * |
| 465 | * Set the SD Output Clock Tap Delays for Output path |
Ashok Reddy Soma | 568edfd | 2020-10-23 04:59:02 -0600 | [diff] [blame] | 466 | */ |
| 467 | static int sdhci_versal_sdcardclk_set_phase(struct sdhci_host *host, |
| 468 | int degrees) |
| 469 | { |
| 470 | struct mmc *mmc = (struct mmc *)host->mmc; |
| 471 | u8 tap_delay, tap_max = 0; |
Ashok Reddy Soma | 568edfd | 2020-10-23 04:59:02 -0600 | [diff] [blame] | 472 | int timing = mode2timing[mmc->selected_mode]; |
Ashok Reddy Soma | 24a5107 | 2021-07-09 05:53:41 -0600 | [diff] [blame] | 473 | u32 regval; |
Ashok Reddy Soma | 568edfd | 2020-10-23 04:59:02 -0600 | [diff] [blame] | 474 | |
| 475 | /* |
| 476 | * This is applicable for SDHCI_SPEC_300 and above |
| 477 | * Versal does not set phase for <=25MHz clock. |
| 478 | * If degrees is zero, no need to do anything. |
| 479 | */ |
Ashok Reddy Soma | 6f64538 | 2021-07-09 05:53:40 -0600 | [diff] [blame] | 480 | if (SDHCI_GET_VERSION(host) < SDHCI_SPEC_300) |
Ashok Reddy Soma | 568edfd | 2020-10-23 04:59:02 -0600 | [diff] [blame] | 481 | return 0; |
| 482 | |
| 483 | switch (timing) { |
| 484 | case MMC_TIMING_MMC_HS: |
| 485 | case MMC_TIMING_SD_HS: |
| 486 | case MMC_TIMING_UHS_SDR25: |
| 487 | case MMC_TIMING_UHS_DDR50: |
| 488 | case MMC_TIMING_MMC_DDR52: |
| 489 | /* For 50MHz clock, 30 Taps are available */ |
| 490 | tap_max = 30; |
| 491 | break; |
| 492 | case MMC_TIMING_UHS_SDR50: |
| 493 | /* For 100MHz clock, 15 Taps are available */ |
| 494 | tap_max = 15; |
| 495 | break; |
| 496 | case MMC_TIMING_UHS_SDR104: |
| 497 | case MMC_TIMING_MMC_HS200: |
| 498 | /* For 200MHz clock, 8 Taps are available */ |
| 499 | tap_max = 8; |
| 500 | default: |
| 501 | break; |
| 502 | } |
| 503 | |
| 504 | tap_delay = (degrees * tap_max) / 360; |
| 505 | |
Ashok Reddy Soma | 24a5107 | 2021-07-09 05:53:41 -0600 | [diff] [blame] | 506 | /* Limit output tap_delay value to 6 bits */ |
| 507 | tap_delay &= SDHCI_ARASAN_OTAPDLY_SEL_MASK; |
Ashok Reddy Soma | 568edfd | 2020-10-23 04:59:02 -0600 | [diff] [blame] | 508 | |
Ashok Reddy Soma | 24a5107 | 2021-07-09 05:53:41 -0600 | [diff] [blame] | 509 | /* Set the Clock Phase */ |
| 510 | regval = sdhci_readl(host, SDHCI_ARASAN_OTAPDLY_REGISTER); |
| 511 | regval |= SDHCI_OTAPDLY_ENABLE; |
| 512 | sdhci_writel(host, regval, SDHCI_ARASAN_OTAPDLY_REGISTER); |
| 513 | regval &= ~SDHCI_ARASAN_OTAPDLY_SEL_MASK; |
| 514 | regval |= tap_delay; |
| 515 | sdhci_writel(host, regval, SDHCI_ARASAN_OTAPDLY_REGISTER); |
Ashok Reddy Soma | 568edfd | 2020-10-23 04:59:02 -0600 | [diff] [blame] | 516 | |
Ashok Reddy Soma | 94a755d | 2021-07-09 05:53:39 -0600 | [diff] [blame] | 517 | return 0; |
Ashok Reddy Soma | 568edfd | 2020-10-23 04:59:02 -0600 | [diff] [blame] | 518 | } |
| 519 | |
| 520 | /** |
| 521 | * sdhci_versal_sampleclk_set_phase - Set the SD Input Clock Tap Delays |
| 522 | * |
Ashok Reddy Soma | 568edfd | 2020-10-23 04:59:02 -0600 | [diff] [blame] | 523 | * @host: Pointer to the sdhci_host structure. |
Michal Simek | 2a43ab8 | 2021-07-09 05:53:43 -0600 | [diff] [blame] | 524 | * @degrees: The clock phase shift between 0 - 359. |
Ashok Reddy Soma | 94a755d | 2021-07-09 05:53:39 -0600 | [diff] [blame] | 525 | * Return: 0 |
Michal Simek | 2a43ab8 | 2021-07-09 05:53:43 -0600 | [diff] [blame] | 526 | * |
| 527 | * Set the SD Input Clock Tap Delays for Input path |
Ashok Reddy Soma | 568edfd | 2020-10-23 04:59:02 -0600 | [diff] [blame] | 528 | */ |
| 529 | static int sdhci_versal_sampleclk_set_phase(struct sdhci_host *host, |
| 530 | int degrees) |
| 531 | { |
| 532 | struct mmc *mmc = (struct mmc *)host->mmc; |
| 533 | u8 tap_delay, tap_max = 0; |
Ashok Reddy Soma | 568edfd | 2020-10-23 04:59:02 -0600 | [diff] [blame] | 534 | int timing = mode2timing[mmc->selected_mode]; |
Ashok Reddy Soma | 24a5107 | 2021-07-09 05:53:41 -0600 | [diff] [blame] | 535 | u32 regval; |
Ashok Reddy Soma | 568edfd | 2020-10-23 04:59:02 -0600 | [diff] [blame] | 536 | |
| 537 | /* |
| 538 | * This is applicable for SDHCI_SPEC_300 and above |
| 539 | * Versal does not set phase for <=25MHz clock. |
| 540 | * If degrees is zero, no need to do anything. |
| 541 | */ |
Ashok Reddy Soma | 6f64538 | 2021-07-09 05:53:40 -0600 | [diff] [blame] | 542 | if (SDHCI_GET_VERSION(host) < SDHCI_SPEC_300) |
Ashok Reddy Soma | 568edfd | 2020-10-23 04:59:02 -0600 | [diff] [blame] | 543 | return 0; |
| 544 | |
| 545 | switch (timing) { |
| 546 | case MMC_TIMING_MMC_HS: |
| 547 | case MMC_TIMING_SD_HS: |
| 548 | case MMC_TIMING_UHS_SDR25: |
| 549 | case MMC_TIMING_UHS_DDR50: |
| 550 | case MMC_TIMING_MMC_DDR52: |
| 551 | /* For 50MHz clock, 120 Taps are available */ |
| 552 | tap_max = 120; |
| 553 | break; |
| 554 | case MMC_TIMING_UHS_SDR50: |
| 555 | /* For 100MHz clock, 60 Taps are available */ |
| 556 | tap_max = 60; |
| 557 | break; |
| 558 | case MMC_TIMING_UHS_SDR104: |
| 559 | case MMC_TIMING_MMC_HS200: |
| 560 | /* For 200MHz clock, 30 Taps are available */ |
| 561 | tap_max = 30; |
| 562 | default: |
| 563 | break; |
| 564 | } |
| 565 | |
| 566 | tap_delay = (degrees * tap_max) / 360; |
| 567 | |
Ashok Reddy Soma | 24a5107 | 2021-07-09 05:53:41 -0600 | [diff] [blame] | 568 | /* Limit input tap_delay value to 8 bits */ |
| 569 | tap_delay &= SDHCI_ARASAN_ITAPDLY_SEL_MASK; |
Ashok Reddy Soma | 568edfd | 2020-10-23 04:59:02 -0600 | [diff] [blame] | 570 | |
Ashok Reddy Soma | 24a5107 | 2021-07-09 05:53:41 -0600 | [diff] [blame] | 571 | /* Set the Clock Phase */ |
| 572 | regval = sdhci_readl(host, SDHCI_ARASAN_ITAPDLY_REGISTER); |
| 573 | regval |= SDHCI_ITAPDLY_CHGWIN; |
| 574 | sdhci_writel(host, regval, SDHCI_ARASAN_ITAPDLY_REGISTER); |
| 575 | regval |= SDHCI_ITAPDLY_ENABLE; |
| 576 | sdhci_writel(host, regval, SDHCI_ARASAN_ITAPDLY_REGISTER); |
| 577 | regval &= ~SDHCI_ARASAN_ITAPDLY_SEL_MASK; |
| 578 | regval |= tap_delay; |
| 579 | sdhci_writel(host, regval, SDHCI_ARASAN_ITAPDLY_REGISTER); |
| 580 | regval &= ~SDHCI_ITAPDLY_CHGWIN; |
| 581 | sdhci_writel(host, regval, SDHCI_ARASAN_ITAPDLY_REGISTER); |
Ashok Reddy Soma | 568edfd | 2020-10-23 04:59:02 -0600 | [diff] [blame] | 582 | |
Ashok Reddy Soma | 94a755d | 2021-07-09 05:53:39 -0600 | [diff] [blame] | 583 | return 0; |
Ashok Reddy Soma | 568edfd | 2020-10-23 04:59:02 -0600 | [diff] [blame] | 584 | } |
| 585 | |
Ashok Reddy Soma | 21fd763 | 2021-08-02 23:20:40 -0600 | [diff] [blame] | 586 | static int arasan_sdhci_set_tapdelay(struct sdhci_host *host) |
Siva Durga Prasad Paladugu | cad14a8 | 2018-04-19 12:37:09 +0530 | [diff] [blame] | 587 | { |
| 588 | struct arasan_sdhci_priv *priv = dev_get_priv(host->mmc->dev); |
Ashok Reddy Soma | 8f62986 | 2020-10-23 04:59:01 -0600 | [diff] [blame] | 589 | struct arasan_sdhci_clk_data *clk_data = &priv->clk_data; |
Siva Durga Prasad Paladugu | cad14a8 | 2018-04-19 12:37:09 +0530 | [diff] [blame] | 590 | struct mmc *mmc = (struct mmc *)host->mmc; |
Ashok Reddy Soma | 8f62986 | 2020-10-23 04:59:01 -0600 | [diff] [blame] | 591 | struct udevice *dev = mmc->dev; |
| 592 | u8 timing = mode2timing[mmc->selected_mode]; |
| 593 | u32 iclk_phase = clk_data->clk_phase_in[timing]; |
| 594 | u32 oclk_phase = clk_data->clk_phase_out[timing]; |
Ashok Reddy Soma | 21fd763 | 2021-08-02 23:20:40 -0600 | [diff] [blame] | 595 | int ret; |
Siva Durga Prasad Paladugu | cad14a8 | 2018-04-19 12:37:09 +0530 | [diff] [blame] | 596 | |
Ashok Reddy Soma | 8f62986 | 2020-10-23 04:59:01 -0600 | [diff] [blame] | 597 | dev_dbg(dev, "%s, host:%s, mode:%d\n", __func__, host->name, timing); |
Siva Durga Prasad Paladugu | cad14a8 | 2018-04-19 12:37:09 +0530 | [diff] [blame] | 598 | |
Ashok Reddy Soma | 8f62986 | 2020-10-23 04:59:01 -0600 | [diff] [blame] | 599 | if (IS_ENABLED(CONFIG_ARCH_ZYNQMP) && |
| 600 | device_is_compatible(dev, "xlnx,zynqmp-8.9a")) { |
Ashok Reddy Soma | 21fd763 | 2021-08-02 23:20:40 -0600 | [diff] [blame] | 601 | ret = sdhci_zynqmp_sampleclk_set_phase(host, iclk_phase); |
| 602 | if (ret) |
| 603 | return ret; |
| 604 | |
| 605 | ret = sdhci_zynqmp_sdcardclk_set_phase(host, oclk_phase); |
| 606 | if (ret) |
| 607 | return ret; |
Ashok Reddy Soma | 568edfd | 2020-10-23 04:59:02 -0600 | [diff] [blame] | 608 | } else if (IS_ENABLED(CONFIG_ARCH_VERSAL) && |
| 609 | device_is_compatible(dev, "xlnx,versal-8.9a")) { |
Ashok Reddy Soma | 21fd763 | 2021-08-02 23:20:40 -0600 | [diff] [blame] | 610 | ret = sdhci_versal_sampleclk_set_phase(host, iclk_phase); |
| 611 | if (ret) |
| 612 | return ret; |
| 613 | |
| 614 | ret = sdhci_versal_sdcardclk_set_phase(host, oclk_phase); |
| 615 | if (ret) |
| 616 | return ret; |
Ashok Reddy Soma | 8f62986 | 2020-10-23 04:59:01 -0600 | [diff] [blame] | 617 | } |
Ashok Reddy Soma | 21fd763 | 2021-08-02 23:20:40 -0600 | [diff] [blame] | 618 | |
| 619 | return 0; |
Siva Durga Prasad Paladugu | cad14a8 | 2018-04-19 12:37:09 +0530 | [diff] [blame] | 620 | } |
| 621 | |
Michal Simek | 33a6b77 | 2020-10-23 04:59:00 -0600 | [diff] [blame] | 622 | static void arasan_dt_read_clk_phase(struct udevice *dev, unsigned char timing, |
| 623 | const char *prop) |
| 624 | { |
| 625 | struct arasan_sdhci_priv *priv = dev_get_priv(dev); |
| 626 | struct arasan_sdhci_clk_data *clk_data = &priv->clk_data; |
| 627 | u32 clk_phase[2] = {0}; |
| 628 | |
| 629 | /* |
| 630 | * Read Tap Delay values from DT, if the DT does not contain the |
| 631 | * Tap Values then use the pre-defined values |
| 632 | */ |
| 633 | if (dev_read_u32_array(dev, prop, &clk_phase[0], 2)) { |
| 634 | dev_dbg(dev, "Using predefined clock phase for %s = %d %d\n", |
| 635 | prop, clk_data->clk_phase_in[timing], |
| 636 | clk_data->clk_phase_out[timing]); |
| 637 | return; |
| 638 | } |
| 639 | |
| 640 | /* The values read are Input and Output Clock Delays in order */ |
| 641 | clk_data->clk_phase_in[timing] = clk_phase[0]; |
| 642 | clk_data->clk_phase_out[timing] = clk_phase[1]; |
| 643 | } |
| 644 | |
| 645 | /** |
| 646 | * arasan_dt_parse_clk_phases - Read Tap Delay values from DT |
| 647 | * |
Michal Simek | 33a6b77 | 2020-10-23 04:59:00 -0600 | [diff] [blame] | 648 | * @dev: Pointer to our struct udevice. |
Michal Simek | 2a43ab8 | 2021-07-09 05:53:43 -0600 | [diff] [blame] | 649 | * |
| 650 | * Called at initialization to parse the values of Tap Delays. |
Michal Simek | 33a6b77 | 2020-10-23 04:59:00 -0600 | [diff] [blame] | 651 | */ |
| 652 | static void arasan_dt_parse_clk_phases(struct udevice *dev) |
| 653 | { |
| 654 | struct arasan_sdhci_priv *priv = dev_get_priv(dev); |
| 655 | struct arasan_sdhci_clk_data *clk_data = &priv->clk_data; |
| 656 | int i; |
| 657 | |
| 658 | if (IS_ENABLED(CONFIG_ARCH_ZYNQMP) && |
| 659 | device_is_compatible(dev, "xlnx,zynqmp-8.9a")) { |
| 660 | for (i = 0; i <= MMC_TIMING_MMC_HS400; i++) { |
| 661 | clk_data->clk_phase_in[i] = zynqmp_iclk_phases[i]; |
| 662 | clk_data->clk_phase_out[i] = zynqmp_oclk_phases[i]; |
| 663 | } |
| 664 | |
| 665 | if (priv->bank == MMC_BANK2) { |
| 666 | clk_data->clk_phase_out[MMC_TIMING_UHS_SDR104] = 90; |
| 667 | clk_data->clk_phase_out[MMC_TIMING_MMC_HS200] = 90; |
| 668 | } |
| 669 | } |
| 670 | |
Ashok Reddy Soma | 568edfd | 2020-10-23 04:59:02 -0600 | [diff] [blame] | 671 | if (IS_ENABLED(CONFIG_ARCH_VERSAL) && |
| 672 | device_is_compatible(dev, "xlnx,versal-8.9a")) { |
| 673 | for (i = 0; i <= MMC_TIMING_MMC_HS400; i++) { |
| 674 | clk_data->clk_phase_in[i] = versal_iclk_phases[i]; |
| 675 | clk_data->clk_phase_out[i] = versal_oclk_phases[i]; |
| 676 | } |
| 677 | } |
| 678 | |
Michal Simek | 33a6b77 | 2020-10-23 04:59:00 -0600 | [diff] [blame] | 679 | arasan_dt_read_clk_phase(dev, MMC_TIMING_LEGACY, |
| 680 | "clk-phase-legacy"); |
| 681 | arasan_dt_read_clk_phase(dev, MMC_TIMING_MMC_HS, |
| 682 | "clk-phase-mmc-hs"); |
| 683 | arasan_dt_read_clk_phase(dev, MMC_TIMING_SD_HS, |
| 684 | "clk-phase-sd-hs"); |
| 685 | arasan_dt_read_clk_phase(dev, MMC_TIMING_UHS_SDR12, |
| 686 | "clk-phase-uhs-sdr12"); |
| 687 | arasan_dt_read_clk_phase(dev, MMC_TIMING_UHS_SDR25, |
| 688 | "clk-phase-uhs-sdr25"); |
| 689 | arasan_dt_read_clk_phase(dev, MMC_TIMING_UHS_SDR50, |
| 690 | "clk-phase-uhs-sdr50"); |
| 691 | arasan_dt_read_clk_phase(dev, MMC_TIMING_UHS_SDR104, |
| 692 | "clk-phase-uhs-sdr104"); |
| 693 | arasan_dt_read_clk_phase(dev, MMC_TIMING_UHS_DDR50, |
| 694 | "clk-phase-uhs-ddr50"); |
| 695 | arasan_dt_read_clk_phase(dev, MMC_TIMING_MMC_DDR52, |
| 696 | "clk-phase-mmc-ddr52"); |
| 697 | arasan_dt_read_clk_phase(dev, MMC_TIMING_MMC_HS200, |
| 698 | "clk-phase-mmc-hs200"); |
| 699 | arasan_dt_read_clk_phase(dev, MMC_TIMING_MMC_HS400, |
| 700 | "clk-phase-mmc-hs400"); |
| 701 | } |
| 702 | |
Michal Simek | 635cf4a | 2021-07-09 05:53:44 -0600 | [diff] [blame] | 703 | static const struct sdhci_ops arasan_ops = { |
| 704 | .platform_execute_tuning = &arasan_sdhci_execute_tuning, |
Siva Durga Prasad Paladugu | cad14a8 | 2018-04-19 12:37:09 +0530 | [diff] [blame] | 705 | .set_delay = &arasan_sdhci_set_tapdelay, |
Ashok Reddy Soma | 8ee49f0 | 2021-08-02 23:20:46 -0600 | [diff] [blame] | 706 | .set_control_reg = &sdhci_set_control_reg, |
Siva Durga Prasad Paladugu | cad14a8 | 2018-04-19 12:37:09 +0530 | [diff] [blame] | 707 | }; |
| 708 | #endif |
| 709 | |
Ashok Reddy Soma | ca7d847 | 2022-02-23 15:36:05 +0100 | [diff] [blame^] | 710 | #if defined(CONFIG_ARCH_ZYNQMP) |
| 711 | static int sdhci_zynqmp_set_dynamic_config(struct arasan_sdhci_priv *priv, |
| 712 | struct udevice *dev) |
| 713 | { |
| 714 | int ret; |
| 715 | u32 node_id = priv->deviceid ? NODE_SD_1 : NODE_SD_0; |
| 716 | struct clk clk; |
| 717 | unsigned long clock, mhz; |
| 718 | |
| 719 | ret = xilinx_pm_request(PM_REQUEST_NODE, node_id, ZYNQMP_PM_CAPABILITY_ACCESS, |
| 720 | ZYNQMP_PM_MAX_QOS, ZYNQMP_PM_REQUEST_ACK_NO, NULL); |
| 721 | if (ret) { |
| 722 | dev_err(dev, "Request node failed for %d\n", node_id); |
| 723 | return ret; |
| 724 | } |
| 725 | |
| 726 | ret = reset_get_bulk(dev, &priv->resets); |
| 727 | if (ret == -ENOTSUPP || ret == -ENOENT) { |
| 728 | dev_err(dev, "Reset not found\n"); |
| 729 | return 0; |
| 730 | } else if (ret) { |
| 731 | dev_err(dev, "Reset failed\n"); |
| 732 | return ret; |
| 733 | } |
| 734 | |
| 735 | ret = reset_assert_bulk(&priv->resets); |
| 736 | if (ret) { |
| 737 | dev_err(dev, "Reset assert failed\n"); |
| 738 | return ret; |
| 739 | } |
| 740 | |
| 741 | ret = zynqmp_pm_set_sd_config(node_id, SD_CONFIG_FIXED, 0); |
| 742 | if (ret) { |
| 743 | dev_err(dev, "SD_CONFIG_FIXED failed\n"); |
| 744 | return ret; |
| 745 | } |
| 746 | |
| 747 | ret = zynqmp_pm_set_sd_config(node_id, SD_CONFIG_EMMC_SEL, |
| 748 | dev_read_bool(dev, "non-removable")); |
| 749 | if (ret) { |
| 750 | dev_err(dev, "SD_CONFIG_EMMC_SEL failed\n"); |
| 751 | return ret; |
| 752 | } |
| 753 | |
| 754 | ret = clk_get_by_index(dev, 0, &clk); |
| 755 | if (ret < 0) { |
| 756 | dev_err(dev, "failed to get clock\n"); |
| 757 | return ret; |
| 758 | } |
| 759 | |
| 760 | clock = clk_get_rate(&clk); |
| 761 | if (IS_ERR_VALUE(clock)) { |
| 762 | dev_err(dev, "failed to get rate\n"); |
| 763 | return clock; |
| 764 | } |
| 765 | |
| 766 | mhz = DIV64_U64_ROUND_UP(clock, 1000000); |
| 767 | |
| 768 | ret = zynqmp_pm_set_sd_config(node_id, SD_CONFIG_BASECLK, mhz); |
| 769 | if (ret) { |
| 770 | dev_err(dev, "SD_CONFIG_BASECLK failed\n"); |
| 771 | return ret; |
| 772 | } |
| 773 | |
| 774 | ret = zynqmp_pm_set_sd_config(node_id, SD_CONFIG_8BIT, |
| 775 | (dev_read_u32_default(dev, "bus-width", 1) == 8)); |
| 776 | if (ret) { |
| 777 | dev_err(dev, "SD_CONFIG_8BIT failed\n"); |
| 778 | return ret; |
| 779 | } |
| 780 | |
| 781 | ret = reset_deassert_bulk(&priv->resets); |
| 782 | if (ret) { |
| 783 | dev_err(dev, "Reset release failed\n"); |
| 784 | return ret; |
| 785 | } |
| 786 | |
| 787 | return 0; |
| 788 | } |
| 789 | #endif |
| 790 | |
Michal Simek | 9ecd268 | 2015-11-30 16:13:03 +0100 | [diff] [blame] | 791 | static int arasan_sdhci_probe(struct udevice *dev) |
Michal Simek | 0dd222b | 2013-04-22 14:56:49 +0200 | [diff] [blame] | 792 | { |
Simon Glass | fa20e93 | 2020-12-03 16:55:20 -0700 | [diff] [blame] | 793 | struct arasan_sdhci_plat *plat = dev_get_plat(dev); |
Michal Simek | 9ecd268 | 2015-11-30 16:13:03 +0100 | [diff] [blame] | 794 | struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); |
Siva Durga Prasad Paladugu | cad14a8 | 2018-04-19 12:37:09 +0530 | [diff] [blame] | 795 | struct arasan_sdhci_priv *priv = dev_get_priv(dev); |
| 796 | struct sdhci_host *host; |
Stefan Herbrechtsmeier | 739ae40 | 2017-01-17 16:27:32 +0100 | [diff] [blame] | 797 | struct clk clk; |
| 798 | unsigned long clock; |
Simon Glass | 4cc87fb | 2016-07-05 17:10:15 -0600 | [diff] [blame] | 799 | int ret; |
Michal Simek | 0dd222b | 2013-04-22 14:56:49 +0200 | [diff] [blame] | 800 | |
Siva Durga Prasad Paladugu | cad14a8 | 2018-04-19 12:37:09 +0530 | [diff] [blame] | 801 | host = priv->host; |
| 802 | |
Ashok Reddy Soma | ca7d847 | 2022-02-23 15:36:05 +0100 | [diff] [blame^] | 803 | #if defined(CONFIG_ARCH_ZYNQMP) |
| 804 | if (device_is_compatible(dev, "xlnx,zynqmp-8.9a")) { |
| 805 | ret = zynqmp_pm_is_function_supported(PM_IOCTL, |
| 806 | IOCTL_SET_SD_CONFIG); |
| 807 | if (!ret) { |
| 808 | ret = sdhci_zynqmp_set_dynamic_config(priv, dev); |
| 809 | if (ret) |
| 810 | return ret; |
| 811 | } |
| 812 | } |
| 813 | #endif |
| 814 | |
Stefan Herbrechtsmeier | 739ae40 | 2017-01-17 16:27:32 +0100 | [diff] [blame] | 815 | ret = clk_get_by_index(dev, 0, &clk); |
| 816 | if (ret < 0) { |
| 817 | dev_err(dev, "failed to get clock\n"); |
| 818 | return ret; |
| 819 | } |
| 820 | |
| 821 | clock = clk_get_rate(&clk); |
| 822 | if (IS_ERR_VALUE(clock)) { |
| 823 | dev_err(dev, "failed to get rate\n"); |
| 824 | return clock; |
| 825 | } |
Siva Durga Prasad Paladugu | cad14a8 | 2018-04-19 12:37:09 +0530 | [diff] [blame] | 826 | |
Ashok Reddy Soma | ca7d847 | 2022-02-23 15:36:05 +0100 | [diff] [blame^] | 827 | dev_dbg(dev, "%s: CLK %ld\n", __func__, clock); |
Stefan Herbrechtsmeier | 739ae40 | 2017-01-17 16:27:32 +0100 | [diff] [blame] | 828 | |
| 829 | ret = clk_enable(&clk); |
Michal Simek | 4171095 | 2021-02-09 15:28:15 +0100 | [diff] [blame] | 830 | if (ret) { |
Stefan Herbrechtsmeier | 739ae40 | 2017-01-17 16:27:32 +0100 | [diff] [blame] | 831 | dev_err(dev, "failed to enable clock\n"); |
| 832 | return ret; |
| 833 | } |
| 834 | |
Siva Durga Prasad Paladugu | 049e003 | 2014-07-08 15:31:04 +0530 | [diff] [blame] | 835 | host->quirks = SDHCI_QUIRK_WAIT_SEND_CMD | |
Siva Durga Prasad Paladugu | 0d6891b | 2014-01-22 09:17:09 +0100 | [diff] [blame] | 836 | SDHCI_QUIRK_BROKEN_R1B; |
Siva Durga Prasad Paladugu | a1619fe | 2016-01-12 15:12:16 +0530 | [diff] [blame] | 837 | |
| 838 | #ifdef CONFIG_ZYNQ_HISPD_BROKEN |
Hannes Schmelzer | 94a5bbc | 2018-03-07 08:00:57 +0100 | [diff] [blame] | 839 | host->quirks |= SDHCI_QUIRK_BROKEN_HISPD_MODE; |
Siva Durga Prasad Paladugu | a1619fe | 2016-01-12 15:12:16 +0530 | [diff] [blame] | 840 | #endif |
| 841 | |
Ashok Reddy Soma | 61e0df9 | 2020-10-23 04:58:57 -0600 | [diff] [blame] | 842 | if (priv->no_1p8) |
| 843 | host->quirks |= SDHCI_QUIRK_NO_1_8_V; |
| 844 | |
Benedikt Grassl | 529e6f0 | 2020-04-14 07:32:12 +0200 | [diff] [blame] | 845 | plat->cfg.f_max = CONFIG_ZYNQ_SDHCI_MAX_FREQ; |
| 846 | |
| 847 | ret = mmc_of_parse(dev, &plat->cfg); |
| 848 | if (ret) |
| 849 | return ret; |
Siva Durga Prasad Paladugu | cad14a8 | 2018-04-19 12:37:09 +0530 | [diff] [blame] | 850 | |
Stefan Herbrechtsmeier | 739ae40 | 2017-01-17 16:27:32 +0100 | [diff] [blame] | 851 | host->max_clk = clock; |
Stefan Herbrechtsmeier | bc47e0e | 2017-01-17 15:58:48 +0100 | [diff] [blame] | 852 | |
Matwey V. Kornilov | 194b860 | 2019-08-01 18:00:05 +0300 | [diff] [blame] | 853 | host->mmc = &plat->mmc; |
| 854 | host->mmc->dev = dev; |
| 855 | host->mmc->priv = host; |
| 856 | |
Benedikt Grassl | 529e6f0 | 2020-04-14 07:32:12 +0200 | [diff] [blame] | 857 | ret = sdhci_setup_cfg(&plat->cfg, host, plat->cfg.f_max, |
Jaehoon Chung | 8a5ffbb | 2016-07-26 19:06:24 +0900 | [diff] [blame] | 858 | CONFIG_ZYNQ_SDHCI_MIN_FREQ); |
Simon Glass | 4cc87fb | 2016-07-05 17:10:15 -0600 | [diff] [blame] | 859 | if (ret) |
| 860 | return ret; |
Simon Glass | 4cc87fb | 2016-07-05 17:10:15 -0600 | [diff] [blame] | 861 | upriv->mmc = host->mmc; |
Michal Simek | 9ecd268 | 2015-11-30 16:13:03 +0100 | [diff] [blame] | 862 | |
T Karthik Reddy | ab0a749 | 2021-08-02 23:20:45 -0600 | [diff] [blame] | 863 | /* |
| 864 | * WORKAROUND: Versal platforms have an issue with card detect state. |
| 865 | * Due to this, host controller is switching off voltage to sd card |
| 866 | * causing sd card timeout error. Workaround this by adding a wait for |
| 867 | * 1000msec till the card detect state gets stable. |
| 868 | */ |
Ashok Reddy Soma | 6556bff | 2022-02-23 15:13:32 +0100 | [diff] [blame] | 869 | if (IS_ENABLED(CONFIG_ARCH_ZYNQMP) || IS_ENABLED(CONFIG_ARCH_VERSAL)) { |
Ashok Reddy Soma | dd74577 | 2022-02-23 15:13:31 +0100 | [diff] [blame] | 870 | u32 timeout = 1000000; |
T Karthik Reddy | ab0a749 | 2021-08-02 23:20:45 -0600 | [diff] [blame] | 871 | |
| 872 | while (((sdhci_readl(host, SDHCI_PRESENT_STATE) & |
Ashok Reddy Soma | 09f3890 | 2022-02-23 15:13:30 +0100 | [diff] [blame] | 873 | SDHCI_CARD_STATE_STABLE) == 0) && timeout) { |
Ashok Reddy Soma | dd74577 | 2022-02-23 15:13:31 +0100 | [diff] [blame] | 874 | udelay(1); |
Ashok Reddy Soma | 09f3890 | 2022-02-23 15:13:30 +0100 | [diff] [blame] | 875 | timeout--; |
T Karthik Reddy | ab0a749 | 2021-08-02 23:20:45 -0600 | [diff] [blame] | 876 | } |
| 877 | if (!timeout) { |
| 878 | dev_err(dev, "Sdhci card detect state not stable\n"); |
| 879 | return -ETIMEDOUT; |
| 880 | } |
| 881 | } |
| 882 | |
Simon Glass | 4cc87fb | 2016-07-05 17:10:15 -0600 | [diff] [blame] | 883 | return sdhci_probe(dev); |
Michal Simek | 0dd222b | 2013-04-22 14:56:49 +0200 | [diff] [blame] | 884 | } |
Michal Simek | 9ecd268 | 2015-11-30 16:13:03 +0100 | [diff] [blame] | 885 | |
Simon Glass | aad29ae | 2020-12-03 16:55:21 -0700 | [diff] [blame] | 886 | static int arasan_sdhci_of_to_plat(struct udevice *dev) |
Michal Simek | 9ecd268 | 2015-11-30 16:13:03 +0100 | [diff] [blame] | 887 | { |
Siva Durga Prasad Paladugu | cad14a8 | 2018-04-19 12:37:09 +0530 | [diff] [blame] | 888 | struct arasan_sdhci_priv *priv = dev_get_priv(dev); |
Michal Simek | 9ecd268 | 2015-11-30 16:13:03 +0100 | [diff] [blame] | 889 | |
Siva Durga Prasad Paladugu | cad14a8 | 2018-04-19 12:37:09 +0530 | [diff] [blame] | 890 | priv->host = calloc(1, sizeof(struct sdhci_host)); |
| 891 | if (!priv->host) |
| 892 | return -1; |
| 893 | |
| 894 | priv->host->name = dev->name; |
Siva Durga Prasad Paladugu | cad14a8 | 2018-04-19 12:37:09 +0530 | [diff] [blame] | 895 | |
Ashok Reddy Soma | 568edfd | 2020-10-23 04:59:02 -0600 | [diff] [blame] | 896 | #if defined(CONFIG_ARCH_ZYNQMP) || defined(CONFIG_ARCH_VERSAL) |
Siva Durga Prasad Paladugu | cad14a8 | 2018-04-19 12:37:09 +0530 | [diff] [blame] | 897 | priv->host->ops = &arasan_ops; |
Michal Simek | 33a6b77 | 2020-10-23 04:59:00 -0600 | [diff] [blame] | 898 | arasan_dt_parse_clk_phases(dev); |
Siva Durga Prasad Paladugu | cad14a8 | 2018-04-19 12:37:09 +0530 | [diff] [blame] | 899 | #endif |
Michal Simek | 9ecd268 | 2015-11-30 16:13:03 +0100 | [diff] [blame] | 900 | |
Michal Simek | 921a8de | 2018-05-16 10:57:07 +0200 | [diff] [blame] | 901 | priv->host->ioaddr = (void *)dev_read_addr(dev); |
| 902 | if (IS_ERR(priv->host->ioaddr)) |
| 903 | return PTR_ERR(priv->host->ioaddr); |
| 904 | |
| 905 | priv->deviceid = dev_read_u32_default(dev, "xlnx,device_id", -1); |
Michal Simek | e40ae57 | 2020-07-22 17:46:31 +0200 | [diff] [blame] | 906 | priv->bank = dev_read_u32_default(dev, "xlnx,mio-bank", 0); |
Ashok Reddy Soma | 61e0df9 | 2020-10-23 04:58:57 -0600 | [diff] [blame] | 907 | priv->no_1p8 = dev_read_bool(dev, "no-1-8-v"); |
Stefan Herbrechtsmeier | 5567b42 | 2017-01-17 16:27:33 +0100 | [diff] [blame] | 908 | |
Michal Simek | 9ecd268 | 2015-11-30 16:13:03 +0100 | [diff] [blame] | 909 | return 0; |
| 910 | } |
| 911 | |
Simon Glass | 4cc87fb | 2016-07-05 17:10:15 -0600 | [diff] [blame] | 912 | static int arasan_sdhci_bind(struct udevice *dev) |
| 913 | { |
Simon Glass | fa20e93 | 2020-12-03 16:55:20 -0700 | [diff] [blame] | 914 | struct arasan_sdhci_plat *plat = dev_get_plat(dev); |
Simon Glass | 4cc87fb | 2016-07-05 17:10:15 -0600 | [diff] [blame] | 915 | |
Masahiro Yamada | cdb67f3 | 2016-09-06 22:17:32 +0900 | [diff] [blame] | 916 | return sdhci_bind(dev, &plat->mmc, &plat->cfg); |
Simon Glass | 4cc87fb | 2016-07-05 17:10:15 -0600 | [diff] [blame] | 917 | } |
| 918 | |
Michal Simek | 9ecd268 | 2015-11-30 16:13:03 +0100 | [diff] [blame] | 919 | static const struct udevice_id arasan_sdhci_ids[] = { |
| 920 | { .compatible = "arasan,sdhci-8.9a" }, |
| 921 | { } |
| 922 | }; |
| 923 | |
| 924 | U_BOOT_DRIVER(arasan_sdhci_drv) = { |
| 925 | .name = "arasan_sdhci", |
| 926 | .id = UCLASS_MMC, |
| 927 | .of_match = arasan_sdhci_ids, |
Simon Glass | aad29ae | 2020-12-03 16:55:21 -0700 | [diff] [blame] | 928 | .of_to_plat = arasan_sdhci_of_to_plat, |
Simon Glass | 4cc87fb | 2016-07-05 17:10:15 -0600 | [diff] [blame] | 929 | .ops = &sdhci_ops, |
| 930 | .bind = arasan_sdhci_bind, |
Michal Simek | 9ecd268 | 2015-11-30 16:13:03 +0100 | [diff] [blame] | 931 | .probe = arasan_sdhci_probe, |
Simon Glass | 8a2b47f | 2020-12-03 16:55:17 -0700 | [diff] [blame] | 932 | .priv_auto = sizeof(struct arasan_sdhci_priv), |
Simon Glass | 71fa5b4 | 2020-12-03 16:55:18 -0700 | [diff] [blame] | 933 | .plat_auto = sizeof(struct arasan_sdhci_plat), |
Michal Simek | 9ecd268 | 2015-11-30 16:13:03 +0100 | [diff] [blame] | 934 | }; |