diff options
author | RajithaY <rajithax.yerrumsetty@intel.com> | 2017-04-25 03:31:15 -0700 |
---|---|---|
committer | Rajitha Yerrumchetty <rajithax.yerrumsetty@intel.com> | 2017-05-22 06:48:08 +0000 |
commit | bb756eebdac6fd24e8919e2c43f7d2c8c4091f59 (patch) | |
tree | ca11e03542edf2d8f631efeca5e1626d211107e3 /qemu/roms/u-boot/arch/powerpc/cpu/mpc8xxx | |
parent | a14b48d18a9ed03ec191cf16b162206998a895ce (diff) |
Adding qemu as a submodule of KVMFORNFV
This Patch includes the changes to add qemu as a submodule to
kvmfornfv repo and make use of the updated latest qemu for the
execution of all testcase
Change-Id: I1280af507a857675c7f81d30c95255635667bdd7
Signed-off-by:RajithaY<rajithax.yerrumsetty@intel.com>
Diffstat (limited to 'qemu/roms/u-boot/arch/powerpc/cpu/mpc8xxx')
-rw-r--r-- | qemu/roms/u-boot/arch/powerpc/cpu/mpc8xxx/Makefile | 30 | ||||
-rw-r--r-- | qemu/roms/u-boot/arch/powerpc/cpu/mpc8xxx/cpu.c | 271 | ||||
-rw-r--r-- | qemu/roms/u-boot/arch/powerpc/cpu/mpc8xxx/fdt.c | 428 | ||||
-rw-r--r-- | qemu/roms/u-boot/arch/powerpc/cpu/mpc8xxx/fsl_lbc.c | 153 | ||||
-rw-r--r-- | qemu/roms/u-boot/arch/powerpc/cpu/mpc8xxx/law.c | 354 | ||||
-rw-r--r-- | qemu/roms/u-boot/arch/powerpc/cpu/mpc8xxx/srio.c | 446 |
6 files changed, 0 insertions, 1682 deletions
diff --git a/qemu/roms/u-boot/arch/powerpc/cpu/mpc8xxx/Makefile b/qemu/roms/u-boot/arch/powerpc/cpu/mpc8xxx/Makefile deleted file mode 100644 index e95539e0a..000000000 --- a/qemu/roms/u-boot/arch/powerpc/cpu/mpc8xxx/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -# -# Copyright 2009-2010 Freescale Semiconductor, Inc. -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# Version 2 as published by the Free Software Foundation. -# - -MINIMAL= - -ifdef CONFIG_SPL_BUILD -ifdef CONFIG_SPL_INIT_MINIMAL -MINIMAL=y -endif -endif - -ifdef MINIMAL - -obj-$(CONFIG_FSL_LAW) += law.o - -else -obj-$(CONFIG_MPC85xx) += cpu.o -obj-$(CONFIG_MPC86xx) += cpu.o - -obj-$(CONFIG_OF_LIBFDT) += fdt.o -obj-$(CONFIG_FSL_LBC) += fsl_lbc.o -obj-$(CONFIG_SYS_SRIO) += srio.o -obj-$(CONFIG_FSL_LAW) += law.o - -endif diff --git a/qemu/roms/u-boot/arch/powerpc/cpu/mpc8xxx/cpu.c b/qemu/roms/u-boot/arch/powerpc/cpu/mpc8xxx/cpu.c deleted file mode 100644 index 13bd0acdf..000000000 --- a/qemu/roms/u-boot/arch/powerpc/cpu/mpc8xxx/cpu.c +++ /dev/null @@ -1,271 +0,0 @@ -/* - * Copyright 2009-2012 Freescale Semiconductor, Inc. - * - * This file is derived from arch/powerpc/cpu/mpc85xx/cpu.c and - * arch/powerpc/cpu/mpc86xx/cpu.c. Basically this file contains - * cpu specific common code for 85xx/86xx processors. - * SPDX-License-Identifier: GPL-2.0+ - */ - -#include <config.h> -#include <common.h> -#include <command.h> -#include <tsec.h> -#include <fm_eth.h> -#include <netdev.h> -#include <asm/cache.h> -#include <asm/io.h> - -DECLARE_GLOBAL_DATA_PTR; - -static struct cpu_type cpu_type_list[] = { -#if defined(CONFIG_MPC85xx) - CPU_TYPE_ENTRY(8533, 8533, 1), - CPU_TYPE_ENTRY(8535, 8535, 1), - CPU_TYPE_ENTRY(8536, 8536, 1), - CPU_TYPE_ENTRY(8540, 8540, 1), - CPU_TYPE_ENTRY(8541, 8541, 1), - CPU_TYPE_ENTRY(8543, 8543, 1), - CPU_TYPE_ENTRY(8544, 8544, 1), - CPU_TYPE_ENTRY(8545, 8545, 1), - CPU_TYPE_ENTRY(8547, 8547, 1), - CPU_TYPE_ENTRY(8548, 8548, 1), - CPU_TYPE_ENTRY(8555, 8555, 1), - CPU_TYPE_ENTRY(8560, 8560, 1), - CPU_TYPE_ENTRY(8567, 8567, 1), - CPU_TYPE_ENTRY(8568, 8568, 1), - CPU_TYPE_ENTRY(8569, 8569, 1), - CPU_TYPE_ENTRY(8572, 8572, 2), - CPU_TYPE_ENTRY(P1010, P1010, 1), - CPU_TYPE_ENTRY(P1011, P1011, 1), - CPU_TYPE_ENTRY(P1012, P1012, 1), - CPU_TYPE_ENTRY(P1013, P1013, 1), - CPU_TYPE_ENTRY(P1014, P1014, 1), - CPU_TYPE_ENTRY(P1017, P1017, 1), - CPU_TYPE_ENTRY(P1020, P1020, 2), - CPU_TYPE_ENTRY(P1021, P1021, 2), - CPU_TYPE_ENTRY(P1022, P1022, 2), - CPU_TYPE_ENTRY(P1023, P1023, 2), - CPU_TYPE_ENTRY(P1024, P1024, 2), - CPU_TYPE_ENTRY(P1025, P1025, 2), - CPU_TYPE_ENTRY(P2010, P2010, 1), - CPU_TYPE_ENTRY(P2020, P2020, 2), - CPU_TYPE_ENTRY(P2040, P2040, 4), - CPU_TYPE_ENTRY(P2041, P2041, 4), - CPU_TYPE_ENTRY(P3041, P3041, 4), - CPU_TYPE_ENTRY(P4040, P4040, 4), - CPU_TYPE_ENTRY(P4080, P4080, 8), - CPU_TYPE_ENTRY(P5010, P5010, 1), - CPU_TYPE_ENTRY(P5020, P5020, 2), - CPU_TYPE_ENTRY(P5021, P5021, 2), - CPU_TYPE_ENTRY(P5040, P5040, 4), - CPU_TYPE_ENTRY(T4240, T4240, 0), - CPU_TYPE_ENTRY(T4120, T4120, 0), - CPU_TYPE_ENTRY(T4160, T4160, 0), - CPU_TYPE_ENTRY(T4080, T4080, 4), - CPU_TYPE_ENTRY(B4860, B4860, 0), - CPU_TYPE_ENTRY(G4860, G4860, 0), - CPU_TYPE_ENTRY(G4060, G4060, 0), - CPU_TYPE_ENTRY(B4440, B4440, 0), - CPU_TYPE_ENTRY(G4440, G4440, 0), - CPU_TYPE_ENTRY(B4420, B4420, 0), - CPU_TYPE_ENTRY(B4220, B4220, 0), - CPU_TYPE_ENTRY(T1040, T1040, 0), - CPU_TYPE_ENTRY(T1041, T1041, 0), - CPU_TYPE_ENTRY(T1042, T1042, 0), - CPU_TYPE_ENTRY(T1020, T1020, 0), - CPU_TYPE_ENTRY(T1021, T1021, 0), - CPU_TYPE_ENTRY(T1022, T1022, 0), - CPU_TYPE_ENTRY(T2080, T2080, 0), - CPU_TYPE_ENTRY(T2081, T2081, 0), - CPU_TYPE_ENTRY(BSC9130, 9130, 1), - CPU_TYPE_ENTRY(BSC9131, 9131, 1), - CPU_TYPE_ENTRY(BSC9132, 9132, 2), - CPU_TYPE_ENTRY(BSC9232, 9232, 2), - CPU_TYPE_ENTRY(C291, C291, 1), - CPU_TYPE_ENTRY(C292, C292, 1), - CPU_TYPE_ENTRY(C293, C293, 1), -#elif defined(CONFIG_MPC86xx) - CPU_TYPE_ENTRY(8610, 8610, 1), - CPU_TYPE_ENTRY(8641, 8641, 2), - CPU_TYPE_ENTRY(8641D, 8641D, 2), -#endif -}; - -#ifdef CONFIG_SYS_FSL_QORIQ_CHASSIS2 -static inline u32 init_type(u32 cluster, int init_id) -{ - ccsr_gur_t *gur = (void __iomem *)(CONFIG_SYS_MPC85xx_GUTS_ADDR); - u32 idx = (cluster >> (init_id * 8)) & TP_CLUSTER_INIT_MASK; - u32 type = in_be32(&gur->tp_ityp[idx]); - - if (type & TP_ITYP_AV) - return type; - - return 0; -} - -u32 compute_ppc_cpumask(void) -{ - ccsr_gur_t *gur = (void __iomem *)(CONFIG_SYS_MPC85xx_GUTS_ADDR); - int i = 0, count = 0; - u32 cluster, type, mask = 0; - - do { - int j; - cluster = in_be32(&gur->tp_cluster[i].lower); - for (j = 0; j < TP_INIT_PER_CLUSTER; j++) { - type = init_type(cluster, j); - if (type) { - if (TP_ITYP_TYPE(type) == TP_ITYP_TYPE_PPC) - mask |= 1 << count; - count++; - } - } - i++; - } while ((cluster & TP_CLUSTER_EOC) != TP_CLUSTER_EOC); - - return mask; -} - -int fsl_qoriq_core_to_cluster(unsigned int core) -{ - ccsr_gur_t *gur = (void __iomem *)(CONFIG_SYS_MPC85xx_GUTS_ADDR); - int i = 0, count = 0; - u32 cluster; - - do { - int j; - cluster = in_be32(&gur->tp_cluster[i].lower); - for (j = 0; j < TP_INIT_PER_CLUSTER; j++) { - if (init_type(cluster, j)) { - if (count == core) - return i; - count++; - } - } - i++; - } while ((cluster & TP_CLUSTER_EOC) != TP_CLUSTER_EOC); - - return -1; /* cannot identify the cluster */ -} - -#else /* CONFIG_SYS_FSL_QORIQ_CHASSIS2 */ -/* - * Before chassis genenration 2, the cpumask should be hard-coded. - * In case of cpu type unknown or cpumask unset, use 1 as fail save. - */ -#define compute_ppc_cpumask() 1 -#define fsl_qoriq_core_to_cluster(x) x -#endif /* CONFIG_SYS_FSL_QORIQ_CHASSIS2 */ - -static struct cpu_type cpu_type_unknown = CPU_TYPE_ENTRY(Unknown, Unknown, 0); - -struct cpu_type *identify_cpu(u32 ver) -{ - int i; - for (i = 0; i < ARRAY_SIZE(cpu_type_list); i++) { - if (cpu_type_list[i].soc_ver == ver) - return &cpu_type_list[i]; - } - return &cpu_type_unknown; -} - -#define MPC8xxx_PICFRR_NCPU_MASK 0x00001f00 -#define MPC8xxx_PICFRR_NCPU_SHIFT 8 - -/* - * Return a 32-bit mask indicating which cores are present on this SOC. - */ -__weak u32 cpu_mask(void) -{ - ccsr_pic_t __iomem *pic = (void *)CONFIG_SYS_MPC8xxx_PIC_ADDR; - struct cpu_type *cpu = gd->arch.cpu; - - /* better to query feature reporting register than just assume 1 */ - if (cpu == &cpu_type_unknown) - return ((in_be32(&pic->frr) & MPC8xxx_PICFRR_NCPU_MASK) >> - MPC8xxx_PICFRR_NCPU_SHIFT) + 1; - - if (cpu->num_cores == 0) - return compute_ppc_cpumask(); - - return cpu->mask; -} - -/* - * Return the number of cores on this SOC. - */ -__weak int cpu_numcores(void) -{ - struct cpu_type *cpu = gd->arch.cpu; - - /* - * Report # of cores in terms of the cpu_mask if we haven't - * figured out how many there are yet - */ - if (cpu->num_cores == 0) - return hweight32(cpu_mask()); - - return cpu->num_cores; -} - -/* - * Check if the given core ID is valid - * - * Returns zero if it isn't, 1 if it is. - */ -int is_core_valid(unsigned int core) -{ - return !!((1 << core) & cpu_mask()); -} - -int probecpu (void) -{ - uint svr; - uint ver; - - svr = get_svr(); - ver = SVR_SOC_VER(svr); - - gd->arch.cpu = identify_cpu(ver); - - return 0; -} - -/* Once in memory, compute mask & # cores once and save them off */ -int fixup_cpu(void) -{ - struct cpu_type *cpu = gd->arch.cpu; - - if (cpu->num_cores == 0) { - cpu->mask = cpu_mask(); - cpu->num_cores = cpu_numcores(); - } - - return 0; -} - -/* - * Initializes on-chip ethernet controllers. - * to override, implement board_eth_init() - */ -int cpu_eth_init(bd_t *bis) -{ -#if defined(CONFIG_ETHER_ON_FCC) - fec_initialize(bis); -#endif - -#if defined(CONFIG_UEC_ETH) - uec_standard_init(bis); -#endif - -#if defined(CONFIG_TSEC_ENET) || defined(CONFIG_MPC85XX_FEC) - tsec_standard_init(bis); -#endif - -#ifdef CONFIG_FMAN_ENET - fm_standard_init(bis); -#endif - return 0; -} diff --git a/qemu/roms/u-boot/arch/powerpc/cpu/mpc8xxx/fdt.c b/qemu/roms/u-boot/arch/powerpc/cpu/mpc8xxx/fdt.c deleted file mode 100644 index 927374529..000000000 --- a/qemu/roms/u-boot/arch/powerpc/cpu/mpc8xxx/fdt.c +++ /dev/null @@ -1,428 +0,0 @@ -/* - * Copyright 2009-2012 Freescale Semiconductor, Inc. - * - * This file is derived from arch/powerpc/cpu/mpc85xx/cpu.c and - * arch/powerpc/cpu/mpc86xx/cpu.c. Basically this file contains - * cpu specific common code for 85xx/86xx processors. - * SPDX-License-Identifier: GPL-2.0+ - */ - -#include <common.h> -#include <libfdt.h> -#include <fdt_support.h> -#include <asm/mp.h> -#include <asm/fsl_serdes.h> -#include <phy.h> -#include <hwconfig.h> - -#ifndef CONFIG_USB_MAX_CONTROLLER_COUNT -#define CONFIG_USB_MAX_CONTROLLER_COUNT 1 -#endif - -#if defined(CONFIG_MP) && (defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)) -static int ft_del_cpuhandle(void *blob, int cpuhandle) -{ - int off, ret = -FDT_ERR_NOTFOUND; - - /* if we find a match, we'll delete at it which point the offsets are - * invalid so we start over from the beginning - */ - off = fdt_node_offset_by_prop_value(blob, -1, "cpu-handle", - &cpuhandle, 4); - while (off != -FDT_ERR_NOTFOUND) { - fdt_delprop(blob, off, "cpu-handle"); - ret = 1; - off = fdt_node_offset_by_prop_value(blob, -1, "cpu-handle", - &cpuhandle, 4); - } - - return ret; -} - -void ft_fixup_num_cores(void *blob) { - int off, num_cores, del_cores; - - del_cores = 0; - num_cores = cpu_numcores(); - - off = fdt_node_offset_by_prop_value(blob, -1, "device_type", "cpu", 4); - while (off != -FDT_ERR_NOTFOUND) { - u32 *reg = (u32 *)fdt_getprop(blob, off, "reg", 0); - u32 phys_cpu_id = thread_to_core(*reg); - - if (!is_core_valid(phys_cpu_id) || is_core_disabled(phys_cpu_id)) { - int ph = fdt_get_phandle(blob, off); - - /* Delete the cpu node once there are no cpu handles */ - if (-FDT_ERR_NOTFOUND == ft_del_cpuhandle(blob, ph)) { - fdt_del_node(blob, off); - del_cores++; - } - /* either we deleted some cpu handles or the cpu node - * so we reset the offset back to the start since we - * can't trust the offsets anymore - */ - off = -1; - } - off = fdt_node_offset_by_prop_value(blob, off, - "device_type", "cpu", 4); - } - debug ("%x core system found\n", num_cores); - debug ("deleted %d extra core entry entries from device tree\n", - del_cores); -} -#endif /* defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx) */ - -#if defined(CONFIG_HAS_FSL_DR_USB) || defined(CONFIG_HAS_FSL_MPH_USB) -static int fdt_fixup_usb_mode_phy_type(void *blob, const char *mode, - const char *phy_type, int start_offset) -{ - const char *compat_dr = "fsl-usb2-dr"; - const char *compat_mph = "fsl-usb2-mph"; - const char *prop_mode = "dr_mode"; - const char *prop_type = "phy_type"; - const char *node_type = NULL; - int node_offset; - int err; - - node_offset = fdt_node_offset_by_compatible(blob, - start_offset, compat_mph); - if (node_offset < 0) { - node_offset = fdt_node_offset_by_compatible(blob, - start_offset, compat_dr); - if (node_offset < 0) { - printf("WARNING: could not find compatible" - " node %s or %s: %s.\n", compat_mph, - compat_dr, fdt_strerror(node_offset)); - return -1; - } else - node_type = compat_dr; - } else - node_type = compat_mph; - - if (mode) { - err = fdt_setprop(blob, node_offset, prop_mode, mode, - strlen(mode) + 1); - if (err < 0) - printf("WARNING: could not set %s for %s: %s.\n", - prop_mode, node_type, fdt_strerror(err)); - } - - if (phy_type) { - err = fdt_setprop(blob, node_offset, prop_type, phy_type, - strlen(phy_type) + 1); - if (err < 0) - printf("WARNING: could not set %s for %s: %s.\n", - prop_type, node_type, fdt_strerror(err)); - } - - return node_offset; -} - -void fdt_fixup_dr_usb(void *blob, bd_t *bd) -{ - const char *modes[] = { "host", "peripheral", "otg" }; - const char *phys[] = { "ulpi", "utmi" }; - const char *dr_mode_type = NULL; - const char *dr_phy_type = NULL; - int usb_mode_off = -1; - int usb_phy_off = -1; - char str[5]; - int i, j; - - for (i = 1; i <= CONFIG_USB_MAX_CONTROLLER_COUNT; i++) { - int mode_idx = -1, phy_idx = -1; - snprintf(str, 5, "%s%d", "usb", i); - if (hwconfig(str)) { - for (j = 0; j < ARRAY_SIZE(modes); j++) { - if (hwconfig_subarg_cmp(str, "dr_mode", - modes[j])) { - mode_idx = j; - break; - } - } - - for (j = 0; j < ARRAY_SIZE(phys); j++) { - if (hwconfig_subarg_cmp(str, "phy_type", - phys[j])) { - phy_idx = j; - break; - } - } - - if (mode_idx < 0 || phy_idx < 0) { - puts("ERROR: wrong usb mode/phy defined!!\n"); - return; - } - - dr_mode_type = modes[mode_idx]; - dr_phy_type = phys[phy_idx]; - - if (mode_idx < 0 && phy_idx < 0) { - printf("WARNING: invalid phy or mode\n"); - return; - } - } - - usb_mode_off = fdt_fixup_usb_mode_phy_type(blob, - dr_mode_type, NULL, usb_mode_off); - - if (usb_mode_off < 0) - return; - - usb_phy_off = fdt_fixup_usb_mode_phy_type(blob, - NULL, dr_phy_type, usb_phy_off); - - if (usb_phy_off < 0) - return; - } -} -#endif /* defined(CONFIG_HAS_FSL_DR_USB) || defined(CONFIG_HAS_FSL_MPH_USB) */ - -/* - * update crypto node properties to a specified revision of the SEC - * called with sec_rev == 0 if not on an E processor - */ -#if CONFIG_SYS_FSL_SEC_COMPAT == 2 /* SEC 2.x/3.x */ -void fdt_fixup_crypto_node(void *blob, int sec_rev) -{ - static const struct sec_rev_prop { - u32 sec_rev; - u32 num_channels; - u32 channel_fifo_len; - u32 exec_units_mask; - u32 descriptor_types_mask; - } sec_rev_prop_list [] = { - { 0x0200, 4, 24, 0x07e, 0x01010ebf }, /* SEC 2.0 */ - { 0x0201, 4, 24, 0x0fe, 0x012b0ebf }, /* SEC 2.1 */ - { 0x0202, 1, 24, 0x04c, 0x0122003f }, /* SEC 2.2 */ - { 0x0204, 4, 24, 0x07e, 0x012b0ebf }, /* SEC 2.4 */ - { 0x0300, 4, 24, 0x9fe, 0x03ab0ebf }, /* SEC 3.0 */ - { 0x0301, 4, 24, 0xbfe, 0x03ab0ebf }, /* SEC 3.1 */ - { 0x0303, 4, 24, 0x97c, 0x03a30abf }, /* SEC 3.3 */ - }; - static char compat_strlist[ARRAY_SIZE(sec_rev_prop_list) * - sizeof("fsl,secX.Y")]; - int crypto_node, sec_idx, err; - char *p; - u32 val; - - /* locate crypto node based on lowest common compatible */ - crypto_node = fdt_node_offset_by_compatible(blob, -1, "fsl,sec2.0"); - if (crypto_node == -FDT_ERR_NOTFOUND) - return; - - /* delete it if not on an E-processor */ - if (crypto_node > 0 && !sec_rev) { - fdt_del_node(blob, crypto_node); - return; - } - - /* else we got called for possible uprev */ - for (sec_idx = 0; sec_idx < ARRAY_SIZE(sec_rev_prop_list); sec_idx++) - if (sec_rev_prop_list[sec_idx].sec_rev == sec_rev) - break; - - if (sec_idx == ARRAY_SIZE(sec_rev_prop_list)) { - puts("warning: unknown SEC revision number\n"); - return; - } - - val = cpu_to_fdt32(sec_rev_prop_list[sec_idx].num_channels); - err = fdt_setprop(blob, crypto_node, "fsl,num-channels", &val, 4); - if (err < 0) - printf("WARNING: could not set crypto property: %s\n", - fdt_strerror(err)); - - val = cpu_to_fdt32(sec_rev_prop_list[sec_idx].descriptor_types_mask); - err = fdt_setprop(blob, crypto_node, "fsl,descriptor-types-mask", &val, 4); - if (err < 0) - printf("WARNING: could not set crypto property: %s\n", - fdt_strerror(err)); - - val = cpu_to_fdt32(sec_rev_prop_list[sec_idx].exec_units_mask); - err = fdt_setprop(blob, crypto_node, "fsl,exec-units-mask", &val, 4); - if (err < 0) - printf("WARNING: could not set crypto property: %s\n", - fdt_strerror(err)); - - val = cpu_to_fdt32(sec_rev_prop_list[sec_idx].channel_fifo_len); - err = fdt_setprop(blob, crypto_node, "fsl,channel-fifo-len", &val, 4); - if (err < 0) - printf("WARNING: could not set crypto property: %s\n", - fdt_strerror(err)); - - val = 0; - while (sec_idx >= 0) { - p = compat_strlist + val; - val += sprintf(p, "fsl,sec%d.%d", - (sec_rev_prop_list[sec_idx].sec_rev & 0xff00) >> 8, - sec_rev_prop_list[sec_idx].sec_rev & 0x00ff) + 1; - sec_idx--; - } - err = fdt_setprop(blob, crypto_node, "compatible", &compat_strlist, val); - if (err < 0) - printf("WARNING: could not set crypto property: %s\n", - fdt_strerror(err)); -} -#elif CONFIG_SYS_FSL_SEC_COMPAT >= 4 /* SEC4 */ -static u8 caam_get_era(void) -{ - static const struct { - u16 ip_id; - u8 maj_rev; - u8 era; - } caam_eras[] = { - {0x0A10, 1, 1}, - {0x0A10, 2, 2}, - {0x0A12, 1, 3}, - {0x0A14, 1, 3}, - {0x0A14, 2, 4}, - {0x0A16, 1, 4}, - {0x0A10, 3, 4}, - {0x0A11, 1, 4}, - {0x0A18, 1, 4}, - {0x0A11, 2, 5}, - {0x0A12, 2, 5}, - {0x0A13, 1, 5}, - {0x0A1C, 1, 5} - }; - - ccsr_sec_t __iomem *sec = (void __iomem *)CONFIG_SYS_FSL_SEC_ADDR; - u32 secvid_ms = in_be32(&sec->secvid_ms); - u32 ccbvid = in_be32(&sec->ccbvid); - u16 ip_id = (secvid_ms & SEC_SECVID_MS_IPID_MASK) >> - SEC_SECVID_MS_IPID_SHIFT; - u8 maj_rev = (secvid_ms & SEC_SECVID_MS_MAJ_REV_MASK) >> - SEC_SECVID_MS_MAJ_REV_SHIFT; - u8 era = (ccbvid & SEC_CCBVID_ERA_MASK) >> SEC_CCBVID_ERA_SHIFT; - - int i; - - if (era) /* This is '0' prior to CAAM ERA-6 */ - return era; - - for (i = 0; i < ARRAY_SIZE(caam_eras); i++) - if (caam_eras[i].ip_id == ip_id && - caam_eras[i].maj_rev == maj_rev) - return caam_eras[i].era; - - return 0; -} - -static void fdt_fixup_crypto_era(void *blob, u32 era) -{ - int err; - int crypto_node; - - crypto_node = fdt_path_offset(blob, "crypto"); - if (crypto_node < 0) { - printf("WARNING: Missing crypto node\n"); - return; - } - - err = fdt_setprop(blob, crypto_node, "fsl,sec-era", &era, - sizeof(era)); - if (err < 0) { - printf("ERROR: could not set fsl,sec-era property: %s\n", - fdt_strerror(err)); - } -} - -void fdt_fixup_crypto_node(void *blob, int sec_rev) -{ - u8 era; - - if (!sec_rev) { - fdt_del_node_and_alias(blob, "crypto"); - return; - } - - /* Add SEC ERA information in compatible */ - era = caam_get_era(); - if (era) { - fdt_fixup_crypto_era(blob, era); - } else { - printf("WARNING: Unable to get ERA for CAAM rev: %d\n", - sec_rev); - } -} -#endif - -int fdt_fixup_phy_connection(void *blob, int offset, phy_interface_t phyc) -{ - return fdt_setprop_string(blob, offset, "phy-connection-type", - phy_string_for_interface(phyc)); -} - -#ifdef CONFIG_SYS_SRIO -static inline void ft_disable_srio_port(void *blob, int srio_off, int port) -{ - int off = fdt_node_offset_by_prop_value(blob, srio_off, - "cell-index", &port, 4); - if (off >= 0) { - off = fdt_setprop_string(blob, off, "status", "disabled"); - if (off > 0) - printf("WARNING unable to set status for fsl,srio " - "port %d: %s\n", port, fdt_strerror(off)); - } -} - -static inline void ft_disable_rman(void *blob) -{ - int off = fdt_node_offset_by_compatible(blob, -1, "fsl,rman"); - if (off >= 0) { - off = fdt_setprop_string(blob, off, "status", "disabled"); - if (off > 0) - printf("WARNING unable to set status for fsl,rman %s\n", - fdt_strerror(off)); - } -} - -static inline void ft_disable_rmu(void *blob) -{ - int off = fdt_node_offset_by_compatible(blob, -1, "fsl,srio-rmu"); - if (off >= 0) { - off = fdt_setprop_string(blob, off, "status", "disabled"); - if (off > 0) - printf("WARNING unable to set status for " - "fsl,srio-rmu %s\n", fdt_strerror(off)); - } -} - -void ft_srio_setup(void *blob) -{ - int srio1_used = 0, srio2_used = 0; - int srio_off; - - /* search for srio node, if doesn't exist just return - nothing todo */ - srio_off = fdt_node_offset_by_compatible(blob, -1, "fsl,srio"); - if (srio_off < 0) - return ; - -#ifdef CONFIG_SRIO1 - if (is_serdes_configured(SRIO1)) - srio1_used = 1; -#endif -#ifdef CONFIG_SRIO2 - if (is_serdes_configured(SRIO2)) - srio2_used = 1; -#endif - - /* mark port1 disabled */ - if (!srio1_used) - ft_disable_srio_port(blob, srio_off, 1); - - /* mark port2 disabled */ - if (!srio2_used) - ft_disable_srio_port(blob, srio_off, 2); - - /* if both ports not used, disable controller, rmu and rman */ - if (!srio1_used && !srio2_used) { - fdt_setprop_string(blob, srio_off, "status", "disabled"); - - ft_disable_rman(blob); - ft_disable_rmu(blob); - } -} -#endif diff --git a/qemu/roms/u-boot/arch/powerpc/cpu/mpc8xxx/fsl_lbc.c b/qemu/roms/u-boot/arch/powerpc/cpu/mpc8xxx/fsl_lbc.c deleted file mode 100644 index c1fe5790a..000000000 --- a/qemu/roms/u-boot/arch/powerpc/cpu/mpc8xxx/fsl_lbc.c +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright 2010-2011 Freescale Semiconductor, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * Version 2 as published by the Free Software Foundation. - */ - -#include <common.h> -#include <asm/fsl_lbc.h> - -#ifdef CONFIG_MPC85xx -/* Boards should provide their own version of this if they use lbc sdram */ -static void __lbc_sdram_init(void) -{ - /* Do nothing */ -} -void lbc_sdram_init(void) __attribute__((weak, alias("__lbc_sdram_init"))); -#endif - - -void print_lbc_regs(void) -{ - int i; - - printf("\nLocal Bus Controller Registers\n"); - for (i = 0; i < 8; i++) { - printf("BR%d\t0x%08X\tOR%d\t0x%08X\n", - i, get_lbc_br(i), i, get_lbc_or(i)); - } - printf("LBCR\t0x%08X\tLCRR\t0x%08X\n", - get_lbc_lbcr(), get_lbc_lcrr()); -} - -void init_early_memctl_regs(void) -{ - uint init_br1 = 1; - -#ifdef CONFIG_SYS_FSL_ERRATUM_ELBC_A001 - /* Set the local bus monitor timeout value to the maximum */ - clrsetbits_be32(&(LBC_BASE_ADDR)->lbcr, LBCR_BMT|LBCR_BMTPS, 0xf); -#endif - -#ifdef CONFIG_MPC85xx - /* if cs1 is already set via debugger, leave cs0/cs1 alone */ - if (get_lbc_br(1) & BR_V) - init_br1 = 0; -#endif - - /* - * Map banks 0 (and maybe 1) to the FLASH banks 0 (and 1) at - * preliminary addresses - these have to be modified later - * when FLASH size has been determined - */ -#if defined(CONFIG_SYS_OR0_REMAP) - set_lbc_or(0, CONFIG_SYS_OR0_REMAP); -#endif -#if defined(CONFIG_SYS_OR1_REMAP) - set_lbc_or(1, CONFIG_SYS_OR1_REMAP); -#endif - /* now restrict to preliminary range */ - if (init_br1) { -#if defined(CONFIG_SYS_BR0_PRELIM) && defined(CONFIG_SYS_OR0_PRELIM) - set_lbc_br(0, CONFIG_SYS_BR0_PRELIM); - set_lbc_or(0, CONFIG_SYS_OR0_PRELIM); -#endif - -#if defined(CONFIG_SYS_BR1_PRELIM) && defined(CONFIG_SYS_OR1_PRELIM) - set_lbc_or(1, CONFIG_SYS_OR1_PRELIM); - set_lbc_br(1, CONFIG_SYS_BR1_PRELIM); -#endif - } - -#if defined(CONFIG_SYS_BR2_PRELIM) && defined(CONFIG_SYS_OR2_PRELIM) - set_lbc_or(2, CONFIG_SYS_OR2_PRELIM); - set_lbc_br(2, CONFIG_SYS_BR2_PRELIM); -#endif - -#if defined(CONFIG_SYS_BR3_PRELIM) && defined(CONFIG_SYS_OR3_PRELIM) - set_lbc_or(3, CONFIG_SYS_OR3_PRELIM); - set_lbc_br(3, CONFIG_SYS_BR3_PRELIM); -#endif - -#if defined(CONFIG_SYS_BR4_PRELIM) && defined(CONFIG_SYS_OR4_PRELIM) - set_lbc_or(4, CONFIG_SYS_OR4_PRELIM); - set_lbc_br(4, CONFIG_SYS_BR4_PRELIM); -#endif - -#if defined(CONFIG_SYS_BR5_PRELIM) && defined(CONFIG_SYS_OR5_PRELIM) - set_lbc_or(5, CONFIG_SYS_OR5_PRELIM); - set_lbc_br(5, CONFIG_SYS_BR5_PRELIM); -#endif - -#if defined(CONFIG_SYS_BR6_PRELIM) && defined(CONFIG_SYS_OR6_PRELIM) - set_lbc_or(6, CONFIG_SYS_OR6_PRELIM); - set_lbc_br(6, CONFIG_SYS_BR6_PRELIM); -#endif - -#if defined(CONFIG_SYS_BR7_PRELIM) && defined(CONFIG_SYS_OR7_PRELIM) - set_lbc_or(7, CONFIG_SYS_OR7_PRELIM); - set_lbc_br(7, CONFIG_SYS_BR7_PRELIM); -#endif -} - -/* - * Configures a UPM. The function requires the respective MxMR to be set - * before calling this function. "size" is the number or entries, not a sizeof. - */ -void upmconfig(uint upm, uint *table, uint size) -{ - fsl_lbc_t *lbc = LBC_BASE_ADDR; - int i, mad, old_mad = 0; - u32 mask = (~MxMR_OP_MSK & ~MxMR_MAD_MSK); - u32 msel = BR_UPMx_TO_MSEL(upm); - u32 *mxmr = &lbc->mamr + upm; - volatile u8 *dummy = NULL; - - if (upm < UPMA || upm > UPMC) { - printf("Error: %s() Bad UPM index %d\n", __func__, upm); - hang(); - } - - /* - * Find the address for the dummy write - scan all of the BRs until we - * find one matching the UPM and extract the base address bits from it. - */ - for (i = 0; i < 8; i++) { - if ((get_lbc_br(i) & (BR_V | BR_MSEL)) == (BR_V | msel)) { - dummy = (volatile u8 *)(get_lbc_br(i) & BR_BA); - break; - } - } - - if (!dummy) { - printf("Error: %s() No matching BR\n", __func__); - hang(); - } - - /* Program UPM using steps outlined by the reference manual */ - for (i = 0; i < size; i++) { - out_be32(mxmr, (in_be32(mxmr) & mask) | MxMR_OP_WARR | i); - out_be32(&lbc->mdr, table[i]); - (void)in_be32(&lbc->mdr); - *dummy = 0; - do { - mad = in_be32(mxmr) & MxMR_MAD_MSK; - } while (mad <= old_mad && !(!mad && i == (size-1))); - old_mad = mad; - } - - /* Return to normal operation */ - out_be32(mxmr, (in_be32(mxmr) & mask) | MxMR_OP_NORM); -} diff --git a/qemu/roms/u-boot/arch/powerpc/cpu/mpc8xxx/law.c b/qemu/roms/u-boot/arch/powerpc/cpu/mpc8xxx/law.c deleted file mode 100644 index 33d53a8cf..000000000 --- a/qemu/roms/u-boot/arch/powerpc/cpu/mpc8xxx/law.c +++ /dev/null @@ -1,354 +0,0 @@ -/* - * Copyright 2008-2011 Freescale Semiconductor, Inc. - * - * (C) Copyright 2000 - * Wolfgang Denk, DENX Software Engineering, wd@denx.de. - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -#include <common.h> -#include <linux/compiler.h> -#include <asm/fsl_law.h> -#include <asm/io.h> - -DECLARE_GLOBAL_DATA_PTR; - -#define FSL_HW_NUM_LAWS CONFIG_SYS_FSL_NUM_LAWS - -#ifdef CONFIG_FSL_CORENET -#define LAW_BASE (CONFIG_SYS_FSL_CORENET_CCM_ADDR) -#define LAWAR_ADDR(x) (&((ccsr_local_t *)LAW_BASE)->law[x].lawar) -#define LAWBARH_ADDR(x) (&((ccsr_local_t *)LAW_BASE)->law[x].lawbarh) -#define LAWBARL_ADDR(x) (&((ccsr_local_t *)LAW_BASE)->law[x].lawbarl) -#define LAWBAR_SHIFT 0 -#else -#define LAW_BASE (CONFIG_SYS_IMMR + 0xc08) -#define LAWAR_ADDR(x) ((u32 *)LAW_BASE + 8 * x + 2) -#define LAWBAR_ADDR(x) ((u32 *)LAW_BASE + 8 * x) -#define LAWBAR_SHIFT 12 -#endif - - -static inline phys_addr_t get_law_base_addr(int idx) -{ -#ifdef CONFIG_FSL_CORENET - return (phys_addr_t) - ((u64)in_be32(LAWBARH_ADDR(idx)) << 32) | - in_be32(LAWBARL_ADDR(idx)); -#else - return (phys_addr_t)in_be32(LAWBAR_ADDR(idx)) << LAWBAR_SHIFT; -#endif -} - -static inline void set_law_base_addr(int idx, phys_addr_t addr) -{ -#ifdef CONFIG_FSL_CORENET - out_be32(LAWBARL_ADDR(idx), addr & 0xffffffff); - out_be32(LAWBARH_ADDR(idx), (u64)addr >> 32); -#else - out_be32(LAWBAR_ADDR(idx), addr >> LAWBAR_SHIFT); -#endif -} - -void set_law(u8 idx, phys_addr_t addr, enum law_size sz, enum law_trgt_if id) -{ - gd->arch.used_laws |= (1 << idx); - - out_be32(LAWAR_ADDR(idx), 0); - set_law_base_addr(idx, addr); - out_be32(LAWAR_ADDR(idx), LAW_EN | ((u32)id << 20) | (u32)sz); - - /* Read back so that we sync the writes */ - in_be32(LAWAR_ADDR(idx)); -} - -void disable_law(u8 idx) -{ - gd->arch.used_laws &= ~(1 << idx); - - out_be32(LAWAR_ADDR(idx), 0); - set_law_base_addr(idx, 0); - - /* Read back so that we sync the writes */ - in_be32(LAWAR_ADDR(idx)); - - return; -} - -#if !defined(CONFIG_NAND_SPL) && \ - (!defined(CONFIG_SPL_BUILD) || !defined(CONFIG_SPL_INIT_MINIMAL)) -static int get_law_entry(u8 i, struct law_entry *e) -{ - u32 lawar; - - lawar = in_be32(LAWAR_ADDR(i)); - - if (!(lawar & LAW_EN)) - return 0; - - e->addr = get_law_base_addr(i); - e->size = lawar & 0x3f; - e->trgt_id = (lawar >> 20) & 0xff; - - return 1; -} -#endif - -int set_next_law(phys_addr_t addr, enum law_size sz, enum law_trgt_if id) -{ - u32 idx = ffz(gd->arch.used_laws); - - if (idx >= FSL_HW_NUM_LAWS) - return -1; - - set_law(idx, addr, sz, id); - - return idx; -} - -#if !defined(CONFIG_NAND_SPL) && \ - (!defined(CONFIG_SPL_BUILD) || !defined(CONFIG_SPL_INIT_MINIMAL)) -int set_last_law(phys_addr_t addr, enum law_size sz, enum law_trgt_if id) -{ - u32 idx; - - /* we have no LAWs free */ - if (gd->arch.used_laws == -1) - return -1; - - /* grab the last free law */ - idx = __ilog2(~(gd->arch.used_laws)); - - if (idx >= FSL_HW_NUM_LAWS) - return -1; - - set_law(idx, addr, sz, id); - - return idx; -} - -struct law_entry find_law(phys_addr_t addr) -{ - struct law_entry entry; - int i; - - entry.index = -1; - entry.addr = 0; - entry.size = 0; - entry.trgt_id = 0; - - for (i = 0; i < FSL_HW_NUM_LAWS; i++) { - u64 upper; - - if (!get_law_entry(i, &entry)) - continue; - - upper = entry.addr + (2ull << entry.size); - if ((addr >= entry.addr) && (addr < upper)) { - entry.index = i; - break; - } - } - - return entry; -} - -void print_laws(void) -{ - int i; - u32 lawar; - - printf("\nLocal Access Window Configuration\n"); - for (i = 0; i < FSL_HW_NUM_LAWS; i++) { - lawar = in_be32(LAWAR_ADDR(i)); -#ifdef CONFIG_FSL_CORENET - printf("LAWBARH%02d: 0x%08x LAWBARL%02d: 0x%08x", - i, in_be32(LAWBARH_ADDR(i)), - i, in_be32(LAWBARL_ADDR(i))); -#else - printf("LAWBAR%02d: 0x%08x", i, in_be32(LAWBAR_ADDR(i))); -#endif - printf(" LAWAR%02d: 0x%08x\n", i, lawar); - printf("\t(EN: %d TGT: 0x%02x SIZE: ", - (lawar & LAW_EN) ? 1 : 0, (lawar >> 20) & 0xff); - print_size(lawar_size(lawar), ")\n"); - } - - return; -} - -/* use up to 2 LAWs for DDR, used the last available LAWs */ -int set_ddr_laws(u64 start, u64 sz, enum law_trgt_if id) -{ - u64 start_align, law_sz; - int law_sz_enc; - - if (start == 0) - start_align = 1ull << (LAW_SIZE_32G + 1); - else - start_align = 1ull << (ffs64(start) - 1); - law_sz = min(start_align, sz); - law_sz_enc = __ilog2_u64(law_sz) - 1; - - if (set_last_law(start, law_sz_enc, id) < 0) - return -1; - - /* recalculate size based on what was actually covered by the law */ - law_sz = 1ull << __ilog2_u64(law_sz); - - /* do we still have anything to map */ - sz = sz - law_sz; - if (sz) { - start += law_sz; - - start_align = 1ull << (ffs64(start) - 1); - law_sz = min(start_align, sz); - law_sz_enc = __ilog2_u64(law_sz) - 1; - - if (set_last_law(start, law_sz_enc, id) < 0) - return -1; - } else { - return 0; - } - - /* do we still have anything to map */ - sz = sz - law_sz; - if (sz) - return 1; - - return 0; -} -#endif /* not SPL */ - -void disable_non_ddr_laws(void) -{ - int i; - int id; - for (i = 0; i < FSL_HW_NUM_LAWS; i++) { - u32 lawar = in_be32(LAWAR_ADDR(i)); - - if (lawar & LAW_EN) { - id = (lawar & ~LAW_EN) >> 20; - switch (id) { - case LAW_TRGT_IF_DDR_1: - case LAW_TRGT_IF_DDR_2: - case LAW_TRGT_IF_DDR_3: - case LAW_TRGT_IF_DDR_4: - case LAW_TRGT_IF_DDR_INTRLV: - case LAW_TRGT_IF_DDR_INTLV_34: - case LAW_TRGT_IF_DDR_INTLV_123: - case LAW_TRGT_IF_DDR_INTLV_1234: - continue; - default: - disable_law(i); - } - } - } -} - -void init_laws(void) -{ - int i; - -#if FSL_HW_NUM_LAWS < 32 - gd->arch.used_laws = ~((1 << FSL_HW_NUM_LAWS) - 1); -#elif FSL_HW_NUM_LAWS == 32 - gd->arch.used_laws = 0; -#else -#error FSL_HW_NUM_LAWS can not be greater than 32 w/o code changes -#endif - -#if defined(CONFIG_SECURE_BOOT) && defined(CONFIG_E500) && \ - !defined(CONFIG_E500MC) - /* ISBC (Boot ROM) creates a LAW 0 entry for non PBL platforms, - * which is not disabled before transferring the control to uboot. - * Disable the LAW 0 entry here. - */ - disable_law(0); -#endif - -#if !defined(CONFIG_SECURE_BOOT) - /* - * if any non DDR LAWs has been created earlier, remove them before - * LAW table is parsed. - */ - disable_non_ddr_laws(); -#endif - - /* - * Any LAWs that were set up before we booted assume they are meant to - * be around and mark them used. - */ - for (i = 0; i < FSL_HW_NUM_LAWS; i++) { - u32 lawar = in_be32(LAWAR_ADDR(i)); - - if (lawar & LAW_EN) - gd->arch.used_laws |= (1 << i); - } - - for (i = 0; i < num_law_entries; i++) { - if (law_table[i].index == -1) - set_next_law(law_table[i].addr, law_table[i].size, - law_table[i].trgt_id); - else - set_law(law_table[i].index, law_table[i].addr, - law_table[i].size, law_table[i].trgt_id); - } - -#ifdef CONFIG_SRIO_PCIE_BOOT_SLAVE - /* check RCW to get which port is used for boot */ - ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR; - u32 bootloc = in_be32(&gur->rcwsr[6]); - /* - * in SRIO or PCIE boot we need to set specail LAWs for - * SRIO or PCIE interfaces. - */ - switch ((bootloc & FSL_CORENET_RCWSR6_BOOT_LOC) >> 23) { - case 0x0: /* boot from PCIE1 */ - set_next_law(CONFIG_SYS_SRIO_PCIE_BOOT_SLAVE_ADDR_PHYS, - LAW_SIZE_1M, - LAW_TRGT_IF_PCIE_1); - set_next_law(CONFIG_SYS_SRIO_PCIE_BOOT_UCODE_ENV_ADDR_PHYS, - LAW_SIZE_1M, - LAW_TRGT_IF_PCIE_1); - break; - case 0x1: /* boot from PCIE2 */ - set_next_law(CONFIG_SYS_SRIO_PCIE_BOOT_SLAVE_ADDR_PHYS, - LAW_SIZE_1M, - LAW_TRGT_IF_PCIE_2); - set_next_law(CONFIG_SYS_SRIO_PCIE_BOOT_UCODE_ENV_ADDR_PHYS, - LAW_SIZE_1M, - LAW_TRGT_IF_PCIE_2); - break; - case 0x2: /* boot from PCIE3 */ - set_next_law(CONFIG_SYS_SRIO_PCIE_BOOT_SLAVE_ADDR_PHYS, - LAW_SIZE_1M, - LAW_TRGT_IF_PCIE_3); - set_next_law(CONFIG_SYS_SRIO_PCIE_BOOT_UCODE_ENV_ADDR_PHYS, - LAW_SIZE_1M, - LAW_TRGT_IF_PCIE_3); - break; - case 0x8: /* boot from SRIO1 */ - set_next_law(CONFIG_SYS_SRIO_PCIE_BOOT_SLAVE_ADDR_PHYS, - LAW_SIZE_1M, - LAW_TRGT_IF_RIO_1); - set_next_law(CONFIG_SYS_SRIO_PCIE_BOOT_UCODE_ENV_ADDR_PHYS, - LAW_SIZE_1M, - LAW_TRGT_IF_RIO_1); - break; - case 0x9: /* boot from SRIO2 */ - set_next_law(CONFIG_SYS_SRIO_PCIE_BOOT_SLAVE_ADDR_PHYS, - LAW_SIZE_1M, - LAW_TRGT_IF_RIO_2); - set_next_law(CONFIG_SYS_SRIO_PCIE_BOOT_UCODE_ENV_ADDR_PHYS, - LAW_SIZE_1M, - LAW_TRGT_IF_RIO_2); - break; - default: - break; - } -#endif - - return ; -} diff --git a/qemu/roms/u-boot/arch/powerpc/cpu/mpc8xxx/srio.c b/qemu/roms/u-boot/arch/powerpc/cpu/mpc8xxx/srio.c deleted file mode 100644 index 0ab9aac4a..000000000 --- a/qemu/roms/u-boot/arch/powerpc/cpu/mpc8xxx/srio.c +++ /dev/null @@ -1,446 +0,0 @@ -/* - * Copyright 2011 Freescale Semiconductor, Inc. - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -#include <common.h> -#include <config.h> -#include <asm/fsl_law.h> -#include <asm/fsl_serdes.h> -#include <asm/fsl_srio.h> -#include <asm/errno.h> - -#ifdef CONFIG_SRIO_PCIE_BOOT_MASTER -#define SRIO_PORT_ACCEPT_ALL 0x10000001 -#define SRIO_IB_ATMU_AR 0x80f55000 -#define SRIO_OB_ATMU_AR_MAINT 0x80077000 -#define SRIO_OB_ATMU_AR_RW 0x80045000 -#define SRIO_LCSBA1CSR_OFFSET 0x5c -#define SRIO_MAINT_WIN_SIZE 0x1000000 /* 16M */ -#define SRIO_RW_WIN_SIZE 0x100000 /* 1M */ -#define SRIO_LCSBA1CSR 0x60000000 -#endif - -#if defined(CONFIG_FSL_CORENET) -#ifdef CONFIG_SYS_FSL_QORIQ_CHASSIS2 - #define _DEVDISR_SRIO1 FSL_CORENET_DEVDISR3_SRIO1 - #define _DEVDISR_SRIO2 FSL_CORENET_DEVDISR3_SRIO2 -#else - #define _DEVDISR_SRIO1 FSL_CORENET_DEVDISR_SRIO1 - #define _DEVDISR_SRIO2 FSL_CORENET_DEVDISR_SRIO2 -#endif - #define _DEVDISR_RMU FSL_CORENET_DEVDISR_RMU - #define CONFIG_SYS_MPC8xxx_GUTS_ADDR CONFIG_SYS_MPC85xx_GUTS_ADDR -#elif defined(CONFIG_MPC85xx) - #define _DEVDISR_SRIO1 MPC85xx_DEVDISR_SRIO - #define _DEVDISR_SRIO2 MPC85xx_DEVDISR_SRIO - #define _DEVDISR_RMU MPC85xx_DEVDISR_RMSG - #define CONFIG_SYS_MPC8xxx_GUTS_ADDR CONFIG_SYS_MPC85xx_GUTS_ADDR -#elif defined(CONFIG_MPC86xx) - #define _DEVDISR_SRIO1 MPC86xx_DEVDISR_SRIO - #define _DEVDISR_SRIO2 MPC86xx_DEVDISR_SRIO - #define _DEVDISR_RMU MPC86xx_DEVDISR_RMSG - #define CONFIG_SYS_MPC8xxx_GUTS_ADDR \ - (&((immap_t *)CONFIG_SYS_IMMR)->im_gur) -#else -#error "No defines for DEVDISR_SRIO" -#endif - -#ifdef CONFIG_SYS_FSL_ERRATUM_SRIO_A004034 -/* - * Erratum A-004034 - * Affects: SRIO - * Description: During port initialization, the SRIO port performs - * lane synchronization (detecting valid symbols on a lane) and - * lane alignment (coordinating multiple lanes to receive valid data - * across lanes). Internal errors in lane synchronization and lane - * alignment may cause failure to achieve link initialization at - * the configured port width. - * An SRIO port configured as a 4x port may see one of these scenarios: - * 1. One or more lanes fails to achieve lane synchronization. Depending - * on which lanes fail, this may result in downtraining from 4x to 1x - * on lane 0, 4x to 1x on lane R (redundant lane). - * 2. The link may fail to achieve lane alignment as a 4x, even though - * all 4 lanes achieve lane synchronization, and downtrain to a 1x. - * An SRIO port configured as a 1x port may fail to complete port - * initialization (PnESCSR[PU] never deasserts) because of scenario 1. - * Impact: SRIO port may downtrain to 1x, or may fail to complete - * link initialization. Once a port completes link initialization - * successfully, it will operate normally. - */ -static int srio_erratum_a004034(u8 port) -{ - serdes_corenet_t *srds_regs; - u32 conf_lane; - u32 init_lane; - int idx, first, last; - u32 i; - unsigned long long end_tick; - struct ccsr_rio *srio_regs = (void *)CONFIG_SYS_FSL_SRIO_ADDR; - - srds_regs = (void *)(CONFIG_SYS_FSL_CORENET_SERDES_ADDR); - conf_lane = (in_be32((void *)&srds_regs->srdspccr0) - >> (12 - port * 4)) & 0x3; - init_lane = (in_be32((void *)&srio_regs->lp_serial - .port[port].pccsr) >> 27) & 0x7; - - /* - * Start a counter set to ~2 ms after the SERDES reset is - * complete (SERDES SRDSBnRSTCTL[RST_DONE]=1 for n - * corresponding to the SERDES bank/PLL for the SRIO port). - */ - if (in_be32((void *)&srds_regs->bank[0].rstctl) - & SRDS_RSTCTL_RSTDONE) { - /* - * Poll the port uninitialized status (SRIO PnESCSR[PO]) until - * PO=1 or the counter expires. If the counter expires, the - * port has failed initialization: go to recover steps. If PO=1 - * and the desired port width is 1x, go to normal steps. If - * PO = 1 and the desired port width is 4x, go to recover steps. - */ - end_tick = usec2ticks(2000) + get_ticks(); - do { - if (in_be32((void *)&srio_regs->lp_serial - .port[port].pescsr) & 0x2) { - if (conf_lane == 0x1) - goto host_ok; - else { - if (init_lane == 0x2) - goto host_ok; - else - break; - } - } - } while (end_tick > get_ticks()); - - /* recover at most 3 times */ - for (i = 0; i < 3; i++) { - /* Set SRIO PnCCSR[PD]=1 */ - setbits_be32((void *)&srio_regs->lp_serial - .port[port].pccsr, - 0x800000); - /* - * Set SRIO PnPCR[OBDEN] on the host to - * enable the discarding of any pending packets. - */ - setbits_be32((void *)&srio_regs->impl.port[port].pcr, - 0x04); - /* Wait 50 us */ - udelay(50); - /* Run sync command */ - isync(); - - if (port) - first = serdes_get_first_lane(SRIO2); - else - first = serdes_get_first_lane(SRIO1); - if (unlikely(first < 0)) - return -ENODEV; - if (conf_lane == 0x1) - last = first; - else - last = first + 3; - /* - * Set SERDES BnGCRm0[RRST]=0 for each SRIO - * bank n and lane m. - */ - for (idx = first; idx <= last; idx++) - clrbits_be32(&srds_regs->lane[idx].gcr0, - SRDS_GCR0_RRST); - /* - * Read SERDES BnGCRm0 for each SRIO - * bank n and lane m - */ - for (idx = first; idx <= last; idx++) - in_be32(&srds_regs->lane[idx].gcr0); - /* Run sync command */ - isync(); - /* Wait >= 100 ns */ - udelay(1); - /* - * Set SERDES BnGCRm0[RRST]=1 for each SRIO - * bank n and lane m. - */ - for (idx = first; idx <= last; idx++) - setbits_be32(&srds_regs->lane[idx].gcr0, - SRDS_GCR0_RRST); - /* - * Read SERDES BnGCRm0 for each SRIO - * bank n and lane m - */ - for (idx = first; idx <= last; idx++) - in_be32(&srds_regs->lane[idx].gcr0); - /* Run sync command */ - isync(); - /* Wait >= 300 ns */ - udelay(1); - - /* Write 1 to clear all bits in SRIO PnSLCSR */ - out_be32((void *)&srio_regs->impl.port[port].slcsr, - 0xffffffff); - /* Clear SRIO PnPCR[OBDEN] on the host */ - clrbits_be32((void *)&srio_regs->impl.port[port].pcr, - 0x04); - /* Set SRIO PnCCSR[PD]=0 */ - clrbits_be32((void *)&srio_regs->lp_serial - .port[port].pccsr, - 0x800000); - /* Wait >= 24 ms */ - udelay(24000); - /* Poll the state of the port again */ - init_lane = - (in_be32((void *)&srio_regs->lp_serial - .port[port].pccsr) >> 27) & 0x7; - if (in_be32((void *)&srio_regs->lp_serial - .port[port].pescsr) & 0x2) { - if (conf_lane == 0x1) - goto host_ok; - else { - if (init_lane == 0x2) - goto host_ok; - } - } - if (i == 2) - return -ENODEV; - } - } else - return -ENODEV; - -host_ok: - /* Poll PnESCSR[OES] on the host until it is clear */ - end_tick = usec2ticks(1000000) + get_ticks(); - do { - if (!(in_be32((void *)&srio_regs->lp_serial.port[port].pescsr) - & 0x10000)) { - out_be32(((void *)&srio_regs->lp_serial - .port[port].pescsr), 0xffffffff); - out_be32(((void *)&srio_regs->phys_err - .port[port].edcsr), 0); - out_be32(((void *)&srio_regs->logical_err.ltledcsr), 0); - return 0; - } - } while (end_tick > get_ticks()); - - return -ENODEV; -} -#endif - -void srio_init(void) -{ - ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC8xxx_GUTS_ADDR; - int srio1_used = 0, srio2_used = 0; - u32 *devdisr; - -#ifdef CONFIG_SYS_FSL_QORIQ_CHASSIS2 - devdisr = &gur->devdisr3; -#else - devdisr = &gur->devdisr; -#endif - if (is_serdes_configured(SRIO1)) { - set_next_law(CONFIG_SYS_SRIO1_MEM_PHYS, - law_size_bits(CONFIG_SYS_SRIO1_MEM_SIZE), - LAW_TRGT_IF_RIO_1); - srio1_used = 1; -#ifdef CONFIG_SYS_FSL_ERRATUM_SRIO_A004034 - if (srio_erratum_a004034(0) < 0) - printf("SRIO1: enabled but port error\n"); - else -#endif - printf("SRIO1: enabled\n"); - } else { - printf("SRIO1: disabled\n"); - } - -#ifdef CONFIG_SRIO2 - if (is_serdes_configured(SRIO2)) { - set_next_law(CONFIG_SYS_SRIO2_MEM_PHYS, - law_size_bits(CONFIG_SYS_SRIO2_MEM_SIZE), - LAW_TRGT_IF_RIO_2); - srio2_used = 1; -#ifdef CONFIG_SYS_FSL_ERRATUM_SRIO_A004034 - if (srio_erratum_a004034(1) < 0) - printf("SRIO2: enabled but port error\n"); - else -#endif - printf("SRIO2: enabled\n"); - - } else { - printf("SRIO2: disabled\n"); - } -#endif - -#ifdef CONFIG_FSL_CORENET - /* On FSL_CORENET devices we can disable individual ports */ - if (!srio1_used) - setbits_be32(devdisr, _DEVDISR_SRIO1); - if (!srio2_used) - setbits_be32(devdisr, _DEVDISR_SRIO2); -#endif - - /* neither port is used - disable everything */ - if (!srio1_used && !srio2_used) { - setbits_be32(devdisr, _DEVDISR_SRIO1); - setbits_be32(devdisr, _DEVDISR_SRIO2); - setbits_be32(devdisr, _DEVDISR_RMU); - } -} - -#ifdef CONFIG_SRIO_PCIE_BOOT_MASTER -void srio_boot_master(int port) -{ - struct ccsr_rio *srio = (void *)CONFIG_SYS_FSL_SRIO_ADDR; - - /* set port accept-all */ - out_be32((void *)&srio->impl.port[port - 1].ptaacr, - SRIO_PORT_ACCEPT_ALL); - - debug("SRIOBOOT - MASTER: Master port [ %d ] for srio boot.\n", port); - /* configure inbound window for slave's u-boot image */ - debug("SRIOBOOT - MASTER: Inbound window for slave's image; " - "Local = 0x%llx, Srio = 0x%llx, Size = 0x%x\n", - (u64)CONFIG_SRIO_PCIE_BOOT_IMAGE_MEM_PHYS, - (u64)CONFIG_SRIO_PCIE_BOOT_IMAGE_MEM_BUS1, - CONFIG_SRIO_PCIE_BOOT_IMAGE_SIZE); - out_be32((void *)&srio->atmu.port[port - 1].inbw[0].riwtar, - CONFIG_SRIO_PCIE_BOOT_IMAGE_MEM_PHYS >> 12); - out_be32((void *)&srio->atmu.port[port - 1].inbw[0].riwbar, - CONFIG_SRIO_PCIE_BOOT_IMAGE_MEM_BUS1 >> 12); - out_be32((void *)&srio->atmu.port[port - 1].inbw[0].riwar, - SRIO_IB_ATMU_AR - | atmu_size_mask(CONFIG_SRIO_PCIE_BOOT_IMAGE_SIZE)); - - /* configure inbound window for slave's u-boot image */ - debug("SRIOBOOT - MASTER: Inbound window for slave's image; " - "Local = 0x%llx, Srio = 0x%llx, Size = 0x%x\n", - (u64)CONFIG_SRIO_PCIE_BOOT_IMAGE_MEM_PHYS, - (u64)CONFIG_SRIO_PCIE_BOOT_IMAGE_MEM_BUS2, - CONFIG_SRIO_PCIE_BOOT_IMAGE_SIZE); - out_be32((void *)&srio->atmu.port[port - 1].inbw[1].riwtar, - CONFIG_SRIO_PCIE_BOOT_IMAGE_MEM_PHYS >> 12); - out_be32((void *)&srio->atmu.port[port - 1].inbw[1].riwbar, - CONFIG_SRIO_PCIE_BOOT_IMAGE_MEM_BUS2 >> 12); - out_be32((void *)&srio->atmu.port[port - 1].inbw[1].riwar, - SRIO_IB_ATMU_AR - | atmu_size_mask(CONFIG_SRIO_PCIE_BOOT_IMAGE_SIZE)); - - /* configure inbound window for slave's ucode and ENV */ - debug("SRIOBOOT - MASTER: Inbound window for slave's ucode and ENV; " - "Local = 0x%llx, Srio = 0x%llx, Size = 0x%x\n", - (u64)CONFIG_SRIO_PCIE_BOOT_UCODE_ENV_MEM_PHYS, - (u64)CONFIG_SRIO_PCIE_BOOT_UCODE_ENV_MEM_BUS, - CONFIG_SRIO_PCIE_BOOT_UCODE_ENV_SIZE); - out_be32((void *)&srio->atmu.port[port - 1].inbw[2].riwtar, - CONFIG_SRIO_PCIE_BOOT_UCODE_ENV_MEM_PHYS >> 12); - out_be32((void *)&srio->atmu.port[port - 1].inbw[2].riwbar, - CONFIG_SRIO_PCIE_BOOT_UCODE_ENV_MEM_BUS >> 12); - out_be32((void *)&srio->atmu.port[port - 1].inbw[2].riwar, - SRIO_IB_ATMU_AR - | atmu_size_mask(CONFIG_SRIO_PCIE_BOOT_UCODE_ENV_SIZE)); -} - -void srio_boot_master_release_slave(int port) -{ - struct ccsr_rio *srio = (void *)CONFIG_SYS_FSL_SRIO_ADDR; - u32 escsr; - debug("SRIOBOOT - MASTER: " - "Check the port status and release slave core ...\n"); - - escsr = in_be32((void *)&srio->lp_serial.port[port - 1].pescsr); - if (escsr & 0x2) { - if (escsr & 0x10100) { - debug("SRIOBOOT - MASTER: Port [ %d ] is error.\n", - port); - } else { - debug("SRIOBOOT - MASTER: " - "Port [ %d ] is ready, now release slave's core ...\n", - port); - /* - * configure outbound window - * with maintenance attribute to set slave's LCSBA1CSR - */ - out_be32((void *)&srio->atmu.port[port - 1] - .outbw[1].rowtar, 0); - out_be32((void *)&srio->atmu.port[port - 1] - .outbw[1].rowtear, 0); - if (port - 1) - out_be32((void *)&srio->atmu.port[port - 1] - .outbw[1].rowbar, - CONFIG_SYS_SRIO2_MEM_PHYS >> 12); - else - out_be32((void *)&srio->atmu.port[port - 1] - .outbw[1].rowbar, - CONFIG_SYS_SRIO1_MEM_PHYS >> 12); - out_be32((void *)&srio->atmu.port[port - 1] - .outbw[1].rowar, - SRIO_OB_ATMU_AR_MAINT - | atmu_size_mask(SRIO_MAINT_WIN_SIZE)); - - /* - * configure outbound window - * with R/W attribute to set slave's BRR - */ - out_be32((void *)&srio->atmu.port[port - 1] - .outbw[2].rowtar, - SRIO_LCSBA1CSR >> 9); - out_be32((void *)&srio->atmu.port[port - 1] - .outbw[2].rowtear, 0); - if (port - 1) - out_be32((void *)&srio->atmu.port[port - 1] - .outbw[2].rowbar, - (CONFIG_SYS_SRIO2_MEM_PHYS - + SRIO_MAINT_WIN_SIZE) >> 12); - else - out_be32((void *)&srio->atmu.port[port - 1] - .outbw[2].rowbar, - (CONFIG_SYS_SRIO1_MEM_PHYS - + SRIO_MAINT_WIN_SIZE) >> 12); - out_be32((void *)&srio->atmu.port[port - 1] - .outbw[2].rowar, - SRIO_OB_ATMU_AR_RW - | atmu_size_mask(SRIO_RW_WIN_SIZE)); - - /* - * Set the LCSBA1CSR register in slave - * by the maint-outbound window - */ - if (port - 1) { - out_be32((void *)CONFIG_SYS_SRIO2_MEM_VIRT - + SRIO_LCSBA1CSR_OFFSET, - SRIO_LCSBA1CSR); - while (in_be32((void *)CONFIG_SYS_SRIO2_MEM_VIRT - + SRIO_LCSBA1CSR_OFFSET) - != SRIO_LCSBA1CSR) - ; - /* - * And then set the BRR register - * to release slave core - */ - out_be32((void *)CONFIG_SYS_SRIO2_MEM_VIRT - + SRIO_MAINT_WIN_SIZE - + CONFIG_SRIO_PCIE_BOOT_BRR_OFFSET, - CONFIG_SRIO_PCIE_BOOT_RELEASE_MASK); - } else { - out_be32((void *)CONFIG_SYS_SRIO1_MEM_VIRT - + SRIO_LCSBA1CSR_OFFSET, - SRIO_LCSBA1CSR); - while (in_be32((void *)CONFIG_SYS_SRIO1_MEM_VIRT - + SRIO_LCSBA1CSR_OFFSET) - != SRIO_LCSBA1CSR) - ; - /* - * And then set the BRR register - * to release slave core - */ - out_be32((void *)CONFIG_SYS_SRIO1_MEM_VIRT - + SRIO_MAINT_WIN_SIZE - + CONFIG_SRIO_PCIE_BOOT_BRR_OFFSET, - CONFIG_SRIO_PCIE_BOOT_RELEASE_MASK); - } - debug("SRIOBOOT - MASTER: " - "Release slave successfully! Now the slave should start up!\n"); - } - } else - debug("SRIOBOOT - MASTER: Port [ %d ] is not ready.\n", port); -} -#endif |