2 * (C) Copyright 2009 SAMSUNG Electronics
3 * Minkyu Kang <mk7.kang@samsung.com>
4 * Jaehoon Chung <jh80.chung@samsung.com>
5 * Portions Copyright 2011-2015 NVIDIA Corporation
7 * SPDX-License-Identifier: GPL-2.0+
10 #include <bouncebuf.h>
12 #include <dm/device.h>
16 #ifndef CONFIG_TEGRA186
17 #include <asm/arch/clock.h>
18 #include <asm/arch-tegra/clk_rst.h>
20 #include <asm/arch-tegra/mmc.h>
21 #include <asm/arch-tegra/tegra_mmc.h>
25 * FIXME: TODO: This driver contains a number of ifdef CONFIG_TEGRA186 that
26 * should not be present. These are needed because newer Tegra SoCs support
27 * only the standard clock/reset APIs, whereas older Tegra SoCs support only
28 * a custom Tegra-specific API. ASAP the older Tegra SoCs' code should be
29 * fixed to implement the standard APIs, and all drivers converted to solely
30 * use the new standard APIs, with no ifdefs.
33 DECLARE_GLOBAL_DATA_PTR;
35 struct tegra_mmc_priv {
36 struct tegra_mmc *reg;
37 int id; /* device id/number, 0-3 */
38 int enabled; /* 1 to enable, 0 to disable */
39 int width; /* Bus Width, 1, 4 or 8 */
40 #ifdef CONFIG_TEGRA186
41 struct reset_ctl reset_ctl;
44 enum periph_id mmc_id; /* Peripheral ID: PERIPH_ID_... */
46 struct gpio_desc cd_gpio; /* Change Detect GPIO */
47 struct gpio_desc pwr_gpio; /* Power GPIO */
48 struct gpio_desc wp_gpio; /* Write Protect GPIO */
49 unsigned int version; /* SDHCI spec. version */
50 unsigned int clock; /* Current clock (MHz) */
51 struct mmc_config cfg; /* mmc configuration */
54 struct tegra_mmc_priv mmc_host[CONFIG_SYS_MMC_MAX_DEVICE];
56 #if !CONFIG_IS_ENABLED(OF_CONTROL)
57 #error "Please enable device tree support to use this driver"
60 static void tegra_mmc_set_power(struct tegra_mmc_priv *priv,
64 debug("%s: power = %x\n", __func__, power);
66 if (power != (unsigned short)-1) {
69 pwr = TEGRA_MMC_PWRCTL_SD_BUS_VOLTAGE_V1_8;
73 pwr = TEGRA_MMC_PWRCTL_SD_BUS_VOLTAGE_V3_0;
77 pwr = TEGRA_MMC_PWRCTL_SD_BUS_VOLTAGE_V3_3;
81 debug("%s: pwr = %X\n", __func__, pwr);
83 /* Set the bus voltage first (if any) */
84 writeb(pwr, &priv->reg->pwrcon);
88 /* Now enable bus power */
89 pwr |= TEGRA_MMC_PWRCTL_SD_BUS_POWER;
90 writeb(pwr, &priv->reg->pwrcon);
93 static void tegra_mmc_prepare_data(struct tegra_mmc_priv *priv,
94 struct mmc_data *data,
95 struct bounce_buffer *bbstate)
100 debug("buf: %p (%p), data->blocks: %u, data->blocksize: %u\n",
101 bbstate->bounce_buffer, bbstate->user_buffer, data->blocks,
104 writel((u32)(unsigned long)bbstate->bounce_buffer, &priv->reg->sysad);
109 * 10 = Selects 32-bit Address ADMA2
110 * 11 = Selects 64-bit Address ADMA2
112 ctrl = readb(&priv->reg->hostctl);
113 ctrl &= ~TEGRA_MMC_HOSTCTL_DMASEL_MASK;
114 ctrl |= TEGRA_MMC_HOSTCTL_DMASEL_SDMA;
115 writeb(ctrl, &priv->reg->hostctl);
117 /* We do not handle DMA boundaries, so set it to max (512 KiB) */
118 writew((7 << 12) | (data->blocksize & 0xFFF), &priv->reg->blksize);
119 writew(data->blocks, &priv->reg->blkcnt);
122 static void tegra_mmc_set_transfer_mode(struct tegra_mmc_priv *priv,
123 struct mmc_data *data)
126 debug(" mmc_set_transfer_mode called\n");
129 * MUL1SIN0[5] : Multi/Single Block Select
130 * RD1WT0[4] : Data Transfer Direction Select
133 * ENACMD12[2] : Auto CMD12 Enable
134 * ENBLKCNT[1] : Block Count Enable
135 * ENDMA[0] : DMA Enable
137 mode = (TEGRA_MMC_TRNMOD_DMA_ENABLE |
138 TEGRA_MMC_TRNMOD_BLOCK_COUNT_ENABLE);
140 if (data->blocks > 1)
141 mode |= TEGRA_MMC_TRNMOD_MULTI_BLOCK_SELECT;
143 if (data->flags & MMC_DATA_READ)
144 mode |= TEGRA_MMC_TRNMOD_DATA_XFER_DIR_SEL_READ;
146 writew(mode, &priv->reg->trnmod);
149 static int tegra_mmc_wait_inhibit(struct tegra_mmc_priv *priv,
151 struct mmc_data *data,
152 unsigned int timeout)
156 * CMDINHDAT[1] : Command Inhibit (DAT)
157 * CMDINHCMD[0] : Command Inhibit (CMD)
159 unsigned int mask = TEGRA_MMC_PRNSTS_CMD_INHIBIT_CMD;
162 * We shouldn't wait for data inhibit for stop commands, even
163 * though they might use busy signaling
165 if ((data == NULL) && (cmd->resp_type & MMC_RSP_BUSY))
166 mask |= TEGRA_MMC_PRNSTS_CMD_INHIBIT_DAT;
168 while (readl(&priv->reg->prnsts) & mask) {
170 printf("%s: timeout error\n", __func__);
180 static int tegra_mmc_send_cmd_bounced(struct mmc *mmc, struct mmc_cmd *cmd,
181 struct mmc_data *data,
182 struct bounce_buffer *bbstate)
184 struct tegra_mmc_priv *priv = mmc->priv;
187 unsigned int mask = 0;
188 unsigned int retry = 0x100000;
189 debug(" mmc_send_cmd called\n");
191 result = tegra_mmc_wait_inhibit(priv, cmd, data, 10 /* ms */);
197 tegra_mmc_prepare_data(priv, data, bbstate);
199 debug("cmd->arg: %08x\n", cmd->cmdarg);
200 writel(cmd->cmdarg, &priv->reg->argument);
203 tegra_mmc_set_transfer_mode(priv, data);
205 if ((cmd->resp_type & MMC_RSP_136) && (cmd->resp_type & MMC_RSP_BUSY))
210 * CMDIDX[13:8] : Command index
211 * DATAPRNT[5] : Data Present Select
212 * ENCMDIDX[4] : Command Index Check Enable
213 * ENCMDCRC[3] : Command CRC Check Enable
218 * 11 = Length 48 Check busy after response
220 if (!(cmd->resp_type & MMC_RSP_PRESENT))
221 flags = TEGRA_MMC_CMDREG_RESP_TYPE_SELECT_NO_RESPONSE;
222 else if (cmd->resp_type & MMC_RSP_136)
223 flags = TEGRA_MMC_CMDREG_RESP_TYPE_SELECT_LENGTH_136;
224 else if (cmd->resp_type & MMC_RSP_BUSY)
225 flags = TEGRA_MMC_CMDREG_RESP_TYPE_SELECT_LENGTH_48_BUSY;
227 flags = TEGRA_MMC_CMDREG_RESP_TYPE_SELECT_LENGTH_48;
229 if (cmd->resp_type & MMC_RSP_CRC)
230 flags |= TEGRA_MMC_TRNMOD_CMD_CRC_CHECK;
231 if (cmd->resp_type & MMC_RSP_OPCODE)
232 flags |= TEGRA_MMC_TRNMOD_CMD_INDEX_CHECK;
234 flags |= TEGRA_MMC_TRNMOD_DATA_PRESENT_SELECT_DATA_TRANSFER;
236 debug("cmd: %d\n", cmd->cmdidx);
238 writew((cmd->cmdidx << 8) | flags, &priv->reg->cmdreg);
240 for (i = 0; i < retry; i++) {
241 mask = readl(&priv->reg->norintsts);
242 /* Command Complete */
243 if (mask & TEGRA_MMC_NORINTSTS_CMD_COMPLETE) {
245 writel(mask, &priv->reg->norintsts);
251 printf("%s: waiting for status update\n", __func__);
252 writel(mask, &priv->reg->norintsts);
256 if (mask & TEGRA_MMC_NORINTSTS_CMD_TIMEOUT) {
258 debug("timeout: %08x cmd %d\n", mask, cmd->cmdidx);
259 writel(mask, &priv->reg->norintsts);
261 } else if (mask & TEGRA_MMC_NORINTSTS_ERR_INTERRUPT) {
262 /* Error Interrupt */
263 debug("error: %08x cmd %d\n", mask, cmd->cmdidx);
264 writel(mask, &priv->reg->norintsts);
268 if (cmd->resp_type & MMC_RSP_PRESENT) {
269 if (cmd->resp_type & MMC_RSP_136) {
270 /* CRC is stripped so we need to do some shifting. */
271 for (i = 0; i < 4; i++) {
272 unsigned long offset = (unsigned long)
273 (&priv->reg->rspreg3 - i);
274 cmd->response[i] = readl(offset) << 8;
280 debug("cmd->resp[%d]: %08x\n",
281 i, cmd->response[i]);
283 } else if (cmd->resp_type & MMC_RSP_BUSY) {
284 for (i = 0; i < retry; i++) {
285 /* PRNTDATA[23:20] : DAT[3:0] Line Signal */
286 if (readl(&priv->reg->prnsts)
287 & (1 << 20)) /* DAT[0] */
292 printf("%s: card is still busy\n", __func__);
293 writel(mask, &priv->reg->norintsts);
297 cmd->response[0] = readl(&priv->reg->rspreg0);
298 debug("cmd->resp[0]: %08x\n", cmd->response[0]);
300 cmd->response[0] = readl(&priv->reg->rspreg0);
301 debug("cmd->resp[0]: %08x\n", cmd->response[0]);
306 unsigned long start = get_timer(0);
309 mask = readl(&priv->reg->norintsts);
311 if (mask & TEGRA_MMC_NORINTSTS_ERR_INTERRUPT) {
312 /* Error Interrupt */
313 writel(mask, &priv->reg->norintsts);
314 printf("%s: error during transfer: 0x%08x\n",
317 } else if (mask & TEGRA_MMC_NORINTSTS_DMA_INTERRUPT) {
319 * DMA Interrupt, restart the transfer where
320 * it was interrupted.
322 unsigned int address = readl(&priv->reg->sysad);
325 writel(TEGRA_MMC_NORINTSTS_DMA_INTERRUPT,
326 &priv->reg->norintsts);
327 writel(address, &priv->reg->sysad);
328 } else if (mask & TEGRA_MMC_NORINTSTS_XFER_COMPLETE) {
329 /* Transfer Complete */
330 debug("r/w is done\n");
332 } else if (get_timer(start) > 8000UL) {
333 writel(mask, &priv->reg->norintsts);
334 printf("%s: MMC Timeout\n"
335 " Interrupt status 0x%08x\n"
336 " Interrupt status enable 0x%08x\n"
337 " Interrupt signal enable 0x%08x\n"
338 " Present status 0x%08x\n",
340 readl(&priv->reg->norintstsen),
341 readl(&priv->reg->norintsigen),
342 readl(&priv->reg->prnsts));
346 writel(mask, &priv->reg->norintsts);
353 static int tegra_mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd,
354 struct mmc_data *data)
357 unsigned int bbflags;
359 struct bounce_buffer bbstate;
363 if (data->flags & MMC_DATA_READ) {
365 bbflags = GEN_BB_WRITE;
367 buf = (void *)data->src;
368 bbflags = GEN_BB_READ;
370 len = data->blocks * data->blocksize;
372 bounce_buffer_start(&bbstate, buf, len, bbflags);
375 ret = tegra_mmc_send_cmd_bounced(mmc, cmd, data, &bbstate);
378 bounce_buffer_stop(&bbstate);
383 static void tegra_mmc_change_clock(struct tegra_mmc_priv *priv, uint clock)
387 unsigned long timeout;
389 debug(" mmc_change_clock called\n");
392 * Change Tegra SDMMCx clock divisor here. Source is PLLP_OUT0
396 #ifdef CONFIG_TEGRA186
398 ulong rate = clk_set_rate(&priv->clk, clock);
399 div = (rate + clock - 1) / clock;
402 clock_adjust_periph_pll_div(priv->mmc_id, CLOCK_ID_PERIPH, clock,
405 debug("div = %d\n", div);
407 writew(0, &priv->reg->clkcon);
411 * SELFREQ[15:8] : base clock divided by value
412 * ENSDCLK[2] : SD Clock Enable
413 * STBLINTCLK[1] : Internal Clock Stable
414 * ENINTCLK[0] : Internal Clock Enable
417 clk = ((div << TEGRA_MMC_CLKCON_SDCLK_FREQ_SEL_SHIFT) |
418 TEGRA_MMC_CLKCON_INTERNAL_CLOCK_ENABLE);
419 writew(clk, &priv->reg->clkcon);
423 while (!(readw(&priv->reg->clkcon) &
424 TEGRA_MMC_CLKCON_INTERNAL_CLOCK_STABLE)) {
426 printf("%s: timeout error\n", __func__);
433 clk |= TEGRA_MMC_CLKCON_SD_CLOCK_ENABLE;
434 writew(clk, &priv->reg->clkcon);
436 debug("mmc_change_clock: clkcon = %08X\n", clk);
442 static void tegra_mmc_set_ios(struct mmc *mmc)
444 struct tegra_mmc_priv *priv = mmc->priv;
446 debug(" mmc_set_ios called\n");
448 debug("bus_width: %x, clock: %d\n", mmc->bus_width, mmc->clock);
450 /* Change clock first */
451 tegra_mmc_change_clock(priv, mmc->clock);
453 ctrl = readb(&priv->reg->hostctl);
457 * 0 = Depend on WIDE4
463 if (mmc->bus_width == 8)
465 else if (mmc->bus_width == 4)
470 writeb(ctrl, &priv->reg->hostctl);
471 debug("mmc_set_ios: hostctl = %08X\n", ctrl);
474 static void tegra_mmc_pad_init(struct tegra_mmc_priv *priv)
476 #if defined(CONFIG_TEGRA30)
479 debug("%s: sdmmc address = %08x\n", __func__, (unsigned int)priv->reg);
481 /* Set the pad drive strength for SDMMC1 or 3 only */
482 if (priv->reg != (void *)0x78000000 &&
483 priv->reg != (void *)0x78000400) {
484 debug("%s: settings are only valid for SDMMC1/SDMMC3!\n",
489 val = readl(&priv->reg->sdmemcmppadctl);
491 val |= MEMCOMP_PADCTRL_VREF;
492 writel(val, &priv->reg->sdmemcmppadctl);
494 val = readl(&priv->reg->autocalcfg);
496 val |= AUTO_CAL_PU_OFFSET | AUTO_CAL_PD_OFFSET | AUTO_CAL_ENABLED;
497 writel(val, &priv->reg->autocalcfg);
501 static void tegra_mmc_reset(struct tegra_mmc_priv *priv, struct mmc *mmc)
503 unsigned int timeout;
504 debug(" mmc_reset called\n");
507 * RSTALL[0] : Software reset for all
511 writeb(TEGRA_MMC_SWRST_SW_RESET_FOR_ALL, &priv->reg->swrst);
515 /* Wait max 100 ms */
518 /* hw clears the bit when it's done */
519 while (readb(&priv->reg->swrst) & TEGRA_MMC_SWRST_SW_RESET_FOR_ALL) {
521 printf("%s: timeout error\n", __func__);
528 /* Set SD bus voltage & enable bus power */
529 tegra_mmc_set_power(priv, fls(mmc->cfg->voltages) - 1);
530 debug("%s: power control = %02X, host control = %02X\n", __func__,
531 readb(&priv->reg->pwrcon), readb(&priv->reg->hostctl));
533 /* Make sure SDIO pads are set up */
534 tegra_mmc_pad_init(priv);
537 static int tegra_mmc_core_init(struct mmc *mmc)
539 struct tegra_mmc_priv *priv = mmc->priv;
541 debug(" mmc_core_init called\n");
543 tegra_mmc_reset(priv, mmc);
545 priv->version = readw(&priv->reg->hcver);
546 debug("host version = %x\n", priv->version);
549 writel(0xffffffff, &priv->reg->norintstsen);
550 writel(0xffffffff, &priv->reg->norintsigen);
552 writeb(0xe, &priv->reg->timeoutcon); /* TMCLK * 2^27 */
554 * NORMAL Interrupt Status Enable Register init
555 * [5] ENSTABUFRDRDY : Buffer Read Ready Status Enable
556 * [4] ENSTABUFWTRDY : Buffer write Ready Status Enable
557 * [3] ENSTADMAINT : DMA boundary interrupt
558 * [1] ENSTASTANSCMPLT : Transfre Complete Status Enable
559 * [0] ENSTACMDCMPLT : Command Complete Status Enable
561 mask = readl(&priv->reg->norintstsen);
563 mask |= (TEGRA_MMC_NORINTSTSEN_CMD_COMPLETE |
564 TEGRA_MMC_NORINTSTSEN_XFER_COMPLETE |
565 TEGRA_MMC_NORINTSTSEN_DMA_INTERRUPT |
566 TEGRA_MMC_NORINTSTSEN_BUFFER_WRITE_READY |
567 TEGRA_MMC_NORINTSTSEN_BUFFER_READ_READY);
568 writel(mask, &priv->reg->norintstsen);
571 * NORMAL Interrupt Signal Enable Register init
572 * [1] ENSTACMDCMPLT : Transfer Complete Signal Enable
574 mask = readl(&priv->reg->norintsigen);
576 mask |= TEGRA_MMC_NORINTSIGEN_XFER_COMPLETE;
577 writel(mask, &priv->reg->norintsigen);
582 static int tegra_mmc_getcd(struct mmc *mmc)
584 struct tegra_mmc_priv *priv = mmc->priv;
586 debug("tegra_mmc_getcd called\n");
588 if (dm_gpio_is_valid(&priv->cd_gpio))
589 return dm_gpio_get_value(&priv->cd_gpio);
594 static const struct mmc_ops tegra_mmc_ops = {
595 .send_cmd = tegra_mmc_send_cmd,
596 .set_ios = tegra_mmc_set_ios,
597 .init = tegra_mmc_core_init,
598 .getcd = tegra_mmc_getcd,
601 static int do_mmc_init(int dev_index, bool removable)
603 struct tegra_mmc_priv *priv;
605 #ifdef CONFIG_TEGRA186
609 /* DT should have been read & host config filled in */
610 priv = &mmc_host[dev_index];
614 debug(" do_mmc_init: index %d, bus width %d pwr_gpio %d cd_gpio %d\n",
615 dev_index, priv->width, gpio_get_number(&priv->pwr_gpio),
616 gpio_get_number(&priv->cd_gpio));
620 #ifdef CONFIG_TEGRA186
621 ret = reset_assert(&priv->reset_ctl);
624 ret = clk_enable(&priv->clk);
627 ret = clk_set_rate(&priv->clk, 20000000);
628 if (IS_ERR_VALUE(ret))
630 ret = reset_deassert(&priv->reset_ctl);
634 clock_start_periph_pll(priv->mmc_id, CLOCK_ID_PERIPH, 20000000);
637 if (dm_gpio_is_valid(&priv->pwr_gpio))
638 dm_gpio_set_value(&priv->pwr_gpio, 1);
640 memset(&priv->cfg, 0, sizeof(priv->cfg));
642 priv->cfg.name = "Tegra SD/MMC";
643 priv->cfg.ops = &tegra_mmc_ops;
645 priv->cfg.voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195;
646 priv->cfg.host_caps = 0;
647 if (priv->width == 8)
648 priv->cfg.host_caps |= MMC_MODE_8BIT;
649 if (priv->width >= 4)
650 priv->cfg.host_caps |= MMC_MODE_4BIT;
651 priv->cfg.host_caps |= MMC_MODE_HS_52MHz | MMC_MODE_HS;
654 * min freq is for card identification, and is the highest
655 * low-speed SDIO card frequency (actually 400KHz)
656 * max freq is highest HS eMMC clock as per the SD/MMC spec
659 priv->cfg.f_min = 375000;
660 priv->cfg.f_max = 48000000;
662 priv->cfg.b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT;
664 mmc = mmc_create(&priv->cfg, priv);
665 mmc->block_dev.removable = removable;
673 * Get the host address and peripheral ID for a node.
675 * @param blob fdt blob
676 * @param node Device index (0-3)
677 * @param priv Structure to fill in (reg, width, mmc_id)
679 static int mmc_get_config(const void *blob, int node,
680 struct tegra_mmc_priv *priv, bool *removablep)
682 debug("%s: node = %d\n", __func__, node);
684 priv->enabled = fdtdec_get_is_enabled(blob, node);
686 priv->reg = (struct tegra_mmc *)fdtdec_get_addr(blob, node, "reg");
687 if ((fdt_addr_t)priv->reg == FDT_ADDR_T_NONE) {
688 debug("%s: no sdmmc base reg info found\n", __func__);
689 return -FDT_ERR_NOTFOUND;
692 #ifdef CONFIG_TEGRA186
695 * FIXME: This variable should go away when the MMC device
696 * actually is a udevice.
700 dev.of_offset = node;
701 ret = reset_get_by_name(&dev, "sdhci", &priv->reset_ctl);
703 debug("reset_get_by_name() failed: %d\n", ret);
706 ret = clk_get_by_index(&dev, 0, &priv->clk);
708 debug("clk_get_by_index() failed: %d\n", ret);
713 priv->mmc_id = clock_decode_periph_id(blob, node);
714 if (priv->mmc_id == PERIPH_ID_NONE) {
715 debug("%s: could not decode periph id\n", __func__);
716 return -FDT_ERR_NOTFOUND;
721 * NOTE: mmc->bus_width is determined by mmc.c dynamically.
722 * TBD: Override it with this value?
724 priv->width = fdtdec_get_int(blob, node, "bus-width", 0);
726 debug("%s: no sdmmc width found\n", __func__);
728 /* These GPIOs are optional */
729 gpio_request_by_name_nodev(blob, node, "cd-gpios", 0, &priv->cd_gpio,
731 gpio_request_by_name_nodev(blob, node, "wp-gpios", 0, &priv->wp_gpio,
733 gpio_request_by_name_nodev(blob, node, "power-gpios", 0,
734 &priv->pwr_gpio, GPIOD_IS_OUT);
735 *removablep = !fdtdec_get_bool(blob, node, "non-removable");
737 debug("%s: found controller at %p, width = %d, periph_id = %d\n",
738 __func__, priv->reg, priv->width,
739 #ifndef CONFIG_TEGRA186
749 * Process a list of nodes, adding them to our list of SDMMC ports.
751 * @param blob fdt blob
752 * @param node_list list of nodes to process (any <=0 are ignored)
753 * @param count number of nodes to process
754 * @return 0 if ok, -1 on error
756 static int process_nodes(const void *blob, int node_list[], int count)
758 struct tegra_mmc_priv *priv;
762 debug("%s: count = %d\n", __func__, count);
764 /* build mmc_host[] for each controller */
765 for (i = 0; i < count; i++) {
773 if (mmc_get_config(blob, node, priv, &removable)) {
774 printf("%s: failed to decode dev %d\n", __func__, i);
777 do_mmc_init(i, removable);
782 void tegra_mmc_init(void)
784 int node_list[CONFIG_SYS_MMC_MAX_DEVICE], count;
785 const void *blob = gd->fdt_blob;
786 debug("%s entry\n", __func__);
788 /* See if any Tegra186 MMC controllers are present */
789 count = fdtdec_find_aliases_for_id(blob, "mmc",
790 COMPAT_NVIDIA_TEGRA186_SDMMC, node_list,
791 CONFIG_SYS_MMC_MAX_DEVICE);
792 debug("%s: count of Tegra186 sdhci nodes is %d\n", __func__, count);
793 if (process_nodes(blob, node_list, count)) {
794 printf("%s: Error processing T186 mmc node(s)!\n", __func__);
798 /* See if any Tegra210 MMC controllers are present */
799 count = fdtdec_find_aliases_for_id(blob, "mmc",
800 COMPAT_NVIDIA_TEGRA210_SDMMC, node_list,
801 CONFIG_SYS_MMC_MAX_DEVICE);
802 debug("%s: count of Tegra210 sdhci nodes is %d\n", __func__, count);
803 if (process_nodes(blob, node_list, count)) {
804 printf("%s: Error processing T210 mmc node(s)!\n", __func__);
808 /* See if any Tegra124 MMC controllers are present */
809 count = fdtdec_find_aliases_for_id(blob, "mmc",
810 COMPAT_NVIDIA_TEGRA124_SDMMC, node_list,
811 CONFIG_SYS_MMC_MAX_DEVICE);
812 debug("%s: count of Tegra124 sdhci nodes is %d\n", __func__, count);
813 if (process_nodes(blob, node_list, count)) {
814 printf("%s: Error processing T124 mmc node(s)!\n", __func__);
818 /* See if any Tegra30 MMC controllers are present */
819 count = fdtdec_find_aliases_for_id(blob, "mmc",
820 COMPAT_NVIDIA_TEGRA30_SDMMC, node_list,
821 CONFIG_SYS_MMC_MAX_DEVICE);
822 debug("%s: count of T30 sdhci nodes is %d\n", __func__, count);
823 if (process_nodes(blob, node_list, count)) {
824 printf("%s: Error processing T30 mmc node(s)!\n", __func__);
828 /* Now look for any Tegra20 MMC controllers */
829 count = fdtdec_find_aliases_for_id(blob, "mmc",
830 COMPAT_NVIDIA_TEGRA20_SDMMC, node_list,
831 CONFIG_SYS_MMC_MAX_DEVICE);
832 debug("%s: count of T20 sdhci nodes is %d\n", __func__, count);
833 if (process_nodes(blob, node_list, count)) {
834 printf("%s: Error processing T20 mmc node(s)!\n", __func__);