[U-Boot] [PATCH 00/17] arm: ls1021atwr: Convert to use driver model TSEC driver

This series adds driver model ethernet support to the Freescale TSEC ethernet driver and convert ls1021atwr board to use it.
Enable the support in the ls1021atwr_nor_defconfig and ls1021atwr_nor_lpuart_defconfig configurations.
Bin Meng (17): powerpc: bsc9132qds: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET powerpc: c29xpcie: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET powerpc: mpc8572ds: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET powerpc: mpc8548cds: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET powerpc: p1010rdb: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET arm: ls1021atwr: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET net: tsec: fsl_mdio: Fix several cosmetic issues net: tsec: Move rx_idx and tx_idx to struct tsec_private net: tsec: Move rxbd and txbd to struct tsec_private net: tsec: Adjust orders to avoid forward declaration of tsec_send() net: tsec: Use tsec_private pointer as the parameter for internal routines doc: dt-bindings: Describe Freescale TSEC ethernet controller net: tsec: Add driver model ethernet support net: tsec: Use priv->tbiaddr to initialize TBI PHY address arm: ls102xa: Rewrite the logic of ft_fixup_enet_phy_connect_type() arm: ls1021atwr: Disable CONFIG_E1000 temporarily arm: ls1021atwr: Convert to use driver model TSEC driver
arch/arm/cpu/armv7/ls102xa/cpu.c | 2 +- arch/arm/cpu/armv7/ls102xa/fdt.c | 26 +- arch/arm/dts/ls1021a-twr.dts | 20 + arch/arm/dts/ls1021a.dtsi | 18 +- board/freescale/bsc9132qds/bsc9132qds.c | 4 +- board/freescale/c29xpcie/c29xpcie.c | 4 +- board/freescale/ls1021atwr/ls1021atwr.c | 4 +- board/freescale/mpc8548cds/mpc8548cds.c | 4 +- board/freescale/mpc8572ds/mpc8572ds.c | 4 +- board/freescale/p1010rdb/p1010rdb.c | 4 +- configs/ls1021atwr_nor_defconfig | 3 +- configs/ls1021atwr_nor_lpuart_defconfig | 3 +- doc/device-tree-bindings/net/fsl-tsec-phy.txt | 64 +++ drivers/net/fsl_mdio.c | 4 +- drivers/net/tsec.c | 536 ++++++++++++++++++-------- include/configs/ls1021atwr.h | 4 + include/fsl_mdio.h | 7 +- include/tsec.h | 69 ++-- 18 files changed, 546 insertions(+), 234 deletions(-) create mode 100644 doc/device-tree-bindings/net/fsl-tsec-phy.txt

The call to pci_eth_init() should not be wrapped with CONFIG_TSEC_ENET.
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
board/freescale/bsc9132qds/bsc9132qds.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/board/freescale/bsc9132qds/bsc9132qds.c b/board/freescale/bsc9132qds/bsc9132qds.c index 586dacc..71a7bb5 100644 --- a/board/freescale/bsc9132qds/bsc9132qds.c +++ b/board/freescale/bsc9132qds/bsc9132qds.c @@ -227,9 +227,9 @@ int checkboard(void) return 0; }
-#ifdef CONFIG_TSEC_ENET int board_eth_init(bd_t *bis) { +#ifdef CONFIG_TSEC_ENET struct fsl_pq_mdio_info mdio_info; struct tsec_info_struct tsec_info[4]; int num = 0; @@ -250,6 +250,7 @@ int board_eth_init(bd_t *bis)
fsl_pq_mdio_init(bis, &mdio_info); tsec_eth_init(bis, tsec_info, num); +#endif
#ifdef CONFIG_PCI pci_eth_init(bis); @@ -257,7 +258,6 @@ int board_eth_init(bd_t *bis)
return 0; } -#endif
#define USBMUX_SEL_MASK 0xc0 #define USBMUX_SEL_UART2 0xc0

Hi Bin,
On Tue, Jan 12, 2016 at 12:41 AM, Bin Meng bmeng.cn@gmail.com wrote:
The call to pci_eth_init() should not be wrapped with CONFIG_TSEC_ENET.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
board/freescale/bsc9132qds/bsc9132qds.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/board/freescale/bsc9132qds/bsc9132qds.c b/board/freescale/bsc9132qds/bsc9132qds.c index 586dacc..71a7bb5 100644 --- a/board/freescale/bsc9132qds/bsc9132qds.c +++ b/board/freescale/bsc9132qds/bsc9132qds.c @@ -227,9 +227,9 @@ int checkboard(void) return 0; }
-#ifdef CONFIG_TSEC_ENET int board_eth_init(bd_t *bis) { +#ifdef CONFIG_TSEC_ENET struct fsl_pq_mdio_info mdio_info; struct tsec_info_struct tsec_info[4]; int num = 0; @@ -250,6 +250,7 @@ int board_eth_init(bd_t *bis)
fsl_pq_mdio_init(bis, &mdio_info); tsec_eth_init(bis, tsec_info, num);
+#endif
#ifdef CONFIG_PCI pci_eth_init(bis);
This is still needed even with what Stephen Warren and Simon Glass are discussing here, right?
If so... Acked-by: Joe Hershberger joe.hershberger@ni.com
@@ -257,7 +258,6 @@ int board_eth_init(bd_t *bis)
return 0;
} -#endif
#define USBMUX_SEL_MASK 0xc0
#define USBMUX_SEL_UART2 0xc0
1.8.2.1
U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot


The call to pci_eth_init() should not be wrapped with CONFIG_TSEC_ENET.
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
board/freescale/c29xpcie/c29xpcie.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/board/freescale/c29xpcie/c29xpcie.c b/board/freescale/c29xpcie/c29xpcie.c index f42d373..e325b4d 100644 --- a/board/freescale/c29xpcie/c29xpcie.c +++ b/board/freescale/c29xpcie/c29xpcie.c @@ -83,9 +83,9 @@ void pci_init_board(void) } #endif /* ifdef CONFIG_PCI */
-#ifdef CONFIG_TSEC_ENET int board_eth_init(bd_t *bis) { +#ifdef CONFIG_TSEC_ENET struct fsl_pq_mdio_info mdio_info; struct tsec_info_struct tsec_info[2]; int num = 0; @@ -110,10 +110,10 @@ int board_eth_init(bd_t *bis) fsl_pq_mdio_init(bis, &mdio_info);
tsec_eth_init(bis, tsec_info, num); +#endif
return pci_eth_init(bis); } -#endif
#if defined(CONFIG_OF_BOARD_SETUP) void fdt_del_sec(void *blob, int offset)

On Tue, Jan 12, 2016 at 12:41 AM, Bin Meng bmeng.cn@gmail.com wrote:
The call to pci_eth_init() should not be wrapped with CONFIG_TSEC_ENET.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
Acked-by: Joe Hershberger joe.hershberger@ni.com


The call to pci_eth_init() should not be wrapped with CONFIG_TSEC_ENET.
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
board/freescale/mpc8572ds/mpc8572ds.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/board/freescale/mpc8572ds/mpc8572ds.c b/board/freescale/mpc8572ds/mpc8572ds.c index 3f68cf4..ed6836a 100644 --- a/board/freescale/mpc8572ds/mpc8572ds.c +++ b/board/freescale/mpc8572ds/mpc8572ds.c @@ -171,9 +171,9 @@ int board_early_init_r(void) return 0; }
-#ifdef CONFIG_TSEC_ENET int board_eth_init(bd_t *bis) { +#ifdef CONFIG_TSEC_ENET struct fsl_pq_mdio_info mdio_info; struct tsec_info_struct tsec_info[4]; int num = 0; @@ -226,10 +226,10 @@ int board_eth_init(bd_t *bis) fsl_pq_mdio_init(bis, &mdio_info);
tsec_eth_init(bis, tsec_info, num); +#endif
return pci_eth_init(bis); } -#endif
#if defined(CONFIG_OF_BOARD_SETUP) int ft_board_setup(void *blob, bd_t *bd)

On Tue, Jan 12, 2016 at 12:41 AM, Bin Meng bmeng.cn@gmail.com wrote:
The call to pci_eth_init() should not be wrapped with CONFIG_TSEC_ENET.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
Acked-by: Joe Hershberger joe.hershberger@ni.com


The call to pci_eth_init() should not be wrapped with CONFIG_TSEC_ENET.
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
board/freescale/mpc8548cds/mpc8548cds.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/board/freescale/mpc8548cds/mpc8548cds.c b/board/freescale/mpc8548cds/mpc8548cds.c index ca9b43c..de76d36 100644 --- a/board/freescale/mpc8548cds/mpc8548cds.c +++ b/board/freescale/mpc8548cds/mpc8548cds.c @@ -301,9 +301,9 @@ void configure_rgmii(void) return; }
-#ifdef CONFIG_TSEC_ENET int board_eth_init(bd_t *bis) { +#ifdef CONFIG_TSEC_ENET struct fsl_pq_mdio_info mdio_info; struct tsec_info_struct tsec_info[4]; int num = 0; @@ -345,10 +345,10 @@ int board_eth_init(bd_t *bis)
tsec_eth_init(bis, tsec_info, num); configure_rgmii(); +#endif
return pci_eth_init(bis); } -#endif
#if defined(CONFIG_OF_BOARD_SETUP) void ft_pci_setup(void *blob, bd_t *bd)

On Tue, Jan 12, 2016 at 12:41 AM, Bin Meng bmeng.cn@gmail.com wrote:
The call to pci_eth_init() should not be wrapped with CONFIG_TSEC_ENET.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
Acked-by: Joe Hershberger joe.hershberger@ni.com


The call to pci_eth_init() should not be wrapped with CONFIG_TSEC_ENET.
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
board/freescale/p1010rdb/p1010rdb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/board/freescale/p1010rdb/p1010rdb.c b/board/freescale/p1010rdb/p1010rdb.c index ebffe9a..1ae1540 100644 --- a/board/freescale/p1010rdb/p1010rdb.c +++ b/board/freescale/p1010rdb/p1010rdb.c @@ -326,9 +326,9 @@ int checkboard(void) return 0; }
-#ifdef CONFIG_TSEC_ENET int board_eth_init(bd_t *bis) { +#ifdef CONFIG_TSEC_ENET struct fsl_pq_mdio_info mdio_info; struct tsec_info_struct tsec_info[4]; struct cpu_type *cpu; @@ -362,10 +362,10 @@ int board_eth_init(bd_t *bis) fsl_pq_mdio_init(bis, &mdio_info);
tsec_eth_init(bis, tsec_info, num); +#endif
return pci_eth_init(bis); } -#endif
#if defined(CONFIG_OF_BOARD_SETUP) void fdt_del_flexcan(void *blob)

On Tue, Jan 12, 2016 at 12:41 AM, Bin Meng bmeng.cn@gmail.com wrote:
The call to pci_eth_init() should not be wrapped with CONFIG_TSEC_ENET.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
Acked-by: Joe Hershberger joe.hershberger@ni.com


The call to pci_eth_init() should not be wrapped with CONFIG_TSEC_ENET.
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
board/freescale/ls1021atwr/ls1021atwr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/board/freescale/ls1021atwr/ls1021atwr.c b/board/freescale/ls1021atwr/ls1021atwr.c index 8eaff5f..f82e567 100644 --- a/board/freescale/ls1021atwr/ls1021atwr.c +++ b/board/freescale/ls1021atwr/ls1021atwr.c @@ -243,9 +243,9 @@ int board_mmc_init(bd_t *bis) } #endif
-#ifdef CONFIG_TSEC_ENET int board_eth_init(bd_t *bis) { +#ifdef CONFIG_TSEC_ENET struct fsl_pq_mdio_info mdio_info; struct tsec_info_struct tsec_info[4]; int num = 0; @@ -280,10 +280,10 @@ int board_eth_init(bd_t *bis) fsl_pq_mdio_init(bis, &mdio_info);
tsec_eth_init(bis, tsec_info, num); +#endif
return pci_eth_init(bis); } -#endif
#if !defined(CONFIG_QSPI_BOOT) && !defined(CONFIG_SD_BOOT_QSPI) int config_serdes_mux(void)

On Tue, Jan 12, 2016 at 12:41 AM, Bin Meng bmeng.cn@gmail.com wrote:
The call to pci_eth_init() should not be wrapped with CONFIG_TSEC_ENET.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
Acked-by: Joe Hershberger joe.hershberger@ni.com


Clean up the tsec and fsl_mdio driver codes a little bit, by: - Fix misuse of tab and space here and there - Use correct multi-line comment format - Replace license identifier to GPL-2.0+
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
drivers/net/fsl_mdio.c | 4 ++-- drivers/net/tsec.c | 61 ++++++++++++++++++++++++++++---------------------- include/fsl_mdio.h | 7 +++--- include/tsec.h | 51 ++++++++++++++++++----------------------- 4 files changed, 62 insertions(+), 61 deletions(-)
diff --git a/drivers/net/fsl_mdio.c b/drivers/net/fsl_mdio.c index d6b181b..ae3d035 100644 --- a/drivers/net/fsl_mdio.c +++ b/drivers/net/fsl_mdio.c @@ -5,6 +5,7 @@ * * SPDX-License-Identifier: GPL-2.0+ */ + #include <common.h> #include <miiphy.h> #include <phy.h> @@ -32,8 +33,7 @@ int tsec_local_mdio_read(struct tsec_mii_mng __iomem *phyregs, int port_addr, int value; int timeout = 1000000;
- /* Put the address of the phy, and the register - * number into MIIMADD */ + /* Put the address of the phy, and the register number into MIIMADD */ out_be32(&phyregs->miimadd, (port_addr << 8) | (regnum & 0x1f));
/* Clear the command register, and wait */ diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c index 4bdc188..4aeb387 100644 --- a/drivers/net/tsec.c +++ b/drivers/net/tsec.c @@ -1,14 +1,11 @@ /* * Freescale Three Speed Ethernet Controller driver * - * This software may be used and distributed according to the - * terms of the GNU Public License, Version 2, incorporated - * herein by reference. - * * Copyright 2004-2011, 2013 Freescale Semiconductor, Inc. * (C) Copyright 2003, Motorola, Inc. * author Andy Fleming * + * SPDX-License-Identifier: GPL-2.0+ */
#include <config.h> @@ -84,8 +81,10 @@ static struct tsec_info_struct tsec_info[] = { /* Configure the TBI for SGMII operation */ static void tsec_configure_serdes(struct tsec_private *priv) { - /* Access TBI PHY registers at given TSEC register offset as opposed - * to the register offset used for external PHY accesses */ + /* + * Access TBI PHY registers at given TSEC register offset as opposed + * to the register offset used for external PHY accesses + */ tsec_local_mdio_write(priv->phyregs_sgmii, in_be32(&priv->regs->tbipa), 0, TBI_ANA, TBIANA_SETTINGS); tsec_local_mdio_write(priv->phyregs_sgmii, in_be32(&priv->regs->tbipa), @@ -100,7 +99,8 @@ static void tsec_configure_serdes(struct tsec_private *priv)
/* Set the appropriate hash bit for the given addr */
-/* The algorithm works like so: +/* + * The algorithm works like so: * 1) Take the Destination Address (ie the multicast address), and * do a CRC on it (little endian), and reverse the bits of the * result. @@ -111,9 +111,9 @@ static void tsec_configure_serdes(struct tsec_private *priv) * hash index which gaddr register to use, and the 5 other bits * indicate which bit (assuming an IBM numbering scheme, which * for PowerPC (tm) is usually the case) in the register holds - * the entry. */ -static int -tsec_mcast_addr(struct eth_device *dev, const u8 *mcast_mac, u8 set) + * the entry. + */ +static int tsec_mcast_addr(struct eth_device *dev, const u8 *mcast_mac, u8 set) { struct tsec_private *priv = (struct tsec_private *)dev->priv; struct tsec __iomem *regs = priv->regs; @@ -135,7 +135,8 @@ tsec_mcast_addr(struct eth_device *dev, const u8 *mcast_mac, u8 set) } #endif /* Multicast TFTP ? */
-/* Initialized required registers to appropriate values, zeroing +/* + * Initialized required registers to appropriate values, zeroing * those we don't care about (unless zero is bad, in which case, * choose a more appropriate value) */ @@ -181,7 +182,8 @@ static void init_registers(struct tsec __iomem *regs)
}
-/* Configure maccfg2 based on negotiated speed and duplex +/* + * Configure maccfg2 based on negotiated speed and duplex * reported by PHY handling code */ static void adjust_link(struct tsec_private *priv, struct phy_device *phydev) @@ -212,7 +214,8 @@ static void adjust_link(struct tsec_private *priv, struct phy_device *phydev) case 10: maccfg2 |= MACCFG2_MII;
- /* Set R100 bit in all modes although + /* + * Set R100 bit in all modes although * it is only used in RGMII mode */ if (phydev->speed == 100) @@ -315,7 +318,8 @@ void redundant_init(struct eth_device *dev) } #endif
-/* Set up the buffers and their descriptors, and bring up the +/* + * Set up the buffers and their descriptors, and bring up the * interface */ static void startup_tsec(struct eth_device *dev) @@ -369,9 +373,10 @@ static void startup_tsec(struct eth_device *dev) clrbits_be32(®s->dmactrl, DMACTRL_GRS | DMACTRL_GTS); }
-/* This returns the status bits of the device. The return value +/* + * This returns the status bits of the device. The return value * is never checked, and this is what the 8260 driver did, so we - * do the same. Presumably, this would be zero if there were no + * do the same. Presumably, this would be zero if there were no * errors */ static int tsec_send(struct eth_device *dev, void *packet, int length) @@ -446,7 +451,6 @@ static int tsec_recv(struct eth_device *dev) }
return -1; - }
/* Stop the interface */ @@ -468,10 +472,11 @@ static void tsec_halt(struct eth_device *dev) phy_shutdown(priv->phydev); }
-/* Initializes data structures and registers for the controller, - * and brings the interface up. Returns the link status, meaning +/* + * Initializes data structures and registers for the controller, + * and brings the interface up. Returns the link status, meaning * that it returns success if the link is up, failure otherwise. - * This allows u-boot to find the first active controller. + * This allows U-Boot to find the first active controller. */ static int tsec_init(struct eth_device *dev, bd_t * bd) { @@ -489,7 +494,8 @@ static int tsec_init(struct eth_device *dev, bd_t * bd) /* Init ECNTRL */ out_be32(®s->ecntrl, ECNTRL_INIT_SETTINGS);
- /* Copy the station address into the address registers. + /* + * Copy the station address into the address registers. * For a station address of 0x12345678ABCD in transmission * order (BE), MACnADDR1 is set to 0xCDAB7856 and * MACnADDR2 is set to 0x34120000. @@ -551,8 +557,8 @@ static phy_interface_t tsec_get_interface(struct tsec_private *priv) * be set by the platform code. */ if ((interface == PHY_INTERFACE_MODE_RGMII_ID) || - (interface == PHY_INTERFACE_MODE_RGMII_TXID) || - (interface == PHY_INTERFACE_MODE_RGMII_RXID)) + (interface == PHY_INTERFACE_MODE_RGMII_TXID) || + (interface == PHY_INTERFACE_MODE_RGMII_RXID)) return interface;
return PHY_INTERFACE_MODE_RGMII; @@ -565,8 +571,8 @@ static phy_interface_t tsec_get_interface(struct tsec_private *priv) return PHY_INTERFACE_MODE_MII; }
- -/* Discover which PHY is attached to the device, and configure it +/* + * Discover which PHY is attached to the device, and configure it * properly. If the PHY is not recognized, then return 0 * (failure). Otherwise, return 1 */ @@ -605,7 +611,8 @@ static int init_phy(struct eth_device *dev) return 1; }
-/* Initialize device structure. Returns success if PHY +/* + * Initialize device structure. Returns success if PHY * initialization succeeded (i.e. if it recognizes the PHY) */ static int tsec_initialize(bd_t *bis, struct tsec_info_struct *tsec_info) @@ -645,7 +652,7 @@ static int tsec_initialize(bd_t *bis, struct tsec_info_struct *tsec_info) dev->mcast = tsec_mcast_addr; #endif
- /* Tell u-boot to get the addr from the env */ + /* Tell U-Boot to get the addr from the env */ for (i = 0; i < 6; i++) dev->enetaddr[i] = 0;
diff --git a/include/fsl_mdio.h b/include/fsl_mdio.h index 2137282..25678a9 100644 --- a/include/fsl_mdio.h +++ b/include/fsl_mdio.h @@ -5,6 +5,7 @@ * * SPDX-License-Identifier: GPL-2.0+ */ + #ifndef __FSL_PHY_H__ #define __FSL_PHY_H__
@@ -27,9 +28,9 @@ int fdt_fixup_phy_connection(void *blob, int offset, phy_interface_t phyc); #define PHY_EXT_PAGE_ACCESS 0x1f
/* MII Management Configuration Register */ -#define MIIMCFG_RESET_MGMT 0x80000000 -#define MIIMCFG_MGMT_CLOCK_SELECT 0x00000007 -#define MIIMCFG_INIT_VALUE 0x00000003 +#define MIIMCFG_RESET_MGMT 0x80000000 +#define MIIMCFG_MGMT_CLOCK_SELECT 0x00000007 +#define MIIMCFG_INIT_VALUE 0x00000003
/* MII Management Command Register */ #define MIIMCOM_READ_CYCLE 0x00000001 diff --git a/include/tsec.h b/include/tsec.h index 1119d2c..f2aa11a 100644 --- a/include/tsec.h +++ b/include/tsec.h @@ -3,15 +3,12 @@ * * Driver for the Motorola Triple Speed Ethernet Controller * - * This software may be used and distributed according to the - * terms of the GNU Public License, Version 2, incorporated - * herein by reference. - * * Copyright 2004, 2007, 2009, 2011, 2013 Freescale Semiconductor, Inc. * (C) Copyright 2003, Motorola, Inc. * maintained by Xianghua Xiao (x.xiao@motorola.com) * author Andy Fleming * + * SPDX-License-Identifier: GPL-2.0+ */
#ifndef __TSEC_H @@ -67,11 +64,11 @@ x.mii_devname = DEFAULT_MII_NAME;\ }
-#define MAC_ADDR_LEN 6 +#define MAC_ADDR_LEN 6
/* #define TSEC_TIMEOUT 1000000 */ -#define TSEC_TIMEOUT 1000 -#define TOUT_LOOP 1000000 +#define TSEC_TIMEOUT 1000 +#define TOUT_LOOP 1000000
/* TBI register addresses */ #define TBI_CR 0x00 @@ -83,8 +80,8 @@
/* TBI MDIO register bit fields*/ #define TBICON_CLK_SELECT 0x0020 -#define TBIANA_ASYMMETRIC_PAUSE 0x0100 -#define TBIANA_SYMMETRIC_PAUSE 0x0080 +#define TBIANA_ASYMMETRIC_PAUSE 0x0100 +#define TBIANA_SYMMETRIC_PAUSE 0x0080 #define TBIANA_HALF_DUPLEX 0x0040 #define TBIANA_FULL_DUPLEX 0x0020 #define TBICR_PHY_RESET 0x8000 @@ -93,13 +90,12 @@ #define TBICR_FULL_DUPLEX 0x0100 #define TBICR_SPEED1_SET 0x0040
- /* MAC register bits */ #define MACCFG1_SOFT_RESET 0x80000000 #define MACCFG1_RESET_RX_MC 0x00080000 #define MACCFG1_RESET_TX_MC 0x00040000 #define MACCFG1_RESET_RX_FUN 0x00020000 -#define MACCFG1_RESET_TX_FUN 0x00010000 +#define MACCFG1_RESET_TX_FUN 0x00010000 #define MACCFG1_LOOPBACK 0x00000100 #define MACCFG1_RX_FLOW 0x00000020 #define MACCFG1_TX_FLOW 0x00000010 @@ -122,7 +118,7 @@ #define ECNTRL_SGMII_MODE 0x00000002
#ifndef CONFIG_SYS_TBIPA_VALUE - #define CONFIG_SYS_TBIPA_VALUE 0x1f +# define CONFIG_SYS_TBIPA_VALUE 0x1f #endif
#define MRBLR_INIT_SETTINGS PKTSIZE_ALIGN @@ -137,7 +133,6 @@ #define TSTAT_CLEAR_THALT 0x80000000 #define RSTAT_CLEAR_RHALT 0x00800000
- #define IEVENT_INIT_CLEAR 0xffffffff #define IEVENT_BABR 0x80000000 #define IEVENT_RXC 0x40000000 @@ -164,11 +159,9 @@ #define IMASK_TXFEN 0x00100000 #define IMASK_RXFEN0 0x00000080
- /* Default Attribute fields */ -#define ATTR_INIT_SETTINGS 0x000000c0 -#define ATTRELI_INIT_SETTINGS 0x00000000 - +#define ATTR_INIT_SETTINGS 0x000000c0 +#define ATTRELI_INIT_SETTINGS 0x00000000
/* TxBD status field bits */ #define TXBD_READY 0x8000 @@ -181,7 +174,7 @@ #define TXBD_HUGEFRAME 0x0080 #define TXBD_LATECOLLISION 0x0080 #define TXBD_RETRYLIMIT 0x0040 -#define TXBD_RETRYCOUNTMASK 0x003c +#define TXBD_RETRYCOUNTMASK 0x003c #define TXBD_UNDERRUN 0x0002 #define TXBD_STATS 0x03ff
@@ -204,15 +197,15 @@ #define RXBD_STATS 0x003f
struct txbd8 { - uint16_t status; /* Status Fields */ - uint16_t length; /* Buffer length */ - uint32_t bufptr; /* Buffer Pointer */ + uint16_t status; /* Status Fields */ + uint16_t length; /* Buffer length */ + uint32_t bufptr; /* Buffer Pointer */ };
struct rxbd8 { - uint16_t status; /* Status Fields */ - uint16_t length; /* Buffer Length */ - uint32_t bufptr; /* Buffer Pointer */ + uint16_t status; /* Status Fields */ + uint16_t length; /* Buffer Length */ + uint32_t bufptr; /* Buffer Pointer */ };
struct tsec_rmon_mib { @@ -336,15 +329,15 @@ struct tsec { u32 rbdlen; /* RxBD Data Length */ u32 res310[4]; u32 res320; - u32 crbptr; /* Current Receive Buffer Pointer */ + u32 crbptr; /* Current Receive Buffer Pointer */ u32 res328[6]; - u32 mrblr; /* Maximum Receive Buffer Length */ + u32 mrblr; /* Maximum Receive Buffer Length */ u32 res344[16]; - u32 rbptr; /* RxBD Pointer */ + u32 rbptr; /* RxBD Pointer */ u32 res388[30]; /* (0x2_n400) */ u32 res400; - u32 rbase; /* RxBD Base Address */ + u32 rbase; /* RxBD Base Address */ u32 res408[62];
/* MAC Registers (0x2_n500) */ @@ -388,7 +381,7 @@ struct tsec { u32 resc00[256]; };
-#define TSEC_GIGABIT (1 << 0) +#define TSEC_GIGABIT (1 << 0)
/* These flags currently only have meaning if we're using the eTSEC */ #define TSEC_REDUCED (1 << 1) /* MAC-PHY interface uses RGMII */

On Tue, Jan 12, 2016 at 12:41 AM, Bin Meng bmeng.cn@gmail.com wrote:
Clean up the tsec and fsl_mdio driver codes a little bit, by:
- Fix misuse of tab and space here and there
- Use correct multi-line comment format
- Replace license identifier to GPL-2.0+
Signed-off-by: Bin Meng bmeng.cn@gmail.com
Acked-by: Joe Hershberger joe.hershberger@ni.com


At present rx_idx and tx_idx are declared as static variables in the driver codes. To support multiple interfaces, move it to struct tsec_private.
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
drivers/net/tsec.c | 54 ++++++++++++++++++++++++++---------------------------- include/tsec.h | 2 ++ 2 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c index 4aeb387..943c4b3 100644 --- a/drivers/net/tsec.c +++ b/drivers/net/tsec.c @@ -23,9 +23,6 @@ DECLARE_GLOBAL_DATA_PTR;
#define TX_BUF_CNT 2
-static uint rx_idx; /* index of the current RX buffer */ -static uint tx_idx; /* index of the current TX buffer */ - #ifdef __GNUC__ static struct txbd8 __iomem txbd[TX_BUF_CNT] __aligned(8); static struct rxbd8 __iomem rxbd[PKTBUFSRX] __aligned(8); @@ -280,22 +277,23 @@ void redundant_init(struct eth_device *dev) tsec_send(dev, (void *)pkt, sizeof(pkt));
/* Wait for buffer to be received */ - for (t = 0; in_be16(&rxbd[rx_idx].status) & RXBD_EMPTY; t++) { + for (t = 0; in_be16(&rxbd[priv->rx_idx].status) & RXBD_EMPTY; + t++) { if (t >= 10 * TOUT_LOOP) { printf("%s: tsec: rx error\n", dev->name); break; } }
- if (!memcmp(pkt, (void *)net_rx_packets[rx_idx], sizeof(pkt))) + if (!memcmp(pkt, net_rx_packets[priv->rx_idx], sizeof(pkt))) fail = 0;
- out_be16(&rxbd[rx_idx].length, 0); + out_be16(&rxbd[priv->rx_idx].length, 0); status = RXBD_EMPTY; - if ((rx_idx + 1) == PKTBUFSRX) + if ((priv->rx_idx + 1) == PKTBUFSRX) status |= RXBD_WRAP; - out_be16(&rxbd[rx_idx].status, status); - rx_idx = (rx_idx + 1) % PKTBUFSRX; + out_be16(&rxbd[priv->rx_idx].status, status); + priv->rx_idx = (priv->rx_idx + 1) % PKTBUFSRX;
if (in_be32(®s->ievent) & IEVENT_BSY) { out_be32(®s->ievent, IEVENT_BSY); @@ -330,8 +328,8 @@ static void startup_tsec(struct eth_device *dev) int i;
/* reset the indices to zero */ - rx_idx = 0; - tx_idx = 0; + priv->rx_idx = 0; + priv->tx_idx = 0; #ifdef CONFIG_SYS_FSL_ERRATUM_NMG_ETSEC129 uint svr; #endif @@ -388,32 +386,32 @@ static int tsec_send(struct eth_device *dev, void *packet, int length) int i;
/* Find an empty buffer descriptor */ - for (i = 0; in_be16(&txbd[tx_idx].status) & TXBD_READY; i++) { + for (i = 0; in_be16(&txbd[priv->tx_idx].status) & TXBD_READY; i++) { if (i >= TOUT_LOOP) { debug("%s: tsec: tx buffers full\n", dev->name); return result; } }
- out_be32(&txbd[tx_idx].bufptr, (u32)packet); - out_be16(&txbd[tx_idx].length, length); - status = in_be16(&txbd[tx_idx].status); - out_be16(&txbd[tx_idx].status, status | + out_be32(&txbd[priv->tx_idx].bufptr, (u32)packet); + out_be16(&txbd[priv->tx_idx].length, length); + status = in_be16(&txbd[priv->tx_idx].status); + out_be16(&txbd[priv->tx_idx].status, status | (TXBD_READY | TXBD_LAST | TXBD_CRC | TXBD_INTERRUPT));
/* Tell the DMA to go */ out_be32(®s->tstat, TSTAT_CLEAR_THALT);
/* Wait for buffer to be transmitted */ - for (i = 0; in_be16(&txbd[tx_idx].status) & TXBD_READY; i++) { + for (i = 0; in_be16(&txbd[priv->tx_idx].status) & TXBD_READY; i++) { if (i >= TOUT_LOOP) { debug("%s: tsec: tx error\n", dev->name); return result; } }
- tx_idx = (tx_idx + 1) % TX_BUF_CNT; - result = in_be16(&txbd[tx_idx].status) & TXBD_STATS; + priv->tx_idx = (priv->tx_idx + 1) % TX_BUF_CNT; + result = in_be16(&txbd[priv->tx_idx].status) & TXBD_STATS;
return result; } @@ -423,26 +421,26 @@ static int tsec_recv(struct eth_device *dev) struct tsec_private *priv = (struct tsec_private *)dev->priv; struct tsec __iomem *regs = priv->regs;
- while (!(in_be16(&rxbd[rx_idx].status) & RXBD_EMPTY)) { - int length = in_be16(&rxbd[rx_idx].length); - uint16_t status = in_be16(&rxbd[rx_idx].status); + while (!(in_be16(&rxbd[priv->rx_idx].status) & RXBD_EMPTY)) { + int length = in_be16(&rxbd[priv->rx_idx].length); + uint16_t status = in_be16(&rxbd[priv->rx_idx].status); + uchar *packet = net_rx_packets[priv->rx_idx];
/* Send the packet up if there were no errors */ if (!(status & RXBD_STATS)) - net_process_received_packet(net_rx_packets[rx_idx], - length - 4); + net_process_received_packet(packet, length - 4); else printf("Got error %x\n", (status & RXBD_STATS));
- out_be16(&rxbd[rx_idx].length, 0); + out_be16(&rxbd[priv->rx_idx].length, 0);
status = RXBD_EMPTY; /* Set the wrap bit if this is the last element in the list */ - if ((rx_idx + 1) == PKTBUFSRX) + if ((priv->rx_idx + 1) == PKTBUFSRX) status |= RXBD_WRAP; - out_be16(&rxbd[rx_idx].status, status); + out_be16(&rxbd[priv->rx_idx].status, status);
- rx_idx = (rx_idx + 1) % PKTBUFSRX; + priv->rx_idx = (priv->rx_idx + 1) % PKTBUFSRX; }
if (in_be32(®s->ievent) & IEVENT_BSY) { diff --git a/include/tsec.h b/include/tsec.h index f2aa11a..023f095 100644 --- a/include/tsec.h +++ b/include/tsec.h @@ -396,6 +396,8 @@ struct tsec_private { uint phyaddr; char mii_devname[16]; u32 flags; + uint rx_idx; /* index of the current RX buffer */ + uint tx_idx; /* index of the current TX buffer */ };
struct tsec_info_struct {

On Tue, Jan 12, 2016 at 12:41 AM, Bin Meng bmeng.cn@gmail.com wrote:
At present rx_idx and tx_idx are declared as static variables in the driver codes. To support multiple interfaces, move it to struct tsec_private.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
Acked-by: Joe Hershberger joe.hershberger@ni.com


rxbd and txbd are declared static with 8 byte alignment requirement, but they can be put into struct tsec_private as well and are natually aligned to 8 byte.
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
drivers/net/tsec.c | 69 +++++++++++++++++++++++++----------------------------- include/tsec.h | 4 ++++ 2 files changed, 36 insertions(+), 37 deletions(-)
diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c index 943c4b3..9a3b1a9 100644 --- a/drivers/net/tsec.c +++ b/drivers/net/tsec.c @@ -21,16 +21,6 @@
DECLARE_GLOBAL_DATA_PTR;
-#define TX_BUF_CNT 2 - -#ifdef __GNUC__ -static struct txbd8 __iomem txbd[TX_BUF_CNT] __aligned(8); -static struct rxbd8 __iomem rxbd[PKTBUFSRX] __aligned(8); - -#else -#error "rtx must be 64-bit aligned" -#endif - static int tsec_send(struct eth_device *dev, void *packet, int length);
/* Default initializations for TSEC controllers. */ @@ -277,7 +267,8 @@ void redundant_init(struct eth_device *dev) tsec_send(dev, (void *)pkt, sizeof(pkt));
/* Wait for buffer to be received */ - for (t = 0; in_be16(&rxbd[priv->rx_idx].status) & RXBD_EMPTY; + for (t = 0; + in_be16(&priv->rxbd[priv->rx_idx].status) & RXBD_EMPTY; t++) { if (t >= 10 * TOUT_LOOP) { printf("%s: tsec: rx error\n", dev->name); @@ -288,11 +279,11 @@ void redundant_init(struct eth_device *dev) if (!memcmp(pkt, net_rx_packets[priv->rx_idx], sizeof(pkt))) fail = 0;
- out_be16(&rxbd[priv->rx_idx].length, 0); + out_be16(&priv->rxbd[priv->rx_idx].length, 0); status = RXBD_EMPTY; if ((priv->rx_idx + 1) == PKTBUFSRX) status |= RXBD_WRAP; - out_be16(&rxbd[priv->rx_idx].status, status); + out_be16(&priv->rxbd[priv->rx_idx].status, status); priv->rx_idx = (priv->rx_idx + 1) % PKTBUFSRX;
if (in_be32(®s->ievent) & IEVENT_BSY) { @@ -335,26 +326,26 @@ static void startup_tsec(struct eth_device *dev) #endif
/* Point to the buffer descriptors */ - out_be32(®s->tbase, (u32)&txbd[0]); - out_be32(®s->rbase, (u32)&rxbd[0]); + out_be32(®s->tbase, (u32)&priv->txbd[0]); + out_be32(®s->rbase, (u32)&priv->rxbd[0]);
/* Initialize the Rx Buffer descriptors */ for (i = 0; i < PKTBUFSRX; i++) { - out_be16(&rxbd[i].status, RXBD_EMPTY); - out_be16(&rxbd[i].length, 0); - out_be32(&rxbd[i].bufptr, (u32)net_rx_packets[i]); + out_be16(&priv->rxbd[i].status, RXBD_EMPTY); + out_be16(&priv->rxbd[i].length, 0); + out_be32(&priv->rxbd[i].bufptr, (u32)net_rx_packets[i]); } - status = in_be16(&rxbd[PKTBUFSRX - 1].status); - out_be16(&rxbd[PKTBUFSRX - 1].status, status | RXBD_WRAP); + status = in_be16(&priv->rxbd[PKTBUFSRX - 1].status); + out_be16(&priv->rxbd[PKTBUFSRX - 1].status, status | RXBD_WRAP);
/* Initialize the TX Buffer Descriptors */ for (i = 0; i < TX_BUF_CNT; i++) { - out_be16(&txbd[i].status, 0); - out_be16(&txbd[i].length, 0); - out_be32(&txbd[i].bufptr, 0); + out_be16(&priv->txbd[i].status, 0); + out_be16(&priv->txbd[i].length, 0); + out_be32(&priv->txbd[i].bufptr, 0); } - status = in_be16(&txbd[TX_BUF_CNT - 1].status); - out_be16(&txbd[TX_BUF_CNT - 1].status, status | TXBD_WRAP); + status = in_be16(&priv->txbd[TX_BUF_CNT - 1].status); + out_be16(&priv->txbd[TX_BUF_CNT - 1].status, status | TXBD_WRAP);
#ifdef CONFIG_SYS_FSL_ERRATUM_NMG_ETSEC129 svr = get_svr(); @@ -386,24 +377,28 @@ static int tsec_send(struct eth_device *dev, void *packet, int length) int i;
/* Find an empty buffer descriptor */ - for (i = 0; in_be16(&txbd[priv->tx_idx].status) & TXBD_READY; i++) { + for (i = 0; + in_be16(&priv->txbd[priv->tx_idx].status) & TXBD_READY; + i++) { if (i >= TOUT_LOOP) { debug("%s: tsec: tx buffers full\n", dev->name); return result; } }
- out_be32(&txbd[priv->tx_idx].bufptr, (u32)packet); - out_be16(&txbd[priv->tx_idx].length, length); - status = in_be16(&txbd[priv->tx_idx].status); - out_be16(&txbd[priv->tx_idx].status, status | + out_be32(&priv->txbd[priv->tx_idx].bufptr, (u32)packet); + out_be16(&priv->txbd[priv->tx_idx].length, length); + status = in_be16(&priv->txbd[priv->tx_idx].status); + out_be16(&priv->txbd[priv->tx_idx].status, status | (TXBD_READY | TXBD_LAST | TXBD_CRC | TXBD_INTERRUPT));
/* Tell the DMA to go */ out_be32(®s->tstat, TSTAT_CLEAR_THALT);
/* Wait for buffer to be transmitted */ - for (i = 0; in_be16(&txbd[priv->tx_idx].status) & TXBD_READY; i++) { + for (i = 0; + in_be16(&priv->txbd[priv->tx_idx].status) & TXBD_READY; + i++) { if (i >= TOUT_LOOP) { debug("%s: tsec: tx error\n", dev->name); return result; @@ -411,7 +406,7 @@ static int tsec_send(struct eth_device *dev, void *packet, int length) }
priv->tx_idx = (priv->tx_idx + 1) % TX_BUF_CNT; - result = in_be16(&txbd[priv->tx_idx].status) & TXBD_STATS; + result = in_be16(&priv->txbd[priv->tx_idx].status) & TXBD_STATS;
return result; } @@ -421,9 +416,9 @@ static int tsec_recv(struct eth_device *dev) struct tsec_private *priv = (struct tsec_private *)dev->priv; struct tsec __iomem *regs = priv->regs;
- while (!(in_be16(&rxbd[priv->rx_idx].status) & RXBD_EMPTY)) { - int length = in_be16(&rxbd[priv->rx_idx].length); - uint16_t status = in_be16(&rxbd[priv->rx_idx].status); + while (!(in_be16(&priv->rxbd[priv->rx_idx].status) & RXBD_EMPTY)) { + int length = in_be16(&priv->rxbd[priv->rx_idx].length); + uint16_t status = in_be16(&priv->rxbd[priv->rx_idx].status); uchar *packet = net_rx_packets[priv->rx_idx];
/* Send the packet up if there were no errors */ @@ -432,13 +427,13 @@ static int tsec_recv(struct eth_device *dev) else printf("Got error %x\n", (status & RXBD_STATS));
- out_be16(&rxbd[priv->rx_idx].length, 0); + out_be16(&priv->rxbd[priv->rx_idx].length, 0);
status = RXBD_EMPTY; /* Set the wrap bit if this is the last element in the list */ if ((priv->rx_idx + 1) == PKTBUFSRX) status |= RXBD_WRAP; - out_be16(&rxbd[priv->rx_idx].status, status); + out_be16(&priv->rxbd[priv->rx_idx].status, status);
priv->rx_idx = (priv->rx_idx + 1) % PKTBUFSRX; } diff --git a/include/tsec.h b/include/tsec.h index 023f095..7200229 100644 --- a/include/tsec.h +++ b/include/tsec.h @@ -387,7 +387,11 @@ struct tsec { #define TSEC_REDUCED (1 << 1) /* MAC-PHY interface uses RGMII */ #define TSEC_SGMII (1 << 2) /* MAC-PHY interface uses SGMII */
+#define TX_BUF_CNT 2 + struct tsec_private { + struct txbd8 __iomem txbd[TX_BUF_CNT]; + struct rxbd8 __iomem rxbd[PKTBUFSRX]; struct tsec __iomem *regs; struct tsec_mii_mng __iomem *phyregs_sgmii; struct phy_device *phydev;

On Tue, Jan 12, 2016 at 12:41 AM, Bin Meng bmeng.cn@gmail.com wrote:
rxbd and txbd are declared static with 8 byte alignment requirement, but they can be put into struct tsec_private as well and are natually aligned to 8 byte.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
Acked-by: Joe Hershberger joe.hershberger@ni.com


Adjust static functions in a proper order so that forward declaration of tsec_send() can be avoided.
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
drivers/net/tsec.c | 208 ++++++++++++++++++++++++++--------------------------- 1 file changed, 103 insertions(+), 105 deletions(-)
diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c index 9a3b1a9..ea2363e 100644 --- a/drivers/net/tsec.c +++ b/drivers/net/tsec.c @@ -21,8 +21,6 @@
DECLARE_GLOBAL_DATA_PTR;
-static int tsec_send(struct eth_device *dev, void *packet, int length); - /* Default initializations for TSEC controllers. */
static struct tsec_info_struct tsec_info[] = { @@ -221,6 +219,109 @@ static void adjust_link(struct tsec_private *priv, struct phy_device *phydev) (phydev->port == PORT_FIBRE) ? ", fiber mode" : ""); }
+/* + * This returns the status bits of the device. The return value + * is never checked, and this is what the 8260 driver did, so we + * do the same. Presumably, this would be zero if there were no + * errors + */ +static int tsec_send(struct eth_device *dev, void *packet, int length) +{ + struct tsec_private *priv = (struct tsec_private *)dev->priv; + struct tsec __iomem *regs = priv->regs; + uint16_t status; + int result = 0; + int i; + + /* Find an empty buffer descriptor */ + for (i = 0; + in_be16(&priv->txbd[priv->tx_idx].status) & TXBD_READY; + i++) { + if (i >= TOUT_LOOP) { + debug("%s: tsec: tx buffers full\n", dev->name); + return result; + } + } + + out_be32(&priv->txbd[priv->tx_idx].bufptr, (u32)packet); + out_be16(&priv->txbd[priv->tx_idx].length, length); + status = in_be16(&priv->txbd[priv->tx_idx].status); + out_be16(&priv->txbd[priv->tx_idx].status, status | + (TXBD_READY | TXBD_LAST | TXBD_CRC | TXBD_INTERRUPT)); + + /* Tell the DMA to go */ + out_be32(®s->tstat, TSTAT_CLEAR_THALT); + + /* Wait for buffer to be transmitted */ + for (i = 0; + in_be16(&priv->txbd[priv->tx_idx].status) & TXBD_READY; + i++) { + if (i >= TOUT_LOOP) { + debug("%s: tsec: tx error\n", dev->name); + return result; + } + } + + priv->tx_idx = (priv->tx_idx + 1) % TX_BUF_CNT; + result = in_be16(&priv->txbd[priv->tx_idx].status) & TXBD_STATS; + + return result; +} + +static int tsec_recv(struct eth_device *dev) +{ + struct tsec_private *priv = (struct tsec_private *)dev->priv; + struct tsec __iomem *regs = priv->regs; + + while (!(in_be16(&priv->rxbd[priv->rx_idx].status) & RXBD_EMPTY)) { + int length = in_be16(&priv->rxbd[priv->rx_idx].length); + uint16_t status = in_be16(&priv->rxbd[priv->rx_idx].status); + uchar *packet = net_rx_packets[priv->rx_idx]; + + /* Send the packet up if there were no errors */ + if (!(status & RXBD_STATS)) + net_process_received_packet(packet, length - 4); + else + printf("Got error %x\n", (status & RXBD_STATS)); + + out_be16(&priv->rxbd[priv->rx_idx].length, 0); + + status = RXBD_EMPTY; + /* Set the wrap bit if this is the last element in the list */ + if ((priv->rx_idx + 1) == PKTBUFSRX) + status |= RXBD_WRAP; + out_be16(&priv->rxbd[priv->rx_idx].status, status); + + priv->rx_idx = (priv->rx_idx + 1) % PKTBUFSRX; + } + + if (in_be32(®s->ievent) & IEVENT_BSY) { + out_be32(®s->ievent, IEVENT_BSY); + out_be32(®s->rstat, RSTAT_CLEAR_RHALT); + } + + return -1; +} + +/* Stop the interface */ +static void tsec_halt(struct eth_device *dev) +{ + struct tsec_private *priv = (struct tsec_private *)dev->priv; + struct tsec __iomem *regs = priv->regs; + + clrbits_be32(®s->dmactrl, DMACTRL_GRS | DMACTRL_GTS); + setbits_be32(®s->dmactrl, DMACTRL_GRS | DMACTRL_GTS); + + while ((in_be32(®s->ievent) & (IEVENT_GRSC | IEVENT_GTSC)) + != (IEVENT_GRSC | IEVENT_GTSC)) + ; + + clrbits_be32(®s->maccfg1, MACCFG1_TX_EN | MACCFG1_RX_EN); + + /* Shut down the PHY, as needed */ + phy_shutdown(priv->phydev); +} + #ifdef CONFIG_SYS_FSL_ERRATUM_NMG_ETSEC129 /* * When MACCFG1[Rx_EN] is enabled during system boot as part @@ -363,109 +464,6 @@ static void startup_tsec(struct eth_device *dev) }
/* - * This returns the status bits of the device. The return value - * is never checked, and this is what the 8260 driver did, so we - * do the same. Presumably, this would be zero if there were no - * errors - */ -static int tsec_send(struct eth_device *dev, void *packet, int length) -{ - struct tsec_private *priv = (struct tsec_private *)dev->priv; - struct tsec __iomem *regs = priv->regs; - uint16_t status; - int result = 0; - int i; - - /* Find an empty buffer descriptor */ - for (i = 0; - in_be16(&priv->txbd[priv->tx_idx].status) & TXBD_READY; - i++) { - if (i >= TOUT_LOOP) { - debug("%s: tsec: tx buffers full\n", dev->name); - return result; - } - } - - out_be32(&priv->txbd[priv->tx_idx].bufptr, (u32)packet); - out_be16(&priv->txbd[priv->tx_idx].length, length); - status = in_be16(&priv->txbd[priv->tx_idx].status); - out_be16(&priv->txbd[priv->tx_idx].status, status | - (TXBD_READY | TXBD_LAST | TXBD_CRC | TXBD_INTERRUPT)); - - /* Tell the DMA to go */ - out_be32(®s->tstat, TSTAT_CLEAR_THALT); - - /* Wait for buffer to be transmitted */ - for (i = 0; - in_be16(&priv->txbd[priv->tx_idx].status) & TXBD_READY; - i++) { - if (i >= TOUT_LOOP) { - debug("%s: tsec: tx error\n", dev->name); - return result; - } - } - - priv->tx_idx = (priv->tx_idx + 1) % TX_BUF_CNT; - result = in_be16(&priv->txbd[priv->tx_idx].status) & TXBD_STATS; - - return result; -} - -static int tsec_recv(struct eth_device *dev) -{ - struct tsec_private *priv = (struct tsec_private *)dev->priv; - struct tsec __iomem *regs = priv->regs; - - while (!(in_be16(&priv->rxbd[priv->rx_idx].status) & RXBD_EMPTY)) { - int length = in_be16(&priv->rxbd[priv->rx_idx].length); - uint16_t status = in_be16(&priv->rxbd[priv->rx_idx].status); - uchar *packet = net_rx_packets[priv->rx_idx]; - - /* Send the packet up if there were no errors */ - if (!(status & RXBD_STATS)) - net_process_received_packet(packet, length - 4); - else - printf("Got error %x\n", (status & RXBD_STATS)); - - out_be16(&priv->rxbd[priv->rx_idx].length, 0); - - status = RXBD_EMPTY; - /* Set the wrap bit if this is the last element in the list */ - if ((priv->rx_idx + 1) == PKTBUFSRX) - status |= RXBD_WRAP; - out_be16(&priv->rxbd[priv->rx_idx].status, status); - - priv->rx_idx = (priv->rx_idx + 1) % PKTBUFSRX; - } - - if (in_be32(®s->ievent) & IEVENT_BSY) { - out_be32(®s->ievent, IEVENT_BSY); - out_be32(®s->rstat, RSTAT_CLEAR_RHALT); - } - - return -1; -} - -/* Stop the interface */ -static void tsec_halt(struct eth_device *dev) -{ - struct tsec_private *priv = (struct tsec_private *)dev->priv; - struct tsec __iomem *regs = priv->regs; - - clrbits_be32(®s->dmactrl, DMACTRL_GRS | DMACTRL_GTS); - setbits_be32(®s->dmactrl, DMACTRL_GRS | DMACTRL_GTS); - - while ((in_be32(®s->ievent) & (IEVENT_GRSC | IEVENT_GTSC)) - != (IEVENT_GRSC | IEVENT_GTSC)) - ; - - clrbits_be32(®s->maccfg1, MACCFG1_TX_EN | MACCFG1_RX_EN); - - /* Shut down the PHY, as needed */ - phy_shutdown(priv->phydev); -} - -/* * Initializes data structures and registers for the controller, * and brings the interface up. Returns the link status, meaning * that it returns success if the link is up, failure otherwise.

On Tue, Jan 12, 2016 at 12:41 AM, Bin Meng bmeng.cn@gmail.com wrote:
Adjust static functions in a proper order so that forward declaration of tsec_send() can be avoided.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
Acked-by: Joe Hershberger joe.hershberger@ni.com


For internal routines like redundant_init(), startup_tsec() and init_phy(), change to use tsec_private pointer as the parameter.
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
drivers/net/tsec.c | 23 +++++++++++------------ include/tsec.h | 1 + 2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c index ea2363e..7e8bc68 100644 --- a/drivers/net/tsec.c +++ b/drivers/net/tsec.c @@ -328,9 +328,8 @@ static void tsec_halt(struct eth_device *dev) * of the eTSEC port initialization sequence, * the eTSEC Rx logic may not be properly initialized. */ -void redundant_init(struct eth_device *dev) +void redundant_init(struct tsec_private *priv) { - struct tsec_private *priv = dev->priv; struct tsec __iomem *regs = priv->regs; uint t, count = 0; int fail = 1; @@ -365,14 +364,14 @@ void redundant_init(struct eth_device *dev)
do { uint16_t status; - tsec_send(dev, (void *)pkt, sizeof(pkt)); + tsec_send(priv->dev, (void *)pkt, sizeof(pkt));
/* Wait for buffer to be received */ for (t = 0; in_be16(&priv->rxbd[priv->rx_idx].status) & RXBD_EMPTY; t++) { if (t >= 10 * TOUT_LOOP) { - printf("%s: tsec: rx error\n", dev->name); + printf("%s: tsec: rx error\n", priv->dev->name); break; } } @@ -412,9 +411,8 @@ void redundant_init(struct eth_device *dev) * Set up the buffers and their descriptors, and bring up the * interface */ -static void startup_tsec(struct eth_device *dev) +static void startup_tsec(struct tsec_private *priv) { - struct tsec_private *priv = (struct tsec_private *)dev->priv; struct tsec __iomem *regs = priv->regs; uint16_t status; int i; @@ -451,7 +449,7 @@ static void startup_tsec(struct eth_device *dev) #ifdef CONFIG_SYS_FSL_ERRATUM_NMG_ETSEC129 svr = get_svr(); if ((SVR_MAJ(svr) == 1) || IS_SVR_REV(svr, 2, 0)) - redundant_init(dev); + redundant_init(priv); #endif /* Enable Transmit and Receive */ setbits_be32(®s->maccfg1, MACCFG1_RX_EN | MACCFG1_TX_EN); @@ -504,7 +502,7 @@ static int tsec_init(struct eth_device *dev, bd_t * bd) init_registers(regs);
/* Ready the device for tx/rx */ - startup_tsec(dev); + startup_tsec(priv);
/* Start up the PHY */ ret = phy_startup(priv->phydev); @@ -567,9 +565,8 @@ static phy_interface_t tsec_get_interface(struct tsec_private *priv) * properly. If the PHY is not recognized, then return 0 * (failure). Otherwise, return 1 */ -static int init_phy(struct eth_device *dev) +static int init_phy(struct tsec_private *priv) { - struct tsec_private *priv = (struct tsec_private *)dev->priv; struct phy_device *phydev; struct tsec __iomem *regs = priv->regs; u32 supported = (SUPPORTED_10baseT_Half | @@ -588,7 +585,8 @@ static int init_phy(struct eth_device *dev) if (priv->interface == PHY_INTERFACE_MODE_SGMII) tsec_configure_serdes(priv);
- phydev = phy_connect(priv->bus, priv->phyaddr, dev, priv->interface); + phydev = phy_connect(priv->bus, priv->phyaddr, priv->dev, + priv->interface); if (!phydev) return 0;
@@ -633,6 +631,7 @@ static int tsec_initialize(bd_t *bis, struct tsec_info_struct *tsec_info) sprintf(dev->name, tsec_info->devname); priv->interface = tsec_info->interface; priv->bus = miiphy_get_dev_by_name(tsec_info->mii_devname); + priv->dev = dev; dev->iobase = 0; dev->priv = priv; dev->init = tsec_init; @@ -655,7 +654,7 @@ static int tsec_initialize(bd_t *bis, struct tsec_info_struct *tsec_info) clrbits_be32(&priv->regs->maccfg1, MACCFG1_SOFT_RESET);
/* Try to initialize PHY here, and return */ - return init_phy(dev); + return init_phy(priv); }
/* diff --git a/include/tsec.h b/include/tsec.h index 7200229..e8b03d6 100644 --- a/include/tsec.h +++ b/include/tsec.h @@ -402,6 +402,7 @@ struct tsec_private { u32 flags; uint rx_idx; /* index of the current RX buffer */ uint tx_idx; /* index of the current TX buffer */ + struct eth_device *dev; };
struct tsec_info_struct {

On Tue, Jan 12, 2016 at 12:41 AM, Bin Meng bmeng.cn@gmail.com wrote:
For internal routines like redundant_init(), startup_tsec() and init_phy(), change to use tsec_private pointer as the parameter.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
Acked-by: Joe Hershberger joe.hershberger@ni.com


Adapted from the same file name in the kernel device tree bindings documentation, to use with U-Boot.
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
doc/device-tree-bindings/net/fsl-tsec-phy.txt | 43 +++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 doc/device-tree-bindings/net/fsl-tsec-phy.txt
diff --git a/doc/device-tree-bindings/net/fsl-tsec-phy.txt b/doc/device-tree-bindings/net/fsl-tsec-phy.txt new file mode 100644 index 0000000..dbe91aa --- /dev/null +++ b/doc/device-tree-bindings/net/fsl-tsec-phy.txt @@ -0,0 +1,43 @@ +* TSEC-compatible ethernet nodes + +Properties: + + - compatible : Should be "fsl,tsec" + - reg : Offset and length of the register set for the device + - phy-handle : See ethernet.txt file in the same directory. + - phy-connection-type : See ethernet.txt file in the same directory. This + property is only really needed if the connection is of type "rgmii-id", + "rgmii-rxid" and "rgmii-txid" as all other connection types are detected + by hardware. + +Example: + ethernet@24000 { + compatible = "fsl,tsec"; + reg = <0x24000 0x1000>; + phy-handle = <&phy0>; + phy-connection-type = "sgmii"; + }; + +Child nodes of the TSEC controller are typically the individual PHY devices +connected via the MDIO bus (sometimes the MDIO bus controller is separate). + +* MDIO IO device + +The MDIO is a bus to which the PHY devices are connected. For each +device that exists on this bus, a PHY node should be created. + +Required properties: + - compatible : Should define the compatible device type for the + mdio. Currently supported string/device is "fsl,tsec-mdio". + - reg : Offset and length of the register set for the device + +Example: + + mdio@24520 { + compatible = "fsl,tsec-mdio"; + reg = <0x24520 0x20>; + + ethernet-phy@0 { + reg = <0>; + }; + };

On Tue, Jan 12, 2016 at 12:41 AM, Bin Meng bmeng.cn@gmail.com wrote:
Adapted from the same file name in the kernel device tree bindings documentation, to use with U-Boot.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
Acked-by: Joe Hershberger joe.hershberger@ni.com


This adds driver model support to Freescale TSEC ethernet driver.
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
drivers/net/tsec.c | 186 +++++++++++++++++++++++++++++++++++++++++++++++++++++ include/tsec.h | 10 +++ 2 files changed, 196 insertions(+)
diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c index 7e8bc68..18b44f6 100644 --- a/drivers/net/tsec.c +++ b/drivers/net/tsec.c @@ -10,6 +10,7 @@
#include <config.h> #include <common.h> +#include <dm.h> #include <malloc.h> #include <net.h> #include <command.h> @@ -21,6 +22,7 @@
DECLARE_GLOBAL_DATA_PTR;
+#ifndef CONFIG_DM_ETH /* Default initializations for TSEC controllers. */
static struct tsec_info_struct tsec_info[] = { @@ -46,6 +48,7 @@ static struct tsec_info_struct tsec_info[] = { STD_TSEC_INFO(4), /* TSEC4 */ #endif }; +#endif /* CONFIG_DM_ETH */
#define TBIANA_SETTINGS ( \ TBIANA_ASYMMETRIC_PAUSE \ @@ -98,7 +101,11 @@ static void tsec_configure_serdes(struct tsec_private *priv) * for PowerPC (tm) is usually the case) in the register holds * the entry. */ +#ifndef CONFIG_DM_ETH static int tsec_mcast_addr(struct eth_device *dev, const u8 *mcast_mac, u8 set) +#else +static int tsec_mcast_addr(struct udevice *dev, const u8 *mcast_mac, int set) +#endif { struct tsec_private *priv = (struct tsec_private *)dev->priv; struct tsec __iomem *regs = priv->regs; @@ -225,7 +232,11 @@ static void adjust_link(struct tsec_private *priv, struct phy_device *phydev) * do the same. Presumably, this would be zero if there were no * errors */ +#ifndef CONFIG_DM_ETH static int tsec_send(struct eth_device *dev, void *packet, int length) +#else +static int tsec_send(struct udevice *dev, void *packet, int length) +#endif { struct tsec_private *priv = (struct tsec_private *)dev->priv; struct tsec __iomem *regs = priv->regs; @@ -268,6 +279,7 @@ static int tsec_send(struct eth_device *dev, void *packet, int length) return result; }
+#ifndef CONFIG_DM_ETH static int tsec_recv(struct eth_device *dev) { struct tsec_private *priv = (struct tsec_private *)dev->priv; @@ -302,9 +314,61 @@ static int tsec_recv(struct eth_device *dev)
return -1; } +#else +static int tsec_recv(struct udevice *dev, int flags, uchar **packetp) +{ + struct tsec_private *priv = (struct tsec_private *)dev->priv; + struct tsec __iomem *regs = priv->regs; + int ret = -1; + + if (!(in_be16(&priv->rxbd[priv->rx_idx].status) & RXBD_EMPTY)) { + int length = in_be16(&priv->rxbd[priv->rx_idx].length); + uint16_t status = in_be16(&priv->rxbd[priv->rx_idx].status); + uint32_t buf; + + /* Send the packet up if there were no errors */ + if (!(status & RXBD_STATS)) { + buf = in_be32(&priv->rxbd[priv->rx_idx].bufptr); + *packetp = (uchar *)buf; + ret = length - 4; + } else { + printf("Got error %x\n", (status & RXBD_STATS)); + } + } + + if (in_be32(®s->ievent) & IEVENT_BSY) { + out_be32(®s->ievent, IEVENT_BSY); + out_be32(®s->rstat, RSTAT_CLEAR_RHALT); + } + + return ret; +} + +static int tsec_free_pkt(struct udevice *dev, uchar *packet, int length) +{ + struct tsec_private *priv = (struct tsec_private *)dev->priv; + uint16_t status; + + out_be16(&priv->rxbd[priv->rx_idx].length, 0); + + status = RXBD_EMPTY; + /* Set the wrap bit if this is the last element in the list */ + if ((priv->rx_idx + 1) == PKTBUFSRX) + status |= RXBD_WRAP; + out_be16(&priv->rxbd[priv->rx_idx].status, status); + + priv->rx_idx = (priv->rx_idx + 1) % PKTBUFSRX; + + return 0; +} +#endif
/* Stop the interface */ +#ifndef CONFIG_DM_ETH static void tsec_halt(struct eth_device *dev) +#else +static void tsec_halt(struct udevice *dev) +#endif { struct tsec_private *priv = (struct tsec_private *)dev->priv; struct tsec __iomem *regs = priv->regs; @@ -467,9 +531,16 @@ static void startup_tsec(struct tsec_private *priv) * that it returns success if the link is up, failure otherwise. * This allows U-Boot to find the first active controller. */ +#ifndef CONFIG_DM_ETH static int tsec_init(struct eth_device *dev, bd_t * bd) +#else +static int tsec_init(struct udevice *dev) +#endif { struct tsec_private *priv = (struct tsec_private *)dev->priv; +#ifdef CONFIG_DM_ETH + struct eth_pdata *pdata = dev_get_platdata(dev); +#endif struct tsec __iomem *regs = priv->regs; u32 tempval; int ret; @@ -489,12 +560,21 @@ static int tsec_init(struct eth_device *dev, bd_t * bd) * order (BE), MACnADDR1 is set to 0xCDAB7856 and * MACnADDR2 is set to 0x34120000. */ +#ifndef CONFIG_DM_ETH tempval = (dev->enetaddr[5] << 24) | (dev->enetaddr[4] << 16) | (dev->enetaddr[3] << 8) | dev->enetaddr[2]; +#else + tempval = (pdata->enetaddr[5] << 24) | (pdata->enetaddr[4] << 16) | + (pdata->enetaddr[3] << 8) | pdata->enetaddr[2]; +#endif
out_be32(®s->macstnaddr1, tempval);
+#ifndef CONFIG_DM_ETH tempval = (dev->enetaddr[1] << 24) | (dev->enetaddr[0] << 16); +#else + tempval = (pdata->enetaddr[1] << 24) | (pdata->enetaddr[0] << 16); +#endif
out_be32(®s->macstnaddr2, tempval);
@@ -600,6 +680,7 @@ static int init_phy(struct tsec_private *priv) return 1; }
+#ifndef CONFIG_DM_ETH /* * Initialize device structure. Returns success if PHY * initialization succeeded (i.e. if it recognizes the PHY) @@ -687,3 +768,108 @@ int tsec_standard_init(bd_t *bis)
return tsec_eth_init(bis, tsec_info, ARRAY_SIZE(tsec_info)); } +#else /* CONFIG_DM_ETH */ +int tsec_probe(struct udevice *dev) +{ + struct tsec_private *priv = dev_get_priv(dev); + struct eth_pdata *pdata = dev_get_platdata(dev); + struct fsl_pq_mdio_info mdio_info; + int offset = 0; + int reg; + const char *phy_mode; + int ret; + + pdata->iobase = (phys_addr_t)dev_get_addr(dev); + priv->regs = (struct tsec *)pdata->iobase; + + offset = fdtdec_lookup_phandle(gd->fdt_blob, dev->of_offset, + "phy-handle"); + if (offset > 0) { + reg = fdtdec_get_int(gd->fdt_blob, offset, "reg", 0); + priv->phyaddr = reg; + } else { + debug("phy-handle does not exist under tsec %s\n", dev->name); + return -ENOENT; + } + + offset = fdt_parent_offset(gd->fdt_blob, offset); + if (offset > 0) { + reg = fdtdec_get_int(gd->fdt_blob, offset, "reg", 0); + priv->phyregs_sgmii = (struct tsec_mii_mng *)(reg + 0x520); + } else { + debug("No parent node for PHY?\n"); + return -ENOENT; + } + + phy_mode = fdt_getprop(gd->fdt_blob, dev->of_offset, + "phy-connection-type", NULL); + if (phy_mode) + pdata->phy_interface = phy_get_interface_by_name(phy_mode); + if (pdata->phy_interface == -1) { + debug("Invalid PHY interface '%s'\n", phy_mode); + return -EINVAL; + } + priv->interface = pdata->phy_interface; + + /* Initialize flags */ + priv->flags = TSEC_GIGABIT; + if (priv->interface == PHY_INTERFACE_MODE_SGMII) + priv->flags |= TSEC_SGMII; + + mdio_info.regs = priv->phyregs_sgmii; + mdio_info.name = (char *)dev->name; + ret = fsl_pq_mdio_init(NULL, &mdio_info); + if (ret) + return ret; + + /* Reset the MAC */ + setbits_be32(&priv->regs->maccfg1, MACCFG1_SOFT_RESET); + udelay(2); /* Soft Reset must be asserted for 3 TX clocks */ + clrbits_be32(&priv->regs->maccfg1, MACCFG1_SOFT_RESET); + + priv->dev = dev; + priv->bus = miiphy_get_dev_by_name(dev->name); + + /* Try to initialize PHY here, and return */ + return !init_phy(priv); +} + +int tsec_remove(struct udevice *dev) +{ + struct tsec_private *priv = dev->priv; + + free(priv->phydev); + mdio_unregister(priv->bus); + mdio_free(priv->bus); + + return 0; +} + +static const struct eth_ops tsec_ops = { + .start = tsec_init, + .send = tsec_send, + .recv = tsec_recv, + .free_pkt = tsec_free_pkt, + .stop = tsec_halt, +#ifdef CONFIG_MCAST_TFTP + .mcast = tsec_mcast_addr, +#endif +}; + +static const struct udevice_id tsec_ids[] = { + { .compatible = "fsl,tsec" }, + { } +}; + +U_BOOT_DRIVER(eth_tsec) = { + .name = "tsec", + .id = UCLASS_ETH, + .of_match = tsec_ids, + .probe = tsec_probe, + .remove = tsec_remove, + .ops = &tsec_ops, + .priv_auto_alloc_size = sizeof(struct tsec_private), + .platdata_auto_alloc_size = sizeof(struct eth_pdata), + .flags = DM_FLAG_ALLOC_PRIV_DMA, +}; +#endif /* CONFIG_DM_ETH */ diff --git a/include/tsec.h b/include/tsec.h index e8b03d6..88ce964 100644 --- a/include/tsec.h +++ b/include/tsec.h @@ -18,6 +18,8 @@ #include <config.h> #include <phy.h>
+#ifndef CONFIG_DM_ETH + #ifdef CONFIG_LS102XA #define TSEC_SIZE 0x40000 #define TSEC_MDIO_OFFSET 0x40000 @@ -64,6 +66,8 @@ x.mii_devname = DEFAULT_MII_NAME;\ }
+#endif /* CONFIG_DM_ETH */ + #define MAC_ADDR_LEN 6
/* #define TSEC_TIMEOUT 1000000 */ @@ -402,7 +406,11 @@ struct tsec_private { u32 flags; uint rx_idx; /* index of the current RX buffer */ uint tx_idx; /* index of the current TX buffer */ +#ifndef CONFIG_DM_ETH struct eth_device *dev; +#else + struct udevice *dev; +#endif };
struct tsec_info_struct { @@ -415,7 +423,9 @@ struct tsec_info_struct { u32 flags; };
+#ifndef CONFIG_DM_ETH int tsec_standard_init(bd_t *bis); int tsec_eth_init(bd_t *bis, struct tsec_info_struct *tsec_info, int num); +#endif
#endif /* __TSEC_H */

On 11 January 2016 at 23:41, Bin Meng bmeng.cn@gmail.com wrote:
This adds driver model support to Freescale TSEC ethernet driver.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
drivers/net/tsec.c | 186 +++++++++++++++++++++++++++++++++++++++++++++++++++++ include/tsec.h | 10 +++ 2 files changed, 196 insertions(+)
Reviewed-by: Simon Glass sjg@chromium.org

On Tue, Jan 12, 2016 at 12:41 AM, Bin Meng bmeng.cn@gmail.com wrote:
This adds driver model support to Freescale TSEC ethernet driver.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
Acked-by: Joe Hershberger joe.hershberger@ni.com


Add a new member 'tbiaddr' to tsec_private struct. For non-DM driver, it is initialized as CONFIG_SYS_TBIPA_VALUE, but for DM driver, we can get this from device tree. Update the bindings doc as well.
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
doc/device-tree-bindings/net/fsl-tsec-phy.txt | 21 +++++++++++++++++++++ drivers/net/tsec.c | 13 ++++++++++++- include/tsec.h | 1 + 3 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/doc/device-tree-bindings/net/fsl-tsec-phy.txt b/doc/device-tree-bindings/net/fsl-tsec-phy.txt index dbe91aa..c5bf48c 100644 --- a/doc/device-tree-bindings/net/fsl-tsec-phy.txt +++ b/doc/device-tree-bindings/net/fsl-tsec-phy.txt @@ -41,3 +41,24 @@ Example: reg = <0>; }; }; + +* TBI Internal MDIO bus + +As of this writing, every tsec is associated with an internal TBI PHY. +This PHY is accessed through the local MDIO bus. These buses are defined +similarly to the mdio buses. The TBI PHYs underneath them are similar to +normal PHYs, but the reg property is considered instructive, rather than +descriptive. The reg property should be chosen so it doesn't interfere +with other PHYs on the bus. The TBI PHYs are referred to by a "tbi-handle" +property under the tsec node, which has a similar meaning of "phy-handle". + +Example: + ethernet@24000 { + phy-handle = <&tbi1>; + }; + + mdio@24520 { + tbi1: tbi-phy@1f { + reg = <0x1f>; + }; + }; diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c index 18b44f6..025e7a7 100644 --- a/drivers/net/tsec.c +++ b/drivers/net/tsec.c @@ -658,7 +658,7 @@ static int init_phy(struct tsec_private *priv) supported |= SUPPORTED_1000baseT_Full;
/* Assign a Physical address to the TBI */ - out_be32(®s->tbipa, CONFIG_SYS_TBIPA_VALUE); + out_be32(®s->tbipa, priv->tbiaddr);
priv->interface = tsec_get_interface(priv);
@@ -707,6 +707,7 @@ static int tsec_initialize(bd_t *bis, struct tsec_info_struct *tsec_info) priv->phyregs_sgmii = tsec_info->miiregs_sgmii;
priv->phyaddr = tsec_info->phyaddr; + priv->tbiaddr = CONFIG_SYS_TBIPA_VALUE; priv->flags = tsec_info->flags;
sprintf(dev->name, tsec_info->devname); @@ -801,6 +802,16 @@ int tsec_probe(struct udevice *dev) return -ENOENT; }
+ offset = fdtdec_lookup_phandle(gd->fdt_blob, dev->of_offset, + "tbi-handle"); + if (offset > 0) { + reg = fdtdec_get_int(gd->fdt_blob, offset, "reg", + CONFIG_SYS_TBIPA_VALUE); + priv->tbiaddr = reg; + } else { + priv->tbiaddr = CONFIG_SYS_TBIPA_VALUE; + } + phy_mode = fdt_getprop(gd->fdt_blob, dev->of_offset, "phy-connection-type", NULL); if (phy_mode) diff --git a/include/tsec.h b/include/tsec.h index 88ce964..fb27edf 100644 --- a/include/tsec.h +++ b/include/tsec.h @@ -402,6 +402,7 @@ struct tsec_private { phy_interface_t interface; struct mii_dev *bus; uint phyaddr; + uint tbiaddr; char mii_devname[16]; u32 flags; uint rx_idx; /* index of the current RX buffer */

On Tue, Jan 12, 2016 at 12:41 AM, Bin Meng bmeng.cn@gmail.com wrote:
Add a new member 'tbiaddr' to tsec_private struct. For non-DM driver, it is initialized as CONFIG_SYS_TBIPA_VALUE, but for DM driver, we can get this from device tree. Update the bindings doc as well.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
Acked-by: Joe Hershberger joe.hershberger@ni.com


eth_get_dev_by_index() is an API which is not available in driver model. Use eth_get_dev_by_name() instead, which can also simplifly the code logic a little bit.
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
arch/arm/cpu/armv7/ls102xa/fdt.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/arch/arm/cpu/armv7/ls102xa/fdt.c b/arch/arm/cpu/armv7/ls102xa/fdt.c index 856abed..ae5e794 100644 --- a/arch/arm/cpu/armv7/ls102xa/fdt.c +++ b/arch/arm/cpu/armv7/ls102xa/fdt.c @@ -30,17 +30,13 @@ void ft_fixup_enet_phy_connect_type(void *fdt) int phy_node; int i = 0; uint32_t ph; + char *name[3] = { "eTSEC1", "eTSEC2", "eTSEC3" };
- while ((dev = eth_get_dev_by_index(i++)) != NULL) { - if (strstr(dev->name, "eTSEC1")) { - strcpy(enet, "ethernet0"); - strcpy(phy, "enet0_rgmii_phy"); - } else if (strstr(dev->name, "eTSEC2")) { - strcpy(enet, "ethernet1"); - strcpy(phy, "enet1_rgmii_phy"); - } else if (strstr(dev->name, "eTSEC3")) { - strcpy(enet, "ethernet2"); - strcpy(phy, "enet2_rgmii_phy"); + for (; i < ARRAY_SIZE(name); i++) { + dev = eth_get_dev_by_name(name[i]); + if (dev) { + sprintf(enet, "ethernet%d", i); + sprintf(phy, "enet%d_rgmii_phy", i); } else { continue; }

On Tue, Jan 12, 2016 at 12:41 AM, Bin Meng bmeng.cn@gmail.com wrote:
eth_get_dev_by_index() is an API which is not available in driver model. Use eth_get_dev_by_name() instead, which can also simplifly the code logic a little bit.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
Acked-by: Joe Hershberger joe.hershberger@ni.com


Before we switch to use driver model ethernet support, disable CONFIG_E1000 temporarily as with driver model ethernet, E1000 driver depends on driver model PCI which is not ready on this board yet.
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
configs/ls1021atwr_nor_defconfig | 1 - configs/ls1021atwr_nor_lpuart_defconfig | 1 - 2 files changed, 2 deletions(-)
diff --git a/configs/ls1021atwr_nor_defconfig b/configs/ls1021atwr_nor_defconfig index 2b79443..ddda0b8 100644 --- a/configs/ls1021atwr_nor_defconfig +++ b/configs/ls1021atwr_nor_defconfig @@ -6,5 +6,4 @@ CONFIG_DEFAULT_DEVICE_TREE="ls1021a-twr" CONFIG_OF_CONTROL=y CONFIG_DM=y CONFIG_NETDEVICES=y -CONFIG_E1000=y CONFIG_SYS_NS16550=y diff --git a/configs/ls1021atwr_nor_lpuart_defconfig b/configs/ls1021atwr_nor_lpuart_defconfig index 5346359..3564736 100644 --- a/configs/ls1021atwr_nor_lpuart_defconfig +++ b/configs/ls1021atwr_nor_lpuart_defconfig @@ -7,5 +7,4 @@ CONFIG_SYS_EXTRA_OPTIONS="LPUART" CONFIG_OF_CONTROL=y CONFIG_DM=y CONFIG_NETDEVICES=y -CONFIG_E1000=y CONFIG_FSL_LPUART=y

On 01/11/2016 10:38 PM, Bin Meng wrote:
Before we switch to use driver model ethernet support, disable CONFIG_E1000 temporarily as with driver model ethernet, E1000 driver depends on driver model PCI which is not ready on this board yet.
Any idea when PCI/E1000 can be enabled?
York

Hi York,
On Wed, Jan 13, 2016 at 1:52 AM, York Sun yorksun@freescale.com wrote:
On 01/11/2016 10:38 PM, Bin Meng wrote:
Before we switch to use driver model ethernet support, disable CONFIG_E1000 temporarily as with driver model ethernet, E1000 driver depends on driver model PCI which is not ready on this board yet.
Any idea when PCI/E1000 can be enabled?
Next on my todo list is to convert layerscape pcie to driver model. But I suspect we should consolidate that driver with imx pcie driver first.
Regards, Bin

On 01/12/2016 10:21 PM, Bin Meng wrote:
Hi York,
On Wed, Jan 13, 2016 at 1:52 AM, York Sun yorksun@freescale.com wrote:
On 01/11/2016 10:38 PM, Bin Meng wrote:
Before we switch to use driver model ethernet support, disable CONFIG_E1000 temporarily as with driver model ethernet, E1000 driver depends on driver model PCI which is not ready on this board yet.
Any idea when PCI/E1000 can be enabled?
Next on my todo list is to convert layerscape pcie to driver model. But I suspect we should consolidate that driver with imx pcie driver first.
The dilemma here is we heavily depend on the PCIe/e1000 for remote boards in our boardfarms. Once this patch is merged, we will lose network under u-boot. The network interfaces of LS1 itself are used for benchmark and other purpose. We surely can reconfigure the boards but that impacts all the auto scripts.
I would prefer to have PCIe/e1000 working first.
York

Hi York,
On Thu, Jan 14, 2016 at 12:07 AM, york sun york.sun@nxp.com wrote:
On 01/12/2016 10:21 PM, Bin Meng wrote:
Hi York,
On Wed, Jan 13, 2016 at 1:52 AM, York Sun yorksun@freescale.com wrote:
On 01/11/2016 10:38 PM, Bin Meng wrote:
Before we switch to use driver model ethernet support, disable CONFIG_E1000 temporarily as with driver model ethernet, E1000 driver depends on driver model PCI which is not ready on this board yet.
Any idea when PCI/E1000 can be enabled?
Next on my todo list is to convert layerscape pcie to driver model. But I suspect we should consolidate that driver with imx pcie driver first.
The dilemma here is we heavily depend on the PCIe/e1000 for remote boards in our boardfarms. Once this patch is merged, we will lose network under u-boot. The network interfaces of LS1 itself are used for benchmark and other purpose. We surely can reconfigure the boards but that impacts all the auto scripts.
I would prefer to have PCIe/e1000 working first.
OK, will include PCIe DM conversion in v2.
Regards, Bin

Now that we have added driver model support to the TSEC driver, convert ls1021atwr board to use it.
This depends on previous DM series for ls1021atwr: http://patchwork.ozlabs.org/patch/561855/
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
arch/arm/cpu/armv7/ls102xa/cpu.c | 2 +- arch/arm/cpu/armv7/ls102xa/fdt.c | 10 ++++++++++ arch/arm/dts/ls1021a-twr.dts | 20 ++++++++++++++++++++ arch/arm/dts/ls1021a.dtsi | 18 ++++++++++++++++-- board/freescale/ls1021atwr/ls1021atwr.c | 2 +- configs/ls1021atwr_nor_defconfig | 2 +- configs/ls1021atwr_nor_lpuart_defconfig | 2 +- include/configs/ls1021atwr.h | 4 ++++ 8 files changed, 54 insertions(+), 6 deletions(-)
diff --git a/arch/arm/cpu/armv7/ls102xa/cpu.c b/arch/arm/cpu/armv7/ls102xa/cpu.c index 2f0df65..ee6b5ea 100644 --- a/arch/arm/cpu/armv7/ls102xa/cpu.c +++ b/arch/arm/cpu/armv7/ls102xa/cpu.c @@ -297,7 +297,7 @@ int cpu_mmc_init(bd_t *bis)
int cpu_eth_init(bd_t *bis) { -#ifdef CONFIG_TSEC_ENET +#if defined(CONFIG_TSEC_ENET) && !defined(CONFIG_DM_ETH) tsec_standard_init(bis); #endif
diff --git a/arch/arm/cpu/armv7/ls102xa/fdt.c b/arch/arm/cpu/armv7/ls102xa/fdt.c index ae5e794..0a4944e 100644 --- a/arch/arm/cpu/armv7/ls102xa/fdt.c +++ b/arch/arm/cpu/armv7/ls102xa/fdt.c @@ -5,6 +5,7 @@ */
#include <common.h> +#include <dm.h> #include <libfdt.h> #include <fdt_support.h> #include <asm/io.h> @@ -22,7 +23,11 @@ DECLARE_GLOBAL_DATA_PTR;
void ft_fixup_enet_phy_connect_type(void *fdt) { +#ifndef CONFIG_DM_ETH struct eth_device *dev; +#else + struct udevice *dev; +#endif struct tsec_private *priv; const char *enet_path, *phy_path; char enet[16]; @@ -30,7 +35,12 @@ void ft_fixup_enet_phy_connect_type(void *fdt) int phy_node; int i = 0; uint32_t ph; +#ifndef CONFIG_DM_ETH char *name[3] = { "eTSEC1", "eTSEC2", "eTSEC3" }; +#else + char *name[3] = { "ethernet@2d10000", "ethernet@2d50000", + "ethernet@2d90000" }; +#endif
for (; i < ARRAY_SIZE(name); i++) { dev = eth_get_dev_by_name(name[i]); diff --git a/arch/arm/dts/ls1021a-twr.dts b/arch/arm/dts/ls1021a-twr.dts index deabb12..2bfeb14 100644 --- a/arch/arm/dts/ls1021a-twr.dts +++ b/arch/arm/dts/ls1021a-twr.dts @@ -57,6 +57,26 @@ }; };
+&enet0 { + tbi-handle = <&tbi1>; + phy-handle = <&sgmii_phy2>; + phy-connection-type = "sgmii"; + status = "okay"; +}; + +&enet1 { + tbi-handle = <&tbi1>; + phy-handle = <&sgmii_phy0>; + phy-connection-type = "sgmii"; + status = "okay"; +}; + +&enet2 { + phy-handle = <&rgmii_phy1>; + phy-connection-type = "rgmii-id"; + status = "okay"; +}; + &i2c0 { status = "okay"; }; diff --git a/arch/arm/dts/ls1021a.dtsi b/arch/arm/dts/ls1021a.dtsi index ee0e554..2ecb345 100644 --- a/arch/arm/dts/ls1021a.dtsi +++ b/arch/arm/dts/ls1021a.dtsi @@ -352,13 +352,27 @@ };
mdio0: mdio@2d24000 { - compatible = "gianfar"; - device_type = "mdio"; + compatible = "fsl,tsec-mdio"; #address-cells = <1>; #size-cells = <0>; reg = <0x2d24000 0x4000>; };
+ enet0: ethernet@2d10000 { + compatible = "fsl,tsec"; + reg = <0x2d10000 0x1000>; + }; + + enet1: ethernet@2d50000 { + compatible = "fsl,tsec"; + reg = <0x2d50000 0x1000>; + }; + + enet2: ethernet@2d90000 { + compatible = "fsl,tsec"; + reg = <0x2d90000 0x1000>; + }; + usb@8600000 { compatible = "fsl-usb2-dr-v2.5", "fsl-usb2-dr"; reg = <0x8600000 0x1000>; diff --git a/board/freescale/ls1021atwr/ls1021atwr.c b/board/freescale/ls1021atwr/ls1021atwr.c index f82e567..d4d0cb9 100644 --- a/board/freescale/ls1021atwr/ls1021atwr.c +++ b/board/freescale/ls1021atwr/ls1021atwr.c @@ -245,7 +245,7 @@ int board_mmc_init(bd_t *bis)
int board_eth_init(bd_t *bis) { -#ifdef CONFIG_TSEC_ENET +#if defined(CONFIG_TSEC_ENET) && !defined(CONFIG_DM_ETH) struct fsl_pq_mdio_info mdio_info; struct tsec_info_struct tsec_info[4]; int num = 0; diff --git a/configs/ls1021atwr_nor_defconfig b/configs/ls1021atwr_nor_defconfig index ddda0b8..1c8d2c1 100644 --- a/configs/ls1021atwr_nor_defconfig +++ b/configs/ls1021atwr_nor_defconfig @@ -5,5 +5,5 @@ CONFIG_DEFAULT_DEVICE_TREE="ls1021a-twr" # CONFIG_CMD_SETEXPR is not set CONFIG_OF_CONTROL=y CONFIG_DM=y -CONFIG_NETDEVICES=y +CONFIG_DM_ETH=y CONFIG_SYS_NS16550=y diff --git a/configs/ls1021atwr_nor_lpuart_defconfig b/configs/ls1021atwr_nor_lpuart_defconfig index 3564736..aec5bf3 100644 --- a/configs/ls1021atwr_nor_lpuart_defconfig +++ b/configs/ls1021atwr_nor_lpuart_defconfig @@ -6,5 +6,5 @@ CONFIG_SYS_EXTRA_OPTIONS="LPUART" # CONFIG_CMD_SETEXPR is not set CONFIG_OF_CONTROL=y CONFIG_DM=y -CONFIG_NETDEVICES=y +CONFIG_DM_ETH=y CONFIG_FSL_LPUART=y diff --git a/include/configs/ls1021atwr.h b/include/configs/ls1021atwr.h index 317ba62..d30050e 100644 --- a/include/configs/ls1021atwr.h +++ b/include/configs/ls1021atwr.h @@ -348,6 +348,7 @@ #define CONFIG_TSEC_ENET
#ifdef CONFIG_TSEC_ENET +#ifndef CONFIG_DM_ETH #define CONFIG_MII #define CONFIG_MII_DEFAULT_TSEC 1 #define CONFIG_TSEC1 1 @@ -370,6 +371,9 @@ #define TSEC3_PHYIDX 0
#define CONFIG_ETHPRIME "eTSEC1" +#else +#define CONFIG_ETHPRIME "ethernet@2d10000" +#endif
#define CONFIG_PHY_GIGE #define CONFIG_PHYLIB

Joe, York,
On Tue, Jan 12, 2016 at 2:41 PM, Bin Meng bmeng.cn@gmail.com wrote:
This series adds driver model ethernet support to the Freescale TSEC ethernet driver and convert ls1021atwr board to use it.
Enable the support in the ls1021atwr_nor_defconfig and ls1021atwr_nor_lpuart_defconfig configurations.
Bin Meng (17): powerpc: bsc9132qds: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET powerpc: c29xpcie: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET powerpc: mpc8572ds: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET powerpc: mpc8548cds: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET powerpc: p1010rdb: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET arm: ls1021atwr: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET net: tsec: fsl_mdio: Fix several cosmetic issues net: tsec: Move rx_idx and tx_idx to struct tsec_private net: tsec: Move rxbd and txbd to struct tsec_private net: tsec: Adjust orders to avoid forward declaration of tsec_send() net: tsec: Use tsec_private pointer as the parameter for internal routines doc: dt-bindings: Describe Freescale TSEC ethernet controller net: tsec: Add driver model ethernet support net: tsec: Use priv->tbiaddr to initialize TBI PHY address arm: ls102xa: Rewrite the logic of ft_fixup_enet_phy_connect_type() arm: ls1021atwr: Disable CONFIG_E1000 temporarily arm: ls1021atwr: Convert to use driver model TSEC driver
arch/arm/cpu/armv7/ls102xa/cpu.c | 2 +- arch/arm/cpu/armv7/ls102xa/fdt.c | 26 +- arch/arm/dts/ls1021a-twr.dts | 20 + arch/arm/dts/ls1021a.dtsi | 18 +- board/freescale/bsc9132qds/bsc9132qds.c | 4 +- board/freescale/c29xpcie/c29xpcie.c | 4 +- board/freescale/ls1021atwr/ls1021atwr.c | 4 +- board/freescale/mpc8548cds/mpc8548cds.c | 4 +- board/freescale/mpc8572ds/mpc8572ds.c | 4 +- board/freescale/p1010rdb/p1010rdb.c | 4 +- configs/ls1021atwr_nor_defconfig | 3 +- configs/ls1021atwr_nor_lpuart_defconfig | 3 +- doc/device-tree-bindings/net/fsl-tsec-phy.txt | 64 +++ drivers/net/fsl_mdio.c | 4 +- drivers/net/tsec.c | 536 ++++++++++++++++++-------- include/configs/ls1021atwr.h | 4 + include/fsl_mdio.h | 7 +- include/tsec.h | 69 ++-- 18 files changed, 546 insertions(+), 234 deletions(-) create mode 100644 doc/device-tree-bindings/net/fsl-tsec-phy.txt
I wonder if you can post some review comments if any before I spin a v2?
Regards, Bin

On 01/17/2016 09:16 PM, Bin Meng wrote:
Joe, York,
On Tue, Jan 12, 2016 at 2:41 PM, Bin Meng bmeng.cn@gmail.com wrote:
This series adds driver model ethernet support to the Freescale TSEC ethernet driver and convert ls1021atwr board to use it.
Enable the support in the ls1021atwr_nor_defconfig and ls1021atwr_nor_lpuart_defconfig configurations.
Bin Meng (17): powerpc: bsc9132qds: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET powerpc: c29xpcie: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET powerpc: mpc8572ds: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET powerpc: mpc8548cds: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET powerpc: p1010rdb: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET arm: ls1021atwr: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET
I think separating TSEC from PCI eth is correct.
net: tsec: fsl_mdio: Fix several cosmetic issues net: tsec: Move rx_idx and tx_idx to struct tsec_private net: tsec: Move rxbd and txbd to struct tsec_private
I don't see problem with above change. I didn't test them though.
net: tsec: Adjust orders to avoid forward declaration of tsec_send() net: tsec: Use tsec_private pointer as the parameter for internal routines doc: dt-bindings: Describe Freescale TSEC ethernet controller net: tsec: Add driver model ethernet support net: tsec: Use priv->tbiaddr to initialize TBI PHY address arm: ls102xa: Rewrite the logic of ft_fixup_enet_phy_connect_type() arm: ls1021atwr: Disable CONFIG_E1000 temporarily arm: ls1021atwr: Convert to use driver model TSEC driver
I haven't tested your patch. Just a reminder, please keep it in mind to have "git bisect" always working, in case we need to find something later. My previous comment on disabling E1000 for ls1021atwr still stands.
York

On Wed, Jan 20, 2016 at 1:16 AM, york sun york.sun@nxp.com wrote:
On 01/17/2016 09:16 PM, Bin Meng wrote:
Joe, York,
On Tue, Jan 12, 2016 at 2:41 PM, Bin Meng bmeng.cn@gmail.com wrote:
This series adds driver model ethernet support to the Freescale TSEC ethernet driver and convert ls1021atwr board to use it.
Enable the support in the ls1021atwr_nor_defconfig and ls1021atwr_nor_lpuart_defconfig configurations.
Bin Meng (17): powerpc: bsc9132qds: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET powerpc: c29xpcie: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET powerpc: mpc8572ds: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET powerpc: mpc8548cds: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET powerpc: p1010rdb: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET arm: ls1021atwr: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET
I think separating TSEC from PCI eth is correct.
net: tsec: fsl_mdio: Fix several cosmetic issues net: tsec: Move rx_idx and tx_idx to struct tsec_private net: tsec: Move rxbd and txbd to struct tsec_private
I don't see problem with above change. I didn't test them though.
Thanks York.
net: tsec: Adjust orders to avoid forward declaration of tsec_send() net: tsec: Use tsec_private pointer as the parameter for internal routines doc: dt-bindings: Describe Freescale TSEC ethernet controller net: tsec: Add driver model ethernet support net: tsec: Use priv->tbiaddr to initialize TBI PHY address arm: ls102xa: Rewrite the logic of ft_fixup_enet_phy_connect_type()
Hi Joe, I see this series are assigned to you. If the first 15 patches are OK, please apply it directly so that I can save some time including them in v2.
arm: ls1021atwr: Disable CONFIG_E1000 temporarily arm: ls1021atwr: Convert to use driver model TSEC driver
Since York has some comments regarding to CONFIG_E1000, I will work on the remaining 2 patches in v2, together with DM PCI conversion.
I haven't tested your patch. Just a reminder, please keep it in mind to have "git bisect" always working, in case we need to find something later. My previous comment on disabling E1000 for ls1021atwr still stands.
York
Regards, Bin

Hi Bin,
On Mon, Jan 25, 2016 at 8:45 PM, Bin Meng bmeng.cn@gmail.com wrote:
On Wed, Jan 20, 2016 at 1:16 AM, york sun york.sun@nxp.com wrote:
On 01/17/2016 09:16 PM, Bin Meng wrote:
Joe, York,
On Tue, Jan 12, 2016 at 2:41 PM, Bin Meng bmeng.cn@gmail.com wrote:
This series adds driver model ethernet support to the Freescale TSEC ethernet driver and convert ls1021atwr board to use it.
Enable the support in the ls1021atwr_nor_defconfig and ls1021atwr_nor_lpuart_defconfig configurations.
Bin Meng (17): powerpc: bsc9132qds: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET powerpc: c29xpcie: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET powerpc: mpc8572ds: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET powerpc: mpc8548cds: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET powerpc: p1010rdb: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET arm: ls1021atwr: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET
I think separating TSEC from PCI eth is correct.
net: tsec: fsl_mdio: Fix several cosmetic issues net: tsec: Move rx_idx and tx_idx to struct tsec_private net: tsec: Move rxbd and txbd to struct tsec_private
I don't see problem with above change. I didn't test them though.
Thanks York.
net: tsec: Adjust orders to avoid forward declaration of tsec_send() net: tsec: Use tsec_private pointer as the parameter for internal routines doc: dt-bindings: Describe Freescale TSEC ethernet controller net: tsec: Add driver model ethernet support net: tsec: Use priv->tbiaddr to initialize TBI PHY address arm: ls102xa: Rewrite the logic of ft_fixup_enet_phy_connect_type()
Hi Joe, I see this series are assigned to you. If the first 15 patches are OK, please apply it directly so that I can save some time including them in v2.
OK, I have reviewed the first 15 and will take them now for build testing.
arm: ls1021atwr: Disable CONFIG_E1000 temporarily arm: ls1021atwr: Convert to use driver model TSEC driver
Since York has some comments regarding to CONFIG_E1000, I will work on the remaining 2 patches in v2, together with DM PCI conversion.
I haven't tested your patch. Just a reminder, please keep it in mind to have "git bisect" always working, in case we need to find something later. My previous comment on disabling E1000 for ls1021atwr still stands.
York
Regards, Bin _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
participants (6)
-
Bin Meng
-
Joe Hershberger
-
Joe Hershberger
-
Simon Glass
-
york sun
-
York Sun