avionic design with actual uboot and tooling
submodule of avionic design uboot bootloader and with included tools to get you started , read readme.md and readme-tk1-loader.md
This commit is contained in:
16
u-boot/board/freescale/ls1043ardb/Kconfig
Normal file
16
u-boot/board/freescale/ls1043ardb/Kconfig
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
if TARGET_LS1043ARDB
|
||||
|
||||
config SYS_BOARD
|
||||
default "ls1043ardb"
|
||||
|
||||
config SYS_VENDOR
|
||||
default "freescale"
|
||||
|
||||
config SYS_SOC
|
||||
default "fsl-layerscape"
|
||||
|
||||
config SYS_CONFIG_NAME
|
||||
default "ls1043ardb"
|
||||
|
||||
endif
|
||||
14
u-boot/board/freescale/ls1043ardb/MAINTAINERS
Normal file
14
u-boot/board/freescale/ls1043ardb/MAINTAINERS
Normal file
@@ -0,0 +1,14 @@
|
||||
LS1043A BOARD
|
||||
M: Mingkai Hu <Mingkai.hu@freescale.com>
|
||||
S: Maintained
|
||||
F: board/freescale/ls1043ardb/
|
||||
F: board/freescale/ls1043ardb/ls1043ardb.c
|
||||
F: include/configs/ls1043ardb.h
|
||||
F: configs/ls1043ardb_defconfig
|
||||
F: configs/ls1043ardb_nand_defconfig
|
||||
F: configs/ls1043ardb_sdcard_defconfig
|
||||
|
||||
LS1043A_SECURE_BOOT BOARD
|
||||
M: Aneesh Bansal <aneesh.bansal@freescale.com>
|
||||
S: Maintained
|
||||
F: configs/ls1043ardb_SECURE_BOOT_defconfig
|
||||
10
u-boot/board/freescale/ls1043ardb/Makefile
Normal file
10
u-boot/board/freescale/ls1043ardb/Makefile
Normal file
@@ -0,0 +1,10 @@
|
||||
#
|
||||
# Copyright 2015 Freescale Semiconductor
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0+
|
||||
#
|
||||
|
||||
obj-y += cpld.o
|
||||
obj-y += ddr.o
|
||||
obj-y += ls1043ardb.o
|
||||
obj-$(CONFIG_SYS_DPAA_FMAN) += eth.o
|
||||
54
u-boot/board/freescale/ls1043ardb/README
Normal file
54
u-boot/board/freescale/ls1043ardb/README
Normal file
@@ -0,0 +1,54 @@
|
||||
Overview
|
||||
--------
|
||||
The LS1043A Reference Design Board (RDB) is a high-performance computing,
|
||||
evaluation, and development platform that supports the QorIQ LS1043A
|
||||
LayerScape Architecture processor. The LS1043ARDB provides SW development
|
||||
platform for the Freescale LS1043A processor series, with a complete
|
||||
debugging environment. The LS1043A RDB is lead-free and RoHS-compliant.
|
||||
|
||||
LS1043A SoC Overview
|
||||
--------------------
|
||||
Please refer arch/arm/cpu/armv8/fsl-layerscape/doc/README.soc for LS1043A
|
||||
SoC overview.
|
||||
|
||||
LS1043ARDB board Overview
|
||||
-----------------------
|
||||
- SERDES Connections, 4 lanes supporting:
|
||||
- PCI Express 2.0 with two PCIe connectors supporting: miniPCIe card and
|
||||
standard PCIe card
|
||||
- QSGMII with x4 RJ45 connector
|
||||
- XFI with x1 RJ45 connector
|
||||
- DDR Controller
|
||||
- 2GB 32bits DDR4 SDRAM. Support rates of up to 1600MT/s
|
||||
-IFC/Local Bus
|
||||
- One 128MB NOR flash 16-bit data bus
|
||||
- One 512 MB NAND flash with ECC support
|
||||
- CPLD connection
|
||||
- USB 3.0
|
||||
- Two super speed USB 3.0 Type A ports
|
||||
- SDHC: connects directly to a full SD/MMC slot
|
||||
- DSPI: 16 MB high-speed flash Memory for boot code and storage (up to 108MHz)
|
||||
- 4 I2C controllers
|
||||
- UART
|
||||
- Two 4-pin serial ports at up to 115.2 Kbit/s
|
||||
- Two DB9 D-Type connectors supporting one Serial port each
|
||||
- ARM JTAG support
|
||||
|
||||
Memory map from core's view
|
||||
----------------------------
|
||||
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_6000_0000 0x00_67FF_FFFF IFC - NOR Flash 128MB
|
||||
0x00_7E80_0000 0x00_7E80_FFFF IFC - NAND Flash 64KB
|
||||
0x00_7FB0_0000 0x00_7FB0_0FFF IFC - FPGA 4KB
|
||||
0x00_8000_0000 0x00_FFFF_FFFF DRAM1 2GB
|
||||
|
||||
Booting Options
|
||||
---------------
|
||||
a) NOR boot
|
||||
b) NAND boot
|
||||
c) SD boot
|
||||
174
u-boot/board/freescale/ls1043ardb/cpld.c
Normal file
174
u-boot/board/freescale/ls1043ardb/cpld.c
Normal file
@@ -0,0 +1,174 @@
|
||||
/*
|
||||
* Copyright 2015 Freescale Semiconductor
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*
|
||||
* Freescale LS1043ARDB board-specific CPLD controlling supports.
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <command.h>
|
||||
#include <asm/io.h>
|
||||
#include "cpld.h"
|
||||
|
||||
u8 cpld_read(unsigned int reg)
|
||||
{
|
||||
void *p = (void *)CONFIG_SYS_CPLD_BASE;
|
||||
|
||||
return in_8(p + reg);
|
||||
}
|
||||
|
||||
void cpld_write(unsigned int reg, u8 value)
|
||||
{
|
||||
void *p = (void *)CONFIG_SYS_CPLD_BASE;
|
||||
|
||||
out_8(p + reg, value);
|
||||
}
|
||||
|
||||
/* Set the boot bank to the alternate bank */
|
||||
void cpld_set_altbank(void)
|
||||
{
|
||||
u16 reg = CPLD_CFG_RCW_SRC_NOR;
|
||||
u8 reg4 = CPLD_READ(soft_mux_on);
|
||||
u8 reg5 = (u8)(reg >> 1);
|
||||
u8 reg6 = (u8)(reg & 1);
|
||||
u8 reg7 = CPLD_READ(vbank);
|
||||
|
||||
cpld_rev_bit(®5);
|
||||
|
||||
CPLD_WRITE(soft_mux_on, reg4 | CPLD_SW_MUX_BANK_SEL | 1);
|
||||
|
||||
CPLD_WRITE(cfg_rcw_src1, reg5);
|
||||
CPLD_WRITE(cfg_rcw_src2, reg6);
|
||||
|
||||
reg7 = (reg7 & ~CPLD_BANK_SEL_MASK) | CPLD_BANK_SEL_ALTBANK;
|
||||
CPLD_WRITE(vbank, reg7);
|
||||
|
||||
CPLD_WRITE(system_rst, 1);
|
||||
}
|
||||
|
||||
/* Set the boot bank to the default bank */
|
||||
void cpld_set_defbank(void)
|
||||
{
|
||||
u16 reg = CPLD_CFG_RCW_SRC_NOR;
|
||||
u8 reg4 = CPLD_READ(soft_mux_on);
|
||||
u8 reg5 = (u8)(reg >> 1);
|
||||
u8 reg6 = (u8)(reg & 1);
|
||||
|
||||
cpld_rev_bit(®5);
|
||||
|
||||
CPLD_WRITE(soft_mux_on, reg4 | CPLD_SW_MUX_BANK_SEL | 1);
|
||||
|
||||
CPLD_WRITE(cfg_rcw_src1, reg5);
|
||||
CPLD_WRITE(cfg_rcw_src2, reg6);
|
||||
|
||||
CPLD_WRITE(vbank, 0);
|
||||
|
||||
CPLD_WRITE(system_rst, 1);
|
||||
}
|
||||
|
||||
void cpld_set_nand(void)
|
||||
{
|
||||
u16 reg = CPLD_CFG_RCW_SRC_NAND;
|
||||
u8 reg5 = (u8)(reg >> 1);
|
||||
u8 reg6 = (u8)(reg & 1);
|
||||
|
||||
cpld_rev_bit(®5);
|
||||
|
||||
CPLD_WRITE(soft_mux_on, 1);
|
||||
|
||||
CPLD_WRITE(cfg_rcw_src1, reg5);
|
||||
CPLD_WRITE(cfg_rcw_src2, reg6);
|
||||
|
||||
CPLD_WRITE(system_rst, 1);
|
||||
}
|
||||
|
||||
void cpld_set_sd(void)
|
||||
{
|
||||
u16 reg = CPLD_CFG_RCW_SRC_SD;
|
||||
u8 reg5 = (u8)(reg >> 1);
|
||||
u8 reg6 = (u8)(reg & 1);
|
||||
|
||||
cpld_rev_bit(®5);
|
||||
|
||||
CPLD_WRITE(soft_mux_on, 1);
|
||||
|
||||
CPLD_WRITE(cfg_rcw_src1, reg5);
|
||||
CPLD_WRITE(cfg_rcw_src2, reg6);
|
||||
|
||||
CPLD_WRITE(system_rst, 1);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
static void cpld_dump_regs(void)
|
||||
{
|
||||
printf("cpld_ver = %x\n", CPLD_READ(cpld_ver));
|
||||
printf("cpld_ver_sub = %x\n", CPLD_READ(cpld_ver_sub));
|
||||
printf("pcba_ver = %x\n", CPLD_READ(pcba_ver));
|
||||
printf("soft_mux_on = %x\n", CPLD_READ(soft_mux_on));
|
||||
printf("cfg_rcw_src1 = %x\n", CPLD_READ(cfg_rcw_src1));
|
||||
printf("cfg_rcw_src2 = %x\n", CPLD_READ(cfg_rcw_src2));
|
||||
printf("vbank = %x\n", CPLD_READ(vbank));
|
||||
printf("sysclk_sel = %x\n", CPLD_READ(sysclk_sel));
|
||||
printf("uart_sel = %x\n", CPLD_READ(uart_sel));
|
||||
printf("sd1refclk_sel = %x\n", CPLD_READ(sd1refclk_sel));
|
||||
printf("tdmclk_mux_sel = %x\n", CPLD_READ(tdmclk_mux_sel));
|
||||
printf("sdhc_spics_sel = %x\n", CPLD_READ(sdhc_spics_sel));
|
||||
printf("status_led = %x\n", CPLD_READ(status_led));
|
||||
putc('\n');
|
||||
}
|
||||
#endif
|
||||
|
||||
void cpld_rev_bit(unsigned char *value)
|
||||
{
|
||||
u8 rev_val, val;
|
||||
int i;
|
||||
|
||||
val = *value;
|
||||
rev_val = val & 1;
|
||||
for (i = 1; i <= 7; i++) {
|
||||
val >>= 1;
|
||||
rev_val <<= 1;
|
||||
rev_val |= val & 1;
|
||||
}
|
||||
|
||||
*value = rev_val;
|
||||
}
|
||||
|
||||
int do_cpld(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
if (argc <= 1)
|
||||
return cmd_usage(cmdtp);
|
||||
|
||||
if (strcmp(argv[1], "reset") == 0) {
|
||||
if (strcmp(argv[2], "altbank") == 0)
|
||||
cpld_set_altbank();
|
||||
else if (strcmp(argv[2], "nand") == 0)
|
||||
cpld_set_nand();
|
||||
else if (strcmp(argv[2], "sd") == 0)
|
||||
cpld_set_sd();
|
||||
else
|
||||
cpld_set_defbank();
|
||||
#ifdef DEBUG
|
||||
} else if (strcmp(argv[1], "dump") == 0) {
|
||||
cpld_dump_regs();
|
||||
#endif
|
||||
} else {
|
||||
rc = cmd_usage(cmdtp);
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
U_BOOT_CMD(
|
||||
cpld, CONFIG_SYS_MAXARGS, 1, do_cpld,
|
||||
"Reset the board or alternate bank",
|
||||
"reset: reset to default bank\n"
|
||||
"cpld reset altbank: reset to alternate bank\n"
|
||||
"cpld reset nand: reset to boot from NAND flash\n"
|
||||
"cpld reset sd: reset to boot from SD card\n"
|
||||
#ifdef DEBUG
|
||||
"cpld dump - display the CPLD registers\n"
|
||||
#endif
|
||||
);
|
||||
46
u-boot/board/freescale/ls1043ardb/cpld.h
Normal file
46
u-boot/board/freescale/ls1043ardb/cpld.h
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright 2015 Freescale Semiconductor
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifndef __CPLD_H__
|
||||
#define __CPLD_H__
|
||||
|
||||
/*
|
||||
* CPLD register set of LS1043ARDB board-specific.
|
||||
*/
|
||||
struct cpld_data {
|
||||
u8 cpld_ver; /* 0x0 - CPLD Major Revision Register */
|
||||
u8 cpld_ver_sub; /* 0x1 - CPLD Minor Revision Register */
|
||||
u8 pcba_ver; /* 0x2 - PCBA Revision Register */
|
||||
u8 system_rst; /* 0x3 - system reset register */
|
||||
u8 soft_mux_on; /* 0x4 - Switch Control Enable Register */
|
||||
u8 cfg_rcw_src1; /* 0x5 - Reset config word 1 */
|
||||
u8 cfg_rcw_src2; /* 0x6 - Reset config word 1 */
|
||||
u8 vbank; /* 0x7 - Flash bank selection Control */
|
||||
u8 sysclk_sel; /* 0x8 - */
|
||||
u8 uart_sel; /* 0x9 - */
|
||||
u8 sd1refclk_sel; /* 0xA - */
|
||||
u8 tdmclk_mux_sel; /* 0xB - */
|
||||
u8 sdhc_spics_sel; /* 0xC - */
|
||||
u8 status_led; /* 0xD - */
|
||||
u8 global_rst; /* 0xE - */
|
||||
};
|
||||
|
||||
u8 cpld_read(unsigned int reg);
|
||||
void cpld_write(unsigned int reg, u8 value);
|
||||
void cpld_rev_bit(unsigned char *value);
|
||||
|
||||
#define CPLD_READ(reg) cpld_read(offsetof(struct cpld_data, reg))
|
||||
#define CPLD_WRITE(reg, value) \
|
||||
cpld_write(offsetof(struct cpld_data, reg), value)
|
||||
|
||||
/* CPLD on IFC */
|
||||
#define CPLD_SW_MUX_BANK_SEL 0x40
|
||||
#define CPLD_BANK_SEL_MASK 0x07
|
||||
#define CPLD_BANK_SEL_ALTBANK 0x04
|
||||
#define CPLD_CFG_RCW_SRC_NOR 0x025
|
||||
#define CPLD_CFG_RCW_SRC_NAND 0x106
|
||||
#define CPLD_CFG_RCW_SRC_SD 0x040
|
||||
#endif
|
||||
215
u-boot/board/freescale/ls1043ardb/ddr.c
Normal file
215
u-boot/board/freescale/ls1043ardb/ddr.c
Normal file
@@ -0,0 +1,215 @@
|
||||
/*
|
||||
* Copyright 2015 Freescale Semiconductor, Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <fsl_ddr_sdram.h>
|
||||
#include <fsl_ddr_dimm_params.h>
|
||||
#include "ddr.h"
|
||||
#ifdef CONFIG_FSL_DEEP_SLEEP
|
||||
#include <fsl_sleep.h>
|
||||
#endif
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
void fsl_ddr_board_options(memctl_options_t *popts,
|
||||
dimm_params_t *pdimm,
|
||||
unsigned int ctrl_num)
|
||||
{
|
||||
const struct board_specific_parameters *pbsp, *pbsp_highest = NULL;
|
||||
ulong ddr_freq;
|
||||
|
||||
if (ctrl_num > 1) {
|
||||
printf("Not supported controller number %d\n", ctrl_num);
|
||||
return;
|
||||
}
|
||||
if (!pdimm->n_ranks)
|
||||
return;
|
||||
|
||||
pbsp = udimms[0];
|
||||
|
||||
/* Get clk_adjust, wrlvl_start, wrlvl_ctl, according to the board ddr
|
||||
* freqency and n_banks specified in board_specific_parameters table.
|
||||
*/
|
||||
ddr_freq = get_ddr_freq(0) / 1000000;
|
||||
while (pbsp->datarate_mhz_high) {
|
||||
if (pbsp->n_ranks == pdimm->n_ranks) {
|
||||
if (ddr_freq <= pbsp->datarate_mhz_high) {
|
||||
popts->clk_adjust = pbsp->clk_adjust;
|
||||
popts->wrlvl_start = pbsp->wrlvl_start;
|
||||
popts->wrlvl_ctl_2 = pbsp->wrlvl_ctl_2;
|
||||
popts->wrlvl_ctl_3 = pbsp->wrlvl_ctl_3;
|
||||
popts->cpo_override = pbsp->cpo_override;
|
||||
popts->write_data_delay =
|
||||
pbsp->write_data_delay;
|
||||
goto found;
|
||||
}
|
||||
pbsp_highest = pbsp;
|
||||
}
|
||||
pbsp++;
|
||||
}
|
||||
|
||||
if (pbsp_highest) {
|
||||
printf("Error: board specific timing not found for %lu MT/s\n",
|
||||
ddr_freq);
|
||||
printf("Trying to use the highest speed (%u) parameters\n",
|
||||
pbsp_highest->datarate_mhz_high);
|
||||
popts->clk_adjust = pbsp_highest->clk_adjust;
|
||||
popts->wrlvl_start = pbsp_highest->wrlvl_start;
|
||||
popts->wrlvl_ctl_2 = pbsp->wrlvl_ctl_2;
|
||||
popts->wrlvl_ctl_3 = pbsp->wrlvl_ctl_3;
|
||||
} else {
|
||||
panic("DIMM is not supported by this board");
|
||||
}
|
||||
found:
|
||||
debug("Found timing match: n_ranks %d, data rate %d, rank_gb %d\n",
|
||||
pbsp->n_ranks, pbsp->datarate_mhz_high, pbsp->rank_gb);
|
||||
|
||||
/* force DDR bus width to 32 bits */
|
||||
popts->data_bus_width = 1;
|
||||
popts->otf_burst_chop_en = 0;
|
||||
popts->burst_length = DDR_BL8;
|
||||
|
||||
/*
|
||||
* Factors to consider for half-strength driver enable:
|
||||
* - number of DIMMs installed
|
||||
*/
|
||||
popts->half_strength_driver_enable = 1;
|
||||
/*
|
||||
* Write leveling override
|
||||
*/
|
||||
popts->wrlvl_override = 1;
|
||||
popts->wrlvl_sample = 0xf;
|
||||
|
||||
/*
|
||||
* Rtt and Rtt_WR override
|
||||
*/
|
||||
popts->rtt_override = 0;
|
||||
|
||||
/* Enable ZQ calibration */
|
||||
popts->zq_en = 1;
|
||||
|
||||
popts->ddr_cdr1 = DDR_CDR1_DHC_EN | DDR_CDR1_ODT(DDR_CDR_ODT_80ohm);
|
||||
popts->ddr_cdr2 = DDR_CDR2_ODT(DDR_CDR_ODT_80ohm) |
|
||||
DDR_CDR2_VREF_OVRD(70); /* Vref = 70% */
|
||||
}
|
||||
|
||||
/* DDR model number: MT40A512M8HX-093E */
|
||||
#ifdef CONFIG_SYS_DDR_RAW_TIMING
|
||||
dimm_params_t ddr_raw_timing = {
|
||||
.n_ranks = 1,
|
||||
.rank_density = 2147483648u,
|
||||
.capacity = 2147483648u,
|
||||
.primary_sdram_width = 32,
|
||||
.ec_sdram_width = 0,
|
||||
.registered_dimm = 0,
|
||||
.mirrored_dimm = 0,
|
||||
.n_row_addr = 15,
|
||||
.n_col_addr = 10,
|
||||
.bank_addr_bits = 0,
|
||||
.bank_group_bits = 2,
|
||||
.edc_config = 0,
|
||||
.burst_lengths_bitmask = 0x0c,
|
||||
|
||||
.tckmin_x_ps = 938,
|
||||
.tckmax_ps = 1500,
|
||||
.caslat_x = 0x000DFA00,
|
||||
.taa_ps = 13500,
|
||||
.trcd_ps = 13500,
|
||||
.trp_ps = 13500,
|
||||
.tras_ps = 33000,
|
||||
.trc_ps = 46500,
|
||||
.trfc1_ps = 260000,
|
||||
.trfc2_ps = 160000,
|
||||
.trfc4_ps = 110000,
|
||||
.tfaw_ps = 21000,
|
||||
.trrds_ps = 3700,
|
||||
.trrdl_ps = 5300,
|
||||
.tccdl_ps = 5355,
|
||||
.refresh_rate_ps = 7800000,
|
||||
.dq_mapping[0] = 0x0,
|
||||
.dq_mapping[1] = 0x0,
|
||||
.dq_mapping[2] = 0x0,
|
||||
.dq_mapping[3] = 0x0,
|
||||
.dq_mapping[4] = 0x0,
|
||||
.dq_mapping[5] = 0x0,
|
||||
.dq_mapping[6] = 0x0,
|
||||
.dq_mapping[7] = 0x0,
|
||||
.dq_mapping[8] = 0x0,
|
||||
.dq_mapping[9] = 0x0,
|
||||
.dq_mapping[10] = 0x0,
|
||||
.dq_mapping[11] = 0x0,
|
||||
.dq_mapping[12] = 0x0,
|
||||
.dq_mapping[13] = 0x0,
|
||||
.dq_mapping[14] = 0x0,
|
||||
.dq_mapping[15] = 0x0,
|
||||
.dq_mapping[16] = 0x0,
|
||||
.dq_mapping[17] = 0x0,
|
||||
.dq_mapping_ors = 0,
|
||||
};
|
||||
|
||||
int fsl_ddr_get_dimm_params(dimm_params_t *pdimm,
|
||||
unsigned int controller_number,
|
||||
unsigned int dimm_number)
|
||||
{
|
||||
static const char dimm_model[] = "Fixed DDR on board";
|
||||
|
||||
if (((controller_number == 0) && (dimm_number == 0)) ||
|
||||
((controller_number == 1) && (dimm_number == 0))) {
|
||||
memcpy(pdimm, &ddr_raw_timing, sizeof(dimm_params_t));
|
||||
memset(pdimm->mpart, 0, sizeof(pdimm->mpart));
|
||||
memcpy(pdimm->mpart, dimm_model, sizeof(dimm_model) - 1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
phys_size_t initdram(int board_type)
|
||||
{
|
||||
phys_size_t dram_size;
|
||||
|
||||
#if defined(CONFIG_SPL_BUILD) || !defined(CONFIG_SPL)
|
||||
puts("Initializing DDR....\n");
|
||||
dram_size = fsl_ddr_sdram();
|
||||
#else
|
||||
dram_size = fsl_ddr_sdram_size();
|
||||
#endif
|
||||
erratum_a008850_post();
|
||||
|
||||
#ifdef CONFIG_FSL_DEEP_SLEEP
|
||||
fsl_dp_ddr_restore();
|
||||
#endif
|
||||
|
||||
return dram_size;
|
||||
}
|
||||
|
||||
void dram_init_banksize(void)
|
||||
{
|
||||
/*
|
||||
* gd->secure_ram tracks the location of secure memory.
|
||||
* It was set as if the memory starts from 0.
|
||||
* The address needs to add the offset of its bank.
|
||||
*/
|
||||
gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
|
||||
if (gd->ram_size > CONFIG_SYS_DDR_BLOCK1_SIZE) {
|
||||
gd->bd->bi_dram[0].size = CONFIG_SYS_DDR_BLOCK1_SIZE;
|
||||
gd->bd->bi_dram[1].start = CONFIG_SYS_DDR_BLOCK2_BASE;
|
||||
gd->bd->bi_dram[1].size = gd->ram_size -
|
||||
CONFIG_SYS_DDR_BLOCK1_SIZE;
|
||||
#ifdef CONFIG_SYS_MEM_RESERVE_SECURE
|
||||
gd->secure_ram = gd->bd->bi_dram[1].start +
|
||||
gd->secure_ram -
|
||||
CONFIG_SYS_DDR_BLOCK1_SIZE;
|
||||
gd->secure_ram |= MEM_RESERVE_SECURE_MAINTAINED;
|
||||
#endif
|
||||
} else {
|
||||
gd->bd->bi_dram[0].size = gd->ram_size;
|
||||
#ifdef CONFIG_SYS_MEM_RESERVE_SECURE
|
||||
gd->secure_ram = gd->bd->bi_dram[0].start + gd->secure_ram;
|
||||
gd->secure_ram |= MEM_RESERVE_SECURE_MAINTAINED;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
48
u-boot/board/freescale/ls1043ardb/ddr.h
Normal file
48
u-boot/board/freescale/ls1043ardb/ddr.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright 2015 Freescale Semiconductor, Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifndef __DDR_H__
|
||||
#define __DDR_H__
|
||||
|
||||
extern void erratum_a008850_post(void);
|
||||
|
||||
struct board_specific_parameters {
|
||||
u32 n_ranks;
|
||||
u32 datarate_mhz_high;
|
||||
u32 rank_gb;
|
||||
u32 clk_adjust;
|
||||
u32 wrlvl_start;
|
||||
u32 wrlvl_ctl_2;
|
||||
u32 wrlvl_ctl_3;
|
||||
u32 cpo_override;
|
||||
u32 write_data_delay;
|
||||
u32 force_2t;
|
||||
};
|
||||
|
||||
/*
|
||||
* These tables contain all valid speeds we want to override with board
|
||||
* specific parameters. datarate_mhz_high values need to be in ascending order
|
||||
* for each n_ranks group.
|
||||
*/
|
||||
static const struct board_specific_parameters udimm0[] = {
|
||||
/*
|
||||
* memory controller 0
|
||||
* num| hi| rank| clk| wrlvl | wrlvl | wrlvl | cpo |wrdata|2T
|
||||
* ranks| mhz| GB |adjst| start | ctl2 | ctl3 | |delay |
|
||||
*/
|
||||
#ifdef CONFIG_SYS_FSL_DDR4
|
||||
{1, 1666, 0, 12, 7, 0x07090800, 0x00000000,},
|
||||
{1, 1900, 0, 12, 7, 0x07090800, 0x00000000,},
|
||||
{1, 2200, 0, 12, 7, 0x07090800, 0x00000000,},
|
||||
#endif
|
||||
{}
|
||||
};
|
||||
|
||||
static const struct board_specific_parameters *udimms[] = {
|
||||
udimm0,
|
||||
};
|
||||
|
||||
#endif
|
||||
77
u-boot/board/freescale/ls1043ardb/eth.c
Normal file
77
u-boot/board/freescale/ls1043ardb/eth.c
Normal file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright 2015 Freescale Semiconductor, Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
#include <common.h>
|
||||
#include <asm/io.h>
|
||||
#include <netdev.h>
|
||||
#include <fm_eth.h>
|
||||
#include <fsl_dtsec.h>
|
||||
#include <fsl_mdio.h>
|
||||
#include <malloc.h>
|
||||
|
||||
#include "../common/fman.h"
|
||||
|
||||
int board_eth_init(bd_t *bis)
|
||||
{
|
||||
#ifdef CONFIG_FMAN_ENET
|
||||
int i;
|
||||
struct memac_mdio_info dtsec_mdio_info;
|
||||
struct memac_mdio_info tgec_mdio_info;
|
||||
struct mii_dev *dev;
|
||||
u32 srds_s1;
|
||||
struct ccsr_gur *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
|
||||
|
||||
srds_s1 = in_be32(&gur->rcwsr[4]) &
|
||||
FSL_CHASSIS2_RCWSR4_SRDS1_PRTCL_MASK;
|
||||
srds_s1 >>= FSL_CHASSIS2_RCWSR4_SRDS1_PRTCL_SHIFT;
|
||||
|
||||
dtsec_mdio_info.regs =
|
||||
(struct memac_mdio_controller *)CONFIG_SYS_FM1_DTSEC_MDIO_ADDR;
|
||||
|
||||
dtsec_mdio_info.name = DEFAULT_FM_MDIO_NAME;
|
||||
|
||||
/* Register the 1G MDIO bus */
|
||||
fm_memac_mdio_init(bis, &dtsec_mdio_info);
|
||||
|
||||
tgec_mdio_info.regs =
|
||||
(struct memac_mdio_controller *)CONFIG_SYS_FM1_TGEC_MDIO_ADDR;
|
||||
tgec_mdio_info.name = DEFAULT_FM_TGEC_MDIO_NAME;
|
||||
|
||||
/* Register the 10G MDIO bus */
|
||||
fm_memac_mdio_init(bis, &tgec_mdio_info);
|
||||
|
||||
/* Set the two on-board RGMII PHY address */
|
||||
fm_info_set_phy_address(FM1_DTSEC3, RGMII_PHY1_ADDR);
|
||||
fm_info_set_phy_address(FM1_DTSEC4, RGMII_PHY2_ADDR);
|
||||
|
||||
/* QSGMII on lane B, MAC 1/2/5/6 */
|
||||
fm_info_set_phy_address(FM1_DTSEC1, QSGMII_PORT1_PHY_ADDR);
|
||||
fm_info_set_phy_address(FM1_DTSEC2, QSGMII_PORT2_PHY_ADDR);
|
||||
fm_info_set_phy_address(FM1_DTSEC5, QSGMII_PORT3_PHY_ADDR);
|
||||
fm_info_set_phy_address(FM1_DTSEC6, QSGMII_PORT4_PHY_ADDR);
|
||||
|
||||
switch (srds_s1) {
|
||||
case 0x1455:
|
||||
break;
|
||||
default:
|
||||
printf("Invalid SerDes protocol 0x%x for LS1043ARDB\n",
|
||||
srds_s1);
|
||||
break;
|
||||
}
|
||||
|
||||
dev = miiphy_get_dev_by_name(DEFAULT_FM_MDIO_NAME);
|
||||
for (i = FM1_DTSEC1; i < FM1_DTSEC1 + CONFIG_SYS_NUM_FM1_DTSEC; i++)
|
||||
fm_info_set_mdio(i, dev);
|
||||
|
||||
/* XFI on lane A, MAC 9 */
|
||||
fm_info_set_phy_address(FM1_10GEC1, FM1_10GEC1_PHY_ADDR);
|
||||
dev = miiphy_get_dev_by_name(DEFAULT_FM_TGEC_MDIO_NAME);
|
||||
fm_info_set_mdio(FM1_10GEC1, dev);
|
||||
|
||||
cpu_eth_init(bis);
|
||||
#endif
|
||||
|
||||
return pci_eth_init(bis);
|
||||
}
|
||||
217
u-boot/board/freescale/ls1043ardb/ls1043ardb.c
Normal file
217
u-boot/board/freescale/ls1043ardb/ls1043ardb.c
Normal file
@@ -0,0 +1,217 @@
|
||||
/*
|
||||
* Copyright 2015 Freescale Semiconductor, Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <i2c.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/arch/clock.h>
|
||||
#include <asm/arch/fsl_serdes.h>
|
||||
#include <asm/arch/soc.h>
|
||||
#include <fdt_support.h>
|
||||
#include <hwconfig.h>
|
||||
#include <ahci.h>
|
||||
#include <mmc.h>
|
||||
#include <scsi.h>
|
||||
#include <fm_eth.h>
|
||||
#include <fsl_csu.h>
|
||||
#include <fsl_esdhc.h>
|
||||
#include <fsl_ifc.h>
|
||||
#include <fsl_sec.h>
|
||||
#include "cpld.h"
|
||||
#ifdef CONFIG_U_QE
|
||||
#include <fsl_qe.h>
|
||||
#endif
|
||||
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
int checkboard(void)
|
||||
{
|
||||
static const char *freq[2] = {"100.00MHZ", "156.25MHZ"};
|
||||
#ifndef CONFIG_SD_BOOT
|
||||
u8 cfg_rcw_src1, cfg_rcw_src2;
|
||||
u16 cfg_rcw_src;
|
||||
#endif
|
||||
u8 sd1refclk_sel;
|
||||
|
||||
printf("Board: LS1043ARDB, boot from ");
|
||||
|
||||
#ifdef CONFIG_SD_BOOT
|
||||
puts("SD\n");
|
||||
#else
|
||||
cfg_rcw_src1 = CPLD_READ(cfg_rcw_src1);
|
||||
cfg_rcw_src2 = CPLD_READ(cfg_rcw_src2);
|
||||
cpld_rev_bit(&cfg_rcw_src1);
|
||||
cfg_rcw_src = cfg_rcw_src1;
|
||||
cfg_rcw_src = (cfg_rcw_src << 1) | cfg_rcw_src2;
|
||||
|
||||
if (cfg_rcw_src == 0x25)
|
||||
printf("vBank %d\n", CPLD_READ(vbank));
|
||||
else if (cfg_rcw_src == 0x106)
|
||||
puts("NAND\n");
|
||||
else
|
||||
printf("Invalid setting of SW4\n");
|
||||
#endif
|
||||
|
||||
printf("CPLD: V%x.%x\nPCBA: V%x.0\n", CPLD_READ(cpld_ver),
|
||||
CPLD_READ(cpld_ver_sub), CPLD_READ(pcba_ver));
|
||||
|
||||
puts("SERDES Reference Clocks:\n");
|
||||
sd1refclk_sel = CPLD_READ(sd1refclk_sel);
|
||||
printf("SD1_CLK1 = %s, SD1_CLK2 = %s\n", freq[sd1refclk_sel], freq[0]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dram_init(void)
|
||||
{
|
||||
gd->ram_size = initdram(0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int board_early_init_f(void)
|
||||
{
|
||||
fsl_lsch2_early_init_f();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int board_init(void)
|
||||
{
|
||||
struct ccsr_scfg *scfg = (struct ccsr_scfg *)CONFIG_SYS_FSL_SCFG_ADDR;
|
||||
|
||||
#ifdef CONFIG_FSL_IFC
|
||||
init_final_memctl_regs();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LAYERSCAPE_NS_ACCESS
|
||||
enable_layerscape_ns_access();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_U_QE
|
||||
u_qe_init();
|
||||
#endif
|
||||
/* invert AQR105 IRQ pins polarity */
|
||||
out_be32(&scfg->intpcr, AQR105_IRQ_MASK);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int config_board_mux(void)
|
||||
{
|
||||
struct ccsr_scfg *scfg = (struct ccsr_scfg *)CONFIG_SYS_FSL_SCFG_ADDR;
|
||||
u32 usb_pwrfault;
|
||||
|
||||
if (hwconfig("qe-hdlc")) {
|
||||
out_be32(&scfg->rcwpmuxcr0,
|
||||
(in_be32(&scfg->rcwpmuxcr0) & ~0xff00) | 0x6600);
|
||||
printf("Assign to qe-hdlc clk, rcwpmuxcr0=%x\n",
|
||||
in_be32(&scfg->rcwpmuxcr0));
|
||||
} else {
|
||||
#ifdef CONFIG_HAS_FSL_XHCI_USB
|
||||
out_be32(&scfg->rcwpmuxcr0, 0x3333);
|
||||
out_be32(&scfg->usbdrvvbus_selcr, SCFG_USBDRVVBUS_SELCR_USB1);
|
||||
usb_pwrfault = (SCFG_USBPWRFAULT_DEDICATED <<
|
||||
SCFG_USBPWRFAULT_USB3_SHIFT) |
|
||||
(SCFG_USBPWRFAULT_DEDICATED <<
|
||||
SCFG_USBPWRFAULT_USB2_SHIFT) |
|
||||
(SCFG_USBPWRFAULT_SHARED <<
|
||||
SCFG_USBPWRFAULT_USB1_SHIFT);
|
||||
out_be32(&scfg->usbpwrfault_selcr, usb_pwrfault);
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_MISC_INIT_R)
|
||||
int misc_init_r(void)
|
||||
{
|
||||
config_board_mux();
|
||||
#ifdef CONFIG_SECURE_BOOT
|
||||
/* In case of Secure Boot, the IBR configures the SMMU
|
||||
* to allow only Secure transactions.
|
||||
* SMMU must be reset in bypass mode.
|
||||
* Set the ClientPD bit and Clear the USFCFG Bit
|
||||
*/
|
||||
u32 val;
|
||||
val = (in_le32(SMMU_SCR0) | SCR0_CLIENTPD_MASK) & ~(SCR0_USFCFG_MASK);
|
||||
out_le32(SMMU_SCR0, val);
|
||||
val = (in_le32(SMMU_NSCR0) | SCR0_CLIENTPD_MASK) & ~(SCR0_USFCFG_MASK);
|
||||
out_le32(SMMU_NSCR0, val);
|
||||
#endif
|
||||
#ifdef CONFIG_FSL_CAAM
|
||||
return sec_init();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
void fdt_del_qe(void *blob)
|
||||
{
|
||||
int nodeoff = 0;
|
||||
|
||||
while ((nodeoff = fdt_node_offset_by_compatible(blob, 0,
|
||||
"fsl,qe")) >= 0) {
|
||||
fdt_del_node(blob, nodeoff);
|
||||
}
|
||||
}
|
||||
|
||||
int ft_board_setup(void *blob, bd_t *bd)
|
||||
{
|
||||
u64 base[CONFIG_NR_DRAM_BANKS];
|
||||
u64 size[CONFIG_NR_DRAM_BANKS];
|
||||
|
||||
/* fixup DT for the two DDR banks */
|
||||
base[0] = gd->bd->bi_dram[0].start;
|
||||
size[0] = gd->bd->bi_dram[0].size;
|
||||
base[1] = gd->bd->bi_dram[1].start;
|
||||
size[1] = gd->bd->bi_dram[1].size;
|
||||
|
||||
fdt_fixup_memory_banks(blob, base, size, 2);
|
||||
ft_cpu_setup(blob, bd);
|
||||
|
||||
#ifdef CONFIG_SYS_DPAA_FMAN
|
||||
fdt_fixup_fman_ethernet(blob);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* qe-hdlc and usb multi-use the pins,
|
||||
* when set hwconfig to qe-hdlc, delete usb node.
|
||||
*/
|
||||
if (hwconfig("qe-hdlc"))
|
||||
#ifdef CONFIG_HAS_FSL_XHCI_USB
|
||||
fdt_del_node_and_alias(blob, "usb1");
|
||||
#endif
|
||||
/*
|
||||
* qe just support qe-uart and qe-hdlc,
|
||||
* if qe-uart and qe-hdlc are not set in hwconfig,
|
||||
* delete qe node.
|
||||
*/
|
||||
if (!hwconfig("qe-uart") && !hwconfig("qe-hdlc"))
|
||||
fdt_del_qe(blob);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
u8 flash_read8(void *addr)
|
||||
{
|
||||
return __raw_readb(addr + 1);
|
||||
}
|
||||
|
||||
void flash_write16(u16 val, void *addr)
|
||||
{
|
||||
u16 shftval = (((val >> 8) & 0xff) | ((val << 8) & 0xff00));
|
||||
|
||||
__raw_writew(shftval, addr);
|
||||
}
|
||||
|
||||
u16 flash_read16(void *addr)
|
||||
{
|
||||
u16 val = __raw_readw(addr);
|
||||
|
||||
return (((val) >> 8) & 0x00ff) | (((val) << 8) & 0xff00);
|
||||
}
|
||||
14
u-boot/board/freescale/ls1043ardb/ls1043ardb_pbi.cfg
Normal file
14
u-boot/board/freescale/ls1043ardb/ls1043ardb_pbi.cfg
Normal file
@@ -0,0 +1,14 @@
|
||||
#Configure Scratch register
|
||||
09570600 00000000
|
||||
09570604 10000000
|
||||
#Alt base register
|
||||
09570158 00001000
|
||||
#Disable CCI barrier tranaction
|
||||
09570178 0000e010
|
||||
09180000 00000008
|
||||
#USB PHY frequency sel
|
||||
09570418 0000009e
|
||||
0957041c 0000009e
|
||||
09570420 0000009e
|
||||
#flush PBI data
|
||||
096100c0 000fffff
|
||||
@@ -0,0 +1,7 @@
|
||||
#PBL preamble and RCW header
|
||||
aa55aa55 01ee0100
|
||||
# serdes protocol
|
||||
08100010 0a000000 00000000 00000000
|
||||
14550002 80004012 e0106000 c1002000
|
||||
00000000 00000000 00000000 00038800
|
||||
00000000 00001100 00000096 00000001
|
||||
7
u-boot/board/freescale/ls1043ardb/ls1043ardb_rcw_sd.cfg
Normal file
7
u-boot/board/freescale/ls1043ardb/ls1043ardb_rcw_sd.cfg
Normal file
@@ -0,0 +1,7 @@
|
||||
#PBL preamble and RCW header
|
||||
aa55aa55 01ee0100
|
||||
# RCW
|
||||
08100010 0a000000 00000000 00000000
|
||||
14550002 80004012 60040000 c1002000
|
||||
00000000 00000000 00000000 00038800
|
||||
00000000 00001100 00000096 00000001
|
||||
Reference in New Issue
Block a user