Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Marek Vasut | c140e98 | 2011-11-08 23:18:08 +0000 | [diff] [blame] | 2 | /* |
Otavio Salvador | fd96c03 | 2013-01-11 03:19:08 +0000 | [diff] [blame] | 3 | * Freescale i.MX23/i.MX28 common code |
Marek Vasut | c140e98 | 2011-11-08 23:18:08 +0000 | [diff] [blame] | 4 | * |
| 5 | * Copyright (C) 2011 Marek Vasut <marek.vasut@gmail.com> |
| 6 | * on behalf of DENX Software Engineering GmbH |
| 7 | * |
| 8 | * Based on code from LTIB: |
| 9 | * Copyright (C) 2010 Freescale Semiconductor, Inc. |
Marek Vasut | c140e98 | 2011-11-08 23:18:08 +0000 | [diff] [blame] | 10 | */ |
| 11 | |
| 12 | #include <common.h> |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame] | 13 | #include <command.h> |
Simon Glass | afb0215 | 2019-12-28 10:45:01 -0700 | [diff] [blame] | 14 | #include <cpu_func.h> |
Simon Glass | f11478f | 2019-12-28 10:45:07 -0700 | [diff] [blame] | 15 | #include <hang.h> |
Simon Glass | 9758973 | 2020-05-10 11:40:02 -0600 | [diff] [blame] | 16 | #include <init.h> |
Simon Glass | 274e0b0 | 2020-05-10 11:39:56 -0600 | [diff] [blame] | 17 | #include <net.h> |
Simon Glass | 3ba929a | 2020-10-30 21:38:53 -0600 | [diff] [blame] | 18 | #include <asm/global_data.h> |
Simon Glass | dbd7954 | 2020-05-10 11:40:11 -0600 | [diff] [blame] | 19 | #include <linux/delay.h> |
Masahiro Yamada | 56a931c | 2016-09-21 11:28:55 +0900 | [diff] [blame] | 20 | #include <linux/errno.h> |
Marek Vasut | c140e98 | 2011-11-08 23:18:08 +0000 | [diff] [blame] | 21 | #include <asm/io.h> |
| 22 | #include <asm/arch/clock.h> |
Stefano Babic | 33731bc | 2017-06-29 10:16:06 +0200 | [diff] [blame] | 23 | #include <asm/mach-imx/dma.h> |
Marek Vasut | c140e98 | 2011-11-08 23:18:08 +0000 | [diff] [blame] | 24 | #include <asm/arch/gpio.h> |
Marek Vasut | 53fdab2 | 2011-11-08 23:18:13 +0000 | [diff] [blame] | 25 | #include <asm/arch/iomux.h> |
Marek Vasut | c140e98 | 2011-11-08 23:18:08 +0000 | [diff] [blame] | 26 | #include <asm/arch/imx-regs.h> |
| 27 | #include <asm/arch/sys_proto.h> |
Marek BehĂșn | 90dcc4f | 2021-05-20 13:24:12 +0200 | [diff] [blame] | 28 | #include <asm/sections.h> |
Fabio Estevam | 570dcfd | 2013-01-08 05:21:45 +0000 | [diff] [blame] | 29 | #include <linux/compiler.h> |
Marek Vasut | c140e98 | 2011-11-08 23:18:08 +0000 | [diff] [blame] | 30 | |
Marek Vasut | 5bf48fb | 2011-11-08 23:18:23 +0000 | [diff] [blame] | 31 | DECLARE_GLOBAL_DATA_PTR; |
| 32 | |
Marek Vasut | c140e98 | 2011-11-08 23:18:08 +0000 | [diff] [blame] | 33 | /* Lowlevel init isn't used on i.MX28, so just have a dummy here */ |
Mans Rullgard | 04ef865 | 2018-04-21 16:11:06 +0100 | [diff] [blame] | 34 | __weak void lowlevel_init(void) {} |
Marek Vasut | c140e98 | 2011-11-08 23:18:08 +0000 | [diff] [blame] | 35 | |
Harald Seiler | 6f14d5f | 2020-12-15 16:47:52 +0100 | [diff] [blame] | 36 | void reset_cpu(void) __attribute__((noreturn)); |
Marek Vasut | c140e98 | 2011-11-08 23:18:08 +0000 | [diff] [blame] | 37 | |
Harald Seiler | 6f14d5f | 2020-12-15 16:47:52 +0100 | [diff] [blame] | 38 | void reset_cpu(void) |
Marek Vasut | c140e98 | 2011-11-08 23:18:08 +0000 | [diff] [blame] | 39 | { |
Otavio Salvador | 22f4ff9 | 2012-08-05 09:05:31 +0000 | [diff] [blame] | 40 | struct mxs_rtc_regs *rtc_regs = |
| 41 | (struct mxs_rtc_regs *)MXS_RTC_BASE; |
| 42 | struct mxs_lcdif_regs *lcdif_regs = |
| 43 | (struct mxs_lcdif_regs *)MXS_LCDIF_BASE; |
Marek Vasut | 9c53b7e | 2012-05-01 11:09:47 +0000 | [diff] [blame] | 44 | |
| 45 | /* |
| 46 | * Shut down the LCD controller as it interferes with BootROM boot mode |
| 47 | * pads sampling. |
| 48 | */ |
| 49 | writel(LCDIF_CTRL_RUN, &lcdif_regs->hw_lcdif_ctrl_clr); |
Marek Vasut | c140e98 | 2011-11-08 23:18:08 +0000 | [diff] [blame] | 50 | |
| 51 | /* Wait 1 uS before doing the actual watchdog reset */ |
| 52 | writel(1, &rtc_regs->hw_rtc_watchdog); |
| 53 | writel(RTC_CTRL_WATCHDOGEN, &rtc_regs->hw_rtc_ctrl_set); |
| 54 | |
| 55 | /* Endless loop, reset will exit from here */ |
| 56 | for (;;) |
| 57 | ; |
| 58 | } |
| 59 | |
Marek Vasut | 39c3103 | 2013-04-25 16:37:12 +0000 | [diff] [blame] | 60 | /* |
| 61 | * This function will craft a jumptable at 0x0 which will redirect interrupt |
| 62 | * vectoring to proper location of U-Boot in RAM. |
| 63 | * |
| 64 | * The structure of the jumptable will be as follows: |
| 65 | * ldr pc, [pc, #0x18] ..... for each vector, thus repeated 8 times |
| 66 | * <destination address> ... for each previous ldr, thus also repeated 8 times |
| 67 | * |
| 68 | * The "ldr pc, [pc, #0x18]" instruction above loads address from memory at |
| 69 | * offset 0x18 from current value of PC register. Note that PC is already |
| 70 | * incremented by 4 when computing the offset, so the effective offset is |
| 71 | * actually 0x20, this the associated <destination address>. Loading the PC |
| 72 | * register with an address performs a jump to that address. |
| 73 | */ |
Marek Vasut | d193763 | 2023-10-18 20:51:59 +0200 | [diff] [blame] | 74 | noinline __attribute__((target("arm"))) |
Marek Vasut | 5bf48fb | 2011-11-08 23:18:23 +0000 | [diff] [blame] | 75 | void mx28_fixup_vt(uint32_t start_addr) |
| 76 | { |
Marek Vasut | 39c3103 | 2013-04-25 16:37:12 +0000 | [diff] [blame] | 77 | /* ldr pc, [pc, #0x18] */ |
| 78 | const uint32_t ldr_pc = 0xe59ff018; |
| 79 | /* Jumptable location is 0x0 */ |
| 80 | uint32_t *vt = (uint32_t *)0x0; |
Marek Vasut | 5bf48fb | 2011-11-08 23:18:23 +0000 | [diff] [blame] | 81 | int i; |
| 82 | |
Marek Vasut | 39c3103 | 2013-04-25 16:37:12 +0000 | [diff] [blame] | 83 | for (i = 0; i < 8; i++) { |
Wolfgang Denk | 6ae8083 | 2014-11-06 14:02:57 +0100 | [diff] [blame] | 84 | /* cppcheck-suppress nullPointer */ |
Marek Vasut | 39c3103 | 2013-04-25 16:37:12 +0000 | [diff] [blame] | 85 | vt[i] = ldr_pc; |
Wolfgang Denk | 6ae8083 | 2014-11-06 14:02:57 +0100 | [diff] [blame] | 86 | /* cppcheck-suppress nullPointer */ |
Marek Vasut | 39c3103 | 2013-04-25 16:37:12 +0000 | [diff] [blame] | 87 | vt[i + 8] = start_addr + (4 * i); |
| 88 | } |
Marek Vasut | d193763 | 2023-10-18 20:51:59 +0200 | [diff] [blame] | 89 | |
| 90 | /* Make sure ARM core points to low vectors */ |
| 91 | set_cr(get_cr() & ~CR_V); |
Marek Vasut | 5bf48fb | 2011-11-08 23:18:23 +0000 | [diff] [blame] | 92 | } |
| 93 | |
| 94 | #ifdef CONFIG_ARCH_MISC_INIT |
| 95 | int arch_misc_init(void) |
| 96 | { |
| 97 | mx28_fixup_vt(gd->relocaddr); |
Marek Vasut | c140e98 | 2011-11-08 23:18:08 +0000 | [diff] [blame] | 98 | return 0; |
| 99 | } |
Marek Vasut | 5bf48fb | 2011-11-08 23:18:23 +0000 | [diff] [blame] | 100 | #endif |
Marek Vasut | c140e98 | 2011-11-08 23:18:08 +0000 | [diff] [blame] | 101 | |
Marek Vasut | c140e98 | 2011-11-08 23:18:08 +0000 | [diff] [blame] | 102 | int arch_cpu_init(void) |
| 103 | { |
Otavio Salvador | 22f4ff9 | 2012-08-05 09:05:31 +0000 | [diff] [blame] | 104 | struct mxs_clkctrl_regs *clkctrl_regs = |
| 105 | (struct mxs_clkctrl_regs *)MXS_CLKCTRL_BASE; |
Marek Vasut | 5bf48fb | 2011-11-08 23:18:23 +0000 | [diff] [blame] | 106 | |
Shiji Yang | eff11fa | 2023-08-03 09:47:17 +0800 | [diff] [blame] | 107 | mx28_fixup_vt((uint32_t)_start); |
Marek Vasut | c140e98 | 2011-11-08 23:18:08 +0000 | [diff] [blame] | 108 | |
| 109 | /* |
| 110 | * Enable NAND clock |
| 111 | */ |
Rasmus Villemoes | 6cb658c | 2019-09-12 09:17:10 +0000 | [diff] [blame] | 112 | /* Set bypass bit */ |
Marek Vasut | c140e98 | 2011-11-08 23:18:08 +0000 | [diff] [blame] | 113 | writel(CLKCTRL_CLKSEQ_BYPASS_GPMI, |
| 114 | &clkctrl_regs->hw_clkctrl_clkseq_set); |
| 115 | |
Rasmus Villemoes | 6cb658c | 2019-09-12 09:17:10 +0000 | [diff] [blame] | 116 | /* Set GPMI clock to ref_xtal / 1 */ |
Rasmus Villemoes | 5a84b03 | 2019-09-12 09:17:11 +0000 | [diff] [blame] | 117 | clrbits_le32(&clkctrl_regs->hw_clkctrl_gpmi, CLKCTRL_GPMI_CLKGATE); |
| 118 | while (readl(&clkctrl_regs->hw_clkctrl_gpmi) & CLKCTRL_GPMI_CLKGATE) |
| 119 | ; |
Marek Vasut | c140e98 | 2011-11-08 23:18:08 +0000 | [diff] [blame] | 120 | clrsetbits_le32(&clkctrl_regs->hw_clkctrl_gpmi, |
Rasmus Villemoes | 5a84b03 | 2019-09-12 09:17:11 +0000 | [diff] [blame] | 121 | CLKCTRL_GPMI_DIV_MASK, 1); |
Marek Vasut | c140e98 | 2011-11-08 23:18:08 +0000 | [diff] [blame] | 122 | |
| 123 | udelay(1000); |
| 124 | |
Marek Vasut | 53fdab2 | 2011-11-08 23:18:13 +0000 | [diff] [blame] | 125 | /* |
| 126 | * Configure GPIO unit |
| 127 | */ |
| 128 | mxs_gpio_init(); |
| 129 | |
Marek Vasut | 93541b4 | 2012-04-08 17:34:46 +0000 | [diff] [blame] | 130 | #ifdef CONFIG_APBH_DMA |
| 131 | /* Start APBH DMA */ |
| 132 | mxs_dma_init(); |
| 133 | #endif |
| 134 | |
Marek Vasut | c140e98 | 2011-11-08 23:18:08 +0000 | [diff] [blame] | 135 | return 0; |
| 136 | } |
Marek Vasut | c140e98 | 2011-11-08 23:18:08 +0000 | [diff] [blame] | 137 | |
Peng Fan | b741b16 | 2015-08-13 10:55:33 +0800 | [diff] [blame] | 138 | u32 get_cpu_rev(void) |
Otavio Salvador | ca36b53 | 2012-07-28 11:43:47 +0000 | [diff] [blame] | 139 | { |
Otavio Salvador | 22f4ff9 | 2012-08-05 09:05:31 +0000 | [diff] [blame] | 140 | struct mxs_digctl_regs *digctl_regs = |
| 141 | (struct mxs_digctl_regs *)MXS_DIGCTL_BASE; |
Otavio Salvador | ca36b53 | 2012-07-28 11:43:47 +0000 | [diff] [blame] | 142 | uint8_t rev = readl(&digctl_regs->hw_digctl_chipid) & 0x000000FF; |
| 143 | |
| 144 | switch (readl(&digctl_regs->hw_digctl_chipid) & HW_DIGCTL_CHIPID_MASK) { |
Otavio Salvador | fd96c03 | 2013-01-11 03:19:08 +0000 | [diff] [blame] | 145 | case HW_DIGCTL_CHIPID_MX23: |
| 146 | switch (rev) { |
| 147 | case 0x0: |
Otavio Salvador | fd96c03 | 2013-01-11 03:19:08 +0000 | [diff] [blame] | 148 | case 0x1: |
Otavio Salvador | fd96c03 | 2013-01-11 03:19:08 +0000 | [diff] [blame] | 149 | case 0x2: |
Otavio Salvador | fd96c03 | 2013-01-11 03:19:08 +0000 | [diff] [blame] | 150 | case 0x3: |
Otavio Salvador | fd96c03 | 2013-01-11 03:19:08 +0000 | [diff] [blame] | 151 | case 0x4: |
Peng Fan | b741b16 | 2015-08-13 10:55:33 +0800 | [diff] [blame] | 152 | return (MXC_CPU_MX23 << 12) | (rev + 0x10); |
Otavio Salvador | fd96c03 | 2013-01-11 03:19:08 +0000 | [diff] [blame] | 153 | default: |
Peng Fan | b741b16 | 2015-08-13 10:55:33 +0800 | [diff] [blame] | 154 | return 0; |
Otavio Salvador | fd96c03 | 2013-01-11 03:19:08 +0000 | [diff] [blame] | 155 | } |
Otavio Salvador | ca36b53 | 2012-07-28 11:43:47 +0000 | [diff] [blame] | 156 | case HW_DIGCTL_CHIPID_MX28: |
| 157 | switch (rev) { |
| 158 | case 0x1: |
Peng Fan | b741b16 | 2015-08-13 10:55:33 +0800 | [diff] [blame] | 159 | return (MXC_CPU_MX28 << 12) | 0x12; |
Otavio Salvador | ca36b53 | 2012-07-28 11:43:47 +0000 | [diff] [blame] | 160 | default: |
Peng Fan | b741b16 | 2015-08-13 10:55:33 +0800 | [diff] [blame] | 161 | return 0; |
Otavio Salvador | ca36b53 | 2012-07-28 11:43:47 +0000 | [diff] [blame] | 162 | } |
| 163 | default: |
Peng Fan | b741b16 | 2015-08-13 10:55:33 +0800 | [diff] [blame] | 164 | return 0; |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | #if defined(CONFIG_DISPLAY_CPUINFO) |
| 169 | const char *get_imx_type(u32 imxtype) |
| 170 | { |
| 171 | switch (imxtype) { |
| 172 | case MXC_CPU_MX23: |
Michael Heimpold | 0ad9e1f | 2016-06-06 14:26:39 +0200 | [diff] [blame] | 173 | return "23"; |
Peng Fan | b741b16 | 2015-08-13 10:55:33 +0800 | [diff] [blame] | 174 | case MXC_CPU_MX28: |
Michael Heimpold | 0ad9e1f | 2016-06-06 14:26:39 +0200 | [diff] [blame] | 175 | return "28"; |
Peng Fan | b741b16 | 2015-08-13 10:55:33 +0800 | [diff] [blame] | 176 | default: |
Otavio Salvador | ca36b53 | 2012-07-28 11:43:47 +0000 | [diff] [blame] | 177 | return "??"; |
| 178 | } |
| 179 | } |
| 180 | |
Marek Vasut | c140e98 | 2011-11-08 23:18:08 +0000 | [diff] [blame] | 181 | int print_cpuinfo(void) |
| 182 | { |
Peng Fan | b741b16 | 2015-08-13 10:55:33 +0800 | [diff] [blame] | 183 | u32 cpurev; |
Mans Rullgard | 2f66b40 | 2018-04-21 16:11:09 +0100 | [diff] [blame] | 184 | struct mxs_spl_data *data = MXS_SPL_DATA; |
Marek Vasut | b28fe46 | 2012-05-01 11:09:45 +0000 | [diff] [blame] | 185 | |
Peng Fan | b741b16 | 2015-08-13 10:55:33 +0800 | [diff] [blame] | 186 | cpurev = get_cpu_rev(); |
| 187 | printf("CPU: Freescale i.MX%s rev%d.%d at %d MHz\n", |
| 188 | get_imx_type((cpurev & 0xFF000) >> 12), |
| 189 | (cpurev & 0x000F0) >> 4, |
| 190 | (cpurev & 0x0000F) >> 0, |
Otavio Salvador | ca36b53 | 2012-07-28 11:43:47 +0000 | [diff] [blame] | 191 | mxc_get_clock(MXC_ARM_CLK) / 1000000); |
Otavio Salvador | cbf0bf2 | 2012-08-13 09:53:12 +0000 | [diff] [blame] | 192 | printf("BOOT: %s\n", mxs_boot_modes[data->boot_mode_idx].mode); |
Marek Vasut | c140e98 | 2011-11-08 23:18:08 +0000 | [diff] [blame] | 193 | return 0; |
| 194 | } |
| 195 | #endif |
| 196 | |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame] | 197 | int do_mx28_showclocks(struct cmd_tbl *cmdtp, int flag, int argc, |
| 198 | char *const argv[]) |
Marek Vasut | c140e98 | 2011-11-08 23:18:08 +0000 | [diff] [blame] | 199 | { |
| 200 | printf("CPU: %3d MHz\n", mxc_get_clock(MXC_ARM_CLK) / 1000000); |
| 201 | printf("BUS: %3d MHz\n", mxc_get_clock(MXC_AHB_CLK) / 1000000); |
| 202 | printf("EMI: %3d MHz\n", mxc_get_clock(MXC_EMI_CLK)); |
| 203 | printf("GPMI: %3d MHz\n", mxc_get_clock(MXC_GPMI_CLK) / 1000000); |
| 204 | return 0; |
| 205 | } |
| 206 | |
| 207 | /* |
| 208 | * Initializes on-chip ethernet controllers. |
| 209 | */ |
Otavio Salvador | d1de2e0 | 2012-08-19 04:58:29 +0000 | [diff] [blame] | 210 | #if defined(CONFIG_MX28) && defined(CONFIG_CMD_NET) |
Masahiro Yamada | f7ed78b | 2020-06-26 15:13:33 +0900 | [diff] [blame] | 211 | int cpu_eth_init(struct bd_info *bis) |
Marek Vasut | c140e98 | 2011-11-08 23:18:08 +0000 | [diff] [blame] | 212 | { |
Otavio Salvador | 22f4ff9 | 2012-08-05 09:05:31 +0000 | [diff] [blame] | 213 | struct mxs_clkctrl_regs *clkctrl_regs = |
| 214 | (struct mxs_clkctrl_regs *)MXS_CLKCTRL_BASE; |
Marek Vasut | c140e98 | 2011-11-08 23:18:08 +0000 | [diff] [blame] | 215 | |
| 216 | /* Turn on ENET clocks */ |
| 217 | clrbits_le32(&clkctrl_regs->hw_clkctrl_enet, |
| 218 | CLKCTRL_ENET_SLEEP | CLKCTRL_ENET_DISABLE); |
| 219 | |
| 220 | /* Set up ENET PLL for 50 MHz */ |
| 221 | /* Power on ENET PLL */ |
| 222 | writel(CLKCTRL_PLL2CTRL0_POWER, |
| 223 | &clkctrl_regs->hw_clkctrl_pll2ctrl0_set); |
| 224 | |
| 225 | udelay(10); |
| 226 | |
| 227 | /* Gate on ENET PLL */ |
| 228 | writel(CLKCTRL_PLL2CTRL0_CLKGATE, |
| 229 | &clkctrl_regs->hw_clkctrl_pll2ctrl0_clr); |
| 230 | |
| 231 | /* Enable pad output */ |
| 232 | setbits_le32(&clkctrl_regs->hw_clkctrl_enet, CLKCTRL_ENET_CLK_OUT_EN); |
| 233 | |
| 234 | return 0; |
| 235 | } |
| 236 | #endif |
| 237 | |
Fabio Estevam | 570dcfd | 2013-01-08 05:21:45 +0000 | [diff] [blame] | 238 | __weak void mx28_adjust_mac(int dev_id, unsigned char *mac) |
Fabio Estevam | 4029c01 | 2011-12-20 06:42:29 +0000 | [diff] [blame] | 239 | { |
| 240 | mac[0] = 0x00; |
| 241 | mac[1] = 0x04; /* Use FSL vendor MAC address by default */ |
| 242 | |
| 243 | if (dev_id == 1) /* Let MAC1 be MAC0 + 1 by default */ |
| 244 | mac[5] += 1; |
| 245 | } |
| 246 | |
Fabio Estevam | 4029c01 | 2011-12-20 06:42:29 +0000 | [diff] [blame] | 247 | #ifdef CONFIG_MX28_FEC_MAC_IN_OCOTP |
| 248 | |
| 249 | #define MXS_OCOTP_MAX_TIMEOUT 1000000 |
| 250 | void imx_get_mac_from_fuse(int dev_id, unsigned char *mac) |
| 251 | { |
Otavio Salvador | 22f4ff9 | 2012-08-05 09:05:31 +0000 | [diff] [blame] | 252 | struct mxs_ocotp_regs *ocotp_regs = |
| 253 | (struct mxs_ocotp_regs *)MXS_OCOTP_BASE; |
Fabio Estevam | 4029c01 | 2011-12-20 06:42:29 +0000 | [diff] [blame] | 254 | uint32_t data; |
| 255 | |
| 256 | memset(mac, 0, 6); |
| 257 | |
| 258 | writel(OCOTP_CTRL_RD_BANK_OPEN, &ocotp_regs->hw_ocotp_ctrl_set); |
| 259 | |
Otavio Salvador | cbf0bf2 | 2012-08-13 09:53:12 +0000 | [diff] [blame] | 260 | if (mxs_wait_mask_clr(&ocotp_regs->hw_ocotp_ctrl_reg, OCOTP_CTRL_BUSY, |
Fabio Estevam | 4029c01 | 2011-12-20 06:42:29 +0000 | [diff] [blame] | 261 | MXS_OCOTP_MAX_TIMEOUT)) { |
| 262 | printf("MXS FEC: Can't get MAC from OCOTP\n"); |
| 263 | return; |
| 264 | } |
| 265 | |
| 266 | data = readl(&ocotp_regs->hw_ocotp_cust0); |
| 267 | |
| 268 | mac[2] = (data >> 24) & 0xff; |
| 269 | mac[3] = (data >> 16) & 0xff; |
| 270 | mac[4] = (data >> 8) & 0xff; |
| 271 | mac[5] = data & 0xff; |
| 272 | mx28_adjust_mac(dev_id, mac); |
| 273 | } |
| 274 | #else |
| 275 | void imx_get_mac_from_fuse(int dev_id, unsigned char *mac) |
| 276 | { |
| 277 | memset(mac, 0, 6); |
| 278 | } |
| 279 | #endif |
| 280 | |
Otavio Salvador | a2bbe0c | 2012-08-19 04:58:30 +0000 | [diff] [blame] | 281 | int mxs_dram_init(void) |
Fabio Estevam | 93f3a89 | 2011-12-20 05:46:33 +0000 | [diff] [blame] | 282 | { |
Mans Rullgard | 2f66b40 | 2018-04-21 16:11:09 +0100 | [diff] [blame] | 283 | struct mxs_spl_data *data = MXS_SPL_DATA; |
Fabio Estevam | 93f3a89 | 2011-12-20 05:46:33 +0000 | [diff] [blame] | 284 | |
Marek Vasut | 9136fe9 | 2012-05-01 11:09:44 +0000 | [diff] [blame] | 285 | if (data->mem_dram_size == 0) { |
Otavio Salvador | a2bbe0c | 2012-08-19 04:58:30 +0000 | [diff] [blame] | 286 | printf("MXS:\n" |
Marek Vasut | 9136fe9 | 2012-05-01 11:09:44 +0000 | [diff] [blame] | 287 | "Error, the RAM size passed up from SPL is 0!\n"); |
Fabio Estevam | 93f3a89 | 2011-12-20 05:46:33 +0000 | [diff] [blame] | 288 | hang(); |
| 289 | } |
| 290 | |
Marek Vasut | 9136fe9 | 2012-05-01 11:09:44 +0000 | [diff] [blame] | 291 | gd->ram_size = data->mem_dram_size; |
Fabio Estevam | 93f3a89 | 2011-12-20 05:46:33 +0000 | [diff] [blame] | 292 | return 0; |
| 293 | } |
| 294 | |
Marek Vasut | c140e98 | 2011-11-08 23:18:08 +0000 | [diff] [blame] | 295 | U_BOOT_CMD( |
| 296 | clocks, CONFIG_SYS_MAXARGS, 1, do_mx28_showclocks, |
| 297 | "display clocks", |
| 298 | "" |
| 299 | ); |