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:
12
u-boot/board/freescale/b4860qds/Kconfig
Normal file
12
u-boot/board/freescale/b4860qds/Kconfig
Normal file
@@ -0,0 +1,12 @@
|
||||
if TARGET_B4860QDS
|
||||
|
||||
config SYS_BOARD
|
||||
default "b4860qds"
|
||||
|
||||
config SYS_VENDOR
|
||||
default "freescale"
|
||||
|
||||
config SYS_CONFIG_NAME
|
||||
default "B4860QDS"
|
||||
|
||||
endif
|
||||
17
u-boot/board/freescale/b4860qds/MAINTAINERS
Normal file
17
u-boot/board/freescale/b4860qds/MAINTAINERS
Normal file
@@ -0,0 +1,17 @@
|
||||
B4860QDS BOARD
|
||||
#M: -
|
||||
S: Maintained
|
||||
F: board/freescale/b4860qds/
|
||||
F: include/configs/B4860QDS.h
|
||||
F: configs/B4420QDS_defconfig
|
||||
F: configs/B4420QDS_NAND_defconfig
|
||||
F: configs/B4420QDS_SPIFLASH_defconfig
|
||||
F: configs/B4860QDS_defconfig
|
||||
F: configs/B4860QDS_NAND_defconfig
|
||||
F: configs/B4860QDS_SPIFLASH_defconfig
|
||||
F: configs/B4860QDS_SRIO_PCIE_BOOT_defconfig
|
||||
|
||||
B4860QDS_SECURE_BOOT BOARD
|
||||
M: Aneesh Bansal <aneesh.bansal@freescale.com>
|
||||
S: Maintained
|
||||
F: configs/B4860QDS_SECURE_BOOT_defconfig
|
||||
17
u-boot/board/freescale/b4860qds/Makefile
Normal file
17
u-boot/board/freescale/b4860qds/Makefile
Normal file
@@ -0,0 +1,17 @@
|
||||
#
|
||||
# Copyright 2012 Freescale Semiconductor, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0+
|
||||
#
|
||||
|
||||
ifdef CONFIG_SPL_BUILD
|
||||
obj-y += spl.o
|
||||
else
|
||||
obj-y += b4860qds.o
|
||||
obj-$(CONFIG_B4860QDS) += eth_b4860qds.o
|
||||
obj-$(CONFIG_PCI) += pci.o
|
||||
endif
|
||||
|
||||
obj-y += ddr.o
|
||||
obj-y += law.o
|
||||
obj-y += tlb.o
|
||||
1268
u-boot/board/freescale/b4860qds/b4860qds.c
Normal file
1268
u-boot/board/freescale/b4860qds/b4860qds.c
Normal file
File diff suppressed because it is too large
Load Diff
13
u-boot/board/freescale/b4860qds/b4860qds.h
Normal file
13
u-boot/board/freescale/b4860qds/b4860qds.h
Normal file
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* Copyright 2011-2012 Freescale Semiconductor, Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifndef __CORENET_DS_H__
|
||||
#define __CORENET_DS_H__
|
||||
|
||||
void fdt_fixup_board_enet(void *blob);
|
||||
void pci_of_setup(void *blob, bd_t *bd);
|
||||
|
||||
#endif
|
||||
73
u-boot/board/freescale/b4860qds/b4860qds_crossbar_con.h
Normal file
73
u-boot/board/freescale/b4860qds/b4860qds_crossbar_con.h
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright 2012 Freescale Semiconductor, Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifndef __CROSSBAR_CONNECTIONS_H__
|
||||
#define __CROSSBAR_CONNECTIONS_H__
|
||||
|
||||
#define NUM_CON_VSC3316 8
|
||||
#define NUM_CON_VSC3308 4
|
||||
|
||||
static const int8_t vsc16_tx_amc[8][2] = { {15, 3}, {0, 2}, {7, 4}, {9, 10},
|
||||
{5, 11}, {4, 5}, {2, 6}, {12, 9} };
|
||||
|
||||
static int8_t vsc16_tx_sfp[8][2] = { {15, 7}, {0, 1}, {7, 8}, {9, 0},
|
||||
{-1, -1}, {-1, -1}, {-1, -1}, {-1, -1} };
|
||||
|
||||
static int8_t vsc16_tx_4sfp_sgmii_12_56[8][2] = { {15, 7}, {0, 1},
|
||||
{7, 8}, {9, 0}, {2, 14}, {12, 15},
|
||||
{-1, -1}, {-1, -1} };
|
||||
|
||||
static const int8_t vsc16_tx_4sfp_sgmii_34[8][2] = { {15, 7}, {0, 1},
|
||||
{7, 8}, {9, 0}, {5, 14}, {4, 15},
|
||||
{-1, -1}, {-1, -1} };
|
||||
|
||||
static int8_t vsc16_tx_sfp_sgmii_aurora[8][2] = { {15, 7}, {0, 1},
|
||||
{7, 8}, {9, 0}, {5, 14},
|
||||
{4, 15}, {2, 12}, {12, 13} };
|
||||
|
||||
#ifdef CONFIG_PPC_B4420
|
||||
static int8_t vsc16_tx_sgmii_lane_cd[8][2] = { {5, 14}, {4, 15},
|
||||
{-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1} };
|
||||
#endif
|
||||
|
||||
static const int8_t vsc16_tx_aurora[8][2] = { {2, 13}, {12, 12}, {-1, -1},
|
||||
{-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1} };
|
||||
|
||||
static const int8_t vsc16_rx_amc[8][2] = { {3, 15}, {2, 1}, {4, 8}, {10, 9},
|
||||
{11, 11}, {5, 10}, {6, 3}, {9, 12} };
|
||||
|
||||
static int8_t vsc16_rx_sfp[8][2] = { {8, 15}, {0, 1}, {7, 8}, {1, 9},
|
||||
{-1, -1}, {-1, -1}, {-1, -1}, {-1, -1} };
|
||||
|
||||
static int8_t vsc16_rx_4sfp_sgmii_12_56[8][2] = { {8, 15}, {0, 1},
|
||||
{7, 8}, {1, 9}, {14, 3}, {15, 12},
|
||||
{-1, -1}, {-1, -1} };
|
||||
|
||||
static const int8_t vsc16_rx_4sfp_sgmii_34[8][2] = { {8, 15}, {0, 1},
|
||||
{7, 8}, {1, 9}, {14, 11}, {15, 10},
|
||||
{-1, -1}, {-1, -1} };
|
||||
|
||||
static int8_t vsc16_rx_sfp_sgmii_aurora[8][2] = { {8, 15}, {0, 1},
|
||||
{7, 8}, {1, 9}, {14, 11},
|
||||
{15, 10}, {13, 3}, {12, 12} };
|
||||
|
||||
#ifdef CONFIG_PPC_B4420
|
||||
static int8_t vsc16_rx_sgmii_lane_cd[8][2] = { {14, 11}, {15, 10},
|
||||
{-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1} };
|
||||
#endif
|
||||
|
||||
static const int8_t vsc16_rx_aurora[8][2] = { {13, 3}, {12, 12}, {-1, -1},
|
||||
{-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1} };
|
||||
|
||||
static const int8_t vsc08_tx_amc[4][2] = { {2, 2}, {3, 3}, {7, 4}, {1, 5} };
|
||||
|
||||
static const int8_t vsc08_tx_sfp[4][2] = { {2, 1}, {3, 0}, {7, 6}, {1, 7} };
|
||||
|
||||
static const int8_t vsc08_rx_amc[4][2] = { {2, 3}, {3, 4}, {4, 7}, {5, 1} };
|
||||
|
||||
static const int8_t vsc08_rx_sfp[4][2] = { {1, 3}, {0, 4}, {6, 7}, {7, 1} };
|
||||
|
||||
#endif
|
||||
29
u-boot/board/freescale/b4860qds/b4860qds_qixis.h
Normal file
29
u-boot/board/freescale/b4860qds/b4860qds_qixis.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright 2012 Freescale Semiconductor, Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifndef __B4860QDS_QIXIS_H__
|
||||
#define __B4860QDS_QIXIS_H__
|
||||
|
||||
/* Definitions of QIXIS Registers for B4860QDS */
|
||||
|
||||
/* BRDCFG4[4:7]] select EC1 and EC2 as a pair */
|
||||
#define BRDCFG4_EMISEL_MASK 0xE0
|
||||
#define BRDCFG4_EMISEL_SHIFT 5
|
||||
|
||||
/* CLK */
|
||||
#define QIXIS_CLK_66 0x0
|
||||
#define QIXIS_CLK_100 0x1
|
||||
#define QIXIS_CLK_125 0x2
|
||||
#define QIXIS_CLK_133 0x3
|
||||
|
||||
#define QIXIS_SRDS1CLK_122 0x5a
|
||||
#define QIXIS_SRDS1CLK_125 0x5e
|
||||
|
||||
/* SGMII */
|
||||
#define PHY_BASE_ADDR 0x18
|
||||
#define PORT_NUM 0x04
|
||||
#define REGNUM 0x00
|
||||
#endif
|
||||
30
u-boot/board/freescale/b4860qds/b4_pbi.cfg
Normal file
30
u-boot/board/freescale/b4860qds/b4_pbi.cfg
Normal file
@@ -0,0 +1,30 @@
|
||||
#PBI commands
|
||||
#Initialize CPC1
|
||||
09010000 00200400
|
||||
09138000 00000000
|
||||
091380c0 00000100
|
||||
#Configure CPC1 as 512KB SRAM
|
||||
09010100 00000000
|
||||
09010104 fff80009
|
||||
09010f00 08000000
|
||||
09010000 80000000
|
||||
#Configure LAW for CPC1
|
||||
09000d00 00000000
|
||||
09000d04 fff80000
|
||||
09000d08 81000012
|
||||
#Configure alternate space
|
||||
09000010 00000000
|
||||
09000014 ff000000
|
||||
09000018 81000000
|
||||
#Configure SPI controller
|
||||
09110000 80000403
|
||||
09110020 2d170008
|
||||
09110024 00100008
|
||||
09110028 00100008
|
||||
0911002c 00100008
|
||||
#slowing down the MDC clock to make it <= 2.5 MHZ
|
||||
094fc030 00008148
|
||||
094fd030 00008148
|
||||
#Flush PBL data
|
||||
09138000 00000000
|
||||
091380c0 00000000
|
||||
7
u-boot/board/freescale/b4860qds/b4_rcw.cfg
Normal file
7
u-boot/board/freescale/b4860qds/b4_rcw.cfg
Normal file
@@ -0,0 +1,7 @@
|
||||
#PBL preamble and RCW header
|
||||
aa55aa55 010e0100
|
||||
# serdes protocol 0x2A_0x98
|
||||
140e0018 0f001218 00000000 00000000
|
||||
54980000 9000a000 e8104000 a9000000
|
||||
01000000 00000000 00000000 0001b1f8
|
||||
00000000 14000020 00000000 00000011
|
||||
261
u-boot/board/freescale/b4860qds/ddr.c
Normal file
261
u-boot/board/freescale/b4860qds/ddr.c
Normal file
@@ -0,0 +1,261 @@
|
||||
/*
|
||||
* Copyright 2011-2012 Freescale Semiconductor, Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <i2c.h>
|
||||
#include <hwconfig.h>
|
||||
#include <fsl_ddr.h>
|
||||
#include <asm/mmu.h>
|
||||
#include <fsl_ddr_sdram.h>
|
||||
#include <fsl_ddr_dimm_params.h>
|
||||
#include <asm/fsl_law.h>
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
dimm_params_t ddr_raw_timing = {
|
||||
.n_ranks = 2,
|
||||
.rank_density = 2147483648u,
|
||||
.capacity = 4294967296u,
|
||||
.primary_sdram_width = 64,
|
||||
.ec_sdram_width = 8,
|
||||
.registered_dimm = 0,
|
||||
.mirrored_dimm = 1,
|
||||
.n_row_addr = 15,
|
||||
.n_col_addr = 10,
|
||||
.n_banks_per_sdram_device = 8,
|
||||
.edc_config = 2, /* ECC */
|
||||
.burst_lengths_bitmask = 0x0c,
|
||||
|
||||
.tckmin_x_ps = 1071,
|
||||
.caslat_x = 0x2fe << 4, /* 5,6,7,8,9,10,11,13 */
|
||||
.taa_ps = 13910,
|
||||
.twr_ps = 15000,
|
||||
.trcd_ps = 13910,
|
||||
.trrd_ps = 6000,
|
||||
.trp_ps = 13910,
|
||||
.tras_ps = 34000,
|
||||
.trc_ps = 48910,
|
||||
.trfc_ps = 260000,
|
||||
.twtr_ps = 7500,
|
||||
.trtp_ps = 7500,
|
||||
.refresh_rate_ps = 7800000,
|
||||
.tfaw_ps = 35000,
|
||||
};
|
||||
|
||||
int fsl_ddr_get_dimm_params(dimm_params_t *pdimm,
|
||||
unsigned int controller_number,
|
||||
unsigned int dimm_number)
|
||||
{
|
||||
const char dimm_model[] = "RAW timing DDR";
|
||||
|
||||
if ((controller_number == 0) && (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;
|
||||
}
|
||||
|
||||
struct board_specific_parameters {
|
||||
u32 n_ranks;
|
||||
u32 datarate_mhz_high;
|
||||
u32 clk_adjust;
|
||||
u32 wrlvl_start;
|
||||
u32 wrlvl_ctl_2;
|
||||
u32 wrlvl_ctl_3;
|
||||
u32 cpo;
|
||||
u32 write_data_delay;
|
||||
u32 force_2t;
|
||||
};
|
||||
|
||||
/*
|
||||
* This table contains 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| clk| wrlvl | wrlvl | wrlvl | cpo |wrdata|2T
|
||||
* ranks| mhz|adjst| start | ctl2 | ctl3 | |delay |
|
||||
*/
|
||||
{2, 1350, 4, 7, 0x09080807, 0x07060607, 0xff, 2, 0},
|
||||
{2, 1666, 4, 7, 0x09080806, 0x06050607, 0xff, 2, 0},
|
||||
{2, 1900, 3, 7, 0x08070706, 0x06040507, 0xff, 2, 0},
|
||||
{1, 1350, 4, 7, 0x09080807, 0x07060607, 0xff, 2, 0},
|
||||
{1, 1700, 4, 7, 0x09080806, 0x06050607, 0xff, 2, 0},
|
||||
{1, 1900, 3, 7, 0x08070706, 0x06040507, 0xff, 2, 0},
|
||||
{}
|
||||
};
|
||||
|
||||
static const struct board_specific_parameters *udimms[] = {
|
||||
udimm0,
|
||||
};
|
||||
|
||||
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 > 2) {
|
||||
printf("Not supported controller number %d\n", ctrl_num);
|
||||
return;
|
||||
}
|
||||
if (!pdimm->n_ranks)
|
||||
return;
|
||||
|
||||
pbsp = udimms[0];
|
||||
|
||||
|
||||
/* Get clk_adjust, cpo, write_data_delay,2T, 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->cpo_override = pbsp->cpo;
|
||||
popts->write_data_delay =
|
||||
pbsp->write_data_delay;
|
||||
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->twot_en = pbsp->force_2t;
|
||||
goto found;
|
||||
}
|
||||
pbsp_highest = pbsp;
|
||||
}
|
||||
pbsp++;
|
||||
}
|
||||
|
||||
if (pbsp_highest) {
|
||||
printf("Error: board specific timing not found "
|
||||
"for data rate %lu MT/s\n"
|
||||
"Trying to use the highest speed (%u) parameters\n",
|
||||
ddr_freq, pbsp_highest->datarate_mhz_high);
|
||||
popts->cpo_override = pbsp_highest->cpo;
|
||||
popts->write_data_delay = pbsp_highest->write_data_delay;
|
||||
popts->clk_adjust = pbsp_highest->clk_adjust;
|
||||
popts->wrlvl_start = pbsp_highest->wrlvl_start;
|
||||
popts->twot_en = pbsp_highest->force_2t;
|
||||
} else {
|
||||
panic("DIMM is not supported by this board");
|
||||
}
|
||||
found:
|
||||
/*
|
||||
* Factors to consider for half-strength driver enable:
|
||||
* - number of DIMMs installed
|
||||
*/
|
||||
popts->half_strength_driver_enable = 0;
|
||||
/*
|
||||
* 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;
|
||||
|
||||
/* DHC_EN =1, ODT = 75 Ohm */
|
||||
popts->ddr_cdr1 = DDR_CDR1_DHC_EN | DDR_CDR1_ODT(DDR_CDR_ODT_75ohm);
|
||||
popts->ddr_cdr2 = DDR_CDR2_ODT(DDR_CDR_ODT_75ohm);
|
||||
}
|
||||
|
||||
phys_size_t initdram(int board_type)
|
||||
{
|
||||
phys_size_t dram_size;
|
||||
|
||||
#if defined(CONFIG_SPL_BUILD) || !defined(CONFIG_RAMBOOT_PBL)
|
||||
puts("Initializing....using SPD\n");
|
||||
dram_size = fsl_ddr_sdram();
|
||||
#else
|
||||
dram_size = fsl_ddr_sdram_size();
|
||||
#endif
|
||||
dram_size = setup_ddr_tlbs(dram_size / 0x100000);
|
||||
dram_size *= 0x100000;
|
||||
|
||||
return dram_size;
|
||||
}
|
||||
|
||||
unsigned long long step_assign_addresses(fsl_ddr_info_t *pinfo,
|
||||
unsigned int dbw_cap_adj[])
|
||||
{
|
||||
int i, j;
|
||||
unsigned long long total_mem, current_mem_base, total_ctlr_mem;
|
||||
unsigned long long rank_density, ctlr_density = 0;
|
||||
|
||||
current_mem_base = 0ull;
|
||||
total_mem = 0;
|
||||
/*
|
||||
* This board has soldered DDR chips. DDRC1 has two rank.
|
||||
* DDRC2 has only one rank.
|
||||
* Assigning DDRC2 to lower address and DDRC1 to higher address.
|
||||
*/
|
||||
if (pinfo->memctl_opts[0].memctl_interleaving) {
|
||||
rank_density = pinfo->dimm_params[0][0].rank_density >>
|
||||
dbw_cap_adj[0];
|
||||
ctlr_density = rank_density;
|
||||
|
||||
debug("rank density is 0x%llx, ctlr density is 0x%llx\n",
|
||||
rank_density, ctlr_density);
|
||||
for (i = CONFIG_NUM_DDR_CONTROLLERS - 1; i >= 0; i--) {
|
||||
switch (pinfo->memctl_opts[i].memctl_interleaving_mode) {
|
||||
case FSL_DDR_CACHE_LINE_INTERLEAVING:
|
||||
case FSL_DDR_PAGE_INTERLEAVING:
|
||||
case FSL_DDR_BANK_INTERLEAVING:
|
||||
case FSL_DDR_SUPERBANK_INTERLEAVING:
|
||||
total_ctlr_mem = 2 * ctlr_density;
|
||||
break;
|
||||
default:
|
||||
panic("Unknown interleaving mode");
|
||||
}
|
||||
pinfo->common_timing_params[i].base_address =
|
||||
current_mem_base;
|
||||
pinfo->common_timing_params[i].total_mem =
|
||||
total_ctlr_mem;
|
||||
total_mem = current_mem_base + total_ctlr_mem;
|
||||
debug("ctrl %d base 0x%llx\n", i, current_mem_base);
|
||||
debug("ctrl %d total 0x%llx\n", i, total_ctlr_mem);
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* Simple linear assignment if memory
|
||||
* controllers are not interleaved.
|
||||
*/
|
||||
for (i = CONFIG_NUM_DDR_CONTROLLERS - 1; i >= 0; i--) {
|
||||
total_ctlr_mem = 0;
|
||||
pinfo->common_timing_params[i].base_address =
|
||||
current_mem_base;
|
||||
for (j = 0; j < CONFIG_DIMM_SLOTS_PER_CTLR; j++) {
|
||||
/* Compute DIMM base addresses. */
|
||||
unsigned long long cap =
|
||||
pinfo->dimm_params[i][j].capacity;
|
||||
pinfo->dimm_params[i][j].base_address =
|
||||
current_mem_base;
|
||||
debug("ctrl %d dimm %d base 0x%llx\n",
|
||||
i, j, current_mem_base);
|
||||
current_mem_base += cap;
|
||||
total_ctlr_mem += cap;
|
||||
}
|
||||
debug("ctrl %d total 0x%llx\n", i, total_ctlr_mem);
|
||||
pinfo->common_timing_params[i].total_mem =
|
||||
total_ctlr_mem;
|
||||
total_mem += total_ctlr_mem;
|
||||
}
|
||||
}
|
||||
debug("Total mem by %s is 0x%llx\n", __func__, total_mem);
|
||||
|
||||
return total_mem;
|
||||
}
|
||||
453
u-boot/board/freescale/b4860qds/eth_b4860qds.c
Normal file
453
u-boot/board/freescale/b4860qds/eth_b4860qds.c
Normal file
@@ -0,0 +1,453 @@
|
||||
/*
|
||||
* Copyright 2012 Freescale Semiconductor, Inc.
|
||||
* Author: Sandeep Kumar Singh <sandeep@freescale.com>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
/* This file is based on board/freescale/corenet_ds/eth_superhydra.c */
|
||||
|
||||
/*
|
||||
* This file handles the board muxing between the Fman Ethernet MACs and
|
||||
* the RGMII/SGMII/XGMII PHYs on a Freescale B4860 "Centaur". The SGMII
|
||||
* PHYs are the two on-board 1Gb ports. There are no RGMII PHY on board.
|
||||
* The 10Gb XGMII PHY is provided via the XAUI riser card. There is only
|
||||
* one Fman device on B4860. The SERDES configuration is used to determine
|
||||
* where the SGMII and XAUI cards exist, and also which Fman MACs are routed
|
||||
* to which PHYs. So for a given Fman MAC, there is one and only PHY it
|
||||
* connects to. MACs cannot be routed to PHYs dynamically. This configuration
|
||||
* is done at boot time by reading SERDES protocol from RCW.
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <netdev.h>
|
||||
#include <asm/fsl_serdes.h>
|
||||
#include <fm_eth.h>
|
||||
#include <fsl_mdio.h>
|
||||
#include <malloc.h>
|
||||
#include <fdt_support.h>
|
||||
#include <fsl_dtsec.h>
|
||||
|
||||
#include "../common/ngpixis.h"
|
||||
#include "../common/fman.h"
|
||||
#include "../common/qixis.h"
|
||||
#include "b4860qds_qixis.h"
|
||||
|
||||
#define EMI_NONE 0xFFFFFFFF
|
||||
|
||||
#ifdef CONFIG_FMAN_ENET
|
||||
|
||||
/*
|
||||
* Mapping of all 16 SERDES lanes to board slots. A value n(>0) will mean that
|
||||
* lane at index is mapped to slot number n. A value of '0' will mean
|
||||
* that the mapping must be determined dynamically, or that the lane maps to
|
||||
* something other than a board slot
|
||||
*/
|
||||
static u8 lane_to_slot[] = {
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
1, 1, 1, 1,
|
||||
0, 0, 0, 0
|
||||
};
|
||||
|
||||
/*
|
||||
* This function initializes the lane_to_slot[] array. It reads RCW to check
|
||||
* if Serdes2{E,F,G,H} is configured as slot 2 or as SFP and initializes
|
||||
* lane_to_slot[] accordingly
|
||||
*/
|
||||
static void initialize_lane_to_slot(void)
|
||||
{
|
||||
unsigned int serdes2_prtcl;
|
||||
ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
|
||||
serdes2_prtcl = in_be32(&gur->rcwsr[4]) &
|
||||
FSL_CORENET2_RCWSR4_SRDS2_PRTCL;
|
||||
serdes2_prtcl >>= FSL_CORENET2_RCWSR4_SRDS2_PRTCL_SHIFT;
|
||||
debug("Initializing lane to slot: Serdes2 protocol: %x\n",
|
||||
serdes2_prtcl);
|
||||
|
||||
switch (serdes2_prtcl) {
|
||||
case 0x17:
|
||||
case 0x18:
|
||||
/*
|
||||
* Configuration:
|
||||
* SERDES: 2
|
||||
* Lanes: A,B,C,D: SGMII
|
||||
* Lanes: E,F: Aur
|
||||
* Lanes: G,H: SRIO
|
||||
*/
|
||||
case 0x91:
|
||||
/*
|
||||
* Configuration:
|
||||
* SERDES: 2
|
||||
* Lanes: A,B: SGMII
|
||||
* Lanes: C,D: SRIO2
|
||||
* Lanes: E,F,G,H: XAUI2
|
||||
*/
|
||||
case 0x93:
|
||||
/*
|
||||
* Configuration:
|
||||
* SERDES: 2
|
||||
* Lanes: A,B,C,D: SGMII
|
||||
* Lanes: E,F,G,H: XAUI2
|
||||
*/
|
||||
case 0x98:
|
||||
/*
|
||||
* Configuration:
|
||||
* SERDES: 2
|
||||
* Lanes: A,B,C,D: XAUI2
|
||||
* Lanes: E,F,G,H: XAUI2
|
||||
*/
|
||||
case 0x9a:
|
||||
/*
|
||||
* Configuration:
|
||||
* SERDES: 2
|
||||
* Lanes: A,B: PCI
|
||||
* Lanes: C,D: SGMII
|
||||
* Lanes: E,F,G,H: XAUI2
|
||||
*/
|
||||
case 0x9e:
|
||||
/*
|
||||
* Configuration:
|
||||
* SERDES: 2
|
||||
* Lanes: A,B,C,D: PCI
|
||||
* Lanes: E,F,G,H: XAUI2
|
||||
*/
|
||||
case 0xb1:
|
||||
case 0xb2:
|
||||
case 0x8c:
|
||||
case 0x8d:
|
||||
/*
|
||||
* Configuration:
|
||||
* SERDES: 2
|
||||
* Lanes: A,B,C,D: PCI
|
||||
* Lanes: E,F: SGMII 3&4
|
||||
* Lanes: G,H: XFI
|
||||
*/
|
||||
case 0xc2:
|
||||
/*
|
||||
* Configuration:
|
||||
* SERDES: 2
|
||||
* Lanes: A,B: SGMII
|
||||
* Lanes: C,D: SRIO2
|
||||
* Lanes: E,F,G,H: XAUI2
|
||||
*/
|
||||
lane_to_slot[12] = 2;
|
||||
lane_to_slot[13] = lane_to_slot[12];
|
||||
lane_to_slot[14] = lane_to_slot[12];
|
||||
lane_to_slot[15] = lane_to_slot[12];
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("Fman: Unsupported SerDes2 Protocol 0x%02x\n",
|
||||
serdes2_prtcl);
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
#endif /* #ifdef CONFIG_FMAN_ENET */
|
||||
|
||||
int board_eth_init(bd_t *bis)
|
||||
{
|
||||
#ifdef CONFIG_FMAN_ENET
|
||||
struct memac_mdio_info memac_mdio_info;
|
||||
struct memac_mdio_info tg_memac_mdio_info;
|
||||
unsigned int i;
|
||||
unsigned int serdes1_prtcl, serdes2_prtcl;
|
||||
int qsgmii;
|
||||
struct mii_dev *bus;
|
||||
ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
|
||||
serdes1_prtcl = in_be32(&gur->rcwsr[4]) &
|
||||
FSL_CORENET2_RCWSR4_SRDS1_PRTCL;
|
||||
if (!serdes1_prtcl) {
|
||||
printf("SERDES1 is not enabled\n");
|
||||
return 0;
|
||||
}
|
||||
serdes1_prtcl >>= FSL_CORENET2_RCWSR4_SRDS1_PRTCL_SHIFT;
|
||||
debug("Using SERDES1 Protocol: 0x%x:\n", serdes1_prtcl);
|
||||
|
||||
serdes2_prtcl = in_be32(&gur->rcwsr[4]) &
|
||||
FSL_CORENET2_RCWSR4_SRDS2_PRTCL;
|
||||
if (!serdes2_prtcl) {
|
||||
printf("SERDES2 is not enabled\n");
|
||||
return 0;
|
||||
}
|
||||
serdes2_prtcl >>= FSL_CORENET2_RCWSR4_SRDS2_PRTCL_SHIFT;
|
||||
debug("Using SERDES2 Protocol: 0x%x:\n", serdes2_prtcl);
|
||||
|
||||
printf("Initializing Fman\n");
|
||||
|
||||
initialize_lane_to_slot();
|
||||
|
||||
memac_mdio_info.regs =
|
||||
(struct memac_mdio_controller *)CONFIG_SYS_FM1_DTSEC_MDIO_ADDR;
|
||||
memac_mdio_info.name = DEFAULT_FM_MDIO_NAME;
|
||||
|
||||
/* Register the real 1G MDIO bus */
|
||||
fm_memac_mdio_init(bis, &memac_mdio_info);
|
||||
|
||||
tg_memac_mdio_info.regs =
|
||||
(struct memac_mdio_controller *)CONFIG_SYS_FM1_TGEC_MDIO_ADDR;
|
||||
tg_memac_mdio_info.name = DEFAULT_FM_TGEC_MDIO_NAME;
|
||||
|
||||
/* Register the real 10G MDIO bus */
|
||||
fm_memac_mdio_init(bis, &tg_memac_mdio_info);
|
||||
|
||||
/*
|
||||
* Program the two on board DTSEC PHY addresses assuming that they are
|
||||
* all SGMII. RGMII is not supported on this board. Setting SGMII 5 and
|
||||
* 6 to on board SGMII phys
|
||||
*/
|
||||
fm_info_set_phy_address(FM1_DTSEC5, CONFIG_SYS_FM1_ONBOARD_PHY1_ADDR);
|
||||
fm_info_set_phy_address(FM1_DTSEC6, CONFIG_SYS_FM1_ONBOARD_PHY2_ADDR);
|
||||
|
||||
switch (serdes1_prtcl) {
|
||||
case 0x29:
|
||||
case 0x2a:
|
||||
/* Serdes 1: A-B SGMII, Configuring DTSEC 5 and 6 */
|
||||
debug("Set phy addresses for FM1_DTSEC5:%x, FM1_DTSEC6:%x\n",
|
||||
CONFIG_SYS_FM1_ONBOARD_PHY1_ADDR,
|
||||
CONFIG_SYS_FM1_ONBOARD_PHY2_ADDR);
|
||||
fm_info_set_phy_address(FM1_DTSEC5,
|
||||
CONFIG_SYS_FM1_ONBOARD_PHY1_ADDR);
|
||||
fm_info_set_phy_address(FM1_DTSEC6,
|
||||
CONFIG_SYS_FM1_ONBOARD_PHY2_ADDR);
|
||||
break;
|
||||
#ifdef CONFIG_PPC_B4420
|
||||
case 0x17:
|
||||
case 0x18:
|
||||
/* Serdes 1: A-D SGMII, Configuring on board dual SGMII Phy */
|
||||
debug("Set phy addresses for FM1_DTSEC3:%x, FM1_DTSEC4:%x\n",
|
||||
CONFIG_SYS_FM1_ONBOARD_PHY1_ADDR,
|
||||
CONFIG_SYS_FM1_ONBOARD_PHY2_ADDR);
|
||||
/* Fixing Serdes clock by programming FPGA register */
|
||||
QIXIS_WRITE(brdcfg[4], QIXIS_SRDS1CLK_125);
|
||||
fm_info_set_phy_address(FM1_DTSEC3,
|
||||
CONFIG_SYS_FM1_ONBOARD_PHY1_ADDR);
|
||||
fm_info_set_phy_address(FM1_DTSEC4,
|
||||
CONFIG_SYS_FM1_ONBOARD_PHY2_ADDR);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
printf("Fman: Unsupported SerDes1 Protocol 0x%02x\n",
|
||||
serdes1_prtcl);
|
||||
break;
|
||||
}
|
||||
switch (serdes2_prtcl) {
|
||||
case 0x17:
|
||||
case 0x18:
|
||||
debug("Set phy address on SGMII Riser for FM1_DTSEC1:%x\n",
|
||||
CONFIG_SYS_FM1_DTSEC1_RISER_PHY_ADDR);
|
||||
fm_info_set_phy_address(FM1_DTSEC1,
|
||||
CONFIG_SYS_FM1_DTSEC1_RISER_PHY_ADDR);
|
||||
fm_info_set_phy_address(FM1_DTSEC2,
|
||||
CONFIG_SYS_FM1_DTSEC2_RISER_PHY_ADDR);
|
||||
fm_info_set_phy_address(FM1_DTSEC3,
|
||||
CONFIG_SYS_FM1_DTSEC3_RISER_PHY_ADDR);
|
||||
fm_info_set_phy_address(FM1_DTSEC4,
|
||||
CONFIG_SYS_FM1_DTSEC4_RISER_PHY_ADDR);
|
||||
break;
|
||||
case 0x48:
|
||||
case 0x49:
|
||||
debug("Set phy address on SGMII Riser for FM1_DTSEC1:%x\n",
|
||||
CONFIG_SYS_FM1_DTSEC1_RISER_PHY_ADDR);
|
||||
fm_info_set_phy_address(FM1_DTSEC1,
|
||||
CONFIG_SYS_FM1_DTSEC1_RISER_PHY_ADDR);
|
||||
fm_info_set_phy_address(FM1_DTSEC2,
|
||||
CONFIG_SYS_FM1_DTSEC2_RISER_PHY_ADDR);
|
||||
fm_info_set_phy_address(FM1_DTSEC3,
|
||||
CONFIG_SYS_FM1_DTSEC3_RISER_PHY_ADDR);
|
||||
break;
|
||||
case 0xb1:
|
||||
case 0xb2:
|
||||
case 0x8c:
|
||||
case 0x8d:
|
||||
debug("Set phy addresses on SGMII Riser for FM1_DTSEC1:%x\n",
|
||||
CONFIG_SYS_FM1_DTSEC1_RISER_PHY_ADDR);
|
||||
fm_info_set_phy_address(FM1_DTSEC3,
|
||||
CONFIG_SYS_FM1_DTSEC1_RISER_PHY_ADDR);
|
||||
fm_info_set_phy_address(FM1_DTSEC4,
|
||||
CONFIG_SYS_FM1_DTSEC2_RISER_PHY_ADDR);
|
||||
/*
|
||||
* XFI does not need a PHY to work, but to make U-Boot
|
||||
* happy, assign a fake PHY address for a XFI port.
|
||||
*/
|
||||
fm_info_set_phy_address(FM1_10GEC1, 0);
|
||||
fm_info_set_phy_address(FM1_10GEC2, 1);
|
||||
break;
|
||||
case 0x98:
|
||||
/* XAUI in Slot1 and Slot2 */
|
||||
debug("Set phy address of AMC2PEX-2S for FM1_10GEC1:%x\n",
|
||||
CONFIG_SYS_FM1_10GEC1_PHY_ADDR);
|
||||
fm_info_set_phy_address(FM1_10GEC1,
|
||||
CONFIG_SYS_FM1_10GEC1_PHY_ADDR);
|
||||
debug("Set phy address of AMC2PEX-2S for FM1_10GEC2:%x\n",
|
||||
CONFIG_SYS_FM1_10GEC2_PHY_ADDR);
|
||||
fm_info_set_phy_address(FM1_10GEC2,
|
||||
CONFIG_SYS_FM1_10GEC2_PHY_ADDR);
|
||||
break;
|
||||
case 0x9E:
|
||||
/* XAUI in Slot2 */
|
||||
debug("Sett phy address of AMC2PEX-2S for FM1_10GEC2:%x\n",
|
||||
CONFIG_SYS_FM1_10GEC2_PHY_ADDR);
|
||||
fm_info_set_phy_address(FM1_10GEC2,
|
||||
CONFIG_SYS_FM1_10GEC2_PHY_ADDR);
|
||||
break;
|
||||
default:
|
||||
printf("Fman: Unsupported SerDes2 Protocol 0x%02x\n",
|
||||
serdes2_prtcl);
|
||||
break;
|
||||
}
|
||||
|
||||
/*set PHY address for QSGMII Riser Card on slot2*/
|
||||
bus = miiphy_get_dev_by_name(DEFAULT_FM_MDIO_NAME);
|
||||
qsgmii = is_qsgmii_riser_card(bus, PHY_BASE_ADDR, PORT_NUM, REGNUM);
|
||||
|
||||
if (qsgmii) {
|
||||
switch (serdes2_prtcl) {
|
||||
case 0xb2:
|
||||
case 0x8d:
|
||||
fm_info_set_phy_address(FM1_DTSEC3, PHY_BASE_ADDR);
|
||||
fm_info_set_phy_address(FM1_DTSEC4, PHY_BASE_ADDR + 1);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = FM1_DTSEC1; i < FM1_DTSEC1 + CONFIG_SYS_NUM_FM1_DTSEC; i++) {
|
||||
int idx = i - FM1_DTSEC1;
|
||||
|
||||
switch (fm_info_get_enet_if(i)) {
|
||||
case PHY_INTERFACE_MODE_SGMII:
|
||||
fm_info_set_mdio(i,
|
||||
miiphy_get_dev_by_name(DEFAULT_FM_MDIO_NAME));
|
||||
break;
|
||||
case PHY_INTERFACE_MODE_NONE:
|
||||
fm_info_set_phy_address(i, 0);
|
||||
break;
|
||||
default:
|
||||
printf("Fman1: DTSEC%u set to unknown interface %i\n",
|
||||
idx + 1, fm_info_get_enet_if(i));
|
||||
fm_info_set_phy_address(i, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = FM1_10GEC1; i < FM1_10GEC1 + CONFIG_SYS_NUM_FM1_10GEC; i++) {
|
||||
int idx = i - FM1_10GEC1;
|
||||
|
||||
switch (fm_info_get_enet_if(i)) {
|
||||
case PHY_INTERFACE_MODE_XGMII:
|
||||
fm_info_set_mdio(i,
|
||||
miiphy_get_dev_by_name
|
||||
(DEFAULT_FM_TGEC_MDIO_NAME));
|
||||
break;
|
||||
case PHY_INTERFACE_MODE_NONE:
|
||||
fm_info_set_phy_address(i, 0);
|
||||
break;
|
||||
default:
|
||||
printf("Fman1: TGEC%u set to unknown interface %i\n",
|
||||
idx + 1, fm_info_get_enet_if(i));
|
||||
fm_info_set_phy_address(i, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
cpu_eth_init(bis);
|
||||
#endif
|
||||
|
||||
return pci_eth_init(bis);
|
||||
}
|
||||
|
||||
void board_ft_fman_fixup_port(void *fdt, char *compat, phys_addr_t addr,
|
||||
enum fm_port port, int offset)
|
||||
{
|
||||
int phy;
|
||||
char alias[32];
|
||||
struct fixed_link f_link;
|
||||
ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
|
||||
u32 prtcl2 = in_be32(&gur->rcwsr[4]) & FSL_CORENET2_RCWSR4_SRDS2_PRTCL;
|
||||
|
||||
prtcl2 >>= FSL_CORENET2_RCWSR4_SRDS2_PRTCL_SHIFT;
|
||||
|
||||
if (fm_info_get_enet_if(port) == PHY_INTERFACE_MODE_SGMII) {
|
||||
phy = fm_info_get_phy_address(port);
|
||||
|
||||
sprintf(alias, "phy_sgmii_%x", phy);
|
||||
fdt_set_phy_handle(fdt, compat, addr, alias);
|
||||
fdt_status_okay_by_alias(fdt, alias);
|
||||
} else if (fm_info_get_enet_if(port) == PHY_INTERFACE_MODE_XGMII) {
|
||||
/* check if it's XFI interface for 10g */
|
||||
switch (prtcl2) {
|
||||
case 0x80:
|
||||
case 0x81:
|
||||
case 0x82:
|
||||
case 0x83:
|
||||
case 0x84:
|
||||
case 0x85:
|
||||
case 0x86:
|
||||
case 0x87:
|
||||
case 0x88:
|
||||
case 0x89:
|
||||
case 0x8a:
|
||||
case 0x8b:
|
||||
case 0x8c:
|
||||
case 0x8d:
|
||||
case 0x8e:
|
||||
case 0xb1:
|
||||
case 0xb2:
|
||||
f_link.phy_id = port;
|
||||
f_link.duplex = 1;
|
||||
f_link.link_speed = 10000;
|
||||
f_link.pause = 0;
|
||||
f_link.asym_pause = 0;
|
||||
|
||||
fdt_delprop(fdt, offset, "phy-handle");
|
||||
fdt_setprop(fdt, offset, "fixed-link", &f_link,
|
||||
sizeof(f_link));
|
||||
break;
|
||||
case 0x98: /* XAUI interface */
|
||||
strcpy(alias, "phy_xaui_slot1");
|
||||
fdt_status_okay_by_alias(fdt, alias);
|
||||
|
||||
strcpy(alias, "phy_xaui_slot2");
|
||||
fdt_status_okay_by_alias(fdt, alias);
|
||||
break;
|
||||
case 0x9e: /* XAUI interface */
|
||||
case 0x9a:
|
||||
case 0x93:
|
||||
case 0x91:
|
||||
strcpy(alias, "phy_xaui_slot1");
|
||||
fdt_status_okay_by_alias(fdt, alias);
|
||||
break;
|
||||
case 0x97: /* XAUI interface */
|
||||
case 0xc3:
|
||||
strcpy(alias, "phy_xaui_slot2");
|
||||
fdt_status_okay_by_alias(fdt, alias);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Set status to disabled for unused ethernet node
|
||||
*/
|
||||
void fdt_fixup_board_enet(void *fdt)
|
||||
{
|
||||
int i;
|
||||
char alias[32];
|
||||
|
||||
for (i = FM1_DTSEC1; i <= FM1_10GEC2; i++) {
|
||||
switch (fm_info_get_enet_if(i)) {
|
||||
case PHY_INTERFACE_MODE_NONE:
|
||||
sprintf(alias, "ethernet%u", i);
|
||||
fdt_status_disabled_by_alias(fdt, alias);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
29
u-boot/board/freescale/b4860qds/law.c
Normal file
29
u-boot/board/freescale/b4860qds/law.c
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright 2011-2012 Freescale Semiconductor, Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <asm/fsl_law.h>
|
||||
#include <asm/mmu.h>
|
||||
|
||||
struct law_entry law_table[] = {
|
||||
SET_LAW(CONFIG_SYS_FLASH_BASE_PHYS, LAW_SIZE_256M, LAW_TRGT_IF_IFC),
|
||||
#ifdef CONFIG_SYS_BMAN_MEM_PHYS
|
||||
SET_LAW(CONFIG_SYS_BMAN_MEM_PHYS, LAW_SIZE_32M, LAW_TRGT_IF_BMAN),
|
||||
#endif
|
||||
#ifdef CONFIG_SYS_QMAN_MEM_PHYS
|
||||
SET_LAW(CONFIG_SYS_QMAN_MEM_PHYS, LAW_SIZE_32M, LAW_TRGT_IF_QMAN),
|
||||
#endif
|
||||
SET_LAW(QIXIS_BASE_PHYS, LAW_SIZE_4K, LAW_TRGT_IF_IFC),
|
||||
#ifdef CONFIG_SYS_DCSRBAR_PHYS
|
||||
/* Limit DCSR to 32M to access NPC Trace Buffer */
|
||||
SET_LAW(CONFIG_SYS_DCSRBAR_PHYS, LAW_SIZE_32M, LAW_TRGT_IF_DCSR),
|
||||
#endif
|
||||
#ifdef CONFIG_SYS_NAND_BASE_PHYS
|
||||
SET_LAW(CONFIG_SYS_NAND_BASE_PHYS, LAW_SIZE_64K, LAW_TRGT_IF_IFC),
|
||||
#endif
|
||||
};
|
||||
|
||||
int num_law_entries = ARRAY_SIZE(law_table);
|
||||
23
u-boot/board/freescale/b4860qds/pci.c
Normal file
23
u-boot/board/freescale/b4860qds/pci.c
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright 2011-2012 Freescale Semiconductor, Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <command.h>
|
||||
#include <pci.h>
|
||||
#include <asm/fsl_pci.h>
|
||||
#include <libfdt.h>
|
||||
#include <fdt_support.h>
|
||||
#include <asm/fsl_serdes.h>
|
||||
|
||||
void pci_init_board(void)
|
||||
{
|
||||
fsl_pcie_init_board(0);
|
||||
}
|
||||
|
||||
void pci_of_setup(void *blob, bd_t *bd)
|
||||
{
|
||||
FT_FSL_PCI_SETUP;
|
||||
}
|
||||
116
u-boot/board/freescale/b4860qds/spl.c
Normal file
116
u-boot/board/freescale/b4860qds/spl.c
Normal file
@@ -0,0 +1,116 @@
|
||||
/* Copyright 2013 Freescale Semiconductor, Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <console.h>
|
||||
#include <asm/spl.h>
|
||||
#include <malloc.h>
|
||||
#include <ns16550.h>
|
||||
#include <nand.h>
|
||||
#include <i2c.h>
|
||||
#include "../common/qixis.h"
|
||||
#include "b4860qds_qixis.h"
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
phys_size_t get_effective_memsize(void)
|
||||
{
|
||||
return CONFIG_SYS_L3_SIZE;
|
||||
}
|
||||
|
||||
unsigned long get_board_sys_clk(void)
|
||||
{
|
||||
u8 sysclk_conf = QIXIS_READ(brdcfg[1]);
|
||||
|
||||
switch ((sysclk_conf & 0x0C) >> 2) {
|
||||
case QIXIS_CLK_100:
|
||||
return 100000000;
|
||||
case QIXIS_CLK_125:
|
||||
return 125000000;
|
||||
case QIXIS_CLK_133:
|
||||
return 133333333;
|
||||
}
|
||||
return 66666666;
|
||||
}
|
||||
|
||||
unsigned long get_board_ddr_clk(void)
|
||||
{
|
||||
u8 ddrclk_conf = QIXIS_READ(brdcfg[1]);
|
||||
|
||||
switch (ddrclk_conf & 0x03) {
|
||||
case QIXIS_CLK_100:
|
||||
return 100000000;
|
||||
case QIXIS_CLK_125:
|
||||
return 125000000;
|
||||
case QIXIS_CLK_133:
|
||||
return 133333333;
|
||||
}
|
||||
return 66666666;
|
||||
}
|
||||
|
||||
void board_init_f(ulong bootflag)
|
||||
{
|
||||
u32 plat_ratio, sys_clk, uart_clk;
|
||||
ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
|
||||
|
||||
/* Memcpy existing GD at CONFIG_SPL_GD_ADDR */
|
||||
memcpy((void *)CONFIG_SPL_GD_ADDR, (void *)gd, sizeof(gd_t));
|
||||
|
||||
/* Update GD pointer */
|
||||
gd = (gd_t *)(CONFIG_SPL_GD_ADDR);
|
||||
|
||||
/* compiler optimization barrier needed for GCC >= 3.4 */
|
||||
__asm__ __volatile__("" : : : "memory");
|
||||
|
||||
console_init_f();
|
||||
|
||||
/* initialize selected port with appropriate baud rate */
|
||||
sys_clk = get_board_sys_clk();
|
||||
plat_ratio = (in_be32(&gur->rcwsr[0]) >> 25) & 0x1f;
|
||||
uart_clk = sys_clk * plat_ratio / 2;
|
||||
|
||||
NS16550_init((NS16550_t)CONFIG_SYS_NS16550_COM1,
|
||||
uart_clk / 16 / CONFIG_BAUDRATE);
|
||||
|
||||
relocate_code(CONFIG_SPL_RELOC_STACK, (gd_t *)CONFIG_SPL_GD_ADDR, 0x0);
|
||||
}
|
||||
|
||||
void board_init_r(gd_t *gd, ulong dest_addr)
|
||||
{
|
||||
bd_t *bd;
|
||||
|
||||
bd = (bd_t *)(gd + sizeof(gd_t));
|
||||
memset(bd, 0, sizeof(bd_t));
|
||||
gd->bd = bd;
|
||||
bd->bi_memstart = CONFIG_SYS_INIT_L3_ADDR;
|
||||
bd->bi_memsize = CONFIG_SYS_L3_SIZE;
|
||||
|
||||
probecpu();
|
||||
get_clocks();
|
||||
mem_malloc_init(CONFIG_SPL_RELOC_MALLOC_ADDR,
|
||||
CONFIG_SPL_RELOC_MALLOC_SIZE);
|
||||
gd->flags |= GD_FLG_FULL_MALLOC_INIT;
|
||||
|
||||
#ifndef CONFIG_SPL_NAND_BOOT
|
||||
env_init();
|
||||
env_relocate();
|
||||
#else
|
||||
/* relocate environment function pointers etc. */
|
||||
nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
|
||||
(uchar *)CONFIG_ENV_ADDR);
|
||||
gd->env_addr = (ulong)(CONFIG_ENV_ADDR);
|
||||
gd->env_valid = 1;
|
||||
#endif
|
||||
|
||||
i2c_init_all();
|
||||
|
||||
puts("\n\n");
|
||||
|
||||
gd->ram_size = initdram(0);
|
||||
|
||||
#ifdef CONFIG_SPL_NAND_BOOT
|
||||
nand_boot();
|
||||
#endif
|
||||
}
|
||||
155
u-boot/board/freescale/b4860qds/tlb.c
Normal file
155
u-boot/board/freescale/b4860qds/tlb.c
Normal file
@@ -0,0 +1,155 @@
|
||||
/*
|
||||
* Copyright 2011-2012 Freescale Semiconductor, Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <asm/mmu.h>
|
||||
|
||||
struct fsl_e_tlb_entry tlb_table[] = {
|
||||
/* TLB 0 - for temp stack in cache */
|
||||
SET_TLB_ENTRY(0, CONFIG_SYS_INIT_RAM_ADDR,
|
||||
CONFIG_SYS_INIT_RAM_ADDR_PHYS,
|
||||
MAS3_SX|MAS3_SW|MAS3_SR, 0,
|
||||
0, 0, BOOKE_PAGESZ_4K, 0),
|
||||
SET_TLB_ENTRY(0, CONFIG_SYS_INIT_RAM_ADDR + 4 * 1024,
|
||||
CONFIG_SYS_INIT_RAM_ADDR_PHYS + 4 * 1024,
|
||||
MAS3_SX|MAS3_SW|MAS3_SR, 0,
|
||||
0, 0, BOOKE_PAGESZ_4K, 0),
|
||||
SET_TLB_ENTRY(0, CONFIG_SYS_INIT_RAM_ADDR + 8 * 1024,
|
||||
CONFIG_SYS_INIT_RAM_ADDR_PHYS + 8 * 1024,
|
||||
MAS3_SX|MAS3_SW|MAS3_SR, 0,
|
||||
0, 0, BOOKE_PAGESZ_4K, 0),
|
||||
SET_TLB_ENTRY(0, CONFIG_SYS_INIT_RAM_ADDR + 12 * 1024,
|
||||
CONFIG_SYS_INIT_RAM_ADDR_PHYS + 12 * 1024,
|
||||
MAS3_SX|MAS3_SW|MAS3_SR, 0,
|
||||
0, 0, BOOKE_PAGESZ_4K, 0),
|
||||
|
||||
/* TLB 1 */
|
||||
/* *I*** - Covers boot page */
|
||||
#if defined(CONFIG_SYS_RAMBOOT) && defined(CONFIG_SYS_INIT_L3_ADDR)
|
||||
/*
|
||||
* *I*G - L3SRAM. When L3 is used as 1M SRAM, the address of the
|
||||
* SRAM is at 0xfff00000, it covered the 0xfffff000.
|
||||
*/
|
||||
SET_TLB_ENTRY(1, CONFIG_SYS_INIT_L3_ADDR, CONFIG_SYS_INIT_L3_ADDR,
|
||||
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
|
||||
0, 0, BOOKE_PAGESZ_1M, 1),
|
||||
#elif defined(CONFIG_SRIO_PCIE_BOOT_SLAVE)
|
||||
/*
|
||||
* SRIO_PCIE_BOOT-SLAVE. When slave boot, the address of the
|
||||
* space is at 0xfff00000, it covered the 0xfffff000.
|
||||
*/
|
||||
SET_TLB_ENTRY(1, CONFIG_SYS_SRIO_PCIE_BOOT_SLAVE_ADDR,
|
||||
CONFIG_SYS_SRIO_PCIE_BOOT_SLAVE_ADDR_PHYS,
|
||||
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_W|MAS2_G,
|
||||
0, 0, BOOKE_PAGESZ_1M, 1),
|
||||
#else
|
||||
SET_TLB_ENTRY(1, 0xfffff000, 0xfffff000,
|
||||
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
|
||||
0, 0, BOOKE_PAGESZ_4K, 1),
|
||||
#endif
|
||||
|
||||
/* *I*G* - CCSRBAR */
|
||||
SET_TLB_ENTRY(1, CONFIG_SYS_CCSRBAR, CONFIG_SYS_CCSRBAR_PHYS,
|
||||
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
|
||||
0, 1, BOOKE_PAGESZ_16M, 1),
|
||||
|
||||
/* *I*G* - Flash, localbus */
|
||||
/* This will be changed to *I*G* after relocation to RAM. */
|
||||
SET_TLB_ENTRY(1, CONFIG_SYS_FLASH_BASE, CONFIG_SYS_FLASH_BASE_PHYS,
|
||||
MAS3_SX|MAS3_SR, MAS2_W|MAS2_G,
|
||||
0, 2, BOOKE_PAGESZ_256M, 1),
|
||||
|
||||
#ifndef CONFIG_SPL_BUILD
|
||||
/* *I*G* - PCI */
|
||||
SET_TLB_ENTRY(1, CONFIG_SYS_PCIE1_MEM_VIRT, CONFIG_SYS_PCIE1_MEM_PHYS,
|
||||
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
|
||||
0, 3, BOOKE_PAGESZ_256M, 1),
|
||||
|
||||
SET_TLB_ENTRY(1, CONFIG_SYS_PCIE1_MEM_VIRT + 0x10000000,
|
||||
CONFIG_SYS_PCIE1_MEM_PHYS + 0x10000000,
|
||||
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
|
||||
0, 4, BOOKE_PAGESZ_256M, 1),
|
||||
|
||||
/* *I*G* - PCI I/O */
|
||||
SET_TLB_ENTRY(1, CONFIG_SYS_PCIE1_IO_VIRT, CONFIG_SYS_PCIE1_IO_PHYS,
|
||||
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
|
||||
0, 5, BOOKE_PAGESZ_64K, 1),
|
||||
|
||||
/* Bman/Qman */
|
||||
#ifdef CONFIG_SYS_BMAN_MEM_PHYS
|
||||
SET_TLB_ENTRY(1, CONFIG_SYS_BMAN_MEM_BASE, CONFIG_SYS_BMAN_MEM_PHYS,
|
||||
MAS3_SX|MAS3_SW|MAS3_SR, 0,
|
||||
0, 6, BOOKE_PAGESZ_16M, 1),
|
||||
SET_TLB_ENTRY(1, CONFIG_SYS_BMAN_MEM_BASE + 0x01000000,
|
||||
CONFIG_SYS_BMAN_MEM_PHYS + 0x01000000,
|
||||
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
|
||||
0, 7, BOOKE_PAGESZ_16M, 1),
|
||||
#endif
|
||||
#ifdef CONFIG_SYS_QMAN_MEM_PHYS
|
||||
SET_TLB_ENTRY(1, CONFIG_SYS_QMAN_MEM_BASE, CONFIG_SYS_QMAN_MEM_PHYS,
|
||||
MAS3_SX|MAS3_SW|MAS3_SR, 0,
|
||||
0, 8, BOOKE_PAGESZ_16M, 1),
|
||||
SET_TLB_ENTRY(1, CONFIG_SYS_QMAN_MEM_BASE + 0x01000000,
|
||||
CONFIG_SYS_QMAN_MEM_PHYS + 0x01000000,
|
||||
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
|
||||
0, 9, BOOKE_PAGESZ_16M, 1),
|
||||
#endif
|
||||
#endif
|
||||
#ifdef CONFIG_SYS_DCSRBAR_PHYS
|
||||
SET_TLB_ENTRY(1, CONFIG_SYS_DCSRBAR, CONFIG_SYS_DCSRBAR_PHYS,
|
||||
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
|
||||
0, 10, BOOKE_PAGESZ_32M, 1),
|
||||
#endif
|
||||
#ifdef CONFIG_SYS_NAND_BASE
|
||||
/*
|
||||
* *I*G - NAND
|
||||
*/
|
||||
SET_TLB_ENTRY(1, CONFIG_SYS_NAND_BASE, CONFIG_SYS_NAND_BASE_PHYS,
|
||||
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
|
||||
0, 11, BOOKE_PAGESZ_64K, 1),
|
||||
#endif
|
||||
SET_TLB_ENTRY(1, QIXIS_BASE, QIXIS_BASE_PHYS,
|
||||
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
|
||||
0, 12, BOOKE_PAGESZ_4K, 1),
|
||||
|
||||
/*
|
||||
* *I*G - SRIO
|
||||
* entry 14 and 15 has been used hard coded, they will be disabled
|
||||
* in cpu_init_f, so we use entry 16 for SRIO2.
|
||||
*/
|
||||
#ifndef CONFIG_SPL_BUILD
|
||||
#ifdef CONFIG_SYS_SRIO1_MEM_PHYS
|
||||
/* *I*G* - SRIO1 */
|
||||
SET_TLB_ENTRY(1, CONFIG_SYS_SRIO1_MEM_VIRT, CONFIG_SYS_SRIO1_MEM_PHYS,
|
||||
MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
|
||||
0, 13, BOOKE_PAGESZ_256M, 1),
|
||||
#endif
|
||||
#ifdef CONFIG_SYS_SRIO2_MEM_PHYS
|
||||
/* *I*G* - SRIO2 */
|
||||
SET_TLB_ENTRY(1, CONFIG_SYS_SRIO2_MEM_VIRT, CONFIG_SYS_SRIO2_MEM_PHYS,
|
||||
MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
|
||||
0, 16, BOOKE_PAGESZ_256M, 1),
|
||||
#endif
|
||||
#ifdef CONFIG_SRIO_PCIE_BOOT_SLAVE
|
||||
/*
|
||||
* SRIO_PCIE_BOOT-SLAVE. 1M space from 0xffe00000 for
|
||||
* fetching ucode and ENV from master
|
||||
*/
|
||||
SET_TLB_ENTRY(1, CONFIG_SYS_SRIO_PCIE_BOOT_UCODE_ENV_ADDR,
|
||||
CONFIG_SYS_SRIO_PCIE_BOOT_UCODE_ENV_ADDR_PHYS,
|
||||
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_G,
|
||||
0, 17, BOOKE_PAGESZ_1M, 1),
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_RAMBOOT_PBL) && !defined(CONFIG_SPL_BUILD)
|
||||
SET_TLB_ENTRY(1, CONFIG_SYS_DDR_SDRAM_BASE, CONFIG_SYS_DDR_SDRAM_BASE,
|
||||
MAS3_SX|MAS3_SW|MAS3_SR, 0,
|
||||
0, 17, BOOKE_PAGESZ_2G, 1)
|
||||
#endif
|
||||
};
|
||||
|
||||
int num_tlb_entries = ARRAY_SIZE(tlb_table);
|
||||
Reference in New Issue
Block a user