1 From 4bb641f4d28053bd1ff4af73dc0a63be2151f851 Mon Sep 17 00:00:00 2001
2 From: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
3 Date: Mon, 25 Apr 2016 14:37:33 +0530
4 Subject: [PATCH 15/93] armv8: ls1012a: Add support of ls1012ardb board
6 QorIQ LS1012A Reference Design System (LS1012ARDB) is a high-performance
7 development platform, with a complete debugging environment.
8 The LS1012ARDB board supports the QorIQ LS1012A processor and is
9 optimized to support the high-bandwidth DDR3L memory and
10 a full complement of high-speed SerDes ports.
12 Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
13 Signed-off-by: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
15 arch/arm/Kconfig | 10 ++
16 arch/arm/dts/Makefile | 3 +-
17 arch/arm/dts/fsl-ls1012a-rdb.dts | 16 +++
18 arch/arm/dts/fsl-ls1012a-rdb.dtsi | 39 ++++++
19 board/freescale/ls1012ardb/Kconfig | 15 +++
20 board/freescale/ls1012ardb/MAINTAINERS | 6 +
21 board/freescale/ls1012ardb/Makefile | 7 +
22 board/freescale/ls1012ardb/README | 89 +++++++++++++
23 board/freescale/ls1012ardb/ls1012ardb.c | 220 +++++++++++++++++++++++++++++++
24 configs/ls1012ardb_qspi_defconfig | 10 ++
25 include/configs/ls1012a_common.h | 3 +-
26 include/configs/ls1012ardb.h | 61 +++++++++
27 include/linux/usb/xhci-fsl.h | 2 +-
28 13 files changed, 477 insertions(+), 4 deletions(-)
29 create mode 100644 arch/arm/dts/fsl-ls1012a-rdb.dts
30 create mode 100644 arch/arm/dts/fsl-ls1012a-rdb.dtsi
31 create mode 100644 board/freescale/ls1012ardb/Kconfig
32 create mode 100644 board/freescale/ls1012ardb/MAINTAINERS
33 create mode 100644 board/freescale/ls1012ardb/Makefile
34 create mode 100644 board/freescale/ls1012ardb/README
35 create mode 100644 board/freescale/ls1012ardb/ls1012ardb.c
36 create mode 100644 configs/ls1012ardb_qspi_defconfig
37 create mode 100644 include/configs/ls1012ardb.h
39 diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
40 index f5033db..5c20801 100644
41 --- a/arch/arm/Kconfig
42 +++ b/arch/arm/Kconfig
43 @@ -656,6 +656,15 @@ config TARGET_LS1012AQDS
44 development platform that supports the QorIQ LS1012A
45 Layerscape Architecture processor.
47 +config TARGET_LS1012ARDB
48 + bool "Support ls1012ardb"
51 + Support for Freescale LS1012ARDB platform.
52 + The LS1012A Reference design board (RDB) is a high-performance
53 + development platform that supports the QorIQ LS1012A
54 + Layerscape Architecture processor.
56 config TARGET_LS1021AQDS
57 bool "Support ls1021aqds"
59 @@ -802,6 +811,7 @@ source "board/freescale/ls1043aqds/Kconfig"
60 source "board/freescale/ls1021atwr/Kconfig"
61 source "board/freescale/ls1043ardb/Kconfig"
62 source "board/freescale/ls1012aqds/Kconfig"
63 +source "board/freescale/ls1012ardb/Kconfig"
64 source "board/freescale/mx23evk/Kconfig"
65 source "board/freescale/mx25pdk/Kconfig"
66 source "board/freescale/mx28evk/Kconfig"
67 diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
68 index ed5eb38..9e8137b 100644
69 --- a/arch/arm/dts/Makefile
70 +++ b/arch/arm/dts/Makefile
71 @@ -95,7 +95,8 @@ dtb-$(CONFIG_FSL_LSCH3) += fsl-ls2080a-qds.dtb \
72 dtb-$(CONFIG_FSL_LSCH2) += fsl-ls1043a-qds-duart.dtb \
73 fsl-ls1043a-qds-lpuart.dtb \
76 + fsl-ls1012a-qds.dtb \
79 dtb-$(CONFIG_MACH_SUN4I) += \
81 diff --git a/arch/arm/dts/fsl-ls1012a-rdb.dts b/arch/arm/dts/fsl-ls1012a-rdb.dts
83 index 0000000..4ec9786
85 +++ b/arch/arm/dts/fsl-ls1012a-rdb.dts
88 + * Device Tree file for Freescale Layerscape-1012A family SoC.
90 + * Copyright (C) 2016, Freescale Semiconductor
92 + * SPDX-License-Identifier: GPL-2.0+
96 +#include "fsl-ls1012a-rdb.dtsi"
100 + stdout-path = &duart0;
103 diff --git a/arch/arm/dts/fsl-ls1012a-rdb.dtsi b/arch/arm/dts/fsl-ls1012a-rdb.dtsi
105 index 0000000..71aba78
107 +++ b/arch/arm/dts/fsl-ls1012a-rdb.dtsi
110 + * Device Tree Include file for Freescale Layerscape-1012A family SoC.
112 + * Copyright (C) 2016, Freescale Semiconductor
114 + * This file is licensed under the terms of the GNU General Public
115 + * License version 2. This program is licensed "as is" without any
116 + * warranty of any kind, whether express or implied.
119 +/include/ "fsl-ls1012a.dtsi"
122 + model = "LS1012A RDB Board";
132 + qflash0: s25fl128s@0 {
133 + #address-cells = <1>;
135 + compatible = "spi-flash";
136 + spi-max-frequency = <20000000>;
148 diff --git a/board/freescale/ls1012ardb/Kconfig b/board/freescale/ls1012ardb/Kconfig
150 index 0000000..3f67c28
152 +++ b/board/freescale/ls1012ardb/Kconfig
154 +if TARGET_LS1012ARDB
157 + default "ls1012ardb"
160 + default "freescale"
163 + default "fsl-layerscape"
165 +config SYS_CONFIG_NAME
166 + default "ls1012ardb"
169 diff --git a/board/freescale/ls1012ardb/MAINTAINERS b/board/freescale/ls1012ardb/MAINTAINERS
171 index 0000000..757e810
173 +++ b/board/freescale/ls1012ardb/MAINTAINERS
178 +F: board/freescale/ls1012ardb/
179 +F: include/configs/ls1012ardb.h
180 +F: configs/ls1012ardb_defconfig
181 diff --git a/board/freescale/ls1012ardb/Makefile b/board/freescale/ls1012ardb/Makefile
183 index 0000000..05fa9d9
185 +++ b/board/freescale/ls1012ardb/Makefile
188 +# Copyright 2016 Freescale Semiconductor, Inc.
190 +# SPDX-License-Identifier: GPL-2.0+
193 +obj-y += ls1012ardb.o
194 diff --git a/board/freescale/ls1012ardb/README b/board/freescale/ls1012ardb/README
196 index 0000000..cda03f6
198 +++ b/board/freescale/ls1012ardb/README
202 +The LS1012ARDB power supplies (PS) provide all the voltages necessary
203 +for the correct operation of the LS1012A processor, DDR3L, QSPI memory,
204 +and other onboard peripherals.
206 +LS1012A SoC Overview
207 +--------------------
208 +The LS1012A features an advanced 64-bit ARM v8 Cortex-
209 +A53 processor, with 32 KB of parity protected L1-I cache,
210 +32 KB of ECC protected L1-D cache, as well as 256 KB of
211 +ECC protected L2 cache.
213 +The LS1012A SoC includes the following function and features:
214 + - One 64-bit ARM v8 Cortex-A53 core with the following capabilities:
215 + - ARM v8 cryptography extensions
216 + - One 16-bit DDR3L SDRAM memory controller, Up to 1.0 GT/s, Supports
217 + 16-/8-bit operation (no ECC support)
218 + - ARM core-link CCI-400 cache coherent interconnect
219 + - Packet Forwarding Engine (PFE)
220 + - Cryptography acceleration (SEC)
221 + - Ethernet interfaces supported by PFE:
222 + - One Configurable x3 SerDes:
223 + Two Serdes PLLs supported for usage by any SerDes data lane
224 + Support for up to 6 GBaud operation
225 + - High-speed peripheral interfaces:
226 + - One PCI Express Gen2 controller, supporting x1 operation
227 + - One serial ATA (SATA Gen 3.0) controller
228 + - One USB 3.0/2.0 controller with integrated PHY
229 + - One USB 2.0 controller with ULPI interface. .
230 + - Additional peripheral interfaces:
231 + - One quad serial peripheral interface (QuadSPI) controller
232 + - One serial peripheral interface (SPI) controller
233 + - Two enhanced secure digital host controllers
234 + - Two I2C controllers
235 + - One 16550 compliant DUART (two UART interfaces)
236 + - Two general purpose IOs (GPIO)
238 + - Five synchronous audio interfaces (SAI)
239 + - Pre-boot loader (PBL) provides pre-boot initialization and RCW loading
240 + - Single-source clocking solution enabling generation of core, platform,
241 + DDR, SerDes, and USB clocks from a single external crystal and internal
243 + - Thermal monitor unit (TMU) with +/- 3C accuracy
244 + - Two WatchDog timers
245 + - ARM generic timer
246 + - QorIQ platform's trust architecture 2.1
248 + LS1012ARDB board Overview
249 + -----------------------
250 + - SERDES Connections, 4 lanes supporting:
251 + - PCI Express - 3.0
255 + - 6-bit, 1 GB DDR3L SDRAM memory, running at data rates up to 1 GT/s
256 + -QSPI: A dual 1:3 switch, NX3L4357GM,115 (U35) drives the QSPI chip-select
258 + - QSPI NOR flash memory (2 virtual banks)
259 + - the QSPI emulator.s
261 + - one high-speed USB 2.0/3.0 port.
262 + - Two enhanced secure digital host controllers:
263 + - SDHC1 controller can be connected to onboard SDHC connector
264 + - SDHC2 controller: Three dual 1:4 mux/demux devices,
265 + 74CBTLV3253DS (U30, U31, U33) drive the SDHC2 signals to eMMC,
266 + SDIO WiFi, SPI, and Ardiuno shield
267 + - 2 I2C controllers
268 + - One SATA onboard connectors
270 + - The LS1012A processor consists of two UART controllers,
271 + out of which only UART1 is used on RDB.
276 +a) QSPI Flash Emu Boot
282 +Images | Size |QSPI Flash Address
283 +------------------------------------------
284 +RCW + PBI | 1MB | 0x4000_0000
285 +U-boot | 1MB | 0x4010_0000
286 +U-boot Env | 1MB | 0x4020_0000
287 +PPA FIT image | 2MB | 0x4050_0000
288 +Linux ITB | ~53MB | 0x40A0_0000
289 diff --git a/board/freescale/ls1012ardb/ls1012ardb.c b/board/freescale/ls1012ardb/ls1012ardb.c
291 index 0000000..4a7aaaa
293 +++ b/board/freescale/ls1012ardb/ls1012ardb.c
296 + * Copyright 2016 Freescale Semiconductor, Inc.
298 + * SPDX-License-Identifier: GPL-2.0+
304 +#include <asm/arch/clock.h>
305 +#include <asm/arch/fsl_serdes.h>
306 +#include <asm/arch/ppa.h>
307 +#include <asm/arch/soc.h>
308 +#include <hwconfig.h>
312 +#include <fsl_csu.h>
313 +#include <fsl_esdhc.h>
314 +#include <environment.h>
315 +#include <fsl_mmdc.h>
318 +DECLARE_GLOBAL_DATA_PTR;
320 +int checkboard(void)
324 + puts("Board: LS1012ARDB ");
326 + /* Initialize i2c early for Serial flash bank information */
327 + i2c_set_bus_num(0);
329 + if (i2c_read(I2C_MUX_IO1_ADDR, 1, 1, &in1, 1) < 0) {
330 + printf("Error reading i2c boot information!\n");
331 + return 0; /* Don't want to hang() on this error */
335 + if ((in1 & (~__SW_REV_MASK)) == __SW_REV_A)
337 + else if ((in1 & (~__SW_REV_MASK)) == __SW_REV_B)
342 + printf(", boot from QSPI");
343 + if ((in1 & (~__SW_BOOT_MASK)) == __SW_BOOT_EMU)
345 + else if ((in1 & (~__SW_BOOT_MASK)) == __SW_BOOT_BANK1)
347 + else if ((in1 & (~__SW_BOOT_MASK)) == __SW_BOOT_BANK2)
355 +void mmdc_init(void)
357 + struct mmdc_p_regs *mmdc =
358 + (struct mmdc_p_regs *)CONFIG_SYS_FSL_DDR_ADDR;
360 + /* Set MMDC_MDSCR[CON_REQ] */
361 + out_be32(&mmdc->mdscr, 0x00008000);
363 + /* configure timing parms */
364 + out_be32(&mmdc->mdotc, 0x12554000);
365 + out_be32(&mmdc->mdcfg0, 0xbabf7954);
366 + out_be32(&mmdc->mdcfg1, 0xff328f64);
367 + out_be32(&mmdc->mdcfg2, 0x01ff00db);
370 + out_be32(&mmdc->mdmisc, 0x00000680);
371 + out_be32(&mmdc->mpmur0, 0x00000800);
372 + out_be32(&mmdc->mdrwd, 0x00002000);
373 + out_be32(&mmdc->mpodtctrl, 0x0000022a);
375 + /* out of reset delays */
376 + out_be32(&mmdc->mdor, 0x00bf1023);
378 + /* physical parms */
379 + out_be32(&mmdc->mdctl, 0x05180000);
380 + out_be32(&mmdc->mdasp, 0x0000007f);
383 + out_be32(&mmdc->mdctl, 0x85180000);
385 + /* dram init sequence: update MRs */
386 + out_be32(&mmdc->mdscr, 0x00088032);
387 + out_be32(&mmdc->mdscr, 0x00008033);
388 + out_be32(&mmdc->mdscr, 0x00048031);
389 + out_be32(&mmdc->mdscr, 0x19308030);
391 + /* dram init sequence: ZQCL */
392 + out_be32(&mmdc->mdscr, 0x04008040);
393 + out_be32(&mmdc->mpzqhwctrl, 0xa1390003);
397 + /* Calibrations now: wr lvl */
398 + out_be32(&mmdc->mdscr, 0x00848031);
399 + out_be32(&mmdc->mdscr, 0x00008200);
400 + out_be32(&mmdc->mpwlgcr, 0x00000001);
404 + out_be32(&mmdc->mdscr, 0x00048031);
405 + out_be32(&mmdc->mdscr, 0x00008000);
407 + /* manual_refresh */
408 + out_be32(&mmdc->mdscr, 0x00008020);
412 + /* Calibrations now: Read DQS gating calibration */
413 + out_be32(&mmdc->mdscr, 0x04008050);
414 + out_be32(&mmdc->mdscr, 0x00048033);
415 + out_be32(&mmdc->mppdcmpr2, 0x00000001);
416 + out_be32(&mmdc->mprddlctl, 0x40404040);
417 + out_be32(&mmdc->mpdgctrl0, 0x10000000);
421 + out_be32(&mmdc->mdscr, 0x00008033);
423 + /* manual_refresh */
424 + out_be32(&mmdc->mdscr, 0x00008020);
428 + /* Calibrations now: Read calibration */
429 + out_be32(&mmdc->mdscr, 0x04008050);
430 + out_be32(&mmdc->mdscr, 0x00048033);
431 + out_be32(&mmdc->mppdcmpr2, 0x00000001);
432 + out_be32(&mmdc->mprddlhwctl, 0x00000010);
436 + out_be32(&mmdc->mdscr, 0x00008033);
438 + /* manual_refresh */
439 + out_be32(&mmdc->mdscr, 0x00008020);
444 + out_be32(&mmdc->mdpdc, 0x00030035);
445 + out_be32(&mmdc->mapsr, 0x00001067);
447 + /* refresh scheme */
448 + out_be32(&mmdc->mdref, 0x103e8000);
452 + /* disable CON_REQ */
453 + out_be32(&mmdc->mdscr, 0x0);
462 + gd->ram_size = 0x40000000;
467 +int board_eth_init(bd_t *bis)
469 + return pci_eth_init(bis);
472 +int board_early_init_f(void)
474 + fsl_lsch2_early_init_f();
479 +int board_init(void)
481 + struct ccsr_cci400 *cci = (struct ccsr_cci400 *)CONFIG_SYS_CCI400_ADDR;
483 + * Set CCI-400 control override register to enable barrier
486 + out_le32(&cci->ctrl_ord, CCI400_CTRLORD_EN_BARRIER);
488 +#ifdef CONFIG_ENV_IS_NOWHERE
489 + gd->env_addr = (ulong)&default_environment[0];
492 +#ifdef CONFIG_LAYERSCAPE_NS_ACCESS
493 + enable_layerscape_ns_access();
499 +int ft_board_setup(void *blob, bd_t *bd)
501 + u64 base[CONFIG_NR_DRAM_BANKS];
502 + u64 size[CONFIG_NR_DRAM_BANKS];
504 + /* fixup DT for the two DDR banks */
505 + base[0] = gd->bd->bi_dram[0].start;
506 + size[0] = gd->bd->bi_dram[0].size;
507 + base[1] = gd->bd->bi_dram[1].start;
508 + size[1] = gd->bd->bi_dram[1].size;
510 + fdt_fixup_memory_banks(blob, base, size, 2);
511 + ft_cpu_setup(blob, bd);
515 diff --git a/configs/ls1012ardb_qspi_defconfig b/configs/ls1012ardb_qspi_defconfig
517 index 0000000..f819038
519 +++ b/configs/ls1012ardb_qspi_defconfig
522 +CONFIG_TARGET_LS1012ARDB=y
523 +CONFIG_SYS_EXTRA_OPTIONS="QSPI_BOOT"
524 +# CONFIG_CMD_IMLS is not set
525 +CONFIG_SYS_NS16550=y
526 +CONFIG_DEFAULT_DEVICE_TREE="fsl-ls1012a-rdb"
531 diff --git a/include/configs/ls1012a_common.h b/include/configs/ls1012a_common.h
532 index 9ed04f9..3fd360a 100644
533 --- a/include/configs/ls1012a_common.h
534 +++ b/include/configs/ls1012a_common.h
536 #define CONFIG_LS1012A
539 -#define CONFIG_SYS_HAS_SERDES
540 +#define CONFIG_SYS_HAS_SERDES
542 #include <asm/arch/config.h>
543 #define CONFIG_SYS_NO_FLASH
545 #define CONFIG_ENV_SPI_MODE 0x03
546 #define CONFIG_CMD_SF
547 #define CONFIG_SPI_FLASH_SPANSION
548 -#define CONFIG_SPI_FLASH_ATMEL
549 #define CONFIG_FSL_SPI_INTERFACE
550 #define CONFIG_SF_DATAFLASH
552 diff --git a/include/configs/ls1012ardb.h b/include/configs/ls1012ardb.h
554 index 0000000..9ff5935
556 +++ b/include/configs/ls1012ardb.h
559 + * Copyright 2016 Freescale Semiconductor, Inc.
561 + * SPDX-License-Identifier: GPL-2.0+
564 +#ifndef __LS1012ARDB_H__
565 +#define __LS1012ARDB_H__
567 +#include "ls1012a_common.h"
570 +#define CONFIG_DIMM_SLOTS_PER_CTLR 1
571 +#define CONFIG_CHIP_SELECTS_PER_CTRL 1
572 +#define CONFIG_NR_DRAM_BANKS 2
574 +#define CONFIG_CMD_MEMINFO
575 +#define CONFIG_CMD_MEMTEST
576 +#define CONFIG_SYS_MEMTEST_START 0x80000000
577 +#define CONFIG_SYS_MEMTEST_END 0x9fffffff
579 +#define CONFIG_PHYLIB
580 +#define CONFIG_PHY_REALTEK
581 +#define SGMII_PHY1_ADDR 0x0
582 +#define RGMII_PHY2_ADDR 0x1
587 +#define CONFIG_HAS_FSL_XHCI_USB
589 +#ifdef CONFIG_HAS_FSL_XHCI_USB
590 +#define CONFIG_USB_XHCI
591 +#define CONFIG_USB_XHCI_FSL
592 +#define CONFIG_USB_XHCI_DWC3
593 +#define CONFIG_USB_MAX_CONTROLLER_COUNT 1
594 +#define CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS 2
595 +#define CONFIG_CMD_USB
596 +#define CONFIG_USB_STORAGE
597 +#define CONFIG_CMD_EXT2
604 +#define I2C_MUX_IO1_ADDR 0x24
605 +#define __SW_BOOT_MASK 0xFC
606 +#define __SW_BOOT_EMU 0x10
607 +#define __SW_BOOT_BANK1 0x00
608 +#define __SW_BOOT_BANK2 0x01
609 +#define __SW_REV_MASK 0x07
610 +#define __SW_REV_A 0xF8
611 +#define __SW_REV_B 0xF0
613 +#define CONFIG_CMD_MEMINFO
614 +#define CONFIG_CMD_MEMTEST
615 +#define CONFIG_SYS_MEMTEST_START 0x80000000
616 +#define CONFIG_SYS_MEMTEST_END 0x9fffffff
618 +#endif /* __LS1012ARDB_H__ */
619 diff --git a/include/linux/usb/xhci-fsl.h b/include/linux/usb/xhci-fsl.h
620 index 72a5d5b..7ab88c3 100644
621 --- a/include/linux/usb/xhci-fsl.h
622 +++ b/include/linux/usb/xhci-fsl.h
623 @@ -62,7 +62,7 @@ struct fsl_xhci {
624 #define CONFIG_SYS_FSL_XHCI_USB1_ADDR CONFIG_SYS_LS2080A_XHCI_USB1_ADDR
625 #define CONFIG_SYS_FSL_XHCI_USB2_ADDR CONFIG_SYS_LS2080A_XHCI_USB2_ADDR
626 #define CONFIG_SYS_FSL_XHCI_USB3_ADDR 0
627 -#elif defined(CONFIG_LS1043A)
628 +#elif defined(CONFIG_LS1043A) || defined(CONFIG_LS1012A)
629 #define CONFIG_SYS_FSL_XHCI_USB1_ADDR CONFIG_SYS_LS1043A_XHCI_USB1_ADDR
630 #define CONFIG_SYS_FSL_XHCI_USB2_ADDR CONFIG_SYS_LS1043A_XHCI_USB2_ADDR
631 #define CONFIG_SYS_FSL_XHCI_USB3_ADDR CONFIG_SYS_LS1043A_XHCI_USB3_ADDR