u-boot/board/freescale/ls1021atsn
Jianchao Wang 8782122052 Add support for the NXP LS1021A-TSN board
The LS1021A-TSN is a development board built by VVDN/Argonboards in
partnership with NXP.

It features the LS1021A SoC and the first-generation SJA1105T Ethernet
switch for prototyping implementations of a subset of IEEE 802.1 TSN
standards.

Supported boot media: microSD card (via SPL), QSPI flash.

Rev. A of the board uses a Spansion S25FL512S_256K serial flash, which
is 64 MB in size and has an erase sector size of 256KB (therefore,
flashing the RCW would erase part of U-Boot).

Rev. B and C of the board use a Spansion S25FL256S1 serial flash, which
is only 32 MB in size but has an erase sector size of 64KB (therefore
the RCW image can be flashed without erasing U-Boot).

To avoid the problems above, the U-Boot base address has been selected
at 0x100000 (the start of the 5th 256KB erase sector), which works for
all board revisions. Actually 0x40000 would have been enough, but
0x100000 is common for all Layerscape devices.

eTSEC3 is connecting directly to SJA1105 via an RGMII fixed-link, but
SJA1105 is currently not supported by uboot. Therefore, eTSEC3 is
disabled.

Signed-off-by: Xiaoliang Yang <xiaoliang.yang_1@nxp.com>
Signed-off-by: Mingkai Hu <mingkai.hu@nxp.com>
Signed-off-by: Jianchao Wang <jianchao.wang@nxp.com>
Signed-off-by: Changming Huang <jerry.huang@nxp.com>
Signed-off-by: Vladimir Oltean <olteanv@gmail.com>

[Vladimir] Code taken from https://github.com/openil/u-boot (which
itself is mostly copied from ls1021a-iot) and adapted with the following
changes:

- Add a008850 errata workaround
- Converted eTSEC, MMC to DM to avoid all build warnings
- Plugged in distro boot feature, including support for extlinux.conf
- Added defconfig for QSPI boot
- Added the board/freescale/ls1021atsn/README.rst for initial setup
- Increased CONFIG_SYS_MONITOR_LEN so that the SPL malloc pool does not
  get overwritten during copying of the u-boot.bin payload from MMC to
  DDR.
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2019-07-25 13:13:31 -05:00
..
Kconfig Add support for the NXP LS1021A-TSN board 2019-07-25 13:13:31 -05:00
ls102xa_pbi.cfg Add support for the NXP LS1021A-TSN board 2019-07-25 13:13:31 -05:00
ls102xa_rcw_sd.cfg Add support for the NXP LS1021A-TSN board 2019-07-25 13:13:31 -05:00
ls1021atsn.c Add support for the NXP LS1021A-TSN board 2019-07-25 13:13:31 -05:00
MAINTAINERS Add support for the NXP LS1021A-TSN board 2019-07-25 13:13:31 -05:00
Makefile Add support for the NXP LS1021A-TSN board 2019-07-25 13:13:31 -05:00
README.rst Add support for the NXP LS1021A-TSN board 2019-07-25 13:13:31 -05:00

.. SPDX-License-Identifier: GPL-2.0

LS1021A-TSN Board Overview
==========================

 - 1GB DDR3 at 800 MHz
 - Spansion/Cypress 64 MB (Rev. A) / 32 MB (Rev. B and C) QSPI NOR flash
 - Ethernet
     - 2 SGMII 10/100/1G Ethernet ports (Atheros AR8031)
     - One SJA1105T switch with 4 Ethernet ports (Broadcom BCM5464R)
     - One internal RGMII port connected to the switch
 - SDHC
     - microSDHC/SDXC connector
 - Other I/O
    - One Serial port
    - Arduino and expansion headers
    - mPCIE slot
    - SATA port
    - USB3.0 port

LS1021A Memory map
==================

The addresses in brackets are physical addresses.

==============  ==============  ==============================  =======
Start Address   End Address     Description                     Size
==============  ==============  ==============================  =======
0x00_0000_0000  0x00_000F_FFFF  Secure Boot ROM                 1MB
0x00_0100_0000  0x00_0FFF_FFFF  CCSRBAR                         240MB
0x00_1000_0000  0x00_1000_FFFF  OCRAM0                          64KB
0x00_1001_0000  0x00_1001_FFFF  OCRAM1                          64KB
0x00_2000_0000  0x00_20FF_FFFF  DCSR                            16MB
0x00_4000_0000  0x00_5FFF_FFFF  QSPI                            512MB
0x00_6000_0000  0x00_67FF_FFFF  IFC - NOR Flash                 128MB
0x00_8000_0000  0x00_FFFF_FFFF  DRAM1                           2GB
==============  ==============  ==============================  =======

Compiling and flashing
======================

The LS1021A-TSN board comes along with a microSD card with OpenIL U-Boot that
can be used to update its internal QSPI flash (which is empty out of the
factory).

To compile and flash an SD card image::

  make ls1021atsn_sdcard_defconfig && make -j 8 && sudo cp u-boot-with-spl-pbl.bin /srv/tftpboot/
  => tftp 0x82000000 u-boot-with-spl-pbl.bin && mmc rescan && mmc erase 8 0x1100 && mmc write 0x82000000 8 0x1100

For the QSPI flash, first obtain the Reset Configuration Word binary for
bootimg from the QSPI flash from the rcw project
(https://source.codeaurora.org/external/qoriq/qoriq-components/rcw)::

  make -j 8 && sudo cp ls1021atsn/SSR_PNS_30/rcw_1200_qspiboot.bin.swapped /srv/tftpboot/

The above RCW binary takes care of swapping the QSPI AMBA memory, so that the
U-Boot binary does not need to be swapped when flashing it.

To compile and flash a U-Boot image for QSPI::

  make ls1021atsn_qspi_defconfig && make -j 8 && sudo cp u-boot.bin /srv/tftpboot/

Then optionally create a custom uboot-env.txt file (although the default
environment already supports distro boot) and convert it to binary format::

  mkenvimage -s 2M -o /srv/tftpboot/uboot-env.bin uboot-env.txt

To program the QSPI flash with the images::

  => tftp 0x82000000 rcw_1200_qspiboot.bin.swapped && sf probe && sf erase 0x0 +${filesize} && sf write 0x82000000 0x0 ${filesize}
  => tftp 0x82000000 u-boot.bin && sf probe && sf erase 0x100000 +${filesize} && sf write 0x82000000 0x100000 ${filesize}
  => tftp 0x82000000 uboot-env.bin && sf probe && sf erase 0x400000 +${filesize} && sf write 0x82000000 0x400000 ${filesize}

The boards contain an AT24 I2C EEPROM that is supposed to hold the MAC
addresses of the Ethernet interfaces, however the EEPROM comes blank out of
the factory, and the MAC addresses are printed on a label on the bottom of
the boards.

To write the MAC addresses to the EEPROM, the following needs to be done once::

  => mac id
  => mac 0 00:1F:7B:xx:xx:xx
  => mac 1 00:1F:7B:xx:xx:xx
  => mac 2 00:1F:7B:xx:xx:xx
  => mac save

The switch ports do not have their own MAC address - they inherit it from the
master enet2 port.

Known issues and limitations
============================

- The 4 SJA1105 switch ports are not functional in U-Boot for now.
- Since the IFC pins are multiplexed with QSPI on LS1021A, currently there is
  no way to talk to the CPLD for e.g. running the "qixis_reset" command, or
  turning the fan on, etc.