[RFC PATCH 08/11] MIPS: OCTEON: move the link helpers into a separate file
Move the link helpers into a separate file. Signed-off-by: Aaro Koskinen --- arch/mips/cavium-octeon/executive/Makefile | 2 +- .../cavium-octeon/executive/cvmx-helper-board.c| 511 arch/mips/cavium-octeon/executive/cvmx-link.c | 534 + 3 files changed, 535 insertions(+), 512 deletions(-) create mode 100644 arch/mips/cavium-octeon/executive/cvmx-link.c diff --git a/arch/mips/cavium-octeon/executive/Makefile b/arch/mips/cavium-octeon/executive/Makefile index e755a73..abafe06 100644 --- a/arch/mips/cavium-octeon/executive/Makefile +++ b/arch/mips/cavium-octeon/executive/Makefile @@ -14,7 +14,7 @@ obj-y += cvmx-pko.o cvmx-spi.o cvmx-cmd-queue.o \ cvmx-helper-board.o cvmx-helper.o cvmx-helper-xaui.o \ cvmx-helper-rgmii.o cvmx-helper-sgmii.o cvmx-helper-npi.o \ cvmx-helper-loop.o cvmx-helper-spi.o cvmx-helper-util.o \ - cvmx-helper-ethernet.o \ + cvmx-helper-ethernet.o cvmx-link.o \ cvmx-interrupt-decodes.o cvmx-interrupt-rsl.o obj-y += cvmx-helper-errata.o cvmx-helper-jtag.o diff --git a/arch/mips/cavium-octeon/executive/cvmx-helper-board.c b/arch/mips/cavium-octeon/executive/cvmx-helper-board.c index 9eb0fee..10f8de1 100644 --- a/arch/mips/cavium-octeon/executive/cvmx-helper-board.c +++ b/arch/mips/cavium-octeon/executive/cvmx-helper-board.c @@ -36,26 +36,9 @@ #include -#include - #include -#include #include -#include -#include - -/** - * cvmx_override_board_link_get(int ipd_port) is a function - * pointer. It is meant to allow customization of the process of - * talking to a PHY to determine link speed. It is called every - * time a PHY must be polled for link status. Users should set - * this pointer to a function before calling any cvmx-helper - * operations. - */ -cvmx_helper_link_info_t(*cvmx_override_board_link_get) (int ipd_port) = -NULL; - /** * Return the MII PHY address associated with the given IPD * port. A result of -1 means there isn't a MII capable PHY @@ -205,419 +188,6 @@ int cvmx_helper_board_get_mii_address(int ipd_port) } /** - * This function is the board specific method of determining an - * ethernet ports link speed. Most Octeon boards have Marvell PHYs - * and are handled by the fall through case. This function must be - * updated for boards that don't have the normal Marvell PHYs. - * - * This function must be modified for every new Octeon board. - * Internally it uses switch statements based on the cvmx_sysinfo - * data to determine board types and revisions. It relies on the - * fact that every Octeon board receives a unique board type - * enumeration from the bootloader. - * - * @ipd_port: IPD input port associated with the port we want to get link - *status for. - * - * Returns The ports link status. If the link isn't fully resolved, this must - *return zero. - */ -cvmx_helper_link_info_t __cvmx_helper_board_link_get(int ipd_port) -{ - cvmx_helper_link_info_t result; - int phy_addr; - int is_broadcom_phy = 0; - - /* Give the user a chance to override the processing of this function */ - if (cvmx_override_board_link_get) - return cvmx_override_board_link_get(ipd_port); - - /* Unless we fix it later, all links are defaulted to down */ - result.u64 = 0; - - /* -* This switch statement should handle all ports that either don't use -* Marvell PHYS, or don't support in-band status. -*/ - switch (cvmx_sysinfo_get()->board_type) { - case CVMX_BOARD_TYPE_SIM: - /* The simulator gives you a simulated 1Gbps full duplex link */ - result.s.link_up = 1; - result.s.full_duplex = 1; - result.s.speed = 1000; - return result; - case CVMX_BOARD_TYPE_EBH3100: - case CVMX_BOARD_TYPE_CN3010_EVB_HS5: - case CVMX_BOARD_TYPE_CN3005_EVB_HS5: - case CVMX_BOARD_TYPE_CN3020_EVB_HS5: - /* Port 1 on these boards is always Gigabit */ - if (ipd_port == 1) { - result.s.link_up = 1; - result.s.full_duplex = 1; - result.s.speed = 1000; - return result; - } - /* Fall through to the generic code below */ - break; - case CVMX_BOARD_TYPE_CUST_NB5: - /* Port 1 on these boards is always Gigabit */ - if (ipd_port == 1) { - result.s.link_up = 1; - result.s.full_duplex = 1; - result.s.speed = 1000; - return result; - } else /* The other port uses a broadcom PHY */ - is_broadcom_phy = 1; - break; - case CVMX_BOARD_TYPE_BBGW_REF: - /* Port 1 on these boards is always Gigabit */ - if (ipd_port == 2) { -
[RFC PATCH 08/11] MIPS: OCTEON: move the link helpers into a separate file
Move the link helpers into a separate file. Signed-off-by: Aaro Koskinen aaro.koski...@iki.fi --- arch/mips/cavium-octeon/executive/Makefile | 2 +- .../cavium-octeon/executive/cvmx-helper-board.c| 511 arch/mips/cavium-octeon/executive/cvmx-link.c | 534 + 3 files changed, 535 insertions(+), 512 deletions(-) create mode 100644 arch/mips/cavium-octeon/executive/cvmx-link.c diff --git a/arch/mips/cavium-octeon/executive/Makefile b/arch/mips/cavium-octeon/executive/Makefile index e755a73..abafe06 100644 --- a/arch/mips/cavium-octeon/executive/Makefile +++ b/arch/mips/cavium-octeon/executive/Makefile @@ -14,7 +14,7 @@ obj-y += cvmx-pko.o cvmx-spi.o cvmx-cmd-queue.o \ cvmx-helper-board.o cvmx-helper.o cvmx-helper-xaui.o \ cvmx-helper-rgmii.o cvmx-helper-sgmii.o cvmx-helper-npi.o \ cvmx-helper-loop.o cvmx-helper-spi.o cvmx-helper-util.o \ - cvmx-helper-ethernet.o \ + cvmx-helper-ethernet.o cvmx-link.o \ cvmx-interrupt-decodes.o cvmx-interrupt-rsl.o obj-y += cvmx-helper-errata.o cvmx-helper-jtag.o diff --git a/arch/mips/cavium-octeon/executive/cvmx-helper-board.c b/arch/mips/cavium-octeon/executive/cvmx-helper-board.c index 9eb0fee..10f8de1 100644 --- a/arch/mips/cavium-octeon/executive/cvmx-helper-board.c +++ b/arch/mips/cavium-octeon/executive/cvmx-helper-board.c @@ -36,26 +36,9 @@ #include asm/octeon/cvmx-config.h -#include asm/octeon/cvmx-mdio.h - #include asm/octeon/cvmx-helper.h -#include asm/octeon/cvmx-helper-util.h #include asm/octeon/cvmx-helper-board.h -#include asm/octeon/cvmx-gmxx-defs.h -#include asm/octeon/cvmx-asxx-defs.h - -/** - * cvmx_override_board_link_get(int ipd_port) is a function - * pointer. It is meant to allow customization of the process of - * talking to a PHY to determine link speed. It is called every - * time a PHY must be polled for link status. Users should set - * this pointer to a function before calling any cvmx-helper - * operations. - */ -cvmx_helper_link_info_t(*cvmx_override_board_link_get) (int ipd_port) = -NULL; - /** * Return the MII PHY address associated with the given IPD * port. A result of -1 means there isn't a MII capable PHY @@ -205,419 +188,6 @@ int cvmx_helper_board_get_mii_address(int ipd_port) } /** - * This function is the board specific method of determining an - * ethernet ports link speed. Most Octeon boards have Marvell PHYs - * and are handled by the fall through case. This function must be - * updated for boards that don't have the normal Marvell PHYs. - * - * This function must be modified for every new Octeon board. - * Internally it uses switch statements based on the cvmx_sysinfo - * data to determine board types and revisions. It relies on the - * fact that every Octeon board receives a unique board type - * enumeration from the bootloader. - * - * @ipd_port: IPD input port associated with the port we want to get link - *status for. - * - * Returns The ports link status. If the link isn't fully resolved, this must - *return zero. - */ -cvmx_helper_link_info_t __cvmx_helper_board_link_get(int ipd_port) -{ - cvmx_helper_link_info_t result; - int phy_addr; - int is_broadcom_phy = 0; - - /* Give the user a chance to override the processing of this function */ - if (cvmx_override_board_link_get) - return cvmx_override_board_link_get(ipd_port); - - /* Unless we fix it later, all links are defaulted to down */ - result.u64 = 0; - - /* -* This switch statement should handle all ports that either don't use -* Marvell PHYS, or don't support in-band status. -*/ - switch (cvmx_sysinfo_get()-board_type) { - case CVMX_BOARD_TYPE_SIM: - /* The simulator gives you a simulated 1Gbps full duplex link */ - result.s.link_up = 1; - result.s.full_duplex = 1; - result.s.speed = 1000; - return result; - case CVMX_BOARD_TYPE_EBH3100: - case CVMX_BOARD_TYPE_CN3010_EVB_HS5: - case CVMX_BOARD_TYPE_CN3005_EVB_HS5: - case CVMX_BOARD_TYPE_CN3020_EVB_HS5: - /* Port 1 on these boards is always Gigabit */ - if (ipd_port == 1) { - result.s.link_up = 1; - result.s.full_duplex = 1; - result.s.speed = 1000; - return result; - } - /* Fall through to the generic code below */ - break; - case CVMX_BOARD_TYPE_CUST_NB5: - /* Port 1 on these boards is always Gigabit */ - if (ipd_port == 1) { - result.s.link_up = 1; - result.s.full_duplex = 1; - result.s.speed = 1000; - return result; - } else /* The other port uses a broadcom PHY */ -