summaryrefslogtreecommitdiff
path: root/board/scalys/simc-t10xx
diff options
context:
space:
mode:
Diffstat (limited to 'board/scalys/simc-t10xx')
-rw-r--r--board/scalys/simc-t10xx/Kconfig67
-rw-r--r--board/scalys/simc-t10xx/Makefile8
-rw-r--r--board/scalys/simc-t10xx/ddr.c22
-rw-r--r--board/scalys/simc-t10xx/ddr_QT1040-1GB.c173
-rw-r--r--board/scalys/simc-t10xx/dragonfruit.c162
-rw-r--r--board/scalys/simc-t10xx/dragonfruit.h10
-rw-r--r--board/scalys/simc-t10xx/eth.c101
-rw-r--r--board/scalys/simc-t10xx/law.c4
-rw-r--r--board/scalys/simc-t10xx/pci.c55
-rw-r--r--board/scalys/simc-t10xx/qt1040-1gb_nand_rcw.cfg7
-rw-r--r--board/scalys/simc-t10xx/qt1040-1gb_nor_rcw.cfg7
-rw-r--r--board/scalys/simc-t10xx/qt1040-1gb_sdhc_rcw.cfg7
-rw-r--r--board/scalys/simc-t10xx/qt1040-1gb_spi_rcw.cfg9
-rw-r--r--board/scalys/simc-t10xx/simc-t1022_rcw.cfg17
-rw-r--r--board/scalys/simc-t10xx/simc-t1040_rcw.cfg7
-rw-r--r--board/scalys/simc-t10xx/simc-t10x0_nand_rcw.cfg7
-rw-r--r--board/scalys/simc-t10xx/simc-t10x0_nand_secure_rcw.cfg (renamed from board/scalys/simc-t10xx/simc-t1040_nand_secure_rcw.cfg)8
-rw-r--r--board/scalys/simc-t10xx/simc-t10x0_nor_rcw.cfg7
-rw-r--r--board/scalys/simc-t10xx/simc-t10x0_sdhc_rcw.cfg7
-rw-r--r--board/scalys/simc-t10xx/simc-t10x0_spi_rcw.cfg9
-rw-r--r--board/scalys/simc-t10xx/simc-t10xx.c16
-rw-r--r--board/scalys/simc-t10xx/simc-t10xx_nand_pbi.cfg (renamed from board/scalys/simc-t10xx/simc-t10xx_pbi.cfg)7
-rw-r--r--board/scalys/simc-t10xx/simc-t10xx_nor_pbi.cfg44
-rw-r--r--board/scalys/simc-t10xx/simc-t10xx_sdhc_pbi.cfg36
-rw-r--r--board/scalys/simc-t10xx/simc-t10xx_spi_pbi.cfg36
-rw-r--r--board/scalys/simc-t10xx/spl.c109
-rw-r--r--board/scalys/simc-t10xx/tlb.c17
27 files changed, 772 insertions, 187 deletions
diff --git a/board/scalys/simc-t10xx/Kconfig b/board/scalys/simc-t10xx/Kconfig
index 2b18913..4ac5c59 100644
--- a/board/scalys/simc-t10xx/Kconfig
+++ b/board/scalys/simc-t10xx/Kconfig
@@ -1,72 +1,23 @@
-if TARGET_SIMC_T10XX
+if (TARGET_SIMC_TXXXX || TARGET_QT1040_1GB) && !ARCH_T2081
config SYS_BOARD
string
default "simc-t10xx"
+
+endif
-config SYS_VENDOR
- string
- default "scalys"
+if TARGET_SIMC_TXXXX && !ARCH_T2081
config SYS_CONFIG_NAME
string
default "simc-t10xx"
-
-config RAMBOOT_PBL
- bool
- default y
-
-config SPL_FSL_PBL
- bool
- default y
-choice
- prompt "Bootsource"
- default NAND
-config NAND
- bool
- prompt "NAND boot"
- help
- Select NAND as the bootsource
-
-endchoice
-
-choice
- prompt "SYSCLK frequency"
- default SYS_CLK_FREQ_100
-
-config SYS_CLK_FREQ_66
- bool
- prompt "66.6 MHz"
-
-config SYS_CLK_FREQ_100
- bool
- prompt "100 MHz"
-
-endchoice
-
-choice
- prompt "CPU type"
- default PPC_T1040
- help
- Select the exact type of CPU which is used on the version of the simc-t10xx module
-
-config PPC_T1020
- bool
- prompt "T1020"
-
-config PPC_T1022
- bool
- prompt "T1022"
+endif
-config PPC_T1040
- bool
- prompt "T1040"
+if TARGET_QT1040_1GB
-config PPC_T1042
- bool
- prompt "T1042"
-
-endchoice
+config SYS_CONFIG_NAME
+ string
+ default "QT1040-1GB"
endif
diff --git a/board/scalys/simc-t10xx/Makefile b/board/scalys/simc-t10xx/Makefile
index 83ac551..59f29ec 100644
--- a/board/scalys/simc-t10xx/Makefile
+++ b/board/scalys/simc-t10xx/Makefile
@@ -1,4 +1,4 @@
-# Copyright 2016 Scalys B.V.
+# Copyright 2017 Scalys B.V.
# opensource@scalys.com
#
# SPDX-License-Identifier: GPL-2.0+
@@ -13,7 +13,11 @@ obj-y += simc-t10xx.o
obj-y += eth.o
obj-$(CONFIG_PCI) += pci.o
endif
+ifdef CONFIG_TARGET_QT1040_1GB
+obj-y += ddr_QT1040-1GB.o
+else
obj-y += ddr.o
+endif
obj-y += law.o
obj-y += tlb.o
-obj-y += dragonfruit.o \ No newline at end of file
+obj-y += dragonfruit.o
diff --git a/board/scalys/simc-t10xx/ddr.c b/board/scalys/simc-t10xx/ddr.c
index f6d04ac..7fed0d2 100644
--- a/board/scalys/simc-t10xx/ddr.c
+++ b/board/scalys/simc-t10xx/ddr.c
@@ -1,24 +1,19 @@
/*
- * Copyright 2016 Scalys B.V.
+ * Copyright 2017 Scalys B.V.
* opensource@scalys.com
*
* SPDX-License-Identifier: GPL-2.0+
*/
#include <common.h>
-#include <asm/mmu.h>
-//#include <asm/gpio.h>
-#include <fsl_ddr_sdram.h>
-#include <fsl_ddr_dimm_params.h>
-
-#include <common.h>
#include <i2c.h>
#include <hwconfig.h>
#include <asm/mmu.h>
#include <fsl_ddr_sdram.h>
#include <fsl_ddr_dimm_params.h>
#include <asm/fsl_law.h>
-//#include <asm/gpio.h>
+
+DECLARE_GLOBAL_DATA_PTR;
/* MT41K512M8RH-125 */
dimm_params_t ddr_raw_timing = {
@@ -45,7 +40,7 @@ dimm_params_t ddr_raw_timing = {
.tfaw_ps = 30000,
.twr_ps = 15000,
.trfc_ps = 260000,
- .trrd_ps = 6000,
+ .trrd_ps = 5000, //1Kb page size!
.twtr_ps = 7500,
.trtp_ps = 7500,
.refresh_rate_ps = 70200000,
@@ -90,6 +85,9 @@ void fsl_ddr_board_options(memctl_options_t *popts,
/* Clock is launched 1/2 applied cycle after address/command */
popts->clk_adjust = 8;
+
+ /* Optimized cpo */
+ popts->cpo_sample = 0x46;
}
int fsl_ddr_get_dimm_params(dimm_params_t *pdimm,
@@ -108,7 +106,7 @@ int fsl_ddr_get_dimm_params(dimm_params_t *pdimm,
return 0;
}
-phys_size_t initdram(int board_type)
+int dram_init(void)
{
phys_size_t dram_size;
@@ -142,5 +140,7 @@ phys_size_t initdram(int board_type)
dram_size = fsl_ddr_sdram_size();
#endif
- return dram_size;
+ gd->ram_size = dram_size;
+
+ return 0;
}
diff --git a/board/scalys/simc-t10xx/ddr_QT1040-1GB.c b/board/scalys/simc-t10xx/ddr_QT1040-1GB.c
new file mode 100644
index 0000000..e4fdcf6
--- /dev/null
+++ b/board/scalys/simc-t10xx/ddr_QT1040-1GB.c
@@ -0,0 +1,173 @@
+/*
+ * Copyright 2017 Scalys B.V.
+ * opensource@scalys.com
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <common.h>
+#include <i2c.h>
+#include <hwconfig.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;
+
+/* Values for QT1040 */
+dimm_params_t ddr_raw_timing = {
+ .n_ranks = 1,
+ .rank_density = 1073741824u,
+ .capacity = 1073741824u,
+ .device_width = 16,
+ .primary_sdram_width = 64,
+ .ec_sdram_width = 8,
+ .registered_dimm = 0,
+ .mirrored_dimm = 0,
+ .n_row_addr = 14,
+ .n_col_addr = 10,
+ .n_banks_per_sdram_device = 8,
+ .edc_config = 2,
+ .burst_lengths_bitmask = 0x0c,
+ .tckmin_x_ps = 1250,
+ .caslat_x = (0x7fe << 4),
+ .taa_ps = 13750,
+ .twr_ps = 15000,
+ .trcd_ps = 13750,
+ .trrd_ps = 7500,
+ .trp_ps = 13750,
+ .tras_ps = 37500,
+ .trc_ps = 50600,
+ .trfc_ps = 160000,
+ .twtr_ps = 7500,
+ .trtp_ps = 7500,
+ .refresh_rate_ps = 3900000,
+ .tfaw_ps = 50000,
+};
+
+void fsl_ddr_board_options(memctl_options_t *popts,
+ dimm_params_t *pdimm,
+ unsigned int ctrl_num)
+{
+ int i;
+
+ if (ctrl_num != 0) {
+ printf("Only 1 memory controller supported, but %i requested\n",
+ ctrl_num);
+ return;
+ }
+
+ if (pdimm == NULL ) {
+ printf("Error, no valid dimm pararmeter supplied\n");
+ return;
+ }
+
+ if (!pdimm->n_ranks) {
+ printf("No ranks in dimm parameters. Configuration error?\n");
+ return;
+ }
+
+ /* DDR speed is fixed in the RCW */
+
+ /* set odt_rd_cfg and odt_wr_cfg. */
+ for (i = 0; i < CONFIG_CHIP_SELECTS_PER_CTRL; i++) {
+ popts->cs_local_opts[i].odt_wr_cfg = 4;
+ }
+
+ popts->half_strength_driver_enable = 0; /* */
+
+ popts->wrlvl_en = 1;
+ popts->wrlvl_override = 1;
+ popts->wrlvl_sample = 0xf;
+ popts->wrlvl_start = 5;
+ popts->wrlvl_ctl_2 = 0x05050506;
+ popts->wrlvl_ctl_3 = 0x06060605; /* 1333MT/s */
+
+ popts->ddr_cdr1 = 0x800c0000;
+ popts->ddr_cdr2 = 0x00000001;
+
+ /*
+ * rtt and rtt_wr override
+ */
+ popts->rtt_override = 0; /* */
+
+ /* Enable ZQ calibration */
+ popts->zq_en = 1; /* */
+
+ /* Clock is launched 1/2 applied cycle after address/command */
+ popts->clk_adjust = 4;
+
+ /* Optimized cpo */
+ popts->cpo_sample = 0x33;
+}
+
+int fsl_ddr_get_dimm_params(dimm_params_t *pdimm,
+ unsigned int controller_number,
+ unsigned int dimm_number)
+{
+ const char dimm_model[] = "Soldered-down discrete DDR3";
+
+ 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;
+}
+
+int test123(void){
+ {
+ volatile int waitforme = 0;
+
+ while (waitforme) {
+ asm volatile ("nop");
+ }
+ }
+ return 0;
+}
+
+
+int dram_init(void)
+{
+ phys_size_t dram_size;
+
+#if defined(CONFIG_SPL_BUILD) || !defined(CONFIG_RAMBOOT_PBL)
+ uint32_t regval;
+
+ /* Remove reset of DDR using GPIO pin. We do this manually since
+ * we have not yet access to the DM gpio at this time */
+ /* DDR_RST_N => IFC_CS3_B => GPIO2_12 */
+
+#define CONFIG_SYS_MPC85XX_GPIO2_ADDR (CONFIG_SYS_IMMR + 0x131000)
+#define DDR_RST_N (12)
+/* DDR_RST_N => IFC_CS3_B => GPIO2_12 */
+/* #define DDR_RST_N MPC85XX_GPIO_NR(2, 12) */
+
+ /* Set output */
+ regval = in_be32((size_t*)CONFIG_SYS_MPC85XX_GPIO2_ADDR+0x8);
+ regval |= (0x80000000 >> 12);
+ out_be32((size_t*)CONFIG_SYS_MPC85XX_GPIO2_ADDR+0x8, regval);
+
+ /* Set direction to acivate gpio pin */
+ regval = in_be32((size_t*)CONFIG_SYS_MPC85XX_GPIO2_ADDR);
+ regval |= (0x80000000 >> 12);
+ out_be32((size_t*)CONFIG_SYS_MPC85XX_GPIO2_ADDR, regval);
+
+ dram_size = fsl_ddr_sdram();
+ dram_size = setup_ddr_tlbs(dram_size / 0x100000);
+ dram_size *= 0x100000;
+#else
+ /* DDR has been initialised by SPL loader */
+ dram_size = fsl_ddr_sdram_size();
+#endif
+
+ test123();
+
+ gd->ram_size = dram_size;
+
+ return 0;
+}
+
diff --git a/board/scalys/simc-t10xx/dragonfruit.c b/board/scalys/simc-t10xx/dragonfruit.c
index 0ae849c..c8e5a13 100644
--- a/board/scalys/simc-t10xx/dragonfruit.c
+++ b/board/scalys/simc-t10xx/dragonfruit.c
@@ -1,53 +1,68 @@
/*
- * Copyright 2016 Scalys B.V.
+ * Copyright 2017 Scalys B.V.
* opensource@scalys.com
*
* SPDX-License-Identifier: GPL-2.0+
*/
+
#include <common.h>
#include <asm-generic/gpio.h>
#include "dragonfruit.h"
-
/*
* SERDER MUX Configuration pins:
* IFC_A25 : GPIO2_25 : SERDES_CLK_ MUX_SER0_1_SEL
* IFC_A26 : GPIO2_26 : SERDES_CLK_ MUX_SER2_3_SEL
* IFC_A27 : GPIO2_27 : SERDES_CLK_ MUX_SER5_6_SEL
- *
+ */
+#define MUX_SER0_1_SEL MPC85XX_GPIO_NR(2, 25)
+#define MUX_SER2_3_SEL MPC85XX_GPIO_NR(2, 26)
+#define MUX_SER5_6_SEL MPC85XX_GPIO_NR(2, 27)
+#define SERDES_CLK_OE MPC85XX_GPIO_NR(2, 29)
+
+/*
* MUX_SER0_1_SEL
* 0: SERDES A => Slot1, lane 0
* SERDES B => Slot1, lane 1
* 1: SERDES A => CS4315 retimer => SFP+ 0
* SERDES B => CS4315 retimer => SFP+ 1
- *
+ */
+#define SER_0_1_SLOT1 0
+#define SER_0_1_SFP01 1
+
+/*
* MUX_SER2_3_SEL
* 0: SERDES C => Slot1, lane 2
* SERDES D => Slot1, lane 3
* 1: SERDES C => QSFP+ 2
* SERDES D => QSFP+ 3
- *
+ */
+#define SER_2_3_SLOT1 0
+#define SER_2_3_SFP23 2
+
+/*
* SERDES E => Slot 4, lane 0
- *
- * MUX_SER5_6_SEL
+ */
+
+/* MUX_SER5_6_SEL
* 0: SERDES F => SLOT4, lane 1
* SERDES G => SLOT4, lane 2
* 1: SERDES F => SLOT2
* SERDES G => SLOT3
- *
- * SERDES H => Slot 4, lane 3
*/
+#define SER_5_6_SLOT4 0
+#define SER_5_6_SLOT23 4
-#define MUX_SER0_1_SEL MPC85XX_GPIO_NR(2, 25)
-#define MUX_SER2_3_SEL MPC85XX_GPIO_NR(2, 26)
-#define MUX_SER5_6_SEL MPC85XX_GPIO_NR(2, 27)
-#define SERDES_CLK_OE MPC85XX_GPIO_NR(2, 29)
+/*
+ * SERDES H => Slot 4, lane 3
+ */
int scalys_carrier_setup_muxing(int serdes_config)
{
int ret = 0;
+ int mux_config = 0;
ret = gpio_request(MUX_SER0_1_SEL, "mux_ser0_1_sel");
if (ret != 0) {
@@ -56,34 +71,121 @@ int scalys_carrier_setup_muxing(int serdes_config)
gpio_request(MUX_SER2_3_SEL, "mux_ser2_3_sel");
gpio_request(MUX_SER5_6_SEL, "mux_ser5_6_sel");
gpio_request(SERDES_CLK_OE, "serdes_clk_oe");
-
+
+
+ /*
+ * SERDES options for each target as supported by the dragonfruit
+ * carrier board. Refer to the QorIQ reference manual for the SERDES options table
+ * and all relevant information.
+ *
+ * Note: The SERDES lanes A&B, C&D, and F&G can only be switched
+ * as pairs using the multiplexers. Which means some SERDES options are only partly usable.
+ *
+ * Note/TODO: SERDES PLL2 must be powered down using SRDS_PLL_PD_S1 when
+ * SRDS_PRTCL_S1 is any of the following values: 0x00, 0x40, 0x60, 0x67,
+ * 0x85, 0x87, 0x8D, 0x45.
+ *
+ */
switch(serdes_config){
- case 0x06:
- /* A-D: PCIe1 (5/2.5G); E: PCIe2 (5/2.5G);
- * F: PCIe3 (5/2.5G); G: PCIe4 (5/2.5); H: SATA.1 (3/1.5G) */
- gpio_direction_output(MUX_SER0_1_SEL, 0);
- gpio_direction_output(MUX_SER2_3_SEL, 0);
- gpio_direction_output(MUX_SER5_6_SEL, 1);
-
+#if defined(CONFIG_PPC_T1040) || defined(CONFIG_PPC_T1020)
+/* With Ethernet Switch (T1040/T1020 only) */
+ //case 0x69:
+ //case 0x67: /* See note 2 */
+ case 0x60: /* See note 2 */
+ mux_config = SER_5_6_SLOT4 | SER_2_3_SFP23 | SER_0_1_SFP01;
+ break;
+ //case 0x8D: /* See note 2 */
+ //case 0x8E:
+ //case 0x66:
+ case 0x89:
+ /* A: unused; B: sg.s3; C: sg.s1; D: sg.s2;
+ * E: PCIe2 (5/2.5G); F: PCIe3 (5/2.5G); G: unused; H: SATA1(3/1.5G) */
+ mux_config = SER_5_6_SLOT23 | SER_2_3_SFP23 | SER_0_1_SFP01;
break;
case 0x81:
+ /* A: Unused; B: sg.m3/sg.s3; C: sg.m1/sg.s1; D: sg.m2/sg.s2;
+ * E: PCIe2 (5/2.5G); F: unused; G: unused; H: SATA1(3/1.5G) */
+ //case 0x88: /* Option has been verified to work, but is not officially supported */
+ /* A: Unused; B: sg.m3; C: sg.m1; D: sg.m2;
+ * E: PCIe2 (5/2.5G); F: unused; G: SATA.2(3/1.5G); H: SATA1(3/1.5G) */
+ mux_config = SER_5_6_SLOT4 | SER_2_3_SFP23 | SER_0_1_SFP01;
+ break;
+#elif defined(CONFIG_PPC_T1042) || defined(CONFIG_PPC_T1022)
case 0x86:
+ /* A: Unused; B: sg.m3; C: sg.m1; D: sg.m2;
+ * E: PCIe2 (5/2.5G); F: PCIe3 (5/2.5G); G: PCIe4 (5/2.5G); H: SATA1(3/1.5G) */
+ mux_config = SER_5_6_SLOT23 | SER_2_3_SFP23 | SER_0_1_SFP01;
+ break;
+ case 0x81:
+ /* A: Unused; B: sg.m3/sg.s3; C: sg.m1/sg.s1; D: sg.m2/sg.s2;
+ * E: PCIe2 (5/2.5G); F: unused; G: unused; H: SATA1(3/1.5G) */
case 0x88:
- case 0x89:
- /* A: PCIe1 (5/2.5G); B: sg.m3; C: sg.m1; D: sg.m2;
- * E: PCIe2 (5/2.5G); F:PCIe3 (5/2.5G); G: SATA2(3/1.5G);
- * H: SATA1(3/1.5G) */
+ /* A: Unused; B: sg.m3; C: sg.m1; D: sg.m2;
+ * E: PCIe2 (5/2.5G); F: unused; G: SATA.2(3/1.5G); H: SATA1(3/1.5G) */
+ mux_config = SER_5_6_SLOT4 | SER_2_3_SFP23 | SER_0_1_SFP01;
+ break;
+ case 0x06:
+ /* A-D: PCIe1 (5/2.5G);
+ * E: PCIe2 (5/2.5G); F: PCIe3 (5/2.5G); G: PCIe4 (5/2.5G); H: SATA.1 (3/1.5G) */
+ mux_config = SER_5_6_SLOT23 | SER_2_3_SLOT1 | SER_0_1_SLOT1;
+ break;
+ //case 0x08:
+ //case 0x87: /* See note 2 */
+ //case 0xA7:
+ //case 0xAA:
+ //case 0xA2:
+ //case 0x45:
+ //case 0x40: /* See note 2 */
+ //case 0x8E:
+ //case 0x85: /* See note 2 */
+ //case 0xA5:
+ //case 0x00: /* See note 2 */
+#else
+#error "Invalid or unspecified target cpu for dragonfruit carrier board!"
+#endif
+ default:
+ printf("Unsupported SERDES configuration (%02x) detected for dragonfruit carrier board (Warning: Using default multiplexer settings)!\n", serdes_config);
+ }
+
+ printf("-----------------------------------------------------\n");
+ printf("Serdes lane configuration:\n");
+ if ((mux_config & 1) > 0) {
gpio_direction_output(MUX_SER0_1_SEL, 1);
+ printf("A: SFP slot 0 (T2081 only)\n");
+ printf("B: SFP slot 1\n");
+ } else {
+ gpio_direction_output(MUX_SER0_1_SEL, 0);
+ printf("A: PCIe slot 1 on lane 0\n");
+ printf("B: PCIe slot 1 on lane 1\n");
+ }
+
+ if ((mux_config & 2) > 0) {
gpio_direction_output(MUX_SER2_3_SEL, 1);
+ printf("C: SFP slot 2\n");
+ printf("D: SFP slot 3\n");
+ } else {
+ gpio_direction_output(MUX_SER2_3_SEL, 0);
+ printf("C: PCIe slot 1 on lane 2\n");
+ printf("D: PCIe slot 1 on lane 3\n");
+ }
+
+ printf("E: PCIe slot 4 on lane 0\n");
+
+ if ((mux_config & 4) > 0) {
gpio_direction_output(MUX_SER5_6_SEL, 1);
-
- break;
- default:
- printf("Unsupported SERDES configuration (%02x)\n", serdes_config);
+ printf("F: PCIe slot 2 on lane 0\n");
+ printf("G: PCIe slot 3 on lane 0\n");
+ } else {
+ gpio_direction_output(MUX_SER5_6_SEL, 0);
+ printf("F: PCIe slot 4 on lane 1\n");
+ printf("G: PCIe slot 4 on lane 2\n");
}
+
+ printf("H: PCIe slot 4 on lane 3\n");
+ printf("-----------------------------------------------------\n");
/* Enable serdes clock */
gpio_direction_output(SERDES_CLK_OE, 1);
return ret;
-} \ No newline at end of file
+}
diff --git a/board/scalys/simc-t10xx/dragonfruit.h b/board/scalys/simc-t10xx/dragonfruit.h
index 900b2e4..12928b4 100644
--- a/board/scalys/simc-t10xx/dragonfruit.h
+++ b/board/scalys/simc-t10xx/dragonfruit.h
@@ -1,6 +1,14 @@
+/*
+ * Copyright 2017 Scalys B.V.
+ * opensource@scalys.com
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+
#ifndef _DRAGON_FRUIT_H
#define _DRAGON_FRUIT_H
int scalys_carrier_setup_muxing(int serdes_config);
-#endif /* _DRAGON_FRUIT_H */ \ No newline at end of file
+#endif /* _DRAGON_FRUIT_H */
diff --git a/board/scalys/simc-t10xx/eth.c b/board/scalys/simc-t10xx/eth.c
index 2f5c401..2b548f1 100644
--- a/board/scalys/simc-t10xx/eth.c
+++ b/board/scalys/simc-t10xx/eth.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Scalys B.V.
+ * Copyright 2017 Scalys B.V.
* opensource@scalys.com
*
* SPDX-License-Identifier: GPL-2.0+
@@ -7,17 +7,6 @@
#include <common.h>
#include <netdev.h>
-#include <asm/immap_85xx.h>
-#include <fm_eth.h>
-#include <fsl_mdio.h>
-#include <malloc.h>
-#include <i2c.h>
-
-
-
-
-#include <common.h>
-#include <netdev.h>
#include <asm/fsl_serdes.h>
#include <asm/immap_85xx.h>
#include <fm_eth.h>
@@ -25,11 +14,7 @@
#include <malloc.h>
#include <fsl_dtsec.h>
#include <vsc9953.h>
-
-//#include "../common/fman.h"
-//#include "../common/qixis.h"
-
-
+#include <i2c.h>
#include "../../freescale/common/fman.h"
@@ -53,16 +38,24 @@ int board_eth_init(bd_t *bis)
int phy_addr = 0;
#ifdef CONFIG_VSC9953
- int lane;
- phy_interface_t phy_int;
- struct mii_dev *bus;
+ /*phy_interface_t phy_int;*/
+ /*struct mii_dev *bus;*/
struct ccsr_scfg *scfg;
#endif
uint32_t *gpio2_gpdir = (uint32_t *) 0xffe131000;
uint32_t *gpio2_gpdat = (uint32_t *) 0xffe131008;
+ uint32_t *gpio4_gpdir = (uint32_t *) 0xffe133000;
+ uint32_t *gpio4_gpdat = (uint32_t *) 0xffe133008;
uint32_t regval;
+ /* Try to read a byte from te carrier eeprom te determine if were on the correct carrier */
+ ret = i2c_read(0x54, 0, 2, &i2c_data, 1 );
+ if (ret != 0) {
+ printf("No dragonfruit carrier detected\n");
+ return 0;
+ }
+
printf("Initializing Fman\n");
memac_mdio_info.regs =
@@ -72,11 +65,24 @@ int board_eth_init(bd_t *bis)
/* Register the real 1G MDIO bus */
fm_memac_mdio_init(bis, &memac_mdio_info);
- /* Remove reset from Ethernet PHY's
- * IFC_PERR_B : GPIO2_15 : eth1_reset
- * IFC_CS_N2 : GPIO2_11 : eth2_reset */
-// gpio_set_value(2, 0);
-
+ /* Marvell 88E1111 Setup
+ *
+ * Remove reset from Ethernet PHY's
+ *
+ * Carrier board v1.x:
+ * IFC_PERR_B : GPIO2_15 : eth1_reset
+ * IFC_CS_N2 : GPIO2_11 : eth2_reset
+ *
+ * Carrier board v2.x:
+ * IFC_PERR_B : GPIO2_15 : eth1_reset
+ * IFC_CS_N2 : GPIO4_09 : eth2_reset
+ *
+ * Note: make sure gpio pins are configured as gpio in RCW!
+ */
+
+#if 0
+ /* TODO: use EEPROM data to chose carrier board version */
+ /* Carrier board v1.x */
/* Clear outputs to activate reset */
regval = in_be32(gpio2_gpdat);
regval &= ~((0x80000000 >> 11 ) | (0x80000000 >> 15));
@@ -94,11 +100,44 @@ int board_eth_init(bd_t *bis)
regval = in_be32(gpio2_gpdat);
regval |= ((0x80000000 >> 11 ) | (0x80000000 >> 15));
out_be32(gpio2_gpdat, regval);
-
+#else
+ /* Carrier board v2.x */
+ /* Clear outputs to activate reset */
+ regval = in_be32(gpio2_gpdat);
+ regval &= ~(0x80000000 >> 15);
+ out_be32(gpio2_gpdat, regval);
+ regval = in_be32(gpio4_gpdat);
+ regval &= ~(0x80000000 >> 9);
+ out_be32(gpio4_gpdat, regval);
+
+ /* Set outputs to output mode */
+ regval = in_be32(gpio2_gpdir);
+ regval |= (0x80000000 >> 15);
+ out_be32(gpio2_gpdir, regval);
+ regval = in_be32(gpio4_gpdir);
+ regval |= (0x80000000 >> 9);
+ out_be32(gpio4_gpdir, regval);
+
+ /* Wait for 10 ms to to meet reset timing */
+ mdelay(10);
+
+ /* Set outputs to de-activate reset */
+ regval = in_be32(gpio2_gpdat);
+ regval |= (0x80000000 >> 15);
+ out_be32(gpio2_gpdat, regval);
+ regval = in_be32(gpio4_gpdat);
+ regval |= (0x80000000 >> 9);
+ out_be32(gpio4_gpdat, regval);
+#endif
+
+ /* Write 0x4111 to reg 0x18 on both PHYs to change LEDs usage */
+ miiphy_write("FSL_MDIO0",0,0x18,0x4111);
+ miiphy_write("FSL_MDIO0",1,0x18,0x4111);
/* Remove SFP TX_disable */
i2c_set_bus_num(0);
- i2c_data = 0x3b;
+ ret = i2c_read(0x22, 0x0E, 1, &i2c_data, 1);
+ i2c_data &= ~0x04;
ret = i2c_write(0x22, 0x0E, 1, &i2c_data, 1);
mdelay(100);
@@ -163,9 +202,9 @@ int board_eth_init(bd_t *bis)
#ifdef CONFIG_VSC9953
for (i = 0; i < VSC9953_MAX_PORTS; i++) {
- int lane = -1;
- int phy_addr = 0;
- int phy_int = PHY_INTERFACE_MODE_NONE;
+ /*int lane = -1;*/
+ /*int phy_addr = 0;*/
+ /*int phy_int = PHY_INTERFACE_MODE_NONE;*/
switch (i) {
case 0:
case 1:
@@ -193,7 +232,7 @@ int board_eth_init(bd_t *bis)
vsc9953_port_enable(i);
break;
}
- bus = lane;
+ /*bus = lane;*/
}
#endif
diff --git a/board/scalys/simc-t10xx/law.c b/board/scalys/simc-t10xx/law.c
index c3b5e85..df823d1 100644
--- a/board/scalys/simc-t10xx/law.c
+++ b/board/scalys/simc-t10xx/law.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Scalys B.V.
+ * Copyright 2017 Scalys B.V.
* opensource@scalys.com
*
* Copyright 2013 Freescale Semiconductor, Inc.
@@ -29,4 +29,4 @@ struct law_entry law_table[] = {
#endif
};
-int num_law_entries = ARRAY_SIZE(law_table); \ No newline at end of file
+int num_law_entries = ARRAY_SIZE(law_table);
diff --git a/board/scalys/simc-t10xx/pci.c b/board/scalys/simc-t10xx/pci.c
index ab9edbb..9a02f90 100644
--- a/board/scalys/simc-t10xx/pci.c
+++ b/board/scalys/simc-t10xx/pci.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Scalys B.V.
+ * Copyright 2017 Scalys B.V.
* opensource@scalys.com
*
* Copyright 2013 Freescale Semiconductor, Inc.
@@ -22,11 +22,16 @@ void pci_init_board(void)
uint32_t *gpio1_gpdat = (uint32_t *) 0xffe130008;
uint32_t *gpio2_gpdir = (uint32_t *) 0xffe131000;
uint32_t *gpio2_gpdat = (uint32_t *) 0xffe131008;
- uint32_t regval;
-
- debug("%s\n", __FUNCTION__);
+ uint32_t regval;
+
+ /*debug("%s\n", __FUNCTION__);*/
- //TODO, when present pins are available on the board, use them to enable only active slots
+ /*TODO, when present pins are available on the board, use them to enable only active slots*/
+
+#if 0
+ /* Dragonfruit Carrier board 1.x */
+
+
/*
* IRQ[0-3] : PCIe present detect signals
* IRQ[0] : SLOT1_PRSNT2_N : XXX
@@ -51,7 +56,47 @@ void pci_init_board(void)
regval |= ( (0x80000000 >> 9 ) | ( 0x80000000 >> 10 ) | ( 0x80000000 >> 11 ) | ( 0x80000000 >> 12 ) );
out_be32(gpio1_gpdir, regval);
+#else
+ /* Dragonfruit Carrier board 2.x */
+ /*
+ * PCIe present detect signals:
+ * IRQ[3] : GPIO1_23 : SLOT1_PRSNT2_N
+ * IRQ[4] : GPIO1_24 : SLOT2_PRSNT2_N
+ * IRQ[5] : GPIO1_25 : SLOT3_PRSNT2_N
+ * IRQ[10] : GPIO1_30 : SLOT4_PRSNT2_N
+ *
+ * Clock enable of PCIe Slots 1-4: IFC_CS_N4-IFC_CS_N7
+ * IFC_CS_N7 : GPIO1_IO12 : PCIe SLOT4_REFCLK_OE_N (used for all 4 slots)
+ * IFC_PAR1 : GPIO2_14 : PEX_REFCLK_SEL
+ */
+
+ /* Set output to 0 to enable reference clocks */
+ regval = in_be32(gpio1_gpdat);
+ regval &= ~( 0x80000000 >> 12 );
+ out_be32(gpio1_gpdat, regval);
+ /* Set Enable outputs */
+ regval = in_be32(gpio1_gpdir);
+ regval |= ( 0x80000000 >> 12 );
+ out_be32(gpio1_gpdir, regval);
+
+ /* Set PEX_REFCLK_SEL to 0 to select CLK0 */
+
+ /* Set IFC_PAR1 to output mode */
+ regval = in_be32(gpio2_gpdir);
+ regval |= ( 0x80000000 >> 14 );
+ out_be32(gpio2_gpdir, regval);
+
+ /* Set output to 0 to select clock source 0 */
+ regval = in_be32(gpio2_gpdat);
+ regval &= ~( 0x80000000 >> 14 );
+ out_be32(gpio2_gpdat, regval);
+
+#endif
+
+ /*
+ * IFC_PAR0 : GPIO2_13 : PEX_PERST_N
+ */
/* Remove reset from PCIe devices */
diff --git a/board/scalys/simc-t10xx/qt1040-1gb_nand_rcw.cfg b/board/scalys/simc-t10xx/qt1040-1gb_nand_rcw.cfg
new file mode 100644
index 0000000..48b9f68
--- /dev/null
+++ b/board/scalys/simc-t10xx/qt1040-1gb_nand_rcw.cfg
@@ -0,0 +1,7 @@
+#PBL preamble and RCW header
+AA55AA55 010E0100
+
+0c0a000c 0c000000 00000000 00000000
+81000002 40000002 e8105000 21000000
+00000000 cafebabe 00000000 00030ffc
+00000314 00005005 00000000 00000000
diff --git a/board/scalys/simc-t10xx/qt1040-1gb_nor_rcw.cfg b/board/scalys/simc-t10xx/qt1040-1gb_nor_rcw.cfg
new file mode 100644
index 0000000..5cf027e
--- /dev/null
+++ b/board/scalys/simc-t10xx/qt1040-1gb_nor_rcw.cfg
@@ -0,0 +1,7 @@
+#PBL preamble and RCW header
+AA55AA55 010E0100
+#
+0c0a000c 0c000000 00000000 00000000
+81000002 40000002 e8023000 21000000
+00000000 cafebabe 00000000 00030ffc
+00000314 00005005 00000000 00000000
diff --git a/board/scalys/simc-t10xx/qt1040-1gb_sdhc_rcw.cfg b/board/scalys/simc-t10xx/qt1040-1gb_sdhc_rcw.cfg
new file mode 100644
index 0000000..b5cc904
--- /dev/null
+++ b/board/scalys/simc-t10xx/qt1040-1gb_sdhc_rcw.cfg
@@ -0,0 +1,7 @@
+#PBL preamble and RCW header
+AA55AA55 010E0100
+#
+0c0a000c 0c000000 00000000 00000000
+81000002 40000002 68105000 21000000
+00000000 cafebabe 00000000 00030ffc
+00000314 00005005 00000000 00000000
diff --git a/board/scalys/simc-t10xx/qt1040-1gb_spi_rcw.cfg b/board/scalys/simc-t10xx/qt1040-1gb_spi_rcw.cfg
new file mode 100644
index 0000000..dfc4250
--- /dev/null
+++ b/board/scalys/simc-t10xx/qt1040-1gb_spi_rcw.cfg
@@ -0,0 +1,9 @@
+#PBL preamble and RCW header
+AA55AA55 010E0100
+#
+0c0a000c 0c000000 00000000 00000000
+81000002 40000002 58105000 21000000
+00000000 cafebabe 00000000 00030ffc
+00000314 00005005 00000000 00000000
+
+#58505000 / 58105000
diff --git a/board/scalys/simc-t10xx/simc-t1022_rcw.cfg b/board/scalys/simc-t10xx/simc-t1022_rcw.cfg
deleted file mode 100644
index 1ddbe0c..0000000
--- a/board/scalys/simc-t10xx/simc-t1022_rcw.cfg
+++ /dev/null
@@ -1,17 +0,0 @@
-#PBL preamble and RCW header
-AA55AA55 010E0100
-#
-#120C0015 15000000 00000000 00000000
-#06000000 00C00002 E8104000 21000000
-#00000000 CAFEBABE 00000000 00030ffc
-#00000314 0014500C 00000000 00000000
-#
-#120C0015 15000000 00000000 00000000
-#06000000 00000002 E8105000 21000000
-#00000000 CAFEBABE 00000000 00230FFC
-#00000714 0014500C 00000000 00000000
-
-120C0015 15000000 00000000 00000000
-86000000 00000002 E8104000 21000000
-00000000 CAFEBABE 00000000 00030FFC
-00000314 0014500C 00000000 00000000
diff --git a/board/scalys/simc-t10xx/simc-t1040_rcw.cfg b/board/scalys/simc-t10xx/simc-t1040_rcw.cfg
deleted file mode 100644
index 323ea71..0000000
--- a/board/scalys/simc-t10xx/simc-t1040_rcw.cfg
+++ /dev/null
@@ -1,7 +0,0 @@
-#PBL preamble and RCW header
-AA55AA55 010E0100
-#
-0A0C000C 0C000000 00000000 00000000
-81000002 00400002 E8105000 21000000
-00000000 CAFEBABE 00000000 00030FFC
-00000314 0014500C 00000000 00000000
diff --git a/board/scalys/simc-t10xx/simc-t10x0_nand_rcw.cfg b/board/scalys/simc-t10xx/simc-t10x0_nand_rcw.cfg
new file mode 100644
index 0000000..ccb3509
--- /dev/null
+++ b/board/scalys/simc-t10xx/simc-t10x0_nand_rcw.cfg
@@ -0,0 +1,7 @@
+#PBL preamble and RCW header
+AA55AA55 010E0100
+
+0c0c000c 0c000000 00000000 00000000
+81000002 40000002 e8105000 21000000
+00000000 cafebabe 00000000 00030ffc
+00000314 00005005 00000000 00000000
diff --git a/board/scalys/simc-t10xx/simc-t1040_nand_secure_rcw.cfg b/board/scalys/simc-t10xx/simc-t10x0_nand_secure_rcw.cfg
index 6a69289..6f0ec4d 100644
--- a/board/scalys/simc-t10xx/simc-t1040_nand_secure_rcw.cfg
+++ b/board/scalys/simc-t10xx/simc-t10x0_nand_secure_rcw.cfg
@@ -1,7 +1,7 @@
#PBL preamble and RCW header
AA55AA55 010E0100
#
-0A0C000C 0C000000 00000000 00000000
+0c0C000C 0C000000 00000000 00000000
# HOLDOFF E8705000
# core 0 enabled E8305000
# PBL disabled F8505000
@@ -9,6 +9,6 @@ AA55AA55 010E0100
#Holdoff enabled, PBL enabled No secure boot E8505000
#Holdoff enabled, PBL enabled with secure boot E8705000
-81000002 00400002 E8305000 21000000
-00000000 CAFEBABE 00000000 00030FFC
-00000314 0014500C 00000000 00000000 \ No newline at end of file
+81000002 40000002 e8305000 21000000
+00000000 cafebabe 00000000 00030ffc
+00000314 00005005 00000000 00000000
diff --git a/board/scalys/simc-t10xx/simc-t10x0_nor_rcw.cfg b/board/scalys/simc-t10xx/simc-t10x0_nor_rcw.cfg
new file mode 100644
index 0000000..a63c1f2
--- /dev/null
+++ b/board/scalys/simc-t10xx/simc-t10x0_nor_rcw.cfg
@@ -0,0 +1,7 @@
+#PBL preamble and RCW header
+AA55AA55 010E0100
+#
+0c0c000c 0c000000 00000000 00000000
+81000002 40000002 e8023000 21000000
+00000000 cafebabe 00000000 00030ffc
+00000314 00005005 00000000 00000000
diff --git a/board/scalys/simc-t10xx/simc-t10x0_sdhc_rcw.cfg b/board/scalys/simc-t10xx/simc-t10x0_sdhc_rcw.cfg
new file mode 100644
index 0000000..61236ed
--- /dev/null
+++ b/board/scalys/simc-t10xx/simc-t10x0_sdhc_rcw.cfg
@@ -0,0 +1,7 @@
+#PBL preamble and RCW header
+AA55AA55 010E0100
+#
+0c0c000c 0c000000 00000000 00000000
+81000002 40000002 68105000 21000000
+00000000 cafebabe 00000000 00030ffc
+00000314 00005005 00000000 00000000
diff --git a/board/scalys/simc-t10xx/simc-t10x0_spi_rcw.cfg b/board/scalys/simc-t10xx/simc-t10x0_spi_rcw.cfg
new file mode 100644
index 0000000..dba4882
--- /dev/null
+++ b/board/scalys/simc-t10xx/simc-t10x0_spi_rcw.cfg
@@ -0,0 +1,9 @@
+#PBL preamble and RCW header
+AA55AA55 010E0100
+#
+0c0c000c 0c000000 00000000 00000000
+81000002 40000002 58105000 21000000
+00000000 cafebabe 00000000 00030ffc
+00000314 00005005 00000000 00000000
+
+#58505000 / 58105000
diff --git a/board/scalys/simc-t10xx/simc-t10xx.c b/board/scalys/simc-t10xx/simc-t10xx.c
index 46c5677..2f9b8d3 100644
--- a/board/scalys/simc-t10xx/simc-t10xx.c
+++ b/board/scalys/simc-t10xx/simc-t10xx.c
@@ -1,10 +1,11 @@
/*
- * Copyright 2016 Scalys B.V.
+ * Copyright 2017 Scalys B.V.
* opensource@scalys.com
*
* SPDX-License-Identifier: GPL-2.0+
*/
+
#include <common.h>
#include <command.h>
#include <netdev.h>
@@ -31,7 +32,11 @@ DECLARE_GLOBAL_DATA_PTR;
int checkboard(void)
{
+#ifdef CONFIG_TARGET_QT1040_1GB
+ printf("Board: QT1040-1GB\n" );
+#else
printf("Board: simc-t10xx\n" );
+#endif
return 0;
}
@@ -110,8 +115,8 @@ int ft_board_setup(void *blob, bd_t *bd)
fdt_fixup_liodn(blob);
#ifdef CONFIG_HAS_FSL_DR_USB
- debug( "fdt_fixup_dr_usb\n" );
- fdt_fixup_dr_usb(blob, bd);
+ debug( "fsl_fdt_fixup_dr_usb\n" );
+ fsl_fdt_fixup_dr_usb(blob, bd);
#endif
#ifdef CONFIG_SYS_DPAA_FMAN
@@ -141,3 +146,8 @@ void board_detail(void)
do_bcdinfo();
}
#endif
+
+void board_reset(void)
+{
+ printf("U-boot reset command not implemented.\n");
+}
diff --git a/board/scalys/simc-t10xx/simc-t10xx_pbi.cfg b/board/scalys/simc-t10xx/simc-t10xx_nand_pbi.cfg
index c5fd95d..ad31c5b 100644
--- a/board/scalys/simc-t10xx/simc-t10xx_pbi.cfg
+++ b/board/scalys/simc-t10xx/simc-t10xx_nand_pbi.cfg
@@ -30,13 +30,14 @@
# (IFC_CSPR1)
09124010 ff8000c3
# IFC_CSOR_NAND
-09124130 0108a100
+09124130 85084101
# IFC_FTIM0_CS0_NAND to IFC_FTIM0_CS0_NAND
091241c0 181c080c
091241c4 3850141a
091241c8 03008028
091241cc 28000000
-# Set IFC_CCR clkdiv to 6 (IFC clock to platform clock/6=83.3MHz)
-0912444c 05008000
+# Set IFC_CCR clkdiv to 2 (=/3) to get:
+# (platform clock/2/3=83.3MHz)
+0912444c 02008000
#Flush PBL data (Wait 0xFFFFF cycles )
091380c0 000fffff \ No newline at end of file
diff --git a/board/scalys/simc-t10xx/simc-t10xx_nor_pbi.cfg b/board/scalys/simc-t10xx/simc-t10xx_nor_pbi.cfg
new file mode 100644
index 0000000..1e7a20e
--- /dev/null
+++ b/board/scalys/simc-t10xx/simc-t10xx_nor_pbi.cfg
@@ -0,0 +1,44 @@
+#PBI commands
+#Software Workaround for errata A-007662 to train PCIe2 controller in Gen2 speed
+09250100 00000400
+09250108 00002000
+#Software Workaround for errata A-008007 to reset PVR register
+09000010 0000000b
+09000014 c0000000
+09000018 81d00017
+89020400 a1000000
+091380c0 000f0000
+89020400 00000000
+#Initialize CPC1
+09010000 00200400
+09138000 00000000
+091380c0 00000100
+#Configure CPC1 as 256KB SRAM
+09010100 00000000
+09010104 fffc0007
+09010f00 08000000
+09010000 80000000
+#Configure LAW for CPC1 (LAW 13)
+09000cd0 00000000
+09000cd4 fffc0000
+09000cd8 81000011
+#Configure alternate space
+09000010 00000000
+09000014 ff000000
+09000018 81000000
+
+#Configure IFC controller
+# (IFC_CSPR1)
+#09124010 ff8000c3
+# IFC_CSOR_NAND
+#09124130 0108a100
+# IFC_FTIM0_CS0_NAND to IFC_FTIM0_CS0_NAND
+#091241c0 181c080c
+#091241c4 3850141a
+#091241c8 03008028
+#091241cc 28000000
+
+# Set IFC_CCR clkdiv to 6 (IFC clock to platform clock/6=83.3MHz)
+0912444c 05008000
+#Flush PBL data (Wait 0xFFFFF cycles )
+091380c0 000fffff \ No newline at end of file
diff --git a/board/scalys/simc-t10xx/simc-t10xx_sdhc_pbi.cfg b/board/scalys/simc-t10xx/simc-t10xx_sdhc_pbi.cfg
new file mode 100644
index 0000000..51945b4
--- /dev/null
+++ b/board/scalys/simc-t10xx/simc-t10xx_sdhc_pbi.cfg
@@ -0,0 +1,36 @@
+#PBI commands
+#Software Workaround for errata A-007662 to train PCIe2 controller in Gen2 speed
+09250100 00000400
+09250108 00002000
+#Software Workaround for errata A-008007 to reset PVR register
+09000010 0000000b
+09000014 c0000000
+09000018 81d00017
+89020400 a1000000
+091380c0 000f0000
+89020400 00000000
+#Initialize CPC1
+09010000 00200400
+09138000 00000000
+091380c0 00000100
+#Configure CPC1 as 256KB SRAM
+09010100 00000000
+09010104 fffc0007
+09010f00 081e000d
+09010000 80000000
+#Configure LAW for CPC1
+09000cd0 00000000
+09000cd4 fffc0000
+09000cd8 81000011
+#Configure alternate space
+09000010 00000000
+09000014 ff000000
+09000018 81000000
+#Configure SPI controller
+09110000 80000403
+09110020 2d170008
+09110024 00100008
+09110028 00100008
+0911002c 00100008
+#Flush PBL data
+091380c0 000FFFFF
diff --git a/board/scalys/simc-t10xx/simc-t10xx_spi_pbi.cfg b/board/scalys/simc-t10xx/simc-t10xx_spi_pbi.cfg
new file mode 100644
index 0000000..51945b4
--- /dev/null
+++ b/board/scalys/simc-t10xx/simc-t10xx_spi_pbi.cfg
@@ -0,0 +1,36 @@
+#PBI commands
+#Software Workaround for errata A-007662 to train PCIe2 controller in Gen2 speed
+09250100 00000400
+09250108 00002000
+#Software Workaround for errata A-008007 to reset PVR register
+09000010 0000000b
+09000014 c0000000
+09000018 81d00017
+89020400 a1000000
+091380c0 000f0000
+89020400 00000000
+#Initialize CPC1
+09010000 00200400
+09138000 00000000
+091380c0 00000100
+#Configure CPC1 as 256KB SRAM
+09010100 00000000
+09010104 fffc0007
+09010f00 081e000d
+09010000 80000000
+#Configure LAW for CPC1
+09000cd0 00000000
+09000cd4 fffc0000
+09000cd8 81000011
+#Configure alternate space
+09000010 00000000
+09000014 ff000000
+09000018 81000000
+#Configure SPI controller
+09110000 80000403
+09110020 2d170008
+09110024 00100008
+09110028 00100008
+0911002c 00100008
+#Flush PBL data
+091380c0 000FFFFF
diff --git a/board/scalys/simc-t10xx/spl.c b/board/scalys/simc-t10xx/spl.c
index 3675169..c861284 100644
--- a/board/scalys/simc-t10xx/spl.c
+++ b/board/scalys/simc-t10xx/spl.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Scalys B.V.
+ * Copyright 2017 Scalys B.V.
* opensource@scalys.com
*
* Copyright 2013 Freescale Semiconductor, Inc.
@@ -10,10 +10,11 @@
#include <common.h>
#include <malloc.h>
#include <ns16550.h>
+#include <console.h>
#include <nand.h>
-#include <i2c.h>
#include <mmc.h>
#include <fsl_esdhc.h>
+#include <i2c.h>
#include <spi_flash.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -61,9 +62,40 @@ void board_init_f(ulong bootflag)
relocate_code(CONFIG_SPL_RELOC_STACK, (gd_t *)CONFIG_SPL_GD_ADDR, 0x0);
}
+void setup_ifc_nand(enum ifc_chip_sel cs)
+{
+ set_ifc_cspr_ext(cs, CONFIG_SYS_NAND_CSPR_EXT);
+ set_ifc_csor (cs, CONFIG_SYS_NAND_CSOR);
+ set_ifc_amask (cs, CONFIG_SYS_NAND_AMASK);
+ set_ifc_cspr (cs, CONFIG_SYS_NAND_CSPR);
+ set_ifc_ftim (cs, IFC_FTIM0, CONFIG_SYS_NAND_FTIM0);
+ set_ifc_ftim (cs, IFC_FTIM1, CONFIG_SYS_NAND_FTIM1);
+ set_ifc_ftim (cs, IFC_FTIM2, CONFIG_SYS_NAND_FTIM2);
+ set_ifc_ftim (cs, IFC_FTIM3, CONFIG_SYS_NAND_FTIM3);
+ set_ifc_csor_ext(cs, 0);
+
+}
+
+void setup_ifc_nor(enum ifc_chip_sel cs)
+{
+ set_ifc_cspr_ext(cs, CONFIG_SYS_NOR_CSPR_EXT);
+ set_ifc_csor (cs, CONFIG_SYS_NOR_CSOR);
+ set_ifc_amask (cs, CONFIG_SYS_NOR_AMASK);
+ set_ifc_cspr (cs, CONFIG_SYS_NOR_CSPR);
+ set_ifc_ftim (cs, IFC_FTIM0, CONFIG_SYS_NOR_FTIM0);
+ set_ifc_ftim (cs, IFC_FTIM1, CONFIG_SYS_NOR_FTIM1);
+ set_ifc_ftim (cs, IFC_FTIM2, CONFIG_SYS_NOR_FTIM2);
+ set_ifc_ftim (cs, IFC_FTIM3, CONFIG_SYS_NOR_FTIM3);
+ set_ifc_csor_ext(cs, 0);
+}
+
void board_init_r(gd_t *gd, ulong dest_addr)
{
bd_t *bd;
+ ccsr_gur_t *gur = (void __iomem *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
+ uint32_t boot_source;
+
+ __attribute__((noreturn)) void (*boot)(void) = hang;
bd = (bd_t *)(gd + sizeof(gd_t));
memset(bd, 0, sizeof(bd_t));
@@ -71,11 +103,80 @@ void board_init_r(gd_t *gd, ulong dest_addr)
bd->bi_memstart = CONFIG_SYS_INIT_L3_ADDR;
bd->bi_memsize = CONFIG_SYS_L3_SIZE;
- probecpu();
+ arch_cpu_init();
get_clocks();
mem_malloc_init(CONFIG_SPL_RELOC_MALLOC_ADDR,
CONFIG_SPL_RELOC_MALLOC_SIZE);
+ gd->env_addr = (ulong)(CONFIG_ENV_ADDR);
+ gd->env_valid = 1;
+
+ dram_init();
+
+ /* Get the boot source from the Power On Status Register (set by QSC) */
+ boot_source = (in_be32(&gur->porsr1) >> 23);
+
+ switch (boot_source) {
+ case 0x23:
+ /* NOR boot */
+ setup_ifc_nor(IFC_CS0);
+ setup_ifc_nand(IFC_CS1);
+
+ memcpy((void*)CONFIG_SYS_NAND_U_BOOT_DST, (void*) CONFIG_SYS_FLASH_BASE + CONFIG_SPL_PAD_TO, CONFIG_SYS_NAND_U_BOOT_SIZE);
+
+ flush_cache(CONFIG_SYS_NAND_U_BOOT_DST, CONFIG_SYS_NAND_U_BOOT_SIZE);
+ boot = (void*) CONFIG_SYS_NAND_U_BOOT_START;
+ break;
+
+ case 0x45:
+#if 0
+ /*SPI nor flash */
+ setup_ifc_nand(IFC_CS0);
+ setup_ifc_nor(IFC_CS1);
+ //fsl_spi_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE, (uchar *)CONFIG_ENV_ADDR);
+ {
+ struct spi_flash *flash;
+
+ flash = spi_flash_probe(0, 0,
+ CONFIG_SF_DEFAULT_SPEED, CONFIG_SF_DEFAULT_MODE);
+ if (flash == NULL) {
+ puts("\nspi_flash_probe failed");
+ hang();
+ }
+
+ spi_flash_read(flash, CONFIG_SPL_PAD_TO, CONFIG_SYS_NAND_U_BOOT_SIZE, (void*) CONFIG_SYS_NAND_U_BOOT_DST);
+ }
+#endif
+ printf("TODO, load u-boot from SPI....\n");
+ hang();
+ break;
+ case 0x40:
+ /* SD/MMC (eSDHC) boot */
+ #ifdef CONFIG_SPL_MMC_BOOT
+ setup_ifc_nand(IFC_CS0);
+ setup_ifc_nor(IFC_CS1);
+
+ mmc_initialize(bd);
+ mmc_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
+ (uchar *)CONFIG_ENV_ADDR);
+ boot = mmc_boot;
+ #endif
+ break;
+ case 0x105:
+ /* NAND boot */
+ setup_ifc_nand(IFC_CS0);
+ setup_ifc_nor(IFC_CS1);
+
+ nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
+ (uchar *)CONFIG_ENV_ADDR);
+ boot = nand_boot;
+ break;
+ default:
+ printf("Unknown boot source (%3x\n", boot_source);
+ break;
+ }
+ boot();
+#if 0
#ifdef CONFIG_SPL_MMC_BOOT
mmc_initialize(bd);
#endif
@@ -85,6 +186,7 @@ void board_init_r(gd_t *gd, ulong dest_addr)
nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
(uchar *)CONFIG_ENV_ADDR);
#endif
+
#ifdef CONFIG_SPL_MMC_BOOT
mmc_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
(uchar *)CONFIG_ENV_ADDR);
@@ -109,4 +211,5 @@ void board_init_r(gd_t *gd, ulong dest_addr)
#elif defined(CONFIG_SPL_NAND_BOOT)
nand_boot();
#endif
+#endif
}
diff --git a/board/scalys/simc-t10xx/tlb.c b/board/scalys/simc-t10xx/tlb.c
index fa2dccb..e6edf51 100644
--- a/board/scalys/simc-t10xx/tlb.c
+++ b/board/scalys/simc-t10xx/tlb.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Scalys B.V.
+ * Copyright 2017 Scalys B.V.
* opensource@scalys.com
*
* Copyright 2013 Freescale Semiconductor, Inc.
@@ -40,14 +40,12 @@ struct fsl_e_tlb_entry tlb_table[] = {
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_256K, 1),
-
#elif defined(CONFIG_SECURE_BOOT) && defined(CONFIG_SPL_BUILD)
/*
* *I*G - L3SRAM. When L3 is used as 256K SRAM, in case of Secure Boot
* the physical address of the SRAM is at 0xbffc0000,
* and virtual address is 0xfffc0000
*/
-
SET_TLB_ENTRY(1, CONFIG_SYS_INIT_L3_VADDR,
CONFIG_SYS_INIT_L3_ADDR,
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
@@ -66,8 +64,8 @@ struct fsl_e_tlb_entry tlb_table[] = {
/* *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),
+ MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
+ 0, 2, BOOKE_PAGESZ_64M, 1),
#ifndef CONFIG_SPL_BUILD
#ifdef CONFIG_PCI
@@ -116,21 +114,20 @@ struct fsl_e_tlb_entry tlb_table[] = {
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
0, 10, BOOKE_PAGESZ_64K, 1),
#endif
-#ifdef CONFIG_SYS_CPLD_BASE
- SET_TLB_ENTRY(1, CONFIG_SYS_CPLD_BASE, CONFIG_SYS_CPLD_BASE_PHYS,
- MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
- 0, 11, BOOKE_PAGESZ_256K, 1),
-#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, 12, BOOKE_PAGESZ_1G, 1),
+#if defined(CONFIG_SYS_SDRAM_SIZE)
+#if (CONFIG_SYS_SDRAM_SIZE >= 2048)
SET_TLB_ENTRY(1, CONFIG_SYS_DDR_SDRAM_BASE + 0x40000000,
CONFIG_SYS_DDR_SDRAM_BASE + 0x40000000,
MAS3_SX|MAS3_SW|MAS3_SR, 0,
0, 13, BOOKE_PAGESZ_1G, 1)
#endif
+#endif
+#endif
};
int num_tlb_entries = ARRAY_SIZE(tlb_table);