]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
Merge git://www.denx.de/git/u-boot-marvell
authorTom Rini <trini@konsulko.com>
Tue, 4 Apr 2017 13:17:56 +0000 (09:17 -0400)
committerTom Rini <trini@konsulko.com>
Tue, 4 Apr 2017 13:17:56 +0000 (09:17 -0400)
This includes Marvell mvpp2 patches with the ethernet support for the
ARMv8 Armada 7k/8k platforms. The ethernet patches are all acked by Joe
and he is okay with me pushing them via the Marvell tree.

64 files changed:
arch/arm/cpu/armv8/fsl-layerscape/Kconfig
arch/arm/cpu/armv8/fsl-layerscape/cpu.c
arch/arm/cpu/armv8/fsl-layerscape/fdt.c
arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_serdes.c
arch/arm/cpu/armv8/fsl-layerscape/ppa.c
arch/arm/cpu/armv8/fsl-layerscape/soc.c
arch/arm/dts/fsl-ls1012a.dtsi
arch/arm/include/asm/arch-fsl-layerscape/fsl_serdes.h
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h
arch/arm/include/asm/arch-fsl-layerscape/ppa.h
arch/arm/include/asm/arch-fsl-layerscape/stream_id_lsch2.h [new file with mode: 0644]
arch/arm/include/asm/arch-fsl-layerscape/stream_id_lsch3.h [moved from arch/arm/include/asm/arch-fsl-layerscape/ls2080a_stream_id.h with 80% similarity]
arch/arm/include/asm/arch-lpc32xx/i2c.h [new file with mode: 0644]
arch/arm/include/asm/armv8/sec_firmware.h
arch/arm/include/asm/fsl_secure_boot.h
board/freescale/common/fsl_validate.c
board/freescale/ls1043ardb/ls1043ardb.c
board/freescale/ls2080aqds/ls2080aqds.c
board/freescale/ls2080ardb/ls2080ardb.c
board/ge/bx50v3/bx50v3.c
cmd/i2c.c
common/board_r.c
common/fdt_support.c
configs/A10-OLinuXino-Lime_defconfig
configs/A20-OLinuXino-Lime2_defconfig
configs/A20-OLinuXino-Lime_defconfig
configs/A20-OLinuXino_MICRO_defconfig
configs/ls1043ardb_nand_defconfig
configs/ls1043ardb_sdcard_defconfig
configs/ls1046ardb_emmc_defconfig
configs/ls1046ardb_sdcard_defconfig
configs/ls2080aqds_defconfig
configs/ls2080ardb_defconfig
doc/device-tree-bindings/net/fixed-link.txt [new file with mode: 0644]
drivers/i2c/Kconfig
drivers/i2c/lpc32xx_i2c.c
drivers/i2c/omap24xx_i2c.c
drivers/i2c/omap24xx_i2c.h
drivers/mtd/nand/nand.c
drivers/net/bcm-sf2-eth-gmac.c
drivers/net/bcm-sf2-eth.h
drivers/net/ldpaa_eth/ls2080a.c
drivers/net/phy/Kconfig
drivers/net/phy/Makefile
drivers/net/phy/fixed.c [new file with mode: 0644]
drivers/net/phy/phy.c
drivers/net/sunxi_emac.c
drivers/pci/pcie_layerscape.c
drivers/pci/pcie_layerscape.h
drivers/pci/pcie_layerscape_fixup.c
drivers/spi/fsl_qspi.c
include/configs/ls1012a_common.h
include/configs/ls1043a_common.h
include/configs/ls1046a_common.h
include/configs/ls1046aqds.h
include/configs/ls2080a_common.h
include/configs/ls2080aqds.h
include/configs/ls2080ardb.h
include/fsl-mc/ldpaa_wriop.h
include/fsl_validate.h
include/nand.h
include/phy.h
net/link_local.c
tools/pblimage.c

index a99b1c6a99b2ce036c9c4b5c430d06c5392d5907..b24462bede9dec9bfb5c89b7d46fec609331f41a 100644 (file)
@@ -73,6 +73,7 @@ config ARCH_LS2080A
        select SYS_FSL_ERRATUM_A009803
        select SYS_FSL_ERRATUM_A009942
        select SYS_FSL_ERRATUM_A010165
+       select SYS_FSL_ERRATUM_A009203
        select ARCH_EARLY_INIT_R
        select BOARD_EARLY_INIT_F
 
@@ -134,6 +135,8 @@ config FSL_LS_PPA
 choice
        prompt "FSL Layerscape PPA firmware loading-media select"
        depends on FSL_LS_PPA
+       default SYS_LS_PPA_FW_IN_MMC if SD_BOOT
+       default SYS_LS_PPA_FW_IN_NAND if NAND_BOOT
        default SYS_LS_PPA_FW_IN_XIP
 
 config SYS_LS_PPA_FW_IN_XIP
@@ -142,13 +145,27 @@ config SYS_LS_PPA_FW_IN_XIP
          Say Y here if the PPA firmware locate at XIP flash, such
          as NOR or QSPI flash.
 
+config SYS_LS_PPA_FW_IN_MMC
+       bool "eMMC or SD Card"
+       help
+         Say Y here if the PPA firmware locate at eMMC/SD card.
+
+config SYS_LS_PPA_FW_IN_NAND
+       bool "NAND"
+       help
+         Say Y here if the PPA firmware locate at NAND flash.
+
 endchoice
 
 config SYS_LS_PPA_FW_ADDR
        hex "Address of PPA firmware loading from"
        depends on FSL_LS_PPA
        default 0x40500000 if SYS_LS_PPA_FW_IN_XIP && QSPI_BOOT
+       default 0x580a00000 if SYS_LS_PPA_FW_IN_XIP && ARCH_LS2080A
        default 0x60500000 if SYS_LS_PPA_FW_IN_XIP
+       default 0x500000 if SYS_LS_PPA_FW_IN_MMC
+       default 0x500000 if SYS_LS_PPA_FW_IN_NAND
+
        help
          If the PPA firmware locate at XIP flash, such as NOR or
          QSPI flash, this address is a directly memory-mapped.
@@ -307,6 +324,9 @@ config SYS_FSL_ERRATUM_A008585
 config SYS_FSL_ERRATUM_A008850
        bool
 
+config SYS_FSL_ERRATUM_A009203
+       bool
+
 config SYS_FSL_ERRATUM_A009635
        bool
 
index 7e66ee08b56d70573505f1f9e6e72437cc66017b..cebbb0fec5ee054c31fdabf33759819de86cafac 100644 (file)
@@ -89,6 +89,49 @@ static inline void early_mmu_setup(void)
        set_sctlr(get_sctlr() | CR_M);
 }
 
+static void fix_pcie_mmu_map(void)
+{
+#ifdef CONFIG_LS2080A
+       unsigned int i;
+       u32 svr, ver;
+       struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
+
+       svr = gur_in32(&gur->svr);
+       ver = SVR_SOC_VER(svr);
+
+       /* Fix PCIE base and size for LS2088A */
+       if ((ver == SVR_LS2088A) || (ver == SVR_LS2084A) ||
+           (ver == SVR_LS2048A) || (ver == SVR_LS2044A)) {
+               for (i = 0; i < ARRAY_SIZE(final_map); i++) {
+                       switch (final_map[i].phys) {
+                       case CONFIG_SYS_PCIE1_PHYS_ADDR:
+                               final_map[i].phys = 0x2000000000ULL;
+                               final_map[i].virt = 0x2000000000ULL;
+                               final_map[i].size = 0x800000000ULL;
+                               break;
+                       case CONFIG_SYS_PCIE2_PHYS_ADDR:
+                               final_map[i].phys = 0x2800000000ULL;
+                               final_map[i].virt = 0x2800000000ULL;
+                               final_map[i].size = 0x800000000ULL;
+                               break;
+                       case CONFIG_SYS_PCIE3_PHYS_ADDR:
+                               final_map[i].phys = 0x3000000000ULL;
+                               final_map[i].virt = 0x3000000000ULL;
+                               final_map[i].size = 0x800000000ULL;
+                               break;
+                       case CONFIG_SYS_PCIE4_PHYS_ADDR:
+                               final_map[i].phys = 0x3800000000ULL;
+                               final_map[i].virt = 0x3800000000ULL;
+                               final_map[i].size = 0x800000000ULL;
+                               break;
+                       default:
+                               break;
+                       }
+               }
+       }
+#endif
+}
+
 /*
  * The final tables look similar to early tables, but different in detail.
  * These tables are in DRAM. Sub tables are added to enable cache for
@@ -103,6 +146,9 @@ static inline void final_mmu_setup(void)
        unsigned int el = current_el();
        int index;
 
+       /* fix the final_map before filling in the block entries */
+       fix_pcie_mmu_map();
+
        mem_map = final_map;
 
        /* Update mapping for DDR to actual size */
@@ -436,7 +482,14 @@ int arch_early_init_r(void)
 #endif
 
 #ifdef CONFIG_SYS_FSL_ERRATUM_A009635
-       erratum_a009635();
+       u32 svr_dev_id;
+       /*
+        * erratum A009635 is valid only for LS2080A SoC and
+        * its personalitiesi
+        */
+       svr_dev_id = get_svr() >> 16;
+       if (svr_dev_id == SVR_DEV_LS2080A)
+               erratum_a009635();
 #endif
 #if defined(CONFIG_SYS_FSL_ERRATUM_A009942) && defined(CONFIG_SYS_FSL_DDR)
        erratum_a009942_check_cpo();
index 26d4a303a536fa82cc15b002030eeb156abe4104..762a95b945c131adc5375fa601def93f109fa49f 100644 (file)
@@ -387,8 +387,9 @@ void ft_cpu_setup(void *blob, bd_t *bd)
 #ifdef CONFIG_SYS_DPAA_FMAN
        fdt_fixup_fman_firmware(blob);
 #endif
+#ifndef CONFIG_LS1012A
        fsl_fdt_disable_usb(blob);
-
+#endif
 #ifdef CONFIG_HAS_FEATURE_GIC64K_ALIGN
        fdt_fixup_gic(blob);
 #endif
index 7faa86c3fdf41587052d19a2a3d957004cc3df50..955e0b747854383a1de097f886d7aafae30fbf48 100644 (file)
@@ -23,6 +23,11 @@ int xfi_dpmac[XFI8 + 1];
 int sgmii_dpmac[SGMII16 + 1];
 #endif
 
+__weak void wriop_init_dpmac_qsgmii(int sd, int lane_prtcl)
+{
+       return;
+}
+
 int is_serdes_configured(enum srds_prtcl device)
 {
        int ret = 0;
@@ -46,20 +51,22 @@ int is_serdes_configured(enum srds_prtcl device)
 int serdes_get_first_lane(u32 sd, enum srds_prtcl device)
 {
        struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
-       u32 cfg = gur_in32(&gur->rcwsr[28]);
+       u32 cfg = 0;
        int i;
 
        switch (sd) {
 #ifdef CONFIG_SYS_FSL_SRDS_1
        case FSL_SRDS_1:
-               cfg &= FSL_CHASSIS3_RCWSR28_SRDS1_PRTCL_MASK;
-               cfg >>= FSL_CHASSIS3_RCWSR28_SRDS1_PRTCL_SHIFT;
+               cfg = gur_in32(&gur->rcwsr[FSL_CHASSIS3_SRDS1_REGSR - 1]);
+               cfg &= FSL_CHASSIS3_SRDS1_PRTCL_MASK;
+               cfg >>= FSL_CHASSIS3_SRDS1_PRTCL_SHIFT;
                break;
 #endif
 #ifdef CONFIG_SYS_FSL_SRDS_2
        case FSL_SRDS_2:
-               cfg &= FSL_CHASSIS3_RCWSR28_SRDS2_PRTCL_MASK;
-               cfg >>= FSL_CHASSIS3_RCWSR28_SRDS2_PRTCL_SHIFT;
+               cfg = gur_in32(&gur->rcwsr[FSL_CHASSIS3_SRDS2_REGSR - 1]);
+               cfg &= FSL_CHASSIS3_SRDS2_PRTCL_MASK;
+               cfg >>= FSL_CHASSIS3_SRDS2_PRTCL_SHIFT;
                break;
 #endif
        default:
@@ -78,8 +85,8 @@ int serdes_get_first_lane(u32 sd, enum srds_prtcl device)
        return -ENODEV;
 }
 
-void serdes_init(u32 sd, u32 sd_addr, u32 sd_prctl_mask, u32 sd_prctl_shift,
-               u8 serdes_prtcl_map[SERDES_PRCTL_COUNT])
+void serdes_init(u32 sd, u32 sd_addr, u32 rcwsr, u32 sd_prctl_mask,
+                u32 sd_prctl_shift, u8 serdes_prtcl_map[SERDES_PRCTL_COUNT])
 {
        struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
        u32 cfg;
@@ -90,7 +97,7 @@ void serdes_init(u32 sd, u32 sd_addr, u32 sd_prctl_mask, u32 sd_prctl_shift,
 
        memset(serdes_prtcl_map, 0, sizeof(u8) * SERDES_PRCTL_COUNT);
 
-       cfg = gur_in32(&gur->rcwsr[28]) & sd_prctl_mask;
+       cfg = gur_in32(&gur->rcwsr[rcwsr - 1]) & sd_prctl_mask;
        cfg >>= sd_prctl_shift;
        printf("Using SERDES%d Protocol: %d (0x%x)\n", sd + 1, cfg, cfg);
 
@@ -106,28 +113,10 @@ void serdes_init(u32 sd, u32 sd_addr, u32 sd_prctl_mask, u32 sd_prctl_shift,
 #ifdef CONFIG_FSL_MC_ENET
                        switch (lane_prtcl) {
                        case QSGMII_A:
-                               wriop_init_dpmac(sd, 5, (int)lane_prtcl);
-                               wriop_init_dpmac(sd, 6, (int)lane_prtcl);
-                               wriop_init_dpmac(sd, 7, (int)lane_prtcl);
-                               wriop_init_dpmac(sd, 8, (int)lane_prtcl);
-                               break;
                        case QSGMII_B:
-                               wriop_init_dpmac(sd, 1, (int)lane_prtcl);
-                               wriop_init_dpmac(sd, 2, (int)lane_prtcl);
-                               wriop_init_dpmac(sd, 3, (int)lane_prtcl);
-                               wriop_init_dpmac(sd, 4, (int)lane_prtcl);
-                               break;
                        case QSGMII_C:
-                               wriop_init_dpmac(sd, 13, (int)lane_prtcl);
-                               wriop_init_dpmac(sd, 14, (int)lane_prtcl);
-                               wriop_init_dpmac(sd, 15, (int)lane_prtcl);
-                               wriop_init_dpmac(sd, 16, (int)lane_prtcl);
-                               break;
                        case QSGMII_D:
-                               wriop_init_dpmac(sd, 9, (int)lane_prtcl);
-                               wriop_init_dpmac(sd, 10, (int)lane_prtcl);
-                               wriop_init_dpmac(sd, 11, (int)lane_prtcl);
-                               wriop_init_dpmac(sd, 12, (int)lane_prtcl);
+                               wriop_init_dpmac_qsgmii(sd, (int)lane_prtcl);
                                break;
                        default:
                                if (lane_prtcl >= XFI1 && lane_prtcl <= XFI8)
@@ -165,15 +154,17 @@ void fsl_serdes_init(void)
 #ifdef CONFIG_SYS_FSL_SRDS_1
        serdes_init(FSL_SRDS_1,
                    CONFIG_SYS_FSL_LSCH3_SERDES_ADDR,
-                   FSL_CHASSIS3_RCWSR28_SRDS1_PRTCL_MASK,
-                   FSL_CHASSIS3_RCWSR28_SRDS1_PRTCL_SHIFT,
+                   FSL_CHASSIS3_SRDS1_REGSR,
+                   FSL_CHASSIS3_SRDS1_PRTCL_MASK,
+                   FSL_CHASSIS3_SRDS1_PRTCL_SHIFT,
                    serdes1_prtcl_map);
 #endif
 #ifdef CONFIG_SYS_FSL_SRDS_2
        serdes_init(FSL_SRDS_2,
                    CONFIG_SYS_FSL_LSCH3_SERDES_ADDR + FSL_SRDS_2 * 0x10000,
-                   FSL_CHASSIS3_RCWSR28_SRDS2_PRTCL_MASK,
-                   FSL_CHASSIS3_RCWSR28_SRDS2_PRTCL_SHIFT,
+                   FSL_CHASSIS3_SRDS2_REGSR,
+                   FSL_CHASSIS3_SRDS2_PRTCL_MASK,
+                   FSL_CHASSIS3_SRDS2_PRTCL_SHIFT,
                    serdes2_prtcl_map);
 #endif
 }
index b68e87d657176308662440cdf56a3e5d31cf62c4..b35ad5fb6f07f89d24fe0abe92337d071d250721 100644 (file)
@@ -4,6 +4,7 @@
  * SPDX-License-Identifier:    GPL-2.0+
  */
 #include <common.h>
+#include <malloc.h>
 #include <config.h>
 #include <errno.h>
 #include <asm/system.h>
 #include <fsl_validate.h>
 #endif
 
+#ifdef CONFIG_SYS_LS_PPA_FW_IN_NAND
+#include <nand.h>
+#elif defined(CONFIG_SYS_LS_PPA_FW_IN_MMC)
+#include <mmc.h>
+#endif
+
+DECLARE_GLOBAL_DATA_PTR;
+
 int ppa_init(void)
 {
-       const void *ppa_fit_addr;
+       void *ppa_fit_addr;
        u32 *boot_loc_ptr_l, *boot_loc_ptr_h;
        int ret;
 
@@ -34,10 +43,137 @@ int ppa_init(void)
 
 #ifdef CONFIG_SYS_LS_PPA_FW_IN_XIP
        ppa_fit_addr = (void *)CONFIG_SYS_LS_PPA_FW_ADDR;
+       debug("%s: PPA image load from XIP\n", __func__);
+#else /* !CONFIG_SYS_LS_PPA_FW_IN_XIP */
+       size_t fw_length, fdt_header_len = sizeof(struct fdt_header);
+
+       /* Copy PPA image from MMC/SD/NAND to allocated memory */
+#ifdef CONFIG_SYS_LS_PPA_FW_IN_MMC
+       struct mmc *mmc;
+       int dev = CONFIG_SYS_MMC_ENV_DEV;
+       struct fdt_header *fitp;
+       u32 cnt;
+       u32 blk = CONFIG_SYS_LS_PPA_FW_ADDR / 512;
+
+       debug("%s: PPA image load from eMMC/SD\n", __func__);
+
+       ret = mmc_initialize(gd->bd);
+       if (ret) {
+               printf("%s: mmc_initialize() failed\n", __func__);
+               return ret;
+       }
+       mmc = find_mmc_device(dev);
+       if (!mmc) {
+               printf("PPA: MMC cannot find device for PPA firmware\n");
+               return -ENODEV;
+       }
+
+       ret = mmc_init(mmc);
+       if (ret) {
+               printf("%s: mmc_init() failed\n", __func__);
+               return ret;
+       }
+
+       fitp = malloc(roundup(fdt_header_len, 512));
+       if (!fitp) {
+               printf("PPA: malloc failed for FIT header(size 0x%zx)\n",
+                      roundup(fdt_header_len, 512));
+               return -ENOMEM;
+       }
+
+       cnt = DIV_ROUND_UP(fdt_header_len, 512);
+       debug("%s: MMC read PPA FIT header: dev # %u, block # %u, count %u\n",
+             __func__, dev, blk, cnt);
+       ret = mmc->block_dev.block_read(&mmc->block_dev, blk, cnt, fitp);
+       if (ret != cnt) {
+               free(fitp);
+               printf("MMC/SD read of PPA FIT header at offset 0x%x failed\n",
+                      CONFIG_SYS_LS_PPA_FW_ADDR);
+               return -EIO;
+       }
+
+       /* flush cache after read */
+       flush_cache((ulong)fitp, cnt * 512);
+
+       ret = fdt_check_header(fitp);
+       if (ret) {
+               free(fitp);
+               printf("%s: fdt_check_header() failed\n", __func__);
+               return ret;
+       }
+
+       fw_length = fdt_totalsize(fitp);
+       free(fitp);
+
+       fw_length = roundup(fw_length, 512);
+       ppa_fit_addr = malloc(fw_length);
+       if (!ppa_fit_addr) {
+               printf("PPA: malloc failed for PPA image(size 0x%zx)\n",
+                      fw_length);
+               return -ENOMEM;
+       }
+
+       cnt = DIV_ROUND_UP(fw_length, 512);
+       debug("%s: MMC read PPA FIT image: dev # %u, block # %u, count %u\n",
+             __func__, dev, blk, cnt);
+       ret = mmc->block_dev.block_read(&mmc->block_dev,
+                                       blk, cnt, ppa_fit_addr);
+       if (ret != cnt) {
+               free(ppa_fit_addr);
+               printf("MMC/SD read of PPA FIT header at offset 0x%x failed\n",
+                      CONFIG_SYS_LS_PPA_FW_ADDR);
+               return -EIO;
+       }
+
+       /* flush cache after read */
+       flush_cache((ulong)ppa_fit_addr, cnt * 512);
+
+#elif defined(CONFIG_SYS_LS_PPA_FW_IN_NAND)
+       struct fdt_header fit;
+
+       debug("%s: PPA image load from NAND\n", __func__);
+
+       nand_init();
+       ret = nand_read(nand_info[0], (loff_t)CONFIG_SYS_LS_PPA_FW_ADDR,
+                      &fdt_header_len, (u_char *)&fit);
+       if (ret == -EUCLEAN) {
+               printf("NAND read of PPA FIT header at offset 0x%x failed\n",
+                      CONFIG_SYS_LS_PPA_FW_ADDR);
+               return -EIO;
+       }
+
+       ret = fdt_check_header(&fit);
+       if (ret) {
+               printf("%s: fdt_check_header() failed\n", __func__);
+               return ret;
+       }
+
+       fw_length = fdt_totalsize(&fit);
+
+       ppa_fit_addr = malloc(fw_length);
+       if (!ppa_fit_addr) {
+               printf("PPA: malloc failed for PPA image(size 0x%zx)\n",
+                      fw_length);
+               return -ENOMEM;
+       }
+
+       ret = nand_read(nand_info[0], (loff_t)CONFIG_SYS_LS_PPA_FW_ADDR,
+                      &fw_length, (u_char *)ppa_fit_addr);
+       if (ret == -EUCLEAN) {
+               free(ppa_fit_addr);
+               printf("NAND read of PPA firmware at offset 0x%x failed\n",
+                      CONFIG_SYS_LS_PPA_FW_ADDR);
+               return -EIO;
+       }
+
+       /* flush cache after read */
+       flush_cache((ulong)ppa_fit_addr, fw_length);
 #else
 #error "No CONFIG_SYS_LS_PPA_FW_IN_xxx defined"
 #endif
 
+#endif
+
 #ifdef CONFIG_CHAIN_OF_TRUST
        ppa_img_addr = (uintptr_t)ppa_fit_addr;
        if (fsl_check_boot_mode_secure() != 0) {
@@ -65,5 +201,10 @@ int ppa_init(void)
              boot_loc_ptr_l, boot_loc_ptr_h);
        ret = sec_firmware_init(ppa_fit_addr, boot_loc_ptr_l, boot_loc_ptr_h);
 
+#if defined(CONFIG_SYS_LS_PPA_FW_IN_MMC) || \
+       defined(CONFIG_SYS_LS_PPA_FW_IN_NAND)
+       free(ppa_fit_addr);
+#endif
+
        return ret;
 }
index b54a9379711752e1dd78184121884954b08d4ff5..9e3cdd78af5b6f70fffc9298801c69331f599462 100644 (file)
@@ -152,6 +152,7 @@ static void erratum_rcw_src(void)
  * This erratum requires setting glitch_en bit to enable
  * digital glitch filter to improve clock stability.
  */
+#ifdef CONFIG_SYS_FSL_ERRATUM_A009203
 static void erratum_a009203(void)
 {
        u8 __iomem *ptr;
@@ -178,6 +179,7 @@ static void erratum_a009203(void)
 #endif
 #endif
 }
+#endif
 
 void bypass_smmu(void)
 {
@@ -191,7 +193,9 @@ void fsl_lsch3_early_init_f(void)
 {
        erratum_rcw_src();
        init_early_memctl_regs();       /* tighten IFC timing */
+#ifdef CONFIG_SYS_FSL_ERRATUM_A009203
        erratum_a009203();
+#endif
        erratum_a008514();
        erratum_a008336();
 #ifdef CONFIG_CHAIN_OF_TRUST
index ed5ea54a5ece5a3af841ca085c875d979e6641e2..23b3cec43443dcf81736cb7d213087343953ff0f 100644 (file)
                        reg = <0x0 0x1550000 0x0 0x10000>,
                                <0x0 0x40000000 0x0 0x4000000>;
                        reg-names = "QuadSPI", "QuadSPI-memory";
-                       num-cs = <2>;
+                       num-cs = <1>;
                        big-endian;
                        status = "disabled";
                };
index d9d948e2ab7cfa6ea07a5bb3a4132e995f95fd9e..70181c5077ca5897c75e87766e3ca1bc60befece 100644 (file)
@@ -48,10 +48,10 @@ enum srds_prtcl {
        SGMII14,
        SGMII15,
        SGMII16,
-       QSGMII_A, /* A indicates MACs 1-4 */
-       QSGMII_B, /* B indicates MACs 5-8 */
-       QSGMII_C, /* C indicates MACs 9-12 */
-       QSGMII_D, /* D indicates MACs 12-16 */
+       QSGMII_A,
+       QSGMII_B,
+       QSGMII_C,
+       QSGMII_D,
        SERDES_PRCTL_COUNT
 };
 
index 08ea8fb8eff68b6c29f0c5a660a095e29ddba5e8..80c421f71041372ce57d53a4feee0d2d02f068d4 100644 (file)
@@ -230,10 +230,19 @@ struct ccsr_gur {
 #define FSL_CHASSIS3_RCWSR0_MEM_PLL_RAT_MASK   0x3f
 #define FSL_CHASSIS3_RCWSR0_MEM2_PLL_RAT_SHIFT 18
 #define FSL_CHASSIS3_RCWSR0_MEM2_PLL_RAT_MASK  0x3f
+
+#if defined(CONFIG_ARCH_LS2080A)
 #define        FSL_CHASSIS3_RCWSR28_SRDS1_PRTCL_MASK   0x00FF0000
 #define        FSL_CHASSIS3_RCWSR28_SRDS1_PRTCL_SHIFT  16
 #define        FSL_CHASSIS3_RCWSR28_SRDS2_PRTCL_MASK   0xFF000000
 #define        FSL_CHASSIS3_RCWSR28_SRDS2_PRTCL_SHIFT  24
+#define FSL_CHASSIS3_SRDS1_PRTCL_MASK  FSL_CHASSIS3_RCWSR28_SRDS1_PRTCL_MASK
+#define FSL_CHASSIS3_SRDS1_PRTCL_SHIFT FSL_CHASSIS3_RCWSR28_SRDS1_PRTCL_SHIFT
+#define FSL_CHASSIS3_SRDS2_PRTCL_MASK  FSL_CHASSIS3_RCWSR28_SRDS2_PRTCL_MASK
+#define FSL_CHASSIS3_SRDS2_PRTCL_SHIFT FSL_CHASSIS3_RCWSR28_SRDS2_PRTCL_SHIFT
+#define FSL_CHASSIS3_SRDS1_REGSR       29
+#define FSL_CHASSIS3_SRDS2_REGSR       29
+#endif
 #define RCW_SB_EN_REG_INDEX    9
 #define RCW_SB_EN_MASK         0x00000400
 
index 1f1442b6f0aa2a9703fff81c1a5628d284b8cd05..da4098ebd3225c3f9ac5ad9d33c2abfaf8d8af46 100644 (file)
@@ -7,10 +7,7 @@
 #ifndef __FSL_PPA_H_
 #define __FSL_PPA_H_
 
-#define SEC_FIRMWARE_FIT_IMAGE         "firmware"
-#define SEC_FIRMEWARE_FIT_CNF_NAME     "config@1"
-#define SEC_FIRMWARE_TARGET_EL         2
-
+#ifdef CONFIG_FSL_LS_PPA
 int ppa_init(void);
-
+#endif
 #endif
diff --git a/arch/arm/include/asm/arch-fsl-layerscape/stream_id_lsch2.h b/arch/arm/include/asm/arch-fsl-layerscape/stream_id_lsch2.h
new file mode 100644 (file)
index 0000000..b326fe5
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2017 NXP Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ *
+ */
+#ifndef __FSL_STREAM_ID_H
+#define __FSL_STREAM_ID_H
+
+/*
+ * Stream IDs on Chassis-2 (for example ls1043a, ls1046a, ls1012) devices
+ * are not hardwired and are programmed by sw.  There are a limited number
+ * of stream IDs available, and the partitioning of them is scenario
+ * dependent. This header defines the partitioning between legacy, PCI,
+ * and DPAA1 devices.
+ *
+ * This partitioning can be customized in this file depending
+ * on the specific hardware config:
+ *
+ *  -non-PCI legacy, platform devices (USB, SDHC, SATA, DMA, QE etc)
+ *     -all legacy devices get a unique stream ID assigned and programmed in
+ *      their AMQR registers by u-boot
+ *
+ *  -PCIe
+ *     -there is a range of stream IDs set aside for PCI in this
+ *      file.  U-boot will scan the PCI bus and for each device discovered:
+ *         -allocate a streamID
+ *         -set a PEXn LUT table entry mapping 'requester ID' to 'stream ID'
+ *         -set a msi-map entry in the PEXn controller node in the
+ *          device tree (see Documentation/devicetree/bindings/pci/pci-msi.txt
+ *          for more info on the msi-map definition)
+ *         -set a iommu-map entry in the PEXn controller node in the
+ *          device tree (see Documentation/devicetree/bindings/pci/pci-iommu.txt
+ *          for more info on the iommu-map definition)
+ *
+ *  -DPAA1
+ *     - Stream ids for DPAA1 use are reserved for future usecase.
+ *
+ */
+
+
+#define FSL_INVALID_STREAM_ID          0
+
+/* legacy devices */
+#define FSL_USB1_STREAM_ID             1
+#define FSL_USB2_STREAM_ID             2
+#define FSL_USB3_STREAM_ID             3
+#define FSL_SDHC_STREAM_ID             4
+#define FSL_SATA_STREAM_ID             5
+#define FSL_QE_STREAM_ID               6
+#define FSL_QDMA_STREAM_ID             7
+#define FSL_EDMA_STREAM_ID             8
+#define FSL_ETR_STREAM_ID              9
+
+/* PCI - programmed in PEXn_LUT */
+#define FSL_PEX_STREAM_ID_START                11
+#define FSL_PEX_STREAM_ID_END          26
+
+/* DPAA1 - Stream-ID that can be programmed in DPAA1 h/w */
+#define FSL_DPAA1_STREAM_ID_START      27
+#define FSL_DPAA1_STREAM_ID_END                63
+
+#endif
similarity index 80%
rename from arch/arm/include/asm/arch-fsl-layerscape/ls2080a_stream_id.h
rename to arch/arm/include/asm/arch-fsl-layerscape/stream_id_lsch3.h
index ee28323f8ca629c1809298b1a4ff068dc64057d9..d7d527d8f4f34bea1ead14762550e4c8339f113b 100644 (file)
@@ -8,11 +8,11 @@
 #define __FSL_STREAM_ID_H
 
 /*
- * Stream IDs on ls2080a devices are not hardwired and are
- * programmed by sw.  There are a limited number of stream IDs
- * available, and the partitioning of them is scenario dependent.
- * This header defines the partitioning between legacy, PCI,
- * and DPAA2 devices.
+ * Stream IDs on NXP Chassis-3 (for example ls2080a, ls1088a, ls2088a)
+ * devices are not hardwired and are programmed by sw. There are a limited
+ * number of stream IDs available, and the partitioning of them is scenario
+ * dependent. This header defines the partitioning between legacy,
+ * PCI, and DPAA2 devices.
  *
  * This partitioning can be customized in this file depending
  * on the specific hardware config:
@@ -29,6 +29,9 @@
  *         -set a msi-map entry in the PEXn controller node in the
  *          device tree (see Documentation/devicetree/bindings/pci/pci-msi.txt
  *          for more info on the msi-map definition)
+ *         -set a iommu-map entry in the PEXn controller node in the
+ *          device tree (see Documentation/devicetree/bindings/pci/pci-iommu.txt
+ *          for more info on the iommu-map definition)
  *
  *  -DPAA2
  *     -u-boot will allocate a range of stream IDs to be used by the Management
@@ -36,7 +39,7 @@
  *     -the MC is responsible for allocating and setting up 'isolation context
  *      IDs (ICIDs) based on the allocated stream IDs for all DPAA2 devices.
  *
- * On ls2080a SoCs stream IDs are programmed in AMQ registers (32-bits) for
+ * On Chasis-3 SoCs stream IDs are programmed in AMQ registers (32-bits) for
  * each of the different bus masters.  The relationship between
  * the AMQ registers and stream IDs is defined in the table below:
  *          AMQ bit    streamID bit
diff --git a/arch/arm/include/asm/arch-lpc32xx/i2c.h b/arch/arm/include/asm/arch-lpc32xx/i2c.h
new file mode 100644 (file)
index 0000000..5301d4c
--- /dev/null
@@ -0,0 +1,37 @@
+#ifndef _LPC32XX_I2C_H
+#define _LPC32XX_I2C_H
+
+#include <common.h>
+#include <asm/types.h>
+
+/* i2c register set */
+struct lpc32xx_i2c_base {
+       union {
+               u32 rx;
+               u32 tx;
+       };
+       u32 stat;
+       u32 ctrl;
+       u32 clk_hi;
+       u32 clk_lo;
+       u32 adr;
+       u32 rxfl;
+       u32 txfl;
+       u32 rxb;
+       u32 txb;
+       u32 stx;
+       u32 stxfl;
+};
+
+#ifdef CONFIG_DM_I2C
+enum {
+       I2C_0, I2C_1, I2C_2,
+};
+
+struct lpc32xx_i2c_dev {
+       struct lpc32xx_i2c_base *base;
+       int index;
+       uint speed;
+};
+#endif /* CONFIG_DM_I2C */
+#endif /* _LPC32XX_I2C_H */
index 5ae00fa8d20b5d5bce15fd264c4e87d8971da2d9..bcdb1b0072046b45b1e5a99f4cc9e7ce35dad2d8 100644 (file)
@@ -7,10 +7,6 @@
 #ifndef __SEC_FIRMWARE_H_
 #define __SEC_FIRMWARE_H_
 
-#ifdef CONFIG_FSL_LS_PPA
-#include <asm/arch/ppa.h>
-#endif
-
 int sec_firmware_init(const void *, u32 *, u32 *);
 int _sec_firmware_entry(const void *, u32 *, u32 *);
 bool sec_firmware_is_valid(const void *);
index fd627c0874e969723dc99cf599fc2dadaac95391..d98a1e8f89d7eb2f537fc6a2d6620f80c473c7ba 100644 (file)
  * in boot ROM of the SoC.
  * The feature is only applicable in case of NOR boot and is
  * not applicable in case of RAMBOOT (NAND, SD, SPI).
+ * For LS, this feature is available for all device if IE Table
+ * is copied to XIP memory
+ * Also, for LS, ISBC doesn't verify this table.
  */
-#ifndef CONFIG_ESBC_HDR_LS
-/* Current Key EXT feature not available in LS ESBC Header */
 #define CONFIG_FSL_ISBC_KEY_EXT
-#endif
 
 #endif
 
 #ifdef CONFIG_SYS_LS_PPA_FW_IN_XIP
 #ifdef CONFIG_LS1043A
 #define CONFIG_SYS_LS_PPA_ESBC_ADDR    0x600c0000
+#elif defined(CONFIG_FSL_LSCH3)
+#define CONFIG_SYS_LS_PPA_ESBC_ADDR     0x580c40000
 #endif
 #else
 #error "No CONFIG_SYS_LS_PPA_FW_IN_xxx defined"
index 2b723a4b9cb995af5f4398412010aa9dde8387d1..7396aa2f698aa0022317460becc230f9b7ad1b81 100644 (file)
 #define CHECK_KEY_LEN(key_len) (((key_len) == 2 * KEY_SIZE_BYTES / 4) || \
                                 ((key_len) == 2 * KEY_SIZE_BYTES / 2) || \
                                 ((key_len) == 2 * KEY_SIZE_BYTES))
+#if defined(CONFIG_FSL_ISBC_KEY_EXT)
+/* Global data structure */
+static struct fsl_secboot_glb glb;
+#endif
 
 /* This array contains DER value for SHA-256 */
 static const u8 hash_identifier[] = { 0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60,
@@ -60,7 +64,7 @@ self:
 #if defined(CONFIG_FSL_ISBC_KEY_EXT)
 static u32 check_ie(struct fsl_secboot_img_priv *img)
 {
-       if (img->hdr.ie_flag)
+       if (img->hdr.ie_flag & IE_FLAG_MASK)
                return 1;
 
        return 0;
@@ -119,7 +123,21 @@ int get_csf_base_addr(u32 *csf_addr, u32 *flash_base_addr)
 }
 #endif
 
-static int get_ie_info_addr(u32 *ie_addr)
+#if defined(CONFIG_ESBC_HDR_LS)
+static int get_ie_info_addr(uintptr_t *ie_addr)
+{
+       struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
+       /* For LS-CH3, the address of IE Table is
+        * stated in Scratch13 and scratch14 of DCFG.
+        * Bootrom validates this table while validating uboot.
+        * DCFG is LE*/
+       *ie_addr = in_le32(&gur->scratchrw[SCRATCH_IE_HIGH_ADR - 1]);
+       *ie_addr = *ie_addr << 32;
+       *ie_addr |= in_le32(&gur->scratchrw[SCRATCH_IE_LOW_ADR - 1]);
+       return 0;
+}
+#else /* CONFIG_ESBC_HDR_LS */
+static int get_ie_info_addr(uintptr_t *ie_addr)
 {
        struct fsl_secboot_img_hdr *hdr;
        struct fsl_secboot_sg_table *sg_tbl;
@@ -147,16 +165,17 @@ static int get_ie_info_addr(u32 *ie_addr)
 
        /* IE Key Table is the first entry in the SG Table */
 #if defined(CONFIG_MPC85xx)
-       *ie_addr = (sg_tbl->src_addr & ~(CONFIG_SYS_PBI_FLASH_BASE)) +
-                  flash_base_addr;
+       *ie_addr = (uintptr_t)((sg_tbl->src_addr &
+                       ~(CONFIG_SYS_PBI_FLASH_BASE)) +
+                       flash_base_addr);
 #else
-       *ie_addr = sg_tbl->src_addr;
+       *ie_addr = (uintptr_t)sg_tbl->src_addr;
 #endif
 
-       debug("IE Table address is %x\n", *ie_addr);
+       debug("IE Table address is %lx\n", *ie_addr);
        return 0;
 }
-
+#endif /* CONFIG_ESBC_HDR_LS */
 #endif
 
 #ifdef CONFIG_KEY_REVOCATION
@@ -164,7 +183,10 @@ static int get_ie_info_addr(u32 *ie_addr)
 static u32 check_srk(struct fsl_secboot_img_priv *img)
 {
 #ifdef CONFIG_ESBC_HDR_LS
-       /* In LS, No SRK Flag as SRK is always present*/
+       /* In LS, No SRK Flag as SRK is always present if IE not present*/
+#if defined(CONFIG_FSL_ISBC_KEY_EXT)
+       return !check_ie(img);
+#endif
        return 1;
 #else
        if (img->hdr.len_kr.srk_table_flag & SRK_FLAG)
@@ -253,14 +275,29 @@ static u32 read_validate_single_key(struct fsl_secboot_img_priv *img)
 #endif /* CONFIG_ESBC_HDR_LS */
 
 #if defined(CONFIG_FSL_ISBC_KEY_EXT)
+
+static void install_ie_tbl(uintptr_t ie_tbl_addr,
+               struct fsl_secboot_img_priv *img)
+{
+       /* Copy IE tbl to Global Data */
+       memcpy(&glb.ie_tbl, (u8 *)ie_tbl_addr, sizeof(struct ie_key_info));
+       img->ie_addr = (uintptr_t)&glb.ie_tbl;
+       glb.ie_addr = img->ie_addr;
+}
+
 static u32 read_validate_ie_tbl(struct fsl_secboot_img_priv *img)
 {
        struct fsl_secboot_img_hdr *hdr = &img->hdr;
        u32 ie_key_len, ie_revoc_flag, ie_num;
        struct ie_key_info *ie_info;
 
-       if (get_ie_info_addr(&img->ie_addr))
-               return ERROR_IE_TABLE_NOT_FOUND;
+       if (!img->ie_addr) {
+               if (get_ie_info_addr(&img->ie_addr))
+                       return ERROR_IE_TABLE_NOT_FOUND;
+               else
+                       install_ie_tbl(img->ie_addr, img);
+               }
+
        ie_info = (struct ie_key_info *)(uintptr_t)img->ie_addr;
        if (ie_info->num_keys == 0 || ie_info->num_keys > 32)
                return ERROR_ESBC_CLIENT_HEADER_INVALID_IE_NUM_ENTRY;
@@ -786,6 +823,26 @@ static int calculate_cmp_img_sig(struct fsl_secboot_img_priv *img)
 
        return 0;
 }
+/* Function to initialize img priv and global data structure
+ */
+static int secboot_init(struct fsl_secboot_img_priv **img_ptr)
+{
+       *img_ptr = malloc(sizeof(struct fsl_secboot_img_priv));
+
+       struct fsl_secboot_img_priv *img = *img_ptr;
+
+       if (!img)
+               return -ENOMEM;
+       memset(img, 0, sizeof(struct fsl_secboot_img_priv));
+
+#if defined(CONFIG_FSL_ISBC_KEY_EXT)
+       if (glb.ie_addr)
+               img->ie_addr = glb.ie_addr;
+#endif
+       return 0;
+}
+
+
 /* haddr - Address of the header of image to be validated.
  * arg_hash_str - Option hash string. If provided, this
  * overrides the key hash in the SFP fuses.
@@ -839,12 +896,9 @@ int fsl_secboot_validate(uintptr_t haddr, char *arg_hash_str,
                hash_cmd = 1;
        }
 
-       img = malloc(sizeof(struct fsl_secboot_img_priv));
-
-       if (!img)
-               return -1;
-
-       memset(img, 0, sizeof(struct fsl_secboot_img_priv));
+       ret = secboot_init(&img);
+       if (ret)
+               goto exit;
 
        /* Update the information in Private Struct */
        hdr = &img->hdr;
@@ -899,5 +953,7 @@ int fsl_secboot_validate(uintptr_t haddr, char *arg_hash_str,
        }
 
 exit:
+       /* Free Img as it was malloc'ed*/
+       free(img);
        return ret;
 }
index 2333843958fdb614940fcccff212cbcbc8447403..728de2e3f171bc63f15048bd338c404b467f23c8 100644 (file)
@@ -23,9 +23,7 @@
 #ifdef CONFIG_U_QE
 #include <fsl_qe.h>
 #endif
-#ifdef CONFIG_FSL_LS_PPA
 #include <asm/arch/ppa.h>
-#endif
 
 DECLARE_GLOBAL_DATA_PTR;
 
index 277013bfcc6f74aff33d41f28dc80777c28c85df..6da9c6cfe8313d4445d6153cb266f6f844c1fa98 100644 (file)
@@ -19,6 +19,8 @@
 #include <asm/arch/soc.h>
 #include <hwconfig.h>
 #include <fsl_sec.h>
+#include <asm/arch/ppa.h>
+
 
 #include "../common/qixis.h"
 #include "ls2080aqds_qixis.h"
@@ -225,6 +227,14 @@ int board_init(void)
        select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT);
        rtc_enable_32khz_output();
 
+#ifdef CONFIG_FSL_LS_PPA
+       ppa_init();
+#endif
+
+#ifdef CONFIG_FSL_CAAM
+       sec_init();
+#endif
+
        return 0;
 }
 
@@ -266,9 +276,6 @@ void detail_board_ddr_info(void)
 #if defined(CONFIG_ARCH_MISC_INIT)
 int arch_misc_init(void)
 {
-#ifdef CONFIG_FSL_CAAM
-       sec_init();
-#endif
        return 0;
 }
 #endif
index 4c01f560bcde815006decb1fa2c6ea68a6b85b61..ea05ec6f6518a79a62dca87142799097b77b6a64 100644 (file)
@@ -19,6 +19,7 @@
 #include <i2c.h>
 #include <asm/arch/mmu.h>
 #include <asm/arch/soc.h>
+#include <asm/arch/ppa.h>
 #include <fsl_sec.h>
 
 #include "../common/qixis.h"
@@ -181,10 +182,17 @@ int board_init(void)
 
        QIXIS_WRITE(rst_ctl, QIXIS_RST_CTL_RESET_EN);
 
+#ifdef CONFIG_FSL_LS_PPA
+       ppa_init();
+#endif
+
 #ifdef CONFIG_FSL_MC_ENET
        /* invert AQR405 IRQ pins polarity */
        out_le32(irq_ccsr + IRQCR_OFFSET / 4, AQR405_IRQ_MASK);
 #endif
+#ifdef CONFIG_FSL_CAAM
+       sec_init();
+#endif
 
        return 0;
 }
@@ -223,9 +231,6 @@ void detail_board_ddr_info(void)
 #if defined(CONFIG_ARCH_MISC_INIT)
 int arch_misc_init(void)
 {
-#ifdef CONFIG_FSL_CAAM
-       sec_init();
-#endif
        return 0;
 }
 #endif
index 2fc1144cdae17170193e69251dd39aa24e918330..0acf655c0e5b86686ea1d32471ba1ab1c4122f2a 100644 (file)
@@ -103,8 +103,9 @@ static void setup_iomux_enet(void)
 
        /* Reset AR8033 PHY */
        gpio_direction_output(IMX_GPIO_NR(1, 28), 0);
-       udelay(500);
+       mdelay(10);
        gpio_set_value(IMX_GPIO_NR(1, 28), 1);
+       mdelay(1);
 }
 
 static iomux_v3_cfg_t const usdhc2_pads[] = {
@@ -306,7 +307,8 @@ static int mx6_rgmii_rework(struct phy_device *phydev)
        /* set debug port address: SerDes Test and System Mode Control */
        phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x05);
        /* enable rgmii tx clock delay */
-       phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x100);
+       /* set the reserved bits to avoid board specific voltage peak issue*/
+       phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x3D47);
 
        return 0;
 }
index 473153fbd4737a7949a3f22b0c5a29b7009b941b..3dd7c6ba4de2d014535a973ba400eae060d8698d 100644 (file)
--- a/cmd/i2c.c
+++ b/cmd/i2c.c
@@ -151,6 +151,16 @@ static int cmd_i2c_set_bus_num(unsigned int busnum)
 
 static int i2c_get_cur_bus(struct udevice **busp)
 {
+#ifdef CONFIG_I2C_SET_DEFAULT_BUS_NUM
+       if (!i2c_cur_bus) {
+               if (cmd_i2c_set_bus_num(CONFIG_I2C_DEFAULT_BUS_NUMBER)) {
+                       printf("Default I2C bus %d not found\n",
+                              CONFIG_I2C_DEFAULT_BUS_NUMBER);
+                       return -ENODEV;
+               }
+       }
+#endif
+
        if (!i2c_cur_bus) {
                puts("No I2C bus selected\n");
                return -ENODEV;
index 5c9e6987b9e1a64f4b9fc43e53cd6bf06166860a..334491339914bc1ee97aaaf05bda7ea5e4feb5b9 100644 (file)
@@ -426,6 +426,7 @@ static int initr_nand(void)
 {
        puts("NAND:  ");
        nand_init();
+       printf("%lu MiB\n", nand_size() / 1024);
        return 0;
 }
 #endif
index 55d4d6f6d444ef6cc4bd208efa4da58a9e11d386..c6a76b7ad299f365d08542ed7f583f8f1f2720ea 100644 (file)
@@ -482,7 +482,6 @@ void fdt_fixup_ethernet(void *fdt)
        /* Cycle through all aliases */
        for (prop = 0; ; prop++) {
                const char *name;
-               int len = strlen("ethernet");
 
                /* FDT might have been edited, recompute the offset */
                offset = fdt_first_property_offset(fdt,
@@ -495,8 +494,13 @@ void fdt_fixup_ethernet(void *fdt)
                        break;
 
                path = fdt_getprop_by_offset(fdt, offset, &name, NULL);
-               if (!strncmp(name, "ethernet", len)) {
-                       i = trailing_strtol(name);
+               if (!strncmp(name, "ethernet", 8)) {
+                       /* Treat plain "ethernet" same as "ethernet0". */
+                       if (!strcmp(name, "ethernet"))
+                               i = 0;
+                       else
+                               i = trailing_strtol(name);
+
                        if (i != -1) {
                                if (i == 0)
                                        strcpy(mac, "ethaddr");
index 1cd3f1fd98b5de112de85297556263841cdbfc93..6634139ab8646480b33cfada00169ae394833324 100644 (file)
@@ -14,6 +14,10 @@ CONFIG_SPL_I2C_SUPPORT=y
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
+CONFIG_NET_ETHADDR_EEPROM=y
+CONFIG_NET_ETHADDR_EEPROM_I2C=y
+CONFIG_NET_ETHADDR_EEPROM_I2C_BUS=1
+CONFIG_I2C1_ENABLE=y
 # CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_SPL_ISO_PARTITION is not set
 # CONFIG_SPL_EFI_PARTITION is not set
index a4ade72d4a3a8029d6417e7658655d5e91aaa20f..4c720b3109503d5b8a1a8d1786ce4742b16a72ed 100644 (file)
@@ -21,6 +21,10 @@ CONFIG_CMD_USB_MASS_STORAGE=y
 # CONFIG_SPL_PARTITION_UUIDS is not set
 CONFIG_DFU_RAM=y
 CONFIG_ETH_DESIGNWARE=y
+CONFIG_NET_ETHADDR_EEPROM=y
+CONFIG_NET_ETHADDR_EEPROM_I2C=y
+CONFIG_NET_ETHADDR_EEPROM_I2C_BUS=1
+CONFIG_I2C1_ENABLE=y
 CONFIG_AXP_ALDO3_VOLT=2800
 CONFIG_AXP_ALDO4_VOLT=2800
 CONFIG_USB_EHCI_HCD=y
index 4fe4e4acf78e1c01972e5d50b145b5f5f32c268b..564ae256a35dcbf0d588f996faeb429080504a65 100644 (file)
@@ -16,6 +16,10 @@ CONFIG_SPL_I2C_SUPPORT=y
 # CONFIG_SPL_ISO_PARTITION is not set
 # CONFIG_SPL_EFI_PARTITION is not set
 CONFIG_ETH_DESIGNWARE=y
+CONFIG_NET_ETHADDR_EEPROM=y
+CONFIG_NET_ETHADDR_EEPROM_I2C=y
+CONFIG_NET_ETHADDR_EEPROM_I2C_BUS=1
+CONFIG_I2C1_ENABLE=y
 CONFIG_AXP_ALDO3_VOLT=2800
 CONFIG_AXP_ALDO4_VOLT=2800
 CONFIG_USB_EHCI_HCD=y
index e1d91e3b0855ee96ab223bc0dca05dd3df785e70..93be13b4077e27f70b40ef2a4a03d91a5b7aa569 100644 (file)
@@ -19,6 +19,10 @@ CONFIG_SPL_I2C_SUPPORT=y
 # CONFIG_SPL_ISO_PARTITION is not set
 # CONFIG_SPL_EFI_PARTITION is not set
 CONFIG_ETH_DESIGNWARE=y
+CONFIG_NET_ETHADDR_EEPROM=y
+CONFIG_NET_ETHADDR_EEPROM_I2C=y
+CONFIG_NET_ETHADDR_EEPROM_I2C_BUS=1
+CONFIG_I2C1_ENABLE=y
 CONFIG_AXP_ALDO3_VOLT=2800
 CONFIG_AXP_ALDO4_VOLT=2800
 CONFIG_USB_EHCI_HCD=y
index 4f4ae5aeebc91a8f25121593cbddc90f4d9543c9..ed429cb5097e4197436c178c6d5a667ab8558f30 100644 (file)
@@ -9,6 +9,7 @@ CONFIG_SPL_WATCHDOG_SUPPORT=y
 CONFIG_DEFAULT_DEVICE_TREE="fsl-ls1043a-rdb"
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
+CONFIG_FSL_LS_PPA=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_SYS_EXTRA_OPTIONS="RAMBOOT_PBL,SPL_FSL_PBL,NAND_BOOT"
 CONFIG_NAND_BOOT=y
index e57c42b507aa5ce7e85a208748c708a656ed9a94..02b5b5434afa2fc860746d15fd4befc6bac55baf 100644 (file)
@@ -9,6 +9,7 @@ CONFIG_SPL_WATCHDOG_SUPPORT=y
 CONFIG_DEFAULT_DEVICE_TREE="fsl-ls1043a-rdb"
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
+CONFIG_FSL_LS_PPA=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_SYS_EXTRA_OPTIONS="RAMBOOT_PBL,SPL_FSL_PBL,SD_BOOT"
 CONFIG_SD_BOOT=y
index 9beb050b908971406726d8052d9fc36f1a8cbd0d..711fc10ab60cd51fa10578744a04ad9d227e3fb9 100644 (file)
@@ -3,6 +3,7 @@ CONFIG_TARGET_LS1046ARDB=y
 CONFIG_DEFAULT_DEVICE_TREE="fsl-ls1046a-rdb"
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
+CONFIG_FSL_LS_PPA=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_SYS_EXTRA_OPTIONS="RAMBOOT_PBL,SPL_FSL_PBL,EMMC_BOOT"
 CONFIG_SD_BOOT=y
index 032aab358187559fde6c6d5139f437070d091e10..a3965f245f335f7345dc38cfc4befb4d1b59e947 100644 (file)
@@ -3,6 +3,7 @@ CONFIG_TARGET_LS1046ARDB=y
 CONFIG_DEFAULT_DEVICE_TREE="fsl-ls1046a-rdb"
 CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
+CONFIG_FSL_LS_PPA=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_SYS_EXTRA_OPTIONS="RAMBOOT_PBL,SPL_FSL_PBL"
 CONFIG_SD_BOOT=y
index 0344d5f4a9823563c0b94feab89607f49041733a..fb9a3e4041f373daad279e3579f98afd64e6bd78 100644 (file)
@@ -1,5 +1,6 @@
 CONFIG_ARM=y
 CONFIG_TARGET_LS2080AQDS=y
+CONFIG_FSL_LS_PPA=y
 CONFIG_DEFAULT_DEVICE_TREE="fsl-ls2080a-qds"
 # CONFIG_SYS_MALLOC_F is not set
 CONFIG_FIT=y
index c4d8204dae76823f1da53c085c9a001393aafd4e..a1e552d69a336fbf04380400b9e039976bcb6933 100644 (file)
@@ -1,5 +1,6 @@
 CONFIG_ARM=y
 CONFIG_TARGET_LS2080ARDB=y
+CONFIG_FSL_LS_PPA=y
 CONFIG_DEFAULT_DEVICE_TREE="fsl-ls2080a-rdb"
 # CONFIG_SYS_MALLOC_F is not set
 CONFIG_FIT=y
diff --git a/doc/device-tree-bindings/net/fixed-link.txt b/doc/device-tree-bindings/net/fixed-link.txt
new file mode 100644 (file)
index 0000000..5829bd8
--- /dev/null
@@ -0,0 +1,30 @@
+Fixed link Device Tree binding
+------------------------------
+
+Some Ethernet MACs have a "fixed link", and are not connected to a
+normal MDIO-managed PHY device. For those situations, a Device Tree
+binding allows to describe a "fixed link".
+
+Such a fixed link situation is described by creating a 'fixed-link'
+sub-node of the Ethernet MAC device node, with the following
+properties:
+
+* 'speed' (integer, mandatory), to indicate the link speed. Accepted
+  values are 10, 100 and 1000
+* 'full-duplex' (boolean, optional), to indicate that full duplex is
+  used. When absent, half duplex is assumed.
+* 'pause' (boolean, optional), to indicate that pause should be
+  enabled.
+* 'asym-pause' (boolean, optional), to indicate that asym_pause should
+  be enabled.
+
+Examples:
+
+ethernet@0 {
+       ...
+       fixed-link {
+             speed = <1000>;
+             full-duplex;
+       };
+       ...
+};
index 8ac7aaf2d236c32e101ba0635be8cc2ef64e3ecc..4e9afc120a3ff4789afa428387a9a6f2c1fcddf0 100644 (file)
@@ -49,6 +49,20 @@ config I2C_CROS_EC_LDO
        avoid duplicating the logic in the TPS65090 regulator driver for
        enabling/disabling an LDO.
 
+config I2C_SET_DEFAULT_BUS_NUM
+       bool "Set default I2C bus number"
+       depends on DM_I2C
+       help
+         Set default number of I2C bus to be accessed. This option provides
+         behaviour similar to old (i.e. pre DM) I2C bus driver.
+
+config I2C_DEFAULT_BUS_NUMBER
+       hex "I2C default bus number"
+       depends on I2C_SET_DEFAULT_BUS_NUM
+       default 0x0
+       help
+         Number of default I2C bus to use
+
 config DM_I2C_GPIO
        bool "Enable Driver Model for software emulated I2C bus driver"
        depends on DM_I2C && DM_GPIO
index b0167ab3dcee69ba8df1d303058bf15ec5061a59..661d03147a4e9d2a99169802a98b64cf7643be44 100644 (file)
@@ -5,9 +5,6 @@
  * Written-by: Albert ARIBAUD - 3ADEV <albert.aribaud@3adev.fr>
  *
  * SPDX-License-Identifier:    GPL-2.0+
- *
- * NOTE: This driver should be converted to driver model before June 2017.
- * Please see doc/driver-model/i2c-howto.txt for instructions.
  */
 
 #include <common.h>
@@ -15,6 +12,9 @@
 #include <i2c.h>
 #include <linux/errno.h>
 #include <asm/arch/clk.h>
+#include <asm/arch/i2c.h>
+#include <dm.h>
+#include <mapmem.h>
 
 /*
  * Provide default speed and slave if target did not
 #define CONFIG_SYS_I2C_LPC32XX_SLAVE 0
 #endif
 
-/* i2c register set */
-struct lpc32xx_i2c_registers {
-       union {
-               u32 rx;
-               u32 tx;
-       };
-       u32 stat;
-       u32 ctrl;
-       u32 clk_hi;
-       u32 clk_lo;
-       u32 adr;
-       u32 rxfl;
-       u32 txfl;
-       u32 rxb;
-       u32 txb;
-       u32 stx;
-       u32 stxfl;
-};
-
 /* TX register fields */
 #define LPC32XX_I2C_TX_START           0x00000100
 #define LPC32XX_I2C_TX_STOP            0x00000200
@@ -61,15 +42,17 @@ struct lpc32xx_i2c_registers {
 #define LPC32XX_I2C_STAT_NAI           0x00000004
 #define LPC32XX_I2C_STAT_TDI           0x00000001
 
-static struct lpc32xx_i2c_registers *lpc32xx_i2c[] = {
-       (struct lpc32xx_i2c_registers *)I2C1_BASE,
-       (struct lpc32xx_i2c_registers *)I2C2_BASE,
-       (struct lpc32xx_i2c_registers *)(USB_BASE + 0x300)
+#ifndef CONFIG_DM_I2C
+static struct lpc32xx_i2c_base *lpc32xx_i2c[] = {
+       (struct lpc32xx_i2c_base *)I2C1_BASE,
+       (struct lpc32xx_i2c_base *)I2C2_BASE,
+       (struct lpc32xx_i2c_base *)(USB_BASE + 0x300)
 };
+#endif
 
 /* Set I2C bus speed */
-static unsigned int lpc32xx_i2c_set_bus_speed(struct i2c_adapter *adap,
-                       unsigned int speed)
+static unsigned int __i2c_set_bus_speed(struct lpc32xx_i2c_base *base,
+                                       unsigned int speed, unsigned int chip)
 {
        int half_period;
 
@@ -77,7 +60,7 @@ static unsigned int lpc32xx_i2c_set_bus_speed(struct i2c_adapter *adap,
                return -EINVAL;
 
        /* OTG I2C clock source and CLK registers are different */
-       if (adap->hwadapnr == 2) {
+       if (chip == 2) {
                half_period = (get_periph_clk_rate() / speed) / 2;
                if (half_period > 0xFF)
                        return -EINVAL;
@@ -87,38 +70,35 @@ static unsigned int lpc32xx_i2c_set_bus_speed(struct i2c_adapter *adap,
                        return -EINVAL;
        }
 
-       writel(half_period, &lpc32xx_i2c[adap->hwadapnr]->clk_hi);
-       writel(half_period, &lpc32xx_i2c[adap->hwadapnr]->clk_lo);
+       writel(half_period, &base->clk_hi);
+       writel(half_period, &base->clk_lo);
        return 0;
 }
 
 /* I2C init called by cmd_i2c when doing 'i2c reset'. */
-static void _i2c_init(struct i2c_adapter *adap,
-       int requested_speed, int slaveadd)
+static void __i2c_init(struct lpc32xx_i2c_base *base,
+                      int requested_speed, int slaveadd, unsigned int chip)
 {
-       struct lpc32xx_i2c_registers *i2c = lpc32xx_i2c[adap->hwadapnr];
-
        /* soft reset (auto-clears) */
-       writel(LPC32XX_I2C_SOFT_RESET, &i2c->ctrl);
+       writel(LPC32XX_I2C_SOFT_RESET, &base->ctrl);
        /* set HI and LO periods for half of the default speed */
-       lpc32xx_i2c_set_bus_speed(adap, requested_speed);
+       __i2c_set_bus_speed(base, requested_speed, chip);
 }
 
 /* I2C probe called by cmd_i2c when doing 'i2c probe'. */
-static int lpc32xx_i2c_probe(struct i2c_adapter *adap, u8 dev)
+static int __i2c_probe_chip(struct lpc32xx_i2c_base *base, u8 dev)
 {
-       struct lpc32xx_i2c_registers *i2c = lpc32xx_i2c[adap->hwadapnr];
        int stat;
 
        /* Soft-reset the controller */
-       writel(LPC32XX_I2C_SOFT_RESET, &i2c->ctrl);
-       while (readl(&i2c->ctrl) & LPC32XX_I2C_SOFT_RESET)
+       writel(LPC32XX_I2C_SOFT_RESET, &base->ctrl);
+       while (readl(&base->ctrl) & LPC32XX_I2C_SOFT_RESET)
                ;
        /* Addre slave for write with start before and stop after */
        writel((dev<<1) | LPC32XX_I2C_TX_START | LPC32XX_I2C_TX_STOP,
-              &i2c->tx);
+              &base->tx);
        /* wait for end of transation */
-       while (!((stat = readl(&i2c->stat)) & LPC32XX_I2C_STAT_TDI))
+       while (!((stat = readl(&base->stat)) & LPC32XX_I2C_STAT_TDI))
                ;
        /* was there no acknowledge? */
        return (stat & LPC32XX_I2C_STAT_NAI) ? -1 : 0;
@@ -128,20 +108,19 @@ static int lpc32xx_i2c_probe(struct i2c_adapter *adap, u8 dev)
  * I2C read called by cmd_i2c when doing 'i2c read' and by cmd_eeprom.c
  * Begin write, send address byte(s), begin read, receive data bytes, end.
  */
-static int lpc32xx_i2c_read(struct i2c_adapter *adap, u8 dev, uint addr,
-                        int alen, u8 *data, int length)
+static int __i2c_read(struct lpc32xx_i2c_base *base, u8 dev, uint addr,
+                     int alen, u8 *data, int length)
 {
-       struct lpc32xx_i2c_registers *i2c = lpc32xx_i2c[adap->hwadapnr];
        int stat, wlen;
 
        /* Soft-reset the controller */
-       writel(LPC32XX_I2C_SOFT_RESET, &i2c->ctrl);
-       while (readl(&i2c->ctrl) & LPC32XX_I2C_SOFT_RESET)
+       writel(LPC32XX_I2C_SOFT_RESET, &base->ctrl);
+       while (readl(&base->ctrl) & LPC32XX_I2C_SOFT_RESET)
                ;
        /* do we need to write an address at all? */
        if (alen) {
                /* Address slave in write mode */
-               writel((dev<<1) | LPC32XX_I2C_TX_START, &i2c->tx);
+               writel((dev<<1) | LPC32XX_I2C_TX_START, &base->tx);
                /* write address bytes */
                while (alen--) {
                        /* compute address byte + stop for the last one */
@@ -149,44 +128,44 @@ static int lpc32xx_i2c_read(struct i2c_adapter *adap, u8 dev, uint addr,
                        if (!alen)
                                a |= LPC32XX_I2C_TX_STOP;
                        /* Send address byte */
-                       writel(a, &i2c->tx);
+                       writel(a, &base->tx);
                }
                /* wait for end of transation */
-               while (!((stat = readl(&i2c->stat)) & LPC32XX_I2C_STAT_TDI))
+               while (!((stat = readl(&base->stat)) & LPC32XX_I2C_STAT_TDI))
                        ;
                /* clear end-of-transaction flag */
-               writel(1, &i2c->stat);
+               writel(1, &base->stat);
        }
        /* do we have to read data at all? */
        if (length) {
                /* Address slave in read mode */
-               writel(1 | (dev<<1) | LPC32XX_I2C_TX_START, &i2c->tx);
+               writel(1 | (dev<<1) | LPC32XX_I2C_TX_START, &base->tx);
                wlen = length;
                /* get data */
                while (length | wlen) {
                        /* read status for TFF and RFE */
-                       stat = readl(&i2c->stat);
+                       stat = readl(&base->stat);
                        /* must we, can we write a trigger byte? */
                        if ((wlen > 0)
                           & (!(stat & LPC32XX_I2C_STAT_TFF))) {
                                wlen--;
                                /* write trigger byte + stop if last */
                                writel(wlen ? 0 :
-                               LPC32XX_I2C_TX_STOP, &i2c->tx);
+                               LPC32XX_I2C_TX_STOP, &base->tx);
                        }
                        /* must we, can we read a data byte? */
                        if ((length > 0)
                           & (!(stat & LPC32XX_I2C_STAT_RFE))) {
                                length--;
                                /* read byte */
-                               *(data++) = readl(&i2c->rx);
+                               *(data++) = readl(&base->rx);
                        }
                }
                /* wait for end of transation */
-               while (!((stat = readl(&i2c->stat)) & LPC32XX_I2C_STAT_TDI))
+               while (!((stat = readl(&base->stat)) & LPC32XX_I2C_STAT_TDI))
                        ;
                /* clear end-of-transaction flag */
-               writel(1, &i2c->stat);
+               writel(1, &base->stat);
        }
        /* success */
        return 0;
@@ -196,38 +175,37 @@ static int lpc32xx_i2c_read(struct i2c_adapter *adap, u8 dev, uint addr,
  * I2C write called by cmd_i2c when doing 'i2c write' and by cmd_eeprom.c
  * Begin write, send address byte(s), send data bytes, end.
  */
-static int lpc32xx_i2c_write(struct i2c_adapter *adap, u8 dev, uint addr,
-                         int alen, u8 *data, int length)
+static int __i2c_write(struct lpc32xx_i2c_base *base, u8 dev, uint addr,
+                      int alen, u8 *data, int length)
 {
-       struct lpc32xx_i2c_registers *i2c = lpc32xx_i2c[adap->hwadapnr];
        int stat;
 
        /* Soft-reset the controller */
-       writel(LPC32XX_I2C_SOFT_RESET, &i2c->ctrl);
-       while (readl(&i2c->ctrl) & LPC32XX_I2C_SOFT_RESET)
+       writel(LPC32XX_I2C_SOFT_RESET, &base->ctrl);
+       while (readl(&base->ctrl) & LPC32XX_I2C_SOFT_RESET)
                ;
        /* do we need to write anything at all? */
        if (alen | length)
                /* Address slave in write mode */
-               writel((dev<<1) | LPC32XX_I2C_TX_START, &i2c->tx);
+               writel((dev<<1) | LPC32XX_I2C_TX_START, &base->tx);
        else
                return 0;
        /* write address bytes */
        while (alen) {
                /* wait for transmit fifo not full */
-               stat = readl(&i2c->stat);
+               stat = readl(&base->stat);
                if (!(stat & LPC32XX_I2C_STAT_TFF)) {
                        alen--;
                        int a = (addr >> (8 * alen)) & 0xff;
                        if (!(alen | length))
                                a |= LPC32XX_I2C_TX_STOP;
                        /* Send address byte */
-                       writel(a, &i2c->tx);
+                       writel(a, &base->tx);
                }
        }
        while (length) {
                /* wait for transmit fifo not full */
-               stat = readl(&i2c->stat);
+               stat = readl(&base->stat);
                if (!(stat & LPC32XX_I2C_STAT_TFF)) {
                        /* compute data byte, add stop if length==0 */
                        length--;
@@ -235,34 +213,146 @@ static int lpc32xx_i2c_write(struct i2c_adapter *adap, u8 dev, uint addr,
                        if (!length)
                                d |= LPC32XX_I2C_TX_STOP;
                        /* Send data byte */
-                       writel(d, &i2c->tx);
+                       writel(d, &base->tx);
                }
        }
        /* wait for end of transation */
-       while (!((stat = readl(&i2c->stat)) & LPC32XX_I2C_STAT_TDI))
+       while (!((stat = readl(&base->stat)) & LPC32XX_I2C_STAT_TDI))
                ;
        /* clear end-of-transaction flag */
-       writel(1, &i2c->stat);
+       writel(1, &base->stat);
        return 0;
 }
 
-U_BOOT_I2C_ADAP_COMPLETE(lpc32xx_0, _i2c_init, lpc32xx_i2c_probe,
+#ifndef CONFIG_DM_I2C
+static void lpc32xx_i2c_init(struct i2c_adapter *adap,
+                            int requested_speed, int slaveadd)
+{
+       __i2c_init(lpc32xx_i2c[adap->hwadapnr], requested_speed, slaveadd,
+                  adap->hwadapnr);
+}
+
+static int lpc32xx_i2c_probe_chip(struct i2c_adapter *adap, u8 dev)
+{
+       return __i2c_probe_chip(lpc32xx_i2c[adap->hwadapnr], dev);
+}
+
+static int lpc32xx_i2c_read(struct i2c_adapter *adap, u8 dev, uint addr,
+                           int alen, u8 *data, int length)
+{
+       return __i2c_read(lpc32xx_i2c[adap->hwadapnr], dev, addr,
+                        alen, data, length);
+}
+
+static int lpc32xx_i2c_write(struct i2c_adapter *adap, u8 dev, uint addr,
+                            int alen, u8 *data, int length)
+{
+       return __i2c_write(lpc32xx_i2c[adap->hwadapnr], dev, addr,
+                         alen, data, length);
+}
+
+static unsigned int lpc32xx_i2c_set_bus_speed(struct i2c_adapter *adap,
+                                             unsigned int speed)
+{
+       return __i2c_set_bus_speed(lpc32xx_i2c[adap->hwadapnr], speed,
+                                 adap->hwadapnr);
+}
+
+U_BOOT_I2C_ADAP_COMPLETE(lpc32xx_0, lpc32xx_i2c_init, lpc32xx_i2c_probe_chip,
                         lpc32xx_i2c_read, lpc32xx_i2c_write,
                         lpc32xx_i2c_set_bus_speed,
                         CONFIG_SYS_I2C_LPC32XX_SPEED,
                         CONFIG_SYS_I2C_LPC32XX_SLAVE,
                         0)
 
-U_BOOT_I2C_ADAP_COMPLETE(lpc32xx_1, _i2c_init, lpc32xx_i2c_probe,
+U_BOOT_I2C_ADAP_COMPLETE(lpc32xx_1, lpc32xx_i2c_init, lpc32xx_i2c_probe_chip,
                         lpc32xx_i2c_read, lpc32xx_i2c_write,
                         lpc32xx_i2c_set_bus_speed,
                         CONFIG_SYS_I2C_LPC32XX_SPEED,
                         CONFIG_SYS_I2C_LPC32XX_SLAVE,
                         1)
 
-U_BOOT_I2C_ADAP_COMPLETE(lpc32xx_2, _i2c_init, NULL,
+U_BOOT_I2C_ADAP_COMPLETE(lpc32xx_2, lpc32xx_i2c_init, NULL,
                         lpc32xx_i2c_read, lpc32xx_i2c_write,
                         lpc32xx_i2c_set_bus_speed,
                         100000,
                         0,
                         2)
+#else /* CONFIG_DM_I2C */
+static int lpc32xx_i2c_probe(struct udevice *bus)
+{
+       struct lpc32xx_i2c_dev *dev = dev_get_platdata(bus);
+       bus->seq = dev->index;
+
+       __i2c_init(dev->base, dev->speed, 0, dev->index);
+       return 0;
+}
+
+static int lpc32xx_i2c_probe_chip(struct udevice *bus, u32 chip_addr,
+                                 u32 chip_flags)
+{
+       struct lpc32xx_i2c_dev *dev = dev_get_platdata(bus);
+       return __i2c_probe_chip(dev->base, chip_addr);
+}
+
+static int lpc32xx_i2c_xfer(struct udevice *bus, struct i2c_msg *msg,
+               int nmsgs)
+{
+       struct lpc32xx_i2c_dev *dev = dev_get_platdata(bus);
+       struct i2c_msg *dmsg, *omsg, dummy;
+       uint i = 0, address = 0;
+
+       memset(&dummy, 0, sizeof(struct i2c_msg));
+
+       /* We expect either two messages (one with an offset and one with the
+        * actual data) or one message (just data)
+        */
+       if (nmsgs > 2 || nmsgs == 0) {
+               debug("%s: Only one or two messages are supported.", __func__);
+               return -1;
+       }
+
+       omsg = nmsgs == 1 ? &dummy : msg;
+       dmsg = nmsgs == 1 ? msg : msg + 1;
+
+       /* the address is expected to be a uint, not a array. */
+       address = omsg->buf[0];
+       for (i = 1; i < omsg->len; i++)
+               address = (address << 8) + omsg->buf[i];
+
+       if (dmsg->flags & I2C_M_RD)
+               return __i2c_read(dev->base, dmsg->addr, address,
+                                 omsg->len, dmsg->buf, dmsg->len);
+       else
+               return __i2c_write(dev->base, dmsg->addr, address,
+                                  omsg->len, dmsg->buf, dmsg->len);
+}
+
+static int lpc32xx_i2c_set_bus_speed(struct udevice *bus, unsigned int speed)
+{
+       struct lpc32xx_i2c_dev *dev = dev_get_platdata(bus);
+       return __i2c_set_bus_speed(dev->base, speed, dev->index);
+}
+
+static int lpc32xx_i2c_reset(struct udevice *bus)
+{
+       struct lpc32xx_i2c_dev *dev = dev_get_platdata(bus);
+
+       __i2c_init(dev->base, dev->speed, 0, dev->index);
+       return 0;
+}
+
+static const struct dm_i2c_ops lpc32xx_i2c_ops = {
+       .xfer          = lpc32xx_i2c_xfer,
+       .probe_chip    = lpc32xx_i2c_probe_chip,
+       .deblock       = lpc32xx_i2c_reset,
+       .set_bus_speed = lpc32xx_i2c_set_bus_speed,
+};
+
+U_BOOT_DRIVER(i2c_lpc32xx) = {
+       .id                   = UCLASS_I2C,
+       .name                 = "i2c_lpc32xx",
+       .probe                = lpc32xx_i2c_probe,
+       .ops                  = &lpc32xx_i2c_ops,
+};
+#endif /* CONFIG_DM_I2C */
index 00063431040313e5240c096e9f4fb7349acd2cf9..26996e9db933fd3a5679cf009186f7e71e6284bf 100644 (file)
@@ -64,36 +64,52 @@ struct omap_i2c {
 
 static int omap24_i2c_findpsc(u32 *pscl, u32 *psch, uint speed)
 {
-       unsigned int sampleclk, prescaler;
-       int fsscll, fssclh;
+       unsigned long internal_clk = 0, fclk;
+       unsigned int prescaler;
 
-       speed <<= 1;
-       prescaler = 0;
        /*
-        * some divisors may cause a precission loss, but shouldn't
-        * be a big thing, because i2c_clk is then allready very slow.
+        * This method is only called for Standard and Fast Mode speeds
+        *
+        * For some TI SoCs it is explicitly written in TRM (e,g, SPRUHZ6G,
+        * page 5685, Table 24-7)
+        * that the internal I2C clock (after prescaler) should be between
+        * 7-12 MHz (at least for Fast Mode (FS)).
+        *
+        * Such approach is used in v4.9 Linux kernel in:
+        * ./drivers/i2c/busses/i2c-omap.c (omap_i2c_init function).
         */
-       while (prescaler <= 0xFF) {
-               sampleclk = I2C_IP_CLK / (prescaler+1);
 
-               fsscll = sampleclk / speed;
-               fssclh = fsscll;
-               fsscll -= I2C_FASTSPEED_SCLL_TRIM;
-               fssclh -= I2C_FASTSPEED_SCLH_TRIM;
-
-               if (((fsscll > 0) && (fssclh > 0)) &&
-                   ((fsscll <= (255-I2C_FASTSPEED_SCLL_TRIM)) &&
-                   (fssclh <= (255-I2C_FASTSPEED_SCLH_TRIM)))) {
-                       if (pscl)
-                               *pscl = fsscll;
-                       if (psch)
-                               *psch = fssclh;
-
-                       return prescaler;
-               }
-               prescaler++;
+       speed /= 1000; /* convert speed to kHz */
+
+       if (speed > 100)
+               internal_clk = 9600;
+       else
+               internal_clk = 4000;
+
+       fclk = I2C_IP_CLK / 1000;
+       prescaler = fclk / internal_clk;
+       prescaler = prescaler - 1;
+
+       if (speed > 100) {
+               unsigned long scl;
+
+               /* Fast mode */
+               scl = internal_clk / speed;
+               *pscl = scl - (scl / 3) - I2C_FASTSPEED_SCLL_TRIM;
+               *psch = (scl / 3) - I2C_FASTSPEED_SCLH_TRIM;
+       } else {
+               /* Standard mode */
+               *pscl = internal_clk / (speed * 2) - I2C_FASTSPEED_SCLL_TRIM;
+               *psch = internal_clk / (speed * 2) - I2C_FASTSPEED_SCLH_TRIM;
        }
-       return -1;
+
+       debug("%s: speed [kHz]: %d psc: 0x%x sscl: 0x%x ssch: 0x%x\n",
+             __func__, speed, prescaler, *pscl, *psch);
+
+       if (*pscl <= 0 || *psch <= 0 || prescaler <= 0)
+               return -EINVAL;
+
+       return prescaler;
 }
 
 /*
index 3dae295e55edaddd95110dfe65b52a0f5c045c8d..8a4ae9847c5c80fcf70b3944fe1c80754780a8fe 100644 (file)
  * scll_trim = 7
  * sclh_trim = 5
  *
- * The linux 2.6.30 kernel uses
- * scll_trim = 6
- * sclh_trim = 6
+ * The linux 4.9 kernel uses
+ * scll_trim = 7
+ * sclh_trim = 5
  *
  * These are the trim values for standard and fast speed
  */
 #ifndef I2C_FASTSPEED_SCLL_TRIM
-#define I2C_FASTSPEED_SCLL_TRIM                6
+#define I2C_FASTSPEED_SCLL_TRIM                7
 #endif
 #ifndef I2C_FASTSPEED_SCLH_TRIM
-#define I2C_FASTSPEED_SCLH_TRIM                6
+#define I2C_FASTSPEED_SCLH_TRIM                5
 #endif
 
 /* These are the trim values for high speed */
index 05512412b9404a886f5c4457ea43527c16d909aa..168bac6055dea6be0b64ebcac20c0136f3e15bab 100644 (file)
@@ -131,8 +131,23 @@ static void create_mtd_concat(void)
 }
 #endif
 
+unsigned long nand_size(void)
+{
+       return total_nand_size;
+}
+
 void nand_init(void)
 {
+       static int initialized;
+
+       /*
+        * Avoid initializing NAND Flash multiple times,
+        * otherwise it will calculate a wrong total size.
+        */
+       if (initialized)
+               return;
+       initialized = 1;
+
 #ifdef CONFIG_SYS_NAND_SELF_INIT
        board_nand_init();
 #else
@@ -142,8 +157,6 @@ void nand_init(void)
                nand_init_chip(i);
 #endif
 
-       printf("%lu MiB\n", total_nand_size / 1024);
-
 #ifdef CONFIG_SYS_NAND_SELECT_DEVICE
        /*
         * Select the chip in the board/cpu specific driver
index f2853cfad250715eeb21022eb55723bc55016ef5..9ff72fa1edc7d5d1ba19299289a81abc851621d1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2014 Broadcom Corporation.
+ * Copyright 2014-2017 Broadcom.
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
        } \
 }
 
+#define RX_BUF_SIZE_ALIGNED    ALIGN(RX_BUF_SIZE, ARCH_DMA_MINALIGN)
+#define TX_BUF_SIZE_ALIGNED    ALIGN(TX_BUF_SIZE, ARCH_DMA_MINALIGN)
+#define DESCP_SIZE_ALIGNED     ALIGN(sizeof(dma64dd_t), ARCH_DMA_MINALIGN)
+
 static int gmac_disable_dma(struct eth_dma *dma, int dir);
 static int gmac_enable_dma(struct eth_dma *dma, int dir);
 
@@ -114,7 +118,7 @@ static void dma_tx_dump(struct eth_dma *dma)
        printf("TX Buffers:\n");
        /* Initialize TX DMA descriptor table */
        for (i = 0; i < TX_BUF_NUM; i++) {
-               bufp = (uint8_t *)(dma->tx_buf + i * TX_BUF_SIZE);
+               bufp = (uint8_t *)(dma->tx_buf + i * TX_BUF_SIZE_ALIGNED);
                printf("buf%d:0x%x; ", i, (uint32_t)bufp);
        }
        printf("\n");
@@ -145,7 +149,7 @@ static void dma_rx_dump(struct eth_dma *dma)
 
        printf("RX Buffers:\n");
        for (i = 0; i < RX_BUF_NUM; i++) {
-               bufp = dma->rx_buf + i * RX_BUF_SIZE;
+               bufp = dma->rx_buf + i * RX_BUF_SIZE_ALIGNED;
                printf("buf%d:0x%x; ", i, (uint32_t)bufp);
        }
        printf("\n");
@@ -163,15 +167,15 @@ static int dma_tx_init(struct eth_dma *dma)
 
        /* clear descriptor memory */
        memset((void *)(dma->tx_desc_aligned), 0,
-              TX_BUF_NUM * sizeof(dma64dd_t));
-       memset(dma->tx_buf, 0, TX_BUF_NUM * TX_BUF_SIZE);
+              TX_BUF_NUM * DESCP_SIZE_ALIGNED);
+       memset(dma->tx_buf, 0, TX_BUF_NUM * TX_BUF_SIZE_ALIGNED);
 
        /* Initialize TX DMA descriptor table */
        for (i = 0; i < TX_BUF_NUM; i++) {
                descp = (dma64dd_t *)(dma->tx_desc_aligned) + i;
-               bufp = dma->tx_buf + i * TX_BUF_SIZE;
+               bufp = dma->tx_buf + i * TX_BUF_SIZE_ALIGNED;
                /* clear buffer memory */
-               memset((void *)bufp, 0, TX_BUF_SIZE);
+               memset((void *)bufp, 0, TX_BUF_SIZE_ALIGNED);
 
                ctrl = 0;
                /* if last descr set endOfTable */
@@ -187,10 +191,11 @@ static int dma_tx_init(struct eth_dma *dma)
        descp = dma->tx_desc_aligned;
        bufp = dma->tx_buf;
        flush_dcache_range((unsigned long)descp,
-                          (unsigned long)(descp +
-                                          sizeof(dma64dd_t) * TX_BUF_NUM));
-       flush_dcache_range((unsigned long)(bufp),
-                          (unsigned long)(bufp + TX_BUF_SIZE * TX_BUF_NUM));
+                          (unsigned long)descp +
+                          DESCP_SIZE_ALIGNED * TX_BUF_NUM);
+       flush_dcache_range((unsigned long)bufp,
+                          (unsigned long)bufp +
+                          TX_BUF_SIZE_ALIGNED * TX_BUF_NUM);
 
        /* initialize the DMA channel */
        writel((uint32_t)(dma->tx_desc_aligned), GMAC0_DMA_TX_ADDR_LOW_ADDR);
@@ -215,20 +220,20 @@ static int dma_rx_init(struct eth_dma *dma)
 
        /* clear descriptor memory */
        memset((void *)(dma->rx_desc_aligned), 0,
-              RX_BUF_NUM * sizeof(dma64dd_t));
+              RX_BUF_NUM * DESCP_SIZE_ALIGNED);
        /* clear buffer memory */
-       memset(dma->rx_buf, 0, RX_BUF_NUM * RX_BUF_SIZE);
+       memset(dma->rx_buf, 0, RX_BUF_NUM * RX_BUF_SIZE_ALIGNED);
 
        /* Initialize RX DMA descriptor table */
        for (i = 0; i < RX_BUF_NUM; i++) {
                descp = (dma64dd_t *)(dma->rx_desc_aligned) + i;
-               bufp = dma->rx_buf + i * RX_BUF_SIZE;
+               bufp = dma->rx_buf + i * RX_BUF_SIZE_ALIGNED;
                ctrl = 0;
                /* if last descr set endOfTable */
                if (i == (RX_BUF_NUM - 1))
                        ctrl = D64_CTRL1_EOT;
                descp->ctrl1 = ctrl;
-               descp->ctrl2 = RX_BUF_SIZE;
+               descp->ctrl2 = RX_BUF_SIZE_ALIGNED;
                descp->addrlow = (uint32_t)bufp;
                descp->addrhigh = 0;
 
@@ -240,10 +245,11 @@ static int dma_rx_init(struct eth_dma *dma)
        bufp = dma->rx_buf;
        /* flush descriptor and buffer */
        flush_dcache_range((unsigned long)descp,
-                          (unsigned long)(descp +
-                                          sizeof(dma64dd_t) * RX_BUF_NUM));
+                          (unsigned long)descp +
+                          DESCP_SIZE_ALIGNED * RX_BUF_NUM);
        flush_dcache_range((unsigned long)(bufp),
-                          (unsigned long)(bufp + RX_BUF_SIZE * RX_BUF_NUM));
+                          (unsigned long)bufp +
+                          RX_BUF_SIZE_ALIGNED * RX_BUF_NUM);
 
        /* initailize the DMA channel */
        writel((uint32_t)descp, GMAC0_DMA_RX_ADDR_LOW_ADDR);
@@ -292,14 +298,12 @@ static int dma_deinit(struct eth_dma *dma)
 
        free(dma->tx_buf);
        dma->tx_buf = NULL;
-       free(dma->tx_desc);
-       dma->tx_desc = NULL;
+       free(dma->tx_desc_aligned);
        dma->tx_desc_aligned = NULL;
 
        free(dma->rx_buf);
        dma->rx_buf = NULL;
-       free(dma->rx_desc);
-       dma->rx_desc = NULL;
+       free(dma->rx_desc_aligned);
        dma->rx_desc_aligned = NULL;
 
        return 0;
@@ -307,7 +311,7 @@ static int dma_deinit(struct eth_dma *dma)
 
 int gmac_tx_packet(struct eth_dma *dma, void *packet, int length)
 {
-       uint8_t *bufp = dma->tx_buf + dma->cur_tx_index * TX_BUF_SIZE;
+       uint8_t *bufp = dma->tx_buf + dma->cur_tx_index * TX_BUF_SIZE_ALIGNED;
 
        /* kick off the dma */
        size_t len = length;
@@ -348,10 +352,11 @@ int gmac_tx_packet(struct eth_dma *dma, void *packet, int length)
        descp->ctrl2 = ctrl;
 
        /* flush descriptor and buffer */
-       flush_dcache_range((unsigned long)descp,
-                          (unsigned long)(descp + sizeof(dma64dd_t)));
+       flush_dcache_range((unsigned long)dma->tx_desc_aligned,
+                          (unsigned long)dma->tx_desc_aligned +
+                          DESCP_SIZE_ALIGNED * TX_BUF_NUM);
        flush_dcache_range((unsigned long)bufp,
-                          (unsigned long)(bufp + TX_BUF_SIZE));
+                          (unsigned long)bufp + TX_BUF_SIZE_ALIGNED);
 
        /* now update the dma last descriptor */
        writel(last_desc, GMAC0_DMA_TX_PTR_ADDR);
@@ -426,14 +431,15 @@ int gmac_check_rx_done(struct eth_dma *dma, uint8_t *buf)
                ;
 
        /* get the packet pointer that corresponds to the rx descriptor */
-       bufp = dma->rx_buf + index * RX_BUF_SIZE;
+       bufp = dma->rx_buf + index * RX_BUF_SIZE_ALIGNED;
 
        descp = (dma64dd_t *)(dma->rx_desc_aligned) + index;
        /* flush descriptor and buffer */
-       flush_dcache_range((unsigned long)descp,
-                          (unsigned long)(descp + sizeof(dma64dd_t)));
+       flush_dcache_range((unsigned long)dma->rx_desc_aligned,
+                          (unsigned long)dma->rx_desc_aligned +
+                          DESCP_SIZE_ALIGNED * RX_BUF_NUM);
        flush_dcache_range((unsigned long)bufp,
-                          (unsigned long)(bufp + RX_BUF_SIZE));
+                          (unsigned long)bufp + RX_BUF_SIZE_ALIGNED);
 
        buflen = (descp->ctrl2 & D64_CTRL2_BC_MASK);
 
@@ -457,12 +463,13 @@ int gmac_check_rx_done(struct eth_dma *dma, uint8_t *buf)
        memcpy(buf, datap, rcvlen);
 
        /* update descriptor that is being added back on ring */
-       descp->ctrl2 = RX_BUF_SIZE;
+       descp->ctrl2 = RX_BUF_SIZE_ALIGNED;
        descp->addrlow = (uint32_t)bufp;
        descp->addrhigh = 0;
        /* flush descriptor */
-       flush_dcache_range((unsigned long)descp,
-                          (unsigned long)(descp + sizeof(dma64dd_t)));
+       flush_dcache_range((unsigned long)dma->rx_desc_aligned,
+                          (unsigned long)dma->rx_desc_aligned +
+                          DESCP_SIZE_ALIGNED * RX_BUF_NUM);
 
        /* set the lastdscr for the rx ring */
        writel(((uint32_t)descp) & D64_XP_LD_MASK, GMAC0_DMA_RX_PTR_ADDR);
@@ -573,7 +580,7 @@ static int gmac_enable_dma(struct eth_dma *dma, int dir)
                 * set the lastdscr for the rx ring
                 */
                writel(((uint32_t)(dma->rx_desc_aligned) +
-                       (RX_BUF_NUM - 1) * RX_BUF_SIZE) &
+                       (RX_BUF_NUM - 1) * RX_BUF_SIZE_ALIGNED) &
                       D64_XP_LD_MASK, GMAC0_DMA_RX_PTR_ADDR);
        }
 
@@ -893,54 +900,52 @@ int gmac_add(struct eth_device *dev)
        void *tmp;
 
        /*
-        * Desc has to be 16-byte aligned ?
-        * If it is 8-byte aligned by malloc, fail Tx
+        * Desc has to be 16-byte aligned. But for dcache flush it must be
+        * aligned to ARCH_DMA_MINALIGN.
         */
-       tmp = malloc(sizeof(dma64dd_t) * TX_BUF_NUM + 8);
+       tmp = memalign(ARCH_DMA_MINALIGN, DESCP_SIZE_ALIGNED * TX_BUF_NUM);
        if (tmp == NULL) {
                printf("%s: Failed to allocate TX desc Buffer\n", __func__);
                return -1;
        }
 
-       dma->tx_desc = (void *)tmp;
-       dma->tx_desc_aligned = (void *)(((uint32_t)tmp) & (~0xf));
+       dma->tx_desc_aligned = (void *)tmp;
        debug("TX Descriptor Buffer: %p; length: 0x%x\n",
-             dma->tx_desc_aligned, sizeof(dma64dd_t) * TX_BUF_NUM);
+             dma->tx_desc_aligned, DESCP_SIZE_ALIGNED * TX_BUF_NUM);
 
-       tmp = malloc(TX_BUF_SIZE * TX_BUF_NUM);
+       tmp = memalign(ARCH_DMA_MINALIGN, TX_BUF_SIZE_ALIGNED * TX_BUF_NUM);
        if (tmp == NULL) {
                printf("%s: Failed to allocate TX Data Buffer\n", __func__);
-               free(dma->tx_desc);
+               free(dma->tx_desc_aligned);
                return -1;
        }
        dma->tx_buf = (uint8_t *)tmp;
        debug("TX Data Buffer: %p; length: 0x%x\n",
-             dma->tx_buf, TX_BUF_SIZE * TX_BUF_NUM);
+             dma->tx_buf, TX_BUF_SIZE_ALIGNED * TX_BUF_NUM);
 
-       /* Desc has to be 16-byte aligned */
-       tmp = malloc(sizeof(dma64dd_t) * RX_BUF_NUM + 8);
+       /* Desc has to be 16-byte aligned */
+       tmp = memalign(ARCH_DMA_MINALIGN, DESCP_SIZE_ALIGNED * RX_BUF_NUM);
        if (tmp == NULL) {
                printf("%s: Failed to allocate RX Descriptor\n", __func__);
-               free(dma->tx_desc);
+               free(dma->tx_desc_aligned);
                free(dma->tx_buf);
                return -1;
        }
-       dma->rx_desc = tmp;
-       dma->rx_desc_aligned = (void *)(((uint32_t)tmp) & (~0xf));
+       dma->rx_desc_aligned = (void *)tmp;
        debug("RX Descriptor Buffer: %p, length: 0x%x\n",
-             dma->rx_desc_aligned, sizeof(dma64dd_t) * RX_BUF_NUM);
+             dma->rx_desc_aligned, DESCP_SIZE_ALIGNED * RX_BUF_NUM);
 
-       tmp = malloc(RX_BUF_SIZE * RX_BUF_NUM);
+       tmp = memalign(ARCH_DMA_MINALIGN, RX_BUF_SIZE_ALIGNED * RX_BUF_NUM);
        if (tmp == NULL) {
                printf("%s: Failed to allocate RX Data Buffer\n", __func__);
-               free(dma->tx_desc);
+               free(dma->tx_desc_aligned);
                free(dma->tx_buf);
-               free(dma->rx_desc);
+               free(dma->rx_desc_aligned);
                return -1;
        }
-       dma->rx_buf = tmp;
+       dma->rx_buf = (uint8_t *)tmp;
        debug("RX Data Buffer: %p; length: 0x%x\n",
-             dma->rx_buf, RX_BUF_SIZE * RX_BUF_NUM);
+             dma->rx_buf, RX_BUF_SIZE_ALIGNED * RX_BUF_NUM);
 
        g_dmactrlflags = 0;
 
index 6104affc51c226bad0c6339c45543f6d59a42131..c4e2e01003432efaf2eda169aacdb158040b56a8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2014 Broadcom Corporation.
+ * Copyright 2014-2017 Broadcom.
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
@@ -30,8 +30,6 @@ enum {
 struct eth_dma {
        void *tx_desc_aligned;
        void *rx_desc_aligned;
-       void *tx_desc;
-       void *rx_desc;
 
        uint8_t *tx_buf;
        uint8_t *rx_buf;
index 93ed4f18fe989cad37e8a85b24245faa4352b2ee..673e428a403720513df415609fc0302a89255884 100644 (file)
@@ -79,3 +79,33 @@ phy_interface_t wriop_dpmac_enet_if(int dpmac_id, int lane_prtcl)
 
        return PHY_INTERFACE_MODE_NONE;
 }
+
+void wriop_init_dpmac_qsgmii(int sd, int lane_prtcl)
+{
+       switch (lane_prtcl) {
+       case QSGMII_A:
+               wriop_init_dpmac(sd, 5, (int)lane_prtcl);
+               wriop_init_dpmac(sd, 6, (int)lane_prtcl);
+               wriop_init_dpmac(sd, 7, (int)lane_prtcl);
+               wriop_init_dpmac(sd, 8, (int)lane_prtcl);
+               break;
+       case QSGMII_B:
+               wriop_init_dpmac(sd, 1, (int)lane_prtcl);
+               wriop_init_dpmac(sd, 2, (int)lane_prtcl);
+               wriop_init_dpmac(sd, 3, (int)lane_prtcl);
+               wriop_init_dpmac(sd, 4, (int)lane_prtcl);
+               break;
+       case QSGMII_C:
+               wriop_init_dpmac(sd, 13, (int)lane_prtcl);
+               wriop_init_dpmac(sd, 14, (int)lane_prtcl);
+               wriop_init_dpmac(sd, 15, (int)lane_prtcl);
+               wriop_init_dpmac(sd, 16, (int)lane_prtcl);
+               break;
+       case QSGMII_D:
+               wriop_init_dpmac(sd, 9, (int)lane_prtcl);
+               wriop_init_dpmac(sd, 10, (int)lane_prtcl);
+               wriop_init_dpmac(sd, 11, (int)lane_prtcl);
+               wriop_init_dpmac(sd, 12, (int)lane_prtcl);
+               break;
+       }
+}
index 1d514e92d3b677b597b1cb7bd02a49c6b24c06cb..e562a8ac1a77852c4cf7094c6e17e1966bd55bc0 100644 (file)
@@ -90,4 +90,14 @@ config PHY_VITESSE
 config PHY_XILINX
        bool "Xilinx Ethernet PHYs support"
 
+config PHY_FIXED
+       bool "Fixed-Link PHY"
+       depends on DM_ETH
+       help
+         Fixed PHY is used for having a 'fixed-link' to another MAC with a direct
+         connection (MII, RGMII, ...).
+         There is nothing like autoneogation and so
+         on, the link is always up with fixed speed and fixed duplex-setting.
+         More information: doc/device-tree-bindings/net/fixed-link.txt
+
 endif #PHYLIB
index d37297122add80b173f56cf1e7c5cbd0da37d38f..88c00a5cd3568ea534917c715f7f87437689e490 100644 (file)
@@ -28,3 +28,4 @@ obj-$(CONFIG_PHY_TI) += ti.o
 obj-$(CONFIG_PHY_XILINX) += xilinx_phy.o
 obj-$(CONFIG_PHY_VITESSE) += vitesse.o
 obj-$(CONFIG_PHY_MSCC) += mscc.o
+obj-$(CONFIG_PHY_FIXED) += fixed.o
diff --git a/drivers/net/phy/fixed.c b/drivers/net/phy/fixed.c
new file mode 100644 (file)
index 0000000..df82356
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+ * Fixed-Link phy
+ *
+ * Copyright 2017 Bernecker & Rainer Industrieelektronik GmbH
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <config.h>
+#include <common.h>
+#include <phy.h>
+#include <dm.h>
+#include <fdt_support.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int fixedphy_probe(struct phy_device *phydev)
+{
+       struct fixed_link *priv;
+       int ofnode = phydev->addr;
+       u32 val;
+
+       /* check for mandatory properties within fixed-link node */
+       val = fdt_getprop_u32_default_node(gd->fdt_blob,
+                                          ofnode, 0, "speed", 0);
+       if (val != SPEED_10 && val != SPEED_100 && val != SPEED_1000) {
+               printf("ERROR: no/invalid speed given in fixed-link node!");
+               return -EINVAL;
+       }
+
+       priv = malloc(sizeof(*priv));
+       if (!priv)
+               return -ENOMEM;
+       memset(priv, 0, sizeof(*priv));
+
+       phydev->priv = priv;
+       phydev->addr = 0;
+
+       priv->link_speed = val;
+       priv->duplex = fdtdec_get_bool(gd->fdt_blob, ofnode, "full-duplex");
+       priv->pause = fdtdec_get_bool(gd->fdt_blob, ofnode, "pause");
+       priv->asym_pause = fdtdec_get_bool(gd->fdt_blob, ofnode, "asym-pause");
+
+       /* fixed-link phy must not be reset by core phy code */
+       phydev->flags |= PHY_FLAG_BROKEN_RESET;
+
+       return 0;
+}
+
+int fixedphy_startup(struct phy_device *phydev)
+{
+       struct fixed_link *priv = phydev->priv;
+
+       phydev->asym_pause = priv->asym_pause;
+       phydev->pause = priv->pause;
+       phydev->duplex = priv->duplex;
+       phydev->speed = priv->link_speed;
+       phydev->link = 1;
+
+       return 0;
+}
+
+int fixedphy_shutdown(struct phy_device *phydev)
+{
+       return 0;
+}
+
+static struct phy_driver fixedphy_driver = {
+       .uid            = PHY_FIXED_ID,
+       .mask           = 0xffffffff,
+       .name           = "Fixed PHY",
+       .features       = PHY_GBIT_FEATURES | SUPPORTED_MII,
+       .probe          = fixedphy_probe,
+       .startup        = fixedphy_startup,
+       .shutdown       = fixedphy_shutdown,
+};
+
+int phy_fixed_init(void)
+{
+       phy_register(&fixedphy_driver);
+       return 0;
+}
index 8db65749b11b8fca3aba00b96458696eb19c3997..8bacd991ad570929b0c0869718306cc9691fece8 100644 (file)
@@ -515,7 +515,9 @@ int phy_init(void)
 #ifdef CONFIG_PHY_MSCC
        phy_mscc_init();
 #endif
-
+#ifdef CONFIG_PHY_FIXED
+       phy_fixed_init();
+#endif
        return 0;
 }
 
@@ -854,9 +856,24 @@ struct phy_device *phy_connect(struct mii_dev *bus, int addr,
                struct eth_device *dev, phy_interface_t interface)
 #endif
 {
-       struct phy_device *phydev;
+       struct phy_device *phydev = NULL;
+#ifdef CONFIG_PHY_FIXED
+       int sn;
+       const char *name;
+       sn = fdt_first_subnode(gd->fdt_blob, dev->of_offset);
+       while (sn > 0) {
+               name = fdt_get_name(gd->fdt_blob, sn, NULL);
+               if (name != NULL && strcmp(name, "fixed-link") == 0) {
+                       phydev = phy_device_create(bus,
+                                                  sn, PHY_FIXED_ID, interface);
+                       break;
+               }
+               sn = fdt_next_subnode(gd->fdt_blob, sn);
+       }
+#endif
+       if (phydev == NULL)
+               phydev = phy_find_by_mask(bus, 1 << addr, interface);
 
-       phydev = phy_find_by_mask(bus, 1 << addr, interface);
        if (phydev)
                phy_connect_dev(phydev, dev);
        else
index 11cd0ea06888ba8e271b0c10376306df5291a3e2..99339db4bf58b9ff812d69faf134a802dba305fc 100644 (file)
@@ -327,6 +327,20 @@ static void emac_reset(struct emac_eth_dev *priv)
        udelay(200);
 }
 
+static int _sunxi_write_hwaddr(struct emac_eth_dev *priv, u8 *enetaddr)
+{
+       struct emac_regs *regs = priv->regs;
+       u32 enetaddr_lo, enetaddr_hi;
+
+       enetaddr_lo = enetaddr[2] | (enetaddr[1] << 8) | (enetaddr[0] << 16);
+       enetaddr_hi = enetaddr[5] | (enetaddr[4] << 8) | (enetaddr[3] << 16);
+
+       writel(enetaddr_hi, &regs->mac_a1);
+       writel(enetaddr_lo, &regs->mac_a0);
+
+       return 0;
+}
+
 static int _sunxi_emac_eth_init(struct emac_eth_dev *priv, u8 *enetaddr)
 {
        struct emac_regs *regs = priv->regs;
@@ -350,10 +364,7 @@ static int _sunxi_emac_eth_init(struct emac_eth_dev *priv, u8 *enetaddr)
        /* Set up EMAC */
        emac_setup(priv);
 
-       writel(enetaddr[0] << 16 | enetaddr[1] << 8 | enetaddr[2],
-              &regs->mac_a1);
-       writel(enetaddr[3] << 16 | enetaddr[4] << 8 | enetaddr[5],
-              &regs->mac_a0);
+       _sunxi_write_hwaddr(priv, enetaddr);
 
        mdelay(1);
 
index b6806cf67b69bae3f5babaf5a94ffe8d88949fbc..1c5a33ac2835275f84a73fb299f0c4f24caf5fe7 100644 (file)
@@ -167,6 +167,27 @@ static void ls_pcie_setup_atu(struct ls_pcie *pcie)
        pci_get_regions(pcie->bus, &io, &mem, &pref);
        idx = PCIE_ATU_REGION_INDEX1 + 1;
 
+       /* Fix the pcie memory map for LS2088A series SoCs */
+       svr = (svr >> SVR_VAR_PER_SHIFT) & 0xFFFFFE;
+       if (svr == SVR_LS2088A || svr == SVR_LS2084A ||
+           svr == SVR_LS2048A || svr == SVR_LS2044A) {
+               if (io)
+                       io->phys_start = (io->phys_start &
+                                        (PCIE_PHYS_SIZE - 1)) +
+                                        LS2088A_PCIE1_PHYS_ADDR +
+                                        LS2088A_PCIE_PHYS_SIZE * pcie->idx;
+               if (mem)
+                       mem->phys_start = (mem->phys_start &
+                                        (PCIE_PHYS_SIZE - 1)) +
+                                        LS2088A_PCIE1_PHYS_ADDR +
+                                        LS2088A_PCIE_PHYS_SIZE * pcie->idx;
+               if (pref)
+                       pref->phys_start = (pref->phys_start &
+                                        (PCIE_PHYS_SIZE - 1)) +
+                                        LS2088A_PCIE1_PHYS_ADDR +
+                                        LS2088A_PCIE_PHYS_SIZE * pcie->idx;
+       }
+
        if (io)
                /* ATU : OUTBOUND : IO */
                ls_pcie_atu_outbound_set(pcie, idx++,
@@ -409,6 +430,11 @@ static void ls_pcie_ep_setup_bars(void *bar_base)
        ls_pcie_ep_setup_bar(bar_base, 4, PCIE_BAR4_SIZE);
 }
 
+static void ls_pcie_ep_enable_cfg(struct ls_pcie *pcie)
+{
+       ctrl_writel(pcie, PCIE_CONFIG_READY, PCIE_PF_CONFIG);
+}
+
 static void ls_pcie_setup_ep(struct ls_pcie *pcie)
 {
        u32 sriov;
@@ -432,6 +458,8 @@ static void ls_pcie_setup_ep(struct ls_pcie *pcie)
                ls_pcie_ep_setup_bars(pcie->dbi + PCIE_NO_SRIOV_BAR_BASE);
                ls_pcie_ep_setup_atu(pcie);
        }
+
+       ls_pcie_ep_enable_cfg(pcie);
 }
 
 static int ls_pcie_probe(struct udevice *dev)
@@ -442,6 +470,7 @@ static int ls_pcie_probe(struct udevice *dev)
        u8 header_type;
        u16 link_sta;
        bool ep_mode;
+       uint svr;
        int ret;
 
        pcie->bus = dev;
@@ -495,6 +524,19 @@ static int ls_pcie_probe(struct udevice *dev)
                return ret;
        }
 
+       /*
+        * Fix the pcie memory map address and PF control registers address
+        * for LS2088A series SoCs
+        */
+       svr = get_svr();
+       svr = (svr >> SVR_VAR_PER_SHIFT) & 0xFFFFFE;
+       if (svr == SVR_LS2088A || svr == SVR_LS2084A ||
+           svr == SVR_LS2048A || svr == SVR_LS2044A) {
+               pcie->cfg_res.start = LS2088A_PCIE1_PHYS_ADDR +
+                                       LS2088A_PCIE_PHYS_SIZE * pcie->idx;
+               pcie->ctrl = pcie->lut + 0x40000;
+       }
+
        pcie->cfg0 = map_physmem(pcie->cfg_res.start,
                                 fdt_resource_size(&pcie->cfg_res),
                                 MAP_NOCACHE);
index 1e635ef1f28c2e23ea3dc9f53d46daf241067708..e3324a5e52c41d80ab86ac59da79e3b88b74afa3 100644 (file)
 #define CONFIG_SYS_PCI_EP_MEMORY_BASE CONFIG_SYS_LOAD_ADDR
 #endif
 
+#define PCIE_PHYS_SIZE                 0x200000000
+#define LS2088A_PCIE_PHYS_SIZE         0x800000000
+#define LS2088A_PCIE1_PHYS_ADDR                0x2000000000
+
 /* iATU registers */
 #define PCIE_ATU_VIEWPORT              0x900
 #define PCIE_ATU_REGION_INBOUND                (0x1 << 31)
 #define PCIE_LUT_ENTRY_COUNT   32
 
 /* PF Controll registers */
+#define PCIE_PF_CONFIG         0x14
 #define PCIE_PF_VF_CTRL                0x7F8
 #define PCIE_PF_DBG            0x7FC
+#define PCIE_CONFIG_READY      (1 << 0)
 
 #define PCIE_SRDS_PRTCL(idx)   (PCIE1 + (idx))
 #define PCIE_SYS_BASE_ADDR     0x3400000
 #define SVR_LS102XA            0
 #define SVR_VAR_PER_SHIFT      8
 #define SVR_LS102XA_MASK       0x700
+#define SVR_LS2088A            0x870900
+#define SVR_LS2084A            0x870910
+#define SVR_LS2048A            0x870920
+#define SVR_LS2044A            0x870930
 
 /* LS1021a PCIE space */
 #define LS1021_PCIE_SPACE_OFFSET       0x4000000000ULL
index 19ede2f104d36484bbdf056cd7e5ad694954fb5b..d504bbda378b636dc93ab38732b2060ff7cfe086 100644 (file)
@@ -15,7 +15,7 @@
 #include <fdt_support.h>
 #include "pcie_layerscape.h"
 
-#ifdef CONFIG_FSL_LSCH3
+#if defined(CONFIG_FSL_LSCH3) || defined(CONFIG_FSL_LSCH2)
 /*
  * Return next available LUT index.
  */
@@ -72,19 +72,26 @@ static void fdt_pcie_set_msi_map_entry(void *blob, struct ls_pcie *pcie,
        u32 *prop;
        u32 phandle;
        int nodeoffset;
+       uint svr;
+       char *compat = NULL;
 
        /* find pci controller node */
        nodeoffset = fdt_node_offset_by_compat_reg(blob, "fsl,ls-pcie",
                                                   pcie->dbi_res.start);
        if (nodeoffset < 0) {
 #ifdef CONFIG_FSL_PCIE_COMPAT /* Compatible with older version of dts node */
-               nodeoffset = fdt_node_offset_by_compat_reg(blob,
-                               CONFIG_FSL_PCIE_COMPAT, pcie->dbi_res.start);
+               svr = (get_svr() >> SVR_VAR_PER_SHIFT) & 0xFFFFFE;
+               if (svr == SVR_LS2088A || svr == SVR_LS2084A ||
+                   svr == SVR_LS2048A || svr == SVR_LS2044A)
+                       compat = "fsl,ls2088a-pcie";
+               else
+                       compat = CONFIG_FSL_PCIE_COMPAT;
+               if (compat)
+                       nodeoffset = fdt_node_offset_by_compat_reg(blob,
+                                       compat, pcie->dbi_res.start);
+#endif
                if (nodeoffset < 0)
                        return;
-#else
-               return;
-#endif
        }
 
        /* get phandle to MSI controller */
@@ -103,6 +110,58 @@ static void fdt_pcie_set_msi_map_entry(void *blob, struct ls_pcie *pcie,
        fdt_appendprop_u32(blob, nodeoffset, "msi-map", 1);
 }
 
+/*
+ * An iommu-map is a property to be added to the pci controller
+ * node.  It is a table, where each entry consists of 4 fields
+ * e.g.:
+ *
+ *      iommu-map = <[devid] [phandle-to-iommu-ctrl] [stream-id] [count]
+ *                 [devid] [phandle-to-iommu-ctrl] [stream-id] [count]>;
+ */
+static void fdt_pcie_set_iommu_map_entry(void *blob, struct ls_pcie *pcie,
+                                      u32 devid, u32 streamid)
+{
+       u32 *prop;
+       u32 iommu_map[4];
+       int nodeoffset;
+       int lenp;
+
+       /* find pci controller node */
+       nodeoffset = fdt_node_offset_by_compat_reg(blob, "fsl,ls-pcie",
+                                                  pcie->dbi_res.start);
+       if (nodeoffset < 0) {
+#ifdef CONFIG_FSL_PCIE_COMPAT /* Compatible with older version of dts node */
+               nodeoffset = fdt_node_offset_by_compat_reg(blob,
+                               CONFIG_FSL_PCIE_COMPAT, pcie->dbi_res.start);
+               if (nodeoffset < 0)
+                       return;
+#else
+               return;
+#endif
+       }
+
+       /* get phandle to iommu controller */
+       prop = fdt_getprop_w(blob, nodeoffset, "iommu-map", &lenp);
+       if (prop == NULL) {
+               debug("\n%s: ERROR: missing iommu-map: PCIe%d\n",
+                     __func__, pcie->idx);
+               return;
+       }
+
+       /* set iommu-map row */
+       iommu_map[0] = cpu_to_fdt32(devid);
+       iommu_map[1] = *++prop;
+       iommu_map[2] = cpu_to_fdt32(streamid);
+       iommu_map[3] = cpu_to_fdt32(1);
+
+       if (devid == 0) {
+               fdt_setprop_inplace(blob, nodeoffset, "iommu-map",
+                                   iommu_map, 16);
+       } else {
+               fdt_appendprop(blob, nodeoffset, "iommu-map", iommu_map, 16);
+       }
+}
+
 static void fdt_fixup_pcie(void *blob)
 {
        struct udevice *dev, *bus;
@@ -139,6 +198,9 @@ static void fdt_fixup_pcie(void *blob)
                /* update msi-map in device tree */
                fdt_pcie_set_msi_map_entry(blob, pcie, bdf >> 8,
                                           streamid);
+               /* update iommu-map in device tree */
+               fdt_pcie_set_iommu_map_entry(blob, pcie, bdf >> 8,
+                                            streamid);
        }
 }
 #endif
@@ -146,19 +208,25 @@ static void fdt_fixup_pcie(void *blob)
 static void ft_pcie_ls_setup(void *blob, struct ls_pcie *pcie)
 {
        int off;
+       uint svr;
+       char *compat = NULL;
 
        off = fdt_node_offset_by_compat_reg(blob, "fsl,ls-pcie",
                                            pcie->dbi_res.start);
        if (off < 0) {
 #ifdef CONFIG_FSL_PCIE_COMPAT /* Compatible with older version of dts node */
-               off = fdt_node_offset_by_compat_reg(blob,
-                                                   CONFIG_FSL_PCIE_COMPAT,
-                                                   pcie->dbi_res.start);
+               svr = (get_svr() >> SVR_VAR_PER_SHIFT) & 0xFFFFFE;
+               if (svr == SVR_LS2088A || svr == SVR_LS2084A ||
+                   svr == SVR_LS2048A || svr == SVR_LS2044A)
+                       compat = "fsl,ls2088a-pcie";
+               else
+                       compat = CONFIG_FSL_PCIE_COMPAT;
+               if (compat)
+                       off = fdt_node_offset_by_compat_reg(blob,
+                                       compat, pcie->dbi_res.start);
+#endif
                if (off < 0)
                        return;
-#else
-               return;
-#endif
        }
 
        if (pcie->enabled)
@@ -175,7 +243,7 @@ void ft_pci_setup(void *blob, bd_t *bd)
        list_for_each_entry(pcie, &ls_pcie_list, list)
                ft_pcie_ls_setup(blob, pcie);
 
-#ifdef CONFIG_FSL_LSCH3
+#if defined(CONFIG_FSL_LSCH3) || defined(CONFIG_FSL_LSCH2)
        fdt_fixup_pcie(blob);
 #endif
 }
index b2a058380f69ea271602af6815d9cf0bba5441da..e61c67b088bc7e267f44eaec916df7628b9fa5b4 100644 (file)
@@ -1037,8 +1037,11 @@ static int fsl_qspi_probe(struct udevice *bus)
         * setting the size of these devices to 0.  This would ensure
         * that the complete memory map is assigned to only one flash device.
         */
-       qspi_write32(priv->flags, &priv->regs->sfa1ad, priv->amba_base[1]);
+       qspi_write32(priv->flags, &priv->regs->sfa1ad,
+                    priv->amba_base[0] + amba_size_per_chip);
        switch (priv->num_chipselect) {
+       case 1:
+               break;
        case 2:
                qspi_write32(priv->flags, &priv->regs->sfa2ad,
                             priv->amba_base[1]);
index af076725ba4ba442f69d721f2734068b03ebd10b..1a0c7f8e5f924c5c876af4dcd6a187b20111cca4 100644 (file)
@@ -11,6 +11,7 @@
 #define CONFIG_GICV2
 
 #include <asm/arch/config.h>
+#include <asm/arch/stream_id_lsch2.h>
 
 #define CONFIG_SUPPORT_RAW_INITRD
 
index 5a5f9516e3baadac7e35c40a7632580ea1f06f19..46d54a0f0d05adc8f8d8defec7d79acbcbbbfbc6 100644 (file)
@@ -13,6 +13,7 @@
 #define CONFIG_MP
 #define CONFIG_GICV2
 
+#include <asm/arch/stream_id_lsch2.h>
 #include <asm/arch/config.h>
 
 /* Link Definitions */
 #define MTDPARTS_DEFAULT "mtdparts=spi0.0:1m(uboot)," \
                        "5m(kernel),1m(dtb),9m(file_system)"
 #else
-#define MTDPARTS_DEFAULT "mtdparts=60000000.nor:1m(nor_bank0_rcw)," \
-                       "1m(nor_bank0_uboot),1m(nor_bank0_uboot_env)," \
-                       "1m(nor_bank0_fman_uconde),40m(nor_bank0_fit)," \
-                       "1m(nor_bank4_rcw),1m(nor_bank4_uboot)," \
-                       "1m(nor_bank4_uboot_env),1m(nor_bank4_fman_ucode)," \
-                       "40m(nor_bank4_fit);7e800000.flash:" \
+#define MTDPARTS_DEFAULT "mtdparts=60000000.nor:" \
+                       "2m@0x100000(nor_bank0_uboot),"\
+                       "40m@0x1100000(nor_bank0_fit)," \
+                       "7m(nor_bank0_user)," \
+                       "2m@0x4100000(nor_bank4_uboot)," \
+                       "40m@0x5100000(nor_bank4_fit),"\
+                       "-(nor_bank4_user);" \
+                       "7e800000.flash:" \
                        "1m(nand_uboot),1m(nand_uboot_env)," \
                        "20m(nand_fit);spi0.0:1m(uboot)," \
                        "5m(kernel),1m(dtb),9m(file_system)"
index 1ed7517e0119c14749050802e857f70fb7719072..cb792961b8b8fbe251ece758064aee301ef79c37 100644 (file)
@@ -13,6 +13,7 @@
 #define CONFIG_GICV2
 
 #include <asm/arch/config.h>
+#include <asm/arch/stream_id_lsch2.h>
 
 /* Link Definitions */
 #define CONFIG_SYS_INIT_SP_ADDR                (CONFIG_SYS_FSL_OCRAM_BASE + 0xfff0)
index 4b3b21eaa1a63a00fd538ba7f0d1913efb95fce1..476387d5ad4a471a93456579a233938feef0648f 100644 (file)
@@ -485,12 +485,14 @@ unsigned long get_board_ddr_clk(void);
 #define MTDPARTS_DEFAULT "mtdparts=1550000.quadspi:2m(uboot)," \
                        "14m(free)"
 #else
-#define MTDPARTS_DEFAULT "mtdparts=60000000.nor:1m(nor_bank0_rcw)," \
-                       "1m(nor_bank0_uboot),1m(nor_bank0_uboot_env)," \
-                       "1m(nor_bank0_fman_uconde),40m(nor_bank0_fit)," \
-                       "1m(nor_bank4_rcw),1m(nor_bank4_uboot)," \
-                       "1m(nor_bank4_uboot_env),1m(nor_bank4_fman_ucode)," \
-                       "40m(nor_bank4_fit);7e800000.flash:" \
+#define MTDPARTS_DEFAULT "mtdparts=60000000.nor:" \
+                       "2m@0x100000(nor_bank0_uboot),"\
+                       "40m@0x1100000(nor_bank0_fit)," \
+                       "7m(nor_bank0_user)," \
+                       "2m@0x4100000(nor_bank4_uboot)," \
+                       "40m@0x5100000(nor_bank4_fit),"\
+                       "-(nor_bank4_user);" \
+                       "7e800000.flash:" \
                        "4m(nand_uboot),36m(nand_kernel)," \
                        "472m(nand_free);spi0.0:2m(uboot)," \
                        "14m(free)"
index 5072e208114209f42b26571a82a9a3269f54445a..427f623e8c52f395b658a826d65d4b87c20d1586 100644 (file)
@@ -13,7 +13,7 @@
 #define CONFIG_GICV3
 #define CONFIG_FSL_TZPC_BP147
 
-#include <asm/arch/ls2080a_stream_id.h>
+#include <asm/arch/stream_id_lsch3.h>
 #include <asm/arch/config.h>
 
 /* Link Definitions */
index 08d1586867664f815e828f56aef8ea0fb40c87d2..beacb997a3d0ccadaab907fa5c7613f0675e79d5 100644 (file)
@@ -368,6 +368,7 @@ unsigned long get_board_ddr_clk(void);
        "kernel_start=0x581100000\0"            \
        "kernel_load=0xa0000000\0"              \
        "kernel_size=0x2800000\0"               \
+       "mcmemsize=0x40000000\0"                \
        "mcinitcmd=esbc_validate 0x580c80000;"  \
        "esbc_validate 0x580cc0000;"            \
        "fsl_mc start mc 0x580300000"           \
@@ -384,6 +385,7 @@ unsigned long get_board_ddr_clk(void);
        "kernel_start=0x581100000\0"            \
        "kernel_load=0xa0000000\0"              \
        "kernel_size=0x2800000\0"               \
+       "mcmemsize=0x40000000\0"                \
        "mcinitcmd=fsl_mc start mc 0x580300000" \
        " 0x580800000 \0"
 #endif /* CONFIG_SECURE_BOOT */
index 408140f4e8bce17e8a5176751ee96bcbc2f76c8b..2155a89e360936d933ad3a8197a82de8a452eb88 100644 (file)
@@ -339,6 +339,7 @@ unsigned long get_board_sys_clk(void);
        "kernel_start=0x581100000\0"            \
        "kernel_load=0xa0000000\0"              \
        "kernel_size=0x2800000\0"               \
+       "mcmemsize=0x40000000\0"                \
        "fdtfile=fsl-ls2080a-rdb.dtb\0"         \
        "mcinitcmd=esbc_validate 0x580c80000;"  \
        "esbc_validate 0x580cc0000;"            \
@@ -362,6 +363,7 @@ unsigned long get_board_sys_clk(void);
        "kernel_start=0x581100000\0"            \
        "kernel_load=0xa0000000\0"              \
        "kernel_size=0x2800000\0"               \
+       "mcmemsize=0x40000000\0"                \
        "fdtfile=fsl-ls2080a-rdb.dtb\0"         \
        "mcinitcmd=fsl_mc start mc 0x580300000" \
        " 0x580800000 \0"                       \
index 6dc159d9d79991d73611b5c449fa17b850130a41..8ae0fc071e11bc4aa90062875c7457e8ef6e8384 100644 (file)
@@ -68,4 +68,5 @@ phy_interface_t wriop_get_enet_if(int);
 void wriop_dpmac_disable(int);
 void wriop_dpmac_enable(int);
 phy_interface_t wriop_dpmac_enet_if(int, int);
+void wriop_init_dpmac_qsgmii(int, int);
 #endif /* __LDPAA_WRIOP_H */
index c350938d1ffc92142f7dfeba5616b7dbf694e55b..452c6df83f25587b9d4eea82d42165d9adaaebc6 100644 (file)
@@ -40,8 +40,8 @@ struct fsl_secboot_img_hdr {
                u8 num_srk;
                u8 srk_sel;
                u8 reserve;
-               u8 ie_flag;
        } len_kr;
+       u8 ie_flag;
 
        u32 uid_flag;
 
@@ -69,6 +69,11 @@ struct fsl_secboot_img_hdr {
 #define MAX_KEY_ENTRIES 8
 #endif
 
+#if defined(CONFIG_FSL_ISBC_KEY_EXT)
+#define IE_FLAG_MASK 0x1
+#define SCRATCH_IE_LOW_ADR 13
+#define SCRATCH_IE_HIGH_ADR 14
+#endif
 
 #else /* CONFIG_ESBC_HDR_LS */
 
@@ -150,6 +155,10 @@ struct fsl_secboot_img_hdr {
 #define MAX_KEY_ENTRIES 4
 #endif
 
+#if defined(CONFIG_FSL_ISBC_KEY_EXT)
+#define IE_FLAG_MASK 0xFFFFFFFF
+#endif
+
 #endif /* CONFIG_ESBC_HDR_LS */
 
 
@@ -202,6 +211,17 @@ struct fsl_secboot_sg_table {
 };
 #endif
 
+/* ESBC global structure.
+ * Data to be used across verification of different images.
+ * Stores follwoing Data:
+ * IE Table
+ */
+struct fsl_secboot_glb {
+#if defined(CONFIG_FSL_ISBC_KEY_EXT)
+       uintptr_t ie_addr;
+       struct ie_key_info ie_tbl;
+#endif
+};
 /*
  * ESBC private structure.
  * Private structure used by ESBC to store following fields
@@ -213,7 +233,7 @@ struct fsl_secboot_sg_table {
  */
 struct fsl_secboot_img_priv {
        uint32_t hdr_location;
-       u32 ie_addr;
+       uintptr_t ie_addr;
        u32 key_len;
        struct fsl_secboot_img_hdr hdr;
 
index b6eb223fb6f3c34786e7f9af7415d14e41476656..a86552878e92064e61195495e9d9c96afd687aeb 100644 (file)
@@ -28,6 +28,7 @@
 #endif
 
 extern void nand_init(void);
+unsigned long nand_size(void);
 
 #include <linux/compat.h>
 #include <linux/mtd/mtd.h>
index 8e507cd7a68584098ed45e937dab075e6e80062f..4f2094bdf0b58f116d597c4ddbc47dfa610d4e4b 100644 (file)
@@ -15,6 +15,8 @@
 #include <linux/ethtool.h>
 #include <linux/mdio.h>
 
+#define PHY_FIXED_ID           0xa5a55a5a
+
 #define PHY_MAX_ADDR 32
 
 #define PHY_FLAG_BROKEN_RESET  (1 << 0) /* soft reset not supported */
@@ -273,6 +275,7 @@ int phy_ti_init(void);
 int phy_vitesse_init(void);
 int phy_xilinx_init(void);
 int phy_mscc_init(void);
+int phy_fixed_init(void);
 
 int board_phy_config(struct phy_device *phydev);
 int get_phy_id(struct mii_dev *bus, int addr, int devad, u32 *phy_id);
index 27851b6b813b98b80607476381945402674dc1bd..dfd240dfbcfd90288de50fdf54c934bbe754549a 100644 (file)
@@ -111,7 +111,7 @@ void link_local_start(void)
                net_set_state(NETLOOP_FAIL);
                return;
        }
-       net_netmask.s_addr = IN_CLASSB_NET;
+       net_netmask.s_addr = htonl(IN_CLASSB_NET);
 
        seed = seed_mac();
        if (ip.s_addr == 0)
index 16d94c98c611d1b1992f320c5634cee04b054823..ffc3268209d2b3d0542d5f29f69fefc5251cee0e 100644 (file)
@@ -194,17 +194,20 @@ void pbl_load_uboot(int ifd, struct image_tool_params *params)
        pbl_parser(params->imagename);
 
        /* parse the pbi.cfg file. */
-       pbl_parser(params->imagename2);
+       if (params->imagename2[0] != '\0')
+               pbl_parser(params->imagename2);
+
+       if (params->datafile) {
+               fp_uboot = fopen(params->datafile, "r");
+               if (fp_uboot == NULL) {
+                       printf("Error: %s open failed\n", params->datafile);
+                       exit(EXIT_FAILURE);
+               }
 
-       fp_uboot = fopen(params->datafile, "r");
-       if (fp_uboot == NULL) {
-               printf("Error: %s open failed\n", params->datafile);
-               exit(EXIT_FAILURE);
+               load_uboot(fp_uboot);
+               fclose(fp_uboot);
        }
-
-       load_uboot(fp_uboot);
        add_end_cmd();
-       fclose(fp_uboot);
        lseek(ifd, 0, SEEK_SET);
 
        size = pbl_size;
@@ -265,21 +268,24 @@ int pblimage_check_params(struct image_tool_params *params)
        if (!params)
                return EXIT_FAILURE;
 
-       fp_uboot = fopen(params->datafile, "r");
-       if (fp_uboot == NULL) {
-               printf("Error: %s open failed\n", params->datafile);
-               exit(EXIT_FAILURE);
-       }
-       fd = fileno(fp_uboot);
+       if (params->datafile) {
+               fp_uboot = fopen(params->datafile, "r");
+               if (fp_uboot == NULL) {
+                       printf("Error: %s open failed\n", params->datafile);
+                       exit(EXIT_FAILURE);
+               }
+               fd = fileno(fp_uboot);
 
-       if (fstat(fd, &st) == -1) {
-               printf("Error: Could not determine u-boot image size. %s\n",
-                      strerror(errno));
-               exit(EXIT_FAILURE);
-       }
+               if (fstat(fd, &st) == -1) {
+                       printf("Error: Could not determine u-boot image size. %s\n",
+                              strerror(errno));
+                       exit(EXIT_FAILURE);
+               }
 
-       /* For the variable size, we need to pad it to 64 byte boundary */
-       uboot_size = roundup(st.st_size, 64);
+               /* For the variable size, pad it to 64 byte boundary */
+               uboot_size = roundup(st.st_size, 64);
+               fclose(fp_uboot);
+       }
 
        if (params->arch == IH_ARCH_ARM) {
                arch_flag = IH_ARCH_ARM;