LS1088A is compliant with the Layerscape Chassis Generation 3 with eight ARM v8 Cortex-A53 cores in 2 cluster, CCI-400, one 64-bit DDR4 SDRAM memory controller with ECC, Data path acceleration architecture 2.0 (DPAA2), Ethernet interfaces (SGMIIs, RGMIIs, QSGMIIs, XFIs), QSPI, IFC, PCIe, SATA, USB, SDXC, DUARTs etc. Signed-off-by: Alison Wang <alison.wang@nxp.com> Signed-off-by: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com> Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com> Signed-off-by: Raghav Dogra <raghav.dogra@nxp.com> Signed-off-by: Shaohui Xie <Shaohui.Xie@nxp.com> [YS: Revised commit message] Reviewed-by: York Sun <york.sun@nxp.com>master
parent
22c51855bf
commit
6d9b82d085
@ -0,0 +1,126 @@ |
||||
/*
|
||||
* Copyright 2017 NXP |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#include <common.h> |
||||
#include <asm/arch/fsl_serdes.h> |
||||
|
||||
struct serdes_config { |
||||
u8 ip_protocol; |
||||
u8 lanes[SRDS_MAX_LANES]; |
||||
u8 rcw_lanes[SRDS_MAX_LANES]; |
||||
}; |
||||
|
||||
static struct serdes_config serdes1_cfg_tbl[] = { |
||||
/* SerDes 1 */ |
||||
{0x12, {SGMII3, SGMII7, SGMII1, SGMII2 }, {3, 3, 3, 3 } }, |
||||
{0x15, {SGMII3, SGMII7, XFI1, XFI2 }, {3, 3, 1, 1 } }, |
||||
{0x16, {SGMII3, SGMII7, SGMII1, XFI2 }, {3, 3, 3, 1 } }, |
||||
{0x17, {SGMII3, SGMII7, SGMII1, SGMII2 }, {3, 3, 3, 2 } }, |
||||
{0x18, {SGMII3, SGMII7, SGMII1, SGMII2 }, {3, 3, 2, 2 } }, |
||||
{0x19, {SGMII3, QSGMII_B, XFI1, XFI2}, {3, 4, 1, 1 } }, |
||||
{0x1A, {SGMII3, QSGMII_B, SGMII1, XFI2 }, {3, 4, 3, 1 } }, |
||||
{0x1B, {SGMII3, QSGMII_B, SGMII1, SGMII2 }, {3, 4, 3, 2 } }, |
||||
{0x1C, {SGMII3, QSGMII_B, SGMII1, SGMII2 }, {3, 4, 2, 2 } }, |
||||
{0x1D, {QSGMII_A, QSGMII_B, XFI1, XFI2 }, {4, 4, 1, 1 } }, |
||||
{0x1E, {QSGMII_A, QSGMII_B, SGMII1, XFI2 }, {4, 4, 3, 1 } }, |
||||
{0x1F, {QSGMII_A, QSGMII_B, SGMII1, SGMII2 }, {4, 4, 3, 2 } }, |
||||
{0x20, {QSGMII_A, QSGMII_B, SGMII1, SGMII2 }, {4, 4, 2, 2 } }, |
||||
{0x35, {SGMII3, QSGMII_B, SGMII1, SGMII2 }, {3, 4, 3, 3 } }, |
||||
{0x36, {QSGMII_A, QSGMII_B, SGMII1, SGMII2 }, {4, 4, 3, 3 } }, |
||||
{0x3A, {SGMII3, PCIE1, SGMII1, SGMII2 }, {3, 5, 3, 3 } }, |
||||
{} |
||||
}; |
||||
static struct serdes_config serdes2_cfg_tbl[] = { |
||||
/* SerDes 2 */ |
||||
{0x0C, {PCIE1, PCIE1, PCIE1, PCIE1 }, {8, 8, 8, 8 } }, |
||||
{0x0D, {PCIE1, PCIE2, PCIE3, SATA1 }, {5, 5, 5, 9 } }, |
||||
{0x0E, {PCIE1, PCIE1, PCIE2, SATA1 }, {7, 7, 6, 9 } }, |
||||
{0x13, {PCIE1, PCIE1, PCIE3, PCIE3 }, {7, 7, 7, 7 } }, |
||||
{0x14, {PCIE1, PCIE2, PCIE3, PCIE3 }, {5, 5, 7, 7 } }, |
||||
{0x3C, {NONE, PCIE2, NONE, PCIE3 }, {0, 5, 0, 6 } }, |
||||
{} |
||||
}; |
||||
|
||||
static struct serdes_config *serdes_cfg_tbl[] = { |
||||
serdes1_cfg_tbl, |
||||
serdes2_cfg_tbl, |
||||
}; |
||||
|
||||
int serdes_get_number(int serdes, int cfg) |
||||
{ |
||||
struct serdes_config *ptr; |
||||
int i, j, index, lnk; |
||||
int is_found, max_lane = SRDS_MAX_LANES; |
||||
|
||||
if (serdes >= ARRAY_SIZE(serdes_cfg_tbl)) |
||||
return 0; |
||||
|
||||
ptr = serdes_cfg_tbl[serdes]; |
||||
|
||||
while (ptr->ip_protocol) { |
||||
is_found = 1; |
||||
for (i = 0, j = max_lane - 1; i < max_lane; i++, j--) { |
||||
lnk = cfg & (0xf << 4 * i); |
||||
lnk = lnk >> (4 * i); |
||||
|
||||
index = (serdes == FSL_SRDS_1) ? j : i; |
||||
|
||||
if (ptr->rcw_lanes[index] == lnk && is_found) |
||||
is_found = 1; |
||||
else |
||||
is_found = 0; |
||||
} |
||||
|
||||
if (is_found) |
||||
return ptr->ip_protocol; |
||||
ptr++; |
||||
} |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
enum srds_prtcl serdes_get_prtcl(int serdes, int cfg, int lane) |
||||
{ |
||||
struct serdes_config *ptr; |
||||
|
||||
if (serdes >= ARRAY_SIZE(serdes_cfg_tbl)) |
||||
return 0; |
||||
|
||||
ptr = serdes_cfg_tbl[serdes]; |
||||
while (ptr->ip_protocol) { |
||||
if (ptr->ip_protocol == cfg) |
||||
return ptr->lanes[lane]; |
||||
ptr++; |
||||
} |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
int is_serdes_prtcl_valid(int serdes, u32 prtcl) |
||||
{ |
||||
int i; |
||||
struct serdes_config *ptr; |
||||
|
||||
if (serdes >= ARRAY_SIZE(serdes_cfg_tbl)) |
||||
return 0; |
||||
|
||||
ptr = serdes_cfg_tbl[serdes]; |
||||
while (ptr->ip_protocol) { |
||||
if (ptr->ip_protocol == prtcl) |
||||
break; |
||||
ptr++; |
||||
} |
||||
|
||||
if (!ptr->ip_protocol) |
||||
return 0; |
||||
|
||||
for (i = 0; i < SRDS_MAX_LANES; i++) { |
||||
if (ptr->lanes[i] != NONE) |
||||
return 1; |
||||
} |
||||
|
||||
return 0; |
||||
} |
@ -0,0 +1,78 @@ |
||||
/* |
||||
* NXP ls1088a SOC common device tree source |
||||
* |
||||
* Copyright 2017 NXP |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
/ { |
||||
compatible = "fsl,ls1088a"; |
||||
interrupt-parent = <&gic>; |
||||
#address-cells = <2>; |
||||
#size-cells = <2>; |
||||
|
||||
memory@80000000 { |
||||
device_type = "memory"; |
||||
reg = <0x00000000 0x80000000 0 0x80000000>; |
||||
/* DRAM space - 1, size : 2 GB DRAM */ |
||||
}; |
||||
|
||||
gic: interrupt-controller@6000000 { |
||||
compatible = "arm,gic-v3"; |
||||
reg = <0x0 0x06000000 0 0x10000>, /* GIC Dist */ |
||||
<0x0 0x06100000 0 0x100000>; /* GICR (RD_base + SGI_base) */ |
||||
#interrupt-cells = <3>; |
||||
interrupt-controller; |
||||
interrupts = <1 9 0x4>; |
||||
}; |
||||
|
||||
timer { |
||||
compatible = "arm,armv8-timer"; |
||||
interrupts = <1 13 0x8>, /* Physical Secure PPI, active-low */ |
||||
<1 14 0x8>, /* Physical Non-Secure PPI, active-low */ |
||||
<1 11 0x8>, /* Virtual PPI, active-low */ |
||||
<1 10 0x8>; /* Hypervisor PPI, active-low */ |
||||
}; |
||||
|
||||
serial0: serial@21c0500 { |
||||
device_type = "serial"; |
||||
compatible = "fsl,ns16550", "ns16550a"; |
||||
reg = <0x0 0x21c0500 0x0 0x100>; |
||||
clock-frequency = <0>; /* Updated by bootloader */ |
||||
interrupts = <0 32 0x1>; /* edge triggered */ |
||||
}; |
||||
|
||||
serial1: serial@21c0600 { |
||||
device_type = "serial"; |
||||
compatible = "fsl,ns16550", "ns16550a"; |
||||
reg = <0x0 0x21c0600 0x0 0x100>; |
||||
clock-frequency = <0>; /* Updated by bootloader */ |
||||
interrupts = <0 32 0x1>; /* edge triggered */ |
||||
}; |
||||
|
||||
fsl_mc: fsl-mc@80c000000 { |
||||
compatible = "fsl,qoriq-mc"; |
||||
reg = <0x00000008 0x0c000000 0 0x40>, /* MC portal base */ |
||||
<0x00000000 0x08340000 0 0x40000>; /* MC control reg */ |
||||
}; |
||||
|
||||
dspi: dspi@2100000 { |
||||
compatible = "fsl,vf610-dspi"; |
||||
#address-cells = <1>; |
||||
#size-cells = <0>; |
||||
reg = <0x0 0x2100000 0x0 0x10000>; |
||||
interrupts = <0 26 0x4>; /* Level high type */ |
||||
num-cs = <6>; |
||||
}; |
||||
|
||||
qspi: quadspi@1550000 { |
||||
compatible = "fsl,vf610-qspi"; |
||||
#address-cells = <1>; |
||||
#size-cells = <0>; |
||||
reg = <0x0 0x20c0000 0x0 0x10000>, |
||||
<0x0 0x20000000 0x0 0x10000000>; |
||||
reg-names = "QuadSPI", "QuadSPI-memory"; |
||||
num-cs = <4>; |
||||
}; |
||||
}; |
@ -0,0 +1,87 @@ |
||||
/*
|
||||
* Copyright 2017 NXP |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
#include <common.h> |
||||
#include <phy.h> |
||||
#include <fsl-mc/ldpaa_wriop.h> |
||||
#include <asm/io.h> |
||||
#include <asm/arch/fsl_serdes.h> |
||||
|
||||
u32 dpmac_to_devdisr[] = { |
||||
[WRIOP1_DPMAC1] = FSL_CHASSIS3_DEVDISR2_DPMAC1, |
||||
[WRIOP1_DPMAC2] = FSL_CHASSIS3_DEVDISR2_DPMAC2, |
||||
[WRIOP1_DPMAC3] = FSL_CHASSIS3_DEVDISR2_DPMAC3, |
||||
[WRIOP1_DPMAC4] = FSL_CHASSIS3_DEVDISR2_DPMAC4, |
||||
[WRIOP1_DPMAC5] = FSL_CHASSIS3_DEVDISR2_DPMAC5, |
||||
[WRIOP1_DPMAC6] = FSL_CHASSIS3_DEVDISR2_DPMAC6, |
||||
[WRIOP1_DPMAC7] = FSL_CHASSIS3_DEVDISR2_DPMAC7, |
||||
[WRIOP1_DPMAC8] = FSL_CHASSIS3_DEVDISR2_DPMAC8, |
||||
[WRIOP1_DPMAC9] = FSL_CHASSIS3_DEVDISR2_DPMAC9, |
||||
[WRIOP1_DPMAC10] = FSL_CHASSIS3_DEVDISR2_DPMAC10, |
||||
}; |
||||
|
||||
static int is_device_disabled(int dpmac_id) |
||||
{ |
||||
struct ccsr_gur __iomem *gur = (void *)CONFIG_SYS_FSL_GUTS_ADDR; |
||||
u32 devdisr2 = in_le32(&gur->devdisr2); |
||||
|
||||
return dpmac_to_devdisr[dpmac_id] & devdisr2; |
||||
} |
||||
|
||||
void wriop_dpmac_disable(int dpmac_id) |
||||
{ |
||||
struct ccsr_gur __iomem *gur = (void *)CONFIG_SYS_FSL_GUTS_ADDR; |
||||
|
||||
setbits_le32(&gur->devdisr2, dpmac_to_devdisr[dpmac_id]); |
||||
} |
||||
|
||||
void wriop_dpmac_enable(int dpmac_id) |
||||
{ |
||||
struct ccsr_gur __iomem *gur = (void *)CONFIG_SYS_FSL_GUTS_ADDR; |
||||
|
||||
clrbits_le32(&gur->devdisr2, dpmac_to_devdisr[dpmac_id]); |
||||
} |
||||
|
||||
phy_interface_t wriop_dpmac_enet_if(int dpmac_id, int lane_prtcl) |
||||
{ |
||||
enum srds_prtcl; |
||||
|
||||
if (is_device_disabled(dpmac_id + 1)) |
||||
return PHY_INTERFACE_MODE_NONE; |
||||
|
||||
switch (lane_prtcl) { |
||||
case SGMII1: |
||||
case SGMII2: |
||||
case SGMII3: |
||||
case SGMII7: |
||||
return PHY_INTERFACE_MODE_SGMII; |
||||
} |
||||
|
||||
if (lane_prtcl >= XFI1 && lane_prtcl <= XFI2) |
||||
return PHY_INTERFACE_MODE_XGMII; |
||||
|
||||
if (lane_prtcl >= QSGMII_A && lane_prtcl <= QSGMII_B) |
||||
return PHY_INTERFACE_MODE_QSGMII; |
||||
|
||||
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, 3, (int)lane_prtcl); |
||||
wriop_init_dpmac(sd, 4, (int)lane_prtcl); |
||||
wriop_init_dpmac(sd, 5, (int)lane_prtcl); |
||||
wriop_init_dpmac(sd, 6, (int)lane_prtcl); |
||||
break; |
||||
case QSGMII_B: |
||||
wriop_init_dpmac(sd, 7, (int)lane_prtcl); |
||||
wriop_init_dpmac(sd, 8, (int)lane_prtcl); |
||||
wriop_init_dpmac(sd, 9, (int)lane_prtcl); |
||||
wriop_init_dpmac(sd, 10, (int)lane_prtcl); |
||||
break; |
||||
} |
||||
} |
Loading…
Reference in new issue