All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] staging: octeon: delete driver
@ 2019-12-10  9:15 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 59+ messages in thread
From: Greg Kroah-Hartman @ 2019-12-10  9:15 UTC (permalink / raw)
  To: devel
  Cc: linux-kernel, Greg Kroah-Hartman, Guenter Roeck, David Daney,
	David S. Miller, Matthew Wilcox (Oracle),
	YueHaibing, Aaro Koskinen, Wambui Karuga, Julia Lawall,
	Florian Westphal, Geert Uytterhoeven, Branden Bonaby,
	Petr Štetiar, Sandro Volery, Paul Burton, Dan Carpenter,
	Giovanni Gherdovich, Valery Ivanov

This driver has been in the tree since 2009 with no real movement to get
it out.  Now it is starting to cause build issues and other problems for
people who want to fix coding style problems, but can not actually build
it.

As nothing is happening here, just delete the module entirely.

Reported-by: Guenter Roeck <linux@roeck-us.net>
Cc: David Daney <ddaney@caviumnetworks.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: YueHaibing <yuehaibing@huawei.com>
Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: Wambui Karuga <wambui.karugax@gmail.com>
Cc: Julia Lawall <julia.lawall@lip6.fr>
Cc: Florian Westphal <fw@strlen.de>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Branden Bonaby <brandonbonaby94@gmail.com>
Cc: "Petr Štetiar" <ynezz@true.cz>
Cc: Sandro Volery <sandro@volery.com>
Cc: Paul Burton <paulburton@kernel.org>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Giovanni Gherdovich <bobdc9664@seznam.cz>
Cc: Valery Ivanov <ivalery111@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/staging/Kconfig                   |    2 -
 drivers/staging/Makefile                  |    1 -
 drivers/staging/octeon/Kconfig            |   16 -
 drivers/staging/octeon/Makefile           |   19 -
 drivers/staging/octeon/TODO               |    9 -
 drivers/staging/octeon/ethernet-defines.h |   40 -
 drivers/staging/octeon/ethernet-mdio.c    |  178 ---
 drivers/staging/octeon/ethernet-mdio.h    |   28 -
 drivers/staging/octeon/ethernet-mem.c     |  154 ---
 drivers/staging/octeon/ethernet-mem.h     |    9 -
 drivers/staging/octeon/ethernet-rgmii.c   |  158 ---
 drivers/staging/octeon/ethernet-rx.c      |  538 --------
 drivers/staging/octeon/ethernet-rx.h      |   31 -
 drivers/staging/octeon/ethernet-sgmii.c   |   30 -
 drivers/staging/octeon/ethernet-spi.c     |  226 ----
 drivers/staging/octeon/ethernet-tx.c      |  717 -----------
 drivers/staging/octeon/ethernet-tx.h      |   14 -
 drivers/staging/octeon/ethernet-util.h    |   47 -
 drivers/staging/octeon/ethernet.c         |  992 --------------
 drivers/staging/octeon/octeon-ethernet.h  |  107 --
 drivers/staging/octeon/octeon-stubs.h     | 1433 ---------------------
 21 files changed, 4749 deletions(-)
 delete mode 100644 drivers/staging/octeon/Kconfig
 delete mode 100644 drivers/staging/octeon/Makefile
 delete mode 100644 drivers/staging/octeon/TODO
 delete mode 100644 drivers/staging/octeon/ethernet-defines.h
 delete mode 100644 drivers/staging/octeon/ethernet-mdio.c
 delete mode 100644 drivers/staging/octeon/ethernet-mdio.h
 delete mode 100644 drivers/staging/octeon/ethernet-mem.c
 delete mode 100644 drivers/staging/octeon/ethernet-mem.h
 delete mode 100644 drivers/staging/octeon/ethernet-rgmii.c
 delete mode 100644 drivers/staging/octeon/ethernet-rx.c
 delete mode 100644 drivers/staging/octeon/ethernet-rx.h
 delete mode 100644 drivers/staging/octeon/ethernet-sgmii.c
 delete mode 100644 drivers/staging/octeon/ethernet-spi.c
 delete mode 100644 drivers/staging/octeon/ethernet-tx.c
 delete mode 100644 drivers/staging/octeon/ethernet-tx.h
 delete mode 100644 drivers/staging/octeon/ethernet-util.h
 delete mode 100644 drivers/staging/octeon/ethernet.c
 delete mode 100644 drivers/staging/octeon/octeon-ethernet.h
 delete mode 100644 drivers/staging/octeon/octeon-stubs.h

diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
index eaf753b70ec5..15d3549e7cc7 100644
--- a/drivers/staging/Kconfig
+++ b/drivers/staging/Kconfig
@@ -42,8 +42,6 @@ source "drivers/staging/rtl8188eu/Kconfig"
 
 source "drivers/staging/rts5208/Kconfig"
 
-source "drivers/staging/octeon/Kconfig"
-
 source "drivers/staging/octeon-usb/Kconfig"
 
 source "drivers/staging/vt6655/Kconfig"
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
index 0a4396c9067b..c521204220b5 100644
--- a/drivers/staging/Makefile
+++ b/drivers/staging/Makefile
@@ -12,7 +12,6 @@ obj-$(CONFIG_R8712U)		+= rtl8712/
 obj-$(CONFIG_R8188EU)		+= rtl8188eu/
 obj-$(CONFIG_RTS5208)		+= rts5208/
 obj-$(CONFIG_NETLOGIC_XLR_NET)	+= netlogic/
-obj-$(CONFIG_OCTEON_ETHERNET)	+= octeon/
 obj-$(CONFIG_OCTEON_USB)	+= octeon-usb/
 obj-$(CONFIG_VT6655)		+= vt6655/
 obj-$(CONFIG_VT6656)		+= vt6656/
diff --git a/drivers/staging/octeon/Kconfig b/drivers/staging/octeon/Kconfig
deleted file mode 100644
index e7f4ddcc1361..000000000000
--- a/drivers/staging/octeon/Kconfig
+++ /dev/null
@@ -1,16 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-config OCTEON_ETHERNET
-	tristate "Cavium Networks Octeon Ethernet support"
-	depends on CAVIUM_OCTEON_SOC || COMPILE_TEST
-	depends on NETDEVICES
-	depends on BROKEN
-	select PHYLIB
-	select MDIO_OCTEON
-	help
-	  This driver supports the builtin ethernet ports on Cavium
-	  Networks' products in the Octeon family. This driver supports the
-	  CN3XXX and CN5XXX Octeon processors.
-
-	  To compile this driver as a module, choose M here.  The module
-	  will be called octeon-ethernet.
-
diff --git a/drivers/staging/octeon/Makefile b/drivers/staging/octeon/Makefile
deleted file mode 100644
index 3887cf5f1e84..000000000000
--- a/drivers/staging/octeon/Makefile
+++ /dev/null
@@ -1,19 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-#
-# Copyright (C) 2005-2009 Cavium Networks
-#
-
-#
-# Makefile for Cavium OCTEON on-board ethernet driver
-#
-
-obj-${CONFIG_OCTEON_ETHERNET} :=  octeon-ethernet.o
-
-octeon-ethernet-y := ethernet.o
-octeon-ethernet-y += ethernet-mdio.o
-octeon-ethernet-y += ethernet-mem.o
-octeon-ethernet-y += ethernet-rgmii.o
-octeon-ethernet-y += ethernet-rx.o
-octeon-ethernet-y += ethernet-sgmii.o
-octeon-ethernet-y += ethernet-spi.o
-octeon-ethernet-y += ethernet-tx.o
diff --git a/drivers/staging/octeon/TODO b/drivers/staging/octeon/TODO
deleted file mode 100644
index 67a0a1f6b922..000000000000
--- a/drivers/staging/octeon/TODO
+++ /dev/null
@@ -1,9 +0,0 @@
-This driver is functional and supports Ethernet on OCTEON+/OCTEON2/OCTEON3
-chips at least up to CN7030.
-
-TODO:
-	- general code review and clean up
-	- make driver self-contained instead of being split between staging and
-	  arch/mips/cavium-octeon.
-
-Contact: Aaro Koskinen <aaro.koskinen@iki.fi>
diff --git a/drivers/staging/octeon/ethernet-defines.h b/drivers/staging/octeon/ethernet-defines.h
deleted file mode 100644
index ef9e767b0e2e..000000000000
--- a/drivers/staging/octeon/ethernet-defines.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * This file is based on code from OCTEON SDK by Cavium Networks.
- *
- * Copyright (c) 2003-2007 Cavium Networks
- */
-
-/*
- * A few defines are used to control the operation of this driver:
- *  USE_ASYNC_IOBDMA
- *      Use asynchronous IO access to hardware. This uses Octeon's asynchronous
- *      IOBDMAs to issue IO accesses without stalling. Set this to zero
- *      to disable this. Note that IOBDMAs require CVMSEG.
- *  REUSE_SKBUFFS_WITHOUT_FREE
- *      Allows the TX path to free an skbuff into the FPA hardware pool. This
- *      can significantly improve performance for forwarding and bridging, but
- *      may be somewhat dangerous. Checks are made, but if any buffer is reused
- *      without the proper Linux cleanup, the networking stack may have very
- *      bizarre bugs.
- */
-#ifndef __ETHERNET_DEFINES_H__
-#define __ETHERNET_DEFINES_H__
-
-#ifdef CONFIG_NETFILTER
-#define REUSE_SKBUFFS_WITHOUT_FREE  0
-#else
-#define REUSE_SKBUFFS_WITHOUT_FREE  1
-#endif
-
-#define USE_ASYNC_IOBDMA            (CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE > 0)
-
-/* Maximum number of SKBs to try to free per xmit packet. */
-#define MAX_OUT_QUEUE_DEPTH 1000
-
-#define FAU_TOTAL_TX_TO_CLEAN (CVMX_FAU_REG_END - sizeof(u32))
-#define FAU_NUM_PACKET_BUFFERS_TO_FREE (FAU_TOTAL_TX_TO_CLEAN - sizeof(u32))
-
-#define TOTAL_NUMBER_OF_PORTS       (CVMX_PIP_NUM_INPUT_PORTS + 1)
-
-#endif /* __ETHERNET_DEFINES_H__ */
diff --git a/drivers/staging/octeon/ethernet-mdio.c b/drivers/staging/octeon/ethernet-mdio.c
deleted file mode 100644
index c798672d61b2..000000000000
--- a/drivers/staging/octeon/ethernet-mdio.c
+++ /dev/null
@@ -1,178 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * This file is based on code from OCTEON SDK by Cavium Networks.
- *
- * Copyright (c) 2003-2007 Cavium Networks
- */
-
-#include <linux/kernel.h>
-#include <linux/ethtool.h>
-#include <linux/phy.h>
-#include <linux/ratelimit.h>
-#include <linux/of_mdio.h>
-#include <generated/utsrelease.h>
-#include <net/dst.h>
-
-#include "octeon-ethernet.h"
-#include "ethernet-defines.h"
-#include "ethernet-mdio.h"
-#include "ethernet-util.h"
-
-static void cvm_oct_get_drvinfo(struct net_device *dev,
-				struct ethtool_drvinfo *info)
-{
-	strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver));
-	strlcpy(info->version, UTS_RELEASE, sizeof(info->version));
-	strlcpy(info->bus_info, "Builtin", sizeof(info->bus_info));
-}
-
-static int cvm_oct_nway_reset(struct net_device *dev)
-{
-	if (!capable(CAP_NET_ADMIN))
-		return -EPERM;
-
-	if (dev->phydev)
-		return phy_start_aneg(dev->phydev);
-
-	return -EINVAL;
-}
-
-const struct ethtool_ops cvm_oct_ethtool_ops = {
-	.get_drvinfo = cvm_oct_get_drvinfo,
-	.nway_reset = cvm_oct_nway_reset,
-	.get_link = ethtool_op_get_link,
-	.get_link_ksettings = phy_ethtool_get_link_ksettings,
-	.set_link_ksettings = phy_ethtool_set_link_ksettings,
-};
-
-/**
- * cvm_oct_ioctl - IOCTL support for PHY control
- * @dev:    Device to change
- * @rq:     the request
- * @cmd:    the command
- *
- * Returns Zero on success
- */
-int cvm_oct_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
-{
-	if (!netif_running(dev))
-		return -EINVAL;
-
-	if (!dev->phydev)
-		return -EINVAL;
-
-	return phy_mii_ioctl(dev->phydev, rq, cmd);
-}
-
-void cvm_oct_note_carrier(struct octeon_ethernet *priv,
-			  union cvmx_helper_link_info li)
-{
-	if (li.s.link_up) {
-		pr_notice_ratelimited("%s: %u Mbps %s duplex, port %d, queue %d\n",
-				      netdev_name(priv->netdev), li.s.speed,
-				      (li.s.full_duplex) ? "Full" : "Half",
-				      priv->port, priv->queue);
-	} else {
-		pr_notice_ratelimited("%s: Link down\n",
-				      netdev_name(priv->netdev));
-	}
-}
-
-void cvm_oct_adjust_link(struct net_device *dev)
-{
-	struct octeon_ethernet *priv = netdev_priv(dev);
-	union cvmx_helper_link_info link_info;
-
-	link_info.u64		= 0;
-	link_info.s.link_up	= dev->phydev->link ? 1 : 0;
-	link_info.s.full_duplex = dev->phydev->duplex ? 1 : 0;
-	link_info.s.speed	= dev->phydev->speed;
-	priv->link_info		= link_info.u64;
-
-	/*
-	 * The polling task need to know about link status changes.
-	 */
-	if (priv->poll)
-		priv->poll(dev);
-
-	if (priv->last_link != dev->phydev->link) {
-		priv->last_link = dev->phydev->link;
-		cvmx_helper_link_set(priv->port, link_info);
-		cvm_oct_note_carrier(priv, link_info);
-	}
-}
-
-int cvm_oct_common_stop(struct net_device *dev)
-{
-	struct octeon_ethernet *priv = netdev_priv(dev);
-	int interface = INTERFACE(priv->port);
-	union cvmx_helper_link_info link_info;
-	union cvmx_gmxx_prtx_cfg gmx_cfg;
-	int index = INDEX(priv->port);
-
-	gmx_cfg.u64 = cvmx_read_csr(CVMX_GMXX_PRTX_CFG(index, interface));
-	gmx_cfg.s.en = 0;
-	cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface), gmx_cfg.u64);
-
-	priv->poll = NULL;
-
-	if (dev->phydev)
-		phy_disconnect(dev->phydev);
-
-	if (priv->last_link) {
-		link_info.u64 = 0;
-		priv->last_link = 0;
-
-		cvmx_helper_link_set(priv->port, link_info);
-		cvm_oct_note_carrier(priv, link_info);
-	}
-	return 0;
-}
-
-/**
- * cvm_oct_phy_setup_device - setup the PHY
- *
- * @dev:    Device to setup
- *
- * Returns Zero on success, negative on failure
- */
-int cvm_oct_phy_setup_device(struct net_device *dev)
-{
-	struct octeon_ethernet *priv = netdev_priv(dev);
-	struct device_node *phy_node;
-	struct phy_device *phydev = NULL;
-
-	if (!priv->of_node)
-		goto no_phy;
-
-	phy_node = of_parse_phandle(priv->of_node, "phy-handle", 0);
-	if (!phy_node && of_phy_is_fixed_link(priv->of_node)) {
-		int rc;
-
-		rc = of_phy_register_fixed_link(priv->of_node);
-		if (rc)
-			return rc;
-
-		phy_node = of_node_get(priv->of_node);
-	}
-	if (!phy_node)
-		goto no_phy;
-
-	phydev = of_phy_connect(dev, phy_node, cvm_oct_adjust_link, 0,
-				priv->phy_mode);
-	of_node_put(phy_node);
-
-	if (!phydev)
-		return -ENODEV;
-
-	priv->last_link = 0;
-	phy_start(phydev);
-
-	return 0;
-no_phy:
-	/* If there is no phy, assume a direct MAC connection and that
-	 * the link is up.
-	 */
-	netif_carrier_on(dev);
-	return 0;
-}
diff --git a/drivers/staging/octeon/ethernet-mdio.h b/drivers/staging/octeon/ethernet-mdio.h
deleted file mode 100644
index e3771d48c49b..000000000000
--- a/drivers/staging/octeon/ethernet-mdio.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * This file is based on code from OCTEON SDK by Cavium Networks.
- *
- * Copyright (c) 2003-2007 Cavium Networks
- */
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-#include <linux/ip.h>
-#include <linux/string.h>
-#include <linux/ethtool.h>
-#include <linux/seq_file.h>
-#include <linux/proc_fs.h>
-#include <net/dst.h>
-#ifdef CONFIG_XFRM
-#include <linux/xfrm.h>
-#include <net/xfrm.h>
-#endif /* CONFIG_XFRM */
-
-extern const struct ethtool_ops cvm_oct_ethtool_ops;
-
-void octeon_mdiobus_force_mod_depencency(void);
-
-int cvm_oct_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
-int cvm_oct_phy_setup_device(struct net_device *dev);
diff --git a/drivers/staging/octeon/ethernet-mem.c b/drivers/staging/octeon/ethernet-mem.c
deleted file mode 100644
index 532594957ebc..000000000000
--- a/drivers/staging/octeon/ethernet-mem.c
+++ /dev/null
@@ -1,154 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * This file is based on code from OCTEON SDK by Cavium Networks.
- *
- * Copyright (c) 2003-2010 Cavium Networks
- */
-
-#include <linux/kernel.h>
-#include <linux/netdevice.h>
-#include <linux/slab.h>
-
-#include "octeon-ethernet.h"
-#include "ethernet-mem.h"
-#include "ethernet-defines.h"
-
-/**
- * cvm_oct_fill_hw_skbuff - fill the supplied hardware pool with skbuffs
- * @pool:     Pool to allocate an skbuff for
- * @size:     Size of the buffer needed for the pool
- * @elements: Number of buffers to allocate
- *
- * Returns the actual number of buffers allocated.
- */
-static int cvm_oct_fill_hw_skbuff(int pool, int size, int elements)
-{
-	int freed = elements;
-
-	while (freed) {
-		struct sk_buff *skb = dev_alloc_skb(size + 256);
-
-		if (unlikely(!skb))
-			break;
-		skb_reserve(skb, 256 - (((unsigned long)skb->data) & 0x7f));
-		*(struct sk_buff **)(skb->data - sizeof(void *)) = skb;
-		cvmx_fpa_free(skb->data, pool, size / 128);
-		freed--;
-	}
-	return elements - freed;
-}
-
-/**
- * cvm_oct_free_hw_skbuff- free hardware pool skbuffs
- * @pool:     Pool to allocate an skbuff for
- * @size:     Size of the buffer needed for the pool
- * @elements: Number of buffers to allocate
- */
-static void cvm_oct_free_hw_skbuff(int pool, int size, int elements)
-{
-	char *memory;
-
-	do {
-		memory = cvmx_fpa_alloc(pool);
-		if (memory) {
-			struct sk_buff *skb =
-			    *(struct sk_buff **)(memory - sizeof(void *));
-			elements--;
-			dev_kfree_skb(skb);
-		}
-	} while (memory);
-
-	if (elements < 0)
-		pr_warn("Freeing of pool %u had too many skbuffs (%d)\n",
-			pool, elements);
-	else if (elements > 0)
-		pr_warn("Freeing of pool %u is missing %d skbuffs\n",
-			pool, elements);
-}
-
-/**
- * cvm_oct_fill_hw_memory - fill a hardware pool with memory.
- * @pool:     Pool to populate
- * @size:     Size of each buffer in the pool
- * @elements: Number of buffers to allocate
- *
- * Returns the actual number of buffers allocated.
- */
-static int cvm_oct_fill_hw_memory(int pool, int size, int elements)
-{
-	char *memory;
-	char *fpa;
-	int freed = elements;
-
-	while (freed) {
-		/*
-		 * FPA memory must be 128 byte aligned.  Since we are
-		 * aligning we need to save the original pointer so we
-		 * can feed it to kfree when the memory is returned to
-		 * the kernel.
-		 *
-		 * We allocate an extra 256 bytes to allow for
-		 * alignment and space for the original pointer saved
-		 * just before the block.
-		 */
-		memory = kmalloc(size + 256, GFP_ATOMIC);
-		if (unlikely(!memory)) {
-			pr_warn("Unable to allocate %u bytes for FPA pool %d\n",
-				elements * size, pool);
-			break;
-		}
-		fpa = (char *)(((unsigned long)memory + 256) & ~0x7fUL);
-		*((char **)fpa - 1) = memory;
-		cvmx_fpa_free(fpa, pool, 0);
-		freed--;
-	}
-	return elements - freed;
-}
-
-/**
- * cvm_oct_free_hw_memory - Free memory allocated by cvm_oct_fill_hw_memory
- * @pool:     FPA pool to free
- * @size:     Size of each buffer in the pool
- * @elements: Number of buffers that should be in the pool
- */
-static void cvm_oct_free_hw_memory(int pool, int size, int elements)
-{
-	char *memory;
-	char *fpa;
-
-	do {
-		fpa = cvmx_fpa_alloc(pool);
-		if (fpa) {
-			elements--;
-			fpa = (char *)phys_to_virt(cvmx_ptr_to_phys(fpa));
-			memory = *((char **)fpa - 1);
-			kfree(memory);
-		}
-	} while (fpa);
-
-	if (elements < 0)
-		pr_warn("Freeing of pool %u had too many buffers (%d)\n",
-			pool, elements);
-	else if (elements > 0)
-		pr_warn("Warning: Freeing of pool %u is missing %d buffers\n",
-			pool, elements);
-}
-
-int cvm_oct_mem_fill_fpa(int pool, int size, int elements)
-{
-	int freed;
-
-	if (pool == CVMX_FPA_PACKET_POOL)
-		freed = cvm_oct_fill_hw_skbuff(pool, size, elements);
-	else
-		freed = cvm_oct_fill_hw_memory(pool, size, elements);
-	return freed;
-}
-
-void cvm_oct_mem_empty_fpa(int pool, int size, int elements)
-{
-	if (pool == CVMX_FPA_PACKET_POOL)
-		cvm_oct_free_hw_skbuff(pool, size, elements);
-	else
-		cvm_oct_free_hw_memory(pool, size, elements);
-}
diff --git a/drivers/staging/octeon/ethernet-mem.h b/drivers/staging/octeon/ethernet-mem.h
deleted file mode 100644
index 692dcdb7154d..000000000000
--- a/drivers/staging/octeon/ethernet-mem.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * This file is based on code from OCTEON SDK by Cavium Networks.
- *
- * Copyright (c) 2003-2007 Cavium Networks
- */
-
-int cvm_oct_mem_fill_fpa(int pool, int size, int elements);
-void cvm_oct_mem_empty_fpa(int pool, int size, int elements);
diff --git a/drivers/staging/octeon/ethernet-rgmii.c b/drivers/staging/octeon/ethernet-rgmii.c
deleted file mode 100644
index 0c4fac31540a..000000000000
--- a/drivers/staging/octeon/ethernet-rgmii.c
+++ /dev/null
@@ -1,158 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * This file is based on code from OCTEON SDK by Cavium Networks.
- *
- * Copyright (c) 2003-2007 Cavium Networks
- */
-
-#include <linux/kernel.h>
-#include <linux/netdevice.h>
-#include <linux/interrupt.h>
-#include <linux/phy.h>
-#include <linux/ratelimit.h>
-#include <net/dst.h>
-
-#include "octeon-ethernet.h"
-#include "ethernet-defines.h"
-#include "ethernet-util.h"
-#include "ethernet-mdio.h"
-
-static DEFINE_SPINLOCK(global_register_lock);
-
-static void cvm_oct_set_hw_preamble(struct octeon_ethernet *priv, bool enable)
-{
-	union cvmx_gmxx_rxx_frm_ctl gmxx_rxx_frm_ctl;
-	union cvmx_ipd_sub_port_fcs ipd_sub_port_fcs;
-	union cvmx_gmxx_rxx_int_reg gmxx_rxx_int_reg;
-	int interface = INTERFACE(priv->port);
-	int index = INDEX(priv->port);
-
-	/* Set preamble checking. */
-	gmxx_rxx_frm_ctl.u64 = cvmx_read_csr(CVMX_GMXX_RXX_FRM_CTL(index,
-								   interface));
-	gmxx_rxx_frm_ctl.s.pre_chk = enable;
-	cvmx_write_csr(CVMX_GMXX_RXX_FRM_CTL(index, interface),
-		       gmxx_rxx_frm_ctl.u64);
-
-	/* Set FCS stripping. */
-	ipd_sub_port_fcs.u64 = cvmx_read_csr(CVMX_IPD_SUB_PORT_FCS);
-	if (enable)
-		ipd_sub_port_fcs.s.port_bit |= 1ull << priv->port;
-	else
-		ipd_sub_port_fcs.s.port_bit &=
-					0xffffffffull ^ (1ull << priv->port);
-	cvmx_write_csr(CVMX_IPD_SUB_PORT_FCS, ipd_sub_port_fcs.u64);
-
-	/* Clear any error bits. */
-	gmxx_rxx_int_reg.u64 = cvmx_read_csr(CVMX_GMXX_RXX_INT_REG(index,
-								   interface));
-	cvmx_write_csr(CVMX_GMXX_RXX_INT_REG(index, interface),
-		       gmxx_rxx_int_reg.u64);
-}
-
-static void cvm_oct_check_preamble_errors(struct net_device *dev)
-{
-	struct octeon_ethernet *priv = netdev_priv(dev);
-	union cvmx_helper_link_info link_info;
-	unsigned long flags;
-
-	link_info.u64 = priv->link_info;
-
-	/*
-	 * Take the global register lock since we are going to
-	 * touch registers that affect more than one port.
-	 */
-	spin_lock_irqsave(&global_register_lock, flags);
-
-	if (link_info.s.speed == 10 && priv->last_speed == 10) {
-		/*
-		 * Read the GMXX_RXX_INT_REG[PCTERR] bit and see if we are
-		 * getting preamble errors.
-		 */
-		int interface = INTERFACE(priv->port);
-		int index = INDEX(priv->port);
-		union cvmx_gmxx_rxx_int_reg gmxx_rxx_int_reg;
-
-		gmxx_rxx_int_reg.u64 = cvmx_read_csr(CVMX_GMXX_RXX_INT_REG
-							(index, interface));
-		if (gmxx_rxx_int_reg.s.pcterr) {
-			/*
-			 * We are getting preamble errors at 10Mbps. Most
-			 * likely the PHY is giving us packets with misaligned
-			 * preambles. In order to get these packets we need to
-			 * disable preamble checking and do it in software.
-			 */
-			cvm_oct_set_hw_preamble(priv, false);
-			printk_ratelimited("%s: Using 10Mbps with software preamble removal\n",
-					   dev->name);
-		}
-	} else {
-		/*
-		 * Since the 10Mbps preamble workaround is allowed we need to
-		 * enable preamble checking, FCS stripping, and clear error
-		 * bits on every speed change. If errors occur during 10Mbps
-		 * operation the above code will change this stuff
-		 */
-		if (priv->last_speed != link_info.s.speed)
-			cvm_oct_set_hw_preamble(priv, true);
-		priv->last_speed = link_info.s.speed;
-	}
-	spin_unlock_irqrestore(&global_register_lock, flags);
-}
-
-static void cvm_oct_rgmii_poll(struct net_device *dev)
-{
-	struct octeon_ethernet *priv = netdev_priv(dev);
-	union cvmx_helper_link_info link_info;
-	bool status_change;
-
-	link_info = cvmx_helper_link_get(priv->port);
-	if (priv->link_info != link_info.u64 &&
-	    cvmx_helper_link_set(priv->port, link_info))
-		link_info.u64 = priv->link_info;
-	status_change = priv->link_info != link_info.u64;
-	priv->link_info = link_info.u64;
-
-	cvm_oct_check_preamble_errors(dev);
-
-	if (likely(!status_change))
-		return;
-
-	/* Tell core. */
-	if (link_info.s.link_up) {
-		if (!netif_carrier_ok(dev))
-			netif_carrier_on(dev);
-	} else if (netif_carrier_ok(dev)) {
-		netif_carrier_off(dev);
-	}
-	cvm_oct_note_carrier(priv, link_info);
-}
-
-int cvm_oct_rgmii_open(struct net_device *dev)
-{
-	struct octeon_ethernet *priv = netdev_priv(dev);
-	int ret;
-
-	ret = cvm_oct_common_open(dev, cvm_oct_rgmii_poll);
-	if (ret)
-		return ret;
-
-	if (dev->phydev) {
-		/*
-		 * In phydev mode, we need still periodic polling for the
-		 * preamble error checking, and we also need to call this
-		 * function on every link state change.
-		 *
-		 * Only true RGMII ports need to be polled. In GMII mode, port
-		 * 0 is really a RGMII port.
-		 */
-		if ((priv->imode == CVMX_HELPER_INTERFACE_MODE_GMII &&
-		     priv->port  == 0) ||
-		    (priv->imode == CVMX_HELPER_INTERFACE_MODE_RGMII)) {
-			priv->poll = cvm_oct_check_preamble_errors;
-			cvm_oct_check_preamble_errors(dev);
-		}
-	}
-
-	return 0;
-}
diff --git a/drivers/staging/octeon/ethernet-rx.c b/drivers/staging/octeon/ethernet-rx.c
deleted file mode 100644
index 2c16230f993c..000000000000
--- a/drivers/staging/octeon/ethernet-rx.c
+++ /dev/null
@@ -1,538 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * This file is based on code from OCTEON SDK by Cavium Networks.
- *
- * Copyright (c) 2003-2010 Cavium Networks
- */
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/cache.h>
-#include <linux/cpumask.h>
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-#include <linux/ip.h>
-#include <linux/string.h>
-#include <linux/prefetch.h>
-#include <linux/ratelimit.h>
-#include <linux/smp.h>
-#include <linux/interrupt.h>
-#include <net/dst.h>
-#ifdef CONFIG_XFRM
-#include <linux/xfrm.h>
-#include <net/xfrm.h>
-#endif /* CONFIG_XFRM */
-
-#include "octeon-ethernet.h"
-#include "ethernet-defines.h"
-#include "ethernet-mem.h"
-#include "ethernet-rx.h"
-#include "ethernet-util.h"
-
-static atomic_t oct_rx_ready = ATOMIC_INIT(0);
-
-static struct oct_rx_group {
-	int irq;
-	int group;
-	struct napi_struct napi;
-} oct_rx_group[16];
-
-/**
- * cvm_oct_do_interrupt - interrupt handler.
- * @irq: Interrupt number.
- * @napi_id: Cookie to identify the NAPI instance.
- *
- * The interrupt occurs whenever the POW has packets in our group.
- *
- */
-static irqreturn_t cvm_oct_do_interrupt(int irq, void *napi_id)
-{
-	/* Disable the IRQ and start napi_poll. */
-	disable_irq_nosync(irq);
-	napi_schedule(napi_id);
-
-	return IRQ_HANDLED;
-}
-
-/**
- * cvm_oct_check_rcv_error - process receive errors
- * @work: Work queue entry pointing to the packet.
- *
- * Returns Non-zero if the packet can be dropped, zero otherwise.
- */
-static inline int cvm_oct_check_rcv_error(struct cvmx_wqe *work)
-{
-	int port;
-
-	if (octeon_has_feature(OCTEON_FEATURE_PKND))
-		port = work->word0.pip.cn68xx.pknd;
-	else
-		port = work->word1.cn38xx.ipprt;
-
-	if ((work->word2.snoip.err_code == 10) && (work->word1.len <= 64)) {
-		/*
-		 * Ignore length errors on min size packets. Some
-		 * equipment incorrectly pads packets to 64+4FCS
-		 * instead of 60+4FCS.  Note these packets still get
-		 * counted as frame errors.
-		 */
-	} else if (work->word2.snoip.err_code == 5 ||
-		   work->word2.snoip.err_code == 7) {
-		/*
-		 * We received a packet with either an alignment error
-		 * or a FCS error. This may be signalling that we are
-		 * running 10Mbps with GMXX_RXX_FRM_CTL[PRE_CHK]
-		 * off. If this is the case we need to parse the
-		 * packet to determine if we can remove a non spec
-		 * preamble and generate a correct packet.
-		 */
-		int interface = cvmx_helper_get_interface_num(port);
-		int index = cvmx_helper_get_interface_index_num(port);
-		union cvmx_gmxx_rxx_frm_ctl gmxx_rxx_frm_ctl;
-
-		gmxx_rxx_frm_ctl.u64 =
-		    cvmx_read_csr(CVMX_GMXX_RXX_FRM_CTL(index, interface));
-		if (gmxx_rxx_frm_ctl.s.pre_chk == 0) {
-			u8 *ptr =
-			    cvmx_phys_to_ptr(work->packet_ptr.s.addr);
-			int i = 0;
-
-			while (i < work->word1.len - 1) {
-				if (*ptr != 0x55)
-					break;
-				ptr++;
-				i++;
-			}
-
-			if (*ptr == 0xd5) {
-				/* Port received 0xd5 preamble */
-				work->packet_ptr.s.addr += i + 1;
-				work->word1.len -= i + 5;
-			} else if ((*ptr & 0xf) == 0xd) {
-				/* Port received 0xd preamble */
-				work->packet_ptr.s.addr += i;
-				work->word1.len -= i + 4;
-				for (i = 0; i < work->word1.len; i++) {
-					*ptr =
-					    ((*ptr & 0xf0) >> 4) |
-					    ((*(ptr + 1) & 0xf) << 4);
-					ptr++;
-				}
-			} else {
-				printk_ratelimited("Port %d unknown preamble, packet dropped\n",
-						   port);
-				cvm_oct_free_work(work);
-				return 1;
-			}
-		}
-	} else {
-		printk_ratelimited("Port %d receive error code %d, packet dropped\n",
-				   port, work->word2.snoip.err_code);
-		cvm_oct_free_work(work);
-		return 1;
-	}
-
-	return 0;
-}
-
-static void copy_segments_to_skb(struct cvmx_wqe *work, struct sk_buff *skb)
-{
-	int segments = work->word2.s.bufs;
-	union cvmx_buf_ptr segment_ptr = work->packet_ptr;
-	int len = work->word1.len;
-	int segment_size;
-
-	while (segments--) {
-		union cvmx_buf_ptr next_ptr;
-
-		next_ptr = *(union cvmx_buf_ptr *)
-			cvmx_phys_to_ptr(segment_ptr.s.addr - 8);
-
-		/*
-		 * Octeon Errata PKI-100: The segment size is wrong.
-		 *
-		 * Until it is fixed, calculate the segment size based on
-		 * the packet pool buffer size.
-		 * When it is fixed, the following line should be replaced
-		 * with this one:
-		 * int segment_size = segment_ptr.s.size;
-		 */
-		segment_size =
-			CVMX_FPA_PACKET_POOL_SIZE -
-			(segment_ptr.s.addr -
-			 (((segment_ptr.s.addr >> 7) -
-			   segment_ptr.s.back) << 7));
-
-		/* Don't copy more than what is left in the packet */
-		if (segment_size > len)
-			segment_size = len;
-
-		/* Copy the data into the packet */
-		skb_put_data(skb, cvmx_phys_to_ptr(segment_ptr.s.addr),
-			     segment_size);
-		len -= segment_size;
-		segment_ptr = next_ptr;
-	}
-}
-
-static int cvm_oct_poll(struct oct_rx_group *rx_group, int budget)
-{
-	const int	coreid = cvmx_get_core_num();
-	u64	old_group_mask;
-	u64	old_scratch;
-	int		rx_count = 0;
-	int		did_work_request = 0;
-	int		packet_not_copied;
-
-	/* Prefetch cvm_oct_device since we know we need it soon */
-	prefetch(cvm_oct_device);
-
-	if (USE_ASYNC_IOBDMA) {
-		/* Save scratch in case userspace is using it */
-		CVMX_SYNCIOBDMA;
-		old_scratch = cvmx_scratch_read64(CVMX_SCR_SCRATCH);
-	}
-
-	/* Only allow work for our group (and preserve priorities) */
-	if (OCTEON_IS_MODEL(OCTEON_CN68XX)) {
-		old_group_mask = cvmx_read_csr(CVMX_SSO_PPX_GRP_MSK(coreid));
-		cvmx_write_csr(CVMX_SSO_PPX_GRP_MSK(coreid),
-			       BIT(rx_group->group));
-		cvmx_read_csr(CVMX_SSO_PPX_GRP_MSK(coreid)); /* Flush */
-	} else {
-		old_group_mask = cvmx_read_csr(CVMX_POW_PP_GRP_MSKX(coreid));
-		cvmx_write_csr(CVMX_POW_PP_GRP_MSKX(coreid),
-			       (old_group_mask & ~0xFFFFull) |
-			       BIT(rx_group->group));
-	}
-
-	if (USE_ASYNC_IOBDMA) {
-		cvmx_pow_work_request_async(CVMX_SCR_SCRATCH, CVMX_POW_NO_WAIT);
-		did_work_request = 1;
-	}
-
-	while (rx_count < budget) {
-		struct sk_buff *skb = NULL;
-		struct sk_buff **pskb = NULL;
-		int skb_in_hw;
-		struct cvmx_wqe *work;
-		int port;
-
-		if (USE_ASYNC_IOBDMA && did_work_request)
-			work = cvmx_pow_work_response_async(CVMX_SCR_SCRATCH);
-		else
-			work = cvmx_pow_work_request_sync(CVMX_POW_NO_WAIT);
-
-		prefetch(work);
-		did_work_request = 0;
-		if (!work) {
-			if (OCTEON_IS_MODEL(OCTEON_CN68XX)) {
-				cvmx_write_csr(CVMX_SSO_WQ_IQ_DIS,
-					       BIT(rx_group->group));
-				cvmx_write_csr(CVMX_SSO_WQ_INT,
-					       BIT(rx_group->group));
-			} else {
-				union cvmx_pow_wq_int wq_int;
-
-				wq_int.u64 = 0;
-				wq_int.s.iq_dis = BIT(rx_group->group);
-				wq_int.s.wq_int = BIT(rx_group->group);
-				cvmx_write_csr(CVMX_POW_WQ_INT, wq_int.u64);
-			}
-			break;
-		}
-		pskb = (struct sk_buff **)
-			(cvm_oct_get_buffer_ptr(work->packet_ptr) -
-			sizeof(void *));
-		prefetch(pskb);
-
-		if (USE_ASYNC_IOBDMA && rx_count < (budget - 1)) {
-			cvmx_pow_work_request_async_nocheck(CVMX_SCR_SCRATCH,
-							    CVMX_POW_NO_WAIT);
-			did_work_request = 1;
-		}
-		rx_count++;
-
-		skb_in_hw = work->word2.s.bufs == 1;
-		if (likely(skb_in_hw)) {
-			skb = *pskb;
-			prefetch(&skb->head);
-			prefetch(&skb->len);
-		}
-
-		if (octeon_has_feature(OCTEON_FEATURE_PKND))
-			port = work->word0.pip.cn68xx.pknd;
-		else
-			port = work->word1.cn38xx.ipprt;
-
-		prefetch(cvm_oct_device[port]);
-
-		/* Immediately throw away all packets with receive errors */
-		if (unlikely(work->word2.snoip.rcv_error)) {
-			if (cvm_oct_check_rcv_error(work))
-				continue;
-		}
-
-		/*
-		 * We can only use the zero copy path if skbuffs are
-		 * in the FPA pool and the packet fits in a single
-		 * buffer.
-		 */
-		if (likely(skb_in_hw)) {
-			skb->data = skb->head + work->packet_ptr.s.addr -
-				cvmx_ptr_to_phys(skb->head);
-			prefetch(skb->data);
-			skb->len = work->word1.len;
-			skb_set_tail_pointer(skb, skb->len);
-			packet_not_copied = 1;
-		} else {
-			/*
-			 * We have to copy the packet. First allocate
-			 * an skbuff for it.
-			 */
-			skb = dev_alloc_skb(work->word1.len);
-			if (!skb) {
-				cvm_oct_free_work(work);
-				continue;
-			}
-
-			/*
-			 * Check if we've received a packet that was
-			 * entirely stored in the work entry.
-			 */
-			if (unlikely(work->word2.s.bufs == 0)) {
-				u8 *ptr = work->packet_data;
-
-				if (likely(!work->word2.s.not_IP)) {
-					/*
-					 * The beginning of the packet
-					 * moves for IP packets.
-					 */
-					if (work->word2.s.is_v6)
-						ptr += 2;
-					else
-						ptr += 6;
-				}
-				skb_put_data(skb, ptr, work->word1.len);
-				/* No packet buffers to free */
-			} else {
-				copy_segments_to_skb(work, skb);
-			}
-			packet_not_copied = 0;
-		}
-		if (likely((port < TOTAL_NUMBER_OF_PORTS) &&
-			   cvm_oct_device[port])) {
-			struct net_device *dev = cvm_oct_device[port];
-
-			/*
-			 * Only accept packets for devices that are
-			 * currently up.
-			 */
-			if (likely(dev->flags & IFF_UP)) {
-				skb->protocol = eth_type_trans(skb, dev);
-				skb->dev = dev;
-
-				if (unlikely(work->word2.s.not_IP ||
-					     work->word2.s.IP_exc ||
-					     work->word2.s.L4_error ||
-					     !work->word2.s.tcp_or_udp))
-					skb->ip_summed = CHECKSUM_NONE;
-				else
-					skb->ip_summed = CHECKSUM_UNNECESSARY;
-
-				/* Increment RX stats for virtual ports */
-				if (port >= CVMX_PIP_NUM_INPUT_PORTS) {
-					dev->stats.rx_packets++;
-					dev->stats.rx_bytes += skb->len;
-				}
-				netif_receive_skb(skb);
-			} else {
-				/*
-				 * Drop any packet received for a device that
-				 * isn't up.
-				 */
-				dev->stats.rx_dropped++;
-				dev_kfree_skb_irq(skb);
-			}
-		} else {
-			/*
-			 * Drop any packet received for a device that
-			 * doesn't exist.
-			 */
-			printk_ratelimited("Port %d not controlled by Linux, packet dropped\n",
-					   port);
-			dev_kfree_skb_irq(skb);
-		}
-		/*
-		 * Check to see if the skbuff and work share the same
-		 * packet buffer.
-		 */
-		if (likely(packet_not_copied)) {
-			/*
-			 * This buffer needs to be replaced, increment
-			 * the number of buffers we need to free by
-			 * one.
-			 */
-			cvmx_fau_atomic_add32(FAU_NUM_PACKET_BUFFERS_TO_FREE,
-					      1);
-
-			cvmx_fpa_free(work, CVMX_FPA_WQE_POOL, 1);
-		} else {
-			cvm_oct_free_work(work);
-		}
-	}
-	/* Restore the original POW group mask */
-	if (OCTEON_IS_MODEL(OCTEON_CN68XX)) {
-		cvmx_write_csr(CVMX_SSO_PPX_GRP_MSK(coreid), old_group_mask);
-		cvmx_read_csr(CVMX_SSO_PPX_GRP_MSK(coreid)); /* Flush */
-	} else {
-		cvmx_write_csr(CVMX_POW_PP_GRP_MSKX(coreid), old_group_mask);
-	}
-
-	if (USE_ASYNC_IOBDMA) {
-		/* Restore the scratch area */
-		cvmx_scratch_write64(CVMX_SCR_SCRATCH, old_scratch);
-	}
-	cvm_oct_rx_refill_pool(0);
-
-	return rx_count;
-}
-
-/**
- * cvm_oct_napi_poll - the NAPI poll function.
- * @napi: The NAPI instance.
- * @budget: Maximum number of packets to receive.
- *
- * Returns the number of packets processed.
- */
-static int cvm_oct_napi_poll(struct napi_struct *napi, int budget)
-{
-	struct oct_rx_group *rx_group = container_of(napi, struct oct_rx_group,
-						     napi);
-	int rx_count;
-
-	rx_count = cvm_oct_poll(rx_group, budget);
-
-	if (rx_count < budget) {
-		/* No more work */
-		napi_complete_done(napi, rx_count);
-		enable_irq(rx_group->irq);
-	}
-	return rx_count;
-}
-
-#ifdef CONFIG_NET_POLL_CONTROLLER
-/**
- * cvm_oct_poll_controller - poll for receive packets
- * device.
- *
- * @dev:    Device to poll. Unused
- */
-void cvm_oct_poll_controller(struct net_device *dev)
-{
-	int i;
-
-	if (!atomic_read(&oct_rx_ready))
-		return;
-
-	for (i = 0; i < ARRAY_SIZE(oct_rx_group); i++) {
-		if (!(pow_receive_groups & BIT(i)))
-			continue;
-
-		cvm_oct_poll(&oct_rx_group[i], 16);
-	}
-}
-#endif
-
-void cvm_oct_rx_initialize(void)
-{
-	int i;
-	struct net_device *dev_for_napi = NULL;
-
-	for (i = 0; i < TOTAL_NUMBER_OF_PORTS; i++) {
-		if (cvm_oct_device[i]) {
-			dev_for_napi = cvm_oct_device[i];
-			break;
-		}
-	}
-
-	if (!dev_for_napi)
-		panic("No net_devices were allocated.");
-
-	for (i = 0; i < ARRAY_SIZE(oct_rx_group); i++) {
-		int ret;
-
-		if (!(pow_receive_groups & BIT(i)))
-			continue;
-
-		netif_napi_add(dev_for_napi, &oct_rx_group[i].napi,
-			       cvm_oct_napi_poll, rx_napi_weight);
-		napi_enable(&oct_rx_group[i].napi);
-
-		oct_rx_group[i].irq = OCTEON_IRQ_WORKQ0 + i;
-		oct_rx_group[i].group = i;
-
-		/* Register an IRQ handler to receive POW interrupts */
-		ret = request_irq(oct_rx_group[i].irq, cvm_oct_do_interrupt, 0,
-				  "Ethernet", &oct_rx_group[i].napi);
-		if (ret)
-			panic("Could not acquire Ethernet IRQ %d\n",
-			      oct_rx_group[i].irq);
-
-		disable_irq_nosync(oct_rx_group[i].irq);
-
-		/* Enable POW interrupt when our port has at least one packet */
-		if (OCTEON_IS_MODEL(OCTEON_CN68XX)) {
-			union cvmx_sso_wq_int_thrx int_thr;
-			union cvmx_pow_wq_int_pc int_pc;
-
-			int_thr.u64 = 0;
-			int_thr.s.tc_en = 1;
-			int_thr.s.tc_thr = 1;
-			cvmx_write_csr(CVMX_SSO_WQ_INT_THRX(i), int_thr.u64);
-
-			int_pc.u64 = 0;
-			int_pc.s.pc_thr = 5;
-			cvmx_write_csr(CVMX_SSO_WQ_INT_PC, int_pc.u64);
-		} else {
-			union cvmx_pow_wq_int_thrx int_thr;
-			union cvmx_pow_wq_int_pc int_pc;
-
-			int_thr.u64 = 0;
-			int_thr.s.tc_en = 1;
-			int_thr.s.tc_thr = 1;
-			cvmx_write_csr(CVMX_POW_WQ_INT_THRX(i), int_thr.u64);
-
-			int_pc.u64 = 0;
-			int_pc.s.pc_thr = 5;
-			cvmx_write_csr(CVMX_POW_WQ_INT_PC, int_pc.u64);
-		}
-
-		/* Schedule NAPI now. This will indirectly enable the
-		 * interrupt.
-		 */
-		napi_schedule(&oct_rx_group[i].napi);
-	}
-	atomic_inc(&oct_rx_ready);
-}
-
-void cvm_oct_rx_shutdown(void)
-{
-	int i;
-
-	for (i = 0; i < ARRAY_SIZE(oct_rx_group); i++) {
-		if (!(pow_receive_groups & BIT(i)))
-			continue;
-
-		/* Disable POW interrupt */
-		if (OCTEON_IS_MODEL(OCTEON_CN68XX))
-			cvmx_write_csr(CVMX_SSO_WQ_INT_THRX(i), 0);
-		else
-			cvmx_write_csr(CVMX_POW_WQ_INT_THRX(i), 0);
-
-		/* Free the interrupt handler */
-		free_irq(oct_rx_group[i].irq, cvm_oct_device);
-
-		netif_napi_del(&oct_rx_group[i].napi);
-	}
-}
diff --git a/drivers/staging/octeon/ethernet-rx.h b/drivers/staging/octeon/ethernet-rx.h
deleted file mode 100644
index ff6482fa20d6..000000000000
--- a/drivers/staging/octeon/ethernet-rx.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * This file is based on code from OCTEON SDK by Cavium Networks.
- *
- * Copyright (c) 2003-2007 Cavium Networks
- */
-
-void cvm_oct_poll_controller(struct net_device *dev);
-void cvm_oct_rx_initialize(void);
-void cvm_oct_rx_shutdown(void);
-
-static inline void cvm_oct_rx_refill_pool(int fill_threshold)
-{
-	int number_to_free;
-	int num_freed;
-	/* Refill the packet buffer pool */
-	number_to_free =
-		cvmx_fau_fetch_and_add32(FAU_NUM_PACKET_BUFFERS_TO_FREE, 0);
-
-	if (number_to_free > fill_threshold) {
-		cvmx_fau_atomic_add32(FAU_NUM_PACKET_BUFFERS_TO_FREE,
-				      -number_to_free);
-		num_freed = cvm_oct_mem_fill_fpa(CVMX_FPA_PACKET_POOL,
-						 CVMX_FPA_PACKET_POOL_SIZE,
-						 number_to_free);
-		if (num_freed != number_to_free) {
-			cvmx_fau_atomic_add32(FAU_NUM_PACKET_BUFFERS_TO_FREE,
-					      number_to_free - num_freed);
-		}
-	}
-}
diff --git a/drivers/staging/octeon/ethernet-sgmii.c b/drivers/staging/octeon/ethernet-sgmii.c
deleted file mode 100644
index d7fbd9159302..000000000000
--- a/drivers/staging/octeon/ethernet-sgmii.c
+++ /dev/null
@@ -1,30 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * This file is based on code from OCTEON SDK by Cavium Networks.
- *
- * Copyright (c) 2003-2007 Cavium Networks
- */
-
-#include <linux/phy.h>
-#include <linux/kernel.h>
-#include <linux/netdevice.h>
-#include <linux/ratelimit.h>
-#include <net/dst.h>
-
-#include "octeon-ethernet.h"
-#include "ethernet-defines.h"
-#include "ethernet-util.h"
-#include "ethernet-mdio.h"
-
-int cvm_oct_sgmii_open(struct net_device *dev)
-{
-	return cvm_oct_common_open(dev, cvm_oct_link_poll);
-}
-
-int cvm_oct_sgmii_init(struct net_device *dev)
-{
-	cvm_oct_common_init(dev);
-
-	/* FIXME: Need autoneg logic */
-	return 0;
-}
diff --git a/drivers/staging/octeon/ethernet-spi.c b/drivers/staging/octeon/ethernet-spi.c
deleted file mode 100644
index c582403e6a1f..000000000000
--- a/drivers/staging/octeon/ethernet-spi.c
+++ /dev/null
@@ -1,226 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * This file is based on code from OCTEON SDK by Cavium Networks.
- *
- * Copyright (c) 2003-2007 Cavium Networks
- */
-
-#include <linux/kernel.h>
-#include <linux/netdevice.h>
-#include <linux/interrupt.h>
-#include <net/dst.h>
-
-#include "octeon-ethernet.h"
-#include "ethernet-defines.h"
-#include "ethernet-util.h"
-
-static int number_spi_ports;
-static int need_retrain[2] = { 0, 0 };
-
-static void cvm_oct_spxx_int_pr(union cvmx_spxx_int_reg spx_int_reg, int index)
-{
-	if (spx_int_reg.s.spf)
-		pr_err("SPI%d: SRX Spi4 interface down\n", index);
-	if (spx_int_reg.s.calerr)
-		pr_err("SPI%d: SRX Spi4 Calendar table parity error\n", index);
-	if (spx_int_reg.s.syncerr)
-		pr_err("SPI%d: SRX Consecutive Spi4 DIP4 errors have exceeded SPX_ERR_CTL[ERRCNT]\n",
-		       index);
-	if (spx_int_reg.s.diperr)
-		pr_err("SPI%d: SRX Spi4 DIP4 error\n", index);
-	if (spx_int_reg.s.tpaovr)
-		pr_err("SPI%d: SRX Selected port has hit TPA overflow\n",
-		       index);
-	if (spx_int_reg.s.rsverr)
-		pr_err("SPI%d: SRX Spi4 reserved control word detected\n",
-		       index);
-	if (spx_int_reg.s.drwnng)
-		pr_err("SPI%d: SRX Spi4 receive FIFO drowning/overflow\n",
-		       index);
-	if (spx_int_reg.s.clserr)
-		pr_err("SPI%d: SRX Spi4 packet closed on non-16B alignment without EOP\n",
-		       index);
-	if (spx_int_reg.s.spiovr)
-		pr_err("SPI%d: SRX Spi4 async FIFO overflow\n", index);
-	if (spx_int_reg.s.abnorm)
-		pr_err("SPI%d: SRX Abnormal packet termination (ERR bit)\n",
-		       index);
-	if (spx_int_reg.s.prtnxa)
-		pr_err("SPI%d: SRX Port out of range\n", index);
-}
-
-static void cvm_oct_stxx_int_pr(union cvmx_stxx_int_reg stx_int_reg, int index)
-{
-	if (stx_int_reg.s.syncerr)
-		pr_err("SPI%d: STX Interface encountered a fatal error\n",
-		       index);
-	if (stx_int_reg.s.frmerr)
-		pr_err("SPI%d: STX FRMCNT has exceeded STX_DIP_CNT[MAXFRM]\n",
-		       index);
-	if (stx_int_reg.s.unxfrm)
-		pr_err("SPI%d: STX Unexpected framing sequence\n", index);
-	if (stx_int_reg.s.nosync)
-		pr_err("SPI%d: STX ERRCNT has exceeded STX_DIP_CNT[MAXDIP]\n",
-		       index);
-	if (stx_int_reg.s.diperr)
-		pr_err("SPI%d: STX DIP2 error on the Spi4 Status channel\n",
-		       index);
-	if (stx_int_reg.s.datovr)
-		pr_err("SPI%d: STX Spi4 FIFO overflow error\n", index);
-	if (stx_int_reg.s.ovrbst)
-		pr_err("SPI%d: STX Transmit packet burst too big\n", index);
-	if (stx_int_reg.s.calpar1)
-		pr_err("SPI%d: STX Calendar Table Parity Error Bank%d\n",
-		       index, 1);
-	if (stx_int_reg.s.calpar0)
-		pr_err("SPI%d: STX Calendar Table Parity Error Bank%d\n",
-		       index, 0);
-}
-
-static irqreturn_t cvm_oct_spi_spx_int(int index)
-{
-	union cvmx_spxx_int_reg spx_int_reg;
-	union cvmx_stxx_int_reg stx_int_reg;
-
-	spx_int_reg.u64 = cvmx_read_csr(CVMX_SPXX_INT_REG(index));
-	cvmx_write_csr(CVMX_SPXX_INT_REG(index), spx_int_reg.u64);
-	if (!need_retrain[index]) {
-		spx_int_reg.u64 &= cvmx_read_csr(CVMX_SPXX_INT_MSK(index));
-		cvm_oct_spxx_int_pr(spx_int_reg, index);
-	}
-
-	stx_int_reg.u64 = cvmx_read_csr(CVMX_STXX_INT_REG(index));
-	cvmx_write_csr(CVMX_STXX_INT_REG(index), stx_int_reg.u64);
-	if (!need_retrain[index]) {
-		stx_int_reg.u64 &= cvmx_read_csr(CVMX_STXX_INT_MSK(index));
-		cvm_oct_stxx_int_pr(stx_int_reg, index);
-	}
-
-	cvmx_write_csr(CVMX_SPXX_INT_MSK(index), 0);
-	cvmx_write_csr(CVMX_STXX_INT_MSK(index), 0);
-	need_retrain[index] = 1;
-
-	return IRQ_HANDLED;
-}
-
-static irqreturn_t cvm_oct_spi_rml_interrupt(int cpl, void *dev_id)
-{
-	irqreturn_t return_status = IRQ_NONE;
-	union cvmx_npi_rsl_int_blocks rsl_int_blocks;
-
-	/* Check and see if this interrupt was caused by the GMX block */
-	rsl_int_blocks.u64 = cvmx_read_csr(CVMX_NPI_RSL_INT_BLOCKS);
-	if (rsl_int_blocks.s.spx1) /* 19 - SPX1_INT_REG & STX1_INT_REG */
-		return_status = cvm_oct_spi_spx_int(1);
-
-	if (rsl_int_blocks.s.spx0) /* 18 - SPX0_INT_REG & STX0_INT_REG */
-		return_status = cvm_oct_spi_spx_int(0);
-
-	return return_status;
-}
-
-static void cvm_oct_spi_enable_error_reporting(int interface)
-{
-	union cvmx_spxx_int_msk spxx_int_msk;
-	union cvmx_stxx_int_msk stxx_int_msk;
-
-	spxx_int_msk.u64 = cvmx_read_csr(CVMX_SPXX_INT_MSK(interface));
-	spxx_int_msk.s.calerr = 1;
-	spxx_int_msk.s.syncerr = 1;
-	spxx_int_msk.s.diperr = 1;
-	spxx_int_msk.s.tpaovr = 1;
-	spxx_int_msk.s.rsverr = 1;
-	spxx_int_msk.s.drwnng = 1;
-	spxx_int_msk.s.clserr = 1;
-	spxx_int_msk.s.spiovr = 1;
-	spxx_int_msk.s.abnorm = 1;
-	spxx_int_msk.s.prtnxa = 1;
-	cvmx_write_csr(CVMX_SPXX_INT_MSK(interface), spxx_int_msk.u64);
-
-	stxx_int_msk.u64 = cvmx_read_csr(CVMX_STXX_INT_MSK(interface));
-	stxx_int_msk.s.frmerr = 1;
-	stxx_int_msk.s.unxfrm = 1;
-	stxx_int_msk.s.nosync = 1;
-	stxx_int_msk.s.diperr = 1;
-	stxx_int_msk.s.datovr = 1;
-	stxx_int_msk.s.ovrbst = 1;
-	stxx_int_msk.s.calpar1 = 1;
-	stxx_int_msk.s.calpar0 = 1;
-	cvmx_write_csr(CVMX_STXX_INT_MSK(interface), stxx_int_msk.u64);
-}
-
-static void cvm_oct_spi_poll(struct net_device *dev)
-{
-	static int spi4000_port;
-	struct octeon_ethernet *priv = netdev_priv(dev);
-	int interface;
-
-	for (interface = 0; interface < 2; interface++) {
-		if ((priv->port == interface * 16) && need_retrain[interface]) {
-			if (cvmx_spi_restart_interface
-			    (interface, CVMX_SPI_MODE_DUPLEX, 10) == 0) {
-				need_retrain[interface] = 0;
-				cvm_oct_spi_enable_error_reporting(interface);
-			}
-		}
-
-		/*
-		 * The SPI4000 TWSI interface is very slow. In order
-		 * not to bring the system to a crawl, we only poll a
-		 * single port every second. This means negotiation
-		 * speed changes take up to 10 seconds, but at least
-		 * we don't waste absurd amounts of time waiting for
-		 * TWSI.
-		 */
-		if (priv->port == spi4000_port) {
-			/*
-			 * This function does nothing if it is called on an
-			 * interface without a SPI4000.
-			 */
-			cvmx_spi4000_check_speed(interface, priv->port);
-			/*
-			 * Normal ordering increments. By decrementing
-			 * we only match once per iteration.
-			 */
-			spi4000_port--;
-			if (spi4000_port < 0)
-				spi4000_port = 10;
-		}
-	}
-}
-
-int cvm_oct_spi_init(struct net_device *dev)
-{
-	int r;
-	struct octeon_ethernet *priv = netdev_priv(dev);
-
-	if (number_spi_ports == 0) {
-		r = request_irq(OCTEON_IRQ_RML, cvm_oct_spi_rml_interrupt,
-				IRQF_SHARED, "SPI", &number_spi_ports);
-		if (r)
-			return r;
-	}
-	number_spi_ports++;
-
-	if ((priv->port == 0) || (priv->port == 16)) {
-		cvm_oct_spi_enable_error_reporting(INTERFACE(priv->port));
-		priv->poll = cvm_oct_spi_poll;
-	}
-	cvm_oct_common_init(dev);
-	return 0;
-}
-
-void cvm_oct_spi_uninit(struct net_device *dev)
-{
-	int interface;
-
-	cvm_oct_common_uninit(dev);
-	number_spi_ports--;
-	if (number_spi_ports == 0) {
-		for (interface = 0; interface < 2; interface++) {
-			cvmx_write_csr(CVMX_SPXX_INT_MSK(interface), 0);
-			cvmx_write_csr(CVMX_STXX_INT_MSK(interface), 0);
-		}
-		free_irq(OCTEON_IRQ_RML, &number_spi_ports);
-	}
-}
diff --git a/drivers/staging/octeon/ethernet-tx.c b/drivers/staging/octeon/ethernet-tx.c
deleted file mode 100644
index b334cf89794e..000000000000
--- a/drivers/staging/octeon/ethernet-tx.c
+++ /dev/null
@@ -1,717 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * This file is based on code from OCTEON SDK by Cavium Networks.
- *
- * Copyright (c) 2003-2010 Cavium Networks
- */
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-#include <linux/ip.h>
-#include <linux/ratelimit.h>
-#include <linux/string.h>
-#include <linux/interrupt.h>
-#include <net/dst.h>
-#ifdef CONFIG_XFRM
-#include <linux/xfrm.h>
-#include <net/xfrm.h>
-#endif /* CONFIG_XFRM */
-
-#include <linux/atomic.h>
-#include <net/sch_generic.h>
-
-#include "octeon-ethernet.h"
-#include "ethernet-defines.h"
-#include "ethernet-tx.h"
-#include "ethernet-util.h"
-
-#define CVM_OCT_SKB_CB(skb)	((u64 *)((skb)->cb))
-
-/*
- * You can define GET_SKBUFF_QOS() to override how the skbuff output
- * function determines which output queue is used. The default
- * implementation always uses the base queue for the port. If, for
- * example, you wanted to use the skb->priority field, define
- * GET_SKBUFF_QOS as: #define GET_SKBUFF_QOS(skb) ((skb)->priority)
- */
-#ifndef GET_SKBUFF_QOS
-#define GET_SKBUFF_QOS(skb) 0
-#endif
-
-static void cvm_oct_tx_do_cleanup(unsigned long arg);
-static DECLARE_TASKLET(cvm_oct_tx_cleanup_tasklet, cvm_oct_tx_do_cleanup, 0);
-
-/* Maximum number of SKBs to try to free per xmit packet. */
-#define MAX_SKB_TO_FREE (MAX_OUT_QUEUE_DEPTH * 2)
-
-static inline int cvm_oct_adjust_skb_to_free(int skb_to_free, int fau)
-{
-	int undo;
-
-	undo = skb_to_free > 0 ? MAX_SKB_TO_FREE : skb_to_free +
-						   MAX_SKB_TO_FREE;
-	if (undo > 0)
-		cvmx_fau_atomic_add32(fau, -undo);
-	skb_to_free = -skb_to_free > MAX_SKB_TO_FREE ? MAX_SKB_TO_FREE :
-						       -skb_to_free;
-	return skb_to_free;
-}
-
-static void cvm_oct_kick_tx_poll_watchdog(void)
-{
-	union cvmx_ciu_timx ciu_timx;
-
-	ciu_timx.u64 = 0;
-	ciu_timx.s.one_shot = 1;
-	ciu_timx.s.len = cvm_oct_tx_poll_interval;
-	cvmx_write_csr(CVMX_CIU_TIMX(1), ciu_timx.u64);
-}
-
-static void cvm_oct_free_tx_skbs(struct net_device *dev)
-{
-	int skb_to_free;
-	int qos, queues_per_port;
-	int total_freed = 0;
-	int total_remaining = 0;
-	unsigned long flags;
-	struct octeon_ethernet *priv = netdev_priv(dev);
-
-	queues_per_port = cvmx_pko_get_num_queues(priv->port);
-	/* Drain any pending packets in the free list */
-	for (qos = 0; qos < queues_per_port; qos++) {
-		if (skb_queue_len(&priv->tx_free_list[qos]) == 0)
-			continue;
-		skb_to_free = cvmx_fau_fetch_and_add32(priv->fau + qos * 4,
-						       MAX_SKB_TO_FREE);
-		skb_to_free = cvm_oct_adjust_skb_to_free(skb_to_free,
-							 priv->fau + qos * 4);
-		total_freed += skb_to_free;
-		if (skb_to_free > 0) {
-			struct sk_buff *to_free_list = NULL;
-
-			spin_lock_irqsave(&priv->tx_free_list[qos].lock, flags);
-			while (skb_to_free > 0) {
-				struct sk_buff *t;
-
-				t = __skb_dequeue(&priv->tx_free_list[qos]);
-				t->next = to_free_list;
-				to_free_list = t;
-				skb_to_free--;
-			}
-			spin_unlock_irqrestore(&priv->tx_free_list[qos].lock,
-					       flags);
-			/* Do the actual freeing outside of the lock. */
-			while (to_free_list) {
-				struct sk_buff *t = to_free_list;
-
-				to_free_list = to_free_list->next;
-				dev_kfree_skb_any(t);
-			}
-		}
-		total_remaining += skb_queue_len(&priv->tx_free_list[qos]);
-	}
-	if (total_remaining < MAX_OUT_QUEUE_DEPTH && netif_queue_stopped(dev))
-		netif_wake_queue(dev);
-	if (total_remaining)
-		cvm_oct_kick_tx_poll_watchdog();
-}
-
-/**
- * cvm_oct_xmit - transmit a packet
- * @skb:    Packet to send
- * @dev:    Device info structure
- *
- * Returns Always returns NETDEV_TX_OK
- */
-int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev)
-{
-	union cvmx_pko_command_word0 pko_command;
-	union cvmx_buf_ptr hw_buffer;
-	u64 old_scratch;
-	u64 old_scratch2;
-	int qos;
-	int i;
-	enum {QUEUE_CORE, QUEUE_HW, QUEUE_DROP} queue_type;
-	struct octeon_ethernet *priv = netdev_priv(dev);
-	struct sk_buff *to_free_list;
-	int skb_to_free;
-	int buffers_to_free;
-	u32 total_to_clean;
-	unsigned long flags;
-#if REUSE_SKBUFFS_WITHOUT_FREE
-	unsigned char *fpa_head;
-#endif
-
-	/*
-	 * Prefetch the private data structure.  It is larger than the
-	 * one cache line.
-	 */
-	prefetch(priv);
-
-	/*
-	 * The check on CVMX_PKO_QUEUES_PER_PORT_* is designed to
-	 * completely remove "qos" in the event neither interface
-	 * supports multiple queues per port.
-	 */
-	if ((CVMX_PKO_QUEUES_PER_PORT_INTERFACE0 > 1) ||
-	    (CVMX_PKO_QUEUES_PER_PORT_INTERFACE1 > 1)) {
-		qos = GET_SKBUFF_QOS(skb);
-		if (qos <= 0)
-			qos = 0;
-		else if (qos >= cvmx_pko_get_num_queues(priv->port))
-			qos = 0;
-	} else {
-		qos = 0;
-	}
-
-	if (USE_ASYNC_IOBDMA) {
-		/* Save scratch in case userspace is using it */
-		CVMX_SYNCIOBDMA;
-		old_scratch = cvmx_scratch_read64(CVMX_SCR_SCRATCH);
-		old_scratch2 = cvmx_scratch_read64(CVMX_SCR_SCRATCH + 8);
-
-		/*
-		 * Fetch and increment the number of packets to be
-		 * freed.
-		 */
-		cvmx_fau_async_fetch_and_add32(CVMX_SCR_SCRATCH + 8,
-					       FAU_NUM_PACKET_BUFFERS_TO_FREE,
-					       0);
-		cvmx_fau_async_fetch_and_add32(CVMX_SCR_SCRATCH,
-					       priv->fau + qos * 4,
-					       MAX_SKB_TO_FREE);
-	}
-
-	/*
-	 * We have space for 6 segment pointers, If there will be more
-	 * than that, we must linearize.
-	 */
-	if (unlikely(skb_shinfo(skb)->nr_frags > 5)) {
-		if (unlikely(__skb_linearize(skb))) {
-			queue_type = QUEUE_DROP;
-			if (USE_ASYNC_IOBDMA) {
-				/*
-				 * Get the number of skbuffs in use
-				 * by the hardware
-				 */
-				CVMX_SYNCIOBDMA;
-				skb_to_free =
-					cvmx_scratch_read64(CVMX_SCR_SCRATCH);
-			} else {
-				/*
-				 * Get the number of skbuffs in use
-				 * by the hardware
-				 */
-				skb_to_free =
-				     cvmx_fau_fetch_and_add32(priv->fau +
-							      qos * 4,
-							      MAX_SKB_TO_FREE);
-			}
-			skb_to_free = cvm_oct_adjust_skb_to_free(skb_to_free,
-								 priv->fau +
-								 qos * 4);
-			spin_lock_irqsave(&priv->tx_free_list[qos].lock, flags);
-			goto skip_xmit;
-		}
-	}
-
-	/*
-	 * The CN3XXX series of parts has an errata (GMX-401) which
-	 * causes the GMX block to hang if a collision occurs towards
-	 * the end of a <68 byte packet. As a workaround for this, we
-	 * pad packets to be 68 bytes whenever we are in half duplex
-	 * mode. We don't handle the case of having a small packet but
-	 * no room to add the padding.  The kernel should always give
-	 * us at least a cache line
-	 */
-	if ((skb->len < 64) && OCTEON_IS_MODEL(OCTEON_CN3XXX)) {
-		union cvmx_gmxx_prtx_cfg gmx_prt_cfg;
-		int interface = INTERFACE(priv->port);
-		int index = INDEX(priv->port);
-
-		if (interface < 2) {
-			/* We only need to pad packet in half duplex mode */
-			gmx_prt_cfg.u64 =
-			    cvmx_read_csr(CVMX_GMXX_PRTX_CFG(index, interface));
-			if (gmx_prt_cfg.s.duplex == 0) {
-				int add_bytes = 64 - skb->len;
-
-				if ((skb_tail_pointer(skb) + add_bytes) <=
-				    skb_end_pointer(skb))
-					__skb_put_zero(skb, add_bytes);
-			}
-		}
-	}
-
-	/* Build the PKO command */
-	pko_command.u64 = 0;
-#ifdef __LITTLE_ENDIAN
-	pko_command.s.le = 1;
-#endif
-	pko_command.s.n2 = 1;	/* Don't pollute L2 with the outgoing packet */
-	pko_command.s.segs = 1;
-	pko_command.s.total_bytes = skb->len;
-	pko_command.s.size0 = CVMX_FAU_OP_SIZE_32;
-	pko_command.s.subone0 = 1;
-
-	pko_command.s.dontfree = 1;
-
-	/* Build the PKO buffer pointer */
-	hw_buffer.u64 = 0;
-	if (skb_shinfo(skb)->nr_frags == 0) {
-		hw_buffer.s.addr = XKPHYS_TO_PHYS((uintptr_t)skb->data);
-		hw_buffer.s.pool = 0;
-		hw_buffer.s.size = skb->len;
-	} else {
-		hw_buffer.s.addr = XKPHYS_TO_PHYS((uintptr_t)skb->data);
-		hw_buffer.s.pool = 0;
-		hw_buffer.s.size = skb_headlen(skb);
-		CVM_OCT_SKB_CB(skb)[0] = hw_buffer.u64;
-		for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
-			skb_frag_t *fs = skb_shinfo(skb)->frags + i;
-
-			hw_buffer.s.addr =
-				XKPHYS_TO_PHYS((uintptr_t)skb_frag_address(fs));
-			hw_buffer.s.size = skb_frag_size(fs);
-			CVM_OCT_SKB_CB(skb)[i + 1] = hw_buffer.u64;
-		}
-		hw_buffer.s.addr =
-			XKPHYS_TO_PHYS((uintptr_t)CVM_OCT_SKB_CB(skb));
-		hw_buffer.s.size = skb_shinfo(skb)->nr_frags + 1;
-		pko_command.s.segs = skb_shinfo(skb)->nr_frags + 1;
-		pko_command.s.gather = 1;
-		goto dont_put_skbuff_in_hw;
-	}
-
-	/*
-	 * See if we can put this skb in the FPA pool. Any strange
-	 * behavior from the Linux networking stack will most likely
-	 * be caused by a bug in the following code. If some field is
-	 * in use by the network stack and gets carried over when a
-	 * buffer is reused, bad things may happen.  If in doubt and
-	 * you dont need the absolute best performance, disable the
-	 * define REUSE_SKBUFFS_WITHOUT_FREE. The reuse of buffers has
-	 * shown a 25% increase in performance under some loads.
-	 */
-#if REUSE_SKBUFFS_WITHOUT_FREE
-	fpa_head = skb->head + 256 - ((unsigned long)skb->head & 0x7f);
-	if (unlikely(skb->data < fpa_head)) {
-		/* TX buffer beginning can't meet FPA alignment constraints */
-		goto dont_put_skbuff_in_hw;
-	}
-	if (unlikely
-	    ((skb_end_pointer(skb) - fpa_head) < CVMX_FPA_PACKET_POOL_SIZE)) {
-		/* TX buffer isn't large enough for the FPA */
-		goto dont_put_skbuff_in_hw;
-	}
-	if (unlikely(skb_shared(skb))) {
-		/* TX buffer sharing data with someone else */
-		goto dont_put_skbuff_in_hw;
-	}
-	if (unlikely(skb_cloned(skb))) {
-		/* TX buffer has been cloned */
-		goto dont_put_skbuff_in_hw;
-	}
-	if (unlikely(skb_header_cloned(skb))) {
-		/* TX buffer header has been cloned */
-		goto dont_put_skbuff_in_hw;
-	}
-	if (unlikely(skb->destructor)) {
-		/* TX buffer has a destructor */
-		goto dont_put_skbuff_in_hw;
-	}
-	if (unlikely(skb_shinfo(skb)->nr_frags)) {
-		/* TX buffer has fragments */
-		goto dont_put_skbuff_in_hw;
-	}
-	if (unlikely
-	    (skb->truesize !=
-	     sizeof(*skb) + skb_end_offset(skb))) {
-		/* TX buffer truesize has been changed */
-		goto dont_put_skbuff_in_hw;
-	}
-
-	/*
-	 * We can use this buffer in the FPA.  We don't need the FAU
-	 * update anymore
-	 */
-	pko_command.s.dontfree = 0;
-
-	hw_buffer.s.back = ((unsigned long)skb->data >> 7) -
-			   ((unsigned long)fpa_head >> 7);
-
-	*(struct sk_buff **)(fpa_head - sizeof(void *)) = skb;
-
-	/*
-	 * The skbuff will be reused without ever being freed. We must
-	 * cleanup a bunch of core things.
-	 */
-	dst_release(skb_dst(skb));
-	skb_dst_set(skb, NULL);
-	skb_ext_reset(skb);
-	nf_reset_ct(skb);
-
-#ifdef CONFIG_NET_SCHED
-	skb->tc_index = 0;
-	skb_reset_tc(skb);
-#endif /* CONFIG_NET_SCHED */
-#endif /* REUSE_SKBUFFS_WITHOUT_FREE */
-
-dont_put_skbuff_in_hw:
-
-	/* Check if we can use the hardware checksumming */
-	if ((skb->protocol == htons(ETH_P_IP)) &&
-	    (ip_hdr(skb)->version == 4) &&
-	    (ip_hdr(skb)->ihl == 5) &&
-	    ((ip_hdr(skb)->frag_off == 0) ||
-	     (ip_hdr(skb)->frag_off == htons(1 << 14))) &&
-	    ((ip_hdr(skb)->protocol == IPPROTO_TCP) ||
-	     (ip_hdr(skb)->protocol == IPPROTO_UDP))) {
-		/* Use hardware checksum calc */
-		pko_command.s.ipoffp1 = skb_network_offset(skb) + 1;
-	}
-
-	if (USE_ASYNC_IOBDMA) {
-		/* Get the number of skbuffs in use by the hardware */
-		CVMX_SYNCIOBDMA;
-		skb_to_free = cvmx_scratch_read64(CVMX_SCR_SCRATCH);
-		buffers_to_free = cvmx_scratch_read64(CVMX_SCR_SCRATCH + 8);
-	} else {
-		/* Get the number of skbuffs in use by the hardware */
-		skb_to_free = cvmx_fau_fetch_and_add32(priv->fau + qos * 4,
-						       MAX_SKB_TO_FREE);
-		buffers_to_free =
-		    cvmx_fau_fetch_and_add32(FAU_NUM_PACKET_BUFFERS_TO_FREE, 0);
-	}
-
-	skb_to_free = cvm_oct_adjust_skb_to_free(skb_to_free,
-						 priv->fau + qos * 4);
-
-	/*
-	 * If we're sending faster than the receive can free them then
-	 * don't do the HW free.
-	 */
-	if ((buffers_to_free < -100) && !pko_command.s.dontfree)
-		pko_command.s.dontfree = 1;
-
-	if (pko_command.s.dontfree) {
-		queue_type = QUEUE_CORE;
-		pko_command.s.reg0 = priv->fau + qos * 4;
-	} else {
-		queue_type = QUEUE_HW;
-	}
-	if (USE_ASYNC_IOBDMA)
-		cvmx_fau_async_fetch_and_add32(CVMX_SCR_SCRATCH,
-					       FAU_TOTAL_TX_TO_CLEAN, 1);
-
-	spin_lock_irqsave(&priv->tx_free_list[qos].lock, flags);
-
-	/* Drop this packet if we have too many already queued to the HW */
-	if (unlikely(skb_queue_len(&priv->tx_free_list[qos]) >=
-		     MAX_OUT_QUEUE_DEPTH)) {
-		if (dev->tx_queue_len != 0) {
-			/* Drop the lock when notifying the core.  */
-			spin_unlock_irqrestore(&priv->tx_free_list[qos].lock,
-					       flags);
-			netif_stop_queue(dev);
-			spin_lock_irqsave(&priv->tx_free_list[qos].lock,
-					  flags);
-		} else {
-			/* If not using normal queueing.  */
-			queue_type = QUEUE_DROP;
-			goto skip_xmit;
-		}
-	}
-
-	cvmx_pko_send_packet_prepare(priv->port, priv->queue + qos,
-				     CVMX_PKO_LOCK_NONE);
-
-	/* Send the packet to the output queue */
-	if (unlikely(cvmx_pko_send_packet_finish(priv->port,
-						 priv->queue + qos,
-						 pko_command, hw_buffer,
-						 CVMX_PKO_LOCK_NONE))) {
-		printk_ratelimited("%s: Failed to send the packet\n",
-				   dev->name);
-		queue_type = QUEUE_DROP;
-	}
-skip_xmit:
-	to_free_list = NULL;
-
-	switch (queue_type) {
-	case QUEUE_DROP:
-		skb->next = to_free_list;
-		to_free_list = skb;
-		dev->stats.tx_dropped++;
-		break;
-	case QUEUE_HW:
-		cvmx_fau_atomic_add32(FAU_NUM_PACKET_BUFFERS_TO_FREE, -1);
-		break;
-	case QUEUE_CORE:
-		__skb_queue_tail(&priv->tx_free_list[qos], skb);
-		break;
-	default:
-		BUG();
-	}
-
-	while (skb_to_free > 0) {
-		struct sk_buff *t = __skb_dequeue(&priv->tx_free_list[qos]);
-
-		t->next = to_free_list;
-		to_free_list = t;
-		skb_to_free--;
-	}
-
-	spin_unlock_irqrestore(&priv->tx_free_list[qos].lock, flags);
-
-	/* Do the actual freeing outside of the lock. */
-	while (to_free_list) {
-		struct sk_buff *t = to_free_list;
-
-		to_free_list = to_free_list->next;
-		dev_kfree_skb_any(t);
-	}
-
-	if (USE_ASYNC_IOBDMA) {
-		CVMX_SYNCIOBDMA;
-		total_to_clean = cvmx_scratch_read64(CVMX_SCR_SCRATCH);
-		/* Restore the scratch area */
-		cvmx_scratch_write64(CVMX_SCR_SCRATCH, old_scratch);
-		cvmx_scratch_write64(CVMX_SCR_SCRATCH + 8, old_scratch2);
-	} else {
-		total_to_clean =
-			cvmx_fau_fetch_and_add32(FAU_TOTAL_TX_TO_CLEAN, 1);
-	}
-
-	if (total_to_clean & 0x3ff) {
-		/*
-		 * Schedule the cleanup tasklet every 1024 packets for
-		 * the pathological case of high traffic on one port
-		 * delaying clean up of packets on a different port
-		 * that is blocked waiting for the cleanup.
-		 */
-		tasklet_schedule(&cvm_oct_tx_cleanup_tasklet);
-	}
-
-	cvm_oct_kick_tx_poll_watchdog();
-
-	return NETDEV_TX_OK;
-}
-
-/**
- * cvm_oct_xmit_pow - transmit a packet to the POW
- * @skb:    Packet to send
- * @dev:    Device info structure
-
- * Returns Always returns zero
- */
-int cvm_oct_xmit_pow(struct sk_buff *skb, struct net_device *dev)
-{
-	struct octeon_ethernet *priv = netdev_priv(dev);
-	void *packet_buffer;
-	void *copy_location;
-
-	/* Get a work queue entry */
-	struct cvmx_wqe *work = cvmx_fpa_alloc(CVMX_FPA_WQE_POOL);
-
-	if (unlikely(!work)) {
-		printk_ratelimited("%s: Failed to allocate a work queue entry\n",
-				   dev->name);
-		dev->stats.tx_dropped++;
-		dev_kfree_skb_any(skb);
-		return 0;
-	}
-
-	/* Get a packet buffer */
-	packet_buffer = cvmx_fpa_alloc(CVMX_FPA_PACKET_POOL);
-	if (unlikely(!packet_buffer)) {
-		printk_ratelimited("%s: Failed to allocate a packet buffer\n",
-				   dev->name);
-		cvmx_fpa_free(work, CVMX_FPA_WQE_POOL, 1);
-		dev->stats.tx_dropped++;
-		dev_kfree_skb_any(skb);
-		return 0;
-	}
-
-	/*
-	 * Calculate where we need to copy the data to. We need to
-	 * leave 8 bytes for a next pointer (unused). We also need to
-	 * include any configure skip. Then we need to align the IP
-	 * packet src and dest into the same 64bit word. The below
-	 * calculation may add a little extra, but that doesn't
-	 * hurt.
-	 */
-	copy_location = packet_buffer + sizeof(u64);
-	copy_location += ((CVMX_HELPER_FIRST_MBUFF_SKIP + 7) & 0xfff8) + 6;
-
-	/*
-	 * We have to copy the packet since whoever processes this
-	 * packet will free it to a hardware pool. We can't use the
-	 * trick of counting outstanding packets like in
-	 * cvm_oct_xmit.
-	 */
-	memcpy(copy_location, skb->data, skb->len);
-
-	/*
-	 * Fill in some of the work queue fields. We may need to add
-	 * more if the software at the other end needs them.
-	 */
-	if (!OCTEON_IS_MODEL(OCTEON_CN68XX))
-		work->word0.pip.cn38xx.hw_chksum = skb->csum;
-	work->word1.len = skb->len;
-	cvmx_wqe_set_port(work, priv->port);
-	cvmx_wqe_set_qos(work, priv->port & 0x7);
-	cvmx_wqe_set_grp(work, pow_send_group);
-	work->word1.tag_type = CVMX_HELPER_INPUT_TAG_TYPE;
-	work->word1.tag = pow_send_group;	/* FIXME */
-	/* Default to zero. Sets of zero later are commented out */
-	work->word2.u64 = 0;
-	work->word2.s.bufs = 1;
-	work->packet_ptr.u64 = 0;
-	work->packet_ptr.s.addr = cvmx_ptr_to_phys(copy_location);
-	work->packet_ptr.s.pool = CVMX_FPA_PACKET_POOL;
-	work->packet_ptr.s.size = CVMX_FPA_PACKET_POOL_SIZE;
-	work->packet_ptr.s.back = (copy_location - packet_buffer) >> 7;
-
-	if (skb->protocol == htons(ETH_P_IP)) {
-		work->word2.s.ip_offset = 14;
-#if 0
-		work->word2.s.vlan_valid = 0;	/* FIXME */
-		work->word2.s.vlan_cfi = 0;	/* FIXME */
-		work->word2.s.vlan_id = 0;	/* FIXME */
-		work->word2.s.dec_ipcomp = 0;	/* FIXME */
-#endif
-		work->word2.s.tcp_or_udp =
-		    (ip_hdr(skb)->protocol == IPPROTO_TCP) ||
-		    (ip_hdr(skb)->protocol == IPPROTO_UDP);
-#if 0
-		/* FIXME */
-		work->word2.s.dec_ipsec = 0;
-		/* We only support IPv4 right now */
-		work->word2.s.is_v6 = 0;
-		/* Hardware would set to zero */
-		work->word2.s.software = 0;
-		/* No error, packet is internal */
-		work->word2.s.L4_error = 0;
-#endif
-		work->word2.s.is_frag = !((ip_hdr(skb)->frag_off == 0) ||
-					  (ip_hdr(skb)->frag_off ==
-					      cpu_to_be16(1 << 14)));
-#if 0
-		/* Assume Linux is sending a good packet */
-		work->word2.s.IP_exc = 0;
-#endif
-		work->word2.s.is_bcast = (skb->pkt_type == PACKET_BROADCAST);
-		work->word2.s.is_mcast = (skb->pkt_type == PACKET_MULTICAST);
-#if 0
-		/* This is an IP packet */
-		work->word2.s.not_IP = 0;
-		/* No error, packet is internal */
-		work->word2.s.rcv_error = 0;
-		/* No error, packet is internal */
-		work->word2.s.err_code = 0;
-#endif
-
-		/*
-		 * When copying the data, include 4 bytes of the
-		 * ethernet header to align the same way hardware
-		 * does.
-		 */
-		memcpy(work->packet_data, skb->data + 10,
-		       sizeof(work->packet_data));
-	} else {
-#if 0
-		work->word2.snoip.vlan_valid = 0;	/* FIXME */
-		work->word2.snoip.vlan_cfi = 0;	/* FIXME */
-		work->word2.snoip.vlan_id = 0;	/* FIXME */
-		work->word2.snoip.software = 0;	/* Hardware would set to zero */
-#endif
-		work->word2.snoip.is_rarp = skb->protocol == htons(ETH_P_RARP);
-		work->word2.snoip.is_arp = skb->protocol == htons(ETH_P_ARP);
-		work->word2.snoip.is_bcast =
-		    (skb->pkt_type == PACKET_BROADCAST);
-		work->word2.snoip.is_mcast =
-		    (skb->pkt_type == PACKET_MULTICAST);
-		work->word2.snoip.not_IP = 1;	/* IP was done up above */
-#if 0
-		/* No error, packet is internal */
-		work->word2.snoip.rcv_error = 0;
-		/* No error, packet is internal */
-		work->word2.snoip.err_code = 0;
-#endif
-		memcpy(work->packet_data, skb->data, sizeof(work->packet_data));
-	}
-
-	/* Submit the packet to the POW */
-	cvmx_pow_work_submit(work, work->word1.tag, work->word1.tag_type,
-			     cvmx_wqe_get_qos(work), cvmx_wqe_get_grp(work));
-	dev->stats.tx_packets++;
-	dev->stats.tx_bytes += skb->len;
-	dev_consume_skb_any(skb);
-	return 0;
-}
-
-/**
- * cvm_oct_tx_shutdown_dev - free all skb that are currently queued for TX.
- * @dev:    Device being shutdown
- *
- */
-void cvm_oct_tx_shutdown_dev(struct net_device *dev)
-{
-	struct octeon_ethernet *priv = netdev_priv(dev);
-	unsigned long flags;
-	int qos;
-
-	for (qos = 0; qos < 16; qos++) {
-		spin_lock_irqsave(&priv->tx_free_list[qos].lock, flags);
-		while (skb_queue_len(&priv->tx_free_list[qos]))
-			dev_kfree_skb_any(__skb_dequeue
-					  (&priv->tx_free_list[qos]));
-		spin_unlock_irqrestore(&priv->tx_free_list[qos].lock, flags);
-	}
-}
-
-static void cvm_oct_tx_do_cleanup(unsigned long arg)
-{
-	int port;
-
-	for (port = 0; port < TOTAL_NUMBER_OF_PORTS; port++) {
-		if (cvm_oct_device[port]) {
-			struct net_device *dev = cvm_oct_device[port];
-
-			cvm_oct_free_tx_skbs(dev);
-		}
-	}
-}
-
-static irqreturn_t cvm_oct_tx_cleanup_watchdog(int cpl, void *dev_id)
-{
-	/* Disable the interrupt.  */
-	cvmx_write_csr(CVMX_CIU_TIMX(1), 0);
-	/* Do the work in the tasklet.  */
-	tasklet_schedule(&cvm_oct_tx_cleanup_tasklet);
-	return IRQ_HANDLED;
-}
-
-void cvm_oct_tx_initialize(void)
-{
-	int i;
-
-	/* Disable the interrupt.  */
-	cvmx_write_csr(CVMX_CIU_TIMX(1), 0);
-	/* Register an IRQ handler to receive CIU_TIMX(1) interrupts */
-	i = request_irq(OCTEON_IRQ_TIMER1,
-			cvm_oct_tx_cleanup_watchdog, 0,
-			"Ethernet", cvm_oct_device);
-
-	if (i)
-		panic("Could not acquire Ethernet IRQ %d\n", OCTEON_IRQ_TIMER1);
-}
-
-void cvm_oct_tx_shutdown(void)
-{
-	/* Free the interrupt handler */
-	free_irq(OCTEON_IRQ_TIMER1, cvm_oct_device);
-}
diff --git a/drivers/staging/octeon/ethernet-tx.h b/drivers/staging/octeon/ethernet-tx.h
deleted file mode 100644
index 78936e9b33b0..000000000000
--- a/drivers/staging/octeon/ethernet-tx.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * This file is based on code from OCTEON SDK by Cavium Networks.
- *
- * Copyright (c) 2003-2007 Cavium Networks
- */
-
-int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev);
-int cvm_oct_xmit_pow(struct sk_buff *skb, struct net_device *dev);
-int cvm_oct_transmit_qos(struct net_device *dev, void *work_queue_entry,
-			 int do_free, int qos);
-void cvm_oct_tx_initialize(void);
-void cvm_oct_tx_shutdown(void);
-void cvm_oct_tx_shutdown_dev(struct net_device *dev);
diff --git a/drivers/staging/octeon/ethernet-util.h b/drivers/staging/octeon/ethernet-util.h
deleted file mode 100644
index 2af83a12ca78..000000000000
--- a/drivers/staging/octeon/ethernet-util.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * This file is based on code from OCTEON SDK by Cavium Networks.
- *
- * Copyright (c) 2003-2007 Cavium Networks
- */
-
-/**
- * cvm_oct_get_buffer_ptr - convert packet data address to pointer
- * @packet_ptr: Packet data hardware address
- *
- * Returns Packet buffer pointer
- */
-static inline void *cvm_oct_get_buffer_ptr(union cvmx_buf_ptr packet_ptr)
-{
-	return cvmx_phys_to_ptr(((packet_ptr.s.addr >> 7) - packet_ptr.s.back)
-				<< 7);
-}
-
-/**
- * INTERFACE - convert IPD port to logical interface
- * @ipd_port: Port to check
- *
- * Returns Logical interface
- */
-static inline int INTERFACE(int ipd_port)
-{
-	int interface;
-
-	if (ipd_port == CVMX_PIP_NUM_INPUT_PORTS)
-		return 10;
-	interface = cvmx_helper_get_interface_num(ipd_port);
-	if (interface >= 0)
-		return interface;
-	panic("Illegal ipd_port %d passed to %s\n", ipd_port, __func__);
-}
-
-/**
- * INDEX - convert IPD/PKO port number to the port's interface index
- * @ipd_port: Port to check
- *
- * Returns Index into interface port list
- */
-static inline int INDEX(int ipd_port)
-{
-	return cvmx_helper_get_interface_index_num(ipd_port);
-}
diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c
deleted file mode 100644
index f42c3816ce49..000000000000
--- a/drivers/staging/octeon/ethernet.c
+++ /dev/null
@@ -1,992 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * This file is based on code from OCTEON SDK by Cavium Networks.
- *
- * Copyright (c) 2003-2007 Cavium Networks
- */
-
-#include <linux/platform_device.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-#include <linux/phy.h>
-#include <linux/slab.h>
-#include <linux/interrupt.h>
-#include <linux/of_net.h>
-#include <linux/if_ether.h>
-#include <linux/if_vlan.h>
-
-#include <net/dst.h>
-
-#include "octeon-ethernet.h"
-#include "ethernet-defines.h"
-#include "ethernet-mem.h"
-#include "ethernet-rx.h"
-#include "ethernet-tx.h"
-#include "ethernet-mdio.h"
-#include "ethernet-util.h"
-
-#define OCTEON_MAX_MTU 65392
-
-static int num_packet_buffers = 1024;
-module_param(num_packet_buffers, int, 0444);
-MODULE_PARM_DESC(num_packet_buffers, "\n"
-	"\tNumber of packet buffers to allocate and store in the\n"
-	"\tFPA. By default, 1024 packet buffers are used.\n");
-
-static int pow_receive_group = 15;
-module_param(pow_receive_group, int, 0444);
-MODULE_PARM_DESC(pow_receive_group, "\n"
-	"\tPOW group to receive packets from. All ethernet hardware\n"
-	"\twill be configured to send incoming packets to this POW\n"
-	"\tgroup. Also any other software can submit packets to this\n"
-	"\tgroup for the kernel to process.");
-
-static int receive_group_order;
-module_param(receive_group_order, int, 0444);
-MODULE_PARM_DESC(receive_group_order, "\n"
-	"\tOrder (0..4) of receive groups to take into use. Ethernet hardware\n"
-	"\twill be configured to send incoming packets to multiple POW\n"
-	"\tgroups. pow_receive_group parameter is ignored when multiple\n"
-	"\tgroups are taken into use and groups are allocated starting\n"
-	"\tfrom 0. By default, a single group is used.\n");
-
-int pow_send_group = -1;
-module_param(pow_send_group, int, 0644);
-MODULE_PARM_DESC(pow_send_group, "\n"
-	"\tPOW group to send packets to other software on. This\n"
-	"\tcontrols the creation of the virtual device pow0.\n"
-	"\talways_use_pow also depends on this value.");
-
-int always_use_pow;
-module_param(always_use_pow, int, 0444);
-MODULE_PARM_DESC(always_use_pow, "\n"
-	"\tWhen set, always send to the pow group. This will cause\n"
-	"\tpackets sent to real ethernet devices to be sent to the\n"
-	"\tPOW group instead of the hardware. Unless some other\n"
-	"\tapplication changes the config, packets will still be\n"
-	"\treceived from the low level hardware. Use this option\n"
-	"\tto allow a CVMX app to intercept all packets from the\n"
-	"\tlinux kernel. You must specify pow_send_group along with\n"
-	"\tthis option.");
-
-char pow_send_list[128] = "";
-module_param_string(pow_send_list, pow_send_list, sizeof(pow_send_list), 0444);
-MODULE_PARM_DESC(pow_send_list, "\n"
-	"\tComma separated list of ethernet devices that should use the\n"
-	"\tPOW for transmit instead of the actual ethernet hardware. This\n"
-	"\tis a per port version of always_use_pow. always_use_pow takes\n"
-	"\tprecedence over this list. For example, setting this to\n"
-	"\t\"eth2,spi3,spi7\" would cause these three devices to transmit\n"
-	"\tusing the pow_send_group.");
-
-int rx_napi_weight = 32;
-module_param(rx_napi_weight, int, 0444);
-MODULE_PARM_DESC(rx_napi_weight, "The NAPI WEIGHT parameter.");
-
-/* Mask indicating which receive groups are in use. */
-int pow_receive_groups;
-
-/*
- * cvm_oct_poll_queue_stopping - flag to indicate polling should stop.
- *
- * Set to one right before cvm_oct_poll_queue is destroyed.
- */
-atomic_t cvm_oct_poll_queue_stopping = ATOMIC_INIT(0);
-
-/*
- * Array of every ethernet device owned by this driver indexed by
- * the ipd input port number.
- */
-struct net_device *cvm_oct_device[TOTAL_NUMBER_OF_PORTS];
-
-u64 cvm_oct_tx_poll_interval;
-
-static void cvm_oct_rx_refill_worker(struct work_struct *work);
-static DECLARE_DELAYED_WORK(cvm_oct_rx_refill_work, cvm_oct_rx_refill_worker);
-
-static void cvm_oct_rx_refill_worker(struct work_struct *work)
-{
-	/*
-	 * FPA 0 may have been drained, try to refill it if we need
-	 * more than num_packet_buffers / 2, otherwise normal receive
-	 * processing will refill it.  If it were drained, no packets
-	 * could be received so cvm_oct_napi_poll would never be
-	 * invoked to do the refill.
-	 */
-	cvm_oct_rx_refill_pool(num_packet_buffers / 2);
-
-	if (!atomic_read(&cvm_oct_poll_queue_stopping))
-		schedule_delayed_work(&cvm_oct_rx_refill_work, HZ);
-}
-
-static void cvm_oct_periodic_worker(struct work_struct *work)
-{
-	struct octeon_ethernet *priv = container_of(work,
-						    struct octeon_ethernet,
-						    port_periodic_work.work);
-
-	if (priv->poll)
-		priv->poll(cvm_oct_device[priv->port]);
-
-	cvm_oct_device[priv->port]->netdev_ops->ndo_get_stats
-						(cvm_oct_device[priv->port]);
-
-	if (!atomic_read(&cvm_oct_poll_queue_stopping))
-		schedule_delayed_work(&priv->port_periodic_work, HZ);
-}
-
-static void cvm_oct_configure_common_hw(void)
-{
-	/* Setup the FPA */
-	cvmx_fpa_enable();
-	cvm_oct_mem_fill_fpa(CVMX_FPA_PACKET_POOL, CVMX_FPA_PACKET_POOL_SIZE,
-			     num_packet_buffers);
-	cvm_oct_mem_fill_fpa(CVMX_FPA_WQE_POOL, CVMX_FPA_WQE_POOL_SIZE,
-			     num_packet_buffers);
-	if (CVMX_FPA_OUTPUT_BUFFER_POOL != CVMX_FPA_PACKET_POOL)
-		cvm_oct_mem_fill_fpa(CVMX_FPA_OUTPUT_BUFFER_POOL,
-				     CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE, 1024);
-
-#ifdef __LITTLE_ENDIAN
-	{
-		union cvmx_ipd_ctl_status ipd_ctl_status;
-
-		ipd_ctl_status.u64 = cvmx_read_csr(CVMX_IPD_CTL_STATUS);
-		ipd_ctl_status.s.pkt_lend = 1;
-		ipd_ctl_status.s.wqe_lend = 1;
-		cvmx_write_csr(CVMX_IPD_CTL_STATUS, ipd_ctl_status.u64);
-	}
-#endif
-
-	cvmx_helper_setup_red(num_packet_buffers / 4, num_packet_buffers / 8);
-}
-
-/**
- * cvm_oct_free_work- Free a work queue entry
- *
- * @work_queue_entry: Work queue entry to free
- *
- * Returns Zero on success, Negative on failure.
- */
-int cvm_oct_free_work(void *work_queue_entry)
-{
-	struct cvmx_wqe *work = work_queue_entry;
-
-	int segments = work->word2.s.bufs;
-	union cvmx_buf_ptr segment_ptr = work->packet_ptr;
-
-	while (segments--) {
-		union cvmx_buf_ptr next_ptr = *(union cvmx_buf_ptr *)
-			cvmx_phys_to_ptr(segment_ptr.s.addr - 8);
-		if (unlikely(!segment_ptr.s.i))
-			cvmx_fpa_free(cvm_oct_get_buffer_ptr(segment_ptr),
-				      segment_ptr.s.pool,
-				      CVMX_FPA_PACKET_POOL_SIZE / 128);
-		segment_ptr = next_ptr;
-	}
-	cvmx_fpa_free(work, CVMX_FPA_WQE_POOL, 1);
-
-	return 0;
-}
-EXPORT_SYMBOL(cvm_oct_free_work);
-
-/**
- * cvm_oct_common_get_stats - get the low level ethernet statistics
- * @dev:    Device to get the statistics from
- *
- * Returns Pointer to the statistics
- */
-static struct net_device_stats *cvm_oct_common_get_stats(struct net_device *dev)
-{
-	cvmx_pip_port_status_t rx_status;
-	cvmx_pko_port_status_t tx_status;
-	struct octeon_ethernet *priv = netdev_priv(dev);
-
-	if (priv->port < CVMX_PIP_NUM_INPUT_PORTS) {
-		if (octeon_is_simulation()) {
-			/* The simulator doesn't support statistics */
-			memset(&rx_status, 0, sizeof(rx_status));
-			memset(&tx_status, 0, sizeof(tx_status));
-		} else {
-			cvmx_pip_get_port_status(priv->port, 1, &rx_status);
-			cvmx_pko_get_port_status(priv->port, 1, &tx_status);
-		}
-
-		dev->stats.rx_packets += rx_status.inb_packets;
-		dev->stats.tx_packets += tx_status.packets;
-		dev->stats.rx_bytes += rx_status.inb_octets;
-		dev->stats.tx_bytes += tx_status.octets;
-		dev->stats.multicast += rx_status.multicast_packets;
-		dev->stats.rx_crc_errors += rx_status.inb_errors;
-		dev->stats.rx_frame_errors += rx_status.fcs_align_err_packets;
-		dev->stats.rx_dropped += rx_status.dropped_packets;
-	}
-
-	return &dev->stats;
-}
-
-/**
- * cvm_oct_common_change_mtu - change the link MTU
- * @dev:     Device to change
- * @new_mtu: The new MTU
- *
- * Returns Zero on success
- */
-static int cvm_oct_common_change_mtu(struct net_device *dev, int new_mtu)
-{
-	struct octeon_ethernet *priv = netdev_priv(dev);
-	int interface = INTERFACE(priv->port);
-#if IS_ENABLED(CONFIG_VLAN_8021Q)
-	int vlan_bytes = VLAN_HLEN;
-#else
-	int vlan_bytes = 0;
-#endif
-	int mtu_overhead = ETH_HLEN + ETH_FCS_LEN + vlan_bytes;
-
-	dev->mtu = new_mtu;
-
-	if ((interface < 2) &&
-	    (cvmx_helper_interface_get_mode(interface) !=
-		CVMX_HELPER_INTERFACE_MODE_SPI)) {
-		int index = INDEX(priv->port);
-		/* Add ethernet header and FCS, and VLAN if configured. */
-		int max_packet = new_mtu + mtu_overhead;
-
-		if (OCTEON_IS_MODEL(OCTEON_CN3XXX) ||
-		    OCTEON_IS_MODEL(OCTEON_CN58XX)) {
-			/* Signal errors on packets larger than the MTU */
-			cvmx_write_csr(CVMX_GMXX_RXX_FRM_MAX(index, interface),
-				       max_packet);
-		} else {
-			/*
-			 * Set the hardware to truncate packets larger
-			 * than the MTU and smaller the 64 bytes.
-			 */
-			union cvmx_pip_frm_len_chkx frm_len_chk;
-
-			frm_len_chk.u64 = 0;
-			frm_len_chk.s.minlen = VLAN_ETH_ZLEN;
-			frm_len_chk.s.maxlen = max_packet;
-			cvmx_write_csr(CVMX_PIP_FRM_LEN_CHKX(interface),
-				       frm_len_chk.u64);
-		}
-		/*
-		 * Set the hardware to truncate packets larger than
-		 * the MTU. The jabber register must be set to a
-		 * multiple of 8 bytes, so round up.
-		 */
-		cvmx_write_csr(CVMX_GMXX_RXX_JABBER(index, interface),
-			       (max_packet + 7) & ~7u);
-	}
-	return 0;
-}
-
-/**
- * cvm_oct_common_set_multicast_list - set the multicast list
- * @dev:    Device to work on
- */
-static void cvm_oct_common_set_multicast_list(struct net_device *dev)
-{
-	union cvmx_gmxx_prtx_cfg gmx_cfg;
-	struct octeon_ethernet *priv = netdev_priv(dev);
-	int interface = INTERFACE(priv->port);
-
-	if ((interface < 2) &&
-	    (cvmx_helper_interface_get_mode(interface) !=
-		CVMX_HELPER_INTERFACE_MODE_SPI)) {
-		union cvmx_gmxx_rxx_adr_ctl control;
-		int index = INDEX(priv->port);
-
-		control.u64 = 0;
-		control.s.bcst = 1;	/* Allow broadcast MAC addresses */
-
-		if (!netdev_mc_empty(dev) || (dev->flags & IFF_ALLMULTI) ||
-		    (dev->flags & IFF_PROMISC))
-			/* Force accept multicast packets */
-			control.s.mcst = 2;
-		else
-			/* Force reject multicast packets */
-			control.s.mcst = 1;
-
-		if (dev->flags & IFF_PROMISC)
-			/*
-			 * Reject matches if promisc. Since CAM is
-			 * shut off, should accept everything.
-			 */
-			control.s.cam_mode = 0;
-		else
-			/* Filter packets based on the CAM */
-			control.s.cam_mode = 1;
-
-		gmx_cfg.u64 =
-		    cvmx_read_csr(CVMX_GMXX_PRTX_CFG(index, interface));
-		cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface),
-			       gmx_cfg.u64 & ~1ull);
-
-		cvmx_write_csr(CVMX_GMXX_RXX_ADR_CTL(index, interface),
-			       control.u64);
-		if (dev->flags & IFF_PROMISC)
-			cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM_EN
-				       (index, interface), 0);
-		else
-			cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM_EN
-				       (index, interface), 1);
-
-		cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface),
-			       gmx_cfg.u64);
-	}
-}
-
-static int cvm_oct_set_mac_filter(struct net_device *dev)
-{
-	struct octeon_ethernet *priv = netdev_priv(dev);
-	union cvmx_gmxx_prtx_cfg gmx_cfg;
-	int interface = INTERFACE(priv->port);
-
-	if ((interface < 2) &&
-	    (cvmx_helper_interface_get_mode(interface) !=
-		CVMX_HELPER_INTERFACE_MODE_SPI)) {
-		int i;
-		u8 *ptr = dev->dev_addr;
-		u64 mac = 0;
-		int index = INDEX(priv->port);
-
-		for (i = 0; i < 6; i++)
-			mac = (mac << 8) | (u64)ptr[i];
-
-		gmx_cfg.u64 =
-		    cvmx_read_csr(CVMX_GMXX_PRTX_CFG(index, interface));
-		cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface),
-			       gmx_cfg.u64 & ~1ull);
-
-		cvmx_write_csr(CVMX_GMXX_SMACX(index, interface), mac);
-		cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM0(index, interface),
-			       ptr[0]);
-		cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM1(index, interface),
-			       ptr[1]);
-		cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM2(index, interface),
-			       ptr[2]);
-		cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM3(index, interface),
-			       ptr[3]);
-		cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM4(index, interface),
-			       ptr[4]);
-		cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM5(index, interface),
-			       ptr[5]);
-		cvm_oct_common_set_multicast_list(dev);
-		cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface),
-			       gmx_cfg.u64);
-	}
-	return 0;
-}
-
-/**
- * cvm_oct_common_set_mac_address - set the hardware MAC address for a device
- * @dev:    The device in question.
- * @addr:   Socket address.
- *
- * Returns Zero on success
- */
-static int cvm_oct_common_set_mac_address(struct net_device *dev, void *addr)
-{
-	int r = eth_mac_addr(dev, addr);
-
-	if (r)
-		return r;
-	return cvm_oct_set_mac_filter(dev);
-}
-
-/**
- * cvm_oct_common_init - per network device initialization
- * @dev:    Device to initialize
- *
- * Returns Zero on success
- */
-int cvm_oct_common_init(struct net_device *dev)
-{
-	struct octeon_ethernet *priv = netdev_priv(dev);
-	const u8 *mac = NULL;
-
-	if (priv->of_node)
-		mac = of_get_mac_address(priv->of_node);
-
-	if (!IS_ERR_OR_NULL(mac))
-		ether_addr_copy(dev->dev_addr, mac);
-	else
-		eth_hw_addr_random(dev);
-
-	/*
-	 * Force the interface to use the POW send if always_use_pow
-	 * was specified or it is in the pow send list.
-	 */
-	if ((pow_send_group != -1) &&
-	    (always_use_pow || strstr(pow_send_list, dev->name)))
-		priv->queue = -1;
-
-	if (priv->queue != -1)
-		dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM;
-
-	/* We do our own locking, Linux doesn't need to */
-	dev->features |= NETIF_F_LLTX;
-	dev->ethtool_ops = &cvm_oct_ethtool_ops;
-
-	cvm_oct_set_mac_filter(dev);
-	dev_set_mtu(dev, dev->mtu);
-
-	/*
-	 * Zero out stats for port so we won't mistakenly show
-	 * counters from the bootloader.
-	 */
-	memset(dev->netdev_ops->ndo_get_stats(dev), 0,
-	       sizeof(struct net_device_stats));
-
-	if (dev->netdev_ops->ndo_stop)
-		dev->netdev_ops->ndo_stop(dev);
-
-	return 0;
-}
-
-void cvm_oct_common_uninit(struct net_device *dev)
-{
-	if (dev->phydev)
-		phy_disconnect(dev->phydev);
-}
-
-int cvm_oct_common_open(struct net_device *dev,
-			void (*link_poll)(struct net_device *))
-{
-	union cvmx_gmxx_prtx_cfg gmx_cfg;
-	struct octeon_ethernet *priv = netdev_priv(dev);
-	int interface = INTERFACE(priv->port);
-	int index = INDEX(priv->port);
-	union cvmx_helper_link_info link_info;
-	int rv;
-
-	rv = cvm_oct_phy_setup_device(dev);
-	if (rv)
-		return rv;
-
-	gmx_cfg.u64 = cvmx_read_csr(CVMX_GMXX_PRTX_CFG(index, interface));
-	gmx_cfg.s.en = 1;
-	if (octeon_has_feature(OCTEON_FEATURE_PKND))
-		gmx_cfg.s.pknd = priv->port;
-	cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface), gmx_cfg.u64);
-
-	if (octeon_is_simulation())
-		return 0;
-
-	if (dev->phydev) {
-		int r = phy_read_status(dev->phydev);
-
-		if (r == 0 && dev->phydev->link == 0)
-			netif_carrier_off(dev);
-		cvm_oct_adjust_link(dev);
-	} else {
-		link_info = cvmx_helper_link_get(priv->port);
-		if (!link_info.s.link_up)
-			netif_carrier_off(dev);
-		priv->poll = link_poll;
-		link_poll(dev);
-	}
-
-	return 0;
-}
-
-void cvm_oct_link_poll(struct net_device *dev)
-{
-	struct octeon_ethernet *priv = netdev_priv(dev);
-	union cvmx_helper_link_info link_info;
-
-	link_info = cvmx_helper_link_get(priv->port);
-	if (link_info.u64 == priv->link_info)
-		return;
-
-	if (cvmx_helper_link_set(priv->port, link_info))
-		link_info.u64 = priv->link_info;
-	else
-		priv->link_info = link_info.u64;
-
-	if (link_info.s.link_up) {
-		if (!netif_carrier_ok(dev))
-			netif_carrier_on(dev);
-	} else if (netif_carrier_ok(dev)) {
-		netif_carrier_off(dev);
-	}
-	cvm_oct_note_carrier(priv, link_info);
-}
-
-static int cvm_oct_xaui_open(struct net_device *dev)
-{
-	return cvm_oct_common_open(dev, cvm_oct_link_poll);
-}
-
-static const struct net_device_ops cvm_oct_npi_netdev_ops = {
-	.ndo_init		= cvm_oct_common_init,
-	.ndo_uninit		= cvm_oct_common_uninit,
-	.ndo_start_xmit		= cvm_oct_xmit,
-	.ndo_set_rx_mode	= cvm_oct_common_set_multicast_list,
-	.ndo_set_mac_address	= cvm_oct_common_set_mac_address,
-	.ndo_do_ioctl		= cvm_oct_ioctl,
-	.ndo_change_mtu		= cvm_oct_common_change_mtu,
-	.ndo_get_stats		= cvm_oct_common_get_stats,
-#ifdef CONFIG_NET_POLL_CONTROLLER
-	.ndo_poll_controller	= cvm_oct_poll_controller,
-#endif
-};
-
-static const struct net_device_ops cvm_oct_xaui_netdev_ops = {
-	.ndo_init		= cvm_oct_common_init,
-	.ndo_uninit		= cvm_oct_common_uninit,
-	.ndo_open		= cvm_oct_xaui_open,
-	.ndo_stop		= cvm_oct_common_stop,
-	.ndo_start_xmit		= cvm_oct_xmit,
-	.ndo_set_rx_mode	= cvm_oct_common_set_multicast_list,
-	.ndo_set_mac_address	= cvm_oct_common_set_mac_address,
-	.ndo_do_ioctl		= cvm_oct_ioctl,
-	.ndo_change_mtu		= cvm_oct_common_change_mtu,
-	.ndo_get_stats		= cvm_oct_common_get_stats,
-#ifdef CONFIG_NET_POLL_CONTROLLER
-	.ndo_poll_controller	= cvm_oct_poll_controller,
-#endif
-};
-
-static const struct net_device_ops cvm_oct_sgmii_netdev_ops = {
-	.ndo_init		= cvm_oct_sgmii_init,
-	.ndo_uninit		= cvm_oct_common_uninit,
-	.ndo_open		= cvm_oct_sgmii_open,
-	.ndo_stop		= cvm_oct_common_stop,
-	.ndo_start_xmit		= cvm_oct_xmit,
-	.ndo_set_rx_mode	= cvm_oct_common_set_multicast_list,
-	.ndo_set_mac_address	= cvm_oct_common_set_mac_address,
-	.ndo_do_ioctl		= cvm_oct_ioctl,
-	.ndo_change_mtu		= cvm_oct_common_change_mtu,
-	.ndo_get_stats		= cvm_oct_common_get_stats,
-#ifdef CONFIG_NET_POLL_CONTROLLER
-	.ndo_poll_controller	= cvm_oct_poll_controller,
-#endif
-};
-
-static const struct net_device_ops cvm_oct_spi_netdev_ops = {
-	.ndo_init		= cvm_oct_spi_init,
-	.ndo_uninit		= cvm_oct_spi_uninit,
-	.ndo_start_xmit		= cvm_oct_xmit,
-	.ndo_set_rx_mode	= cvm_oct_common_set_multicast_list,
-	.ndo_set_mac_address	= cvm_oct_common_set_mac_address,
-	.ndo_do_ioctl		= cvm_oct_ioctl,
-	.ndo_change_mtu		= cvm_oct_common_change_mtu,
-	.ndo_get_stats		= cvm_oct_common_get_stats,
-#ifdef CONFIG_NET_POLL_CONTROLLER
-	.ndo_poll_controller	= cvm_oct_poll_controller,
-#endif
-};
-
-static const struct net_device_ops cvm_oct_rgmii_netdev_ops = {
-	.ndo_init		= cvm_oct_common_init,
-	.ndo_uninit		= cvm_oct_common_uninit,
-	.ndo_open		= cvm_oct_rgmii_open,
-	.ndo_stop		= cvm_oct_common_stop,
-	.ndo_start_xmit		= cvm_oct_xmit,
-	.ndo_set_rx_mode	= cvm_oct_common_set_multicast_list,
-	.ndo_set_mac_address	= cvm_oct_common_set_mac_address,
-	.ndo_do_ioctl		= cvm_oct_ioctl,
-	.ndo_change_mtu		= cvm_oct_common_change_mtu,
-	.ndo_get_stats		= cvm_oct_common_get_stats,
-#ifdef CONFIG_NET_POLL_CONTROLLER
-	.ndo_poll_controller	= cvm_oct_poll_controller,
-#endif
-};
-
-static const struct net_device_ops cvm_oct_pow_netdev_ops = {
-	.ndo_init		= cvm_oct_common_init,
-	.ndo_start_xmit		= cvm_oct_xmit_pow,
-	.ndo_set_rx_mode	= cvm_oct_common_set_multicast_list,
-	.ndo_set_mac_address	= cvm_oct_common_set_mac_address,
-	.ndo_do_ioctl		= cvm_oct_ioctl,
-	.ndo_change_mtu		= cvm_oct_common_change_mtu,
-	.ndo_get_stats		= cvm_oct_common_get_stats,
-#ifdef CONFIG_NET_POLL_CONTROLLER
-	.ndo_poll_controller	= cvm_oct_poll_controller,
-#endif
-};
-
-static struct device_node *cvm_oct_of_get_child
-				(const struct device_node *parent, int reg_val)
-{
-	struct device_node *node = NULL;
-	int size;
-	const __be32 *addr;
-
-	for (;;) {
-		node = of_get_next_child(parent, node);
-		if (!node)
-			break;
-		addr = of_get_property(node, "reg", &size);
-		if (addr && (be32_to_cpu(*addr) == reg_val))
-			break;
-	}
-	return node;
-}
-
-static struct device_node *cvm_oct_node_for_port(struct device_node *pip,
-						 int interface, int port)
-{
-	struct device_node *ni, *np;
-
-	ni = cvm_oct_of_get_child(pip, interface);
-	if (!ni)
-		return NULL;
-
-	np = cvm_oct_of_get_child(ni, port);
-	of_node_put(ni);
-
-	return np;
-}
-
-static void cvm_set_rgmii_delay(struct octeon_ethernet *priv, int iface,
-				int port)
-{
-	struct device_node *np = priv->of_node;
-	u32 delay_value;
-	bool rx_delay;
-	bool tx_delay;
-
-	/* By default, both RX/TX delay is enabled in
-	 * __cvmx_helper_rgmii_enable().
-	 */
-	rx_delay = true;
-	tx_delay = true;
-
-	if (!of_property_read_u32(np, "rx-delay", &delay_value)) {
-		cvmx_write_csr(CVMX_ASXX_RX_CLK_SETX(port, iface), delay_value);
-		rx_delay = delay_value > 0;
-	}
-	if (!of_property_read_u32(np, "tx-delay", &delay_value)) {
-		cvmx_write_csr(CVMX_ASXX_TX_CLK_SETX(port, iface), delay_value);
-		tx_delay = delay_value > 0;
-	}
-
-	if (!rx_delay && !tx_delay)
-		priv->phy_mode = PHY_INTERFACE_MODE_RGMII_ID;
-	else if (!rx_delay)
-		priv->phy_mode = PHY_INTERFACE_MODE_RGMII_RXID;
-	else if (!tx_delay)
-		priv->phy_mode = PHY_INTERFACE_MODE_RGMII_TXID;
-	else
-		priv->phy_mode = PHY_INTERFACE_MODE_RGMII;
-}
-
-static int cvm_oct_probe(struct platform_device *pdev)
-{
-	int num_interfaces;
-	int interface;
-	int fau = FAU_NUM_PACKET_BUFFERS_TO_FREE;
-	int qos;
-	struct device_node *pip;
-	int mtu_overhead = ETH_HLEN + ETH_FCS_LEN;
-
-#if IS_ENABLED(CONFIG_VLAN_8021Q)
-	mtu_overhead += VLAN_HLEN;
-#endif
-
-	octeon_mdiobus_force_mod_depencency();
-
-	pip = pdev->dev.of_node;
-	if (!pip) {
-		pr_err("Error: No 'pip' in /aliases\n");
-		return -EINVAL;
-	}
-
-	cvm_oct_configure_common_hw();
-
-	cvmx_helper_initialize_packet_io_global();
-
-	if (receive_group_order) {
-		if (receive_group_order > 4)
-			receive_group_order = 4;
-		pow_receive_groups = (1 << (1 << receive_group_order)) - 1;
-	} else {
-		pow_receive_groups = BIT(pow_receive_group);
-	}
-
-	/* Change the input group for all ports before input is enabled */
-	num_interfaces = cvmx_helper_get_number_of_interfaces();
-	for (interface = 0; interface < num_interfaces; interface++) {
-		int num_ports = cvmx_helper_ports_on_interface(interface);
-		int port;
-
-		for (port = cvmx_helper_get_ipd_port(interface, 0);
-		     port < cvmx_helper_get_ipd_port(interface, num_ports);
-		     port++) {
-			union cvmx_pip_prt_tagx pip_prt_tagx;
-
-			pip_prt_tagx.u64 =
-			    cvmx_read_csr(CVMX_PIP_PRT_TAGX(port));
-
-			if (receive_group_order) {
-				int tag_mask;
-
-				/* We support only 16 groups at the moment, so
-				 * always disable the two additional "hidden"
-				 * tag_mask bits on CN68XX.
-				 */
-				if (OCTEON_IS_MODEL(OCTEON_CN68XX))
-					pip_prt_tagx.u64 |= 0x3ull << 44;
-
-				tag_mask = ~((1 << receive_group_order) - 1);
-				pip_prt_tagx.s.grptagbase	= 0;
-				pip_prt_tagx.s.grptagmask	= tag_mask;
-				pip_prt_tagx.s.grptag		= 1;
-				pip_prt_tagx.s.tag_mode		= 0;
-				pip_prt_tagx.s.inc_prt_flag	= 1;
-				pip_prt_tagx.s.ip6_dprt_flag	= 1;
-				pip_prt_tagx.s.ip4_dprt_flag	= 1;
-				pip_prt_tagx.s.ip6_sprt_flag	= 1;
-				pip_prt_tagx.s.ip4_sprt_flag	= 1;
-				pip_prt_tagx.s.ip6_dst_flag	= 1;
-				pip_prt_tagx.s.ip4_dst_flag	= 1;
-				pip_prt_tagx.s.ip6_src_flag	= 1;
-				pip_prt_tagx.s.ip4_src_flag	= 1;
-				pip_prt_tagx.s.grp		= 0;
-			} else {
-				pip_prt_tagx.s.grptag	= 0;
-				pip_prt_tagx.s.grp	= pow_receive_group;
-			}
-
-			cvmx_write_csr(CVMX_PIP_PRT_TAGX(port),
-				       pip_prt_tagx.u64);
-		}
-	}
-
-	cvmx_helper_ipd_and_packet_input_enable();
-
-	memset(cvm_oct_device, 0, sizeof(cvm_oct_device));
-
-	/*
-	 * Initialize the FAU used for counting packet buffers that
-	 * need to be freed.
-	 */
-	cvmx_fau_atomic_write32(FAU_NUM_PACKET_BUFFERS_TO_FREE, 0);
-
-	/* Initialize the FAU used for counting tx SKBs that need to be freed */
-	cvmx_fau_atomic_write32(FAU_TOTAL_TX_TO_CLEAN, 0);
-
-	if ((pow_send_group != -1)) {
-		struct net_device *dev;
-
-		dev = alloc_etherdev(sizeof(struct octeon_ethernet));
-		if (dev) {
-			/* Initialize the device private structure. */
-			struct octeon_ethernet *priv = netdev_priv(dev);
-
-			SET_NETDEV_DEV(dev, &pdev->dev);
-			dev->netdev_ops = &cvm_oct_pow_netdev_ops;
-			priv->imode = CVMX_HELPER_INTERFACE_MODE_DISABLED;
-			priv->port = CVMX_PIP_NUM_INPUT_PORTS;
-			priv->queue = -1;
-			strscpy(dev->name, "pow%d", sizeof(dev->name));
-			for (qos = 0; qos < 16; qos++)
-				skb_queue_head_init(&priv->tx_free_list[qos]);
-			dev->min_mtu = VLAN_ETH_ZLEN - mtu_overhead;
-			dev->max_mtu = OCTEON_MAX_MTU - mtu_overhead;
-
-			if (register_netdev(dev) < 0) {
-				pr_err("Failed to register ethernet device for POW\n");
-				free_netdev(dev);
-			} else {
-				cvm_oct_device[CVMX_PIP_NUM_INPUT_PORTS] = dev;
-				pr_info("%s: POW send group %d, receive group %d\n",
-					dev->name, pow_send_group,
-					pow_receive_group);
-			}
-		} else {
-			pr_err("Failed to allocate ethernet device for POW\n");
-		}
-	}
-
-	num_interfaces = cvmx_helper_get_number_of_interfaces();
-	for (interface = 0; interface < num_interfaces; interface++) {
-		cvmx_helper_interface_mode_t imode =
-		    cvmx_helper_interface_get_mode(interface);
-		int num_ports = cvmx_helper_ports_on_interface(interface);
-		int port;
-		int port_index;
-
-		for (port_index = 0,
-		     port = cvmx_helper_get_ipd_port(interface, 0);
-		     port < cvmx_helper_get_ipd_port(interface, num_ports);
-		     port_index++, port++) {
-			struct octeon_ethernet *priv;
-			struct net_device *dev =
-			    alloc_etherdev(sizeof(struct octeon_ethernet));
-			if (!dev) {
-				pr_err("Failed to allocate ethernet device for port %d\n",
-				       port);
-				continue;
-			}
-
-			/* Initialize the device private structure. */
-			SET_NETDEV_DEV(dev, &pdev->dev);
-			priv = netdev_priv(dev);
-			priv->netdev = dev;
-			priv->of_node = cvm_oct_node_for_port(pip, interface,
-							      port_index);
-
-			INIT_DELAYED_WORK(&priv->port_periodic_work,
-					  cvm_oct_periodic_worker);
-			priv->imode = imode;
-			priv->port = port;
-			priv->queue = cvmx_pko_get_base_queue(priv->port);
-			priv->fau = fau - cvmx_pko_get_num_queues(port) * 4;
-			priv->phy_mode = PHY_INTERFACE_MODE_NA;
-			for (qos = 0; qos < 16; qos++)
-				skb_queue_head_init(&priv->tx_free_list[qos]);
-			for (qos = 0; qos < cvmx_pko_get_num_queues(port);
-			     qos++)
-				cvmx_fau_atomic_write32(priv->fau + qos * 4, 0);
-			dev->min_mtu = VLAN_ETH_ZLEN - mtu_overhead;
-			dev->max_mtu = OCTEON_MAX_MTU - mtu_overhead;
-
-			switch (priv->imode) {
-			/* These types don't support ports to IPD/PKO */
-			case CVMX_HELPER_INTERFACE_MODE_DISABLED:
-			case CVMX_HELPER_INTERFACE_MODE_PCIE:
-			case CVMX_HELPER_INTERFACE_MODE_PICMG:
-				break;
-
-			case CVMX_HELPER_INTERFACE_MODE_NPI:
-				dev->netdev_ops = &cvm_oct_npi_netdev_ops;
-				strscpy(dev->name, "npi%d", sizeof(dev->name));
-				break;
-
-			case CVMX_HELPER_INTERFACE_MODE_XAUI:
-				dev->netdev_ops = &cvm_oct_xaui_netdev_ops;
-				strscpy(dev->name, "xaui%d", sizeof(dev->name));
-				break;
-
-			case CVMX_HELPER_INTERFACE_MODE_LOOP:
-				dev->netdev_ops = &cvm_oct_npi_netdev_ops;
-				strscpy(dev->name, "loop%d", sizeof(dev->name));
-				break;
-
-			case CVMX_HELPER_INTERFACE_MODE_SGMII:
-				priv->phy_mode = PHY_INTERFACE_MODE_SGMII;
-				dev->netdev_ops = &cvm_oct_sgmii_netdev_ops;
-				strscpy(dev->name, "eth%d", sizeof(dev->name));
-				break;
-
-			case CVMX_HELPER_INTERFACE_MODE_SPI:
-				dev->netdev_ops = &cvm_oct_spi_netdev_ops;
-				strscpy(dev->name, "spi%d", sizeof(dev->name));
-				break;
-
-			case CVMX_HELPER_INTERFACE_MODE_GMII:
-				priv->phy_mode = PHY_INTERFACE_MODE_GMII;
-				dev->netdev_ops = &cvm_oct_rgmii_netdev_ops;
-				strscpy(dev->name, "eth%d", sizeof(dev->name));
-				break;
-
-			case CVMX_HELPER_INTERFACE_MODE_RGMII:
-				dev->netdev_ops = &cvm_oct_rgmii_netdev_ops;
-				strscpy(dev->name, "eth%d", sizeof(dev->name));
-				cvm_set_rgmii_delay(priv, interface,
-						    port_index);
-				break;
-			}
-
-			if (!dev->netdev_ops) {
-				free_netdev(dev);
-			} else if (register_netdev(dev) < 0) {
-				pr_err("Failed to register ethernet device for interface %d, port %d\n",
-				       interface, priv->port);
-				free_netdev(dev);
-			} else {
-				cvm_oct_device[priv->port] = dev;
-				fau -=
-				    cvmx_pko_get_num_queues(priv->port) *
-				    sizeof(u32);
-				schedule_delayed_work(&priv->port_periodic_work,
-						      HZ);
-			}
-		}
-	}
-
-	cvm_oct_tx_initialize();
-	cvm_oct_rx_initialize();
-
-	/*
-	 * 150 uS: about 10 1500-byte packets at 1GE.
-	 */
-	cvm_oct_tx_poll_interval = 150 * (octeon_get_clock_rate() / 1000000);
-
-	schedule_delayed_work(&cvm_oct_rx_refill_work, HZ);
-
-	return 0;
-}
-
-static int cvm_oct_remove(struct platform_device *pdev)
-{
-	int port;
-
-	cvmx_ipd_disable();
-
-	atomic_inc_return(&cvm_oct_poll_queue_stopping);
-	cancel_delayed_work_sync(&cvm_oct_rx_refill_work);
-
-	cvm_oct_rx_shutdown();
-	cvm_oct_tx_shutdown();
-
-	cvmx_pko_disable();
-
-	/* Free the ethernet devices */
-	for (port = 0; port < TOTAL_NUMBER_OF_PORTS; port++) {
-		if (cvm_oct_device[port]) {
-			struct net_device *dev = cvm_oct_device[port];
-			struct octeon_ethernet *priv = netdev_priv(dev);
-
-			cancel_delayed_work_sync(&priv->port_periodic_work);
-
-			cvm_oct_tx_shutdown_dev(dev);
-			unregister_netdev(dev);
-			free_netdev(dev);
-			cvm_oct_device[port] = NULL;
-		}
-	}
-
-	cvmx_pko_shutdown();
-
-	cvmx_ipd_free_ptr();
-
-	/* Free the HW pools */
-	cvm_oct_mem_empty_fpa(CVMX_FPA_PACKET_POOL, CVMX_FPA_PACKET_POOL_SIZE,
-			      num_packet_buffers);
-	cvm_oct_mem_empty_fpa(CVMX_FPA_WQE_POOL, CVMX_FPA_WQE_POOL_SIZE,
-			      num_packet_buffers);
-	if (CVMX_FPA_OUTPUT_BUFFER_POOL != CVMX_FPA_PACKET_POOL)
-		cvm_oct_mem_empty_fpa(CVMX_FPA_OUTPUT_BUFFER_POOL,
-				      CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE, 128);
-	return 0;
-}
-
-static const struct of_device_id cvm_oct_match[] = {
-	{
-		.compatible = "cavium,octeon-3860-pip",
-	},
-	{},
-};
-MODULE_DEVICE_TABLE(of, cvm_oct_match);
-
-static struct platform_driver cvm_oct_driver = {
-	.probe		= cvm_oct_probe,
-	.remove		= cvm_oct_remove,
-	.driver		= {
-		.name	= KBUILD_MODNAME,
-		.of_match_table = cvm_oct_match,
-	},
-};
-
-module_platform_driver(cvm_oct_driver);
-
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Cavium Networks <support@caviumnetworks.com>");
-MODULE_DESCRIPTION("Cavium Networks Octeon ethernet driver.");
diff --git a/drivers/staging/octeon/octeon-ethernet.h b/drivers/staging/octeon/octeon-ethernet.h
deleted file mode 100644
index a6140705706f..000000000000
--- a/drivers/staging/octeon/octeon-ethernet.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * This file is based on code from OCTEON SDK by Cavium Networks.
- *
- * Copyright (c) 2003-2010 Cavium Networks
- */
-
-/*
- * External interface for the Cavium Octeon ethernet driver.
- */
-#ifndef OCTEON_ETHERNET_H
-#define OCTEON_ETHERNET_H
-
-#include <linux/of.h>
-#include <linux/phy.h>
-
-#ifdef CONFIG_CAVIUM_OCTEON_SOC
-
-#include <asm/octeon/octeon.h>
-
-#include <asm/octeon/cvmx-asxx-defs.h>
-#include <asm/octeon/cvmx-config.h>
-#include <asm/octeon/cvmx-fau.h>
-#include <asm/octeon/cvmx-gmxx-defs.h>
-#include <asm/octeon/cvmx-helper.h>
-#include <asm/octeon/cvmx-helper-util.h>
-#include <asm/octeon/cvmx-ipd.h>
-#include <asm/octeon/cvmx-ipd-defs.h>
-#include <asm/octeon/cvmx-npi-defs.h>
-#include <asm/octeon/cvmx-pip.h>
-#include <asm/octeon/cvmx-pko.h>
-#include <asm/octeon/cvmx-pow.h>
-#include <asm/octeon/cvmx-scratch.h>
-#include <asm/octeon/cvmx-spi.h>
-#include <asm/octeon/cvmx-spxx-defs.h>
-#include <asm/octeon/cvmx-stxx-defs.h>
-#include <asm/octeon/cvmx-wqe.h>
-
-#else
-
-#include "octeon-stubs.h"
-
-#endif
-
-/**
- * This is the definition of the Ethernet driver's private
- * driver state stored in netdev_priv(dev).
- */
-struct octeon_ethernet {
-	/* PKO hardware output port */
-	int port;
-	/* PKO hardware queue for the port */
-	int queue;
-	/* Hardware fetch and add to count outstanding tx buffers */
-	int fau;
-	/* My netdev. */
-	struct net_device *netdev;
-	/*
-	 * Type of port. This is one of the enums in
-	 * cvmx_helper_interface_mode_t
-	 */
-	int imode;
-	/* PHY mode */
-	phy_interface_t phy_mode;
-	/* List of outstanding tx buffers per queue */
-	struct sk_buff_head tx_free_list[16];
-	unsigned int last_speed;
-	unsigned int last_link;
-	/* Last negotiated link state */
-	u64 link_info;
-	/* Called periodically to check link status */
-	void (*poll)(struct net_device *dev);
-	struct delayed_work	port_periodic_work;
-	struct device_node	*of_node;
-};
-
-int cvm_oct_free_work(void *work_queue_entry);
-
-int cvm_oct_rgmii_open(struct net_device *dev);
-
-int cvm_oct_sgmii_init(struct net_device *dev);
-int cvm_oct_sgmii_open(struct net_device *dev);
-
-int cvm_oct_spi_init(struct net_device *dev);
-void cvm_oct_spi_uninit(struct net_device *dev);
-
-int cvm_oct_common_init(struct net_device *dev);
-void cvm_oct_common_uninit(struct net_device *dev);
-void cvm_oct_adjust_link(struct net_device *dev);
-int cvm_oct_common_stop(struct net_device *dev);
-int cvm_oct_common_open(struct net_device *dev,
-			void (*link_poll)(struct net_device *));
-void cvm_oct_note_carrier(struct octeon_ethernet *priv,
-			  union cvmx_helper_link_info li);
-void cvm_oct_link_poll(struct net_device *dev);
-
-extern int always_use_pow;
-extern int pow_send_group;
-extern int pow_receive_groups;
-extern char pow_send_list[];
-extern struct net_device *cvm_oct_device[];
-extern atomic_t cvm_oct_poll_queue_stopping;
-extern u64 cvm_oct_tx_poll_interval;
-
-extern int rx_napi_weight;
-
-#endif
diff --git a/drivers/staging/octeon/octeon-stubs.h b/drivers/staging/octeon/octeon-stubs.h
deleted file mode 100644
index 79213c045504..000000000000
--- a/drivers/staging/octeon/octeon-stubs.h
+++ /dev/null
@@ -1,1433 +0,0 @@
-#define CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE	512
-
-#ifndef XKPHYS_TO_PHYS
-# define XKPHYS_TO_PHYS(p)			(p)
-#endif
-
-#define OCTEON_IRQ_WORKQ0 0
-#define OCTEON_IRQ_RML 0
-#define OCTEON_IRQ_TIMER1 0
-#define OCTEON_IS_MODEL(x) 0
-#define octeon_has_feature(x)	0
-#define octeon_get_clock_rate()	0
-
-#define CVMX_SYNCIOBDMA		do { } while(0)
-
-#define CVMX_HELPER_INPUT_TAG_TYPE	0
-#define CVMX_HELPER_FIRST_MBUFF_SKIP	7
-#define CVMX_FAU_REG_END		(2048)
-#define CVMX_FPA_OUTPUT_BUFFER_POOL	    (2)
-#define CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE    16
-#define CVMX_FPA_PACKET_POOL		    (0)
-#define CVMX_FPA_PACKET_POOL_SIZE	    16
-#define CVMX_FPA_WQE_POOL		    (1)
-#define CVMX_FPA_WQE_POOL_SIZE		    16
-#define CVMX_GMXX_RXX_ADR_CAM_EN(a, b)	((a)+(b))
-#define CVMX_GMXX_RXX_ADR_CTL(a, b)	((a)+(b))
-#define CVMX_GMXX_PRTX_CFG(a, b)	((a)+(b))
-#define CVMX_GMXX_RXX_FRM_MAX(a, b)	((a)+(b))
-#define CVMX_GMXX_RXX_JABBER(a, b)	((a)+(b))
-#define CVMX_IPD_CTL_STATUS		0
-#define CVMX_PIP_FRM_LEN_CHKX(a)	(a)
-#define CVMX_PIP_NUM_INPUT_PORTS	1
-#define CVMX_SCR_SCRATCH		0
-#define CVMX_PKO_QUEUES_PER_PORT_INTERFACE0	2
-#define CVMX_PKO_QUEUES_PER_PORT_INTERFACE1	2
-#define CVMX_IPD_SUB_PORT_FCS		0
-#define CVMX_SSO_WQ_IQ_DIS		0
-#define CVMX_SSO_WQ_INT			0
-#define CVMX_POW_WQ_INT			0
-#define CVMX_SSO_WQ_INT_PC		0
-#define CVMX_NPI_RSL_INT_BLOCKS		0
-#define CVMX_POW_WQ_INT_PC		0
-
-union cvmx_pip_wqe_word2 {
-	uint64_t u64;
-	struct {
-		uint64_t bufs:8;
-		uint64_t ip_offset:8;
-		uint64_t vlan_valid:1;
-		uint64_t vlan_stacked:1;
-		uint64_t unassigned:1;
-		uint64_t vlan_cfi:1;
-		uint64_t vlan_id:12;
-		uint64_t pr:4;
-		uint64_t unassigned2:8;
-		uint64_t dec_ipcomp:1;
-		uint64_t tcp_or_udp:1;
-		uint64_t dec_ipsec:1;
-		uint64_t is_v6:1;
-		uint64_t software:1;
-		uint64_t L4_error:1;
-		uint64_t is_frag:1;
-		uint64_t IP_exc:1;
-		uint64_t is_bcast:1;
-		uint64_t is_mcast:1;
-		uint64_t not_IP:1;
-		uint64_t rcv_error:1;
-		uint64_t err_code:8;
-	} s;
-	struct {
-		uint64_t bufs:8;
-		uint64_t ip_offset:8;
-		uint64_t vlan_valid:1;
-		uint64_t vlan_stacked:1;
-		uint64_t unassigned:1;
-		uint64_t vlan_cfi:1;
-		uint64_t vlan_id:12;
-		uint64_t port:12;
-		uint64_t dec_ipcomp:1;
-		uint64_t tcp_or_udp:1;
-		uint64_t dec_ipsec:1;
-		uint64_t is_v6:1;
-		uint64_t software:1;
-		uint64_t L4_error:1;
-		uint64_t is_frag:1;
-		uint64_t IP_exc:1;
-		uint64_t is_bcast:1;
-		uint64_t is_mcast:1;
-		uint64_t not_IP:1;
-		uint64_t rcv_error:1;
-		uint64_t err_code:8;
-	} s_cn68xx;
-
-	struct {
-		uint64_t unused1:16;
-		uint64_t vlan:16;
-		uint64_t unused2:32;
-	} svlan;
-	struct {
-		uint64_t bufs:8;
-		uint64_t unused:8;
-		uint64_t vlan_valid:1;
-		uint64_t vlan_stacked:1;
-		uint64_t unassigned:1;
-		uint64_t vlan_cfi:1;
-		uint64_t vlan_id:12;
-		uint64_t pr:4;
-		uint64_t unassigned2:12;
-		uint64_t software:1;
-		uint64_t unassigned3:1;
-		uint64_t is_rarp:1;
-		uint64_t is_arp:1;
-		uint64_t is_bcast:1;
-		uint64_t is_mcast:1;
-		uint64_t not_IP:1;
-		uint64_t rcv_error:1;
-		uint64_t err_code:8;
-	} snoip;
-
-};
-
-union cvmx_pip_wqe_word0 {
-	struct {
-		uint64_t next_ptr:40;
-		uint8_t unused;
-		__wsum hw_chksum;
-	} cn38xx;
-	struct {
-		uint64_t pknd:6;        /* 0..5 */
-		uint64_t unused2:2;     /* 6..7 */
-		uint64_t bpid:6;        /* 8..13 */
-		uint64_t unused1:18;    /* 14..31 */
-		uint64_t l2ptr:8;       /* 32..39 */
-		uint64_t l3ptr:8;       /* 40..47 */
-		uint64_t unused0:8;     /* 48..55 */
-		uint64_t l4ptr:8;       /* 56..63 */
-	} cn68xx;
-};
-
-union cvmx_wqe_word0 {
-	uint64_t u64;
-	union cvmx_pip_wqe_word0 pip;
-};
-
-union cvmx_wqe_word1 {
-	uint64_t u64;
-	struct {
-		uint64_t tag:32;
-		uint64_t tag_type:2;
-		uint64_t varies:14;
-		uint64_t len:16;
-	};
-	struct {
-		uint64_t tag:32;
-		uint64_t tag_type:2;
-		uint64_t zero_2:3;
-		uint64_t grp:6;
-		uint64_t zero_1:1;
-		uint64_t qos:3;
-		uint64_t zero_0:1;
-		uint64_t len:16;
-	} cn68xx;
-	struct {
-		uint64_t tag:32;
-		uint64_t tag_type:2;
-		uint64_t zero_2:1;
-		uint64_t grp:4;
-		uint64_t qos:3;
-		uint64_t ipprt:6;
-		uint64_t len:16;
-	} cn38xx;
-};
-
-union cvmx_buf_ptr {
-	void *ptr;
-	uint64_t u64;
-	struct {
-		uint64_t i:1;
-		uint64_t back:4;
-		uint64_t pool:3;
-		uint64_t size:16;
-		uint64_t addr:40;
-	} s;
-};
-
-struct cvmx_wqe {
-	union cvmx_wqe_word0 word0;
-	union cvmx_wqe_word1 word1;
-	union cvmx_pip_wqe_word2 word2;
-	union cvmx_buf_ptr packet_ptr;
-	uint8_t packet_data[96];
-};
-
-union cvmx_helper_link_info {
-	uint64_t u64;
-	struct {
-		uint64_t reserved_20_63:44;
-		uint64_t link_up:1;	    /**< Is the physical link up? */
-		uint64_t full_duplex:1;	    /**< 1 if the link is full duplex */
-		uint64_t speed:18;	    /**< Speed of the link in Mbps */
-	} s;
-};
-
-enum cvmx_fau_reg_32 {
-	CVMX_FAU_REG_32_START	= 0,
-};
-
-enum cvmx_fau_op_size {
-	CVMX_FAU_OP_SIZE_8 = 0,
-	CVMX_FAU_OP_SIZE_16 = 1,
-	CVMX_FAU_OP_SIZE_32 = 2,
-	CVMX_FAU_OP_SIZE_64 = 3
-};
-
-typedef enum {
-	CVMX_SPI_MODE_UNKNOWN = 0,
-	CVMX_SPI_MODE_TX_HALFPLEX = 1,
-	CVMX_SPI_MODE_RX_HALFPLEX = 2,
-	CVMX_SPI_MODE_DUPLEX = 3
-} cvmx_spi_mode_t;
-
-typedef enum {
-	CVMX_HELPER_INTERFACE_MODE_DISABLED,
-	CVMX_HELPER_INTERFACE_MODE_RGMII,
-	CVMX_HELPER_INTERFACE_MODE_GMII,
-	CVMX_HELPER_INTERFACE_MODE_SPI,
-	CVMX_HELPER_INTERFACE_MODE_PCIE,
-	CVMX_HELPER_INTERFACE_MODE_XAUI,
-	CVMX_HELPER_INTERFACE_MODE_SGMII,
-	CVMX_HELPER_INTERFACE_MODE_PICMG,
-	CVMX_HELPER_INTERFACE_MODE_NPI,
-	CVMX_HELPER_INTERFACE_MODE_LOOP,
-} cvmx_helper_interface_mode_t;
-
-typedef enum {
-	CVMX_POW_WAIT = 1,
-	CVMX_POW_NO_WAIT = 0,
-} cvmx_pow_wait_t;
-
-typedef enum {
-	CVMX_PKO_LOCK_NONE = 0,
-	CVMX_PKO_LOCK_ATOMIC_TAG = 1,
-	CVMX_PKO_LOCK_CMD_QUEUE = 2,
-} cvmx_pko_lock_t;
-
-typedef enum {
-	CVMX_PKO_SUCCESS,
-	CVMX_PKO_INVALID_PORT,
-	CVMX_PKO_INVALID_QUEUE,
-	CVMX_PKO_INVALID_PRIORITY,
-	CVMX_PKO_NO_MEMORY,
-	CVMX_PKO_PORT_ALREADY_SETUP,
-	CVMX_PKO_CMD_QUEUE_INIT_ERROR
-} cvmx_pko_status_t;
-
-enum cvmx_pow_tag_type {
-	CVMX_POW_TAG_TYPE_ORDERED   = 0L,
-	CVMX_POW_TAG_TYPE_ATOMIC    = 1L,
-	CVMX_POW_TAG_TYPE_NULL	    = 2L,
-	CVMX_POW_TAG_TYPE_NULL_NULL = 3L
-};
-
-union cvmx_ipd_ctl_status {
-	uint64_t u64;
-	struct cvmx_ipd_ctl_status_s {
-		uint64_t reserved_18_63:46;
-		uint64_t use_sop:1;
-		uint64_t rst_done:1;
-		uint64_t clken:1;
-		uint64_t no_wptr:1;
-		uint64_t pq_apkt:1;
-		uint64_t pq_nabuf:1;
-		uint64_t ipd_full:1;
-		uint64_t pkt_off:1;
-		uint64_t len_m8:1;
-		uint64_t reset:1;
-		uint64_t addpkt:1;
-		uint64_t naddbuf:1;
-		uint64_t pkt_lend:1;
-		uint64_t wqe_lend:1;
-		uint64_t pbp_en:1;
-		uint64_t opc_mode:2;
-		uint64_t ipd_en:1;
-	} s;
-	struct cvmx_ipd_ctl_status_cn30xx {
-		uint64_t reserved_10_63:54;
-		uint64_t len_m8:1;
-		uint64_t reset:1;
-		uint64_t addpkt:1;
-		uint64_t naddbuf:1;
-		uint64_t pkt_lend:1;
-		uint64_t wqe_lend:1;
-		uint64_t pbp_en:1;
-		uint64_t opc_mode:2;
-		uint64_t ipd_en:1;
-	} cn30xx;
-	struct cvmx_ipd_ctl_status_cn38xxp2 {
-		uint64_t reserved_9_63:55;
-		uint64_t reset:1;
-		uint64_t addpkt:1;
-		uint64_t naddbuf:1;
-		uint64_t pkt_lend:1;
-		uint64_t wqe_lend:1;
-		uint64_t pbp_en:1;
-		uint64_t opc_mode:2;
-		uint64_t ipd_en:1;
-	} cn38xxp2;
-	struct cvmx_ipd_ctl_status_cn50xx {
-		uint64_t reserved_15_63:49;
-		uint64_t no_wptr:1;
-		uint64_t pq_apkt:1;
-		uint64_t pq_nabuf:1;
-		uint64_t ipd_full:1;
-		uint64_t pkt_off:1;
-		uint64_t len_m8:1;
-		uint64_t reset:1;
-		uint64_t addpkt:1;
-		uint64_t naddbuf:1;
-		uint64_t pkt_lend:1;
-		uint64_t wqe_lend:1;
-		uint64_t pbp_en:1;
-		uint64_t opc_mode:2;
-		uint64_t ipd_en:1;
-	} cn50xx;
-	struct cvmx_ipd_ctl_status_cn58xx {
-		uint64_t reserved_12_63:52;
-		uint64_t ipd_full:1;
-		uint64_t pkt_off:1;
-		uint64_t len_m8:1;
-		uint64_t reset:1;
-		uint64_t addpkt:1;
-		uint64_t naddbuf:1;
-		uint64_t pkt_lend:1;
-		uint64_t wqe_lend:1;
-		uint64_t pbp_en:1;
-		uint64_t opc_mode:2;
-		uint64_t ipd_en:1;
-	} cn58xx;
-	struct cvmx_ipd_ctl_status_cn63xxp1 {
-		uint64_t reserved_16_63:48;
-		uint64_t clken:1;
-		uint64_t no_wptr:1;
-		uint64_t pq_apkt:1;
-		uint64_t pq_nabuf:1;
-		uint64_t ipd_full:1;
-		uint64_t pkt_off:1;
-		uint64_t len_m8:1;
-		uint64_t reset:1;
-		uint64_t addpkt:1;
-		uint64_t naddbuf:1;
-		uint64_t pkt_lend:1;
-		uint64_t wqe_lend:1;
-		uint64_t pbp_en:1;
-		uint64_t opc_mode:2;
-		uint64_t ipd_en:1;
-	} cn63xxp1;
-};
-
-union cvmx_ipd_sub_port_fcs {
-	uint64_t u64;
-	struct cvmx_ipd_sub_port_fcs_s {
-		uint64_t port_bit:32;
-		uint64_t reserved_32_35:4;
-		uint64_t port_bit2:4;
-		uint64_t reserved_40_63:24;
-	} s;
-	struct cvmx_ipd_sub_port_fcs_cn30xx {
-		uint64_t port_bit:3;
-		uint64_t reserved_3_63:61;
-	} cn30xx;
-	struct cvmx_ipd_sub_port_fcs_cn38xx {
-		uint64_t port_bit:32;
-		uint64_t reserved_32_63:32;
-	} cn38xx;
-};
-
-union cvmx_ipd_sub_port_qos_cnt {
-	uint64_t u64;
-	struct cvmx_ipd_sub_port_qos_cnt_s {
-		uint64_t cnt:32;
-		uint64_t port_qos:9;
-		uint64_t reserved_41_63:23;
-	} s;
-};
-typedef struct {
-	uint32_t dropped_octets;
-	uint32_t dropped_packets;
-	uint32_t pci_raw_packets;
-	uint32_t octets;
-	uint32_t packets;
-	uint32_t multicast_packets;
-	uint32_t broadcast_packets;
-	uint32_t len_64_packets;
-	uint32_t len_65_127_packets;
-	uint32_t len_128_255_packets;
-	uint32_t len_256_511_packets;
-	uint32_t len_512_1023_packets;
-	uint32_t len_1024_1518_packets;
-	uint32_t len_1519_max_packets;
-	uint32_t fcs_align_err_packets;
-	uint32_t runt_packets;
-	uint32_t runt_crc_packets;
-	uint32_t oversize_packets;
-	uint32_t oversize_crc_packets;
-	uint32_t inb_packets;
-	uint64_t inb_octets;
-	uint16_t inb_errors;
-} cvmx_pip_port_status_t;
-
-typedef struct {
-	uint32_t packets;
-	uint64_t octets;
-	uint64_t doorbell;
-} cvmx_pko_port_status_t;
-
-union cvmx_pip_frm_len_chkx {
-	uint64_t u64;
-	struct cvmx_pip_frm_len_chkx_s {
-		uint64_t reserved_32_63:32;
-		uint64_t maxlen:16;
-		uint64_t minlen:16;
-	} s;
-};
-
-union cvmx_gmxx_rxx_frm_ctl {
-	uint64_t u64;
-	struct cvmx_gmxx_rxx_frm_ctl_s {
-		uint64_t pre_chk:1;
-		uint64_t pre_strp:1;
-		uint64_t ctl_drp:1;
-		uint64_t ctl_bck:1;
-		uint64_t ctl_mcst:1;
-		uint64_t ctl_smac:1;
-		uint64_t pre_free:1;
-		uint64_t vlan_len:1;
-		uint64_t pad_len:1;
-		uint64_t pre_align:1;
-		uint64_t null_dis:1;
-		uint64_t reserved_11_11:1;
-		uint64_t ptp_mode:1;
-		uint64_t reserved_13_63:51;
-	} s;
-	struct cvmx_gmxx_rxx_frm_ctl_cn30xx {
-		uint64_t pre_chk:1;
-		uint64_t pre_strp:1;
-		uint64_t ctl_drp:1;
-		uint64_t ctl_bck:1;
-		uint64_t ctl_mcst:1;
-		uint64_t ctl_smac:1;
-		uint64_t pre_free:1;
-		uint64_t vlan_len:1;
-		uint64_t pad_len:1;
-		uint64_t reserved_9_63:55;
-	} cn30xx;
-	struct cvmx_gmxx_rxx_frm_ctl_cn31xx {
-		uint64_t pre_chk:1;
-		uint64_t pre_strp:1;
-		uint64_t ctl_drp:1;
-		uint64_t ctl_bck:1;
-		uint64_t ctl_mcst:1;
-		uint64_t ctl_smac:1;
-		uint64_t pre_free:1;
-		uint64_t vlan_len:1;
-		uint64_t reserved_8_63:56;
-	} cn31xx;
-	struct cvmx_gmxx_rxx_frm_ctl_cn50xx {
-		uint64_t pre_chk:1;
-		uint64_t pre_strp:1;
-		uint64_t ctl_drp:1;
-		uint64_t ctl_bck:1;
-		uint64_t ctl_mcst:1;
-		uint64_t ctl_smac:1;
-		uint64_t pre_free:1;
-		uint64_t reserved_7_8:2;
-		uint64_t pre_align:1;
-		uint64_t null_dis:1;
-		uint64_t reserved_11_63:53;
-	} cn50xx;
-	struct cvmx_gmxx_rxx_frm_ctl_cn56xxp1 {
-		uint64_t pre_chk:1;
-		uint64_t pre_strp:1;
-		uint64_t ctl_drp:1;
-		uint64_t ctl_bck:1;
-		uint64_t ctl_mcst:1;
-		uint64_t ctl_smac:1;
-		uint64_t pre_free:1;
-		uint64_t reserved_7_8:2;
-		uint64_t pre_align:1;
-		uint64_t reserved_10_63:54;
-	} cn56xxp1;
-	struct cvmx_gmxx_rxx_frm_ctl_cn58xx {
-		uint64_t pre_chk:1;
-		uint64_t pre_strp:1;
-		uint64_t ctl_drp:1;
-		uint64_t ctl_bck:1;
-		uint64_t ctl_mcst:1;
-		uint64_t ctl_smac:1;
-		uint64_t pre_free:1;
-		uint64_t vlan_len:1;
-		uint64_t pad_len:1;
-		uint64_t pre_align:1;
-		uint64_t null_dis:1;
-		uint64_t reserved_11_63:53;
-	} cn58xx;
-	struct cvmx_gmxx_rxx_frm_ctl_cn61xx {
-		uint64_t pre_chk:1;
-		uint64_t pre_strp:1;
-		uint64_t ctl_drp:1;
-		uint64_t ctl_bck:1;
-		uint64_t ctl_mcst:1;
-		uint64_t ctl_smac:1;
-		uint64_t pre_free:1;
-		uint64_t reserved_7_8:2;
-		uint64_t pre_align:1;
-		uint64_t null_dis:1;
-		uint64_t reserved_11_11:1;
-		uint64_t ptp_mode:1;
-		uint64_t reserved_13_63:51;
-	} cn61xx;
-};
-
-union cvmx_gmxx_rxx_int_reg {
-	uint64_t u64;
-	struct cvmx_gmxx_rxx_int_reg_s {
-		uint64_t minerr:1;
-		uint64_t carext:1;
-		uint64_t maxerr:1;
-		uint64_t jabber:1;
-		uint64_t fcserr:1;
-		uint64_t alnerr:1;
-		uint64_t lenerr:1;
-		uint64_t rcverr:1;
-		uint64_t skperr:1;
-		uint64_t niberr:1;
-		uint64_t ovrerr:1;
-		uint64_t pcterr:1;
-		uint64_t rsverr:1;
-		uint64_t falerr:1;
-		uint64_t coldet:1;
-		uint64_t ifgerr:1;
-		uint64_t phy_link:1;
-		uint64_t phy_spd:1;
-		uint64_t phy_dupx:1;
-		uint64_t pause_drp:1;
-		uint64_t loc_fault:1;
-		uint64_t rem_fault:1;
-		uint64_t bad_seq:1;
-		uint64_t bad_term:1;
-		uint64_t unsop:1;
-		uint64_t uneop:1;
-		uint64_t undat:1;
-		uint64_t hg2fld:1;
-		uint64_t hg2cc:1;
-		uint64_t reserved_29_63:35;
-	} s;
-	struct cvmx_gmxx_rxx_int_reg_cn30xx {
-		uint64_t minerr:1;
-		uint64_t carext:1;
-		uint64_t maxerr:1;
-		uint64_t jabber:1;
-		uint64_t fcserr:1;
-		uint64_t alnerr:1;
-		uint64_t lenerr:1;
-		uint64_t rcverr:1;
-		uint64_t skperr:1;
-		uint64_t niberr:1;
-		uint64_t ovrerr:1;
-		uint64_t pcterr:1;
-		uint64_t rsverr:1;
-		uint64_t falerr:1;
-		uint64_t coldet:1;
-		uint64_t ifgerr:1;
-		uint64_t phy_link:1;
-		uint64_t phy_spd:1;
-		uint64_t phy_dupx:1;
-		uint64_t reserved_19_63:45;
-	} cn30xx;
-	struct cvmx_gmxx_rxx_int_reg_cn50xx {
-		uint64_t reserved_0_0:1;
-		uint64_t carext:1;
-		uint64_t reserved_2_2:1;
-		uint64_t jabber:1;
-		uint64_t fcserr:1;
-		uint64_t alnerr:1;
-		uint64_t reserved_6_6:1;
-		uint64_t rcverr:1;
-		uint64_t skperr:1;
-		uint64_t niberr:1;
-		uint64_t ovrerr:1;
-		uint64_t pcterr:1;
-		uint64_t rsverr:1;
-		uint64_t falerr:1;
-		uint64_t coldet:1;
-		uint64_t ifgerr:1;
-		uint64_t phy_link:1;
-		uint64_t phy_spd:1;
-		uint64_t phy_dupx:1;
-		uint64_t pause_drp:1;
-		uint64_t reserved_20_63:44;
-	} cn50xx;
-	struct cvmx_gmxx_rxx_int_reg_cn52xx {
-		uint64_t reserved_0_0:1;
-		uint64_t carext:1;
-		uint64_t reserved_2_2:1;
-		uint64_t jabber:1;
-		uint64_t fcserr:1;
-		uint64_t reserved_5_6:2;
-		uint64_t rcverr:1;
-		uint64_t skperr:1;
-		uint64_t reserved_9_9:1;
-		uint64_t ovrerr:1;
-		uint64_t pcterr:1;
-		uint64_t rsverr:1;
-		uint64_t falerr:1;
-		uint64_t coldet:1;
-		uint64_t ifgerr:1;
-		uint64_t reserved_16_18:3;
-		uint64_t pause_drp:1;
-		uint64_t loc_fault:1;
-		uint64_t rem_fault:1;
-		uint64_t bad_seq:1;
-		uint64_t bad_term:1;
-		uint64_t unsop:1;
-		uint64_t uneop:1;
-		uint64_t undat:1;
-		uint64_t hg2fld:1;
-		uint64_t hg2cc:1;
-		uint64_t reserved_29_63:35;
-	} cn52xx;
-	struct cvmx_gmxx_rxx_int_reg_cn56xxp1 {
-		uint64_t reserved_0_0:1;
-		uint64_t carext:1;
-		uint64_t reserved_2_2:1;
-		uint64_t jabber:1;
-		uint64_t fcserr:1;
-		uint64_t reserved_5_6:2;
-		uint64_t rcverr:1;
-		uint64_t skperr:1;
-		uint64_t reserved_9_9:1;
-		uint64_t ovrerr:1;
-		uint64_t pcterr:1;
-		uint64_t rsverr:1;
-		uint64_t falerr:1;
-		uint64_t coldet:1;
-		uint64_t ifgerr:1;
-		uint64_t reserved_16_18:3;
-		uint64_t pause_drp:1;
-		uint64_t loc_fault:1;
-		uint64_t rem_fault:1;
-		uint64_t bad_seq:1;
-		uint64_t bad_term:1;
-		uint64_t unsop:1;
-		uint64_t uneop:1;
-		uint64_t undat:1;
-		uint64_t reserved_27_63:37;
-	} cn56xxp1;
-	struct cvmx_gmxx_rxx_int_reg_cn58xx {
-		uint64_t minerr:1;
-		uint64_t carext:1;
-		uint64_t maxerr:1;
-		uint64_t jabber:1;
-		uint64_t fcserr:1;
-		uint64_t alnerr:1;
-		uint64_t lenerr:1;
-		uint64_t rcverr:1;
-		uint64_t skperr:1;
-		uint64_t niberr:1;
-		uint64_t ovrerr:1;
-		uint64_t pcterr:1;
-		uint64_t rsverr:1;
-		uint64_t falerr:1;
-		uint64_t coldet:1;
-		uint64_t ifgerr:1;
-		uint64_t phy_link:1;
-		uint64_t phy_spd:1;
-		uint64_t phy_dupx:1;
-		uint64_t pause_drp:1;
-		uint64_t reserved_20_63:44;
-	} cn58xx;
-	struct cvmx_gmxx_rxx_int_reg_cn61xx {
-		uint64_t minerr:1;
-		uint64_t carext:1;
-		uint64_t reserved_2_2:1;
-		uint64_t jabber:1;
-		uint64_t fcserr:1;
-		uint64_t reserved_5_6:2;
-		uint64_t rcverr:1;
-		uint64_t skperr:1;
-		uint64_t reserved_9_9:1;
-		uint64_t ovrerr:1;
-		uint64_t pcterr:1;
-		uint64_t rsverr:1;
-		uint64_t falerr:1;
-		uint64_t coldet:1;
-		uint64_t ifgerr:1;
-		uint64_t reserved_16_18:3;
-		uint64_t pause_drp:1;
-		uint64_t loc_fault:1;
-		uint64_t rem_fault:1;
-		uint64_t bad_seq:1;
-		uint64_t bad_term:1;
-		uint64_t unsop:1;
-		uint64_t uneop:1;
-		uint64_t undat:1;
-		uint64_t hg2fld:1;
-		uint64_t hg2cc:1;
-		uint64_t reserved_29_63:35;
-	} cn61xx;
-};
-
-union cvmx_gmxx_prtx_cfg {
-	uint64_t u64;
-	struct cvmx_gmxx_prtx_cfg_s {
-		uint64_t reserved_22_63:42;
-		uint64_t pknd:6;
-		uint64_t reserved_14_15:2;
-		uint64_t tx_idle:1;
-		uint64_t rx_idle:1;
-		uint64_t reserved_9_11:3;
-		uint64_t speed_msb:1;
-		uint64_t reserved_4_7:4;
-		uint64_t slottime:1;
-		uint64_t duplex:1;
-		uint64_t speed:1;
-		uint64_t en:1;
-	} s;
-	struct cvmx_gmxx_prtx_cfg_cn30xx {
-		uint64_t reserved_4_63:60;
-		uint64_t slottime:1;
-		uint64_t duplex:1;
-		uint64_t speed:1;
-		uint64_t en:1;
-	} cn30xx;
-	struct cvmx_gmxx_prtx_cfg_cn52xx {
-		uint64_t reserved_14_63:50;
-		uint64_t tx_idle:1;
-		uint64_t rx_idle:1;
-		uint64_t reserved_9_11:3;
-		uint64_t speed_msb:1;
-		uint64_t reserved_4_7:4;
-		uint64_t slottime:1;
-		uint64_t duplex:1;
-		uint64_t speed:1;
-		uint64_t en:1;
-	} cn52xx;
-};
-
-union cvmx_gmxx_rxx_adr_ctl {
-	uint64_t u64;
-	struct cvmx_gmxx_rxx_adr_ctl_s {
-		uint64_t reserved_4_63:60;
-		uint64_t cam_mode:1;
-		uint64_t mcst:2;
-		uint64_t bcst:1;
-	} s;
-};
-
-union cvmx_pip_prt_tagx {
-	uint64_t u64;
-	struct cvmx_pip_prt_tagx_s {
-		uint64_t reserved_54_63:10;
-		uint64_t portadd_en:1;
-		uint64_t inc_hwchk:1;
-		uint64_t reserved_50_51:2;
-		uint64_t grptagbase_msb:2;
-		uint64_t reserved_46_47:2;
-		uint64_t grptagmask_msb:2;
-		uint64_t reserved_42_43:2;
-		uint64_t grp_msb:2;
-		uint64_t grptagbase:4;
-		uint64_t grptagmask:4;
-		uint64_t grptag:1;
-		uint64_t grptag_mskip:1;
-		uint64_t tag_mode:2;
-		uint64_t inc_vs:2;
-		uint64_t inc_vlan:1;
-		uint64_t inc_prt_flag:1;
-		uint64_t ip6_dprt_flag:1;
-		uint64_t ip4_dprt_flag:1;
-		uint64_t ip6_sprt_flag:1;
-		uint64_t ip4_sprt_flag:1;
-		uint64_t ip6_nxth_flag:1;
-		uint64_t ip4_pctl_flag:1;
-		uint64_t ip6_dst_flag:1;
-		uint64_t ip4_dst_flag:1;
-		uint64_t ip6_src_flag:1;
-		uint64_t ip4_src_flag:1;
-		uint64_t tcp6_tag_type:2;
-		uint64_t tcp4_tag_type:2;
-		uint64_t ip6_tag_type:2;
-		uint64_t ip4_tag_type:2;
-		uint64_t non_tag_type:2;
-		uint64_t grp:4;
-	} s;
-	struct cvmx_pip_prt_tagx_cn30xx {
-		uint64_t reserved_40_63:24;
-		uint64_t grptagbase:4;
-		uint64_t grptagmask:4;
-		uint64_t grptag:1;
-		uint64_t reserved_30_30:1;
-		uint64_t tag_mode:2;
-		uint64_t inc_vs:2;
-		uint64_t inc_vlan:1;
-		uint64_t inc_prt_flag:1;
-		uint64_t ip6_dprt_flag:1;
-		uint64_t ip4_dprt_flag:1;
-		uint64_t ip6_sprt_flag:1;
-		uint64_t ip4_sprt_flag:1;
-		uint64_t ip6_nxth_flag:1;
-		uint64_t ip4_pctl_flag:1;
-		uint64_t ip6_dst_flag:1;
-		uint64_t ip4_dst_flag:1;
-		uint64_t ip6_src_flag:1;
-		uint64_t ip4_src_flag:1;
-		uint64_t tcp6_tag_type:2;
-		uint64_t tcp4_tag_type:2;
-		uint64_t ip6_tag_type:2;
-		uint64_t ip4_tag_type:2;
-		uint64_t non_tag_type:2;
-		uint64_t grp:4;
-	} cn30xx;
-	struct cvmx_pip_prt_tagx_cn50xx {
-		uint64_t reserved_40_63:24;
-		uint64_t grptagbase:4;
-		uint64_t grptagmask:4;
-		uint64_t grptag:1;
-		uint64_t grptag_mskip:1;
-		uint64_t tag_mode:2;
-		uint64_t inc_vs:2;
-		uint64_t inc_vlan:1;
-		uint64_t inc_prt_flag:1;
-		uint64_t ip6_dprt_flag:1;
-		uint64_t ip4_dprt_flag:1;
-		uint64_t ip6_sprt_flag:1;
-		uint64_t ip4_sprt_flag:1;
-		uint64_t ip6_nxth_flag:1;
-		uint64_t ip4_pctl_flag:1;
-		uint64_t ip6_dst_flag:1;
-		uint64_t ip4_dst_flag:1;
-		uint64_t ip6_src_flag:1;
-		uint64_t ip4_src_flag:1;
-		uint64_t tcp6_tag_type:2;
-		uint64_t tcp4_tag_type:2;
-		uint64_t ip6_tag_type:2;
-		uint64_t ip4_tag_type:2;
-		uint64_t non_tag_type:2;
-		uint64_t grp:4;
-	} cn50xx;
-};
-
-union cvmx_spxx_int_reg {
-	uint64_t u64;
-	struct cvmx_spxx_int_reg_s {
-		uint64_t reserved_32_63:32;
-		uint64_t spf:1;
-		uint64_t reserved_12_30:19;
-		uint64_t calerr:1;
-		uint64_t syncerr:1;
-		uint64_t diperr:1;
-		uint64_t tpaovr:1;
-		uint64_t rsverr:1;
-		uint64_t drwnng:1;
-		uint64_t clserr:1;
-		uint64_t spiovr:1;
-		uint64_t reserved_2_3:2;
-		uint64_t abnorm:1;
-		uint64_t prtnxa:1;
-	} s;
-};
-
-union cvmx_spxx_int_msk {
-	uint64_t u64;
-	struct cvmx_spxx_int_msk_s {
-		uint64_t reserved_12_63:52;
-		uint64_t calerr:1;
-		uint64_t syncerr:1;
-		uint64_t diperr:1;
-		uint64_t tpaovr:1;
-		uint64_t rsverr:1;
-		uint64_t drwnng:1;
-		uint64_t clserr:1;
-		uint64_t spiovr:1;
-		uint64_t reserved_2_3:2;
-		uint64_t abnorm:1;
-		uint64_t prtnxa:1;
-	} s;
-};
-
-union cvmx_pow_wq_int {
-	uint64_t u64;
-	struct cvmx_pow_wq_int_s {
-		uint64_t wq_int:16;
-		uint64_t iq_dis:16;
-		uint64_t reserved_32_63:32;
-	} s;
-};
-
-union cvmx_sso_wq_int_thrx {
-	uint64_t u64;
-	struct {
-		uint64_t iq_thr:12;
-		uint64_t reserved_12_13:2;
-		uint64_t ds_thr:12;
-		uint64_t reserved_26_27:2;
-		uint64_t tc_thr:4;
-		uint64_t tc_en:1;
-		uint64_t reserved_33_63:31;
-	} s;
-};
-
-union cvmx_stxx_int_reg {
-	uint64_t u64;
-	struct cvmx_stxx_int_reg_s {
-		uint64_t reserved_9_63:55;
-		uint64_t syncerr:1;
-		uint64_t frmerr:1;
-		uint64_t unxfrm:1;
-		uint64_t nosync:1;
-		uint64_t diperr:1;
-		uint64_t datovr:1;
-		uint64_t ovrbst:1;
-		uint64_t calpar1:1;
-		uint64_t calpar0:1;
-	} s;
-};
-
-union cvmx_stxx_int_msk {
-	uint64_t u64;
-	struct cvmx_stxx_int_msk_s {
-		uint64_t reserved_8_63:56;
-		uint64_t frmerr:1;
-		uint64_t unxfrm:1;
-		uint64_t nosync:1;
-		uint64_t diperr:1;
-		uint64_t datovr:1;
-		uint64_t ovrbst:1;
-		uint64_t calpar1:1;
-		uint64_t calpar0:1;
-	} s;
-};
-
-union cvmx_pow_wq_int_pc {
-	uint64_t u64;
-	struct cvmx_pow_wq_int_pc_s {
-		uint64_t reserved_0_7:8;
-		uint64_t pc_thr:20;
-		uint64_t reserved_28_31:4;
-		uint64_t pc:28;
-		uint64_t reserved_60_63:4;
-	} s;
-};
-
-union cvmx_pow_wq_int_thrx {
-	uint64_t u64;
-	struct cvmx_pow_wq_int_thrx_s {
-		uint64_t reserved_29_63:35;
-		uint64_t tc_en:1;
-		uint64_t tc_thr:4;
-		uint64_t reserved_23_23:1;
-		uint64_t ds_thr:11;
-		uint64_t reserved_11_11:1;
-		uint64_t iq_thr:11;
-	} s;
-	struct cvmx_pow_wq_int_thrx_cn30xx {
-		uint64_t reserved_29_63:35;
-		uint64_t tc_en:1;
-		uint64_t tc_thr:4;
-		uint64_t reserved_18_23:6;
-		uint64_t ds_thr:6;
-		uint64_t reserved_6_11:6;
-		uint64_t iq_thr:6;
-	} cn30xx;
-	struct cvmx_pow_wq_int_thrx_cn31xx {
-		uint64_t reserved_29_63:35;
-		uint64_t tc_en:1;
-		uint64_t tc_thr:4;
-		uint64_t reserved_20_23:4;
-		uint64_t ds_thr:8;
-		uint64_t reserved_8_11:4;
-		uint64_t iq_thr:8;
-	} cn31xx;
-	struct cvmx_pow_wq_int_thrx_cn52xx {
-		uint64_t reserved_29_63:35;
-		uint64_t tc_en:1;
-		uint64_t tc_thr:4;
-		uint64_t reserved_21_23:3;
-		uint64_t ds_thr:9;
-		uint64_t reserved_9_11:3;
-		uint64_t iq_thr:9;
-	} cn52xx;
-	struct cvmx_pow_wq_int_thrx_cn63xx {
-		uint64_t reserved_29_63:35;
-		uint64_t tc_en:1;
-		uint64_t tc_thr:4;
-		uint64_t reserved_22_23:2;
-		uint64_t ds_thr:10;
-		uint64_t reserved_10_11:2;
-		uint64_t iq_thr:10;
-	} cn63xx;
-};
-
-union cvmx_npi_rsl_int_blocks {
-	uint64_t u64;
-	struct cvmx_npi_rsl_int_blocks_s {
-		uint64_t reserved_32_63:32;
-		uint64_t rint_31:1;
-		uint64_t iob:1;
-		uint64_t reserved_28_29:2;
-		uint64_t rint_27:1;
-		uint64_t rint_26:1;
-		uint64_t rint_25:1;
-		uint64_t rint_24:1;
-		uint64_t asx1:1;
-		uint64_t asx0:1;
-		uint64_t rint_21:1;
-		uint64_t pip:1;
-		uint64_t spx1:1;
-		uint64_t spx0:1;
-		uint64_t lmc:1;
-		uint64_t l2c:1;
-		uint64_t rint_15:1;
-		uint64_t reserved_13_14:2;
-		uint64_t pow:1;
-		uint64_t tim:1;
-		uint64_t pko:1;
-		uint64_t ipd:1;
-		uint64_t rint_8:1;
-		uint64_t zip:1;
-		uint64_t dfa:1;
-		uint64_t fpa:1;
-		uint64_t key:1;
-		uint64_t npi:1;
-		uint64_t gmx1:1;
-		uint64_t gmx0:1;
-		uint64_t mio:1;
-	} s;
-	struct cvmx_npi_rsl_int_blocks_cn30xx {
-		uint64_t reserved_32_63:32;
-		uint64_t rint_31:1;
-		uint64_t iob:1;
-		uint64_t rint_29:1;
-		uint64_t rint_28:1;
-		uint64_t rint_27:1;
-		uint64_t rint_26:1;
-		uint64_t rint_25:1;
-		uint64_t rint_24:1;
-		uint64_t asx1:1;
-		uint64_t asx0:1;
-		uint64_t rint_21:1;
-		uint64_t pip:1;
-		uint64_t spx1:1;
-		uint64_t spx0:1;
-		uint64_t lmc:1;
-		uint64_t l2c:1;
-		uint64_t rint_15:1;
-		uint64_t rint_14:1;
-		uint64_t usb:1;
-		uint64_t pow:1;
-		uint64_t tim:1;
-		uint64_t pko:1;
-		uint64_t ipd:1;
-		uint64_t rint_8:1;
-		uint64_t zip:1;
-		uint64_t dfa:1;
-		uint64_t fpa:1;
-		uint64_t key:1;
-		uint64_t npi:1;
-		uint64_t gmx1:1;
-		uint64_t gmx0:1;
-		uint64_t mio:1;
-	} cn30xx;
-	struct cvmx_npi_rsl_int_blocks_cn38xx {
-		uint64_t reserved_32_63:32;
-		uint64_t rint_31:1;
-		uint64_t iob:1;
-		uint64_t rint_29:1;
-		uint64_t rint_28:1;
-		uint64_t rint_27:1;
-		uint64_t rint_26:1;
-		uint64_t rint_25:1;
-		uint64_t rint_24:1;
-		uint64_t asx1:1;
-		uint64_t asx0:1;
-		uint64_t rint_21:1;
-		uint64_t pip:1;
-		uint64_t spx1:1;
-		uint64_t spx0:1;
-		uint64_t lmc:1;
-		uint64_t l2c:1;
-		uint64_t rint_15:1;
-		uint64_t rint_14:1;
-		uint64_t rint_13:1;
-		uint64_t pow:1;
-		uint64_t tim:1;
-		uint64_t pko:1;
-		uint64_t ipd:1;
-		uint64_t rint_8:1;
-		uint64_t zip:1;
-		uint64_t dfa:1;
-		uint64_t fpa:1;
-		uint64_t key:1;
-		uint64_t npi:1;
-		uint64_t gmx1:1;
-		uint64_t gmx0:1;
-		uint64_t mio:1;
-	} cn38xx;
-	struct cvmx_npi_rsl_int_blocks_cn50xx {
-		uint64_t reserved_31_63:33;
-		uint64_t iob:1;
-		uint64_t lmc1:1;
-		uint64_t agl:1;
-		uint64_t reserved_24_27:4;
-		uint64_t asx1:1;
-		uint64_t asx0:1;
-		uint64_t reserved_21_21:1;
-		uint64_t pip:1;
-		uint64_t spx1:1;
-		uint64_t spx0:1;
-		uint64_t lmc:1;
-		uint64_t l2c:1;
-		uint64_t reserved_15_15:1;
-		uint64_t rad:1;
-		uint64_t usb:1;
-		uint64_t pow:1;
-		uint64_t tim:1;
-		uint64_t pko:1;
-		uint64_t ipd:1;
-		uint64_t reserved_8_8:1;
-		uint64_t zip:1;
-		uint64_t dfa:1;
-		uint64_t fpa:1;
-		uint64_t key:1;
-		uint64_t npi:1;
-		uint64_t gmx1:1;
-		uint64_t gmx0:1;
-		uint64_t mio:1;
-	} cn50xx;
-};
-
-union cvmx_pko_command_word0 {
-	uint64_t u64;
-	struct {
-		uint64_t total_bytes:16;
-		uint64_t segs:6;
-		uint64_t dontfree:1;
-		uint64_t ignore_i:1;
-		uint64_t ipoffp1:7;
-		uint64_t gather:1;
-		uint64_t rsp:1;
-		uint64_t wqp:1;
-		uint64_t n2:1;
-		uint64_t le:1;
-		uint64_t reg0:11;
-		uint64_t subone0:1;
-		uint64_t reg1:11;
-		uint64_t subone1:1;
-		uint64_t size0:2;
-		uint64_t size1:2;
-	} s;
-};
-
-union cvmx_ciu_timx {
-	uint64_t u64;
-	struct cvmx_ciu_timx_s {
-		uint64_t reserved_37_63:27;
-		uint64_t one_shot:1;
-		uint64_t len:36;
-	} s;
-};
-
-union cvmx_gmxx_rxx_rx_inbnd {
-	uint64_t u64;
-	struct cvmx_gmxx_rxx_rx_inbnd_s {
-		uint64_t status:1;
-		uint64_t speed:2;
-		uint64_t duplex:1;
-		uint64_t reserved_4_63:60;
-	} s;
-};
-
-static inline int32_t cvmx_fau_fetch_and_add32(enum cvmx_fau_reg_32 reg,
-					       int32_t value)
-{
-	return value;
-}
-
-static inline void cvmx_fau_atomic_add32(enum cvmx_fau_reg_32 reg,
-					 int32_t value)
-{ }
-
-static inline void cvmx_fau_atomic_write32(enum cvmx_fau_reg_32 reg,
-					   int32_t value)
-{ }
-
-static inline uint64_t cvmx_scratch_read64(uint64_t address)
-{
-	return 0;
-}
-
-static inline void cvmx_scratch_write64(uint64_t address, uint64_t value)
-{ }
-
-static inline int cvmx_wqe_get_grp(struct cvmx_wqe *work)
-{
-	return 0;
-}
-
-static inline void *cvmx_phys_to_ptr(uint64_t physical_address)
-{
-	return (void *)(uintptr_t)(physical_address);
-}
-
-static inline uint64_t cvmx_ptr_to_phys(void *ptr)
-{
-	return (unsigned long)ptr;
-}
-
-static inline int cvmx_helper_get_interface_num(int ipd_port)
-{
-	return ipd_port;
-}
-
-static inline int cvmx_helper_get_interface_index_num(int ipd_port)
-{
-	return ipd_port;
-}
-
-static inline void cvmx_fpa_enable(void)
-{ }
-
-static inline uint64_t cvmx_read_csr(uint64_t csr_addr)
-{
-	return 0;
-}
-
-static inline void cvmx_write_csr(uint64_t csr_addr, uint64_t val)
-{ }
-
-static inline int cvmx_helper_setup_red(int pass_thresh, int drop_thresh)
-{
-	return 0;
-}
-
-static inline void *cvmx_fpa_alloc(uint64_t pool)
-{
-	return NULL;
-}
-
-static inline void cvmx_fpa_free(void *ptr, uint64_t pool,
-				 uint64_t num_cache_lines)
-{ }
-
-static inline int octeon_is_simulation(void)
-{
-	return 1;
-}
-
-static inline void cvmx_pip_get_port_status(uint64_t port_num, uint64_t clear,
-					    cvmx_pip_port_status_t *status)
-{ }
-
-static inline void cvmx_pko_get_port_status(uint64_t port_num, uint64_t clear,
-					    cvmx_pko_port_status_t *status)
-{ }
-
-static inline cvmx_helper_interface_mode_t cvmx_helper_interface_get_mode(int
-								   interface)
-{
-	return 0;
-}
-
-static inline union cvmx_helper_link_info cvmx_helper_link_get(int ipd_port)
-{
-	union cvmx_helper_link_info ret = { .u64 = 0 };
-
-	return ret;
-}
-
-static inline int cvmx_helper_link_set(int ipd_port,
-				       union cvmx_helper_link_info link_info)
-{
-	return 0;
-}
-
-static inline int cvmx_helper_initialize_packet_io_global(void)
-{
-	return 0;
-}
-
-static inline int cvmx_helper_get_number_of_interfaces(void)
-{
-	return 2;
-}
-
-static inline int cvmx_helper_ports_on_interface(int interface)
-{
-	return 1;
-}
-
-static inline int cvmx_helper_get_ipd_port(int interface, int port)
-{
-	return 0;
-}
-
-static inline int cvmx_helper_ipd_and_packet_input_enable(void)
-{
-	return 0;
-}
-
-static inline void cvmx_ipd_disable(void)
-{ }
-
-static inline void cvmx_ipd_free_ptr(void)
-{ }
-
-static inline void cvmx_pko_disable(void)
-{ }
-
-static inline void cvmx_pko_shutdown(void)
-{ }
-
-static inline int cvmx_pko_get_base_queue_per_core(int port, int core)
-{
-	return port;
-}
-
-static inline int cvmx_pko_get_base_queue(int port)
-{
-	return port;
-}
-
-static inline int cvmx_pko_get_num_queues(int port)
-{
-	return port;
-}
-
-static inline unsigned int cvmx_get_core_num(void)
-{
-	return 0;
-}
-
-static inline void cvmx_pow_work_request_async_nocheck(int scr_addr,
-						       cvmx_pow_wait_t wait)
-{ }
-
-static inline void cvmx_pow_work_request_async(int scr_addr,
-						       cvmx_pow_wait_t wait)
-{ }
-
-static inline struct cvmx_wqe *cvmx_pow_work_response_async(int scr_addr)
-{
-	struct cvmx_wqe *wqe = (void *)(unsigned long)scr_addr;
-
-	return wqe;
-}
-
-static inline struct cvmx_wqe *cvmx_pow_work_request_sync(cvmx_pow_wait_t wait)
-{
-	return (void *)(unsigned long)wait;
-}
-
-static inline int cvmx_spi_restart_interface(int interface,
-					cvmx_spi_mode_t mode, int timeout)
-{
-	return 0;
-}
-
-static inline void cvmx_fau_async_fetch_and_add32(uint64_t scraddr,
-						  enum cvmx_fau_reg_32 reg,
-						  int32_t value)
-{ }
-
-static inline union cvmx_gmxx_rxx_rx_inbnd cvmx_spi4000_check_speed(
-	int interface,
-	int port)
-{
-	union cvmx_gmxx_rxx_rx_inbnd r;
-
-	r.u64 = 0;
-	return r;
-}
-
-static inline void cvmx_pko_send_packet_prepare(uint64_t port, uint64_t queue,
-						cvmx_pko_lock_t use_locking)
-{ }
-
-static inline cvmx_pko_status_t cvmx_pko_send_packet_finish(uint64_t port,
-		uint64_t queue, union cvmx_pko_command_word0 pko_command,
-		union cvmx_buf_ptr packet, cvmx_pko_lock_t use_locking)
-{
-	return 0;
-}
-
-static inline void cvmx_wqe_set_port(struct cvmx_wqe *work, int port)
-{ }
-
-static inline void cvmx_wqe_set_qos(struct cvmx_wqe *work, int qos)
-{ }
-
-static inline int cvmx_wqe_get_qos(struct cvmx_wqe *work)
-{
-	return 0;
-}
-
-static inline void cvmx_wqe_set_grp(struct cvmx_wqe *work, int grp)
-{ }
-
-static inline void cvmx_pow_work_submit(struct cvmx_wqe *wqp, uint32_t tag,
-					enum cvmx_pow_tag_type tag_type,
-					uint64_t qos, uint64_t grp)
-{ }
-
-#define CVMX_ASXX_RX_CLK_SETX(a, b)	((a)+(b))
-#define CVMX_ASXX_TX_CLK_SETX(a, b)	((a)+(b))
-#define CVMX_CIU_TIMX(a)		(a)
-#define CVMX_GMXX_RXX_ADR_CAM0(a, b)	((a)+(b))
-#define CVMX_GMXX_RXX_ADR_CAM1(a, b)	((a)+(b))
-#define CVMX_GMXX_RXX_ADR_CAM2(a, b)	((a)+(b))
-#define CVMX_GMXX_RXX_ADR_CAM3(a, b)	((a)+(b))
-#define CVMX_GMXX_RXX_ADR_CAM4(a, b)	((a)+(b))
-#define CVMX_GMXX_RXX_ADR_CAM5(a, b)	((a)+(b))
-#define CVMX_GMXX_RXX_FRM_CTL(a, b)	((a)+(b))
-#define CVMX_GMXX_RXX_INT_REG(a, b)	((a)+(b))
-#define CVMX_GMXX_SMACX(a, b)		((a)+(b))
-#define CVMX_PIP_PRT_TAGX(a)		(a)
-#define CVMX_POW_PP_GRP_MSKX(a)		(a)
-#define CVMX_POW_WQ_INT_THRX(a)		(a)
-#define CVMX_SPXX_INT_MSK(a)		(a)
-#define CVMX_SPXX_INT_REG(a)		(a)
-#define CVMX_SSO_PPX_GRP_MSK(a)		(a)
-#define CVMX_SSO_WQ_INT_THRX(a)		(a)
-#define CVMX_STXX_INT_MSK(a)		(a)
-#define CVMX_STXX_INT_REG(a)		(a)
-- 
2.24.0


^ permalink raw reply related	[flat|nested] 59+ messages in thread

* [PATCH 1/2] staging: octeon: delete driver
@ 2019-12-10  9:15 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 59+ messages in thread
From: Greg Kroah-Hartman @ 2019-12-10  9:15 UTC (permalink / raw)
  To: devel
  Cc: Branden Bonaby, Giovanni Gherdovich, Florian Westphal,
	Paul Burton, Aaro Koskinen, Greg Kroah-Hartman, YueHaibing,
	linux-kernel, Matthew Wilcox (Oracle),
	David Daney, Julia Lawall, Sandro Volery, Geert Uytterhoeven,
	Dan Carpenter, Valery Ivanov, Petr Štetiar, David S. Miller,
	Guenter Roeck, Wambui Karuga

This driver has been in the tree since 2009 with no real movement to get
it out.  Now it is starting to cause build issues and other problems for
people who want to fix coding style problems, but can not actually build
it.

As nothing is happening here, just delete the module entirely.

Reported-by: Guenter Roeck <linux@roeck-us.net>
Cc: David Daney <ddaney@caviumnetworks.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: YueHaibing <yuehaibing@huawei.com>
Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: Wambui Karuga <wambui.karugax@gmail.com>
Cc: Julia Lawall <julia.lawall@lip6.fr>
Cc: Florian Westphal <fw@strlen.de>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Branden Bonaby <brandonbonaby94@gmail.com>
Cc: "Petr Štetiar" <ynezz@true.cz>
Cc: Sandro Volery <sandro@volery.com>
Cc: Paul Burton <paulburton@kernel.org>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Giovanni Gherdovich <bobdc9664@seznam.cz>
Cc: Valery Ivanov <ivalery111@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/staging/Kconfig                   |    2 -
 drivers/staging/Makefile                  |    1 -
 drivers/staging/octeon/Kconfig            |   16 -
 drivers/staging/octeon/Makefile           |   19 -
 drivers/staging/octeon/TODO               |    9 -
 drivers/staging/octeon/ethernet-defines.h |   40 -
 drivers/staging/octeon/ethernet-mdio.c    |  178 ---
 drivers/staging/octeon/ethernet-mdio.h    |   28 -
 drivers/staging/octeon/ethernet-mem.c     |  154 ---
 drivers/staging/octeon/ethernet-mem.h     |    9 -
 drivers/staging/octeon/ethernet-rgmii.c   |  158 ---
 drivers/staging/octeon/ethernet-rx.c      |  538 --------
 drivers/staging/octeon/ethernet-rx.h      |   31 -
 drivers/staging/octeon/ethernet-sgmii.c   |   30 -
 drivers/staging/octeon/ethernet-spi.c     |  226 ----
 drivers/staging/octeon/ethernet-tx.c      |  717 -----------
 drivers/staging/octeon/ethernet-tx.h      |   14 -
 drivers/staging/octeon/ethernet-util.h    |   47 -
 drivers/staging/octeon/ethernet.c         |  992 --------------
 drivers/staging/octeon/octeon-ethernet.h  |  107 --
 drivers/staging/octeon/octeon-stubs.h     | 1433 ---------------------
 21 files changed, 4749 deletions(-)
 delete mode 100644 drivers/staging/octeon/Kconfig
 delete mode 100644 drivers/staging/octeon/Makefile
 delete mode 100644 drivers/staging/octeon/TODO
 delete mode 100644 drivers/staging/octeon/ethernet-defines.h
 delete mode 100644 drivers/staging/octeon/ethernet-mdio.c
 delete mode 100644 drivers/staging/octeon/ethernet-mdio.h
 delete mode 100644 drivers/staging/octeon/ethernet-mem.c
 delete mode 100644 drivers/staging/octeon/ethernet-mem.h
 delete mode 100644 drivers/staging/octeon/ethernet-rgmii.c
 delete mode 100644 drivers/staging/octeon/ethernet-rx.c
 delete mode 100644 drivers/staging/octeon/ethernet-rx.h
 delete mode 100644 drivers/staging/octeon/ethernet-sgmii.c
 delete mode 100644 drivers/staging/octeon/ethernet-spi.c
 delete mode 100644 drivers/staging/octeon/ethernet-tx.c
 delete mode 100644 drivers/staging/octeon/ethernet-tx.h
 delete mode 100644 drivers/staging/octeon/ethernet-util.h
 delete mode 100644 drivers/staging/octeon/ethernet.c
 delete mode 100644 drivers/staging/octeon/octeon-ethernet.h
 delete mode 100644 drivers/staging/octeon/octeon-stubs.h

diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
index eaf753b70ec5..15d3549e7cc7 100644
--- a/drivers/staging/Kconfig
+++ b/drivers/staging/Kconfig
@@ -42,8 +42,6 @@ source "drivers/staging/rtl8188eu/Kconfig"
 
 source "drivers/staging/rts5208/Kconfig"
 
-source "drivers/staging/octeon/Kconfig"
-
 source "drivers/staging/octeon-usb/Kconfig"
 
 source "drivers/staging/vt6655/Kconfig"
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
index 0a4396c9067b..c521204220b5 100644
--- a/drivers/staging/Makefile
+++ b/drivers/staging/Makefile
@@ -12,7 +12,6 @@ obj-$(CONFIG_R8712U)		+= rtl8712/
 obj-$(CONFIG_R8188EU)		+= rtl8188eu/
 obj-$(CONFIG_RTS5208)		+= rts5208/
 obj-$(CONFIG_NETLOGIC_XLR_NET)	+= netlogic/
-obj-$(CONFIG_OCTEON_ETHERNET)	+= octeon/
 obj-$(CONFIG_OCTEON_USB)	+= octeon-usb/
 obj-$(CONFIG_VT6655)		+= vt6655/
 obj-$(CONFIG_VT6656)		+= vt6656/
diff --git a/drivers/staging/octeon/Kconfig b/drivers/staging/octeon/Kconfig
deleted file mode 100644
index e7f4ddcc1361..000000000000
--- a/drivers/staging/octeon/Kconfig
+++ /dev/null
@@ -1,16 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-config OCTEON_ETHERNET
-	tristate "Cavium Networks Octeon Ethernet support"
-	depends on CAVIUM_OCTEON_SOC || COMPILE_TEST
-	depends on NETDEVICES
-	depends on BROKEN
-	select PHYLIB
-	select MDIO_OCTEON
-	help
-	  This driver supports the builtin ethernet ports on Cavium
-	  Networks' products in the Octeon family. This driver supports the
-	  CN3XXX and CN5XXX Octeon processors.
-
-	  To compile this driver as a module, choose M here.  The module
-	  will be called octeon-ethernet.
-
diff --git a/drivers/staging/octeon/Makefile b/drivers/staging/octeon/Makefile
deleted file mode 100644
index 3887cf5f1e84..000000000000
--- a/drivers/staging/octeon/Makefile
+++ /dev/null
@@ -1,19 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-#
-# Copyright (C) 2005-2009 Cavium Networks
-#
-
-#
-# Makefile for Cavium OCTEON on-board ethernet driver
-#
-
-obj-${CONFIG_OCTEON_ETHERNET} :=  octeon-ethernet.o
-
-octeon-ethernet-y := ethernet.o
-octeon-ethernet-y += ethernet-mdio.o
-octeon-ethernet-y += ethernet-mem.o
-octeon-ethernet-y += ethernet-rgmii.o
-octeon-ethernet-y += ethernet-rx.o
-octeon-ethernet-y += ethernet-sgmii.o
-octeon-ethernet-y += ethernet-spi.o
-octeon-ethernet-y += ethernet-tx.o
diff --git a/drivers/staging/octeon/TODO b/drivers/staging/octeon/TODO
deleted file mode 100644
index 67a0a1f6b922..000000000000
--- a/drivers/staging/octeon/TODO
+++ /dev/null
@@ -1,9 +0,0 @@
-This driver is functional and supports Ethernet on OCTEON+/OCTEON2/OCTEON3
-chips at least up to CN7030.
-
-TODO:
-	- general code review and clean up
-	- make driver self-contained instead of being split between staging and
-	  arch/mips/cavium-octeon.
-
-Contact: Aaro Koskinen <aaro.koskinen@iki.fi>
diff --git a/drivers/staging/octeon/ethernet-defines.h b/drivers/staging/octeon/ethernet-defines.h
deleted file mode 100644
index ef9e767b0e2e..000000000000
--- a/drivers/staging/octeon/ethernet-defines.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * This file is based on code from OCTEON SDK by Cavium Networks.
- *
- * Copyright (c) 2003-2007 Cavium Networks
- */
-
-/*
- * A few defines are used to control the operation of this driver:
- *  USE_ASYNC_IOBDMA
- *      Use asynchronous IO access to hardware. This uses Octeon's asynchronous
- *      IOBDMAs to issue IO accesses without stalling. Set this to zero
- *      to disable this. Note that IOBDMAs require CVMSEG.
- *  REUSE_SKBUFFS_WITHOUT_FREE
- *      Allows the TX path to free an skbuff into the FPA hardware pool. This
- *      can significantly improve performance for forwarding and bridging, but
- *      may be somewhat dangerous. Checks are made, but if any buffer is reused
- *      without the proper Linux cleanup, the networking stack may have very
- *      bizarre bugs.
- */
-#ifndef __ETHERNET_DEFINES_H__
-#define __ETHERNET_DEFINES_H__
-
-#ifdef CONFIG_NETFILTER
-#define REUSE_SKBUFFS_WITHOUT_FREE  0
-#else
-#define REUSE_SKBUFFS_WITHOUT_FREE  1
-#endif
-
-#define USE_ASYNC_IOBDMA            (CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE > 0)
-
-/* Maximum number of SKBs to try to free per xmit packet. */
-#define MAX_OUT_QUEUE_DEPTH 1000
-
-#define FAU_TOTAL_TX_TO_CLEAN (CVMX_FAU_REG_END - sizeof(u32))
-#define FAU_NUM_PACKET_BUFFERS_TO_FREE (FAU_TOTAL_TX_TO_CLEAN - sizeof(u32))
-
-#define TOTAL_NUMBER_OF_PORTS       (CVMX_PIP_NUM_INPUT_PORTS + 1)
-
-#endif /* __ETHERNET_DEFINES_H__ */
diff --git a/drivers/staging/octeon/ethernet-mdio.c b/drivers/staging/octeon/ethernet-mdio.c
deleted file mode 100644
index c798672d61b2..000000000000
--- a/drivers/staging/octeon/ethernet-mdio.c
+++ /dev/null
@@ -1,178 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * This file is based on code from OCTEON SDK by Cavium Networks.
- *
- * Copyright (c) 2003-2007 Cavium Networks
- */
-
-#include <linux/kernel.h>
-#include <linux/ethtool.h>
-#include <linux/phy.h>
-#include <linux/ratelimit.h>
-#include <linux/of_mdio.h>
-#include <generated/utsrelease.h>
-#include <net/dst.h>
-
-#include "octeon-ethernet.h"
-#include "ethernet-defines.h"
-#include "ethernet-mdio.h"
-#include "ethernet-util.h"
-
-static void cvm_oct_get_drvinfo(struct net_device *dev,
-				struct ethtool_drvinfo *info)
-{
-	strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver));
-	strlcpy(info->version, UTS_RELEASE, sizeof(info->version));
-	strlcpy(info->bus_info, "Builtin", sizeof(info->bus_info));
-}
-
-static int cvm_oct_nway_reset(struct net_device *dev)
-{
-	if (!capable(CAP_NET_ADMIN))
-		return -EPERM;
-
-	if (dev->phydev)
-		return phy_start_aneg(dev->phydev);
-
-	return -EINVAL;
-}
-
-const struct ethtool_ops cvm_oct_ethtool_ops = {
-	.get_drvinfo = cvm_oct_get_drvinfo,
-	.nway_reset = cvm_oct_nway_reset,
-	.get_link = ethtool_op_get_link,
-	.get_link_ksettings = phy_ethtool_get_link_ksettings,
-	.set_link_ksettings = phy_ethtool_set_link_ksettings,
-};
-
-/**
- * cvm_oct_ioctl - IOCTL support for PHY control
- * @dev:    Device to change
- * @rq:     the request
- * @cmd:    the command
- *
- * Returns Zero on success
- */
-int cvm_oct_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
-{
-	if (!netif_running(dev))
-		return -EINVAL;
-
-	if (!dev->phydev)
-		return -EINVAL;
-
-	return phy_mii_ioctl(dev->phydev, rq, cmd);
-}
-
-void cvm_oct_note_carrier(struct octeon_ethernet *priv,
-			  union cvmx_helper_link_info li)
-{
-	if (li.s.link_up) {
-		pr_notice_ratelimited("%s: %u Mbps %s duplex, port %d, queue %d\n",
-				      netdev_name(priv->netdev), li.s.speed,
-				      (li.s.full_duplex) ? "Full" : "Half",
-				      priv->port, priv->queue);
-	} else {
-		pr_notice_ratelimited("%s: Link down\n",
-				      netdev_name(priv->netdev));
-	}
-}
-
-void cvm_oct_adjust_link(struct net_device *dev)
-{
-	struct octeon_ethernet *priv = netdev_priv(dev);
-	union cvmx_helper_link_info link_info;
-
-	link_info.u64		= 0;
-	link_info.s.link_up	= dev->phydev->link ? 1 : 0;
-	link_info.s.full_duplex = dev->phydev->duplex ? 1 : 0;
-	link_info.s.speed	= dev->phydev->speed;
-	priv->link_info		= link_info.u64;
-
-	/*
-	 * The polling task need to know about link status changes.
-	 */
-	if (priv->poll)
-		priv->poll(dev);
-
-	if (priv->last_link != dev->phydev->link) {
-		priv->last_link = dev->phydev->link;
-		cvmx_helper_link_set(priv->port, link_info);
-		cvm_oct_note_carrier(priv, link_info);
-	}
-}
-
-int cvm_oct_common_stop(struct net_device *dev)
-{
-	struct octeon_ethernet *priv = netdev_priv(dev);
-	int interface = INTERFACE(priv->port);
-	union cvmx_helper_link_info link_info;
-	union cvmx_gmxx_prtx_cfg gmx_cfg;
-	int index = INDEX(priv->port);
-
-	gmx_cfg.u64 = cvmx_read_csr(CVMX_GMXX_PRTX_CFG(index, interface));
-	gmx_cfg.s.en = 0;
-	cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface), gmx_cfg.u64);
-
-	priv->poll = NULL;
-
-	if (dev->phydev)
-		phy_disconnect(dev->phydev);
-
-	if (priv->last_link) {
-		link_info.u64 = 0;
-		priv->last_link = 0;
-
-		cvmx_helper_link_set(priv->port, link_info);
-		cvm_oct_note_carrier(priv, link_info);
-	}
-	return 0;
-}
-
-/**
- * cvm_oct_phy_setup_device - setup the PHY
- *
- * @dev:    Device to setup
- *
- * Returns Zero on success, negative on failure
- */
-int cvm_oct_phy_setup_device(struct net_device *dev)
-{
-	struct octeon_ethernet *priv = netdev_priv(dev);
-	struct device_node *phy_node;
-	struct phy_device *phydev = NULL;
-
-	if (!priv->of_node)
-		goto no_phy;
-
-	phy_node = of_parse_phandle(priv->of_node, "phy-handle", 0);
-	if (!phy_node && of_phy_is_fixed_link(priv->of_node)) {
-		int rc;
-
-		rc = of_phy_register_fixed_link(priv->of_node);
-		if (rc)
-			return rc;
-
-		phy_node = of_node_get(priv->of_node);
-	}
-	if (!phy_node)
-		goto no_phy;
-
-	phydev = of_phy_connect(dev, phy_node, cvm_oct_adjust_link, 0,
-				priv->phy_mode);
-	of_node_put(phy_node);
-
-	if (!phydev)
-		return -ENODEV;
-
-	priv->last_link = 0;
-	phy_start(phydev);
-
-	return 0;
-no_phy:
-	/* If there is no phy, assume a direct MAC connection and that
-	 * the link is up.
-	 */
-	netif_carrier_on(dev);
-	return 0;
-}
diff --git a/drivers/staging/octeon/ethernet-mdio.h b/drivers/staging/octeon/ethernet-mdio.h
deleted file mode 100644
index e3771d48c49b..000000000000
--- a/drivers/staging/octeon/ethernet-mdio.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * This file is based on code from OCTEON SDK by Cavium Networks.
- *
- * Copyright (c) 2003-2007 Cavium Networks
- */
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-#include <linux/ip.h>
-#include <linux/string.h>
-#include <linux/ethtool.h>
-#include <linux/seq_file.h>
-#include <linux/proc_fs.h>
-#include <net/dst.h>
-#ifdef CONFIG_XFRM
-#include <linux/xfrm.h>
-#include <net/xfrm.h>
-#endif /* CONFIG_XFRM */
-
-extern const struct ethtool_ops cvm_oct_ethtool_ops;
-
-void octeon_mdiobus_force_mod_depencency(void);
-
-int cvm_oct_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
-int cvm_oct_phy_setup_device(struct net_device *dev);
diff --git a/drivers/staging/octeon/ethernet-mem.c b/drivers/staging/octeon/ethernet-mem.c
deleted file mode 100644
index 532594957ebc..000000000000
--- a/drivers/staging/octeon/ethernet-mem.c
+++ /dev/null
@@ -1,154 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * This file is based on code from OCTEON SDK by Cavium Networks.
- *
- * Copyright (c) 2003-2010 Cavium Networks
- */
-
-#include <linux/kernel.h>
-#include <linux/netdevice.h>
-#include <linux/slab.h>
-
-#include "octeon-ethernet.h"
-#include "ethernet-mem.h"
-#include "ethernet-defines.h"
-
-/**
- * cvm_oct_fill_hw_skbuff - fill the supplied hardware pool with skbuffs
- * @pool:     Pool to allocate an skbuff for
- * @size:     Size of the buffer needed for the pool
- * @elements: Number of buffers to allocate
- *
- * Returns the actual number of buffers allocated.
- */
-static int cvm_oct_fill_hw_skbuff(int pool, int size, int elements)
-{
-	int freed = elements;
-
-	while (freed) {
-		struct sk_buff *skb = dev_alloc_skb(size + 256);
-
-		if (unlikely(!skb))
-			break;
-		skb_reserve(skb, 256 - (((unsigned long)skb->data) & 0x7f));
-		*(struct sk_buff **)(skb->data - sizeof(void *)) = skb;
-		cvmx_fpa_free(skb->data, pool, size / 128);
-		freed--;
-	}
-	return elements - freed;
-}
-
-/**
- * cvm_oct_free_hw_skbuff- free hardware pool skbuffs
- * @pool:     Pool to allocate an skbuff for
- * @size:     Size of the buffer needed for the pool
- * @elements: Number of buffers to allocate
- */
-static void cvm_oct_free_hw_skbuff(int pool, int size, int elements)
-{
-	char *memory;
-
-	do {
-		memory = cvmx_fpa_alloc(pool);
-		if (memory) {
-			struct sk_buff *skb =
-			    *(struct sk_buff **)(memory - sizeof(void *));
-			elements--;
-			dev_kfree_skb(skb);
-		}
-	} while (memory);
-
-	if (elements < 0)
-		pr_warn("Freeing of pool %u had too many skbuffs (%d)\n",
-			pool, elements);
-	else if (elements > 0)
-		pr_warn("Freeing of pool %u is missing %d skbuffs\n",
-			pool, elements);
-}
-
-/**
- * cvm_oct_fill_hw_memory - fill a hardware pool with memory.
- * @pool:     Pool to populate
- * @size:     Size of each buffer in the pool
- * @elements: Number of buffers to allocate
- *
- * Returns the actual number of buffers allocated.
- */
-static int cvm_oct_fill_hw_memory(int pool, int size, int elements)
-{
-	char *memory;
-	char *fpa;
-	int freed = elements;
-
-	while (freed) {
-		/*
-		 * FPA memory must be 128 byte aligned.  Since we are
-		 * aligning we need to save the original pointer so we
-		 * can feed it to kfree when the memory is returned to
-		 * the kernel.
-		 *
-		 * We allocate an extra 256 bytes to allow for
-		 * alignment and space for the original pointer saved
-		 * just before the block.
-		 */
-		memory = kmalloc(size + 256, GFP_ATOMIC);
-		if (unlikely(!memory)) {
-			pr_warn("Unable to allocate %u bytes for FPA pool %d\n",
-				elements * size, pool);
-			break;
-		}
-		fpa = (char *)(((unsigned long)memory + 256) & ~0x7fUL);
-		*((char **)fpa - 1) = memory;
-		cvmx_fpa_free(fpa, pool, 0);
-		freed--;
-	}
-	return elements - freed;
-}
-
-/**
- * cvm_oct_free_hw_memory - Free memory allocated by cvm_oct_fill_hw_memory
- * @pool:     FPA pool to free
- * @size:     Size of each buffer in the pool
- * @elements: Number of buffers that should be in the pool
- */
-static void cvm_oct_free_hw_memory(int pool, int size, int elements)
-{
-	char *memory;
-	char *fpa;
-
-	do {
-		fpa = cvmx_fpa_alloc(pool);
-		if (fpa) {
-			elements--;
-			fpa = (char *)phys_to_virt(cvmx_ptr_to_phys(fpa));
-			memory = *((char **)fpa - 1);
-			kfree(memory);
-		}
-	} while (fpa);
-
-	if (elements < 0)
-		pr_warn("Freeing of pool %u had too many buffers (%d)\n",
-			pool, elements);
-	else if (elements > 0)
-		pr_warn("Warning: Freeing of pool %u is missing %d buffers\n",
-			pool, elements);
-}
-
-int cvm_oct_mem_fill_fpa(int pool, int size, int elements)
-{
-	int freed;
-
-	if (pool == CVMX_FPA_PACKET_POOL)
-		freed = cvm_oct_fill_hw_skbuff(pool, size, elements);
-	else
-		freed = cvm_oct_fill_hw_memory(pool, size, elements);
-	return freed;
-}
-
-void cvm_oct_mem_empty_fpa(int pool, int size, int elements)
-{
-	if (pool == CVMX_FPA_PACKET_POOL)
-		cvm_oct_free_hw_skbuff(pool, size, elements);
-	else
-		cvm_oct_free_hw_memory(pool, size, elements);
-}
diff --git a/drivers/staging/octeon/ethernet-mem.h b/drivers/staging/octeon/ethernet-mem.h
deleted file mode 100644
index 692dcdb7154d..000000000000
--- a/drivers/staging/octeon/ethernet-mem.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * This file is based on code from OCTEON SDK by Cavium Networks.
- *
- * Copyright (c) 2003-2007 Cavium Networks
- */
-
-int cvm_oct_mem_fill_fpa(int pool, int size, int elements);
-void cvm_oct_mem_empty_fpa(int pool, int size, int elements);
diff --git a/drivers/staging/octeon/ethernet-rgmii.c b/drivers/staging/octeon/ethernet-rgmii.c
deleted file mode 100644
index 0c4fac31540a..000000000000
--- a/drivers/staging/octeon/ethernet-rgmii.c
+++ /dev/null
@@ -1,158 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * This file is based on code from OCTEON SDK by Cavium Networks.
- *
- * Copyright (c) 2003-2007 Cavium Networks
- */
-
-#include <linux/kernel.h>
-#include <linux/netdevice.h>
-#include <linux/interrupt.h>
-#include <linux/phy.h>
-#include <linux/ratelimit.h>
-#include <net/dst.h>
-
-#include "octeon-ethernet.h"
-#include "ethernet-defines.h"
-#include "ethernet-util.h"
-#include "ethernet-mdio.h"
-
-static DEFINE_SPINLOCK(global_register_lock);
-
-static void cvm_oct_set_hw_preamble(struct octeon_ethernet *priv, bool enable)
-{
-	union cvmx_gmxx_rxx_frm_ctl gmxx_rxx_frm_ctl;
-	union cvmx_ipd_sub_port_fcs ipd_sub_port_fcs;
-	union cvmx_gmxx_rxx_int_reg gmxx_rxx_int_reg;
-	int interface = INTERFACE(priv->port);
-	int index = INDEX(priv->port);
-
-	/* Set preamble checking. */
-	gmxx_rxx_frm_ctl.u64 = cvmx_read_csr(CVMX_GMXX_RXX_FRM_CTL(index,
-								   interface));
-	gmxx_rxx_frm_ctl.s.pre_chk = enable;
-	cvmx_write_csr(CVMX_GMXX_RXX_FRM_CTL(index, interface),
-		       gmxx_rxx_frm_ctl.u64);
-
-	/* Set FCS stripping. */
-	ipd_sub_port_fcs.u64 = cvmx_read_csr(CVMX_IPD_SUB_PORT_FCS);
-	if (enable)
-		ipd_sub_port_fcs.s.port_bit |= 1ull << priv->port;
-	else
-		ipd_sub_port_fcs.s.port_bit &=
-					0xffffffffull ^ (1ull << priv->port);
-	cvmx_write_csr(CVMX_IPD_SUB_PORT_FCS, ipd_sub_port_fcs.u64);
-
-	/* Clear any error bits. */
-	gmxx_rxx_int_reg.u64 = cvmx_read_csr(CVMX_GMXX_RXX_INT_REG(index,
-								   interface));
-	cvmx_write_csr(CVMX_GMXX_RXX_INT_REG(index, interface),
-		       gmxx_rxx_int_reg.u64);
-}
-
-static void cvm_oct_check_preamble_errors(struct net_device *dev)
-{
-	struct octeon_ethernet *priv = netdev_priv(dev);
-	union cvmx_helper_link_info link_info;
-	unsigned long flags;
-
-	link_info.u64 = priv->link_info;
-
-	/*
-	 * Take the global register lock since we are going to
-	 * touch registers that affect more than one port.
-	 */
-	spin_lock_irqsave(&global_register_lock, flags);
-
-	if (link_info.s.speed == 10 && priv->last_speed == 10) {
-		/*
-		 * Read the GMXX_RXX_INT_REG[PCTERR] bit and see if we are
-		 * getting preamble errors.
-		 */
-		int interface = INTERFACE(priv->port);
-		int index = INDEX(priv->port);
-		union cvmx_gmxx_rxx_int_reg gmxx_rxx_int_reg;
-
-		gmxx_rxx_int_reg.u64 = cvmx_read_csr(CVMX_GMXX_RXX_INT_REG
-							(index, interface));
-		if (gmxx_rxx_int_reg.s.pcterr) {
-			/*
-			 * We are getting preamble errors at 10Mbps. Most
-			 * likely the PHY is giving us packets with misaligned
-			 * preambles. In order to get these packets we need to
-			 * disable preamble checking and do it in software.
-			 */
-			cvm_oct_set_hw_preamble(priv, false);
-			printk_ratelimited("%s: Using 10Mbps with software preamble removal\n",
-					   dev->name);
-		}
-	} else {
-		/*
-		 * Since the 10Mbps preamble workaround is allowed we need to
-		 * enable preamble checking, FCS stripping, and clear error
-		 * bits on every speed change. If errors occur during 10Mbps
-		 * operation the above code will change this stuff
-		 */
-		if (priv->last_speed != link_info.s.speed)
-			cvm_oct_set_hw_preamble(priv, true);
-		priv->last_speed = link_info.s.speed;
-	}
-	spin_unlock_irqrestore(&global_register_lock, flags);
-}
-
-static void cvm_oct_rgmii_poll(struct net_device *dev)
-{
-	struct octeon_ethernet *priv = netdev_priv(dev);
-	union cvmx_helper_link_info link_info;
-	bool status_change;
-
-	link_info = cvmx_helper_link_get(priv->port);
-	if (priv->link_info != link_info.u64 &&
-	    cvmx_helper_link_set(priv->port, link_info))
-		link_info.u64 = priv->link_info;
-	status_change = priv->link_info != link_info.u64;
-	priv->link_info = link_info.u64;
-
-	cvm_oct_check_preamble_errors(dev);
-
-	if (likely(!status_change))
-		return;
-
-	/* Tell core. */
-	if (link_info.s.link_up) {
-		if (!netif_carrier_ok(dev))
-			netif_carrier_on(dev);
-	} else if (netif_carrier_ok(dev)) {
-		netif_carrier_off(dev);
-	}
-	cvm_oct_note_carrier(priv, link_info);
-}
-
-int cvm_oct_rgmii_open(struct net_device *dev)
-{
-	struct octeon_ethernet *priv = netdev_priv(dev);
-	int ret;
-
-	ret = cvm_oct_common_open(dev, cvm_oct_rgmii_poll);
-	if (ret)
-		return ret;
-
-	if (dev->phydev) {
-		/*
-		 * In phydev mode, we need still periodic polling for the
-		 * preamble error checking, and we also need to call this
-		 * function on every link state change.
-		 *
-		 * Only true RGMII ports need to be polled. In GMII mode, port
-		 * 0 is really a RGMII port.
-		 */
-		if ((priv->imode == CVMX_HELPER_INTERFACE_MODE_GMII &&
-		     priv->port  == 0) ||
-		    (priv->imode == CVMX_HELPER_INTERFACE_MODE_RGMII)) {
-			priv->poll = cvm_oct_check_preamble_errors;
-			cvm_oct_check_preamble_errors(dev);
-		}
-	}
-
-	return 0;
-}
diff --git a/drivers/staging/octeon/ethernet-rx.c b/drivers/staging/octeon/ethernet-rx.c
deleted file mode 100644
index 2c16230f993c..000000000000
--- a/drivers/staging/octeon/ethernet-rx.c
+++ /dev/null
@@ -1,538 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * This file is based on code from OCTEON SDK by Cavium Networks.
- *
- * Copyright (c) 2003-2010 Cavium Networks
- */
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/cache.h>
-#include <linux/cpumask.h>
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-#include <linux/ip.h>
-#include <linux/string.h>
-#include <linux/prefetch.h>
-#include <linux/ratelimit.h>
-#include <linux/smp.h>
-#include <linux/interrupt.h>
-#include <net/dst.h>
-#ifdef CONFIG_XFRM
-#include <linux/xfrm.h>
-#include <net/xfrm.h>
-#endif /* CONFIG_XFRM */
-
-#include "octeon-ethernet.h"
-#include "ethernet-defines.h"
-#include "ethernet-mem.h"
-#include "ethernet-rx.h"
-#include "ethernet-util.h"
-
-static atomic_t oct_rx_ready = ATOMIC_INIT(0);
-
-static struct oct_rx_group {
-	int irq;
-	int group;
-	struct napi_struct napi;
-} oct_rx_group[16];
-
-/**
- * cvm_oct_do_interrupt - interrupt handler.
- * @irq: Interrupt number.
- * @napi_id: Cookie to identify the NAPI instance.
- *
- * The interrupt occurs whenever the POW has packets in our group.
- *
- */
-static irqreturn_t cvm_oct_do_interrupt(int irq, void *napi_id)
-{
-	/* Disable the IRQ and start napi_poll. */
-	disable_irq_nosync(irq);
-	napi_schedule(napi_id);
-
-	return IRQ_HANDLED;
-}
-
-/**
- * cvm_oct_check_rcv_error - process receive errors
- * @work: Work queue entry pointing to the packet.
- *
- * Returns Non-zero if the packet can be dropped, zero otherwise.
- */
-static inline int cvm_oct_check_rcv_error(struct cvmx_wqe *work)
-{
-	int port;
-
-	if (octeon_has_feature(OCTEON_FEATURE_PKND))
-		port = work->word0.pip.cn68xx.pknd;
-	else
-		port = work->word1.cn38xx.ipprt;
-
-	if ((work->word2.snoip.err_code == 10) && (work->word1.len <= 64)) {
-		/*
-		 * Ignore length errors on min size packets. Some
-		 * equipment incorrectly pads packets to 64+4FCS
-		 * instead of 60+4FCS.  Note these packets still get
-		 * counted as frame errors.
-		 */
-	} else if (work->word2.snoip.err_code == 5 ||
-		   work->word2.snoip.err_code == 7) {
-		/*
-		 * We received a packet with either an alignment error
-		 * or a FCS error. This may be signalling that we are
-		 * running 10Mbps with GMXX_RXX_FRM_CTL[PRE_CHK]
-		 * off. If this is the case we need to parse the
-		 * packet to determine if we can remove a non spec
-		 * preamble and generate a correct packet.
-		 */
-		int interface = cvmx_helper_get_interface_num(port);
-		int index = cvmx_helper_get_interface_index_num(port);
-		union cvmx_gmxx_rxx_frm_ctl gmxx_rxx_frm_ctl;
-
-		gmxx_rxx_frm_ctl.u64 =
-		    cvmx_read_csr(CVMX_GMXX_RXX_FRM_CTL(index, interface));
-		if (gmxx_rxx_frm_ctl.s.pre_chk == 0) {
-			u8 *ptr =
-			    cvmx_phys_to_ptr(work->packet_ptr.s.addr);
-			int i = 0;
-
-			while (i < work->word1.len - 1) {
-				if (*ptr != 0x55)
-					break;
-				ptr++;
-				i++;
-			}
-
-			if (*ptr == 0xd5) {
-				/* Port received 0xd5 preamble */
-				work->packet_ptr.s.addr += i + 1;
-				work->word1.len -= i + 5;
-			} else if ((*ptr & 0xf) == 0xd) {
-				/* Port received 0xd preamble */
-				work->packet_ptr.s.addr += i;
-				work->word1.len -= i + 4;
-				for (i = 0; i < work->word1.len; i++) {
-					*ptr =
-					    ((*ptr & 0xf0) >> 4) |
-					    ((*(ptr + 1) & 0xf) << 4);
-					ptr++;
-				}
-			} else {
-				printk_ratelimited("Port %d unknown preamble, packet dropped\n",
-						   port);
-				cvm_oct_free_work(work);
-				return 1;
-			}
-		}
-	} else {
-		printk_ratelimited("Port %d receive error code %d, packet dropped\n",
-				   port, work->word2.snoip.err_code);
-		cvm_oct_free_work(work);
-		return 1;
-	}
-
-	return 0;
-}
-
-static void copy_segments_to_skb(struct cvmx_wqe *work, struct sk_buff *skb)
-{
-	int segments = work->word2.s.bufs;
-	union cvmx_buf_ptr segment_ptr = work->packet_ptr;
-	int len = work->word1.len;
-	int segment_size;
-
-	while (segments--) {
-		union cvmx_buf_ptr next_ptr;
-
-		next_ptr = *(union cvmx_buf_ptr *)
-			cvmx_phys_to_ptr(segment_ptr.s.addr - 8);
-
-		/*
-		 * Octeon Errata PKI-100: The segment size is wrong.
-		 *
-		 * Until it is fixed, calculate the segment size based on
-		 * the packet pool buffer size.
-		 * When it is fixed, the following line should be replaced
-		 * with this one:
-		 * int segment_size = segment_ptr.s.size;
-		 */
-		segment_size =
-			CVMX_FPA_PACKET_POOL_SIZE -
-			(segment_ptr.s.addr -
-			 (((segment_ptr.s.addr >> 7) -
-			   segment_ptr.s.back) << 7));
-
-		/* Don't copy more than what is left in the packet */
-		if (segment_size > len)
-			segment_size = len;
-
-		/* Copy the data into the packet */
-		skb_put_data(skb, cvmx_phys_to_ptr(segment_ptr.s.addr),
-			     segment_size);
-		len -= segment_size;
-		segment_ptr = next_ptr;
-	}
-}
-
-static int cvm_oct_poll(struct oct_rx_group *rx_group, int budget)
-{
-	const int	coreid = cvmx_get_core_num();
-	u64	old_group_mask;
-	u64	old_scratch;
-	int		rx_count = 0;
-	int		did_work_request = 0;
-	int		packet_not_copied;
-
-	/* Prefetch cvm_oct_device since we know we need it soon */
-	prefetch(cvm_oct_device);
-
-	if (USE_ASYNC_IOBDMA) {
-		/* Save scratch in case userspace is using it */
-		CVMX_SYNCIOBDMA;
-		old_scratch = cvmx_scratch_read64(CVMX_SCR_SCRATCH);
-	}
-
-	/* Only allow work for our group (and preserve priorities) */
-	if (OCTEON_IS_MODEL(OCTEON_CN68XX)) {
-		old_group_mask = cvmx_read_csr(CVMX_SSO_PPX_GRP_MSK(coreid));
-		cvmx_write_csr(CVMX_SSO_PPX_GRP_MSK(coreid),
-			       BIT(rx_group->group));
-		cvmx_read_csr(CVMX_SSO_PPX_GRP_MSK(coreid)); /* Flush */
-	} else {
-		old_group_mask = cvmx_read_csr(CVMX_POW_PP_GRP_MSKX(coreid));
-		cvmx_write_csr(CVMX_POW_PP_GRP_MSKX(coreid),
-			       (old_group_mask & ~0xFFFFull) |
-			       BIT(rx_group->group));
-	}
-
-	if (USE_ASYNC_IOBDMA) {
-		cvmx_pow_work_request_async(CVMX_SCR_SCRATCH, CVMX_POW_NO_WAIT);
-		did_work_request = 1;
-	}
-
-	while (rx_count < budget) {
-		struct sk_buff *skb = NULL;
-		struct sk_buff **pskb = NULL;
-		int skb_in_hw;
-		struct cvmx_wqe *work;
-		int port;
-
-		if (USE_ASYNC_IOBDMA && did_work_request)
-			work = cvmx_pow_work_response_async(CVMX_SCR_SCRATCH);
-		else
-			work = cvmx_pow_work_request_sync(CVMX_POW_NO_WAIT);
-
-		prefetch(work);
-		did_work_request = 0;
-		if (!work) {
-			if (OCTEON_IS_MODEL(OCTEON_CN68XX)) {
-				cvmx_write_csr(CVMX_SSO_WQ_IQ_DIS,
-					       BIT(rx_group->group));
-				cvmx_write_csr(CVMX_SSO_WQ_INT,
-					       BIT(rx_group->group));
-			} else {
-				union cvmx_pow_wq_int wq_int;
-
-				wq_int.u64 = 0;
-				wq_int.s.iq_dis = BIT(rx_group->group);
-				wq_int.s.wq_int = BIT(rx_group->group);
-				cvmx_write_csr(CVMX_POW_WQ_INT, wq_int.u64);
-			}
-			break;
-		}
-		pskb = (struct sk_buff **)
-			(cvm_oct_get_buffer_ptr(work->packet_ptr) -
-			sizeof(void *));
-		prefetch(pskb);
-
-		if (USE_ASYNC_IOBDMA && rx_count < (budget - 1)) {
-			cvmx_pow_work_request_async_nocheck(CVMX_SCR_SCRATCH,
-							    CVMX_POW_NO_WAIT);
-			did_work_request = 1;
-		}
-		rx_count++;
-
-		skb_in_hw = work->word2.s.bufs == 1;
-		if (likely(skb_in_hw)) {
-			skb = *pskb;
-			prefetch(&skb->head);
-			prefetch(&skb->len);
-		}
-
-		if (octeon_has_feature(OCTEON_FEATURE_PKND))
-			port = work->word0.pip.cn68xx.pknd;
-		else
-			port = work->word1.cn38xx.ipprt;
-
-		prefetch(cvm_oct_device[port]);
-
-		/* Immediately throw away all packets with receive errors */
-		if (unlikely(work->word2.snoip.rcv_error)) {
-			if (cvm_oct_check_rcv_error(work))
-				continue;
-		}
-
-		/*
-		 * We can only use the zero copy path if skbuffs are
-		 * in the FPA pool and the packet fits in a single
-		 * buffer.
-		 */
-		if (likely(skb_in_hw)) {
-			skb->data = skb->head + work->packet_ptr.s.addr -
-				cvmx_ptr_to_phys(skb->head);
-			prefetch(skb->data);
-			skb->len = work->word1.len;
-			skb_set_tail_pointer(skb, skb->len);
-			packet_not_copied = 1;
-		} else {
-			/*
-			 * We have to copy the packet. First allocate
-			 * an skbuff for it.
-			 */
-			skb = dev_alloc_skb(work->word1.len);
-			if (!skb) {
-				cvm_oct_free_work(work);
-				continue;
-			}
-
-			/*
-			 * Check if we've received a packet that was
-			 * entirely stored in the work entry.
-			 */
-			if (unlikely(work->word2.s.bufs == 0)) {
-				u8 *ptr = work->packet_data;
-
-				if (likely(!work->word2.s.not_IP)) {
-					/*
-					 * The beginning of the packet
-					 * moves for IP packets.
-					 */
-					if (work->word2.s.is_v6)
-						ptr += 2;
-					else
-						ptr += 6;
-				}
-				skb_put_data(skb, ptr, work->word1.len);
-				/* No packet buffers to free */
-			} else {
-				copy_segments_to_skb(work, skb);
-			}
-			packet_not_copied = 0;
-		}
-		if (likely((port < TOTAL_NUMBER_OF_PORTS) &&
-			   cvm_oct_device[port])) {
-			struct net_device *dev = cvm_oct_device[port];
-
-			/*
-			 * Only accept packets for devices that are
-			 * currently up.
-			 */
-			if (likely(dev->flags & IFF_UP)) {
-				skb->protocol = eth_type_trans(skb, dev);
-				skb->dev = dev;
-
-				if (unlikely(work->word2.s.not_IP ||
-					     work->word2.s.IP_exc ||
-					     work->word2.s.L4_error ||
-					     !work->word2.s.tcp_or_udp))
-					skb->ip_summed = CHECKSUM_NONE;
-				else
-					skb->ip_summed = CHECKSUM_UNNECESSARY;
-
-				/* Increment RX stats for virtual ports */
-				if (port >= CVMX_PIP_NUM_INPUT_PORTS) {
-					dev->stats.rx_packets++;
-					dev->stats.rx_bytes += skb->len;
-				}
-				netif_receive_skb(skb);
-			} else {
-				/*
-				 * Drop any packet received for a device that
-				 * isn't up.
-				 */
-				dev->stats.rx_dropped++;
-				dev_kfree_skb_irq(skb);
-			}
-		} else {
-			/*
-			 * Drop any packet received for a device that
-			 * doesn't exist.
-			 */
-			printk_ratelimited("Port %d not controlled by Linux, packet dropped\n",
-					   port);
-			dev_kfree_skb_irq(skb);
-		}
-		/*
-		 * Check to see if the skbuff and work share the same
-		 * packet buffer.
-		 */
-		if (likely(packet_not_copied)) {
-			/*
-			 * This buffer needs to be replaced, increment
-			 * the number of buffers we need to free by
-			 * one.
-			 */
-			cvmx_fau_atomic_add32(FAU_NUM_PACKET_BUFFERS_TO_FREE,
-					      1);
-
-			cvmx_fpa_free(work, CVMX_FPA_WQE_POOL, 1);
-		} else {
-			cvm_oct_free_work(work);
-		}
-	}
-	/* Restore the original POW group mask */
-	if (OCTEON_IS_MODEL(OCTEON_CN68XX)) {
-		cvmx_write_csr(CVMX_SSO_PPX_GRP_MSK(coreid), old_group_mask);
-		cvmx_read_csr(CVMX_SSO_PPX_GRP_MSK(coreid)); /* Flush */
-	} else {
-		cvmx_write_csr(CVMX_POW_PP_GRP_MSKX(coreid), old_group_mask);
-	}
-
-	if (USE_ASYNC_IOBDMA) {
-		/* Restore the scratch area */
-		cvmx_scratch_write64(CVMX_SCR_SCRATCH, old_scratch);
-	}
-	cvm_oct_rx_refill_pool(0);
-
-	return rx_count;
-}
-
-/**
- * cvm_oct_napi_poll - the NAPI poll function.
- * @napi: The NAPI instance.
- * @budget: Maximum number of packets to receive.
- *
- * Returns the number of packets processed.
- */
-static int cvm_oct_napi_poll(struct napi_struct *napi, int budget)
-{
-	struct oct_rx_group *rx_group = container_of(napi, struct oct_rx_group,
-						     napi);
-	int rx_count;
-
-	rx_count = cvm_oct_poll(rx_group, budget);
-
-	if (rx_count < budget) {
-		/* No more work */
-		napi_complete_done(napi, rx_count);
-		enable_irq(rx_group->irq);
-	}
-	return rx_count;
-}
-
-#ifdef CONFIG_NET_POLL_CONTROLLER
-/**
- * cvm_oct_poll_controller - poll for receive packets
- * device.
- *
- * @dev:    Device to poll. Unused
- */
-void cvm_oct_poll_controller(struct net_device *dev)
-{
-	int i;
-
-	if (!atomic_read(&oct_rx_ready))
-		return;
-
-	for (i = 0; i < ARRAY_SIZE(oct_rx_group); i++) {
-		if (!(pow_receive_groups & BIT(i)))
-			continue;
-
-		cvm_oct_poll(&oct_rx_group[i], 16);
-	}
-}
-#endif
-
-void cvm_oct_rx_initialize(void)
-{
-	int i;
-	struct net_device *dev_for_napi = NULL;
-
-	for (i = 0; i < TOTAL_NUMBER_OF_PORTS; i++) {
-		if (cvm_oct_device[i]) {
-			dev_for_napi = cvm_oct_device[i];
-			break;
-		}
-	}
-
-	if (!dev_for_napi)
-		panic("No net_devices were allocated.");
-
-	for (i = 0; i < ARRAY_SIZE(oct_rx_group); i++) {
-		int ret;
-
-		if (!(pow_receive_groups & BIT(i)))
-			continue;
-
-		netif_napi_add(dev_for_napi, &oct_rx_group[i].napi,
-			       cvm_oct_napi_poll, rx_napi_weight);
-		napi_enable(&oct_rx_group[i].napi);
-
-		oct_rx_group[i].irq = OCTEON_IRQ_WORKQ0 + i;
-		oct_rx_group[i].group = i;
-
-		/* Register an IRQ handler to receive POW interrupts */
-		ret = request_irq(oct_rx_group[i].irq, cvm_oct_do_interrupt, 0,
-				  "Ethernet", &oct_rx_group[i].napi);
-		if (ret)
-			panic("Could not acquire Ethernet IRQ %d\n",
-			      oct_rx_group[i].irq);
-
-		disable_irq_nosync(oct_rx_group[i].irq);
-
-		/* Enable POW interrupt when our port has at least one packet */
-		if (OCTEON_IS_MODEL(OCTEON_CN68XX)) {
-			union cvmx_sso_wq_int_thrx int_thr;
-			union cvmx_pow_wq_int_pc int_pc;
-
-			int_thr.u64 = 0;
-			int_thr.s.tc_en = 1;
-			int_thr.s.tc_thr = 1;
-			cvmx_write_csr(CVMX_SSO_WQ_INT_THRX(i), int_thr.u64);
-
-			int_pc.u64 = 0;
-			int_pc.s.pc_thr = 5;
-			cvmx_write_csr(CVMX_SSO_WQ_INT_PC, int_pc.u64);
-		} else {
-			union cvmx_pow_wq_int_thrx int_thr;
-			union cvmx_pow_wq_int_pc int_pc;
-
-			int_thr.u64 = 0;
-			int_thr.s.tc_en = 1;
-			int_thr.s.tc_thr = 1;
-			cvmx_write_csr(CVMX_POW_WQ_INT_THRX(i), int_thr.u64);
-
-			int_pc.u64 = 0;
-			int_pc.s.pc_thr = 5;
-			cvmx_write_csr(CVMX_POW_WQ_INT_PC, int_pc.u64);
-		}
-
-		/* Schedule NAPI now. This will indirectly enable the
-		 * interrupt.
-		 */
-		napi_schedule(&oct_rx_group[i].napi);
-	}
-	atomic_inc(&oct_rx_ready);
-}
-
-void cvm_oct_rx_shutdown(void)
-{
-	int i;
-
-	for (i = 0; i < ARRAY_SIZE(oct_rx_group); i++) {
-		if (!(pow_receive_groups & BIT(i)))
-			continue;
-
-		/* Disable POW interrupt */
-		if (OCTEON_IS_MODEL(OCTEON_CN68XX))
-			cvmx_write_csr(CVMX_SSO_WQ_INT_THRX(i), 0);
-		else
-			cvmx_write_csr(CVMX_POW_WQ_INT_THRX(i), 0);
-
-		/* Free the interrupt handler */
-		free_irq(oct_rx_group[i].irq, cvm_oct_device);
-
-		netif_napi_del(&oct_rx_group[i].napi);
-	}
-}
diff --git a/drivers/staging/octeon/ethernet-rx.h b/drivers/staging/octeon/ethernet-rx.h
deleted file mode 100644
index ff6482fa20d6..000000000000
--- a/drivers/staging/octeon/ethernet-rx.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * This file is based on code from OCTEON SDK by Cavium Networks.
- *
- * Copyright (c) 2003-2007 Cavium Networks
- */
-
-void cvm_oct_poll_controller(struct net_device *dev);
-void cvm_oct_rx_initialize(void);
-void cvm_oct_rx_shutdown(void);
-
-static inline void cvm_oct_rx_refill_pool(int fill_threshold)
-{
-	int number_to_free;
-	int num_freed;
-	/* Refill the packet buffer pool */
-	number_to_free =
-		cvmx_fau_fetch_and_add32(FAU_NUM_PACKET_BUFFERS_TO_FREE, 0);
-
-	if (number_to_free > fill_threshold) {
-		cvmx_fau_atomic_add32(FAU_NUM_PACKET_BUFFERS_TO_FREE,
-				      -number_to_free);
-		num_freed = cvm_oct_mem_fill_fpa(CVMX_FPA_PACKET_POOL,
-						 CVMX_FPA_PACKET_POOL_SIZE,
-						 number_to_free);
-		if (num_freed != number_to_free) {
-			cvmx_fau_atomic_add32(FAU_NUM_PACKET_BUFFERS_TO_FREE,
-					      number_to_free - num_freed);
-		}
-	}
-}
diff --git a/drivers/staging/octeon/ethernet-sgmii.c b/drivers/staging/octeon/ethernet-sgmii.c
deleted file mode 100644
index d7fbd9159302..000000000000
--- a/drivers/staging/octeon/ethernet-sgmii.c
+++ /dev/null
@@ -1,30 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * This file is based on code from OCTEON SDK by Cavium Networks.
- *
- * Copyright (c) 2003-2007 Cavium Networks
- */
-
-#include <linux/phy.h>
-#include <linux/kernel.h>
-#include <linux/netdevice.h>
-#include <linux/ratelimit.h>
-#include <net/dst.h>
-
-#include "octeon-ethernet.h"
-#include "ethernet-defines.h"
-#include "ethernet-util.h"
-#include "ethernet-mdio.h"
-
-int cvm_oct_sgmii_open(struct net_device *dev)
-{
-	return cvm_oct_common_open(dev, cvm_oct_link_poll);
-}
-
-int cvm_oct_sgmii_init(struct net_device *dev)
-{
-	cvm_oct_common_init(dev);
-
-	/* FIXME: Need autoneg logic */
-	return 0;
-}
diff --git a/drivers/staging/octeon/ethernet-spi.c b/drivers/staging/octeon/ethernet-spi.c
deleted file mode 100644
index c582403e6a1f..000000000000
--- a/drivers/staging/octeon/ethernet-spi.c
+++ /dev/null
@@ -1,226 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * This file is based on code from OCTEON SDK by Cavium Networks.
- *
- * Copyright (c) 2003-2007 Cavium Networks
- */
-
-#include <linux/kernel.h>
-#include <linux/netdevice.h>
-#include <linux/interrupt.h>
-#include <net/dst.h>
-
-#include "octeon-ethernet.h"
-#include "ethernet-defines.h"
-#include "ethernet-util.h"
-
-static int number_spi_ports;
-static int need_retrain[2] = { 0, 0 };
-
-static void cvm_oct_spxx_int_pr(union cvmx_spxx_int_reg spx_int_reg, int index)
-{
-	if (spx_int_reg.s.spf)
-		pr_err("SPI%d: SRX Spi4 interface down\n", index);
-	if (spx_int_reg.s.calerr)
-		pr_err("SPI%d: SRX Spi4 Calendar table parity error\n", index);
-	if (spx_int_reg.s.syncerr)
-		pr_err("SPI%d: SRX Consecutive Spi4 DIP4 errors have exceeded SPX_ERR_CTL[ERRCNT]\n",
-		       index);
-	if (spx_int_reg.s.diperr)
-		pr_err("SPI%d: SRX Spi4 DIP4 error\n", index);
-	if (spx_int_reg.s.tpaovr)
-		pr_err("SPI%d: SRX Selected port has hit TPA overflow\n",
-		       index);
-	if (spx_int_reg.s.rsverr)
-		pr_err("SPI%d: SRX Spi4 reserved control word detected\n",
-		       index);
-	if (spx_int_reg.s.drwnng)
-		pr_err("SPI%d: SRX Spi4 receive FIFO drowning/overflow\n",
-		       index);
-	if (spx_int_reg.s.clserr)
-		pr_err("SPI%d: SRX Spi4 packet closed on non-16B alignment without EOP\n",
-		       index);
-	if (spx_int_reg.s.spiovr)
-		pr_err("SPI%d: SRX Spi4 async FIFO overflow\n", index);
-	if (spx_int_reg.s.abnorm)
-		pr_err("SPI%d: SRX Abnormal packet termination (ERR bit)\n",
-		       index);
-	if (spx_int_reg.s.prtnxa)
-		pr_err("SPI%d: SRX Port out of range\n", index);
-}
-
-static void cvm_oct_stxx_int_pr(union cvmx_stxx_int_reg stx_int_reg, int index)
-{
-	if (stx_int_reg.s.syncerr)
-		pr_err("SPI%d: STX Interface encountered a fatal error\n",
-		       index);
-	if (stx_int_reg.s.frmerr)
-		pr_err("SPI%d: STX FRMCNT has exceeded STX_DIP_CNT[MAXFRM]\n",
-		       index);
-	if (stx_int_reg.s.unxfrm)
-		pr_err("SPI%d: STX Unexpected framing sequence\n", index);
-	if (stx_int_reg.s.nosync)
-		pr_err("SPI%d: STX ERRCNT has exceeded STX_DIP_CNT[MAXDIP]\n",
-		       index);
-	if (stx_int_reg.s.diperr)
-		pr_err("SPI%d: STX DIP2 error on the Spi4 Status channel\n",
-		       index);
-	if (stx_int_reg.s.datovr)
-		pr_err("SPI%d: STX Spi4 FIFO overflow error\n", index);
-	if (stx_int_reg.s.ovrbst)
-		pr_err("SPI%d: STX Transmit packet burst too big\n", index);
-	if (stx_int_reg.s.calpar1)
-		pr_err("SPI%d: STX Calendar Table Parity Error Bank%d\n",
-		       index, 1);
-	if (stx_int_reg.s.calpar0)
-		pr_err("SPI%d: STX Calendar Table Parity Error Bank%d\n",
-		       index, 0);
-}
-
-static irqreturn_t cvm_oct_spi_spx_int(int index)
-{
-	union cvmx_spxx_int_reg spx_int_reg;
-	union cvmx_stxx_int_reg stx_int_reg;
-
-	spx_int_reg.u64 = cvmx_read_csr(CVMX_SPXX_INT_REG(index));
-	cvmx_write_csr(CVMX_SPXX_INT_REG(index), spx_int_reg.u64);
-	if (!need_retrain[index]) {
-		spx_int_reg.u64 &= cvmx_read_csr(CVMX_SPXX_INT_MSK(index));
-		cvm_oct_spxx_int_pr(spx_int_reg, index);
-	}
-
-	stx_int_reg.u64 = cvmx_read_csr(CVMX_STXX_INT_REG(index));
-	cvmx_write_csr(CVMX_STXX_INT_REG(index), stx_int_reg.u64);
-	if (!need_retrain[index]) {
-		stx_int_reg.u64 &= cvmx_read_csr(CVMX_STXX_INT_MSK(index));
-		cvm_oct_stxx_int_pr(stx_int_reg, index);
-	}
-
-	cvmx_write_csr(CVMX_SPXX_INT_MSK(index), 0);
-	cvmx_write_csr(CVMX_STXX_INT_MSK(index), 0);
-	need_retrain[index] = 1;
-
-	return IRQ_HANDLED;
-}
-
-static irqreturn_t cvm_oct_spi_rml_interrupt(int cpl, void *dev_id)
-{
-	irqreturn_t return_status = IRQ_NONE;
-	union cvmx_npi_rsl_int_blocks rsl_int_blocks;
-
-	/* Check and see if this interrupt was caused by the GMX block */
-	rsl_int_blocks.u64 = cvmx_read_csr(CVMX_NPI_RSL_INT_BLOCKS);
-	if (rsl_int_blocks.s.spx1) /* 19 - SPX1_INT_REG & STX1_INT_REG */
-		return_status = cvm_oct_spi_spx_int(1);
-
-	if (rsl_int_blocks.s.spx0) /* 18 - SPX0_INT_REG & STX0_INT_REG */
-		return_status = cvm_oct_spi_spx_int(0);
-
-	return return_status;
-}
-
-static void cvm_oct_spi_enable_error_reporting(int interface)
-{
-	union cvmx_spxx_int_msk spxx_int_msk;
-	union cvmx_stxx_int_msk stxx_int_msk;
-
-	spxx_int_msk.u64 = cvmx_read_csr(CVMX_SPXX_INT_MSK(interface));
-	spxx_int_msk.s.calerr = 1;
-	spxx_int_msk.s.syncerr = 1;
-	spxx_int_msk.s.diperr = 1;
-	spxx_int_msk.s.tpaovr = 1;
-	spxx_int_msk.s.rsverr = 1;
-	spxx_int_msk.s.drwnng = 1;
-	spxx_int_msk.s.clserr = 1;
-	spxx_int_msk.s.spiovr = 1;
-	spxx_int_msk.s.abnorm = 1;
-	spxx_int_msk.s.prtnxa = 1;
-	cvmx_write_csr(CVMX_SPXX_INT_MSK(interface), spxx_int_msk.u64);
-
-	stxx_int_msk.u64 = cvmx_read_csr(CVMX_STXX_INT_MSK(interface));
-	stxx_int_msk.s.frmerr = 1;
-	stxx_int_msk.s.unxfrm = 1;
-	stxx_int_msk.s.nosync = 1;
-	stxx_int_msk.s.diperr = 1;
-	stxx_int_msk.s.datovr = 1;
-	stxx_int_msk.s.ovrbst = 1;
-	stxx_int_msk.s.calpar1 = 1;
-	stxx_int_msk.s.calpar0 = 1;
-	cvmx_write_csr(CVMX_STXX_INT_MSK(interface), stxx_int_msk.u64);
-}
-
-static void cvm_oct_spi_poll(struct net_device *dev)
-{
-	static int spi4000_port;
-	struct octeon_ethernet *priv = netdev_priv(dev);
-	int interface;
-
-	for (interface = 0; interface < 2; interface++) {
-		if ((priv->port == interface * 16) && need_retrain[interface]) {
-			if (cvmx_spi_restart_interface
-			    (interface, CVMX_SPI_MODE_DUPLEX, 10) == 0) {
-				need_retrain[interface] = 0;
-				cvm_oct_spi_enable_error_reporting(interface);
-			}
-		}
-
-		/*
-		 * The SPI4000 TWSI interface is very slow. In order
-		 * not to bring the system to a crawl, we only poll a
-		 * single port every second. This means negotiation
-		 * speed changes take up to 10 seconds, but at least
-		 * we don't waste absurd amounts of time waiting for
-		 * TWSI.
-		 */
-		if (priv->port == spi4000_port) {
-			/*
-			 * This function does nothing if it is called on an
-			 * interface without a SPI4000.
-			 */
-			cvmx_spi4000_check_speed(interface, priv->port);
-			/*
-			 * Normal ordering increments. By decrementing
-			 * we only match once per iteration.
-			 */
-			spi4000_port--;
-			if (spi4000_port < 0)
-				spi4000_port = 10;
-		}
-	}
-}
-
-int cvm_oct_spi_init(struct net_device *dev)
-{
-	int r;
-	struct octeon_ethernet *priv = netdev_priv(dev);
-
-	if (number_spi_ports == 0) {
-		r = request_irq(OCTEON_IRQ_RML, cvm_oct_spi_rml_interrupt,
-				IRQF_SHARED, "SPI", &number_spi_ports);
-		if (r)
-			return r;
-	}
-	number_spi_ports++;
-
-	if ((priv->port == 0) || (priv->port == 16)) {
-		cvm_oct_spi_enable_error_reporting(INTERFACE(priv->port));
-		priv->poll = cvm_oct_spi_poll;
-	}
-	cvm_oct_common_init(dev);
-	return 0;
-}
-
-void cvm_oct_spi_uninit(struct net_device *dev)
-{
-	int interface;
-
-	cvm_oct_common_uninit(dev);
-	number_spi_ports--;
-	if (number_spi_ports == 0) {
-		for (interface = 0; interface < 2; interface++) {
-			cvmx_write_csr(CVMX_SPXX_INT_MSK(interface), 0);
-			cvmx_write_csr(CVMX_STXX_INT_MSK(interface), 0);
-		}
-		free_irq(OCTEON_IRQ_RML, &number_spi_ports);
-	}
-}
diff --git a/drivers/staging/octeon/ethernet-tx.c b/drivers/staging/octeon/ethernet-tx.c
deleted file mode 100644
index b334cf89794e..000000000000
--- a/drivers/staging/octeon/ethernet-tx.c
+++ /dev/null
@@ -1,717 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * This file is based on code from OCTEON SDK by Cavium Networks.
- *
- * Copyright (c) 2003-2010 Cavium Networks
- */
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-#include <linux/ip.h>
-#include <linux/ratelimit.h>
-#include <linux/string.h>
-#include <linux/interrupt.h>
-#include <net/dst.h>
-#ifdef CONFIG_XFRM
-#include <linux/xfrm.h>
-#include <net/xfrm.h>
-#endif /* CONFIG_XFRM */
-
-#include <linux/atomic.h>
-#include <net/sch_generic.h>
-
-#include "octeon-ethernet.h"
-#include "ethernet-defines.h"
-#include "ethernet-tx.h"
-#include "ethernet-util.h"
-
-#define CVM_OCT_SKB_CB(skb)	((u64 *)((skb)->cb))
-
-/*
- * You can define GET_SKBUFF_QOS() to override how the skbuff output
- * function determines which output queue is used. The default
- * implementation always uses the base queue for the port. If, for
- * example, you wanted to use the skb->priority field, define
- * GET_SKBUFF_QOS as: #define GET_SKBUFF_QOS(skb) ((skb)->priority)
- */
-#ifndef GET_SKBUFF_QOS
-#define GET_SKBUFF_QOS(skb) 0
-#endif
-
-static void cvm_oct_tx_do_cleanup(unsigned long arg);
-static DECLARE_TASKLET(cvm_oct_tx_cleanup_tasklet, cvm_oct_tx_do_cleanup, 0);
-
-/* Maximum number of SKBs to try to free per xmit packet. */
-#define MAX_SKB_TO_FREE (MAX_OUT_QUEUE_DEPTH * 2)
-
-static inline int cvm_oct_adjust_skb_to_free(int skb_to_free, int fau)
-{
-	int undo;
-
-	undo = skb_to_free > 0 ? MAX_SKB_TO_FREE : skb_to_free +
-						   MAX_SKB_TO_FREE;
-	if (undo > 0)
-		cvmx_fau_atomic_add32(fau, -undo);
-	skb_to_free = -skb_to_free > MAX_SKB_TO_FREE ? MAX_SKB_TO_FREE :
-						       -skb_to_free;
-	return skb_to_free;
-}
-
-static void cvm_oct_kick_tx_poll_watchdog(void)
-{
-	union cvmx_ciu_timx ciu_timx;
-
-	ciu_timx.u64 = 0;
-	ciu_timx.s.one_shot = 1;
-	ciu_timx.s.len = cvm_oct_tx_poll_interval;
-	cvmx_write_csr(CVMX_CIU_TIMX(1), ciu_timx.u64);
-}
-
-static void cvm_oct_free_tx_skbs(struct net_device *dev)
-{
-	int skb_to_free;
-	int qos, queues_per_port;
-	int total_freed = 0;
-	int total_remaining = 0;
-	unsigned long flags;
-	struct octeon_ethernet *priv = netdev_priv(dev);
-
-	queues_per_port = cvmx_pko_get_num_queues(priv->port);
-	/* Drain any pending packets in the free list */
-	for (qos = 0; qos < queues_per_port; qos++) {
-		if (skb_queue_len(&priv->tx_free_list[qos]) == 0)
-			continue;
-		skb_to_free = cvmx_fau_fetch_and_add32(priv->fau + qos * 4,
-						       MAX_SKB_TO_FREE);
-		skb_to_free = cvm_oct_adjust_skb_to_free(skb_to_free,
-							 priv->fau + qos * 4);
-		total_freed += skb_to_free;
-		if (skb_to_free > 0) {
-			struct sk_buff *to_free_list = NULL;
-
-			spin_lock_irqsave(&priv->tx_free_list[qos].lock, flags);
-			while (skb_to_free > 0) {
-				struct sk_buff *t;
-
-				t = __skb_dequeue(&priv->tx_free_list[qos]);
-				t->next = to_free_list;
-				to_free_list = t;
-				skb_to_free--;
-			}
-			spin_unlock_irqrestore(&priv->tx_free_list[qos].lock,
-					       flags);
-			/* Do the actual freeing outside of the lock. */
-			while (to_free_list) {
-				struct sk_buff *t = to_free_list;
-
-				to_free_list = to_free_list->next;
-				dev_kfree_skb_any(t);
-			}
-		}
-		total_remaining += skb_queue_len(&priv->tx_free_list[qos]);
-	}
-	if (total_remaining < MAX_OUT_QUEUE_DEPTH && netif_queue_stopped(dev))
-		netif_wake_queue(dev);
-	if (total_remaining)
-		cvm_oct_kick_tx_poll_watchdog();
-}
-
-/**
- * cvm_oct_xmit - transmit a packet
- * @skb:    Packet to send
- * @dev:    Device info structure
- *
- * Returns Always returns NETDEV_TX_OK
- */
-int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev)
-{
-	union cvmx_pko_command_word0 pko_command;
-	union cvmx_buf_ptr hw_buffer;
-	u64 old_scratch;
-	u64 old_scratch2;
-	int qos;
-	int i;
-	enum {QUEUE_CORE, QUEUE_HW, QUEUE_DROP} queue_type;
-	struct octeon_ethernet *priv = netdev_priv(dev);
-	struct sk_buff *to_free_list;
-	int skb_to_free;
-	int buffers_to_free;
-	u32 total_to_clean;
-	unsigned long flags;
-#if REUSE_SKBUFFS_WITHOUT_FREE
-	unsigned char *fpa_head;
-#endif
-
-	/*
-	 * Prefetch the private data structure.  It is larger than the
-	 * one cache line.
-	 */
-	prefetch(priv);
-
-	/*
-	 * The check on CVMX_PKO_QUEUES_PER_PORT_* is designed to
-	 * completely remove "qos" in the event neither interface
-	 * supports multiple queues per port.
-	 */
-	if ((CVMX_PKO_QUEUES_PER_PORT_INTERFACE0 > 1) ||
-	    (CVMX_PKO_QUEUES_PER_PORT_INTERFACE1 > 1)) {
-		qos = GET_SKBUFF_QOS(skb);
-		if (qos <= 0)
-			qos = 0;
-		else if (qos >= cvmx_pko_get_num_queues(priv->port))
-			qos = 0;
-	} else {
-		qos = 0;
-	}
-
-	if (USE_ASYNC_IOBDMA) {
-		/* Save scratch in case userspace is using it */
-		CVMX_SYNCIOBDMA;
-		old_scratch = cvmx_scratch_read64(CVMX_SCR_SCRATCH);
-		old_scratch2 = cvmx_scratch_read64(CVMX_SCR_SCRATCH + 8);
-
-		/*
-		 * Fetch and increment the number of packets to be
-		 * freed.
-		 */
-		cvmx_fau_async_fetch_and_add32(CVMX_SCR_SCRATCH + 8,
-					       FAU_NUM_PACKET_BUFFERS_TO_FREE,
-					       0);
-		cvmx_fau_async_fetch_and_add32(CVMX_SCR_SCRATCH,
-					       priv->fau + qos * 4,
-					       MAX_SKB_TO_FREE);
-	}
-
-	/*
-	 * We have space for 6 segment pointers, If there will be more
-	 * than that, we must linearize.
-	 */
-	if (unlikely(skb_shinfo(skb)->nr_frags > 5)) {
-		if (unlikely(__skb_linearize(skb))) {
-			queue_type = QUEUE_DROP;
-			if (USE_ASYNC_IOBDMA) {
-				/*
-				 * Get the number of skbuffs in use
-				 * by the hardware
-				 */
-				CVMX_SYNCIOBDMA;
-				skb_to_free =
-					cvmx_scratch_read64(CVMX_SCR_SCRATCH);
-			} else {
-				/*
-				 * Get the number of skbuffs in use
-				 * by the hardware
-				 */
-				skb_to_free =
-				     cvmx_fau_fetch_and_add32(priv->fau +
-							      qos * 4,
-							      MAX_SKB_TO_FREE);
-			}
-			skb_to_free = cvm_oct_adjust_skb_to_free(skb_to_free,
-								 priv->fau +
-								 qos * 4);
-			spin_lock_irqsave(&priv->tx_free_list[qos].lock, flags);
-			goto skip_xmit;
-		}
-	}
-
-	/*
-	 * The CN3XXX series of parts has an errata (GMX-401) which
-	 * causes the GMX block to hang if a collision occurs towards
-	 * the end of a <68 byte packet. As a workaround for this, we
-	 * pad packets to be 68 bytes whenever we are in half duplex
-	 * mode. We don't handle the case of having a small packet but
-	 * no room to add the padding.  The kernel should always give
-	 * us at least a cache line
-	 */
-	if ((skb->len < 64) && OCTEON_IS_MODEL(OCTEON_CN3XXX)) {
-		union cvmx_gmxx_prtx_cfg gmx_prt_cfg;
-		int interface = INTERFACE(priv->port);
-		int index = INDEX(priv->port);
-
-		if (interface < 2) {
-			/* We only need to pad packet in half duplex mode */
-			gmx_prt_cfg.u64 =
-			    cvmx_read_csr(CVMX_GMXX_PRTX_CFG(index, interface));
-			if (gmx_prt_cfg.s.duplex == 0) {
-				int add_bytes = 64 - skb->len;
-
-				if ((skb_tail_pointer(skb) + add_bytes) <=
-				    skb_end_pointer(skb))
-					__skb_put_zero(skb, add_bytes);
-			}
-		}
-	}
-
-	/* Build the PKO command */
-	pko_command.u64 = 0;
-#ifdef __LITTLE_ENDIAN
-	pko_command.s.le = 1;
-#endif
-	pko_command.s.n2 = 1;	/* Don't pollute L2 with the outgoing packet */
-	pko_command.s.segs = 1;
-	pko_command.s.total_bytes = skb->len;
-	pko_command.s.size0 = CVMX_FAU_OP_SIZE_32;
-	pko_command.s.subone0 = 1;
-
-	pko_command.s.dontfree = 1;
-
-	/* Build the PKO buffer pointer */
-	hw_buffer.u64 = 0;
-	if (skb_shinfo(skb)->nr_frags == 0) {
-		hw_buffer.s.addr = XKPHYS_TO_PHYS((uintptr_t)skb->data);
-		hw_buffer.s.pool = 0;
-		hw_buffer.s.size = skb->len;
-	} else {
-		hw_buffer.s.addr = XKPHYS_TO_PHYS((uintptr_t)skb->data);
-		hw_buffer.s.pool = 0;
-		hw_buffer.s.size = skb_headlen(skb);
-		CVM_OCT_SKB_CB(skb)[0] = hw_buffer.u64;
-		for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
-			skb_frag_t *fs = skb_shinfo(skb)->frags + i;
-
-			hw_buffer.s.addr =
-				XKPHYS_TO_PHYS((uintptr_t)skb_frag_address(fs));
-			hw_buffer.s.size = skb_frag_size(fs);
-			CVM_OCT_SKB_CB(skb)[i + 1] = hw_buffer.u64;
-		}
-		hw_buffer.s.addr =
-			XKPHYS_TO_PHYS((uintptr_t)CVM_OCT_SKB_CB(skb));
-		hw_buffer.s.size = skb_shinfo(skb)->nr_frags + 1;
-		pko_command.s.segs = skb_shinfo(skb)->nr_frags + 1;
-		pko_command.s.gather = 1;
-		goto dont_put_skbuff_in_hw;
-	}
-
-	/*
-	 * See if we can put this skb in the FPA pool. Any strange
-	 * behavior from the Linux networking stack will most likely
-	 * be caused by a bug in the following code. If some field is
-	 * in use by the network stack and gets carried over when a
-	 * buffer is reused, bad things may happen.  If in doubt and
-	 * you dont need the absolute best performance, disable the
-	 * define REUSE_SKBUFFS_WITHOUT_FREE. The reuse of buffers has
-	 * shown a 25% increase in performance under some loads.
-	 */
-#if REUSE_SKBUFFS_WITHOUT_FREE
-	fpa_head = skb->head + 256 - ((unsigned long)skb->head & 0x7f);
-	if (unlikely(skb->data < fpa_head)) {
-		/* TX buffer beginning can't meet FPA alignment constraints */
-		goto dont_put_skbuff_in_hw;
-	}
-	if (unlikely
-	    ((skb_end_pointer(skb) - fpa_head) < CVMX_FPA_PACKET_POOL_SIZE)) {
-		/* TX buffer isn't large enough for the FPA */
-		goto dont_put_skbuff_in_hw;
-	}
-	if (unlikely(skb_shared(skb))) {
-		/* TX buffer sharing data with someone else */
-		goto dont_put_skbuff_in_hw;
-	}
-	if (unlikely(skb_cloned(skb))) {
-		/* TX buffer has been cloned */
-		goto dont_put_skbuff_in_hw;
-	}
-	if (unlikely(skb_header_cloned(skb))) {
-		/* TX buffer header has been cloned */
-		goto dont_put_skbuff_in_hw;
-	}
-	if (unlikely(skb->destructor)) {
-		/* TX buffer has a destructor */
-		goto dont_put_skbuff_in_hw;
-	}
-	if (unlikely(skb_shinfo(skb)->nr_frags)) {
-		/* TX buffer has fragments */
-		goto dont_put_skbuff_in_hw;
-	}
-	if (unlikely
-	    (skb->truesize !=
-	     sizeof(*skb) + skb_end_offset(skb))) {
-		/* TX buffer truesize has been changed */
-		goto dont_put_skbuff_in_hw;
-	}
-
-	/*
-	 * We can use this buffer in the FPA.  We don't need the FAU
-	 * update anymore
-	 */
-	pko_command.s.dontfree = 0;
-
-	hw_buffer.s.back = ((unsigned long)skb->data >> 7) -
-			   ((unsigned long)fpa_head >> 7);
-
-	*(struct sk_buff **)(fpa_head - sizeof(void *)) = skb;
-
-	/*
-	 * The skbuff will be reused without ever being freed. We must
-	 * cleanup a bunch of core things.
-	 */
-	dst_release(skb_dst(skb));
-	skb_dst_set(skb, NULL);
-	skb_ext_reset(skb);
-	nf_reset_ct(skb);
-
-#ifdef CONFIG_NET_SCHED
-	skb->tc_index = 0;
-	skb_reset_tc(skb);
-#endif /* CONFIG_NET_SCHED */
-#endif /* REUSE_SKBUFFS_WITHOUT_FREE */
-
-dont_put_skbuff_in_hw:
-
-	/* Check if we can use the hardware checksumming */
-	if ((skb->protocol == htons(ETH_P_IP)) &&
-	    (ip_hdr(skb)->version == 4) &&
-	    (ip_hdr(skb)->ihl == 5) &&
-	    ((ip_hdr(skb)->frag_off == 0) ||
-	     (ip_hdr(skb)->frag_off == htons(1 << 14))) &&
-	    ((ip_hdr(skb)->protocol == IPPROTO_TCP) ||
-	     (ip_hdr(skb)->protocol == IPPROTO_UDP))) {
-		/* Use hardware checksum calc */
-		pko_command.s.ipoffp1 = skb_network_offset(skb) + 1;
-	}
-
-	if (USE_ASYNC_IOBDMA) {
-		/* Get the number of skbuffs in use by the hardware */
-		CVMX_SYNCIOBDMA;
-		skb_to_free = cvmx_scratch_read64(CVMX_SCR_SCRATCH);
-		buffers_to_free = cvmx_scratch_read64(CVMX_SCR_SCRATCH + 8);
-	} else {
-		/* Get the number of skbuffs in use by the hardware */
-		skb_to_free = cvmx_fau_fetch_and_add32(priv->fau + qos * 4,
-						       MAX_SKB_TO_FREE);
-		buffers_to_free =
-		    cvmx_fau_fetch_and_add32(FAU_NUM_PACKET_BUFFERS_TO_FREE, 0);
-	}
-
-	skb_to_free = cvm_oct_adjust_skb_to_free(skb_to_free,
-						 priv->fau + qos * 4);
-
-	/*
-	 * If we're sending faster than the receive can free them then
-	 * don't do the HW free.
-	 */
-	if ((buffers_to_free < -100) && !pko_command.s.dontfree)
-		pko_command.s.dontfree = 1;
-
-	if (pko_command.s.dontfree) {
-		queue_type = QUEUE_CORE;
-		pko_command.s.reg0 = priv->fau + qos * 4;
-	} else {
-		queue_type = QUEUE_HW;
-	}
-	if (USE_ASYNC_IOBDMA)
-		cvmx_fau_async_fetch_and_add32(CVMX_SCR_SCRATCH,
-					       FAU_TOTAL_TX_TO_CLEAN, 1);
-
-	spin_lock_irqsave(&priv->tx_free_list[qos].lock, flags);
-
-	/* Drop this packet if we have too many already queued to the HW */
-	if (unlikely(skb_queue_len(&priv->tx_free_list[qos]) >=
-		     MAX_OUT_QUEUE_DEPTH)) {
-		if (dev->tx_queue_len != 0) {
-			/* Drop the lock when notifying the core.  */
-			spin_unlock_irqrestore(&priv->tx_free_list[qos].lock,
-					       flags);
-			netif_stop_queue(dev);
-			spin_lock_irqsave(&priv->tx_free_list[qos].lock,
-					  flags);
-		} else {
-			/* If not using normal queueing.  */
-			queue_type = QUEUE_DROP;
-			goto skip_xmit;
-		}
-	}
-
-	cvmx_pko_send_packet_prepare(priv->port, priv->queue + qos,
-				     CVMX_PKO_LOCK_NONE);
-
-	/* Send the packet to the output queue */
-	if (unlikely(cvmx_pko_send_packet_finish(priv->port,
-						 priv->queue + qos,
-						 pko_command, hw_buffer,
-						 CVMX_PKO_LOCK_NONE))) {
-		printk_ratelimited("%s: Failed to send the packet\n",
-				   dev->name);
-		queue_type = QUEUE_DROP;
-	}
-skip_xmit:
-	to_free_list = NULL;
-
-	switch (queue_type) {
-	case QUEUE_DROP:
-		skb->next = to_free_list;
-		to_free_list = skb;
-		dev->stats.tx_dropped++;
-		break;
-	case QUEUE_HW:
-		cvmx_fau_atomic_add32(FAU_NUM_PACKET_BUFFERS_TO_FREE, -1);
-		break;
-	case QUEUE_CORE:
-		__skb_queue_tail(&priv->tx_free_list[qos], skb);
-		break;
-	default:
-		BUG();
-	}
-
-	while (skb_to_free > 0) {
-		struct sk_buff *t = __skb_dequeue(&priv->tx_free_list[qos]);
-
-		t->next = to_free_list;
-		to_free_list = t;
-		skb_to_free--;
-	}
-
-	spin_unlock_irqrestore(&priv->tx_free_list[qos].lock, flags);
-
-	/* Do the actual freeing outside of the lock. */
-	while (to_free_list) {
-		struct sk_buff *t = to_free_list;
-
-		to_free_list = to_free_list->next;
-		dev_kfree_skb_any(t);
-	}
-
-	if (USE_ASYNC_IOBDMA) {
-		CVMX_SYNCIOBDMA;
-		total_to_clean = cvmx_scratch_read64(CVMX_SCR_SCRATCH);
-		/* Restore the scratch area */
-		cvmx_scratch_write64(CVMX_SCR_SCRATCH, old_scratch);
-		cvmx_scratch_write64(CVMX_SCR_SCRATCH + 8, old_scratch2);
-	} else {
-		total_to_clean =
-			cvmx_fau_fetch_and_add32(FAU_TOTAL_TX_TO_CLEAN, 1);
-	}
-
-	if (total_to_clean & 0x3ff) {
-		/*
-		 * Schedule the cleanup tasklet every 1024 packets for
-		 * the pathological case of high traffic on one port
-		 * delaying clean up of packets on a different port
-		 * that is blocked waiting for the cleanup.
-		 */
-		tasklet_schedule(&cvm_oct_tx_cleanup_tasklet);
-	}
-
-	cvm_oct_kick_tx_poll_watchdog();
-
-	return NETDEV_TX_OK;
-}
-
-/**
- * cvm_oct_xmit_pow - transmit a packet to the POW
- * @skb:    Packet to send
- * @dev:    Device info structure
-
- * Returns Always returns zero
- */
-int cvm_oct_xmit_pow(struct sk_buff *skb, struct net_device *dev)
-{
-	struct octeon_ethernet *priv = netdev_priv(dev);
-	void *packet_buffer;
-	void *copy_location;
-
-	/* Get a work queue entry */
-	struct cvmx_wqe *work = cvmx_fpa_alloc(CVMX_FPA_WQE_POOL);
-
-	if (unlikely(!work)) {
-		printk_ratelimited("%s: Failed to allocate a work queue entry\n",
-				   dev->name);
-		dev->stats.tx_dropped++;
-		dev_kfree_skb_any(skb);
-		return 0;
-	}
-
-	/* Get a packet buffer */
-	packet_buffer = cvmx_fpa_alloc(CVMX_FPA_PACKET_POOL);
-	if (unlikely(!packet_buffer)) {
-		printk_ratelimited("%s: Failed to allocate a packet buffer\n",
-				   dev->name);
-		cvmx_fpa_free(work, CVMX_FPA_WQE_POOL, 1);
-		dev->stats.tx_dropped++;
-		dev_kfree_skb_any(skb);
-		return 0;
-	}
-
-	/*
-	 * Calculate where we need to copy the data to. We need to
-	 * leave 8 bytes for a next pointer (unused). We also need to
-	 * include any configure skip. Then we need to align the IP
-	 * packet src and dest into the same 64bit word. The below
-	 * calculation may add a little extra, but that doesn't
-	 * hurt.
-	 */
-	copy_location = packet_buffer + sizeof(u64);
-	copy_location += ((CVMX_HELPER_FIRST_MBUFF_SKIP + 7) & 0xfff8) + 6;
-
-	/*
-	 * We have to copy the packet since whoever processes this
-	 * packet will free it to a hardware pool. We can't use the
-	 * trick of counting outstanding packets like in
-	 * cvm_oct_xmit.
-	 */
-	memcpy(copy_location, skb->data, skb->len);
-
-	/*
-	 * Fill in some of the work queue fields. We may need to add
-	 * more if the software at the other end needs them.
-	 */
-	if (!OCTEON_IS_MODEL(OCTEON_CN68XX))
-		work->word0.pip.cn38xx.hw_chksum = skb->csum;
-	work->word1.len = skb->len;
-	cvmx_wqe_set_port(work, priv->port);
-	cvmx_wqe_set_qos(work, priv->port & 0x7);
-	cvmx_wqe_set_grp(work, pow_send_group);
-	work->word1.tag_type = CVMX_HELPER_INPUT_TAG_TYPE;
-	work->word1.tag = pow_send_group;	/* FIXME */
-	/* Default to zero. Sets of zero later are commented out */
-	work->word2.u64 = 0;
-	work->word2.s.bufs = 1;
-	work->packet_ptr.u64 = 0;
-	work->packet_ptr.s.addr = cvmx_ptr_to_phys(copy_location);
-	work->packet_ptr.s.pool = CVMX_FPA_PACKET_POOL;
-	work->packet_ptr.s.size = CVMX_FPA_PACKET_POOL_SIZE;
-	work->packet_ptr.s.back = (copy_location - packet_buffer) >> 7;
-
-	if (skb->protocol == htons(ETH_P_IP)) {
-		work->word2.s.ip_offset = 14;
-#if 0
-		work->word2.s.vlan_valid = 0;	/* FIXME */
-		work->word2.s.vlan_cfi = 0;	/* FIXME */
-		work->word2.s.vlan_id = 0;	/* FIXME */
-		work->word2.s.dec_ipcomp = 0;	/* FIXME */
-#endif
-		work->word2.s.tcp_or_udp =
-		    (ip_hdr(skb)->protocol == IPPROTO_TCP) ||
-		    (ip_hdr(skb)->protocol == IPPROTO_UDP);
-#if 0
-		/* FIXME */
-		work->word2.s.dec_ipsec = 0;
-		/* We only support IPv4 right now */
-		work->word2.s.is_v6 = 0;
-		/* Hardware would set to zero */
-		work->word2.s.software = 0;
-		/* No error, packet is internal */
-		work->word2.s.L4_error = 0;
-#endif
-		work->word2.s.is_frag = !((ip_hdr(skb)->frag_off == 0) ||
-					  (ip_hdr(skb)->frag_off ==
-					      cpu_to_be16(1 << 14)));
-#if 0
-		/* Assume Linux is sending a good packet */
-		work->word2.s.IP_exc = 0;
-#endif
-		work->word2.s.is_bcast = (skb->pkt_type == PACKET_BROADCAST);
-		work->word2.s.is_mcast = (skb->pkt_type == PACKET_MULTICAST);
-#if 0
-		/* This is an IP packet */
-		work->word2.s.not_IP = 0;
-		/* No error, packet is internal */
-		work->word2.s.rcv_error = 0;
-		/* No error, packet is internal */
-		work->word2.s.err_code = 0;
-#endif
-
-		/*
-		 * When copying the data, include 4 bytes of the
-		 * ethernet header to align the same way hardware
-		 * does.
-		 */
-		memcpy(work->packet_data, skb->data + 10,
-		       sizeof(work->packet_data));
-	} else {
-#if 0
-		work->word2.snoip.vlan_valid = 0;	/* FIXME */
-		work->word2.snoip.vlan_cfi = 0;	/* FIXME */
-		work->word2.snoip.vlan_id = 0;	/* FIXME */
-		work->word2.snoip.software = 0;	/* Hardware would set to zero */
-#endif
-		work->word2.snoip.is_rarp = skb->protocol == htons(ETH_P_RARP);
-		work->word2.snoip.is_arp = skb->protocol == htons(ETH_P_ARP);
-		work->word2.snoip.is_bcast =
-		    (skb->pkt_type == PACKET_BROADCAST);
-		work->word2.snoip.is_mcast =
-		    (skb->pkt_type == PACKET_MULTICAST);
-		work->word2.snoip.not_IP = 1;	/* IP was done up above */
-#if 0
-		/* No error, packet is internal */
-		work->word2.snoip.rcv_error = 0;
-		/* No error, packet is internal */
-		work->word2.snoip.err_code = 0;
-#endif
-		memcpy(work->packet_data, skb->data, sizeof(work->packet_data));
-	}
-
-	/* Submit the packet to the POW */
-	cvmx_pow_work_submit(work, work->word1.tag, work->word1.tag_type,
-			     cvmx_wqe_get_qos(work), cvmx_wqe_get_grp(work));
-	dev->stats.tx_packets++;
-	dev->stats.tx_bytes += skb->len;
-	dev_consume_skb_any(skb);
-	return 0;
-}
-
-/**
- * cvm_oct_tx_shutdown_dev - free all skb that are currently queued for TX.
- * @dev:    Device being shutdown
- *
- */
-void cvm_oct_tx_shutdown_dev(struct net_device *dev)
-{
-	struct octeon_ethernet *priv = netdev_priv(dev);
-	unsigned long flags;
-	int qos;
-
-	for (qos = 0; qos < 16; qos++) {
-		spin_lock_irqsave(&priv->tx_free_list[qos].lock, flags);
-		while (skb_queue_len(&priv->tx_free_list[qos]))
-			dev_kfree_skb_any(__skb_dequeue
-					  (&priv->tx_free_list[qos]));
-		spin_unlock_irqrestore(&priv->tx_free_list[qos].lock, flags);
-	}
-}
-
-static void cvm_oct_tx_do_cleanup(unsigned long arg)
-{
-	int port;
-
-	for (port = 0; port < TOTAL_NUMBER_OF_PORTS; port++) {
-		if (cvm_oct_device[port]) {
-			struct net_device *dev = cvm_oct_device[port];
-
-			cvm_oct_free_tx_skbs(dev);
-		}
-	}
-}
-
-static irqreturn_t cvm_oct_tx_cleanup_watchdog(int cpl, void *dev_id)
-{
-	/* Disable the interrupt.  */
-	cvmx_write_csr(CVMX_CIU_TIMX(1), 0);
-	/* Do the work in the tasklet.  */
-	tasklet_schedule(&cvm_oct_tx_cleanup_tasklet);
-	return IRQ_HANDLED;
-}
-
-void cvm_oct_tx_initialize(void)
-{
-	int i;
-
-	/* Disable the interrupt.  */
-	cvmx_write_csr(CVMX_CIU_TIMX(1), 0);
-	/* Register an IRQ handler to receive CIU_TIMX(1) interrupts */
-	i = request_irq(OCTEON_IRQ_TIMER1,
-			cvm_oct_tx_cleanup_watchdog, 0,
-			"Ethernet", cvm_oct_device);
-
-	if (i)
-		panic("Could not acquire Ethernet IRQ %d\n", OCTEON_IRQ_TIMER1);
-}
-
-void cvm_oct_tx_shutdown(void)
-{
-	/* Free the interrupt handler */
-	free_irq(OCTEON_IRQ_TIMER1, cvm_oct_device);
-}
diff --git a/drivers/staging/octeon/ethernet-tx.h b/drivers/staging/octeon/ethernet-tx.h
deleted file mode 100644
index 78936e9b33b0..000000000000
--- a/drivers/staging/octeon/ethernet-tx.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * This file is based on code from OCTEON SDK by Cavium Networks.
- *
- * Copyright (c) 2003-2007 Cavium Networks
- */
-
-int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev);
-int cvm_oct_xmit_pow(struct sk_buff *skb, struct net_device *dev);
-int cvm_oct_transmit_qos(struct net_device *dev, void *work_queue_entry,
-			 int do_free, int qos);
-void cvm_oct_tx_initialize(void);
-void cvm_oct_tx_shutdown(void);
-void cvm_oct_tx_shutdown_dev(struct net_device *dev);
diff --git a/drivers/staging/octeon/ethernet-util.h b/drivers/staging/octeon/ethernet-util.h
deleted file mode 100644
index 2af83a12ca78..000000000000
--- a/drivers/staging/octeon/ethernet-util.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * This file is based on code from OCTEON SDK by Cavium Networks.
- *
- * Copyright (c) 2003-2007 Cavium Networks
- */
-
-/**
- * cvm_oct_get_buffer_ptr - convert packet data address to pointer
- * @packet_ptr: Packet data hardware address
- *
- * Returns Packet buffer pointer
- */
-static inline void *cvm_oct_get_buffer_ptr(union cvmx_buf_ptr packet_ptr)
-{
-	return cvmx_phys_to_ptr(((packet_ptr.s.addr >> 7) - packet_ptr.s.back)
-				<< 7);
-}
-
-/**
- * INTERFACE - convert IPD port to logical interface
- * @ipd_port: Port to check
- *
- * Returns Logical interface
- */
-static inline int INTERFACE(int ipd_port)
-{
-	int interface;
-
-	if (ipd_port == CVMX_PIP_NUM_INPUT_PORTS)
-		return 10;
-	interface = cvmx_helper_get_interface_num(ipd_port);
-	if (interface >= 0)
-		return interface;
-	panic("Illegal ipd_port %d passed to %s\n", ipd_port, __func__);
-}
-
-/**
- * INDEX - convert IPD/PKO port number to the port's interface index
- * @ipd_port: Port to check
- *
- * Returns Index into interface port list
- */
-static inline int INDEX(int ipd_port)
-{
-	return cvmx_helper_get_interface_index_num(ipd_port);
-}
diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c
deleted file mode 100644
index f42c3816ce49..000000000000
--- a/drivers/staging/octeon/ethernet.c
+++ /dev/null
@@ -1,992 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * This file is based on code from OCTEON SDK by Cavium Networks.
- *
- * Copyright (c) 2003-2007 Cavium Networks
- */
-
-#include <linux/platform_device.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-#include <linux/phy.h>
-#include <linux/slab.h>
-#include <linux/interrupt.h>
-#include <linux/of_net.h>
-#include <linux/if_ether.h>
-#include <linux/if_vlan.h>
-
-#include <net/dst.h>
-
-#include "octeon-ethernet.h"
-#include "ethernet-defines.h"
-#include "ethernet-mem.h"
-#include "ethernet-rx.h"
-#include "ethernet-tx.h"
-#include "ethernet-mdio.h"
-#include "ethernet-util.h"
-
-#define OCTEON_MAX_MTU 65392
-
-static int num_packet_buffers = 1024;
-module_param(num_packet_buffers, int, 0444);
-MODULE_PARM_DESC(num_packet_buffers, "\n"
-	"\tNumber of packet buffers to allocate and store in the\n"
-	"\tFPA. By default, 1024 packet buffers are used.\n");
-
-static int pow_receive_group = 15;
-module_param(pow_receive_group, int, 0444);
-MODULE_PARM_DESC(pow_receive_group, "\n"
-	"\tPOW group to receive packets from. All ethernet hardware\n"
-	"\twill be configured to send incoming packets to this POW\n"
-	"\tgroup. Also any other software can submit packets to this\n"
-	"\tgroup for the kernel to process.");
-
-static int receive_group_order;
-module_param(receive_group_order, int, 0444);
-MODULE_PARM_DESC(receive_group_order, "\n"
-	"\tOrder (0..4) of receive groups to take into use. Ethernet hardware\n"
-	"\twill be configured to send incoming packets to multiple POW\n"
-	"\tgroups. pow_receive_group parameter is ignored when multiple\n"
-	"\tgroups are taken into use and groups are allocated starting\n"
-	"\tfrom 0. By default, a single group is used.\n");
-
-int pow_send_group = -1;
-module_param(pow_send_group, int, 0644);
-MODULE_PARM_DESC(pow_send_group, "\n"
-	"\tPOW group to send packets to other software on. This\n"
-	"\tcontrols the creation of the virtual device pow0.\n"
-	"\talways_use_pow also depends on this value.");
-
-int always_use_pow;
-module_param(always_use_pow, int, 0444);
-MODULE_PARM_DESC(always_use_pow, "\n"
-	"\tWhen set, always send to the pow group. This will cause\n"
-	"\tpackets sent to real ethernet devices to be sent to the\n"
-	"\tPOW group instead of the hardware. Unless some other\n"
-	"\tapplication changes the config, packets will still be\n"
-	"\treceived from the low level hardware. Use this option\n"
-	"\tto allow a CVMX app to intercept all packets from the\n"
-	"\tlinux kernel. You must specify pow_send_group along with\n"
-	"\tthis option.");
-
-char pow_send_list[128] = "";
-module_param_string(pow_send_list, pow_send_list, sizeof(pow_send_list), 0444);
-MODULE_PARM_DESC(pow_send_list, "\n"
-	"\tComma separated list of ethernet devices that should use the\n"
-	"\tPOW for transmit instead of the actual ethernet hardware. This\n"
-	"\tis a per port version of always_use_pow. always_use_pow takes\n"
-	"\tprecedence over this list. For example, setting this to\n"
-	"\t\"eth2,spi3,spi7\" would cause these three devices to transmit\n"
-	"\tusing the pow_send_group.");
-
-int rx_napi_weight = 32;
-module_param(rx_napi_weight, int, 0444);
-MODULE_PARM_DESC(rx_napi_weight, "The NAPI WEIGHT parameter.");
-
-/* Mask indicating which receive groups are in use. */
-int pow_receive_groups;
-
-/*
- * cvm_oct_poll_queue_stopping - flag to indicate polling should stop.
- *
- * Set to one right before cvm_oct_poll_queue is destroyed.
- */
-atomic_t cvm_oct_poll_queue_stopping = ATOMIC_INIT(0);
-
-/*
- * Array of every ethernet device owned by this driver indexed by
- * the ipd input port number.
- */
-struct net_device *cvm_oct_device[TOTAL_NUMBER_OF_PORTS];
-
-u64 cvm_oct_tx_poll_interval;
-
-static void cvm_oct_rx_refill_worker(struct work_struct *work);
-static DECLARE_DELAYED_WORK(cvm_oct_rx_refill_work, cvm_oct_rx_refill_worker);
-
-static void cvm_oct_rx_refill_worker(struct work_struct *work)
-{
-	/*
-	 * FPA 0 may have been drained, try to refill it if we need
-	 * more than num_packet_buffers / 2, otherwise normal receive
-	 * processing will refill it.  If it were drained, no packets
-	 * could be received so cvm_oct_napi_poll would never be
-	 * invoked to do the refill.
-	 */
-	cvm_oct_rx_refill_pool(num_packet_buffers / 2);
-
-	if (!atomic_read(&cvm_oct_poll_queue_stopping))
-		schedule_delayed_work(&cvm_oct_rx_refill_work, HZ);
-}
-
-static void cvm_oct_periodic_worker(struct work_struct *work)
-{
-	struct octeon_ethernet *priv = container_of(work,
-						    struct octeon_ethernet,
-						    port_periodic_work.work);
-
-	if (priv->poll)
-		priv->poll(cvm_oct_device[priv->port]);
-
-	cvm_oct_device[priv->port]->netdev_ops->ndo_get_stats
-						(cvm_oct_device[priv->port]);
-
-	if (!atomic_read(&cvm_oct_poll_queue_stopping))
-		schedule_delayed_work(&priv->port_periodic_work, HZ);
-}
-
-static void cvm_oct_configure_common_hw(void)
-{
-	/* Setup the FPA */
-	cvmx_fpa_enable();
-	cvm_oct_mem_fill_fpa(CVMX_FPA_PACKET_POOL, CVMX_FPA_PACKET_POOL_SIZE,
-			     num_packet_buffers);
-	cvm_oct_mem_fill_fpa(CVMX_FPA_WQE_POOL, CVMX_FPA_WQE_POOL_SIZE,
-			     num_packet_buffers);
-	if (CVMX_FPA_OUTPUT_BUFFER_POOL != CVMX_FPA_PACKET_POOL)
-		cvm_oct_mem_fill_fpa(CVMX_FPA_OUTPUT_BUFFER_POOL,
-				     CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE, 1024);
-
-#ifdef __LITTLE_ENDIAN
-	{
-		union cvmx_ipd_ctl_status ipd_ctl_status;
-
-		ipd_ctl_status.u64 = cvmx_read_csr(CVMX_IPD_CTL_STATUS);
-		ipd_ctl_status.s.pkt_lend = 1;
-		ipd_ctl_status.s.wqe_lend = 1;
-		cvmx_write_csr(CVMX_IPD_CTL_STATUS, ipd_ctl_status.u64);
-	}
-#endif
-
-	cvmx_helper_setup_red(num_packet_buffers / 4, num_packet_buffers / 8);
-}
-
-/**
- * cvm_oct_free_work- Free a work queue entry
- *
- * @work_queue_entry: Work queue entry to free
- *
- * Returns Zero on success, Negative on failure.
- */
-int cvm_oct_free_work(void *work_queue_entry)
-{
-	struct cvmx_wqe *work = work_queue_entry;
-
-	int segments = work->word2.s.bufs;
-	union cvmx_buf_ptr segment_ptr = work->packet_ptr;
-
-	while (segments--) {
-		union cvmx_buf_ptr next_ptr = *(union cvmx_buf_ptr *)
-			cvmx_phys_to_ptr(segment_ptr.s.addr - 8);
-		if (unlikely(!segment_ptr.s.i))
-			cvmx_fpa_free(cvm_oct_get_buffer_ptr(segment_ptr),
-				      segment_ptr.s.pool,
-				      CVMX_FPA_PACKET_POOL_SIZE / 128);
-		segment_ptr = next_ptr;
-	}
-	cvmx_fpa_free(work, CVMX_FPA_WQE_POOL, 1);
-
-	return 0;
-}
-EXPORT_SYMBOL(cvm_oct_free_work);
-
-/**
- * cvm_oct_common_get_stats - get the low level ethernet statistics
- * @dev:    Device to get the statistics from
- *
- * Returns Pointer to the statistics
- */
-static struct net_device_stats *cvm_oct_common_get_stats(struct net_device *dev)
-{
-	cvmx_pip_port_status_t rx_status;
-	cvmx_pko_port_status_t tx_status;
-	struct octeon_ethernet *priv = netdev_priv(dev);
-
-	if (priv->port < CVMX_PIP_NUM_INPUT_PORTS) {
-		if (octeon_is_simulation()) {
-			/* The simulator doesn't support statistics */
-			memset(&rx_status, 0, sizeof(rx_status));
-			memset(&tx_status, 0, sizeof(tx_status));
-		} else {
-			cvmx_pip_get_port_status(priv->port, 1, &rx_status);
-			cvmx_pko_get_port_status(priv->port, 1, &tx_status);
-		}
-
-		dev->stats.rx_packets += rx_status.inb_packets;
-		dev->stats.tx_packets += tx_status.packets;
-		dev->stats.rx_bytes += rx_status.inb_octets;
-		dev->stats.tx_bytes += tx_status.octets;
-		dev->stats.multicast += rx_status.multicast_packets;
-		dev->stats.rx_crc_errors += rx_status.inb_errors;
-		dev->stats.rx_frame_errors += rx_status.fcs_align_err_packets;
-		dev->stats.rx_dropped += rx_status.dropped_packets;
-	}
-
-	return &dev->stats;
-}
-
-/**
- * cvm_oct_common_change_mtu - change the link MTU
- * @dev:     Device to change
- * @new_mtu: The new MTU
- *
- * Returns Zero on success
- */
-static int cvm_oct_common_change_mtu(struct net_device *dev, int new_mtu)
-{
-	struct octeon_ethernet *priv = netdev_priv(dev);
-	int interface = INTERFACE(priv->port);
-#if IS_ENABLED(CONFIG_VLAN_8021Q)
-	int vlan_bytes = VLAN_HLEN;
-#else
-	int vlan_bytes = 0;
-#endif
-	int mtu_overhead = ETH_HLEN + ETH_FCS_LEN + vlan_bytes;
-
-	dev->mtu = new_mtu;
-
-	if ((interface < 2) &&
-	    (cvmx_helper_interface_get_mode(interface) !=
-		CVMX_HELPER_INTERFACE_MODE_SPI)) {
-		int index = INDEX(priv->port);
-		/* Add ethernet header and FCS, and VLAN if configured. */
-		int max_packet = new_mtu + mtu_overhead;
-
-		if (OCTEON_IS_MODEL(OCTEON_CN3XXX) ||
-		    OCTEON_IS_MODEL(OCTEON_CN58XX)) {
-			/* Signal errors on packets larger than the MTU */
-			cvmx_write_csr(CVMX_GMXX_RXX_FRM_MAX(index, interface),
-				       max_packet);
-		} else {
-			/*
-			 * Set the hardware to truncate packets larger
-			 * than the MTU and smaller the 64 bytes.
-			 */
-			union cvmx_pip_frm_len_chkx frm_len_chk;
-
-			frm_len_chk.u64 = 0;
-			frm_len_chk.s.minlen = VLAN_ETH_ZLEN;
-			frm_len_chk.s.maxlen = max_packet;
-			cvmx_write_csr(CVMX_PIP_FRM_LEN_CHKX(interface),
-				       frm_len_chk.u64);
-		}
-		/*
-		 * Set the hardware to truncate packets larger than
-		 * the MTU. The jabber register must be set to a
-		 * multiple of 8 bytes, so round up.
-		 */
-		cvmx_write_csr(CVMX_GMXX_RXX_JABBER(index, interface),
-			       (max_packet + 7) & ~7u);
-	}
-	return 0;
-}
-
-/**
- * cvm_oct_common_set_multicast_list - set the multicast list
- * @dev:    Device to work on
- */
-static void cvm_oct_common_set_multicast_list(struct net_device *dev)
-{
-	union cvmx_gmxx_prtx_cfg gmx_cfg;
-	struct octeon_ethernet *priv = netdev_priv(dev);
-	int interface = INTERFACE(priv->port);
-
-	if ((interface < 2) &&
-	    (cvmx_helper_interface_get_mode(interface) !=
-		CVMX_HELPER_INTERFACE_MODE_SPI)) {
-		union cvmx_gmxx_rxx_adr_ctl control;
-		int index = INDEX(priv->port);
-
-		control.u64 = 0;
-		control.s.bcst = 1;	/* Allow broadcast MAC addresses */
-
-		if (!netdev_mc_empty(dev) || (dev->flags & IFF_ALLMULTI) ||
-		    (dev->flags & IFF_PROMISC))
-			/* Force accept multicast packets */
-			control.s.mcst = 2;
-		else
-			/* Force reject multicast packets */
-			control.s.mcst = 1;
-
-		if (dev->flags & IFF_PROMISC)
-			/*
-			 * Reject matches if promisc. Since CAM is
-			 * shut off, should accept everything.
-			 */
-			control.s.cam_mode = 0;
-		else
-			/* Filter packets based on the CAM */
-			control.s.cam_mode = 1;
-
-		gmx_cfg.u64 =
-		    cvmx_read_csr(CVMX_GMXX_PRTX_CFG(index, interface));
-		cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface),
-			       gmx_cfg.u64 & ~1ull);
-
-		cvmx_write_csr(CVMX_GMXX_RXX_ADR_CTL(index, interface),
-			       control.u64);
-		if (dev->flags & IFF_PROMISC)
-			cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM_EN
-				       (index, interface), 0);
-		else
-			cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM_EN
-				       (index, interface), 1);
-
-		cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface),
-			       gmx_cfg.u64);
-	}
-}
-
-static int cvm_oct_set_mac_filter(struct net_device *dev)
-{
-	struct octeon_ethernet *priv = netdev_priv(dev);
-	union cvmx_gmxx_prtx_cfg gmx_cfg;
-	int interface = INTERFACE(priv->port);
-
-	if ((interface < 2) &&
-	    (cvmx_helper_interface_get_mode(interface) !=
-		CVMX_HELPER_INTERFACE_MODE_SPI)) {
-		int i;
-		u8 *ptr = dev->dev_addr;
-		u64 mac = 0;
-		int index = INDEX(priv->port);
-
-		for (i = 0; i < 6; i++)
-			mac = (mac << 8) | (u64)ptr[i];
-
-		gmx_cfg.u64 =
-		    cvmx_read_csr(CVMX_GMXX_PRTX_CFG(index, interface));
-		cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface),
-			       gmx_cfg.u64 & ~1ull);
-
-		cvmx_write_csr(CVMX_GMXX_SMACX(index, interface), mac);
-		cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM0(index, interface),
-			       ptr[0]);
-		cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM1(index, interface),
-			       ptr[1]);
-		cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM2(index, interface),
-			       ptr[2]);
-		cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM3(index, interface),
-			       ptr[3]);
-		cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM4(index, interface),
-			       ptr[4]);
-		cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM5(index, interface),
-			       ptr[5]);
-		cvm_oct_common_set_multicast_list(dev);
-		cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface),
-			       gmx_cfg.u64);
-	}
-	return 0;
-}
-
-/**
- * cvm_oct_common_set_mac_address - set the hardware MAC address for a device
- * @dev:    The device in question.
- * @addr:   Socket address.
- *
- * Returns Zero on success
- */
-static int cvm_oct_common_set_mac_address(struct net_device *dev, void *addr)
-{
-	int r = eth_mac_addr(dev, addr);
-
-	if (r)
-		return r;
-	return cvm_oct_set_mac_filter(dev);
-}
-
-/**
- * cvm_oct_common_init - per network device initialization
- * @dev:    Device to initialize
- *
- * Returns Zero on success
- */
-int cvm_oct_common_init(struct net_device *dev)
-{
-	struct octeon_ethernet *priv = netdev_priv(dev);
-	const u8 *mac = NULL;
-
-	if (priv->of_node)
-		mac = of_get_mac_address(priv->of_node);
-
-	if (!IS_ERR_OR_NULL(mac))
-		ether_addr_copy(dev->dev_addr, mac);
-	else
-		eth_hw_addr_random(dev);
-
-	/*
-	 * Force the interface to use the POW send if always_use_pow
-	 * was specified or it is in the pow send list.
-	 */
-	if ((pow_send_group != -1) &&
-	    (always_use_pow || strstr(pow_send_list, dev->name)))
-		priv->queue = -1;
-
-	if (priv->queue != -1)
-		dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM;
-
-	/* We do our own locking, Linux doesn't need to */
-	dev->features |= NETIF_F_LLTX;
-	dev->ethtool_ops = &cvm_oct_ethtool_ops;
-
-	cvm_oct_set_mac_filter(dev);
-	dev_set_mtu(dev, dev->mtu);
-
-	/*
-	 * Zero out stats for port so we won't mistakenly show
-	 * counters from the bootloader.
-	 */
-	memset(dev->netdev_ops->ndo_get_stats(dev), 0,
-	       sizeof(struct net_device_stats));
-
-	if (dev->netdev_ops->ndo_stop)
-		dev->netdev_ops->ndo_stop(dev);
-
-	return 0;
-}
-
-void cvm_oct_common_uninit(struct net_device *dev)
-{
-	if (dev->phydev)
-		phy_disconnect(dev->phydev);
-}
-
-int cvm_oct_common_open(struct net_device *dev,
-			void (*link_poll)(struct net_device *))
-{
-	union cvmx_gmxx_prtx_cfg gmx_cfg;
-	struct octeon_ethernet *priv = netdev_priv(dev);
-	int interface = INTERFACE(priv->port);
-	int index = INDEX(priv->port);
-	union cvmx_helper_link_info link_info;
-	int rv;
-
-	rv = cvm_oct_phy_setup_device(dev);
-	if (rv)
-		return rv;
-
-	gmx_cfg.u64 = cvmx_read_csr(CVMX_GMXX_PRTX_CFG(index, interface));
-	gmx_cfg.s.en = 1;
-	if (octeon_has_feature(OCTEON_FEATURE_PKND))
-		gmx_cfg.s.pknd = priv->port;
-	cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface), gmx_cfg.u64);
-
-	if (octeon_is_simulation())
-		return 0;
-
-	if (dev->phydev) {
-		int r = phy_read_status(dev->phydev);
-
-		if (r == 0 && dev->phydev->link == 0)
-			netif_carrier_off(dev);
-		cvm_oct_adjust_link(dev);
-	} else {
-		link_info = cvmx_helper_link_get(priv->port);
-		if (!link_info.s.link_up)
-			netif_carrier_off(dev);
-		priv->poll = link_poll;
-		link_poll(dev);
-	}
-
-	return 0;
-}
-
-void cvm_oct_link_poll(struct net_device *dev)
-{
-	struct octeon_ethernet *priv = netdev_priv(dev);
-	union cvmx_helper_link_info link_info;
-
-	link_info = cvmx_helper_link_get(priv->port);
-	if (link_info.u64 == priv->link_info)
-		return;
-
-	if (cvmx_helper_link_set(priv->port, link_info))
-		link_info.u64 = priv->link_info;
-	else
-		priv->link_info = link_info.u64;
-
-	if (link_info.s.link_up) {
-		if (!netif_carrier_ok(dev))
-			netif_carrier_on(dev);
-	} else if (netif_carrier_ok(dev)) {
-		netif_carrier_off(dev);
-	}
-	cvm_oct_note_carrier(priv, link_info);
-}
-
-static int cvm_oct_xaui_open(struct net_device *dev)
-{
-	return cvm_oct_common_open(dev, cvm_oct_link_poll);
-}
-
-static const struct net_device_ops cvm_oct_npi_netdev_ops = {
-	.ndo_init		= cvm_oct_common_init,
-	.ndo_uninit		= cvm_oct_common_uninit,
-	.ndo_start_xmit		= cvm_oct_xmit,
-	.ndo_set_rx_mode	= cvm_oct_common_set_multicast_list,
-	.ndo_set_mac_address	= cvm_oct_common_set_mac_address,
-	.ndo_do_ioctl		= cvm_oct_ioctl,
-	.ndo_change_mtu		= cvm_oct_common_change_mtu,
-	.ndo_get_stats		= cvm_oct_common_get_stats,
-#ifdef CONFIG_NET_POLL_CONTROLLER
-	.ndo_poll_controller	= cvm_oct_poll_controller,
-#endif
-};
-
-static const struct net_device_ops cvm_oct_xaui_netdev_ops = {
-	.ndo_init		= cvm_oct_common_init,
-	.ndo_uninit		= cvm_oct_common_uninit,
-	.ndo_open		= cvm_oct_xaui_open,
-	.ndo_stop		= cvm_oct_common_stop,
-	.ndo_start_xmit		= cvm_oct_xmit,
-	.ndo_set_rx_mode	= cvm_oct_common_set_multicast_list,
-	.ndo_set_mac_address	= cvm_oct_common_set_mac_address,
-	.ndo_do_ioctl		= cvm_oct_ioctl,
-	.ndo_change_mtu		= cvm_oct_common_change_mtu,
-	.ndo_get_stats		= cvm_oct_common_get_stats,
-#ifdef CONFIG_NET_POLL_CONTROLLER
-	.ndo_poll_controller	= cvm_oct_poll_controller,
-#endif
-};
-
-static const struct net_device_ops cvm_oct_sgmii_netdev_ops = {
-	.ndo_init		= cvm_oct_sgmii_init,
-	.ndo_uninit		= cvm_oct_common_uninit,
-	.ndo_open		= cvm_oct_sgmii_open,
-	.ndo_stop		= cvm_oct_common_stop,
-	.ndo_start_xmit		= cvm_oct_xmit,
-	.ndo_set_rx_mode	= cvm_oct_common_set_multicast_list,
-	.ndo_set_mac_address	= cvm_oct_common_set_mac_address,
-	.ndo_do_ioctl		= cvm_oct_ioctl,
-	.ndo_change_mtu		= cvm_oct_common_change_mtu,
-	.ndo_get_stats		= cvm_oct_common_get_stats,
-#ifdef CONFIG_NET_POLL_CONTROLLER
-	.ndo_poll_controller	= cvm_oct_poll_controller,
-#endif
-};
-
-static const struct net_device_ops cvm_oct_spi_netdev_ops = {
-	.ndo_init		= cvm_oct_spi_init,
-	.ndo_uninit		= cvm_oct_spi_uninit,
-	.ndo_start_xmit		= cvm_oct_xmit,
-	.ndo_set_rx_mode	= cvm_oct_common_set_multicast_list,
-	.ndo_set_mac_address	= cvm_oct_common_set_mac_address,
-	.ndo_do_ioctl		= cvm_oct_ioctl,
-	.ndo_change_mtu		= cvm_oct_common_change_mtu,
-	.ndo_get_stats		= cvm_oct_common_get_stats,
-#ifdef CONFIG_NET_POLL_CONTROLLER
-	.ndo_poll_controller	= cvm_oct_poll_controller,
-#endif
-};
-
-static const struct net_device_ops cvm_oct_rgmii_netdev_ops = {
-	.ndo_init		= cvm_oct_common_init,
-	.ndo_uninit		= cvm_oct_common_uninit,
-	.ndo_open		= cvm_oct_rgmii_open,
-	.ndo_stop		= cvm_oct_common_stop,
-	.ndo_start_xmit		= cvm_oct_xmit,
-	.ndo_set_rx_mode	= cvm_oct_common_set_multicast_list,
-	.ndo_set_mac_address	= cvm_oct_common_set_mac_address,
-	.ndo_do_ioctl		= cvm_oct_ioctl,
-	.ndo_change_mtu		= cvm_oct_common_change_mtu,
-	.ndo_get_stats		= cvm_oct_common_get_stats,
-#ifdef CONFIG_NET_POLL_CONTROLLER
-	.ndo_poll_controller	= cvm_oct_poll_controller,
-#endif
-};
-
-static const struct net_device_ops cvm_oct_pow_netdev_ops = {
-	.ndo_init		= cvm_oct_common_init,
-	.ndo_start_xmit		= cvm_oct_xmit_pow,
-	.ndo_set_rx_mode	= cvm_oct_common_set_multicast_list,
-	.ndo_set_mac_address	= cvm_oct_common_set_mac_address,
-	.ndo_do_ioctl		= cvm_oct_ioctl,
-	.ndo_change_mtu		= cvm_oct_common_change_mtu,
-	.ndo_get_stats		= cvm_oct_common_get_stats,
-#ifdef CONFIG_NET_POLL_CONTROLLER
-	.ndo_poll_controller	= cvm_oct_poll_controller,
-#endif
-};
-
-static struct device_node *cvm_oct_of_get_child
-				(const struct device_node *parent, int reg_val)
-{
-	struct device_node *node = NULL;
-	int size;
-	const __be32 *addr;
-
-	for (;;) {
-		node = of_get_next_child(parent, node);
-		if (!node)
-			break;
-		addr = of_get_property(node, "reg", &size);
-		if (addr && (be32_to_cpu(*addr) == reg_val))
-			break;
-	}
-	return node;
-}
-
-static struct device_node *cvm_oct_node_for_port(struct device_node *pip,
-						 int interface, int port)
-{
-	struct device_node *ni, *np;
-
-	ni = cvm_oct_of_get_child(pip, interface);
-	if (!ni)
-		return NULL;
-
-	np = cvm_oct_of_get_child(ni, port);
-	of_node_put(ni);
-
-	return np;
-}
-
-static void cvm_set_rgmii_delay(struct octeon_ethernet *priv, int iface,
-				int port)
-{
-	struct device_node *np = priv->of_node;
-	u32 delay_value;
-	bool rx_delay;
-	bool tx_delay;
-
-	/* By default, both RX/TX delay is enabled in
-	 * __cvmx_helper_rgmii_enable().
-	 */
-	rx_delay = true;
-	tx_delay = true;
-
-	if (!of_property_read_u32(np, "rx-delay", &delay_value)) {
-		cvmx_write_csr(CVMX_ASXX_RX_CLK_SETX(port, iface), delay_value);
-		rx_delay = delay_value > 0;
-	}
-	if (!of_property_read_u32(np, "tx-delay", &delay_value)) {
-		cvmx_write_csr(CVMX_ASXX_TX_CLK_SETX(port, iface), delay_value);
-		tx_delay = delay_value > 0;
-	}
-
-	if (!rx_delay && !tx_delay)
-		priv->phy_mode = PHY_INTERFACE_MODE_RGMII_ID;
-	else if (!rx_delay)
-		priv->phy_mode = PHY_INTERFACE_MODE_RGMII_RXID;
-	else if (!tx_delay)
-		priv->phy_mode = PHY_INTERFACE_MODE_RGMII_TXID;
-	else
-		priv->phy_mode = PHY_INTERFACE_MODE_RGMII;
-}
-
-static int cvm_oct_probe(struct platform_device *pdev)
-{
-	int num_interfaces;
-	int interface;
-	int fau = FAU_NUM_PACKET_BUFFERS_TO_FREE;
-	int qos;
-	struct device_node *pip;
-	int mtu_overhead = ETH_HLEN + ETH_FCS_LEN;
-
-#if IS_ENABLED(CONFIG_VLAN_8021Q)
-	mtu_overhead += VLAN_HLEN;
-#endif
-
-	octeon_mdiobus_force_mod_depencency();
-
-	pip = pdev->dev.of_node;
-	if (!pip) {
-		pr_err("Error: No 'pip' in /aliases\n");
-		return -EINVAL;
-	}
-
-	cvm_oct_configure_common_hw();
-
-	cvmx_helper_initialize_packet_io_global();
-
-	if (receive_group_order) {
-		if (receive_group_order > 4)
-			receive_group_order = 4;
-		pow_receive_groups = (1 << (1 << receive_group_order)) - 1;
-	} else {
-		pow_receive_groups = BIT(pow_receive_group);
-	}
-
-	/* Change the input group for all ports before input is enabled */
-	num_interfaces = cvmx_helper_get_number_of_interfaces();
-	for (interface = 0; interface < num_interfaces; interface++) {
-		int num_ports = cvmx_helper_ports_on_interface(interface);
-		int port;
-
-		for (port = cvmx_helper_get_ipd_port(interface, 0);
-		     port < cvmx_helper_get_ipd_port(interface, num_ports);
-		     port++) {
-			union cvmx_pip_prt_tagx pip_prt_tagx;
-
-			pip_prt_tagx.u64 =
-			    cvmx_read_csr(CVMX_PIP_PRT_TAGX(port));
-
-			if (receive_group_order) {
-				int tag_mask;
-
-				/* We support only 16 groups at the moment, so
-				 * always disable the two additional "hidden"
-				 * tag_mask bits on CN68XX.
-				 */
-				if (OCTEON_IS_MODEL(OCTEON_CN68XX))
-					pip_prt_tagx.u64 |= 0x3ull << 44;
-
-				tag_mask = ~((1 << receive_group_order) - 1);
-				pip_prt_tagx.s.grptagbase	= 0;
-				pip_prt_tagx.s.grptagmask	= tag_mask;
-				pip_prt_tagx.s.grptag		= 1;
-				pip_prt_tagx.s.tag_mode		= 0;
-				pip_prt_tagx.s.inc_prt_flag	= 1;
-				pip_prt_tagx.s.ip6_dprt_flag	= 1;
-				pip_prt_tagx.s.ip4_dprt_flag	= 1;
-				pip_prt_tagx.s.ip6_sprt_flag	= 1;
-				pip_prt_tagx.s.ip4_sprt_flag	= 1;
-				pip_prt_tagx.s.ip6_dst_flag	= 1;
-				pip_prt_tagx.s.ip4_dst_flag	= 1;
-				pip_prt_tagx.s.ip6_src_flag	= 1;
-				pip_prt_tagx.s.ip4_src_flag	= 1;
-				pip_prt_tagx.s.grp		= 0;
-			} else {
-				pip_prt_tagx.s.grptag	= 0;
-				pip_prt_tagx.s.grp	= pow_receive_group;
-			}
-
-			cvmx_write_csr(CVMX_PIP_PRT_TAGX(port),
-				       pip_prt_tagx.u64);
-		}
-	}
-
-	cvmx_helper_ipd_and_packet_input_enable();
-
-	memset(cvm_oct_device, 0, sizeof(cvm_oct_device));
-
-	/*
-	 * Initialize the FAU used for counting packet buffers that
-	 * need to be freed.
-	 */
-	cvmx_fau_atomic_write32(FAU_NUM_PACKET_BUFFERS_TO_FREE, 0);
-
-	/* Initialize the FAU used for counting tx SKBs that need to be freed */
-	cvmx_fau_atomic_write32(FAU_TOTAL_TX_TO_CLEAN, 0);
-
-	if ((pow_send_group != -1)) {
-		struct net_device *dev;
-
-		dev = alloc_etherdev(sizeof(struct octeon_ethernet));
-		if (dev) {
-			/* Initialize the device private structure. */
-			struct octeon_ethernet *priv = netdev_priv(dev);
-
-			SET_NETDEV_DEV(dev, &pdev->dev);
-			dev->netdev_ops = &cvm_oct_pow_netdev_ops;
-			priv->imode = CVMX_HELPER_INTERFACE_MODE_DISABLED;
-			priv->port = CVMX_PIP_NUM_INPUT_PORTS;
-			priv->queue = -1;
-			strscpy(dev->name, "pow%d", sizeof(dev->name));
-			for (qos = 0; qos < 16; qos++)
-				skb_queue_head_init(&priv->tx_free_list[qos]);
-			dev->min_mtu = VLAN_ETH_ZLEN - mtu_overhead;
-			dev->max_mtu = OCTEON_MAX_MTU - mtu_overhead;
-
-			if (register_netdev(dev) < 0) {
-				pr_err("Failed to register ethernet device for POW\n");
-				free_netdev(dev);
-			} else {
-				cvm_oct_device[CVMX_PIP_NUM_INPUT_PORTS] = dev;
-				pr_info("%s: POW send group %d, receive group %d\n",
-					dev->name, pow_send_group,
-					pow_receive_group);
-			}
-		} else {
-			pr_err("Failed to allocate ethernet device for POW\n");
-		}
-	}
-
-	num_interfaces = cvmx_helper_get_number_of_interfaces();
-	for (interface = 0; interface < num_interfaces; interface++) {
-		cvmx_helper_interface_mode_t imode =
-		    cvmx_helper_interface_get_mode(interface);
-		int num_ports = cvmx_helper_ports_on_interface(interface);
-		int port;
-		int port_index;
-
-		for (port_index = 0,
-		     port = cvmx_helper_get_ipd_port(interface, 0);
-		     port < cvmx_helper_get_ipd_port(interface, num_ports);
-		     port_index++, port++) {
-			struct octeon_ethernet *priv;
-			struct net_device *dev =
-			    alloc_etherdev(sizeof(struct octeon_ethernet));
-			if (!dev) {
-				pr_err("Failed to allocate ethernet device for port %d\n",
-				       port);
-				continue;
-			}
-
-			/* Initialize the device private structure. */
-			SET_NETDEV_DEV(dev, &pdev->dev);
-			priv = netdev_priv(dev);
-			priv->netdev = dev;
-			priv->of_node = cvm_oct_node_for_port(pip, interface,
-							      port_index);
-
-			INIT_DELAYED_WORK(&priv->port_periodic_work,
-					  cvm_oct_periodic_worker);
-			priv->imode = imode;
-			priv->port = port;
-			priv->queue = cvmx_pko_get_base_queue(priv->port);
-			priv->fau = fau - cvmx_pko_get_num_queues(port) * 4;
-			priv->phy_mode = PHY_INTERFACE_MODE_NA;
-			for (qos = 0; qos < 16; qos++)
-				skb_queue_head_init(&priv->tx_free_list[qos]);
-			for (qos = 0; qos < cvmx_pko_get_num_queues(port);
-			     qos++)
-				cvmx_fau_atomic_write32(priv->fau + qos * 4, 0);
-			dev->min_mtu = VLAN_ETH_ZLEN - mtu_overhead;
-			dev->max_mtu = OCTEON_MAX_MTU - mtu_overhead;
-
-			switch (priv->imode) {
-			/* These types don't support ports to IPD/PKO */
-			case CVMX_HELPER_INTERFACE_MODE_DISABLED:
-			case CVMX_HELPER_INTERFACE_MODE_PCIE:
-			case CVMX_HELPER_INTERFACE_MODE_PICMG:
-				break;
-
-			case CVMX_HELPER_INTERFACE_MODE_NPI:
-				dev->netdev_ops = &cvm_oct_npi_netdev_ops;
-				strscpy(dev->name, "npi%d", sizeof(dev->name));
-				break;
-
-			case CVMX_HELPER_INTERFACE_MODE_XAUI:
-				dev->netdev_ops = &cvm_oct_xaui_netdev_ops;
-				strscpy(dev->name, "xaui%d", sizeof(dev->name));
-				break;
-
-			case CVMX_HELPER_INTERFACE_MODE_LOOP:
-				dev->netdev_ops = &cvm_oct_npi_netdev_ops;
-				strscpy(dev->name, "loop%d", sizeof(dev->name));
-				break;
-
-			case CVMX_HELPER_INTERFACE_MODE_SGMII:
-				priv->phy_mode = PHY_INTERFACE_MODE_SGMII;
-				dev->netdev_ops = &cvm_oct_sgmii_netdev_ops;
-				strscpy(dev->name, "eth%d", sizeof(dev->name));
-				break;
-
-			case CVMX_HELPER_INTERFACE_MODE_SPI:
-				dev->netdev_ops = &cvm_oct_spi_netdev_ops;
-				strscpy(dev->name, "spi%d", sizeof(dev->name));
-				break;
-
-			case CVMX_HELPER_INTERFACE_MODE_GMII:
-				priv->phy_mode = PHY_INTERFACE_MODE_GMII;
-				dev->netdev_ops = &cvm_oct_rgmii_netdev_ops;
-				strscpy(dev->name, "eth%d", sizeof(dev->name));
-				break;
-
-			case CVMX_HELPER_INTERFACE_MODE_RGMII:
-				dev->netdev_ops = &cvm_oct_rgmii_netdev_ops;
-				strscpy(dev->name, "eth%d", sizeof(dev->name));
-				cvm_set_rgmii_delay(priv, interface,
-						    port_index);
-				break;
-			}
-
-			if (!dev->netdev_ops) {
-				free_netdev(dev);
-			} else if (register_netdev(dev) < 0) {
-				pr_err("Failed to register ethernet device for interface %d, port %d\n",
-				       interface, priv->port);
-				free_netdev(dev);
-			} else {
-				cvm_oct_device[priv->port] = dev;
-				fau -=
-				    cvmx_pko_get_num_queues(priv->port) *
-				    sizeof(u32);
-				schedule_delayed_work(&priv->port_periodic_work,
-						      HZ);
-			}
-		}
-	}
-
-	cvm_oct_tx_initialize();
-	cvm_oct_rx_initialize();
-
-	/*
-	 * 150 uS: about 10 1500-byte packets at 1GE.
-	 */
-	cvm_oct_tx_poll_interval = 150 * (octeon_get_clock_rate() / 1000000);
-
-	schedule_delayed_work(&cvm_oct_rx_refill_work, HZ);
-
-	return 0;
-}
-
-static int cvm_oct_remove(struct platform_device *pdev)
-{
-	int port;
-
-	cvmx_ipd_disable();
-
-	atomic_inc_return(&cvm_oct_poll_queue_stopping);
-	cancel_delayed_work_sync(&cvm_oct_rx_refill_work);
-
-	cvm_oct_rx_shutdown();
-	cvm_oct_tx_shutdown();
-
-	cvmx_pko_disable();
-
-	/* Free the ethernet devices */
-	for (port = 0; port < TOTAL_NUMBER_OF_PORTS; port++) {
-		if (cvm_oct_device[port]) {
-			struct net_device *dev = cvm_oct_device[port];
-			struct octeon_ethernet *priv = netdev_priv(dev);
-
-			cancel_delayed_work_sync(&priv->port_periodic_work);
-
-			cvm_oct_tx_shutdown_dev(dev);
-			unregister_netdev(dev);
-			free_netdev(dev);
-			cvm_oct_device[port] = NULL;
-		}
-	}
-
-	cvmx_pko_shutdown();
-
-	cvmx_ipd_free_ptr();
-
-	/* Free the HW pools */
-	cvm_oct_mem_empty_fpa(CVMX_FPA_PACKET_POOL, CVMX_FPA_PACKET_POOL_SIZE,
-			      num_packet_buffers);
-	cvm_oct_mem_empty_fpa(CVMX_FPA_WQE_POOL, CVMX_FPA_WQE_POOL_SIZE,
-			      num_packet_buffers);
-	if (CVMX_FPA_OUTPUT_BUFFER_POOL != CVMX_FPA_PACKET_POOL)
-		cvm_oct_mem_empty_fpa(CVMX_FPA_OUTPUT_BUFFER_POOL,
-				      CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE, 128);
-	return 0;
-}
-
-static const struct of_device_id cvm_oct_match[] = {
-	{
-		.compatible = "cavium,octeon-3860-pip",
-	},
-	{},
-};
-MODULE_DEVICE_TABLE(of, cvm_oct_match);
-
-static struct platform_driver cvm_oct_driver = {
-	.probe		= cvm_oct_probe,
-	.remove		= cvm_oct_remove,
-	.driver		= {
-		.name	= KBUILD_MODNAME,
-		.of_match_table = cvm_oct_match,
-	},
-};
-
-module_platform_driver(cvm_oct_driver);
-
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Cavium Networks <support@caviumnetworks.com>");
-MODULE_DESCRIPTION("Cavium Networks Octeon ethernet driver.");
diff --git a/drivers/staging/octeon/octeon-ethernet.h b/drivers/staging/octeon/octeon-ethernet.h
deleted file mode 100644
index a6140705706f..000000000000
--- a/drivers/staging/octeon/octeon-ethernet.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * This file is based on code from OCTEON SDK by Cavium Networks.
- *
- * Copyright (c) 2003-2010 Cavium Networks
- */
-
-/*
- * External interface for the Cavium Octeon ethernet driver.
- */
-#ifndef OCTEON_ETHERNET_H
-#define OCTEON_ETHERNET_H
-
-#include <linux/of.h>
-#include <linux/phy.h>
-
-#ifdef CONFIG_CAVIUM_OCTEON_SOC
-
-#include <asm/octeon/octeon.h>
-
-#include <asm/octeon/cvmx-asxx-defs.h>
-#include <asm/octeon/cvmx-config.h>
-#include <asm/octeon/cvmx-fau.h>
-#include <asm/octeon/cvmx-gmxx-defs.h>
-#include <asm/octeon/cvmx-helper.h>
-#include <asm/octeon/cvmx-helper-util.h>
-#include <asm/octeon/cvmx-ipd.h>
-#include <asm/octeon/cvmx-ipd-defs.h>
-#include <asm/octeon/cvmx-npi-defs.h>
-#include <asm/octeon/cvmx-pip.h>
-#include <asm/octeon/cvmx-pko.h>
-#include <asm/octeon/cvmx-pow.h>
-#include <asm/octeon/cvmx-scratch.h>
-#include <asm/octeon/cvmx-spi.h>
-#include <asm/octeon/cvmx-spxx-defs.h>
-#include <asm/octeon/cvmx-stxx-defs.h>
-#include <asm/octeon/cvmx-wqe.h>
-
-#else
-
-#include "octeon-stubs.h"
-
-#endif
-
-/**
- * This is the definition of the Ethernet driver's private
- * driver state stored in netdev_priv(dev).
- */
-struct octeon_ethernet {
-	/* PKO hardware output port */
-	int port;
-	/* PKO hardware queue for the port */
-	int queue;
-	/* Hardware fetch and add to count outstanding tx buffers */
-	int fau;
-	/* My netdev. */
-	struct net_device *netdev;
-	/*
-	 * Type of port. This is one of the enums in
-	 * cvmx_helper_interface_mode_t
-	 */
-	int imode;
-	/* PHY mode */
-	phy_interface_t phy_mode;
-	/* List of outstanding tx buffers per queue */
-	struct sk_buff_head tx_free_list[16];
-	unsigned int last_speed;
-	unsigned int last_link;
-	/* Last negotiated link state */
-	u64 link_info;
-	/* Called periodically to check link status */
-	void (*poll)(struct net_device *dev);
-	struct delayed_work	port_periodic_work;
-	struct device_node	*of_node;
-};
-
-int cvm_oct_free_work(void *work_queue_entry);
-
-int cvm_oct_rgmii_open(struct net_device *dev);
-
-int cvm_oct_sgmii_init(struct net_device *dev);
-int cvm_oct_sgmii_open(struct net_device *dev);
-
-int cvm_oct_spi_init(struct net_device *dev);
-void cvm_oct_spi_uninit(struct net_device *dev);
-
-int cvm_oct_common_init(struct net_device *dev);
-void cvm_oct_common_uninit(struct net_device *dev);
-void cvm_oct_adjust_link(struct net_device *dev);
-int cvm_oct_common_stop(struct net_device *dev);
-int cvm_oct_common_open(struct net_device *dev,
-			void (*link_poll)(struct net_device *));
-void cvm_oct_note_carrier(struct octeon_ethernet *priv,
-			  union cvmx_helper_link_info li);
-void cvm_oct_link_poll(struct net_device *dev);
-
-extern int always_use_pow;
-extern int pow_send_group;
-extern int pow_receive_groups;
-extern char pow_send_list[];
-extern struct net_device *cvm_oct_device[];
-extern atomic_t cvm_oct_poll_queue_stopping;
-extern u64 cvm_oct_tx_poll_interval;
-
-extern int rx_napi_weight;
-
-#endif
diff --git a/drivers/staging/octeon/octeon-stubs.h b/drivers/staging/octeon/octeon-stubs.h
deleted file mode 100644
index 79213c045504..000000000000
--- a/drivers/staging/octeon/octeon-stubs.h
+++ /dev/null
@@ -1,1433 +0,0 @@
-#define CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE	512
-
-#ifndef XKPHYS_TO_PHYS
-# define XKPHYS_TO_PHYS(p)			(p)
-#endif
-
-#define OCTEON_IRQ_WORKQ0 0
-#define OCTEON_IRQ_RML 0
-#define OCTEON_IRQ_TIMER1 0
-#define OCTEON_IS_MODEL(x) 0
-#define octeon_has_feature(x)	0
-#define octeon_get_clock_rate()	0
-
-#define CVMX_SYNCIOBDMA		do { } while(0)
-
-#define CVMX_HELPER_INPUT_TAG_TYPE	0
-#define CVMX_HELPER_FIRST_MBUFF_SKIP	7
-#define CVMX_FAU_REG_END		(2048)
-#define CVMX_FPA_OUTPUT_BUFFER_POOL	    (2)
-#define CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE    16
-#define CVMX_FPA_PACKET_POOL		    (0)
-#define CVMX_FPA_PACKET_POOL_SIZE	    16
-#define CVMX_FPA_WQE_POOL		    (1)
-#define CVMX_FPA_WQE_POOL_SIZE		    16
-#define CVMX_GMXX_RXX_ADR_CAM_EN(a, b)	((a)+(b))
-#define CVMX_GMXX_RXX_ADR_CTL(a, b)	((a)+(b))
-#define CVMX_GMXX_PRTX_CFG(a, b)	((a)+(b))
-#define CVMX_GMXX_RXX_FRM_MAX(a, b)	((a)+(b))
-#define CVMX_GMXX_RXX_JABBER(a, b)	((a)+(b))
-#define CVMX_IPD_CTL_STATUS		0
-#define CVMX_PIP_FRM_LEN_CHKX(a)	(a)
-#define CVMX_PIP_NUM_INPUT_PORTS	1
-#define CVMX_SCR_SCRATCH		0
-#define CVMX_PKO_QUEUES_PER_PORT_INTERFACE0	2
-#define CVMX_PKO_QUEUES_PER_PORT_INTERFACE1	2
-#define CVMX_IPD_SUB_PORT_FCS		0
-#define CVMX_SSO_WQ_IQ_DIS		0
-#define CVMX_SSO_WQ_INT			0
-#define CVMX_POW_WQ_INT			0
-#define CVMX_SSO_WQ_INT_PC		0
-#define CVMX_NPI_RSL_INT_BLOCKS		0
-#define CVMX_POW_WQ_INT_PC		0
-
-union cvmx_pip_wqe_word2 {
-	uint64_t u64;
-	struct {
-		uint64_t bufs:8;
-		uint64_t ip_offset:8;
-		uint64_t vlan_valid:1;
-		uint64_t vlan_stacked:1;
-		uint64_t unassigned:1;
-		uint64_t vlan_cfi:1;
-		uint64_t vlan_id:12;
-		uint64_t pr:4;
-		uint64_t unassigned2:8;
-		uint64_t dec_ipcomp:1;
-		uint64_t tcp_or_udp:1;
-		uint64_t dec_ipsec:1;
-		uint64_t is_v6:1;
-		uint64_t software:1;
-		uint64_t L4_error:1;
-		uint64_t is_frag:1;
-		uint64_t IP_exc:1;
-		uint64_t is_bcast:1;
-		uint64_t is_mcast:1;
-		uint64_t not_IP:1;
-		uint64_t rcv_error:1;
-		uint64_t err_code:8;
-	} s;
-	struct {
-		uint64_t bufs:8;
-		uint64_t ip_offset:8;
-		uint64_t vlan_valid:1;
-		uint64_t vlan_stacked:1;
-		uint64_t unassigned:1;
-		uint64_t vlan_cfi:1;
-		uint64_t vlan_id:12;
-		uint64_t port:12;
-		uint64_t dec_ipcomp:1;
-		uint64_t tcp_or_udp:1;
-		uint64_t dec_ipsec:1;
-		uint64_t is_v6:1;
-		uint64_t software:1;
-		uint64_t L4_error:1;
-		uint64_t is_frag:1;
-		uint64_t IP_exc:1;
-		uint64_t is_bcast:1;
-		uint64_t is_mcast:1;
-		uint64_t not_IP:1;
-		uint64_t rcv_error:1;
-		uint64_t err_code:8;
-	} s_cn68xx;
-
-	struct {
-		uint64_t unused1:16;
-		uint64_t vlan:16;
-		uint64_t unused2:32;
-	} svlan;
-	struct {
-		uint64_t bufs:8;
-		uint64_t unused:8;
-		uint64_t vlan_valid:1;
-		uint64_t vlan_stacked:1;
-		uint64_t unassigned:1;
-		uint64_t vlan_cfi:1;
-		uint64_t vlan_id:12;
-		uint64_t pr:4;
-		uint64_t unassigned2:12;
-		uint64_t software:1;
-		uint64_t unassigned3:1;
-		uint64_t is_rarp:1;
-		uint64_t is_arp:1;
-		uint64_t is_bcast:1;
-		uint64_t is_mcast:1;
-		uint64_t not_IP:1;
-		uint64_t rcv_error:1;
-		uint64_t err_code:8;
-	} snoip;
-
-};
-
-union cvmx_pip_wqe_word0 {
-	struct {
-		uint64_t next_ptr:40;
-		uint8_t unused;
-		__wsum hw_chksum;
-	} cn38xx;
-	struct {
-		uint64_t pknd:6;        /* 0..5 */
-		uint64_t unused2:2;     /* 6..7 */
-		uint64_t bpid:6;        /* 8..13 */
-		uint64_t unused1:18;    /* 14..31 */
-		uint64_t l2ptr:8;       /* 32..39 */
-		uint64_t l3ptr:8;       /* 40..47 */
-		uint64_t unused0:8;     /* 48..55 */
-		uint64_t l4ptr:8;       /* 56..63 */
-	} cn68xx;
-};
-
-union cvmx_wqe_word0 {
-	uint64_t u64;
-	union cvmx_pip_wqe_word0 pip;
-};
-
-union cvmx_wqe_word1 {
-	uint64_t u64;
-	struct {
-		uint64_t tag:32;
-		uint64_t tag_type:2;
-		uint64_t varies:14;
-		uint64_t len:16;
-	};
-	struct {
-		uint64_t tag:32;
-		uint64_t tag_type:2;
-		uint64_t zero_2:3;
-		uint64_t grp:6;
-		uint64_t zero_1:1;
-		uint64_t qos:3;
-		uint64_t zero_0:1;
-		uint64_t len:16;
-	} cn68xx;
-	struct {
-		uint64_t tag:32;
-		uint64_t tag_type:2;
-		uint64_t zero_2:1;
-		uint64_t grp:4;
-		uint64_t qos:3;
-		uint64_t ipprt:6;
-		uint64_t len:16;
-	} cn38xx;
-};
-
-union cvmx_buf_ptr {
-	void *ptr;
-	uint64_t u64;
-	struct {
-		uint64_t i:1;
-		uint64_t back:4;
-		uint64_t pool:3;
-		uint64_t size:16;
-		uint64_t addr:40;
-	} s;
-};
-
-struct cvmx_wqe {
-	union cvmx_wqe_word0 word0;
-	union cvmx_wqe_word1 word1;
-	union cvmx_pip_wqe_word2 word2;
-	union cvmx_buf_ptr packet_ptr;
-	uint8_t packet_data[96];
-};
-
-union cvmx_helper_link_info {
-	uint64_t u64;
-	struct {
-		uint64_t reserved_20_63:44;
-		uint64_t link_up:1;	    /**< Is the physical link up? */
-		uint64_t full_duplex:1;	    /**< 1 if the link is full duplex */
-		uint64_t speed:18;	    /**< Speed of the link in Mbps */
-	} s;
-};
-
-enum cvmx_fau_reg_32 {
-	CVMX_FAU_REG_32_START	= 0,
-};
-
-enum cvmx_fau_op_size {
-	CVMX_FAU_OP_SIZE_8 = 0,
-	CVMX_FAU_OP_SIZE_16 = 1,
-	CVMX_FAU_OP_SIZE_32 = 2,
-	CVMX_FAU_OP_SIZE_64 = 3
-};
-
-typedef enum {
-	CVMX_SPI_MODE_UNKNOWN = 0,
-	CVMX_SPI_MODE_TX_HALFPLEX = 1,
-	CVMX_SPI_MODE_RX_HALFPLEX = 2,
-	CVMX_SPI_MODE_DUPLEX = 3
-} cvmx_spi_mode_t;
-
-typedef enum {
-	CVMX_HELPER_INTERFACE_MODE_DISABLED,
-	CVMX_HELPER_INTERFACE_MODE_RGMII,
-	CVMX_HELPER_INTERFACE_MODE_GMII,
-	CVMX_HELPER_INTERFACE_MODE_SPI,
-	CVMX_HELPER_INTERFACE_MODE_PCIE,
-	CVMX_HELPER_INTERFACE_MODE_XAUI,
-	CVMX_HELPER_INTERFACE_MODE_SGMII,
-	CVMX_HELPER_INTERFACE_MODE_PICMG,
-	CVMX_HELPER_INTERFACE_MODE_NPI,
-	CVMX_HELPER_INTERFACE_MODE_LOOP,
-} cvmx_helper_interface_mode_t;
-
-typedef enum {
-	CVMX_POW_WAIT = 1,
-	CVMX_POW_NO_WAIT = 0,
-} cvmx_pow_wait_t;
-
-typedef enum {
-	CVMX_PKO_LOCK_NONE = 0,
-	CVMX_PKO_LOCK_ATOMIC_TAG = 1,
-	CVMX_PKO_LOCK_CMD_QUEUE = 2,
-} cvmx_pko_lock_t;
-
-typedef enum {
-	CVMX_PKO_SUCCESS,
-	CVMX_PKO_INVALID_PORT,
-	CVMX_PKO_INVALID_QUEUE,
-	CVMX_PKO_INVALID_PRIORITY,
-	CVMX_PKO_NO_MEMORY,
-	CVMX_PKO_PORT_ALREADY_SETUP,
-	CVMX_PKO_CMD_QUEUE_INIT_ERROR
-} cvmx_pko_status_t;
-
-enum cvmx_pow_tag_type {
-	CVMX_POW_TAG_TYPE_ORDERED   = 0L,
-	CVMX_POW_TAG_TYPE_ATOMIC    = 1L,
-	CVMX_POW_TAG_TYPE_NULL	    = 2L,
-	CVMX_POW_TAG_TYPE_NULL_NULL = 3L
-};
-
-union cvmx_ipd_ctl_status {
-	uint64_t u64;
-	struct cvmx_ipd_ctl_status_s {
-		uint64_t reserved_18_63:46;
-		uint64_t use_sop:1;
-		uint64_t rst_done:1;
-		uint64_t clken:1;
-		uint64_t no_wptr:1;
-		uint64_t pq_apkt:1;
-		uint64_t pq_nabuf:1;
-		uint64_t ipd_full:1;
-		uint64_t pkt_off:1;
-		uint64_t len_m8:1;
-		uint64_t reset:1;
-		uint64_t addpkt:1;
-		uint64_t naddbuf:1;
-		uint64_t pkt_lend:1;
-		uint64_t wqe_lend:1;
-		uint64_t pbp_en:1;
-		uint64_t opc_mode:2;
-		uint64_t ipd_en:1;
-	} s;
-	struct cvmx_ipd_ctl_status_cn30xx {
-		uint64_t reserved_10_63:54;
-		uint64_t len_m8:1;
-		uint64_t reset:1;
-		uint64_t addpkt:1;
-		uint64_t naddbuf:1;
-		uint64_t pkt_lend:1;
-		uint64_t wqe_lend:1;
-		uint64_t pbp_en:1;
-		uint64_t opc_mode:2;
-		uint64_t ipd_en:1;
-	} cn30xx;
-	struct cvmx_ipd_ctl_status_cn38xxp2 {
-		uint64_t reserved_9_63:55;
-		uint64_t reset:1;
-		uint64_t addpkt:1;
-		uint64_t naddbuf:1;
-		uint64_t pkt_lend:1;
-		uint64_t wqe_lend:1;
-		uint64_t pbp_en:1;
-		uint64_t opc_mode:2;
-		uint64_t ipd_en:1;
-	} cn38xxp2;
-	struct cvmx_ipd_ctl_status_cn50xx {
-		uint64_t reserved_15_63:49;
-		uint64_t no_wptr:1;
-		uint64_t pq_apkt:1;
-		uint64_t pq_nabuf:1;
-		uint64_t ipd_full:1;
-		uint64_t pkt_off:1;
-		uint64_t len_m8:1;
-		uint64_t reset:1;
-		uint64_t addpkt:1;
-		uint64_t naddbuf:1;
-		uint64_t pkt_lend:1;
-		uint64_t wqe_lend:1;
-		uint64_t pbp_en:1;
-		uint64_t opc_mode:2;
-		uint64_t ipd_en:1;
-	} cn50xx;
-	struct cvmx_ipd_ctl_status_cn58xx {
-		uint64_t reserved_12_63:52;
-		uint64_t ipd_full:1;
-		uint64_t pkt_off:1;
-		uint64_t len_m8:1;
-		uint64_t reset:1;
-		uint64_t addpkt:1;
-		uint64_t naddbuf:1;
-		uint64_t pkt_lend:1;
-		uint64_t wqe_lend:1;
-		uint64_t pbp_en:1;
-		uint64_t opc_mode:2;
-		uint64_t ipd_en:1;
-	} cn58xx;
-	struct cvmx_ipd_ctl_status_cn63xxp1 {
-		uint64_t reserved_16_63:48;
-		uint64_t clken:1;
-		uint64_t no_wptr:1;
-		uint64_t pq_apkt:1;
-		uint64_t pq_nabuf:1;
-		uint64_t ipd_full:1;
-		uint64_t pkt_off:1;
-		uint64_t len_m8:1;
-		uint64_t reset:1;
-		uint64_t addpkt:1;
-		uint64_t naddbuf:1;
-		uint64_t pkt_lend:1;
-		uint64_t wqe_lend:1;
-		uint64_t pbp_en:1;
-		uint64_t opc_mode:2;
-		uint64_t ipd_en:1;
-	} cn63xxp1;
-};
-
-union cvmx_ipd_sub_port_fcs {
-	uint64_t u64;
-	struct cvmx_ipd_sub_port_fcs_s {
-		uint64_t port_bit:32;
-		uint64_t reserved_32_35:4;
-		uint64_t port_bit2:4;
-		uint64_t reserved_40_63:24;
-	} s;
-	struct cvmx_ipd_sub_port_fcs_cn30xx {
-		uint64_t port_bit:3;
-		uint64_t reserved_3_63:61;
-	} cn30xx;
-	struct cvmx_ipd_sub_port_fcs_cn38xx {
-		uint64_t port_bit:32;
-		uint64_t reserved_32_63:32;
-	} cn38xx;
-};
-
-union cvmx_ipd_sub_port_qos_cnt {
-	uint64_t u64;
-	struct cvmx_ipd_sub_port_qos_cnt_s {
-		uint64_t cnt:32;
-		uint64_t port_qos:9;
-		uint64_t reserved_41_63:23;
-	} s;
-};
-typedef struct {
-	uint32_t dropped_octets;
-	uint32_t dropped_packets;
-	uint32_t pci_raw_packets;
-	uint32_t octets;
-	uint32_t packets;
-	uint32_t multicast_packets;
-	uint32_t broadcast_packets;
-	uint32_t len_64_packets;
-	uint32_t len_65_127_packets;
-	uint32_t len_128_255_packets;
-	uint32_t len_256_511_packets;
-	uint32_t len_512_1023_packets;
-	uint32_t len_1024_1518_packets;
-	uint32_t len_1519_max_packets;
-	uint32_t fcs_align_err_packets;
-	uint32_t runt_packets;
-	uint32_t runt_crc_packets;
-	uint32_t oversize_packets;
-	uint32_t oversize_crc_packets;
-	uint32_t inb_packets;
-	uint64_t inb_octets;
-	uint16_t inb_errors;
-} cvmx_pip_port_status_t;
-
-typedef struct {
-	uint32_t packets;
-	uint64_t octets;
-	uint64_t doorbell;
-} cvmx_pko_port_status_t;
-
-union cvmx_pip_frm_len_chkx {
-	uint64_t u64;
-	struct cvmx_pip_frm_len_chkx_s {
-		uint64_t reserved_32_63:32;
-		uint64_t maxlen:16;
-		uint64_t minlen:16;
-	} s;
-};
-
-union cvmx_gmxx_rxx_frm_ctl {
-	uint64_t u64;
-	struct cvmx_gmxx_rxx_frm_ctl_s {
-		uint64_t pre_chk:1;
-		uint64_t pre_strp:1;
-		uint64_t ctl_drp:1;
-		uint64_t ctl_bck:1;
-		uint64_t ctl_mcst:1;
-		uint64_t ctl_smac:1;
-		uint64_t pre_free:1;
-		uint64_t vlan_len:1;
-		uint64_t pad_len:1;
-		uint64_t pre_align:1;
-		uint64_t null_dis:1;
-		uint64_t reserved_11_11:1;
-		uint64_t ptp_mode:1;
-		uint64_t reserved_13_63:51;
-	} s;
-	struct cvmx_gmxx_rxx_frm_ctl_cn30xx {
-		uint64_t pre_chk:1;
-		uint64_t pre_strp:1;
-		uint64_t ctl_drp:1;
-		uint64_t ctl_bck:1;
-		uint64_t ctl_mcst:1;
-		uint64_t ctl_smac:1;
-		uint64_t pre_free:1;
-		uint64_t vlan_len:1;
-		uint64_t pad_len:1;
-		uint64_t reserved_9_63:55;
-	} cn30xx;
-	struct cvmx_gmxx_rxx_frm_ctl_cn31xx {
-		uint64_t pre_chk:1;
-		uint64_t pre_strp:1;
-		uint64_t ctl_drp:1;
-		uint64_t ctl_bck:1;
-		uint64_t ctl_mcst:1;
-		uint64_t ctl_smac:1;
-		uint64_t pre_free:1;
-		uint64_t vlan_len:1;
-		uint64_t reserved_8_63:56;
-	} cn31xx;
-	struct cvmx_gmxx_rxx_frm_ctl_cn50xx {
-		uint64_t pre_chk:1;
-		uint64_t pre_strp:1;
-		uint64_t ctl_drp:1;
-		uint64_t ctl_bck:1;
-		uint64_t ctl_mcst:1;
-		uint64_t ctl_smac:1;
-		uint64_t pre_free:1;
-		uint64_t reserved_7_8:2;
-		uint64_t pre_align:1;
-		uint64_t null_dis:1;
-		uint64_t reserved_11_63:53;
-	} cn50xx;
-	struct cvmx_gmxx_rxx_frm_ctl_cn56xxp1 {
-		uint64_t pre_chk:1;
-		uint64_t pre_strp:1;
-		uint64_t ctl_drp:1;
-		uint64_t ctl_bck:1;
-		uint64_t ctl_mcst:1;
-		uint64_t ctl_smac:1;
-		uint64_t pre_free:1;
-		uint64_t reserved_7_8:2;
-		uint64_t pre_align:1;
-		uint64_t reserved_10_63:54;
-	} cn56xxp1;
-	struct cvmx_gmxx_rxx_frm_ctl_cn58xx {
-		uint64_t pre_chk:1;
-		uint64_t pre_strp:1;
-		uint64_t ctl_drp:1;
-		uint64_t ctl_bck:1;
-		uint64_t ctl_mcst:1;
-		uint64_t ctl_smac:1;
-		uint64_t pre_free:1;
-		uint64_t vlan_len:1;
-		uint64_t pad_len:1;
-		uint64_t pre_align:1;
-		uint64_t null_dis:1;
-		uint64_t reserved_11_63:53;
-	} cn58xx;
-	struct cvmx_gmxx_rxx_frm_ctl_cn61xx {
-		uint64_t pre_chk:1;
-		uint64_t pre_strp:1;
-		uint64_t ctl_drp:1;
-		uint64_t ctl_bck:1;
-		uint64_t ctl_mcst:1;
-		uint64_t ctl_smac:1;
-		uint64_t pre_free:1;
-		uint64_t reserved_7_8:2;
-		uint64_t pre_align:1;
-		uint64_t null_dis:1;
-		uint64_t reserved_11_11:1;
-		uint64_t ptp_mode:1;
-		uint64_t reserved_13_63:51;
-	} cn61xx;
-};
-
-union cvmx_gmxx_rxx_int_reg {
-	uint64_t u64;
-	struct cvmx_gmxx_rxx_int_reg_s {
-		uint64_t minerr:1;
-		uint64_t carext:1;
-		uint64_t maxerr:1;
-		uint64_t jabber:1;
-		uint64_t fcserr:1;
-		uint64_t alnerr:1;
-		uint64_t lenerr:1;
-		uint64_t rcverr:1;
-		uint64_t skperr:1;
-		uint64_t niberr:1;
-		uint64_t ovrerr:1;
-		uint64_t pcterr:1;
-		uint64_t rsverr:1;
-		uint64_t falerr:1;
-		uint64_t coldet:1;
-		uint64_t ifgerr:1;
-		uint64_t phy_link:1;
-		uint64_t phy_spd:1;
-		uint64_t phy_dupx:1;
-		uint64_t pause_drp:1;
-		uint64_t loc_fault:1;
-		uint64_t rem_fault:1;
-		uint64_t bad_seq:1;
-		uint64_t bad_term:1;
-		uint64_t unsop:1;
-		uint64_t uneop:1;
-		uint64_t undat:1;
-		uint64_t hg2fld:1;
-		uint64_t hg2cc:1;
-		uint64_t reserved_29_63:35;
-	} s;
-	struct cvmx_gmxx_rxx_int_reg_cn30xx {
-		uint64_t minerr:1;
-		uint64_t carext:1;
-		uint64_t maxerr:1;
-		uint64_t jabber:1;
-		uint64_t fcserr:1;
-		uint64_t alnerr:1;
-		uint64_t lenerr:1;
-		uint64_t rcverr:1;
-		uint64_t skperr:1;
-		uint64_t niberr:1;
-		uint64_t ovrerr:1;
-		uint64_t pcterr:1;
-		uint64_t rsverr:1;
-		uint64_t falerr:1;
-		uint64_t coldet:1;
-		uint64_t ifgerr:1;
-		uint64_t phy_link:1;
-		uint64_t phy_spd:1;
-		uint64_t phy_dupx:1;
-		uint64_t reserved_19_63:45;
-	} cn30xx;
-	struct cvmx_gmxx_rxx_int_reg_cn50xx {
-		uint64_t reserved_0_0:1;
-		uint64_t carext:1;
-		uint64_t reserved_2_2:1;
-		uint64_t jabber:1;
-		uint64_t fcserr:1;
-		uint64_t alnerr:1;
-		uint64_t reserved_6_6:1;
-		uint64_t rcverr:1;
-		uint64_t skperr:1;
-		uint64_t niberr:1;
-		uint64_t ovrerr:1;
-		uint64_t pcterr:1;
-		uint64_t rsverr:1;
-		uint64_t falerr:1;
-		uint64_t coldet:1;
-		uint64_t ifgerr:1;
-		uint64_t phy_link:1;
-		uint64_t phy_spd:1;
-		uint64_t phy_dupx:1;
-		uint64_t pause_drp:1;
-		uint64_t reserved_20_63:44;
-	} cn50xx;
-	struct cvmx_gmxx_rxx_int_reg_cn52xx {
-		uint64_t reserved_0_0:1;
-		uint64_t carext:1;
-		uint64_t reserved_2_2:1;
-		uint64_t jabber:1;
-		uint64_t fcserr:1;
-		uint64_t reserved_5_6:2;
-		uint64_t rcverr:1;
-		uint64_t skperr:1;
-		uint64_t reserved_9_9:1;
-		uint64_t ovrerr:1;
-		uint64_t pcterr:1;
-		uint64_t rsverr:1;
-		uint64_t falerr:1;
-		uint64_t coldet:1;
-		uint64_t ifgerr:1;
-		uint64_t reserved_16_18:3;
-		uint64_t pause_drp:1;
-		uint64_t loc_fault:1;
-		uint64_t rem_fault:1;
-		uint64_t bad_seq:1;
-		uint64_t bad_term:1;
-		uint64_t unsop:1;
-		uint64_t uneop:1;
-		uint64_t undat:1;
-		uint64_t hg2fld:1;
-		uint64_t hg2cc:1;
-		uint64_t reserved_29_63:35;
-	} cn52xx;
-	struct cvmx_gmxx_rxx_int_reg_cn56xxp1 {
-		uint64_t reserved_0_0:1;
-		uint64_t carext:1;
-		uint64_t reserved_2_2:1;
-		uint64_t jabber:1;
-		uint64_t fcserr:1;
-		uint64_t reserved_5_6:2;
-		uint64_t rcverr:1;
-		uint64_t skperr:1;
-		uint64_t reserved_9_9:1;
-		uint64_t ovrerr:1;
-		uint64_t pcterr:1;
-		uint64_t rsverr:1;
-		uint64_t falerr:1;
-		uint64_t coldet:1;
-		uint64_t ifgerr:1;
-		uint64_t reserved_16_18:3;
-		uint64_t pause_drp:1;
-		uint64_t loc_fault:1;
-		uint64_t rem_fault:1;
-		uint64_t bad_seq:1;
-		uint64_t bad_term:1;
-		uint64_t unsop:1;
-		uint64_t uneop:1;
-		uint64_t undat:1;
-		uint64_t reserved_27_63:37;
-	} cn56xxp1;
-	struct cvmx_gmxx_rxx_int_reg_cn58xx {
-		uint64_t minerr:1;
-		uint64_t carext:1;
-		uint64_t maxerr:1;
-		uint64_t jabber:1;
-		uint64_t fcserr:1;
-		uint64_t alnerr:1;
-		uint64_t lenerr:1;
-		uint64_t rcverr:1;
-		uint64_t skperr:1;
-		uint64_t niberr:1;
-		uint64_t ovrerr:1;
-		uint64_t pcterr:1;
-		uint64_t rsverr:1;
-		uint64_t falerr:1;
-		uint64_t coldet:1;
-		uint64_t ifgerr:1;
-		uint64_t phy_link:1;
-		uint64_t phy_spd:1;
-		uint64_t phy_dupx:1;
-		uint64_t pause_drp:1;
-		uint64_t reserved_20_63:44;
-	} cn58xx;
-	struct cvmx_gmxx_rxx_int_reg_cn61xx {
-		uint64_t minerr:1;
-		uint64_t carext:1;
-		uint64_t reserved_2_2:1;
-		uint64_t jabber:1;
-		uint64_t fcserr:1;
-		uint64_t reserved_5_6:2;
-		uint64_t rcverr:1;
-		uint64_t skperr:1;
-		uint64_t reserved_9_9:1;
-		uint64_t ovrerr:1;
-		uint64_t pcterr:1;
-		uint64_t rsverr:1;
-		uint64_t falerr:1;
-		uint64_t coldet:1;
-		uint64_t ifgerr:1;
-		uint64_t reserved_16_18:3;
-		uint64_t pause_drp:1;
-		uint64_t loc_fault:1;
-		uint64_t rem_fault:1;
-		uint64_t bad_seq:1;
-		uint64_t bad_term:1;
-		uint64_t unsop:1;
-		uint64_t uneop:1;
-		uint64_t undat:1;
-		uint64_t hg2fld:1;
-		uint64_t hg2cc:1;
-		uint64_t reserved_29_63:35;
-	} cn61xx;
-};
-
-union cvmx_gmxx_prtx_cfg {
-	uint64_t u64;
-	struct cvmx_gmxx_prtx_cfg_s {
-		uint64_t reserved_22_63:42;
-		uint64_t pknd:6;
-		uint64_t reserved_14_15:2;
-		uint64_t tx_idle:1;
-		uint64_t rx_idle:1;
-		uint64_t reserved_9_11:3;
-		uint64_t speed_msb:1;
-		uint64_t reserved_4_7:4;
-		uint64_t slottime:1;
-		uint64_t duplex:1;
-		uint64_t speed:1;
-		uint64_t en:1;
-	} s;
-	struct cvmx_gmxx_prtx_cfg_cn30xx {
-		uint64_t reserved_4_63:60;
-		uint64_t slottime:1;
-		uint64_t duplex:1;
-		uint64_t speed:1;
-		uint64_t en:1;
-	} cn30xx;
-	struct cvmx_gmxx_prtx_cfg_cn52xx {
-		uint64_t reserved_14_63:50;
-		uint64_t tx_idle:1;
-		uint64_t rx_idle:1;
-		uint64_t reserved_9_11:3;
-		uint64_t speed_msb:1;
-		uint64_t reserved_4_7:4;
-		uint64_t slottime:1;
-		uint64_t duplex:1;
-		uint64_t speed:1;
-		uint64_t en:1;
-	} cn52xx;
-};
-
-union cvmx_gmxx_rxx_adr_ctl {
-	uint64_t u64;
-	struct cvmx_gmxx_rxx_adr_ctl_s {
-		uint64_t reserved_4_63:60;
-		uint64_t cam_mode:1;
-		uint64_t mcst:2;
-		uint64_t bcst:1;
-	} s;
-};
-
-union cvmx_pip_prt_tagx {
-	uint64_t u64;
-	struct cvmx_pip_prt_tagx_s {
-		uint64_t reserved_54_63:10;
-		uint64_t portadd_en:1;
-		uint64_t inc_hwchk:1;
-		uint64_t reserved_50_51:2;
-		uint64_t grptagbase_msb:2;
-		uint64_t reserved_46_47:2;
-		uint64_t grptagmask_msb:2;
-		uint64_t reserved_42_43:2;
-		uint64_t grp_msb:2;
-		uint64_t grptagbase:4;
-		uint64_t grptagmask:4;
-		uint64_t grptag:1;
-		uint64_t grptag_mskip:1;
-		uint64_t tag_mode:2;
-		uint64_t inc_vs:2;
-		uint64_t inc_vlan:1;
-		uint64_t inc_prt_flag:1;
-		uint64_t ip6_dprt_flag:1;
-		uint64_t ip4_dprt_flag:1;
-		uint64_t ip6_sprt_flag:1;
-		uint64_t ip4_sprt_flag:1;
-		uint64_t ip6_nxth_flag:1;
-		uint64_t ip4_pctl_flag:1;
-		uint64_t ip6_dst_flag:1;
-		uint64_t ip4_dst_flag:1;
-		uint64_t ip6_src_flag:1;
-		uint64_t ip4_src_flag:1;
-		uint64_t tcp6_tag_type:2;
-		uint64_t tcp4_tag_type:2;
-		uint64_t ip6_tag_type:2;
-		uint64_t ip4_tag_type:2;
-		uint64_t non_tag_type:2;
-		uint64_t grp:4;
-	} s;
-	struct cvmx_pip_prt_tagx_cn30xx {
-		uint64_t reserved_40_63:24;
-		uint64_t grptagbase:4;
-		uint64_t grptagmask:4;
-		uint64_t grptag:1;
-		uint64_t reserved_30_30:1;
-		uint64_t tag_mode:2;
-		uint64_t inc_vs:2;
-		uint64_t inc_vlan:1;
-		uint64_t inc_prt_flag:1;
-		uint64_t ip6_dprt_flag:1;
-		uint64_t ip4_dprt_flag:1;
-		uint64_t ip6_sprt_flag:1;
-		uint64_t ip4_sprt_flag:1;
-		uint64_t ip6_nxth_flag:1;
-		uint64_t ip4_pctl_flag:1;
-		uint64_t ip6_dst_flag:1;
-		uint64_t ip4_dst_flag:1;
-		uint64_t ip6_src_flag:1;
-		uint64_t ip4_src_flag:1;
-		uint64_t tcp6_tag_type:2;
-		uint64_t tcp4_tag_type:2;
-		uint64_t ip6_tag_type:2;
-		uint64_t ip4_tag_type:2;
-		uint64_t non_tag_type:2;
-		uint64_t grp:4;
-	} cn30xx;
-	struct cvmx_pip_prt_tagx_cn50xx {
-		uint64_t reserved_40_63:24;
-		uint64_t grptagbase:4;
-		uint64_t grptagmask:4;
-		uint64_t grptag:1;
-		uint64_t grptag_mskip:1;
-		uint64_t tag_mode:2;
-		uint64_t inc_vs:2;
-		uint64_t inc_vlan:1;
-		uint64_t inc_prt_flag:1;
-		uint64_t ip6_dprt_flag:1;
-		uint64_t ip4_dprt_flag:1;
-		uint64_t ip6_sprt_flag:1;
-		uint64_t ip4_sprt_flag:1;
-		uint64_t ip6_nxth_flag:1;
-		uint64_t ip4_pctl_flag:1;
-		uint64_t ip6_dst_flag:1;
-		uint64_t ip4_dst_flag:1;
-		uint64_t ip6_src_flag:1;
-		uint64_t ip4_src_flag:1;
-		uint64_t tcp6_tag_type:2;
-		uint64_t tcp4_tag_type:2;
-		uint64_t ip6_tag_type:2;
-		uint64_t ip4_tag_type:2;
-		uint64_t non_tag_type:2;
-		uint64_t grp:4;
-	} cn50xx;
-};
-
-union cvmx_spxx_int_reg {
-	uint64_t u64;
-	struct cvmx_spxx_int_reg_s {
-		uint64_t reserved_32_63:32;
-		uint64_t spf:1;
-		uint64_t reserved_12_30:19;
-		uint64_t calerr:1;
-		uint64_t syncerr:1;
-		uint64_t diperr:1;
-		uint64_t tpaovr:1;
-		uint64_t rsverr:1;
-		uint64_t drwnng:1;
-		uint64_t clserr:1;
-		uint64_t spiovr:1;
-		uint64_t reserved_2_3:2;
-		uint64_t abnorm:1;
-		uint64_t prtnxa:1;
-	} s;
-};
-
-union cvmx_spxx_int_msk {
-	uint64_t u64;
-	struct cvmx_spxx_int_msk_s {
-		uint64_t reserved_12_63:52;
-		uint64_t calerr:1;
-		uint64_t syncerr:1;
-		uint64_t diperr:1;
-		uint64_t tpaovr:1;
-		uint64_t rsverr:1;
-		uint64_t drwnng:1;
-		uint64_t clserr:1;
-		uint64_t spiovr:1;
-		uint64_t reserved_2_3:2;
-		uint64_t abnorm:1;
-		uint64_t prtnxa:1;
-	} s;
-};
-
-union cvmx_pow_wq_int {
-	uint64_t u64;
-	struct cvmx_pow_wq_int_s {
-		uint64_t wq_int:16;
-		uint64_t iq_dis:16;
-		uint64_t reserved_32_63:32;
-	} s;
-};
-
-union cvmx_sso_wq_int_thrx {
-	uint64_t u64;
-	struct {
-		uint64_t iq_thr:12;
-		uint64_t reserved_12_13:2;
-		uint64_t ds_thr:12;
-		uint64_t reserved_26_27:2;
-		uint64_t tc_thr:4;
-		uint64_t tc_en:1;
-		uint64_t reserved_33_63:31;
-	} s;
-};
-
-union cvmx_stxx_int_reg {
-	uint64_t u64;
-	struct cvmx_stxx_int_reg_s {
-		uint64_t reserved_9_63:55;
-		uint64_t syncerr:1;
-		uint64_t frmerr:1;
-		uint64_t unxfrm:1;
-		uint64_t nosync:1;
-		uint64_t diperr:1;
-		uint64_t datovr:1;
-		uint64_t ovrbst:1;
-		uint64_t calpar1:1;
-		uint64_t calpar0:1;
-	} s;
-};
-
-union cvmx_stxx_int_msk {
-	uint64_t u64;
-	struct cvmx_stxx_int_msk_s {
-		uint64_t reserved_8_63:56;
-		uint64_t frmerr:1;
-		uint64_t unxfrm:1;
-		uint64_t nosync:1;
-		uint64_t diperr:1;
-		uint64_t datovr:1;
-		uint64_t ovrbst:1;
-		uint64_t calpar1:1;
-		uint64_t calpar0:1;
-	} s;
-};
-
-union cvmx_pow_wq_int_pc {
-	uint64_t u64;
-	struct cvmx_pow_wq_int_pc_s {
-		uint64_t reserved_0_7:8;
-		uint64_t pc_thr:20;
-		uint64_t reserved_28_31:4;
-		uint64_t pc:28;
-		uint64_t reserved_60_63:4;
-	} s;
-};
-
-union cvmx_pow_wq_int_thrx {
-	uint64_t u64;
-	struct cvmx_pow_wq_int_thrx_s {
-		uint64_t reserved_29_63:35;
-		uint64_t tc_en:1;
-		uint64_t tc_thr:4;
-		uint64_t reserved_23_23:1;
-		uint64_t ds_thr:11;
-		uint64_t reserved_11_11:1;
-		uint64_t iq_thr:11;
-	} s;
-	struct cvmx_pow_wq_int_thrx_cn30xx {
-		uint64_t reserved_29_63:35;
-		uint64_t tc_en:1;
-		uint64_t tc_thr:4;
-		uint64_t reserved_18_23:6;
-		uint64_t ds_thr:6;
-		uint64_t reserved_6_11:6;
-		uint64_t iq_thr:6;
-	} cn30xx;
-	struct cvmx_pow_wq_int_thrx_cn31xx {
-		uint64_t reserved_29_63:35;
-		uint64_t tc_en:1;
-		uint64_t tc_thr:4;
-		uint64_t reserved_20_23:4;
-		uint64_t ds_thr:8;
-		uint64_t reserved_8_11:4;
-		uint64_t iq_thr:8;
-	} cn31xx;
-	struct cvmx_pow_wq_int_thrx_cn52xx {
-		uint64_t reserved_29_63:35;
-		uint64_t tc_en:1;
-		uint64_t tc_thr:4;
-		uint64_t reserved_21_23:3;
-		uint64_t ds_thr:9;
-		uint64_t reserved_9_11:3;
-		uint64_t iq_thr:9;
-	} cn52xx;
-	struct cvmx_pow_wq_int_thrx_cn63xx {
-		uint64_t reserved_29_63:35;
-		uint64_t tc_en:1;
-		uint64_t tc_thr:4;
-		uint64_t reserved_22_23:2;
-		uint64_t ds_thr:10;
-		uint64_t reserved_10_11:2;
-		uint64_t iq_thr:10;
-	} cn63xx;
-};
-
-union cvmx_npi_rsl_int_blocks {
-	uint64_t u64;
-	struct cvmx_npi_rsl_int_blocks_s {
-		uint64_t reserved_32_63:32;
-		uint64_t rint_31:1;
-		uint64_t iob:1;
-		uint64_t reserved_28_29:2;
-		uint64_t rint_27:1;
-		uint64_t rint_26:1;
-		uint64_t rint_25:1;
-		uint64_t rint_24:1;
-		uint64_t asx1:1;
-		uint64_t asx0:1;
-		uint64_t rint_21:1;
-		uint64_t pip:1;
-		uint64_t spx1:1;
-		uint64_t spx0:1;
-		uint64_t lmc:1;
-		uint64_t l2c:1;
-		uint64_t rint_15:1;
-		uint64_t reserved_13_14:2;
-		uint64_t pow:1;
-		uint64_t tim:1;
-		uint64_t pko:1;
-		uint64_t ipd:1;
-		uint64_t rint_8:1;
-		uint64_t zip:1;
-		uint64_t dfa:1;
-		uint64_t fpa:1;
-		uint64_t key:1;
-		uint64_t npi:1;
-		uint64_t gmx1:1;
-		uint64_t gmx0:1;
-		uint64_t mio:1;
-	} s;
-	struct cvmx_npi_rsl_int_blocks_cn30xx {
-		uint64_t reserved_32_63:32;
-		uint64_t rint_31:1;
-		uint64_t iob:1;
-		uint64_t rint_29:1;
-		uint64_t rint_28:1;
-		uint64_t rint_27:1;
-		uint64_t rint_26:1;
-		uint64_t rint_25:1;
-		uint64_t rint_24:1;
-		uint64_t asx1:1;
-		uint64_t asx0:1;
-		uint64_t rint_21:1;
-		uint64_t pip:1;
-		uint64_t spx1:1;
-		uint64_t spx0:1;
-		uint64_t lmc:1;
-		uint64_t l2c:1;
-		uint64_t rint_15:1;
-		uint64_t rint_14:1;
-		uint64_t usb:1;
-		uint64_t pow:1;
-		uint64_t tim:1;
-		uint64_t pko:1;
-		uint64_t ipd:1;
-		uint64_t rint_8:1;
-		uint64_t zip:1;
-		uint64_t dfa:1;
-		uint64_t fpa:1;
-		uint64_t key:1;
-		uint64_t npi:1;
-		uint64_t gmx1:1;
-		uint64_t gmx0:1;
-		uint64_t mio:1;
-	} cn30xx;
-	struct cvmx_npi_rsl_int_blocks_cn38xx {
-		uint64_t reserved_32_63:32;
-		uint64_t rint_31:1;
-		uint64_t iob:1;
-		uint64_t rint_29:1;
-		uint64_t rint_28:1;
-		uint64_t rint_27:1;
-		uint64_t rint_26:1;
-		uint64_t rint_25:1;
-		uint64_t rint_24:1;
-		uint64_t asx1:1;
-		uint64_t asx0:1;
-		uint64_t rint_21:1;
-		uint64_t pip:1;
-		uint64_t spx1:1;
-		uint64_t spx0:1;
-		uint64_t lmc:1;
-		uint64_t l2c:1;
-		uint64_t rint_15:1;
-		uint64_t rint_14:1;
-		uint64_t rint_13:1;
-		uint64_t pow:1;
-		uint64_t tim:1;
-		uint64_t pko:1;
-		uint64_t ipd:1;
-		uint64_t rint_8:1;
-		uint64_t zip:1;
-		uint64_t dfa:1;
-		uint64_t fpa:1;
-		uint64_t key:1;
-		uint64_t npi:1;
-		uint64_t gmx1:1;
-		uint64_t gmx0:1;
-		uint64_t mio:1;
-	} cn38xx;
-	struct cvmx_npi_rsl_int_blocks_cn50xx {
-		uint64_t reserved_31_63:33;
-		uint64_t iob:1;
-		uint64_t lmc1:1;
-		uint64_t agl:1;
-		uint64_t reserved_24_27:4;
-		uint64_t asx1:1;
-		uint64_t asx0:1;
-		uint64_t reserved_21_21:1;
-		uint64_t pip:1;
-		uint64_t spx1:1;
-		uint64_t spx0:1;
-		uint64_t lmc:1;
-		uint64_t l2c:1;
-		uint64_t reserved_15_15:1;
-		uint64_t rad:1;
-		uint64_t usb:1;
-		uint64_t pow:1;
-		uint64_t tim:1;
-		uint64_t pko:1;
-		uint64_t ipd:1;
-		uint64_t reserved_8_8:1;
-		uint64_t zip:1;
-		uint64_t dfa:1;
-		uint64_t fpa:1;
-		uint64_t key:1;
-		uint64_t npi:1;
-		uint64_t gmx1:1;
-		uint64_t gmx0:1;
-		uint64_t mio:1;
-	} cn50xx;
-};
-
-union cvmx_pko_command_word0 {
-	uint64_t u64;
-	struct {
-		uint64_t total_bytes:16;
-		uint64_t segs:6;
-		uint64_t dontfree:1;
-		uint64_t ignore_i:1;
-		uint64_t ipoffp1:7;
-		uint64_t gather:1;
-		uint64_t rsp:1;
-		uint64_t wqp:1;
-		uint64_t n2:1;
-		uint64_t le:1;
-		uint64_t reg0:11;
-		uint64_t subone0:1;
-		uint64_t reg1:11;
-		uint64_t subone1:1;
-		uint64_t size0:2;
-		uint64_t size1:2;
-	} s;
-};
-
-union cvmx_ciu_timx {
-	uint64_t u64;
-	struct cvmx_ciu_timx_s {
-		uint64_t reserved_37_63:27;
-		uint64_t one_shot:1;
-		uint64_t len:36;
-	} s;
-};
-
-union cvmx_gmxx_rxx_rx_inbnd {
-	uint64_t u64;
-	struct cvmx_gmxx_rxx_rx_inbnd_s {
-		uint64_t status:1;
-		uint64_t speed:2;
-		uint64_t duplex:1;
-		uint64_t reserved_4_63:60;
-	} s;
-};
-
-static inline int32_t cvmx_fau_fetch_and_add32(enum cvmx_fau_reg_32 reg,
-					       int32_t value)
-{
-	return value;
-}
-
-static inline void cvmx_fau_atomic_add32(enum cvmx_fau_reg_32 reg,
-					 int32_t value)
-{ }
-
-static inline void cvmx_fau_atomic_write32(enum cvmx_fau_reg_32 reg,
-					   int32_t value)
-{ }
-
-static inline uint64_t cvmx_scratch_read64(uint64_t address)
-{
-	return 0;
-}
-
-static inline void cvmx_scratch_write64(uint64_t address, uint64_t value)
-{ }
-
-static inline int cvmx_wqe_get_grp(struct cvmx_wqe *work)
-{
-	return 0;
-}
-
-static inline void *cvmx_phys_to_ptr(uint64_t physical_address)
-{
-	return (void *)(uintptr_t)(physical_address);
-}
-
-static inline uint64_t cvmx_ptr_to_phys(void *ptr)
-{
-	return (unsigned long)ptr;
-}
-
-static inline int cvmx_helper_get_interface_num(int ipd_port)
-{
-	return ipd_port;
-}
-
-static inline int cvmx_helper_get_interface_index_num(int ipd_port)
-{
-	return ipd_port;
-}
-
-static inline void cvmx_fpa_enable(void)
-{ }
-
-static inline uint64_t cvmx_read_csr(uint64_t csr_addr)
-{
-	return 0;
-}
-
-static inline void cvmx_write_csr(uint64_t csr_addr, uint64_t val)
-{ }
-
-static inline int cvmx_helper_setup_red(int pass_thresh, int drop_thresh)
-{
-	return 0;
-}
-
-static inline void *cvmx_fpa_alloc(uint64_t pool)
-{
-	return NULL;
-}
-
-static inline void cvmx_fpa_free(void *ptr, uint64_t pool,
-				 uint64_t num_cache_lines)
-{ }
-
-static inline int octeon_is_simulation(void)
-{
-	return 1;
-}
-
-static inline void cvmx_pip_get_port_status(uint64_t port_num, uint64_t clear,
-					    cvmx_pip_port_status_t *status)
-{ }
-
-static inline void cvmx_pko_get_port_status(uint64_t port_num, uint64_t clear,
-					    cvmx_pko_port_status_t *status)
-{ }
-
-static inline cvmx_helper_interface_mode_t cvmx_helper_interface_get_mode(int
-								   interface)
-{
-	return 0;
-}
-
-static inline union cvmx_helper_link_info cvmx_helper_link_get(int ipd_port)
-{
-	union cvmx_helper_link_info ret = { .u64 = 0 };
-
-	return ret;
-}
-
-static inline int cvmx_helper_link_set(int ipd_port,
-				       union cvmx_helper_link_info link_info)
-{
-	return 0;
-}
-
-static inline int cvmx_helper_initialize_packet_io_global(void)
-{
-	return 0;
-}
-
-static inline int cvmx_helper_get_number_of_interfaces(void)
-{
-	return 2;
-}
-
-static inline int cvmx_helper_ports_on_interface(int interface)
-{
-	return 1;
-}
-
-static inline int cvmx_helper_get_ipd_port(int interface, int port)
-{
-	return 0;
-}
-
-static inline int cvmx_helper_ipd_and_packet_input_enable(void)
-{
-	return 0;
-}
-
-static inline void cvmx_ipd_disable(void)
-{ }
-
-static inline void cvmx_ipd_free_ptr(void)
-{ }
-
-static inline void cvmx_pko_disable(void)
-{ }
-
-static inline void cvmx_pko_shutdown(void)
-{ }
-
-static inline int cvmx_pko_get_base_queue_per_core(int port, int core)
-{
-	return port;
-}
-
-static inline int cvmx_pko_get_base_queue(int port)
-{
-	return port;
-}
-
-static inline int cvmx_pko_get_num_queues(int port)
-{
-	return port;
-}
-
-static inline unsigned int cvmx_get_core_num(void)
-{
-	return 0;
-}
-
-static inline void cvmx_pow_work_request_async_nocheck(int scr_addr,
-						       cvmx_pow_wait_t wait)
-{ }
-
-static inline void cvmx_pow_work_request_async(int scr_addr,
-						       cvmx_pow_wait_t wait)
-{ }
-
-static inline struct cvmx_wqe *cvmx_pow_work_response_async(int scr_addr)
-{
-	struct cvmx_wqe *wqe = (void *)(unsigned long)scr_addr;
-
-	return wqe;
-}
-
-static inline struct cvmx_wqe *cvmx_pow_work_request_sync(cvmx_pow_wait_t wait)
-{
-	return (void *)(unsigned long)wait;
-}
-
-static inline int cvmx_spi_restart_interface(int interface,
-					cvmx_spi_mode_t mode, int timeout)
-{
-	return 0;
-}
-
-static inline void cvmx_fau_async_fetch_and_add32(uint64_t scraddr,
-						  enum cvmx_fau_reg_32 reg,
-						  int32_t value)
-{ }
-
-static inline union cvmx_gmxx_rxx_rx_inbnd cvmx_spi4000_check_speed(
-	int interface,
-	int port)
-{
-	union cvmx_gmxx_rxx_rx_inbnd r;
-
-	r.u64 = 0;
-	return r;
-}
-
-static inline void cvmx_pko_send_packet_prepare(uint64_t port, uint64_t queue,
-						cvmx_pko_lock_t use_locking)
-{ }
-
-static inline cvmx_pko_status_t cvmx_pko_send_packet_finish(uint64_t port,
-		uint64_t queue, union cvmx_pko_command_word0 pko_command,
-		union cvmx_buf_ptr packet, cvmx_pko_lock_t use_locking)
-{
-	return 0;
-}
-
-static inline void cvmx_wqe_set_port(struct cvmx_wqe *work, int port)
-{ }
-
-static inline void cvmx_wqe_set_qos(struct cvmx_wqe *work, int qos)
-{ }
-
-static inline int cvmx_wqe_get_qos(struct cvmx_wqe *work)
-{
-	return 0;
-}
-
-static inline void cvmx_wqe_set_grp(struct cvmx_wqe *work, int grp)
-{ }
-
-static inline void cvmx_pow_work_submit(struct cvmx_wqe *wqp, uint32_t tag,
-					enum cvmx_pow_tag_type tag_type,
-					uint64_t qos, uint64_t grp)
-{ }
-
-#define CVMX_ASXX_RX_CLK_SETX(a, b)	((a)+(b))
-#define CVMX_ASXX_TX_CLK_SETX(a, b)	((a)+(b))
-#define CVMX_CIU_TIMX(a)		(a)
-#define CVMX_GMXX_RXX_ADR_CAM0(a, b)	((a)+(b))
-#define CVMX_GMXX_RXX_ADR_CAM1(a, b)	((a)+(b))
-#define CVMX_GMXX_RXX_ADR_CAM2(a, b)	((a)+(b))
-#define CVMX_GMXX_RXX_ADR_CAM3(a, b)	((a)+(b))
-#define CVMX_GMXX_RXX_ADR_CAM4(a, b)	((a)+(b))
-#define CVMX_GMXX_RXX_ADR_CAM5(a, b)	((a)+(b))
-#define CVMX_GMXX_RXX_FRM_CTL(a, b)	((a)+(b))
-#define CVMX_GMXX_RXX_INT_REG(a, b)	((a)+(b))
-#define CVMX_GMXX_SMACX(a, b)		((a)+(b))
-#define CVMX_PIP_PRT_TAGX(a)		(a)
-#define CVMX_POW_PP_GRP_MSKX(a)		(a)
-#define CVMX_POW_WQ_INT_THRX(a)		(a)
-#define CVMX_SPXX_INT_MSK(a)		(a)
-#define CVMX_SPXX_INT_REG(a)		(a)
-#define CVMX_SSO_PPX_GRP_MSK(a)		(a)
-#define CVMX_SSO_WQ_INT_THRX(a)		(a)
-#define CVMX_STXX_INT_MSK(a)		(a)
-#define CVMX_STXX_INT_REG(a)		(a)
-- 
2.24.0

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 59+ messages in thread

* [PATCH 2/2] staging: octeon-usb: delete the octeon usb host controller driver
  2019-12-10  9:15 ` Greg Kroah-Hartman
@ 2019-12-10  9:15   ` Greg Kroah-Hartman
  -1 siblings, 0 replies; 59+ messages in thread
From: Greg Kroah-Hartman @ 2019-12-10  9:15 UTC (permalink / raw)
  To: devel
  Cc: linux-kernel, Greg Kroah-Hartman, Aaro Koskinen, David Daney,
	Nishka Dasgupta, Himadri Pandya, Frank A. Cancio Bello,
	Sumit Pundir, Laura Lazzati

This driver was merged back in 2013 and shows no progress toward every
being merged into the "correct" part of the kernel.  The code doesn't
even build for anyone unless you have the specific hardware platform
selected, so odds are it doesn't even work anymore.

Remove it for now and is someone comes along that has the hardware and
is willing to fix it up, it can be reverted.

Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: David Daney <ddaney.cavm@gmail.com>
Cc: Nishka Dasgupta <nishkadg.linux@gmail.com>
Cc: Himadri Pandya <himadri18.07@gmail.com>
Cc: "Frank A. Cancio Bello" <frank@generalsoftwareinc.com>
Cc: Sumit Pundir <pundirsumit11@gmail.com>
Cc: Laura Lazzati <laura.lazzati.15@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/staging/Kconfig                 |    2 -
 drivers/staging/Makefile                |    1 -
 drivers/staging/octeon-usb/Kconfig      |   11 -
 drivers/staging/octeon-usb/Makefile     |    2 -
 drivers/staging/octeon-usb/TODO         |    8 -
 drivers/staging/octeon-usb/octeon-hcd.c | 3737 -----------------------
 drivers/staging/octeon-usb/octeon-hcd.h | 1847 -----------
 7 files changed, 5608 deletions(-)
 delete mode 100644 drivers/staging/octeon-usb/Kconfig
 delete mode 100644 drivers/staging/octeon-usb/Makefile
 delete mode 100644 drivers/staging/octeon-usb/TODO
 delete mode 100644 drivers/staging/octeon-usb/octeon-hcd.c
 delete mode 100644 drivers/staging/octeon-usb/octeon-hcd.h

diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
index 15d3549e7cc7..198bf59bc1e6 100644
--- a/drivers/staging/Kconfig
+++ b/drivers/staging/Kconfig
@@ -42,8 +42,6 @@ source "drivers/staging/rtl8188eu/Kconfig"
 
 source "drivers/staging/rts5208/Kconfig"
 
-source "drivers/staging/octeon-usb/Kconfig"
-
 source "drivers/staging/vt6655/Kconfig"
 
 source "drivers/staging/vt6656/Kconfig"
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
index c521204220b5..bf230a830338 100644
--- a/drivers/staging/Makefile
+++ b/drivers/staging/Makefile
@@ -12,7 +12,6 @@ obj-$(CONFIG_R8712U)		+= rtl8712/
 obj-$(CONFIG_R8188EU)		+= rtl8188eu/
 obj-$(CONFIG_RTS5208)		+= rts5208/
 obj-$(CONFIG_NETLOGIC_XLR_NET)	+= netlogic/
-obj-$(CONFIG_OCTEON_USB)	+= octeon-usb/
 obj-$(CONFIG_VT6655)		+= vt6655/
 obj-$(CONFIG_VT6656)		+= vt6656/
 obj-$(CONFIG_VME_BUS)		+= vme/
diff --git a/drivers/staging/octeon-usb/Kconfig b/drivers/staging/octeon-usb/Kconfig
deleted file mode 100644
index 6a5d842ee0f2..000000000000
--- a/drivers/staging/octeon-usb/Kconfig
+++ /dev/null
@@ -1,11 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-config OCTEON_USB
-	tristate "Cavium Networks Octeon USB support"
-	depends on CAVIUM_OCTEON_SOC && USB
-	help
-	  This driver supports USB host controller on some Cavium
-	  Networks' products in the Octeon family.
-
-	  To compile this driver as a module, choose M here. The module
-	  will be called octeon-hcd.
-
diff --git a/drivers/staging/octeon-usb/Makefile b/drivers/staging/octeon-usb/Makefile
deleted file mode 100644
index 9873a0130ad5..000000000000
--- a/drivers/staging/octeon-usb/Makefile
+++ /dev/null
@@ -1,2 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-obj-${CONFIG_OCTEON_USB} := octeon-hcd.o
diff --git a/drivers/staging/octeon-usb/TODO b/drivers/staging/octeon-usb/TODO
deleted file mode 100644
index 2b29acca5caa..000000000000
--- a/drivers/staging/octeon-usb/TODO
+++ /dev/null
@@ -1,8 +0,0 @@
-This driver is functional and has been tested on EdgeRouter Lite,
-D-Link DSR-1000N and EBH5600 evaluation board with USB mass storage.
-
-TODO:
-	- kernel coding style
-	- checkpatch warnings
-
-Contact: Aaro Koskinen <aaro.koskinen@iki.fi>
diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c
deleted file mode 100644
index 582c9187559d..000000000000
--- a/drivers/staging/octeon-usb/octeon-hcd.c
+++ /dev/null
@@ -1,3737 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 2008 Cavium Networks
- *
- * Some parts of the code were originally released under BSD license:
- *
- * Copyright (c) 2003-2010 Cavium Networks (support@cavium.com). All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *   * Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *
- *   * Redistributions in binary form must reproduce the above
- *     copyright notice, this list of conditions and the following
- *     disclaimer in the documentation and/or other materials provided
- *     with the distribution.
- *
- *   * Neither the name of Cavium Networks nor the names of
- *     its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written
- *     permission.
- *
- * This Software, including technical data, may be subject to U.S. export
- * control laws, including the U.S. Export Administration Act and its associated
- * regulations, and may be subject to export or import regulations in other
- * countries.
- *
- * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
- * AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR
- * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
- * THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION
- * OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
- * SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
- * MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
- * VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
- * CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
- * PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
- */
-
-#include <linux/usb.h>
-#include <linux/slab.h>
-#include <linux/module.h>
-#include <linux/usb/hcd.h>
-#include <linux/prefetch.h>
-#include <linux/dma-mapping.h>
-#include <linux/platform_device.h>
-
-#include <asm/octeon/octeon.h>
-
-#include "octeon-hcd.h"
-
-/**
- * enum cvmx_usb_speed - the possible USB device speeds
- *
- * @CVMX_USB_SPEED_HIGH: Device is operation at 480Mbps
- * @CVMX_USB_SPEED_FULL: Device is operation at 12Mbps
- * @CVMX_USB_SPEED_LOW:  Device is operation at 1.5Mbps
- */
-enum cvmx_usb_speed {
-	CVMX_USB_SPEED_HIGH = 0,
-	CVMX_USB_SPEED_FULL = 1,
-	CVMX_USB_SPEED_LOW = 2,
-};
-
-/**
- * enum cvmx_usb_transfer - the possible USB transfer types
- *
- * @CVMX_USB_TRANSFER_CONTROL:	   USB transfer type control for hub and status
- *				   transfers
- * @CVMX_USB_TRANSFER_ISOCHRONOUS: USB transfer type isochronous for low
- *				   priority periodic transfers
- * @CVMX_USB_TRANSFER_BULK:	   USB transfer type bulk for large low priority
- *				   transfers
- * @CVMX_USB_TRANSFER_INTERRUPT:   USB transfer type interrupt for high priority
- *				   periodic transfers
- */
-enum cvmx_usb_transfer {
-	CVMX_USB_TRANSFER_CONTROL = 0,
-	CVMX_USB_TRANSFER_ISOCHRONOUS = 1,
-	CVMX_USB_TRANSFER_BULK = 2,
-	CVMX_USB_TRANSFER_INTERRUPT = 3,
-};
-
-/**
- * enum cvmx_usb_direction - the transfer directions
- *
- * @CVMX_USB_DIRECTION_OUT: Data is transferring from Octeon to the device/host
- * @CVMX_USB_DIRECTION_IN:  Data is transferring from the device/host to Octeon
- */
-enum cvmx_usb_direction {
-	CVMX_USB_DIRECTION_OUT,
-	CVMX_USB_DIRECTION_IN,
-};
-
-/**
- * enum cvmx_usb_status - possible callback function status codes
- *
- * @CVMX_USB_STATUS_OK:		  The transaction / operation finished without
- *				  any errors
- * @CVMX_USB_STATUS_SHORT:	  FIXME: This is currently not implemented
- * @CVMX_USB_STATUS_CANCEL:	  The transaction was canceled while in flight
- *				  by a user call to cvmx_usb_cancel
- * @CVMX_USB_STATUS_ERROR:	  The transaction aborted with an unexpected
- *				  error status
- * @CVMX_USB_STATUS_STALL:	  The transaction received a USB STALL response
- *				  from the device
- * @CVMX_USB_STATUS_XACTERR:	  The transaction failed with an error from the
- *				  device even after a number of retries
- * @CVMX_USB_STATUS_DATATGLERR:	  The transaction failed with a data toggle
- *				  error even after a number of retries
- * @CVMX_USB_STATUS_BABBLEERR:	  The transaction failed with a babble error
- * @CVMX_USB_STATUS_FRAMEERR:	  The transaction failed with a frame error
- *				  even after a number of retries
- */
-enum cvmx_usb_status {
-	CVMX_USB_STATUS_OK,
-	CVMX_USB_STATUS_SHORT,
-	CVMX_USB_STATUS_CANCEL,
-	CVMX_USB_STATUS_ERROR,
-	CVMX_USB_STATUS_STALL,
-	CVMX_USB_STATUS_XACTERR,
-	CVMX_USB_STATUS_DATATGLERR,
-	CVMX_USB_STATUS_BABBLEERR,
-	CVMX_USB_STATUS_FRAMEERR,
-};
-
-/**
- * struct cvmx_usb_port_status - the USB port status information
- *
- * @port_enabled:	1 = Usb port is enabled, 0 = disabled
- * @port_over_current:	1 = Over current detected, 0 = Over current not
- *			detected. Octeon doesn't support over current detection.
- * @port_powered:	1 = Port power is being supplied to the device, 0 =
- *			power is off. Octeon doesn't support turning port power
- *			off.
- * @port_speed:		Current port speed.
- * @connected:		1 = A device is connected to the port, 0 = No device is
- *			connected.
- * @connect_change:	1 = Device connected state changed since the last set
- *			status call.
- */
-struct cvmx_usb_port_status {
-	u32 reserved			: 25;
-	u32 port_enabled		: 1;
-	u32 port_over_current		: 1;
-	u32 port_powered		: 1;
-	enum cvmx_usb_speed port_speed	: 2;
-	u32 connected			: 1;
-	u32 connect_change		: 1;
-};
-
-/**
- * struct cvmx_usb_iso_packet - descriptor for Isochronous packets
- *
- * @offset:	This is the offset in bytes into the main buffer where this data
- *		is stored.
- * @length:	This is the length in bytes of the data.
- * @status:	This is the status of this individual packet transfer.
- */
-struct cvmx_usb_iso_packet {
-	int offset;
-	int length;
-	enum cvmx_usb_status status;
-};
-
-/**
- * enum cvmx_usb_initialize_flags - flags used by the initialization function
- *
- * @CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_XI:    The USB port uses a 12MHz crystal
- *					      as clock source at USB_XO and
- *					      USB_XI.
- * @CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_GND:   The USB port uses 12/24/48MHz 2.5V
- *					      board clock source at USB_XO.
- *					      USB_XI should be tied to GND.
- * @CVMX_USB_INITIALIZE_FLAGS_CLOCK_MHZ_MASK: Mask for clock speed field
- * @CVMX_USB_INITIALIZE_FLAGS_CLOCK_12MHZ:    Speed of reference clock or
- *					      crystal
- * @CVMX_USB_INITIALIZE_FLAGS_CLOCK_24MHZ:    Speed of reference clock
- * @CVMX_USB_INITIALIZE_FLAGS_CLOCK_48MHZ:    Speed of reference clock
- * @CVMX_USB_INITIALIZE_FLAGS_NO_DMA:	      Disable DMA and used polled IO for
- *					      data transfer use for the USB
- */
-enum cvmx_usb_initialize_flags {
-	CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_XI		= 1 << 0,
-	CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_GND		= 1 << 1,
-	CVMX_USB_INITIALIZE_FLAGS_CLOCK_MHZ_MASK	= 3 << 3,
-	CVMX_USB_INITIALIZE_FLAGS_CLOCK_12MHZ		= 1 << 3,
-	CVMX_USB_INITIALIZE_FLAGS_CLOCK_24MHZ		= 2 << 3,
-	CVMX_USB_INITIALIZE_FLAGS_CLOCK_48MHZ		= 3 << 3,
-	/* Bits 3-4 used to encode the clock frequency */
-	CVMX_USB_INITIALIZE_FLAGS_NO_DMA		= 1 << 5,
-};
-
-/**
- * enum cvmx_usb_pipe_flags - internal flags for a pipe.
- *
- * @CVMX_USB_PIPE_FLAGS_SCHEDULED: Used internally to determine if a pipe is
- *				   actively using hardware.
- * @CVMX_USB_PIPE_FLAGS_NEED_PING: Used internally to determine if a high speed
- *				   pipe is in the ping state.
- */
-enum cvmx_usb_pipe_flags {
-	CVMX_USB_PIPE_FLAGS_SCHEDULED	= 1 << 17,
-	CVMX_USB_PIPE_FLAGS_NEED_PING	= 1 << 18,
-};
-
-/* Maximum number of times to retry failed transactions */
-#define MAX_RETRIES		3
-
-/* Maximum number of hardware channels supported by the USB block */
-#define MAX_CHANNELS		8
-
-/*
- * The low level hardware can transfer a maximum of this number of bytes in each
- * transfer. The field is 19 bits wide
- */
-#define MAX_TRANSFER_BYTES	((1 << 19) - 1)
-
-/*
- * The low level hardware can transfer a maximum of this number of packets in
- * each transfer. The field is 10 bits wide
- */
-#define MAX_TRANSFER_PACKETS	((1 << 10) - 1)
-
-/**
- * Logical transactions may take numerous low level
- * transactions, especially when splits are concerned. This
- * enum represents all of the possible stages a transaction can
- * be in. Note that split completes are always even. This is so
- * the NAK handler can backup to the previous low level
- * transaction with a simple clearing of bit 0.
- */
-enum cvmx_usb_stage {
-	CVMX_USB_STAGE_NON_CONTROL,
-	CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE,
-	CVMX_USB_STAGE_SETUP,
-	CVMX_USB_STAGE_SETUP_SPLIT_COMPLETE,
-	CVMX_USB_STAGE_DATA,
-	CVMX_USB_STAGE_DATA_SPLIT_COMPLETE,
-	CVMX_USB_STAGE_STATUS,
-	CVMX_USB_STAGE_STATUS_SPLIT_COMPLETE,
-};
-
-/**
- * struct cvmx_usb_transaction - describes each pending USB transaction
- *				 regardless of type. These are linked together
- *				 to form a list of pending requests for a pipe.
- *
- * @node:		List node for transactions in the pipe.
- * @type:		Type of transaction, duplicated of the pipe.
- * @flags:		State flags for this transaction.
- * @buffer:		User's physical buffer address to read/write.
- * @buffer_length:	Size of the user's buffer in bytes.
- * @control_header:	For control transactions, physical address of the 8
- *			byte standard header.
- * @iso_start_frame:	For ISO transactions, the starting frame number.
- * @iso_number_packets:	For ISO transactions, the number of packets in the
- *			request.
- * @iso_packets:	For ISO transactions, the sub packets in the request.
- * @actual_bytes:	Actual bytes transfer for this transaction.
- * @stage:		For control transactions, the current stage.
- * @urb:		URB.
- */
-struct cvmx_usb_transaction {
-	struct list_head node;
-	enum cvmx_usb_transfer type;
-	u64 buffer;
-	int buffer_length;
-	u64 control_header;
-	int iso_start_frame;
-	int iso_number_packets;
-	struct cvmx_usb_iso_packet *iso_packets;
-	int xfersize;
-	int pktcnt;
-	int retries;
-	int actual_bytes;
-	enum cvmx_usb_stage stage;
-	struct urb *urb;
-};
-
-/**
- * struct cvmx_usb_pipe - a pipe represents a virtual connection between Octeon
- *			  and some USB device. It contains a list of pending
- *			  request to the device.
- *
- * @node:		List node for pipe list
- * @next:		Pipe after this one in the list
- * @transactions:	List of pending transactions
- * @interval:		For periodic pipes, the interval between packets in
- *			frames
- * @next_tx_frame:	The next frame this pipe is allowed to transmit on
- * @flags:		State flags for this pipe
- * @device_speed:	Speed of device connected to this pipe
- * @transfer_type:	Type of transaction supported by this pipe
- * @transfer_dir:	IN or OUT. Ignored for Control
- * @multi_count:	Max packet in a row for the device
- * @max_packet:		The device's maximum packet size in bytes
- * @device_addr:	USB device address at other end of pipe
- * @endpoint_num:	USB endpoint number at other end of pipe
- * @hub_device_addr:	Hub address this device is connected to
- * @hub_port:		Hub port this device is connected to
- * @pid_toggle:		This toggles between 0/1 on every packet send to track
- *			the data pid needed
- * @channel:		Hardware DMA channel for this pipe
- * @split_sc_frame:	The low order bits of the frame number the split
- *			complete should be sent on
- */
-struct cvmx_usb_pipe {
-	struct list_head node;
-	struct list_head transactions;
-	u64 interval;
-	u64 next_tx_frame;
-	enum cvmx_usb_pipe_flags flags;
-	enum cvmx_usb_speed device_speed;
-	enum cvmx_usb_transfer transfer_type;
-	enum cvmx_usb_direction transfer_dir;
-	int multi_count;
-	u16 max_packet;
-	u8 device_addr;
-	u8 endpoint_num;
-	u8 hub_device_addr;
-	u8 hub_port;
-	u8 pid_toggle;
-	u8 channel;
-	s8 split_sc_frame;
-};
-
-struct cvmx_usb_tx_fifo {
-	struct {
-		int channel;
-		int size;
-		u64 address;
-	} entry[MAX_CHANNELS + 1];
-	int head;
-	int tail;
-};
-
-/**
- * struct octeon_hcd - the state of the USB block
- *
- * lock:		   Serialization lock.
- * init_flags:		   Flags passed to initialize.
- * index:		   Which USB block this is for.
- * idle_hardware_channels: Bit set for every idle hardware channel.
- * usbcx_hprt:		   Stored port status so we don't need to read a CSR to
- *			   determine splits.
- * pipe_for_channel:	   Map channels to pipes.
- * pipe:		   Storage for pipes.
- * indent:		   Used by debug output to indent functions.
- * port_status:		   Last port status used for change notification.
- * idle_pipes:		   List of open pipes that have no transactions.
- * active_pipes:	   Active pipes indexed by transfer type.
- * frame_number:	   Increments every SOF interrupt for time keeping.
- * active_split:	   Points to the current active split, or NULL.
- */
-struct octeon_hcd {
-	spinlock_t lock; /* serialization lock */
-	int init_flags;
-	int index;
-	int idle_hardware_channels;
-	union cvmx_usbcx_hprt usbcx_hprt;
-	struct cvmx_usb_pipe *pipe_for_channel[MAX_CHANNELS];
-	int indent;
-	struct cvmx_usb_port_status port_status;
-	struct list_head idle_pipes;
-	struct list_head active_pipes[4];
-	u64 frame_number;
-	struct cvmx_usb_transaction *active_split;
-	struct cvmx_usb_tx_fifo periodic;
-	struct cvmx_usb_tx_fifo nonperiodic;
-};
-
-/*
- * This macro logically sets a single field in a CSR. It does the sequence
- * read, modify, and write
- */
-#define USB_SET_FIELD32(address, _union, field, value)		\
-	do {							\
-		union _union c;					\
-								\
-		c.u32 = cvmx_usb_read_csr32(usb, address);	\
-		c.s.field = value;				\
-		cvmx_usb_write_csr32(usb, address, c.u32);	\
-	} while (0)
-
-/* Returns the IO address to push/pop stuff data from the FIFOs */
-#define USB_FIFO_ADDRESS(channel, usb_index) \
-	(CVMX_USBCX_GOTGCTL(usb_index) + ((channel) + 1) * 0x1000)
-
-/**
- * struct octeon_temp_buffer - a bounce buffer for USB transfers
- * @orig_buffer: the original buffer passed by the USB stack
- * @data:	 the newly allocated temporary buffer (excluding meta-data)
- *
- * Both the DMA engine and FIFO mode will always transfer full 32-bit words. If
- * the buffer is too short, we need to allocate a temporary one, and this struct
- * represents it.
- */
-struct octeon_temp_buffer {
-	void *orig_buffer;
-	u8 data[0];
-};
-
-static inline struct usb_hcd *octeon_to_hcd(struct octeon_hcd *p)
-{
-	return container_of((void *)p, struct usb_hcd, hcd_priv);
-}
-
-/**
- * octeon_alloc_temp_buffer - allocate a temporary buffer for USB transfer
- *                            (if needed)
- * @urb:	URB.
- * @mem_flags:	Memory allocation flags.
- *
- * This function allocates a temporary bounce buffer whenever it's needed
- * due to HW limitations.
- */
-static int octeon_alloc_temp_buffer(struct urb *urb, gfp_t mem_flags)
-{
-	struct octeon_temp_buffer *temp;
-
-	if (urb->num_sgs || urb->sg ||
-	    (urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP) ||
-	    !(urb->transfer_buffer_length % sizeof(u32)))
-		return 0;
-
-	temp = kmalloc(ALIGN(urb->transfer_buffer_length, sizeof(u32)) +
-		       sizeof(*temp), mem_flags);
-	if (!temp)
-		return -ENOMEM;
-
-	temp->orig_buffer = urb->transfer_buffer;
-	if (usb_urb_dir_out(urb))
-		memcpy(temp->data, urb->transfer_buffer,
-		       urb->transfer_buffer_length);
-	urb->transfer_buffer = temp->data;
-	urb->transfer_flags |= URB_ALIGNED_TEMP_BUFFER;
-
-	return 0;
-}
-
-/**
- * octeon_free_temp_buffer - free a temporary buffer used by USB transfers.
- * @urb: URB.
- *
- * Frees a buffer allocated by octeon_alloc_temp_buffer().
- */
-static void octeon_free_temp_buffer(struct urb *urb)
-{
-	struct octeon_temp_buffer *temp;
-	size_t length;
-
-	if (!(urb->transfer_flags & URB_ALIGNED_TEMP_BUFFER))
-		return;
-
-	temp = container_of(urb->transfer_buffer, struct octeon_temp_buffer,
-			    data);
-	if (usb_urb_dir_in(urb)) {
-		if (usb_pipeisoc(urb->pipe))
-			length = urb->transfer_buffer_length;
-		else
-			length = urb->actual_length;
-
-		memcpy(temp->orig_buffer, urb->transfer_buffer, length);
-	}
-	urb->transfer_buffer = temp->orig_buffer;
-	urb->transfer_flags &= ~URB_ALIGNED_TEMP_BUFFER;
-	kfree(temp);
-}
-
-/**
- * octeon_map_urb_for_dma - Octeon-specific map_urb_for_dma().
- * @hcd:	USB HCD structure.
- * @urb:	URB.
- * @mem_flags:	Memory allocation flags.
- */
-static int octeon_map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb,
-				  gfp_t mem_flags)
-{
-	int ret;
-
-	ret = octeon_alloc_temp_buffer(urb, mem_flags);
-	if (ret)
-		return ret;
-
-	ret = usb_hcd_map_urb_for_dma(hcd, urb, mem_flags);
-	if (ret)
-		octeon_free_temp_buffer(urb);
-
-	return ret;
-}
-
-/**
- * octeon_unmap_urb_for_dma - Octeon-specific unmap_urb_for_dma()
- * @hcd:	USB HCD structure.
- * @urb:	URB.
- */
-static void octeon_unmap_urb_for_dma(struct usb_hcd *hcd, struct urb *urb)
-{
-	usb_hcd_unmap_urb_for_dma(hcd, urb);
-	octeon_free_temp_buffer(urb);
-}
-
-/**
- * Read a USB 32bit CSR. It performs the necessary address swizzle
- * for 32bit CSRs and logs the value in a readable format if
- * debugging is on.
- *
- * @usb:     USB block this access is for
- * @address: 64bit address to read
- *
- * Returns: Result of the read
- */
-static inline u32 cvmx_usb_read_csr32(struct octeon_hcd *usb, u64 address)
-{
-	return cvmx_read64_uint32(address ^ 4);
-}
-
-/**
- * Write a USB 32bit CSR. It performs the necessary address
- * swizzle for 32bit CSRs and logs the value in a readable format
- * if debugging is on.
- *
- * @usb:     USB block this access is for
- * @address: 64bit address to write
- * @value:   Value to write
- */
-static inline void cvmx_usb_write_csr32(struct octeon_hcd *usb,
-					u64 address, u32 value)
-{
-	cvmx_write64_uint32(address ^ 4, value);
-	cvmx_read64_uint64(CVMX_USBNX_DMA0_INB_CHN0(usb->index));
-}
-
-/**
- * Return non zero if this pipe connects to a non HIGH speed
- * device through a high speed hub.
- *
- * @usb:    USB block this access is for
- * @pipe:   Pipe to check
- *
- * Returns: Non zero if we need to do split transactions
- */
-static inline int cvmx_usb_pipe_needs_split(struct octeon_hcd *usb,
-					    struct cvmx_usb_pipe *pipe)
-{
-	return pipe->device_speed != CVMX_USB_SPEED_HIGH &&
-	       usb->usbcx_hprt.s.prtspd == CVMX_USB_SPEED_HIGH;
-}
-
-/**
- * Trivial utility function to return the correct PID for a pipe
- *
- * @pipe:   pipe to check
- *
- * Returns: PID for pipe
- */
-static inline int cvmx_usb_get_data_pid(struct cvmx_usb_pipe *pipe)
-{
-	if (pipe->pid_toggle)
-		return 2; /* Data1 */
-	return 0; /* Data0 */
-}
-
-/* Loops through register until txfflsh or rxfflsh become zero.*/
-static int cvmx_wait_tx_rx(struct octeon_hcd *usb, int fflsh_type)
-{
-	int result;
-	u64 address = CVMX_USBCX_GRSTCTL(usb->index);
-	u64 done = cvmx_get_cycle() + 100 *
-		   (u64)octeon_get_clock_rate / 1000000;
-	union cvmx_usbcx_grstctl c;
-
-	while (1) {
-		c.u32 = cvmx_usb_read_csr32(usb, address);
-		if (fflsh_type == 0 && c.s.txfflsh == 0) {
-			result = 0;
-			break;
-		} else if (fflsh_type == 1 && c.s.rxfflsh == 0) {
-			result = 0;
-			break;
-		} else if (cvmx_get_cycle() > done) {
-			result = -1;
-			break;
-		}
-
-		__delay(100);
-	}
-	return result;
-}
-
-static void cvmx_fifo_setup(struct octeon_hcd *usb)
-{
-	union cvmx_usbcx_ghwcfg3 usbcx_ghwcfg3;
-	union cvmx_usbcx_gnptxfsiz npsiz;
-	union cvmx_usbcx_hptxfsiz psiz;
-
-	usbcx_ghwcfg3.u32 = cvmx_usb_read_csr32(usb,
-						CVMX_USBCX_GHWCFG3(usb->index));
-
-	/*
-	 * Program the USBC_GRXFSIZ register to select the size of the receive
-	 * FIFO (25%).
-	 */
-	USB_SET_FIELD32(CVMX_USBCX_GRXFSIZ(usb->index), cvmx_usbcx_grxfsiz,
-			rxfdep, usbcx_ghwcfg3.s.dfifodepth / 4);
-
-	/*
-	 * Program the USBC_GNPTXFSIZ register to select the size and the start
-	 * address of the non-periodic transmit FIFO for nonperiodic
-	 * transactions (50%).
-	 */
-	npsiz.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_GNPTXFSIZ(usb->index));
-	npsiz.s.nptxfdep = usbcx_ghwcfg3.s.dfifodepth / 2;
-	npsiz.s.nptxfstaddr = usbcx_ghwcfg3.s.dfifodepth / 4;
-	cvmx_usb_write_csr32(usb, CVMX_USBCX_GNPTXFSIZ(usb->index), npsiz.u32);
-
-	/*
-	 * Program the USBC_HPTXFSIZ register to select the size and start
-	 * address of the periodic transmit FIFO for periodic transactions
-	 * (25%).
-	 */
-	psiz.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HPTXFSIZ(usb->index));
-	psiz.s.ptxfsize = usbcx_ghwcfg3.s.dfifodepth / 4;
-	psiz.s.ptxfstaddr = 3 * usbcx_ghwcfg3.s.dfifodepth / 4;
-	cvmx_usb_write_csr32(usb, CVMX_USBCX_HPTXFSIZ(usb->index), psiz.u32);
-
-	/* Flush all FIFOs */
-	USB_SET_FIELD32(CVMX_USBCX_GRSTCTL(usb->index),
-			cvmx_usbcx_grstctl, txfnum, 0x10);
-	USB_SET_FIELD32(CVMX_USBCX_GRSTCTL(usb->index),
-			cvmx_usbcx_grstctl, txfflsh, 1);
-	cvmx_wait_tx_rx(usb, 0);
-	USB_SET_FIELD32(CVMX_USBCX_GRSTCTL(usb->index),
-			cvmx_usbcx_grstctl, rxfflsh, 1);
-	cvmx_wait_tx_rx(usb, 1);
-}
-
-/**
- * Shutdown a USB port after a call to cvmx_usb_initialize().
- * The port should be disabled with all pipes closed when this
- * function is called.
- *
- * @usb: USB device state populated by cvmx_usb_initialize().
- *
- * Returns: 0 or a negative error code.
- */
-static int cvmx_usb_shutdown(struct octeon_hcd *usb)
-{
-	union cvmx_usbnx_clk_ctl usbn_clk_ctl;
-
-	/* Make sure all pipes are closed */
-	if (!list_empty(&usb->idle_pipes) ||
-	    !list_empty(&usb->active_pipes[CVMX_USB_TRANSFER_ISOCHRONOUS]) ||
-	    !list_empty(&usb->active_pipes[CVMX_USB_TRANSFER_INTERRUPT]) ||
-	    !list_empty(&usb->active_pipes[CVMX_USB_TRANSFER_CONTROL]) ||
-	    !list_empty(&usb->active_pipes[CVMX_USB_TRANSFER_BULK]))
-		return -EBUSY;
-
-	/* Disable the clocks and put them in power on reset */
-	usbn_clk_ctl.u64 = cvmx_read64_uint64(CVMX_USBNX_CLK_CTL(usb->index));
-	usbn_clk_ctl.s.enable = 1;
-	usbn_clk_ctl.s.por = 1;
-	usbn_clk_ctl.s.hclk_rst = 1;
-	usbn_clk_ctl.s.prst = 0;
-	usbn_clk_ctl.s.hrst = 0;
-	cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64);
-	return 0;
-}
-
-/**
- * Initialize a USB port for use. This must be called before any
- * other access to the Octeon USB port is made. The port starts
- * off in the disabled state.
- *
- * @dev:	 Pointer to struct device for logging purposes.
- * @usb:	 Pointer to struct octeon_hcd.
- *
- * Returns: 0 or a negative error code.
- */
-static int cvmx_usb_initialize(struct device *dev,
-			       struct octeon_hcd *usb)
-{
-	int channel;
-	int divisor;
-	int retries = 0;
-	union cvmx_usbcx_hcfg usbcx_hcfg;
-	union cvmx_usbnx_clk_ctl usbn_clk_ctl;
-	union cvmx_usbcx_gintsts usbc_gintsts;
-	union cvmx_usbcx_gahbcfg usbcx_gahbcfg;
-	union cvmx_usbcx_gintmsk usbcx_gintmsk;
-	union cvmx_usbcx_gusbcfg usbcx_gusbcfg;
-	union cvmx_usbnx_usbp_ctl_status usbn_usbp_ctl_status;
-
-retry:
-	/*
-	 * Power On Reset and PHY Initialization
-	 *
-	 * 1. Wait for DCOK to assert (nothing to do)
-	 *
-	 * 2a. Write USBN0/1_CLK_CTL[POR] = 1 and
-	 *     USBN0/1_CLK_CTL[HRST,PRST,HCLK_RST] = 0
-	 */
-	usbn_clk_ctl.u64 = cvmx_read64_uint64(CVMX_USBNX_CLK_CTL(usb->index));
-	usbn_clk_ctl.s.por = 1;
-	usbn_clk_ctl.s.hrst = 0;
-	usbn_clk_ctl.s.prst = 0;
-	usbn_clk_ctl.s.hclk_rst = 0;
-	usbn_clk_ctl.s.enable = 0;
-	/*
-	 * 2b. Select the USB reference clock/crystal parameters by writing
-	 *     appropriate values to USBN0/1_CLK_CTL[P_C_SEL, P_RTYPE, P_COM_ON]
-	 */
-	if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_GND) {
-		/*
-		 * The USB port uses 12/24/48MHz 2.5V board clock
-		 * source at USB_XO. USB_XI should be tied to GND.
-		 * Most Octeon evaluation boards require this setting
-		 */
-		if (OCTEON_IS_MODEL(OCTEON_CN3XXX) ||
-		    OCTEON_IS_MODEL(OCTEON_CN56XX) ||
-		    OCTEON_IS_MODEL(OCTEON_CN50XX))
-			/* From CN56XX,CN50XX,CN31XX,CN30XX manuals */
-			usbn_clk_ctl.s.p_rtype = 2; /* p_rclk=1 & p_xenbn=0 */
-		else
-			/* From CN52XX manual */
-			usbn_clk_ctl.s.p_rtype = 1;
-
-		switch (usb->init_flags &
-			CVMX_USB_INITIALIZE_FLAGS_CLOCK_MHZ_MASK) {
-		case CVMX_USB_INITIALIZE_FLAGS_CLOCK_12MHZ:
-			usbn_clk_ctl.s.p_c_sel = 0;
-			break;
-		case CVMX_USB_INITIALIZE_FLAGS_CLOCK_24MHZ:
-			usbn_clk_ctl.s.p_c_sel = 1;
-			break;
-		case CVMX_USB_INITIALIZE_FLAGS_CLOCK_48MHZ:
-			usbn_clk_ctl.s.p_c_sel = 2;
-			break;
-		}
-	} else {
-		/*
-		 * The USB port uses a 12MHz crystal as clock source
-		 * at USB_XO and USB_XI
-		 */
-		if (OCTEON_IS_MODEL(OCTEON_CN3XXX))
-			/* From CN31XX,CN30XX manual */
-			usbn_clk_ctl.s.p_rtype = 3; /* p_rclk=1 & p_xenbn=1 */
-		else
-			/* From CN56XX,CN52XX,CN50XX manuals. */
-			usbn_clk_ctl.s.p_rtype = 0;
-
-		usbn_clk_ctl.s.p_c_sel = 0;
-	}
-	/*
-	 * 2c. Select the HCLK via writing USBN0/1_CLK_CTL[DIVIDE, DIVIDE2] and
-	 *     setting USBN0/1_CLK_CTL[ENABLE] = 1. Divide the core clock down
-	 *     such that USB is as close as possible to 125Mhz
-	 */
-	divisor = DIV_ROUND_UP(octeon_get_clock_rate(), 125000000);
-	/* Lower than 4 doesn't seem to work properly */
-	if (divisor < 4)
-		divisor = 4;
-	usbn_clk_ctl.s.divide = divisor;
-	usbn_clk_ctl.s.divide2 = 0;
-	cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64);
-
-	/* 2d. Write USBN0/1_CLK_CTL[HCLK_RST] = 1 */
-	usbn_clk_ctl.s.hclk_rst = 1;
-	cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64);
-	/* 2e.  Wait 64 core-clock cycles for HCLK to stabilize */
-	__delay(64);
-	/*
-	 * 3. Program the power-on reset field in the USBN clock-control
-	 *    register:
-	 *    USBN_CLK_CTL[POR] = 0
-	 */
-	usbn_clk_ctl.s.por = 0;
-	cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64);
-	/* 4. Wait 1 ms for PHY clock to start */
-	mdelay(1);
-	/*
-	 * 5. Program the Reset input from automatic test equipment field in the
-	 *    USBP control and status register:
-	 *    USBN_USBP_CTL_STATUS[ATE_RESET] = 1
-	 */
-	usbn_usbp_ctl_status.u64 =
-		cvmx_read64_uint64(CVMX_USBNX_USBP_CTL_STATUS(usb->index));
-	usbn_usbp_ctl_status.s.ate_reset = 1;
-	cvmx_write64_uint64(CVMX_USBNX_USBP_CTL_STATUS(usb->index),
-			    usbn_usbp_ctl_status.u64);
-	/* 6. Wait 10 cycles */
-	__delay(10);
-	/*
-	 * 7. Clear ATE_RESET field in the USBN clock-control register:
-	 *    USBN_USBP_CTL_STATUS[ATE_RESET] = 0
-	 */
-	usbn_usbp_ctl_status.s.ate_reset = 0;
-	cvmx_write64_uint64(CVMX_USBNX_USBP_CTL_STATUS(usb->index),
-			    usbn_usbp_ctl_status.u64);
-	/*
-	 * 8. Program the PHY reset field in the USBN clock-control register:
-	 *    USBN_CLK_CTL[PRST] = 1
-	 */
-	usbn_clk_ctl.s.prst = 1;
-	cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64);
-	/*
-	 * 9. Program the USBP control and status register to select host or
-	 *    device mode. USBN_USBP_CTL_STATUS[HST_MODE] = 0 for host, = 1 for
-	 *    device
-	 */
-	usbn_usbp_ctl_status.s.hst_mode = 0;
-	cvmx_write64_uint64(CVMX_USBNX_USBP_CTL_STATUS(usb->index),
-			    usbn_usbp_ctl_status.u64);
-	/* 10. Wait 1 us */
-	udelay(1);
-	/*
-	 * 11. Program the hreset_n field in the USBN clock-control register:
-	 *     USBN_CLK_CTL[HRST] = 1
-	 */
-	usbn_clk_ctl.s.hrst = 1;
-	cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64);
-	/* 12. Proceed to USB core initialization */
-	usbn_clk_ctl.s.enable = 1;
-	cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64);
-	udelay(1);
-
-	/*
-	 * USB Core Initialization
-	 *
-	 * 1. Read USBC_GHWCFG1, USBC_GHWCFG2, USBC_GHWCFG3, USBC_GHWCFG4 to
-	 *    determine USB core configuration parameters.
-	 *
-	 *    Nothing needed
-	 *
-	 * 2. Program the following fields in the global AHB configuration
-	 *    register (USBC_GAHBCFG)
-	 *    DMA mode, USBC_GAHBCFG[DMAEn]: 1 = DMA mode, 0 = slave mode
-	 *    Burst length, USBC_GAHBCFG[HBSTLEN] = 0
-	 *    Nonperiodic TxFIFO empty level (slave mode only),
-	 *    USBC_GAHBCFG[NPTXFEMPLVL]
-	 *    Periodic TxFIFO empty level (slave mode only),
-	 *    USBC_GAHBCFG[PTXFEMPLVL]
-	 *    Global interrupt mask, USBC_GAHBCFG[GLBLINTRMSK] = 1
-	 */
-	usbcx_gahbcfg.u32 = 0;
-	usbcx_gahbcfg.s.dmaen = !(usb->init_flags &
-				  CVMX_USB_INITIALIZE_FLAGS_NO_DMA);
-	usbcx_gahbcfg.s.hbstlen = 0;
-	usbcx_gahbcfg.s.nptxfemplvl = 1;
-	usbcx_gahbcfg.s.ptxfemplvl = 1;
-	usbcx_gahbcfg.s.glblintrmsk = 1;
-	cvmx_usb_write_csr32(usb, CVMX_USBCX_GAHBCFG(usb->index),
-			     usbcx_gahbcfg.u32);
-
-	/*
-	 * 3. Program the following fields in USBC_GUSBCFG register.
-	 *    HS/FS timeout calibration, USBC_GUSBCFG[TOUTCAL] = 0
-	 *    ULPI DDR select, USBC_GUSBCFG[DDRSEL] = 0
-	 *    USB turnaround time, USBC_GUSBCFG[USBTRDTIM] = 0x5
-	 *    PHY low-power clock select, USBC_GUSBCFG[PHYLPWRCLKSEL] = 0
-	 */
-	usbcx_gusbcfg.u32 = cvmx_usb_read_csr32(usb,
-						CVMX_USBCX_GUSBCFG(usb->index));
-	usbcx_gusbcfg.s.toutcal = 0;
-	usbcx_gusbcfg.s.ddrsel = 0;
-	usbcx_gusbcfg.s.usbtrdtim = 0x5;
-	usbcx_gusbcfg.s.phylpwrclksel = 0;
-	cvmx_usb_write_csr32(usb, CVMX_USBCX_GUSBCFG(usb->index),
-			     usbcx_gusbcfg.u32);
-
-	/*
-	 * 4. The software must unmask the following bits in the USBC_GINTMSK
-	 *    register.
-	 *    OTG interrupt mask, USBC_GINTMSK[OTGINTMSK] = 1
-	 *    Mode mismatch interrupt mask, USBC_GINTMSK[MODEMISMSK] = 1
-	 */
-	usbcx_gintmsk.u32 = cvmx_usb_read_csr32(usb,
-						CVMX_USBCX_GINTMSK(usb->index));
-	usbcx_gintmsk.s.otgintmsk = 1;
-	usbcx_gintmsk.s.modemismsk = 1;
-	usbcx_gintmsk.s.hchintmsk = 1;
-	usbcx_gintmsk.s.sofmsk = 0;
-	/* We need RX FIFO interrupts if we don't have DMA */
-	if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA)
-		usbcx_gintmsk.s.rxflvlmsk = 1;
-	cvmx_usb_write_csr32(usb, CVMX_USBCX_GINTMSK(usb->index),
-			     usbcx_gintmsk.u32);
-
-	/*
-	 * Disable all channel interrupts. We'll enable them per channel later.
-	 */
-	for (channel = 0; channel < 8; channel++)
-		cvmx_usb_write_csr32(usb,
-				     CVMX_USBCX_HCINTMSKX(channel, usb->index),
-				     0);
-
-	/*
-	 * Host Port Initialization
-	 *
-	 * 1. Program the host-port interrupt-mask field to unmask,
-	 *    USBC_GINTMSK[PRTINT] = 1
-	 */
-	USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index),
-			cvmx_usbcx_gintmsk, prtintmsk, 1);
-	USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index),
-			cvmx_usbcx_gintmsk, disconnintmsk, 1);
-
-	/*
-	 * 2. Program the USBC_HCFG register to select full-speed host
-	 *    or high-speed host.
-	 */
-	usbcx_hcfg.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HCFG(usb->index));
-	usbcx_hcfg.s.fslssupp = 0;
-	usbcx_hcfg.s.fslspclksel = 0;
-	cvmx_usb_write_csr32(usb, CVMX_USBCX_HCFG(usb->index), usbcx_hcfg.u32);
-
-	cvmx_fifo_setup(usb);
-
-	/*
-	 * If the controller is getting port events right after the reset, it
-	 * means the initialization failed. Try resetting the controller again
-	 * in such case. This is seen to happen after cold boot on DSR-1000N.
-	 */
-	usbc_gintsts.u32 = cvmx_usb_read_csr32(usb,
-					       CVMX_USBCX_GINTSTS(usb->index));
-	cvmx_usb_write_csr32(usb, CVMX_USBCX_GINTSTS(usb->index),
-			     usbc_gintsts.u32);
-	dev_dbg(dev, "gintsts after reset: 0x%x\n", (int)usbc_gintsts.u32);
-	if (!usbc_gintsts.s.disconnint && !usbc_gintsts.s.prtint)
-		return 0;
-	if (retries++ >= 5)
-		return -EAGAIN;
-	dev_info(dev, "controller reset failed (gintsts=0x%x) - retrying\n",
-		 (int)usbc_gintsts.u32);
-	msleep(50);
-	cvmx_usb_shutdown(usb);
-	msleep(50);
-	goto retry;
-}
-
-/**
- * Reset a USB port. After this call succeeds, the USB port is
- * online and servicing requests.
- *
- * @usb: USB device state populated by cvmx_usb_initialize().
- */
-static void cvmx_usb_reset_port(struct octeon_hcd *usb)
-{
-	usb->usbcx_hprt.u32 = cvmx_usb_read_csr32(usb,
-						  CVMX_USBCX_HPRT(usb->index));
-
-	/* Program the port reset bit to start the reset process */
-	USB_SET_FIELD32(CVMX_USBCX_HPRT(usb->index), cvmx_usbcx_hprt,
-			prtrst, 1);
-
-	/*
-	 * Wait at least 50ms (high speed), or 10ms (full speed) for the reset
-	 * process to complete.
-	 */
-	mdelay(50);
-
-	/* Program the port reset bit to 0, USBC_HPRT[PRTRST] = 0 */
-	USB_SET_FIELD32(CVMX_USBCX_HPRT(usb->index), cvmx_usbcx_hprt,
-			prtrst, 0);
-
-	/*
-	 * Read the port speed field to get the enumerated speed,
-	 * USBC_HPRT[PRTSPD].
-	 */
-	usb->usbcx_hprt.u32 = cvmx_usb_read_csr32(usb,
-						  CVMX_USBCX_HPRT(usb->index));
-}
-
-/**
- * Disable a USB port. After this call the USB port will not
- * generate data transfers and will not generate events.
- * Transactions in process will fail and call their
- * associated callbacks.
- *
- * @usb: USB device state populated by cvmx_usb_initialize().
- *
- * Returns: 0 or a negative error code.
- */
-static int cvmx_usb_disable(struct octeon_hcd *usb)
-{
-	/* Disable the port */
-	USB_SET_FIELD32(CVMX_USBCX_HPRT(usb->index), cvmx_usbcx_hprt,
-			prtena, 1);
-	return 0;
-}
-
-/**
- * Get the current state of the USB port. Use this call to
- * determine if the usb port has anything connected, is enabled,
- * or has some sort of error condition. The return value of this
- * call has "changed" bits to signal of the value of some fields
- * have changed between calls.
- *
- * @usb: USB device state populated by cvmx_usb_initialize().
- *
- * Returns: Port status information
- */
-static struct cvmx_usb_port_status cvmx_usb_get_status(struct octeon_hcd *usb)
-{
-	union cvmx_usbcx_hprt usbc_hprt;
-	struct cvmx_usb_port_status result;
-
-	memset(&result, 0, sizeof(result));
-
-	usbc_hprt.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HPRT(usb->index));
-	result.port_enabled = usbc_hprt.s.prtena;
-	result.port_over_current = usbc_hprt.s.prtovrcurract;
-	result.port_powered = usbc_hprt.s.prtpwr;
-	result.port_speed = usbc_hprt.s.prtspd;
-	result.connected = usbc_hprt.s.prtconnsts;
-	result.connect_change =
-		result.connected != usb->port_status.connected;
-
-	return result;
-}
-
-/**
- * Open a virtual pipe between the host and a USB device. A pipe
- * must be opened before data can be transferred between a device
- * and Octeon.
- *
- * @usb:	     USB device state populated by cvmx_usb_initialize().
- * @device_addr:
- *		     USB device address to open the pipe to
- *		     (0-127).
- * @endpoint_num:
- *		     USB endpoint number to open the pipe to
- *		     (0-15).
- * @device_speed:
- *		     The speed of the device the pipe is going
- *		     to. This must match the device's speed,
- *		     which may be different than the port speed.
- * @max_packet:	     The maximum packet length the device can
- *		     transmit/receive (low speed=0-8, full
- *		     speed=0-1023, high speed=0-1024). This value
- *		     comes from the standard endpoint descriptor
- *		     field wMaxPacketSize bits <10:0>.
- * @transfer_type:
- *		     The type of transfer this pipe is for.
- * @transfer_dir:
- *		     The direction the pipe is in. This is not
- *		     used for control pipes.
- * @interval:	     For ISOCHRONOUS and INTERRUPT transfers,
- *		     this is how often the transfer is scheduled
- *		     for. All other transfers should specify
- *		     zero. The units are in frames (8000/sec at
- *		     high speed, 1000/sec for full speed).
- * @multi_count:
- *		     For high speed devices, this is the maximum
- *		     allowed number of packet per microframe.
- *		     Specify zero for non high speed devices. This
- *		     value comes from the standard endpoint descriptor
- *		     field wMaxPacketSize bits <12:11>.
- * @hub_device_addr:
- *		     Hub device address this device is connected
- *		     to. Devices connected directly to Octeon
- *		     use zero. This is only used when the device
- *		     is full/low speed behind a high speed hub.
- *		     The address will be of the high speed hub,
- *		     not and full speed hubs after it.
- * @hub_port:	     Which port on the hub the device is
- *		     connected. Use zero for devices connected
- *		     directly to Octeon. Like hub_device_addr,
- *		     this is only used for full/low speed
- *		     devices behind a high speed hub.
- *
- * Returns: A non-NULL value is a pipe. NULL means an error.
- */
-static struct cvmx_usb_pipe *cvmx_usb_open_pipe(struct octeon_hcd *usb,
-						int device_addr,
-						int endpoint_num,
-						enum cvmx_usb_speed
-							device_speed,
-						int max_packet,
-						enum cvmx_usb_transfer
-							transfer_type,
-						enum cvmx_usb_direction
-							transfer_dir,
-						int interval, int multi_count,
-						int hub_device_addr,
-						int hub_port)
-{
-	struct cvmx_usb_pipe *pipe;
-
-	pipe = kzalloc(sizeof(*pipe), GFP_ATOMIC);
-	if (!pipe)
-		return NULL;
-	if ((device_speed == CVMX_USB_SPEED_HIGH) &&
-	    (transfer_dir == CVMX_USB_DIRECTION_OUT) &&
-	    (transfer_type == CVMX_USB_TRANSFER_BULK))
-		pipe->flags |= CVMX_USB_PIPE_FLAGS_NEED_PING;
-	pipe->device_addr = device_addr;
-	pipe->endpoint_num = endpoint_num;
-	pipe->device_speed = device_speed;
-	pipe->max_packet = max_packet;
-	pipe->transfer_type = transfer_type;
-	pipe->transfer_dir = transfer_dir;
-	INIT_LIST_HEAD(&pipe->transactions);
-
-	/*
-	 * All pipes use interval to rate limit NAK processing. Force an
-	 * interval if one wasn't supplied
-	 */
-	if (!interval)
-		interval = 1;
-	if (cvmx_usb_pipe_needs_split(usb, pipe)) {
-		pipe->interval = interval * 8;
-		/* Force start splits to be schedule on uFrame 0 */
-		pipe->next_tx_frame = ((usb->frame_number + 7) & ~7) +
-					pipe->interval;
-	} else {
-		pipe->interval = interval;
-		pipe->next_tx_frame = usb->frame_number + pipe->interval;
-	}
-	pipe->multi_count = multi_count;
-	pipe->hub_device_addr = hub_device_addr;
-	pipe->hub_port = hub_port;
-	pipe->pid_toggle = 0;
-	pipe->split_sc_frame = -1;
-	list_add_tail(&pipe->node, &usb->idle_pipes);
-
-	/*
-	 * We don't need to tell the hardware about this pipe yet since
-	 * it doesn't have any submitted requests
-	 */
-
-	return pipe;
-}
-
-/**
- * Poll the RX FIFOs and remove data as needed. This function is only used
- * in non DMA mode. It is very important that this function be called quickly
- * enough to prevent FIFO overflow.
- *
- * @usb:	USB device state populated by cvmx_usb_initialize().
- */
-static void cvmx_usb_poll_rx_fifo(struct octeon_hcd *usb)
-{
-	union cvmx_usbcx_grxstsph rx_status;
-	int channel;
-	int bytes;
-	u64 address;
-	u32 *ptr;
-
-	rx_status.u32 = cvmx_usb_read_csr32(usb,
-					    CVMX_USBCX_GRXSTSPH(usb->index));
-	/* Only read data if IN data is there */
-	if (rx_status.s.pktsts != 2)
-		return;
-	/* Check if no data is available */
-	if (!rx_status.s.bcnt)
-		return;
-
-	channel = rx_status.s.chnum;
-	bytes = rx_status.s.bcnt;
-	if (!bytes)
-		return;
-
-	/* Get where the DMA engine would have written this data */
-	address = cvmx_read64_uint64(CVMX_USBNX_DMA0_INB_CHN0(usb->index) +
-				     channel * 8);
-
-	ptr = cvmx_phys_to_ptr(address);
-	cvmx_write64_uint64(CVMX_USBNX_DMA0_INB_CHN0(usb->index) + channel * 8,
-			    address + bytes);
-
-	/* Loop writing the FIFO data for this packet into memory */
-	while (bytes > 0) {
-		*ptr++ = cvmx_usb_read_csr32(usb,
-					USB_FIFO_ADDRESS(channel, usb->index));
-		bytes -= 4;
-	}
-	CVMX_SYNCW;
-}
-
-/**
- * Fill the TX hardware fifo with data out of the software
- * fifos
- *
- * @usb:	    USB device state populated by cvmx_usb_initialize().
- * @fifo:	    Software fifo to use
- * @available:	    Amount of space in the hardware fifo
- *
- * Returns: Non zero if the hardware fifo was too small and needs
- *	    to be serviced again.
- */
-static int cvmx_usb_fill_tx_hw(struct octeon_hcd *usb,
-			       struct cvmx_usb_tx_fifo *fifo, int available)
-{
-	/*
-	 * We're done either when there isn't anymore space or the software FIFO
-	 * is empty
-	 */
-	while (available && (fifo->head != fifo->tail)) {
-		int i = fifo->tail;
-		const u32 *ptr = cvmx_phys_to_ptr(fifo->entry[i].address);
-		u64 csr_address = USB_FIFO_ADDRESS(fifo->entry[i].channel,
-						   usb->index) ^ 4;
-		int words = available;
-
-		/* Limit the amount of data to what the SW fifo has */
-		if (fifo->entry[i].size <= available) {
-			words = fifo->entry[i].size;
-			fifo->tail++;
-			if (fifo->tail > MAX_CHANNELS)
-				fifo->tail = 0;
-		}
-
-		/* Update the next locations and counts */
-		available -= words;
-		fifo->entry[i].address += words * 4;
-		fifo->entry[i].size -= words;
-
-		/*
-		 * Write the HW fifo data. The read every three writes is due
-		 * to an errata on CN3XXX chips
-		 */
-		while (words > 3) {
-			cvmx_write64_uint32(csr_address, *ptr++);
-			cvmx_write64_uint32(csr_address, *ptr++);
-			cvmx_write64_uint32(csr_address, *ptr++);
-			cvmx_read64_uint64(
-					CVMX_USBNX_DMA0_INB_CHN0(usb->index));
-			words -= 3;
-		}
-		cvmx_write64_uint32(csr_address, *ptr++);
-		if (--words) {
-			cvmx_write64_uint32(csr_address, *ptr++);
-			if (--words)
-				cvmx_write64_uint32(csr_address, *ptr++);
-		}
-		cvmx_read64_uint64(CVMX_USBNX_DMA0_INB_CHN0(usb->index));
-	}
-	return fifo->head != fifo->tail;
-}
-
-/**
- * Check the hardware FIFOs and fill them as needed
- *
- * @usb:	USB device state populated by cvmx_usb_initialize().
- */
-static void cvmx_usb_poll_tx_fifo(struct octeon_hcd *usb)
-{
-	if (usb->periodic.head != usb->periodic.tail) {
-		union cvmx_usbcx_hptxsts tx_status;
-
-		tx_status.u32 = cvmx_usb_read_csr32(usb,
-					CVMX_USBCX_HPTXSTS(usb->index));
-		if (cvmx_usb_fill_tx_hw(usb, &usb->periodic,
-					tx_status.s.ptxfspcavail))
-			USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index),
-					cvmx_usbcx_gintmsk, ptxfempmsk, 1);
-		else
-			USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index),
-					cvmx_usbcx_gintmsk, ptxfempmsk, 0);
-	}
-
-	if (usb->nonperiodic.head != usb->nonperiodic.tail) {
-		union cvmx_usbcx_gnptxsts tx_status;
-
-		tx_status.u32 = cvmx_usb_read_csr32(usb,
-					CVMX_USBCX_GNPTXSTS(usb->index));
-		if (cvmx_usb_fill_tx_hw(usb, &usb->nonperiodic,
-					tx_status.s.nptxfspcavail))
-			USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index),
-					cvmx_usbcx_gintmsk, nptxfempmsk, 1);
-		else
-			USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index),
-					cvmx_usbcx_gintmsk, nptxfempmsk, 0);
-	}
-}
-
-/**
- * Fill the TX FIFO with an outgoing packet
- *
- * @usb:	  USB device state populated by cvmx_usb_initialize().
- * @channel:	  Channel number to get packet from
- */
-static void cvmx_usb_fill_tx_fifo(struct octeon_hcd *usb, int channel)
-{
-	union cvmx_usbcx_hccharx hcchar;
-	union cvmx_usbcx_hcspltx usbc_hcsplt;
-	union cvmx_usbcx_hctsizx usbc_hctsiz;
-	struct cvmx_usb_tx_fifo *fifo;
-
-	/* We only need to fill data on outbound channels */
-	hcchar.u32 = cvmx_usb_read_csr32(usb,
-			CVMX_USBCX_HCCHARX(channel, usb->index));
-	if (hcchar.s.epdir != CVMX_USB_DIRECTION_OUT)
-		return;
-
-	/* OUT Splits only have data on the start and not the complete */
-	usbc_hcsplt.u32 = cvmx_usb_read_csr32(usb,
-				CVMX_USBCX_HCSPLTX(channel, usb->index));
-	if (usbc_hcsplt.s.spltena && usbc_hcsplt.s.compsplt)
-		return;
-
-	/*
-	 * Find out how many bytes we need to fill and convert it into 32bit
-	 * words.
-	 */
-	usbc_hctsiz.u32 = cvmx_usb_read_csr32(usb,
-				CVMX_USBCX_HCTSIZX(channel, usb->index));
-	if (!usbc_hctsiz.s.xfersize)
-		return;
-
-	if ((hcchar.s.eptype == CVMX_USB_TRANSFER_INTERRUPT) ||
-	    (hcchar.s.eptype == CVMX_USB_TRANSFER_ISOCHRONOUS))
-		fifo = &usb->periodic;
-	else
-		fifo = &usb->nonperiodic;
-
-	fifo->entry[fifo->head].channel = channel;
-	fifo->entry[fifo->head].address =
-		cvmx_read64_uint64(CVMX_USBNX_DMA0_OUTB_CHN0(usb->index) +
-				   channel * 8);
-	fifo->entry[fifo->head].size = (usbc_hctsiz.s.xfersize + 3) >> 2;
-	fifo->head++;
-	if (fifo->head > MAX_CHANNELS)
-		fifo->head = 0;
-
-	cvmx_usb_poll_tx_fifo(usb);
-}
-
-/**
- * Perform channel specific setup for Control transactions. All
- * the generic stuff will already have been done in cvmx_usb_start_channel().
- *
- * @usb:	  USB device state populated by cvmx_usb_initialize().
- * @channel:	  Channel to setup
- * @pipe:	  Pipe for control transaction
- */
-static void cvmx_usb_start_channel_control(struct octeon_hcd *usb,
-					   int channel,
-					   struct cvmx_usb_pipe *pipe)
-{
-	struct usb_hcd *hcd = octeon_to_hcd(usb);
-	struct device *dev = hcd->self.controller;
-	struct cvmx_usb_transaction *transaction =
-		list_first_entry(&pipe->transactions, typeof(*transaction),
-				 node);
-	struct usb_ctrlrequest *header =
-		cvmx_phys_to_ptr(transaction->control_header);
-	int bytes_to_transfer = transaction->buffer_length -
-		transaction->actual_bytes;
-	int packets_to_transfer;
-	union cvmx_usbcx_hctsizx usbc_hctsiz;
-
-	usbc_hctsiz.u32 = cvmx_usb_read_csr32(usb,
-				CVMX_USBCX_HCTSIZX(channel, usb->index));
-
-	switch (transaction->stage) {
-	case CVMX_USB_STAGE_NON_CONTROL:
-	case CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE:
-		dev_err(dev, "%s: ERROR - Non control stage\n", __func__);
-		break;
-	case CVMX_USB_STAGE_SETUP:
-		usbc_hctsiz.s.pid = 3; /* Setup */
-		bytes_to_transfer = sizeof(*header);
-		/* All Control operations start with a setup going OUT */
-		USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index),
-				cvmx_usbcx_hccharx, epdir,
-				CVMX_USB_DIRECTION_OUT);
-		/*
-		 * Setup send the control header instead of the buffer data. The
-		 * buffer data will be used in the next stage
-		 */
-		cvmx_write64_uint64(CVMX_USBNX_DMA0_OUTB_CHN0(usb->index) +
-					channel * 8,
-				    transaction->control_header);
-		break;
-	case CVMX_USB_STAGE_SETUP_SPLIT_COMPLETE:
-		usbc_hctsiz.s.pid = 3; /* Setup */
-		bytes_to_transfer = 0;
-		/* All Control operations start with a setup going OUT */
-		USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index),
-				cvmx_usbcx_hccharx, epdir,
-				CVMX_USB_DIRECTION_OUT);
-
-		USB_SET_FIELD32(CVMX_USBCX_HCSPLTX(channel, usb->index),
-				cvmx_usbcx_hcspltx, compsplt, 1);
-		break;
-	case CVMX_USB_STAGE_DATA:
-		usbc_hctsiz.s.pid = cvmx_usb_get_data_pid(pipe);
-		if (cvmx_usb_pipe_needs_split(usb, pipe)) {
-			if (header->bRequestType & USB_DIR_IN)
-				bytes_to_transfer = 0;
-			else if (bytes_to_transfer > pipe->max_packet)
-				bytes_to_transfer = pipe->max_packet;
-		}
-		USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index),
-				cvmx_usbcx_hccharx, epdir,
-				((header->bRequestType & USB_DIR_IN) ?
-					CVMX_USB_DIRECTION_IN :
-					CVMX_USB_DIRECTION_OUT));
-		break;
-	case CVMX_USB_STAGE_DATA_SPLIT_COMPLETE:
-		usbc_hctsiz.s.pid = cvmx_usb_get_data_pid(pipe);
-		if (!(header->bRequestType & USB_DIR_IN))
-			bytes_to_transfer = 0;
-		USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index),
-				cvmx_usbcx_hccharx, epdir,
-				((header->bRequestType & USB_DIR_IN) ?
-					CVMX_USB_DIRECTION_IN :
-					CVMX_USB_DIRECTION_OUT));
-		USB_SET_FIELD32(CVMX_USBCX_HCSPLTX(channel, usb->index),
-				cvmx_usbcx_hcspltx, compsplt, 1);
-		break;
-	case CVMX_USB_STAGE_STATUS:
-		usbc_hctsiz.s.pid = cvmx_usb_get_data_pid(pipe);
-		bytes_to_transfer = 0;
-		USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index),
-				cvmx_usbcx_hccharx, epdir,
-				((header->bRequestType & USB_DIR_IN) ?
-					CVMX_USB_DIRECTION_OUT :
-					CVMX_USB_DIRECTION_IN));
-		break;
-	case CVMX_USB_STAGE_STATUS_SPLIT_COMPLETE:
-		usbc_hctsiz.s.pid = cvmx_usb_get_data_pid(pipe);
-		bytes_to_transfer = 0;
-		USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index),
-				cvmx_usbcx_hccharx, epdir,
-				((header->bRequestType & USB_DIR_IN) ?
-					CVMX_USB_DIRECTION_OUT :
-					CVMX_USB_DIRECTION_IN));
-		USB_SET_FIELD32(CVMX_USBCX_HCSPLTX(channel, usb->index),
-				cvmx_usbcx_hcspltx, compsplt, 1);
-		break;
-	}
-
-	/*
-	 * Make sure the transfer never exceeds the byte limit of the hardware.
-	 * Further bytes will be sent as continued transactions
-	 */
-	if (bytes_to_transfer > MAX_TRANSFER_BYTES) {
-		/* Round MAX_TRANSFER_BYTES to a multiple of out packet size */
-		bytes_to_transfer = MAX_TRANSFER_BYTES / pipe->max_packet;
-		bytes_to_transfer *= pipe->max_packet;
-	}
-
-	/*
-	 * Calculate the number of packets to transfer. If the length is zero
-	 * we still need to transfer one packet
-	 */
-	packets_to_transfer = DIV_ROUND_UP(bytes_to_transfer,
-					   pipe->max_packet);
-	if (packets_to_transfer == 0) {
-		packets_to_transfer = 1;
-	} else if ((packets_to_transfer > 1) &&
-			(usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA)) {
-		/*
-		 * Limit to one packet when not using DMA. Channels must be
-		 * restarted between every packet for IN transactions, so there
-		 * is no reason to do multiple packets in a row
-		 */
-		packets_to_transfer = 1;
-		bytes_to_transfer = packets_to_transfer * pipe->max_packet;
-	} else if (packets_to_transfer > MAX_TRANSFER_PACKETS) {
-		/*
-		 * Limit the number of packet and data transferred to what the
-		 * hardware can handle
-		 */
-		packets_to_transfer = MAX_TRANSFER_PACKETS;
-		bytes_to_transfer = packets_to_transfer * pipe->max_packet;
-	}
-
-	usbc_hctsiz.s.xfersize = bytes_to_transfer;
-	usbc_hctsiz.s.pktcnt = packets_to_transfer;
-
-	cvmx_usb_write_csr32(usb, CVMX_USBCX_HCTSIZX(channel, usb->index),
-			     usbc_hctsiz.u32);
-}
-
-/**
- * Start a channel to perform the pipe's head transaction
- *
- * @usb:	  USB device state populated by cvmx_usb_initialize().
- * @channel:	  Channel to setup
- * @pipe:	  Pipe to start
- */
-static void cvmx_usb_start_channel(struct octeon_hcd *usb, int channel,
-				   struct cvmx_usb_pipe *pipe)
-{
-	struct cvmx_usb_transaction *transaction =
-		list_first_entry(&pipe->transactions, typeof(*transaction),
-				 node);
-
-	/* Make sure all writes to the DMA region get flushed */
-	CVMX_SYNCW;
-
-	/* Attach the channel to the pipe */
-	usb->pipe_for_channel[channel] = pipe;
-	pipe->channel = channel;
-	pipe->flags |= CVMX_USB_PIPE_FLAGS_SCHEDULED;
-
-	/* Mark this channel as in use */
-	usb->idle_hardware_channels &= ~(1 << channel);
-
-	/* Enable the channel interrupt bits */
-	{
-		union cvmx_usbcx_hcintx usbc_hcint;
-		union cvmx_usbcx_hcintmskx usbc_hcintmsk;
-		union cvmx_usbcx_haintmsk usbc_haintmsk;
-
-		/* Clear all channel status bits */
-		usbc_hcint.u32 = cvmx_usb_read_csr32(usb,
-					CVMX_USBCX_HCINTX(channel, usb->index));
-
-		cvmx_usb_write_csr32(usb,
-				     CVMX_USBCX_HCINTX(channel, usb->index),
-				     usbc_hcint.u32);
-
-		usbc_hcintmsk.u32 = 0;
-		usbc_hcintmsk.s.chhltdmsk = 1;
-		if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA) {
-			/*
-			 * Channels need these extra interrupts when we aren't
-			 * in DMA mode.
-			 */
-			usbc_hcintmsk.s.datatglerrmsk = 1;
-			usbc_hcintmsk.s.frmovrunmsk = 1;
-			usbc_hcintmsk.s.bblerrmsk = 1;
-			usbc_hcintmsk.s.xacterrmsk = 1;
-			if (cvmx_usb_pipe_needs_split(usb, pipe)) {
-				/*
-				 * Splits don't generate xfercompl, so we need
-				 * ACK and NYET.
-				 */
-				usbc_hcintmsk.s.nyetmsk = 1;
-				usbc_hcintmsk.s.ackmsk = 1;
-			}
-			usbc_hcintmsk.s.nakmsk = 1;
-			usbc_hcintmsk.s.stallmsk = 1;
-			usbc_hcintmsk.s.xfercomplmsk = 1;
-		}
-		cvmx_usb_write_csr32(usb,
-				     CVMX_USBCX_HCINTMSKX(channel, usb->index),
-				     usbc_hcintmsk.u32);
-
-		/* Enable the channel interrupt to propagate */
-		usbc_haintmsk.u32 = cvmx_usb_read_csr32(usb,
-					CVMX_USBCX_HAINTMSK(usb->index));
-		usbc_haintmsk.s.haintmsk |= 1 << channel;
-		cvmx_usb_write_csr32(usb, CVMX_USBCX_HAINTMSK(usb->index),
-				     usbc_haintmsk.u32);
-	}
-
-	/* Setup the location the DMA engine uses. */
-	{
-		u64 reg;
-		u64 dma_address = transaction->buffer +
-				  transaction->actual_bytes;
-
-		if (transaction->type == CVMX_USB_TRANSFER_ISOCHRONOUS)
-			dma_address = transaction->buffer +
-					transaction->iso_packets[0].offset +
-					transaction->actual_bytes;
-
-		if (pipe->transfer_dir == CVMX_USB_DIRECTION_OUT)
-			reg = CVMX_USBNX_DMA0_OUTB_CHN0(usb->index);
-		else
-			reg = CVMX_USBNX_DMA0_INB_CHN0(usb->index);
-		cvmx_write64_uint64(reg + channel * 8, dma_address);
-	}
-
-	/* Setup both the size of the transfer and the SPLIT characteristics */
-	{
-		union cvmx_usbcx_hcspltx usbc_hcsplt = {.u32 = 0};
-		union cvmx_usbcx_hctsizx usbc_hctsiz = {.u32 = 0};
-		int packets_to_transfer;
-		int bytes_to_transfer = transaction->buffer_length -
-			transaction->actual_bytes;
-
-		/*
-		 * ISOCHRONOUS transactions store each individual transfer size
-		 * in the packet structure, not the global buffer_length
-		 */
-		if (transaction->type == CVMX_USB_TRANSFER_ISOCHRONOUS)
-			bytes_to_transfer =
-				transaction->iso_packets[0].length -
-				transaction->actual_bytes;
-
-		/*
-		 * We need to do split transactions when we are talking to non
-		 * high speed devices that are behind a high speed hub
-		 */
-		if (cvmx_usb_pipe_needs_split(usb, pipe)) {
-			/*
-			 * On the start split phase (stage is even) record the
-			 * frame number we will need to send the split complete.
-			 * We only store the lower two bits since the time ahead
-			 * can only be two frames
-			 */
-			if ((transaction->stage & 1) == 0) {
-				if (transaction->type == CVMX_USB_TRANSFER_BULK)
-					pipe->split_sc_frame =
-						(usb->frame_number + 1) & 0x7f;
-				else
-					pipe->split_sc_frame =
-						(usb->frame_number + 2) & 0x7f;
-			} else {
-				pipe->split_sc_frame = -1;
-			}
-
-			usbc_hcsplt.s.spltena = 1;
-			usbc_hcsplt.s.hubaddr = pipe->hub_device_addr;
-			usbc_hcsplt.s.prtaddr = pipe->hub_port;
-			usbc_hcsplt.s.compsplt = (transaction->stage ==
-				CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE);
-
-			/*
-			 * SPLIT transactions can only ever transmit one data
-			 * packet so limit the transfer size to the max packet
-			 * size
-			 */
-			if (bytes_to_transfer > pipe->max_packet)
-				bytes_to_transfer = pipe->max_packet;
-
-			/*
-			 * ISOCHRONOUS OUT splits are unique in that they limit
-			 * data transfers to 188 byte chunks representing the
-			 * begin/middle/end of the data or all
-			 */
-			if (!usbc_hcsplt.s.compsplt &&
-			    (pipe->transfer_dir == CVMX_USB_DIRECTION_OUT) &&
-			    (pipe->transfer_type ==
-			     CVMX_USB_TRANSFER_ISOCHRONOUS)) {
-				/*
-				 * Clear the split complete frame number as
-				 * there isn't going to be a split complete
-				 */
-				pipe->split_sc_frame = -1;
-				/*
-				 * See if we've started this transfer and sent
-				 * data
-				 */
-				if (transaction->actual_bytes == 0) {
-					/*
-					 * Nothing sent yet, this is either a
-					 * begin or the entire payload
-					 */
-					if (bytes_to_transfer <= 188)
-						/* Entire payload in one go */
-						usbc_hcsplt.s.xactpos = 3;
-					else
-						/* First part of payload */
-						usbc_hcsplt.s.xactpos = 2;
-				} else {
-					/*
-					 * Continuing the previous data, we must
-					 * either be in the middle or at the end
-					 */
-					if (bytes_to_transfer <= 188)
-						/* End of payload */
-						usbc_hcsplt.s.xactpos = 1;
-					else
-						/* Middle of payload */
-						usbc_hcsplt.s.xactpos = 0;
-				}
-				/*
-				 * Again, the transfer size is limited to 188
-				 * bytes
-				 */
-				if (bytes_to_transfer > 188)
-					bytes_to_transfer = 188;
-			}
-		}
-
-		/*
-		 * Make sure the transfer never exceeds the byte limit of the
-		 * hardware. Further bytes will be sent as continued
-		 * transactions
-		 */
-		if (bytes_to_transfer > MAX_TRANSFER_BYTES) {
-			/*
-			 * Round MAX_TRANSFER_BYTES to a multiple of out packet
-			 * size
-			 */
-			bytes_to_transfer = MAX_TRANSFER_BYTES /
-				pipe->max_packet;
-			bytes_to_transfer *= pipe->max_packet;
-		}
-
-		/*
-		 * Calculate the number of packets to transfer. If the length is
-		 * zero we still need to transfer one packet
-		 */
-		packets_to_transfer =
-			DIV_ROUND_UP(bytes_to_transfer, pipe->max_packet);
-		if (packets_to_transfer == 0) {
-			packets_to_transfer = 1;
-		} else if ((packets_to_transfer > 1) &&
-			   (usb->init_flags &
-			    CVMX_USB_INITIALIZE_FLAGS_NO_DMA)) {
-			/*
-			 * Limit to one packet when not using DMA. Channels must
-			 * be restarted between every packet for IN
-			 * transactions, so there is no reason to do multiple
-			 * packets in a row
-			 */
-			packets_to_transfer = 1;
-			bytes_to_transfer = packets_to_transfer *
-				pipe->max_packet;
-		} else if (packets_to_transfer > MAX_TRANSFER_PACKETS) {
-			/*
-			 * Limit the number of packet and data transferred to
-			 * what the hardware can handle
-			 */
-			packets_to_transfer = MAX_TRANSFER_PACKETS;
-			bytes_to_transfer = packets_to_transfer *
-				pipe->max_packet;
-		}
-
-		usbc_hctsiz.s.xfersize = bytes_to_transfer;
-		usbc_hctsiz.s.pktcnt = packets_to_transfer;
-
-		/* Update the DATA0/DATA1 toggle */
-		usbc_hctsiz.s.pid = cvmx_usb_get_data_pid(pipe);
-		/*
-		 * High speed pipes may need a hardware ping before they start
-		 */
-		if (pipe->flags & CVMX_USB_PIPE_FLAGS_NEED_PING)
-			usbc_hctsiz.s.dopng = 1;
-
-		cvmx_usb_write_csr32(usb,
-				     CVMX_USBCX_HCSPLTX(channel, usb->index),
-				     usbc_hcsplt.u32);
-		cvmx_usb_write_csr32(usb,
-				     CVMX_USBCX_HCTSIZX(channel, usb->index),
-				     usbc_hctsiz.u32);
-	}
-
-	/* Setup the Host Channel Characteristics Register */
-	{
-		union cvmx_usbcx_hccharx usbc_hcchar = {.u32 = 0};
-
-		/*
-		 * Set the startframe odd/even properly. This is only used for
-		 * periodic
-		 */
-		usbc_hcchar.s.oddfrm = usb->frame_number & 1;
-
-		/*
-		 * Set the number of back to back packets allowed by this
-		 * endpoint. Split transactions interpret "ec" as the number of
-		 * immediate retries of failure. These retries happen too
-		 * quickly, so we disable these entirely for splits
-		 */
-		if (cvmx_usb_pipe_needs_split(usb, pipe))
-			usbc_hcchar.s.ec = 1;
-		else if (pipe->multi_count < 1)
-			usbc_hcchar.s.ec = 1;
-		else if (pipe->multi_count > 3)
-			usbc_hcchar.s.ec = 3;
-		else
-			usbc_hcchar.s.ec = pipe->multi_count;
-
-		/* Set the rest of the endpoint specific settings */
-		usbc_hcchar.s.devaddr = pipe->device_addr;
-		usbc_hcchar.s.eptype = transaction->type;
-		usbc_hcchar.s.lspddev =
-			(pipe->device_speed == CVMX_USB_SPEED_LOW);
-		usbc_hcchar.s.epdir = pipe->transfer_dir;
-		usbc_hcchar.s.epnum = pipe->endpoint_num;
-		usbc_hcchar.s.mps = pipe->max_packet;
-		cvmx_usb_write_csr32(usb,
-				     CVMX_USBCX_HCCHARX(channel, usb->index),
-				     usbc_hcchar.u32);
-	}
-
-	/* Do transaction type specific fixups as needed */
-	switch (transaction->type) {
-	case CVMX_USB_TRANSFER_CONTROL:
-		cvmx_usb_start_channel_control(usb, channel, pipe);
-		break;
-	case CVMX_USB_TRANSFER_BULK:
-	case CVMX_USB_TRANSFER_INTERRUPT:
-		break;
-	case CVMX_USB_TRANSFER_ISOCHRONOUS:
-		if (!cvmx_usb_pipe_needs_split(usb, pipe)) {
-			/*
-			 * ISO transactions require different PIDs depending on
-			 * direction and how many packets are needed
-			 */
-			if (pipe->transfer_dir == CVMX_USB_DIRECTION_OUT) {
-				if (pipe->multi_count < 2) /* Need DATA0 */
-					USB_SET_FIELD32(
-						CVMX_USBCX_HCTSIZX(channel,
-								   usb->index),
-						cvmx_usbcx_hctsizx, pid, 0);
-				else /* Need MDATA */
-					USB_SET_FIELD32(
-						CVMX_USBCX_HCTSIZX(channel,
-								   usb->index),
-						cvmx_usbcx_hctsizx, pid, 3);
-			}
-		}
-		break;
-	}
-	{
-		union cvmx_usbcx_hctsizx usbc_hctsiz = { .u32 =
-			cvmx_usb_read_csr32(usb,
-					    CVMX_USBCX_HCTSIZX(channel,
-							       usb->index))
-		};
-		transaction->xfersize = usbc_hctsiz.s.xfersize;
-		transaction->pktcnt = usbc_hctsiz.s.pktcnt;
-	}
-	/* Remember when we start a split transaction */
-	if (cvmx_usb_pipe_needs_split(usb, pipe))
-		usb->active_split = transaction;
-	USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index),
-			cvmx_usbcx_hccharx, chena, 1);
-	if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA)
-		cvmx_usb_fill_tx_fifo(usb, channel);
-}
-
-/**
- * Find a pipe that is ready to be scheduled to hardware.
- * @usb:	 USB device state populated by cvmx_usb_initialize().
- * @xfer_type:	 Transfer type
- *
- * Returns: Pipe or NULL if none are ready
- */
-static struct cvmx_usb_pipe *cvmx_usb_find_ready_pipe(struct octeon_hcd *usb,
-		enum cvmx_usb_transfer xfer_type)
-{
-	struct list_head *list = usb->active_pipes + xfer_type;
-	u64 current_frame = usb->frame_number;
-	struct cvmx_usb_pipe *pipe;
-
-	list_for_each_entry(pipe, list, node) {
-		struct cvmx_usb_transaction *t =
-			list_first_entry(&pipe->transactions, typeof(*t),
-					 node);
-		if (!(pipe->flags & CVMX_USB_PIPE_FLAGS_SCHEDULED) && t &&
-		    (pipe->next_tx_frame <= current_frame) &&
-		    ((pipe->split_sc_frame == -1) ||
-		     ((((int)current_frame - pipe->split_sc_frame) & 0x7f) <
-		      0x40)) &&
-		    (!usb->active_split || (usb->active_split == t))) {
-			prefetch(t);
-			return pipe;
-		}
-	}
-	return NULL;
-}
-
-static struct cvmx_usb_pipe *cvmx_usb_next_pipe(struct octeon_hcd *usb,
-						int is_sof)
-{
-	struct cvmx_usb_pipe *pipe;
-
-	/* Find a pipe needing service. */
-	if (is_sof) {
-		/*
-		 * Only process periodic pipes on SOF interrupts. This way we
-		 * are sure that the periodic data is sent in the beginning of
-		 * the frame.
-		 */
-		pipe = cvmx_usb_find_ready_pipe(usb,
-						CVMX_USB_TRANSFER_ISOCHRONOUS);
-		if (pipe)
-			return pipe;
-		pipe = cvmx_usb_find_ready_pipe(usb,
-						CVMX_USB_TRANSFER_INTERRUPT);
-		if (pipe)
-			return pipe;
-	}
-	pipe = cvmx_usb_find_ready_pipe(usb, CVMX_USB_TRANSFER_CONTROL);
-	if (pipe)
-		return pipe;
-	return cvmx_usb_find_ready_pipe(usb, CVMX_USB_TRANSFER_BULK);
-}
-
-/**
- * Called whenever a pipe might need to be scheduled to the
- * hardware.
- *
- * @usb:	 USB device state populated by cvmx_usb_initialize().
- * @is_sof:	 True if this schedule was called on a SOF interrupt.
- */
-static void cvmx_usb_schedule(struct octeon_hcd *usb, int is_sof)
-{
-	int channel;
-	struct cvmx_usb_pipe *pipe;
-	int need_sof;
-	enum cvmx_usb_transfer ttype;
-
-	if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA) {
-		/*
-		 * Without DMA we need to be careful to not schedule something
-		 * at the end of a frame and cause an overrun.
-		 */
-		union cvmx_usbcx_hfnum hfnum = {
-			.u32 = cvmx_usb_read_csr32(usb,
-						CVMX_USBCX_HFNUM(usb->index))
-		};
-
-		union cvmx_usbcx_hfir hfir = {
-			.u32 = cvmx_usb_read_csr32(usb,
-						CVMX_USBCX_HFIR(usb->index))
-		};
-
-		if (hfnum.s.frrem < hfir.s.frint / 4)
-			goto done;
-	}
-
-	while (usb->idle_hardware_channels) {
-		/* Find an idle channel */
-		channel = __fls(usb->idle_hardware_channels);
-		if (unlikely(channel > 7))
-			break;
-
-		pipe = cvmx_usb_next_pipe(usb, is_sof);
-		if (!pipe)
-			break;
-
-		cvmx_usb_start_channel(usb, channel, pipe);
-	}
-
-done:
-	/*
-	 * Only enable SOF interrupts when we have transactions pending in the
-	 * future that might need to be scheduled
-	 */
-	need_sof = 0;
-	for (ttype = CVMX_USB_TRANSFER_CONTROL;
-	     ttype <= CVMX_USB_TRANSFER_INTERRUPT; ttype++) {
-		list_for_each_entry(pipe, &usb->active_pipes[ttype], node) {
-			if (pipe->next_tx_frame > usb->frame_number) {
-				need_sof = 1;
-				break;
-			}
-		}
-	}
-	USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index),
-			cvmx_usbcx_gintmsk, sofmsk, need_sof);
-}
-
-static void octeon_usb_urb_complete_callback(struct octeon_hcd *usb,
-					     enum cvmx_usb_status status,
-					     struct cvmx_usb_pipe *pipe,
-					     struct cvmx_usb_transaction
-						*transaction,
-					     int bytes_transferred,
-					     struct urb *urb)
-{
-	struct usb_hcd *hcd = octeon_to_hcd(usb);
-	struct device *dev = hcd->self.controller;
-
-	if (likely(status == CVMX_USB_STATUS_OK))
-		urb->actual_length = bytes_transferred;
-	else
-		urb->actual_length = 0;
-
-	urb->hcpriv = NULL;
-
-	/* For Isochronous transactions we need to update the URB packet status
-	 * list from data in our private copy
-	 */
-	if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) {
-		int i;
-		/*
-		 * The pointer to the private list is stored in the setup_packet
-		 * field.
-		 */
-		struct cvmx_usb_iso_packet *iso_packet =
-			(struct cvmx_usb_iso_packet *)urb->setup_packet;
-		/* Recalculate the transfer size by adding up each packet */
-		urb->actual_length = 0;
-		for (i = 0; i < urb->number_of_packets; i++) {
-			if (iso_packet[i].status == CVMX_USB_STATUS_OK) {
-				urb->iso_frame_desc[i].status = 0;
-				urb->iso_frame_desc[i].actual_length =
-					iso_packet[i].length;
-				urb->actual_length +=
-					urb->iso_frame_desc[i].actual_length;
-			} else {
-				dev_dbg(dev, "ISOCHRONOUS packet=%d of %d status=%d pipe=%p transaction=%p size=%d\n",
-					i, urb->number_of_packets,
-					iso_packet[i].status, pipe,
-					transaction, iso_packet[i].length);
-				urb->iso_frame_desc[i].status = -EREMOTEIO;
-			}
-		}
-		/* Free the private list now that we don't need it anymore */
-		kfree(iso_packet);
-		urb->setup_packet = NULL;
-	}
-
-	switch (status) {
-	case CVMX_USB_STATUS_OK:
-		urb->status = 0;
-		break;
-	case CVMX_USB_STATUS_CANCEL:
-		if (urb->status == 0)
-			urb->status = -ENOENT;
-		break;
-	case CVMX_USB_STATUS_STALL:
-		dev_dbg(dev, "status=stall pipe=%p transaction=%p size=%d\n",
-			pipe, transaction, bytes_transferred);
-		urb->status = -EPIPE;
-		break;
-	case CVMX_USB_STATUS_BABBLEERR:
-		dev_dbg(dev, "status=babble pipe=%p transaction=%p size=%d\n",
-			pipe, transaction, bytes_transferred);
-		urb->status = -EPIPE;
-		break;
-	case CVMX_USB_STATUS_SHORT:
-		dev_dbg(dev, "status=short pipe=%p transaction=%p size=%d\n",
-			pipe, transaction, bytes_transferred);
-		urb->status = -EREMOTEIO;
-		break;
-	case CVMX_USB_STATUS_ERROR:
-	case CVMX_USB_STATUS_XACTERR:
-	case CVMX_USB_STATUS_DATATGLERR:
-	case CVMX_USB_STATUS_FRAMEERR:
-		dev_dbg(dev, "status=%d pipe=%p transaction=%p size=%d\n",
-			status, pipe, transaction, bytes_transferred);
-		urb->status = -EPROTO;
-		break;
-	}
-	usb_hcd_unlink_urb_from_ep(octeon_to_hcd(usb), urb);
-	spin_unlock(&usb->lock);
-	usb_hcd_giveback_urb(octeon_to_hcd(usb), urb, urb->status);
-	spin_lock(&usb->lock);
-}
-
-/**
- * Signal the completion of a transaction and free it. The
- * transaction will be removed from the pipe transaction list.
- *
- * @usb:	 USB device state populated by cvmx_usb_initialize().
- * @pipe:	 Pipe the transaction is on
- * @transaction:
- *		 Transaction that completed
- * @complete_code:
- *		 Completion code
- */
-static void cvmx_usb_complete(struct octeon_hcd *usb,
-			      struct cvmx_usb_pipe *pipe,
-			      struct cvmx_usb_transaction *transaction,
-			      enum cvmx_usb_status complete_code)
-{
-	/* If this was a split then clear our split in progress marker */
-	if (usb->active_split == transaction)
-		usb->active_split = NULL;
-
-	/*
-	 * Isochronous transactions need extra processing as they might not be
-	 * done after a single data transfer
-	 */
-	if (unlikely(transaction->type == CVMX_USB_TRANSFER_ISOCHRONOUS)) {
-		/* Update the number of bytes transferred in this ISO packet */
-		transaction->iso_packets[0].length = transaction->actual_bytes;
-		transaction->iso_packets[0].status = complete_code;
-
-		/*
-		 * If there are more ISOs pending and we succeeded, schedule the
-		 * next one
-		 */
-		if ((transaction->iso_number_packets > 1) &&
-		    (complete_code == CVMX_USB_STATUS_OK)) {
-			/* No bytes transferred for this packet as of yet */
-			transaction->actual_bytes = 0;
-			/* One less ISO waiting to transfer */
-			transaction->iso_number_packets--;
-			/* Increment to the next location in our packet array */
-			transaction->iso_packets++;
-			transaction->stage = CVMX_USB_STAGE_NON_CONTROL;
-			return;
-		}
-	}
-
-	/* Remove the transaction from the pipe list */
-	list_del(&transaction->node);
-	if (list_empty(&pipe->transactions))
-		list_move_tail(&pipe->node, &usb->idle_pipes);
-	octeon_usb_urb_complete_callback(usb, complete_code, pipe,
-					 transaction,
-					 transaction->actual_bytes,
-					 transaction->urb);
-	kfree(transaction);
-}
-
-/**
- * Submit a usb transaction to a pipe. Called for all types
- * of transactions.
- *
- * @usb:
- * @pipe:	    Which pipe to submit to.
- * @type:	    Transaction type
- * @buffer:	    User buffer for the transaction
- * @buffer_length:
- *		    User buffer's length in bytes
- * @control_header:
- *		    For control transactions, the 8 byte standard header
- * @iso_start_frame:
- *		    For ISO transactions, the start frame
- * @iso_number_packets:
- *		    For ISO, the number of packet in the transaction.
- * @iso_packets:
- *		    A description of each ISO packet
- * @urb:	    URB for the callback
- *
- * Returns: Transaction or NULL on failure.
- */
-static struct cvmx_usb_transaction *cvmx_usb_submit_transaction(
-				struct octeon_hcd *usb,
-				struct cvmx_usb_pipe *pipe,
-				enum cvmx_usb_transfer type,
-				u64 buffer,
-				int buffer_length,
-				u64 control_header,
-				int iso_start_frame,
-				int iso_number_packets,
-				struct cvmx_usb_iso_packet *iso_packets,
-				struct urb *urb)
-{
-	struct cvmx_usb_transaction *transaction;
-
-	if (unlikely(pipe->transfer_type != type))
-		return NULL;
-
-	transaction = kzalloc(sizeof(*transaction), GFP_ATOMIC);
-	if (unlikely(!transaction))
-		return NULL;
-
-	transaction->type = type;
-	transaction->buffer = buffer;
-	transaction->buffer_length = buffer_length;
-	transaction->control_header = control_header;
-	/* FIXME: This is not used, implement it. */
-	transaction->iso_start_frame = iso_start_frame;
-	transaction->iso_number_packets = iso_number_packets;
-	transaction->iso_packets = iso_packets;
-	transaction->urb = urb;
-	if (transaction->type == CVMX_USB_TRANSFER_CONTROL)
-		transaction->stage = CVMX_USB_STAGE_SETUP;
-	else
-		transaction->stage = CVMX_USB_STAGE_NON_CONTROL;
-
-	if (!list_empty(&pipe->transactions)) {
-		list_add_tail(&transaction->node, &pipe->transactions);
-	} else {
-		list_add_tail(&transaction->node, &pipe->transactions);
-		list_move_tail(&pipe->node,
-			       &usb->active_pipes[pipe->transfer_type]);
-
-		/*
-		 * We may need to schedule the pipe if this was the head of the
-		 * pipe.
-		 */
-		cvmx_usb_schedule(usb, 0);
-	}
-
-	return transaction;
-}
-
-/**
- * Call to submit a USB Bulk transfer to a pipe.
- *
- * @usb:	    USB device state populated by cvmx_usb_initialize().
- * @pipe:	    Handle to the pipe for the transfer.
- * @urb:	    URB.
- *
- * Returns: A submitted transaction or NULL on failure.
- */
-static struct cvmx_usb_transaction *cvmx_usb_submit_bulk(
-						struct octeon_hcd *usb,
-						struct cvmx_usb_pipe *pipe,
-						struct urb *urb)
-{
-	return cvmx_usb_submit_transaction(usb, pipe, CVMX_USB_TRANSFER_BULK,
-					   urb->transfer_dma,
-					   urb->transfer_buffer_length,
-					   0, /* control_header */
-					   0, /* iso_start_frame */
-					   0, /* iso_number_packets */
-					   NULL, /* iso_packets */
-					   urb);
-}
-
-/**
- * Call to submit a USB Interrupt transfer to a pipe.
- *
- * @usb:	    USB device state populated by cvmx_usb_initialize().
- * @pipe:	    Handle to the pipe for the transfer.
- * @urb:	    URB returned when the callback is called.
- *
- * Returns: A submitted transaction or NULL on failure.
- */
-static struct cvmx_usb_transaction *cvmx_usb_submit_interrupt(
-						struct octeon_hcd *usb,
-						struct cvmx_usb_pipe *pipe,
-						struct urb *urb)
-{
-	return cvmx_usb_submit_transaction(usb, pipe,
-					   CVMX_USB_TRANSFER_INTERRUPT,
-					   urb->transfer_dma,
-					   urb->transfer_buffer_length,
-					   0, /* control_header */
-					   0, /* iso_start_frame */
-					   0, /* iso_number_packets */
-					   NULL, /* iso_packets */
-					   urb);
-}
-
-/**
- * Call to submit a USB Control transfer to a pipe.
- *
- * @usb:	    USB device state populated by cvmx_usb_initialize().
- * @pipe:	    Handle to the pipe for the transfer.
- * @urb:	    URB.
- *
- * Returns: A submitted transaction or NULL on failure.
- */
-static struct cvmx_usb_transaction *cvmx_usb_submit_control(
-						struct octeon_hcd *usb,
-						struct cvmx_usb_pipe *pipe,
-						struct urb *urb)
-{
-	int buffer_length = urb->transfer_buffer_length;
-	u64 control_header = urb->setup_dma;
-	struct usb_ctrlrequest *header = cvmx_phys_to_ptr(control_header);
-
-	if ((header->bRequestType & USB_DIR_IN) == 0)
-		buffer_length = le16_to_cpu(header->wLength);
-
-	return cvmx_usb_submit_transaction(usb, pipe,
-					   CVMX_USB_TRANSFER_CONTROL,
-					   urb->transfer_dma, buffer_length,
-					   control_header,
-					   0, /* iso_start_frame */
-					   0, /* iso_number_packets */
-					   NULL, /* iso_packets */
-					   urb);
-}
-
-/**
- * Call to submit a USB Isochronous transfer to a pipe.
- *
- * @usb:	    USB device state populated by cvmx_usb_initialize().
- * @pipe:	    Handle to the pipe for the transfer.
- * @urb:	    URB returned when the callback is called.
- *
- * Returns: A submitted transaction or NULL on failure.
- */
-static struct cvmx_usb_transaction *cvmx_usb_submit_isochronous(
-						struct octeon_hcd *usb,
-						struct cvmx_usb_pipe *pipe,
-						struct urb *urb)
-{
-	struct cvmx_usb_iso_packet *packets;
-
-	packets = (struct cvmx_usb_iso_packet *)urb->setup_packet;
-	return cvmx_usb_submit_transaction(usb, pipe,
-					   CVMX_USB_TRANSFER_ISOCHRONOUS,
-					   urb->transfer_dma,
-					   urb->transfer_buffer_length,
-					   0, /* control_header */
-					   urb->start_frame,
-					   urb->number_of_packets,
-					   packets, urb);
-}
-
-/**
- * Cancel one outstanding request in a pipe. Canceling a request
- * can fail if the transaction has already completed before cancel
- * is called. Even after a successful cancel call, it may take
- * a frame or two for the cvmx_usb_poll() function to call the
- * associated callback.
- *
- * @usb:	 USB device state populated by cvmx_usb_initialize().
- * @pipe:	 Pipe to cancel requests in.
- * @transaction: Transaction to cancel, returned by the submit function.
- *
- * Returns: 0 or a negative error code.
- */
-static int cvmx_usb_cancel(struct octeon_hcd *usb,
-			   struct cvmx_usb_pipe *pipe,
-			   struct cvmx_usb_transaction *transaction)
-{
-	/*
-	 * If the transaction is the HEAD of the queue and scheduled. We need to
-	 * treat it special
-	 */
-	if (list_first_entry(&pipe->transactions, typeof(*transaction), node) ==
-	    transaction && (pipe->flags & CVMX_USB_PIPE_FLAGS_SCHEDULED)) {
-		union cvmx_usbcx_hccharx usbc_hcchar;
-
-		usb->pipe_for_channel[pipe->channel] = NULL;
-		pipe->flags &= ~CVMX_USB_PIPE_FLAGS_SCHEDULED;
-
-		CVMX_SYNCW;
-
-		usbc_hcchar.u32 = cvmx_usb_read_csr32(usb,
-				CVMX_USBCX_HCCHARX(pipe->channel, usb->index));
-		/*
-		 * If the channel isn't enabled then the transaction already
-		 * completed.
-		 */
-		if (usbc_hcchar.s.chena) {
-			usbc_hcchar.s.chdis = 1;
-			cvmx_usb_write_csr32(usb,
-					     CVMX_USBCX_HCCHARX(pipe->channel,
-								usb->index),
-					     usbc_hcchar.u32);
-		}
-	}
-	cvmx_usb_complete(usb, pipe, transaction, CVMX_USB_STATUS_CANCEL);
-	return 0;
-}
-
-/**
- * Cancel all outstanding requests in a pipe. Logically all this
- * does is call cvmx_usb_cancel() in a loop.
- *
- * @usb:	 USB device state populated by cvmx_usb_initialize().
- * @pipe:	 Pipe to cancel requests in.
- *
- * Returns: 0 or a negative error code.
- */
-static int cvmx_usb_cancel_all(struct octeon_hcd *usb,
-			       struct cvmx_usb_pipe *pipe)
-{
-	struct cvmx_usb_transaction *transaction, *next;
-
-	/* Simply loop through and attempt to cancel each transaction */
-	list_for_each_entry_safe(transaction, next, &pipe->transactions, node) {
-		int result = cvmx_usb_cancel(usb, pipe, transaction);
-
-		if (unlikely(result != 0))
-			return result;
-	}
-	return 0;
-}
-
-/**
- * Close a pipe created with cvmx_usb_open_pipe().
- *
- * @usb:	 USB device state populated by cvmx_usb_initialize().
- * @pipe:	 Pipe to close.
- *
- * Returns: 0 or a negative error code. EBUSY is returned if the pipe has
- *	    outstanding transfers.
- */
-static int cvmx_usb_close_pipe(struct octeon_hcd *usb,
-			       struct cvmx_usb_pipe *pipe)
-{
-	/* Fail if the pipe has pending transactions */
-	if (!list_empty(&pipe->transactions))
-		return -EBUSY;
-
-	list_del(&pipe->node);
-	kfree(pipe);
-
-	return 0;
-}
-
-/**
- * Get the current USB protocol level frame number. The frame
- * number is always in the range of 0-0x7ff.
- *
- * @usb: USB device state populated by cvmx_usb_initialize().
- *
- * Returns: USB frame number
- */
-static int cvmx_usb_get_frame_number(struct octeon_hcd *usb)
-{
-	union cvmx_usbcx_hfnum usbc_hfnum;
-
-	usbc_hfnum.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HFNUM(usb->index));
-
-	return usbc_hfnum.s.frnum;
-}
-
-static void cvmx_usb_transfer_control(struct octeon_hcd *usb,
-				      struct cvmx_usb_pipe *pipe,
-				      struct cvmx_usb_transaction *transaction,
-				      union cvmx_usbcx_hccharx usbc_hcchar,
-				      int buffer_space_left,
-				      int bytes_in_last_packet)
-{
-	switch (transaction->stage) {
-	case CVMX_USB_STAGE_NON_CONTROL:
-	case CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE:
-		/* This should be impossible */
-		cvmx_usb_complete(usb, pipe, transaction,
-				  CVMX_USB_STATUS_ERROR);
-		break;
-	case CVMX_USB_STAGE_SETUP:
-		pipe->pid_toggle = 1;
-		if (cvmx_usb_pipe_needs_split(usb, pipe)) {
-			transaction->stage =
-				CVMX_USB_STAGE_SETUP_SPLIT_COMPLETE;
-		} else {
-			struct usb_ctrlrequest *header =
-				cvmx_phys_to_ptr(transaction->control_header);
-			if (header->wLength)
-				transaction->stage = CVMX_USB_STAGE_DATA;
-			else
-				transaction->stage = CVMX_USB_STAGE_STATUS;
-		}
-		break;
-	case CVMX_USB_STAGE_SETUP_SPLIT_COMPLETE:
-		{
-			struct usb_ctrlrequest *header =
-				cvmx_phys_to_ptr(transaction->control_header);
-			if (header->wLength)
-				transaction->stage = CVMX_USB_STAGE_DATA;
-			else
-				transaction->stage = CVMX_USB_STAGE_STATUS;
-		}
-		break;
-	case CVMX_USB_STAGE_DATA:
-		if (cvmx_usb_pipe_needs_split(usb, pipe)) {
-			transaction->stage = CVMX_USB_STAGE_DATA_SPLIT_COMPLETE;
-			/*
-			 * For setup OUT data that are splits,
-			 * the hardware doesn't appear to count
-			 * transferred data. Here we manually
-			 * update the data transferred
-			 */
-			if (!usbc_hcchar.s.epdir) {
-				if (buffer_space_left < pipe->max_packet)
-					transaction->actual_bytes +=
-						buffer_space_left;
-				else
-					transaction->actual_bytes +=
-						pipe->max_packet;
-			}
-		} else if ((buffer_space_left == 0) ||
-			   (bytes_in_last_packet < pipe->max_packet)) {
-			pipe->pid_toggle = 1;
-			transaction->stage = CVMX_USB_STAGE_STATUS;
-		}
-		break;
-	case CVMX_USB_STAGE_DATA_SPLIT_COMPLETE:
-		if ((buffer_space_left == 0) ||
-		    (bytes_in_last_packet < pipe->max_packet)) {
-			pipe->pid_toggle = 1;
-			transaction->stage = CVMX_USB_STAGE_STATUS;
-		} else {
-			transaction->stage = CVMX_USB_STAGE_DATA;
-		}
-		break;
-	case CVMX_USB_STAGE_STATUS:
-		if (cvmx_usb_pipe_needs_split(usb, pipe))
-			transaction->stage =
-				CVMX_USB_STAGE_STATUS_SPLIT_COMPLETE;
-		else
-			cvmx_usb_complete(usb, pipe, transaction,
-					  CVMX_USB_STATUS_OK);
-		break;
-	case CVMX_USB_STAGE_STATUS_SPLIT_COMPLETE:
-		cvmx_usb_complete(usb, pipe, transaction, CVMX_USB_STATUS_OK);
-		break;
-	}
-}
-
-static void cvmx_usb_transfer_bulk(struct octeon_hcd *usb,
-				   struct cvmx_usb_pipe *pipe,
-				   struct cvmx_usb_transaction *transaction,
-				   union cvmx_usbcx_hcintx usbc_hcint,
-				   int buffer_space_left,
-				   int bytes_in_last_packet)
-{
-	/*
-	 * The only time a bulk transfer isn't complete when it finishes with
-	 * an ACK is during a split transaction. For splits we need to continue
-	 * the transfer if more data is needed.
-	 */
-	if (cvmx_usb_pipe_needs_split(usb, pipe)) {
-		if (transaction->stage == CVMX_USB_STAGE_NON_CONTROL)
-			transaction->stage =
-				CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE;
-		else if (buffer_space_left &&
-			 (bytes_in_last_packet == pipe->max_packet))
-			transaction->stage = CVMX_USB_STAGE_NON_CONTROL;
-		else
-			cvmx_usb_complete(usb, pipe, transaction,
-					  CVMX_USB_STATUS_OK);
-	} else {
-		if ((pipe->device_speed == CVMX_USB_SPEED_HIGH) &&
-		    (pipe->transfer_dir == CVMX_USB_DIRECTION_OUT) &&
-		    (usbc_hcint.s.nak))
-			pipe->flags |= CVMX_USB_PIPE_FLAGS_NEED_PING;
-		if (!buffer_space_left ||
-		    (bytes_in_last_packet < pipe->max_packet))
-			cvmx_usb_complete(usb, pipe, transaction,
-					  CVMX_USB_STATUS_OK);
-	}
-}
-
-static void cvmx_usb_transfer_intr(struct octeon_hcd *usb,
-				   struct cvmx_usb_pipe *pipe,
-				   struct cvmx_usb_transaction *transaction,
-				   int buffer_space_left,
-				   int bytes_in_last_packet)
-{
-	if (cvmx_usb_pipe_needs_split(usb, pipe)) {
-		if (transaction->stage == CVMX_USB_STAGE_NON_CONTROL) {
-			transaction->stage =
-				CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE;
-		} else if (buffer_space_left &&
-			   (bytes_in_last_packet == pipe->max_packet)) {
-			transaction->stage = CVMX_USB_STAGE_NON_CONTROL;
-		} else {
-			pipe->next_tx_frame += pipe->interval;
-			cvmx_usb_complete(usb, pipe, transaction,
-					  CVMX_USB_STATUS_OK);
-		}
-	} else if (!buffer_space_left ||
-		   (bytes_in_last_packet < pipe->max_packet)) {
-		pipe->next_tx_frame += pipe->interval;
-		cvmx_usb_complete(usb, pipe, transaction, CVMX_USB_STATUS_OK);
-	}
-}
-
-static void cvmx_usb_transfer_isoc(struct octeon_hcd *usb,
-				   struct cvmx_usb_pipe *pipe,
-				   struct cvmx_usb_transaction *transaction,
-				   int buffer_space_left,
-				   int bytes_in_last_packet,
-				   int bytes_this_transfer)
-{
-	if (cvmx_usb_pipe_needs_split(usb, pipe)) {
-		/*
-		 * ISOCHRONOUS OUT splits don't require a complete split stage.
-		 * Instead they use a sequence of begin OUT splits to transfer
-		 * the data 188 bytes at a time. Once the transfer is complete,
-		 * the pipe sleeps until the next schedule interval.
-		 */
-		if (pipe->transfer_dir == CVMX_USB_DIRECTION_OUT) {
-			/*
-			 * If no space left or this wasn't a max size packet
-			 * then this transfer is complete. Otherwise start it
-			 * again to send the next 188 bytes
-			 */
-			if (!buffer_space_left || (bytes_this_transfer < 188)) {
-				pipe->next_tx_frame += pipe->interval;
-				cvmx_usb_complete(usb, pipe, transaction,
-						  CVMX_USB_STATUS_OK);
-			}
-			return;
-		}
-		if (transaction->stage ==
-		    CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE) {
-			/*
-			 * We are in the incoming data phase. Keep getting data
-			 * until we run out of space or get a small packet
-			 */
-			if ((buffer_space_left == 0) ||
-			    (bytes_in_last_packet < pipe->max_packet)) {
-				pipe->next_tx_frame += pipe->interval;
-				cvmx_usb_complete(usb, pipe, transaction,
-						  CVMX_USB_STATUS_OK);
-			}
-		} else {
-			transaction->stage =
-				CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE;
-		}
-	} else {
-		pipe->next_tx_frame += pipe->interval;
-		cvmx_usb_complete(usb, pipe, transaction, CVMX_USB_STATUS_OK);
-	}
-}
-
-/**
- * Poll a channel for status
- *
- * @usb:     USB device
- * @channel: Channel to poll
- *
- * Returns: Zero on success
- */
-static int cvmx_usb_poll_channel(struct octeon_hcd *usb, int channel)
-{
-	struct usb_hcd *hcd = octeon_to_hcd(usb);
-	struct device *dev = hcd->self.controller;
-	union cvmx_usbcx_hcintx usbc_hcint;
-	union cvmx_usbcx_hctsizx usbc_hctsiz;
-	union cvmx_usbcx_hccharx usbc_hcchar;
-	struct cvmx_usb_pipe *pipe;
-	struct cvmx_usb_transaction *transaction;
-	int bytes_this_transfer;
-	int bytes_in_last_packet;
-	int packets_processed;
-	int buffer_space_left;
-
-	/* Read the interrupt status bits for the channel */
-	usbc_hcint.u32 = cvmx_usb_read_csr32(usb,
-				CVMX_USBCX_HCINTX(channel, usb->index));
-
-	if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA) {
-		usbc_hcchar.u32 = cvmx_usb_read_csr32(usb,
-				CVMX_USBCX_HCCHARX(channel, usb->index));
-
-		if (usbc_hcchar.s.chena && usbc_hcchar.s.chdis) {
-			/*
-			 * There seems to be a bug in CN31XX which can cause
-			 * interrupt IN transfers to get stuck until we do a
-			 * write of HCCHARX without changing things
-			 */
-			cvmx_usb_write_csr32(usb,
-					     CVMX_USBCX_HCCHARX(channel,
-								usb->index),
-					     usbc_hcchar.u32);
-			return 0;
-		}
-
-		/*
-		 * In non DMA mode the channels don't halt themselves. We need
-		 * to manually disable channels that are left running
-		 */
-		if (!usbc_hcint.s.chhltd) {
-			if (usbc_hcchar.s.chena) {
-				union cvmx_usbcx_hcintmskx hcintmsk;
-				/* Disable all interrupts except CHHLTD */
-				hcintmsk.u32 = 0;
-				hcintmsk.s.chhltdmsk = 1;
-				cvmx_usb_write_csr32(usb,
-						     CVMX_USBCX_HCINTMSKX(channel, usb->index),
-						     hcintmsk.u32);
-				usbc_hcchar.s.chdis = 1;
-				cvmx_usb_write_csr32(usb,
-						     CVMX_USBCX_HCCHARX(channel, usb->index),
-						     usbc_hcchar.u32);
-				return 0;
-			} else if (usbc_hcint.s.xfercompl) {
-				/*
-				 * Successful IN/OUT with transfer complete.
-				 * Channel halt isn't needed.
-				 */
-			} else {
-				dev_err(dev, "USB%d: Channel %d interrupt without halt\n",
-					usb->index, channel);
-				return 0;
-			}
-		}
-	} else {
-		/*
-		 * There is are no interrupts that we need to process when the
-		 * channel is still running
-		 */
-		if (!usbc_hcint.s.chhltd)
-			return 0;
-	}
-
-	/* Disable the channel interrupts now that it is done */
-	cvmx_usb_write_csr32(usb, CVMX_USBCX_HCINTMSKX(channel, usb->index), 0);
-	usb->idle_hardware_channels |= (1 << channel);
-
-	/* Make sure this channel is tied to a valid pipe */
-	pipe = usb->pipe_for_channel[channel];
-	prefetch(pipe);
-	if (!pipe)
-		return 0;
-	transaction = list_first_entry(&pipe->transactions,
-				       typeof(*transaction),
-				       node);
-	prefetch(transaction);
-
-	/*
-	 * Disconnect this pipe from the HW channel. Later the schedule
-	 * function will figure out which pipe needs to go
-	 */
-	usb->pipe_for_channel[channel] = NULL;
-	pipe->flags &= ~CVMX_USB_PIPE_FLAGS_SCHEDULED;
-
-	/*
-	 * Read the channel config info so we can figure out how much data
-	 * transferred
-	 */
-	usbc_hcchar.u32 = cvmx_usb_read_csr32(usb,
-			CVMX_USBCX_HCCHARX(channel, usb->index));
-	usbc_hctsiz.u32 = cvmx_usb_read_csr32(usb,
-			CVMX_USBCX_HCTSIZX(channel, usb->index));
-
-	/*
-	 * Calculating the number of bytes successfully transferred is dependent
-	 * on the transfer direction
-	 */
-	packets_processed = transaction->pktcnt - usbc_hctsiz.s.pktcnt;
-	if (usbc_hcchar.s.epdir) {
-		/*
-		 * IN transactions are easy. For every byte received the
-		 * hardware decrements xfersize. All we need to do is subtract
-		 * the current value of xfersize from its starting value and we
-		 * know how many bytes were written to the buffer
-		 */
-		bytes_this_transfer = transaction->xfersize -
-			usbc_hctsiz.s.xfersize;
-	} else {
-		/*
-		 * OUT transaction don't decrement xfersize. Instead pktcnt is
-		 * decremented on every successful packet send. The hardware
-		 * does this when it receives an ACK, or NYET. If it doesn't
-		 * receive one of these responses pktcnt doesn't change
-		 */
-		bytes_this_transfer = packets_processed * usbc_hcchar.s.mps;
-		/*
-		 * The last packet may not be a full transfer if we didn't have
-		 * enough data
-		 */
-		if (bytes_this_transfer > transaction->xfersize)
-			bytes_this_transfer = transaction->xfersize;
-	}
-	/* Figure out how many bytes were in the last packet of the transfer */
-	if (packets_processed)
-		bytes_in_last_packet = bytes_this_transfer -
-			(packets_processed - 1) * usbc_hcchar.s.mps;
-	else
-		bytes_in_last_packet = bytes_this_transfer;
-
-	/*
-	 * As a special case, setup transactions output the setup header, not
-	 * the user's data. For this reason we don't count setup data as bytes
-	 * transferred
-	 */
-	if ((transaction->stage == CVMX_USB_STAGE_SETUP) ||
-	    (transaction->stage == CVMX_USB_STAGE_SETUP_SPLIT_COMPLETE))
-		bytes_this_transfer = 0;
-
-	/*
-	 * Add the bytes transferred to the running total. It is important that
-	 * bytes_this_transfer doesn't count any data that needs to be
-	 * retransmitted
-	 */
-	transaction->actual_bytes += bytes_this_transfer;
-	if (transaction->type == CVMX_USB_TRANSFER_ISOCHRONOUS)
-		buffer_space_left = transaction->iso_packets[0].length -
-			transaction->actual_bytes;
-	else
-		buffer_space_left = transaction->buffer_length -
-			transaction->actual_bytes;
-
-	/*
-	 * We need to remember the PID toggle state for the next transaction.
-	 * The hardware already updated it for the next transaction
-	 */
-	pipe->pid_toggle = !(usbc_hctsiz.s.pid == 0);
-
-	/*
-	 * For high speed bulk out, assume the next transaction will need to do
-	 * a ping before proceeding. If this isn't true the ACK processing below
-	 * will clear this flag
-	 */
-	if ((pipe->device_speed == CVMX_USB_SPEED_HIGH) &&
-	    (pipe->transfer_type == CVMX_USB_TRANSFER_BULK) &&
-	    (pipe->transfer_dir == CVMX_USB_DIRECTION_OUT))
-		pipe->flags |= CVMX_USB_PIPE_FLAGS_NEED_PING;
-
-	if (WARN_ON_ONCE(bytes_this_transfer < 0)) {
-		/*
-		 * In some rare cases the DMA engine seems to get stuck and
-		 * keeps substracting same byte count over and over again. In
-		 * such case we just need to fail every transaction.
-		 */
-		cvmx_usb_complete(usb, pipe, transaction,
-				  CVMX_USB_STATUS_ERROR);
-		return 0;
-	}
-
-	if (usbc_hcint.s.stall) {
-		/*
-		 * STALL as a response means this transaction cannot be
-		 * completed because the device can't process transactions. Tell
-		 * the user. Any data that was transferred will be counted on
-		 * the actual bytes transferred
-		 */
-		pipe->pid_toggle = 0;
-		cvmx_usb_complete(usb, pipe, transaction,
-				  CVMX_USB_STATUS_STALL);
-	} else if (usbc_hcint.s.xacterr) {
-		/*
-		 * XactErr as a response means the device signaled
-		 * something wrong with the transfer. For example, PID
-		 * toggle errors cause these.
-		 */
-		cvmx_usb_complete(usb, pipe, transaction,
-				  CVMX_USB_STATUS_XACTERR);
-	} else if (usbc_hcint.s.bblerr) {
-		/* Babble Error (BblErr) */
-		cvmx_usb_complete(usb, pipe, transaction,
-				  CVMX_USB_STATUS_BABBLEERR);
-	} else if (usbc_hcint.s.datatglerr) {
-		/* Data toggle error */
-		cvmx_usb_complete(usb, pipe, transaction,
-				  CVMX_USB_STATUS_DATATGLERR);
-	} else if (usbc_hcint.s.nyet) {
-		/*
-		 * NYET as a response is only allowed in three cases: as a
-		 * response to a ping, as a response to a split transaction, and
-		 * as a response to a bulk out. The ping case is handled by
-		 * hardware, so we only have splits and bulk out
-		 */
-		if (!cvmx_usb_pipe_needs_split(usb, pipe)) {
-			transaction->retries = 0;
-			/*
-			 * If there is more data to go then we need to try
-			 * again. Otherwise this transaction is complete
-			 */
-			if ((buffer_space_left == 0) ||
-			    (bytes_in_last_packet < pipe->max_packet))
-				cvmx_usb_complete(usb, pipe,
-						  transaction,
-						  CVMX_USB_STATUS_OK);
-		} else {
-			/*
-			 * Split transactions retry the split complete 4 times
-			 * then rewind to the start split and do the entire
-			 * transactions again
-			 */
-			transaction->retries++;
-			if ((transaction->retries & 0x3) == 0) {
-				/*
-				 * Rewind to the beginning of the transaction by
-				 * anding off the split complete bit
-				 */
-				transaction->stage &= ~1;
-				pipe->split_sc_frame = -1;
-			}
-		}
-	} else if (usbc_hcint.s.ack) {
-		transaction->retries = 0;
-		/*
-		 * The ACK bit can only be checked after the other error bits.
-		 * This is because a multi packet transfer may succeed in a
-		 * number of packets and then get a different response on the
-		 * last packet. In this case both ACK and the last response bit
-		 * will be set. If none of the other response bits is set, then
-		 * the last packet must have been an ACK
-		 *
-		 * Since we got an ACK, we know we don't need to do a ping on
-		 * this pipe
-		 */
-		pipe->flags &= ~CVMX_USB_PIPE_FLAGS_NEED_PING;
-
-		switch (transaction->type) {
-		case CVMX_USB_TRANSFER_CONTROL:
-			cvmx_usb_transfer_control(usb, pipe, transaction,
-						  usbc_hcchar,
-						  buffer_space_left,
-						  bytes_in_last_packet);
-			break;
-		case CVMX_USB_TRANSFER_BULK:
-			cvmx_usb_transfer_bulk(usb, pipe, transaction,
-					       usbc_hcint, buffer_space_left,
-					       bytes_in_last_packet);
-			break;
-		case CVMX_USB_TRANSFER_INTERRUPT:
-			cvmx_usb_transfer_intr(usb, pipe, transaction,
-					       buffer_space_left,
-					       bytes_in_last_packet);
-			break;
-		case CVMX_USB_TRANSFER_ISOCHRONOUS:
-			cvmx_usb_transfer_isoc(usb, pipe, transaction,
-					       buffer_space_left,
-					       bytes_in_last_packet,
-					       bytes_this_transfer);
-			break;
-		}
-	} else if (usbc_hcint.s.nak) {
-		/*
-		 * If this was a split then clear our split in progress marker.
-		 */
-		if (usb->active_split == transaction)
-			usb->active_split = NULL;
-		/*
-		 * NAK as a response means the device couldn't accept the
-		 * transaction, but it should be retried in the future. Rewind
-		 * to the beginning of the transaction by anding off the split
-		 * complete bit. Retry in the next interval
-		 */
-		transaction->retries = 0;
-		transaction->stage &= ~1;
-		pipe->next_tx_frame += pipe->interval;
-		if (pipe->next_tx_frame < usb->frame_number)
-			pipe->next_tx_frame = usb->frame_number +
-				pipe->interval -
-				(usb->frame_number - pipe->next_tx_frame) %
-				pipe->interval;
-	} else {
-		struct cvmx_usb_port_status port;
-
-		port = cvmx_usb_get_status(usb);
-		if (port.port_enabled) {
-			/* We'll retry the exact same transaction again */
-			transaction->retries++;
-		} else {
-			/*
-			 * We get channel halted interrupts with no result bits
-			 * sets when the cable is unplugged
-			 */
-			cvmx_usb_complete(usb, pipe, transaction,
-					  CVMX_USB_STATUS_ERROR);
-		}
-	}
-	return 0;
-}
-
-static void octeon_usb_port_callback(struct octeon_hcd *usb)
-{
-	spin_unlock(&usb->lock);
-	usb_hcd_poll_rh_status(octeon_to_hcd(usb));
-	spin_lock(&usb->lock);
-}
-
-/**
- * Poll the USB block for status and call all needed callback
- * handlers. This function is meant to be called in the interrupt
- * handler for the USB controller. It can also be called
- * periodically in a loop for non-interrupt based operation.
- *
- * @usb: USB device state populated by cvmx_usb_initialize().
- *
- * Returns: 0 or a negative error code.
- */
-static int cvmx_usb_poll(struct octeon_hcd *usb)
-{
-	union cvmx_usbcx_hfnum usbc_hfnum;
-	union cvmx_usbcx_gintsts usbc_gintsts;
-
-	prefetch_range(usb, sizeof(*usb));
-
-	/* Update the frame counter */
-	usbc_hfnum.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HFNUM(usb->index));
-	if ((usb->frame_number & 0x3fff) > usbc_hfnum.s.frnum)
-		usb->frame_number += 0x4000;
-	usb->frame_number &= ~0x3fffull;
-	usb->frame_number |= usbc_hfnum.s.frnum;
-
-	/* Read the pending interrupts */
-	usbc_gintsts.u32 = cvmx_usb_read_csr32(usb,
-					       CVMX_USBCX_GINTSTS(usb->index));
-
-	/* Clear the interrupts now that we know about them */
-	cvmx_usb_write_csr32(usb, CVMX_USBCX_GINTSTS(usb->index),
-			     usbc_gintsts.u32);
-
-	if (usbc_gintsts.s.rxflvl) {
-		/*
-		 * RxFIFO Non-Empty (RxFLvl)
-		 * Indicates that there is at least one packet pending to be
-		 * read from the RxFIFO.
-		 *
-		 * In DMA mode this is handled by hardware
-		 */
-		if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA)
-			cvmx_usb_poll_rx_fifo(usb);
-	}
-	if (usbc_gintsts.s.ptxfemp || usbc_gintsts.s.nptxfemp) {
-		/* Fill the Tx FIFOs when not in DMA mode */
-		if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA)
-			cvmx_usb_poll_tx_fifo(usb);
-	}
-	if (usbc_gintsts.s.disconnint || usbc_gintsts.s.prtint) {
-		union cvmx_usbcx_hprt usbc_hprt;
-		/*
-		 * Disconnect Detected Interrupt (DisconnInt)
-		 * Asserted when a device disconnect is detected.
-		 *
-		 * Host Port Interrupt (PrtInt)
-		 * The core sets this bit to indicate a change in port status of
-		 * one of the O2P USB core ports in Host mode. The application
-		 * must read the Host Port Control and Status (HPRT) register to
-		 * determine the exact event that caused this interrupt. The
-		 * application must clear the appropriate status bit in the Host
-		 * Port Control and Status register to clear this bit.
-		 *
-		 * Call the user's port callback
-		 */
-		octeon_usb_port_callback(usb);
-		/* Clear the port change bits */
-		usbc_hprt.u32 =
-			cvmx_usb_read_csr32(usb, CVMX_USBCX_HPRT(usb->index));
-		usbc_hprt.s.prtena = 0;
-		cvmx_usb_write_csr32(usb, CVMX_USBCX_HPRT(usb->index),
-				     usbc_hprt.u32);
-	}
-	if (usbc_gintsts.s.hchint) {
-		/*
-		 * Host Channels Interrupt (HChInt)
-		 * The core sets this bit to indicate that an interrupt is
-		 * pending on one of the channels of the core (in Host mode).
-		 * The application must read the Host All Channels Interrupt
-		 * (HAINT) register to determine the exact number of the channel
-		 * on which the interrupt occurred, and then read the
-		 * corresponding Host Channel-n Interrupt (HCINTn) register to
-		 * determine the exact cause of the interrupt. The application
-		 * must clear the appropriate status bit in the HCINTn register
-		 * to clear this bit.
-		 */
-		union cvmx_usbcx_haint usbc_haint;
-
-		usbc_haint.u32 = cvmx_usb_read_csr32(usb,
-					CVMX_USBCX_HAINT(usb->index));
-		while (usbc_haint.u32) {
-			int channel;
-
-			channel = __fls(usbc_haint.u32);
-			cvmx_usb_poll_channel(usb, channel);
-			usbc_haint.u32 ^= 1 << channel;
-		}
-	}
-
-	cvmx_usb_schedule(usb, usbc_gintsts.s.sof);
-
-	return 0;
-}
-
-/* convert between an HCD pointer and the corresponding struct octeon_hcd */
-static inline struct octeon_hcd *hcd_to_octeon(struct usb_hcd *hcd)
-{
-	return (struct octeon_hcd *)(hcd->hcd_priv);
-}
-
-static irqreturn_t octeon_usb_irq(struct usb_hcd *hcd)
-{
-	struct octeon_hcd *usb = hcd_to_octeon(hcd);
-	unsigned long flags;
-
-	spin_lock_irqsave(&usb->lock, flags);
-	cvmx_usb_poll(usb);
-	spin_unlock_irqrestore(&usb->lock, flags);
-	return IRQ_HANDLED;
-}
-
-static int octeon_usb_start(struct usb_hcd *hcd)
-{
-	hcd->state = HC_STATE_RUNNING;
-	return 0;
-}
-
-static void octeon_usb_stop(struct usb_hcd *hcd)
-{
-	hcd->state = HC_STATE_HALT;
-}
-
-static int octeon_usb_get_frame_number(struct usb_hcd *hcd)
-{
-	struct octeon_hcd *usb = hcd_to_octeon(hcd);
-
-	return cvmx_usb_get_frame_number(usb);
-}
-
-static int octeon_usb_urb_enqueue(struct usb_hcd *hcd,
-				  struct urb *urb,
-				  gfp_t mem_flags)
-{
-	struct octeon_hcd *usb = hcd_to_octeon(hcd);
-	struct device *dev = hcd->self.controller;
-	struct cvmx_usb_transaction *transaction = NULL;
-	struct cvmx_usb_pipe *pipe;
-	unsigned long flags;
-	struct cvmx_usb_iso_packet *iso_packet;
-	struct usb_host_endpoint *ep = urb->ep;
-	int rc;
-
-	urb->status = 0;
-	spin_lock_irqsave(&usb->lock, flags);
-
-	rc = usb_hcd_link_urb_to_ep(hcd, urb);
-	if (rc) {
-		spin_unlock_irqrestore(&usb->lock, flags);
-		return rc;
-	}
-
-	if (!ep->hcpriv) {
-		enum cvmx_usb_transfer transfer_type;
-		enum cvmx_usb_speed speed;
-		int split_device = 0;
-		int split_port = 0;
-
-		switch (usb_pipetype(urb->pipe)) {
-		case PIPE_ISOCHRONOUS:
-			transfer_type = CVMX_USB_TRANSFER_ISOCHRONOUS;
-			break;
-		case PIPE_INTERRUPT:
-			transfer_type = CVMX_USB_TRANSFER_INTERRUPT;
-			break;
-		case PIPE_CONTROL:
-			transfer_type = CVMX_USB_TRANSFER_CONTROL;
-			break;
-		default:
-			transfer_type = CVMX_USB_TRANSFER_BULK;
-			break;
-		}
-		switch (urb->dev->speed) {
-		case USB_SPEED_LOW:
-			speed = CVMX_USB_SPEED_LOW;
-			break;
-		case USB_SPEED_FULL:
-			speed = CVMX_USB_SPEED_FULL;
-			break;
-		default:
-			speed = CVMX_USB_SPEED_HIGH;
-			break;
-		}
-		/*
-		 * For slow devices on high speed ports we need to find the hub
-		 * that does the speed translation so we know where to send the
-		 * split transactions.
-		 */
-		if (speed != CVMX_USB_SPEED_HIGH) {
-			/*
-			 * Start at this device and work our way up the usb
-			 * tree.
-			 */
-			struct usb_device *dev = urb->dev;
-
-			while (dev->parent) {
-				/*
-				 * If our parent is high speed then he'll
-				 * receive the splits.
-				 */
-				if (dev->parent->speed == USB_SPEED_HIGH) {
-					split_device = dev->parent->devnum;
-					split_port = dev->portnum;
-					break;
-				}
-				/*
-				 * Move up the tree one level. If we make it all
-				 * the way up the tree, then the port must not
-				 * be in high speed mode and we don't need a
-				 * split.
-				 */
-				dev = dev->parent;
-			}
-		}
-		pipe = cvmx_usb_open_pipe(usb, usb_pipedevice(urb->pipe),
-					  usb_pipeendpoint(urb->pipe), speed,
-					  le16_to_cpu(ep->desc.wMaxPacketSize)
-					  & 0x7ff,
-					  transfer_type,
-					  usb_pipein(urb->pipe) ?
-						CVMX_USB_DIRECTION_IN :
-						CVMX_USB_DIRECTION_OUT,
-					  urb->interval,
-					  (le16_to_cpu(ep->desc.wMaxPacketSize)
-					   >> 11) & 0x3,
-					  split_device, split_port);
-		if (!pipe) {
-			usb_hcd_unlink_urb_from_ep(hcd, urb);
-			spin_unlock_irqrestore(&usb->lock, flags);
-			dev_dbg(dev, "Failed to create pipe\n");
-			return -ENOMEM;
-		}
-		ep->hcpriv = pipe;
-	} else {
-		pipe = ep->hcpriv;
-	}
-
-	switch (usb_pipetype(urb->pipe)) {
-	case PIPE_ISOCHRONOUS:
-		dev_dbg(dev, "Submit isochronous to %d.%d\n",
-			usb_pipedevice(urb->pipe),
-			usb_pipeendpoint(urb->pipe));
-		/*
-		 * Allocate a structure to use for our private list of
-		 * isochronous packets.
-		 */
-		iso_packet = kmalloc_array(urb->number_of_packets,
-					   sizeof(struct cvmx_usb_iso_packet),
-					   GFP_ATOMIC);
-		if (iso_packet) {
-			int i;
-			/* Fill the list with the data from the URB */
-			for (i = 0; i < urb->number_of_packets; i++) {
-				iso_packet[i].offset =
-					urb->iso_frame_desc[i].offset;
-				iso_packet[i].length =
-					urb->iso_frame_desc[i].length;
-				iso_packet[i].status = CVMX_USB_STATUS_ERROR;
-			}
-			/*
-			 * Store a pointer to the list in the URB setup_packet
-			 * field. We know this currently isn't being used and
-			 * this saves us a bunch of logic.
-			 */
-			urb->setup_packet = (char *)iso_packet;
-			transaction = cvmx_usb_submit_isochronous(usb,
-								  pipe, urb);
-			/*
-			 * If submit failed we need to free our private packet
-			 * list.
-			 */
-			if (!transaction) {
-				urb->setup_packet = NULL;
-				kfree(iso_packet);
-			}
-		}
-		break;
-	case PIPE_INTERRUPT:
-		dev_dbg(dev, "Submit interrupt to %d.%d\n",
-			usb_pipedevice(urb->pipe),
-			usb_pipeendpoint(urb->pipe));
-		transaction = cvmx_usb_submit_interrupt(usb, pipe, urb);
-		break;
-	case PIPE_CONTROL:
-		dev_dbg(dev, "Submit control to %d.%d\n",
-			usb_pipedevice(urb->pipe),
-			usb_pipeendpoint(urb->pipe));
-		transaction = cvmx_usb_submit_control(usb, pipe, urb);
-		break;
-	case PIPE_BULK:
-		dev_dbg(dev, "Submit bulk to %d.%d\n",
-			usb_pipedevice(urb->pipe),
-			usb_pipeendpoint(urb->pipe));
-		transaction = cvmx_usb_submit_bulk(usb, pipe, urb);
-		break;
-	}
-	if (!transaction) {
-		usb_hcd_unlink_urb_from_ep(hcd, urb);
-		spin_unlock_irqrestore(&usb->lock, flags);
-		dev_dbg(dev, "Failed to submit\n");
-		return -ENOMEM;
-	}
-	urb->hcpriv = transaction;
-	spin_unlock_irqrestore(&usb->lock, flags);
-	return 0;
-}
-
-static int octeon_usb_urb_dequeue(struct usb_hcd *hcd,
-				  struct urb *urb,
-				  int status)
-{
-	struct octeon_hcd *usb = hcd_to_octeon(hcd);
-	unsigned long flags;
-	int rc;
-
-	if (!urb->dev)
-		return -EINVAL;
-
-	spin_lock_irqsave(&usb->lock, flags);
-
-	rc = usb_hcd_check_unlink_urb(hcd, urb, status);
-	if (rc)
-		goto out;
-
-	urb->status = status;
-	cvmx_usb_cancel(usb, urb->ep->hcpriv, urb->hcpriv);
-
-out:
-	spin_unlock_irqrestore(&usb->lock, flags);
-
-	return rc;
-}
-
-static void octeon_usb_endpoint_disable(struct usb_hcd *hcd,
-					struct usb_host_endpoint *ep)
-{
-	struct device *dev = hcd->self.controller;
-
-	if (ep->hcpriv) {
-		struct octeon_hcd *usb = hcd_to_octeon(hcd);
-		struct cvmx_usb_pipe *pipe = ep->hcpriv;
-		unsigned long flags;
-
-		spin_lock_irqsave(&usb->lock, flags);
-		cvmx_usb_cancel_all(usb, pipe);
-		if (cvmx_usb_close_pipe(usb, pipe))
-			dev_dbg(dev, "Closing pipe %p failed\n", pipe);
-		spin_unlock_irqrestore(&usb->lock, flags);
-		ep->hcpriv = NULL;
-	}
-}
-
-static int octeon_usb_hub_status_data(struct usb_hcd *hcd, char *buf)
-{
-	struct octeon_hcd *usb = hcd_to_octeon(hcd);
-	struct cvmx_usb_port_status port_status;
-	unsigned long flags;
-
-	spin_lock_irqsave(&usb->lock, flags);
-	port_status = cvmx_usb_get_status(usb);
-	spin_unlock_irqrestore(&usb->lock, flags);
-	buf[0] = port_status.connect_change << 1;
-
-	return buf[0] != 0;
-}
-
-static int octeon_usb_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
-				  u16 wIndex, char *buf, u16 wLength)
-{
-	struct octeon_hcd *usb = hcd_to_octeon(hcd);
-	struct device *dev = hcd->self.controller;
-	struct cvmx_usb_port_status usb_port_status;
-	int port_status;
-	struct usb_hub_descriptor *desc;
-	unsigned long flags;
-
-	switch (typeReq) {
-	case ClearHubFeature:
-		dev_dbg(dev, "ClearHubFeature\n");
-		switch (wValue) {
-		case C_HUB_LOCAL_POWER:
-		case C_HUB_OVER_CURRENT:
-			/* Nothing required here */
-			break;
-		default:
-			return -EINVAL;
-		}
-		break;
-	case ClearPortFeature:
-		dev_dbg(dev, "ClearPortFeature\n");
-		if (wIndex != 1) {
-			dev_dbg(dev, " INVALID\n");
-			return -EINVAL;
-		}
-
-		switch (wValue) {
-		case USB_PORT_FEAT_ENABLE:
-			dev_dbg(dev, " ENABLE\n");
-			spin_lock_irqsave(&usb->lock, flags);
-			cvmx_usb_disable(usb);
-			spin_unlock_irqrestore(&usb->lock, flags);
-			break;
-		case USB_PORT_FEAT_SUSPEND:
-			dev_dbg(dev, " SUSPEND\n");
-			/* Not supported on Octeon */
-			break;
-		case USB_PORT_FEAT_POWER:
-			dev_dbg(dev, " POWER\n");
-			/* Not supported on Octeon */
-			break;
-		case USB_PORT_FEAT_INDICATOR:
-			dev_dbg(dev, " INDICATOR\n");
-			/* Port inidicator not supported */
-			break;
-		case USB_PORT_FEAT_C_CONNECTION:
-			dev_dbg(dev, " C_CONNECTION\n");
-			/* Clears drivers internal connect status change flag */
-			spin_lock_irqsave(&usb->lock, flags);
-			usb->port_status = cvmx_usb_get_status(usb);
-			spin_unlock_irqrestore(&usb->lock, flags);
-			break;
-		case USB_PORT_FEAT_C_RESET:
-			dev_dbg(dev, " C_RESET\n");
-			/*
-			 * Clears the driver's internal Port Reset Change flag.
-			 */
-			spin_lock_irqsave(&usb->lock, flags);
-			usb->port_status = cvmx_usb_get_status(usb);
-			spin_unlock_irqrestore(&usb->lock, flags);
-			break;
-		case USB_PORT_FEAT_C_ENABLE:
-			dev_dbg(dev, " C_ENABLE\n");
-			/*
-			 * Clears the driver's internal Port Enable/Disable
-			 * Change flag.
-			 */
-			spin_lock_irqsave(&usb->lock, flags);
-			usb->port_status = cvmx_usb_get_status(usb);
-			spin_unlock_irqrestore(&usb->lock, flags);
-			break;
-		case USB_PORT_FEAT_C_SUSPEND:
-			dev_dbg(dev, " C_SUSPEND\n");
-			/*
-			 * Clears the driver's internal Port Suspend Change
-			 * flag, which is set when resume signaling on the host
-			 * port is complete.
-			 */
-			break;
-		case USB_PORT_FEAT_C_OVER_CURRENT:
-			dev_dbg(dev, " C_OVER_CURRENT\n");
-			/* Clears the driver's overcurrent Change flag */
-			spin_lock_irqsave(&usb->lock, flags);
-			usb->port_status = cvmx_usb_get_status(usb);
-			spin_unlock_irqrestore(&usb->lock, flags);
-			break;
-		default:
-			dev_dbg(dev, " UNKNOWN\n");
-			return -EINVAL;
-		}
-		break;
-	case GetHubDescriptor:
-		dev_dbg(dev, "GetHubDescriptor\n");
-		desc = (struct usb_hub_descriptor *)buf;
-		desc->bDescLength = 9;
-		desc->bDescriptorType = 0x29;
-		desc->bNbrPorts = 1;
-		desc->wHubCharacteristics = cpu_to_le16(0x08);
-		desc->bPwrOn2PwrGood = 1;
-		desc->bHubContrCurrent = 0;
-		desc->u.hs.DeviceRemovable[0] = 0;
-		desc->u.hs.DeviceRemovable[1] = 0xff;
-		break;
-	case GetHubStatus:
-		dev_dbg(dev, "GetHubStatus\n");
-		*(__le32 *)buf = 0;
-		break;
-	case GetPortStatus:
-		dev_dbg(dev, "GetPortStatus\n");
-		if (wIndex != 1) {
-			dev_dbg(dev, " INVALID\n");
-			return -EINVAL;
-		}
-
-		spin_lock_irqsave(&usb->lock, flags);
-		usb_port_status = cvmx_usb_get_status(usb);
-		spin_unlock_irqrestore(&usb->lock, flags);
-		port_status = 0;
-
-		if (usb_port_status.connect_change) {
-			port_status |= (1 << USB_PORT_FEAT_C_CONNECTION);
-			dev_dbg(dev, " C_CONNECTION\n");
-		}
-
-		if (usb_port_status.port_enabled) {
-			port_status |= (1 << USB_PORT_FEAT_C_ENABLE);
-			dev_dbg(dev, " C_ENABLE\n");
-		}
-
-		if (usb_port_status.connected) {
-			port_status |= (1 << USB_PORT_FEAT_CONNECTION);
-			dev_dbg(dev, " CONNECTION\n");
-		}
-
-		if (usb_port_status.port_enabled) {
-			port_status |= (1 << USB_PORT_FEAT_ENABLE);
-			dev_dbg(dev, " ENABLE\n");
-		}
-
-		if (usb_port_status.port_over_current) {
-			port_status |= (1 << USB_PORT_FEAT_OVER_CURRENT);
-			dev_dbg(dev, " OVER_CURRENT\n");
-		}
-
-		if (usb_port_status.port_powered) {
-			port_status |= (1 << USB_PORT_FEAT_POWER);
-			dev_dbg(dev, " POWER\n");
-		}
-
-		if (usb_port_status.port_speed == CVMX_USB_SPEED_HIGH) {
-			port_status |= USB_PORT_STAT_HIGH_SPEED;
-			dev_dbg(dev, " HIGHSPEED\n");
-		} else if (usb_port_status.port_speed == CVMX_USB_SPEED_LOW) {
-			port_status |= (1 << USB_PORT_FEAT_LOWSPEED);
-			dev_dbg(dev, " LOWSPEED\n");
-		}
-
-		*((__le32 *)buf) = cpu_to_le32(port_status);
-		break;
-	case SetHubFeature:
-		dev_dbg(dev, "SetHubFeature\n");
-		/* No HUB features supported */
-		break;
-	case SetPortFeature:
-		dev_dbg(dev, "SetPortFeature\n");
-		if (wIndex != 1) {
-			dev_dbg(dev, " INVALID\n");
-			return -EINVAL;
-		}
-
-		switch (wValue) {
-		case USB_PORT_FEAT_SUSPEND:
-			dev_dbg(dev, " SUSPEND\n");
-			return -EINVAL;
-		case USB_PORT_FEAT_POWER:
-			dev_dbg(dev, " POWER\n");
-			/*
-			 * Program the port power bit to drive VBUS on the USB.
-			 */
-			spin_lock_irqsave(&usb->lock, flags);
-			USB_SET_FIELD32(CVMX_USBCX_HPRT(usb->index),
-					cvmx_usbcx_hprt, prtpwr, 1);
-			spin_unlock_irqrestore(&usb->lock, flags);
-			return 0;
-		case USB_PORT_FEAT_RESET:
-			dev_dbg(dev, " RESET\n");
-			spin_lock_irqsave(&usb->lock, flags);
-			cvmx_usb_reset_port(usb);
-			spin_unlock_irqrestore(&usb->lock, flags);
-			return 0;
-		case USB_PORT_FEAT_INDICATOR:
-			dev_dbg(dev, " INDICATOR\n");
-			/* Not supported */
-			break;
-		default:
-			dev_dbg(dev, " UNKNOWN\n");
-			return -EINVAL;
-		}
-		break;
-	default:
-		dev_dbg(dev, "Unknown root hub request\n");
-		return -EINVAL;
-	}
-	return 0;
-}
-
-static const struct hc_driver octeon_hc_driver = {
-	.description		= "Octeon USB",
-	.product_desc		= "Octeon Host Controller",
-	.hcd_priv_size		= sizeof(struct octeon_hcd),
-	.irq			= octeon_usb_irq,
-	.flags			= HCD_MEMORY | HCD_DMA | HCD_USB2,
-	.start			= octeon_usb_start,
-	.stop			= octeon_usb_stop,
-	.urb_enqueue		= octeon_usb_urb_enqueue,
-	.urb_dequeue		= octeon_usb_urb_dequeue,
-	.endpoint_disable	= octeon_usb_endpoint_disable,
-	.get_frame_number	= octeon_usb_get_frame_number,
-	.hub_status_data	= octeon_usb_hub_status_data,
-	.hub_control		= octeon_usb_hub_control,
-	.map_urb_for_dma	= octeon_map_urb_for_dma,
-	.unmap_urb_for_dma	= octeon_unmap_urb_for_dma,
-};
-
-static int octeon_usb_probe(struct platform_device *pdev)
-{
-	int status;
-	int initialize_flags;
-	int usb_num;
-	struct resource *res_mem;
-	struct device_node *usbn_node;
-	int irq = platform_get_irq(pdev, 0);
-	struct device *dev = &pdev->dev;
-	struct octeon_hcd *usb;
-	struct usb_hcd *hcd;
-	u32 clock_rate = 48000000;
-	bool is_crystal_clock = false;
-	const char *clock_type;
-	int i;
-
-	if (!dev->of_node) {
-		dev_err(dev, "Error: empty of_node\n");
-		return -ENXIO;
-	}
-	usbn_node = dev->of_node->parent;
-
-	i = of_property_read_u32(usbn_node,
-				 "clock-frequency", &clock_rate);
-	if (i)
-		i = of_property_read_u32(usbn_node,
-					 "refclk-frequency", &clock_rate);
-	if (i) {
-		dev_err(dev, "No USBN \"clock-frequency\"\n");
-		return -ENXIO;
-	}
-	switch (clock_rate) {
-	case 12000000:
-		initialize_flags = CVMX_USB_INITIALIZE_FLAGS_CLOCK_12MHZ;
-		break;
-	case 24000000:
-		initialize_flags = CVMX_USB_INITIALIZE_FLAGS_CLOCK_24MHZ;
-		break;
-	case 48000000:
-		initialize_flags = CVMX_USB_INITIALIZE_FLAGS_CLOCK_48MHZ;
-		break;
-	default:
-		dev_err(dev, "Illegal USBN \"clock-frequency\" %u\n",
-			clock_rate);
-		return -ENXIO;
-	}
-
-	i = of_property_read_string(usbn_node,
-				    "cavium,refclk-type", &clock_type);
-	if (i)
-		i = of_property_read_string(usbn_node,
-					    "refclk-type", &clock_type);
-
-	if (!i && strcmp("crystal", clock_type) == 0)
-		is_crystal_clock = true;
-
-	if (is_crystal_clock)
-		initialize_flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_XI;
-	else
-		initialize_flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_GND;
-
-	res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res_mem) {
-		dev_err(dev, "found no memory resource\n");
-		return -ENXIO;
-	}
-	usb_num = (res_mem->start >> 44) & 1;
-
-	if (irq < 0) {
-		/* Defective device tree, but we know how to fix it. */
-		irq_hw_number_t hwirq = usb_num ? (1 << 6) + 17 : 56;
-
-		irq = irq_create_mapping(NULL, hwirq);
-	}
-
-	/*
-	 * Set the DMA mask to 64bits so we get buffers already translated for
-	 * DMA.
-	 */
-	i = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64));
-	if (i)
-		return i;
-
-	/*
-	 * Only cn52XX and cn56XX have DWC_OTG USB hardware and the
-	 * IOB priority registers.  Under heavy network load USB
-	 * hardware can be starved by the IOB causing a crash.  Give
-	 * it a priority boost if it has been waiting more than 400
-	 * cycles to avoid this situation.
-	 *
-	 * Testing indicates that a cnt_val of 8192 is not sufficient,
-	 * but no failures are seen with 4096.  We choose a value of
-	 * 400 to give a safety factor of 10.
-	 */
-	if (OCTEON_IS_MODEL(OCTEON_CN52XX) || OCTEON_IS_MODEL(OCTEON_CN56XX)) {
-		union cvmx_iob_n2c_l2c_pri_cnt pri_cnt;
-
-		pri_cnt.u64 = 0;
-		pri_cnt.s.cnt_enb = 1;
-		pri_cnt.s.cnt_val = 400;
-		cvmx_write_csr(CVMX_IOB_N2C_L2C_PRI_CNT, pri_cnt.u64);
-	}
-
-	hcd = usb_create_hcd(&octeon_hc_driver, dev, dev_name(dev));
-	if (!hcd) {
-		dev_dbg(dev, "Failed to allocate memory for HCD\n");
-		return -1;
-	}
-	hcd->uses_new_polling = 1;
-	usb = (struct octeon_hcd *)hcd->hcd_priv;
-
-	spin_lock_init(&usb->lock);
-
-	usb->init_flags = initialize_flags;
-
-	/* Initialize the USB state structure */
-	usb->index = usb_num;
-	INIT_LIST_HEAD(&usb->idle_pipes);
-	for (i = 0; i < ARRAY_SIZE(usb->active_pipes); i++)
-		INIT_LIST_HEAD(&usb->active_pipes[i]);
-
-	/* Due to an errata, CN31XX doesn't support DMA */
-	if (OCTEON_IS_MODEL(OCTEON_CN31XX)) {
-		usb->init_flags |= CVMX_USB_INITIALIZE_FLAGS_NO_DMA;
-		/* Only use one channel with non DMA */
-		usb->idle_hardware_channels = 0x1;
-	} else if (OCTEON_IS_MODEL(OCTEON_CN5XXX)) {
-		/* CN5XXX have an errata with channel 3 */
-		usb->idle_hardware_channels = 0xf7;
-	} else {
-		usb->idle_hardware_channels = 0xff;
-	}
-
-	status = cvmx_usb_initialize(dev, usb);
-	if (status) {
-		dev_dbg(dev, "USB initialization failed with %d\n", status);
-		usb_put_hcd(hcd);
-		return -1;
-	}
-
-	status = usb_add_hcd(hcd, irq, 0);
-	if (status) {
-		dev_dbg(dev, "USB add HCD failed with %d\n", status);
-		usb_put_hcd(hcd);
-		return -1;
-	}
-	device_wakeup_enable(hcd->self.controller);
-
-	dev_info(dev, "Registered HCD for port %d on irq %d\n", usb_num, irq);
-
-	return 0;
-}
-
-static int octeon_usb_remove(struct platform_device *pdev)
-{
-	int status;
-	struct device *dev = &pdev->dev;
-	struct usb_hcd *hcd = dev_get_drvdata(dev);
-	struct octeon_hcd *usb = hcd_to_octeon(hcd);
-	unsigned long flags;
-
-	usb_remove_hcd(hcd);
-	spin_lock_irqsave(&usb->lock, flags);
-	status = cvmx_usb_shutdown(usb);
-	spin_unlock_irqrestore(&usb->lock, flags);
-	if (status)
-		dev_dbg(dev, "USB shutdown failed with %d\n", status);
-
-	usb_put_hcd(hcd);
-
-	return 0;
-}
-
-static const struct of_device_id octeon_usb_match[] = {
-	{
-		.compatible = "cavium,octeon-5750-usbc",
-	},
-	{},
-};
-MODULE_DEVICE_TABLE(of, octeon_usb_match);
-
-static struct platform_driver octeon_usb_driver = {
-	.driver = {
-		.name		= "octeon-hcd",
-		.of_match_table = octeon_usb_match,
-	},
-	.probe      = octeon_usb_probe,
-	.remove     = octeon_usb_remove,
-};
-
-static int __init octeon_usb_driver_init(void)
-{
-	if (usb_disabled())
-		return 0;
-
-	return platform_driver_register(&octeon_usb_driver);
-}
-module_init(octeon_usb_driver_init);
-
-static void __exit octeon_usb_driver_exit(void)
-{
-	if (usb_disabled())
-		return;
-
-	platform_driver_unregister(&octeon_usb_driver);
-}
-module_exit(octeon_usb_driver_exit);
-
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Cavium, Inc. <support@cavium.com>");
-MODULE_DESCRIPTION("Cavium Inc. OCTEON USB Host driver.");
diff --git a/drivers/staging/octeon-usb/octeon-hcd.h b/drivers/staging/octeon-usb/octeon-hcd.h
deleted file mode 100644
index 9ed619c93a4e..000000000000
--- a/drivers/staging/octeon-usb/octeon-hcd.h
+++ /dev/null
@@ -1,1847 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Octeon HCD hardware register definitions.
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Some parts of the code were originally released under BSD license:
- *
- * Copyright (c) 2003-2010 Cavium Networks (support@cavium.com). All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *   * Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *
- *   * Redistributions in binary form must reproduce the above
- *     copyright notice, this list of conditions and the following
- *     disclaimer in the documentation and/or other materials provided
- *     with the distribution.
- *
- *   * Neither the name of Cavium Networks nor the names of
- *     its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written
- *     permission.
- *
- * This Software, including technical data, may be subject to U.S. export
- * control laws, including the U.S. Export Administration Act and its associated
- * regulations, and may be subject to export or import regulations in other
- * countries.
- *
- * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
- * AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR
- * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
- * THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION
- * OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
- * SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
- * MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
- * VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
- * CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
- * PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
- */
-
-#ifndef __OCTEON_HCD_H__
-#define __OCTEON_HCD_H__
-
-#include <asm/bitfield.h>
-
-#define CVMX_USBCXBASE 0x00016F0010000000ull
-#define CVMX_USBCXREG1(reg, bid) \
-	(CVMX_ADD_IO_SEG(CVMX_USBCXBASE | reg) + \
-	 ((bid) & 1) * 0x100000000000ull)
-#define CVMX_USBCXREG2(reg, bid, off) \
-	(CVMX_ADD_IO_SEG(CVMX_USBCXBASE | reg) + \
-	 (((off) & 7) + ((bid) & 1) * 0x8000000000ull) * 32)
-
-#define CVMX_USBCX_GAHBCFG(bid)		CVMX_USBCXREG1(0x008, bid)
-#define CVMX_USBCX_GHWCFG3(bid)		CVMX_USBCXREG1(0x04c, bid)
-#define CVMX_USBCX_GINTMSK(bid)		CVMX_USBCXREG1(0x018, bid)
-#define CVMX_USBCX_GINTSTS(bid)		CVMX_USBCXREG1(0x014, bid)
-#define CVMX_USBCX_GNPTXFSIZ(bid)	CVMX_USBCXREG1(0x028, bid)
-#define CVMX_USBCX_GNPTXSTS(bid)	CVMX_USBCXREG1(0x02c, bid)
-#define CVMX_USBCX_GOTGCTL(bid)		CVMX_USBCXREG1(0x000, bid)
-#define CVMX_USBCX_GRSTCTL(bid)		CVMX_USBCXREG1(0x010, bid)
-#define CVMX_USBCX_GRXFSIZ(bid)		CVMX_USBCXREG1(0x024, bid)
-#define CVMX_USBCX_GRXSTSPH(bid)	CVMX_USBCXREG1(0x020, bid)
-#define CVMX_USBCX_GUSBCFG(bid)		CVMX_USBCXREG1(0x00c, bid)
-#define CVMX_USBCX_HAINT(bid)		CVMX_USBCXREG1(0x414, bid)
-#define CVMX_USBCX_HAINTMSK(bid)	CVMX_USBCXREG1(0x418, bid)
-#define CVMX_USBCX_HCCHARX(off, bid)	CVMX_USBCXREG2(0x500, bid, off)
-#define CVMX_USBCX_HCFG(bid)		CVMX_USBCXREG1(0x400, bid)
-#define CVMX_USBCX_HCINTMSKX(off, bid)	CVMX_USBCXREG2(0x50c, bid, off)
-#define CVMX_USBCX_HCINTX(off, bid)	CVMX_USBCXREG2(0x508, bid, off)
-#define CVMX_USBCX_HCSPLTX(off, bid)	CVMX_USBCXREG2(0x504, bid, off)
-#define CVMX_USBCX_HCTSIZX(off, bid)	CVMX_USBCXREG2(0x510, bid, off)
-#define CVMX_USBCX_HFIR(bid)		CVMX_USBCXREG1(0x404, bid)
-#define CVMX_USBCX_HFNUM(bid)		CVMX_USBCXREG1(0x408, bid)
-#define CVMX_USBCX_HPRT(bid)		CVMX_USBCXREG1(0x440, bid)
-#define CVMX_USBCX_HPTXFSIZ(bid)	CVMX_USBCXREG1(0x100, bid)
-#define CVMX_USBCX_HPTXSTS(bid)		CVMX_USBCXREG1(0x410, bid)
-
-#define CVMX_USBNXBID1(bid) (((bid) & 1) * 0x10000000ull)
-#define CVMX_USBNXBID2(bid) (((bid) & 1) * 0x100000000000ull)
-
-#define CVMX_USBNXREG1(reg, bid) \
-	(CVMX_ADD_IO_SEG(0x0001180068000000ull | reg) + CVMX_USBNXBID1(bid))
-#define CVMX_USBNXREG2(reg, bid) \
-	(CVMX_ADD_IO_SEG(0x00016F0000000000ull | reg) + CVMX_USBNXBID2(bid))
-
-#define CVMX_USBNX_CLK_CTL(bid)		CVMX_USBNXREG1(0x10, bid)
-#define CVMX_USBNX_DMA0_INB_CHN0(bid)	CVMX_USBNXREG2(0x818, bid)
-#define CVMX_USBNX_DMA0_OUTB_CHN0(bid)	CVMX_USBNXREG2(0x858, bid)
-#define CVMX_USBNX_USBP_CTL_STATUS(bid)	CVMX_USBNXREG1(0x18, bid)
-
-/**
- * cvmx_usbc#_gahbcfg
- *
- * Core AHB Configuration Register (GAHBCFG)
- *
- * This register can be used to configure the core after power-on or a change in
- * mode of operation. This register mainly contains AHB system-related
- * configuration parameters. The AHB is the processor interface to the O2P USB
- * core. In general, software need not know about this interface except to
- * program the values as specified.
- *
- * The application must program this register as part of the O2P USB core
- * initialization. Do not change this register after the initial programming.
- */
-union cvmx_usbcx_gahbcfg {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_gahbcfg_s
-	 * @ptxfemplvl: Periodic TxFIFO Empty Level (PTxFEmpLvl)
-	 *	Software should set this bit to 0x1.
-	 *	Indicates when the Periodic TxFIFO Empty Interrupt bit in the
-	 *	Core Interrupt register (GINTSTS.PTxFEmp) is triggered. This
-	 *	bit is used only in Slave mode.
-	 *	* 1'b0: GINTSTS.PTxFEmp interrupt indicates that the Periodic
-	 *	TxFIFO is half empty
-	 *	* 1'b1: GINTSTS.PTxFEmp interrupt indicates that the Periodic
-	 *	TxFIFO is completely empty
-	 * @nptxfemplvl: Non-Periodic TxFIFO Empty Level (NPTxFEmpLvl)
-	 *	Software should set this bit to 0x1.
-	 *	Indicates when the Non-Periodic TxFIFO Empty Interrupt bit in
-	 *	the Core Interrupt register (GINTSTS.NPTxFEmp) is triggered.
-	 *	This bit is used only in Slave mode.
-	 *	* 1'b0: GINTSTS.NPTxFEmp interrupt indicates that the Non-
-	 *	Periodic TxFIFO is half empty
-	 *	* 1'b1: GINTSTS.NPTxFEmp interrupt indicates that the Non-
-	 *	Periodic TxFIFO is completely empty
-	 * @dmaen: DMA Enable (DMAEn)
-	 *	* 1'b0: Core operates in Slave mode
-	 *	* 1'b1: Core operates in a DMA mode
-	 * @hbstlen: Burst Length/Type (HBstLen)
-	 *	This field has not effect and should be left as 0x0.
-	 * @glblintrmsk: Global Interrupt Mask (GlblIntrMsk)
-	 *	Software should set this field to 0x1.
-	 *	The application uses this bit to mask or unmask the interrupt
-	 *	line assertion to itself. Irrespective of this bit's setting,
-	 *	the interrupt status registers are updated by the core.
-	 *	* 1'b0: Mask the interrupt assertion to the application.
-	 *	* 1'b1: Unmask the interrupt assertion to the application.
-	 */
-	struct cvmx_usbcx_gahbcfg_s {
-		__BITFIELD_FIELD(u32 reserved_9_31	: 23,
-		__BITFIELD_FIELD(u32 ptxfemplvl		: 1,
-		__BITFIELD_FIELD(u32 nptxfemplvl	: 1,
-		__BITFIELD_FIELD(u32 reserved_6_6	: 1,
-		__BITFIELD_FIELD(u32 dmaen		: 1,
-		__BITFIELD_FIELD(u32 hbstlen		: 4,
-		__BITFIELD_FIELD(u32 glblintrmsk	: 1,
-		;)))))))
-	} s;
-};
-
-/**
- * cvmx_usbc#_ghwcfg3
- *
- * User HW Config3 Register (GHWCFG3)
- *
- * This register contains the configuration options of the O2P USB core.
- */
-union cvmx_usbcx_ghwcfg3 {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_ghwcfg3_s
-	 * @dfifodepth: DFIFO Depth (DfifoDepth)
-	 *	This value is in terms of 32-bit words.
-	 *	* Minimum value is 32
-	 *	* Maximum value is 32768
-	 * @ahbphysync: AHB and PHY Synchronous (AhbPhySync)
-	 *	Indicates whether AHB and PHY clocks are synchronous to
-	 *	each other.
-	 *	* 1'b0: No
-	 *	* 1'b1: Yes
-	 *	This bit is tied to 1.
-	 * @rsttype: Reset Style for Clocked always Blocks in RTL (RstType)
-	 *	* 1'b0: Asynchronous reset is used in the core
-	 *	* 1'b1: Synchronous reset is used in the core
-	 * @optfeature: Optional Features Removed (OptFeature)
-	 *	Indicates whether the User ID register, GPIO interface ports,
-	 *	and SOF toggle and counter ports were removed for gate count
-	 *	optimization.
-	 * @vendor_control_interface_support: Vendor Control Interface Support
-	 *	* 1'b0: Vendor Control Interface is not available on the core.
-	 *	* 1'b1: Vendor Control Interface is available.
-	 * @i2c_selection: I2C Selection
-	 *	* 1'b0: I2C Interface is not available on the core.
-	 *	* 1'b1: I2C Interface is available on the core.
-	 * @otgen: OTG Function Enabled (OtgEn)
-	 *	The application uses this bit to indicate the O2P USB core's
-	 *	OTG capabilities.
-	 *	* 1'b0: Not OTG capable
-	 *	* 1'b1: OTG Capable
-	 * @pktsizewidth: Width of Packet Size Counters (PktSizeWidth)
-	 *	* 3'b000: 4 bits
-	 *	* 3'b001: 5 bits
-	 *	* 3'b010: 6 bits
-	 *	* 3'b011: 7 bits
-	 *	* 3'b100: 8 bits
-	 *	* 3'b101: 9 bits
-	 *	* 3'b110: 10 bits
-	 *	* Others: Reserved
-	 * @xfersizewidth: Width of Transfer Size Counters (XferSizeWidth)
-	 *	* 4'b0000: 11 bits
-	 *	* 4'b0001: 12 bits
-	 *	- ...
-	 *	* 4'b1000: 19 bits
-	 *	* Others: Reserved
-	 */
-	struct cvmx_usbcx_ghwcfg3_s {
-		__BITFIELD_FIELD(u32 dfifodepth				: 16,
-		__BITFIELD_FIELD(u32 reserved_13_15			: 3,
-		__BITFIELD_FIELD(u32 ahbphysync				: 1,
-		__BITFIELD_FIELD(u32 rsttype				: 1,
-		__BITFIELD_FIELD(u32 optfeature				: 1,
-		__BITFIELD_FIELD(u32 vendor_control_interface_support	: 1,
-		__BITFIELD_FIELD(u32 i2c_selection			: 1,
-		__BITFIELD_FIELD(u32 otgen				: 1,
-		__BITFIELD_FIELD(u32 pktsizewidth			: 3,
-		__BITFIELD_FIELD(u32 xfersizewidth			: 4,
-		;))))))))))
-	} s;
-};
-
-/**
- * cvmx_usbc#_gintmsk
- *
- * Core Interrupt Mask Register (GINTMSK)
- *
- * This register works with the Core Interrupt register to interrupt the
- * application. When an interrupt bit is masked, the interrupt associated with
- * that bit will not be generated. However, the Core Interrupt (GINTSTS)
- * register bit corresponding to that interrupt will still be set.
- * Mask interrupt: 1'b0, Unmask interrupt: 1'b1
- */
-union cvmx_usbcx_gintmsk {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_gintmsk_s
-	 * @wkupintmsk: Resume/Remote Wakeup Detected Interrupt Mask
-	 *	(WkUpIntMsk)
-	 * @sessreqintmsk: Session Request/New Session Detected Interrupt Mask
-	 *	(SessReqIntMsk)
-	 * @disconnintmsk: Disconnect Detected Interrupt Mask (DisconnIntMsk)
-	 * @conidstschngmsk: Connector ID Status Change Mask (ConIDStsChngMsk)
-	 * @ptxfempmsk: Periodic TxFIFO Empty Mask (PTxFEmpMsk)
-	 * @hchintmsk: Host Channels Interrupt Mask (HChIntMsk)
-	 * @prtintmsk: Host Port Interrupt Mask (PrtIntMsk)
-	 * @fetsuspmsk: Data Fetch Suspended Mask (FetSuspMsk)
-	 * @incomplpmsk: Incomplete Periodic Transfer Mask (incomplPMsk)
-	 *	Incomplete Isochronous OUT Transfer Mask
-	 *	(incompISOOUTMsk)
-	 * @incompisoinmsk: Incomplete Isochronous IN Transfer Mask
-	 *		    (incompISOINMsk)
-	 * @oepintmsk: OUT Endpoints Interrupt Mask (OEPIntMsk)
-	 * @inepintmsk: IN Endpoints Interrupt Mask (INEPIntMsk)
-	 * @epmismsk: Endpoint Mismatch Interrupt Mask (EPMisMsk)
-	 * @eopfmsk: End of Periodic Frame Interrupt Mask (EOPFMsk)
-	 * @isooutdropmsk: Isochronous OUT Packet Dropped Interrupt Mask
-	 *	(ISOOutDropMsk)
-	 * @enumdonemsk: Enumeration Done Mask (EnumDoneMsk)
-	 * @usbrstmsk: USB Reset Mask (USBRstMsk)
-	 * @usbsuspmsk: USB Suspend Mask (USBSuspMsk)
-	 * @erlysuspmsk: Early Suspend Mask (ErlySuspMsk)
-	 * @i2cint: I2C Interrupt Mask (I2CINT)
-	 * @ulpickintmsk: ULPI Carkit Interrupt Mask (ULPICKINTMsk)
-	 *	I2C Carkit Interrupt Mask (I2CCKINTMsk)
-	 * @goutnakeffmsk: Global OUT NAK Effective Mask (GOUTNakEffMsk)
-	 * @ginnakeffmsk: Global Non-Periodic IN NAK Effective Mask
-	 *		  (GINNakEffMsk)
-	 * @nptxfempmsk: Non-Periodic TxFIFO Empty Mask (NPTxFEmpMsk)
-	 * @rxflvlmsk: Receive FIFO Non-Empty Mask (RxFLvlMsk)
-	 * @sofmsk: Start of (micro)Frame Mask (SofMsk)
-	 * @otgintmsk: OTG Interrupt Mask (OTGIntMsk)
-	 * @modemismsk: Mode Mismatch Interrupt Mask (ModeMisMsk)
-	 */
-	struct cvmx_usbcx_gintmsk_s {
-		__BITFIELD_FIELD(u32 wkupintmsk		: 1,
-		__BITFIELD_FIELD(u32 sessreqintmsk	: 1,
-		__BITFIELD_FIELD(u32 disconnintmsk	: 1,
-		__BITFIELD_FIELD(u32 conidstschngmsk	: 1,
-		__BITFIELD_FIELD(u32 reserved_27_27	: 1,
-		__BITFIELD_FIELD(u32 ptxfempmsk		: 1,
-		__BITFIELD_FIELD(u32 hchintmsk		: 1,
-		__BITFIELD_FIELD(u32 prtintmsk		: 1,
-		__BITFIELD_FIELD(u32 reserved_23_23	: 1,
-		__BITFIELD_FIELD(u32 fetsuspmsk		: 1,
-		__BITFIELD_FIELD(u32 incomplpmsk	: 1,
-		__BITFIELD_FIELD(u32 incompisoinmsk	: 1,
-		__BITFIELD_FIELD(u32 oepintmsk		: 1,
-		__BITFIELD_FIELD(u32 inepintmsk		: 1,
-		__BITFIELD_FIELD(u32 epmismsk		: 1,
-		__BITFIELD_FIELD(u32 reserved_16_16	: 1,
-		__BITFIELD_FIELD(u32 eopfmsk		: 1,
-		__BITFIELD_FIELD(u32 isooutdropmsk	: 1,
-		__BITFIELD_FIELD(u32 enumdonemsk	: 1,
-		__BITFIELD_FIELD(u32 usbrstmsk		: 1,
-		__BITFIELD_FIELD(u32 usbsuspmsk		: 1,
-		__BITFIELD_FIELD(u32 erlysuspmsk	: 1,
-		__BITFIELD_FIELD(u32 i2cint		: 1,
-		__BITFIELD_FIELD(u32 ulpickintmsk	: 1,
-		__BITFIELD_FIELD(u32 goutnakeffmsk	: 1,
-		__BITFIELD_FIELD(u32 ginnakeffmsk	: 1,
-		__BITFIELD_FIELD(u32 nptxfempmsk	: 1,
-		__BITFIELD_FIELD(u32 rxflvlmsk		: 1,
-		__BITFIELD_FIELD(u32 sofmsk		: 1,
-		__BITFIELD_FIELD(u32 otgintmsk		: 1,
-		__BITFIELD_FIELD(u32 modemismsk		: 1,
-		__BITFIELD_FIELD(u32 reserved_0_0	: 1,
-		;))))))))))))))))))))))))))))))))
-	} s;
-};
-
-/**
- * cvmx_usbc#_gintsts
- *
- * Core Interrupt Register (GINTSTS)
- *
- * This register interrupts the application for system-level events in the
- * current mode of operation (Device mode or Host mode). It is shown in
- * Interrupt. Some of the bits in this register are valid only in Host mode,
- * while others are valid in Device mode only. This register also indicates the
- * current mode of operation. In order to clear the interrupt status bits of
- * type R_SS_WC, the application must write 1'b1 into the bit. The FIFO status
- * interrupts are read only; once software reads from or writes to the FIFO
- * while servicing these interrupts, FIFO interrupt conditions are cleared
- * automatically.
- */
-union cvmx_usbcx_gintsts {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_gintsts_s
-	 * @wkupint: Resume/Remote Wakeup Detected Interrupt (WkUpInt)
-	 *	In Device mode, this interrupt is asserted when a resume is
-	 *	detected on the USB. In Host mode, this interrupt is asserted
-	 *	when a remote wakeup is detected on the USB.
-	 *	For more information on how to use this interrupt, see "Partial
-	 *	Power-Down and Clock Gating Programming Model" on
-	 *	page 353.
-	 * @sessreqint: Session Request/New Session Detected Interrupt
-	 *		(SessReqInt)
-	 *	In Host mode, this interrupt is asserted when a session request
-	 *	is detected from the device. In Device mode, this interrupt is
-	 *	asserted when the utmiotg_bvalid signal goes high.
-	 *	For more information on how to use this interrupt, see "Partial
-	 *	Power-Down and Clock Gating Programming Model" on
-	 *	page 353.
-	 * @disconnint: Disconnect Detected Interrupt (DisconnInt)
-	 *	Asserted when a device disconnect is detected.
-	 * @conidstschng: Connector ID Status Change (ConIDStsChng)
-	 *	The core sets this bit when there is a change in connector ID
-	 *	status.
-	 * @ptxfemp: Periodic TxFIFO Empty (PTxFEmp)
-	 *	Asserted when the Periodic Transmit FIFO is either half or
-	 *	completely empty and there is space for at least one entry to be
-	 *	written in the Periodic Request Queue. The half or completely
-	 *	empty status is determined by the Periodic TxFIFO Empty Level
-	 *	bit in the Core AHB Configuration register
-	 *	(GAHBCFG.PTxFEmpLvl).
-	 * @hchint: Host Channels Interrupt (HChInt)
-	 *	The core sets this bit to indicate that an interrupt is pending
-	 *	on one of the channels of the core (in Host mode). The
-	 *	application must read the Host All Channels Interrupt (HAINT)
-	 *	register to determine the exact number of the channel on which
-	 *	the interrupt occurred, and then read the corresponding Host
-	 *	Channel-n Interrupt (HCINTn) register to determine the exact
-	 *	cause of the interrupt. The application must clear the
-	 *	appropriate status bit in the HCINTn register to clear this bit.
-	 * @prtint: Host Port Interrupt (PrtInt)
-	 *	The core sets this bit to indicate a change in port status of
-	 *	one of the O2P USB core ports in Host mode. The application must
-	 *	read the Host Port Control and Status (HPRT) register to
-	 *	determine the exact event that caused this interrupt. The
-	 *	application must clear the appropriate status bit in the Host
-	 *	Port Control and Status register to clear this bit.
-	 * @fetsusp: Data Fetch Suspended (FetSusp)
-	 *	This interrupt is valid only in DMA mode. This interrupt
-	 *	indicates that the core has stopped fetching data for IN
-	 *	endpoints due to the unavailability of TxFIFO space or Request
-	 *	Queue space. This interrupt is used by the application for an
-	 *	endpoint mismatch algorithm.
-	 * @incomplp: Incomplete Periodic Transfer (incomplP)
-	 *	In Host mode, the core sets this interrupt bit when there are
-	 *	incomplete periodic transactions still pending which are
-	 *	scheduled for the current microframe.
-	 *	Incomplete Isochronous OUT Transfer (incompISOOUT)
-	 *	The Device mode, the core sets this interrupt to indicate that
-	 *	there is at least one isochronous OUT endpoint on which the
-	 *	transfer is not completed in the current microframe. This
-	 *	interrupt is asserted along with the End of Periodic Frame
-	 *	Interrupt (EOPF) bit in this register.
-	 * @incompisoin: Incomplete Isochronous IN Transfer (incompISOIN)
-	 *	The core sets this interrupt to indicate that there is at least
-	 *	one isochronous IN endpoint on which the transfer is not
-	 *	completed in the current microframe. This interrupt is asserted
-	 *	along with the End of Periodic Frame Interrupt (EOPF) bit in
-	 *	this register.
-	 * @oepint: OUT Endpoints Interrupt (OEPInt)
-	 *	The core sets this bit to indicate that an interrupt is pending
-	 *	on one of the OUT endpoints of the core (in Device mode). The
-	 *	application must read the Device All Endpoints Interrupt
-	 *	(DAINT) register to determine the exact number of the OUT
-	 *	endpoint on which the interrupt occurred, and then read the
-	 *	corresponding Device OUT Endpoint-n Interrupt (DOEPINTn)
-	 *	register to determine the exact cause of the interrupt. The
-	 *	application must clear the appropriate status bit in the
-	 *	corresponding DOEPINTn register to clear this bit.
-	 * @iepint: IN Endpoints Interrupt (IEPInt)
-	 *	The core sets this bit to indicate that an interrupt is pending
-	 *	on one of the IN endpoints of the core (in Device mode). The
-	 *	application must read the Device All Endpoints Interrupt
-	 *	(DAINT) register to determine the exact number of the IN
-	 *	endpoint on which the interrupt occurred, and then read the
-	 *	corresponding Device IN Endpoint-n Interrupt (DIEPINTn)
-	 *	register to determine the exact cause of the interrupt. The
-	 *	application must clear the appropriate status bit in the
-	 *	corresponding DIEPINTn register to clear this bit.
-	 * @epmis: Endpoint Mismatch Interrupt (EPMis)
-	 *	Indicates that an IN token has been received for a non-periodic
-	 *	endpoint, but the data for another endpoint is present in the
-	 *	top of the Non-Periodic Transmit FIFO and the IN endpoint
-	 *	mismatch count programmed by the application has expired.
-	 * @eopf: End of Periodic Frame Interrupt (EOPF)
-	 *	Indicates that the period specified in the Periodic Frame
-	 *	Interval field of the Device Configuration register
-	 *	(DCFG.PerFrInt) has been reached in the current microframe.
-	 * @isooutdrop: Isochronous OUT Packet Dropped Interrupt (ISOOutDrop)
-	 *	The core sets this bit when it fails to write an isochronous OUT
-	 *	packet into the RxFIFO because the RxFIFO doesn't have
-	 *	enough space to accommodate a maximum packet size packet
-	 *	for the isochronous OUT endpoint.
-	 * @enumdone: Enumeration Done (EnumDone)
-	 *	The core sets this bit to indicate that speed enumeration is
-	 *	complete. The application must read the Device Status (DSTS)
-	 *	register to obtain the enumerated speed.
-	 * @usbrst: USB Reset (USBRst)
-	 *	The core sets this bit to indicate that a reset is detected on
-	 *	the USB.
-	 * @usbsusp: USB Suspend (USBSusp)
-	 *	The core sets this bit to indicate that a suspend was detected
-	 *	on the USB. The core enters the Suspended state when there
-	 *	is no activity on the phy_line_state_i signal for an extended
-	 *	period of time.
-	 * @erlysusp: Early Suspend (ErlySusp)
-	 *	The core sets this bit to indicate that an Idle state has been
-	 *	detected on the USB for 3 ms.
-	 * @i2cint: I2C Interrupt (I2CINT)
-	 *	This bit is always 0x0.
-	 * @ulpickint: ULPI Carkit Interrupt (ULPICKINT)
-	 *	This bit is always 0x0.
-	 * @goutnakeff: Global OUT NAK Effective (GOUTNakEff)
-	 *	Indicates that the Set Global OUT NAK bit in the Device Control
-	 *	register (DCTL.SGOUTNak), set by the application, has taken
-	 *	effect in the core. This bit can be cleared by writing the Clear
-	 *	Global OUT NAK bit in the Device Control register
-	 *	(DCTL.CGOUTNak).
-	 * @ginnakeff: Global IN Non-Periodic NAK Effective (GINNakEff)
-	 *	Indicates that the Set Global Non-Periodic IN NAK bit in the
-	 *	Device Control register (DCTL.SGNPInNak), set by the
-	 *	application, has taken effect in the core. That is, the core has
-	 *	sampled the Global IN NAK bit set by the application. This bit
-	 *	can be cleared by clearing the Clear Global Non-Periodic IN
-	 *	NAK bit in the Device Control register (DCTL.CGNPInNak).
-	 *	This interrupt does not necessarily mean that a NAK handshake
-	 *	is sent out on the USB. The STALL bit takes precedence over
-	 *	the NAK bit.
-	 * @nptxfemp: Non-Periodic TxFIFO Empty (NPTxFEmp)
-	 *	This interrupt is asserted when the Non-Periodic TxFIFO is
-	 *	either half or completely empty, and there is space for at least
-	 *	one entry to be written to the Non-Periodic Transmit Request
-	 *	Queue. The half or completely empty status is determined by
-	 *	the Non-Periodic TxFIFO Empty Level bit in the Core AHB
-	 *	Configuration register (GAHBCFG.NPTxFEmpLvl).
-	 * @rxflvl: RxFIFO Non-Empty (RxFLvl)
-	 *	Indicates that there is at least one packet pending to be read
-	 *	from the RxFIFO.
-	 * @sof: Start of (micro)Frame (Sof)
-	 *	In Host mode, the core sets this bit to indicate that an SOF
-	 *	(FS), micro-SOF (HS), or Keep-Alive (LS) is transmitted on the
-	 *	USB. The application must write a 1 to this bit to clear the
-	 *	interrupt.
-	 *	In Device mode, in the core sets this bit to indicate that an
-	 *	SOF token has been received on the USB. The application can read
-	 *	the Device Status register to get the current (micro)frame
-	 *	number. This interrupt is seen only when the core is operating
-	 *	at either HS or FS.
-	 * @otgint: OTG Interrupt (OTGInt)
-	 *	The core sets this bit to indicate an OTG protocol event. The
-	 *	application must read the OTG Interrupt Status (GOTGINT)
-	 *	register to determine the exact event that caused this
-	 *	interrupt. The application must clear the appropriate status bit
-	 *	in the GOTGINT register to clear this bit.
-	 * @modemis: Mode Mismatch Interrupt (ModeMis)
-	 *	The core sets this bit when the application is trying to access:
-	 *	* A Host mode register, when the core is operating in Device
-	 *	mode
-	 *	* A Device mode register, when the core is operating in Host
-	 *	mode
-	 *	The register access is completed on the AHB with an OKAY
-	 *	response, but is ignored by the core internally and doesn't
-	 *	affect the operation of the core.
-	 * @curmod: Current Mode of Operation (CurMod)
-	 *	Indicates the current mode of operation.
-	 *	* 1'b0: Device mode
-	 *	* 1'b1: Host mode
-	 */
-	struct cvmx_usbcx_gintsts_s {
-		__BITFIELD_FIELD(u32 wkupint		: 1,
-		__BITFIELD_FIELD(u32 sessreqint		: 1,
-		__BITFIELD_FIELD(u32 disconnint		: 1,
-		__BITFIELD_FIELD(u32 conidstschng	: 1,
-		__BITFIELD_FIELD(u32 reserved_27_27	: 1,
-		__BITFIELD_FIELD(u32 ptxfemp		: 1,
-		__BITFIELD_FIELD(u32 hchint		: 1,
-		__BITFIELD_FIELD(u32 prtint		: 1,
-		__BITFIELD_FIELD(u32 reserved_23_23	: 1,
-		__BITFIELD_FIELD(u32 fetsusp		: 1,
-		__BITFIELD_FIELD(u32 incomplp		: 1,
-		__BITFIELD_FIELD(u32 incompisoin	: 1,
-		__BITFIELD_FIELD(u32 oepint		: 1,
-		__BITFIELD_FIELD(u32 iepint		: 1,
-		__BITFIELD_FIELD(u32 epmis		: 1,
-		__BITFIELD_FIELD(u32 reserved_16_16	: 1,
-		__BITFIELD_FIELD(u32 eopf		: 1,
-		__BITFIELD_FIELD(u32 isooutdrop		: 1,
-		__BITFIELD_FIELD(u32 enumdone		: 1,
-		__BITFIELD_FIELD(u32 usbrst		: 1,
-		__BITFIELD_FIELD(u32 usbsusp		: 1,
-		__BITFIELD_FIELD(u32 erlysusp		: 1,
-		__BITFIELD_FIELD(u32 i2cint		: 1,
-		__BITFIELD_FIELD(u32 ulpickint		: 1,
-		__BITFIELD_FIELD(u32 goutnakeff		: 1,
-		__BITFIELD_FIELD(u32 ginnakeff		: 1,
-		__BITFIELD_FIELD(u32 nptxfemp		: 1,
-		__BITFIELD_FIELD(u32 rxflvl		: 1,
-		__BITFIELD_FIELD(u32 sof		: 1,
-		__BITFIELD_FIELD(u32 otgint		: 1,
-		__BITFIELD_FIELD(u32 modemis		: 1,
-		__BITFIELD_FIELD(u32 curmod		: 1,
-		;))))))))))))))))))))))))))))))))
-	} s;
-};
-
-/**
- * cvmx_usbc#_gnptxfsiz
- *
- * Non-Periodic Transmit FIFO Size Register (GNPTXFSIZ)
- *
- * The application can program the RAM size and the memory start address for the
- * Non-Periodic TxFIFO.
- */
-union cvmx_usbcx_gnptxfsiz {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_gnptxfsiz_s
-	 * @nptxfdep: Non-Periodic TxFIFO Depth (NPTxFDep)
-	 *	This value is in terms of 32-bit words.
-	 *	Minimum value is 16
-	 *	Maximum value is 32768
-	 * @nptxfstaddr: Non-Periodic Transmit RAM Start Address (NPTxFStAddr)
-	 *	This field contains the memory start address for Non-Periodic
-	 *	Transmit FIFO RAM.
-	 */
-	struct cvmx_usbcx_gnptxfsiz_s {
-		__BITFIELD_FIELD(u32 nptxfdep		: 16,
-		__BITFIELD_FIELD(u32 nptxfstaddr	: 16,
-		;))
-	} s;
-};
-
-/**
- * cvmx_usbc#_gnptxsts
- *
- * Non-Periodic Transmit FIFO/Queue Status Register (GNPTXSTS)
- *
- * This read-only register contains the free space information for the
- * Non-Periodic TxFIFO and the Non-Periodic Transmit Request Queue.
- */
-union cvmx_usbcx_gnptxsts {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_gnptxsts_s
-	 * @nptxqtop: Top of the Non-Periodic Transmit Request Queue (NPTxQTop)
-	 *	Entry in the Non-Periodic Tx Request Queue that is currently
-	 *	being processed by the MAC.
-	 *	* Bits [30:27]: Channel/endpoint number
-	 *	* Bits [26:25]:
-	 *	- 2'b00: IN/OUT token
-	 *	- 2'b01: Zero-length transmit packet (device IN/host OUT)
-	 *	- 2'b10: PING/CSPLIT token
-	 *	- 2'b11: Channel halt command
-	 *	* Bit [24]: Terminate (last entry for selected channel/endpoint)
-	 * @nptxqspcavail: Non-Periodic Transmit Request Queue Space Available
-	 *	(NPTxQSpcAvail)
-	 *	Indicates the amount of free space available in the Non-
-	 *	Periodic Transmit Request Queue. This queue holds both IN
-	 *	and OUT requests in Host mode. Device mode has only IN
-	 *	requests.
-	 *	* 8'h0: Non-Periodic Transmit Request Queue is full
-	 *	* 8'h1: 1 location available
-	 *	* 8'h2: 2 locations available
-	 *	* n: n locations available (0..8)
-	 *	* Others: Reserved
-	 * @nptxfspcavail: Non-Periodic TxFIFO Space Avail (NPTxFSpcAvail)
-	 *	Indicates the amount of free space available in the Non-
-	 *	Periodic TxFIFO.
-	 *	Values are in terms of 32-bit words.
-	 *	* 16'h0: Non-Periodic TxFIFO is full
-	 *	* 16'h1: 1 word available
-	 *	* 16'h2: 2 words available
-	 *	* 16'hn: n words available (where 0..32768)
-	 *	* 16'h8000: 32768 words available
-	 *	* Others: Reserved
-	 */
-	struct cvmx_usbcx_gnptxsts_s {
-		__BITFIELD_FIELD(u32 reserved_31_31	: 1,
-		__BITFIELD_FIELD(u32 nptxqtop		: 7,
-		__BITFIELD_FIELD(u32 nptxqspcavail	: 8,
-		__BITFIELD_FIELD(u32 nptxfspcavail	: 16,
-		;))))
-	} s;
-};
-
-/**
- * cvmx_usbc#_grstctl
- *
- * Core Reset Register (GRSTCTL)
- *
- * The application uses this register to reset various hardware features inside
- * the core.
- */
-union cvmx_usbcx_grstctl {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_grstctl_s
-	 * @ahbidle: AHB Master Idle (AHBIdle)
-	 *	Indicates that the AHB Master State Machine is in the IDLE
-	 *	condition.
-	 * @dmareq: DMA Request Signal (DMAReq)
-	 *	Indicates that the DMA request is in progress. Used for debug.
-	 * @txfnum: TxFIFO Number (TxFNum)
-	 *	This is the FIFO number that must be flushed using the TxFIFO
-	 *	Flush bit. This field must not be changed until the core clears
-	 *	the TxFIFO Flush bit.
-	 *	* 5'h0: Non-Periodic TxFIFO flush
-	 *	* 5'h1: Periodic TxFIFO 1 flush in Device mode or Periodic
-	 *	TxFIFO flush in Host mode
-	 *	* 5'h2: Periodic TxFIFO 2 flush in Device mode
-	 *	- ...
-	 *	* 5'hF: Periodic TxFIFO 15 flush in Device mode
-	 *	* 5'h10: Flush all the Periodic and Non-Periodic TxFIFOs in the
-	 *	core
-	 * @txfflsh: TxFIFO Flush (TxFFlsh)
-	 *	This bit selectively flushes a single or all transmit FIFOs, but
-	 *	cannot do so if the core is in the midst of a transaction.
-	 *	The application must only write this bit after checking that the
-	 *	core is neither writing to the TxFIFO nor reading from the
-	 *	TxFIFO.
-	 *	The application must wait until the core clears this bit before
-	 *	performing any operations. This bit takes 8 clocks (of phy_clk
-	 *	or hclk, whichever is slower) to clear.
-	 * @rxfflsh: RxFIFO Flush (RxFFlsh)
-	 *	The application can flush the entire RxFIFO using this bit, but
-	 *	must first ensure that the core is not in the middle of a
-	 *	transaction.
-	 *	The application must only write to this bit after checking that
-	 *	the core is neither reading from the RxFIFO nor writing to the
-	 *	RxFIFO.
-	 *	The application must wait until the bit is cleared before
-	 *	performing any other operations. This bit will take 8 clocks
-	 *	(slowest of PHY or AHB clock) to clear.
-	 * @intknqflsh: IN Token Sequence Learning Queue Flush (INTknQFlsh)
-	 *	The application writes this bit to flush the IN Token Sequence
-	 *	Learning Queue.
-	 * @frmcntrrst: Host Frame Counter Reset (FrmCntrRst)
-	 *	The application writes this bit to reset the (micro)frame number
-	 *	counter inside the core. When the (micro)frame counter is reset,
-	 *	the subsequent SOF sent out by the core will have a
-	 *	(micro)frame number of 0.
-	 * @hsftrst: HClk Soft Reset (HSftRst)
-	 *	The application uses this bit to flush the control logic in the
-	 *	AHB Clock domain. Only AHB Clock Domain pipelines are reset.
-	 *	* FIFOs are not flushed with this bit.
-	 *	* All state machines in the AHB clock domain are reset to the
-	 *	Idle state after terminating the transactions on the AHB,
-	 *	following the protocol.
-	 *	* CSR control bits used by the AHB clock domain state
-	 *	machines are cleared.
-	 *	* To clear this interrupt, status mask bits that control the
-	 *	interrupt status and are generated by the AHB clock domain
-	 *	state machine are cleared.
-	 *	* Because interrupt status bits are not cleared, the application
-	 *	can get the status of any core events that occurred after it set
-	 *	this bit.
-	 *	This is a self-clearing bit that the core clears after all
-	 *	necessary logic is reset in the core. This may take several
-	 *	clocks, depending on the core's current state.
-	 * @csftrst: Core Soft Reset (CSftRst)
-	 *	Resets the hclk and phy_clock domains as follows:
-	 *	* Clears the interrupts and all the CSR registers except the
-	 *	following register bits:
-	 *	- PCGCCTL.RstPdwnModule
-	 *	- PCGCCTL.GateHclk
-	 *	- PCGCCTL.PwrClmp
-	 *	- PCGCCTL.StopPPhyLPwrClkSelclk
-	 *	- GUSBCFG.PhyLPwrClkSel
-	 *	- GUSBCFG.DDRSel
-	 *	- GUSBCFG.PHYSel
-	 *	- GUSBCFG.FSIntf
-	 *	- GUSBCFG.ULPI_UTMI_Sel
-	 *	- GUSBCFG.PHYIf
-	 *	- HCFG.FSLSPclkSel
-	 *	- DCFG.DevSpd
-	 *	* All module state machines (except the AHB Slave Unit) are
-	 *	reset to the IDLE state, and all the transmit FIFOs and the
-	 *	receive FIFO are flushed.
-	 *	* Any transactions on the AHB Master are terminated as soon
-	 *	as possible, after gracefully completing the last data phase of
-	 *	an AHB transfer. Any transactions on the USB are terminated
-	 *	immediately.
-	 *	The application can write to this bit any time it wants to reset
-	 *	the core. This is a self-clearing bit and the core clears this
-	 *	bit after all the necessary logic is reset in the core, which
-	 *	may take several clocks, depending on the current state of the
-	 *	core. Once this bit is cleared software should wait at least 3
-	 *	PHY clocks before doing any access to the PHY domain
-	 *	(synchronization delay). Software should also should check that
-	 *	bit 31 of this register is 1 (AHB Master is IDLE) before
-	 *	starting any operation.
-	 *	Typically software reset is used during software development
-	 *	and also when you dynamically change the PHY selection bits
-	 *	in the USB configuration registers listed above. When you
-	 *	change the PHY, the corresponding clock for the PHY is
-	 *	selected and used in the PHY domain. Once a new clock is
-	 *	selected, the PHY domain has to be reset for proper operation.
-	 */
-	struct cvmx_usbcx_grstctl_s {
-		__BITFIELD_FIELD(u32 ahbidle		: 1,
-		__BITFIELD_FIELD(u32 dmareq		: 1,
-		__BITFIELD_FIELD(u32 reserved_11_29	: 19,
-		__BITFIELD_FIELD(u32 txfnum		: 5,
-		__BITFIELD_FIELD(u32 txfflsh		: 1,
-		__BITFIELD_FIELD(u32 rxfflsh		: 1,
-		__BITFIELD_FIELD(u32 intknqflsh		: 1,
-		__BITFIELD_FIELD(u32 frmcntrrst		: 1,
-		__BITFIELD_FIELD(u32 hsftrst		: 1,
-		__BITFIELD_FIELD(u32 csftrst		: 1,
-		;))))))))))
-	} s;
-};
-
-/**
- * cvmx_usbc#_grxfsiz
- *
- * Receive FIFO Size Register (GRXFSIZ)
- *
- * The application can program the RAM size that must be allocated to the
- * RxFIFO.
- */
-union cvmx_usbcx_grxfsiz {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_grxfsiz_s
-	 * @rxfdep: RxFIFO Depth (RxFDep)
-	 *	This value is in terms of 32-bit words.
-	 *	* Minimum value is 16
-	 *	* Maximum value is 32768
-	 */
-	struct cvmx_usbcx_grxfsiz_s {
-		__BITFIELD_FIELD(u32 reserved_16_31	: 16,
-		__BITFIELD_FIELD(u32 rxfdep		: 16,
-		;))
-	} s;
-};
-
-/**
- * cvmx_usbc#_grxstsph
- *
- * Receive Status Read and Pop Register, Host Mode (GRXSTSPH)
- *
- * A read to the Receive Status Read and Pop register returns and additionally
- * pops the top data entry out of the RxFIFO.
- * This Description is only valid when the core is in Host Mode. For Device Mode
- * use USBC_GRXSTSPD instead.
- * NOTE: GRXSTSPH and GRXSTSPD are physically the same register and share the
- *	 same offset in the O2P USB core. The offset difference shown in this
- *	 document is for software clarity and is actually ignored by the
- *       hardware.
- */
-union cvmx_usbcx_grxstsph {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_grxstsph_s
-	 * @pktsts: Packet Status (PktSts)
-	 *	Indicates the status of the received packet
-	 *	* 4'b0010: IN data packet received
-	 *	* 4'b0011: IN transfer completed (triggers an interrupt)
-	 *	* 4'b0101: Data toggle error (triggers an interrupt)
-	 *	* 4'b0111: Channel halted (triggers an interrupt)
-	 *	* Others: Reserved
-	 * @dpid: Data PID (DPID)
-	 *	* 2'b00: DATA0
-	 *	* 2'b10: DATA1
-	 *	* 2'b01: DATA2
-	 *	* 2'b11: MDATA
-	 * @bcnt: Byte Count (BCnt)
-	 *	Indicates the byte count of the received IN data packet
-	 * @chnum: Channel Number (ChNum)
-	 *	Indicates the channel number to which the current received
-	 *	packet belongs.
-	 */
-	struct cvmx_usbcx_grxstsph_s {
-		__BITFIELD_FIELD(u32 reserved_21_31	: 11,
-		__BITFIELD_FIELD(u32 pktsts		: 4,
-		__BITFIELD_FIELD(u32 dpid		: 2,
-		__BITFIELD_FIELD(u32 bcnt		: 11,
-		__BITFIELD_FIELD(u32 chnum		: 4,
-		;)))))
-	} s;
-};
-
-/**
- * cvmx_usbc#_gusbcfg
- *
- * Core USB Configuration Register (GUSBCFG)
- *
- * This register can be used to configure the core after power-on or a changing
- * to Host mode or Device mode. It contains USB and USB-PHY related
- * configuration parameters. The application must program this register before
- * starting any transactions on either the AHB or the USB. Do not make changes
- * to this register after the initial programming.
- */
-union cvmx_usbcx_gusbcfg {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_gusbcfg_s
-	 * @otgi2csel: UTMIFS or I2C Interface Select (OtgI2CSel)
-	 *	This bit is always 0x0.
-	 * @phylpwrclksel: PHY Low-Power Clock Select (PhyLPwrClkSel)
-	 *	Software should set this bit to 0x0.
-	 *	Selects either 480-MHz or 48-MHz (low-power) PHY mode. In
-	 *	FS and LS modes, the PHY can usually operate on a 48-MHz
-	 *	clock to save power.
-	 *	* 1'b0: 480-MHz Internal PLL clock
-	 *	* 1'b1: 48-MHz External Clock
-	 *	In 480 MHz mode, the UTMI interface operates at either 60 or
-	 *	30-MHz, depending upon whether 8- or 16-bit data width is
-	 *	selected. In 48-MHz mode, the UTMI interface operates at 48
-	 *	MHz in FS mode and at either 48 or 6 MHz in LS mode
-	 *	(depending on the PHY vendor).
-	 *	This bit drives the utmi_fsls_low_power core output signal, and
-	 *	is valid only for UTMI+ PHYs.
-	 * @usbtrdtim: USB Turnaround Time (USBTrdTim)
-	 *	Sets the turnaround time in PHY clocks.
-	 *	Specifies the response time for a MAC request to the Packet
-	 *	FIFO Controller (PFC) to fetch data from the DFIFO (SPRAM).
-	 *	This must be programmed to 0x5.
-	 * @hnpcap: HNP-Capable (HNPCap)
-	 *	This bit is always 0x0.
-	 * @srpcap: SRP-Capable (SRPCap)
-	 *	This bit is always 0x0.
-	 * @ddrsel: ULPI DDR Select (DDRSel)
-	 *	Software should set this bit to 0x0.
-	 * @physel: USB 2.0 High-Speed PHY or USB 1.1 Full-Speed Serial
-	 *	Software should set this bit to 0x0.
-	 * @fsintf: Full-Speed Serial Interface Select (FSIntf)
-	 *	Software should set this bit to 0x0.
-	 * @ulpi_utmi_sel: ULPI or UTMI+ Select (ULPI_UTMI_Sel)
-	 *	This bit is always 0x0.
-	 * @phyif: PHY Interface (PHYIf)
-	 *	This bit is always 0x1.
-	 * @toutcal: HS/FS Timeout Calibration (TOutCal)
-	 *	The number of PHY clocks that the application programs in this
-	 *	field is added to the high-speed/full-speed interpacket timeout
-	 *	duration in the core to account for any additional delays
-	 *	introduced by the PHY. This may be required, since the delay
-	 *	introduced by the PHY in generating the linestate condition may
-	 *	vary from one PHY to another.
-	 *	The USB standard timeout value for high-speed operation is
-	 *	736 to 816 (inclusive) bit times. The USB standard timeout
-	 *	value for full-speed operation is 16 to 18 (inclusive) bit
-	 *	times. The application must program this field based on the
-	 *	speed of enumeration. The number of bit times added per PHY
-	 *	clock are:
-	 *	High-speed operation:
-	 *	* One 30-MHz PHY clock = 16 bit times
-	 *	* One 60-MHz PHY clock = 8 bit times
-	 *	Full-speed operation:
-	 *	* One 30-MHz PHY clock = 0.4 bit times
-	 *	* One 60-MHz PHY clock = 0.2 bit times
-	 *	* One 48-MHz PHY clock = 0.25 bit times
-	 */
-	struct cvmx_usbcx_gusbcfg_s {
-		__BITFIELD_FIELD(u32 reserved_17_31	: 15,
-		__BITFIELD_FIELD(u32 otgi2csel		: 1,
-		__BITFIELD_FIELD(u32 phylpwrclksel	: 1,
-		__BITFIELD_FIELD(u32 reserved_14_14	: 1,
-		__BITFIELD_FIELD(u32 usbtrdtim		: 4,
-		__BITFIELD_FIELD(u32 hnpcap		: 1,
-		__BITFIELD_FIELD(u32 srpcap		: 1,
-		__BITFIELD_FIELD(u32 ddrsel		: 1,
-		__BITFIELD_FIELD(u32 physel		: 1,
-		__BITFIELD_FIELD(u32 fsintf		: 1,
-		__BITFIELD_FIELD(u32 ulpi_utmi_sel	: 1,
-		__BITFIELD_FIELD(u32 phyif		: 1,
-		__BITFIELD_FIELD(u32 toutcal		: 3,
-		;)))))))))))))
-	} s;
-};
-
-/**
- * cvmx_usbc#_haint
- *
- * Host All Channels Interrupt Register (HAINT)
- *
- * When a significant event occurs on a channel, the Host All Channels Interrupt
- * register interrupts the application using the Host Channels Interrupt bit of
- * the Core Interrupt register (GINTSTS.HChInt). This is shown in Interrupt.
- * There is one interrupt bit per channel, up to a maximum of 16 bits. Bits in
- * this register are set and cleared when the application sets and clears bits
- * in the corresponding Host Channel-n Interrupt register.
- */
-union cvmx_usbcx_haint {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_haint_s
-	 * @haint: Channel Interrupts (HAINT)
-	 *	One bit per channel: Bit 0 for Channel 0, bit 15 for Channel 15
-	 */
-	struct cvmx_usbcx_haint_s {
-		__BITFIELD_FIELD(u32 reserved_16_31	: 16,
-		__BITFIELD_FIELD(u32 haint		: 16,
-		;))
-	} s;
-};
-
-/**
- * cvmx_usbc#_haintmsk
- *
- * Host All Channels Interrupt Mask Register (HAINTMSK)
- *
- * The Host All Channel Interrupt Mask register works with the Host All Channel
- * Interrupt register to interrupt the application when an event occurs on a
- * channel. There is one interrupt mask bit per channel, up to a maximum of 16
- * bits.
- * Mask interrupt: 1'b0 Unmask interrupt: 1'b1
- */
-union cvmx_usbcx_haintmsk {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_haintmsk_s
-	 * @haintmsk: Channel Interrupt Mask (HAINTMsk)
-	 *	One bit per channel: Bit 0 for channel 0, bit 15 for channel 15
-	 */
-	struct cvmx_usbcx_haintmsk_s {
-		__BITFIELD_FIELD(u32 reserved_16_31	: 16,
-		__BITFIELD_FIELD(u32 haintmsk		: 16,
-		;))
-	} s;
-};
-
-/**
- * cvmx_usbc#_hcchar#
- *
- * Host Channel-n Characteristics Register (HCCHAR)
- *
- */
-union cvmx_usbcx_hccharx {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_hccharx_s
-	 * @chena: Channel Enable (ChEna)
-	 *	This field is set by the application and cleared by the OTG
-	 *	host.
-	 *	* 1'b0: Channel disabled
-	 *	* 1'b1: Channel enabled
-	 * @chdis: Channel Disable (ChDis)
-	 *	The application sets this bit to stop transmitting/receiving
-	 *	data on a channel, even before the transfer for that channel is
-	 *	complete. The application must wait for the Channel Disabled
-	 *	interrupt before treating the channel as disabled.
-	 * @oddfrm: Odd Frame (OddFrm)
-	 *	This field is set (reset) by the application to indicate that
-	 *	the OTG host must perform a transfer in an odd (micro)frame.
-	 *	This field is applicable for only periodic (isochronous and
-	 *	interrupt) transactions.
-	 *	* 1'b0: Even (micro)frame
-	 *	* 1'b1: Odd (micro)frame
-	 * @devaddr: Device Address (DevAddr)
-	 *	This field selects the specific device serving as the data
-	 *	source or sink.
-	 * @ec: Multi Count (MC) / Error Count (EC)
-	 *	When the Split Enable bit of the Host Channel-n Split Control
-	 *	register (HCSPLTn.SpltEna) is reset (1'b0), this field indicates
-	 *	to the host the number of transactions that should be executed
-	 *	per microframe for this endpoint.
-	 *	* 2'b00: Reserved. This field yields undefined results.
-	 *	* 2'b01: 1 transaction
-	 *	* 2'b10: 2 transactions to be issued for this endpoint per
-	 *	microframe
-	 *	* 2'b11: 3 transactions to be issued for this endpoint per
-	 *	microframe
-	 *	When HCSPLTn.SpltEna is set (1'b1), this field indicates the
-	 *	number of immediate retries to be performed for a periodic split
-	 *	transactions on transaction errors. This field must be set to at
-	 *	least 2'b01.
-	 * @eptype: Endpoint Type (EPType)
-	 *	Indicates the transfer type selected.
-	 *	* 2'b00: Control
-	 *	* 2'b01: Isochronous
-	 *	* 2'b10: Bulk
-	 *	* 2'b11: Interrupt
-	 * @lspddev: Low-Speed Device (LSpdDev)
-	 *	This field is set by the application to indicate that this
-	 *	channel is communicating to a low-speed device.
-	 * @epdir: Endpoint Direction (EPDir)
-	 *	Indicates whether the transaction is IN or OUT.
-	 *	* 1'b0: OUT
-	 *	* 1'b1: IN
-	 * @epnum: Endpoint Number (EPNum)
-	 *	Indicates the endpoint number on the device serving as the
-	 *	data source or sink.
-	 * @mps: Maximum Packet Size (MPS)
-	 *	Indicates the maximum packet size of the associated endpoint.
-	 */
-	struct cvmx_usbcx_hccharx_s {
-		__BITFIELD_FIELD(u32 chena		: 1,
-		__BITFIELD_FIELD(u32 chdis		: 1,
-		__BITFIELD_FIELD(u32 oddfrm		: 1,
-		__BITFIELD_FIELD(u32 devaddr		: 7,
-		__BITFIELD_FIELD(u32 ec			: 2,
-		__BITFIELD_FIELD(u32 eptype		: 2,
-		__BITFIELD_FIELD(u32 lspddev		: 1,
-		__BITFIELD_FIELD(u32 reserved_16_16	: 1,
-		__BITFIELD_FIELD(u32 epdir		: 1,
-		__BITFIELD_FIELD(u32 epnum		: 4,
-		__BITFIELD_FIELD(u32 mps		: 11,
-		;)))))))))))
-	} s;
-};
-
-/**
- * cvmx_usbc#_hcfg
- *
- * Host Configuration Register (HCFG)
- *
- * This register configures the core after power-on. Do not make changes to this
- * register after initializing the host.
- */
-union cvmx_usbcx_hcfg {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_hcfg_s
-	 * @fslssupp: FS- and LS-Only Support (FSLSSupp)
-	 *	The application uses this bit to control the core's enumeration
-	 *	speed. Using this bit, the application can make the core
-	 *	enumerate as a FS host, even if the connected device supports
-	 *	HS traffic. Do not make changes to this field after initial
-	 *	programming.
-	 *	* 1'b0: HS/FS/LS, based on the maximum speed supported by
-	 *	the connected device
-	 *	* 1'b1: FS/LS-only, even if the connected device can support HS
-	 * @fslspclksel: FS/LS PHY Clock Select (FSLSPclkSel)
-	 *	When the core is in FS Host mode
-	 *	* 2'b00: PHY clock is running at 30/60 MHz
-	 *	* 2'b01: PHY clock is running at 48 MHz
-	 *	* Others: Reserved
-	 *	When the core is in LS Host mode
-	 *	* 2'b00: PHY clock is running at 30/60 MHz. When the
-	 *	UTMI+/ULPI PHY Low Power mode is not selected, use
-	 *	30/60 MHz.
-	 *	* 2'b01: PHY clock is running at 48 MHz. When the UTMI+
-	 *	PHY Low Power mode is selected, use 48MHz if the PHY
-	 *	supplies a 48 MHz clock during LS mode.
-	 *	* 2'b10: PHY clock is running at 6 MHz. In USB 1.1 FS mode,
-	 *	use 6 MHz when the UTMI+ PHY Low Power mode is
-	 *	selected and the PHY supplies a 6 MHz clock during LS
-	 *	mode. If you select a 6 MHz clock during LS mode, you must
-	 *	do a soft reset.
-	 *	* 2'b11: Reserved
-	 */
-	struct cvmx_usbcx_hcfg_s {
-		__BITFIELD_FIELD(u32 reserved_3_31	: 29,
-		__BITFIELD_FIELD(u32 fslssupp		: 1,
-		__BITFIELD_FIELD(u32 fslspclksel	: 2,
-		;)))
-	} s;
-};
-
-/**
- * cvmx_usbc#_hcint#
- *
- * Host Channel-n Interrupt Register (HCINT)
- *
- * This register indicates the status of a channel with respect to USB- and
- * AHB-related events. The application must read this register when the Host
- * Channels Interrupt bit of the Core Interrupt register (GINTSTS.HChInt) is
- * set. Before the application can read this register, it must first read
- * the Host All Channels Interrupt (HAINT) register to get the exact channel
- * number for the Host Channel-n Interrupt register. The application must clear
- * the appropriate bit in this register to clear the corresponding bits in the
- * HAINT and GINTSTS registers.
- */
-union cvmx_usbcx_hcintx {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_hcintx_s
-	 * @datatglerr: Data Toggle Error (DataTglErr)
-	 * @frmovrun: Frame Overrun (FrmOvrun)
-	 * @bblerr: Babble Error (BblErr)
-	 * @xacterr: Transaction Error (XactErr)
-	 * @nyet: NYET Response Received Interrupt (NYET)
-	 * @ack: ACK Response Received Interrupt (ACK)
-	 * @nak: NAK Response Received Interrupt (NAK)
-	 * @stall: STALL Response Received Interrupt (STALL)
-	 * @ahberr: This bit is always 0x0.
-	 * @chhltd: Channel Halted (ChHltd)
-	 *	Indicates the transfer completed abnormally either because of
-	 *	any USB transaction error or in response to disable request by
-	 *	the application.
-	 * @xfercompl: Transfer Completed (XferCompl)
-	 *	Transfer completed normally without any errors.
-	 */
-	struct cvmx_usbcx_hcintx_s {
-		__BITFIELD_FIELD(u32 reserved_11_31	: 21,
-		__BITFIELD_FIELD(u32 datatglerr		: 1,
-		__BITFIELD_FIELD(u32 frmovrun		: 1,
-		__BITFIELD_FIELD(u32 bblerr		: 1,
-		__BITFIELD_FIELD(u32 xacterr		: 1,
-		__BITFIELD_FIELD(u32 nyet		: 1,
-		__BITFIELD_FIELD(u32 ack		: 1,
-		__BITFIELD_FIELD(u32 nak		: 1,
-		__BITFIELD_FIELD(u32 stall		: 1,
-		__BITFIELD_FIELD(u32 ahberr		: 1,
-		__BITFIELD_FIELD(u32 chhltd		: 1,
-		__BITFIELD_FIELD(u32 xfercompl		: 1,
-		;))))))))))))
-	} s;
-};
-
-/**
- * cvmx_usbc#_hcintmsk#
- *
- * Host Channel-n Interrupt Mask Register (HCINTMSKn)
- *
- * This register reflects the mask for each channel status described in the
- * previous section.
- * Mask interrupt: 1'b0 Unmask interrupt: 1'b1
- */
-union cvmx_usbcx_hcintmskx {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_hcintmskx_s
-	 * @datatglerrmsk: Data Toggle Error Mask (DataTglErrMsk)
-	 * @frmovrunmsk: Frame Overrun Mask (FrmOvrunMsk)
-	 * @bblerrmsk: Babble Error Mask (BblErrMsk)
-	 * @xacterrmsk: Transaction Error Mask (XactErrMsk)
-	 * @nyetmsk: NYET Response Received Interrupt Mask (NyetMsk)
-	 * @ackmsk: ACK Response Received Interrupt Mask (AckMsk)
-	 * @nakmsk: NAK Response Received Interrupt Mask (NakMsk)
-	 * @stallmsk: STALL Response Received Interrupt Mask (StallMsk)
-	 * @ahberrmsk: AHB Error Mask (AHBErrMsk)
-	 * @chhltdmsk: Channel Halted Mask (ChHltdMsk)
-	 * @xfercomplmsk: Transfer Completed Mask (XferComplMsk)
-	 */
-	struct cvmx_usbcx_hcintmskx_s {
-		__BITFIELD_FIELD(u32 reserved_11_31		: 21,
-		__BITFIELD_FIELD(u32 datatglerrmsk		: 1,
-		__BITFIELD_FIELD(u32 frmovrunmsk		: 1,
-		__BITFIELD_FIELD(u32 bblerrmsk			: 1,
-		__BITFIELD_FIELD(u32 xacterrmsk			: 1,
-		__BITFIELD_FIELD(u32 nyetmsk			: 1,
-		__BITFIELD_FIELD(u32 ackmsk			: 1,
-		__BITFIELD_FIELD(u32 nakmsk			: 1,
-		__BITFIELD_FIELD(u32 stallmsk			: 1,
-		__BITFIELD_FIELD(u32 ahberrmsk			: 1,
-		__BITFIELD_FIELD(u32 chhltdmsk			: 1,
-		__BITFIELD_FIELD(u32 xfercomplmsk		: 1,
-		;))))))))))))
-	} s;
-};
-
-/**
- * cvmx_usbc#_hcsplt#
- *
- * Host Channel-n Split Control Register (HCSPLT)
- *
- */
-union cvmx_usbcx_hcspltx {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_hcspltx_s
-	 * @spltena: Split Enable (SpltEna)
-	 *	The application sets this field to indicate that this channel is
-	 *	enabled to perform split transactions.
-	 * @compsplt: Do Complete Split (CompSplt)
-	 *	The application sets this field to request the OTG host to
-	 *	perform a complete split transaction.
-	 * @xactpos: Transaction Position (XactPos)
-	 *	This field is used to determine whether to send all, first,
-	 *	middle, or last payloads with each OUT transaction.
-	 *	* 2'b11: All. This is the entire data payload is of this
-	 *	transaction (which is less than or equal to 188 bytes).
-	 *	* 2'b10: Begin. This is the first data payload of this
-	 *	transaction (which is larger than 188 bytes).
-	 *	* 2'b00: Mid. This is the middle payload of this transaction
-	 *	(which is larger than 188 bytes).
-	 *	* 2'b01: End. This is the last payload of this transaction
-	 *	(which is larger than 188 bytes).
-	 * @hubaddr: Hub Address (HubAddr)
-	 *	This field holds the device address of the transaction
-	 *	translator's hub.
-	 * @prtaddr: Port Address (PrtAddr)
-	 *	This field is the port number of the recipient transaction
-	 *	translator.
-	 */
-	struct cvmx_usbcx_hcspltx_s {
-		__BITFIELD_FIELD(u32 spltena			: 1,
-		__BITFIELD_FIELD(u32 reserved_17_30		: 14,
-		__BITFIELD_FIELD(u32 compsplt			: 1,
-		__BITFIELD_FIELD(u32 xactpos			: 2,
-		__BITFIELD_FIELD(u32 hubaddr			: 7,
-		__BITFIELD_FIELD(u32 prtaddr			: 7,
-		;))))))
-	} s;
-};
-
-/**
- * cvmx_usbc#_hctsiz#
- *
- * Host Channel-n Transfer Size Register (HCTSIZ)
- *
- */
-union cvmx_usbcx_hctsizx {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_hctsizx_s
-	 * @dopng: Do Ping (DoPng)
-	 *	Setting this field to 1 directs the host to do PING protocol.
-	 * @pid: PID (Pid)
-	 *	The application programs this field with the type of PID to use
-	 *	for the initial transaction. The host will maintain this field
-	 *	for the rest of the transfer.
-	 *	* 2'b00: DATA0
-	 *	* 2'b01: DATA2
-	 *	* 2'b10: DATA1
-	 *	* 2'b11: MDATA (non-control)/SETUP (control)
-	 * @pktcnt: Packet Count (PktCnt)
-	 *	This field is programmed by the application with the expected
-	 *	number of packets to be transmitted (OUT) or received (IN).
-	 *	The host decrements this count on every successful
-	 *	transmission or reception of an OUT/IN packet. Once this count
-	 *	reaches zero, the application is interrupted to indicate normal
-	 *	completion.
-	 * @xfersize: Transfer Size (XferSize)
-	 *	For an OUT, this field is the number of data bytes the host will
-	 *	send during the transfer.
-	 *	For an IN, this field is the buffer size that the application
-	 *	has reserved for the transfer. The application is expected to
-	 *	program this field as an integer multiple of the maximum packet
-	 *	size for IN transactions (periodic and non-periodic).
-	 */
-	struct cvmx_usbcx_hctsizx_s {
-		__BITFIELD_FIELD(u32 dopng		: 1,
-		__BITFIELD_FIELD(u32 pid		: 2,
-		__BITFIELD_FIELD(u32 pktcnt		: 10,
-		__BITFIELD_FIELD(u32 xfersize		: 19,
-		;))))
-	} s;
-};
-
-/**
- * cvmx_usbc#_hfir
- *
- * Host Frame Interval Register (HFIR)
- *
- * This register stores the frame interval information for the current speed to
- * which the O2P USB core has enumerated.
- */
-union cvmx_usbcx_hfir {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_hfir_s
-	 * @frint: Frame Interval (FrInt)
-	 *	The value that the application programs to this field specifies
-	 *	the interval between two consecutive SOFs (FS) or micro-
-	 *	SOFs (HS) or Keep-Alive tokens (HS). This field contains the
-	 *	number of PHY clocks that constitute the required frame
-	 *	interval. The default value set in this field for a FS operation
-	 *	when the PHY clock frequency is 60 MHz. The application can
-	 *	write a value to this register only after the Port Enable bit of
-	 *	the Host Port Control and Status register (HPRT.PrtEnaPort)
-	 *	has been set. If no value is programmed, the core calculates
-	 *	the value based on the PHY clock specified in the FS/LS PHY
-	 *	Clock Select field of the Host Configuration register
-	 *	(HCFG.FSLSPclkSel). Do not change the value of this field
-	 *	after the initial configuration.
-	 *	* 125 us (PHY clock frequency for HS)
-	 *	* 1 ms (PHY clock frequency for FS/LS)
-	 */
-	struct cvmx_usbcx_hfir_s {
-		__BITFIELD_FIELD(u32 reserved_16_31		: 16,
-		__BITFIELD_FIELD(u32 frint			: 16,
-		;))
-	} s;
-};
-
-/**
- * cvmx_usbc#_hfnum
- *
- * Host Frame Number/Frame Time Remaining Register (HFNUM)
- *
- * This register indicates the current frame number.
- * It also indicates the time remaining (in terms of the number of PHY clocks)
- * in the current (micro)frame.
- */
-union cvmx_usbcx_hfnum {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_hfnum_s
-	 * @frrem: Frame Time Remaining (FrRem)
-	 *	Indicates the amount of time remaining in the current
-	 *	microframe (HS) or frame (FS/LS), in terms of PHY clocks.
-	 *	This field decrements on each PHY clock. When it reaches
-	 *	zero, this field is reloaded with the value in the Frame
-	 *	Interval register and a new SOF is transmitted on the USB.
-	 * @frnum: Frame Number (FrNum)
-	 *	This field increments when a new SOF is transmitted on the
-	 *	USB, and is reset to 0 when it reaches 16'h3FFF.
-	 */
-	struct cvmx_usbcx_hfnum_s {
-		__BITFIELD_FIELD(u32 frrem		: 16,
-		__BITFIELD_FIELD(u32 frnum		: 16,
-		;))
-	} s;
-};
-
-/**
- * cvmx_usbc#_hprt
- *
- * Host Port Control and Status Register (HPRT)
- *
- * This register is available in both Host and Device modes.
- * Currently, the OTG Host supports only one port.
- * A single register holds USB port-related information such as USB reset,
- * enable, suspend, resume, connect status, and test mode for each port. The
- * R_SS_WC bits in this register can trigger an interrupt to the application
- * through the Host Port Interrupt bit of the Core Interrupt register
- * (GINTSTS.PrtInt). On a Port Interrupt, the application must read this
- * register and clear the bit that caused the interrupt. For the R_SS_WC bits,
- * the application must write a 1 to the bit to clear the interrupt.
- */
-union cvmx_usbcx_hprt {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_hprt_s
-	 * @prtspd: Port Speed (PrtSpd)
-	 *	Indicates the speed of the device attached to this port.
-	 *	* 2'b00: High speed
-	 *	* 2'b01: Full speed
-	 *	* 2'b10: Low speed
-	 *	* 2'b11: Reserved
-	 * @prttstctl: Port Test Control (PrtTstCtl)
-	 *	The application writes a nonzero value to this field to put
-	 *	the port into a Test mode, and the corresponding pattern is
-	 *	signaled on the port.
-	 *	* 4'b0000: Test mode disabled
-	 *	* 4'b0001: Test_J mode
-	 *	* 4'b0010: Test_K mode
-	 *	* 4'b0011: Test_SE0_NAK mode
-	 *	* 4'b0100: Test_Packet mode
-	 *	* 4'b0101: Test_Force_Enable
-	 *	* Others: Reserved
-	 *	PrtSpd must be zero (i.e. the interface must be in high-speed
-	 *	mode) to use the PrtTstCtl test modes.
-	 * @prtpwr: Port Power (PrtPwr)
-	 *	The application uses this field to control power to this port,
-	 *	and the core clears this bit on an overcurrent condition.
-	 *	* 1'b0: Power off
-	 *	* 1'b1: Power on
-	 * @prtlnsts: Port Line Status (PrtLnSts)
-	 *	Indicates the current logic level USB data lines
-	 *	* Bit [10]: Logic level of D-
-	 *	* Bit [11]: Logic level of D+
-	 * @prtrst: Port Reset (PrtRst)
-	 *	When the application sets this bit, a reset sequence is
-	 *	started on this port. The application must time the reset
-	 *	period and clear this bit after the reset sequence is
-	 *	complete.
-	 *	* 1'b0: Port not in reset
-	 *	* 1'b1: Port in reset
-	 *	The application must leave this bit set for at least a
-	 *	minimum duration mentioned below to start a reset on the
-	 *	port. The application can leave it set for another 10 ms in
-	 *	addition to the required minimum duration, before clearing
-	 *	the bit, even though there is no maximum limit set by the
-	 *	USB standard.
-	 *	* High speed: 50 ms
-	 *	* Full speed/Low speed: 10 ms
-	 * @prtsusp: Port Suspend (PrtSusp)
-	 *	The application sets this bit to put this port in Suspend
-	 *	mode. The core only stops sending SOFs when this is set.
-	 *	To stop the PHY clock, the application must set the Port
-	 *	Clock Stop bit, which will assert the suspend input pin of
-	 *	the PHY.
-	 *	The read value of this bit reflects the current suspend
-	 *	status of the port. This bit is cleared by the core after a
-	 *	remote wakeup signal is detected or the application sets
-	 *	the Port Reset bit or Port Resume bit in this register or the
-	 *	Resume/Remote Wakeup Detected Interrupt bit or
-	 *	Disconnect Detected Interrupt bit in the Core Interrupt
-	 *	register (GINTSTS.WkUpInt or GINTSTS.DisconnInt,
-	 *	respectively).
-	 *	* 1'b0: Port not in Suspend mode
-	 *	* 1'b1: Port in Suspend mode
-	 * @prtres: Port Resume (PrtRes)
-	 *	The application sets this bit to drive resume signaling on
-	 *	the port. The core continues to drive the resume signal
-	 *	until the application clears this bit.
-	 *	If the core detects a USB remote wakeup sequence, as
-	 *	indicated by the Port Resume/Remote Wakeup Detected
-	 *	Interrupt bit of the Core Interrupt register
-	 *	(GINTSTS.WkUpInt), the core starts driving resume
-	 *	signaling without application intervention and clears this bit
-	 *	when it detects a disconnect condition. The read value of
-	 *	this bit indicates whether the core is currently driving
-	 *	resume signaling.
-	 *	* 1'b0: No resume driven
-	 *	* 1'b1: Resume driven
-	 * @prtovrcurrchng: Port Overcurrent Change (PrtOvrCurrChng)
-	 *	The core sets this bit when the status of the Port
-	 *	Overcurrent Active bit (bit 4) in this register changes.
-	 * @prtovrcurract: Port Overcurrent Active (PrtOvrCurrAct)
-	 *	Indicates the overcurrent condition of the port.
-	 *	* 1'b0: No overcurrent condition
-	 *	* 1'b1: Overcurrent condition
-	 * @prtenchng: Port Enable/Disable Change (PrtEnChng)
-	 *	The core sets this bit when the status of the Port Enable bit
-	 *	[2] of this register changes.
-	 * @prtena: Port Enable (PrtEna)
-	 *	A port is enabled only by the core after a reset sequence,
-	 *	and is disabled by an overcurrent condition, a disconnect
-	 *	condition, or by the application clearing this bit. The
-	 *	application cannot set this bit by a register write. It can only
-	 *	clear it to disable the port. This bit does not trigger any
-	 *	interrupt to the application.
-	 *	* 1'b0: Port disabled
-	 *	* 1'b1: Port enabled
-	 * @prtconndet: Port Connect Detected (PrtConnDet)
-	 *	The core sets this bit when a device connection is detected
-	 *	to trigger an interrupt to the application using the Host Port
-	 *	Interrupt bit of the Core Interrupt register (GINTSTS.PrtInt).
-	 *	The application must write a 1 to this bit to clear the
-	 *	interrupt.
-	 * @prtconnsts: Port Connect Status (PrtConnSts)
-	 *	* 0: No device is attached to the port.
-	 *	* 1: A device is attached to the port.
-	 */
-	struct cvmx_usbcx_hprt_s {
-		__BITFIELD_FIELD(u32 reserved_19_31	: 13,
-		__BITFIELD_FIELD(u32 prtspd		: 2,
-		__BITFIELD_FIELD(u32 prttstctl		: 4,
-		__BITFIELD_FIELD(u32 prtpwr		: 1,
-		__BITFIELD_FIELD(u32 prtlnsts		: 2,
-		__BITFIELD_FIELD(u32 reserved_9_9	: 1,
-		__BITFIELD_FIELD(u32 prtrst		: 1,
-		__BITFIELD_FIELD(u32 prtsusp		: 1,
-		__BITFIELD_FIELD(u32 prtres		: 1,
-		__BITFIELD_FIELD(u32 prtovrcurrchng	: 1,
-		__BITFIELD_FIELD(u32 prtovrcurract	: 1,
-		__BITFIELD_FIELD(u32 prtenchng		: 1,
-		__BITFIELD_FIELD(u32 prtena		: 1,
-		__BITFIELD_FIELD(u32 prtconndet		: 1,
-		__BITFIELD_FIELD(u32 prtconnsts		: 1,
-		;)))))))))))))))
-	} s;
-};
-
-/**
- * cvmx_usbc#_hptxfsiz
- *
- * Host Periodic Transmit FIFO Size Register (HPTXFSIZ)
- *
- * This register holds the size and the memory start address of the Periodic
- * TxFIFO, as shown in Figures 310 and 311.
- */
-union cvmx_usbcx_hptxfsiz {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_hptxfsiz_s
-	 * @ptxfsize: Host Periodic TxFIFO Depth (PTxFSize)
-	 *	This value is in terms of 32-bit words.
-	 *	* Minimum value is 16
-	 *	* Maximum value is 32768
-	 * @ptxfstaddr: Host Periodic TxFIFO Start Address (PTxFStAddr)
-	 */
-	struct cvmx_usbcx_hptxfsiz_s {
-		__BITFIELD_FIELD(u32 ptxfsize	: 16,
-		__BITFIELD_FIELD(u32 ptxfstaddr	: 16,
-		;))
-	} s;
-};
-
-/**
- * cvmx_usbc#_hptxsts
- *
- * Host Periodic Transmit FIFO/Queue Status Register (HPTXSTS)
- *
- * This read-only register contains the free space information for the Periodic
- * TxFIFO and the Periodic Transmit Request Queue
- */
-union cvmx_usbcx_hptxsts {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_hptxsts_s
-	 * @ptxqtop: Top of the Periodic Transmit Request Queue (PTxQTop)
-	 *	This indicates the entry in the Periodic Tx Request Queue that
-	 *	is currently being processes by the MAC.
-	 *	This register is used for debugging.
-	 *	* Bit [31]: Odd/Even (micro)frame
-	 *	- 1'b0: send in even (micro)frame
-	 *	- 1'b1: send in odd (micro)frame
-	 *	* Bits [30:27]: Channel/endpoint number
-	 *	* Bits [26:25]: Type
-	 *	- 2'b00: IN/OUT
-	 *	- 2'b01: Zero-length packet
-	 *	- 2'b10: CSPLIT
-	 *	- 2'b11: Disable channel command
-	 *	* Bit [24]: Terminate (last entry for the selected
-	 *	channel/endpoint)
-	 * @ptxqspcavail: Periodic Transmit Request Queue Space Available
-	 *	(PTxQSpcAvail)
-	 *	Indicates the number of free locations available to be written
-	 *	in the Periodic Transmit Request Queue. This queue holds both
-	 *	IN and OUT requests.
-	 *	* 8'h0: Periodic Transmit Request Queue is full
-	 *	* 8'h1: 1 location available
-	 *	* 8'h2: 2 locations available
-	 *	* n: n locations available (0..8)
-	 *	* Others: Reserved
-	 * @ptxfspcavail: Periodic Transmit Data FIFO Space Available
-	 *		  (PTxFSpcAvail)
-	 *	Indicates the number of free locations available to be written
-	 *	to in the Periodic TxFIFO.
-	 *	Values are in terms of 32-bit words
-	 *	* 16'h0: Periodic TxFIFO is full
-	 *	* 16'h1: 1 word available
-	 *	* 16'h2: 2 words available
-	 *	* 16'hn: n words available (where 0..32768)
-	 *	* 16'h8000: 32768 words available
-	 *	* Others: Reserved
-	 */
-	struct cvmx_usbcx_hptxsts_s {
-		__BITFIELD_FIELD(u32 ptxqtop		: 8,
-		__BITFIELD_FIELD(u32 ptxqspcavail	: 8,
-		__BITFIELD_FIELD(u32 ptxfspcavail	: 16,
-		;)))
-	} s;
-};
-
-/**
- * cvmx_usbn#_clk_ctl
- *
- * USBN_CLK_CTL = USBN's Clock Control
- *
- * This register is used to control the frequency of the hclk and the
- * hreset and phy_rst signals.
- */
-union cvmx_usbnx_clk_ctl {
-	u64 u64;
-	/**
-	 * struct cvmx_usbnx_clk_ctl_s
-	 * @divide2: The 'hclk' used by the USB subsystem is derived
-	 *	from the eclk.
-	 *	Also see the field DIVIDE. DIVIDE2<1> must currently
-	 *	be zero because it is not implemented, so the maximum
-	 *	ratio of eclk/hclk is currently 16.
-	 *	The actual divide number for hclk is:
-	 *	(DIVIDE2 + 1) * (DIVIDE + 1)
-	 * @hclk_rst: When this field is '0' the HCLK-DIVIDER used to
-	 *	generate the hclk in the USB Subsystem is held
-	 *	in reset. This bit must be set to '0' before
-	 *	changing the value os DIVIDE in this register.
-	 *	The reset to the HCLK_DIVIDERis also asserted
-	 *	when core reset is asserted.
-	 * @p_x_on: Force USB-PHY on during suspend.
-	 *	'1' USB-PHY XO block is powered-down during
-	 *	suspend.
-	 *	'0' USB-PHY XO block is powered-up during
-	 *	suspend.
-	 *	The value of this field must be set while POR is
-	 *	active.
-	 * @p_rtype: PHY reference clock type
-	 *	On CN50XX/CN52XX/CN56XX the values are:
-	 *		'0' The USB-PHY uses a 12MHz crystal as a clock source
-	 *		    at the USB_XO and USB_XI pins.
-	 *		'1' Reserved.
-	 *		'2' The USB_PHY uses 12/24/48MHz 2.5V board clock at the
-	 *		    USB_XO pin. USB_XI should be tied to ground in this
-	 *		    case.
-	 *		'3' Reserved.
-	 *	On CN3xxx bits 14 and 15 are p_xenbn and p_rclk and values are:
-	 *		'0' Reserved.
-	 *		'1' Reserved.
-	 *		'2' The PHY PLL uses the XO block output as a reference.
-	 *		    The XO block uses an external clock supplied on the
-	 *		    XO pin. USB_XI should be tied to ground for this
-	 *		    usage.
-	 *		'3' The XO block uses the clock from a crystal.
-	 * @p_com_on: '0' Force USB-PHY XO Bias, Bandgap and PLL to
-	 *	remain powered in Suspend Mode.
-	 *	'1' The USB-PHY XO Bias, Bandgap and PLL are
-	 *	powered down in suspend mode.
-	 *	The value of this field must be set while POR is
-	 *	active.
-	 * @p_c_sel: Phy clock speed select.
-	 *	Selects the reference clock / crystal frequency.
-	 *	'11': Reserved
-	 *	'10': 48 MHz (reserved when a crystal is used)
-	 *	'01': 24 MHz (reserved when a crystal is used)
-	 *	'00': 12 MHz
-	 *	The value of this field must be set while POR is
-	 *	active.
-	 *	NOTE: if a crystal is used as a reference clock,
-	 *	this field must be set to 12 MHz.
-	 * @cdiv_byp: Used to enable the bypass input to the USB_CLK_DIV.
-	 * @sd_mode: Scaledown mode for the USBC. Control timing events
-	 *	in the USBC, for normal operation this must be '0'.
-	 * @s_bist: Starts bist on the hclk memories, during the '0'
-	 *	to '1' transition.
-	 * @por: Power On Reset for the PHY.
-	 *	Resets all the PHYS registers and state machines.
-	 * @enable: When '1' allows the generation of the hclk. When
-	 *	'0' the hclk will not be generated. SEE DIVIDE
-	 *	field of this register.
-	 * @prst: When this field is '0' the reset associated with
-	 *	the phy_clk functionality in the USB Subsystem is
-	 *	help in reset. This bit should not be set to '1'
-	 *	until the time it takes 6 clocks (hclk or phy_clk,
-	 *	whichever is slower) has passed. Under normal
-	 *	operation once this bit is set to '1' it should not
-	 *	be set to '0'.
-	 * @hrst: When this field is '0' the reset associated with
-	 *	the hclk functioanlity in the USB Subsystem is
-	 *	held in reset.This bit should not be set to '1'
-	 *	until 12ms after phy_clk is stable. Under normal
-	 *	operation, once this bit is set to '1' it should
-	 *	not be set to '0'.
-	 * @divide: The frequency of 'hclk' used by the USB subsystem
-	 *	is the eclk frequency divided by the value of
-	 *	(DIVIDE2 + 1) * (DIVIDE + 1), also see the field
-	 *	DIVIDE2 of this register.
-	 *	The hclk frequency should be less than 125Mhz.
-	 *	After writing a value to this field the SW should
-	 *	read the field for the value written.
-	 *	The ENABLE field of this register should not be set
-	 *	until AFTER this field is set and then read.
-	 */
-	struct cvmx_usbnx_clk_ctl_s {
-		__BITFIELD_FIELD(u64 reserved_20_63	: 44,
-		__BITFIELD_FIELD(u64 divide2		: 2,
-		__BITFIELD_FIELD(u64 hclk_rst		: 1,
-		__BITFIELD_FIELD(u64 p_x_on		: 1,
-		__BITFIELD_FIELD(u64 p_rtype		: 2,
-		__BITFIELD_FIELD(u64 p_com_on		: 1,
-		__BITFIELD_FIELD(u64 p_c_sel		: 2,
-		__BITFIELD_FIELD(u64 cdiv_byp		: 1,
-		__BITFIELD_FIELD(u64 sd_mode		: 2,
-		__BITFIELD_FIELD(u64 s_bist		: 1,
-		__BITFIELD_FIELD(u64 por		: 1,
-		__BITFIELD_FIELD(u64 enable		: 1,
-		__BITFIELD_FIELD(u64 prst		: 1,
-		__BITFIELD_FIELD(u64 hrst		: 1,
-		__BITFIELD_FIELD(u64 divide		: 3,
-		;)))))))))))))))
-	} s;
-};
-
-/**
- * cvmx_usbn#_usbp_ctl_status
- *
- * USBN_USBP_CTL_STATUS = USBP Control And Status Register
- *
- * Contains general control and status information for the USBN block.
- */
-union cvmx_usbnx_usbp_ctl_status {
-	u64 u64;
-	/**
-	 * struct cvmx_usbnx_usbp_ctl_status_s
-	 * @txrisetune: HS Transmitter Rise/Fall Time Adjustment
-	 * @txvreftune: HS DC Voltage Level Adjustment
-	 * @txfslstune: FS/LS Source Impedance Adjustment
-	 * @txhsxvtune: Transmitter High-Speed Crossover Adjustment
-	 * @sqrxtune: Squelch Threshold Adjustment
-	 * @compdistune: Disconnect Threshold Adjustment
-	 * @otgtune: VBUS Valid Threshold Adjustment
-	 * @otgdisable: OTG Block Disable
-	 * @portreset: Per_Port Reset
-	 * @drvvbus: Drive VBUS
-	 * @lsbist: Low-Speed BIST Enable.
-	 * @fsbist: Full-Speed BIST Enable.
-	 * @hsbist: High-Speed BIST Enable.
-	 * @bist_done: PHY Bist Done.
-	 *	Asserted at the end of the PHY BIST sequence.
-	 * @bist_err: PHY Bist Error.
-	 *	Indicates an internal error was detected during
-	 *	the BIST sequence.
-	 * @tdata_out: PHY Test Data Out.
-	 *	Presents either internally generated signals or
-	 *	test register contents, based upon the value of
-	 *	test_data_out_sel.
-	 * @siddq: Drives the USBP (USB-PHY) SIDDQ input.
-	 *	Normally should be set to zero.
-	 *	When customers have no intent to use USB PHY
-	 *	interface, they should:
-	 *	- still provide 3.3V to USB_VDD33, and
-	 *	- tie USB_REXT to 3.3V supply, and
-	 *	- set USBN*_USBP_CTL_STATUS[SIDDQ]=1
-	 * @txpreemphasistune: HS Transmitter Pre-Emphasis Enable
-	 * @dma_bmode: When set to 1 the L2C DMA address will be updated
-	 *	with byte-counts between packets. When set to 0
-	 *	the L2C DMA address is incremented to the next
-	 *	4-byte aligned address after adding byte-count.
-	 * @usbc_end: Bigendian input to the USB Core. This should be
-	 *	set to '0' for operation.
-	 * @usbp_bist: PHY, This is cleared '0' to run BIST on the USBP.
-	 * @tclk: PHY Test Clock, used to load TDATA_IN to the USBP.
-	 * @dp_pulld: PHY DP_PULLDOWN input to the USB-PHY.
-	 *	This signal enables the pull-down resistance on
-	 *	the D+ line. '1' pull down-resistance is connected
-	 *	to D+/ '0' pull down resistance is not connected
-	 *	to D+. When an A/B device is acting as a host
-	 *	(downstream-facing port), dp_pulldown and
-	 *	dm_pulldown are enabled. This must not toggle
-	 *	during normal operation.
-	 * @dm_pulld: PHY DM_PULLDOWN input to the USB-PHY.
-	 *	This signal enables the pull-down resistance on
-	 *	the D- line. '1' pull down-resistance is connected
-	 *	to D-. '0' pull down resistance is not connected
-	 *	to D-. When an A/B device is acting as a host
-	 *	(downstream-facing port), dp_pulldown and
-	 *	dm_pulldown are enabled. This must not toggle
-	 *	during normal operation.
-	 * @hst_mode: When '0' the USB is acting as HOST, when '1'
-	 *	USB is acting as device. This field needs to be
-	 *	set while the USB is in reset.
-	 * @tuning: Transmitter Tuning for High-Speed Operation.
-	 *	Tunes the current supply and rise/fall output
-	 *	times for high-speed operation.
-	 *	[20:19] == 11: Current supply increased
-	 *	approximately 9%
-	 *	[20:19] == 10: Current supply increased
-	 *	approximately 4.5%
-	 *	[20:19] == 01: Design default.
-	 *	[20:19] == 00: Current supply decreased
-	 *	approximately 4.5%
-	 *	[22:21] == 11: Rise and fall times are increased.
-	 *	[22:21] == 10: Design default.
-	 *	[22:21] == 01: Rise and fall times are decreased.
-	 *	[22:21] == 00: Rise and fall times are decreased
-	 *	further as compared to the 01 setting.
-	 * @tx_bs_enh: Transmit Bit Stuffing on [15:8].
-	 *	Enables or disables bit stuffing on data[15:8]
-	 *	when bit-stuffing is enabled.
-	 * @tx_bs_en: Transmit Bit Stuffing on [7:0].
-	 *	Enables or disables bit stuffing on data[7:0]
-	 *	when bit-stuffing is enabled.
-	 * @loop_enb: PHY Loopback Test Enable.
-	 *	'1': During data transmission the receive is
-	 *	enabled.
-	 *	'0': During data transmission the receive is
-	 *	disabled.
-	 *	Must be '0' for normal operation.
-	 * @vtest_enb: Analog Test Pin Enable.
-	 *	'1' The PHY's analog_test pin is enabled for the
-	 *	input and output of applicable analog test signals.
-	 *	'0' THe analog_test pin is disabled.
-	 * @bist_enb: Built-In Self Test Enable.
-	 *	Used to activate BIST in the PHY.
-	 * @tdata_sel: Test Data Out Select.
-	 *	'1' test_data_out[3:0] (PHY) register contents
-	 *	are output. '0' internally generated signals are
-	 *	output.
-	 * @taddr_in: Mode Address for Test Interface.
-	 *	Specifies the register address for writing to or
-	 *	reading from the PHY test interface register.
-	 * @tdata_in: Internal Testing Register Input Data and Select
-	 *	This is a test bus. Data is present on [3:0],
-	 *	and its corresponding select (enable) is present
-	 *	on bits [7:4].
-	 * @ate_reset: Reset input from automatic test equipment.
-	 *	This is a test signal. When the USB Core is
-	 *	powered up (not in Susned Mode), an automatic
-	 *	tester can use this to disable phy_clock and
-	 *	free_clk, then re-enable them with an aligned
-	 *	phase.
-	 *	'1': The phy_clk and free_clk outputs are
-	 *	disabled. "0": The phy_clock and free_clk outputs
-	 *	are available within a specific period after the
-	 *	de-assertion.
-	 */
-	struct cvmx_usbnx_usbp_ctl_status_s {
-		__BITFIELD_FIELD(u64 txrisetune		: 1,
-		__BITFIELD_FIELD(u64 txvreftune		: 4,
-		__BITFIELD_FIELD(u64 txfslstune		: 4,
-		__BITFIELD_FIELD(u64 txhsxvtune		: 2,
-		__BITFIELD_FIELD(u64 sqrxtune		: 3,
-		__BITFIELD_FIELD(u64 compdistune	: 3,
-		__BITFIELD_FIELD(u64 otgtune		: 3,
-		__BITFIELD_FIELD(u64 otgdisable		: 1,
-		__BITFIELD_FIELD(u64 portreset		: 1,
-		__BITFIELD_FIELD(u64 drvvbus		: 1,
-		__BITFIELD_FIELD(u64 lsbist		: 1,
-		__BITFIELD_FIELD(u64 fsbist		: 1,
-		__BITFIELD_FIELD(u64 hsbist		: 1,
-		__BITFIELD_FIELD(u64 bist_done		: 1,
-		__BITFIELD_FIELD(u64 bist_err		: 1,
-		__BITFIELD_FIELD(u64 tdata_out		: 4,
-		__BITFIELD_FIELD(u64 siddq		: 1,
-		__BITFIELD_FIELD(u64 txpreemphasistune	: 1,
-		__BITFIELD_FIELD(u64 dma_bmode		: 1,
-		__BITFIELD_FIELD(u64 usbc_end		: 1,
-		__BITFIELD_FIELD(u64 usbp_bist		: 1,
-		__BITFIELD_FIELD(u64 tclk		: 1,
-		__BITFIELD_FIELD(u64 dp_pulld		: 1,
-		__BITFIELD_FIELD(u64 dm_pulld		: 1,
-		__BITFIELD_FIELD(u64 hst_mode		: 1,
-		__BITFIELD_FIELD(u64 tuning		: 4,
-		__BITFIELD_FIELD(u64 tx_bs_enh		: 1,
-		__BITFIELD_FIELD(u64 tx_bs_en		: 1,
-		__BITFIELD_FIELD(u64 loop_enb		: 1,
-		__BITFIELD_FIELD(u64 vtest_enb		: 1,
-		__BITFIELD_FIELD(u64 bist_enb		: 1,
-		__BITFIELD_FIELD(u64 tdata_sel		: 1,
-		__BITFIELD_FIELD(u64 taddr_in		: 4,
-		__BITFIELD_FIELD(u64 tdata_in		: 8,
-		__BITFIELD_FIELD(u64 ate_reset		: 1,
-		;)))))))))))))))))))))))))))))))))))
-	} s;
-};
-
-#endif /* __OCTEON_HCD_H__ */
-- 
2.24.0


^ permalink raw reply related	[flat|nested] 59+ messages in thread

* [PATCH 2/2] staging: octeon-usb: delete the octeon usb host controller driver
@ 2019-12-10  9:15   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 59+ messages in thread
From: Greg Kroah-Hartman @ 2019-12-10  9:15 UTC (permalink / raw)
  To: devel
  Cc: David Daney, Sumit Pundir, Aaro Koskinen, Greg Kroah-Hartman,
	linux-kernel, Nishka Dasgupta, Frank A. Cancio Bello,
	Laura Lazzati

This driver was merged back in 2013 and shows no progress toward every
being merged into the "correct" part of the kernel.  The code doesn't
even build for anyone unless you have the specific hardware platform
selected, so odds are it doesn't even work anymore.

Remove it for now and is someone comes along that has the hardware and
is willing to fix it up, it can be reverted.

Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: David Daney <ddaney.cavm@gmail.com>
Cc: Nishka Dasgupta <nishkadg.linux@gmail.com>
Cc: Himadri Pandya <himadri18.07@gmail.com>
Cc: "Frank A. Cancio Bello" <frank@generalsoftwareinc.com>
Cc: Sumit Pundir <pundirsumit11@gmail.com>
Cc: Laura Lazzati <laura.lazzati.15@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/staging/Kconfig                 |    2 -
 drivers/staging/Makefile                |    1 -
 drivers/staging/octeon-usb/Kconfig      |   11 -
 drivers/staging/octeon-usb/Makefile     |    2 -
 drivers/staging/octeon-usb/TODO         |    8 -
 drivers/staging/octeon-usb/octeon-hcd.c | 3737 -----------------------
 drivers/staging/octeon-usb/octeon-hcd.h | 1847 -----------
 7 files changed, 5608 deletions(-)
 delete mode 100644 drivers/staging/octeon-usb/Kconfig
 delete mode 100644 drivers/staging/octeon-usb/Makefile
 delete mode 100644 drivers/staging/octeon-usb/TODO
 delete mode 100644 drivers/staging/octeon-usb/octeon-hcd.c
 delete mode 100644 drivers/staging/octeon-usb/octeon-hcd.h

diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
index 15d3549e7cc7..198bf59bc1e6 100644
--- a/drivers/staging/Kconfig
+++ b/drivers/staging/Kconfig
@@ -42,8 +42,6 @@ source "drivers/staging/rtl8188eu/Kconfig"
 
 source "drivers/staging/rts5208/Kconfig"
 
-source "drivers/staging/octeon-usb/Kconfig"
-
 source "drivers/staging/vt6655/Kconfig"
 
 source "drivers/staging/vt6656/Kconfig"
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
index c521204220b5..bf230a830338 100644
--- a/drivers/staging/Makefile
+++ b/drivers/staging/Makefile
@@ -12,7 +12,6 @@ obj-$(CONFIG_R8712U)		+= rtl8712/
 obj-$(CONFIG_R8188EU)		+= rtl8188eu/
 obj-$(CONFIG_RTS5208)		+= rts5208/
 obj-$(CONFIG_NETLOGIC_XLR_NET)	+= netlogic/
-obj-$(CONFIG_OCTEON_USB)	+= octeon-usb/
 obj-$(CONFIG_VT6655)		+= vt6655/
 obj-$(CONFIG_VT6656)		+= vt6656/
 obj-$(CONFIG_VME_BUS)		+= vme/
diff --git a/drivers/staging/octeon-usb/Kconfig b/drivers/staging/octeon-usb/Kconfig
deleted file mode 100644
index 6a5d842ee0f2..000000000000
--- a/drivers/staging/octeon-usb/Kconfig
+++ /dev/null
@@ -1,11 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-config OCTEON_USB
-	tristate "Cavium Networks Octeon USB support"
-	depends on CAVIUM_OCTEON_SOC && USB
-	help
-	  This driver supports USB host controller on some Cavium
-	  Networks' products in the Octeon family.
-
-	  To compile this driver as a module, choose M here. The module
-	  will be called octeon-hcd.
-
diff --git a/drivers/staging/octeon-usb/Makefile b/drivers/staging/octeon-usb/Makefile
deleted file mode 100644
index 9873a0130ad5..000000000000
--- a/drivers/staging/octeon-usb/Makefile
+++ /dev/null
@@ -1,2 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-obj-${CONFIG_OCTEON_USB} := octeon-hcd.o
diff --git a/drivers/staging/octeon-usb/TODO b/drivers/staging/octeon-usb/TODO
deleted file mode 100644
index 2b29acca5caa..000000000000
--- a/drivers/staging/octeon-usb/TODO
+++ /dev/null
@@ -1,8 +0,0 @@
-This driver is functional and has been tested on EdgeRouter Lite,
-D-Link DSR-1000N and EBH5600 evaluation board with USB mass storage.
-
-TODO:
-	- kernel coding style
-	- checkpatch warnings
-
-Contact: Aaro Koskinen <aaro.koskinen@iki.fi>
diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c
deleted file mode 100644
index 582c9187559d..000000000000
--- a/drivers/staging/octeon-usb/octeon-hcd.c
+++ /dev/null
@@ -1,3737 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 2008 Cavium Networks
- *
- * Some parts of the code were originally released under BSD license:
- *
- * Copyright (c) 2003-2010 Cavium Networks (support@cavium.com). All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *   * Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *
- *   * Redistributions in binary form must reproduce the above
- *     copyright notice, this list of conditions and the following
- *     disclaimer in the documentation and/or other materials provided
- *     with the distribution.
- *
- *   * Neither the name of Cavium Networks nor the names of
- *     its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written
- *     permission.
- *
- * This Software, including technical data, may be subject to U.S. export
- * control laws, including the U.S. Export Administration Act and its associated
- * regulations, and may be subject to export or import regulations in other
- * countries.
- *
- * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
- * AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR
- * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
- * THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION
- * OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
- * SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
- * MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
- * VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
- * CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
- * PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
- */
-
-#include <linux/usb.h>
-#include <linux/slab.h>
-#include <linux/module.h>
-#include <linux/usb/hcd.h>
-#include <linux/prefetch.h>
-#include <linux/dma-mapping.h>
-#include <linux/platform_device.h>
-
-#include <asm/octeon/octeon.h>
-
-#include "octeon-hcd.h"
-
-/**
- * enum cvmx_usb_speed - the possible USB device speeds
- *
- * @CVMX_USB_SPEED_HIGH: Device is operation at 480Mbps
- * @CVMX_USB_SPEED_FULL: Device is operation at 12Mbps
- * @CVMX_USB_SPEED_LOW:  Device is operation at 1.5Mbps
- */
-enum cvmx_usb_speed {
-	CVMX_USB_SPEED_HIGH = 0,
-	CVMX_USB_SPEED_FULL = 1,
-	CVMX_USB_SPEED_LOW = 2,
-};
-
-/**
- * enum cvmx_usb_transfer - the possible USB transfer types
- *
- * @CVMX_USB_TRANSFER_CONTROL:	   USB transfer type control for hub and status
- *				   transfers
- * @CVMX_USB_TRANSFER_ISOCHRONOUS: USB transfer type isochronous for low
- *				   priority periodic transfers
- * @CVMX_USB_TRANSFER_BULK:	   USB transfer type bulk for large low priority
- *				   transfers
- * @CVMX_USB_TRANSFER_INTERRUPT:   USB transfer type interrupt for high priority
- *				   periodic transfers
- */
-enum cvmx_usb_transfer {
-	CVMX_USB_TRANSFER_CONTROL = 0,
-	CVMX_USB_TRANSFER_ISOCHRONOUS = 1,
-	CVMX_USB_TRANSFER_BULK = 2,
-	CVMX_USB_TRANSFER_INTERRUPT = 3,
-};
-
-/**
- * enum cvmx_usb_direction - the transfer directions
- *
- * @CVMX_USB_DIRECTION_OUT: Data is transferring from Octeon to the device/host
- * @CVMX_USB_DIRECTION_IN:  Data is transferring from the device/host to Octeon
- */
-enum cvmx_usb_direction {
-	CVMX_USB_DIRECTION_OUT,
-	CVMX_USB_DIRECTION_IN,
-};
-
-/**
- * enum cvmx_usb_status - possible callback function status codes
- *
- * @CVMX_USB_STATUS_OK:		  The transaction / operation finished without
- *				  any errors
- * @CVMX_USB_STATUS_SHORT:	  FIXME: This is currently not implemented
- * @CVMX_USB_STATUS_CANCEL:	  The transaction was canceled while in flight
- *				  by a user call to cvmx_usb_cancel
- * @CVMX_USB_STATUS_ERROR:	  The transaction aborted with an unexpected
- *				  error status
- * @CVMX_USB_STATUS_STALL:	  The transaction received a USB STALL response
- *				  from the device
- * @CVMX_USB_STATUS_XACTERR:	  The transaction failed with an error from the
- *				  device even after a number of retries
- * @CVMX_USB_STATUS_DATATGLERR:	  The transaction failed with a data toggle
- *				  error even after a number of retries
- * @CVMX_USB_STATUS_BABBLEERR:	  The transaction failed with a babble error
- * @CVMX_USB_STATUS_FRAMEERR:	  The transaction failed with a frame error
- *				  even after a number of retries
- */
-enum cvmx_usb_status {
-	CVMX_USB_STATUS_OK,
-	CVMX_USB_STATUS_SHORT,
-	CVMX_USB_STATUS_CANCEL,
-	CVMX_USB_STATUS_ERROR,
-	CVMX_USB_STATUS_STALL,
-	CVMX_USB_STATUS_XACTERR,
-	CVMX_USB_STATUS_DATATGLERR,
-	CVMX_USB_STATUS_BABBLEERR,
-	CVMX_USB_STATUS_FRAMEERR,
-};
-
-/**
- * struct cvmx_usb_port_status - the USB port status information
- *
- * @port_enabled:	1 = Usb port is enabled, 0 = disabled
- * @port_over_current:	1 = Over current detected, 0 = Over current not
- *			detected. Octeon doesn't support over current detection.
- * @port_powered:	1 = Port power is being supplied to the device, 0 =
- *			power is off. Octeon doesn't support turning port power
- *			off.
- * @port_speed:		Current port speed.
- * @connected:		1 = A device is connected to the port, 0 = No device is
- *			connected.
- * @connect_change:	1 = Device connected state changed since the last set
- *			status call.
- */
-struct cvmx_usb_port_status {
-	u32 reserved			: 25;
-	u32 port_enabled		: 1;
-	u32 port_over_current		: 1;
-	u32 port_powered		: 1;
-	enum cvmx_usb_speed port_speed	: 2;
-	u32 connected			: 1;
-	u32 connect_change		: 1;
-};
-
-/**
- * struct cvmx_usb_iso_packet - descriptor for Isochronous packets
- *
- * @offset:	This is the offset in bytes into the main buffer where this data
- *		is stored.
- * @length:	This is the length in bytes of the data.
- * @status:	This is the status of this individual packet transfer.
- */
-struct cvmx_usb_iso_packet {
-	int offset;
-	int length;
-	enum cvmx_usb_status status;
-};
-
-/**
- * enum cvmx_usb_initialize_flags - flags used by the initialization function
- *
- * @CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_XI:    The USB port uses a 12MHz crystal
- *					      as clock source at USB_XO and
- *					      USB_XI.
- * @CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_GND:   The USB port uses 12/24/48MHz 2.5V
- *					      board clock source at USB_XO.
- *					      USB_XI should be tied to GND.
- * @CVMX_USB_INITIALIZE_FLAGS_CLOCK_MHZ_MASK: Mask for clock speed field
- * @CVMX_USB_INITIALIZE_FLAGS_CLOCK_12MHZ:    Speed of reference clock or
- *					      crystal
- * @CVMX_USB_INITIALIZE_FLAGS_CLOCK_24MHZ:    Speed of reference clock
- * @CVMX_USB_INITIALIZE_FLAGS_CLOCK_48MHZ:    Speed of reference clock
- * @CVMX_USB_INITIALIZE_FLAGS_NO_DMA:	      Disable DMA and used polled IO for
- *					      data transfer use for the USB
- */
-enum cvmx_usb_initialize_flags {
-	CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_XI		= 1 << 0,
-	CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_GND		= 1 << 1,
-	CVMX_USB_INITIALIZE_FLAGS_CLOCK_MHZ_MASK	= 3 << 3,
-	CVMX_USB_INITIALIZE_FLAGS_CLOCK_12MHZ		= 1 << 3,
-	CVMX_USB_INITIALIZE_FLAGS_CLOCK_24MHZ		= 2 << 3,
-	CVMX_USB_INITIALIZE_FLAGS_CLOCK_48MHZ		= 3 << 3,
-	/* Bits 3-4 used to encode the clock frequency */
-	CVMX_USB_INITIALIZE_FLAGS_NO_DMA		= 1 << 5,
-};
-
-/**
- * enum cvmx_usb_pipe_flags - internal flags for a pipe.
- *
- * @CVMX_USB_PIPE_FLAGS_SCHEDULED: Used internally to determine if a pipe is
- *				   actively using hardware.
- * @CVMX_USB_PIPE_FLAGS_NEED_PING: Used internally to determine if a high speed
- *				   pipe is in the ping state.
- */
-enum cvmx_usb_pipe_flags {
-	CVMX_USB_PIPE_FLAGS_SCHEDULED	= 1 << 17,
-	CVMX_USB_PIPE_FLAGS_NEED_PING	= 1 << 18,
-};
-
-/* Maximum number of times to retry failed transactions */
-#define MAX_RETRIES		3
-
-/* Maximum number of hardware channels supported by the USB block */
-#define MAX_CHANNELS		8
-
-/*
- * The low level hardware can transfer a maximum of this number of bytes in each
- * transfer. The field is 19 bits wide
- */
-#define MAX_TRANSFER_BYTES	((1 << 19) - 1)
-
-/*
- * The low level hardware can transfer a maximum of this number of packets in
- * each transfer. The field is 10 bits wide
- */
-#define MAX_TRANSFER_PACKETS	((1 << 10) - 1)
-
-/**
- * Logical transactions may take numerous low level
- * transactions, especially when splits are concerned. This
- * enum represents all of the possible stages a transaction can
- * be in. Note that split completes are always even. This is so
- * the NAK handler can backup to the previous low level
- * transaction with a simple clearing of bit 0.
- */
-enum cvmx_usb_stage {
-	CVMX_USB_STAGE_NON_CONTROL,
-	CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE,
-	CVMX_USB_STAGE_SETUP,
-	CVMX_USB_STAGE_SETUP_SPLIT_COMPLETE,
-	CVMX_USB_STAGE_DATA,
-	CVMX_USB_STAGE_DATA_SPLIT_COMPLETE,
-	CVMX_USB_STAGE_STATUS,
-	CVMX_USB_STAGE_STATUS_SPLIT_COMPLETE,
-};
-
-/**
- * struct cvmx_usb_transaction - describes each pending USB transaction
- *				 regardless of type. These are linked together
- *				 to form a list of pending requests for a pipe.
- *
- * @node:		List node for transactions in the pipe.
- * @type:		Type of transaction, duplicated of the pipe.
- * @flags:		State flags for this transaction.
- * @buffer:		User's physical buffer address to read/write.
- * @buffer_length:	Size of the user's buffer in bytes.
- * @control_header:	For control transactions, physical address of the 8
- *			byte standard header.
- * @iso_start_frame:	For ISO transactions, the starting frame number.
- * @iso_number_packets:	For ISO transactions, the number of packets in the
- *			request.
- * @iso_packets:	For ISO transactions, the sub packets in the request.
- * @actual_bytes:	Actual bytes transfer for this transaction.
- * @stage:		For control transactions, the current stage.
- * @urb:		URB.
- */
-struct cvmx_usb_transaction {
-	struct list_head node;
-	enum cvmx_usb_transfer type;
-	u64 buffer;
-	int buffer_length;
-	u64 control_header;
-	int iso_start_frame;
-	int iso_number_packets;
-	struct cvmx_usb_iso_packet *iso_packets;
-	int xfersize;
-	int pktcnt;
-	int retries;
-	int actual_bytes;
-	enum cvmx_usb_stage stage;
-	struct urb *urb;
-};
-
-/**
- * struct cvmx_usb_pipe - a pipe represents a virtual connection between Octeon
- *			  and some USB device. It contains a list of pending
- *			  request to the device.
- *
- * @node:		List node for pipe list
- * @next:		Pipe after this one in the list
- * @transactions:	List of pending transactions
- * @interval:		For periodic pipes, the interval between packets in
- *			frames
- * @next_tx_frame:	The next frame this pipe is allowed to transmit on
- * @flags:		State flags for this pipe
- * @device_speed:	Speed of device connected to this pipe
- * @transfer_type:	Type of transaction supported by this pipe
- * @transfer_dir:	IN or OUT. Ignored for Control
- * @multi_count:	Max packet in a row for the device
- * @max_packet:		The device's maximum packet size in bytes
- * @device_addr:	USB device address at other end of pipe
- * @endpoint_num:	USB endpoint number at other end of pipe
- * @hub_device_addr:	Hub address this device is connected to
- * @hub_port:		Hub port this device is connected to
- * @pid_toggle:		This toggles between 0/1 on every packet send to track
- *			the data pid needed
- * @channel:		Hardware DMA channel for this pipe
- * @split_sc_frame:	The low order bits of the frame number the split
- *			complete should be sent on
- */
-struct cvmx_usb_pipe {
-	struct list_head node;
-	struct list_head transactions;
-	u64 interval;
-	u64 next_tx_frame;
-	enum cvmx_usb_pipe_flags flags;
-	enum cvmx_usb_speed device_speed;
-	enum cvmx_usb_transfer transfer_type;
-	enum cvmx_usb_direction transfer_dir;
-	int multi_count;
-	u16 max_packet;
-	u8 device_addr;
-	u8 endpoint_num;
-	u8 hub_device_addr;
-	u8 hub_port;
-	u8 pid_toggle;
-	u8 channel;
-	s8 split_sc_frame;
-};
-
-struct cvmx_usb_tx_fifo {
-	struct {
-		int channel;
-		int size;
-		u64 address;
-	} entry[MAX_CHANNELS + 1];
-	int head;
-	int tail;
-};
-
-/**
- * struct octeon_hcd - the state of the USB block
- *
- * lock:		   Serialization lock.
- * init_flags:		   Flags passed to initialize.
- * index:		   Which USB block this is for.
- * idle_hardware_channels: Bit set for every idle hardware channel.
- * usbcx_hprt:		   Stored port status so we don't need to read a CSR to
- *			   determine splits.
- * pipe_for_channel:	   Map channels to pipes.
- * pipe:		   Storage for pipes.
- * indent:		   Used by debug output to indent functions.
- * port_status:		   Last port status used for change notification.
- * idle_pipes:		   List of open pipes that have no transactions.
- * active_pipes:	   Active pipes indexed by transfer type.
- * frame_number:	   Increments every SOF interrupt for time keeping.
- * active_split:	   Points to the current active split, or NULL.
- */
-struct octeon_hcd {
-	spinlock_t lock; /* serialization lock */
-	int init_flags;
-	int index;
-	int idle_hardware_channels;
-	union cvmx_usbcx_hprt usbcx_hprt;
-	struct cvmx_usb_pipe *pipe_for_channel[MAX_CHANNELS];
-	int indent;
-	struct cvmx_usb_port_status port_status;
-	struct list_head idle_pipes;
-	struct list_head active_pipes[4];
-	u64 frame_number;
-	struct cvmx_usb_transaction *active_split;
-	struct cvmx_usb_tx_fifo periodic;
-	struct cvmx_usb_tx_fifo nonperiodic;
-};
-
-/*
- * This macro logically sets a single field in a CSR. It does the sequence
- * read, modify, and write
- */
-#define USB_SET_FIELD32(address, _union, field, value)		\
-	do {							\
-		union _union c;					\
-								\
-		c.u32 = cvmx_usb_read_csr32(usb, address);	\
-		c.s.field = value;				\
-		cvmx_usb_write_csr32(usb, address, c.u32);	\
-	} while (0)
-
-/* Returns the IO address to push/pop stuff data from the FIFOs */
-#define USB_FIFO_ADDRESS(channel, usb_index) \
-	(CVMX_USBCX_GOTGCTL(usb_index) + ((channel) + 1) * 0x1000)
-
-/**
- * struct octeon_temp_buffer - a bounce buffer for USB transfers
- * @orig_buffer: the original buffer passed by the USB stack
- * @data:	 the newly allocated temporary buffer (excluding meta-data)
- *
- * Both the DMA engine and FIFO mode will always transfer full 32-bit words. If
- * the buffer is too short, we need to allocate a temporary one, and this struct
- * represents it.
- */
-struct octeon_temp_buffer {
-	void *orig_buffer;
-	u8 data[0];
-};
-
-static inline struct usb_hcd *octeon_to_hcd(struct octeon_hcd *p)
-{
-	return container_of((void *)p, struct usb_hcd, hcd_priv);
-}
-
-/**
- * octeon_alloc_temp_buffer - allocate a temporary buffer for USB transfer
- *                            (if needed)
- * @urb:	URB.
- * @mem_flags:	Memory allocation flags.
- *
- * This function allocates a temporary bounce buffer whenever it's needed
- * due to HW limitations.
- */
-static int octeon_alloc_temp_buffer(struct urb *urb, gfp_t mem_flags)
-{
-	struct octeon_temp_buffer *temp;
-
-	if (urb->num_sgs || urb->sg ||
-	    (urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP) ||
-	    !(urb->transfer_buffer_length % sizeof(u32)))
-		return 0;
-
-	temp = kmalloc(ALIGN(urb->transfer_buffer_length, sizeof(u32)) +
-		       sizeof(*temp), mem_flags);
-	if (!temp)
-		return -ENOMEM;
-
-	temp->orig_buffer = urb->transfer_buffer;
-	if (usb_urb_dir_out(urb))
-		memcpy(temp->data, urb->transfer_buffer,
-		       urb->transfer_buffer_length);
-	urb->transfer_buffer = temp->data;
-	urb->transfer_flags |= URB_ALIGNED_TEMP_BUFFER;
-
-	return 0;
-}
-
-/**
- * octeon_free_temp_buffer - free a temporary buffer used by USB transfers.
- * @urb: URB.
- *
- * Frees a buffer allocated by octeon_alloc_temp_buffer().
- */
-static void octeon_free_temp_buffer(struct urb *urb)
-{
-	struct octeon_temp_buffer *temp;
-	size_t length;
-
-	if (!(urb->transfer_flags & URB_ALIGNED_TEMP_BUFFER))
-		return;
-
-	temp = container_of(urb->transfer_buffer, struct octeon_temp_buffer,
-			    data);
-	if (usb_urb_dir_in(urb)) {
-		if (usb_pipeisoc(urb->pipe))
-			length = urb->transfer_buffer_length;
-		else
-			length = urb->actual_length;
-
-		memcpy(temp->orig_buffer, urb->transfer_buffer, length);
-	}
-	urb->transfer_buffer = temp->orig_buffer;
-	urb->transfer_flags &= ~URB_ALIGNED_TEMP_BUFFER;
-	kfree(temp);
-}
-
-/**
- * octeon_map_urb_for_dma - Octeon-specific map_urb_for_dma().
- * @hcd:	USB HCD structure.
- * @urb:	URB.
- * @mem_flags:	Memory allocation flags.
- */
-static int octeon_map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb,
-				  gfp_t mem_flags)
-{
-	int ret;
-
-	ret = octeon_alloc_temp_buffer(urb, mem_flags);
-	if (ret)
-		return ret;
-
-	ret = usb_hcd_map_urb_for_dma(hcd, urb, mem_flags);
-	if (ret)
-		octeon_free_temp_buffer(urb);
-
-	return ret;
-}
-
-/**
- * octeon_unmap_urb_for_dma - Octeon-specific unmap_urb_for_dma()
- * @hcd:	USB HCD structure.
- * @urb:	URB.
- */
-static void octeon_unmap_urb_for_dma(struct usb_hcd *hcd, struct urb *urb)
-{
-	usb_hcd_unmap_urb_for_dma(hcd, urb);
-	octeon_free_temp_buffer(urb);
-}
-
-/**
- * Read a USB 32bit CSR. It performs the necessary address swizzle
- * for 32bit CSRs and logs the value in a readable format if
- * debugging is on.
- *
- * @usb:     USB block this access is for
- * @address: 64bit address to read
- *
- * Returns: Result of the read
- */
-static inline u32 cvmx_usb_read_csr32(struct octeon_hcd *usb, u64 address)
-{
-	return cvmx_read64_uint32(address ^ 4);
-}
-
-/**
- * Write a USB 32bit CSR. It performs the necessary address
- * swizzle for 32bit CSRs and logs the value in a readable format
- * if debugging is on.
- *
- * @usb:     USB block this access is for
- * @address: 64bit address to write
- * @value:   Value to write
- */
-static inline void cvmx_usb_write_csr32(struct octeon_hcd *usb,
-					u64 address, u32 value)
-{
-	cvmx_write64_uint32(address ^ 4, value);
-	cvmx_read64_uint64(CVMX_USBNX_DMA0_INB_CHN0(usb->index));
-}
-
-/**
- * Return non zero if this pipe connects to a non HIGH speed
- * device through a high speed hub.
- *
- * @usb:    USB block this access is for
- * @pipe:   Pipe to check
- *
- * Returns: Non zero if we need to do split transactions
- */
-static inline int cvmx_usb_pipe_needs_split(struct octeon_hcd *usb,
-					    struct cvmx_usb_pipe *pipe)
-{
-	return pipe->device_speed != CVMX_USB_SPEED_HIGH &&
-	       usb->usbcx_hprt.s.prtspd == CVMX_USB_SPEED_HIGH;
-}
-
-/**
- * Trivial utility function to return the correct PID for a pipe
- *
- * @pipe:   pipe to check
- *
- * Returns: PID for pipe
- */
-static inline int cvmx_usb_get_data_pid(struct cvmx_usb_pipe *pipe)
-{
-	if (pipe->pid_toggle)
-		return 2; /* Data1 */
-	return 0; /* Data0 */
-}
-
-/* Loops through register until txfflsh or rxfflsh become zero.*/
-static int cvmx_wait_tx_rx(struct octeon_hcd *usb, int fflsh_type)
-{
-	int result;
-	u64 address = CVMX_USBCX_GRSTCTL(usb->index);
-	u64 done = cvmx_get_cycle() + 100 *
-		   (u64)octeon_get_clock_rate / 1000000;
-	union cvmx_usbcx_grstctl c;
-
-	while (1) {
-		c.u32 = cvmx_usb_read_csr32(usb, address);
-		if (fflsh_type == 0 && c.s.txfflsh == 0) {
-			result = 0;
-			break;
-		} else if (fflsh_type == 1 && c.s.rxfflsh == 0) {
-			result = 0;
-			break;
-		} else if (cvmx_get_cycle() > done) {
-			result = -1;
-			break;
-		}
-
-		__delay(100);
-	}
-	return result;
-}
-
-static void cvmx_fifo_setup(struct octeon_hcd *usb)
-{
-	union cvmx_usbcx_ghwcfg3 usbcx_ghwcfg3;
-	union cvmx_usbcx_gnptxfsiz npsiz;
-	union cvmx_usbcx_hptxfsiz psiz;
-
-	usbcx_ghwcfg3.u32 = cvmx_usb_read_csr32(usb,
-						CVMX_USBCX_GHWCFG3(usb->index));
-
-	/*
-	 * Program the USBC_GRXFSIZ register to select the size of the receive
-	 * FIFO (25%).
-	 */
-	USB_SET_FIELD32(CVMX_USBCX_GRXFSIZ(usb->index), cvmx_usbcx_grxfsiz,
-			rxfdep, usbcx_ghwcfg3.s.dfifodepth / 4);
-
-	/*
-	 * Program the USBC_GNPTXFSIZ register to select the size and the start
-	 * address of the non-periodic transmit FIFO for nonperiodic
-	 * transactions (50%).
-	 */
-	npsiz.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_GNPTXFSIZ(usb->index));
-	npsiz.s.nptxfdep = usbcx_ghwcfg3.s.dfifodepth / 2;
-	npsiz.s.nptxfstaddr = usbcx_ghwcfg3.s.dfifodepth / 4;
-	cvmx_usb_write_csr32(usb, CVMX_USBCX_GNPTXFSIZ(usb->index), npsiz.u32);
-
-	/*
-	 * Program the USBC_HPTXFSIZ register to select the size and start
-	 * address of the periodic transmit FIFO for periodic transactions
-	 * (25%).
-	 */
-	psiz.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HPTXFSIZ(usb->index));
-	psiz.s.ptxfsize = usbcx_ghwcfg3.s.dfifodepth / 4;
-	psiz.s.ptxfstaddr = 3 * usbcx_ghwcfg3.s.dfifodepth / 4;
-	cvmx_usb_write_csr32(usb, CVMX_USBCX_HPTXFSIZ(usb->index), psiz.u32);
-
-	/* Flush all FIFOs */
-	USB_SET_FIELD32(CVMX_USBCX_GRSTCTL(usb->index),
-			cvmx_usbcx_grstctl, txfnum, 0x10);
-	USB_SET_FIELD32(CVMX_USBCX_GRSTCTL(usb->index),
-			cvmx_usbcx_grstctl, txfflsh, 1);
-	cvmx_wait_tx_rx(usb, 0);
-	USB_SET_FIELD32(CVMX_USBCX_GRSTCTL(usb->index),
-			cvmx_usbcx_grstctl, rxfflsh, 1);
-	cvmx_wait_tx_rx(usb, 1);
-}
-
-/**
- * Shutdown a USB port after a call to cvmx_usb_initialize().
- * The port should be disabled with all pipes closed when this
- * function is called.
- *
- * @usb: USB device state populated by cvmx_usb_initialize().
- *
- * Returns: 0 or a negative error code.
- */
-static int cvmx_usb_shutdown(struct octeon_hcd *usb)
-{
-	union cvmx_usbnx_clk_ctl usbn_clk_ctl;
-
-	/* Make sure all pipes are closed */
-	if (!list_empty(&usb->idle_pipes) ||
-	    !list_empty(&usb->active_pipes[CVMX_USB_TRANSFER_ISOCHRONOUS]) ||
-	    !list_empty(&usb->active_pipes[CVMX_USB_TRANSFER_INTERRUPT]) ||
-	    !list_empty(&usb->active_pipes[CVMX_USB_TRANSFER_CONTROL]) ||
-	    !list_empty(&usb->active_pipes[CVMX_USB_TRANSFER_BULK]))
-		return -EBUSY;
-
-	/* Disable the clocks and put them in power on reset */
-	usbn_clk_ctl.u64 = cvmx_read64_uint64(CVMX_USBNX_CLK_CTL(usb->index));
-	usbn_clk_ctl.s.enable = 1;
-	usbn_clk_ctl.s.por = 1;
-	usbn_clk_ctl.s.hclk_rst = 1;
-	usbn_clk_ctl.s.prst = 0;
-	usbn_clk_ctl.s.hrst = 0;
-	cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64);
-	return 0;
-}
-
-/**
- * Initialize a USB port for use. This must be called before any
- * other access to the Octeon USB port is made. The port starts
- * off in the disabled state.
- *
- * @dev:	 Pointer to struct device for logging purposes.
- * @usb:	 Pointer to struct octeon_hcd.
- *
- * Returns: 0 or a negative error code.
- */
-static int cvmx_usb_initialize(struct device *dev,
-			       struct octeon_hcd *usb)
-{
-	int channel;
-	int divisor;
-	int retries = 0;
-	union cvmx_usbcx_hcfg usbcx_hcfg;
-	union cvmx_usbnx_clk_ctl usbn_clk_ctl;
-	union cvmx_usbcx_gintsts usbc_gintsts;
-	union cvmx_usbcx_gahbcfg usbcx_gahbcfg;
-	union cvmx_usbcx_gintmsk usbcx_gintmsk;
-	union cvmx_usbcx_gusbcfg usbcx_gusbcfg;
-	union cvmx_usbnx_usbp_ctl_status usbn_usbp_ctl_status;
-
-retry:
-	/*
-	 * Power On Reset and PHY Initialization
-	 *
-	 * 1. Wait for DCOK to assert (nothing to do)
-	 *
-	 * 2a. Write USBN0/1_CLK_CTL[POR] = 1 and
-	 *     USBN0/1_CLK_CTL[HRST,PRST,HCLK_RST] = 0
-	 */
-	usbn_clk_ctl.u64 = cvmx_read64_uint64(CVMX_USBNX_CLK_CTL(usb->index));
-	usbn_clk_ctl.s.por = 1;
-	usbn_clk_ctl.s.hrst = 0;
-	usbn_clk_ctl.s.prst = 0;
-	usbn_clk_ctl.s.hclk_rst = 0;
-	usbn_clk_ctl.s.enable = 0;
-	/*
-	 * 2b. Select the USB reference clock/crystal parameters by writing
-	 *     appropriate values to USBN0/1_CLK_CTL[P_C_SEL, P_RTYPE, P_COM_ON]
-	 */
-	if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_GND) {
-		/*
-		 * The USB port uses 12/24/48MHz 2.5V board clock
-		 * source at USB_XO. USB_XI should be tied to GND.
-		 * Most Octeon evaluation boards require this setting
-		 */
-		if (OCTEON_IS_MODEL(OCTEON_CN3XXX) ||
-		    OCTEON_IS_MODEL(OCTEON_CN56XX) ||
-		    OCTEON_IS_MODEL(OCTEON_CN50XX))
-			/* From CN56XX,CN50XX,CN31XX,CN30XX manuals */
-			usbn_clk_ctl.s.p_rtype = 2; /* p_rclk=1 & p_xenbn=0 */
-		else
-			/* From CN52XX manual */
-			usbn_clk_ctl.s.p_rtype = 1;
-
-		switch (usb->init_flags &
-			CVMX_USB_INITIALIZE_FLAGS_CLOCK_MHZ_MASK) {
-		case CVMX_USB_INITIALIZE_FLAGS_CLOCK_12MHZ:
-			usbn_clk_ctl.s.p_c_sel = 0;
-			break;
-		case CVMX_USB_INITIALIZE_FLAGS_CLOCK_24MHZ:
-			usbn_clk_ctl.s.p_c_sel = 1;
-			break;
-		case CVMX_USB_INITIALIZE_FLAGS_CLOCK_48MHZ:
-			usbn_clk_ctl.s.p_c_sel = 2;
-			break;
-		}
-	} else {
-		/*
-		 * The USB port uses a 12MHz crystal as clock source
-		 * at USB_XO and USB_XI
-		 */
-		if (OCTEON_IS_MODEL(OCTEON_CN3XXX))
-			/* From CN31XX,CN30XX manual */
-			usbn_clk_ctl.s.p_rtype = 3; /* p_rclk=1 & p_xenbn=1 */
-		else
-			/* From CN56XX,CN52XX,CN50XX manuals. */
-			usbn_clk_ctl.s.p_rtype = 0;
-
-		usbn_clk_ctl.s.p_c_sel = 0;
-	}
-	/*
-	 * 2c. Select the HCLK via writing USBN0/1_CLK_CTL[DIVIDE, DIVIDE2] and
-	 *     setting USBN0/1_CLK_CTL[ENABLE] = 1. Divide the core clock down
-	 *     such that USB is as close as possible to 125Mhz
-	 */
-	divisor = DIV_ROUND_UP(octeon_get_clock_rate(), 125000000);
-	/* Lower than 4 doesn't seem to work properly */
-	if (divisor < 4)
-		divisor = 4;
-	usbn_clk_ctl.s.divide = divisor;
-	usbn_clk_ctl.s.divide2 = 0;
-	cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64);
-
-	/* 2d. Write USBN0/1_CLK_CTL[HCLK_RST] = 1 */
-	usbn_clk_ctl.s.hclk_rst = 1;
-	cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64);
-	/* 2e.  Wait 64 core-clock cycles for HCLK to stabilize */
-	__delay(64);
-	/*
-	 * 3. Program the power-on reset field in the USBN clock-control
-	 *    register:
-	 *    USBN_CLK_CTL[POR] = 0
-	 */
-	usbn_clk_ctl.s.por = 0;
-	cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64);
-	/* 4. Wait 1 ms for PHY clock to start */
-	mdelay(1);
-	/*
-	 * 5. Program the Reset input from automatic test equipment field in the
-	 *    USBP control and status register:
-	 *    USBN_USBP_CTL_STATUS[ATE_RESET] = 1
-	 */
-	usbn_usbp_ctl_status.u64 =
-		cvmx_read64_uint64(CVMX_USBNX_USBP_CTL_STATUS(usb->index));
-	usbn_usbp_ctl_status.s.ate_reset = 1;
-	cvmx_write64_uint64(CVMX_USBNX_USBP_CTL_STATUS(usb->index),
-			    usbn_usbp_ctl_status.u64);
-	/* 6. Wait 10 cycles */
-	__delay(10);
-	/*
-	 * 7. Clear ATE_RESET field in the USBN clock-control register:
-	 *    USBN_USBP_CTL_STATUS[ATE_RESET] = 0
-	 */
-	usbn_usbp_ctl_status.s.ate_reset = 0;
-	cvmx_write64_uint64(CVMX_USBNX_USBP_CTL_STATUS(usb->index),
-			    usbn_usbp_ctl_status.u64);
-	/*
-	 * 8. Program the PHY reset field in the USBN clock-control register:
-	 *    USBN_CLK_CTL[PRST] = 1
-	 */
-	usbn_clk_ctl.s.prst = 1;
-	cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64);
-	/*
-	 * 9. Program the USBP control and status register to select host or
-	 *    device mode. USBN_USBP_CTL_STATUS[HST_MODE] = 0 for host, = 1 for
-	 *    device
-	 */
-	usbn_usbp_ctl_status.s.hst_mode = 0;
-	cvmx_write64_uint64(CVMX_USBNX_USBP_CTL_STATUS(usb->index),
-			    usbn_usbp_ctl_status.u64);
-	/* 10. Wait 1 us */
-	udelay(1);
-	/*
-	 * 11. Program the hreset_n field in the USBN clock-control register:
-	 *     USBN_CLK_CTL[HRST] = 1
-	 */
-	usbn_clk_ctl.s.hrst = 1;
-	cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64);
-	/* 12. Proceed to USB core initialization */
-	usbn_clk_ctl.s.enable = 1;
-	cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64);
-	udelay(1);
-
-	/*
-	 * USB Core Initialization
-	 *
-	 * 1. Read USBC_GHWCFG1, USBC_GHWCFG2, USBC_GHWCFG3, USBC_GHWCFG4 to
-	 *    determine USB core configuration parameters.
-	 *
-	 *    Nothing needed
-	 *
-	 * 2. Program the following fields in the global AHB configuration
-	 *    register (USBC_GAHBCFG)
-	 *    DMA mode, USBC_GAHBCFG[DMAEn]: 1 = DMA mode, 0 = slave mode
-	 *    Burst length, USBC_GAHBCFG[HBSTLEN] = 0
-	 *    Nonperiodic TxFIFO empty level (slave mode only),
-	 *    USBC_GAHBCFG[NPTXFEMPLVL]
-	 *    Periodic TxFIFO empty level (slave mode only),
-	 *    USBC_GAHBCFG[PTXFEMPLVL]
-	 *    Global interrupt mask, USBC_GAHBCFG[GLBLINTRMSK] = 1
-	 */
-	usbcx_gahbcfg.u32 = 0;
-	usbcx_gahbcfg.s.dmaen = !(usb->init_flags &
-				  CVMX_USB_INITIALIZE_FLAGS_NO_DMA);
-	usbcx_gahbcfg.s.hbstlen = 0;
-	usbcx_gahbcfg.s.nptxfemplvl = 1;
-	usbcx_gahbcfg.s.ptxfemplvl = 1;
-	usbcx_gahbcfg.s.glblintrmsk = 1;
-	cvmx_usb_write_csr32(usb, CVMX_USBCX_GAHBCFG(usb->index),
-			     usbcx_gahbcfg.u32);
-
-	/*
-	 * 3. Program the following fields in USBC_GUSBCFG register.
-	 *    HS/FS timeout calibration, USBC_GUSBCFG[TOUTCAL] = 0
-	 *    ULPI DDR select, USBC_GUSBCFG[DDRSEL] = 0
-	 *    USB turnaround time, USBC_GUSBCFG[USBTRDTIM] = 0x5
-	 *    PHY low-power clock select, USBC_GUSBCFG[PHYLPWRCLKSEL] = 0
-	 */
-	usbcx_gusbcfg.u32 = cvmx_usb_read_csr32(usb,
-						CVMX_USBCX_GUSBCFG(usb->index));
-	usbcx_gusbcfg.s.toutcal = 0;
-	usbcx_gusbcfg.s.ddrsel = 0;
-	usbcx_gusbcfg.s.usbtrdtim = 0x5;
-	usbcx_gusbcfg.s.phylpwrclksel = 0;
-	cvmx_usb_write_csr32(usb, CVMX_USBCX_GUSBCFG(usb->index),
-			     usbcx_gusbcfg.u32);
-
-	/*
-	 * 4. The software must unmask the following bits in the USBC_GINTMSK
-	 *    register.
-	 *    OTG interrupt mask, USBC_GINTMSK[OTGINTMSK] = 1
-	 *    Mode mismatch interrupt mask, USBC_GINTMSK[MODEMISMSK] = 1
-	 */
-	usbcx_gintmsk.u32 = cvmx_usb_read_csr32(usb,
-						CVMX_USBCX_GINTMSK(usb->index));
-	usbcx_gintmsk.s.otgintmsk = 1;
-	usbcx_gintmsk.s.modemismsk = 1;
-	usbcx_gintmsk.s.hchintmsk = 1;
-	usbcx_gintmsk.s.sofmsk = 0;
-	/* We need RX FIFO interrupts if we don't have DMA */
-	if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA)
-		usbcx_gintmsk.s.rxflvlmsk = 1;
-	cvmx_usb_write_csr32(usb, CVMX_USBCX_GINTMSK(usb->index),
-			     usbcx_gintmsk.u32);
-
-	/*
-	 * Disable all channel interrupts. We'll enable them per channel later.
-	 */
-	for (channel = 0; channel < 8; channel++)
-		cvmx_usb_write_csr32(usb,
-				     CVMX_USBCX_HCINTMSKX(channel, usb->index),
-				     0);
-
-	/*
-	 * Host Port Initialization
-	 *
-	 * 1. Program the host-port interrupt-mask field to unmask,
-	 *    USBC_GINTMSK[PRTINT] = 1
-	 */
-	USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index),
-			cvmx_usbcx_gintmsk, prtintmsk, 1);
-	USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index),
-			cvmx_usbcx_gintmsk, disconnintmsk, 1);
-
-	/*
-	 * 2. Program the USBC_HCFG register to select full-speed host
-	 *    or high-speed host.
-	 */
-	usbcx_hcfg.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HCFG(usb->index));
-	usbcx_hcfg.s.fslssupp = 0;
-	usbcx_hcfg.s.fslspclksel = 0;
-	cvmx_usb_write_csr32(usb, CVMX_USBCX_HCFG(usb->index), usbcx_hcfg.u32);
-
-	cvmx_fifo_setup(usb);
-
-	/*
-	 * If the controller is getting port events right after the reset, it
-	 * means the initialization failed. Try resetting the controller again
-	 * in such case. This is seen to happen after cold boot on DSR-1000N.
-	 */
-	usbc_gintsts.u32 = cvmx_usb_read_csr32(usb,
-					       CVMX_USBCX_GINTSTS(usb->index));
-	cvmx_usb_write_csr32(usb, CVMX_USBCX_GINTSTS(usb->index),
-			     usbc_gintsts.u32);
-	dev_dbg(dev, "gintsts after reset: 0x%x\n", (int)usbc_gintsts.u32);
-	if (!usbc_gintsts.s.disconnint && !usbc_gintsts.s.prtint)
-		return 0;
-	if (retries++ >= 5)
-		return -EAGAIN;
-	dev_info(dev, "controller reset failed (gintsts=0x%x) - retrying\n",
-		 (int)usbc_gintsts.u32);
-	msleep(50);
-	cvmx_usb_shutdown(usb);
-	msleep(50);
-	goto retry;
-}
-
-/**
- * Reset a USB port. After this call succeeds, the USB port is
- * online and servicing requests.
- *
- * @usb: USB device state populated by cvmx_usb_initialize().
- */
-static void cvmx_usb_reset_port(struct octeon_hcd *usb)
-{
-	usb->usbcx_hprt.u32 = cvmx_usb_read_csr32(usb,
-						  CVMX_USBCX_HPRT(usb->index));
-
-	/* Program the port reset bit to start the reset process */
-	USB_SET_FIELD32(CVMX_USBCX_HPRT(usb->index), cvmx_usbcx_hprt,
-			prtrst, 1);
-
-	/*
-	 * Wait at least 50ms (high speed), or 10ms (full speed) for the reset
-	 * process to complete.
-	 */
-	mdelay(50);
-
-	/* Program the port reset bit to 0, USBC_HPRT[PRTRST] = 0 */
-	USB_SET_FIELD32(CVMX_USBCX_HPRT(usb->index), cvmx_usbcx_hprt,
-			prtrst, 0);
-
-	/*
-	 * Read the port speed field to get the enumerated speed,
-	 * USBC_HPRT[PRTSPD].
-	 */
-	usb->usbcx_hprt.u32 = cvmx_usb_read_csr32(usb,
-						  CVMX_USBCX_HPRT(usb->index));
-}
-
-/**
- * Disable a USB port. After this call the USB port will not
- * generate data transfers and will not generate events.
- * Transactions in process will fail and call their
- * associated callbacks.
- *
- * @usb: USB device state populated by cvmx_usb_initialize().
- *
- * Returns: 0 or a negative error code.
- */
-static int cvmx_usb_disable(struct octeon_hcd *usb)
-{
-	/* Disable the port */
-	USB_SET_FIELD32(CVMX_USBCX_HPRT(usb->index), cvmx_usbcx_hprt,
-			prtena, 1);
-	return 0;
-}
-
-/**
- * Get the current state of the USB port. Use this call to
- * determine if the usb port has anything connected, is enabled,
- * or has some sort of error condition. The return value of this
- * call has "changed" bits to signal of the value of some fields
- * have changed between calls.
- *
- * @usb: USB device state populated by cvmx_usb_initialize().
- *
- * Returns: Port status information
- */
-static struct cvmx_usb_port_status cvmx_usb_get_status(struct octeon_hcd *usb)
-{
-	union cvmx_usbcx_hprt usbc_hprt;
-	struct cvmx_usb_port_status result;
-
-	memset(&result, 0, sizeof(result));
-
-	usbc_hprt.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HPRT(usb->index));
-	result.port_enabled = usbc_hprt.s.prtena;
-	result.port_over_current = usbc_hprt.s.prtovrcurract;
-	result.port_powered = usbc_hprt.s.prtpwr;
-	result.port_speed = usbc_hprt.s.prtspd;
-	result.connected = usbc_hprt.s.prtconnsts;
-	result.connect_change =
-		result.connected != usb->port_status.connected;
-
-	return result;
-}
-
-/**
- * Open a virtual pipe between the host and a USB device. A pipe
- * must be opened before data can be transferred between a device
- * and Octeon.
- *
- * @usb:	     USB device state populated by cvmx_usb_initialize().
- * @device_addr:
- *		     USB device address to open the pipe to
- *		     (0-127).
- * @endpoint_num:
- *		     USB endpoint number to open the pipe to
- *		     (0-15).
- * @device_speed:
- *		     The speed of the device the pipe is going
- *		     to. This must match the device's speed,
- *		     which may be different than the port speed.
- * @max_packet:	     The maximum packet length the device can
- *		     transmit/receive (low speed=0-8, full
- *		     speed=0-1023, high speed=0-1024). This value
- *		     comes from the standard endpoint descriptor
- *		     field wMaxPacketSize bits <10:0>.
- * @transfer_type:
- *		     The type of transfer this pipe is for.
- * @transfer_dir:
- *		     The direction the pipe is in. This is not
- *		     used for control pipes.
- * @interval:	     For ISOCHRONOUS and INTERRUPT transfers,
- *		     this is how often the transfer is scheduled
- *		     for. All other transfers should specify
- *		     zero. The units are in frames (8000/sec at
- *		     high speed, 1000/sec for full speed).
- * @multi_count:
- *		     For high speed devices, this is the maximum
- *		     allowed number of packet per microframe.
- *		     Specify zero for non high speed devices. This
- *		     value comes from the standard endpoint descriptor
- *		     field wMaxPacketSize bits <12:11>.
- * @hub_device_addr:
- *		     Hub device address this device is connected
- *		     to. Devices connected directly to Octeon
- *		     use zero. This is only used when the device
- *		     is full/low speed behind a high speed hub.
- *		     The address will be of the high speed hub,
- *		     not and full speed hubs after it.
- * @hub_port:	     Which port on the hub the device is
- *		     connected. Use zero for devices connected
- *		     directly to Octeon. Like hub_device_addr,
- *		     this is only used for full/low speed
- *		     devices behind a high speed hub.
- *
- * Returns: A non-NULL value is a pipe. NULL means an error.
- */
-static struct cvmx_usb_pipe *cvmx_usb_open_pipe(struct octeon_hcd *usb,
-						int device_addr,
-						int endpoint_num,
-						enum cvmx_usb_speed
-							device_speed,
-						int max_packet,
-						enum cvmx_usb_transfer
-							transfer_type,
-						enum cvmx_usb_direction
-							transfer_dir,
-						int interval, int multi_count,
-						int hub_device_addr,
-						int hub_port)
-{
-	struct cvmx_usb_pipe *pipe;
-
-	pipe = kzalloc(sizeof(*pipe), GFP_ATOMIC);
-	if (!pipe)
-		return NULL;
-	if ((device_speed == CVMX_USB_SPEED_HIGH) &&
-	    (transfer_dir == CVMX_USB_DIRECTION_OUT) &&
-	    (transfer_type == CVMX_USB_TRANSFER_BULK))
-		pipe->flags |= CVMX_USB_PIPE_FLAGS_NEED_PING;
-	pipe->device_addr = device_addr;
-	pipe->endpoint_num = endpoint_num;
-	pipe->device_speed = device_speed;
-	pipe->max_packet = max_packet;
-	pipe->transfer_type = transfer_type;
-	pipe->transfer_dir = transfer_dir;
-	INIT_LIST_HEAD(&pipe->transactions);
-
-	/*
-	 * All pipes use interval to rate limit NAK processing. Force an
-	 * interval if one wasn't supplied
-	 */
-	if (!interval)
-		interval = 1;
-	if (cvmx_usb_pipe_needs_split(usb, pipe)) {
-		pipe->interval = interval * 8;
-		/* Force start splits to be schedule on uFrame 0 */
-		pipe->next_tx_frame = ((usb->frame_number + 7) & ~7) +
-					pipe->interval;
-	} else {
-		pipe->interval = interval;
-		pipe->next_tx_frame = usb->frame_number + pipe->interval;
-	}
-	pipe->multi_count = multi_count;
-	pipe->hub_device_addr = hub_device_addr;
-	pipe->hub_port = hub_port;
-	pipe->pid_toggle = 0;
-	pipe->split_sc_frame = -1;
-	list_add_tail(&pipe->node, &usb->idle_pipes);
-
-	/*
-	 * We don't need to tell the hardware about this pipe yet since
-	 * it doesn't have any submitted requests
-	 */
-
-	return pipe;
-}
-
-/**
- * Poll the RX FIFOs and remove data as needed. This function is only used
- * in non DMA mode. It is very important that this function be called quickly
- * enough to prevent FIFO overflow.
- *
- * @usb:	USB device state populated by cvmx_usb_initialize().
- */
-static void cvmx_usb_poll_rx_fifo(struct octeon_hcd *usb)
-{
-	union cvmx_usbcx_grxstsph rx_status;
-	int channel;
-	int bytes;
-	u64 address;
-	u32 *ptr;
-
-	rx_status.u32 = cvmx_usb_read_csr32(usb,
-					    CVMX_USBCX_GRXSTSPH(usb->index));
-	/* Only read data if IN data is there */
-	if (rx_status.s.pktsts != 2)
-		return;
-	/* Check if no data is available */
-	if (!rx_status.s.bcnt)
-		return;
-
-	channel = rx_status.s.chnum;
-	bytes = rx_status.s.bcnt;
-	if (!bytes)
-		return;
-
-	/* Get where the DMA engine would have written this data */
-	address = cvmx_read64_uint64(CVMX_USBNX_DMA0_INB_CHN0(usb->index) +
-				     channel * 8);
-
-	ptr = cvmx_phys_to_ptr(address);
-	cvmx_write64_uint64(CVMX_USBNX_DMA0_INB_CHN0(usb->index) + channel * 8,
-			    address + bytes);
-
-	/* Loop writing the FIFO data for this packet into memory */
-	while (bytes > 0) {
-		*ptr++ = cvmx_usb_read_csr32(usb,
-					USB_FIFO_ADDRESS(channel, usb->index));
-		bytes -= 4;
-	}
-	CVMX_SYNCW;
-}
-
-/**
- * Fill the TX hardware fifo with data out of the software
- * fifos
- *
- * @usb:	    USB device state populated by cvmx_usb_initialize().
- * @fifo:	    Software fifo to use
- * @available:	    Amount of space in the hardware fifo
- *
- * Returns: Non zero if the hardware fifo was too small and needs
- *	    to be serviced again.
- */
-static int cvmx_usb_fill_tx_hw(struct octeon_hcd *usb,
-			       struct cvmx_usb_tx_fifo *fifo, int available)
-{
-	/*
-	 * We're done either when there isn't anymore space or the software FIFO
-	 * is empty
-	 */
-	while (available && (fifo->head != fifo->tail)) {
-		int i = fifo->tail;
-		const u32 *ptr = cvmx_phys_to_ptr(fifo->entry[i].address);
-		u64 csr_address = USB_FIFO_ADDRESS(fifo->entry[i].channel,
-						   usb->index) ^ 4;
-		int words = available;
-
-		/* Limit the amount of data to what the SW fifo has */
-		if (fifo->entry[i].size <= available) {
-			words = fifo->entry[i].size;
-			fifo->tail++;
-			if (fifo->tail > MAX_CHANNELS)
-				fifo->tail = 0;
-		}
-
-		/* Update the next locations and counts */
-		available -= words;
-		fifo->entry[i].address += words * 4;
-		fifo->entry[i].size -= words;
-
-		/*
-		 * Write the HW fifo data. The read every three writes is due
-		 * to an errata on CN3XXX chips
-		 */
-		while (words > 3) {
-			cvmx_write64_uint32(csr_address, *ptr++);
-			cvmx_write64_uint32(csr_address, *ptr++);
-			cvmx_write64_uint32(csr_address, *ptr++);
-			cvmx_read64_uint64(
-					CVMX_USBNX_DMA0_INB_CHN0(usb->index));
-			words -= 3;
-		}
-		cvmx_write64_uint32(csr_address, *ptr++);
-		if (--words) {
-			cvmx_write64_uint32(csr_address, *ptr++);
-			if (--words)
-				cvmx_write64_uint32(csr_address, *ptr++);
-		}
-		cvmx_read64_uint64(CVMX_USBNX_DMA0_INB_CHN0(usb->index));
-	}
-	return fifo->head != fifo->tail;
-}
-
-/**
- * Check the hardware FIFOs and fill them as needed
- *
- * @usb:	USB device state populated by cvmx_usb_initialize().
- */
-static void cvmx_usb_poll_tx_fifo(struct octeon_hcd *usb)
-{
-	if (usb->periodic.head != usb->periodic.tail) {
-		union cvmx_usbcx_hptxsts tx_status;
-
-		tx_status.u32 = cvmx_usb_read_csr32(usb,
-					CVMX_USBCX_HPTXSTS(usb->index));
-		if (cvmx_usb_fill_tx_hw(usb, &usb->periodic,
-					tx_status.s.ptxfspcavail))
-			USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index),
-					cvmx_usbcx_gintmsk, ptxfempmsk, 1);
-		else
-			USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index),
-					cvmx_usbcx_gintmsk, ptxfempmsk, 0);
-	}
-
-	if (usb->nonperiodic.head != usb->nonperiodic.tail) {
-		union cvmx_usbcx_gnptxsts tx_status;
-
-		tx_status.u32 = cvmx_usb_read_csr32(usb,
-					CVMX_USBCX_GNPTXSTS(usb->index));
-		if (cvmx_usb_fill_tx_hw(usb, &usb->nonperiodic,
-					tx_status.s.nptxfspcavail))
-			USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index),
-					cvmx_usbcx_gintmsk, nptxfempmsk, 1);
-		else
-			USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index),
-					cvmx_usbcx_gintmsk, nptxfempmsk, 0);
-	}
-}
-
-/**
- * Fill the TX FIFO with an outgoing packet
- *
- * @usb:	  USB device state populated by cvmx_usb_initialize().
- * @channel:	  Channel number to get packet from
- */
-static void cvmx_usb_fill_tx_fifo(struct octeon_hcd *usb, int channel)
-{
-	union cvmx_usbcx_hccharx hcchar;
-	union cvmx_usbcx_hcspltx usbc_hcsplt;
-	union cvmx_usbcx_hctsizx usbc_hctsiz;
-	struct cvmx_usb_tx_fifo *fifo;
-
-	/* We only need to fill data on outbound channels */
-	hcchar.u32 = cvmx_usb_read_csr32(usb,
-			CVMX_USBCX_HCCHARX(channel, usb->index));
-	if (hcchar.s.epdir != CVMX_USB_DIRECTION_OUT)
-		return;
-
-	/* OUT Splits only have data on the start and not the complete */
-	usbc_hcsplt.u32 = cvmx_usb_read_csr32(usb,
-				CVMX_USBCX_HCSPLTX(channel, usb->index));
-	if (usbc_hcsplt.s.spltena && usbc_hcsplt.s.compsplt)
-		return;
-
-	/*
-	 * Find out how many bytes we need to fill and convert it into 32bit
-	 * words.
-	 */
-	usbc_hctsiz.u32 = cvmx_usb_read_csr32(usb,
-				CVMX_USBCX_HCTSIZX(channel, usb->index));
-	if (!usbc_hctsiz.s.xfersize)
-		return;
-
-	if ((hcchar.s.eptype == CVMX_USB_TRANSFER_INTERRUPT) ||
-	    (hcchar.s.eptype == CVMX_USB_TRANSFER_ISOCHRONOUS))
-		fifo = &usb->periodic;
-	else
-		fifo = &usb->nonperiodic;
-
-	fifo->entry[fifo->head].channel = channel;
-	fifo->entry[fifo->head].address =
-		cvmx_read64_uint64(CVMX_USBNX_DMA0_OUTB_CHN0(usb->index) +
-				   channel * 8);
-	fifo->entry[fifo->head].size = (usbc_hctsiz.s.xfersize + 3) >> 2;
-	fifo->head++;
-	if (fifo->head > MAX_CHANNELS)
-		fifo->head = 0;
-
-	cvmx_usb_poll_tx_fifo(usb);
-}
-
-/**
- * Perform channel specific setup for Control transactions. All
- * the generic stuff will already have been done in cvmx_usb_start_channel().
- *
- * @usb:	  USB device state populated by cvmx_usb_initialize().
- * @channel:	  Channel to setup
- * @pipe:	  Pipe for control transaction
- */
-static void cvmx_usb_start_channel_control(struct octeon_hcd *usb,
-					   int channel,
-					   struct cvmx_usb_pipe *pipe)
-{
-	struct usb_hcd *hcd = octeon_to_hcd(usb);
-	struct device *dev = hcd->self.controller;
-	struct cvmx_usb_transaction *transaction =
-		list_first_entry(&pipe->transactions, typeof(*transaction),
-				 node);
-	struct usb_ctrlrequest *header =
-		cvmx_phys_to_ptr(transaction->control_header);
-	int bytes_to_transfer = transaction->buffer_length -
-		transaction->actual_bytes;
-	int packets_to_transfer;
-	union cvmx_usbcx_hctsizx usbc_hctsiz;
-
-	usbc_hctsiz.u32 = cvmx_usb_read_csr32(usb,
-				CVMX_USBCX_HCTSIZX(channel, usb->index));
-
-	switch (transaction->stage) {
-	case CVMX_USB_STAGE_NON_CONTROL:
-	case CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE:
-		dev_err(dev, "%s: ERROR - Non control stage\n", __func__);
-		break;
-	case CVMX_USB_STAGE_SETUP:
-		usbc_hctsiz.s.pid = 3; /* Setup */
-		bytes_to_transfer = sizeof(*header);
-		/* All Control operations start with a setup going OUT */
-		USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index),
-				cvmx_usbcx_hccharx, epdir,
-				CVMX_USB_DIRECTION_OUT);
-		/*
-		 * Setup send the control header instead of the buffer data. The
-		 * buffer data will be used in the next stage
-		 */
-		cvmx_write64_uint64(CVMX_USBNX_DMA0_OUTB_CHN0(usb->index) +
-					channel * 8,
-				    transaction->control_header);
-		break;
-	case CVMX_USB_STAGE_SETUP_SPLIT_COMPLETE:
-		usbc_hctsiz.s.pid = 3; /* Setup */
-		bytes_to_transfer = 0;
-		/* All Control operations start with a setup going OUT */
-		USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index),
-				cvmx_usbcx_hccharx, epdir,
-				CVMX_USB_DIRECTION_OUT);
-
-		USB_SET_FIELD32(CVMX_USBCX_HCSPLTX(channel, usb->index),
-				cvmx_usbcx_hcspltx, compsplt, 1);
-		break;
-	case CVMX_USB_STAGE_DATA:
-		usbc_hctsiz.s.pid = cvmx_usb_get_data_pid(pipe);
-		if (cvmx_usb_pipe_needs_split(usb, pipe)) {
-			if (header->bRequestType & USB_DIR_IN)
-				bytes_to_transfer = 0;
-			else if (bytes_to_transfer > pipe->max_packet)
-				bytes_to_transfer = pipe->max_packet;
-		}
-		USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index),
-				cvmx_usbcx_hccharx, epdir,
-				((header->bRequestType & USB_DIR_IN) ?
-					CVMX_USB_DIRECTION_IN :
-					CVMX_USB_DIRECTION_OUT));
-		break;
-	case CVMX_USB_STAGE_DATA_SPLIT_COMPLETE:
-		usbc_hctsiz.s.pid = cvmx_usb_get_data_pid(pipe);
-		if (!(header->bRequestType & USB_DIR_IN))
-			bytes_to_transfer = 0;
-		USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index),
-				cvmx_usbcx_hccharx, epdir,
-				((header->bRequestType & USB_DIR_IN) ?
-					CVMX_USB_DIRECTION_IN :
-					CVMX_USB_DIRECTION_OUT));
-		USB_SET_FIELD32(CVMX_USBCX_HCSPLTX(channel, usb->index),
-				cvmx_usbcx_hcspltx, compsplt, 1);
-		break;
-	case CVMX_USB_STAGE_STATUS:
-		usbc_hctsiz.s.pid = cvmx_usb_get_data_pid(pipe);
-		bytes_to_transfer = 0;
-		USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index),
-				cvmx_usbcx_hccharx, epdir,
-				((header->bRequestType & USB_DIR_IN) ?
-					CVMX_USB_DIRECTION_OUT :
-					CVMX_USB_DIRECTION_IN));
-		break;
-	case CVMX_USB_STAGE_STATUS_SPLIT_COMPLETE:
-		usbc_hctsiz.s.pid = cvmx_usb_get_data_pid(pipe);
-		bytes_to_transfer = 0;
-		USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index),
-				cvmx_usbcx_hccharx, epdir,
-				((header->bRequestType & USB_DIR_IN) ?
-					CVMX_USB_DIRECTION_OUT :
-					CVMX_USB_DIRECTION_IN));
-		USB_SET_FIELD32(CVMX_USBCX_HCSPLTX(channel, usb->index),
-				cvmx_usbcx_hcspltx, compsplt, 1);
-		break;
-	}
-
-	/*
-	 * Make sure the transfer never exceeds the byte limit of the hardware.
-	 * Further bytes will be sent as continued transactions
-	 */
-	if (bytes_to_transfer > MAX_TRANSFER_BYTES) {
-		/* Round MAX_TRANSFER_BYTES to a multiple of out packet size */
-		bytes_to_transfer = MAX_TRANSFER_BYTES / pipe->max_packet;
-		bytes_to_transfer *= pipe->max_packet;
-	}
-
-	/*
-	 * Calculate the number of packets to transfer. If the length is zero
-	 * we still need to transfer one packet
-	 */
-	packets_to_transfer = DIV_ROUND_UP(bytes_to_transfer,
-					   pipe->max_packet);
-	if (packets_to_transfer == 0) {
-		packets_to_transfer = 1;
-	} else if ((packets_to_transfer > 1) &&
-			(usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA)) {
-		/*
-		 * Limit to one packet when not using DMA. Channels must be
-		 * restarted between every packet for IN transactions, so there
-		 * is no reason to do multiple packets in a row
-		 */
-		packets_to_transfer = 1;
-		bytes_to_transfer = packets_to_transfer * pipe->max_packet;
-	} else if (packets_to_transfer > MAX_TRANSFER_PACKETS) {
-		/*
-		 * Limit the number of packet and data transferred to what the
-		 * hardware can handle
-		 */
-		packets_to_transfer = MAX_TRANSFER_PACKETS;
-		bytes_to_transfer = packets_to_transfer * pipe->max_packet;
-	}
-
-	usbc_hctsiz.s.xfersize = bytes_to_transfer;
-	usbc_hctsiz.s.pktcnt = packets_to_transfer;
-
-	cvmx_usb_write_csr32(usb, CVMX_USBCX_HCTSIZX(channel, usb->index),
-			     usbc_hctsiz.u32);
-}
-
-/**
- * Start a channel to perform the pipe's head transaction
- *
- * @usb:	  USB device state populated by cvmx_usb_initialize().
- * @channel:	  Channel to setup
- * @pipe:	  Pipe to start
- */
-static void cvmx_usb_start_channel(struct octeon_hcd *usb, int channel,
-				   struct cvmx_usb_pipe *pipe)
-{
-	struct cvmx_usb_transaction *transaction =
-		list_first_entry(&pipe->transactions, typeof(*transaction),
-				 node);
-
-	/* Make sure all writes to the DMA region get flushed */
-	CVMX_SYNCW;
-
-	/* Attach the channel to the pipe */
-	usb->pipe_for_channel[channel] = pipe;
-	pipe->channel = channel;
-	pipe->flags |= CVMX_USB_PIPE_FLAGS_SCHEDULED;
-
-	/* Mark this channel as in use */
-	usb->idle_hardware_channels &= ~(1 << channel);
-
-	/* Enable the channel interrupt bits */
-	{
-		union cvmx_usbcx_hcintx usbc_hcint;
-		union cvmx_usbcx_hcintmskx usbc_hcintmsk;
-		union cvmx_usbcx_haintmsk usbc_haintmsk;
-
-		/* Clear all channel status bits */
-		usbc_hcint.u32 = cvmx_usb_read_csr32(usb,
-					CVMX_USBCX_HCINTX(channel, usb->index));
-
-		cvmx_usb_write_csr32(usb,
-				     CVMX_USBCX_HCINTX(channel, usb->index),
-				     usbc_hcint.u32);
-
-		usbc_hcintmsk.u32 = 0;
-		usbc_hcintmsk.s.chhltdmsk = 1;
-		if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA) {
-			/*
-			 * Channels need these extra interrupts when we aren't
-			 * in DMA mode.
-			 */
-			usbc_hcintmsk.s.datatglerrmsk = 1;
-			usbc_hcintmsk.s.frmovrunmsk = 1;
-			usbc_hcintmsk.s.bblerrmsk = 1;
-			usbc_hcintmsk.s.xacterrmsk = 1;
-			if (cvmx_usb_pipe_needs_split(usb, pipe)) {
-				/*
-				 * Splits don't generate xfercompl, so we need
-				 * ACK and NYET.
-				 */
-				usbc_hcintmsk.s.nyetmsk = 1;
-				usbc_hcintmsk.s.ackmsk = 1;
-			}
-			usbc_hcintmsk.s.nakmsk = 1;
-			usbc_hcintmsk.s.stallmsk = 1;
-			usbc_hcintmsk.s.xfercomplmsk = 1;
-		}
-		cvmx_usb_write_csr32(usb,
-				     CVMX_USBCX_HCINTMSKX(channel, usb->index),
-				     usbc_hcintmsk.u32);
-
-		/* Enable the channel interrupt to propagate */
-		usbc_haintmsk.u32 = cvmx_usb_read_csr32(usb,
-					CVMX_USBCX_HAINTMSK(usb->index));
-		usbc_haintmsk.s.haintmsk |= 1 << channel;
-		cvmx_usb_write_csr32(usb, CVMX_USBCX_HAINTMSK(usb->index),
-				     usbc_haintmsk.u32);
-	}
-
-	/* Setup the location the DMA engine uses. */
-	{
-		u64 reg;
-		u64 dma_address = transaction->buffer +
-				  transaction->actual_bytes;
-
-		if (transaction->type == CVMX_USB_TRANSFER_ISOCHRONOUS)
-			dma_address = transaction->buffer +
-					transaction->iso_packets[0].offset +
-					transaction->actual_bytes;
-
-		if (pipe->transfer_dir == CVMX_USB_DIRECTION_OUT)
-			reg = CVMX_USBNX_DMA0_OUTB_CHN0(usb->index);
-		else
-			reg = CVMX_USBNX_DMA0_INB_CHN0(usb->index);
-		cvmx_write64_uint64(reg + channel * 8, dma_address);
-	}
-
-	/* Setup both the size of the transfer and the SPLIT characteristics */
-	{
-		union cvmx_usbcx_hcspltx usbc_hcsplt = {.u32 = 0};
-		union cvmx_usbcx_hctsizx usbc_hctsiz = {.u32 = 0};
-		int packets_to_transfer;
-		int bytes_to_transfer = transaction->buffer_length -
-			transaction->actual_bytes;
-
-		/*
-		 * ISOCHRONOUS transactions store each individual transfer size
-		 * in the packet structure, not the global buffer_length
-		 */
-		if (transaction->type == CVMX_USB_TRANSFER_ISOCHRONOUS)
-			bytes_to_transfer =
-				transaction->iso_packets[0].length -
-				transaction->actual_bytes;
-
-		/*
-		 * We need to do split transactions when we are talking to non
-		 * high speed devices that are behind a high speed hub
-		 */
-		if (cvmx_usb_pipe_needs_split(usb, pipe)) {
-			/*
-			 * On the start split phase (stage is even) record the
-			 * frame number we will need to send the split complete.
-			 * We only store the lower two bits since the time ahead
-			 * can only be two frames
-			 */
-			if ((transaction->stage & 1) == 0) {
-				if (transaction->type == CVMX_USB_TRANSFER_BULK)
-					pipe->split_sc_frame =
-						(usb->frame_number + 1) & 0x7f;
-				else
-					pipe->split_sc_frame =
-						(usb->frame_number + 2) & 0x7f;
-			} else {
-				pipe->split_sc_frame = -1;
-			}
-
-			usbc_hcsplt.s.spltena = 1;
-			usbc_hcsplt.s.hubaddr = pipe->hub_device_addr;
-			usbc_hcsplt.s.prtaddr = pipe->hub_port;
-			usbc_hcsplt.s.compsplt = (transaction->stage ==
-				CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE);
-
-			/*
-			 * SPLIT transactions can only ever transmit one data
-			 * packet so limit the transfer size to the max packet
-			 * size
-			 */
-			if (bytes_to_transfer > pipe->max_packet)
-				bytes_to_transfer = pipe->max_packet;
-
-			/*
-			 * ISOCHRONOUS OUT splits are unique in that they limit
-			 * data transfers to 188 byte chunks representing the
-			 * begin/middle/end of the data or all
-			 */
-			if (!usbc_hcsplt.s.compsplt &&
-			    (pipe->transfer_dir == CVMX_USB_DIRECTION_OUT) &&
-			    (pipe->transfer_type ==
-			     CVMX_USB_TRANSFER_ISOCHRONOUS)) {
-				/*
-				 * Clear the split complete frame number as
-				 * there isn't going to be a split complete
-				 */
-				pipe->split_sc_frame = -1;
-				/*
-				 * See if we've started this transfer and sent
-				 * data
-				 */
-				if (transaction->actual_bytes == 0) {
-					/*
-					 * Nothing sent yet, this is either a
-					 * begin or the entire payload
-					 */
-					if (bytes_to_transfer <= 188)
-						/* Entire payload in one go */
-						usbc_hcsplt.s.xactpos = 3;
-					else
-						/* First part of payload */
-						usbc_hcsplt.s.xactpos = 2;
-				} else {
-					/*
-					 * Continuing the previous data, we must
-					 * either be in the middle or at the end
-					 */
-					if (bytes_to_transfer <= 188)
-						/* End of payload */
-						usbc_hcsplt.s.xactpos = 1;
-					else
-						/* Middle of payload */
-						usbc_hcsplt.s.xactpos = 0;
-				}
-				/*
-				 * Again, the transfer size is limited to 188
-				 * bytes
-				 */
-				if (bytes_to_transfer > 188)
-					bytes_to_transfer = 188;
-			}
-		}
-
-		/*
-		 * Make sure the transfer never exceeds the byte limit of the
-		 * hardware. Further bytes will be sent as continued
-		 * transactions
-		 */
-		if (bytes_to_transfer > MAX_TRANSFER_BYTES) {
-			/*
-			 * Round MAX_TRANSFER_BYTES to a multiple of out packet
-			 * size
-			 */
-			bytes_to_transfer = MAX_TRANSFER_BYTES /
-				pipe->max_packet;
-			bytes_to_transfer *= pipe->max_packet;
-		}
-
-		/*
-		 * Calculate the number of packets to transfer. If the length is
-		 * zero we still need to transfer one packet
-		 */
-		packets_to_transfer =
-			DIV_ROUND_UP(bytes_to_transfer, pipe->max_packet);
-		if (packets_to_transfer == 0) {
-			packets_to_transfer = 1;
-		} else if ((packets_to_transfer > 1) &&
-			   (usb->init_flags &
-			    CVMX_USB_INITIALIZE_FLAGS_NO_DMA)) {
-			/*
-			 * Limit to one packet when not using DMA. Channels must
-			 * be restarted between every packet for IN
-			 * transactions, so there is no reason to do multiple
-			 * packets in a row
-			 */
-			packets_to_transfer = 1;
-			bytes_to_transfer = packets_to_transfer *
-				pipe->max_packet;
-		} else if (packets_to_transfer > MAX_TRANSFER_PACKETS) {
-			/*
-			 * Limit the number of packet and data transferred to
-			 * what the hardware can handle
-			 */
-			packets_to_transfer = MAX_TRANSFER_PACKETS;
-			bytes_to_transfer = packets_to_transfer *
-				pipe->max_packet;
-		}
-
-		usbc_hctsiz.s.xfersize = bytes_to_transfer;
-		usbc_hctsiz.s.pktcnt = packets_to_transfer;
-
-		/* Update the DATA0/DATA1 toggle */
-		usbc_hctsiz.s.pid = cvmx_usb_get_data_pid(pipe);
-		/*
-		 * High speed pipes may need a hardware ping before they start
-		 */
-		if (pipe->flags & CVMX_USB_PIPE_FLAGS_NEED_PING)
-			usbc_hctsiz.s.dopng = 1;
-
-		cvmx_usb_write_csr32(usb,
-				     CVMX_USBCX_HCSPLTX(channel, usb->index),
-				     usbc_hcsplt.u32);
-		cvmx_usb_write_csr32(usb,
-				     CVMX_USBCX_HCTSIZX(channel, usb->index),
-				     usbc_hctsiz.u32);
-	}
-
-	/* Setup the Host Channel Characteristics Register */
-	{
-		union cvmx_usbcx_hccharx usbc_hcchar = {.u32 = 0};
-
-		/*
-		 * Set the startframe odd/even properly. This is only used for
-		 * periodic
-		 */
-		usbc_hcchar.s.oddfrm = usb->frame_number & 1;
-
-		/*
-		 * Set the number of back to back packets allowed by this
-		 * endpoint. Split transactions interpret "ec" as the number of
-		 * immediate retries of failure. These retries happen too
-		 * quickly, so we disable these entirely for splits
-		 */
-		if (cvmx_usb_pipe_needs_split(usb, pipe))
-			usbc_hcchar.s.ec = 1;
-		else if (pipe->multi_count < 1)
-			usbc_hcchar.s.ec = 1;
-		else if (pipe->multi_count > 3)
-			usbc_hcchar.s.ec = 3;
-		else
-			usbc_hcchar.s.ec = pipe->multi_count;
-
-		/* Set the rest of the endpoint specific settings */
-		usbc_hcchar.s.devaddr = pipe->device_addr;
-		usbc_hcchar.s.eptype = transaction->type;
-		usbc_hcchar.s.lspddev =
-			(pipe->device_speed == CVMX_USB_SPEED_LOW);
-		usbc_hcchar.s.epdir = pipe->transfer_dir;
-		usbc_hcchar.s.epnum = pipe->endpoint_num;
-		usbc_hcchar.s.mps = pipe->max_packet;
-		cvmx_usb_write_csr32(usb,
-				     CVMX_USBCX_HCCHARX(channel, usb->index),
-				     usbc_hcchar.u32);
-	}
-
-	/* Do transaction type specific fixups as needed */
-	switch (transaction->type) {
-	case CVMX_USB_TRANSFER_CONTROL:
-		cvmx_usb_start_channel_control(usb, channel, pipe);
-		break;
-	case CVMX_USB_TRANSFER_BULK:
-	case CVMX_USB_TRANSFER_INTERRUPT:
-		break;
-	case CVMX_USB_TRANSFER_ISOCHRONOUS:
-		if (!cvmx_usb_pipe_needs_split(usb, pipe)) {
-			/*
-			 * ISO transactions require different PIDs depending on
-			 * direction and how many packets are needed
-			 */
-			if (pipe->transfer_dir == CVMX_USB_DIRECTION_OUT) {
-				if (pipe->multi_count < 2) /* Need DATA0 */
-					USB_SET_FIELD32(
-						CVMX_USBCX_HCTSIZX(channel,
-								   usb->index),
-						cvmx_usbcx_hctsizx, pid, 0);
-				else /* Need MDATA */
-					USB_SET_FIELD32(
-						CVMX_USBCX_HCTSIZX(channel,
-								   usb->index),
-						cvmx_usbcx_hctsizx, pid, 3);
-			}
-		}
-		break;
-	}
-	{
-		union cvmx_usbcx_hctsizx usbc_hctsiz = { .u32 =
-			cvmx_usb_read_csr32(usb,
-					    CVMX_USBCX_HCTSIZX(channel,
-							       usb->index))
-		};
-		transaction->xfersize = usbc_hctsiz.s.xfersize;
-		transaction->pktcnt = usbc_hctsiz.s.pktcnt;
-	}
-	/* Remember when we start a split transaction */
-	if (cvmx_usb_pipe_needs_split(usb, pipe))
-		usb->active_split = transaction;
-	USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index),
-			cvmx_usbcx_hccharx, chena, 1);
-	if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA)
-		cvmx_usb_fill_tx_fifo(usb, channel);
-}
-
-/**
- * Find a pipe that is ready to be scheduled to hardware.
- * @usb:	 USB device state populated by cvmx_usb_initialize().
- * @xfer_type:	 Transfer type
- *
- * Returns: Pipe or NULL if none are ready
- */
-static struct cvmx_usb_pipe *cvmx_usb_find_ready_pipe(struct octeon_hcd *usb,
-		enum cvmx_usb_transfer xfer_type)
-{
-	struct list_head *list = usb->active_pipes + xfer_type;
-	u64 current_frame = usb->frame_number;
-	struct cvmx_usb_pipe *pipe;
-
-	list_for_each_entry(pipe, list, node) {
-		struct cvmx_usb_transaction *t =
-			list_first_entry(&pipe->transactions, typeof(*t),
-					 node);
-		if (!(pipe->flags & CVMX_USB_PIPE_FLAGS_SCHEDULED) && t &&
-		    (pipe->next_tx_frame <= current_frame) &&
-		    ((pipe->split_sc_frame == -1) ||
-		     ((((int)current_frame - pipe->split_sc_frame) & 0x7f) <
-		      0x40)) &&
-		    (!usb->active_split || (usb->active_split == t))) {
-			prefetch(t);
-			return pipe;
-		}
-	}
-	return NULL;
-}
-
-static struct cvmx_usb_pipe *cvmx_usb_next_pipe(struct octeon_hcd *usb,
-						int is_sof)
-{
-	struct cvmx_usb_pipe *pipe;
-
-	/* Find a pipe needing service. */
-	if (is_sof) {
-		/*
-		 * Only process periodic pipes on SOF interrupts. This way we
-		 * are sure that the periodic data is sent in the beginning of
-		 * the frame.
-		 */
-		pipe = cvmx_usb_find_ready_pipe(usb,
-						CVMX_USB_TRANSFER_ISOCHRONOUS);
-		if (pipe)
-			return pipe;
-		pipe = cvmx_usb_find_ready_pipe(usb,
-						CVMX_USB_TRANSFER_INTERRUPT);
-		if (pipe)
-			return pipe;
-	}
-	pipe = cvmx_usb_find_ready_pipe(usb, CVMX_USB_TRANSFER_CONTROL);
-	if (pipe)
-		return pipe;
-	return cvmx_usb_find_ready_pipe(usb, CVMX_USB_TRANSFER_BULK);
-}
-
-/**
- * Called whenever a pipe might need to be scheduled to the
- * hardware.
- *
- * @usb:	 USB device state populated by cvmx_usb_initialize().
- * @is_sof:	 True if this schedule was called on a SOF interrupt.
- */
-static void cvmx_usb_schedule(struct octeon_hcd *usb, int is_sof)
-{
-	int channel;
-	struct cvmx_usb_pipe *pipe;
-	int need_sof;
-	enum cvmx_usb_transfer ttype;
-
-	if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA) {
-		/*
-		 * Without DMA we need to be careful to not schedule something
-		 * at the end of a frame and cause an overrun.
-		 */
-		union cvmx_usbcx_hfnum hfnum = {
-			.u32 = cvmx_usb_read_csr32(usb,
-						CVMX_USBCX_HFNUM(usb->index))
-		};
-
-		union cvmx_usbcx_hfir hfir = {
-			.u32 = cvmx_usb_read_csr32(usb,
-						CVMX_USBCX_HFIR(usb->index))
-		};
-
-		if (hfnum.s.frrem < hfir.s.frint / 4)
-			goto done;
-	}
-
-	while (usb->idle_hardware_channels) {
-		/* Find an idle channel */
-		channel = __fls(usb->idle_hardware_channels);
-		if (unlikely(channel > 7))
-			break;
-
-		pipe = cvmx_usb_next_pipe(usb, is_sof);
-		if (!pipe)
-			break;
-
-		cvmx_usb_start_channel(usb, channel, pipe);
-	}
-
-done:
-	/*
-	 * Only enable SOF interrupts when we have transactions pending in the
-	 * future that might need to be scheduled
-	 */
-	need_sof = 0;
-	for (ttype = CVMX_USB_TRANSFER_CONTROL;
-	     ttype <= CVMX_USB_TRANSFER_INTERRUPT; ttype++) {
-		list_for_each_entry(pipe, &usb->active_pipes[ttype], node) {
-			if (pipe->next_tx_frame > usb->frame_number) {
-				need_sof = 1;
-				break;
-			}
-		}
-	}
-	USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index),
-			cvmx_usbcx_gintmsk, sofmsk, need_sof);
-}
-
-static void octeon_usb_urb_complete_callback(struct octeon_hcd *usb,
-					     enum cvmx_usb_status status,
-					     struct cvmx_usb_pipe *pipe,
-					     struct cvmx_usb_transaction
-						*transaction,
-					     int bytes_transferred,
-					     struct urb *urb)
-{
-	struct usb_hcd *hcd = octeon_to_hcd(usb);
-	struct device *dev = hcd->self.controller;
-
-	if (likely(status == CVMX_USB_STATUS_OK))
-		urb->actual_length = bytes_transferred;
-	else
-		urb->actual_length = 0;
-
-	urb->hcpriv = NULL;
-
-	/* For Isochronous transactions we need to update the URB packet status
-	 * list from data in our private copy
-	 */
-	if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) {
-		int i;
-		/*
-		 * The pointer to the private list is stored in the setup_packet
-		 * field.
-		 */
-		struct cvmx_usb_iso_packet *iso_packet =
-			(struct cvmx_usb_iso_packet *)urb->setup_packet;
-		/* Recalculate the transfer size by adding up each packet */
-		urb->actual_length = 0;
-		for (i = 0; i < urb->number_of_packets; i++) {
-			if (iso_packet[i].status == CVMX_USB_STATUS_OK) {
-				urb->iso_frame_desc[i].status = 0;
-				urb->iso_frame_desc[i].actual_length =
-					iso_packet[i].length;
-				urb->actual_length +=
-					urb->iso_frame_desc[i].actual_length;
-			} else {
-				dev_dbg(dev, "ISOCHRONOUS packet=%d of %d status=%d pipe=%p transaction=%p size=%d\n",
-					i, urb->number_of_packets,
-					iso_packet[i].status, pipe,
-					transaction, iso_packet[i].length);
-				urb->iso_frame_desc[i].status = -EREMOTEIO;
-			}
-		}
-		/* Free the private list now that we don't need it anymore */
-		kfree(iso_packet);
-		urb->setup_packet = NULL;
-	}
-
-	switch (status) {
-	case CVMX_USB_STATUS_OK:
-		urb->status = 0;
-		break;
-	case CVMX_USB_STATUS_CANCEL:
-		if (urb->status == 0)
-			urb->status = -ENOENT;
-		break;
-	case CVMX_USB_STATUS_STALL:
-		dev_dbg(dev, "status=stall pipe=%p transaction=%p size=%d\n",
-			pipe, transaction, bytes_transferred);
-		urb->status = -EPIPE;
-		break;
-	case CVMX_USB_STATUS_BABBLEERR:
-		dev_dbg(dev, "status=babble pipe=%p transaction=%p size=%d\n",
-			pipe, transaction, bytes_transferred);
-		urb->status = -EPIPE;
-		break;
-	case CVMX_USB_STATUS_SHORT:
-		dev_dbg(dev, "status=short pipe=%p transaction=%p size=%d\n",
-			pipe, transaction, bytes_transferred);
-		urb->status = -EREMOTEIO;
-		break;
-	case CVMX_USB_STATUS_ERROR:
-	case CVMX_USB_STATUS_XACTERR:
-	case CVMX_USB_STATUS_DATATGLERR:
-	case CVMX_USB_STATUS_FRAMEERR:
-		dev_dbg(dev, "status=%d pipe=%p transaction=%p size=%d\n",
-			status, pipe, transaction, bytes_transferred);
-		urb->status = -EPROTO;
-		break;
-	}
-	usb_hcd_unlink_urb_from_ep(octeon_to_hcd(usb), urb);
-	spin_unlock(&usb->lock);
-	usb_hcd_giveback_urb(octeon_to_hcd(usb), urb, urb->status);
-	spin_lock(&usb->lock);
-}
-
-/**
- * Signal the completion of a transaction and free it. The
- * transaction will be removed from the pipe transaction list.
- *
- * @usb:	 USB device state populated by cvmx_usb_initialize().
- * @pipe:	 Pipe the transaction is on
- * @transaction:
- *		 Transaction that completed
- * @complete_code:
- *		 Completion code
- */
-static void cvmx_usb_complete(struct octeon_hcd *usb,
-			      struct cvmx_usb_pipe *pipe,
-			      struct cvmx_usb_transaction *transaction,
-			      enum cvmx_usb_status complete_code)
-{
-	/* If this was a split then clear our split in progress marker */
-	if (usb->active_split == transaction)
-		usb->active_split = NULL;
-
-	/*
-	 * Isochronous transactions need extra processing as they might not be
-	 * done after a single data transfer
-	 */
-	if (unlikely(transaction->type == CVMX_USB_TRANSFER_ISOCHRONOUS)) {
-		/* Update the number of bytes transferred in this ISO packet */
-		transaction->iso_packets[0].length = transaction->actual_bytes;
-		transaction->iso_packets[0].status = complete_code;
-
-		/*
-		 * If there are more ISOs pending and we succeeded, schedule the
-		 * next one
-		 */
-		if ((transaction->iso_number_packets > 1) &&
-		    (complete_code == CVMX_USB_STATUS_OK)) {
-			/* No bytes transferred for this packet as of yet */
-			transaction->actual_bytes = 0;
-			/* One less ISO waiting to transfer */
-			transaction->iso_number_packets--;
-			/* Increment to the next location in our packet array */
-			transaction->iso_packets++;
-			transaction->stage = CVMX_USB_STAGE_NON_CONTROL;
-			return;
-		}
-	}
-
-	/* Remove the transaction from the pipe list */
-	list_del(&transaction->node);
-	if (list_empty(&pipe->transactions))
-		list_move_tail(&pipe->node, &usb->idle_pipes);
-	octeon_usb_urb_complete_callback(usb, complete_code, pipe,
-					 transaction,
-					 transaction->actual_bytes,
-					 transaction->urb);
-	kfree(transaction);
-}
-
-/**
- * Submit a usb transaction to a pipe. Called for all types
- * of transactions.
- *
- * @usb:
- * @pipe:	    Which pipe to submit to.
- * @type:	    Transaction type
- * @buffer:	    User buffer for the transaction
- * @buffer_length:
- *		    User buffer's length in bytes
- * @control_header:
- *		    For control transactions, the 8 byte standard header
- * @iso_start_frame:
- *		    For ISO transactions, the start frame
- * @iso_number_packets:
- *		    For ISO, the number of packet in the transaction.
- * @iso_packets:
- *		    A description of each ISO packet
- * @urb:	    URB for the callback
- *
- * Returns: Transaction or NULL on failure.
- */
-static struct cvmx_usb_transaction *cvmx_usb_submit_transaction(
-				struct octeon_hcd *usb,
-				struct cvmx_usb_pipe *pipe,
-				enum cvmx_usb_transfer type,
-				u64 buffer,
-				int buffer_length,
-				u64 control_header,
-				int iso_start_frame,
-				int iso_number_packets,
-				struct cvmx_usb_iso_packet *iso_packets,
-				struct urb *urb)
-{
-	struct cvmx_usb_transaction *transaction;
-
-	if (unlikely(pipe->transfer_type != type))
-		return NULL;
-
-	transaction = kzalloc(sizeof(*transaction), GFP_ATOMIC);
-	if (unlikely(!transaction))
-		return NULL;
-
-	transaction->type = type;
-	transaction->buffer = buffer;
-	transaction->buffer_length = buffer_length;
-	transaction->control_header = control_header;
-	/* FIXME: This is not used, implement it. */
-	transaction->iso_start_frame = iso_start_frame;
-	transaction->iso_number_packets = iso_number_packets;
-	transaction->iso_packets = iso_packets;
-	transaction->urb = urb;
-	if (transaction->type == CVMX_USB_TRANSFER_CONTROL)
-		transaction->stage = CVMX_USB_STAGE_SETUP;
-	else
-		transaction->stage = CVMX_USB_STAGE_NON_CONTROL;
-
-	if (!list_empty(&pipe->transactions)) {
-		list_add_tail(&transaction->node, &pipe->transactions);
-	} else {
-		list_add_tail(&transaction->node, &pipe->transactions);
-		list_move_tail(&pipe->node,
-			       &usb->active_pipes[pipe->transfer_type]);
-
-		/*
-		 * We may need to schedule the pipe if this was the head of the
-		 * pipe.
-		 */
-		cvmx_usb_schedule(usb, 0);
-	}
-
-	return transaction;
-}
-
-/**
- * Call to submit a USB Bulk transfer to a pipe.
- *
- * @usb:	    USB device state populated by cvmx_usb_initialize().
- * @pipe:	    Handle to the pipe for the transfer.
- * @urb:	    URB.
- *
- * Returns: A submitted transaction or NULL on failure.
- */
-static struct cvmx_usb_transaction *cvmx_usb_submit_bulk(
-						struct octeon_hcd *usb,
-						struct cvmx_usb_pipe *pipe,
-						struct urb *urb)
-{
-	return cvmx_usb_submit_transaction(usb, pipe, CVMX_USB_TRANSFER_BULK,
-					   urb->transfer_dma,
-					   urb->transfer_buffer_length,
-					   0, /* control_header */
-					   0, /* iso_start_frame */
-					   0, /* iso_number_packets */
-					   NULL, /* iso_packets */
-					   urb);
-}
-
-/**
- * Call to submit a USB Interrupt transfer to a pipe.
- *
- * @usb:	    USB device state populated by cvmx_usb_initialize().
- * @pipe:	    Handle to the pipe for the transfer.
- * @urb:	    URB returned when the callback is called.
- *
- * Returns: A submitted transaction or NULL on failure.
- */
-static struct cvmx_usb_transaction *cvmx_usb_submit_interrupt(
-						struct octeon_hcd *usb,
-						struct cvmx_usb_pipe *pipe,
-						struct urb *urb)
-{
-	return cvmx_usb_submit_transaction(usb, pipe,
-					   CVMX_USB_TRANSFER_INTERRUPT,
-					   urb->transfer_dma,
-					   urb->transfer_buffer_length,
-					   0, /* control_header */
-					   0, /* iso_start_frame */
-					   0, /* iso_number_packets */
-					   NULL, /* iso_packets */
-					   urb);
-}
-
-/**
- * Call to submit a USB Control transfer to a pipe.
- *
- * @usb:	    USB device state populated by cvmx_usb_initialize().
- * @pipe:	    Handle to the pipe for the transfer.
- * @urb:	    URB.
- *
- * Returns: A submitted transaction or NULL on failure.
- */
-static struct cvmx_usb_transaction *cvmx_usb_submit_control(
-						struct octeon_hcd *usb,
-						struct cvmx_usb_pipe *pipe,
-						struct urb *urb)
-{
-	int buffer_length = urb->transfer_buffer_length;
-	u64 control_header = urb->setup_dma;
-	struct usb_ctrlrequest *header = cvmx_phys_to_ptr(control_header);
-
-	if ((header->bRequestType & USB_DIR_IN) == 0)
-		buffer_length = le16_to_cpu(header->wLength);
-
-	return cvmx_usb_submit_transaction(usb, pipe,
-					   CVMX_USB_TRANSFER_CONTROL,
-					   urb->transfer_dma, buffer_length,
-					   control_header,
-					   0, /* iso_start_frame */
-					   0, /* iso_number_packets */
-					   NULL, /* iso_packets */
-					   urb);
-}
-
-/**
- * Call to submit a USB Isochronous transfer to a pipe.
- *
- * @usb:	    USB device state populated by cvmx_usb_initialize().
- * @pipe:	    Handle to the pipe for the transfer.
- * @urb:	    URB returned when the callback is called.
- *
- * Returns: A submitted transaction or NULL on failure.
- */
-static struct cvmx_usb_transaction *cvmx_usb_submit_isochronous(
-						struct octeon_hcd *usb,
-						struct cvmx_usb_pipe *pipe,
-						struct urb *urb)
-{
-	struct cvmx_usb_iso_packet *packets;
-
-	packets = (struct cvmx_usb_iso_packet *)urb->setup_packet;
-	return cvmx_usb_submit_transaction(usb, pipe,
-					   CVMX_USB_TRANSFER_ISOCHRONOUS,
-					   urb->transfer_dma,
-					   urb->transfer_buffer_length,
-					   0, /* control_header */
-					   urb->start_frame,
-					   urb->number_of_packets,
-					   packets, urb);
-}
-
-/**
- * Cancel one outstanding request in a pipe. Canceling a request
- * can fail if the transaction has already completed before cancel
- * is called. Even after a successful cancel call, it may take
- * a frame or two for the cvmx_usb_poll() function to call the
- * associated callback.
- *
- * @usb:	 USB device state populated by cvmx_usb_initialize().
- * @pipe:	 Pipe to cancel requests in.
- * @transaction: Transaction to cancel, returned by the submit function.
- *
- * Returns: 0 or a negative error code.
- */
-static int cvmx_usb_cancel(struct octeon_hcd *usb,
-			   struct cvmx_usb_pipe *pipe,
-			   struct cvmx_usb_transaction *transaction)
-{
-	/*
-	 * If the transaction is the HEAD of the queue and scheduled. We need to
-	 * treat it special
-	 */
-	if (list_first_entry(&pipe->transactions, typeof(*transaction), node) ==
-	    transaction && (pipe->flags & CVMX_USB_PIPE_FLAGS_SCHEDULED)) {
-		union cvmx_usbcx_hccharx usbc_hcchar;
-
-		usb->pipe_for_channel[pipe->channel] = NULL;
-		pipe->flags &= ~CVMX_USB_PIPE_FLAGS_SCHEDULED;
-
-		CVMX_SYNCW;
-
-		usbc_hcchar.u32 = cvmx_usb_read_csr32(usb,
-				CVMX_USBCX_HCCHARX(pipe->channel, usb->index));
-		/*
-		 * If the channel isn't enabled then the transaction already
-		 * completed.
-		 */
-		if (usbc_hcchar.s.chena) {
-			usbc_hcchar.s.chdis = 1;
-			cvmx_usb_write_csr32(usb,
-					     CVMX_USBCX_HCCHARX(pipe->channel,
-								usb->index),
-					     usbc_hcchar.u32);
-		}
-	}
-	cvmx_usb_complete(usb, pipe, transaction, CVMX_USB_STATUS_CANCEL);
-	return 0;
-}
-
-/**
- * Cancel all outstanding requests in a pipe. Logically all this
- * does is call cvmx_usb_cancel() in a loop.
- *
- * @usb:	 USB device state populated by cvmx_usb_initialize().
- * @pipe:	 Pipe to cancel requests in.
- *
- * Returns: 0 or a negative error code.
- */
-static int cvmx_usb_cancel_all(struct octeon_hcd *usb,
-			       struct cvmx_usb_pipe *pipe)
-{
-	struct cvmx_usb_transaction *transaction, *next;
-
-	/* Simply loop through and attempt to cancel each transaction */
-	list_for_each_entry_safe(transaction, next, &pipe->transactions, node) {
-		int result = cvmx_usb_cancel(usb, pipe, transaction);
-
-		if (unlikely(result != 0))
-			return result;
-	}
-	return 0;
-}
-
-/**
- * Close a pipe created with cvmx_usb_open_pipe().
- *
- * @usb:	 USB device state populated by cvmx_usb_initialize().
- * @pipe:	 Pipe to close.
- *
- * Returns: 0 or a negative error code. EBUSY is returned if the pipe has
- *	    outstanding transfers.
- */
-static int cvmx_usb_close_pipe(struct octeon_hcd *usb,
-			       struct cvmx_usb_pipe *pipe)
-{
-	/* Fail if the pipe has pending transactions */
-	if (!list_empty(&pipe->transactions))
-		return -EBUSY;
-
-	list_del(&pipe->node);
-	kfree(pipe);
-
-	return 0;
-}
-
-/**
- * Get the current USB protocol level frame number. The frame
- * number is always in the range of 0-0x7ff.
- *
- * @usb: USB device state populated by cvmx_usb_initialize().
- *
- * Returns: USB frame number
- */
-static int cvmx_usb_get_frame_number(struct octeon_hcd *usb)
-{
-	union cvmx_usbcx_hfnum usbc_hfnum;
-
-	usbc_hfnum.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HFNUM(usb->index));
-
-	return usbc_hfnum.s.frnum;
-}
-
-static void cvmx_usb_transfer_control(struct octeon_hcd *usb,
-				      struct cvmx_usb_pipe *pipe,
-				      struct cvmx_usb_transaction *transaction,
-				      union cvmx_usbcx_hccharx usbc_hcchar,
-				      int buffer_space_left,
-				      int bytes_in_last_packet)
-{
-	switch (transaction->stage) {
-	case CVMX_USB_STAGE_NON_CONTROL:
-	case CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE:
-		/* This should be impossible */
-		cvmx_usb_complete(usb, pipe, transaction,
-				  CVMX_USB_STATUS_ERROR);
-		break;
-	case CVMX_USB_STAGE_SETUP:
-		pipe->pid_toggle = 1;
-		if (cvmx_usb_pipe_needs_split(usb, pipe)) {
-			transaction->stage =
-				CVMX_USB_STAGE_SETUP_SPLIT_COMPLETE;
-		} else {
-			struct usb_ctrlrequest *header =
-				cvmx_phys_to_ptr(transaction->control_header);
-			if (header->wLength)
-				transaction->stage = CVMX_USB_STAGE_DATA;
-			else
-				transaction->stage = CVMX_USB_STAGE_STATUS;
-		}
-		break;
-	case CVMX_USB_STAGE_SETUP_SPLIT_COMPLETE:
-		{
-			struct usb_ctrlrequest *header =
-				cvmx_phys_to_ptr(transaction->control_header);
-			if (header->wLength)
-				transaction->stage = CVMX_USB_STAGE_DATA;
-			else
-				transaction->stage = CVMX_USB_STAGE_STATUS;
-		}
-		break;
-	case CVMX_USB_STAGE_DATA:
-		if (cvmx_usb_pipe_needs_split(usb, pipe)) {
-			transaction->stage = CVMX_USB_STAGE_DATA_SPLIT_COMPLETE;
-			/*
-			 * For setup OUT data that are splits,
-			 * the hardware doesn't appear to count
-			 * transferred data. Here we manually
-			 * update the data transferred
-			 */
-			if (!usbc_hcchar.s.epdir) {
-				if (buffer_space_left < pipe->max_packet)
-					transaction->actual_bytes +=
-						buffer_space_left;
-				else
-					transaction->actual_bytes +=
-						pipe->max_packet;
-			}
-		} else if ((buffer_space_left == 0) ||
-			   (bytes_in_last_packet < pipe->max_packet)) {
-			pipe->pid_toggle = 1;
-			transaction->stage = CVMX_USB_STAGE_STATUS;
-		}
-		break;
-	case CVMX_USB_STAGE_DATA_SPLIT_COMPLETE:
-		if ((buffer_space_left == 0) ||
-		    (bytes_in_last_packet < pipe->max_packet)) {
-			pipe->pid_toggle = 1;
-			transaction->stage = CVMX_USB_STAGE_STATUS;
-		} else {
-			transaction->stage = CVMX_USB_STAGE_DATA;
-		}
-		break;
-	case CVMX_USB_STAGE_STATUS:
-		if (cvmx_usb_pipe_needs_split(usb, pipe))
-			transaction->stage =
-				CVMX_USB_STAGE_STATUS_SPLIT_COMPLETE;
-		else
-			cvmx_usb_complete(usb, pipe, transaction,
-					  CVMX_USB_STATUS_OK);
-		break;
-	case CVMX_USB_STAGE_STATUS_SPLIT_COMPLETE:
-		cvmx_usb_complete(usb, pipe, transaction, CVMX_USB_STATUS_OK);
-		break;
-	}
-}
-
-static void cvmx_usb_transfer_bulk(struct octeon_hcd *usb,
-				   struct cvmx_usb_pipe *pipe,
-				   struct cvmx_usb_transaction *transaction,
-				   union cvmx_usbcx_hcintx usbc_hcint,
-				   int buffer_space_left,
-				   int bytes_in_last_packet)
-{
-	/*
-	 * The only time a bulk transfer isn't complete when it finishes with
-	 * an ACK is during a split transaction. For splits we need to continue
-	 * the transfer if more data is needed.
-	 */
-	if (cvmx_usb_pipe_needs_split(usb, pipe)) {
-		if (transaction->stage == CVMX_USB_STAGE_NON_CONTROL)
-			transaction->stage =
-				CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE;
-		else if (buffer_space_left &&
-			 (bytes_in_last_packet == pipe->max_packet))
-			transaction->stage = CVMX_USB_STAGE_NON_CONTROL;
-		else
-			cvmx_usb_complete(usb, pipe, transaction,
-					  CVMX_USB_STATUS_OK);
-	} else {
-		if ((pipe->device_speed == CVMX_USB_SPEED_HIGH) &&
-		    (pipe->transfer_dir == CVMX_USB_DIRECTION_OUT) &&
-		    (usbc_hcint.s.nak))
-			pipe->flags |= CVMX_USB_PIPE_FLAGS_NEED_PING;
-		if (!buffer_space_left ||
-		    (bytes_in_last_packet < pipe->max_packet))
-			cvmx_usb_complete(usb, pipe, transaction,
-					  CVMX_USB_STATUS_OK);
-	}
-}
-
-static void cvmx_usb_transfer_intr(struct octeon_hcd *usb,
-				   struct cvmx_usb_pipe *pipe,
-				   struct cvmx_usb_transaction *transaction,
-				   int buffer_space_left,
-				   int bytes_in_last_packet)
-{
-	if (cvmx_usb_pipe_needs_split(usb, pipe)) {
-		if (transaction->stage == CVMX_USB_STAGE_NON_CONTROL) {
-			transaction->stage =
-				CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE;
-		} else if (buffer_space_left &&
-			   (bytes_in_last_packet == pipe->max_packet)) {
-			transaction->stage = CVMX_USB_STAGE_NON_CONTROL;
-		} else {
-			pipe->next_tx_frame += pipe->interval;
-			cvmx_usb_complete(usb, pipe, transaction,
-					  CVMX_USB_STATUS_OK);
-		}
-	} else if (!buffer_space_left ||
-		   (bytes_in_last_packet < pipe->max_packet)) {
-		pipe->next_tx_frame += pipe->interval;
-		cvmx_usb_complete(usb, pipe, transaction, CVMX_USB_STATUS_OK);
-	}
-}
-
-static void cvmx_usb_transfer_isoc(struct octeon_hcd *usb,
-				   struct cvmx_usb_pipe *pipe,
-				   struct cvmx_usb_transaction *transaction,
-				   int buffer_space_left,
-				   int bytes_in_last_packet,
-				   int bytes_this_transfer)
-{
-	if (cvmx_usb_pipe_needs_split(usb, pipe)) {
-		/*
-		 * ISOCHRONOUS OUT splits don't require a complete split stage.
-		 * Instead they use a sequence of begin OUT splits to transfer
-		 * the data 188 bytes at a time. Once the transfer is complete,
-		 * the pipe sleeps until the next schedule interval.
-		 */
-		if (pipe->transfer_dir == CVMX_USB_DIRECTION_OUT) {
-			/*
-			 * If no space left or this wasn't a max size packet
-			 * then this transfer is complete. Otherwise start it
-			 * again to send the next 188 bytes
-			 */
-			if (!buffer_space_left || (bytes_this_transfer < 188)) {
-				pipe->next_tx_frame += pipe->interval;
-				cvmx_usb_complete(usb, pipe, transaction,
-						  CVMX_USB_STATUS_OK);
-			}
-			return;
-		}
-		if (transaction->stage ==
-		    CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE) {
-			/*
-			 * We are in the incoming data phase. Keep getting data
-			 * until we run out of space or get a small packet
-			 */
-			if ((buffer_space_left == 0) ||
-			    (bytes_in_last_packet < pipe->max_packet)) {
-				pipe->next_tx_frame += pipe->interval;
-				cvmx_usb_complete(usb, pipe, transaction,
-						  CVMX_USB_STATUS_OK);
-			}
-		} else {
-			transaction->stage =
-				CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE;
-		}
-	} else {
-		pipe->next_tx_frame += pipe->interval;
-		cvmx_usb_complete(usb, pipe, transaction, CVMX_USB_STATUS_OK);
-	}
-}
-
-/**
- * Poll a channel for status
- *
- * @usb:     USB device
- * @channel: Channel to poll
- *
- * Returns: Zero on success
- */
-static int cvmx_usb_poll_channel(struct octeon_hcd *usb, int channel)
-{
-	struct usb_hcd *hcd = octeon_to_hcd(usb);
-	struct device *dev = hcd->self.controller;
-	union cvmx_usbcx_hcintx usbc_hcint;
-	union cvmx_usbcx_hctsizx usbc_hctsiz;
-	union cvmx_usbcx_hccharx usbc_hcchar;
-	struct cvmx_usb_pipe *pipe;
-	struct cvmx_usb_transaction *transaction;
-	int bytes_this_transfer;
-	int bytes_in_last_packet;
-	int packets_processed;
-	int buffer_space_left;
-
-	/* Read the interrupt status bits for the channel */
-	usbc_hcint.u32 = cvmx_usb_read_csr32(usb,
-				CVMX_USBCX_HCINTX(channel, usb->index));
-
-	if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA) {
-		usbc_hcchar.u32 = cvmx_usb_read_csr32(usb,
-				CVMX_USBCX_HCCHARX(channel, usb->index));
-
-		if (usbc_hcchar.s.chena && usbc_hcchar.s.chdis) {
-			/*
-			 * There seems to be a bug in CN31XX which can cause
-			 * interrupt IN transfers to get stuck until we do a
-			 * write of HCCHARX without changing things
-			 */
-			cvmx_usb_write_csr32(usb,
-					     CVMX_USBCX_HCCHARX(channel,
-								usb->index),
-					     usbc_hcchar.u32);
-			return 0;
-		}
-
-		/*
-		 * In non DMA mode the channels don't halt themselves. We need
-		 * to manually disable channels that are left running
-		 */
-		if (!usbc_hcint.s.chhltd) {
-			if (usbc_hcchar.s.chena) {
-				union cvmx_usbcx_hcintmskx hcintmsk;
-				/* Disable all interrupts except CHHLTD */
-				hcintmsk.u32 = 0;
-				hcintmsk.s.chhltdmsk = 1;
-				cvmx_usb_write_csr32(usb,
-						     CVMX_USBCX_HCINTMSKX(channel, usb->index),
-						     hcintmsk.u32);
-				usbc_hcchar.s.chdis = 1;
-				cvmx_usb_write_csr32(usb,
-						     CVMX_USBCX_HCCHARX(channel, usb->index),
-						     usbc_hcchar.u32);
-				return 0;
-			} else if (usbc_hcint.s.xfercompl) {
-				/*
-				 * Successful IN/OUT with transfer complete.
-				 * Channel halt isn't needed.
-				 */
-			} else {
-				dev_err(dev, "USB%d: Channel %d interrupt without halt\n",
-					usb->index, channel);
-				return 0;
-			}
-		}
-	} else {
-		/*
-		 * There is are no interrupts that we need to process when the
-		 * channel is still running
-		 */
-		if (!usbc_hcint.s.chhltd)
-			return 0;
-	}
-
-	/* Disable the channel interrupts now that it is done */
-	cvmx_usb_write_csr32(usb, CVMX_USBCX_HCINTMSKX(channel, usb->index), 0);
-	usb->idle_hardware_channels |= (1 << channel);
-
-	/* Make sure this channel is tied to a valid pipe */
-	pipe = usb->pipe_for_channel[channel];
-	prefetch(pipe);
-	if (!pipe)
-		return 0;
-	transaction = list_first_entry(&pipe->transactions,
-				       typeof(*transaction),
-				       node);
-	prefetch(transaction);
-
-	/*
-	 * Disconnect this pipe from the HW channel. Later the schedule
-	 * function will figure out which pipe needs to go
-	 */
-	usb->pipe_for_channel[channel] = NULL;
-	pipe->flags &= ~CVMX_USB_PIPE_FLAGS_SCHEDULED;
-
-	/*
-	 * Read the channel config info so we can figure out how much data
-	 * transferred
-	 */
-	usbc_hcchar.u32 = cvmx_usb_read_csr32(usb,
-			CVMX_USBCX_HCCHARX(channel, usb->index));
-	usbc_hctsiz.u32 = cvmx_usb_read_csr32(usb,
-			CVMX_USBCX_HCTSIZX(channel, usb->index));
-
-	/*
-	 * Calculating the number of bytes successfully transferred is dependent
-	 * on the transfer direction
-	 */
-	packets_processed = transaction->pktcnt - usbc_hctsiz.s.pktcnt;
-	if (usbc_hcchar.s.epdir) {
-		/*
-		 * IN transactions are easy. For every byte received the
-		 * hardware decrements xfersize. All we need to do is subtract
-		 * the current value of xfersize from its starting value and we
-		 * know how many bytes were written to the buffer
-		 */
-		bytes_this_transfer = transaction->xfersize -
-			usbc_hctsiz.s.xfersize;
-	} else {
-		/*
-		 * OUT transaction don't decrement xfersize. Instead pktcnt is
-		 * decremented on every successful packet send. The hardware
-		 * does this when it receives an ACK, or NYET. If it doesn't
-		 * receive one of these responses pktcnt doesn't change
-		 */
-		bytes_this_transfer = packets_processed * usbc_hcchar.s.mps;
-		/*
-		 * The last packet may not be a full transfer if we didn't have
-		 * enough data
-		 */
-		if (bytes_this_transfer > transaction->xfersize)
-			bytes_this_transfer = transaction->xfersize;
-	}
-	/* Figure out how many bytes were in the last packet of the transfer */
-	if (packets_processed)
-		bytes_in_last_packet = bytes_this_transfer -
-			(packets_processed - 1) * usbc_hcchar.s.mps;
-	else
-		bytes_in_last_packet = bytes_this_transfer;
-
-	/*
-	 * As a special case, setup transactions output the setup header, not
-	 * the user's data. For this reason we don't count setup data as bytes
-	 * transferred
-	 */
-	if ((transaction->stage == CVMX_USB_STAGE_SETUP) ||
-	    (transaction->stage == CVMX_USB_STAGE_SETUP_SPLIT_COMPLETE))
-		bytes_this_transfer = 0;
-
-	/*
-	 * Add the bytes transferred to the running total. It is important that
-	 * bytes_this_transfer doesn't count any data that needs to be
-	 * retransmitted
-	 */
-	transaction->actual_bytes += bytes_this_transfer;
-	if (transaction->type == CVMX_USB_TRANSFER_ISOCHRONOUS)
-		buffer_space_left = transaction->iso_packets[0].length -
-			transaction->actual_bytes;
-	else
-		buffer_space_left = transaction->buffer_length -
-			transaction->actual_bytes;
-
-	/*
-	 * We need to remember the PID toggle state for the next transaction.
-	 * The hardware already updated it for the next transaction
-	 */
-	pipe->pid_toggle = !(usbc_hctsiz.s.pid == 0);
-
-	/*
-	 * For high speed bulk out, assume the next transaction will need to do
-	 * a ping before proceeding. If this isn't true the ACK processing below
-	 * will clear this flag
-	 */
-	if ((pipe->device_speed == CVMX_USB_SPEED_HIGH) &&
-	    (pipe->transfer_type == CVMX_USB_TRANSFER_BULK) &&
-	    (pipe->transfer_dir == CVMX_USB_DIRECTION_OUT))
-		pipe->flags |= CVMX_USB_PIPE_FLAGS_NEED_PING;
-
-	if (WARN_ON_ONCE(bytes_this_transfer < 0)) {
-		/*
-		 * In some rare cases the DMA engine seems to get stuck and
-		 * keeps substracting same byte count over and over again. In
-		 * such case we just need to fail every transaction.
-		 */
-		cvmx_usb_complete(usb, pipe, transaction,
-				  CVMX_USB_STATUS_ERROR);
-		return 0;
-	}
-
-	if (usbc_hcint.s.stall) {
-		/*
-		 * STALL as a response means this transaction cannot be
-		 * completed because the device can't process transactions. Tell
-		 * the user. Any data that was transferred will be counted on
-		 * the actual bytes transferred
-		 */
-		pipe->pid_toggle = 0;
-		cvmx_usb_complete(usb, pipe, transaction,
-				  CVMX_USB_STATUS_STALL);
-	} else if (usbc_hcint.s.xacterr) {
-		/*
-		 * XactErr as a response means the device signaled
-		 * something wrong with the transfer. For example, PID
-		 * toggle errors cause these.
-		 */
-		cvmx_usb_complete(usb, pipe, transaction,
-				  CVMX_USB_STATUS_XACTERR);
-	} else if (usbc_hcint.s.bblerr) {
-		/* Babble Error (BblErr) */
-		cvmx_usb_complete(usb, pipe, transaction,
-				  CVMX_USB_STATUS_BABBLEERR);
-	} else if (usbc_hcint.s.datatglerr) {
-		/* Data toggle error */
-		cvmx_usb_complete(usb, pipe, transaction,
-				  CVMX_USB_STATUS_DATATGLERR);
-	} else if (usbc_hcint.s.nyet) {
-		/*
-		 * NYET as a response is only allowed in three cases: as a
-		 * response to a ping, as a response to a split transaction, and
-		 * as a response to a bulk out. The ping case is handled by
-		 * hardware, so we only have splits and bulk out
-		 */
-		if (!cvmx_usb_pipe_needs_split(usb, pipe)) {
-			transaction->retries = 0;
-			/*
-			 * If there is more data to go then we need to try
-			 * again. Otherwise this transaction is complete
-			 */
-			if ((buffer_space_left == 0) ||
-			    (bytes_in_last_packet < pipe->max_packet))
-				cvmx_usb_complete(usb, pipe,
-						  transaction,
-						  CVMX_USB_STATUS_OK);
-		} else {
-			/*
-			 * Split transactions retry the split complete 4 times
-			 * then rewind to the start split and do the entire
-			 * transactions again
-			 */
-			transaction->retries++;
-			if ((transaction->retries & 0x3) == 0) {
-				/*
-				 * Rewind to the beginning of the transaction by
-				 * anding off the split complete bit
-				 */
-				transaction->stage &= ~1;
-				pipe->split_sc_frame = -1;
-			}
-		}
-	} else if (usbc_hcint.s.ack) {
-		transaction->retries = 0;
-		/*
-		 * The ACK bit can only be checked after the other error bits.
-		 * This is because a multi packet transfer may succeed in a
-		 * number of packets and then get a different response on the
-		 * last packet. In this case both ACK and the last response bit
-		 * will be set. If none of the other response bits is set, then
-		 * the last packet must have been an ACK
-		 *
-		 * Since we got an ACK, we know we don't need to do a ping on
-		 * this pipe
-		 */
-		pipe->flags &= ~CVMX_USB_PIPE_FLAGS_NEED_PING;
-
-		switch (transaction->type) {
-		case CVMX_USB_TRANSFER_CONTROL:
-			cvmx_usb_transfer_control(usb, pipe, transaction,
-						  usbc_hcchar,
-						  buffer_space_left,
-						  bytes_in_last_packet);
-			break;
-		case CVMX_USB_TRANSFER_BULK:
-			cvmx_usb_transfer_bulk(usb, pipe, transaction,
-					       usbc_hcint, buffer_space_left,
-					       bytes_in_last_packet);
-			break;
-		case CVMX_USB_TRANSFER_INTERRUPT:
-			cvmx_usb_transfer_intr(usb, pipe, transaction,
-					       buffer_space_left,
-					       bytes_in_last_packet);
-			break;
-		case CVMX_USB_TRANSFER_ISOCHRONOUS:
-			cvmx_usb_transfer_isoc(usb, pipe, transaction,
-					       buffer_space_left,
-					       bytes_in_last_packet,
-					       bytes_this_transfer);
-			break;
-		}
-	} else if (usbc_hcint.s.nak) {
-		/*
-		 * If this was a split then clear our split in progress marker.
-		 */
-		if (usb->active_split == transaction)
-			usb->active_split = NULL;
-		/*
-		 * NAK as a response means the device couldn't accept the
-		 * transaction, but it should be retried in the future. Rewind
-		 * to the beginning of the transaction by anding off the split
-		 * complete bit. Retry in the next interval
-		 */
-		transaction->retries = 0;
-		transaction->stage &= ~1;
-		pipe->next_tx_frame += pipe->interval;
-		if (pipe->next_tx_frame < usb->frame_number)
-			pipe->next_tx_frame = usb->frame_number +
-				pipe->interval -
-				(usb->frame_number - pipe->next_tx_frame) %
-				pipe->interval;
-	} else {
-		struct cvmx_usb_port_status port;
-
-		port = cvmx_usb_get_status(usb);
-		if (port.port_enabled) {
-			/* We'll retry the exact same transaction again */
-			transaction->retries++;
-		} else {
-			/*
-			 * We get channel halted interrupts with no result bits
-			 * sets when the cable is unplugged
-			 */
-			cvmx_usb_complete(usb, pipe, transaction,
-					  CVMX_USB_STATUS_ERROR);
-		}
-	}
-	return 0;
-}
-
-static void octeon_usb_port_callback(struct octeon_hcd *usb)
-{
-	spin_unlock(&usb->lock);
-	usb_hcd_poll_rh_status(octeon_to_hcd(usb));
-	spin_lock(&usb->lock);
-}
-
-/**
- * Poll the USB block for status and call all needed callback
- * handlers. This function is meant to be called in the interrupt
- * handler for the USB controller. It can also be called
- * periodically in a loop for non-interrupt based operation.
- *
- * @usb: USB device state populated by cvmx_usb_initialize().
- *
- * Returns: 0 or a negative error code.
- */
-static int cvmx_usb_poll(struct octeon_hcd *usb)
-{
-	union cvmx_usbcx_hfnum usbc_hfnum;
-	union cvmx_usbcx_gintsts usbc_gintsts;
-
-	prefetch_range(usb, sizeof(*usb));
-
-	/* Update the frame counter */
-	usbc_hfnum.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HFNUM(usb->index));
-	if ((usb->frame_number & 0x3fff) > usbc_hfnum.s.frnum)
-		usb->frame_number += 0x4000;
-	usb->frame_number &= ~0x3fffull;
-	usb->frame_number |= usbc_hfnum.s.frnum;
-
-	/* Read the pending interrupts */
-	usbc_gintsts.u32 = cvmx_usb_read_csr32(usb,
-					       CVMX_USBCX_GINTSTS(usb->index));
-
-	/* Clear the interrupts now that we know about them */
-	cvmx_usb_write_csr32(usb, CVMX_USBCX_GINTSTS(usb->index),
-			     usbc_gintsts.u32);
-
-	if (usbc_gintsts.s.rxflvl) {
-		/*
-		 * RxFIFO Non-Empty (RxFLvl)
-		 * Indicates that there is at least one packet pending to be
-		 * read from the RxFIFO.
-		 *
-		 * In DMA mode this is handled by hardware
-		 */
-		if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA)
-			cvmx_usb_poll_rx_fifo(usb);
-	}
-	if (usbc_gintsts.s.ptxfemp || usbc_gintsts.s.nptxfemp) {
-		/* Fill the Tx FIFOs when not in DMA mode */
-		if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA)
-			cvmx_usb_poll_tx_fifo(usb);
-	}
-	if (usbc_gintsts.s.disconnint || usbc_gintsts.s.prtint) {
-		union cvmx_usbcx_hprt usbc_hprt;
-		/*
-		 * Disconnect Detected Interrupt (DisconnInt)
-		 * Asserted when a device disconnect is detected.
-		 *
-		 * Host Port Interrupt (PrtInt)
-		 * The core sets this bit to indicate a change in port status of
-		 * one of the O2P USB core ports in Host mode. The application
-		 * must read the Host Port Control and Status (HPRT) register to
-		 * determine the exact event that caused this interrupt. The
-		 * application must clear the appropriate status bit in the Host
-		 * Port Control and Status register to clear this bit.
-		 *
-		 * Call the user's port callback
-		 */
-		octeon_usb_port_callback(usb);
-		/* Clear the port change bits */
-		usbc_hprt.u32 =
-			cvmx_usb_read_csr32(usb, CVMX_USBCX_HPRT(usb->index));
-		usbc_hprt.s.prtena = 0;
-		cvmx_usb_write_csr32(usb, CVMX_USBCX_HPRT(usb->index),
-				     usbc_hprt.u32);
-	}
-	if (usbc_gintsts.s.hchint) {
-		/*
-		 * Host Channels Interrupt (HChInt)
-		 * The core sets this bit to indicate that an interrupt is
-		 * pending on one of the channels of the core (in Host mode).
-		 * The application must read the Host All Channels Interrupt
-		 * (HAINT) register to determine the exact number of the channel
-		 * on which the interrupt occurred, and then read the
-		 * corresponding Host Channel-n Interrupt (HCINTn) register to
-		 * determine the exact cause of the interrupt. The application
-		 * must clear the appropriate status bit in the HCINTn register
-		 * to clear this bit.
-		 */
-		union cvmx_usbcx_haint usbc_haint;
-
-		usbc_haint.u32 = cvmx_usb_read_csr32(usb,
-					CVMX_USBCX_HAINT(usb->index));
-		while (usbc_haint.u32) {
-			int channel;
-
-			channel = __fls(usbc_haint.u32);
-			cvmx_usb_poll_channel(usb, channel);
-			usbc_haint.u32 ^= 1 << channel;
-		}
-	}
-
-	cvmx_usb_schedule(usb, usbc_gintsts.s.sof);
-
-	return 0;
-}
-
-/* convert between an HCD pointer and the corresponding struct octeon_hcd */
-static inline struct octeon_hcd *hcd_to_octeon(struct usb_hcd *hcd)
-{
-	return (struct octeon_hcd *)(hcd->hcd_priv);
-}
-
-static irqreturn_t octeon_usb_irq(struct usb_hcd *hcd)
-{
-	struct octeon_hcd *usb = hcd_to_octeon(hcd);
-	unsigned long flags;
-
-	spin_lock_irqsave(&usb->lock, flags);
-	cvmx_usb_poll(usb);
-	spin_unlock_irqrestore(&usb->lock, flags);
-	return IRQ_HANDLED;
-}
-
-static int octeon_usb_start(struct usb_hcd *hcd)
-{
-	hcd->state = HC_STATE_RUNNING;
-	return 0;
-}
-
-static void octeon_usb_stop(struct usb_hcd *hcd)
-{
-	hcd->state = HC_STATE_HALT;
-}
-
-static int octeon_usb_get_frame_number(struct usb_hcd *hcd)
-{
-	struct octeon_hcd *usb = hcd_to_octeon(hcd);
-
-	return cvmx_usb_get_frame_number(usb);
-}
-
-static int octeon_usb_urb_enqueue(struct usb_hcd *hcd,
-				  struct urb *urb,
-				  gfp_t mem_flags)
-{
-	struct octeon_hcd *usb = hcd_to_octeon(hcd);
-	struct device *dev = hcd->self.controller;
-	struct cvmx_usb_transaction *transaction = NULL;
-	struct cvmx_usb_pipe *pipe;
-	unsigned long flags;
-	struct cvmx_usb_iso_packet *iso_packet;
-	struct usb_host_endpoint *ep = urb->ep;
-	int rc;
-
-	urb->status = 0;
-	spin_lock_irqsave(&usb->lock, flags);
-
-	rc = usb_hcd_link_urb_to_ep(hcd, urb);
-	if (rc) {
-		spin_unlock_irqrestore(&usb->lock, flags);
-		return rc;
-	}
-
-	if (!ep->hcpriv) {
-		enum cvmx_usb_transfer transfer_type;
-		enum cvmx_usb_speed speed;
-		int split_device = 0;
-		int split_port = 0;
-
-		switch (usb_pipetype(urb->pipe)) {
-		case PIPE_ISOCHRONOUS:
-			transfer_type = CVMX_USB_TRANSFER_ISOCHRONOUS;
-			break;
-		case PIPE_INTERRUPT:
-			transfer_type = CVMX_USB_TRANSFER_INTERRUPT;
-			break;
-		case PIPE_CONTROL:
-			transfer_type = CVMX_USB_TRANSFER_CONTROL;
-			break;
-		default:
-			transfer_type = CVMX_USB_TRANSFER_BULK;
-			break;
-		}
-		switch (urb->dev->speed) {
-		case USB_SPEED_LOW:
-			speed = CVMX_USB_SPEED_LOW;
-			break;
-		case USB_SPEED_FULL:
-			speed = CVMX_USB_SPEED_FULL;
-			break;
-		default:
-			speed = CVMX_USB_SPEED_HIGH;
-			break;
-		}
-		/*
-		 * For slow devices on high speed ports we need to find the hub
-		 * that does the speed translation so we know where to send the
-		 * split transactions.
-		 */
-		if (speed != CVMX_USB_SPEED_HIGH) {
-			/*
-			 * Start at this device and work our way up the usb
-			 * tree.
-			 */
-			struct usb_device *dev = urb->dev;
-
-			while (dev->parent) {
-				/*
-				 * If our parent is high speed then he'll
-				 * receive the splits.
-				 */
-				if (dev->parent->speed == USB_SPEED_HIGH) {
-					split_device = dev->parent->devnum;
-					split_port = dev->portnum;
-					break;
-				}
-				/*
-				 * Move up the tree one level. If we make it all
-				 * the way up the tree, then the port must not
-				 * be in high speed mode and we don't need a
-				 * split.
-				 */
-				dev = dev->parent;
-			}
-		}
-		pipe = cvmx_usb_open_pipe(usb, usb_pipedevice(urb->pipe),
-					  usb_pipeendpoint(urb->pipe), speed,
-					  le16_to_cpu(ep->desc.wMaxPacketSize)
-					  & 0x7ff,
-					  transfer_type,
-					  usb_pipein(urb->pipe) ?
-						CVMX_USB_DIRECTION_IN :
-						CVMX_USB_DIRECTION_OUT,
-					  urb->interval,
-					  (le16_to_cpu(ep->desc.wMaxPacketSize)
-					   >> 11) & 0x3,
-					  split_device, split_port);
-		if (!pipe) {
-			usb_hcd_unlink_urb_from_ep(hcd, urb);
-			spin_unlock_irqrestore(&usb->lock, flags);
-			dev_dbg(dev, "Failed to create pipe\n");
-			return -ENOMEM;
-		}
-		ep->hcpriv = pipe;
-	} else {
-		pipe = ep->hcpriv;
-	}
-
-	switch (usb_pipetype(urb->pipe)) {
-	case PIPE_ISOCHRONOUS:
-		dev_dbg(dev, "Submit isochronous to %d.%d\n",
-			usb_pipedevice(urb->pipe),
-			usb_pipeendpoint(urb->pipe));
-		/*
-		 * Allocate a structure to use for our private list of
-		 * isochronous packets.
-		 */
-		iso_packet = kmalloc_array(urb->number_of_packets,
-					   sizeof(struct cvmx_usb_iso_packet),
-					   GFP_ATOMIC);
-		if (iso_packet) {
-			int i;
-			/* Fill the list with the data from the URB */
-			for (i = 0; i < urb->number_of_packets; i++) {
-				iso_packet[i].offset =
-					urb->iso_frame_desc[i].offset;
-				iso_packet[i].length =
-					urb->iso_frame_desc[i].length;
-				iso_packet[i].status = CVMX_USB_STATUS_ERROR;
-			}
-			/*
-			 * Store a pointer to the list in the URB setup_packet
-			 * field. We know this currently isn't being used and
-			 * this saves us a bunch of logic.
-			 */
-			urb->setup_packet = (char *)iso_packet;
-			transaction = cvmx_usb_submit_isochronous(usb,
-								  pipe, urb);
-			/*
-			 * If submit failed we need to free our private packet
-			 * list.
-			 */
-			if (!transaction) {
-				urb->setup_packet = NULL;
-				kfree(iso_packet);
-			}
-		}
-		break;
-	case PIPE_INTERRUPT:
-		dev_dbg(dev, "Submit interrupt to %d.%d\n",
-			usb_pipedevice(urb->pipe),
-			usb_pipeendpoint(urb->pipe));
-		transaction = cvmx_usb_submit_interrupt(usb, pipe, urb);
-		break;
-	case PIPE_CONTROL:
-		dev_dbg(dev, "Submit control to %d.%d\n",
-			usb_pipedevice(urb->pipe),
-			usb_pipeendpoint(urb->pipe));
-		transaction = cvmx_usb_submit_control(usb, pipe, urb);
-		break;
-	case PIPE_BULK:
-		dev_dbg(dev, "Submit bulk to %d.%d\n",
-			usb_pipedevice(urb->pipe),
-			usb_pipeendpoint(urb->pipe));
-		transaction = cvmx_usb_submit_bulk(usb, pipe, urb);
-		break;
-	}
-	if (!transaction) {
-		usb_hcd_unlink_urb_from_ep(hcd, urb);
-		spin_unlock_irqrestore(&usb->lock, flags);
-		dev_dbg(dev, "Failed to submit\n");
-		return -ENOMEM;
-	}
-	urb->hcpriv = transaction;
-	spin_unlock_irqrestore(&usb->lock, flags);
-	return 0;
-}
-
-static int octeon_usb_urb_dequeue(struct usb_hcd *hcd,
-				  struct urb *urb,
-				  int status)
-{
-	struct octeon_hcd *usb = hcd_to_octeon(hcd);
-	unsigned long flags;
-	int rc;
-
-	if (!urb->dev)
-		return -EINVAL;
-
-	spin_lock_irqsave(&usb->lock, flags);
-
-	rc = usb_hcd_check_unlink_urb(hcd, urb, status);
-	if (rc)
-		goto out;
-
-	urb->status = status;
-	cvmx_usb_cancel(usb, urb->ep->hcpriv, urb->hcpriv);
-
-out:
-	spin_unlock_irqrestore(&usb->lock, flags);
-
-	return rc;
-}
-
-static void octeon_usb_endpoint_disable(struct usb_hcd *hcd,
-					struct usb_host_endpoint *ep)
-{
-	struct device *dev = hcd->self.controller;
-
-	if (ep->hcpriv) {
-		struct octeon_hcd *usb = hcd_to_octeon(hcd);
-		struct cvmx_usb_pipe *pipe = ep->hcpriv;
-		unsigned long flags;
-
-		spin_lock_irqsave(&usb->lock, flags);
-		cvmx_usb_cancel_all(usb, pipe);
-		if (cvmx_usb_close_pipe(usb, pipe))
-			dev_dbg(dev, "Closing pipe %p failed\n", pipe);
-		spin_unlock_irqrestore(&usb->lock, flags);
-		ep->hcpriv = NULL;
-	}
-}
-
-static int octeon_usb_hub_status_data(struct usb_hcd *hcd, char *buf)
-{
-	struct octeon_hcd *usb = hcd_to_octeon(hcd);
-	struct cvmx_usb_port_status port_status;
-	unsigned long flags;
-
-	spin_lock_irqsave(&usb->lock, flags);
-	port_status = cvmx_usb_get_status(usb);
-	spin_unlock_irqrestore(&usb->lock, flags);
-	buf[0] = port_status.connect_change << 1;
-
-	return buf[0] != 0;
-}
-
-static int octeon_usb_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
-				  u16 wIndex, char *buf, u16 wLength)
-{
-	struct octeon_hcd *usb = hcd_to_octeon(hcd);
-	struct device *dev = hcd->self.controller;
-	struct cvmx_usb_port_status usb_port_status;
-	int port_status;
-	struct usb_hub_descriptor *desc;
-	unsigned long flags;
-
-	switch (typeReq) {
-	case ClearHubFeature:
-		dev_dbg(dev, "ClearHubFeature\n");
-		switch (wValue) {
-		case C_HUB_LOCAL_POWER:
-		case C_HUB_OVER_CURRENT:
-			/* Nothing required here */
-			break;
-		default:
-			return -EINVAL;
-		}
-		break;
-	case ClearPortFeature:
-		dev_dbg(dev, "ClearPortFeature\n");
-		if (wIndex != 1) {
-			dev_dbg(dev, " INVALID\n");
-			return -EINVAL;
-		}
-
-		switch (wValue) {
-		case USB_PORT_FEAT_ENABLE:
-			dev_dbg(dev, " ENABLE\n");
-			spin_lock_irqsave(&usb->lock, flags);
-			cvmx_usb_disable(usb);
-			spin_unlock_irqrestore(&usb->lock, flags);
-			break;
-		case USB_PORT_FEAT_SUSPEND:
-			dev_dbg(dev, " SUSPEND\n");
-			/* Not supported on Octeon */
-			break;
-		case USB_PORT_FEAT_POWER:
-			dev_dbg(dev, " POWER\n");
-			/* Not supported on Octeon */
-			break;
-		case USB_PORT_FEAT_INDICATOR:
-			dev_dbg(dev, " INDICATOR\n");
-			/* Port inidicator not supported */
-			break;
-		case USB_PORT_FEAT_C_CONNECTION:
-			dev_dbg(dev, " C_CONNECTION\n");
-			/* Clears drivers internal connect status change flag */
-			spin_lock_irqsave(&usb->lock, flags);
-			usb->port_status = cvmx_usb_get_status(usb);
-			spin_unlock_irqrestore(&usb->lock, flags);
-			break;
-		case USB_PORT_FEAT_C_RESET:
-			dev_dbg(dev, " C_RESET\n");
-			/*
-			 * Clears the driver's internal Port Reset Change flag.
-			 */
-			spin_lock_irqsave(&usb->lock, flags);
-			usb->port_status = cvmx_usb_get_status(usb);
-			spin_unlock_irqrestore(&usb->lock, flags);
-			break;
-		case USB_PORT_FEAT_C_ENABLE:
-			dev_dbg(dev, " C_ENABLE\n");
-			/*
-			 * Clears the driver's internal Port Enable/Disable
-			 * Change flag.
-			 */
-			spin_lock_irqsave(&usb->lock, flags);
-			usb->port_status = cvmx_usb_get_status(usb);
-			spin_unlock_irqrestore(&usb->lock, flags);
-			break;
-		case USB_PORT_FEAT_C_SUSPEND:
-			dev_dbg(dev, " C_SUSPEND\n");
-			/*
-			 * Clears the driver's internal Port Suspend Change
-			 * flag, which is set when resume signaling on the host
-			 * port is complete.
-			 */
-			break;
-		case USB_PORT_FEAT_C_OVER_CURRENT:
-			dev_dbg(dev, " C_OVER_CURRENT\n");
-			/* Clears the driver's overcurrent Change flag */
-			spin_lock_irqsave(&usb->lock, flags);
-			usb->port_status = cvmx_usb_get_status(usb);
-			spin_unlock_irqrestore(&usb->lock, flags);
-			break;
-		default:
-			dev_dbg(dev, " UNKNOWN\n");
-			return -EINVAL;
-		}
-		break;
-	case GetHubDescriptor:
-		dev_dbg(dev, "GetHubDescriptor\n");
-		desc = (struct usb_hub_descriptor *)buf;
-		desc->bDescLength = 9;
-		desc->bDescriptorType = 0x29;
-		desc->bNbrPorts = 1;
-		desc->wHubCharacteristics = cpu_to_le16(0x08);
-		desc->bPwrOn2PwrGood = 1;
-		desc->bHubContrCurrent = 0;
-		desc->u.hs.DeviceRemovable[0] = 0;
-		desc->u.hs.DeviceRemovable[1] = 0xff;
-		break;
-	case GetHubStatus:
-		dev_dbg(dev, "GetHubStatus\n");
-		*(__le32 *)buf = 0;
-		break;
-	case GetPortStatus:
-		dev_dbg(dev, "GetPortStatus\n");
-		if (wIndex != 1) {
-			dev_dbg(dev, " INVALID\n");
-			return -EINVAL;
-		}
-
-		spin_lock_irqsave(&usb->lock, flags);
-		usb_port_status = cvmx_usb_get_status(usb);
-		spin_unlock_irqrestore(&usb->lock, flags);
-		port_status = 0;
-
-		if (usb_port_status.connect_change) {
-			port_status |= (1 << USB_PORT_FEAT_C_CONNECTION);
-			dev_dbg(dev, " C_CONNECTION\n");
-		}
-
-		if (usb_port_status.port_enabled) {
-			port_status |= (1 << USB_PORT_FEAT_C_ENABLE);
-			dev_dbg(dev, " C_ENABLE\n");
-		}
-
-		if (usb_port_status.connected) {
-			port_status |= (1 << USB_PORT_FEAT_CONNECTION);
-			dev_dbg(dev, " CONNECTION\n");
-		}
-
-		if (usb_port_status.port_enabled) {
-			port_status |= (1 << USB_PORT_FEAT_ENABLE);
-			dev_dbg(dev, " ENABLE\n");
-		}
-
-		if (usb_port_status.port_over_current) {
-			port_status |= (1 << USB_PORT_FEAT_OVER_CURRENT);
-			dev_dbg(dev, " OVER_CURRENT\n");
-		}
-
-		if (usb_port_status.port_powered) {
-			port_status |= (1 << USB_PORT_FEAT_POWER);
-			dev_dbg(dev, " POWER\n");
-		}
-
-		if (usb_port_status.port_speed == CVMX_USB_SPEED_HIGH) {
-			port_status |= USB_PORT_STAT_HIGH_SPEED;
-			dev_dbg(dev, " HIGHSPEED\n");
-		} else if (usb_port_status.port_speed == CVMX_USB_SPEED_LOW) {
-			port_status |= (1 << USB_PORT_FEAT_LOWSPEED);
-			dev_dbg(dev, " LOWSPEED\n");
-		}
-
-		*((__le32 *)buf) = cpu_to_le32(port_status);
-		break;
-	case SetHubFeature:
-		dev_dbg(dev, "SetHubFeature\n");
-		/* No HUB features supported */
-		break;
-	case SetPortFeature:
-		dev_dbg(dev, "SetPortFeature\n");
-		if (wIndex != 1) {
-			dev_dbg(dev, " INVALID\n");
-			return -EINVAL;
-		}
-
-		switch (wValue) {
-		case USB_PORT_FEAT_SUSPEND:
-			dev_dbg(dev, " SUSPEND\n");
-			return -EINVAL;
-		case USB_PORT_FEAT_POWER:
-			dev_dbg(dev, " POWER\n");
-			/*
-			 * Program the port power bit to drive VBUS on the USB.
-			 */
-			spin_lock_irqsave(&usb->lock, flags);
-			USB_SET_FIELD32(CVMX_USBCX_HPRT(usb->index),
-					cvmx_usbcx_hprt, prtpwr, 1);
-			spin_unlock_irqrestore(&usb->lock, flags);
-			return 0;
-		case USB_PORT_FEAT_RESET:
-			dev_dbg(dev, " RESET\n");
-			spin_lock_irqsave(&usb->lock, flags);
-			cvmx_usb_reset_port(usb);
-			spin_unlock_irqrestore(&usb->lock, flags);
-			return 0;
-		case USB_PORT_FEAT_INDICATOR:
-			dev_dbg(dev, " INDICATOR\n");
-			/* Not supported */
-			break;
-		default:
-			dev_dbg(dev, " UNKNOWN\n");
-			return -EINVAL;
-		}
-		break;
-	default:
-		dev_dbg(dev, "Unknown root hub request\n");
-		return -EINVAL;
-	}
-	return 0;
-}
-
-static const struct hc_driver octeon_hc_driver = {
-	.description		= "Octeon USB",
-	.product_desc		= "Octeon Host Controller",
-	.hcd_priv_size		= sizeof(struct octeon_hcd),
-	.irq			= octeon_usb_irq,
-	.flags			= HCD_MEMORY | HCD_DMA | HCD_USB2,
-	.start			= octeon_usb_start,
-	.stop			= octeon_usb_stop,
-	.urb_enqueue		= octeon_usb_urb_enqueue,
-	.urb_dequeue		= octeon_usb_urb_dequeue,
-	.endpoint_disable	= octeon_usb_endpoint_disable,
-	.get_frame_number	= octeon_usb_get_frame_number,
-	.hub_status_data	= octeon_usb_hub_status_data,
-	.hub_control		= octeon_usb_hub_control,
-	.map_urb_for_dma	= octeon_map_urb_for_dma,
-	.unmap_urb_for_dma	= octeon_unmap_urb_for_dma,
-};
-
-static int octeon_usb_probe(struct platform_device *pdev)
-{
-	int status;
-	int initialize_flags;
-	int usb_num;
-	struct resource *res_mem;
-	struct device_node *usbn_node;
-	int irq = platform_get_irq(pdev, 0);
-	struct device *dev = &pdev->dev;
-	struct octeon_hcd *usb;
-	struct usb_hcd *hcd;
-	u32 clock_rate = 48000000;
-	bool is_crystal_clock = false;
-	const char *clock_type;
-	int i;
-
-	if (!dev->of_node) {
-		dev_err(dev, "Error: empty of_node\n");
-		return -ENXIO;
-	}
-	usbn_node = dev->of_node->parent;
-
-	i = of_property_read_u32(usbn_node,
-				 "clock-frequency", &clock_rate);
-	if (i)
-		i = of_property_read_u32(usbn_node,
-					 "refclk-frequency", &clock_rate);
-	if (i) {
-		dev_err(dev, "No USBN \"clock-frequency\"\n");
-		return -ENXIO;
-	}
-	switch (clock_rate) {
-	case 12000000:
-		initialize_flags = CVMX_USB_INITIALIZE_FLAGS_CLOCK_12MHZ;
-		break;
-	case 24000000:
-		initialize_flags = CVMX_USB_INITIALIZE_FLAGS_CLOCK_24MHZ;
-		break;
-	case 48000000:
-		initialize_flags = CVMX_USB_INITIALIZE_FLAGS_CLOCK_48MHZ;
-		break;
-	default:
-		dev_err(dev, "Illegal USBN \"clock-frequency\" %u\n",
-			clock_rate);
-		return -ENXIO;
-	}
-
-	i = of_property_read_string(usbn_node,
-				    "cavium,refclk-type", &clock_type);
-	if (i)
-		i = of_property_read_string(usbn_node,
-					    "refclk-type", &clock_type);
-
-	if (!i && strcmp("crystal", clock_type) == 0)
-		is_crystal_clock = true;
-
-	if (is_crystal_clock)
-		initialize_flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_XI;
-	else
-		initialize_flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_GND;
-
-	res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res_mem) {
-		dev_err(dev, "found no memory resource\n");
-		return -ENXIO;
-	}
-	usb_num = (res_mem->start >> 44) & 1;
-
-	if (irq < 0) {
-		/* Defective device tree, but we know how to fix it. */
-		irq_hw_number_t hwirq = usb_num ? (1 << 6) + 17 : 56;
-
-		irq = irq_create_mapping(NULL, hwirq);
-	}
-
-	/*
-	 * Set the DMA mask to 64bits so we get buffers already translated for
-	 * DMA.
-	 */
-	i = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64));
-	if (i)
-		return i;
-
-	/*
-	 * Only cn52XX and cn56XX have DWC_OTG USB hardware and the
-	 * IOB priority registers.  Under heavy network load USB
-	 * hardware can be starved by the IOB causing a crash.  Give
-	 * it a priority boost if it has been waiting more than 400
-	 * cycles to avoid this situation.
-	 *
-	 * Testing indicates that a cnt_val of 8192 is not sufficient,
-	 * but no failures are seen with 4096.  We choose a value of
-	 * 400 to give a safety factor of 10.
-	 */
-	if (OCTEON_IS_MODEL(OCTEON_CN52XX) || OCTEON_IS_MODEL(OCTEON_CN56XX)) {
-		union cvmx_iob_n2c_l2c_pri_cnt pri_cnt;
-
-		pri_cnt.u64 = 0;
-		pri_cnt.s.cnt_enb = 1;
-		pri_cnt.s.cnt_val = 400;
-		cvmx_write_csr(CVMX_IOB_N2C_L2C_PRI_CNT, pri_cnt.u64);
-	}
-
-	hcd = usb_create_hcd(&octeon_hc_driver, dev, dev_name(dev));
-	if (!hcd) {
-		dev_dbg(dev, "Failed to allocate memory for HCD\n");
-		return -1;
-	}
-	hcd->uses_new_polling = 1;
-	usb = (struct octeon_hcd *)hcd->hcd_priv;
-
-	spin_lock_init(&usb->lock);
-
-	usb->init_flags = initialize_flags;
-
-	/* Initialize the USB state structure */
-	usb->index = usb_num;
-	INIT_LIST_HEAD(&usb->idle_pipes);
-	for (i = 0; i < ARRAY_SIZE(usb->active_pipes); i++)
-		INIT_LIST_HEAD(&usb->active_pipes[i]);
-
-	/* Due to an errata, CN31XX doesn't support DMA */
-	if (OCTEON_IS_MODEL(OCTEON_CN31XX)) {
-		usb->init_flags |= CVMX_USB_INITIALIZE_FLAGS_NO_DMA;
-		/* Only use one channel with non DMA */
-		usb->idle_hardware_channels = 0x1;
-	} else if (OCTEON_IS_MODEL(OCTEON_CN5XXX)) {
-		/* CN5XXX have an errata with channel 3 */
-		usb->idle_hardware_channels = 0xf7;
-	} else {
-		usb->idle_hardware_channels = 0xff;
-	}
-
-	status = cvmx_usb_initialize(dev, usb);
-	if (status) {
-		dev_dbg(dev, "USB initialization failed with %d\n", status);
-		usb_put_hcd(hcd);
-		return -1;
-	}
-
-	status = usb_add_hcd(hcd, irq, 0);
-	if (status) {
-		dev_dbg(dev, "USB add HCD failed with %d\n", status);
-		usb_put_hcd(hcd);
-		return -1;
-	}
-	device_wakeup_enable(hcd->self.controller);
-
-	dev_info(dev, "Registered HCD for port %d on irq %d\n", usb_num, irq);
-
-	return 0;
-}
-
-static int octeon_usb_remove(struct platform_device *pdev)
-{
-	int status;
-	struct device *dev = &pdev->dev;
-	struct usb_hcd *hcd = dev_get_drvdata(dev);
-	struct octeon_hcd *usb = hcd_to_octeon(hcd);
-	unsigned long flags;
-
-	usb_remove_hcd(hcd);
-	spin_lock_irqsave(&usb->lock, flags);
-	status = cvmx_usb_shutdown(usb);
-	spin_unlock_irqrestore(&usb->lock, flags);
-	if (status)
-		dev_dbg(dev, "USB shutdown failed with %d\n", status);
-
-	usb_put_hcd(hcd);
-
-	return 0;
-}
-
-static const struct of_device_id octeon_usb_match[] = {
-	{
-		.compatible = "cavium,octeon-5750-usbc",
-	},
-	{},
-};
-MODULE_DEVICE_TABLE(of, octeon_usb_match);
-
-static struct platform_driver octeon_usb_driver = {
-	.driver = {
-		.name		= "octeon-hcd",
-		.of_match_table = octeon_usb_match,
-	},
-	.probe      = octeon_usb_probe,
-	.remove     = octeon_usb_remove,
-};
-
-static int __init octeon_usb_driver_init(void)
-{
-	if (usb_disabled())
-		return 0;
-
-	return platform_driver_register(&octeon_usb_driver);
-}
-module_init(octeon_usb_driver_init);
-
-static void __exit octeon_usb_driver_exit(void)
-{
-	if (usb_disabled())
-		return;
-
-	platform_driver_unregister(&octeon_usb_driver);
-}
-module_exit(octeon_usb_driver_exit);
-
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Cavium, Inc. <support@cavium.com>");
-MODULE_DESCRIPTION("Cavium Inc. OCTEON USB Host driver.");
diff --git a/drivers/staging/octeon-usb/octeon-hcd.h b/drivers/staging/octeon-usb/octeon-hcd.h
deleted file mode 100644
index 9ed619c93a4e..000000000000
--- a/drivers/staging/octeon-usb/octeon-hcd.h
+++ /dev/null
@@ -1,1847 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Octeon HCD hardware register definitions.
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Some parts of the code were originally released under BSD license:
- *
- * Copyright (c) 2003-2010 Cavium Networks (support@cavium.com). All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *   * Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *
- *   * Redistributions in binary form must reproduce the above
- *     copyright notice, this list of conditions and the following
- *     disclaimer in the documentation and/or other materials provided
- *     with the distribution.
- *
- *   * Neither the name of Cavium Networks nor the names of
- *     its contributors may be used to endorse or promote products
- *     derived from this software without specific prior written
- *     permission.
- *
- * This Software, including technical data, may be subject to U.S. export
- * control laws, including the U.S. Export Administration Act and its associated
- * regulations, and may be subject to export or import regulations in other
- * countries.
- *
- * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
- * AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR
- * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
- * THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION
- * OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
- * SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
- * MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
- * VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
- * CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
- * PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
- */
-
-#ifndef __OCTEON_HCD_H__
-#define __OCTEON_HCD_H__
-
-#include <asm/bitfield.h>
-
-#define CVMX_USBCXBASE 0x00016F0010000000ull
-#define CVMX_USBCXREG1(reg, bid) \
-	(CVMX_ADD_IO_SEG(CVMX_USBCXBASE | reg) + \
-	 ((bid) & 1) * 0x100000000000ull)
-#define CVMX_USBCXREG2(reg, bid, off) \
-	(CVMX_ADD_IO_SEG(CVMX_USBCXBASE | reg) + \
-	 (((off) & 7) + ((bid) & 1) * 0x8000000000ull) * 32)
-
-#define CVMX_USBCX_GAHBCFG(bid)		CVMX_USBCXREG1(0x008, bid)
-#define CVMX_USBCX_GHWCFG3(bid)		CVMX_USBCXREG1(0x04c, bid)
-#define CVMX_USBCX_GINTMSK(bid)		CVMX_USBCXREG1(0x018, bid)
-#define CVMX_USBCX_GINTSTS(bid)		CVMX_USBCXREG1(0x014, bid)
-#define CVMX_USBCX_GNPTXFSIZ(bid)	CVMX_USBCXREG1(0x028, bid)
-#define CVMX_USBCX_GNPTXSTS(bid)	CVMX_USBCXREG1(0x02c, bid)
-#define CVMX_USBCX_GOTGCTL(bid)		CVMX_USBCXREG1(0x000, bid)
-#define CVMX_USBCX_GRSTCTL(bid)		CVMX_USBCXREG1(0x010, bid)
-#define CVMX_USBCX_GRXFSIZ(bid)		CVMX_USBCXREG1(0x024, bid)
-#define CVMX_USBCX_GRXSTSPH(bid)	CVMX_USBCXREG1(0x020, bid)
-#define CVMX_USBCX_GUSBCFG(bid)		CVMX_USBCXREG1(0x00c, bid)
-#define CVMX_USBCX_HAINT(bid)		CVMX_USBCXREG1(0x414, bid)
-#define CVMX_USBCX_HAINTMSK(bid)	CVMX_USBCXREG1(0x418, bid)
-#define CVMX_USBCX_HCCHARX(off, bid)	CVMX_USBCXREG2(0x500, bid, off)
-#define CVMX_USBCX_HCFG(bid)		CVMX_USBCXREG1(0x400, bid)
-#define CVMX_USBCX_HCINTMSKX(off, bid)	CVMX_USBCXREG2(0x50c, bid, off)
-#define CVMX_USBCX_HCINTX(off, bid)	CVMX_USBCXREG2(0x508, bid, off)
-#define CVMX_USBCX_HCSPLTX(off, bid)	CVMX_USBCXREG2(0x504, bid, off)
-#define CVMX_USBCX_HCTSIZX(off, bid)	CVMX_USBCXREG2(0x510, bid, off)
-#define CVMX_USBCX_HFIR(bid)		CVMX_USBCXREG1(0x404, bid)
-#define CVMX_USBCX_HFNUM(bid)		CVMX_USBCXREG1(0x408, bid)
-#define CVMX_USBCX_HPRT(bid)		CVMX_USBCXREG1(0x440, bid)
-#define CVMX_USBCX_HPTXFSIZ(bid)	CVMX_USBCXREG1(0x100, bid)
-#define CVMX_USBCX_HPTXSTS(bid)		CVMX_USBCXREG1(0x410, bid)
-
-#define CVMX_USBNXBID1(bid) (((bid) & 1) * 0x10000000ull)
-#define CVMX_USBNXBID2(bid) (((bid) & 1) * 0x100000000000ull)
-
-#define CVMX_USBNXREG1(reg, bid) \
-	(CVMX_ADD_IO_SEG(0x0001180068000000ull | reg) + CVMX_USBNXBID1(bid))
-#define CVMX_USBNXREG2(reg, bid) \
-	(CVMX_ADD_IO_SEG(0x00016F0000000000ull | reg) + CVMX_USBNXBID2(bid))
-
-#define CVMX_USBNX_CLK_CTL(bid)		CVMX_USBNXREG1(0x10, bid)
-#define CVMX_USBNX_DMA0_INB_CHN0(bid)	CVMX_USBNXREG2(0x818, bid)
-#define CVMX_USBNX_DMA0_OUTB_CHN0(bid)	CVMX_USBNXREG2(0x858, bid)
-#define CVMX_USBNX_USBP_CTL_STATUS(bid)	CVMX_USBNXREG1(0x18, bid)
-
-/**
- * cvmx_usbc#_gahbcfg
- *
- * Core AHB Configuration Register (GAHBCFG)
- *
- * This register can be used to configure the core after power-on or a change in
- * mode of operation. This register mainly contains AHB system-related
- * configuration parameters. The AHB is the processor interface to the O2P USB
- * core. In general, software need not know about this interface except to
- * program the values as specified.
- *
- * The application must program this register as part of the O2P USB core
- * initialization. Do not change this register after the initial programming.
- */
-union cvmx_usbcx_gahbcfg {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_gahbcfg_s
-	 * @ptxfemplvl: Periodic TxFIFO Empty Level (PTxFEmpLvl)
-	 *	Software should set this bit to 0x1.
-	 *	Indicates when the Periodic TxFIFO Empty Interrupt bit in the
-	 *	Core Interrupt register (GINTSTS.PTxFEmp) is triggered. This
-	 *	bit is used only in Slave mode.
-	 *	* 1'b0: GINTSTS.PTxFEmp interrupt indicates that the Periodic
-	 *	TxFIFO is half empty
-	 *	* 1'b1: GINTSTS.PTxFEmp interrupt indicates that the Periodic
-	 *	TxFIFO is completely empty
-	 * @nptxfemplvl: Non-Periodic TxFIFO Empty Level (NPTxFEmpLvl)
-	 *	Software should set this bit to 0x1.
-	 *	Indicates when the Non-Periodic TxFIFO Empty Interrupt bit in
-	 *	the Core Interrupt register (GINTSTS.NPTxFEmp) is triggered.
-	 *	This bit is used only in Slave mode.
-	 *	* 1'b0: GINTSTS.NPTxFEmp interrupt indicates that the Non-
-	 *	Periodic TxFIFO is half empty
-	 *	* 1'b1: GINTSTS.NPTxFEmp interrupt indicates that the Non-
-	 *	Periodic TxFIFO is completely empty
-	 * @dmaen: DMA Enable (DMAEn)
-	 *	* 1'b0: Core operates in Slave mode
-	 *	* 1'b1: Core operates in a DMA mode
-	 * @hbstlen: Burst Length/Type (HBstLen)
-	 *	This field has not effect and should be left as 0x0.
-	 * @glblintrmsk: Global Interrupt Mask (GlblIntrMsk)
-	 *	Software should set this field to 0x1.
-	 *	The application uses this bit to mask or unmask the interrupt
-	 *	line assertion to itself. Irrespective of this bit's setting,
-	 *	the interrupt status registers are updated by the core.
-	 *	* 1'b0: Mask the interrupt assertion to the application.
-	 *	* 1'b1: Unmask the interrupt assertion to the application.
-	 */
-	struct cvmx_usbcx_gahbcfg_s {
-		__BITFIELD_FIELD(u32 reserved_9_31	: 23,
-		__BITFIELD_FIELD(u32 ptxfemplvl		: 1,
-		__BITFIELD_FIELD(u32 nptxfemplvl	: 1,
-		__BITFIELD_FIELD(u32 reserved_6_6	: 1,
-		__BITFIELD_FIELD(u32 dmaen		: 1,
-		__BITFIELD_FIELD(u32 hbstlen		: 4,
-		__BITFIELD_FIELD(u32 glblintrmsk	: 1,
-		;)))))))
-	} s;
-};
-
-/**
- * cvmx_usbc#_ghwcfg3
- *
- * User HW Config3 Register (GHWCFG3)
- *
- * This register contains the configuration options of the O2P USB core.
- */
-union cvmx_usbcx_ghwcfg3 {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_ghwcfg3_s
-	 * @dfifodepth: DFIFO Depth (DfifoDepth)
-	 *	This value is in terms of 32-bit words.
-	 *	* Minimum value is 32
-	 *	* Maximum value is 32768
-	 * @ahbphysync: AHB and PHY Synchronous (AhbPhySync)
-	 *	Indicates whether AHB and PHY clocks are synchronous to
-	 *	each other.
-	 *	* 1'b0: No
-	 *	* 1'b1: Yes
-	 *	This bit is tied to 1.
-	 * @rsttype: Reset Style for Clocked always Blocks in RTL (RstType)
-	 *	* 1'b0: Asynchronous reset is used in the core
-	 *	* 1'b1: Synchronous reset is used in the core
-	 * @optfeature: Optional Features Removed (OptFeature)
-	 *	Indicates whether the User ID register, GPIO interface ports,
-	 *	and SOF toggle and counter ports were removed for gate count
-	 *	optimization.
-	 * @vendor_control_interface_support: Vendor Control Interface Support
-	 *	* 1'b0: Vendor Control Interface is not available on the core.
-	 *	* 1'b1: Vendor Control Interface is available.
-	 * @i2c_selection: I2C Selection
-	 *	* 1'b0: I2C Interface is not available on the core.
-	 *	* 1'b1: I2C Interface is available on the core.
-	 * @otgen: OTG Function Enabled (OtgEn)
-	 *	The application uses this bit to indicate the O2P USB core's
-	 *	OTG capabilities.
-	 *	* 1'b0: Not OTG capable
-	 *	* 1'b1: OTG Capable
-	 * @pktsizewidth: Width of Packet Size Counters (PktSizeWidth)
-	 *	* 3'b000: 4 bits
-	 *	* 3'b001: 5 bits
-	 *	* 3'b010: 6 bits
-	 *	* 3'b011: 7 bits
-	 *	* 3'b100: 8 bits
-	 *	* 3'b101: 9 bits
-	 *	* 3'b110: 10 bits
-	 *	* Others: Reserved
-	 * @xfersizewidth: Width of Transfer Size Counters (XferSizeWidth)
-	 *	* 4'b0000: 11 bits
-	 *	* 4'b0001: 12 bits
-	 *	- ...
-	 *	* 4'b1000: 19 bits
-	 *	* Others: Reserved
-	 */
-	struct cvmx_usbcx_ghwcfg3_s {
-		__BITFIELD_FIELD(u32 dfifodepth				: 16,
-		__BITFIELD_FIELD(u32 reserved_13_15			: 3,
-		__BITFIELD_FIELD(u32 ahbphysync				: 1,
-		__BITFIELD_FIELD(u32 rsttype				: 1,
-		__BITFIELD_FIELD(u32 optfeature				: 1,
-		__BITFIELD_FIELD(u32 vendor_control_interface_support	: 1,
-		__BITFIELD_FIELD(u32 i2c_selection			: 1,
-		__BITFIELD_FIELD(u32 otgen				: 1,
-		__BITFIELD_FIELD(u32 pktsizewidth			: 3,
-		__BITFIELD_FIELD(u32 xfersizewidth			: 4,
-		;))))))))))
-	} s;
-};
-
-/**
- * cvmx_usbc#_gintmsk
- *
- * Core Interrupt Mask Register (GINTMSK)
- *
- * This register works with the Core Interrupt register to interrupt the
- * application. When an interrupt bit is masked, the interrupt associated with
- * that bit will not be generated. However, the Core Interrupt (GINTSTS)
- * register bit corresponding to that interrupt will still be set.
- * Mask interrupt: 1'b0, Unmask interrupt: 1'b1
- */
-union cvmx_usbcx_gintmsk {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_gintmsk_s
-	 * @wkupintmsk: Resume/Remote Wakeup Detected Interrupt Mask
-	 *	(WkUpIntMsk)
-	 * @sessreqintmsk: Session Request/New Session Detected Interrupt Mask
-	 *	(SessReqIntMsk)
-	 * @disconnintmsk: Disconnect Detected Interrupt Mask (DisconnIntMsk)
-	 * @conidstschngmsk: Connector ID Status Change Mask (ConIDStsChngMsk)
-	 * @ptxfempmsk: Periodic TxFIFO Empty Mask (PTxFEmpMsk)
-	 * @hchintmsk: Host Channels Interrupt Mask (HChIntMsk)
-	 * @prtintmsk: Host Port Interrupt Mask (PrtIntMsk)
-	 * @fetsuspmsk: Data Fetch Suspended Mask (FetSuspMsk)
-	 * @incomplpmsk: Incomplete Periodic Transfer Mask (incomplPMsk)
-	 *	Incomplete Isochronous OUT Transfer Mask
-	 *	(incompISOOUTMsk)
-	 * @incompisoinmsk: Incomplete Isochronous IN Transfer Mask
-	 *		    (incompISOINMsk)
-	 * @oepintmsk: OUT Endpoints Interrupt Mask (OEPIntMsk)
-	 * @inepintmsk: IN Endpoints Interrupt Mask (INEPIntMsk)
-	 * @epmismsk: Endpoint Mismatch Interrupt Mask (EPMisMsk)
-	 * @eopfmsk: End of Periodic Frame Interrupt Mask (EOPFMsk)
-	 * @isooutdropmsk: Isochronous OUT Packet Dropped Interrupt Mask
-	 *	(ISOOutDropMsk)
-	 * @enumdonemsk: Enumeration Done Mask (EnumDoneMsk)
-	 * @usbrstmsk: USB Reset Mask (USBRstMsk)
-	 * @usbsuspmsk: USB Suspend Mask (USBSuspMsk)
-	 * @erlysuspmsk: Early Suspend Mask (ErlySuspMsk)
-	 * @i2cint: I2C Interrupt Mask (I2CINT)
-	 * @ulpickintmsk: ULPI Carkit Interrupt Mask (ULPICKINTMsk)
-	 *	I2C Carkit Interrupt Mask (I2CCKINTMsk)
-	 * @goutnakeffmsk: Global OUT NAK Effective Mask (GOUTNakEffMsk)
-	 * @ginnakeffmsk: Global Non-Periodic IN NAK Effective Mask
-	 *		  (GINNakEffMsk)
-	 * @nptxfempmsk: Non-Periodic TxFIFO Empty Mask (NPTxFEmpMsk)
-	 * @rxflvlmsk: Receive FIFO Non-Empty Mask (RxFLvlMsk)
-	 * @sofmsk: Start of (micro)Frame Mask (SofMsk)
-	 * @otgintmsk: OTG Interrupt Mask (OTGIntMsk)
-	 * @modemismsk: Mode Mismatch Interrupt Mask (ModeMisMsk)
-	 */
-	struct cvmx_usbcx_gintmsk_s {
-		__BITFIELD_FIELD(u32 wkupintmsk		: 1,
-		__BITFIELD_FIELD(u32 sessreqintmsk	: 1,
-		__BITFIELD_FIELD(u32 disconnintmsk	: 1,
-		__BITFIELD_FIELD(u32 conidstschngmsk	: 1,
-		__BITFIELD_FIELD(u32 reserved_27_27	: 1,
-		__BITFIELD_FIELD(u32 ptxfempmsk		: 1,
-		__BITFIELD_FIELD(u32 hchintmsk		: 1,
-		__BITFIELD_FIELD(u32 prtintmsk		: 1,
-		__BITFIELD_FIELD(u32 reserved_23_23	: 1,
-		__BITFIELD_FIELD(u32 fetsuspmsk		: 1,
-		__BITFIELD_FIELD(u32 incomplpmsk	: 1,
-		__BITFIELD_FIELD(u32 incompisoinmsk	: 1,
-		__BITFIELD_FIELD(u32 oepintmsk		: 1,
-		__BITFIELD_FIELD(u32 inepintmsk		: 1,
-		__BITFIELD_FIELD(u32 epmismsk		: 1,
-		__BITFIELD_FIELD(u32 reserved_16_16	: 1,
-		__BITFIELD_FIELD(u32 eopfmsk		: 1,
-		__BITFIELD_FIELD(u32 isooutdropmsk	: 1,
-		__BITFIELD_FIELD(u32 enumdonemsk	: 1,
-		__BITFIELD_FIELD(u32 usbrstmsk		: 1,
-		__BITFIELD_FIELD(u32 usbsuspmsk		: 1,
-		__BITFIELD_FIELD(u32 erlysuspmsk	: 1,
-		__BITFIELD_FIELD(u32 i2cint		: 1,
-		__BITFIELD_FIELD(u32 ulpickintmsk	: 1,
-		__BITFIELD_FIELD(u32 goutnakeffmsk	: 1,
-		__BITFIELD_FIELD(u32 ginnakeffmsk	: 1,
-		__BITFIELD_FIELD(u32 nptxfempmsk	: 1,
-		__BITFIELD_FIELD(u32 rxflvlmsk		: 1,
-		__BITFIELD_FIELD(u32 sofmsk		: 1,
-		__BITFIELD_FIELD(u32 otgintmsk		: 1,
-		__BITFIELD_FIELD(u32 modemismsk		: 1,
-		__BITFIELD_FIELD(u32 reserved_0_0	: 1,
-		;))))))))))))))))))))))))))))))))
-	} s;
-};
-
-/**
- * cvmx_usbc#_gintsts
- *
- * Core Interrupt Register (GINTSTS)
- *
- * This register interrupts the application for system-level events in the
- * current mode of operation (Device mode or Host mode). It is shown in
- * Interrupt. Some of the bits in this register are valid only in Host mode,
- * while others are valid in Device mode only. This register also indicates the
- * current mode of operation. In order to clear the interrupt status bits of
- * type R_SS_WC, the application must write 1'b1 into the bit. The FIFO status
- * interrupts are read only; once software reads from or writes to the FIFO
- * while servicing these interrupts, FIFO interrupt conditions are cleared
- * automatically.
- */
-union cvmx_usbcx_gintsts {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_gintsts_s
-	 * @wkupint: Resume/Remote Wakeup Detected Interrupt (WkUpInt)
-	 *	In Device mode, this interrupt is asserted when a resume is
-	 *	detected on the USB. In Host mode, this interrupt is asserted
-	 *	when a remote wakeup is detected on the USB.
-	 *	For more information on how to use this interrupt, see "Partial
-	 *	Power-Down and Clock Gating Programming Model" on
-	 *	page 353.
-	 * @sessreqint: Session Request/New Session Detected Interrupt
-	 *		(SessReqInt)
-	 *	In Host mode, this interrupt is asserted when a session request
-	 *	is detected from the device. In Device mode, this interrupt is
-	 *	asserted when the utmiotg_bvalid signal goes high.
-	 *	For more information on how to use this interrupt, see "Partial
-	 *	Power-Down and Clock Gating Programming Model" on
-	 *	page 353.
-	 * @disconnint: Disconnect Detected Interrupt (DisconnInt)
-	 *	Asserted when a device disconnect is detected.
-	 * @conidstschng: Connector ID Status Change (ConIDStsChng)
-	 *	The core sets this bit when there is a change in connector ID
-	 *	status.
-	 * @ptxfemp: Periodic TxFIFO Empty (PTxFEmp)
-	 *	Asserted when the Periodic Transmit FIFO is either half or
-	 *	completely empty and there is space for at least one entry to be
-	 *	written in the Periodic Request Queue. The half or completely
-	 *	empty status is determined by the Periodic TxFIFO Empty Level
-	 *	bit in the Core AHB Configuration register
-	 *	(GAHBCFG.PTxFEmpLvl).
-	 * @hchint: Host Channels Interrupt (HChInt)
-	 *	The core sets this bit to indicate that an interrupt is pending
-	 *	on one of the channels of the core (in Host mode). The
-	 *	application must read the Host All Channels Interrupt (HAINT)
-	 *	register to determine the exact number of the channel on which
-	 *	the interrupt occurred, and then read the corresponding Host
-	 *	Channel-n Interrupt (HCINTn) register to determine the exact
-	 *	cause of the interrupt. The application must clear the
-	 *	appropriate status bit in the HCINTn register to clear this bit.
-	 * @prtint: Host Port Interrupt (PrtInt)
-	 *	The core sets this bit to indicate a change in port status of
-	 *	one of the O2P USB core ports in Host mode. The application must
-	 *	read the Host Port Control and Status (HPRT) register to
-	 *	determine the exact event that caused this interrupt. The
-	 *	application must clear the appropriate status bit in the Host
-	 *	Port Control and Status register to clear this bit.
-	 * @fetsusp: Data Fetch Suspended (FetSusp)
-	 *	This interrupt is valid only in DMA mode. This interrupt
-	 *	indicates that the core has stopped fetching data for IN
-	 *	endpoints due to the unavailability of TxFIFO space or Request
-	 *	Queue space. This interrupt is used by the application for an
-	 *	endpoint mismatch algorithm.
-	 * @incomplp: Incomplete Periodic Transfer (incomplP)
-	 *	In Host mode, the core sets this interrupt bit when there are
-	 *	incomplete periodic transactions still pending which are
-	 *	scheduled for the current microframe.
-	 *	Incomplete Isochronous OUT Transfer (incompISOOUT)
-	 *	The Device mode, the core sets this interrupt to indicate that
-	 *	there is at least one isochronous OUT endpoint on which the
-	 *	transfer is not completed in the current microframe. This
-	 *	interrupt is asserted along with the End of Periodic Frame
-	 *	Interrupt (EOPF) bit in this register.
-	 * @incompisoin: Incomplete Isochronous IN Transfer (incompISOIN)
-	 *	The core sets this interrupt to indicate that there is at least
-	 *	one isochronous IN endpoint on which the transfer is not
-	 *	completed in the current microframe. This interrupt is asserted
-	 *	along with the End of Periodic Frame Interrupt (EOPF) bit in
-	 *	this register.
-	 * @oepint: OUT Endpoints Interrupt (OEPInt)
-	 *	The core sets this bit to indicate that an interrupt is pending
-	 *	on one of the OUT endpoints of the core (in Device mode). The
-	 *	application must read the Device All Endpoints Interrupt
-	 *	(DAINT) register to determine the exact number of the OUT
-	 *	endpoint on which the interrupt occurred, and then read the
-	 *	corresponding Device OUT Endpoint-n Interrupt (DOEPINTn)
-	 *	register to determine the exact cause of the interrupt. The
-	 *	application must clear the appropriate status bit in the
-	 *	corresponding DOEPINTn register to clear this bit.
-	 * @iepint: IN Endpoints Interrupt (IEPInt)
-	 *	The core sets this bit to indicate that an interrupt is pending
-	 *	on one of the IN endpoints of the core (in Device mode). The
-	 *	application must read the Device All Endpoints Interrupt
-	 *	(DAINT) register to determine the exact number of the IN
-	 *	endpoint on which the interrupt occurred, and then read the
-	 *	corresponding Device IN Endpoint-n Interrupt (DIEPINTn)
-	 *	register to determine the exact cause of the interrupt. The
-	 *	application must clear the appropriate status bit in the
-	 *	corresponding DIEPINTn register to clear this bit.
-	 * @epmis: Endpoint Mismatch Interrupt (EPMis)
-	 *	Indicates that an IN token has been received for a non-periodic
-	 *	endpoint, but the data for another endpoint is present in the
-	 *	top of the Non-Periodic Transmit FIFO and the IN endpoint
-	 *	mismatch count programmed by the application has expired.
-	 * @eopf: End of Periodic Frame Interrupt (EOPF)
-	 *	Indicates that the period specified in the Periodic Frame
-	 *	Interval field of the Device Configuration register
-	 *	(DCFG.PerFrInt) has been reached in the current microframe.
-	 * @isooutdrop: Isochronous OUT Packet Dropped Interrupt (ISOOutDrop)
-	 *	The core sets this bit when it fails to write an isochronous OUT
-	 *	packet into the RxFIFO because the RxFIFO doesn't have
-	 *	enough space to accommodate a maximum packet size packet
-	 *	for the isochronous OUT endpoint.
-	 * @enumdone: Enumeration Done (EnumDone)
-	 *	The core sets this bit to indicate that speed enumeration is
-	 *	complete. The application must read the Device Status (DSTS)
-	 *	register to obtain the enumerated speed.
-	 * @usbrst: USB Reset (USBRst)
-	 *	The core sets this bit to indicate that a reset is detected on
-	 *	the USB.
-	 * @usbsusp: USB Suspend (USBSusp)
-	 *	The core sets this bit to indicate that a suspend was detected
-	 *	on the USB. The core enters the Suspended state when there
-	 *	is no activity on the phy_line_state_i signal for an extended
-	 *	period of time.
-	 * @erlysusp: Early Suspend (ErlySusp)
-	 *	The core sets this bit to indicate that an Idle state has been
-	 *	detected on the USB for 3 ms.
-	 * @i2cint: I2C Interrupt (I2CINT)
-	 *	This bit is always 0x0.
-	 * @ulpickint: ULPI Carkit Interrupt (ULPICKINT)
-	 *	This bit is always 0x0.
-	 * @goutnakeff: Global OUT NAK Effective (GOUTNakEff)
-	 *	Indicates that the Set Global OUT NAK bit in the Device Control
-	 *	register (DCTL.SGOUTNak), set by the application, has taken
-	 *	effect in the core. This bit can be cleared by writing the Clear
-	 *	Global OUT NAK bit in the Device Control register
-	 *	(DCTL.CGOUTNak).
-	 * @ginnakeff: Global IN Non-Periodic NAK Effective (GINNakEff)
-	 *	Indicates that the Set Global Non-Periodic IN NAK bit in the
-	 *	Device Control register (DCTL.SGNPInNak), set by the
-	 *	application, has taken effect in the core. That is, the core has
-	 *	sampled the Global IN NAK bit set by the application. This bit
-	 *	can be cleared by clearing the Clear Global Non-Periodic IN
-	 *	NAK bit in the Device Control register (DCTL.CGNPInNak).
-	 *	This interrupt does not necessarily mean that a NAK handshake
-	 *	is sent out on the USB. The STALL bit takes precedence over
-	 *	the NAK bit.
-	 * @nptxfemp: Non-Periodic TxFIFO Empty (NPTxFEmp)
-	 *	This interrupt is asserted when the Non-Periodic TxFIFO is
-	 *	either half or completely empty, and there is space for at least
-	 *	one entry to be written to the Non-Periodic Transmit Request
-	 *	Queue. The half or completely empty status is determined by
-	 *	the Non-Periodic TxFIFO Empty Level bit in the Core AHB
-	 *	Configuration register (GAHBCFG.NPTxFEmpLvl).
-	 * @rxflvl: RxFIFO Non-Empty (RxFLvl)
-	 *	Indicates that there is at least one packet pending to be read
-	 *	from the RxFIFO.
-	 * @sof: Start of (micro)Frame (Sof)
-	 *	In Host mode, the core sets this bit to indicate that an SOF
-	 *	(FS), micro-SOF (HS), or Keep-Alive (LS) is transmitted on the
-	 *	USB. The application must write a 1 to this bit to clear the
-	 *	interrupt.
-	 *	In Device mode, in the core sets this bit to indicate that an
-	 *	SOF token has been received on the USB. The application can read
-	 *	the Device Status register to get the current (micro)frame
-	 *	number. This interrupt is seen only when the core is operating
-	 *	at either HS or FS.
-	 * @otgint: OTG Interrupt (OTGInt)
-	 *	The core sets this bit to indicate an OTG protocol event. The
-	 *	application must read the OTG Interrupt Status (GOTGINT)
-	 *	register to determine the exact event that caused this
-	 *	interrupt. The application must clear the appropriate status bit
-	 *	in the GOTGINT register to clear this bit.
-	 * @modemis: Mode Mismatch Interrupt (ModeMis)
-	 *	The core sets this bit when the application is trying to access:
-	 *	* A Host mode register, when the core is operating in Device
-	 *	mode
-	 *	* A Device mode register, when the core is operating in Host
-	 *	mode
-	 *	The register access is completed on the AHB with an OKAY
-	 *	response, but is ignored by the core internally and doesn't
-	 *	affect the operation of the core.
-	 * @curmod: Current Mode of Operation (CurMod)
-	 *	Indicates the current mode of operation.
-	 *	* 1'b0: Device mode
-	 *	* 1'b1: Host mode
-	 */
-	struct cvmx_usbcx_gintsts_s {
-		__BITFIELD_FIELD(u32 wkupint		: 1,
-		__BITFIELD_FIELD(u32 sessreqint		: 1,
-		__BITFIELD_FIELD(u32 disconnint		: 1,
-		__BITFIELD_FIELD(u32 conidstschng	: 1,
-		__BITFIELD_FIELD(u32 reserved_27_27	: 1,
-		__BITFIELD_FIELD(u32 ptxfemp		: 1,
-		__BITFIELD_FIELD(u32 hchint		: 1,
-		__BITFIELD_FIELD(u32 prtint		: 1,
-		__BITFIELD_FIELD(u32 reserved_23_23	: 1,
-		__BITFIELD_FIELD(u32 fetsusp		: 1,
-		__BITFIELD_FIELD(u32 incomplp		: 1,
-		__BITFIELD_FIELD(u32 incompisoin	: 1,
-		__BITFIELD_FIELD(u32 oepint		: 1,
-		__BITFIELD_FIELD(u32 iepint		: 1,
-		__BITFIELD_FIELD(u32 epmis		: 1,
-		__BITFIELD_FIELD(u32 reserved_16_16	: 1,
-		__BITFIELD_FIELD(u32 eopf		: 1,
-		__BITFIELD_FIELD(u32 isooutdrop		: 1,
-		__BITFIELD_FIELD(u32 enumdone		: 1,
-		__BITFIELD_FIELD(u32 usbrst		: 1,
-		__BITFIELD_FIELD(u32 usbsusp		: 1,
-		__BITFIELD_FIELD(u32 erlysusp		: 1,
-		__BITFIELD_FIELD(u32 i2cint		: 1,
-		__BITFIELD_FIELD(u32 ulpickint		: 1,
-		__BITFIELD_FIELD(u32 goutnakeff		: 1,
-		__BITFIELD_FIELD(u32 ginnakeff		: 1,
-		__BITFIELD_FIELD(u32 nptxfemp		: 1,
-		__BITFIELD_FIELD(u32 rxflvl		: 1,
-		__BITFIELD_FIELD(u32 sof		: 1,
-		__BITFIELD_FIELD(u32 otgint		: 1,
-		__BITFIELD_FIELD(u32 modemis		: 1,
-		__BITFIELD_FIELD(u32 curmod		: 1,
-		;))))))))))))))))))))))))))))))))
-	} s;
-};
-
-/**
- * cvmx_usbc#_gnptxfsiz
- *
- * Non-Periodic Transmit FIFO Size Register (GNPTXFSIZ)
- *
- * The application can program the RAM size and the memory start address for the
- * Non-Periodic TxFIFO.
- */
-union cvmx_usbcx_gnptxfsiz {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_gnptxfsiz_s
-	 * @nptxfdep: Non-Periodic TxFIFO Depth (NPTxFDep)
-	 *	This value is in terms of 32-bit words.
-	 *	Minimum value is 16
-	 *	Maximum value is 32768
-	 * @nptxfstaddr: Non-Periodic Transmit RAM Start Address (NPTxFStAddr)
-	 *	This field contains the memory start address for Non-Periodic
-	 *	Transmit FIFO RAM.
-	 */
-	struct cvmx_usbcx_gnptxfsiz_s {
-		__BITFIELD_FIELD(u32 nptxfdep		: 16,
-		__BITFIELD_FIELD(u32 nptxfstaddr	: 16,
-		;))
-	} s;
-};
-
-/**
- * cvmx_usbc#_gnptxsts
- *
- * Non-Periodic Transmit FIFO/Queue Status Register (GNPTXSTS)
- *
- * This read-only register contains the free space information for the
- * Non-Periodic TxFIFO and the Non-Periodic Transmit Request Queue.
- */
-union cvmx_usbcx_gnptxsts {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_gnptxsts_s
-	 * @nptxqtop: Top of the Non-Periodic Transmit Request Queue (NPTxQTop)
-	 *	Entry in the Non-Periodic Tx Request Queue that is currently
-	 *	being processed by the MAC.
-	 *	* Bits [30:27]: Channel/endpoint number
-	 *	* Bits [26:25]:
-	 *	- 2'b00: IN/OUT token
-	 *	- 2'b01: Zero-length transmit packet (device IN/host OUT)
-	 *	- 2'b10: PING/CSPLIT token
-	 *	- 2'b11: Channel halt command
-	 *	* Bit [24]: Terminate (last entry for selected channel/endpoint)
-	 * @nptxqspcavail: Non-Periodic Transmit Request Queue Space Available
-	 *	(NPTxQSpcAvail)
-	 *	Indicates the amount of free space available in the Non-
-	 *	Periodic Transmit Request Queue. This queue holds both IN
-	 *	and OUT requests in Host mode. Device mode has only IN
-	 *	requests.
-	 *	* 8'h0: Non-Periodic Transmit Request Queue is full
-	 *	* 8'h1: 1 location available
-	 *	* 8'h2: 2 locations available
-	 *	* n: n locations available (0..8)
-	 *	* Others: Reserved
-	 * @nptxfspcavail: Non-Periodic TxFIFO Space Avail (NPTxFSpcAvail)
-	 *	Indicates the amount of free space available in the Non-
-	 *	Periodic TxFIFO.
-	 *	Values are in terms of 32-bit words.
-	 *	* 16'h0: Non-Periodic TxFIFO is full
-	 *	* 16'h1: 1 word available
-	 *	* 16'h2: 2 words available
-	 *	* 16'hn: n words available (where 0..32768)
-	 *	* 16'h8000: 32768 words available
-	 *	* Others: Reserved
-	 */
-	struct cvmx_usbcx_gnptxsts_s {
-		__BITFIELD_FIELD(u32 reserved_31_31	: 1,
-		__BITFIELD_FIELD(u32 nptxqtop		: 7,
-		__BITFIELD_FIELD(u32 nptxqspcavail	: 8,
-		__BITFIELD_FIELD(u32 nptxfspcavail	: 16,
-		;))))
-	} s;
-};
-
-/**
- * cvmx_usbc#_grstctl
- *
- * Core Reset Register (GRSTCTL)
- *
- * The application uses this register to reset various hardware features inside
- * the core.
- */
-union cvmx_usbcx_grstctl {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_grstctl_s
-	 * @ahbidle: AHB Master Idle (AHBIdle)
-	 *	Indicates that the AHB Master State Machine is in the IDLE
-	 *	condition.
-	 * @dmareq: DMA Request Signal (DMAReq)
-	 *	Indicates that the DMA request is in progress. Used for debug.
-	 * @txfnum: TxFIFO Number (TxFNum)
-	 *	This is the FIFO number that must be flushed using the TxFIFO
-	 *	Flush bit. This field must not be changed until the core clears
-	 *	the TxFIFO Flush bit.
-	 *	* 5'h0: Non-Periodic TxFIFO flush
-	 *	* 5'h1: Periodic TxFIFO 1 flush in Device mode or Periodic
-	 *	TxFIFO flush in Host mode
-	 *	* 5'h2: Periodic TxFIFO 2 flush in Device mode
-	 *	- ...
-	 *	* 5'hF: Periodic TxFIFO 15 flush in Device mode
-	 *	* 5'h10: Flush all the Periodic and Non-Periodic TxFIFOs in the
-	 *	core
-	 * @txfflsh: TxFIFO Flush (TxFFlsh)
-	 *	This bit selectively flushes a single or all transmit FIFOs, but
-	 *	cannot do so if the core is in the midst of a transaction.
-	 *	The application must only write this bit after checking that the
-	 *	core is neither writing to the TxFIFO nor reading from the
-	 *	TxFIFO.
-	 *	The application must wait until the core clears this bit before
-	 *	performing any operations. This bit takes 8 clocks (of phy_clk
-	 *	or hclk, whichever is slower) to clear.
-	 * @rxfflsh: RxFIFO Flush (RxFFlsh)
-	 *	The application can flush the entire RxFIFO using this bit, but
-	 *	must first ensure that the core is not in the middle of a
-	 *	transaction.
-	 *	The application must only write to this bit after checking that
-	 *	the core is neither reading from the RxFIFO nor writing to the
-	 *	RxFIFO.
-	 *	The application must wait until the bit is cleared before
-	 *	performing any other operations. This bit will take 8 clocks
-	 *	(slowest of PHY or AHB clock) to clear.
-	 * @intknqflsh: IN Token Sequence Learning Queue Flush (INTknQFlsh)
-	 *	The application writes this bit to flush the IN Token Sequence
-	 *	Learning Queue.
-	 * @frmcntrrst: Host Frame Counter Reset (FrmCntrRst)
-	 *	The application writes this bit to reset the (micro)frame number
-	 *	counter inside the core. When the (micro)frame counter is reset,
-	 *	the subsequent SOF sent out by the core will have a
-	 *	(micro)frame number of 0.
-	 * @hsftrst: HClk Soft Reset (HSftRst)
-	 *	The application uses this bit to flush the control logic in the
-	 *	AHB Clock domain. Only AHB Clock Domain pipelines are reset.
-	 *	* FIFOs are not flushed with this bit.
-	 *	* All state machines in the AHB clock domain are reset to the
-	 *	Idle state after terminating the transactions on the AHB,
-	 *	following the protocol.
-	 *	* CSR control bits used by the AHB clock domain state
-	 *	machines are cleared.
-	 *	* To clear this interrupt, status mask bits that control the
-	 *	interrupt status and are generated by the AHB clock domain
-	 *	state machine are cleared.
-	 *	* Because interrupt status bits are not cleared, the application
-	 *	can get the status of any core events that occurred after it set
-	 *	this bit.
-	 *	This is a self-clearing bit that the core clears after all
-	 *	necessary logic is reset in the core. This may take several
-	 *	clocks, depending on the core's current state.
-	 * @csftrst: Core Soft Reset (CSftRst)
-	 *	Resets the hclk and phy_clock domains as follows:
-	 *	* Clears the interrupts and all the CSR registers except the
-	 *	following register bits:
-	 *	- PCGCCTL.RstPdwnModule
-	 *	- PCGCCTL.GateHclk
-	 *	- PCGCCTL.PwrClmp
-	 *	- PCGCCTL.StopPPhyLPwrClkSelclk
-	 *	- GUSBCFG.PhyLPwrClkSel
-	 *	- GUSBCFG.DDRSel
-	 *	- GUSBCFG.PHYSel
-	 *	- GUSBCFG.FSIntf
-	 *	- GUSBCFG.ULPI_UTMI_Sel
-	 *	- GUSBCFG.PHYIf
-	 *	- HCFG.FSLSPclkSel
-	 *	- DCFG.DevSpd
-	 *	* All module state machines (except the AHB Slave Unit) are
-	 *	reset to the IDLE state, and all the transmit FIFOs and the
-	 *	receive FIFO are flushed.
-	 *	* Any transactions on the AHB Master are terminated as soon
-	 *	as possible, after gracefully completing the last data phase of
-	 *	an AHB transfer. Any transactions on the USB are terminated
-	 *	immediately.
-	 *	The application can write to this bit any time it wants to reset
-	 *	the core. This is a self-clearing bit and the core clears this
-	 *	bit after all the necessary logic is reset in the core, which
-	 *	may take several clocks, depending on the current state of the
-	 *	core. Once this bit is cleared software should wait at least 3
-	 *	PHY clocks before doing any access to the PHY domain
-	 *	(synchronization delay). Software should also should check that
-	 *	bit 31 of this register is 1 (AHB Master is IDLE) before
-	 *	starting any operation.
-	 *	Typically software reset is used during software development
-	 *	and also when you dynamically change the PHY selection bits
-	 *	in the USB configuration registers listed above. When you
-	 *	change the PHY, the corresponding clock for the PHY is
-	 *	selected and used in the PHY domain. Once a new clock is
-	 *	selected, the PHY domain has to be reset for proper operation.
-	 */
-	struct cvmx_usbcx_grstctl_s {
-		__BITFIELD_FIELD(u32 ahbidle		: 1,
-		__BITFIELD_FIELD(u32 dmareq		: 1,
-		__BITFIELD_FIELD(u32 reserved_11_29	: 19,
-		__BITFIELD_FIELD(u32 txfnum		: 5,
-		__BITFIELD_FIELD(u32 txfflsh		: 1,
-		__BITFIELD_FIELD(u32 rxfflsh		: 1,
-		__BITFIELD_FIELD(u32 intknqflsh		: 1,
-		__BITFIELD_FIELD(u32 frmcntrrst		: 1,
-		__BITFIELD_FIELD(u32 hsftrst		: 1,
-		__BITFIELD_FIELD(u32 csftrst		: 1,
-		;))))))))))
-	} s;
-};
-
-/**
- * cvmx_usbc#_grxfsiz
- *
- * Receive FIFO Size Register (GRXFSIZ)
- *
- * The application can program the RAM size that must be allocated to the
- * RxFIFO.
- */
-union cvmx_usbcx_grxfsiz {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_grxfsiz_s
-	 * @rxfdep: RxFIFO Depth (RxFDep)
-	 *	This value is in terms of 32-bit words.
-	 *	* Minimum value is 16
-	 *	* Maximum value is 32768
-	 */
-	struct cvmx_usbcx_grxfsiz_s {
-		__BITFIELD_FIELD(u32 reserved_16_31	: 16,
-		__BITFIELD_FIELD(u32 rxfdep		: 16,
-		;))
-	} s;
-};
-
-/**
- * cvmx_usbc#_grxstsph
- *
- * Receive Status Read and Pop Register, Host Mode (GRXSTSPH)
- *
- * A read to the Receive Status Read and Pop register returns and additionally
- * pops the top data entry out of the RxFIFO.
- * This Description is only valid when the core is in Host Mode. For Device Mode
- * use USBC_GRXSTSPD instead.
- * NOTE: GRXSTSPH and GRXSTSPD are physically the same register and share the
- *	 same offset in the O2P USB core. The offset difference shown in this
- *	 document is for software clarity and is actually ignored by the
- *       hardware.
- */
-union cvmx_usbcx_grxstsph {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_grxstsph_s
-	 * @pktsts: Packet Status (PktSts)
-	 *	Indicates the status of the received packet
-	 *	* 4'b0010: IN data packet received
-	 *	* 4'b0011: IN transfer completed (triggers an interrupt)
-	 *	* 4'b0101: Data toggle error (triggers an interrupt)
-	 *	* 4'b0111: Channel halted (triggers an interrupt)
-	 *	* Others: Reserved
-	 * @dpid: Data PID (DPID)
-	 *	* 2'b00: DATA0
-	 *	* 2'b10: DATA1
-	 *	* 2'b01: DATA2
-	 *	* 2'b11: MDATA
-	 * @bcnt: Byte Count (BCnt)
-	 *	Indicates the byte count of the received IN data packet
-	 * @chnum: Channel Number (ChNum)
-	 *	Indicates the channel number to which the current received
-	 *	packet belongs.
-	 */
-	struct cvmx_usbcx_grxstsph_s {
-		__BITFIELD_FIELD(u32 reserved_21_31	: 11,
-		__BITFIELD_FIELD(u32 pktsts		: 4,
-		__BITFIELD_FIELD(u32 dpid		: 2,
-		__BITFIELD_FIELD(u32 bcnt		: 11,
-		__BITFIELD_FIELD(u32 chnum		: 4,
-		;)))))
-	} s;
-};
-
-/**
- * cvmx_usbc#_gusbcfg
- *
- * Core USB Configuration Register (GUSBCFG)
- *
- * This register can be used to configure the core after power-on or a changing
- * to Host mode or Device mode. It contains USB and USB-PHY related
- * configuration parameters. The application must program this register before
- * starting any transactions on either the AHB or the USB. Do not make changes
- * to this register after the initial programming.
- */
-union cvmx_usbcx_gusbcfg {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_gusbcfg_s
-	 * @otgi2csel: UTMIFS or I2C Interface Select (OtgI2CSel)
-	 *	This bit is always 0x0.
-	 * @phylpwrclksel: PHY Low-Power Clock Select (PhyLPwrClkSel)
-	 *	Software should set this bit to 0x0.
-	 *	Selects either 480-MHz or 48-MHz (low-power) PHY mode. In
-	 *	FS and LS modes, the PHY can usually operate on a 48-MHz
-	 *	clock to save power.
-	 *	* 1'b0: 480-MHz Internal PLL clock
-	 *	* 1'b1: 48-MHz External Clock
-	 *	In 480 MHz mode, the UTMI interface operates at either 60 or
-	 *	30-MHz, depending upon whether 8- or 16-bit data width is
-	 *	selected. In 48-MHz mode, the UTMI interface operates at 48
-	 *	MHz in FS mode and at either 48 or 6 MHz in LS mode
-	 *	(depending on the PHY vendor).
-	 *	This bit drives the utmi_fsls_low_power core output signal, and
-	 *	is valid only for UTMI+ PHYs.
-	 * @usbtrdtim: USB Turnaround Time (USBTrdTim)
-	 *	Sets the turnaround time in PHY clocks.
-	 *	Specifies the response time for a MAC request to the Packet
-	 *	FIFO Controller (PFC) to fetch data from the DFIFO (SPRAM).
-	 *	This must be programmed to 0x5.
-	 * @hnpcap: HNP-Capable (HNPCap)
-	 *	This bit is always 0x0.
-	 * @srpcap: SRP-Capable (SRPCap)
-	 *	This bit is always 0x0.
-	 * @ddrsel: ULPI DDR Select (DDRSel)
-	 *	Software should set this bit to 0x0.
-	 * @physel: USB 2.0 High-Speed PHY or USB 1.1 Full-Speed Serial
-	 *	Software should set this bit to 0x0.
-	 * @fsintf: Full-Speed Serial Interface Select (FSIntf)
-	 *	Software should set this bit to 0x0.
-	 * @ulpi_utmi_sel: ULPI or UTMI+ Select (ULPI_UTMI_Sel)
-	 *	This bit is always 0x0.
-	 * @phyif: PHY Interface (PHYIf)
-	 *	This bit is always 0x1.
-	 * @toutcal: HS/FS Timeout Calibration (TOutCal)
-	 *	The number of PHY clocks that the application programs in this
-	 *	field is added to the high-speed/full-speed interpacket timeout
-	 *	duration in the core to account for any additional delays
-	 *	introduced by the PHY. This may be required, since the delay
-	 *	introduced by the PHY in generating the linestate condition may
-	 *	vary from one PHY to another.
-	 *	The USB standard timeout value for high-speed operation is
-	 *	736 to 816 (inclusive) bit times. The USB standard timeout
-	 *	value for full-speed operation is 16 to 18 (inclusive) bit
-	 *	times. The application must program this field based on the
-	 *	speed of enumeration. The number of bit times added per PHY
-	 *	clock are:
-	 *	High-speed operation:
-	 *	* One 30-MHz PHY clock = 16 bit times
-	 *	* One 60-MHz PHY clock = 8 bit times
-	 *	Full-speed operation:
-	 *	* One 30-MHz PHY clock = 0.4 bit times
-	 *	* One 60-MHz PHY clock = 0.2 bit times
-	 *	* One 48-MHz PHY clock = 0.25 bit times
-	 */
-	struct cvmx_usbcx_gusbcfg_s {
-		__BITFIELD_FIELD(u32 reserved_17_31	: 15,
-		__BITFIELD_FIELD(u32 otgi2csel		: 1,
-		__BITFIELD_FIELD(u32 phylpwrclksel	: 1,
-		__BITFIELD_FIELD(u32 reserved_14_14	: 1,
-		__BITFIELD_FIELD(u32 usbtrdtim		: 4,
-		__BITFIELD_FIELD(u32 hnpcap		: 1,
-		__BITFIELD_FIELD(u32 srpcap		: 1,
-		__BITFIELD_FIELD(u32 ddrsel		: 1,
-		__BITFIELD_FIELD(u32 physel		: 1,
-		__BITFIELD_FIELD(u32 fsintf		: 1,
-		__BITFIELD_FIELD(u32 ulpi_utmi_sel	: 1,
-		__BITFIELD_FIELD(u32 phyif		: 1,
-		__BITFIELD_FIELD(u32 toutcal		: 3,
-		;)))))))))))))
-	} s;
-};
-
-/**
- * cvmx_usbc#_haint
- *
- * Host All Channels Interrupt Register (HAINT)
- *
- * When a significant event occurs on a channel, the Host All Channels Interrupt
- * register interrupts the application using the Host Channels Interrupt bit of
- * the Core Interrupt register (GINTSTS.HChInt). This is shown in Interrupt.
- * There is one interrupt bit per channel, up to a maximum of 16 bits. Bits in
- * this register are set and cleared when the application sets and clears bits
- * in the corresponding Host Channel-n Interrupt register.
- */
-union cvmx_usbcx_haint {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_haint_s
-	 * @haint: Channel Interrupts (HAINT)
-	 *	One bit per channel: Bit 0 for Channel 0, bit 15 for Channel 15
-	 */
-	struct cvmx_usbcx_haint_s {
-		__BITFIELD_FIELD(u32 reserved_16_31	: 16,
-		__BITFIELD_FIELD(u32 haint		: 16,
-		;))
-	} s;
-};
-
-/**
- * cvmx_usbc#_haintmsk
- *
- * Host All Channels Interrupt Mask Register (HAINTMSK)
- *
- * The Host All Channel Interrupt Mask register works with the Host All Channel
- * Interrupt register to interrupt the application when an event occurs on a
- * channel. There is one interrupt mask bit per channel, up to a maximum of 16
- * bits.
- * Mask interrupt: 1'b0 Unmask interrupt: 1'b1
- */
-union cvmx_usbcx_haintmsk {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_haintmsk_s
-	 * @haintmsk: Channel Interrupt Mask (HAINTMsk)
-	 *	One bit per channel: Bit 0 for channel 0, bit 15 for channel 15
-	 */
-	struct cvmx_usbcx_haintmsk_s {
-		__BITFIELD_FIELD(u32 reserved_16_31	: 16,
-		__BITFIELD_FIELD(u32 haintmsk		: 16,
-		;))
-	} s;
-};
-
-/**
- * cvmx_usbc#_hcchar#
- *
- * Host Channel-n Characteristics Register (HCCHAR)
- *
- */
-union cvmx_usbcx_hccharx {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_hccharx_s
-	 * @chena: Channel Enable (ChEna)
-	 *	This field is set by the application and cleared by the OTG
-	 *	host.
-	 *	* 1'b0: Channel disabled
-	 *	* 1'b1: Channel enabled
-	 * @chdis: Channel Disable (ChDis)
-	 *	The application sets this bit to stop transmitting/receiving
-	 *	data on a channel, even before the transfer for that channel is
-	 *	complete. The application must wait for the Channel Disabled
-	 *	interrupt before treating the channel as disabled.
-	 * @oddfrm: Odd Frame (OddFrm)
-	 *	This field is set (reset) by the application to indicate that
-	 *	the OTG host must perform a transfer in an odd (micro)frame.
-	 *	This field is applicable for only periodic (isochronous and
-	 *	interrupt) transactions.
-	 *	* 1'b0: Even (micro)frame
-	 *	* 1'b1: Odd (micro)frame
-	 * @devaddr: Device Address (DevAddr)
-	 *	This field selects the specific device serving as the data
-	 *	source or sink.
-	 * @ec: Multi Count (MC) / Error Count (EC)
-	 *	When the Split Enable bit of the Host Channel-n Split Control
-	 *	register (HCSPLTn.SpltEna) is reset (1'b0), this field indicates
-	 *	to the host the number of transactions that should be executed
-	 *	per microframe for this endpoint.
-	 *	* 2'b00: Reserved. This field yields undefined results.
-	 *	* 2'b01: 1 transaction
-	 *	* 2'b10: 2 transactions to be issued for this endpoint per
-	 *	microframe
-	 *	* 2'b11: 3 transactions to be issued for this endpoint per
-	 *	microframe
-	 *	When HCSPLTn.SpltEna is set (1'b1), this field indicates the
-	 *	number of immediate retries to be performed for a periodic split
-	 *	transactions on transaction errors. This field must be set to at
-	 *	least 2'b01.
-	 * @eptype: Endpoint Type (EPType)
-	 *	Indicates the transfer type selected.
-	 *	* 2'b00: Control
-	 *	* 2'b01: Isochronous
-	 *	* 2'b10: Bulk
-	 *	* 2'b11: Interrupt
-	 * @lspddev: Low-Speed Device (LSpdDev)
-	 *	This field is set by the application to indicate that this
-	 *	channel is communicating to a low-speed device.
-	 * @epdir: Endpoint Direction (EPDir)
-	 *	Indicates whether the transaction is IN or OUT.
-	 *	* 1'b0: OUT
-	 *	* 1'b1: IN
-	 * @epnum: Endpoint Number (EPNum)
-	 *	Indicates the endpoint number on the device serving as the
-	 *	data source or sink.
-	 * @mps: Maximum Packet Size (MPS)
-	 *	Indicates the maximum packet size of the associated endpoint.
-	 */
-	struct cvmx_usbcx_hccharx_s {
-		__BITFIELD_FIELD(u32 chena		: 1,
-		__BITFIELD_FIELD(u32 chdis		: 1,
-		__BITFIELD_FIELD(u32 oddfrm		: 1,
-		__BITFIELD_FIELD(u32 devaddr		: 7,
-		__BITFIELD_FIELD(u32 ec			: 2,
-		__BITFIELD_FIELD(u32 eptype		: 2,
-		__BITFIELD_FIELD(u32 lspddev		: 1,
-		__BITFIELD_FIELD(u32 reserved_16_16	: 1,
-		__BITFIELD_FIELD(u32 epdir		: 1,
-		__BITFIELD_FIELD(u32 epnum		: 4,
-		__BITFIELD_FIELD(u32 mps		: 11,
-		;)))))))))))
-	} s;
-};
-
-/**
- * cvmx_usbc#_hcfg
- *
- * Host Configuration Register (HCFG)
- *
- * This register configures the core after power-on. Do not make changes to this
- * register after initializing the host.
- */
-union cvmx_usbcx_hcfg {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_hcfg_s
-	 * @fslssupp: FS- and LS-Only Support (FSLSSupp)
-	 *	The application uses this bit to control the core's enumeration
-	 *	speed. Using this bit, the application can make the core
-	 *	enumerate as a FS host, even if the connected device supports
-	 *	HS traffic. Do not make changes to this field after initial
-	 *	programming.
-	 *	* 1'b0: HS/FS/LS, based on the maximum speed supported by
-	 *	the connected device
-	 *	* 1'b1: FS/LS-only, even if the connected device can support HS
-	 * @fslspclksel: FS/LS PHY Clock Select (FSLSPclkSel)
-	 *	When the core is in FS Host mode
-	 *	* 2'b00: PHY clock is running at 30/60 MHz
-	 *	* 2'b01: PHY clock is running at 48 MHz
-	 *	* Others: Reserved
-	 *	When the core is in LS Host mode
-	 *	* 2'b00: PHY clock is running at 30/60 MHz. When the
-	 *	UTMI+/ULPI PHY Low Power mode is not selected, use
-	 *	30/60 MHz.
-	 *	* 2'b01: PHY clock is running at 48 MHz. When the UTMI+
-	 *	PHY Low Power mode is selected, use 48MHz if the PHY
-	 *	supplies a 48 MHz clock during LS mode.
-	 *	* 2'b10: PHY clock is running at 6 MHz. In USB 1.1 FS mode,
-	 *	use 6 MHz when the UTMI+ PHY Low Power mode is
-	 *	selected and the PHY supplies a 6 MHz clock during LS
-	 *	mode. If you select a 6 MHz clock during LS mode, you must
-	 *	do a soft reset.
-	 *	* 2'b11: Reserved
-	 */
-	struct cvmx_usbcx_hcfg_s {
-		__BITFIELD_FIELD(u32 reserved_3_31	: 29,
-		__BITFIELD_FIELD(u32 fslssupp		: 1,
-		__BITFIELD_FIELD(u32 fslspclksel	: 2,
-		;)))
-	} s;
-};
-
-/**
- * cvmx_usbc#_hcint#
- *
- * Host Channel-n Interrupt Register (HCINT)
- *
- * This register indicates the status of a channel with respect to USB- and
- * AHB-related events. The application must read this register when the Host
- * Channels Interrupt bit of the Core Interrupt register (GINTSTS.HChInt) is
- * set. Before the application can read this register, it must first read
- * the Host All Channels Interrupt (HAINT) register to get the exact channel
- * number for the Host Channel-n Interrupt register. The application must clear
- * the appropriate bit in this register to clear the corresponding bits in the
- * HAINT and GINTSTS registers.
- */
-union cvmx_usbcx_hcintx {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_hcintx_s
-	 * @datatglerr: Data Toggle Error (DataTglErr)
-	 * @frmovrun: Frame Overrun (FrmOvrun)
-	 * @bblerr: Babble Error (BblErr)
-	 * @xacterr: Transaction Error (XactErr)
-	 * @nyet: NYET Response Received Interrupt (NYET)
-	 * @ack: ACK Response Received Interrupt (ACK)
-	 * @nak: NAK Response Received Interrupt (NAK)
-	 * @stall: STALL Response Received Interrupt (STALL)
-	 * @ahberr: This bit is always 0x0.
-	 * @chhltd: Channel Halted (ChHltd)
-	 *	Indicates the transfer completed abnormally either because of
-	 *	any USB transaction error or in response to disable request by
-	 *	the application.
-	 * @xfercompl: Transfer Completed (XferCompl)
-	 *	Transfer completed normally without any errors.
-	 */
-	struct cvmx_usbcx_hcintx_s {
-		__BITFIELD_FIELD(u32 reserved_11_31	: 21,
-		__BITFIELD_FIELD(u32 datatglerr		: 1,
-		__BITFIELD_FIELD(u32 frmovrun		: 1,
-		__BITFIELD_FIELD(u32 bblerr		: 1,
-		__BITFIELD_FIELD(u32 xacterr		: 1,
-		__BITFIELD_FIELD(u32 nyet		: 1,
-		__BITFIELD_FIELD(u32 ack		: 1,
-		__BITFIELD_FIELD(u32 nak		: 1,
-		__BITFIELD_FIELD(u32 stall		: 1,
-		__BITFIELD_FIELD(u32 ahberr		: 1,
-		__BITFIELD_FIELD(u32 chhltd		: 1,
-		__BITFIELD_FIELD(u32 xfercompl		: 1,
-		;))))))))))))
-	} s;
-};
-
-/**
- * cvmx_usbc#_hcintmsk#
- *
- * Host Channel-n Interrupt Mask Register (HCINTMSKn)
- *
- * This register reflects the mask for each channel status described in the
- * previous section.
- * Mask interrupt: 1'b0 Unmask interrupt: 1'b1
- */
-union cvmx_usbcx_hcintmskx {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_hcintmskx_s
-	 * @datatglerrmsk: Data Toggle Error Mask (DataTglErrMsk)
-	 * @frmovrunmsk: Frame Overrun Mask (FrmOvrunMsk)
-	 * @bblerrmsk: Babble Error Mask (BblErrMsk)
-	 * @xacterrmsk: Transaction Error Mask (XactErrMsk)
-	 * @nyetmsk: NYET Response Received Interrupt Mask (NyetMsk)
-	 * @ackmsk: ACK Response Received Interrupt Mask (AckMsk)
-	 * @nakmsk: NAK Response Received Interrupt Mask (NakMsk)
-	 * @stallmsk: STALL Response Received Interrupt Mask (StallMsk)
-	 * @ahberrmsk: AHB Error Mask (AHBErrMsk)
-	 * @chhltdmsk: Channel Halted Mask (ChHltdMsk)
-	 * @xfercomplmsk: Transfer Completed Mask (XferComplMsk)
-	 */
-	struct cvmx_usbcx_hcintmskx_s {
-		__BITFIELD_FIELD(u32 reserved_11_31		: 21,
-		__BITFIELD_FIELD(u32 datatglerrmsk		: 1,
-		__BITFIELD_FIELD(u32 frmovrunmsk		: 1,
-		__BITFIELD_FIELD(u32 bblerrmsk			: 1,
-		__BITFIELD_FIELD(u32 xacterrmsk			: 1,
-		__BITFIELD_FIELD(u32 nyetmsk			: 1,
-		__BITFIELD_FIELD(u32 ackmsk			: 1,
-		__BITFIELD_FIELD(u32 nakmsk			: 1,
-		__BITFIELD_FIELD(u32 stallmsk			: 1,
-		__BITFIELD_FIELD(u32 ahberrmsk			: 1,
-		__BITFIELD_FIELD(u32 chhltdmsk			: 1,
-		__BITFIELD_FIELD(u32 xfercomplmsk		: 1,
-		;))))))))))))
-	} s;
-};
-
-/**
- * cvmx_usbc#_hcsplt#
- *
- * Host Channel-n Split Control Register (HCSPLT)
- *
- */
-union cvmx_usbcx_hcspltx {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_hcspltx_s
-	 * @spltena: Split Enable (SpltEna)
-	 *	The application sets this field to indicate that this channel is
-	 *	enabled to perform split transactions.
-	 * @compsplt: Do Complete Split (CompSplt)
-	 *	The application sets this field to request the OTG host to
-	 *	perform a complete split transaction.
-	 * @xactpos: Transaction Position (XactPos)
-	 *	This field is used to determine whether to send all, first,
-	 *	middle, or last payloads with each OUT transaction.
-	 *	* 2'b11: All. This is the entire data payload is of this
-	 *	transaction (which is less than or equal to 188 bytes).
-	 *	* 2'b10: Begin. This is the first data payload of this
-	 *	transaction (which is larger than 188 bytes).
-	 *	* 2'b00: Mid. This is the middle payload of this transaction
-	 *	(which is larger than 188 bytes).
-	 *	* 2'b01: End. This is the last payload of this transaction
-	 *	(which is larger than 188 bytes).
-	 * @hubaddr: Hub Address (HubAddr)
-	 *	This field holds the device address of the transaction
-	 *	translator's hub.
-	 * @prtaddr: Port Address (PrtAddr)
-	 *	This field is the port number of the recipient transaction
-	 *	translator.
-	 */
-	struct cvmx_usbcx_hcspltx_s {
-		__BITFIELD_FIELD(u32 spltena			: 1,
-		__BITFIELD_FIELD(u32 reserved_17_30		: 14,
-		__BITFIELD_FIELD(u32 compsplt			: 1,
-		__BITFIELD_FIELD(u32 xactpos			: 2,
-		__BITFIELD_FIELD(u32 hubaddr			: 7,
-		__BITFIELD_FIELD(u32 prtaddr			: 7,
-		;))))))
-	} s;
-};
-
-/**
- * cvmx_usbc#_hctsiz#
- *
- * Host Channel-n Transfer Size Register (HCTSIZ)
- *
- */
-union cvmx_usbcx_hctsizx {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_hctsizx_s
-	 * @dopng: Do Ping (DoPng)
-	 *	Setting this field to 1 directs the host to do PING protocol.
-	 * @pid: PID (Pid)
-	 *	The application programs this field with the type of PID to use
-	 *	for the initial transaction. The host will maintain this field
-	 *	for the rest of the transfer.
-	 *	* 2'b00: DATA0
-	 *	* 2'b01: DATA2
-	 *	* 2'b10: DATA1
-	 *	* 2'b11: MDATA (non-control)/SETUP (control)
-	 * @pktcnt: Packet Count (PktCnt)
-	 *	This field is programmed by the application with the expected
-	 *	number of packets to be transmitted (OUT) or received (IN).
-	 *	The host decrements this count on every successful
-	 *	transmission or reception of an OUT/IN packet. Once this count
-	 *	reaches zero, the application is interrupted to indicate normal
-	 *	completion.
-	 * @xfersize: Transfer Size (XferSize)
-	 *	For an OUT, this field is the number of data bytes the host will
-	 *	send during the transfer.
-	 *	For an IN, this field is the buffer size that the application
-	 *	has reserved for the transfer. The application is expected to
-	 *	program this field as an integer multiple of the maximum packet
-	 *	size for IN transactions (periodic and non-periodic).
-	 */
-	struct cvmx_usbcx_hctsizx_s {
-		__BITFIELD_FIELD(u32 dopng		: 1,
-		__BITFIELD_FIELD(u32 pid		: 2,
-		__BITFIELD_FIELD(u32 pktcnt		: 10,
-		__BITFIELD_FIELD(u32 xfersize		: 19,
-		;))))
-	} s;
-};
-
-/**
- * cvmx_usbc#_hfir
- *
- * Host Frame Interval Register (HFIR)
- *
- * This register stores the frame interval information for the current speed to
- * which the O2P USB core has enumerated.
- */
-union cvmx_usbcx_hfir {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_hfir_s
-	 * @frint: Frame Interval (FrInt)
-	 *	The value that the application programs to this field specifies
-	 *	the interval between two consecutive SOFs (FS) or micro-
-	 *	SOFs (HS) or Keep-Alive tokens (HS). This field contains the
-	 *	number of PHY clocks that constitute the required frame
-	 *	interval. The default value set in this field for a FS operation
-	 *	when the PHY clock frequency is 60 MHz. The application can
-	 *	write a value to this register only after the Port Enable bit of
-	 *	the Host Port Control and Status register (HPRT.PrtEnaPort)
-	 *	has been set. If no value is programmed, the core calculates
-	 *	the value based on the PHY clock specified in the FS/LS PHY
-	 *	Clock Select field of the Host Configuration register
-	 *	(HCFG.FSLSPclkSel). Do not change the value of this field
-	 *	after the initial configuration.
-	 *	* 125 us (PHY clock frequency for HS)
-	 *	* 1 ms (PHY clock frequency for FS/LS)
-	 */
-	struct cvmx_usbcx_hfir_s {
-		__BITFIELD_FIELD(u32 reserved_16_31		: 16,
-		__BITFIELD_FIELD(u32 frint			: 16,
-		;))
-	} s;
-};
-
-/**
- * cvmx_usbc#_hfnum
- *
- * Host Frame Number/Frame Time Remaining Register (HFNUM)
- *
- * This register indicates the current frame number.
- * It also indicates the time remaining (in terms of the number of PHY clocks)
- * in the current (micro)frame.
- */
-union cvmx_usbcx_hfnum {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_hfnum_s
-	 * @frrem: Frame Time Remaining (FrRem)
-	 *	Indicates the amount of time remaining in the current
-	 *	microframe (HS) or frame (FS/LS), in terms of PHY clocks.
-	 *	This field decrements on each PHY clock. When it reaches
-	 *	zero, this field is reloaded with the value in the Frame
-	 *	Interval register and a new SOF is transmitted on the USB.
-	 * @frnum: Frame Number (FrNum)
-	 *	This field increments when a new SOF is transmitted on the
-	 *	USB, and is reset to 0 when it reaches 16'h3FFF.
-	 */
-	struct cvmx_usbcx_hfnum_s {
-		__BITFIELD_FIELD(u32 frrem		: 16,
-		__BITFIELD_FIELD(u32 frnum		: 16,
-		;))
-	} s;
-};
-
-/**
- * cvmx_usbc#_hprt
- *
- * Host Port Control and Status Register (HPRT)
- *
- * This register is available in both Host and Device modes.
- * Currently, the OTG Host supports only one port.
- * A single register holds USB port-related information such as USB reset,
- * enable, suspend, resume, connect status, and test mode for each port. The
- * R_SS_WC bits in this register can trigger an interrupt to the application
- * through the Host Port Interrupt bit of the Core Interrupt register
- * (GINTSTS.PrtInt). On a Port Interrupt, the application must read this
- * register and clear the bit that caused the interrupt. For the R_SS_WC bits,
- * the application must write a 1 to the bit to clear the interrupt.
- */
-union cvmx_usbcx_hprt {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_hprt_s
-	 * @prtspd: Port Speed (PrtSpd)
-	 *	Indicates the speed of the device attached to this port.
-	 *	* 2'b00: High speed
-	 *	* 2'b01: Full speed
-	 *	* 2'b10: Low speed
-	 *	* 2'b11: Reserved
-	 * @prttstctl: Port Test Control (PrtTstCtl)
-	 *	The application writes a nonzero value to this field to put
-	 *	the port into a Test mode, and the corresponding pattern is
-	 *	signaled on the port.
-	 *	* 4'b0000: Test mode disabled
-	 *	* 4'b0001: Test_J mode
-	 *	* 4'b0010: Test_K mode
-	 *	* 4'b0011: Test_SE0_NAK mode
-	 *	* 4'b0100: Test_Packet mode
-	 *	* 4'b0101: Test_Force_Enable
-	 *	* Others: Reserved
-	 *	PrtSpd must be zero (i.e. the interface must be in high-speed
-	 *	mode) to use the PrtTstCtl test modes.
-	 * @prtpwr: Port Power (PrtPwr)
-	 *	The application uses this field to control power to this port,
-	 *	and the core clears this bit on an overcurrent condition.
-	 *	* 1'b0: Power off
-	 *	* 1'b1: Power on
-	 * @prtlnsts: Port Line Status (PrtLnSts)
-	 *	Indicates the current logic level USB data lines
-	 *	* Bit [10]: Logic level of D-
-	 *	* Bit [11]: Logic level of D+
-	 * @prtrst: Port Reset (PrtRst)
-	 *	When the application sets this bit, a reset sequence is
-	 *	started on this port. The application must time the reset
-	 *	period and clear this bit after the reset sequence is
-	 *	complete.
-	 *	* 1'b0: Port not in reset
-	 *	* 1'b1: Port in reset
-	 *	The application must leave this bit set for at least a
-	 *	minimum duration mentioned below to start a reset on the
-	 *	port. The application can leave it set for another 10 ms in
-	 *	addition to the required minimum duration, before clearing
-	 *	the bit, even though there is no maximum limit set by the
-	 *	USB standard.
-	 *	* High speed: 50 ms
-	 *	* Full speed/Low speed: 10 ms
-	 * @prtsusp: Port Suspend (PrtSusp)
-	 *	The application sets this bit to put this port in Suspend
-	 *	mode. The core only stops sending SOFs when this is set.
-	 *	To stop the PHY clock, the application must set the Port
-	 *	Clock Stop bit, which will assert the suspend input pin of
-	 *	the PHY.
-	 *	The read value of this bit reflects the current suspend
-	 *	status of the port. This bit is cleared by the core after a
-	 *	remote wakeup signal is detected or the application sets
-	 *	the Port Reset bit or Port Resume bit in this register or the
-	 *	Resume/Remote Wakeup Detected Interrupt bit or
-	 *	Disconnect Detected Interrupt bit in the Core Interrupt
-	 *	register (GINTSTS.WkUpInt or GINTSTS.DisconnInt,
-	 *	respectively).
-	 *	* 1'b0: Port not in Suspend mode
-	 *	* 1'b1: Port in Suspend mode
-	 * @prtres: Port Resume (PrtRes)
-	 *	The application sets this bit to drive resume signaling on
-	 *	the port. The core continues to drive the resume signal
-	 *	until the application clears this bit.
-	 *	If the core detects a USB remote wakeup sequence, as
-	 *	indicated by the Port Resume/Remote Wakeup Detected
-	 *	Interrupt bit of the Core Interrupt register
-	 *	(GINTSTS.WkUpInt), the core starts driving resume
-	 *	signaling without application intervention and clears this bit
-	 *	when it detects a disconnect condition. The read value of
-	 *	this bit indicates whether the core is currently driving
-	 *	resume signaling.
-	 *	* 1'b0: No resume driven
-	 *	* 1'b1: Resume driven
-	 * @prtovrcurrchng: Port Overcurrent Change (PrtOvrCurrChng)
-	 *	The core sets this bit when the status of the Port
-	 *	Overcurrent Active bit (bit 4) in this register changes.
-	 * @prtovrcurract: Port Overcurrent Active (PrtOvrCurrAct)
-	 *	Indicates the overcurrent condition of the port.
-	 *	* 1'b0: No overcurrent condition
-	 *	* 1'b1: Overcurrent condition
-	 * @prtenchng: Port Enable/Disable Change (PrtEnChng)
-	 *	The core sets this bit when the status of the Port Enable bit
-	 *	[2] of this register changes.
-	 * @prtena: Port Enable (PrtEna)
-	 *	A port is enabled only by the core after a reset sequence,
-	 *	and is disabled by an overcurrent condition, a disconnect
-	 *	condition, or by the application clearing this bit. The
-	 *	application cannot set this bit by a register write. It can only
-	 *	clear it to disable the port. This bit does not trigger any
-	 *	interrupt to the application.
-	 *	* 1'b0: Port disabled
-	 *	* 1'b1: Port enabled
-	 * @prtconndet: Port Connect Detected (PrtConnDet)
-	 *	The core sets this bit when a device connection is detected
-	 *	to trigger an interrupt to the application using the Host Port
-	 *	Interrupt bit of the Core Interrupt register (GINTSTS.PrtInt).
-	 *	The application must write a 1 to this bit to clear the
-	 *	interrupt.
-	 * @prtconnsts: Port Connect Status (PrtConnSts)
-	 *	* 0: No device is attached to the port.
-	 *	* 1: A device is attached to the port.
-	 */
-	struct cvmx_usbcx_hprt_s {
-		__BITFIELD_FIELD(u32 reserved_19_31	: 13,
-		__BITFIELD_FIELD(u32 prtspd		: 2,
-		__BITFIELD_FIELD(u32 prttstctl		: 4,
-		__BITFIELD_FIELD(u32 prtpwr		: 1,
-		__BITFIELD_FIELD(u32 prtlnsts		: 2,
-		__BITFIELD_FIELD(u32 reserved_9_9	: 1,
-		__BITFIELD_FIELD(u32 prtrst		: 1,
-		__BITFIELD_FIELD(u32 prtsusp		: 1,
-		__BITFIELD_FIELD(u32 prtres		: 1,
-		__BITFIELD_FIELD(u32 prtovrcurrchng	: 1,
-		__BITFIELD_FIELD(u32 prtovrcurract	: 1,
-		__BITFIELD_FIELD(u32 prtenchng		: 1,
-		__BITFIELD_FIELD(u32 prtena		: 1,
-		__BITFIELD_FIELD(u32 prtconndet		: 1,
-		__BITFIELD_FIELD(u32 prtconnsts		: 1,
-		;)))))))))))))))
-	} s;
-};
-
-/**
- * cvmx_usbc#_hptxfsiz
- *
- * Host Periodic Transmit FIFO Size Register (HPTXFSIZ)
- *
- * This register holds the size and the memory start address of the Periodic
- * TxFIFO, as shown in Figures 310 and 311.
- */
-union cvmx_usbcx_hptxfsiz {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_hptxfsiz_s
-	 * @ptxfsize: Host Periodic TxFIFO Depth (PTxFSize)
-	 *	This value is in terms of 32-bit words.
-	 *	* Minimum value is 16
-	 *	* Maximum value is 32768
-	 * @ptxfstaddr: Host Periodic TxFIFO Start Address (PTxFStAddr)
-	 */
-	struct cvmx_usbcx_hptxfsiz_s {
-		__BITFIELD_FIELD(u32 ptxfsize	: 16,
-		__BITFIELD_FIELD(u32 ptxfstaddr	: 16,
-		;))
-	} s;
-};
-
-/**
- * cvmx_usbc#_hptxsts
- *
- * Host Periodic Transmit FIFO/Queue Status Register (HPTXSTS)
- *
- * This read-only register contains the free space information for the Periodic
- * TxFIFO and the Periodic Transmit Request Queue
- */
-union cvmx_usbcx_hptxsts {
-	u32 u32;
-	/**
-	 * struct cvmx_usbcx_hptxsts_s
-	 * @ptxqtop: Top of the Periodic Transmit Request Queue (PTxQTop)
-	 *	This indicates the entry in the Periodic Tx Request Queue that
-	 *	is currently being processes by the MAC.
-	 *	This register is used for debugging.
-	 *	* Bit [31]: Odd/Even (micro)frame
-	 *	- 1'b0: send in even (micro)frame
-	 *	- 1'b1: send in odd (micro)frame
-	 *	* Bits [30:27]: Channel/endpoint number
-	 *	* Bits [26:25]: Type
-	 *	- 2'b00: IN/OUT
-	 *	- 2'b01: Zero-length packet
-	 *	- 2'b10: CSPLIT
-	 *	- 2'b11: Disable channel command
-	 *	* Bit [24]: Terminate (last entry for the selected
-	 *	channel/endpoint)
-	 * @ptxqspcavail: Periodic Transmit Request Queue Space Available
-	 *	(PTxQSpcAvail)
-	 *	Indicates the number of free locations available to be written
-	 *	in the Periodic Transmit Request Queue. This queue holds both
-	 *	IN and OUT requests.
-	 *	* 8'h0: Periodic Transmit Request Queue is full
-	 *	* 8'h1: 1 location available
-	 *	* 8'h2: 2 locations available
-	 *	* n: n locations available (0..8)
-	 *	* Others: Reserved
-	 * @ptxfspcavail: Periodic Transmit Data FIFO Space Available
-	 *		  (PTxFSpcAvail)
-	 *	Indicates the number of free locations available to be written
-	 *	to in the Periodic TxFIFO.
-	 *	Values are in terms of 32-bit words
-	 *	* 16'h0: Periodic TxFIFO is full
-	 *	* 16'h1: 1 word available
-	 *	* 16'h2: 2 words available
-	 *	* 16'hn: n words available (where 0..32768)
-	 *	* 16'h8000: 32768 words available
-	 *	* Others: Reserved
-	 */
-	struct cvmx_usbcx_hptxsts_s {
-		__BITFIELD_FIELD(u32 ptxqtop		: 8,
-		__BITFIELD_FIELD(u32 ptxqspcavail	: 8,
-		__BITFIELD_FIELD(u32 ptxfspcavail	: 16,
-		;)))
-	} s;
-};
-
-/**
- * cvmx_usbn#_clk_ctl
- *
- * USBN_CLK_CTL = USBN's Clock Control
- *
- * This register is used to control the frequency of the hclk and the
- * hreset and phy_rst signals.
- */
-union cvmx_usbnx_clk_ctl {
-	u64 u64;
-	/**
-	 * struct cvmx_usbnx_clk_ctl_s
-	 * @divide2: The 'hclk' used by the USB subsystem is derived
-	 *	from the eclk.
-	 *	Also see the field DIVIDE. DIVIDE2<1> must currently
-	 *	be zero because it is not implemented, so the maximum
-	 *	ratio of eclk/hclk is currently 16.
-	 *	The actual divide number for hclk is:
-	 *	(DIVIDE2 + 1) * (DIVIDE + 1)
-	 * @hclk_rst: When this field is '0' the HCLK-DIVIDER used to
-	 *	generate the hclk in the USB Subsystem is held
-	 *	in reset. This bit must be set to '0' before
-	 *	changing the value os DIVIDE in this register.
-	 *	The reset to the HCLK_DIVIDERis also asserted
-	 *	when core reset is asserted.
-	 * @p_x_on: Force USB-PHY on during suspend.
-	 *	'1' USB-PHY XO block is powered-down during
-	 *	suspend.
-	 *	'0' USB-PHY XO block is powered-up during
-	 *	suspend.
-	 *	The value of this field must be set while POR is
-	 *	active.
-	 * @p_rtype: PHY reference clock type
-	 *	On CN50XX/CN52XX/CN56XX the values are:
-	 *		'0' The USB-PHY uses a 12MHz crystal as a clock source
-	 *		    at the USB_XO and USB_XI pins.
-	 *		'1' Reserved.
-	 *		'2' The USB_PHY uses 12/24/48MHz 2.5V board clock at the
-	 *		    USB_XO pin. USB_XI should be tied to ground in this
-	 *		    case.
-	 *		'3' Reserved.
-	 *	On CN3xxx bits 14 and 15 are p_xenbn and p_rclk and values are:
-	 *		'0' Reserved.
-	 *		'1' Reserved.
-	 *		'2' The PHY PLL uses the XO block output as a reference.
-	 *		    The XO block uses an external clock supplied on the
-	 *		    XO pin. USB_XI should be tied to ground for this
-	 *		    usage.
-	 *		'3' The XO block uses the clock from a crystal.
-	 * @p_com_on: '0' Force USB-PHY XO Bias, Bandgap and PLL to
-	 *	remain powered in Suspend Mode.
-	 *	'1' The USB-PHY XO Bias, Bandgap and PLL are
-	 *	powered down in suspend mode.
-	 *	The value of this field must be set while POR is
-	 *	active.
-	 * @p_c_sel: Phy clock speed select.
-	 *	Selects the reference clock / crystal frequency.
-	 *	'11': Reserved
-	 *	'10': 48 MHz (reserved when a crystal is used)
-	 *	'01': 24 MHz (reserved when a crystal is used)
-	 *	'00': 12 MHz
-	 *	The value of this field must be set while POR is
-	 *	active.
-	 *	NOTE: if a crystal is used as a reference clock,
-	 *	this field must be set to 12 MHz.
-	 * @cdiv_byp: Used to enable the bypass input to the USB_CLK_DIV.
-	 * @sd_mode: Scaledown mode for the USBC. Control timing events
-	 *	in the USBC, for normal operation this must be '0'.
-	 * @s_bist: Starts bist on the hclk memories, during the '0'
-	 *	to '1' transition.
-	 * @por: Power On Reset for the PHY.
-	 *	Resets all the PHYS registers and state machines.
-	 * @enable: When '1' allows the generation of the hclk. When
-	 *	'0' the hclk will not be generated. SEE DIVIDE
-	 *	field of this register.
-	 * @prst: When this field is '0' the reset associated with
-	 *	the phy_clk functionality in the USB Subsystem is
-	 *	help in reset. This bit should not be set to '1'
-	 *	until the time it takes 6 clocks (hclk or phy_clk,
-	 *	whichever is slower) has passed. Under normal
-	 *	operation once this bit is set to '1' it should not
-	 *	be set to '0'.
-	 * @hrst: When this field is '0' the reset associated with
-	 *	the hclk functioanlity in the USB Subsystem is
-	 *	held in reset.This bit should not be set to '1'
-	 *	until 12ms after phy_clk is stable. Under normal
-	 *	operation, once this bit is set to '1' it should
-	 *	not be set to '0'.
-	 * @divide: The frequency of 'hclk' used by the USB subsystem
-	 *	is the eclk frequency divided by the value of
-	 *	(DIVIDE2 + 1) * (DIVIDE + 1), also see the field
-	 *	DIVIDE2 of this register.
-	 *	The hclk frequency should be less than 125Mhz.
-	 *	After writing a value to this field the SW should
-	 *	read the field for the value written.
-	 *	The ENABLE field of this register should not be set
-	 *	until AFTER this field is set and then read.
-	 */
-	struct cvmx_usbnx_clk_ctl_s {
-		__BITFIELD_FIELD(u64 reserved_20_63	: 44,
-		__BITFIELD_FIELD(u64 divide2		: 2,
-		__BITFIELD_FIELD(u64 hclk_rst		: 1,
-		__BITFIELD_FIELD(u64 p_x_on		: 1,
-		__BITFIELD_FIELD(u64 p_rtype		: 2,
-		__BITFIELD_FIELD(u64 p_com_on		: 1,
-		__BITFIELD_FIELD(u64 p_c_sel		: 2,
-		__BITFIELD_FIELD(u64 cdiv_byp		: 1,
-		__BITFIELD_FIELD(u64 sd_mode		: 2,
-		__BITFIELD_FIELD(u64 s_bist		: 1,
-		__BITFIELD_FIELD(u64 por		: 1,
-		__BITFIELD_FIELD(u64 enable		: 1,
-		__BITFIELD_FIELD(u64 prst		: 1,
-		__BITFIELD_FIELD(u64 hrst		: 1,
-		__BITFIELD_FIELD(u64 divide		: 3,
-		;)))))))))))))))
-	} s;
-};
-
-/**
- * cvmx_usbn#_usbp_ctl_status
- *
- * USBN_USBP_CTL_STATUS = USBP Control And Status Register
- *
- * Contains general control and status information for the USBN block.
- */
-union cvmx_usbnx_usbp_ctl_status {
-	u64 u64;
-	/**
-	 * struct cvmx_usbnx_usbp_ctl_status_s
-	 * @txrisetune: HS Transmitter Rise/Fall Time Adjustment
-	 * @txvreftune: HS DC Voltage Level Adjustment
-	 * @txfslstune: FS/LS Source Impedance Adjustment
-	 * @txhsxvtune: Transmitter High-Speed Crossover Adjustment
-	 * @sqrxtune: Squelch Threshold Adjustment
-	 * @compdistune: Disconnect Threshold Adjustment
-	 * @otgtune: VBUS Valid Threshold Adjustment
-	 * @otgdisable: OTG Block Disable
-	 * @portreset: Per_Port Reset
-	 * @drvvbus: Drive VBUS
-	 * @lsbist: Low-Speed BIST Enable.
-	 * @fsbist: Full-Speed BIST Enable.
-	 * @hsbist: High-Speed BIST Enable.
-	 * @bist_done: PHY Bist Done.
-	 *	Asserted at the end of the PHY BIST sequence.
-	 * @bist_err: PHY Bist Error.
-	 *	Indicates an internal error was detected during
-	 *	the BIST sequence.
-	 * @tdata_out: PHY Test Data Out.
-	 *	Presents either internally generated signals or
-	 *	test register contents, based upon the value of
-	 *	test_data_out_sel.
-	 * @siddq: Drives the USBP (USB-PHY) SIDDQ input.
-	 *	Normally should be set to zero.
-	 *	When customers have no intent to use USB PHY
-	 *	interface, they should:
-	 *	- still provide 3.3V to USB_VDD33, and
-	 *	- tie USB_REXT to 3.3V supply, and
-	 *	- set USBN*_USBP_CTL_STATUS[SIDDQ]=1
-	 * @txpreemphasistune: HS Transmitter Pre-Emphasis Enable
-	 * @dma_bmode: When set to 1 the L2C DMA address will be updated
-	 *	with byte-counts between packets. When set to 0
-	 *	the L2C DMA address is incremented to the next
-	 *	4-byte aligned address after adding byte-count.
-	 * @usbc_end: Bigendian input to the USB Core. This should be
-	 *	set to '0' for operation.
-	 * @usbp_bist: PHY, This is cleared '0' to run BIST on the USBP.
-	 * @tclk: PHY Test Clock, used to load TDATA_IN to the USBP.
-	 * @dp_pulld: PHY DP_PULLDOWN input to the USB-PHY.
-	 *	This signal enables the pull-down resistance on
-	 *	the D+ line. '1' pull down-resistance is connected
-	 *	to D+/ '0' pull down resistance is not connected
-	 *	to D+. When an A/B device is acting as a host
-	 *	(downstream-facing port), dp_pulldown and
-	 *	dm_pulldown are enabled. This must not toggle
-	 *	during normal operation.
-	 * @dm_pulld: PHY DM_PULLDOWN input to the USB-PHY.
-	 *	This signal enables the pull-down resistance on
-	 *	the D- line. '1' pull down-resistance is connected
-	 *	to D-. '0' pull down resistance is not connected
-	 *	to D-. When an A/B device is acting as a host
-	 *	(downstream-facing port), dp_pulldown and
-	 *	dm_pulldown are enabled. This must not toggle
-	 *	during normal operation.
-	 * @hst_mode: When '0' the USB is acting as HOST, when '1'
-	 *	USB is acting as device. This field needs to be
-	 *	set while the USB is in reset.
-	 * @tuning: Transmitter Tuning for High-Speed Operation.
-	 *	Tunes the current supply and rise/fall output
-	 *	times for high-speed operation.
-	 *	[20:19] == 11: Current supply increased
-	 *	approximately 9%
-	 *	[20:19] == 10: Current supply increased
-	 *	approximately 4.5%
-	 *	[20:19] == 01: Design default.
-	 *	[20:19] == 00: Current supply decreased
-	 *	approximately 4.5%
-	 *	[22:21] == 11: Rise and fall times are increased.
-	 *	[22:21] == 10: Design default.
-	 *	[22:21] == 01: Rise and fall times are decreased.
-	 *	[22:21] == 00: Rise and fall times are decreased
-	 *	further as compared to the 01 setting.
-	 * @tx_bs_enh: Transmit Bit Stuffing on [15:8].
-	 *	Enables or disables bit stuffing on data[15:8]
-	 *	when bit-stuffing is enabled.
-	 * @tx_bs_en: Transmit Bit Stuffing on [7:0].
-	 *	Enables or disables bit stuffing on data[7:0]
-	 *	when bit-stuffing is enabled.
-	 * @loop_enb: PHY Loopback Test Enable.
-	 *	'1': During data transmission the receive is
-	 *	enabled.
-	 *	'0': During data transmission the receive is
-	 *	disabled.
-	 *	Must be '0' for normal operation.
-	 * @vtest_enb: Analog Test Pin Enable.
-	 *	'1' The PHY's analog_test pin is enabled for the
-	 *	input and output of applicable analog test signals.
-	 *	'0' THe analog_test pin is disabled.
-	 * @bist_enb: Built-In Self Test Enable.
-	 *	Used to activate BIST in the PHY.
-	 * @tdata_sel: Test Data Out Select.
-	 *	'1' test_data_out[3:0] (PHY) register contents
-	 *	are output. '0' internally generated signals are
-	 *	output.
-	 * @taddr_in: Mode Address for Test Interface.
-	 *	Specifies the register address for writing to or
-	 *	reading from the PHY test interface register.
-	 * @tdata_in: Internal Testing Register Input Data and Select
-	 *	This is a test bus. Data is present on [3:0],
-	 *	and its corresponding select (enable) is present
-	 *	on bits [7:4].
-	 * @ate_reset: Reset input from automatic test equipment.
-	 *	This is a test signal. When the USB Core is
-	 *	powered up (not in Susned Mode), an automatic
-	 *	tester can use this to disable phy_clock and
-	 *	free_clk, then re-enable them with an aligned
-	 *	phase.
-	 *	'1': The phy_clk and free_clk outputs are
-	 *	disabled. "0": The phy_clock and free_clk outputs
-	 *	are available within a specific period after the
-	 *	de-assertion.
-	 */
-	struct cvmx_usbnx_usbp_ctl_status_s {
-		__BITFIELD_FIELD(u64 txrisetune		: 1,
-		__BITFIELD_FIELD(u64 txvreftune		: 4,
-		__BITFIELD_FIELD(u64 txfslstune		: 4,
-		__BITFIELD_FIELD(u64 txhsxvtune		: 2,
-		__BITFIELD_FIELD(u64 sqrxtune		: 3,
-		__BITFIELD_FIELD(u64 compdistune	: 3,
-		__BITFIELD_FIELD(u64 otgtune		: 3,
-		__BITFIELD_FIELD(u64 otgdisable		: 1,
-		__BITFIELD_FIELD(u64 portreset		: 1,
-		__BITFIELD_FIELD(u64 drvvbus		: 1,
-		__BITFIELD_FIELD(u64 lsbist		: 1,
-		__BITFIELD_FIELD(u64 fsbist		: 1,
-		__BITFIELD_FIELD(u64 hsbist		: 1,
-		__BITFIELD_FIELD(u64 bist_done		: 1,
-		__BITFIELD_FIELD(u64 bist_err		: 1,
-		__BITFIELD_FIELD(u64 tdata_out		: 4,
-		__BITFIELD_FIELD(u64 siddq		: 1,
-		__BITFIELD_FIELD(u64 txpreemphasistune	: 1,
-		__BITFIELD_FIELD(u64 dma_bmode		: 1,
-		__BITFIELD_FIELD(u64 usbc_end		: 1,
-		__BITFIELD_FIELD(u64 usbp_bist		: 1,
-		__BITFIELD_FIELD(u64 tclk		: 1,
-		__BITFIELD_FIELD(u64 dp_pulld		: 1,
-		__BITFIELD_FIELD(u64 dm_pulld		: 1,
-		__BITFIELD_FIELD(u64 hst_mode		: 1,
-		__BITFIELD_FIELD(u64 tuning		: 4,
-		__BITFIELD_FIELD(u64 tx_bs_enh		: 1,
-		__BITFIELD_FIELD(u64 tx_bs_en		: 1,
-		__BITFIELD_FIELD(u64 loop_enb		: 1,
-		__BITFIELD_FIELD(u64 vtest_enb		: 1,
-		__BITFIELD_FIELD(u64 bist_enb		: 1,
-		__BITFIELD_FIELD(u64 tdata_sel		: 1,
-		__BITFIELD_FIELD(u64 taddr_in		: 4,
-		__BITFIELD_FIELD(u64 tdata_in		: 8,
-		__BITFIELD_FIELD(u64 ate_reset		: 1,
-		;)))))))))))))))))))))))))))))))))))
-	} s;
-};
-
-#endif /* __OCTEON_HCD_H__ */
-- 
2.24.0


_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 59+ messages in thread

* Re: [PATCH 1/2] staging: octeon: delete driver
  2019-12-10  9:15 ` Greg Kroah-Hartman
@ 2019-12-10 10:42   ` Guenter Roeck
  -1 siblings, 0 replies; 59+ messages in thread
From: Guenter Roeck @ 2019-12-10 10:42 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel
  Cc: linux-kernel, David Daney, David S. Miller,
	Matthew Wilcox (Oracle),
	YueHaibing, Aaro Koskinen, Wambui Karuga, Julia Lawall,
	Florian Westphal, Geert Uytterhoeven, Branden Bonaby,
	Petr Štetiar, Sandro Volery, Paul Burton, Dan Carpenter,
	Giovanni Gherdovich, Valery Ivanov

On 12/10/19 1:15 AM, Greg Kroah-Hartman wrote:
> This driver has been in the tree since 2009 with no real movement to get
> it out.  Now it is starting to cause build issues and other problems for
> people who want to fix coding style problems, but can not actually build
> it.
> 
> As nothing is happening here, just delete the module entirely.
> 
> Reported-by: Guenter Roeck <linux@roeck-us.net>
> Cc: David Daney <ddaney@caviumnetworks.com>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: YueHaibing <yuehaibing@huawei.com>
> Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
> Cc: Wambui Karuga <wambui.karugax@gmail.com>
> Cc: Julia Lawall <julia.lawall@lip6.fr>
> Cc: Florian Westphal <fw@strlen.de>
> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Branden Bonaby <brandonbonaby94@gmail.com>
> Cc: "Petr Štetiar" <ynezz@true.cz>
> Cc: Sandro Volery <sandro@volery.com>
> Cc: Paul Burton <paulburton@kernel.org>
> Cc: Dan Carpenter <dan.carpenter@oracle.com>
> Cc: Giovanni Gherdovich <bobdc9664@seznam.cz>
> Cc: Valery Ivanov <ivalery111@gmail.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Acked-by: Guenter Roeck <linux@roeck-us.net>

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 1/2] staging: octeon: delete driver
@ 2019-12-10 10:42   ` Guenter Roeck
  0 siblings, 0 replies; 59+ messages in thread
From: Guenter Roeck @ 2019-12-10 10:42 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel
  Cc: Branden Bonaby, Giovanni Gherdovich, Paul Burton, Aaro Koskinen,
	Florian Westphal, YueHaibing, linux-kernel,
	Matthew Wilcox (Oracle),
	David Daney, Julia Lawall, Sandro Volery, Geert Uytterhoeven,
	Valery Ivanov, Petr Štetiar, David S. Miller, Dan Carpenter,
	Wambui Karuga

On 12/10/19 1:15 AM, Greg Kroah-Hartman wrote:
> This driver has been in the tree since 2009 with no real movement to get
> it out.  Now it is starting to cause build issues and other problems for
> people who want to fix coding style problems, but can not actually build
> it.
> 
> As nothing is happening here, just delete the module entirely.
> 
> Reported-by: Guenter Roeck <linux@roeck-us.net>
> Cc: David Daney <ddaney@caviumnetworks.com>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: YueHaibing <yuehaibing@huawei.com>
> Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
> Cc: Wambui Karuga <wambui.karugax@gmail.com>
> Cc: Julia Lawall <julia.lawall@lip6.fr>
> Cc: Florian Westphal <fw@strlen.de>
> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Branden Bonaby <brandonbonaby94@gmail.com>
> Cc: "Petr Štetiar" <ynezz@true.cz>
> Cc: Sandro Volery <sandro@volery.com>
> Cc: Paul Burton <paulburton@kernel.org>
> Cc: Dan Carpenter <dan.carpenter@oracle.com>
> Cc: Giovanni Gherdovich <bobdc9664@seznam.cz>
> Cc: Valery Ivanov <ivalery111@gmail.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Acked-by: Guenter Roeck <linux@roeck-us.net>
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 1/2] staging: octeon: delete driver
  2019-12-10  9:15 ` Greg Kroah-Hartman
@ 2019-12-10 11:40   ` Sandro Volery
  -1 siblings, 0 replies; 59+ messages in thread
From: Sandro Volery @ 2019-12-10 11:40 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, linux-kernel, Guenter Roeck, David Daney, David S. Miller,
	Matthew Wilcox (Oracle),
	YueHaibing, Aaro Koskinen, Wambui Karuga, Julia Lawall,
	Florian Westphal, Geert Uytterhoeven, Branden Bonaby,
	Petr Štetiar, Paul Burton, Dan Carpenter,
	Giovanni Gherdovich, Valery Ivanov

Doesn't octeon have drivers out of staging already?
What is this module for?

Sandro V

> On 10 Dec 2019, at 10:15, Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
> 
> This driver has been in the tree since 2009 with no real movement to get
> it out.  Now it is starting to cause build issues and other problems for
> people who want to fix coding style problems, but can not actually build
> it.
> 
> As nothing is happening here, just delete the module entirely.
> 
> Reported-by: Guenter Roeck <linux@roeck-us.net>
> Cc: David Daney <ddaney@caviumnetworks.com>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: YueHaibing <yuehaibing@huawei.com>
> Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
> Cc: Wambui Karuga <wambui.karugax@gmail.com>
> Cc: Julia Lawall <julia.lawall@lip6.fr>
> Cc: Florian Westphal <fw@strlen.de>
> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Branden Bonaby <brandonbonaby94@gmail.com>
> Cc: "Petr Štetiar" <ynezz@true.cz>
> Cc: Sandro Volery <sandro@volery.com>
> Cc: Paul Burton <paulburton@kernel.org>
> Cc: Dan Carpenter <dan.carpenter@oracle.com>
> Cc: Giovanni Gherdovich <bobdc9664@seznam.cz>
> Cc: Valery Ivanov <ivalery111@gmail.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> drivers/staging/Kconfig                   |    2 -
> drivers/staging/Makefile                  |    1 -
> drivers/staging/octeon/Kconfig            |   16 -
> drivers/staging/octeon/Makefile           |   19 -
> drivers/staging/octeon/TODO               |    9 -
> drivers/staging/octeon/ethernet-defines.h |   40 -
> drivers/staging/octeon/ethernet-mdio.c    |  178 ---
> drivers/staging/octeon/ethernet-mdio.h    |   28 -
> drivers/staging/octeon/ethernet-mem.c     |  154 ---
> drivers/staging/octeon/ethernet-mem.h     |    9 -
> drivers/staging/octeon/ethernet-rgmii.c   |  158 ---
> drivers/staging/octeon/ethernet-rx.c      |  538 --------
> drivers/staging/octeon/ethernet-rx.h      |   31 -
> drivers/staging/octeon/ethernet-sgmii.c   |   30 -
> drivers/staging/octeon/ethernet-spi.c     |  226 ----
> drivers/staging/octeon/ethernet-tx.c      |  717 -----------
> drivers/staging/octeon/ethernet-tx.h      |   14 -
> drivers/staging/octeon/ethernet-util.h    |   47 -
> drivers/staging/octeon/ethernet.c         |  992 --------------
> drivers/staging/octeon/octeon-ethernet.h  |  107 --
> drivers/staging/octeon/octeon-stubs.h     | 1433 ---------------------
> 21 files changed, 4749 deletions(-)
> delete mode 100644 drivers/staging/octeon/Kconfig
> delete mode 100644 drivers/staging/octeon/Makefile
> delete mode 100644 drivers/staging/octeon/TODO
> delete mode 100644 drivers/staging/octeon/ethernet-defines.h
> delete mode 100644 drivers/staging/octeon/ethernet-mdio.c
> delete mode 100644 drivers/staging/octeon/ethernet-mdio.h
> delete mode 100644 drivers/staging/octeon/ethernet-mem.c
> delete mode 100644 drivers/staging/octeon/ethernet-mem.h
> delete mode 100644 drivers/staging/octeon/ethernet-rgmii.c
> delete mode 100644 drivers/staging/octeon/ethernet-rx.c
> delete mode 100644 drivers/staging/octeon/ethernet-rx.h
> delete mode 100644 drivers/staging/octeon/ethernet-sgmii.c
> delete mode 100644 drivers/staging/octeon/ethernet-spi.c
> delete mode 100644 drivers/staging/octeon/ethernet-tx.c
> delete mode 100644 drivers/staging/octeon/ethernet-tx.h
> delete mode 100644 drivers/staging/octeon/ethernet-util.h
> delete mode 100644 drivers/staging/octeon/ethernet.c
> delete mode 100644 drivers/staging/octeon/octeon-ethernet.h
> delete mode 100644 drivers/staging/octeon/octeon-stubs.h
> 
> diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
> index eaf753b70ec5..15d3549e7cc7 100644
> --- a/drivers/staging/Kconfig
> +++ b/drivers/staging/Kconfig
> @@ -42,8 +42,6 @@ source "drivers/staging/rtl8188eu/Kconfig"
> 
> source "drivers/staging/rts5208/Kconfig"
> 
> -source "drivers/staging/octeon/Kconfig"
> -
> source "drivers/staging/octeon-usb/Kconfig"
> 
> source "drivers/staging/vt6655/Kconfig"
> diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
> index 0a4396c9067b..c521204220b5 100644
> --- a/drivers/staging/Makefile
> +++ b/drivers/staging/Makefile
> @@ -12,7 +12,6 @@ obj-$(CONFIG_R8712U)        += rtl8712/
> obj-$(CONFIG_R8188EU)        += rtl8188eu/
> obj-$(CONFIG_RTS5208)        += rts5208/
> obj-$(CONFIG_NETLOGIC_XLR_NET)    += netlogic/
> -obj-$(CONFIG_OCTEON_ETHERNET)    += octeon/
> obj-$(CONFIG_OCTEON_USB)    += octeon-usb/
> obj-$(CONFIG_VT6655)        += vt6655/
> obj-$(CONFIG_VT6656)        += vt6656/
> diff --git a/drivers/staging/octeon/Kconfig b/drivers/staging/octeon/Kconfig
> deleted file mode 100644
> index e7f4ddcc1361..000000000000
> --- a/drivers/staging/octeon/Kconfig
> +++ /dev/null
> @@ -1,16 +0,0 @@
> -# SPDX-License-Identifier: GPL-2.0
> -config OCTEON_ETHERNET
> -    tristate "Cavium Networks Octeon Ethernet support"
> -    depends on CAVIUM_OCTEON_SOC || COMPILE_TEST
> -    depends on NETDEVICES
> -    depends on BROKEN
> -    select PHYLIB
> -    select MDIO_OCTEON
> -    help
> -      This driver supports the builtin ethernet ports on Cavium
> -      Networks' products in the Octeon family. This driver supports the
> -      CN3XXX and CN5XXX Octeon processors.
> -
> -      To compile this driver as a module, choose M here.  The module
> -      will be called octeon-ethernet.
> -
> diff --git a/drivers/staging/octeon/Makefile b/drivers/staging/octeon/Makefile
> deleted file mode 100644
> index 3887cf5f1e84..000000000000
> --- a/drivers/staging/octeon/Makefile
> +++ /dev/null
> @@ -1,19 +0,0 @@
> -# SPDX-License-Identifier: GPL-2.0
> -#
> -# Copyright (C) 2005-2009 Cavium Networks
> -#
> -
> -#
> -# Makefile for Cavium OCTEON on-board ethernet driver
> -#
> -
> -obj-${CONFIG_OCTEON_ETHERNET} :=  octeon-ethernet.o
> -
> -octeon-ethernet-y := ethernet.o
> -octeon-ethernet-y += ethernet-mdio.o
> -octeon-ethernet-y += ethernet-mem.o
> -octeon-ethernet-y += ethernet-rgmii.o
> -octeon-ethernet-y += ethernet-rx.o
> -octeon-ethernet-y += ethernet-sgmii.o
> -octeon-ethernet-y += ethernet-spi.o
> -octeon-ethernet-y += ethernet-tx.o
> diff --git a/drivers/staging/octeon/TODO b/drivers/staging/octeon/TODO
> deleted file mode 100644
> index 67a0a1f6b922..000000000000
> --- a/drivers/staging/octeon/TODO
> +++ /dev/null
> @@ -1,9 +0,0 @@
> -This driver is functional and supports Ethernet on OCTEON+/OCTEON2/OCTEON3
> -chips at least up to CN7030.
> -
> -TODO:
> -    - general code review and clean up
> -    - make driver self-contained instead of being split between staging and
> -      arch/mips/cavium-octeon.
> -
> -Contact: Aaro Koskinen <aaro.koskinen@iki.fi>
> diff --git a/drivers/staging/octeon/ethernet-defines.h b/drivers/staging/octeon/ethernet-defines.h
> deleted file mode 100644
> index ef9e767b0e2e..000000000000
> --- a/drivers/staging/octeon/ethernet-defines.h
> +++ /dev/null
> @@ -1,40 +0,0 @@
> -/* SPDX-License-Identifier: GPL-2.0 */
> -/*
> - * This file is based on code from OCTEON SDK by Cavium Networks.
> - *
> - * Copyright (c) 2003-2007 Cavium Networks
> - */
> -
> -/*
> - * A few defines are used to control the operation of this driver:
> - *  USE_ASYNC_IOBDMA
> - *      Use asynchronous IO access to hardware. This uses Octeon's asynchronous
> - *      IOBDMAs to issue IO accesses without stalling. Set this to zero
> - *      to disable this. Note that IOBDMAs require CVMSEG.
> - *  REUSE_SKBUFFS_WITHOUT_FREE
> - *      Allows the TX path to free an skbuff into the FPA hardware pool. This
> - *      can significantly improve performance for forwarding and bridging, but
> - *      may be somewhat dangerous. Checks are made, but if any buffer is reused
> - *      without the proper Linux cleanup, the networking stack may have very
> - *      bizarre bugs.
> - */
> -#ifndef __ETHERNET_DEFINES_H__
> -#define __ETHERNET_DEFINES_H__
> -
> -#ifdef CONFIG_NETFILTER
> -#define REUSE_SKBUFFS_WITHOUT_FREE  0
> -#else
> -#define REUSE_SKBUFFS_WITHOUT_FREE  1
> -#endif
> -
> -#define USE_ASYNC_IOBDMA            (CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE > 0)
> -
> -/* Maximum number of SKBs to try to free per xmit packet. */
> -#define MAX_OUT_QUEUE_DEPTH 1000
> -
> -#define FAU_TOTAL_TX_TO_CLEAN (CVMX_FAU_REG_END - sizeof(u32))
> -#define FAU_NUM_PACKET_BUFFERS_TO_FREE (FAU_TOTAL_TX_TO_CLEAN - sizeof(u32))
> -
> -#define TOTAL_NUMBER_OF_PORTS       (CVMX_PIP_NUM_INPUT_PORTS + 1)
> -
> -#endif /* __ETHERNET_DEFINES_H__ */
> diff --git a/drivers/staging/octeon/ethernet-mdio.c b/drivers/staging/octeon/ethernet-mdio.c
> deleted file mode 100644
> index c798672d61b2..000000000000
> --- a/drivers/staging/octeon/ethernet-mdio.c
> +++ /dev/null
> @@ -1,178 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0
> -/*
> - * This file is based on code from OCTEON SDK by Cavium Networks.
> - *
> - * Copyright (c) 2003-2007 Cavium Networks
> - */
> -
> -#include <linux/kernel.h>
> -#include <linux/ethtool.h>
> -#include <linux/phy.h>
> -#include <linux/ratelimit.h>
> -#include <linux/of_mdio.h>
> -#include <generated/utsrelease.h>
> -#include <net/dst.h>
> -
> -#include "octeon-ethernet.h"
> -#include "ethernet-defines.h"
> -#include "ethernet-mdio.h"
> -#include "ethernet-util.h"
> -
> -static void cvm_oct_get_drvinfo(struct net_device *dev,
> -                struct ethtool_drvinfo *info)
> -{
> -    strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver));
> -    strlcpy(info->version, UTS_RELEASE, sizeof(info->version));
> -    strlcpy(info->bus_info, "Builtin", sizeof(info->bus_info));
> -}
> -
> -static int cvm_oct_nway_reset(struct net_device *dev)
> -{
> -    if (!capable(CAP_NET_ADMIN))
> -        return -EPERM;
> -
> -    if (dev->phydev)
> -        return phy_start_aneg(dev->phydev);
> -
> -    return -EINVAL;
> -}
> -
> -const struct ethtool_ops cvm_oct_ethtool_ops = {
> -    .get_drvinfo = cvm_oct_get_drvinfo,
> -    .nway_reset = cvm_oct_nway_reset,
> -    .get_link = ethtool_op_get_link,
> -    .get_link_ksettings = phy_ethtool_get_link_ksettings,
> -    .set_link_ksettings = phy_ethtool_set_link_ksettings,
> -};
> -
> -/**
> - * cvm_oct_ioctl - IOCTL support for PHY control
> - * @dev:    Device to change
> - * @rq:     the request
> - * @cmd:    the command
> - *
> - * Returns Zero on success
> - */
> -int cvm_oct_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
> -{
> -    if (!netif_running(dev))
> -        return -EINVAL;
> -
> -    if (!dev->phydev)
> -        return -EINVAL;
> -
> -    return phy_mii_ioctl(dev->phydev, rq, cmd);
> -}
> -
> -void cvm_oct_note_carrier(struct octeon_ethernet *priv,
> -              union cvmx_helper_link_info li)
> -{
> -    if (li.s.link_up) {
> -        pr_notice_ratelimited("%s: %u Mbps %s duplex, port %d, queue %d\n",
> -                      netdev_name(priv->netdev), li.s.speed,
> -                      (li.s.full_duplex) ? "Full" : "Half",
> -                      priv->port, priv->queue);
> -    } else {
> -        pr_notice_ratelimited("%s: Link down\n",
> -                      netdev_name(priv->netdev));
> -    }
> -}
> -
> -void cvm_oct_adjust_link(struct net_device *dev)
> -{
> -    struct octeon_ethernet *priv = netdev_priv(dev);
> -    union cvmx_helper_link_info link_info;
> -
> -    link_info.u64        = 0;
> -    link_info.s.link_up    = dev->phydev->link ? 1 : 0;
> -    link_info.s.full_duplex = dev->phydev->duplex ? 1 : 0;
> -    link_info.s.speed    = dev->phydev->speed;
> -    priv->link_info        = link_info.u64;
> -
> -    /*
> -     * The polling task need to know about link status changes.
> -     */
> -    if (priv->poll)
> -        priv->poll(dev);
> -
> -    if (priv->last_link != dev->phydev->link) {
> -        priv->last_link = dev->phydev->link;
> -        cvmx_helper_link_set(priv->port, link_info);
> -        cvm_oct_note_carrier(priv, link_info);
> -    }
> -}
> -
> -int cvm_oct_common_stop(struct net_device *dev)
> -{
> -    struct octeon_ethernet *priv = netdev_priv(dev);
> -    int interface = INTERFACE(priv->port);
> -    union cvmx_helper_link_info link_info;
> -    union cvmx_gmxx_prtx_cfg gmx_cfg;
> -    int index = INDEX(priv->port);
> -
> -    gmx_cfg.u64 = cvmx_read_csr(CVMX_GMXX_PRTX_CFG(index, interface));
> -    gmx_cfg.s.en = 0;
> -    cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface), gmx_cfg.u64);
> -
> -    priv->poll = NULL;
> -
> -    if (dev->phydev)
> -        phy_disconnect(dev->phydev);
> -
> -    if (priv->last_link) {
> -        link_info.u64 = 0;
> -        priv->last_link = 0;
> -
> -        cvmx_helper_link_set(priv->port, link_info);
> -        cvm_oct_note_carrier(priv, link_info);
> -    }
> -    return 0;
> -}
> -
> -/**
> - * cvm_oct_phy_setup_device - setup the PHY
> - *
> - * @dev:    Device to setup
> - *
> - * Returns Zero on success, negative on failure
> - */
> -int cvm_oct_phy_setup_device(struct net_device *dev)
> -{
> -    struct octeon_ethernet *priv = netdev_priv(dev);
> -    struct device_node *phy_node;
> -    struct phy_device *phydev = NULL;
> -
> -    if (!priv->of_node)
> -        goto no_phy;
> -
> -    phy_node = of_parse_phandle(priv->of_node, "phy-handle", 0);
> -    if (!phy_node && of_phy_is_fixed_link(priv->of_node)) {
> -        int rc;
> -
> -        rc = of_phy_register_fixed_link(priv->of_node);
> -        if (rc)
> -            return rc;
> -
> -        phy_node = of_node_get(priv->of_node);
> -    }
> -    if (!phy_node)
> -        goto no_phy;
> -
> -    phydev = of_phy_connect(dev, phy_node, cvm_oct_adjust_link, 0,
> -                priv->phy_mode);
> -    of_node_put(phy_node);
> -
> -    if (!phydev)
> -        return -ENODEV;
> -
> -    priv->last_link = 0;
> -    phy_start(phydev);
> -
> -    return 0;
> -no_phy:
> -    /* If there is no phy, assume a direct MAC connection and that
> -     * the link is up.
> -     */
> -    netif_carrier_on(dev);
> -    return 0;
> -}
> diff --git a/drivers/staging/octeon/ethernet-mdio.h b/drivers/staging/octeon/ethernet-mdio.h
> deleted file mode 100644
> index e3771d48c49b..000000000000
> --- a/drivers/staging/octeon/ethernet-mdio.h
> +++ /dev/null
> @@ -1,28 +0,0 @@
> -/* SPDX-License-Identifier: GPL-2.0 */
> -/*
> - * This file is based on code from OCTEON SDK by Cavium Networks.
> - *
> - * Copyright (c) 2003-2007 Cavium Networks
> - */
> -
> -#include <linux/module.h>
> -#include <linux/kernel.h>
> -#include <linux/netdevice.h>
> -#include <linux/etherdevice.h>
> -#include <linux/ip.h>
> -#include <linux/string.h>
> -#include <linux/ethtool.h>
> -#include <linux/seq_file.h>
> -#include <linux/proc_fs.h>
> -#include <net/dst.h>
> -#ifdef CONFIG_XFRM
> -#include <linux/xfrm.h>
> -#include <net/xfrm.h>
> -#endif /* CONFIG_XFRM */
> -
> -extern const struct ethtool_ops cvm_oct_ethtool_ops;
> -
> -void octeon_mdiobus_force_mod_depencency(void);
> -
> -int cvm_oct_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
> -int cvm_oct_phy_setup_device(struct net_device *dev);
> diff --git a/drivers/staging/octeon/ethernet-mem.c b/drivers/staging/octeon/ethernet-mem.c
> deleted file mode 100644
> index 532594957ebc..000000000000
> --- a/drivers/staging/octeon/ethernet-mem.c
> +++ /dev/null
> @@ -1,154 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0
> -/*
> - * This file is based on code from OCTEON SDK by Cavium Networks.
> - *
> - * Copyright (c) 2003-2010 Cavium Networks
> - */
> -
> -#include <linux/kernel.h>
> -#include <linux/netdevice.h>
> -#include <linux/slab.h>
> -
> -#include "octeon-ethernet.h"
> -#include "ethernet-mem.h"
> -#include "ethernet-defines.h"
> -
> -/**
> - * cvm_oct_fill_hw_skbuff - fill the supplied hardware pool with skbuffs
> - * @pool:     Pool to allocate an skbuff for
> - * @size:     Size of the buffer needed for the pool
> - * @elements: Number of buffers to allocate
> - *
> - * Returns the actual number of buffers allocated.
> - */
> -static int cvm_oct_fill_hw_skbuff(int pool, int size, int elements)
> -{
> -    int freed = elements;
> -
> -    while (freed) {
> -        struct sk_buff *skb = dev_alloc_skb(size + 256);
> -
> -        if (unlikely(!skb))
> -            break;
> -        skb_reserve(skb, 256 - (((unsigned long)skb->data) & 0x7f));
> -        *(struct sk_buff **)(skb->data - sizeof(void *)) = skb;
> -        cvmx_fpa_free(skb->data, pool, size / 128);
> -        freed--;
> -    }
> -    return elements - freed;
> -}
> -
> -/**
> - * cvm_oct_free_hw_skbuff- free hardware pool skbuffs
> - * @pool:     Pool to allocate an skbuff for
> - * @size:     Size of the buffer needed for the pool
> - * @elements: Number of buffers to allocate
> - */
> -static void cvm_oct_free_hw_skbuff(int pool, int size, int elements)
> -{
> -    char *memory;
> -
> -    do {
> -        memory = cvmx_fpa_alloc(pool);
> -        if (memory) {
> -            struct sk_buff *skb =
> -                *(struct sk_buff **)(memory - sizeof(void *));
> -            elements--;
> -            dev_kfree_skb(skb);
> -        }
> -    } while (memory);
> -
> -    if (elements < 0)
> -        pr_warn("Freeing of pool %u had too many skbuffs (%d)\n",
> -            pool, elements);
> -    else if (elements > 0)
> -        pr_warn("Freeing of pool %u is missing %d skbuffs\n",
> -            pool, elements);
> -}
> -
> -/**
> - * cvm_oct_fill_hw_memory - fill a hardware pool with memory.
> - * @pool:     Pool to populate
> - * @size:     Size of each buffer in the pool
> - * @elements: Number of buffers to allocate
> - *
> - * Returns the actual number of buffers allocated.
> - */
> -static int cvm_oct_fill_hw_memory(int pool, int size, int elements)
> -{
> -    char *memory;
> -    char *fpa;
> -    int freed = elements;
> -
> -    while (freed) {
> -        /*
> -         * FPA memory must be 128 byte aligned.  Since we are
> -         * aligning we need to save the original pointer so we
> -         * can feed it to kfree when the memory is returned to
> -         * the kernel.
> -         *
> -         * We allocate an extra 256 bytes to allow for
> -         * alignment and space for the original pointer saved
> -         * just before the block.
> -         */
> -        memory = kmalloc(size + 256, GFP_ATOMIC);
> -        if (unlikely(!memory)) {
> -            pr_warn("Unable to allocate %u bytes for FPA pool %d\n",
> -                elements * size, pool);
> -            break;
> -        }
> -        fpa = (char *)(((unsigned long)memory + 256) & ~0x7fUL);
> -        *((char **)fpa - 1) = memory;
> -        cvmx_fpa_free(fpa, pool, 0);
> -        freed--;
> -    }
> -    return elements - freed;
> -}
> -
> -/**
> - * cvm_oct_free_hw_memory - Free memory allocated by cvm_oct_fill_hw_memory
> - * @pool:     FPA pool to free
> - * @size:     Size of each buffer in the pool
> - * @elements: Number of buffers that should be in the pool
> - */
> -static void cvm_oct_free_hw_memory(int pool, int size, int elements)
> -{
> -    char *memory;
> -    char *fpa;
> -
> -    do {
> -        fpa = cvmx_fpa_alloc(pool);
> -        if (fpa) {
> -            elements--;
> -            fpa = (char *)phys_to_virt(cvmx_ptr_to_phys(fpa));
> -            memory = *((char **)fpa - 1);
> -            kfree(memory);
> -        }
> -    } while (fpa);
> -
> -    if (elements < 0)
> -        pr_warn("Freeing of pool %u had too many buffers (%d)\n",
> -            pool, elements);
> -    else if (elements > 0)
> -        pr_warn("Warning: Freeing of pool %u is missing %d buffers\n",
> -            pool, elements);
> -}
> -
> -int cvm_oct_mem_fill_fpa(int pool, int size, int elements)
> -{
> -    int freed;
> -
> -    if (pool == CVMX_FPA_PACKET_POOL)
> -        freed = cvm_oct_fill_hw_skbuff(pool, size, elements);
> -    else
> -        freed = cvm_oct_fill_hw_memory(pool, size, elements);
> -    return freed;
> -}
> -
> -void cvm_oct_mem_empty_fpa(int pool, int size, int elements)
> -{
> -    if (pool == CVMX_FPA_PACKET_POOL)
> -        cvm_oct_free_hw_skbuff(pool, size, elements);
> -    else
> -        cvm_oct_free_hw_memory(pool, size, elements);
> -}
> diff --git a/drivers/staging/octeon/ethernet-mem.h b/drivers/staging/octeon/ethernet-mem.h
> deleted file mode 100644
> index 692dcdb7154d..000000000000
> --- a/drivers/staging/octeon/ethernet-mem.h
> +++ /dev/null
> @@ -1,9 +0,0 @@
> -/* SPDX-License-Identifier: GPL-2.0 */
> -/*
> - * This file is based on code from OCTEON SDK by Cavium Networks.
> - *
> - * Copyright (c) 2003-2007 Cavium Networks
> - */
> -
> -int cvm_oct_mem_fill_fpa(int pool, int size, int elements);
> -void cvm_oct_mem_empty_fpa(int pool, int size, int elements);
> diff --git a/drivers/staging/octeon/ethernet-rgmii.c b/drivers/staging/octeon/ethernet-rgmii.c
> deleted file mode 100644
> index 0c4fac31540a..000000000000
> --- a/drivers/staging/octeon/ethernet-rgmii.c
> +++ /dev/null
> @@ -1,158 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0
> -/*
> - * This file is based on code from OCTEON SDK by Cavium Networks.
> - *
> - * Copyright (c) 2003-2007 Cavium Networks
> - */
> -
> -#include <linux/kernel.h>
> -#include <linux/netdevice.h>
> -#include <linux/interrupt.h>
> -#include <linux/phy.h>
> -#include <linux/ratelimit.h>
> -#include <net/dst.h>
> -
> -#include "octeon-ethernet.h"
> -#include "ethernet-defines.h"
> -#include "ethernet-util.h"
> -#include "ethernet-mdio.h"
> -
> -static DEFINE_SPINLOCK(global_register_lock);
> -
> -static void cvm_oct_set_hw_preamble(struct octeon_ethernet *priv, bool enable)
> -{
> -    union cvmx_gmxx_rxx_frm_ctl gmxx_rxx_frm_ctl;
> -    union cvmx_ipd_sub_port_fcs ipd_sub_port_fcs;
> -    union cvmx_gmxx_rxx_int_reg gmxx_rxx_int_reg;
> -    int interface = INTERFACE(priv->port);
> -    int index = INDEX(priv->port);
> -
> -    /* Set preamble checking. */
> -    gmxx_rxx_frm_ctl.u64 = cvmx_read_csr(CVMX_GMXX_RXX_FRM_CTL(index,
> -                                   interface));
> -    gmxx_rxx_frm_ctl.s.pre_chk = enable;
> -    cvmx_write_csr(CVMX_GMXX_RXX_FRM_CTL(index, interface),
> -               gmxx_rxx_frm_ctl.u64);
> -
> -    /* Set FCS stripping. */
> -    ipd_sub_port_fcs.u64 = cvmx_read_csr(CVMX_IPD_SUB_PORT_FCS);
> -    if (enable)
> -        ipd_sub_port_fcs.s.port_bit |= 1ull << priv->port;
> -    else
> -        ipd_sub_port_fcs.s.port_bit &=
> -                    0xffffffffull ^ (1ull << priv->port);
> -    cvmx_write_csr(CVMX_IPD_SUB_PORT_FCS, ipd_sub_port_fcs.u64);
> -
> -    /* Clear any error bits. */
> -    gmxx_rxx_int_reg.u64 = cvmx_read_csr(CVMX_GMXX_RXX_INT_REG(index,
> -                                   interface));
> -    cvmx_write_csr(CVMX_GMXX_RXX_INT_REG(index, interface),
> -               gmxx_rxx_int_reg.u64);
> -}
> -
> -static void cvm_oct_check_preamble_errors(struct net_device *dev)
> -{
> -    struct octeon_ethernet *priv = netdev_priv(dev);
> -    union cvmx_helper_link_info link_info;
> -    unsigned long flags;
> -
> -    link_info.u64 = priv->link_info;
> -
> -    /*
> -     * Take the global register lock since we are going to
> -     * touch registers that affect more than one port.
> -     */
> -    spin_lock_irqsave(&global_register_lock, flags);
> -
> -    if (link_info.s.speed == 10 && priv->last_speed == 10) {
> -        /*
> -         * Read the GMXX_RXX_INT_REG[PCTERR] bit and see if we are
> -         * getting preamble errors.
> -         */
> -        int interface = INTERFACE(priv->port);
> -        int index = INDEX(priv->port);
> -        union cvmx_gmxx_rxx_int_reg gmxx_rxx_int_reg;
> -
> -        gmxx_rxx_int_reg.u64 = cvmx_read_csr(CVMX_GMXX_RXX_INT_REG
> -                            (index, interface));
> -        if (gmxx_rxx_int_reg.s.pcterr) {
> -            /*
> -             * We are getting preamble errors at 10Mbps. Most
> -             * likely the PHY is giving us packets with misaligned
> -             * preambles. In order to get these packets we need to
> -             * disable preamble checking and do it in software.
> -             */
> -            cvm_oct_set_hw_preamble(priv, false);
> -            printk_ratelimited("%s: Using 10Mbps with software preamble removal\n",
> -                       dev->name);
> -        }
> -    } else {
> -        /*
> -         * Since the 10Mbps preamble workaround is allowed we need to
> -         * enable preamble checking, FCS stripping, and clear error
> -         * bits on every speed change. If errors occur during 10Mbps
> -         * operation the above code will change this stuff
> -         */
> -        if (priv->last_speed != link_info.s.speed)
> -            cvm_oct_set_hw_preamble(priv, true);
> -        priv->last_speed = link_info.s.speed;
> -    }
> -    spin_unlock_irqrestore(&global_register_lock, flags);
> -}
> -
> -static void cvm_oct_rgmii_poll(struct net_device *dev)
> -{
> -    struct octeon_ethernet *priv = netdev_priv(dev);
> -    union cvmx_helper_link_info link_info;
> -    bool status_change;
> -
> -    link_info = cvmx_helper_link_get(priv->port);
> -    if (priv->link_info != link_info.u64 &&
> -        cvmx_helper_link_set(priv->port, link_info))
> -        link_info.u64 = priv->link_info;
> -    status_change = priv->link_info != link_info.u64;
> -    priv->link_info = link_info.u64;
> -
> -    cvm_oct_check_preamble_errors(dev);
> -
> -    if (likely(!status_change))
> -        return;
> -
> -    /* Tell core. */
> -    if (link_info.s.link_up) {
> -        if (!netif_carrier_ok(dev))
> -            netif_carrier_on(dev);
> -    } else if (netif_carrier_ok(dev)) {
> -        netif_carrier_off(dev);
> -    }
> -    cvm_oct_note_carrier(priv, link_info);
> -}
> -
> -int cvm_oct_rgmii_open(struct net_device *dev)
> -{
> -    struct octeon_ethernet *priv = netdev_priv(dev);
> -    int ret;
> -
> -    ret = cvm_oct_common_open(dev, cvm_oct_rgmii_poll);
> -    if (ret)
> -        return ret;
> -
> -    if (dev->phydev) {
> -        /*
> -         * In phydev mode, we need still periodic polling for the
> -         * preamble error checking, and we also need to call this
> -         * function on every link state change.
> -         *
> -         * Only true RGMII ports need to be polled. In GMII mode, port
> -         * 0 is really a RGMII port.
> -         */
> -        if ((priv->imode == CVMX_HELPER_INTERFACE_MODE_GMII &&
> -             priv->port  == 0) ||
> -            (priv->imode == CVMX_HELPER_INTERFACE_MODE_RGMII)) {
> -            priv->poll = cvm_oct_check_preamble_errors;
> -            cvm_oct_check_preamble_errors(dev);
> -        }
> -    }
> -
> -    return 0;
> -}
> diff --git a/drivers/staging/octeon/ethernet-rx.c b/drivers/staging/octeon/ethernet-rx.c
> deleted file mode 100644
> index 2c16230f993c..000000000000
> --- a/drivers/staging/octeon/ethernet-rx.c
> +++ /dev/null
> @@ -1,538 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0
> -/*
> - * This file is based on code from OCTEON SDK by Cavium Networks.
> - *
> - * Copyright (c) 2003-2010 Cavium Networks
> - */
> -
> -#include <linux/module.h>
> -#include <linux/kernel.h>
> -#include <linux/cache.h>
> -#include <linux/cpumask.h>
> -#include <linux/netdevice.h>
> -#include <linux/etherdevice.h>
> -#include <linux/ip.h>
> -#include <linux/string.h>
> -#include <linux/prefetch.h>
> -#include <linux/ratelimit.h>
> -#include <linux/smp.h>
> -#include <linux/interrupt.h>
> -#include <net/dst.h>
> -#ifdef CONFIG_XFRM
> -#include <linux/xfrm.h>
> -#include <net/xfrm.h>
> -#endif /* CONFIG_XFRM */
> -
> -#include "octeon-ethernet.h"
> -#include "ethernet-defines.h"
> -#include "ethernet-mem.h"
> -#include "ethernet-rx.h"
> -#include "ethernet-util.h"
> -
> -static atomic_t oct_rx_ready = ATOMIC_INIT(0);
> -
> -static struct oct_rx_group {
> -    int irq;
> -    int group;
> -    struct napi_struct napi;
> -} oct_rx_group[16];
> -
> -/**
> - * cvm_oct_do_interrupt - interrupt handler.
> - * @irq: Interrupt number.
> - * @napi_id: Cookie to identify the NAPI instance.
> - *
> - * The interrupt occurs whenever the POW has packets in our group.
> - *
> - */
> -static irqreturn_t cvm_oct_do_interrupt(int irq, void *napi_id)
> -{
> -    /* Disable the IRQ and start napi_poll. */
> -    disable_irq_nosync(irq);
> -    napi_schedule(napi_id);
> -
> -    return IRQ_HANDLED;
> -}
> -
> -/**
> - * cvm_oct_check_rcv_error - process receive errors
> - * @work: Work queue entry pointing to the packet.
> - *
> - * Returns Non-zero if the packet can be dropped, zero otherwise.
> - */
> -static inline int cvm_oct_check_rcv_error(struct cvmx_wqe *work)
> -{
> -    int port;
> -
> -    if (octeon_has_feature(OCTEON_FEATURE_PKND))
> -        port = work->word0.pip.cn68xx.pknd;
> -    else
> -        port = work->word1.cn38xx.ipprt;
> -
> -    if ((work->word2.snoip.err_code == 10) && (work->word1.len <= 64)) {
> -        /*
> -         * Ignore length errors on min size packets. Some
> -         * equipment incorrectly pads packets to 64+4FCS
> -         * instead of 60+4FCS.  Note these packets still get
> -         * counted as frame errors.
> -         */
> -    } else if (work->word2.snoip.err_code == 5 ||
> -           work->word2.snoip.err_code == 7) {
> -        /*
> -         * We received a packet with either an alignment error
> -         * or a FCS error. This may be signalling that we are
> -         * running 10Mbps with GMXX_RXX_FRM_CTL[PRE_CHK]
> -         * off. If this is the case we need to parse the
> -         * packet to determine if we can remove a non spec
> -         * preamble and generate a correct packet.
> -         */
> -        int interface = cvmx_helper_get_interface_num(port);
> -        int index = cvmx_helper_get_interface_index_num(port);
> -        union cvmx_gmxx_rxx_frm_ctl gmxx_rxx_frm_ctl;
> -
> -        gmxx_rxx_frm_ctl.u64 =
> -            cvmx_read_csr(CVMX_GMXX_RXX_FRM_CTL(index, interface));
> -        if (gmxx_rxx_frm_ctl.s.pre_chk == 0) {
> -            u8 *ptr =
> -                cvmx_phys_to_ptr(work->packet_ptr.s.addr);
> -            int i = 0;
> -
> -            while (i < work->word1.len - 1) {
> -                if (*ptr != 0x55)
> -                    break;
> -                ptr++;
> -                i++;
> -            }
> -
> -            if (*ptr == 0xd5) {
> -                /* Port received 0xd5 preamble */
> -                work->packet_ptr.s.addr += i + 1;
> -                work->word1.len -= i + 5;
> -            } else if ((*ptr & 0xf) == 0xd) {
> -                /* Port received 0xd preamble */
> -                work->packet_ptr.s.addr += i;
> -                work->word1.len -= i + 4;
> -                for (i = 0; i < work->word1.len; i++) {
> -                    *ptr =
> -                        ((*ptr & 0xf0) >> 4) |
> -                        ((*(ptr + 1) & 0xf) << 4);
> -                    ptr++;
> -                }
> -            } else {
> -                printk_ratelimited("Port %d unknown preamble, packet dropped\n",
> -                           port);
> -                cvm_oct_free_work(work);
> -                return 1;
> -            }
> -        }
> -    } else {
> -        printk_ratelimited("Port %d receive error code %d, packet dropped\n",
> -                   port, work->word2.snoip.err_code);
> -        cvm_oct_free_work(work);
> -        return 1;
> -    }
> -
> -    return 0;
> -}
> -
> -static void copy_segments_to_skb(struct cvmx_wqe *work, struct sk_buff *skb)
> -{
> -    int segments = work->word2.s.bufs;
> -    union cvmx_buf_ptr segment_ptr = work->packet_ptr;
> -    int len = work->word1.len;
> -    int segment_size;
> -
> -    while (segments--) {
> -        union cvmx_buf_ptr next_ptr;
> -
> -        next_ptr = *(union cvmx_buf_ptr *)
> -            cvmx_phys_to_ptr(segment_ptr.s.addr - 8);
> -
> -        /*
> -         * Octeon Errata PKI-100: The segment size is wrong.
> -         *
> -         * Until it is fixed, calculate the segment size based on
> -         * the packet pool buffer size.
> -         * When it is fixed, the following line should be replaced
> -         * with this one:
> -         * int segment_size = segment_ptr.s.size;
> -         */
> -        segment_size =
> -            CVMX_FPA_PACKET_POOL_SIZE -
> -            (segment_ptr.s.addr -
> -             (((segment_ptr.s.addr >> 7) -
> -               segment_ptr.s.back) << 7));
> -
> -        /* Don't copy more than what is left in the packet */
> -        if (segment_size > len)
> -            segment_size = len;
> -
> -        /* Copy the data into the packet */
> -        skb_put_data(skb, cvmx_phys_to_ptr(segment_ptr.s.addr),
> -                 segment_size);
> -        len -= segment_size;
> -        segment_ptr = next_ptr;
> -    }
> -}
> -
> -static int cvm_oct_poll(struct oct_rx_group *rx_group, int budget)
> -{
> -    const int    coreid = cvmx_get_core_num();
> -    u64    old_group_mask;
> -    u64    old_scratch;
> -    int        rx_count = 0;
> -    int        did_work_request = 0;
> -    int        packet_not_copied;
> -
> -    /* Prefetch cvm_oct_device since we know we need it soon */
> -    prefetch(cvm_oct_device);
> -
> -    if (USE_ASYNC_IOBDMA) {
> -        /* Save scratch in case userspace is using it */
> -        CVMX_SYNCIOBDMA;
> -        old_scratch = cvmx_scratch_read64(CVMX_SCR_SCRATCH);
> -    }
> -
> -    /* Only allow work for our group (and preserve priorities) */
> -    if (OCTEON_IS_MODEL(OCTEON_CN68XX)) {
> -        old_group_mask = cvmx_read_csr(CVMX_SSO_PPX_GRP_MSK(coreid));
> -        cvmx_write_csr(CVMX_SSO_PPX_GRP_MSK(coreid),
> -                   BIT(rx_group->group));
> -        cvmx_read_csr(CVMX_SSO_PPX_GRP_MSK(coreid)); /* Flush */
> -    } else {
> -        old_group_mask = cvmx_read_csr(CVMX_POW_PP_GRP_MSKX(coreid));
> -        cvmx_write_csr(CVMX_POW_PP_GRP_MSKX(coreid),
> -                   (old_group_mask & ~0xFFFFull) |
> -                   BIT(rx_group->group));
> -    }
> -
> -    if (USE_ASYNC_IOBDMA) {
> -        cvmx_pow_work_request_async(CVMX_SCR_SCRATCH, CVMX_POW_NO_WAIT);
> -        did_work_request = 1;
> -    }
> -
> -    while (rx_count < budget) {
> -        struct sk_buff *skb = NULL;
> -        struct sk_buff **pskb = NULL;
> -        int skb_in_hw;
> -        struct cvmx_wqe *work;
> -        int port;
> -
> -        if (USE_ASYNC_IOBDMA && did_work_request)
> -            work = cvmx_pow_work_response_async(CVMX_SCR_SCRATCH);
> -        else
> -            work = cvmx_pow_work_request_sync(CVMX_POW_NO_WAIT);
> -
> -        prefetch(work);
> -        did_work_request = 0;
> -        if (!work) {
> -            if (OCTEON_IS_MODEL(OCTEON_CN68XX)) {
> -                cvmx_write_csr(CVMX_SSO_WQ_IQ_DIS,
> -                           BIT(rx_group->group));
> -                cvmx_write_csr(CVMX_SSO_WQ_INT,
> -                           BIT(rx_group->group));
> -            } else {
> -                union cvmx_pow_wq_int wq_int;
> -
> -                wq_int.u64 = 0;
> -                wq_int.s.iq_dis = BIT(rx_group->group);
> -                wq_int.s.wq_int = BIT(rx_group->group);
> -                cvmx_write_csr(CVMX_POW_WQ_INT, wq_int.u64);
> -            }
> -            break;
> -        }
> -        pskb = (struct sk_buff **)
> -            (cvm_oct_get_buffer_ptr(work->packet_ptr) -
> -            sizeof(void *));
> -        prefetch(pskb);
> -
> -        if (USE_ASYNC_IOBDMA && rx_count < (budget - 1)) {
> -            cvmx_pow_work_request_async_nocheck(CVMX_SCR_SCRATCH,
> -                                CVMX_POW_NO_WAIT);
> -            did_work_request = 1;
> -        }
> -        rx_count++;
> -
> -        skb_in_hw = work->word2.s.bufs == 1;
> -        if (likely(skb_in_hw)) {
> -            skb = *pskb;
> -            prefetch(&skb->head);
> -            prefetch(&skb->len);
> -        }
> -
> -        if (octeon_has_feature(OCTEON_FEATURE_PKND))
> -            port = work->word0.pip.cn68xx.pknd;
> -        else
> -            port = work->word1.cn38xx.ipprt;
> -
> -        prefetch(cvm_oct_device[port]);
> -
> -        /* Immediately throw away all packets with receive errors */
> -        if (unlikely(work->word2.snoip.rcv_error)) {
> -            if (cvm_oct_check_rcv_error(work))
> -                continue;
> -        }
> -
> -        /*
> -         * We can only use the zero copy path if skbuffs are
> -         * in the FPA pool and the packet fits in a single
> -         * buffer.
> -         */
> -        if (likely(skb_in_hw)) {
> -            skb->data = skb->head + work->packet_ptr.s.addr -
> -                cvmx_ptr_to_phys(skb->head);
> -            prefetch(skb->data);
> -            skb->len = work->word1.len;
> -            skb_set_tail_pointer(skb, skb->len);
> -            packet_not_copied = 1;
> -        } else {
> -            /*
> -             * We have to copy the packet. First allocate
> -             * an skbuff for it.
> -             */
> -            skb = dev_alloc_skb(work->word1.len);
> -            if (!skb) {
> -                cvm_oct_free_work(work);
> -                continue;
> -            }
> -
> -            /*
> -             * Check if we've received a packet that was
> -             * entirely stored in the work entry.
> -             */
> -            if (unlikely(work->word2.s.bufs == 0)) {
> -                u8 *ptr = work->packet_data;
> -
> -                if (likely(!work->word2.s.not_IP)) {
> -                    /*
> -                     * The beginning of the packet
> -                     * moves for IP packets.
> -                     */
> -                    if (work->word2.s.is_v6)
> -                        ptr += 2;
> -                    else
> -                        ptr += 6;
> -                }
> -                skb_put_data(skb, ptr, work->word1.len);
> -                /* No packet buffers to free */
> -            } else {
> -                copy_segments_to_skb(work, skb);
> -            }
> -            packet_not_copied = 0;
> -        }
> -        if (likely((port < TOTAL_NUMBER_OF_PORTS) &&
> -               cvm_oct_device[port])) {
> -            struct net_device *dev = cvm_oct_device[port];
> -
> -            /*
> -             * Only accept packets for devices that are
> -             * currently up.
> -             */
> -            if (likely(dev->flags & IFF_UP)) {
> -                skb->protocol = eth_type_trans(skb, dev);
> -                skb->dev = dev;
> -
> -                if (unlikely(work->word2.s.not_IP ||
> -                         work->word2.s.IP_exc ||
> -                         work->word2.s.L4_error ||
> -                         !work->word2.s.tcp_or_udp))
> -                    skb->ip_summed = CHECKSUM_NONE;
> -                else
> -                    skb->ip_summed = CHECKSUM_UNNECESSARY;
> -
> -                /* Increment RX stats for virtual ports */
> -                if (port >= CVMX_PIP_NUM_INPUT_PORTS) {
> -                    dev->stats.rx_packets++;
> -                    dev->stats.rx_bytes += skb->len;
> -                }
> -                netif_receive_skb(skb);
> -            } else {
> -                /*
> -                 * Drop any packet received for a device that
> -                 * isn't up.
> -                 */
> -                dev->stats.rx_dropped++;
> -                dev_kfree_skb_irq(skb);
> -            }
> -        } else {
> -            /*
> -             * Drop any packet received for a device that
> -             * doesn't exist.
> -             */
> -            printk_ratelimited("Port %d not controlled by Linux, packet dropped\n",
> -                       port);
> -            dev_kfree_skb_irq(skb);
> -        }
> -        /*
> -         * Check to see if the skbuff and work share the same
> -         * packet buffer.
> -         */
> -        if (likely(packet_not_copied)) {
> -            /*
> -             * This buffer needs to be replaced, increment
> -             * the number of buffers we need to free by
> -             * one.
> -             */
> -            cvmx_fau_atomic_add32(FAU_NUM_PACKET_BUFFERS_TO_FREE,
> -                          1);
> -
> -            cvmx_fpa_free(work, CVMX_FPA_WQE_POOL, 1);
> -        } else {
> -            cvm_oct_free_work(work);
> -        }
> -    }
> -    /* Restore the original POW group mask */
> -    if (OCTEON_IS_MODEL(OCTEON_CN68XX)) {
> -        cvmx_write_csr(CVMX_SSO_PPX_GRP_MSK(coreid), old_group_mask);
> -        cvmx_read_csr(CVMX_SSO_PPX_GRP_MSK(coreid)); /* Flush */
> -    } else {
> -        cvmx_write_csr(CVMX_POW_PP_GRP_MSKX(coreid), old_group_mask);
> -    }
> -
> -    if (USE_ASYNC_IOBDMA) {
> -        /* Restore the scratch area */
> -        cvmx_scratch_write64(CVMX_SCR_SCRATCH, old_scratch);
> -    }
> -    cvm_oct_rx_refill_pool(0);
> -
> -    return rx_count;
> -}
> -
> -/**
> - * cvm_oct_napi_poll - the NAPI poll function.
> - * @napi: The NAPI instance.
> - * @budget: Maximum number of packets to receive.
> - *
> - * Returns the number of packets processed.
> - */
> -static int cvm_oct_napi_poll(struct napi_struct *napi, int budget)
> -{
> -    struct oct_rx_group *rx_group = container_of(napi, struct oct_rx_group,
> -                             napi);
> -    int rx_count;
> -
> -    rx_count = cvm_oct_poll(rx_group, budget);
> -
> -    if (rx_count < budget) {
> -        /* No more work */
> -        napi_complete_done(napi, rx_count);
> -        enable_irq(rx_group->irq);
> -    }
> -    return rx_count;
> -}
> -
> -#ifdef CONFIG_NET_POLL_CONTROLLER
> -/**
> - * cvm_oct_poll_controller - poll for receive packets
> - * device.
> - *
> - * @dev:    Device to poll. Unused
> - */
> -void cvm_oct_poll_controller(struct net_device *dev)
> -{
> -    int i;
> -
> -    if (!atomic_read(&oct_rx_ready))
> -        return;
> -
> -    for (i = 0; i < ARRAY_SIZE(oct_rx_group); i++) {
> -        if (!(pow_receive_groups & BIT(i)))
> -            continue;
> -
> -        cvm_oct_poll(&oct_rx_group[i], 16);
> -    }
> -}
> -#endif
> -
> -void cvm_oct_rx_initialize(void)
> -{
> -    int i;
> -    struct net_device *dev_for_napi = NULL;
> -
> -    for (i = 0; i < TOTAL_NUMBER_OF_PORTS; i++) {
> -        if (cvm_oct_device[i]) {
> -            dev_for_napi = cvm_oct_device[i];
> -            break;
> -        }
> -    }
> -
> -    if (!dev_for_napi)
> -        panic("No net_devices were allocated.");
> -
> -    for (i = 0; i < ARRAY_SIZE(oct_rx_group); i++) {
> -        int ret;
> -
> -        if (!(pow_receive_groups & BIT(i)))
> -            continue;
> -
> -        netif_napi_add(dev_for_napi, &oct_rx_group[i].napi,
> -                   cvm_oct_napi_poll, rx_napi_weight);
> -        napi_enable(&oct_rx_group[i].napi);
> -
> -        oct_rx_group[i].irq = OCTEON_IRQ_WORKQ0 + i;
> -        oct_rx_group[i].group = i;
> -
> -        /* Register an IRQ handler to receive POW interrupts */
> -        ret = request_irq(oct_rx_group[i].irq, cvm_oct_do_interrupt, 0,
> -                  "Ethernet", &oct_rx_group[i].napi);
> -        if (ret)
> -            panic("Could not acquire Ethernet IRQ %d\n",
> -                  oct_rx_group[i].irq);
> -
> -        disable_irq_nosync(oct_rx_group[i].irq);
> -
> -        /* Enable POW interrupt when our port has at least one packet */
> -        if (OCTEON_IS_MODEL(OCTEON_CN68XX)) {
> -            union cvmx_sso_wq_int_thrx int_thr;
> -            union cvmx_pow_wq_int_pc int_pc;
> -
> -            int_thr.u64 = 0;
> -            int_thr.s.tc_en = 1;
> -            int_thr.s.tc_thr = 1;
> -            cvmx_write_csr(CVMX_SSO_WQ_INT_THRX(i), int_thr.u64);
> -
> -            int_pc.u64 = 0;
> -            int_pc.s.pc_thr = 5;
> -            cvmx_write_csr(CVMX_SSO_WQ_INT_PC, int_pc.u64);
> -        } else {
> -            union cvmx_pow_wq_int_thrx int_thr;
> -            union cvmx_pow_wq_int_pc int_pc;
> -
> -            int_thr.u64 = 0;
> -            int_thr.s.tc_en = 1;
> -            int_thr.s.tc_thr = 1;
> -            cvmx_write_csr(CVMX_POW_WQ_INT_THRX(i), int_thr.u64);
> -
> -            int_pc.u64 = 0;
> -            int_pc.s.pc_thr = 5;
> -            cvmx_write_csr(CVMX_POW_WQ_INT_PC, int_pc.u64);
> -        }
> -
> -        /* Schedule NAPI now. This will indirectly enable the
> -         * interrupt.
> -         */
> -        napi_schedule(&oct_rx_group[i].napi);
> -    }
> -    atomic_inc(&oct_rx_ready);
> -}
> -
> -void cvm_oct_rx_shutdown(void)
> -{
> -    int i;
> -
> -    for (i = 0; i < ARRAY_SIZE(oct_rx_group); i++) {
> -        if (!(pow_receive_groups & BIT(i)))
> -            continue;
> -
> -        /* Disable POW interrupt */
> -        if (OCTEON_IS_MODEL(OCTEON_CN68XX))
> -            cvmx_write_csr(CVMX_SSO_WQ_INT_THRX(i), 0);
> -        else
> -            cvmx_write_csr(CVMX_POW_WQ_INT_THRX(i), 0);
> -
> -        /* Free the interrupt handler */
> -        free_irq(oct_rx_group[i].irq, cvm_oct_device);
> -
> -        netif_napi_del(&oct_rx_group[i].napi);
> -    }
> -}
> diff --git a/drivers/staging/octeon/ethernet-rx.h b/drivers/staging/octeon/ethernet-rx.h
> deleted file mode 100644
> index ff6482fa20d6..000000000000
> --- a/drivers/staging/octeon/ethernet-rx.h
> +++ /dev/null
> @@ -1,31 +0,0 @@
> -/* SPDX-License-Identifier: GPL-2.0 */
> -/*
> - * This file is based on code from OCTEON SDK by Cavium Networks.
> - *
> - * Copyright (c) 2003-2007 Cavium Networks
> - */
> -
> -void cvm_oct_poll_controller(struct net_device *dev);
> -void cvm_oct_rx_initialize(void);
> -void cvm_oct_rx_shutdown(void);
> -
> -static inline void cvm_oct_rx_refill_pool(int fill_threshold)
> -{
> -    int number_to_free;
> -    int num_freed;
> -    /* Refill the packet buffer pool */
> -    number_to_free =
> -        cvmx_fau_fetch_and_add32(FAU_NUM_PACKET_BUFFERS_TO_FREE, 0);
> -
> -    if (number_to_free > fill_threshold) {
> -        cvmx_fau_atomic_add32(FAU_NUM_PACKET_BUFFERS_TO_FREE,
> -                      -number_to_free);
> -        num_freed = cvm_oct_mem_fill_fpa(CVMX_FPA_PACKET_POOL,
> -                         CVMX_FPA_PACKET_POOL_SIZE,
> -                         number_to_free);
> -        if (num_freed != number_to_free) {
> -            cvmx_fau_atomic_add32(FAU_NUM_PACKET_BUFFERS_TO_FREE,
> -                          number_to_free - num_freed);
> -        }
> -    }
> -}
> diff --git a/drivers/staging/octeon/ethernet-sgmii.c b/drivers/staging/octeon/ethernet-sgmii.c
> deleted file mode 100644
> index d7fbd9159302..000000000000
> --- a/drivers/staging/octeon/ethernet-sgmii.c
> +++ /dev/null
> @@ -1,30 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0
> -/*
> - * This file is based on code from OCTEON SDK by Cavium Networks.
> - *
> - * Copyright (c) 2003-2007 Cavium Networks
> - */
> -
> -#include <linux/phy.h>
> -#include <linux/kernel.h>
> -#include <linux/netdevice.h>
> -#include <linux/ratelimit.h>
> -#include <net/dst.h>
> -
> -#include "octeon-ethernet.h"
> -#include "ethernet-defines.h"
> -#include "ethernet-util.h"
> -#include "ethernet-mdio.h"
> -
> -int cvm_oct_sgmii_open(struct net_device *dev)
> -{
> -    return cvm_oct_common_open(dev, cvm_oct_link_poll);
> -}
> -
> -int cvm_oct_sgmii_init(struct net_device *dev)
> -{
> -    cvm_oct_common_init(dev);
> -
> -    /* FIXME: Need autoneg logic */
> -    return 0;
> -}
> diff --git a/drivers/staging/octeon/ethernet-spi.c b/drivers/staging/octeon/ethernet-spi.c
> deleted file mode 100644
> index c582403e6a1f..000000000000
> --- a/drivers/staging/octeon/ethernet-spi.c
> +++ /dev/null
> @@ -1,226 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0
> -/*
> - * This file is based on code from OCTEON SDK by Cavium Networks.
> - *
> - * Copyright (c) 2003-2007 Cavium Networks
> - */
> -
> -#include <linux/kernel.h>
> -#include <linux/netdevice.h>
> -#include <linux/interrupt.h>
> -#include <net/dst.h>
> -
> -#include "octeon-ethernet.h"
> -#include "ethernet-defines.h"
> -#include "ethernet-util.h"
> -
> -static int number_spi_ports;
> -static int need_retrain[2] = { 0, 0 };
> -
> -static void cvm_oct_spxx_int_pr(union cvmx_spxx_int_reg spx_int_reg, int index)
> -{
> -    if (spx_int_reg.s.spf)
> -        pr_err("SPI%d: SRX Spi4 interface down\n", index);
> -    if (spx_int_reg.s.calerr)
> -        pr_err("SPI%d: SRX Spi4 Calendar table parity error\n", index);
> -    if (spx_int_reg.s.syncerr)
> -        pr_err("SPI%d: SRX Consecutive Spi4 DIP4 errors have exceeded SPX_ERR_CTL[ERRCNT]\n",
> -               index);
> -    if (spx_int_reg.s.diperr)
> -        pr_err("SPI%d: SRX Spi4 DIP4 error\n", index);
> -    if (spx_int_reg.s.tpaovr)
> -        pr_err("SPI%d: SRX Selected port has hit TPA overflow\n",
> -               index);
> -    if (spx_int_reg.s.rsverr)
> -        pr_err("SPI%d: SRX Spi4 reserved control word detected\n",
> -               index);
> -    if (spx_int_reg.s.drwnng)
> -        pr_err("SPI%d: SRX Spi4 receive FIFO drowning/overflow\n",
> -               index);
> -    if (spx_int_reg.s.clserr)
> -        pr_err("SPI%d: SRX Spi4 packet closed on non-16B alignment without EOP\n",
> -               index);
> -    if (spx_int_reg.s.spiovr)
> -        pr_err("SPI%d: SRX Spi4 async FIFO overflow\n", index);
> -    if (spx_int_reg.s.abnorm)
> -        pr_err("SPI%d: SRX Abnormal packet termination (ERR bit)\n",
> -               index);
> -    if (spx_int_reg.s.prtnxa)
> -        pr_err("SPI%d: SRX Port out of range\n", index);
> -}
> -
> -static void cvm_oct_stxx_int_pr(union cvmx_stxx_int_reg stx_int_reg, int index)
> -{
> -    if (stx_int_reg.s.syncerr)
> -        pr_err("SPI%d: STX Interface encountered a fatal error\n",
> -               index);
> -    if (stx_int_reg.s.frmerr)
> -        pr_err("SPI%d: STX FRMCNT has exceeded STX_DIP_CNT[MAXFRM]\n",
> -               index);
> -    if (stx_int_reg.s.unxfrm)
> -        pr_err("SPI%d: STX Unexpected framing sequence\n", index);
> -    if (stx_int_reg.s.nosync)
> -        pr_err("SPI%d: STX ERRCNT has exceeded STX_DIP_CNT[MAXDIP]\n",
> -               index);
> -    if (stx_int_reg.s.diperr)
> -        pr_err("SPI%d: STX DIP2 error on the Spi4 Status channel\n",
> -               index);
> -    if (stx_int_reg.s.datovr)
> -        pr_err("SPI%d: STX Spi4 FIFO overflow error\n", index);
> -    if (stx_int_reg.s.ovrbst)
> -        pr_err("SPI%d: STX Transmit packet burst too big\n", index);
> -    if (stx_int_reg.s.calpar1)
> -        pr_err("SPI%d: STX Calendar Table Parity Error Bank%d\n",
> -               index, 1);
> -    if (stx_int_reg.s.calpar0)
> -        pr_err("SPI%d: STX Calendar Table Parity Error Bank%d\n",
> -               index, 0);
> -}
> -
> -static irqreturn_t cvm_oct_spi_spx_int(int index)
> -{
> -    union cvmx_spxx_int_reg spx_int_reg;
> -    union cvmx_stxx_int_reg stx_int_reg;
> -
> -    spx_int_reg.u64 = cvmx_read_csr(CVMX_SPXX_INT_REG(index));
> -    cvmx_write_csr(CVMX_SPXX_INT_REG(index), spx_int_reg.u64);
> -    if (!need_retrain[index]) {
> -        spx_int_reg.u64 &= cvmx_read_csr(CVMX_SPXX_INT_MSK(index));
> -        cvm_oct_spxx_int_pr(spx_int_reg, index);
> -    }
> -
> -    stx_int_reg.u64 = cvmx_read_csr(CVMX_STXX_INT_REG(index));
> -    cvmx_write_csr(CVMX_STXX_INT_REG(index), stx_int_reg.u64);
> -    if (!need_retrain[index]) {
> -        stx_int_reg.u64 &= cvmx_read_csr(CVMX_STXX_INT_MSK(index));
> -        cvm_oct_stxx_int_pr(stx_int_reg, index);
> -    }
> -
> -    cvmx_write_csr(CVMX_SPXX_INT_MSK(index), 0);
> -    cvmx_write_csr(CVMX_STXX_INT_MSK(index), 0);
> -    need_retrain[index] = 1;
> -
> -    return IRQ_HANDLED;
> -}
> -
> -static irqreturn_t cvm_oct_spi_rml_interrupt(int cpl, void *dev_id)
> -{
> -    irqreturn_t return_status = IRQ_NONE;
> -    union cvmx_npi_rsl_int_blocks rsl_int_blocks;
> -
> -    /* Check and see if this interrupt was caused by the GMX block */
> -    rsl_int_blocks.u64 = cvmx_read_csr(CVMX_NPI_RSL_INT_BLOCKS);
> -    if (rsl_int_blocks.s.spx1) /* 19 - SPX1_INT_REG & STX1_INT_REG */
> -        return_status = cvm_oct_spi_spx_int(1);
> -
> -    if (rsl_int_blocks.s.spx0) /* 18 - SPX0_INT_REG & STX0_INT_REG */
> -        return_status = cvm_oct_spi_spx_int(0);
> -
> -    return return_status;
> -}
> -
> -static void cvm_oct_spi_enable_error_reporting(int interface)
> -{
> -    union cvmx_spxx_int_msk spxx_int_msk;
> -    union cvmx_stxx_int_msk stxx_int_msk;
> -
> -    spxx_int_msk.u64 = cvmx_read_csr(CVMX_SPXX_INT_MSK(interface));
> -    spxx_int_msk.s.calerr = 1;
> -    spxx_int_msk.s.syncerr = 1;
> -    spxx_int_msk.s.diperr = 1;
> -    spxx_int_msk.s.tpaovr = 1;
> -    spxx_int_msk.s.rsverr = 1;
> -    spxx_int_msk.s.drwnng = 1;
> -    spxx_int_msk.s.clserr = 1;
> -    spxx_int_msk.s.spiovr = 1;
> -    spxx_int_msk.s.abnorm = 1;
> -    spxx_int_msk.s.prtnxa = 1;
> -    cvmx_write_csr(CVMX_SPXX_INT_MSK(interface), spxx_int_msk.u64);
> -
> -    stxx_int_msk.u64 = cvmx_read_csr(CVMX_STXX_INT_MSK(interface));
> -    stxx_int_msk.s.frmerr = 1;
> -    stxx_int_msk.s.unxfrm = 1;
> -    stxx_int_msk.s.nosync = 1;
> -    stxx_int_msk.s.diperr = 1;
> -    stxx_int_msk.s.datovr = 1;
> -    stxx_int_msk.s.ovrbst = 1;
> -    stxx_int_msk.s.calpar1 = 1;
> -    stxx_int_msk.s.calpar0 = 1;
> -    cvmx_write_csr(CVMX_STXX_INT_MSK(interface), stxx_int_msk.u64);
> -}
> -
> -static void cvm_oct_spi_poll(struct net_device *dev)
> -{
> -    static int spi4000_port;
> -    struct octeon_ethernet *priv = netdev_priv(dev);
> -    int interface;
> -
> -    for (interface = 0; interface < 2; interface++) {
> -        if ((priv->port == interface * 16) && need_retrain[interface]) {
> -            if (cvmx_spi_restart_interface
> -                (interface, CVMX_SPI_MODE_DUPLEX, 10) == 0) {
> -                need_retrain[interface] = 0;
> -                cvm_oct_spi_enable_error_reporting(interface);
> -            }
> -        }
> -
> -        /*
> -         * The SPI4000 TWSI interface is very slow. In order
> -         * not to bring the system to a crawl, we only poll a
> -         * single port every second. This means negotiation
> -         * speed changes take up to 10 seconds, but at least
> -         * we don't waste absurd amounts of time waiting for
> -         * TWSI.
> -         */
> -        if (priv->port == spi4000_port) {
> -            /*
> -             * This function does nothing if it is called on an
> -             * interface without a SPI4000.
> -             */
> -            cvmx_spi4000_check_speed(interface, priv->port);
> -            /*
> -             * Normal ordering increments. By decrementing
> -             * we only match once per iteration.
> -             */
> -            spi4000_port--;
> -            if (spi4000_port < 0)
> -                spi4000_port = 10;
> -        }
> -    }
> -}
> -
> -int cvm_oct_spi_init(struct net_device *dev)
> -{
> -    int r;
> -    struct octeon_ethernet *priv = netdev_priv(dev);
> -
> -    if (number_spi_ports == 0) {
> -        r = request_irq(OCTEON_IRQ_RML, cvm_oct_spi_rml_interrupt,
> -                IRQF_SHARED, "SPI", &number_spi_ports);
> -        if (r)
> -            return r;
> -    }
> -    number_spi_ports++;
> -
> -    if ((priv->port == 0) || (priv->port == 16)) {
> -        cvm_oct_spi_enable_error_reporting(INTERFACE(priv->port));
> -        priv->poll = cvm_oct_spi_poll;
> -    }
> -    cvm_oct_common_init(dev);
> -    return 0;
> -}
> -
> -void cvm_oct_spi_uninit(struct net_device *dev)
> -{
> -    int interface;
> -
> -    cvm_oct_common_uninit(dev);
> -    number_spi_ports--;
> -    if (number_spi_ports == 0) {
> -        for (interface = 0; interface < 2; interface++) {
> -            cvmx_write_csr(CVMX_SPXX_INT_MSK(interface), 0);
> -            cvmx_write_csr(CVMX_STXX_INT_MSK(interface), 0);
> -        }
> -        free_irq(OCTEON_IRQ_RML, &number_spi_ports);
> -    }
> -}
> diff --git a/drivers/staging/octeon/ethernet-tx.c b/drivers/staging/octeon/ethernet-tx.c
> deleted file mode 100644
> index b334cf89794e..000000000000
> --- a/drivers/staging/octeon/ethernet-tx.c
> +++ /dev/null
> @@ -1,717 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0
> -/*
> - * This file is based on code from OCTEON SDK by Cavium Networks.
> - *
> - * Copyright (c) 2003-2010 Cavium Networks
> - */
> -
> -#include <linux/module.h>
> -#include <linux/kernel.h>
> -#include <linux/netdevice.h>
> -#include <linux/etherdevice.h>
> -#include <linux/ip.h>
> -#include <linux/ratelimit.h>
> -#include <linux/string.h>
> -#include <linux/interrupt.h>
> -#include <net/dst.h>
> -#ifdef CONFIG_XFRM
> -#include <linux/xfrm.h>
> -#include <net/xfrm.h>
> -#endif /* CONFIG_XFRM */
> -
> -#include <linux/atomic.h>
> -#include <net/sch_generic.h>
> -
> -#include "octeon-ethernet.h"
> -#include "ethernet-defines.h"
> -#include "ethernet-tx.h"
> -#include "ethernet-util.h"
> -
> -#define CVM_OCT_SKB_CB(skb)    ((u64 *)((skb)->cb))
> -
> -/*
> - * You can define GET_SKBUFF_QOS() to override how the skbuff output
> - * function determines which output queue is used. The default
> - * implementation always uses the base queue for the port. If, for
> - * example, you wanted to use the skb->priority field, define
> - * GET_SKBUFF_QOS as: #define GET_SKBUFF_QOS(skb) ((skb)->priority)
> - */
> -#ifndef GET_SKBUFF_QOS
> -#define GET_SKBUFF_QOS(skb) 0
> -#endif
> -
> -static void cvm_oct_tx_do_cleanup(unsigned long arg);
> -static DECLARE_TASKLET(cvm_oct_tx_cleanup_tasklet, cvm_oct_tx_do_cleanup, 0);
> -
> -/* Maximum number of SKBs to try to free per xmit packet. */
> -#define MAX_SKB_TO_FREE (MAX_OUT_QUEUE_DEPTH * 2)
> -
> -static inline int cvm_oct_adjust_skb_to_free(int skb_to_free, int fau)
> -{
> -    int undo;
> -
> -    undo = skb_to_free > 0 ? MAX_SKB_TO_FREE : skb_to_free +
> -                           MAX_SKB_TO_FREE;
> -    if (undo > 0)
> -        cvmx_fau_atomic_add32(fau, -undo);
> -    skb_to_free = -skb_to_free > MAX_SKB_TO_FREE ? MAX_SKB_TO_FREE :
> -                               -skb_to_free;
> -    return skb_to_free;
> -}
> -
> -static void cvm_oct_kick_tx_poll_watchdog(void)
> -{
> -    union cvmx_ciu_timx ciu_timx;
> -
> -    ciu_timx.u64 = 0;
> -    ciu_timx.s.one_shot = 1;
> -    ciu_timx.s.len = cvm_oct_tx_poll_interval;
> -    cvmx_write_csr(CVMX_CIU_TIMX(1), ciu_timx.u64);
> -}
> -
> -static void cvm_oct_free_tx_skbs(struct net_device *dev)
> -{
> -    int skb_to_free;
> -    int qos, queues_per_port;
> -    int total_freed = 0;
> -    int total_remaining = 0;
> -    unsigned long flags;
> -    struct octeon_ethernet *priv = netdev_priv(dev);
> -
> -    queues_per_port = cvmx_pko_get_num_queues(priv->port);
> -    /* Drain any pending packets in the free list */
> -    for (qos = 0; qos < queues_per_port; qos++) {
> -        if (skb_queue_len(&priv->tx_free_list[qos]) == 0)
> -            continue;
> -        skb_to_free = cvmx_fau_fetch_and_add32(priv->fau + qos * 4,
> -                               MAX_SKB_TO_FREE);
> -        skb_to_free = cvm_oct_adjust_skb_to_free(skb_to_free,
> -                             priv->fau + qos * 4);
> -        total_freed += skb_to_free;
> -        if (skb_to_free > 0) {
> -            struct sk_buff *to_free_list = NULL;
> -
> -            spin_lock_irqsave(&priv->tx_free_list[qos].lock, flags);
> -            while (skb_to_free > 0) {
> -                struct sk_buff *t;
> -
> -                t = __skb_dequeue(&priv->tx_free_list[qos]);
> -                t->next = to_free_list;
> -                to_free_list = t;
> -                skb_to_free--;
> -            }
> -            spin_unlock_irqrestore(&priv->tx_free_list[qos].lock,
> -                           flags);
> -            /* Do the actual freeing outside of the lock. */
> -            while (to_free_list) {
> -                struct sk_buff *t = to_free_list;
> -
> -                to_free_list = to_free_list->next;
> -                dev_kfree_skb_any(t);
> -            }
> -        }
> -        total_remaining += skb_queue_len(&priv->tx_free_list[qos]);
> -    }
> -    if (total_remaining < MAX_OUT_QUEUE_DEPTH && netif_queue_stopped(dev))
> -        netif_wake_queue(dev);
> -    if (total_remaining)
> -        cvm_oct_kick_tx_poll_watchdog();
> -}
> -
> -/**
> - * cvm_oct_xmit - transmit a packet
> - * @skb:    Packet to send
> - * @dev:    Device info structure
> - *
> - * Returns Always returns NETDEV_TX_OK
> - */
> -int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev)
> -{
> -    union cvmx_pko_command_word0 pko_command;
> -    union cvmx_buf_ptr hw_buffer;
> -    u64 old_scratch;
> -    u64 old_scratch2;
> -    int qos;
> -    int i;
> -    enum {QUEUE_CORE, QUEUE_HW, QUEUE_DROP} queue_type;
> -    struct octeon_ethernet *priv = netdev_priv(dev);
> -    struct sk_buff *to_free_list;
> -    int skb_to_free;
> -    int buffers_to_free;
> -    u32 total_to_clean;
> -    unsigned long flags;
> -#if REUSE_SKBUFFS_WITHOUT_FREE
> -    unsigned char *fpa_head;
> -#endif
> -
> -    /*
> -     * Prefetch the private data structure.  It is larger than the
> -     * one cache line.
> -     */
> -    prefetch(priv);
> -
> -    /*
> -     * The check on CVMX_PKO_QUEUES_PER_PORT_* is designed to
> -     * completely remove "qos" in the event neither interface
> -     * supports multiple queues per port.
> -     */
> -    if ((CVMX_PKO_QUEUES_PER_PORT_INTERFACE0 > 1) ||
> -        (CVMX_PKO_QUEUES_PER_PORT_INTERFACE1 > 1)) {
> -        qos = GET_SKBUFF_QOS(skb);
> -        if (qos <= 0)
> -            qos = 0;
> -        else if (qos >= cvmx_pko_get_num_queues(priv->port))
> -            qos = 0;
> -    } else {
> -        qos = 0;
> -    }
> -
> -    if (USE_ASYNC_IOBDMA) {
> -        /* Save scratch in case userspace is using it */
> -        CVMX_SYNCIOBDMA;
> -        old_scratch = cvmx_scratch_read64(CVMX_SCR_SCRATCH);
> -        old_scratch2 = cvmx_scratch_read64(CVMX_SCR_SCRATCH + 8);
> -
> -        /*
> -         * Fetch and increment the number of packets to be
> -         * freed.
> -         */
> -        cvmx_fau_async_fetch_and_add32(CVMX_SCR_SCRATCH + 8,
> -                           FAU_NUM_PACKET_BUFFERS_TO_FREE,
> -                           0);
> -        cvmx_fau_async_fetch_and_add32(CVMX_SCR_SCRATCH,
> -                           priv->fau + qos * 4,
> -                           MAX_SKB_TO_FREE);
> -    }
> -
> -    /*
> -     * We have space for 6 segment pointers, If there will be more
> -     * than that, we must linearize.
> -     */
> -    if (unlikely(skb_shinfo(skb)->nr_frags > 5)) {
> -        if (unlikely(__skb_linearize(skb))) {
> -            queue_type = QUEUE_DROP;
> -            if (USE_ASYNC_IOBDMA) {
> -                /*
> -                 * Get the number of skbuffs in use
> -                 * by the hardware
> -                 */
> -                CVMX_SYNCIOBDMA;
> -                skb_to_free =
> -                    cvmx_scratch_read64(CVMX_SCR_SCRATCH);
> -            } else {
> -                /*
> -                 * Get the number of skbuffs in use
> -                 * by the hardware
> -                 */
> -                skb_to_free =
> -                     cvmx_fau_fetch_and_add32(priv->fau +
> -                                  qos * 4,
> -                                  MAX_SKB_TO_FREE);
> -            }
> -            skb_to_free = cvm_oct_adjust_skb_to_free(skb_to_free,
> -                                 priv->fau +
> -                                 qos * 4);
> -            spin_lock_irqsave(&priv->tx_free_list[qos].lock, flags);
> -            goto skip_xmit;
> -        }
> -    }
> -
> -    /*
> -     * The CN3XXX series of parts has an errata (GMX-401) which
> -     * causes the GMX block to hang if a collision occurs towards
> -     * the end of a <68 byte packet. As a workaround for this, we
> -     * pad packets to be 68 bytes whenever we are in half duplex
> -     * mode. We don't handle the case of having a small packet but
> -     * no room to add the padding.  The kernel should always give
> -     * us at least a cache line
> -     */
> -    if ((skb->len < 64) && OCTEON_IS_MODEL(OCTEON_CN3XXX)) {
> -        union cvmx_gmxx_prtx_cfg gmx_prt_cfg;
> -        int interface = INTERFACE(priv->port);
> -        int index = INDEX(priv->port);
> -
> -        if (interface < 2) {
> -            /* We only need to pad packet in half duplex mode */
> -            gmx_prt_cfg.u64 =
> -                cvmx_read_csr(CVMX_GMXX_PRTX_CFG(index, interface));
> -            if (gmx_prt_cfg.s.duplex == 0) {
> -                int add_bytes = 64 - skb->len;
> -
> -                if ((skb_tail_pointer(skb) + add_bytes) <=
> -                    skb_end_pointer(skb))
> -                    __skb_put_zero(skb, add_bytes);
> -            }
> -        }
> -    }
> -
> -    /* Build the PKO command */
> -    pko_command.u64 = 0;
> -#ifdef __LITTLE_ENDIAN
> -    pko_command.s.le = 1;
> -#endif
> -    pko_command.s.n2 = 1;    /* Don't pollute L2 with the outgoing packet */
> -    pko_command.s.segs = 1;
> -    pko_command.s.total_bytes = skb->len;
> -    pko_command.s.size0 = CVMX_FAU_OP_SIZE_32;
> -    pko_command.s.subone0 = 1;
> -
> -    pko_command.s.dontfree = 1;
> -
> -    /* Build the PKO buffer pointer */
> -    hw_buffer.u64 = 0;
> -    if (skb_shinfo(skb)->nr_frags == 0) {
> -        hw_buffer.s.addr = XKPHYS_TO_PHYS((uintptr_t)skb->data);
> -        hw_buffer.s.pool = 0;
> -        hw_buffer.s.size = skb->len;
> -    } else {
> -        hw_buffer.s.addr = XKPHYS_TO_PHYS((uintptr_t)skb->data);
> -        hw_buffer.s.pool = 0;
> -        hw_buffer.s.size = skb_headlen(skb);
> -        CVM_OCT_SKB_CB(skb)[0] = hw_buffer.u64;
> -        for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
> -            skb_frag_t *fs = skb_shinfo(skb)->frags + i;
> -
> -            hw_buffer.s.addr =
> -                XKPHYS_TO_PHYS((uintptr_t)skb_frag_address(fs));
> -            hw_buffer.s.size = skb_frag_size(fs);
> -            CVM_OCT_SKB_CB(skb)[i + 1] = hw_buffer.u64;
> -        }
> -        hw_buffer.s.addr =
> -            XKPHYS_TO_PHYS((uintptr_t)CVM_OCT_SKB_CB(skb));
> -        hw_buffer.s.size = skb_shinfo(skb)->nr_frags + 1;
> -        pko_command.s.segs = skb_shinfo(skb)->nr_frags + 1;
> -        pko_command.s.gather = 1;
> -        goto dont_put_skbuff_in_hw;
> -    }
> -
> -    /*
> -     * See if we can put this skb in the FPA pool. Any strange
> -     * behavior from the Linux networking stack will most likely
> -     * be caused by a bug in the following code. If some field is
> -     * in use by the network stack and gets carried over when a
> -     * buffer is reused, bad things may happen.  If in doubt and
> -     * you dont need the absolute best performance, disable the
> -     * define REUSE_SKBUFFS_WITHOUT_FREE. The reuse of buffers has
> -     * shown a 25% increase in performance under some loads.
> -     */
> -#if REUSE_SKBUFFS_WITHOUT_FREE
> -    fpa_head = skb->head + 256 - ((unsigned long)skb->head & 0x7f);
> -    if (unlikely(skb->data < fpa_head)) {
> -        /* TX buffer beginning can't meet FPA alignment constraints */
> -        goto dont_put_skbuff_in_hw;
> -    }
> -    if (unlikely
> -        ((skb_end_pointer(skb) - fpa_head) < CVMX_FPA_PACKET_POOL_SIZE)) {
> -        /* TX buffer isn't large enough for the FPA */
> -        goto dont_put_skbuff_in_hw;
> -    }
> -    if (unlikely(skb_shared(skb))) {
> -        /* TX buffer sharing data with someone else */
> -        goto dont_put_skbuff_in_hw;
> -    }
> -    if (unlikely(skb_cloned(skb))) {
> -        /* TX buffer has been cloned */
> -        goto dont_put_skbuff_in_hw;
> -    }
> -    if (unlikely(skb_header_cloned(skb))) {
> -        /* TX buffer header has been cloned */
> -        goto dont_put_skbuff_in_hw;
> -    }
> -    if (unlikely(skb->destructor)) {
> -        /* TX buffer has a destructor */
> -        goto dont_put_skbuff_in_hw;
> -    }
> -    if (unlikely(skb_shinfo(skb)->nr_frags)) {
> -        /* TX buffer has fragments */
> -        goto dont_put_skbuff_in_hw;
> -    }
> -    if (unlikely
> -        (skb->truesize !=
> -         sizeof(*skb) + skb_end_offset(skb))) {
> -        /* TX buffer truesize has been changed */
> -        goto dont_put_skbuff_in_hw;
> -    }
> -
> -    /*
> -     * We can use this buffer in the FPA.  We don't need the FAU
> -     * update anymore
> -     */
> -    pko_command.s.dontfree = 0;
> -
> -    hw_buffer.s.back = ((unsigned long)skb->data >> 7) -
> -               ((unsigned long)fpa_head >> 7);
> -
> -    *(struct sk_buff **)(fpa_head - sizeof(void *)) = skb;
> -
> -    /*
> -     * The skbuff will be reused without ever being freed. We must
> -     * cleanup a bunch of core things.
> -     */
> -    dst_release(skb_dst(skb));
> -    skb_dst_set(skb, NULL);
> -    skb_ext_reset(skb);
> -    nf_reset_ct(skb);
> -
> -#ifdef CONFIG_NET_SCHED
> -    skb->tc_index = 0;
> -    skb_reset_tc(skb);
> -#endif /* CONFIG_NET_SCHED */
> -#endif /* REUSE_SKBUFFS_WITHOUT_FREE */
> -
> -dont_put_skbuff_in_hw:
> -
> -    /* Check if we can use the hardware checksumming */
> -    if ((skb->protocol == htons(ETH_P_IP)) &&
> -        (ip_hdr(skb)->version == 4) &&
> -        (ip_hdr(skb)->ihl == 5) &&
> -        ((ip_hdr(skb)->frag_off == 0) ||
> -         (ip_hdr(skb)->frag_off == htons(1 << 14))) &&
> -        ((ip_hdr(skb)->protocol == IPPROTO_TCP) ||
> -         (ip_hdr(skb)->protocol == IPPROTO_UDP))) {
> -        /* Use hardware checksum calc */
> -        pko_command.s.ipoffp1 = skb_network_offset(skb) + 1;
> -    }
> -
> -    if (USE_ASYNC_IOBDMA) {
> -        /* Get the number of skbuffs in use by the hardware */
> -        CVMX_SYNCIOBDMA;
> -        skb_to_free = cvmx_scratch_read64(CVMX_SCR_SCRATCH);
> -        buffers_to_free = cvmx_scratch_read64(CVMX_SCR_SCRATCH + 8);
> -    } else {
> -        /* Get the number of skbuffs in use by the hardware */
> -        skb_to_free = cvmx_fau_fetch_and_add32(priv->fau + qos * 4,
> -                               MAX_SKB_TO_FREE);
> -        buffers_to_free =
> -            cvmx_fau_fetch_and_add32(FAU_NUM_PACKET_BUFFERS_TO_FREE, 0);
> -    }
> -
> -    skb_to_free = cvm_oct_adjust_skb_to_free(skb_to_free,
> -                         priv->fau + qos * 4);
> -
> -    /*
> -     * If we're sending faster than the receive can free them then
> -     * don't do the HW free.
> -     */
> -    if ((buffers_to_free < -100) && !pko_command.s.dontfree)
> -        pko_command.s.dontfree = 1;
> -
> -    if (pko_command.s.dontfree) {
> -        queue_type = QUEUE_CORE;
> -        pko_command.s.reg0 = priv->fau + qos * 4;
> -    } else {
> -        queue_type = QUEUE_HW;
> -    }
> -    if (USE_ASYNC_IOBDMA)
> -        cvmx_fau_async_fetch_and_add32(CVMX_SCR_SCRATCH,
> -                           FAU_TOTAL_TX_TO_CLEAN, 1);
> -
> -    spin_lock_irqsave(&priv->tx_free_list[qos].lock, flags);
> -
> -    /* Drop this packet if we have too many already queued to the HW */
> -    if (unlikely(skb_queue_len(&priv->tx_free_list[qos]) >=
> -             MAX_OUT_QUEUE_DEPTH)) {
> -        if (dev->tx_queue_len != 0) {
> -            /* Drop the lock when notifying the core.  */
> -            spin_unlock_irqrestore(&priv->tx_free_list[qos].lock,
> -                           flags);
> -            netif_stop_queue(dev);
> -            spin_lock_irqsave(&priv->tx_free_list[qos].lock,
> -                      flags);
> -        } else {
> -            /* If not using normal queueing.  */
> -            queue_type = QUEUE_DROP;
> -            goto skip_xmit;
> -        }
> -    }
> -
> -    cvmx_pko_send_packet_prepare(priv->port, priv->queue + qos,
> -                     CVMX_PKO_LOCK_NONE);
> -
> -    /* Send the packet to the output queue */
> -    if (unlikely(cvmx_pko_send_packet_finish(priv->port,
> -                         priv->queue + qos,
> -                         pko_command, hw_buffer,
> -                         CVMX_PKO_LOCK_NONE))) {
> -        printk_ratelimited("%s: Failed to send the packet\n",
> -                   dev->name);
> -        queue_type = QUEUE_DROP;
> -    }
> -skip_xmit:
> -    to_free_list = NULL;
> -
> -    switch (queue_type) {
> -    case QUEUE_DROP:
> -        skb->next = to_free_list;
> -        to_free_list = skb;
> -        dev->stats.tx_dropped++;
> -        break;
> -    case QUEUE_HW:
> -        cvmx_fau_atomic_add32(FAU_NUM_PACKET_BUFFERS_TO_FREE, -1);
> -        break;
> -    case QUEUE_CORE:
> -        __skb_queue_tail(&priv->tx_free_list[qos], skb);
> -        break;
> -    default:
> -        BUG();
> -    }
> -
> -    while (skb_to_free > 0) {
> -        struct sk_buff *t = __skb_dequeue(&priv->tx_free_list[qos]);
> -
> -        t->next = to_free_list;
> -        to_free_list = t;
> -        skb_to_free--;
> -    }
> -
> -    spin_unlock_irqrestore(&priv->tx_free_list[qos].lock, flags);
> -
> -    /* Do the actual freeing outside of the lock. */
> -    while (to_free_list) {
> -        struct sk_buff *t = to_free_list;
> -
> -        to_free_list = to_free_list->next;
> -        dev_kfree_skb_any(t);
> -    }
> -
> -    if (USE_ASYNC_IOBDMA) {
> -        CVMX_SYNCIOBDMA;
> -        total_to_clean = cvmx_scratch_read64(CVMX_SCR_SCRATCH);
> -        /* Restore the scratch area */
> -        cvmx_scratch_write64(CVMX_SCR_SCRATCH, old_scratch);
> -        cvmx_scratch_write64(CVMX_SCR_SCRATCH + 8, old_scratch2);
> -    } else {
> -        total_to_clean =
> -            cvmx_fau_fetch_and_add32(FAU_TOTAL_TX_TO_CLEAN, 1);
> -    }
> -
> -    if (total_to_clean & 0x3ff) {
> -        /*
> -         * Schedule the cleanup tasklet every 1024 packets for
> -         * the pathological case of high traffic on one port
> -         * delaying clean up of packets on a different port
> -         * that is blocked waiting for the cleanup.
> -         */
> -        tasklet_schedule(&cvm_oct_tx_cleanup_tasklet);
> -    }
> -
> -    cvm_oct_kick_tx_poll_watchdog();
> -
> -    return NETDEV_TX_OK;
> -}
> -
> -/**
> - * cvm_oct_xmit_pow - transmit a packet to the POW
> - * @skb:    Packet to send
> - * @dev:    Device info structure
> -
> - * Returns Always returns zero
> - */
> -int cvm_oct_xmit_pow(struct sk_buff *skb, struct net_device *dev)
> -{
> -    struct octeon_ethernet *priv = netdev_priv(dev);
> -    void *packet_buffer;
> -    void *copy_location;
> -
> -    /* Get a work queue entry */
> -    struct cvmx_wqe *work = cvmx_fpa_alloc(CVMX_FPA_WQE_POOL);
> -
> -    if (unlikely(!work)) {
> -        printk_ratelimited("%s: Failed to allocate a work queue entry\n",
> -                   dev->name);
> -        dev->stats.tx_dropped++;
> -        dev_kfree_skb_any(skb);
> -        return 0;
> -    }
> -
> -    /* Get a packet buffer */
> -    packet_buffer = cvmx_fpa_alloc(CVMX_FPA_PACKET_POOL);
> -    if (unlikely(!packet_buffer)) {
> -        printk_ratelimited("%s: Failed to allocate a packet buffer\n",
> -                   dev->name);
> -        cvmx_fpa_free(work, CVMX_FPA_WQE_POOL, 1);
> -        dev->stats.tx_dropped++;
> -        dev_kfree_skb_any(skb);
> -        return 0;
> -    }
> -
> -    /*
> -     * Calculate where we need to copy the data to. We need to
> -     * leave 8 bytes for a next pointer (unused). We also need to
> -     * include any configure skip. Then we need to align the IP
> -     * packet src and dest into the same 64bit word. The below
> -     * calculation may add a little extra, but that doesn't
> -     * hurt.
> -     */
> -    copy_location = packet_buffer + sizeof(u64);
> -    copy_location += ((CVMX_HELPER_FIRST_MBUFF_SKIP + 7) & 0xfff8) + 6;
> -
> -    /*
> -     * We have to copy the packet since whoever processes this
> -     * packet will free it to a hardware pool. We can't use the
> -     * trick of counting outstanding packets like in
> -     * cvm_oct_xmit.
> -     */
> -    memcpy(copy_location, skb->data, skb->len);
> -
> -    /*
> -     * Fill in some of the work queue fields. We may need to add
> -     * more if the software at the other end needs them.
> -     */
> -    if (!OCTEON_IS_MODEL(OCTEON_CN68XX))
> -        work->word0.pip.cn38xx.hw_chksum = skb->csum;
> -    work->word1.len = skb->len;
> -    cvmx_wqe_set_port(work, priv->port);
> -    cvmx_wqe_set_qos(work, priv->port & 0x7);
> -    cvmx_wqe_set_grp(work, pow_send_group);
> -    work->word1.tag_type = CVMX_HELPER_INPUT_TAG_TYPE;
> -    work->word1.tag = pow_send_group;    /* FIXME */
> -    /* Default to zero. Sets of zero later are commented out */
> -    work->word2.u64 = 0;
> -    work->word2.s.bufs = 1;
> -    work->packet_ptr.u64 = 0;
> -    work->packet_ptr.s.addr = cvmx_ptr_to_phys(copy_location);
> -    work->packet_ptr.s.pool = CVMX_FPA_PACKET_POOL;
> -    work->packet_ptr.s.size = CVMX_FPA_PACKET_POOL_SIZE;
> -    work->packet_ptr.s.back = (copy_location - packet_buffer) >> 7;
> -
> -    if (skb->protocol == htons(ETH_P_IP)) {
> -        work->word2.s.ip_offset = 14;
> -#if 0
> -        work->word2.s.vlan_valid = 0;    /* FIXME */
> -        work->word2.s.vlan_cfi = 0;    /* FIXME */
> -        work->word2.s.vlan_id = 0;    /* FIXME */
> -        work->word2.s.dec_ipcomp = 0;    /* FIXME */
> -#endif
> -        work->word2.s.tcp_or_udp =
> -            (ip_hdr(skb)->protocol == IPPROTO_TCP) ||
> -            (ip_hdr(skb)->protocol == IPPROTO_UDP);
> -#if 0
> -        /* FIXME */
> -        work->word2.s.dec_ipsec = 0;
> -        /* We only support IPv4 right now */
> -        work->word2.s.is_v6 = 0;
> -        /* Hardware would set to zero */
> -        work->word2.s.software = 0;
> -        /* No error, packet is internal */
> -        work->word2.s.L4_error = 0;
> -#endif
> -        work->word2.s.is_frag = !((ip_hdr(skb)->frag_off == 0) ||
> -                      (ip_hdr(skb)->frag_off ==
> -                          cpu_to_be16(1 << 14)));
> -#if 0
> -        /* Assume Linux is sending a good packet */
> -        work->word2.s.IP_exc = 0;
> -#endif
> -        work->word2.s.is_bcast = (skb->pkt_type == PACKET_BROADCAST);
> -        work->word2.s.is_mcast = (skb->pkt_type == PACKET_MULTICAST);
> -#if 0
> -        /* This is an IP packet */
> -        work->word2.s.not_IP = 0;
> -        /* No error, packet is internal */
> -        work->word2.s.rcv_error = 0;
> -        /* No error, packet is internal */
> -        work->word2.s.err_code = 0;
> -#endif
> -
> -        /*
> -         * When copying the data, include 4 bytes of the
> -         * ethernet header to align the same way hardware
> -         * does.
> -         */
> -        memcpy(work->packet_data, skb->data + 10,
> -               sizeof(work->packet_data));
> -    } else {
> -#if 0
> -        work->word2.snoip.vlan_valid = 0;    /* FIXME */
> -        work->word2.snoip.vlan_cfi = 0;    /* FIXME */
> -        work->word2.snoip.vlan_id = 0;    /* FIXME */
> -        work->word2.snoip.software = 0;    /* Hardware would set to zero */
> -#endif
> -        work->word2.snoip.is_rarp = skb->protocol == htons(ETH_P_RARP);
> -        work->word2.snoip.is_arp = skb->protocol == htons(ETH_P_ARP);
> -        work->word2.snoip.is_bcast =
> -            (skb->pkt_type == PACKET_BROADCAST);
> -        work->word2.snoip.is_mcast =
> -            (skb->pkt_type == PACKET_MULTICAST);
> -        work->word2.snoip.not_IP = 1;    /* IP was done up above */
> -#if 0
> -        /* No error, packet is internal */
> -        work->word2.snoip.rcv_error = 0;
> -        /* No error, packet is internal */
> -        work->word2.snoip.err_code = 0;
> -#endif
> -        memcpy(work->packet_data, skb->data, sizeof(work->packet_data));
> -    }
> -
> -    /* Submit the packet to the POW */
> -    cvmx_pow_work_submit(work, work->word1.tag, work->word1.tag_type,
> -                 cvmx_wqe_get_qos(work), cvmx_wqe_get_grp(work));
> -    dev->stats.tx_packets++;
> -    dev->stats.tx_bytes += skb->len;
> -    dev_consume_skb_any(skb);
> -    return 0;
> -}
> -
> -/**
> - * cvm_oct_tx_shutdown_dev - free all skb that are currently queued for TX.
> - * @dev:    Device being shutdown
> - *
> - */
> -void cvm_oct_tx_shutdown_dev(struct net_device *dev)
> -{
> -    struct octeon_ethernet *priv = netdev_priv(dev);
> -    unsigned long flags;
> -    int qos;
> -
> -    for (qos = 0; qos < 16; qos++) {
> -        spin_lock_irqsave(&priv->tx_free_list[qos].lock, flags);
> -        while (skb_queue_len(&priv->tx_free_list[qos]))
> -            dev_kfree_skb_any(__skb_dequeue
> -                      (&priv->tx_free_list[qos]));
> -        spin_unlock_irqrestore(&priv->tx_free_list[qos].lock, flags);
> -    }
> -}
> -
> -static void cvm_oct_tx_do_cleanup(unsigned long arg)
> -{
> -    int port;
> -
> -    for (port = 0; port < TOTAL_NUMBER_OF_PORTS; port++) {
> -        if (cvm_oct_device[port]) {
> -            struct net_device *dev = cvm_oct_device[port];
> -
> -            cvm_oct_free_tx_skbs(dev);
> -        }
> -    }
> -}
> -
> -static irqreturn_t cvm_oct_tx_cleanup_watchdog(int cpl, void *dev_id)
> -{
> -    /* Disable the interrupt.  */
> -    cvmx_write_csr(CVMX_CIU_TIMX(1), 0);
> -    /* Do the work in the tasklet.  */
> -    tasklet_schedule(&cvm_oct_tx_cleanup_tasklet);
> -    return IRQ_HANDLED;
> -}
> -
> -void cvm_oct_tx_initialize(void)
> -{
> -    int i;
> -
> -    /* Disable the interrupt.  */
> -    cvmx_write_csr(CVMX_CIU_TIMX(1), 0);
> -    /* Register an IRQ handler to receive CIU_TIMX(1) interrupts */
> -    i = request_irq(OCTEON_IRQ_TIMER1,
> -            cvm_oct_tx_cleanup_watchdog, 0,
> -            "Ethernet", cvm_oct_device);
> -
> -    if (i)
> -        panic("Could not acquire Ethernet IRQ %d\n", OCTEON_IRQ_TIMER1);
> -}
> -
> -void cvm_oct_tx_shutdown(void)
> -{
> -    /* Free the interrupt handler */
> -    free_irq(OCTEON_IRQ_TIMER1, cvm_oct_device);
> -}
> diff --git a/drivers/staging/octeon/ethernet-tx.h b/drivers/staging/octeon/ethernet-tx.h
> deleted file mode 100644
> index 78936e9b33b0..000000000000
> --- a/drivers/staging/octeon/ethernet-tx.h
> +++ /dev/null
> @@ -1,14 +0,0 @@
> -/* SPDX-License-Identifier: GPL-2.0 */
> -/*
> - * This file is based on code from OCTEON SDK by Cavium Networks.
> - *
> - * Copyright (c) 2003-2007 Cavium Networks
> - */
> -
> -int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev);
> -int cvm_oct_xmit_pow(struct sk_buff *skb, struct net_device *dev);
> -int cvm_oct_transmit_qos(struct net_device *dev, void *work_queue_entry,
> -             int do_free, int qos);
> -void cvm_oct_tx_initialize(void);
> -void cvm_oct_tx_shutdown(void);
> -void cvm_oct_tx_shutdown_dev(struct net_device *dev);
> diff --git a/drivers/staging/octeon/ethernet-util.h b/drivers/staging/octeon/ethernet-util.h
> deleted file mode 100644
> index 2af83a12ca78..000000000000
> --- a/drivers/staging/octeon/ethernet-util.h
> +++ /dev/null
> @@ -1,47 +0,0 @@
> -/* SPDX-License-Identifier: GPL-2.0 */
> -/*
> - * This file is based on code from OCTEON SDK by Cavium Networks.
> - *
> - * Copyright (c) 2003-2007 Cavium Networks
> - */
> -
> -/**
> - * cvm_oct_get_buffer_ptr - convert packet data address to pointer
> - * @packet_ptr: Packet data hardware address
> - *
> - * Returns Packet buffer pointer
> - */
> -static inline void *cvm_oct_get_buffer_ptr(union cvmx_buf_ptr packet_ptr)
> -{
> -    return cvmx_phys_to_ptr(((packet_ptr.s.addr >> 7) - packet_ptr.s.back)
> -                << 7);
> -}
> -
> -/**
> - * INTERFACE - convert IPD port to logical interface
> - * @ipd_port: Port to check
> - *
> - * Returns Logical interface
> - */
> -static inline int INTERFACE(int ipd_port)
> -{
> -    int interface;
> -
> -    if (ipd_port == CVMX_PIP_NUM_INPUT_PORTS)
> -        return 10;
> -    interface = cvmx_helper_get_interface_num(ipd_port);
> -    if (interface >= 0)
> -        return interface;
> -    panic("Illegal ipd_port %d passed to %s\n", ipd_port, __func__);
> -}
> -
> -/**
> - * INDEX - convert IPD/PKO port number to the port's interface index
> - * @ipd_port: Port to check
> - *
> - * Returns Index into interface port list
> - */
> -static inline int INDEX(int ipd_port)
> -{
> -    return cvmx_helper_get_interface_index_num(ipd_port);
> -}
> diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c
> deleted file mode 100644
> index f42c3816ce49..000000000000
> --- a/drivers/staging/octeon/ethernet.c
> +++ /dev/null
> @@ -1,992 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0
> -/*
> - * This file is based on code from OCTEON SDK by Cavium Networks.
> - *
> - * Copyright (c) 2003-2007 Cavium Networks
> - */
> -
> -#include <linux/platform_device.h>
> -#include <linux/kernel.h>
> -#include <linux/module.h>
> -#include <linux/netdevice.h>
> -#include <linux/etherdevice.h>
> -#include <linux/phy.h>
> -#include <linux/slab.h>
> -#include <linux/interrupt.h>
> -#include <linux/of_net.h>
> -#include <linux/if_ether.h>
> -#include <linux/if_vlan.h>
> -
> -#include <net/dst.h>
> -
> -#include "octeon-ethernet.h"
> -#include "ethernet-defines.h"
> -#include "ethernet-mem.h"
> -#include "ethernet-rx.h"
> -#include "ethernet-tx.h"
> -#include "ethernet-mdio.h"
> -#include "ethernet-util.h"
> -
> -#define OCTEON_MAX_MTU 65392
> -
> -static int num_packet_buffers = 1024;
> -module_param(num_packet_buffers, int, 0444);
> -MODULE_PARM_DESC(num_packet_buffers, "\n"
> -    "\tNumber of packet buffers to allocate and store in the\n"
> -    "\tFPA. By default, 1024 packet buffers are used.\n");
> -
> -static int pow_receive_group = 15;
> -module_param(pow_receive_group, int, 0444);
> -MODULE_PARM_DESC(pow_receive_group, "\n"
> -    "\tPOW group to receive packets from. All ethernet hardware\n"
> -    "\twill be configured to send incoming packets to this POW\n"
> -    "\tgroup. Also any other software can submit packets to this\n"
> -    "\tgroup for the kernel to process.");
> -
> -static int receive_group_order;
> -module_param(receive_group_order, int, 0444);
> -MODULE_PARM_DESC(receive_group_order, "\n"
> -    "\tOrder (0..4) of receive groups to take into use. Ethernet hardware\n"
> -    "\twill be configured to send incoming packets to multiple POW\n"
> -    "\tgroups. pow_receive_group parameter is ignored when multiple\n"
> -    "\tgroups are taken into use and groups are allocated starting\n"
> -    "\tfrom 0. By default, a single group is used.\n");
> -
> -int pow_send_group = -1;
> -module_param(pow_send_group, int, 0644);
> -MODULE_PARM_DESC(pow_send_group, "\n"
> -    "\tPOW group to send packets to other software on. This\n"
> -    "\tcontrols the creation of the virtual device pow0.\n"
> -    "\talways_use_pow also depends on this value.");
> -
> -int always_use_pow;
> -module_param(always_use_pow, int, 0444);
> -MODULE_PARM_DESC(always_use_pow, "\n"
> -    "\tWhen set, always send to the pow group. This will cause\n"
> -    "\tpackets sent to real ethernet devices to be sent to the\n"
> -    "\tPOW group instead of the hardware. Unless some other\n"
> -    "\tapplication changes the config, packets will still be\n"
> -    "\treceived from the low level hardware. Use this option\n"
> -    "\tto allow a CVMX app to intercept all packets from the\n"
> -    "\tlinux kernel. You must specify pow_send_group along with\n"
> -    "\tthis option.");
> -
> -char pow_send_list[128] = "";
> -module_param_string(pow_send_list, pow_send_list, sizeof(pow_send_list), 0444);
> -MODULE_PARM_DESC(pow_send_list, "\n"
> -    "\tComma separated list of ethernet devices that should use the\n"
> -    "\tPOW for transmit instead of the actual ethernet hardware. This\n"
> -    "\tis a per port version of always_use_pow. always_use_pow takes\n"
> -    "\tprecedence over this list. For example, setting this to\n"
> -    "\t\"eth2,spi3,spi7\" would cause these three devices to transmit\n"
> -    "\tusing the pow_send_group.");
> -
> -int rx_napi_weight = 32;
> -module_param(rx_napi_weight, int, 0444);
> -MODULE_PARM_DESC(rx_napi_weight, "The NAPI WEIGHT parameter.");
> -
> -/* Mask indicating which receive groups are in use. */
> -int pow_receive_groups;
> -
> -/*
> - * cvm_oct_poll_queue_stopping - flag to indicate polling should stop.
> - *
> - * Set to one right before cvm_oct_poll_queue is destroyed.
> - */
> -atomic_t cvm_oct_poll_queue_stopping = ATOMIC_INIT(0);
> -
> -/*
> - * Array of every ethernet device owned by this driver indexed by
> - * the ipd input port number.
> - */
> -struct net_device *cvm_oct_device[TOTAL_NUMBER_OF_PORTS];
> -
> -u64 cvm_oct_tx_poll_interval;
> -
> -static void cvm_oct_rx_refill_worker(struct work_struct *work);
> -static DECLARE_DELAYED_WORK(cvm_oct_rx_refill_work, cvm_oct_rx_refill_worker);
> -
> -static void cvm_oct_rx_refill_worker(struct work_struct *work)
> -{
> -    /*
> -     * FPA 0 may have been drained, try to refill it if we need
> -     * more than num_packet_buffers / 2, otherwise normal receive
> -     * processing will refill it.  If it were drained, no packets
> -     * could be received so cvm_oct_napi_poll would never be
> -     * invoked to do the refill.
> -     */
> -    cvm_oct_rx_refill_pool(num_packet_buffers / 2);
> -
> -    if (!atomic_read(&cvm_oct_poll_queue_stopping))
> -        schedule_delayed_work(&cvm_oct_rx_refill_work, HZ);
> -}
> -
> -static void cvm_oct_periodic_worker(struct work_struct *work)
> -{
> -    struct octeon_ethernet *priv = container_of(work,
> -                            struct octeon_ethernet,
> -                            port_periodic_work.work);
> -
> -    if (priv->poll)
> -        priv->poll(cvm_oct_device[priv->port]);
> -
> -    cvm_oct_device[priv->port]->netdev_ops->ndo_get_stats
> -                        (cvm_oct_device[priv->port]);
> -
> -    if (!atomic_read(&cvm_oct_poll_queue_stopping))
> -        schedule_delayed_work(&priv->port_periodic_work, HZ);
> -}
> -
> -static void cvm_oct_configure_common_hw(void)
> -{
> -    /* Setup the FPA */
> -    cvmx_fpa_enable();
> -    cvm_oct_mem_fill_fpa(CVMX_FPA_PACKET_POOL, CVMX_FPA_PACKET_POOL_SIZE,
> -                 num_packet_buffers);
> -    cvm_oct_mem_fill_fpa(CVMX_FPA_WQE_POOL, CVMX_FPA_WQE_POOL_SIZE,
> -                 num_packet_buffers);
> -    if (CVMX_FPA_OUTPUT_BUFFER_POOL != CVMX_FPA_PACKET_POOL)
> -        cvm_oct_mem_fill_fpa(CVMX_FPA_OUTPUT_BUFFER_POOL,
> -                     CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE, 1024);
> -
> -#ifdef __LITTLE_ENDIAN
> -    {
> -        union cvmx_ipd_ctl_status ipd_ctl_status;
> -
> -        ipd_ctl_status.u64 = cvmx_read_csr(CVMX_IPD_CTL_STATUS);
> -        ipd_ctl_status.s.pkt_lend = 1;
> -        ipd_ctl_status.s.wqe_lend = 1;
> -        cvmx_write_csr(CVMX_IPD_CTL_STATUS, ipd_ctl_status.u64);
> -    }
> -#endif
> -
> -    cvmx_helper_setup_red(num_packet_buffers / 4, num_packet_buffers / 8);
> -}
> -
> -/**
> - * cvm_oct_free_work- Free a work queue entry
> - *
> - * @work_queue_entry: Work queue entry to free
> - *
> - * Returns Zero on success, Negative on failure.
> - */
> -int cvm_oct_free_work(void *work_queue_entry)
> -{
> -    struct cvmx_wqe *work = work_queue_entry;
> -
> -    int segments = work->word2.s.bufs;
> -    union cvmx_buf_ptr segment_ptr = work->packet_ptr;
> -
> -    while (segments--) {
> -        union cvmx_buf_ptr next_ptr = *(union cvmx_buf_ptr *)
> -            cvmx_phys_to_ptr(segment_ptr.s.addr - 8);
> -        if (unlikely(!segment_ptr.s.i))
> -            cvmx_fpa_free(cvm_oct_get_buffer_ptr(segment_ptr),
> -                      segment_ptr.s.pool,
> -                      CVMX_FPA_PACKET_POOL_SIZE / 128);
> -        segment_ptr = next_ptr;
> -    }
> -    cvmx_fpa_free(work, CVMX_FPA_WQE_POOL, 1);
> -
> -    return 0;
> -}
> -EXPORT_SYMBOL(cvm_oct_free_work);
> -
> -/**
> - * cvm_oct_common_get_stats - get the low level ethernet statistics
> - * @dev:    Device to get the statistics from
> - *
> - * Returns Pointer to the statistics
> - */
> -static struct net_device_stats *cvm_oct_common_get_stats(struct net_device *dev)
> -{
> -    cvmx_pip_port_status_t rx_status;
> -    cvmx_pko_port_status_t tx_status;
> -    struct octeon_ethernet *priv = netdev_priv(dev);
> -
> -    if (priv->port < CVMX_PIP_NUM_INPUT_PORTS) {
> -        if (octeon_is_simulation()) {
> -            /* The simulator doesn't support statistics */
> -            memset(&rx_status, 0, sizeof(rx_status));
> -            memset(&tx_status, 0, sizeof(tx_status));
> -        } else {
> -            cvmx_pip_get_port_status(priv->port, 1, &rx_status);
> -            cvmx_pko_get_port_status(priv->port, 1, &tx_status);
> -        }
> -
> -        dev->stats.rx_packets += rx_status.inb_packets;
> -        dev->stats.tx_packets += tx_status.packets;
> -        dev->stats.rx_bytes += rx_status.inb_octets;
> -        dev->stats.tx_bytes += tx_status.octets;
> -        dev->stats.multicast += rx_status.multicast_packets;
> -        dev->stats.rx_crc_errors += rx_status.inb_errors;
> -        dev->stats.rx_frame_errors += rx_status.fcs_align_err_packets;
> -        dev->stats.rx_dropped += rx_status.dropped_packets;
> -    }
> -
> -    return &dev->stats;
> -}
> -
> -/**
> - * cvm_oct_common_change_mtu - change the link MTU
> - * @dev:     Device to change
> - * @new_mtu: The new MTU
> - *
> - * Returns Zero on success
> - */
> -static int cvm_oct_common_change_mtu(struct net_device *dev, int new_mtu)
> -{
> -    struct octeon_ethernet *priv = netdev_priv(dev);
> -    int interface = INTERFACE(priv->port);
> -#if IS_ENABLED(CONFIG_VLAN_8021Q)
> -    int vlan_bytes = VLAN_HLEN;
> -#else
> -    int vlan_bytes = 0;
> -#endif
> -    int mtu_overhead = ETH_HLEN + ETH_FCS_LEN + vlan_bytes;
> -
> -    dev->mtu = new_mtu;
> -
> -    if ((interface < 2) &&
> -        (cvmx_helper_interface_get_mode(interface) !=
> -        CVMX_HELPER_INTERFACE_MODE_SPI)) {
> -        int index = INDEX(priv->port);
> -        /* Add ethernet header and FCS, and VLAN if configured. */
> -        int max_packet = new_mtu + mtu_overhead;
> -
> -        if (OCTEON_IS_MODEL(OCTEON_CN3XXX) ||
> -            OCTEON_IS_MODEL(OCTEON_CN58XX)) {
> -            /* Signal errors on packets larger than the MTU */
> -            cvmx_write_csr(CVMX_GMXX_RXX_FRM_MAX(index, interface),
> -                       max_packet);
> -        } else {
> -            /*
> -             * Set the hardware to truncate packets larger
> -             * than the MTU and smaller the 64 bytes.
> -             */
> -            union cvmx_pip_frm_len_chkx frm_len_chk;
> -
> -            frm_len_chk.u64 = 0;
> -            frm_len_chk.s.minlen = VLAN_ETH_ZLEN;
> -            frm_len_chk.s.maxlen = max_packet;
> -            cvmx_write_csr(CVMX_PIP_FRM_LEN_CHKX(interface),
> -                       frm_len_chk.u64);
> -        }
> -        /*
> -         * Set the hardware to truncate packets larger than
> -         * the MTU. The jabber register must be set to a
> -         * multiple of 8 bytes, so round up.
> -         */
> -        cvmx_write_csr(CVMX_GMXX_RXX_JABBER(index, interface),
> -                   (max_packet + 7) & ~7u);
> -    }
> -    return 0;
> -}
> -
> -/**
> - * cvm_oct_common_set_multicast_list - set the multicast list
> - * @dev:    Device to work on
> - */
> -static void cvm_oct_common_set_multicast_list(struct net_device *dev)
> -{
> -    union cvmx_gmxx_prtx_cfg gmx_cfg;
> -    struct octeon_ethernet *priv = netdev_priv(dev);
> -    int interface = INTERFACE(priv->port);
> -
> -    if ((interface < 2) &&
> -        (cvmx_helper_interface_get_mode(interface) !=
> -        CVMX_HELPER_INTERFACE_MODE_SPI)) {
> -        union cvmx_gmxx_rxx_adr_ctl control;
> -        int index = INDEX(priv->port);
> -
> -        control.u64 = 0;
> -        control.s.bcst = 1;    /* Allow broadcast MAC addresses */
> -
> -        if (!netdev_mc_empty(dev) || (dev->flags & IFF_ALLMULTI) ||
> -            (dev->flags & IFF_PROMISC))
> -            /* Force accept multicast packets */
> -            control.s.mcst = 2;
> -        else
> -            /* Force reject multicast packets */
> -            control.s.mcst = 1;
> -
> -        if (dev->flags & IFF_PROMISC)
> -            /*
> -             * Reject matches if promisc. Since CAM is
> -             * shut off, should accept everything.
> -             */
> -            control.s.cam_mode = 0;
> -        else
> -            /* Filter packets based on the CAM */
> -            control.s.cam_mode = 1;
> -
> -        gmx_cfg.u64 =
> -            cvmx_read_csr(CVMX_GMXX_PRTX_CFG(index, interface));
> -        cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface),
> -                   gmx_cfg.u64 & ~1ull);
> -
> -        cvmx_write_csr(CVMX_GMXX_RXX_ADR_CTL(index, interface),
> -                   control.u64);
> -        if (dev->flags & IFF_PROMISC)
> -            cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM_EN
> -                       (index, interface), 0);
> -        else
> -            cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM_EN
> -                       (index, interface), 1);
> -
> -        cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface),
> -                   gmx_cfg.u64);
> -    }
> -}
> -
> -static int cvm_oct_set_mac_filter(struct net_device *dev)
> -{
> -    struct octeon_ethernet *priv = netdev_priv(dev);
> -    union cvmx_gmxx_prtx_cfg gmx_cfg;
> -    int interface = INTERFACE(priv->port);
> -
> -    if ((interface < 2) &&
> -        (cvmx_helper_interface_get_mode(interface) !=
> -        CVMX_HELPER_INTERFACE_MODE_SPI)) {
> -        int i;
> -        u8 *ptr = dev->dev_addr;
> -        u64 mac = 0;
> -        int index = INDEX(priv->port);
> -
> -        for (i = 0; i < 6; i++)
> -            mac = (mac << 8) | (u64)ptr[i];
> -
> -        gmx_cfg.u64 =
> -            cvmx_read_csr(CVMX_GMXX_PRTX_CFG(index, interface));
> -        cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface),
> -                   gmx_cfg.u64 & ~1ull);
> -
> -        cvmx_write_csr(CVMX_GMXX_SMACX(index, interface), mac);
> -        cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM0(index, interface),
> -                   ptr[0]);
> -        cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM1(index, interface),
> -                   ptr[1]);
> -        cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM2(index, interface),
> -                   ptr[2]);
> -        cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM3(index, interface),
> -                   ptr[3]);
> -        cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM4(index, interface),
> -                   ptr[4]);
> -        cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM5(index, interface),
> -                   ptr[5]);
> -        cvm_oct_common_set_multicast_list(dev);
> -        cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface),
> -                   gmx_cfg.u64);
> -    }
> -    return 0;
> -}
> -
> -/**
> - * cvm_oct_common_set_mac_address - set the hardware MAC address for a device
> - * @dev:    The device in question.
> - * @addr:   Socket address.
> - *
> - * Returns Zero on success
> - */
> -static int cvm_oct_common_set_mac_address(struct net_device *dev, void *addr)
> -{
> -    int r = eth_mac_addr(dev, addr);
> -
> -    if (r)
> -        return r;
> -    return cvm_oct_set_mac_filter(dev);
> -}
> -
> -/**
> - * cvm_oct_common_init - per network device initialization
> - * @dev:    Device to initialize
> - *
> - * Returns Zero on success
> - */
> -int cvm_oct_common_init(struct net_device *dev)
> -{
> -    struct octeon_ethernet *priv = netdev_priv(dev);
> -    const u8 *mac = NULL;
> -
> -    if (priv->of_node)
> -        mac = of_get_mac_address(priv->of_node);
> -
> -    if (!IS_ERR_OR_NULL(mac))
> -        ether_addr_copy(dev->dev_addr, mac);
> -    else
> -        eth_hw_addr_random(dev);
> -
> -    /*
> -     * Force the interface to use the POW send if always_use_pow
> -     * was specified or it is in the pow send list.
> -     */
> -    if ((pow_send_group != -1) &&
> -        (always_use_pow || strstr(pow_send_list, dev->name)))
> -        priv->queue = -1;
> -
> -    if (priv->queue != -1)
> -        dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM;
> -
> -    /* We do our own locking, Linux doesn't need to */
> -    dev->features |= NETIF_F_LLTX;
> -    dev->ethtool_ops = &cvm_oct_ethtool_ops;
> -
> -    cvm_oct_set_mac_filter(dev);
> -    dev_set_mtu(dev, dev->mtu);
> -
> -    /*
> -     * Zero out stats for port so we won't mistakenly show
> -     * counters from the bootloader.
> -     */
> -    memset(dev->netdev_ops->ndo_get_stats(dev), 0,
> -           sizeof(struct net_device_stats));
> -
> -    if (dev->netdev_ops->ndo_stop)
> -        dev->netdev_ops->ndo_stop(dev);
> -
> -    return 0;
> -}
> -
> -void cvm_oct_common_uninit(struct net_device *dev)
> -{
> -    if (dev->phydev)
> -        phy_disconnect(dev->phydev);
> -}
> -
> -int cvm_oct_common_open(struct net_device *dev,
> -            void (*link_poll)(struct net_device *))
> -{
> -    union cvmx_gmxx_prtx_cfg gmx_cfg;
> -    struct octeon_ethernet *priv = netdev_priv(dev);
> -    int interface = INTERFACE(priv->port);
> -    int index = INDEX(priv->port);
> -    union cvmx_helper_link_info link_info;
> -    int rv;
> -
> -    rv = cvm_oct_phy_setup_device(dev);
> -    if (rv)
> -        return rv;
> -
> -    gmx_cfg.u64 = cvmx_read_csr(CVMX_GMXX_PRTX_CFG(index, interface));
> -    gmx_cfg.s.en = 1;
> -    if (octeon_has_feature(OCTEON_FEATURE_PKND))
> -        gmx_cfg.s.pknd = priv->port;
> -    cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface), gmx_cfg.u64);
> -
> -    if (octeon_is_simulation())
> -        return 0;
> -
> -    if (dev->phydev) {
> -        int r = phy_read_status(dev->phydev);
> -
> -        if (r == 0 && dev->phydev->link == 0)
> -            netif_carrier_off(dev);
> -        cvm_oct_adjust_link(dev);
> -    } else {
> -        link_info = cvmx_helper_link_get(priv->port);
> -        if (!link_info.s.link_up)
> -            netif_carrier_off(dev);
> -        priv->poll = link_poll;
> -        link_poll(dev);
> -    }
> -
> -    return 0;
> -}
> -
> -void cvm_oct_link_poll(struct net_device *dev)
> -{
> -    struct octeon_ethernet *priv = netdev_priv(dev);
> -    union cvmx_helper_link_info link_info;
> -
> -    link_info = cvmx_helper_link_get(priv->port);
> -    if (link_info.u64 == priv->link_info)
> -        return;
> -
> -    if (cvmx_helper_link_set(priv->port, link_info))
> -        link_info.u64 = priv->link_info;
> -    else
> -        priv->link_info = link_info.u64;
> -
> -    if (link_info.s.link_up) {
> -        if (!netif_carrier_ok(dev))
> -            netif_carrier_on(dev);
> -    } else if (netif_carrier_ok(dev)) {
> -        netif_carrier_off(dev);
> -    }
> -    cvm_oct_note_carrier(priv, link_info);
> -}
> -
> -static int cvm_oct_xaui_open(struct net_device *dev)
> -{
> -    return cvm_oct_common_open(dev, cvm_oct_link_poll);
> -}
> -
> -static const struct net_device_ops cvm_oct_npi_netdev_ops = {
> -    .ndo_init        = cvm_oct_common_init,
> -    .ndo_uninit        = cvm_oct_common_uninit,
> -    .ndo_start_xmit        = cvm_oct_xmit,
> -    .ndo_set_rx_mode    = cvm_oct_common_set_multicast_list,
> -    .ndo_set_mac_address    = cvm_oct_common_set_mac_address,
> -    .ndo_do_ioctl        = cvm_oct_ioctl,
> -    .ndo_change_mtu        = cvm_oct_common_change_mtu,
> -    .ndo_get_stats        = cvm_oct_common_get_stats,
> -#ifdef CONFIG_NET_POLL_CONTROLLER
> -    .ndo_poll_controller    = cvm_oct_poll_controller,
> -#endif
> -};
> -
> -static const struct net_device_ops cvm_oct_xaui_netdev_ops = {
> -    .ndo_init        = cvm_oct_common_init,
> -    .ndo_uninit        = cvm_oct_common_uninit,
> -    .ndo_open        = cvm_oct_xaui_open,
> -    .ndo_stop        = cvm_oct_common_stop,
> -    .ndo_start_xmit        = cvm_oct_xmit,
> -    .ndo_set_rx_mode    = cvm_oct_common_set_multicast_list,
> -    .ndo_set_mac_address    = cvm_oct_common_set_mac_address,
> -    .ndo_do_ioctl        = cvm_oct_ioctl,
> -    .ndo_change_mtu        = cvm_oct_common_change_mtu,
> -    .ndo_get_stats        = cvm_oct_common_get_stats,
> -#ifdef CONFIG_NET_POLL_CONTROLLER
> -    .ndo_poll_controller    = cvm_oct_poll_controller,
> -#endif
> -};
> -
> -static const struct net_device_ops cvm_oct_sgmii_netdev_ops = {
> -    .ndo_init        = cvm_oct_sgmii_init,
> -    .ndo_uninit        = cvm_oct_common_uninit,
> -    .ndo_open        = cvm_oct_sgmii_open,
> -    .ndo_stop        = cvm_oct_common_stop,
> -    .ndo_start_xmit        = cvm_oct_xmit,
> -    .ndo_set_rx_mode    = cvm_oct_common_set_multicast_list,
> -    .ndo_set_mac_address    = cvm_oct_common_set_mac_address,
> -    .ndo_do_ioctl        = cvm_oct_ioctl,
> -    .ndo_change_mtu        = cvm_oct_common_change_mtu,
> -    .ndo_get_stats        = cvm_oct_common_get_stats,
> -#ifdef CONFIG_NET_POLL_CONTROLLER
> -    .ndo_poll_controller    = cvm_oct_poll_controller,
> -#endif
> -};
> -
> -static const struct net_device_ops cvm_oct_spi_netdev_ops = {
> -    .ndo_init        = cvm_oct_spi_init,
> -    .ndo_uninit        = cvm_oct_spi_uninit,
> -    .ndo_start_xmit        = cvm_oct_xmit,
> -    .ndo_set_rx_mode    = cvm_oct_common_set_multicast_list,
> -    .ndo_set_mac_address    = cvm_oct_common_set_mac_address,
> -    .ndo_do_ioctl        = cvm_oct_ioctl,
> -    .ndo_change_mtu        = cvm_oct_common_change_mtu,
> -    .ndo_get_stats        = cvm_oct_common_get_stats,
> -#ifdef CONFIG_NET_POLL_CONTROLLER
> -    .ndo_poll_controller    = cvm_oct_poll_controller,
> -#endif
> -};
> -
> -static const struct net_device_ops cvm_oct_rgmii_netdev_ops = {
> -    .ndo_init        = cvm_oct_common_init,
> -    .ndo_uninit        = cvm_oct_common_uninit,
> -    .ndo_open        = cvm_oct_rgmii_open,
> -    .ndo_stop        = cvm_oct_common_stop,
> -    .ndo_start_xmit        = cvm_oct_xmit,
> -    .ndo_set_rx_mode    = cvm_oct_common_set_multicast_list,
> -    .ndo_set_mac_address    = cvm_oct_common_set_mac_address,
> -    .ndo_do_ioctl        = cvm_oct_ioctl,
> -    .ndo_change_mtu        = cvm_oct_common_change_mtu,
> -    .ndo_get_stats        = cvm_oct_common_get_stats,
> -#ifdef CONFIG_NET_POLL_CONTROLLER
> -    .ndo_poll_controller    = cvm_oct_poll_controller,
> -#endif
> -};
> -
> -static const struct net_device_ops cvm_oct_pow_netdev_ops = {
> -    .ndo_init        = cvm_oct_common_init,
> -    .ndo_start_xmit        = cvm_oct_xmit_pow,
> -    .ndo_set_rx_mode    = cvm_oct_common_set_multicast_list,
> -    .ndo_set_mac_address    = cvm_oct_common_set_mac_address,
> -    .ndo_do_ioctl        = cvm_oct_ioctl,
> -    .ndo_change_mtu        = cvm_oct_common_change_mtu,
> -    .ndo_get_stats        = cvm_oct_common_get_stats,
> -#ifdef CONFIG_NET_POLL_CONTROLLER
> -    .ndo_poll_controller    = cvm_oct_poll_controller,
> -#endif
> -};
> -
> -static struct device_node *cvm_oct_of_get_child
> -                (const struct device_node *parent, int reg_val)
> -{
> -    struct device_node *node = NULL;
> -    int size;
> -    const __be32 *addr;
> -
> -    for (;;) {
> -        node = of_get_next_child(parent, node);
> -        if (!node)
> -            break;
> -        addr = of_get_property(node, "reg", &size);
> -        if (addr && (be32_to_cpu(*addr) == reg_val))
> -            break;
> -    }
> -    return node;
> -}
> -
> -static struct device_node *cvm_oct_node_for_port(struct device_node *pip,
> -                         int interface, int port)
> -{
> -    struct device_node *ni, *np;
> -
> -    ni = cvm_oct_of_get_child(pip, interface);
> -    if (!ni)
> -        return NULL;
> -
> -    np = cvm_oct_of_get_child(ni, port);
> -    of_node_put(ni);
> -
> -    return np;
> -}
> -
> -static void cvm_set_rgmii_delay(struct octeon_ethernet *priv, int iface,
> -                int port)
> -{
> -    struct device_node *np = priv->of_node;
> -    u32 delay_value;
> -    bool rx_delay;
> -    bool tx_delay;
> -
> -    /* By default, both RX/TX delay is enabled in
> -     * __cvmx_helper_rgmii_enable().
> -     */
> -    rx_delay = true;
> -    tx_delay = true;
> -
> -    if (!of_property_read_u32(np, "rx-delay", &delay_value)) {
> -        cvmx_write_csr(CVMX_ASXX_RX_CLK_SETX(port, iface), delay_value);
> -        rx_delay = delay_value > 0;
> -    }
> -    if (!of_property_read_u32(np, "tx-delay", &delay_value)) {
> -        cvmx_write_csr(CVMX_ASXX_TX_CLK_SETX(port, iface), delay_value);
> -        tx_delay = delay_value > 0;
> -    }
> -
> -    if (!rx_delay && !tx_delay)
> -        priv->phy_mode = PHY_INTERFACE_MODE_RGMII_ID;
> -    else if (!rx_delay)
> -        priv->phy_mode = PHY_INTERFACE_MODE_RGMII_RXID;
> -    else if (!tx_delay)
> -        priv->phy_mode = PHY_INTERFACE_MODE_RGMII_TXID;
> -    else
> -        priv->phy_mode = PHY_INTERFACE_MODE_RGMII;
> -}
> -
> -static int cvm_oct_probe(struct platform_device *pdev)
> -{
> -    int num_interfaces;
> -    int interface;
> -    int fau = FAU_NUM_PACKET_BUFFERS_TO_FREE;
> -    int qos;
> -    struct device_node *pip;
> -    int mtu_overhead = ETH_HLEN + ETH_FCS_LEN;
> -
> -#if IS_ENABLED(CONFIG_VLAN_8021Q)
> -    mtu_overhead += VLAN_HLEN;
> -#endif
> -
> -    octeon_mdiobus_force_mod_depencency();
> -
> -    pip = pdev->dev.of_node;
> -    if (!pip) {
> -        pr_err("Error: No 'pip' in /aliases\n");
> -        return -EINVAL;
> -    }
> -
> -    cvm_oct_configure_common_hw();
> -
> -    cvmx_helper_initialize_packet_io_global();
> -
> -    if (receive_group_order) {
> -        if (receive_group_order > 4)
> -            receive_group_order = 4;
> -        pow_receive_groups = (1 << (1 << receive_group_order)) - 1;
> -    } else {
> -        pow_receive_groups = BIT(pow_receive_group);
> -    }
> -
> -    /* Change the input group for all ports before input is enabled */
> -    num_interfaces = cvmx_helper_get_number_of_interfaces();
> -    for (interface = 0; interface < num_interfaces; interface++) {
> -        int num_ports = cvmx_helper_ports_on_interface(interface);
> -        int port;
> -
> -        for (port = cvmx_helper_get_ipd_port(interface, 0);
> -             port < cvmx_helper_get_ipd_port(interface, num_ports);
> -             port++) {
> -            union cvmx_pip_prt_tagx pip_prt_tagx;
> -
> -            pip_prt_tagx.u64 =
> -                cvmx_read_csr(CVMX_PIP_PRT_TAGX(port));
> -
> -            if (receive_group_order) {
> -                int tag_mask;
> -
> -                /* We support only 16 groups at the moment, so
> -                 * always disable the two additional "hidden"
> -                 * tag_mask bits on CN68XX.
> -                 */
> -                if (OCTEON_IS_MODEL(OCTEON_CN68XX))
> -                    pip_prt_tagx.u64 |= 0x3ull << 44;
> -
> -                tag_mask = ~((1 << receive_group_order) - 1);
> -                pip_prt_tagx.s.grptagbase    = 0;
> -                pip_prt_tagx.s.grptagmask    = tag_mask;
> -                pip_prt_tagx.s.grptag        = 1;
> -                pip_prt_tagx.s.tag_mode        = 0;
> -                pip_prt_tagx.s.inc_prt_flag    = 1;
> -                pip_prt_tagx.s.ip6_dprt_flag    = 1;
> -                pip_prt_tagx.s.ip4_dprt_flag    = 1;
> -                pip_prt_tagx.s.ip6_sprt_flag    = 1;
> -                pip_prt_tagx.s.ip4_sprt_flag    = 1;
> -                pip_prt_tagx.s.ip6_dst_flag    = 1;
> -                pip_prt_tagx.s.ip4_dst_flag    = 1;
> -                pip_prt_tagx.s.ip6_src_flag    = 1;
> -                pip_prt_tagx.s.ip4_src_flag    = 1;
> -                pip_prt_tagx.s.grp        = 0;
> -            } else {
> -                pip_prt_tagx.s.grptag    = 0;
> -                pip_prt_tagx.s.grp    = pow_receive_group;
> -            }
> -
> -            cvmx_write_csr(CVMX_PIP_PRT_TAGX(port),
> -                       pip_prt_tagx.u64);
> -        }
> -    }
> -
> -    cvmx_helper_ipd_and_packet_input_enable();
> -
> -    memset(cvm_oct_device, 0, sizeof(cvm_oct_device));
> -
> -    /*
> -     * Initialize the FAU used for counting packet buffers that
> -     * need to be freed.
> -     */
> -    cvmx_fau_atomic_write32(FAU_NUM_PACKET_BUFFERS_TO_FREE, 0);
> -
> -    /* Initialize the FAU used for counting tx SKBs that need to be freed */
> -    cvmx_fau_atomic_write32(FAU_TOTAL_TX_TO_CLEAN, 0);
> -
> -    if ((pow_send_group != -1)) {
> -        struct net_device *dev;
> -
> -        dev = alloc_etherdev(sizeof(struct octeon_ethernet));
> -        if (dev) {
> -            /* Initialize the device private structure. */
> -            struct octeon_ethernet *priv = netdev_priv(dev);
> -
> -            SET_NETDEV_DEV(dev, &pdev->dev);
> -            dev->netdev_ops = &cvm_oct_pow_netdev_ops;
> -            priv->imode = CVMX_HELPER_INTERFACE_MODE_DISABLED;
> -            priv->port = CVMX_PIP_NUM_INPUT_PORTS;
> -            priv->queue = -1;
> -            strscpy(dev->name, "pow%d", sizeof(dev->name));
> -            for (qos = 0; qos < 16; qos++)
> -                skb_queue_head_init(&priv->tx_free_list[qos]);
> -            dev->min_mtu = VLAN_ETH_ZLEN - mtu_overhead;
> -            dev->max_mtu = OCTEON_MAX_MTU - mtu_overhead;
> -
> -            if (register_netdev(dev) < 0) {
> -                pr_err("Failed to register ethernet device for POW\n");
> -                free_netdev(dev);
> -            } else {
> -                cvm_oct_device[CVMX_PIP_NUM_INPUT_PORTS] = dev;
> -                pr_info("%s: POW send group %d, receive group %d\n",
> -                    dev->name, pow_send_group,
> -                    pow_receive_group);
> -            }
> -        } else {
> -            pr_err("Failed to allocate ethernet device for POW\n");
> -        }
> -    }
> -
> -    num_interfaces = cvmx_helper_get_number_of_interfaces();
> -    for (interface = 0; interface < num_interfaces; interface++) {
> -        cvmx_helper_interface_mode_t imode =
> -            cvmx_helper_interface_get_mode(interface);
> -        int num_ports = cvmx_helper_ports_on_interface(interface);
> -        int port;
> -        int port_index;
> -
> -        for (port_index = 0,
> -             port = cvmx_helper_get_ipd_port(interface, 0);
> -             port < cvmx_helper_get_ipd_port(interface, num_ports);
> -             port_index++, port++) {
> -            struct octeon_ethernet *priv;
> -            struct net_device *dev =
> -                alloc_etherdev(sizeof(struct octeon_ethernet));
> -            if (!dev) {
> -                pr_err("Failed to allocate ethernet device for port %d\n",
> -                       port);
> -                continue;
> -            }
> -
> -            /* Initialize the device private structure. */
> -            SET_NETDEV_DEV(dev, &pdev->dev);
> -            priv = netdev_priv(dev);
> -            priv->netdev = dev;
> -            priv->of_node = cvm_oct_node_for_port(pip, interface,
> -                                  port_index);
> -
> -            INIT_DELAYED_WORK(&priv->port_periodic_work,
> -                      cvm_oct_periodic_worker);
> -            priv->imode = imode;
> -            priv->port = port;
> -            priv->queue = cvmx_pko_get_base_queue(priv->port);
> -            priv->fau = fau - cvmx_pko_get_num_queues(port) * 4;
> -            priv->phy_mode = PHY_INTERFACE_MODE_NA;
> -            for (qos = 0; qos < 16; qos++)
> -                skb_queue_head_init(&priv->tx_free_list[qos]);
> -            for (qos = 0; qos < cvmx_pko_get_num_queues(port);
> -                 qos++)
> -                cvmx_fau_atomic_write32(priv->fau + qos * 4, 0);
> -            dev->min_mtu = VLAN_ETH_ZLEN - mtu_overhead;
> -            dev->max_mtu = OCTEON_MAX_MTU - mtu_overhead;
> -
> -            switch (priv->imode) {
> -            /* These types don't support ports to IPD/PKO */
> -            case CVMX_HELPER_INTERFACE_MODE_DISABLED:
> -            case CVMX_HELPER_INTERFACE_MODE_PCIE:
> -            case CVMX_HELPER_INTERFACE_MODE_PICMG:
> -                break;
> -
> -            case CVMX_HELPER_INTERFACE_MODE_NPI:
> -                dev->netdev_ops = &cvm_oct_npi_netdev_ops;
> -                strscpy(dev->name, "npi%d", sizeof(dev->name));
> -                break;
> -
> -            case CVMX_HELPER_INTERFACE_MODE_XAUI:
> -                dev->netdev_ops = &cvm_oct_xaui_netdev_ops;
> -                strscpy(dev->name, "xaui%d", sizeof(dev->name));
> -                break;
> -
> -            case CVMX_HELPER_INTERFACE_MODE_LOOP:
> -                dev->netdev_ops = &cvm_oct_npi_netdev_ops;
> -                strscpy(dev->name, "loop%d", sizeof(dev->name));
> -                break;
> -
> -            case CVMX_HELPER_INTERFACE_MODE_SGMII:
> -                priv->phy_mode = PHY_INTERFACE_MODE_SGMII;
> -                dev->netdev_ops = &cvm_oct_sgmii_netdev_ops;
> -                strscpy(dev->name, "eth%d", sizeof(dev->name));
> -                break;
> -
> -            case CVMX_HELPER_INTERFACE_MODE_SPI:
> -                dev->netdev_ops = &cvm_oct_spi_netdev_ops;
> -                strscpy(dev->name, "spi%d", sizeof(dev->name));
> -                break;
> -
> -            case CVMX_HELPER_INTERFACE_MODE_GMII:
> -                priv->phy_mode = PHY_INTERFACE_MODE_GMII;
> -                dev->netdev_ops = &cvm_oct_rgmii_netdev_ops;
> -                strscpy(dev->name, "eth%d", sizeof(dev->name));
> -                break;
> -
> -            case CVMX_HELPER_INTERFACE_MODE_RGMII:
> -                dev->netdev_ops = &cvm_oct_rgmii_netdev_ops;
> -                strscpy(dev->name, "eth%d", sizeof(dev->name));
> -                cvm_set_rgmii_delay(priv, interface,
> -                            port_index);
> -                break;
> -            }
> -
> -            if (!dev->netdev_ops) {
> -                free_netdev(dev);
> -            } else if (register_netdev(dev) < 0) {
> -                pr_err("Failed to register ethernet device for interface %d, port %d\n",
> -                       interface, priv->port);
> -                free_netdev(dev);
> -            } else {
> -                cvm_oct_device[priv->port] = dev;
> -                fau -=
> -                    cvmx_pko_get_num_queues(priv->port) *
> -                    sizeof(u32);
> -                schedule_delayed_work(&priv->port_periodic_work,
> -                              HZ);
> -            }
> -        }
> -    }
> -
> -    cvm_oct_tx_initialize();
> -    cvm_oct_rx_initialize();
> -
> -    /*
> -     * 150 uS: about 10 1500-byte packets at 1GE.
> -     */
> -    cvm_oct_tx_poll_interval = 150 * (octeon_get_clock_rate() / 1000000);
> -
> -    schedule_delayed_work(&cvm_oct_rx_refill_work, HZ);
> -
> -    return 0;
> -}
> -
> -static int cvm_oct_remove(struct platform_device *pdev)
> -{
> -    int port;
> -
> -    cvmx_ipd_disable();
> -
> -    atomic_inc_return(&cvm_oct_poll_queue_stopping);
> -    cancel_delayed_work_sync(&cvm_oct_rx_refill_work);
> -
> -    cvm_oct_rx_shutdown();
> -    cvm_oct_tx_shutdown();
> -
> -    cvmx_pko_disable();
> -
> -    /* Free the ethernet devices */
> -    for (port = 0; port < TOTAL_NUMBER_OF_PORTS; port++) {
> -        if (cvm_oct_device[port]) {
> -            struct net_device *dev = cvm_oct_device[port];
> -            struct octeon_ethernet *priv = netdev_priv(dev);
> -
> -            cancel_delayed_work_sync(&priv->port_periodic_work);
> -
> -            cvm_oct_tx_shutdown_dev(dev);
> -            unregister_netdev(dev);
> -            free_netdev(dev);
> -            cvm_oct_device[port] = NULL;
> -        }
> -    }
> -
> -    cvmx_pko_shutdown();
> -
> -    cvmx_ipd_free_ptr();
> -
> -    /* Free the HW pools */
> -    cvm_oct_mem_empty_fpa(CVMX_FPA_PACKET_POOL, CVMX_FPA_PACKET_POOL_SIZE,
> -                  num_packet_buffers);
> -    cvm_oct_mem_empty_fpa(CVMX_FPA_WQE_POOL, CVMX_FPA_WQE_POOL_SIZE,
> -                  num_packet_buffers);
> -    if (CVMX_FPA_OUTPUT_BUFFER_POOL != CVMX_FPA_PACKET_POOL)
> -        cvm_oct_mem_empty_fpa(CVMX_FPA_OUTPUT_BUFFER_POOL,
> -                      CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE, 128);
> -    return 0;
> -}
> -
> -static const struct of_device_id cvm_oct_match[] = {
> -    {
> -        .compatible = "cavium,octeon-3860-pip",
> -    },
> -    {},
> -};
> -MODULE_DEVICE_TABLE(of, cvm_oct_match);
> -
> -static struct platform_driver cvm_oct_driver = {
> -    .probe        = cvm_oct_probe,
> -    .remove        = cvm_oct_remove,
> -    .driver        = {
> -        .name    = KBUILD_MODNAME,
> -        .of_match_table = cvm_oct_match,
> -    },
> -};
> -
> -module_platform_driver(cvm_oct_driver);
> -
> -MODULE_LICENSE("GPL");
> -MODULE_AUTHOR("Cavium Networks <support@caviumnetworks.com>");
> -MODULE_DESCRIPTION("Cavium Networks Octeon ethernet driver.");
> diff --git a/drivers/staging/octeon/octeon-ethernet.h b/drivers/staging/octeon/octeon-ethernet.h
> deleted file mode 100644
> index a6140705706f..000000000000
> --- a/drivers/staging/octeon/octeon-ethernet.h
> +++ /dev/null
> @@ -1,107 +0,0 @@
> -/* SPDX-License-Identifier: GPL-2.0 */
> -/*
> - * This file is based on code from OCTEON SDK by Cavium Networks.
> - *
> - * Copyright (c) 2003-2010 Cavium Networks
> - */
> -
> -/*
> - * External interface for the Cavium Octeon ethernet driver.
> - */
> -#ifndef OCTEON_ETHERNET_H
> -#define OCTEON_ETHERNET_H
> -
> -#include <linux/of.h>
> -#include <linux/phy.h>
> -
> -#ifdef CONFIG_CAVIUM_OCTEON_SOC
> -
> -#include <asm/octeon/octeon.h>
> -
> -#include <asm/octeon/cvmx-asxx-defs.h>
> -#include <asm/octeon/cvmx-config.h>
> -#include <asm/octeon/cvmx-fau.h>
> -#include <asm/octeon/cvmx-gmxx-defs.h>
> -#include <asm/octeon/cvmx-helper.h>
> -#include <asm/octeon/cvmx-helper-util.h>
> -#include <asm/octeon/cvmx-ipd.h>
> -#include <asm/octeon/cvmx-ipd-defs.h>
> -#include <asm/octeon/cvmx-npi-defs.h>
> -#include <asm/octeon/cvmx-pip.h>
> -#include <asm/octeon/cvmx-pko.h>
> -#include <asm/octeon/cvmx-pow.h>
> -#include <asm/octeon/cvmx-scratch.h>
> -#include <asm/octeon/cvmx-spi.h>
> -#include <asm/octeon/cvmx-spxx-defs.h>
> -#include <asm/octeon/cvmx-stxx-defs.h>
> -#include <asm/octeon/cvmx-wqe.h>
> -
> -#else
> -
> -#include "octeon-stubs.h"
> -
> -#endif
> -
> -/**
> - * This is the definition of the Ethernet driver's private
> - * driver state stored in netdev_priv(dev).
> - */
> -struct octeon_ethernet {
> -    /* PKO hardware output port */
> -    int port;
> -    /* PKO hardware queue for the port */
> -    int queue;
> -    /* Hardware fetch and add to count outstanding tx buffers */
> -    int fau;
> -    /* My netdev. */
> -    struct net_device *netdev;
> -    /*
> -     * Type of port. This is one of the enums in
> -     * cvmx_helper_interface_mode_t
> -     */
> -    int imode;
> -    /* PHY mode */
> -    phy_interface_t phy_mode;
> -    /* List of outstanding tx buffers per queue */
> -    struct sk_buff_head tx_free_list[16];
> -    unsigned int last_speed;
> -    unsigned int last_link;
> -    /* Last negotiated link state */
> -    u64 link_info;
> -    /* Called periodically to check link status */
> -    void (*poll)(struct net_device *dev);
> -    struct delayed_work    port_periodic_work;
> -    struct device_node    *of_node;
> -};
> -
> -int cvm_oct_free_work(void *work_queue_entry);
> -
> -int cvm_oct_rgmii_open(struct net_device *dev);
> -
> -int cvm_oct_sgmii_init(struct net_device *dev);
> -int cvm_oct_sgmii_open(struct net_device *dev);
> -
> -int cvm_oct_spi_init(struct net_device *dev);
> -void cvm_oct_spi_uninit(struct net_device *dev);
> -
> -int cvm_oct_common_init(struct net_device *dev);
> -void cvm_oct_common_uninit(struct net_device *dev);
> -void cvm_oct_adjust_link(struct net_device *dev);
> -int cvm_oct_common_stop(struct net_device *dev);
> -int cvm_oct_common_open(struct net_device *dev,
> -            void (*link_poll)(struct net_device *));
> -void cvm_oct_note_carrier(struct octeon_ethernet *priv,
> -              union cvmx_helper_link_info li);
> -void cvm_oct_link_poll(struct net_device *dev);
> -
> -extern int always_use_pow;
> -extern int pow_send_group;
> -extern int pow_receive_groups;
> -extern char pow_send_list[];
> -extern struct net_device *cvm_oct_device[];
> -extern atomic_t cvm_oct_poll_queue_stopping;
> -extern u64 cvm_oct_tx_poll_interval;
> -
> -extern int rx_napi_weight;
> -
> -#endif
> diff --git a/drivers/staging/octeon/octeon-stubs.h b/drivers/staging/octeon/octeon-stubs.h
> deleted file mode 100644
> index 79213c045504..000000000000
> --- a/drivers/staging/octeon/octeon-stubs.h
> +++ /dev/null
> @@ -1,1433 +0,0 @@
> -#define CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE    512
> -
> -#ifndef XKPHYS_TO_PHYS
> -# define XKPHYS_TO_PHYS(p)            (p)
> -#endif
> -
> -#define OCTEON_IRQ_WORKQ0 0
> -#define OCTEON_IRQ_RML 0
> -#define OCTEON_IRQ_TIMER1 0
> -#define OCTEON_IS_MODEL(x) 0
> -#define octeon_has_feature(x)    0
> -#define octeon_get_clock_rate()    0
> -
> -#define CVMX_SYNCIOBDMA        do { } while(0)
> -
> -#define CVMX_HELPER_INPUT_TAG_TYPE    0
> -#define CVMX_HELPER_FIRST_MBUFF_SKIP    7
> -#define CVMX_FAU_REG_END        (2048)
> -#define CVMX_FPA_OUTPUT_BUFFER_POOL        (2)
> -#define CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE    16
> -#define CVMX_FPA_PACKET_POOL            (0)
> -#define CVMX_FPA_PACKET_POOL_SIZE        16
> -#define CVMX_FPA_WQE_POOL            (1)
> -#define CVMX_FPA_WQE_POOL_SIZE            16
> -#define CVMX_GMXX_RXX_ADR_CAM_EN(a, b)    ((a)+(b))
> -#define CVMX_GMXX_RXX_ADR_CTL(a, b)    ((a)+(b))
> -#define CVMX_GMXX_PRTX_CFG(a, b)    ((a)+(b))
> -#define CVMX_GMXX_RXX_FRM_MAX(a, b)    ((a)+(b))
> -#define CVMX_GMXX_RXX_JABBER(a, b)    ((a)+(b))
> -#define CVMX_IPD_CTL_STATUS        0
> -#define CVMX_PIP_FRM_LEN_CHKX(a)    (a)
> -#define CVMX_PIP_NUM_INPUT_PORTS    1
> -#define CVMX_SCR_SCRATCH        0
> -#define CVMX_PKO_QUEUES_PER_PORT_INTERFACE0    2
> -#define CVMX_PKO_QUEUES_PER_PORT_INTERFACE1    2
> -#define CVMX_IPD_SUB_PORT_FCS        0
> -#define CVMX_SSO_WQ_IQ_DIS        0
> -#define CVMX_SSO_WQ_INT            0
> -#define CVMX_POW_WQ_INT            0
> -#define CVMX_SSO_WQ_INT_PC        0
> -#define CVMX_NPI_RSL_INT_BLOCKS        0
> -#define CVMX_POW_WQ_INT_PC        0
> -
> -union cvmx_pip_wqe_word2 {
> -    uint64_t u64;
> -    struct {
> -        uint64_t bufs:8;
> -        uint64_t ip_offset:8;
> -        uint64_t vlan_valid:1;
> -        uint64_t vlan_stacked:1;
> -        uint64_t unassigned:1;
> -        uint64_t vlan_cfi:1;
> -        uint64_t vlan_id:12;
> -        uint64_t pr:4;
> -        uint64_t unassigned2:8;
> -        uint64_t dec_ipcomp:1;
> -        uint64_t tcp_or_udp:1;
> -        uint64_t dec_ipsec:1;
> -        uint64_t is_v6:1;
> -        uint64_t software:1;
> -        uint64_t L4_error:1;
> -        uint64_t is_frag:1;
> -        uint64_t IP_exc:1;
> -        uint64_t is_bcast:1;
> -        uint64_t is_mcast:1;
> -        uint64_t not_IP:1;
> -        uint64_t rcv_error:1;
> -        uint64_t err_code:8;
> -    } s;
> -    struct {
> -        uint64_t bufs:8;
> -        uint64_t ip_offset:8;
> -        uint64_t vlan_valid:1;
> -        uint64_t vlan_stacked:1;
> -        uint64_t unassigned:1;
> -        uint64_t vlan_cfi:1;
> -        uint64_t vlan_id:12;
> -        uint64_t port:12;
> -        uint64_t dec_ipcomp:1;
> -        uint64_t tcp_or_udp:1;
> -        uint64_t dec_ipsec:1;
> -        uint64_t is_v6:1;
> -        uint64_t software:1;
> -        uint64_t L4_error:1;
> -        uint64_t is_frag:1;
> -        uint64_t IP_exc:1;
> -        uint64_t is_bcast:1;
> -        uint64_t is_mcast:1;
> -        uint64_t not_IP:1;
> -        uint64_t rcv_error:1;
> -        uint64_t err_code:8;
> -    } s_cn68xx;
> -
> -    struct {
> -        uint64_t unused1:16;
> -        uint64_t vlan:16;
> -        uint64_t unused2:32;
> -    } svlan;
> -    struct {
> -        uint64_t bufs:8;
> -        uint64_t unused:8;
> -        uint64_t vlan_valid:1;
> -        uint64_t vlan_stacked:1;
> -        uint64_t unassigned:1;
> -        uint64_t vlan_cfi:1;
> -        uint64_t vlan_id:12;
> -        uint64_t pr:4;
> -        uint64_t unassigned2:12;
> -        uint64_t software:1;
> -        uint64_t unassigned3:1;
> -        uint64_t is_rarp:1;
> -        uint64_t is_arp:1;
> -        uint64_t is_bcast:1;
> -        uint64_t is_mcast:1;
> -        uint64_t not_IP:1;
> -        uint64_t rcv_error:1;
> -        uint64_t err_code:8;
> -    } snoip;
> -
> -};
> -
> -union cvmx_pip_wqe_word0 {
> -    struct {
> -        uint64_t next_ptr:40;
> -        uint8_t unused;
> -        __wsum hw_chksum;
> -    } cn38xx;
> -    struct {
> -        uint64_t pknd:6;        /* 0..5 */
> -        uint64_t unused2:2;     /* 6..7 */
> -        uint64_t bpid:6;        /* 8..13 */
> -        uint64_t unused1:18;    /* 14..31 */
> -        uint64_t l2ptr:8;       /* 32..39 */
> -        uint64_t l3ptr:8;       /* 40..47 */
> -        uint64_t unused0:8;     /* 48..55 */
> -        uint64_t l4ptr:8;       /* 56..63 */
> -    } cn68xx;
> -};
> -
> -union cvmx_wqe_word0 {
> -    uint64_t u64;
> -    union cvmx_pip_wqe_word0 pip;
> -};
> -
> -union cvmx_wqe_word1 {
> -    uint64_t u64;
> -    struct {
> -        uint64_t tag:32;
> -        uint64_t tag_type:2;
> -        uint64_t varies:14;
> -        uint64_t len:16;
> -    };
> -    struct {
> -        uint64_t tag:32;
> -        uint64_t tag_type:2;
> -        uint64_t zero_2:3;
> -        uint64_t grp:6;
> -        uint64_t zero_1:1;
> -        uint64_t qos:3;
> -        uint64_t zero_0:1;
> -        uint64_t len:16;
> -    } cn68xx;
> -    struct {
> -        uint64_t tag:32;
> -        uint64_t tag_type:2;
> -        uint64_t zero_2:1;
> -        uint64_t grp:4;
> -        uint64_t qos:3;
> -        uint64_t ipprt:6;
> -        uint64_t len:16;
> -    } cn38xx;
> -};
> -
> -union cvmx_buf_ptr {
> -    void *ptr;
> -    uint64_t u64;
> -    struct {
> -        uint64_t i:1;
> -        uint64_t back:4;
> -        uint64_t pool:3;
> -        uint64_t size:16;
> -        uint64_t addr:40;
> -    } s;
> -};
> -
> -struct cvmx_wqe {
> -    union cvmx_wqe_word0 word0;
> -    union cvmx_wqe_word1 word1;
> -    union cvmx_pip_wqe_word2 word2;
> -    union cvmx_buf_ptr packet_ptr;
> -    uint8_t packet_data[96];
> -};
> -
> -union cvmx_helper_link_info {
> -    uint64_t u64;
> -    struct {
> -        uint64_t reserved_20_63:44;
> -        uint64_t link_up:1;        /**< Is the physical link up? */
> -        uint64_t full_duplex:1;        /**< 1 if the link is full duplex */
> -        uint64_t speed:18;        /**< Speed of the link in Mbps */
> -    } s;
> -};
> -
> -enum cvmx_fau_reg_32 {
> -    CVMX_FAU_REG_32_START    = 0,
> -};
> -
> -enum cvmx_fau_op_size {
> -    CVMX_FAU_OP_SIZE_8 = 0,
> -    CVMX_FAU_OP_SIZE_16 = 1,
> -    CVMX_FAU_OP_SIZE_32 = 2,
> -    CVMX_FAU_OP_SIZE_64 = 3
> -};
> -
> -typedef enum {
> -    CVMX_SPI_MODE_UNKNOWN = 0,
> -    CVMX_SPI_MODE_TX_HALFPLEX = 1,
> -    CVMX_SPI_MODE_RX_HALFPLEX = 2,
> -    CVMX_SPI_MODE_DUPLEX = 3
> -} cvmx_spi_mode_t;
> -
> -typedef enum {
> -    CVMX_HELPER_INTERFACE_MODE_DISABLED,
> -    CVMX_HELPER_INTERFACE_MODE_RGMII,
> -    CVMX_HELPER_INTERFACE_MODE_GMII,
> -    CVMX_HELPER_INTERFACE_MODE_SPI,
> -    CVMX_HELPER_INTERFACE_MODE_PCIE,
> -    CVMX_HELPER_INTERFACE_MODE_XAUI,
> -    CVMX_HELPER_INTERFACE_MODE_SGMII,
> -    CVMX_HELPER_INTERFACE_MODE_PICMG,
> -    CVMX_HELPER_INTERFACE_MODE_NPI,
> -    CVMX_HELPER_INTERFACE_MODE_LOOP,
> -} cvmx_helper_interface_mode_t;
> -
> -typedef enum {
> -    CVMX_POW_WAIT = 1,
> -    CVMX_POW_NO_WAIT = 0,
> -} cvmx_pow_wait_t;
> -
> -typedef enum {
> -    CVMX_PKO_LOCK_NONE = 0,
> -    CVMX_PKO_LOCK_ATOMIC_TAG = 1,
> -    CVMX_PKO_LOCK_CMD_QUEUE = 2,
> -} cvmx_pko_lock_t;
> -
> -typedef enum {
> -    CVMX_PKO_SUCCESS,
> -    CVMX_PKO_INVALID_PORT,
> -    CVMX_PKO_INVALID_QUEUE,
> -    CVMX_PKO_INVALID_PRIORITY,
> -    CVMX_PKO_NO_MEMORY,
> -    CVMX_PKO_PORT_ALREADY_SETUP,
> -    CVMX_PKO_CMD_QUEUE_INIT_ERROR
> -} cvmx_pko_status_t;
> -
> -enum cvmx_pow_tag_type {
> -    CVMX_POW_TAG_TYPE_ORDERED   = 0L,
> -    CVMX_POW_TAG_TYPE_ATOMIC    = 1L,
> -    CVMX_POW_TAG_TYPE_NULL        = 2L,
> -    CVMX_POW_TAG_TYPE_NULL_NULL = 3L
> -};
> -
> -union cvmx_ipd_ctl_status {
> -    uint64_t u64;
> -    struct cvmx_ipd_ctl_status_s {
> -        uint64_t reserved_18_63:46;
> -        uint64_t use_sop:1;
> -        uint64_t rst_done:1;
> -        uint64_t clken:1;
> -        uint64_t no_wptr:1;
> -        uint64_t pq_apkt:1;
> -        uint64_t pq_nabuf:1;
> -        uint64_t ipd_full:1;
> -        uint64_t pkt_off:1;
> -        uint64_t len_m8:1;
> -        uint64_t reset:1;
> -        uint64_t addpkt:1;
> -        uint64_t naddbuf:1;
> -        uint64_t pkt_lend:1;
> -        uint64_t wqe_lend:1;
> -        uint64_t pbp_en:1;
> -        uint64_t opc_mode:2;
> -        uint64_t ipd_en:1;
> -    } s;
> -    struct cvmx_ipd_ctl_status_cn30xx {
> -        uint64_t reserved_10_63:54;
> -        uint64_t len_m8:1;
> -        uint64_t reset:1;
> -        uint64_t addpkt:1;
> -        uint64_t naddbuf:1;
> -        uint64_t pkt_lend:1;
> -        uint64_t wqe_lend:1;
> -        uint64_t pbp_en:1;
> -        uint64_t opc_mode:2;
> -        uint64_t ipd_en:1;
> -    } cn30xx;
> -    struct cvmx_ipd_ctl_status_cn38xxp2 {
> -        uint64_t reserved_9_63:55;
> -        uint64_t reset:1;
> -        uint64_t addpkt:1;
> -        uint64_t naddbuf:1;
> -        uint64_t pkt_lend:1;
> -        uint64_t wqe_lend:1;
> -        uint64_t pbp_en:1;
> -        uint64_t opc_mode:2;
> -        uint64_t ipd_en:1;
> -    } cn38xxp2;
> -    struct cvmx_ipd_ctl_status_cn50xx {
> -        uint64_t reserved_15_63:49;
> -        uint64_t no_wptr:1;
> -        uint64_t pq_apkt:1;
> -        uint64_t pq_nabuf:1;
> -        uint64_t ipd_full:1;
> -        uint64_t pkt_off:1;
> -        uint64_t len_m8:1;
> -        uint64_t reset:1;
> -        uint64_t addpkt:1;
> -        uint64_t naddbuf:1;
> -        uint64_t pkt_lend:1;
> -        uint64_t wqe_lend:1;
> -        uint64_t pbp_en:1;
> -        uint64_t opc_mode:2;
> -        uint64_t ipd_en:1;
> -    } cn50xx;
> -    struct cvmx_ipd_ctl_status_cn58xx {
> -        uint64_t reserved_12_63:52;
> -        uint64_t ipd_full:1;
> -        uint64_t pkt_off:1;
> -        uint64_t len_m8:1;
> -        uint64_t reset:1;
> -        uint64_t addpkt:1;
> -        uint64_t naddbuf:1;
> -        uint64_t pkt_lend:1;
> -        uint64_t wqe_lend:1;
> -        uint64_t pbp_en:1;
> -        uint64_t opc_mode:2;
> -        uint64_t ipd_en:1;
> -    } cn58xx;
> -    struct cvmx_ipd_ctl_status_cn63xxp1 {
> -        uint64_t reserved_16_63:48;
> -        uint64_t clken:1;
> -        uint64_t no_wptr:1;
> -        uint64_t pq_apkt:1;
> -        uint64_t pq_nabuf:1;
> -        uint64_t ipd_full:1;
> -        uint64_t pkt_off:1;
> -        uint64_t len_m8:1;
> -        uint64_t reset:1;
> -        uint64_t addpkt:1;
> -        uint64_t naddbuf:1;
> -        uint64_t pkt_lend:1;
> -        uint64_t wqe_lend:1;
> -        uint64_t pbp_en:1;
> -        uint64_t opc_mode:2;
> -        uint64_t ipd_en:1;
> -    } cn63xxp1;
> -};
> -
> -union cvmx_ipd_sub_port_fcs {
> -    uint64_t u64;
> -    struct cvmx_ipd_sub_port_fcs_s {
> -        uint64_t port_bit:32;
> -        uint64_t reserved_32_35:4;
> -        uint64_t port_bit2:4;
> -        uint64_t reserved_40_63:24;
> -    } s;
> -    struct cvmx_ipd_sub_port_fcs_cn30xx {
> -        uint64_t port_bit:3;
> -        uint64_t reserved_3_63:61;
> -    } cn30xx;
> -    struct cvmx_ipd_sub_port_fcs_cn38xx {
> -        uint64_t port_bit:32;
> -        uint64_t reserved_32_63:32;
> -    } cn38xx;
> -};
> -
> -union cvmx_ipd_sub_port_qos_cnt {
> -    uint64_t u64;
> -    struct cvmx_ipd_sub_port_qos_cnt_s {
> -        uint64_t cnt:32;
> -        uint64_t port_qos:9;
> -        uint64_t reserved_41_63:23;
> -    } s;
> -};
> -typedef struct {
> -    uint32_t dropped_octets;
> -    uint32_t dropped_packets;
> -    uint32_t pci_raw_packets;
> -    uint32_t octets;
> -    uint32_t packets;
> -    uint32_t multicast_packets;
> -    uint32_t broadcast_packets;
> -    uint32_t len_64_packets;
> -    uint32_t len_65_127_packets;
> -    uint32_t len_128_255_packets;
> -    uint32_t len_256_511_packets;
> -    uint32_t len_512_1023_packets;
> -    uint32_t len_1024_1518_packets;
> -    uint32_t len_1519_max_packets;
> -    uint32_t fcs_align_err_packets;
> -    uint32_t runt_packets;
> -    uint32_t runt_crc_packets;
> -    uint32_t oversize_packets;
> -    uint32_t oversize_crc_packets;
> -    uint32_t inb_packets;
> -    uint64_t inb_octets;
> -    uint16_t inb_errors;
> -} cvmx_pip_port_status_t;
> -
> -typedef struct {
> -    uint32_t packets;
> -    uint64_t octets;
> -    uint64_t doorbell;
> -} cvmx_pko_port_status_t;
> -
> -union cvmx_pip_frm_len_chkx {
> -    uint64_t u64;
> -    struct cvmx_pip_frm_len_chkx_s {
> -        uint64_t reserved_32_63:32;
> -        uint64_t maxlen:16;
> -        uint64_t minlen:16;
> -    } s;
> -};
> -
> -union cvmx_gmxx_rxx_frm_ctl {
> -    uint64_t u64;
> -    struct cvmx_gmxx_rxx_frm_ctl_s {
> -        uint64_t pre_chk:1;
> -        uint64_t pre_strp:1;
> -        uint64_t ctl_drp:1;
> -        uint64_t ctl_bck:1;
> -        uint64_t ctl_mcst:1;
> -        uint64_t ctl_smac:1;
> -        uint64_t pre_free:1;
> -        uint64_t vlan_len:1;
> -        uint64_t pad_len:1;
> -        uint64_t pre_align:1;
> -        uint64_t null_dis:1;
> -        uint64_t reserved_11_11:1;
> -        uint64_t ptp_mode:1;
> -        uint64_t reserved_13_63:51;
> -    } s;
> -    struct cvmx_gmxx_rxx_frm_ctl_cn30xx {
> -        uint64_t pre_chk:1;
> -        uint64_t pre_strp:1;
> -        uint64_t ctl_drp:1;
> -        uint64_t ctl_bck:1;
> -        uint64_t ctl_mcst:1;
> -        uint64_t ctl_smac:1;
> -        uint64_t pre_free:1;
> -        uint64_t vlan_len:1;
> -        uint64_t pad_len:1;
> -        uint64_t reserved_9_63:55;
> -    } cn30xx;
> -    struct cvmx_gmxx_rxx_frm_ctl_cn31xx {
> -        uint64_t pre_chk:1;
> -        uint64_t pre_strp:1;
> -        uint64_t ctl_drp:1;
> -        uint64_t ctl_bck:1;
> -        uint64_t ctl_mcst:1;
> -        uint64_t ctl_smac:1;
> -        uint64_t pre_free:1;
> -        uint64_t vlan_len:1;
> -        uint64_t reserved_8_63:56;
> -    } cn31xx;
> -    struct cvmx_gmxx_rxx_frm_ctl_cn50xx {
> -        uint64_t pre_chk:1;
> -        uint64_t pre_strp:1;
> -        uint64_t ctl_drp:1;
> -        uint64_t ctl_bck:1;
> -        uint64_t ctl_mcst:1;
> -        uint64_t ctl_smac:1;
> -        uint64_t pre_free:1;
> -        uint64_t reserved_7_8:2;
> -        uint64_t pre_align:1;
> -        uint64_t null_dis:1;
> -        uint64_t reserved_11_63:53;
> -    } cn50xx;
> -    struct cvmx_gmxx_rxx_frm_ctl_cn56xxp1 {
> -        uint64_t pre_chk:1;
> -        uint64_t pre_strp:1;
> -        uint64_t ctl_drp:1;
> -        uint64_t ctl_bck:1;
> -        uint64_t ctl_mcst:1;
> -        uint64_t ctl_smac:1;
> -        uint64_t pre_free:1;
> -        uint64_t reserved_7_8:2;
> -        uint64_t pre_align:1;
> -        uint64_t reserved_10_63:54;
> -    } cn56xxp1;
> -    struct cvmx_gmxx_rxx_frm_ctl_cn58xx {
> -        uint64_t pre_chk:1;
> -        uint64_t pre_strp:1;
> -        uint64_t ctl_drp:1;
> -        uint64_t ctl_bck:1;
> -        uint64_t ctl_mcst:1;
> -        uint64_t ctl_smac:1;
> -        uint64_t pre_free:1;
> -        uint64_t vlan_len:1;
> -        uint64_t pad_len:1;
> -        uint64_t pre_align:1;
> -        uint64_t null_dis:1;
> -        uint64_t reserved_11_63:53;
> -    } cn58xx;
> -    struct cvmx_gmxx_rxx_frm_ctl_cn61xx {
> -        uint64_t pre_chk:1;
> -        uint64_t pre_strp:1;
> -        uint64_t ctl_drp:1;
> -        uint64_t ctl_bck:1;
> -        uint64_t ctl_mcst:1;
> -        uint64_t ctl_smac:1;
> -        uint64_t pre_free:1;
> -        uint64_t reserved_7_8:2;
> -        uint64_t pre_align:1;
> -        uint64_t null_dis:1;
> -        uint64_t reserved_11_11:1;
> -        uint64_t ptp_mode:1;
> -        uint64_t reserved_13_63:51;
> -    } cn61xx;
> -};
> -
> -union cvmx_gmxx_rxx_int_reg {
> -    uint64_t u64;
> -    struct cvmx_gmxx_rxx_int_reg_s {
> -        uint64_t minerr:1;
> -        uint64_t carext:1;
> -        uint64_t maxerr:1;
> -        uint64_t jabber:1;
> -        uint64_t fcserr:1;
> -        uint64_t alnerr:1;
> -        uint64_t lenerr:1;
> -        uint64_t rcverr:1;
> -        uint64_t skperr:1;
> -        uint64_t niberr:1;
> -        uint64_t ovrerr:1;
> -        uint64_t pcterr:1;
> -        uint64_t rsverr:1;
> -        uint64_t falerr:1;
> -        uint64_t coldet:1;
> -        uint64_t ifgerr:1;
> -        uint64_t phy_link:1;
> -        uint64_t phy_spd:1;
> -        uint64_t phy_dupx:1;
> -        uint64_t pause_drp:1;
> -        uint64_t loc_fault:1;
> -        uint64_t rem_fault:1;
> -        uint64_t bad_seq:1;
> -        uint64_t bad_term:1;
> -        uint64_t unsop:1;
> -        uint64_t uneop:1;
> -        uint64_t undat:1;
> -        uint64_t hg2fld:1;
> -        uint64_t hg2cc:1;
> -        uint64_t reserved_29_63:35;
> -    } s;
> -    struct cvmx_gmxx_rxx_int_reg_cn30xx {
> -        uint64_t minerr:1;
> -        uint64_t carext:1;
> -        uint64_t maxerr:1;
> -        uint64_t jabber:1;
> -        uint64_t fcserr:1;
> -        uint64_t alnerr:1;
> -        uint64_t lenerr:1;
> -        uint64_t rcverr:1;
> -        uint64_t skperr:1;
> -        uint64_t niberr:1;
> -        uint64_t ovrerr:1;
> -        uint64_t pcterr:1;
> -        uint64_t rsverr:1;
> -        uint64_t falerr:1;
> -        uint64_t coldet:1;
> -        uint64_t ifgerr:1;
> -        uint64_t phy_link:1;
> -        uint64_t phy_spd:1;
> -        uint64_t phy_dupx:1;
> -        uint64_t reserved_19_63:45;
> -    } cn30xx;
> -    struct cvmx_gmxx_rxx_int_reg_cn50xx {
> -        uint64_t reserved_0_0:1;
> -        uint64_t carext:1;
> -        uint64_t reserved_2_2:1;
> -        uint64_t jabber:1;
> -        uint64_t fcserr:1;
> -        uint64_t alnerr:1;
> -        uint64_t reserved_6_6:1;
> -        uint64_t rcverr:1;
> -        uint64_t skperr:1;
> -        uint64_t niberr:1;
> -        uint64_t ovrerr:1;
> -        uint64_t pcterr:1;
> -        uint64_t rsverr:1;
> -        uint64_t falerr:1;
> -        uint64_t coldet:1;
> -        uint64_t ifgerr:1;
> -        uint64_t phy_link:1;
> -        uint64_t phy_spd:1;
> -        uint64_t phy_dupx:1;
> -        uint64_t pause_drp:1;
> -        uint64_t reserved_20_63:44;
> -    } cn50xx;
> -    struct cvmx_gmxx_rxx_int_reg_cn52xx {
> -        uint64_t reserved_0_0:1;
> -        uint64_t carext:1;
> -        uint64_t reserved_2_2:1;
> -        uint64_t jabber:1;
> -        uint64_t fcserr:1;
> -        uint64_t reserved_5_6:2;
> -        uint64_t rcverr:1;
> -        uint64_t skperr:1;
> -        uint64_t reserved_9_9:1;
> -        uint64_t ovrerr:1;
> -        uint64_t pcterr:1;
> -        uint64_t rsverr:1;
> -        uint64_t falerr:1;
> -        uint64_t coldet:1;
> -        uint64_t ifgerr:1;
> -        uint64_t reserved_16_18:3;
> -        uint64_t pause_drp:1;
> -        uint64_t loc_fault:1;
> -        uint64_t rem_fault:1;
> -        uint64_t bad_seq:1;
> -        uint64_t bad_term:1;
> -        uint64_t unsop:1;
> -        uint64_t uneop:1;
> -        uint64_t undat:1;
> -        uint64_t hg2fld:1;
> -        uint64_t hg2cc:1;
> -        uint64_t reserved_29_63:35;
> -    } cn52xx;
> -    struct cvmx_gmxx_rxx_int_reg_cn56xxp1 {
> -        uint64_t reserved_0_0:1;
> -        uint64_t carext:1;
> -        uint64_t reserved_2_2:1;
> -        uint64_t jabber:1;
> -        uint64_t fcserr:1;
> -        uint64_t reserved_5_6:2;
> -        uint64_t rcverr:1;
> -        uint64_t skperr:1;
> -        uint64_t reserved_9_9:1;
> -        uint64_t ovrerr:1;
> -        uint64_t pcterr:1;
> -        uint64_t rsverr:1;
> -        uint64_t falerr:1;
> -        uint64_t coldet:1;
> -        uint64_t ifgerr:1;
> -        uint64_t reserved_16_18:3;
> -        uint64_t pause_drp:1;
> -        uint64_t loc_fault:1;
> -        uint64_t rem_fault:1;
> -        uint64_t bad_seq:1;
> -        uint64_t bad_term:1;
> -        uint64_t unsop:1;
> -        uint64_t uneop:1;
> -        uint64_t undat:1;
> -        uint64_t reserved_27_63:37;
> -    } cn56xxp1;
> -    struct cvmx_gmxx_rxx_int_reg_cn58xx {
> -        uint64_t minerr:1;
> -        uint64_t carext:1;
> -        uint64_t maxerr:1;
> -        uint64_t jabber:1;
> -        uint64_t fcserr:1;
> -        uint64_t alnerr:1;
> -        uint64_t lenerr:1;
> -        uint64_t rcverr:1;
> -        uint64_t skperr:1;
> -        uint64_t niberr:1;
> -        uint64_t ovrerr:1;
> -        uint64_t pcterr:1;
> -        uint64_t rsverr:1;
> -        uint64_t falerr:1;
> -        uint64_t coldet:1;
> -        uint64_t ifgerr:1;
> -        uint64_t phy_link:1;
> -        uint64_t phy_spd:1;
> -        uint64_t phy_dupx:1;
> -        uint64_t pause_drp:1;
> -        uint64_t reserved_20_63:44;
> -    } cn58xx;
> -    struct cvmx_gmxx_rxx_int_reg_cn61xx {
> -        uint64_t minerr:1;
> -        uint64_t carext:1;
> -        uint64_t reserved_2_2:1;
> -        uint64_t jabber:1;
> -        uint64_t fcserr:1;
> -        uint64_t reserved_5_6:2;
> -        uint64_t rcverr:1;
> -        uint64_t skperr:1;
> -        uint64_t reserved_9_9:1;
> -        uint64_t ovrerr:1;
> -        uint64_t pcterr:1;
> -        uint64_t rsverr:1;
> -        uint64_t falerr:1;
> -        uint64_t coldet:1;
> -        uint64_t ifgerr:1;
> -        uint64_t reserved_16_18:3;
> -        uint64_t pause_drp:1;
> -        uint64_t loc_fault:1;
> -        uint64_t rem_fault:1;
> -        uint64_t bad_seq:1;
> -        uint64_t bad_term:1;
> -        uint64_t unsop:1;
> -        uint64_t uneop:1;
> -        uint64_t undat:1;
> -        uint64_t hg2fld:1;
> -        uint64_t hg2cc:1;
> -        uint64_t reserved_29_63:35;
> -    } cn61xx;
> -};
> -
> -union cvmx_gmxx_prtx_cfg {
> -    uint64_t u64;
> -    struct cvmx_gmxx_prtx_cfg_s {
> -        uint64_t reserved_22_63:42;
> -        uint64_t pknd:6;
> -        uint64_t reserved_14_15:2;
> -        uint64_t tx_idle:1;
> -        uint64_t rx_idle:1;
> -        uint64_t reserved_9_11:3;
> -        uint64_t speed_msb:1;
> -        uint64_t reserved_4_7:4;
> -        uint64_t slottime:1;
> -        uint64_t duplex:1;
> -        uint64_t speed:1;
> -        uint64_t en:1;
> -    } s;
> -    struct cvmx_gmxx_prtx_cfg_cn30xx {
> -        uint64_t reserved_4_63:60;
> -        uint64_t slottime:1;
> -        uint64_t duplex:1;
> -        uint64_t speed:1;
> -        uint64_t en:1;
> -    } cn30xx;
> -    struct cvmx_gmxx_prtx_cfg_cn52xx {
> -        uint64_t reserved_14_63:50;
> -        uint64_t tx_idle:1;
> -        uint64_t rx_idle:1;
> -        uint64_t reserved_9_11:3;
> -        uint64_t speed_msb:1;
> -        uint64_t reserved_4_7:4;
> -        uint64_t slottime:1;
> -        uint64_t duplex:1;
> -        uint64_t speed:1;
> -        uint64_t en:1;
> -    } cn52xx;
> -};
> -
> -union cvmx_gmxx_rxx_adr_ctl {
> -    uint64_t u64;
> -    struct cvmx_gmxx_rxx_adr_ctl_s {
> -        uint64_t reserved_4_63:60;
> -        uint64_t cam_mode:1;
> -        uint64_t mcst:2;
> -        uint64_t bcst:1;
> -    } s;
> -};
> -
> -union cvmx_pip_prt_tagx {
> -    uint64_t u64;
> -    struct cvmx_pip_prt_tagx_s {
> -        uint64_t reserved_54_63:10;
> -        uint64_t portadd_en:1;
> -        uint64_t inc_hwchk:1;
> -        uint64_t reserved_50_51:2;
> -        uint64_t grptagbase_msb:2;
> -        uint64_t reserved_46_47:2;
> -        uint64_t grptagmask_msb:2;
> -        uint64_t reserved_42_43:2;
> -        uint64_t grp_msb:2;
> -        uint64_t grptagbase:4;
> -        uint64_t grptagmask:4;
> -        uint64_t grptag:1;
> -        uint64_t grptag_mskip:1;
> -        uint64_t tag_mode:2;
> -        uint64_t inc_vs:2;
> -        uint64_t inc_vlan:1;
> -        uint64_t inc_prt_flag:1;
> -        uint64_t ip6_dprt_flag:1;
> -        uint64_t ip4_dprt_flag:1;
> -        uint64_t ip6_sprt_flag:1;
> -        uint64_t ip4_sprt_flag:1;
> -        uint64_t ip6_nxth_flag:1;
> -        uint64_t ip4_pctl_flag:1;
> -        uint64_t ip6_dst_flag:1;
> -        uint64_t ip4_dst_flag:1;
> -        uint64_t ip6_src_flag:1;
> -        uint64_t ip4_src_flag:1;
> -        uint64_t tcp6_tag_type:2;
> -        uint64_t tcp4_tag_type:2;
> -        uint64_t ip6_tag_type:2;
> -        uint64_t ip4_tag_type:2;
> -        uint64_t non_tag_type:2;
> -        uint64_t grp:4;
> -    } s;
> -    struct cvmx_pip_prt_tagx_cn30xx {
> -        uint64_t reserved_40_63:24;
> -        uint64_t grptagbase:4;
> -        uint64_t grptagmask:4;
> -        uint64_t grptag:1;
> -        uint64_t reserved_30_30:1;
> -        uint64_t tag_mode:2;
> -        uint64_t inc_vs:2;
> -        uint64_t inc_vlan:1;
> -        uint64_t inc_prt_flag:1;
> -        uint64_t ip6_dprt_flag:1;
> -        uint64_t ip4_dprt_flag:1;
> -        uint64_t ip6_sprt_flag:1;
> -        uint64_t ip4_sprt_flag:1;
> -        uint64_t ip6_nxth_flag:1;
> -        uint64_t ip4_pctl_flag:1;
> -        uint64_t ip6_dst_flag:1;
> -        uint64_t ip4_dst_flag:1;
> -        uint64_t ip6_src_flag:1;
> -        uint64_t ip4_src_flag:1;
> -        uint64_t tcp6_tag_type:2;
> -        uint64_t tcp4_tag_type:2;
> -        uint64_t ip6_tag_type:2;
> -        uint64_t ip4_tag_type:2;
> -        uint64_t non_tag_type:2;
> -        uint64_t grp:4;
> -    } cn30xx;
> -    struct cvmx_pip_prt_tagx_cn50xx {
> -        uint64_t reserved_40_63:24;
> -        uint64_t grptagbase:4;
> -        uint64_t grptagmask:4;
> -        uint64_t grptag:1;
> -        uint64_t grptag_mskip:1;
> -        uint64_t tag_mode:2;
> -        uint64_t inc_vs:2;
> -        uint64_t inc_vlan:1;
> -        uint64_t inc_prt_flag:1;
> -        uint64_t ip6_dprt_flag:1;
> -        uint64_t ip4_dprt_flag:1;
> -        uint64_t ip6_sprt_flag:1;
> -        uint64_t ip4_sprt_flag:1;
> -        uint64_t ip6_nxth_flag:1;
> -        uint64_t ip4_pctl_flag:1;
> -        uint64_t ip6_dst_flag:1;
> -        uint64_t ip4_dst_flag:1;
> -        uint64_t ip6_src_flag:1;
> -        uint64_t ip4_src_flag:1;
> -        uint64_t tcp6_tag_type:2;
> -        uint64_t tcp4_tag_type:2;
> -        uint64_t ip6_tag_type:2;
> -        uint64_t ip4_tag_type:2;
> -        uint64_t non_tag_type:2;
> -        uint64_t grp:4;
> -    } cn50xx;
> -};
> -
> -union cvmx_spxx_int_reg {
> -    uint64_t u64;
> -    struct cvmx_spxx_int_reg_s {
> -        uint64_t reserved_32_63:32;
> -        uint64_t spf:1;
> -        uint64_t reserved_12_30:19;
> -        uint64_t calerr:1;
> -        uint64_t syncerr:1;
> -        uint64_t diperr:1;
> -        uint64_t tpaovr:1;
> -        uint64_t rsverr:1;
> -        uint64_t drwnng:1;
> -        uint64_t clserr:1;
> -        uint64_t spiovr:1;
> -        uint64_t reserved_2_3:2;
> -        uint64_t abnorm:1;
> -        uint64_t prtnxa:1;
> -    } s;
> -};
> -
> -union cvmx_spxx_int_msk {
> -    uint64_t u64;
> -    struct cvmx_spxx_int_msk_s {
> -        uint64_t reserved_12_63:52;
> -        uint64_t calerr:1;
> -        uint64_t syncerr:1;
> -        uint64_t diperr:1;
> -        uint64_t tpaovr:1;
> -        uint64_t rsverr:1;
> -        uint64_t drwnng:1;
> -        uint64_t clserr:1;
> -        uint64_t spiovr:1;
> -        uint64_t reserved_2_3:2;
> -        uint64_t abnorm:1;
> -        uint64_t prtnxa:1;
> -    } s;
> -};
> -
> -union cvmx_pow_wq_int {
> -    uint64_t u64;
> -    struct cvmx_pow_wq_int_s {
> -        uint64_t wq_int:16;
> -        uint64_t iq_dis:16;
> -        uint64_t reserved_32_63:32;
> -    } s;
> -};
> -
> -union cvmx_sso_wq_int_thrx {
> -    uint64_t u64;
> -    struct {
> -        uint64_t iq_thr:12;
> -        uint64_t reserved_12_13:2;
> -        uint64_t ds_thr:12;
> -        uint64_t reserved_26_27:2;
> -        uint64_t tc_thr:4;
> -        uint64_t tc_en:1;
> -        uint64_t reserved_33_63:31;
> -    } s;
> -};
> -
> -union cvmx_stxx_int_reg {
> -    uint64_t u64;
> -    struct cvmx_stxx_int_reg_s {
> -        uint64_t reserved_9_63:55;
> -        uint64_t syncerr:1;
> -        uint64_t frmerr:1;
> -        uint64_t unxfrm:1;
> -        uint64_t nosync:1;
> -        uint64_t diperr:1;
> -        uint64_t datovr:1;
> -        uint64_t ovrbst:1;
> -        uint64_t calpar1:1;
> -        uint64_t calpar0:1;
> -    } s;
> -};
> -
> -union cvmx_stxx_int_msk {
> -    uint64_t u64;
> -    struct cvmx_stxx_int_msk_s {
> -        uint64_t reserved_8_63:56;
> -        uint64_t frmerr:1;
> -        uint64_t unxfrm:1;
> -        uint64_t nosync:1;
> -        uint64_t diperr:1;
> -        uint64_t datovr:1;
> -        uint64_t ovrbst:1;
> -        uint64_t calpar1:1;
> -        uint64_t calpar0:1;
> -    } s;
> -};
> -
> -union cvmx_pow_wq_int_pc {
> -    uint64_t u64;
> -    struct cvmx_pow_wq_int_pc_s {
> -        uint64_t reserved_0_7:8;
> -        uint64_t pc_thr:20;
> -        uint64_t reserved_28_31:4;
> -        uint64_t pc:28;
> -        uint64_t reserved_60_63:4;
> -    } s;
> -};
> -
> -union cvmx_pow_wq_int_thrx {
> -    uint64_t u64;
> -    struct cvmx_pow_wq_int_thrx_s {
> -        uint64_t reserved_29_63:35;
> -        uint64_t tc_en:1;
> -        uint64_t tc_thr:4;
> -        uint64_t reserved_23_23:1;
> -        uint64_t ds_thr:11;
> -        uint64_t reserved_11_11:1;
> -        uint64_t iq_thr:11;
> -    } s;
> -    struct cvmx_pow_wq_int_thrx_cn30xx {
> -        uint64_t reserved_29_63:35;
> -        uint64_t tc_en:1;
> -        uint64_t tc_thr:4;
> -        uint64_t reserved_18_23:6;
> -        uint64_t ds_thr:6;
> -        uint64_t reserved_6_11:6;
> -        uint64_t iq_thr:6;
> -    } cn30xx;
> -    struct cvmx_pow_wq_int_thrx_cn31xx {
> -        uint64_t reserved_29_63:35;
> -        uint64_t tc_en:1;
> -        uint64_t tc_thr:4;
> -        uint64_t reserved_20_23:4;
> -        uint64_t ds_thr:8;
> -        uint64_t reserved_8_11:4;
> -        uint64_t iq_thr:8;
> -    } cn31xx;
> -    struct cvmx_pow_wq_int_thrx_cn52xx {
> -        uint64_t reserved_29_63:35;
> -        uint64_t tc_en:1;
> -        uint64_t tc_thr:4;
> -        uint64_t reserved_21_23:3;
> -        uint64_t ds_thr:9;
> -        uint64_t reserved_9_11:3;
> -        uint64_t iq_thr:9;
> -    } cn52xx;
> -    struct cvmx_pow_wq_int_thrx_cn63xx {
> -        uint64_t reserved_29_63:35;
> -        uint64_t tc_en:1;
> -        uint64_t tc_thr:4;
> -        uint64_t reserved_22_23:2;
> -        uint64_t ds_thr:10;
> -        uint64_t reserved_10_11:2;
> -        uint64_t iq_thr:10;
> -    } cn63xx;
> -};
> -
> -union cvmx_npi_rsl_int_blocks {
> -    uint64_t u64;
> -    struct cvmx_npi_rsl_int_blocks_s {
> -        uint64_t reserved_32_63:32;
> -        uint64_t rint_31:1;
> -        uint64_t iob:1;
> -        uint64_t reserved_28_29:2;
> -        uint64_t rint_27:1;
> -        uint64_t rint_26:1;
> -        uint64_t rint_25:1;
> -        uint64_t rint_24:1;
> -        uint64_t asx1:1;
> -        uint64_t asx0:1;
> -        uint64_t rint_21:1;
> -        uint64_t pip:1;
> -        uint64_t spx1:1;
> -        uint64_t spx0:1;
> -        uint64_t lmc:1;
> -        uint64_t l2c:1;
> -        uint64_t rint_15:1;
> -        uint64_t reserved_13_14:2;
> -        uint64_t pow:1;
> -        uint64_t tim:1;
> -        uint64_t pko:1;
> -        uint64_t ipd:1;
> -        uint64_t rint_8:1;
> -        uint64_t zip:1;
> -        uint64_t dfa:1;
> -        uint64_t fpa:1;
> -        uint64_t key:1;
> -        uint64_t npi:1;
> -        uint64_t gmx1:1;
> -        uint64_t gmx0:1;
> -        uint64_t mio:1;
> -    } s;
> -    struct cvmx_npi_rsl_int_blocks_cn30xx {
> -        uint64_t reserved_32_63:32;
> -        uint64_t rint_31:1;
> -        uint64_t iob:1;
> -        uint64_t rint_29:1;
> -        uint64_t rint_28:1;
> -        uint64_t rint_27:1;
> -        uint64_t rint_26:1;
> -        uint64_t rint_25:1;
> -        uint64_t rint_24:1;
> -        uint64_t asx1:1;
> -        uint64_t asx0:1;
> -        uint64_t rint_21:1;
> -        uint64_t pip:1;
> -        uint64_t spx1:1;
> -        uint64_t spx0:1;
> -        uint64_t lmc:1;
> -        uint64_t l2c:1;
> -        uint64_t rint_15:1;
> -        uint64_t rint_14:1;
> -        uint64_t usb:1;
> -        uint64_t pow:1;
> -        uint64_t tim:1;
> -        uint64_t pko:1;
> -        uint64_t ipd:1;
> -        uint64_t rint_8:1;
> -        uint64_t zip:1;
> -        uint64_t dfa:1;
> -        uint64_t fpa:1;
> -        uint64_t key:1;
> -        uint64_t npi:1;
> -        uint64_t gmx1:1;
> -        uint64_t gmx0:1;
> -        uint64_t mio:1;
> -    } cn30xx;
> -    struct cvmx_npi_rsl_int_blocks_cn38xx {
> -        uint64_t reserved_32_63:32;
> -        uint64_t rint_31:1;
> -        uint64_t iob:1;
> -        uint64_t rint_29:1;
> -        uint64_t rint_28:1;
> -        uint64_t rint_27:1;
> -        uint64_t rint_26:1;
> -        uint64_t rint_25:1;
> -        uint64_t rint_24:1;
> -        uint64_t asx1:1;
> -        uint64_t asx0:1;
> -        uint64_t rint_21:1;
> -        uint64_t pip:1;
> -        uint64_t spx1:1;
> -        uint64_t spx0:1;
> -        uint64_t lmc:1;
> -        uint64_t l2c:1;
> -        uint64_t rint_15:1;
> -        uint64_t rint_14:1;
> -        uint64_t rint_13:1;
> -        uint64_t pow:1;
> -        uint64_t tim:1;
> -        uint64_t pko:1;
> -        uint64_t ipd:1;
> -        uint64_t rint_8:1;
> -        uint64_t zip:1;
> -        uint64_t dfa:1;
> -        uint64_t fpa:1;
> -        uint64_t key:1;
> -        uint64_t npi:1;
> -        uint64_t gmx1:1;
> -        uint64_t gmx0:1;
> -        uint64_t mio:1;
> -    } cn38xx;
> -    struct cvmx_npi_rsl_int_blocks_cn50xx {
> -        uint64_t reserved_31_63:33;
> -        uint64_t iob:1;
> -        uint64_t lmc1:1;
> -        uint64_t agl:1;
> -        uint64_t reserved_24_27:4;
> -        uint64_t asx1:1;
> -        uint64_t asx0:1;
> -        uint64_t reserved_21_21:1;
> -        uint64_t pip:1;
> -        uint64_t spx1:1;
> -        uint64_t spx0:1;
> -        uint64_t lmc:1;
> -        uint64_t l2c:1;
> -        uint64_t reserved_15_15:1;
> -        uint64_t rad:1;
> -        uint64_t usb:1;
> -        uint64_t pow:1;
> -        uint64_t tim:1;
> -        uint64_t pko:1;
> -        uint64_t ipd:1;
> -        uint64_t reserved_8_8:1;
> -        uint64_t zip:1;
> -        uint64_t dfa:1;
> -        uint64_t fpa:1;
> -        uint64_t key:1;
> -        uint64_t npi:1;
> -        uint64_t gmx1:1;
> -        uint64_t gmx0:1;
> -        uint64_t mio:1;
> -    } cn50xx;
> -};
> -
> -union cvmx_pko_command_word0 {
> -    uint64_t u64;
> -    struct {
> -        uint64_t total_bytes:16;
> -        uint64_t segs:6;
> -        uint64_t dontfree:1;
> -        uint64_t ignore_i:1;
> -        uint64_t ipoffp1:7;
> -        uint64_t gather:1;
> -        uint64_t rsp:1;
> -        uint64_t wqp:1;
> -        uint64_t n2:1;
> -        uint64_t le:1;
> -        uint64_t reg0:11;
> -        uint64_t subone0:1;
> -        uint64_t reg1:11;
> -        uint64_t subone1:1;
> -        uint64_t size0:2;
> -        uint64_t size1:2;
> -    } s;
> -};
> -
> -union cvmx_ciu_timx {
> -    uint64_t u64;
> -    struct cvmx_ciu_timx_s {
> -        uint64_t reserved_37_63:27;
> -        uint64_t one_shot:1;
> -        uint64_t len:36;
> -    } s;
> -};
> -
> -union cvmx_gmxx_rxx_rx_inbnd {
> -    uint64_t u64;
> -    struct cvmx_gmxx_rxx_rx_inbnd_s {
> -        uint64_t status:1;
> -        uint64_t speed:2;
> -        uint64_t duplex:1;
> -        uint64_t reserved_4_63:60;
> -    } s;
> -};
> -
> -static inline int32_t cvmx_fau_fetch_and_add32(enum cvmx_fau_reg_32 reg,
> -                           int32_t value)
> -{
> -    return value;
> -}
> -
> -static inline void cvmx_fau_atomic_add32(enum cvmx_fau_reg_32 reg,
> -                     int32_t value)
> -{ }
> -
> -static inline void cvmx_fau_atomic_write32(enum cvmx_fau_reg_32 reg,
> -                       int32_t value)
> -{ }
> -
> -static inline uint64_t cvmx_scratch_read64(uint64_t address)
> -{
> -    return 0;
> -}
> -
> -static inline void cvmx_scratch_write64(uint64_t address, uint64_t value)
> -{ }
> -
> -static inline int cvmx_wqe_get_grp(struct cvmx_wqe *work)
> -{
> -    return 0;
> -}
> -
> -static inline void *cvmx_phys_to_ptr(uint64_t physical_address)
> -{
> -    return (void *)(uintptr_t)(physical_address);
> -}
> -
> -static inline uint64_t cvmx_ptr_to_phys(void *ptr)
> -{
> -    return (unsigned long)ptr;
> -}
> -
> -static inline int cvmx_helper_get_interface_num(int ipd_port)
> -{
> -    return ipd_port;
> -}
> -
> -static inline int cvmx_helper_get_interface_index_num(int ipd_port)
> -{
> -    return ipd_port;
> -}
> -
> -static inline void cvmx_fpa_enable(void)
> -{ }
> -
> -static inline uint64_t cvmx_read_csr(uint64_t csr_addr)
> -{
> -    return 0;
> -}
> -
> -static inline void cvmx_write_csr(uint64_t csr_addr, uint64_t val)
> -{ }
> -
> -static inline int cvmx_helper_setup_red(int pass_thresh, int drop_thresh)
> -{
> -    return 0;
> -}
> -
> -static inline void *cvmx_fpa_alloc(uint64_t pool)
> -{
> -    return NULL;
> -}
> -
> -static inline void cvmx_fpa_free(void *ptr, uint64_t pool,
> -                 uint64_t num_cache_lines)
> -{ }
> -
> -static inline int octeon_is_simulation(void)
> -{
> -    return 1;
> -}
> -
> -static inline void cvmx_pip_get_port_status(uint64_t port_num, uint64_t clear,
> -                        cvmx_pip_port_status_t *status)
> -{ }
> -
> -static inline void cvmx_pko_get_port_status(uint64_t port_num, uint64_t clear,
> -                        cvmx_pko_port_status_t *status)
> -{ }
> -
> -static inline cvmx_helper_interface_mode_t cvmx_helper_interface_get_mode(int
> -                                   interface)
> -{
> -    return 0;
> -}
> -
> -static inline union cvmx_helper_link_info cvmx_helper_link_get(int ipd_port)
> -{
> -    union cvmx_helper_link_info ret = { .u64 = 0 };
> -
> -    return ret;
> -}
> -
> -static inline int cvmx_helper_link_set(int ipd_port,
> -                       union cvmx_helper_link_info link_info)
> -{
> -    return 0;
> -}
> -
> -static inline int cvmx_helper_initialize_packet_io_global(void)
> -{
> -    return 0;
> -}
> -
> -static inline int cvmx_helper_get_number_of_interfaces(void)
> -{
> -    return 2;
> -}
> -
> -static inline int cvmx_helper_ports_on_interface(int interface)
> -{
> -    return 1;
> -}
> -
> -static inline int cvmx_helper_get_ipd_port(int interface, int port)
> -{
> -    return 0;
> -}
> -
> -static inline int cvmx_helper_ipd_and_packet_input_enable(void)
> -{
> -    return 0;
> -}
> -
> -static inline void cvmx_ipd_disable(void)
> -{ }
> -
> -static inline void cvmx_ipd_free_ptr(void)
> -{ }
> -
> -static inline void cvmx_pko_disable(void)
> -{ }
> -
> -static inline void cvmx_pko_shutdown(void)
> -{ }
> -
> -static inline int cvmx_pko_get_base_queue_per_core(int port, int core)
> -{
> -    return port;
> -}
> -
> -static inline int cvmx_pko_get_base_queue(int port)
> -{
> -    return port;
> -}
> -
> -static inline int cvmx_pko_get_num_queues(int port)
> -{
> -    return port;
> -}
> -
> -static inline unsigned int cvmx_get_core_num(void)
> -{
> -    return 0;
> -}
> -
> -static inline void cvmx_pow_work_request_async_nocheck(int scr_addr,
> -                               cvmx_pow_wait_t wait)
> -{ }
> -
> -static inline void cvmx_pow_work_request_async(int scr_addr,
> -                               cvmx_pow_wait_t wait)
> -{ }
> -
> -static inline struct cvmx_wqe *cvmx_pow_work_response_async(int scr_addr)
> -{
> -    struct cvmx_wqe *wqe = (void *)(unsigned long)scr_addr;
> -
> -    return wqe;
> -}
> -
> -static inline struct cvmx_wqe *cvmx_pow_work_request_sync(cvmx_pow_wait_t wait)
> -{
> -    return (void *)(unsigned long)wait;
> -}
> -
> -static inline int cvmx_spi_restart_interface(int interface,
> -                    cvmx_spi_mode_t mode, int timeout)
> -{
> -    return 0;
> -}
> -
> -static inline void cvmx_fau_async_fetch_and_add32(uint64_t scraddr,
> -                          enum cvmx_fau_reg_32 reg,
> -                          int32_t value)
> -{ }
> -
> -static inline union cvmx_gmxx_rxx_rx_inbnd cvmx_spi4000_check_speed(
> -    int interface,
> -    int port)
> -{
> -    union cvmx_gmxx_rxx_rx_inbnd r;
> -
> -    r.u64 = 0;
> -    return r;
> -}
> -
> -static inline void cvmx_pko_send_packet_prepare(uint64_t port, uint64_t queue,
> -                        cvmx_pko_lock_t use_locking)
> -{ }
> -
> -static inline cvmx_pko_status_t cvmx_pko_send_packet_finish(uint64_t port,
> -        uint64_t queue, union cvmx_pko_command_word0 pko_command,
> -        union cvmx_buf_ptr packet, cvmx_pko_lock_t use_locking)
> -{
> -    return 0;
> -}
> -
> -static inline void cvmx_wqe_set_port(struct cvmx_wqe *work, int port)
> -{ }
> -
> -static inline void cvmx_wqe_set_qos(struct cvmx_wqe *work, int qos)
> -{ }
> -
> -static inline int cvmx_wqe_get_qos(struct cvmx_wqe *work)
> -{
> -    return 0;
> -}
> -
> -static inline void cvmx_wqe_set_grp(struct cvmx_wqe *work, int grp)
> -{ }
> -
> -static inline void cvmx_pow_work_submit(struct cvmx_wqe *wqp, uint32_t tag,
> -                    enum cvmx_pow_tag_type tag_type,
> -                    uint64_t qos, uint64_t grp)
> -{ }
> -
> -#define CVMX_ASXX_RX_CLK_SETX(a, b)    ((a)+(b))
> -#define CVMX_ASXX_TX_CLK_SETX(a, b)    ((a)+(b))
> -#define CVMX_CIU_TIMX(a)        (a)
> -#define CVMX_GMXX_RXX_ADR_CAM0(a, b)    ((a)+(b))
> -#define CVMX_GMXX_RXX_ADR_CAM1(a, b)    ((a)+(b))
> -#define CVMX_GMXX_RXX_ADR_CAM2(a, b)    ((a)+(b))
> -#define CVMX_GMXX_RXX_ADR_CAM3(a, b)    ((a)+(b))
> -#define CVMX_GMXX_RXX_ADR_CAM4(a, b)    ((a)+(b))
> -#define CVMX_GMXX_RXX_ADR_CAM5(a, b)    ((a)+(b))
> -#define CVMX_GMXX_RXX_FRM_CTL(a, b)    ((a)+(b))
> -#define CVMX_GMXX_RXX_INT_REG(a, b)    ((a)+(b))
> -#define CVMX_GMXX_SMACX(a, b)        ((a)+(b))
> -#define CVMX_PIP_PRT_TAGX(a)        (a)
> -#define CVMX_POW_PP_GRP_MSKX(a)        (a)
> -#define CVMX_POW_WQ_INT_THRX(a)        (a)
> -#define CVMX_SPXX_INT_MSK(a)        (a)
> -#define CVMX_SPXX_INT_REG(a)        (a)
> -#define CVMX_SSO_PPX_GRP_MSK(a)        (a)
> -#define CVMX_SSO_WQ_INT_THRX(a)        (a)
> -#define CVMX_STXX_INT_MSK(a)        (a)
> -#define CVMX_STXX_INT_REG(a)        (a)
> -- 
> 2.24.0
> 


^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 1/2] staging: octeon: delete driver
@ 2019-12-10 11:40   ` Sandro Volery
  0 siblings, 0 replies; 59+ messages in thread
From: Sandro Volery @ 2019-12-10 11:40 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, Branden Bonaby, Giovanni Gherdovich, Paul Burton,
	Aaro Koskinen, Florian Westphal, YueHaibing, linux-kernel,
	Matthew Wilcox (Oracle),
	David Daney, Julia Lawall, Geert Uytterhoeven, Dan Carpenter,
	Valery Ivanov, Petr Štetiar, David S. Miller, Guenter Roeck,
	Wambui Karuga

Doesn't octeon have drivers out of staging already?
What is this module for?

Sandro V

> On 10 Dec 2019, at 10:15, Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
> 
> This driver has been in the tree since 2009 with no real movement to get
> it out.  Now it is starting to cause build issues and other problems for
> people who want to fix coding style problems, but can not actually build
> it.
> 
> As nothing is happening here, just delete the module entirely.
> 
> Reported-by: Guenter Roeck <linux@roeck-us.net>
> Cc: David Daney <ddaney@caviumnetworks.com>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: YueHaibing <yuehaibing@huawei.com>
> Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
> Cc: Wambui Karuga <wambui.karugax@gmail.com>
> Cc: Julia Lawall <julia.lawall@lip6.fr>
> Cc: Florian Westphal <fw@strlen.de>
> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Branden Bonaby <brandonbonaby94@gmail.com>
> Cc: "Petr Štetiar" <ynezz@true.cz>
> Cc: Sandro Volery <sandro@volery.com>
> Cc: Paul Burton <paulburton@kernel.org>
> Cc: Dan Carpenter <dan.carpenter@oracle.com>
> Cc: Giovanni Gherdovich <bobdc9664@seznam.cz>
> Cc: Valery Ivanov <ivalery111@gmail.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> drivers/staging/Kconfig                   |    2 -
> drivers/staging/Makefile                  |    1 -
> drivers/staging/octeon/Kconfig            |   16 -
> drivers/staging/octeon/Makefile           |   19 -
> drivers/staging/octeon/TODO               |    9 -
> drivers/staging/octeon/ethernet-defines.h |   40 -
> drivers/staging/octeon/ethernet-mdio.c    |  178 ---
> drivers/staging/octeon/ethernet-mdio.h    |   28 -
> drivers/staging/octeon/ethernet-mem.c     |  154 ---
> drivers/staging/octeon/ethernet-mem.h     |    9 -
> drivers/staging/octeon/ethernet-rgmii.c   |  158 ---
> drivers/staging/octeon/ethernet-rx.c      |  538 --------
> drivers/staging/octeon/ethernet-rx.h      |   31 -
> drivers/staging/octeon/ethernet-sgmii.c   |   30 -
> drivers/staging/octeon/ethernet-spi.c     |  226 ----
> drivers/staging/octeon/ethernet-tx.c      |  717 -----------
> drivers/staging/octeon/ethernet-tx.h      |   14 -
> drivers/staging/octeon/ethernet-util.h    |   47 -
> drivers/staging/octeon/ethernet.c         |  992 --------------
> drivers/staging/octeon/octeon-ethernet.h  |  107 --
> drivers/staging/octeon/octeon-stubs.h     | 1433 ---------------------
> 21 files changed, 4749 deletions(-)
> delete mode 100644 drivers/staging/octeon/Kconfig
> delete mode 100644 drivers/staging/octeon/Makefile
> delete mode 100644 drivers/staging/octeon/TODO
> delete mode 100644 drivers/staging/octeon/ethernet-defines.h
> delete mode 100644 drivers/staging/octeon/ethernet-mdio.c
> delete mode 100644 drivers/staging/octeon/ethernet-mdio.h
> delete mode 100644 drivers/staging/octeon/ethernet-mem.c
> delete mode 100644 drivers/staging/octeon/ethernet-mem.h
> delete mode 100644 drivers/staging/octeon/ethernet-rgmii.c
> delete mode 100644 drivers/staging/octeon/ethernet-rx.c
> delete mode 100644 drivers/staging/octeon/ethernet-rx.h
> delete mode 100644 drivers/staging/octeon/ethernet-sgmii.c
> delete mode 100644 drivers/staging/octeon/ethernet-spi.c
> delete mode 100644 drivers/staging/octeon/ethernet-tx.c
> delete mode 100644 drivers/staging/octeon/ethernet-tx.h
> delete mode 100644 drivers/staging/octeon/ethernet-util.h
> delete mode 100644 drivers/staging/octeon/ethernet.c
> delete mode 100644 drivers/staging/octeon/octeon-ethernet.h
> delete mode 100644 drivers/staging/octeon/octeon-stubs.h
> 
> diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
> index eaf753b70ec5..15d3549e7cc7 100644
> --- a/drivers/staging/Kconfig
> +++ b/drivers/staging/Kconfig
> @@ -42,8 +42,6 @@ source "drivers/staging/rtl8188eu/Kconfig"
> 
> source "drivers/staging/rts5208/Kconfig"
> 
> -source "drivers/staging/octeon/Kconfig"
> -
> source "drivers/staging/octeon-usb/Kconfig"
> 
> source "drivers/staging/vt6655/Kconfig"
> diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
> index 0a4396c9067b..c521204220b5 100644
> --- a/drivers/staging/Makefile
> +++ b/drivers/staging/Makefile
> @@ -12,7 +12,6 @@ obj-$(CONFIG_R8712U)        += rtl8712/
> obj-$(CONFIG_R8188EU)        += rtl8188eu/
> obj-$(CONFIG_RTS5208)        += rts5208/
> obj-$(CONFIG_NETLOGIC_XLR_NET)    += netlogic/
> -obj-$(CONFIG_OCTEON_ETHERNET)    += octeon/
> obj-$(CONFIG_OCTEON_USB)    += octeon-usb/
> obj-$(CONFIG_VT6655)        += vt6655/
> obj-$(CONFIG_VT6656)        += vt6656/
> diff --git a/drivers/staging/octeon/Kconfig b/drivers/staging/octeon/Kconfig
> deleted file mode 100644
> index e7f4ddcc1361..000000000000
> --- a/drivers/staging/octeon/Kconfig
> +++ /dev/null
> @@ -1,16 +0,0 @@
> -# SPDX-License-Identifier: GPL-2.0
> -config OCTEON_ETHERNET
> -    tristate "Cavium Networks Octeon Ethernet support"
> -    depends on CAVIUM_OCTEON_SOC || COMPILE_TEST
> -    depends on NETDEVICES
> -    depends on BROKEN
> -    select PHYLIB
> -    select MDIO_OCTEON
> -    help
> -      This driver supports the builtin ethernet ports on Cavium
> -      Networks' products in the Octeon family. This driver supports the
> -      CN3XXX and CN5XXX Octeon processors.
> -
> -      To compile this driver as a module, choose M here.  The module
> -      will be called octeon-ethernet.
> -
> diff --git a/drivers/staging/octeon/Makefile b/drivers/staging/octeon/Makefile
> deleted file mode 100644
> index 3887cf5f1e84..000000000000
> --- a/drivers/staging/octeon/Makefile
> +++ /dev/null
> @@ -1,19 +0,0 @@
> -# SPDX-License-Identifier: GPL-2.0
> -#
> -# Copyright (C) 2005-2009 Cavium Networks
> -#
> -
> -#
> -# Makefile for Cavium OCTEON on-board ethernet driver
> -#
> -
> -obj-${CONFIG_OCTEON_ETHERNET} :=  octeon-ethernet.o
> -
> -octeon-ethernet-y := ethernet.o
> -octeon-ethernet-y += ethernet-mdio.o
> -octeon-ethernet-y += ethernet-mem.o
> -octeon-ethernet-y += ethernet-rgmii.o
> -octeon-ethernet-y += ethernet-rx.o
> -octeon-ethernet-y += ethernet-sgmii.o
> -octeon-ethernet-y += ethernet-spi.o
> -octeon-ethernet-y += ethernet-tx.o
> diff --git a/drivers/staging/octeon/TODO b/drivers/staging/octeon/TODO
> deleted file mode 100644
> index 67a0a1f6b922..000000000000
> --- a/drivers/staging/octeon/TODO
> +++ /dev/null
> @@ -1,9 +0,0 @@
> -This driver is functional and supports Ethernet on OCTEON+/OCTEON2/OCTEON3
> -chips at least up to CN7030.
> -
> -TODO:
> -    - general code review and clean up
> -    - make driver self-contained instead of being split between staging and
> -      arch/mips/cavium-octeon.
> -
> -Contact: Aaro Koskinen <aaro.koskinen@iki.fi>
> diff --git a/drivers/staging/octeon/ethernet-defines.h b/drivers/staging/octeon/ethernet-defines.h
> deleted file mode 100644
> index ef9e767b0e2e..000000000000
> --- a/drivers/staging/octeon/ethernet-defines.h
> +++ /dev/null
> @@ -1,40 +0,0 @@
> -/* SPDX-License-Identifier: GPL-2.0 */
> -/*
> - * This file is based on code from OCTEON SDK by Cavium Networks.
> - *
> - * Copyright (c) 2003-2007 Cavium Networks
> - */
> -
> -/*
> - * A few defines are used to control the operation of this driver:
> - *  USE_ASYNC_IOBDMA
> - *      Use asynchronous IO access to hardware. This uses Octeon's asynchronous
> - *      IOBDMAs to issue IO accesses without stalling. Set this to zero
> - *      to disable this. Note that IOBDMAs require CVMSEG.
> - *  REUSE_SKBUFFS_WITHOUT_FREE
> - *      Allows the TX path to free an skbuff into the FPA hardware pool. This
> - *      can significantly improve performance for forwarding and bridging, but
> - *      may be somewhat dangerous. Checks are made, but if any buffer is reused
> - *      without the proper Linux cleanup, the networking stack may have very
> - *      bizarre bugs.
> - */
> -#ifndef __ETHERNET_DEFINES_H__
> -#define __ETHERNET_DEFINES_H__
> -
> -#ifdef CONFIG_NETFILTER
> -#define REUSE_SKBUFFS_WITHOUT_FREE  0
> -#else
> -#define REUSE_SKBUFFS_WITHOUT_FREE  1
> -#endif
> -
> -#define USE_ASYNC_IOBDMA            (CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE > 0)
> -
> -/* Maximum number of SKBs to try to free per xmit packet. */
> -#define MAX_OUT_QUEUE_DEPTH 1000
> -
> -#define FAU_TOTAL_TX_TO_CLEAN (CVMX_FAU_REG_END - sizeof(u32))
> -#define FAU_NUM_PACKET_BUFFERS_TO_FREE (FAU_TOTAL_TX_TO_CLEAN - sizeof(u32))
> -
> -#define TOTAL_NUMBER_OF_PORTS       (CVMX_PIP_NUM_INPUT_PORTS + 1)
> -
> -#endif /* __ETHERNET_DEFINES_H__ */
> diff --git a/drivers/staging/octeon/ethernet-mdio.c b/drivers/staging/octeon/ethernet-mdio.c
> deleted file mode 100644
> index c798672d61b2..000000000000
> --- a/drivers/staging/octeon/ethernet-mdio.c
> +++ /dev/null
> @@ -1,178 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0
> -/*
> - * This file is based on code from OCTEON SDK by Cavium Networks.
> - *
> - * Copyright (c) 2003-2007 Cavium Networks
> - */
> -
> -#include <linux/kernel.h>
> -#include <linux/ethtool.h>
> -#include <linux/phy.h>
> -#include <linux/ratelimit.h>
> -#include <linux/of_mdio.h>
> -#include <generated/utsrelease.h>
> -#include <net/dst.h>
> -
> -#include "octeon-ethernet.h"
> -#include "ethernet-defines.h"
> -#include "ethernet-mdio.h"
> -#include "ethernet-util.h"
> -
> -static void cvm_oct_get_drvinfo(struct net_device *dev,
> -                struct ethtool_drvinfo *info)
> -{
> -    strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver));
> -    strlcpy(info->version, UTS_RELEASE, sizeof(info->version));
> -    strlcpy(info->bus_info, "Builtin", sizeof(info->bus_info));
> -}
> -
> -static int cvm_oct_nway_reset(struct net_device *dev)
> -{
> -    if (!capable(CAP_NET_ADMIN))
> -        return -EPERM;
> -
> -    if (dev->phydev)
> -        return phy_start_aneg(dev->phydev);
> -
> -    return -EINVAL;
> -}
> -
> -const struct ethtool_ops cvm_oct_ethtool_ops = {
> -    .get_drvinfo = cvm_oct_get_drvinfo,
> -    .nway_reset = cvm_oct_nway_reset,
> -    .get_link = ethtool_op_get_link,
> -    .get_link_ksettings = phy_ethtool_get_link_ksettings,
> -    .set_link_ksettings = phy_ethtool_set_link_ksettings,
> -};
> -
> -/**
> - * cvm_oct_ioctl - IOCTL support for PHY control
> - * @dev:    Device to change
> - * @rq:     the request
> - * @cmd:    the command
> - *
> - * Returns Zero on success
> - */
> -int cvm_oct_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
> -{
> -    if (!netif_running(dev))
> -        return -EINVAL;
> -
> -    if (!dev->phydev)
> -        return -EINVAL;
> -
> -    return phy_mii_ioctl(dev->phydev, rq, cmd);
> -}
> -
> -void cvm_oct_note_carrier(struct octeon_ethernet *priv,
> -              union cvmx_helper_link_info li)
> -{
> -    if (li.s.link_up) {
> -        pr_notice_ratelimited("%s: %u Mbps %s duplex, port %d, queue %d\n",
> -                      netdev_name(priv->netdev), li.s.speed,
> -                      (li.s.full_duplex) ? "Full" : "Half",
> -                      priv->port, priv->queue);
> -    } else {
> -        pr_notice_ratelimited("%s: Link down\n",
> -                      netdev_name(priv->netdev));
> -    }
> -}
> -
> -void cvm_oct_adjust_link(struct net_device *dev)
> -{
> -    struct octeon_ethernet *priv = netdev_priv(dev);
> -    union cvmx_helper_link_info link_info;
> -
> -    link_info.u64        = 0;
> -    link_info.s.link_up    = dev->phydev->link ? 1 : 0;
> -    link_info.s.full_duplex = dev->phydev->duplex ? 1 : 0;
> -    link_info.s.speed    = dev->phydev->speed;
> -    priv->link_info        = link_info.u64;
> -
> -    /*
> -     * The polling task need to know about link status changes.
> -     */
> -    if (priv->poll)
> -        priv->poll(dev);
> -
> -    if (priv->last_link != dev->phydev->link) {
> -        priv->last_link = dev->phydev->link;
> -        cvmx_helper_link_set(priv->port, link_info);
> -        cvm_oct_note_carrier(priv, link_info);
> -    }
> -}
> -
> -int cvm_oct_common_stop(struct net_device *dev)
> -{
> -    struct octeon_ethernet *priv = netdev_priv(dev);
> -    int interface = INTERFACE(priv->port);
> -    union cvmx_helper_link_info link_info;
> -    union cvmx_gmxx_prtx_cfg gmx_cfg;
> -    int index = INDEX(priv->port);
> -
> -    gmx_cfg.u64 = cvmx_read_csr(CVMX_GMXX_PRTX_CFG(index, interface));
> -    gmx_cfg.s.en = 0;
> -    cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface), gmx_cfg.u64);
> -
> -    priv->poll = NULL;
> -
> -    if (dev->phydev)
> -        phy_disconnect(dev->phydev);
> -
> -    if (priv->last_link) {
> -        link_info.u64 = 0;
> -        priv->last_link = 0;
> -
> -        cvmx_helper_link_set(priv->port, link_info);
> -        cvm_oct_note_carrier(priv, link_info);
> -    }
> -    return 0;
> -}
> -
> -/**
> - * cvm_oct_phy_setup_device - setup the PHY
> - *
> - * @dev:    Device to setup
> - *
> - * Returns Zero on success, negative on failure
> - */
> -int cvm_oct_phy_setup_device(struct net_device *dev)
> -{
> -    struct octeon_ethernet *priv = netdev_priv(dev);
> -    struct device_node *phy_node;
> -    struct phy_device *phydev = NULL;
> -
> -    if (!priv->of_node)
> -        goto no_phy;
> -
> -    phy_node = of_parse_phandle(priv->of_node, "phy-handle", 0);
> -    if (!phy_node && of_phy_is_fixed_link(priv->of_node)) {
> -        int rc;
> -
> -        rc = of_phy_register_fixed_link(priv->of_node);
> -        if (rc)
> -            return rc;
> -
> -        phy_node = of_node_get(priv->of_node);
> -    }
> -    if (!phy_node)
> -        goto no_phy;
> -
> -    phydev = of_phy_connect(dev, phy_node, cvm_oct_adjust_link, 0,
> -                priv->phy_mode);
> -    of_node_put(phy_node);
> -
> -    if (!phydev)
> -        return -ENODEV;
> -
> -    priv->last_link = 0;
> -    phy_start(phydev);
> -
> -    return 0;
> -no_phy:
> -    /* If there is no phy, assume a direct MAC connection and that
> -     * the link is up.
> -     */
> -    netif_carrier_on(dev);
> -    return 0;
> -}
> diff --git a/drivers/staging/octeon/ethernet-mdio.h b/drivers/staging/octeon/ethernet-mdio.h
> deleted file mode 100644
> index e3771d48c49b..000000000000
> --- a/drivers/staging/octeon/ethernet-mdio.h
> +++ /dev/null
> @@ -1,28 +0,0 @@
> -/* SPDX-License-Identifier: GPL-2.0 */
> -/*
> - * This file is based on code from OCTEON SDK by Cavium Networks.
> - *
> - * Copyright (c) 2003-2007 Cavium Networks
> - */
> -
> -#include <linux/module.h>
> -#include <linux/kernel.h>
> -#include <linux/netdevice.h>
> -#include <linux/etherdevice.h>
> -#include <linux/ip.h>
> -#include <linux/string.h>
> -#include <linux/ethtool.h>
> -#include <linux/seq_file.h>
> -#include <linux/proc_fs.h>
> -#include <net/dst.h>
> -#ifdef CONFIG_XFRM
> -#include <linux/xfrm.h>
> -#include <net/xfrm.h>
> -#endif /* CONFIG_XFRM */
> -
> -extern const struct ethtool_ops cvm_oct_ethtool_ops;
> -
> -void octeon_mdiobus_force_mod_depencency(void);
> -
> -int cvm_oct_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
> -int cvm_oct_phy_setup_device(struct net_device *dev);
> diff --git a/drivers/staging/octeon/ethernet-mem.c b/drivers/staging/octeon/ethernet-mem.c
> deleted file mode 100644
> index 532594957ebc..000000000000
> --- a/drivers/staging/octeon/ethernet-mem.c
> +++ /dev/null
> @@ -1,154 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0
> -/*
> - * This file is based on code from OCTEON SDK by Cavium Networks.
> - *
> - * Copyright (c) 2003-2010 Cavium Networks
> - */
> -
> -#include <linux/kernel.h>
> -#include <linux/netdevice.h>
> -#include <linux/slab.h>
> -
> -#include "octeon-ethernet.h"
> -#include "ethernet-mem.h"
> -#include "ethernet-defines.h"
> -
> -/**
> - * cvm_oct_fill_hw_skbuff - fill the supplied hardware pool with skbuffs
> - * @pool:     Pool to allocate an skbuff for
> - * @size:     Size of the buffer needed for the pool
> - * @elements: Number of buffers to allocate
> - *
> - * Returns the actual number of buffers allocated.
> - */
> -static int cvm_oct_fill_hw_skbuff(int pool, int size, int elements)
> -{
> -    int freed = elements;
> -
> -    while (freed) {
> -        struct sk_buff *skb = dev_alloc_skb(size + 256);
> -
> -        if (unlikely(!skb))
> -            break;
> -        skb_reserve(skb, 256 - (((unsigned long)skb->data) & 0x7f));
> -        *(struct sk_buff **)(skb->data - sizeof(void *)) = skb;
> -        cvmx_fpa_free(skb->data, pool, size / 128);
> -        freed--;
> -    }
> -    return elements - freed;
> -}
> -
> -/**
> - * cvm_oct_free_hw_skbuff- free hardware pool skbuffs
> - * @pool:     Pool to allocate an skbuff for
> - * @size:     Size of the buffer needed for the pool
> - * @elements: Number of buffers to allocate
> - */
> -static void cvm_oct_free_hw_skbuff(int pool, int size, int elements)
> -{
> -    char *memory;
> -
> -    do {
> -        memory = cvmx_fpa_alloc(pool);
> -        if (memory) {
> -            struct sk_buff *skb =
> -                *(struct sk_buff **)(memory - sizeof(void *));
> -            elements--;
> -            dev_kfree_skb(skb);
> -        }
> -    } while (memory);
> -
> -    if (elements < 0)
> -        pr_warn("Freeing of pool %u had too many skbuffs (%d)\n",
> -            pool, elements);
> -    else if (elements > 0)
> -        pr_warn("Freeing of pool %u is missing %d skbuffs\n",
> -            pool, elements);
> -}
> -
> -/**
> - * cvm_oct_fill_hw_memory - fill a hardware pool with memory.
> - * @pool:     Pool to populate
> - * @size:     Size of each buffer in the pool
> - * @elements: Number of buffers to allocate
> - *
> - * Returns the actual number of buffers allocated.
> - */
> -static int cvm_oct_fill_hw_memory(int pool, int size, int elements)
> -{
> -    char *memory;
> -    char *fpa;
> -    int freed = elements;
> -
> -    while (freed) {
> -        /*
> -         * FPA memory must be 128 byte aligned.  Since we are
> -         * aligning we need to save the original pointer so we
> -         * can feed it to kfree when the memory is returned to
> -         * the kernel.
> -         *
> -         * We allocate an extra 256 bytes to allow for
> -         * alignment and space for the original pointer saved
> -         * just before the block.
> -         */
> -        memory = kmalloc(size + 256, GFP_ATOMIC);
> -        if (unlikely(!memory)) {
> -            pr_warn("Unable to allocate %u bytes for FPA pool %d\n",
> -                elements * size, pool);
> -            break;
> -        }
> -        fpa = (char *)(((unsigned long)memory + 256) & ~0x7fUL);
> -        *((char **)fpa - 1) = memory;
> -        cvmx_fpa_free(fpa, pool, 0);
> -        freed--;
> -    }
> -    return elements - freed;
> -}
> -
> -/**
> - * cvm_oct_free_hw_memory - Free memory allocated by cvm_oct_fill_hw_memory
> - * @pool:     FPA pool to free
> - * @size:     Size of each buffer in the pool
> - * @elements: Number of buffers that should be in the pool
> - */
> -static void cvm_oct_free_hw_memory(int pool, int size, int elements)
> -{
> -    char *memory;
> -    char *fpa;
> -
> -    do {
> -        fpa = cvmx_fpa_alloc(pool);
> -        if (fpa) {
> -            elements--;
> -            fpa = (char *)phys_to_virt(cvmx_ptr_to_phys(fpa));
> -            memory = *((char **)fpa - 1);
> -            kfree(memory);
> -        }
> -    } while (fpa);
> -
> -    if (elements < 0)
> -        pr_warn("Freeing of pool %u had too many buffers (%d)\n",
> -            pool, elements);
> -    else if (elements > 0)
> -        pr_warn("Warning: Freeing of pool %u is missing %d buffers\n",
> -            pool, elements);
> -}
> -
> -int cvm_oct_mem_fill_fpa(int pool, int size, int elements)
> -{
> -    int freed;
> -
> -    if (pool == CVMX_FPA_PACKET_POOL)
> -        freed = cvm_oct_fill_hw_skbuff(pool, size, elements);
> -    else
> -        freed = cvm_oct_fill_hw_memory(pool, size, elements);
> -    return freed;
> -}
> -
> -void cvm_oct_mem_empty_fpa(int pool, int size, int elements)
> -{
> -    if (pool == CVMX_FPA_PACKET_POOL)
> -        cvm_oct_free_hw_skbuff(pool, size, elements);
> -    else
> -        cvm_oct_free_hw_memory(pool, size, elements);
> -}
> diff --git a/drivers/staging/octeon/ethernet-mem.h b/drivers/staging/octeon/ethernet-mem.h
> deleted file mode 100644
> index 692dcdb7154d..000000000000
> --- a/drivers/staging/octeon/ethernet-mem.h
> +++ /dev/null
> @@ -1,9 +0,0 @@
> -/* SPDX-License-Identifier: GPL-2.0 */
> -/*
> - * This file is based on code from OCTEON SDK by Cavium Networks.
> - *
> - * Copyright (c) 2003-2007 Cavium Networks
> - */
> -
> -int cvm_oct_mem_fill_fpa(int pool, int size, int elements);
> -void cvm_oct_mem_empty_fpa(int pool, int size, int elements);
> diff --git a/drivers/staging/octeon/ethernet-rgmii.c b/drivers/staging/octeon/ethernet-rgmii.c
> deleted file mode 100644
> index 0c4fac31540a..000000000000
> --- a/drivers/staging/octeon/ethernet-rgmii.c
> +++ /dev/null
> @@ -1,158 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0
> -/*
> - * This file is based on code from OCTEON SDK by Cavium Networks.
> - *
> - * Copyright (c) 2003-2007 Cavium Networks
> - */
> -
> -#include <linux/kernel.h>
> -#include <linux/netdevice.h>
> -#include <linux/interrupt.h>
> -#include <linux/phy.h>
> -#include <linux/ratelimit.h>
> -#include <net/dst.h>
> -
> -#include "octeon-ethernet.h"
> -#include "ethernet-defines.h"
> -#include "ethernet-util.h"
> -#include "ethernet-mdio.h"
> -
> -static DEFINE_SPINLOCK(global_register_lock);
> -
> -static void cvm_oct_set_hw_preamble(struct octeon_ethernet *priv, bool enable)
> -{
> -    union cvmx_gmxx_rxx_frm_ctl gmxx_rxx_frm_ctl;
> -    union cvmx_ipd_sub_port_fcs ipd_sub_port_fcs;
> -    union cvmx_gmxx_rxx_int_reg gmxx_rxx_int_reg;
> -    int interface = INTERFACE(priv->port);
> -    int index = INDEX(priv->port);
> -
> -    /* Set preamble checking. */
> -    gmxx_rxx_frm_ctl.u64 = cvmx_read_csr(CVMX_GMXX_RXX_FRM_CTL(index,
> -                                   interface));
> -    gmxx_rxx_frm_ctl.s.pre_chk = enable;
> -    cvmx_write_csr(CVMX_GMXX_RXX_FRM_CTL(index, interface),
> -               gmxx_rxx_frm_ctl.u64);
> -
> -    /* Set FCS stripping. */
> -    ipd_sub_port_fcs.u64 = cvmx_read_csr(CVMX_IPD_SUB_PORT_FCS);
> -    if (enable)
> -        ipd_sub_port_fcs.s.port_bit |= 1ull << priv->port;
> -    else
> -        ipd_sub_port_fcs.s.port_bit &=
> -                    0xffffffffull ^ (1ull << priv->port);
> -    cvmx_write_csr(CVMX_IPD_SUB_PORT_FCS, ipd_sub_port_fcs.u64);
> -
> -    /* Clear any error bits. */
> -    gmxx_rxx_int_reg.u64 = cvmx_read_csr(CVMX_GMXX_RXX_INT_REG(index,
> -                                   interface));
> -    cvmx_write_csr(CVMX_GMXX_RXX_INT_REG(index, interface),
> -               gmxx_rxx_int_reg.u64);
> -}
> -
> -static void cvm_oct_check_preamble_errors(struct net_device *dev)
> -{
> -    struct octeon_ethernet *priv = netdev_priv(dev);
> -    union cvmx_helper_link_info link_info;
> -    unsigned long flags;
> -
> -    link_info.u64 = priv->link_info;
> -
> -    /*
> -     * Take the global register lock since we are going to
> -     * touch registers that affect more than one port.
> -     */
> -    spin_lock_irqsave(&global_register_lock, flags);
> -
> -    if (link_info.s.speed == 10 && priv->last_speed == 10) {
> -        /*
> -         * Read the GMXX_RXX_INT_REG[PCTERR] bit and see if we are
> -         * getting preamble errors.
> -         */
> -        int interface = INTERFACE(priv->port);
> -        int index = INDEX(priv->port);
> -        union cvmx_gmxx_rxx_int_reg gmxx_rxx_int_reg;
> -
> -        gmxx_rxx_int_reg.u64 = cvmx_read_csr(CVMX_GMXX_RXX_INT_REG
> -                            (index, interface));
> -        if (gmxx_rxx_int_reg.s.pcterr) {
> -            /*
> -             * We are getting preamble errors at 10Mbps. Most
> -             * likely the PHY is giving us packets with misaligned
> -             * preambles. In order to get these packets we need to
> -             * disable preamble checking and do it in software.
> -             */
> -            cvm_oct_set_hw_preamble(priv, false);
> -            printk_ratelimited("%s: Using 10Mbps with software preamble removal\n",
> -                       dev->name);
> -        }
> -    } else {
> -        /*
> -         * Since the 10Mbps preamble workaround is allowed we need to
> -         * enable preamble checking, FCS stripping, and clear error
> -         * bits on every speed change. If errors occur during 10Mbps
> -         * operation the above code will change this stuff
> -         */
> -        if (priv->last_speed != link_info.s.speed)
> -            cvm_oct_set_hw_preamble(priv, true);
> -        priv->last_speed = link_info.s.speed;
> -    }
> -    spin_unlock_irqrestore(&global_register_lock, flags);
> -}
> -
> -static void cvm_oct_rgmii_poll(struct net_device *dev)
> -{
> -    struct octeon_ethernet *priv = netdev_priv(dev);
> -    union cvmx_helper_link_info link_info;
> -    bool status_change;
> -
> -    link_info = cvmx_helper_link_get(priv->port);
> -    if (priv->link_info != link_info.u64 &&
> -        cvmx_helper_link_set(priv->port, link_info))
> -        link_info.u64 = priv->link_info;
> -    status_change = priv->link_info != link_info.u64;
> -    priv->link_info = link_info.u64;
> -
> -    cvm_oct_check_preamble_errors(dev);
> -
> -    if (likely(!status_change))
> -        return;
> -
> -    /* Tell core. */
> -    if (link_info.s.link_up) {
> -        if (!netif_carrier_ok(dev))
> -            netif_carrier_on(dev);
> -    } else if (netif_carrier_ok(dev)) {
> -        netif_carrier_off(dev);
> -    }
> -    cvm_oct_note_carrier(priv, link_info);
> -}
> -
> -int cvm_oct_rgmii_open(struct net_device *dev)
> -{
> -    struct octeon_ethernet *priv = netdev_priv(dev);
> -    int ret;
> -
> -    ret = cvm_oct_common_open(dev, cvm_oct_rgmii_poll);
> -    if (ret)
> -        return ret;
> -
> -    if (dev->phydev) {
> -        /*
> -         * In phydev mode, we need still periodic polling for the
> -         * preamble error checking, and we also need to call this
> -         * function on every link state change.
> -         *
> -         * Only true RGMII ports need to be polled. In GMII mode, port
> -         * 0 is really a RGMII port.
> -         */
> -        if ((priv->imode == CVMX_HELPER_INTERFACE_MODE_GMII &&
> -             priv->port  == 0) ||
> -            (priv->imode == CVMX_HELPER_INTERFACE_MODE_RGMII)) {
> -            priv->poll = cvm_oct_check_preamble_errors;
> -            cvm_oct_check_preamble_errors(dev);
> -        }
> -    }
> -
> -    return 0;
> -}
> diff --git a/drivers/staging/octeon/ethernet-rx.c b/drivers/staging/octeon/ethernet-rx.c
> deleted file mode 100644
> index 2c16230f993c..000000000000
> --- a/drivers/staging/octeon/ethernet-rx.c
> +++ /dev/null
> @@ -1,538 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0
> -/*
> - * This file is based on code from OCTEON SDK by Cavium Networks.
> - *
> - * Copyright (c) 2003-2010 Cavium Networks
> - */
> -
> -#include <linux/module.h>
> -#include <linux/kernel.h>
> -#include <linux/cache.h>
> -#include <linux/cpumask.h>
> -#include <linux/netdevice.h>
> -#include <linux/etherdevice.h>
> -#include <linux/ip.h>
> -#include <linux/string.h>
> -#include <linux/prefetch.h>
> -#include <linux/ratelimit.h>
> -#include <linux/smp.h>
> -#include <linux/interrupt.h>
> -#include <net/dst.h>
> -#ifdef CONFIG_XFRM
> -#include <linux/xfrm.h>
> -#include <net/xfrm.h>
> -#endif /* CONFIG_XFRM */
> -
> -#include "octeon-ethernet.h"
> -#include "ethernet-defines.h"
> -#include "ethernet-mem.h"
> -#include "ethernet-rx.h"
> -#include "ethernet-util.h"
> -
> -static atomic_t oct_rx_ready = ATOMIC_INIT(0);
> -
> -static struct oct_rx_group {
> -    int irq;
> -    int group;
> -    struct napi_struct napi;
> -} oct_rx_group[16];
> -
> -/**
> - * cvm_oct_do_interrupt - interrupt handler.
> - * @irq: Interrupt number.
> - * @napi_id: Cookie to identify the NAPI instance.
> - *
> - * The interrupt occurs whenever the POW has packets in our group.
> - *
> - */
> -static irqreturn_t cvm_oct_do_interrupt(int irq, void *napi_id)
> -{
> -    /* Disable the IRQ and start napi_poll. */
> -    disable_irq_nosync(irq);
> -    napi_schedule(napi_id);
> -
> -    return IRQ_HANDLED;
> -}
> -
> -/**
> - * cvm_oct_check_rcv_error - process receive errors
> - * @work: Work queue entry pointing to the packet.
> - *
> - * Returns Non-zero if the packet can be dropped, zero otherwise.
> - */
> -static inline int cvm_oct_check_rcv_error(struct cvmx_wqe *work)
> -{
> -    int port;
> -
> -    if (octeon_has_feature(OCTEON_FEATURE_PKND))
> -        port = work->word0.pip.cn68xx.pknd;
> -    else
> -        port = work->word1.cn38xx.ipprt;
> -
> -    if ((work->word2.snoip.err_code == 10) && (work->word1.len <= 64)) {
> -        /*
> -         * Ignore length errors on min size packets. Some
> -         * equipment incorrectly pads packets to 64+4FCS
> -         * instead of 60+4FCS.  Note these packets still get
> -         * counted as frame errors.
> -         */
> -    } else if (work->word2.snoip.err_code == 5 ||
> -           work->word2.snoip.err_code == 7) {
> -        /*
> -         * We received a packet with either an alignment error
> -         * or a FCS error. This may be signalling that we are
> -         * running 10Mbps with GMXX_RXX_FRM_CTL[PRE_CHK]
> -         * off. If this is the case we need to parse the
> -         * packet to determine if we can remove a non spec
> -         * preamble and generate a correct packet.
> -         */
> -        int interface = cvmx_helper_get_interface_num(port);
> -        int index = cvmx_helper_get_interface_index_num(port);
> -        union cvmx_gmxx_rxx_frm_ctl gmxx_rxx_frm_ctl;
> -
> -        gmxx_rxx_frm_ctl.u64 =
> -            cvmx_read_csr(CVMX_GMXX_RXX_FRM_CTL(index, interface));
> -        if (gmxx_rxx_frm_ctl.s.pre_chk == 0) {
> -            u8 *ptr =
> -                cvmx_phys_to_ptr(work->packet_ptr.s.addr);
> -            int i = 0;
> -
> -            while (i < work->word1.len - 1) {
> -                if (*ptr != 0x55)
> -                    break;
> -                ptr++;
> -                i++;
> -            }
> -
> -            if (*ptr == 0xd5) {
> -                /* Port received 0xd5 preamble */
> -                work->packet_ptr.s.addr += i + 1;
> -                work->word1.len -= i + 5;
> -            } else if ((*ptr & 0xf) == 0xd) {
> -                /* Port received 0xd preamble */
> -                work->packet_ptr.s.addr += i;
> -                work->word1.len -= i + 4;
> -                for (i = 0; i < work->word1.len; i++) {
> -                    *ptr =
> -                        ((*ptr & 0xf0) >> 4) |
> -                        ((*(ptr + 1) & 0xf) << 4);
> -                    ptr++;
> -                }
> -            } else {
> -                printk_ratelimited("Port %d unknown preamble, packet dropped\n",
> -                           port);
> -                cvm_oct_free_work(work);
> -                return 1;
> -            }
> -        }
> -    } else {
> -        printk_ratelimited("Port %d receive error code %d, packet dropped\n",
> -                   port, work->word2.snoip.err_code);
> -        cvm_oct_free_work(work);
> -        return 1;
> -    }
> -
> -    return 0;
> -}
> -
> -static void copy_segments_to_skb(struct cvmx_wqe *work, struct sk_buff *skb)
> -{
> -    int segments = work->word2.s.bufs;
> -    union cvmx_buf_ptr segment_ptr = work->packet_ptr;
> -    int len = work->word1.len;
> -    int segment_size;
> -
> -    while (segments--) {
> -        union cvmx_buf_ptr next_ptr;
> -
> -        next_ptr = *(union cvmx_buf_ptr *)
> -            cvmx_phys_to_ptr(segment_ptr.s.addr - 8);
> -
> -        /*
> -         * Octeon Errata PKI-100: The segment size is wrong.
> -         *
> -         * Until it is fixed, calculate the segment size based on
> -         * the packet pool buffer size.
> -         * When it is fixed, the following line should be replaced
> -         * with this one:
> -         * int segment_size = segment_ptr.s.size;
> -         */
> -        segment_size =
> -            CVMX_FPA_PACKET_POOL_SIZE -
> -            (segment_ptr.s.addr -
> -             (((segment_ptr.s.addr >> 7) -
> -               segment_ptr.s.back) << 7));
> -
> -        /* Don't copy more than what is left in the packet */
> -        if (segment_size > len)
> -            segment_size = len;
> -
> -        /* Copy the data into the packet */
> -        skb_put_data(skb, cvmx_phys_to_ptr(segment_ptr.s.addr),
> -                 segment_size);
> -        len -= segment_size;
> -        segment_ptr = next_ptr;
> -    }
> -}
> -
> -static int cvm_oct_poll(struct oct_rx_group *rx_group, int budget)
> -{
> -    const int    coreid = cvmx_get_core_num();
> -    u64    old_group_mask;
> -    u64    old_scratch;
> -    int        rx_count = 0;
> -    int        did_work_request = 0;
> -    int        packet_not_copied;
> -
> -    /* Prefetch cvm_oct_device since we know we need it soon */
> -    prefetch(cvm_oct_device);
> -
> -    if (USE_ASYNC_IOBDMA) {
> -        /* Save scratch in case userspace is using it */
> -        CVMX_SYNCIOBDMA;
> -        old_scratch = cvmx_scratch_read64(CVMX_SCR_SCRATCH);
> -    }
> -
> -    /* Only allow work for our group (and preserve priorities) */
> -    if (OCTEON_IS_MODEL(OCTEON_CN68XX)) {
> -        old_group_mask = cvmx_read_csr(CVMX_SSO_PPX_GRP_MSK(coreid));
> -        cvmx_write_csr(CVMX_SSO_PPX_GRP_MSK(coreid),
> -                   BIT(rx_group->group));
> -        cvmx_read_csr(CVMX_SSO_PPX_GRP_MSK(coreid)); /* Flush */
> -    } else {
> -        old_group_mask = cvmx_read_csr(CVMX_POW_PP_GRP_MSKX(coreid));
> -        cvmx_write_csr(CVMX_POW_PP_GRP_MSKX(coreid),
> -                   (old_group_mask & ~0xFFFFull) |
> -                   BIT(rx_group->group));
> -    }
> -
> -    if (USE_ASYNC_IOBDMA) {
> -        cvmx_pow_work_request_async(CVMX_SCR_SCRATCH, CVMX_POW_NO_WAIT);
> -        did_work_request = 1;
> -    }
> -
> -    while (rx_count < budget) {
> -        struct sk_buff *skb = NULL;
> -        struct sk_buff **pskb = NULL;
> -        int skb_in_hw;
> -        struct cvmx_wqe *work;
> -        int port;
> -
> -        if (USE_ASYNC_IOBDMA && did_work_request)
> -            work = cvmx_pow_work_response_async(CVMX_SCR_SCRATCH);
> -        else
> -            work = cvmx_pow_work_request_sync(CVMX_POW_NO_WAIT);
> -
> -        prefetch(work);
> -        did_work_request = 0;
> -        if (!work) {
> -            if (OCTEON_IS_MODEL(OCTEON_CN68XX)) {
> -                cvmx_write_csr(CVMX_SSO_WQ_IQ_DIS,
> -                           BIT(rx_group->group));
> -                cvmx_write_csr(CVMX_SSO_WQ_INT,
> -                           BIT(rx_group->group));
> -            } else {
> -                union cvmx_pow_wq_int wq_int;
> -
> -                wq_int.u64 = 0;
> -                wq_int.s.iq_dis = BIT(rx_group->group);
> -                wq_int.s.wq_int = BIT(rx_group->group);
> -                cvmx_write_csr(CVMX_POW_WQ_INT, wq_int.u64);
> -            }
> -            break;
> -        }
> -        pskb = (struct sk_buff **)
> -            (cvm_oct_get_buffer_ptr(work->packet_ptr) -
> -            sizeof(void *));
> -        prefetch(pskb);
> -
> -        if (USE_ASYNC_IOBDMA && rx_count < (budget - 1)) {
> -            cvmx_pow_work_request_async_nocheck(CVMX_SCR_SCRATCH,
> -                                CVMX_POW_NO_WAIT);
> -            did_work_request = 1;
> -        }
> -        rx_count++;
> -
> -        skb_in_hw = work->word2.s.bufs == 1;
> -        if (likely(skb_in_hw)) {
> -            skb = *pskb;
> -            prefetch(&skb->head);
> -            prefetch(&skb->len);
> -        }
> -
> -        if (octeon_has_feature(OCTEON_FEATURE_PKND))
> -            port = work->word0.pip.cn68xx.pknd;
> -        else
> -            port = work->word1.cn38xx.ipprt;
> -
> -        prefetch(cvm_oct_device[port]);
> -
> -        /* Immediately throw away all packets with receive errors */
> -        if (unlikely(work->word2.snoip.rcv_error)) {
> -            if (cvm_oct_check_rcv_error(work))
> -                continue;
> -        }
> -
> -        /*
> -         * We can only use the zero copy path if skbuffs are
> -         * in the FPA pool and the packet fits in a single
> -         * buffer.
> -         */
> -        if (likely(skb_in_hw)) {
> -            skb->data = skb->head + work->packet_ptr.s.addr -
> -                cvmx_ptr_to_phys(skb->head);
> -            prefetch(skb->data);
> -            skb->len = work->word1.len;
> -            skb_set_tail_pointer(skb, skb->len);
> -            packet_not_copied = 1;
> -        } else {
> -            /*
> -             * We have to copy the packet. First allocate
> -             * an skbuff for it.
> -             */
> -            skb = dev_alloc_skb(work->word1.len);
> -            if (!skb) {
> -                cvm_oct_free_work(work);
> -                continue;
> -            }
> -
> -            /*
> -             * Check if we've received a packet that was
> -             * entirely stored in the work entry.
> -             */
> -            if (unlikely(work->word2.s.bufs == 0)) {
> -                u8 *ptr = work->packet_data;
> -
> -                if (likely(!work->word2.s.not_IP)) {
> -                    /*
> -                     * The beginning of the packet
> -                     * moves for IP packets.
> -                     */
> -                    if (work->word2.s.is_v6)
> -                        ptr += 2;
> -                    else
> -                        ptr += 6;
> -                }
> -                skb_put_data(skb, ptr, work->word1.len);
> -                /* No packet buffers to free */
> -            } else {
> -                copy_segments_to_skb(work, skb);
> -            }
> -            packet_not_copied = 0;
> -        }
> -        if (likely((port < TOTAL_NUMBER_OF_PORTS) &&
> -               cvm_oct_device[port])) {
> -            struct net_device *dev = cvm_oct_device[port];
> -
> -            /*
> -             * Only accept packets for devices that are
> -             * currently up.
> -             */
> -            if (likely(dev->flags & IFF_UP)) {
> -                skb->protocol = eth_type_trans(skb, dev);
> -                skb->dev = dev;
> -
> -                if (unlikely(work->word2.s.not_IP ||
> -                         work->word2.s.IP_exc ||
> -                         work->word2.s.L4_error ||
> -                         !work->word2.s.tcp_or_udp))
> -                    skb->ip_summed = CHECKSUM_NONE;
> -                else
> -                    skb->ip_summed = CHECKSUM_UNNECESSARY;
> -
> -                /* Increment RX stats for virtual ports */
> -                if (port >= CVMX_PIP_NUM_INPUT_PORTS) {
> -                    dev->stats.rx_packets++;
> -                    dev->stats.rx_bytes += skb->len;
> -                }
> -                netif_receive_skb(skb);
> -            } else {
> -                /*
> -                 * Drop any packet received for a device that
> -                 * isn't up.
> -                 */
> -                dev->stats.rx_dropped++;
> -                dev_kfree_skb_irq(skb);
> -            }
> -        } else {
> -            /*
> -             * Drop any packet received for a device that
> -             * doesn't exist.
> -             */
> -            printk_ratelimited("Port %d not controlled by Linux, packet dropped\n",
> -                       port);
> -            dev_kfree_skb_irq(skb);
> -        }
> -        /*
> -         * Check to see if the skbuff and work share the same
> -         * packet buffer.
> -         */
> -        if (likely(packet_not_copied)) {
> -            /*
> -             * This buffer needs to be replaced, increment
> -             * the number of buffers we need to free by
> -             * one.
> -             */
> -            cvmx_fau_atomic_add32(FAU_NUM_PACKET_BUFFERS_TO_FREE,
> -                          1);
> -
> -            cvmx_fpa_free(work, CVMX_FPA_WQE_POOL, 1);
> -        } else {
> -            cvm_oct_free_work(work);
> -        }
> -    }
> -    /* Restore the original POW group mask */
> -    if (OCTEON_IS_MODEL(OCTEON_CN68XX)) {
> -        cvmx_write_csr(CVMX_SSO_PPX_GRP_MSK(coreid), old_group_mask);
> -        cvmx_read_csr(CVMX_SSO_PPX_GRP_MSK(coreid)); /* Flush */
> -    } else {
> -        cvmx_write_csr(CVMX_POW_PP_GRP_MSKX(coreid), old_group_mask);
> -    }
> -
> -    if (USE_ASYNC_IOBDMA) {
> -        /* Restore the scratch area */
> -        cvmx_scratch_write64(CVMX_SCR_SCRATCH, old_scratch);
> -    }
> -    cvm_oct_rx_refill_pool(0);
> -
> -    return rx_count;
> -}
> -
> -/**
> - * cvm_oct_napi_poll - the NAPI poll function.
> - * @napi: The NAPI instance.
> - * @budget: Maximum number of packets to receive.
> - *
> - * Returns the number of packets processed.
> - */
> -static int cvm_oct_napi_poll(struct napi_struct *napi, int budget)
> -{
> -    struct oct_rx_group *rx_group = container_of(napi, struct oct_rx_group,
> -                             napi);
> -    int rx_count;
> -
> -    rx_count = cvm_oct_poll(rx_group, budget);
> -
> -    if (rx_count < budget) {
> -        /* No more work */
> -        napi_complete_done(napi, rx_count);
> -        enable_irq(rx_group->irq);
> -    }
> -    return rx_count;
> -}
> -
> -#ifdef CONFIG_NET_POLL_CONTROLLER
> -/**
> - * cvm_oct_poll_controller - poll for receive packets
> - * device.
> - *
> - * @dev:    Device to poll. Unused
> - */
> -void cvm_oct_poll_controller(struct net_device *dev)
> -{
> -    int i;
> -
> -    if (!atomic_read(&oct_rx_ready))
> -        return;
> -
> -    for (i = 0; i < ARRAY_SIZE(oct_rx_group); i++) {
> -        if (!(pow_receive_groups & BIT(i)))
> -            continue;
> -
> -        cvm_oct_poll(&oct_rx_group[i], 16);
> -    }
> -}
> -#endif
> -
> -void cvm_oct_rx_initialize(void)
> -{
> -    int i;
> -    struct net_device *dev_for_napi = NULL;
> -
> -    for (i = 0; i < TOTAL_NUMBER_OF_PORTS; i++) {
> -        if (cvm_oct_device[i]) {
> -            dev_for_napi = cvm_oct_device[i];
> -            break;
> -        }
> -    }
> -
> -    if (!dev_for_napi)
> -        panic("No net_devices were allocated.");
> -
> -    for (i = 0; i < ARRAY_SIZE(oct_rx_group); i++) {
> -        int ret;
> -
> -        if (!(pow_receive_groups & BIT(i)))
> -            continue;
> -
> -        netif_napi_add(dev_for_napi, &oct_rx_group[i].napi,
> -                   cvm_oct_napi_poll, rx_napi_weight);
> -        napi_enable(&oct_rx_group[i].napi);
> -
> -        oct_rx_group[i].irq = OCTEON_IRQ_WORKQ0 + i;
> -        oct_rx_group[i].group = i;
> -
> -        /* Register an IRQ handler to receive POW interrupts */
> -        ret = request_irq(oct_rx_group[i].irq, cvm_oct_do_interrupt, 0,
> -                  "Ethernet", &oct_rx_group[i].napi);
> -        if (ret)
> -            panic("Could not acquire Ethernet IRQ %d\n",
> -                  oct_rx_group[i].irq);
> -
> -        disable_irq_nosync(oct_rx_group[i].irq);
> -
> -        /* Enable POW interrupt when our port has at least one packet */
> -        if (OCTEON_IS_MODEL(OCTEON_CN68XX)) {
> -            union cvmx_sso_wq_int_thrx int_thr;
> -            union cvmx_pow_wq_int_pc int_pc;
> -
> -            int_thr.u64 = 0;
> -            int_thr.s.tc_en = 1;
> -            int_thr.s.tc_thr = 1;
> -            cvmx_write_csr(CVMX_SSO_WQ_INT_THRX(i), int_thr.u64);
> -
> -            int_pc.u64 = 0;
> -            int_pc.s.pc_thr = 5;
> -            cvmx_write_csr(CVMX_SSO_WQ_INT_PC, int_pc.u64);
> -        } else {
> -            union cvmx_pow_wq_int_thrx int_thr;
> -            union cvmx_pow_wq_int_pc int_pc;
> -
> -            int_thr.u64 = 0;
> -            int_thr.s.tc_en = 1;
> -            int_thr.s.tc_thr = 1;
> -            cvmx_write_csr(CVMX_POW_WQ_INT_THRX(i), int_thr.u64);
> -
> -            int_pc.u64 = 0;
> -            int_pc.s.pc_thr = 5;
> -            cvmx_write_csr(CVMX_POW_WQ_INT_PC, int_pc.u64);
> -        }
> -
> -        /* Schedule NAPI now. This will indirectly enable the
> -         * interrupt.
> -         */
> -        napi_schedule(&oct_rx_group[i].napi);
> -    }
> -    atomic_inc(&oct_rx_ready);
> -}
> -
> -void cvm_oct_rx_shutdown(void)
> -{
> -    int i;
> -
> -    for (i = 0; i < ARRAY_SIZE(oct_rx_group); i++) {
> -        if (!(pow_receive_groups & BIT(i)))
> -            continue;
> -
> -        /* Disable POW interrupt */
> -        if (OCTEON_IS_MODEL(OCTEON_CN68XX))
> -            cvmx_write_csr(CVMX_SSO_WQ_INT_THRX(i), 0);
> -        else
> -            cvmx_write_csr(CVMX_POW_WQ_INT_THRX(i), 0);
> -
> -        /* Free the interrupt handler */
> -        free_irq(oct_rx_group[i].irq, cvm_oct_device);
> -
> -        netif_napi_del(&oct_rx_group[i].napi);
> -    }
> -}
> diff --git a/drivers/staging/octeon/ethernet-rx.h b/drivers/staging/octeon/ethernet-rx.h
> deleted file mode 100644
> index ff6482fa20d6..000000000000
> --- a/drivers/staging/octeon/ethernet-rx.h
> +++ /dev/null
> @@ -1,31 +0,0 @@
> -/* SPDX-License-Identifier: GPL-2.0 */
> -/*
> - * This file is based on code from OCTEON SDK by Cavium Networks.
> - *
> - * Copyright (c) 2003-2007 Cavium Networks
> - */
> -
> -void cvm_oct_poll_controller(struct net_device *dev);
> -void cvm_oct_rx_initialize(void);
> -void cvm_oct_rx_shutdown(void);
> -
> -static inline void cvm_oct_rx_refill_pool(int fill_threshold)
> -{
> -    int number_to_free;
> -    int num_freed;
> -    /* Refill the packet buffer pool */
> -    number_to_free =
> -        cvmx_fau_fetch_and_add32(FAU_NUM_PACKET_BUFFERS_TO_FREE, 0);
> -
> -    if (number_to_free > fill_threshold) {
> -        cvmx_fau_atomic_add32(FAU_NUM_PACKET_BUFFERS_TO_FREE,
> -                      -number_to_free);
> -        num_freed = cvm_oct_mem_fill_fpa(CVMX_FPA_PACKET_POOL,
> -                         CVMX_FPA_PACKET_POOL_SIZE,
> -                         number_to_free);
> -        if (num_freed != number_to_free) {
> -            cvmx_fau_atomic_add32(FAU_NUM_PACKET_BUFFERS_TO_FREE,
> -                          number_to_free - num_freed);
> -        }
> -    }
> -}
> diff --git a/drivers/staging/octeon/ethernet-sgmii.c b/drivers/staging/octeon/ethernet-sgmii.c
> deleted file mode 100644
> index d7fbd9159302..000000000000
> --- a/drivers/staging/octeon/ethernet-sgmii.c
> +++ /dev/null
> @@ -1,30 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0
> -/*
> - * This file is based on code from OCTEON SDK by Cavium Networks.
> - *
> - * Copyright (c) 2003-2007 Cavium Networks
> - */
> -
> -#include <linux/phy.h>
> -#include <linux/kernel.h>
> -#include <linux/netdevice.h>
> -#include <linux/ratelimit.h>
> -#include <net/dst.h>
> -
> -#include "octeon-ethernet.h"
> -#include "ethernet-defines.h"
> -#include "ethernet-util.h"
> -#include "ethernet-mdio.h"
> -
> -int cvm_oct_sgmii_open(struct net_device *dev)
> -{
> -    return cvm_oct_common_open(dev, cvm_oct_link_poll);
> -}
> -
> -int cvm_oct_sgmii_init(struct net_device *dev)
> -{
> -    cvm_oct_common_init(dev);
> -
> -    /* FIXME: Need autoneg logic */
> -    return 0;
> -}
> diff --git a/drivers/staging/octeon/ethernet-spi.c b/drivers/staging/octeon/ethernet-spi.c
> deleted file mode 100644
> index c582403e6a1f..000000000000
> --- a/drivers/staging/octeon/ethernet-spi.c
> +++ /dev/null
> @@ -1,226 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0
> -/*
> - * This file is based on code from OCTEON SDK by Cavium Networks.
> - *
> - * Copyright (c) 2003-2007 Cavium Networks
> - */
> -
> -#include <linux/kernel.h>
> -#include <linux/netdevice.h>
> -#include <linux/interrupt.h>
> -#include <net/dst.h>
> -
> -#include "octeon-ethernet.h"
> -#include "ethernet-defines.h"
> -#include "ethernet-util.h"
> -
> -static int number_spi_ports;
> -static int need_retrain[2] = { 0, 0 };
> -
> -static void cvm_oct_spxx_int_pr(union cvmx_spxx_int_reg spx_int_reg, int index)
> -{
> -    if (spx_int_reg.s.spf)
> -        pr_err("SPI%d: SRX Spi4 interface down\n", index);
> -    if (spx_int_reg.s.calerr)
> -        pr_err("SPI%d: SRX Spi4 Calendar table parity error\n", index);
> -    if (spx_int_reg.s.syncerr)
> -        pr_err("SPI%d: SRX Consecutive Spi4 DIP4 errors have exceeded SPX_ERR_CTL[ERRCNT]\n",
> -               index);
> -    if (spx_int_reg.s.diperr)
> -        pr_err("SPI%d: SRX Spi4 DIP4 error\n", index);
> -    if (spx_int_reg.s.tpaovr)
> -        pr_err("SPI%d: SRX Selected port has hit TPA overflow\n",
> -               index);
> -    if (spx_int_reg.s.rsverr)
> -        pr_err("SPI%d: SRX Spi4 reserved control word detected\n",
> -               index);
> -    if (spx_int_reg.s.drwnng)
> -        pr_err("SPI%d: SRX Spi4 receive FIFO drowning/overflow\n",
> -               index);
> -    if (spx_int_reg.s.clserr)
> -        pr_err("SPI%d: SRX Spi4 packet closed on non-16B alignment without EOP\n",
> -               index);
> -    if (spx_int_reg.s.spiovr)
> -        pr_err("SPI%d: SRX Spi4 async FIFO overflow\n", index);
> -    if (spx_int_reg.s.abnorm)
> -        pr_err("SPI%d: SRX Abnormal packet termination (ERR bit)\n",
> -               index);
> -    if (spx_int_reg.s.prtnxa)
> -        pr_err("SPI%d: SRX Port out of range\n", index);
> -}
> -
> -static void cvm_oct_stxx_int_pr(union cvmx_stxx_int_reg stx_int_reg, int index)
> -{
> -    if (stx_int_reg.s.syncerr)
> -        pr_err("SPI%d: STX Interface encountered a fatal error\n",
> -               index);
> -    if (stx_int_reg.s.frmerr)
> -        pr_err("SPI%d: STX FRMCNT has exceeded STX_DIP_CNT[MAXFRM]\n",
> -               index);
> -    if (stx_int_reg.s.unxfrm)
> -        pr_err("SPI%d: STX Unexpected framing sequence\n", index);
> -    if (stx_int_reg.s.nosync)
> -        pr_err("SPI%d: STX ERRCNT has exceeded STX_DIP_CNT[MAXDIP]\n",
> -               index);
> -    if (stx_int_reg.s.diperr)
> -        pr_err("SPI%d: STX DIP2 error on the Spi4 Status channel\n",
> -               index);
> -    if (stx_int_reg.s.datovr)
> -        pr_err("SPI%d: STX Spi4 FIFO overflow error\n", index);
> -    if (stx_int_reg.s.ovrbst)
> -        pr_err("SPI%d: STX Transmit packet burst too big\n", index);
> -    if (stx_int_reg.s.calpar1)
> -        pr_err("SPI%d: STX Calendar Table Parity Error Bank%d\n",
> -               index, 1);
> -    if (stx_int_reg.s.calpar0)
> -        pr_err("SPI%d: STX Calendar Table Parity Error Bank%d\n",
> -               index, 0);
> -}
> -
> -static irqreturn_t cvm_oct_spi_spx_int(int index)
> -{
> -    union cvmx_spxx_int_reg spx_int_reg;
> -    union cvmx_stxx_int_reg stx_int_reg;
> -
> -    spx_int_reg.u64 = cvmx_read_csr(CVMX_SPXX_INT_REG(index));
> -    cvmx_write_csr(CVMX_SPXX_INT_REG(index), spx_int_reg.u64);
> -    if (!need_retrain[index]) {
> -        spx_int_reg.u64 &= cvmx_read_csr(CVMX_SPXX_INT_MSK(index));
> -        cvm_oct_spxx_int_pr(spx_int_reg, index);
> -    }
> -
> -    stx_int_reg.u64 = cvmx_read_csr(CVMX_STXX_INT_REG(index));
> -    cvmx_write_csr(CVMX_STXX_INT_REG(index), stx_int_reg.u64);
> -    if (!need_retrain[index]) {
> -        stx_int_reg.u64 &= cvmx_read_csr(CVMX_STXX_INT_MSK(index));
> -        cvm_oct_stxx_int_pr(stx_int_reg, index);
> -    }
> -
> -    cvmx_write_csr(CVMX_SPXX_INT_MSK(index), 0);
> -    cvmx_write_csr(CVMX_STXX_INT_MSK(index), 0);
> -    need_retrain[index] = 1;
> -
> -    return IRQ_HANDLED;
> -}
> -
> -static irqreturn_t cvm_oct_spi_rml_interrupt(int cpl, void *dev_id)
> -{
> -    irqreturn_t return_status = IRQ_NONE;
> -    union cvmx_npi_rsl_int_blocks rsl_int_blocks;
> -
> -    /* Check and see if this interrupt was caused by the GMX block */
> -    rsl_int_blocks.u64 = cvmx_read_csr(CVMX_NPI_RSL_INT_BLOCKS);
> -    if (rsl_int_blocks.s.spx1) /* 19 - SPX1_INT_REG & STX1_INT_REG */
> -        return_status = cvm_oct_spi_spx_int(1);
> -
> -    if (rsl_int_blocks.s.spx0) /* 18 - SPX0_INT_REG & STX0_INT_REG */
> -        return_status = cvm_oct_spi_spx_int(0);
> -
> -    return return_status;
> -}
> -
> -static void cvm_oct_spi_enable_error_reporting(int interface)
> -{
> -    union cvmx_spxx_int_msk spxx_int_msk;
> -    union cvmx_stxx_int_msk stxx_int_msk;
> -
> -    spxx_int_msk.u64 = cvmx_read_csr(CVMX_SPXX_INT_MSK(interface));
> -    spxx_int_msk.s.calerr = 1;
> -    spxx_int_msk.s.syncerr = 1;
> -    spxx_int_msk.s.diperr = 1;
> -    spxx_int_msk.s.tpaovr = 1;
> -    spxx_int_msk.s.rsverr = 1;
> -    spxx_int_msk.s.drwnng = 1;
> -    spxx_int_msk.s.clserr = 1;
> -    spxx_int_msk.s.spiovr = 1;
> -    spxx_int_msk.s.abnorm = 1;
> -    spxx_int_msk.s.prtnxa = 1;
> -    cvmx_write_csr(CVMX_SPXX_INT_MSK(interface), spxx_int_msk.u64);
> -
> -    stxx_int_msk.u64 = cvmx_read_csr(CVMX_STXX_INT_MSK(interface));
> -    stxx_int_msk.s.frmerr = 1;
> -    stxx_int_msk.s.unxfrm = 1;
> -    stxx_int_msk.s.nosync = 1;
> -    stxx_int_msk.s.diperr = 1;
> -    stxx_int_msk.s.datovr = 1;
> -    stxx_int_msk.s.ovrbst = 1;
> -    stxx_int_msk.s.calpar1 = 1;
> -    stxx_int_msk.s.calpar0 = 1;
> -    cvmx_write_csr(CVMX_STXX_INT_MSK(interface), stxx_int_msk.u64);
> -}
> -
> -static void cvm_oct_spi_poll(struct net_device *dev)
> -{
> -    static int spi4000_port;
> -    struct octeon_ethernet *priv = netdev_priv(dev);
> -    int interface;
> -
> -    for (interface = 0; interface < 2; interface++) {
> -        if ((priv->port == interface * 16) && need_retrain[interface]) {
> -            if (cvmx_spi_restart_interface
> -                (interface, CVMX_SPI_MODE_DUPLEX, 10) == 0) {
> -                need_retrain[interface] = 0;
> -                cvm_oct_spi_enable_error_reporting(interface);
> -            }
> -        }
> -
> -        /*
> -         * The SPI4000 TWSI interface is very slow. In order
> -         * not to bring the system to a crawl, we only poll a
> -         * single port every second. This means negotiation
> -         * speed changes take up to 10 seconds, but at least
> -         * we don't waste absurd amounts of time waiting for
> -         * TWSI.
> -         */
> -        if (priv->port == spi4000_port) {
> -            /*
> -             * This function does nothing if it is called on an
> -             * interface without a SPI4000.
> -             */
> -            cvmx_spi4000_check_speed(interface, priv->port);
> -            /*
> -             * Normal ordering increments. By decrementing
> -             * we only match once per iteration.
> -             */
> -            spi4000_port--;
> -            if (spi4000_port < 0)
> -                spi4000_port = 10;
> -        }
> -    }
> -}
> -
> -int cvm_oct_spi_init(struct net_device *dev)
> -{
> -    int r;
> -    struct octeon_ethernet *priv = netdev_priv(dev);
> -
> -    if (number_spi_ports == 0) {
> -        r = request_irq(OCTEON_IRQ_RML, cvm_oct_spi_rml_interrupt,
> -                IRQF_SHARED, "SPI", &number_spi_ports);
> -        if (r)
> -            return r;
> -    }
> -    number_spi_ports++;
> -
> -    if ((priv->port == 0) || (priv->port == 16)) {
> -        cvm_oct_spi_enable_error_reporting(INTERFACE(priv->port));
> -        priv->poll = cvm_oct_spi_poll;
> -    }
> -    cvm_oct_common_init(dev);
> -    return 0;
> -}
> -
> -void cvm_oct_spi_uninit(struct net_device *dev)
> -{
> -    int interface;
> -
> -    cvm_oct_common_uninit(dev);
> -    number_spi_ports--;
> -    if (number_spi_ports == 0) {
> -        for (interface = 0; interface < 2; interface++) {
> -            cvmx_write_csr(CVMX_SPXX_INT_MSK(interface), 0);
> -            cvmx_write_csr(CVMX_STXX_INT_MSK(interface), 0);
> -        }
> -        free_irq(OCTEON_IRQ_RML, &number_spi_ports);
> -    }
> -}
> diff --git a/drivers/staging/octeon/ethernet-tx.c b/drivers/staging/octeon/ethernet-tx.c
> deleted file mode 100644
> index b334cf89794e..000000000000
> --- a/drivers/staging/octeon/ethernet-tx.c
> +++ /dev/null
> @@ -1,717 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0
> -/*
> - * This file is based on code from OCTEON SDK by Cavium Networks.
> - *
> - * Copyright (c) 2003-2010 Cavium Networks
> - */
> -
> -#include <linux/module.h>
> -#include <linux/kernel.h>
> -#include <linux/netdevice.h>
> -#include <linux/etherdevice.h>
> -#include <linux/ip.h>
> -#include <linux/ratelimit.h>
> -#include <linux/string.h>
> -#include <linux/interrupt.h>
> -#include <net/dst.h>
> -#ifdef CONFIG_XFRM
> -#include <linux/xfrm.h>
> -#include <net/xfrm.h>
> -#endif /* CONFIG_XFRM */
> -
> -#include <linux/atomic.h>
> -#include <net/sch_generic.h>
> -
> -#include "octeon-ethernet.h"
> -#include "ethernet-defines.h"
> -#include "ethernet-tx.h"
> -#include "ethernet-util.h"
> -
> -#define CVM_OCT_SKB_CB(skb)    ((u64 *)((skb)->cb))
> -
> -/*
> - * You can define GET_SKBUFF_QOS() to override how the skbuff output
> - * function determines which output queue is used. The default
> - * implementation always uses the base queue for the port. If, for
> - * example, you wanted to use the skb->priority field, define
> - * GET_SKBUFF_QOS as: #define GET_SKBUFF_QOS(skb) ((skb)->priority)
> - */
> -#ifndef GET_SKBUFF_QOS
> -#define GET_SKBUFF_QOS(skb) 0
> -#endif
> -
> -static void cvm_oct_tx_do_cleanup(unsigned long arg);
> -static DECLARE_TASKLET(cvm_oct_tx_cleanup_tasklet, cvm_oct_tx_do_cleanup, 0);
> -
> -/* Maximum number of SKBs to try to free per xmit packet. */
> -#define MAX_SKB_TO_FREE (MAX_OUT_QUEUE_DEPTH * 2)
> -
> -static inline int cvm_oct_adjust_skb_to_free(int skb_to_free, int fau)
> -{
> -    int undo;
> -
> -    undo = skb_to_free > 0 ? MAX_SKB_TO_FREE : skb_to_free +
> -                           MAX_SKB_TO_FREE;
> -    if (undo > 0)
> -        cvmx_fau_atomic_add32(fau, -undo);
> -    skb_to_free = -skb_to_free > MAX_SKB_TO_FREE ? MAX_SKB_TO_FREE :
> -                               -skb_to_free;
> -    return skb_to_free;
> -}
> -
> -static void cvm_oct_kick_tx_poll_watchdog(void)
> -{
> -    union cvmx_ciu_timx ciu_timx;
> -
> -    ciu_timx.u64 = 0;
> -    ciu_timx.s.one_shot = 1;
> -    ciu_timx.s.len = cvm_oct_tx_poll_interval;
> -    cvmx_write_csr(CVMX_CIU_TIMX(1), ciu_timx.u64);
> -}
> -
> -static void cvm_oct_free_tx_skbs(struct net_device *dev)
> -{
> -    int skb_to_free;
> -    int qos, queues_per_port;
> -    int total_freed = 0;
> -    int total_remaining = 0;
> -    unsigned long flags;
> -    struct octeon_ethernet *priv = netdev_priv(dev);
> -
> -    queues_per_port = cvmx_pko_get_num_queues(priv->port);
> -    /* Drain any pending packets in the free list */
> -    for (qos = 0; qos < queues_per_port; qos++) {
> -        if (skb_queue_len(&priv->tx_free_list[qos]) == 0)
> -            continue;
> -        skb_to_free = cvmx_fau_fetch_and_add32(priv->fau + qos * 4,
> -                               MAX_SKB_TO_FREE);
> -        skb_to_free = cvm_oct_adjust_skb_to_free(skb_to_free,
> -                             priv->fau + qos * 4);
> -        total_freed += skb_to_free;
> -        if (skb_to_free > 0) {
> -            struct sk_buff *to_free_list = NULL;
> -
> -            spin_lock_irqsave(&priv->tx_free_list[qos].lock, flags);
> -            while (skb_to_free > 0) {
> -                struct sk_buff *t;
> -
> -                t = __skb_dequeue(&priv->tx_free_list[qos]);
> -                t->next = to_free_list;
> -                to_free_list = t;
> -                skb_to_free--;
> -            }
> -            spin_unlock_irqrestore(&priv->tx_free_list[qos].lock,
> -                           flags);
> -            /* Do the actual freeing outside of the lock. */
> -            while (to_free_list) {
> -                struct sk_buff *t = to_free_list;
> -
> -                to_free_list = to_free_list->next;
> -                dev_kfree_skb_any(t);
> -            }
> -        }
> -        total_remaining += skb_queue_len(&priv->tx_free_list[qos]);
> -    }
> -    if (total_remaining < MAX_OUT_QUEUE_DEPTH && netif_queue_stopped(dev))
> -        netif_wake_queue(dev);
> -    if (total_remaining)
> -        cvm_oct_kick_tx_poll_watchdog();
> -}
> -
> -/**
> - * cvm_oct_xmit - transmit a packet
> - * @skb:    Packet to send
> - * @dev:    Device info structure
> - *
> - * Returns Always returns NETDEV_TX_OK
> - */
> -int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev)
> -{
> -    union cvmx_pko_command_word0 pko_command;
> -    union cvmx_buf_ptr hw_buffer;
> -    u64 old_scratch;
> -    u64 old_scratch2;
> -    int qos;
> -    int i;
> -    enum {QUEUE_CORE, QUEUE_HW, QUEUE_DROP} queue_type;
> -    struct octeon_ethernet *priv = netdev_priv(dev);
> -    struct sk_buff *to_free_list;
> -    int skb_to_free;
> -    int buffers_to_free;
> -    u32 total_to_clean;
> -    unsigned long flags;
> -#if REUSE_SKBUFFS_WITHOUT_FREE
> -    unsigned char *fpa_head;
> -#endif
> -
> -    /*
> -     * Prefetch the private data structure.  It is larger than the
> -     * one cache line.
> -     */
> -    prefetch(priv);
> -
> -    /*
> -     * The check on CVMX_PKO_QUEUES_PER_PORT_* is designed to
> -     * completely remove "qos" in the event neither interface
> -     * supports multiple queues per port.
> -     */
> -    if ((CVMX_PKO_QUEUES_PER_PORT_INTERFACE0 > 1) ||
> -        (CVMX_PKO_QUEUES_PER_PORT_INTERFACE1 > 1)) {
> -        qos = GET_SKBUFF_QOS(skb);
> -        if (qos <= 0)
> -            qos = 0;
> -        else if (qos >= cvmx_pko_get_num_queues(priv->port))
> -            qos = 0;
> -    } else {
> -        qos = 0;
> -    }
> -
> -    if (USE_ASYNC_IOBDMA) {
> -        /* Save scratch in case userspace is using it */
> -        CVMX_SYNCIOBDMA;
> -        old_scratch = cvmx_scratch_read64(CVMX_SCR_SCRATCH);
> -        old_scratch2 = cvmx_scratch_read64(CVMX_SCR_SCRATCH + 8);
> -
> -        /*
> -         * Fetch and increment the number of packets to be
> -         * freed.
> -         */
> -        cvmx_fau_async_fetch_and_add32(CVMX_SCR_SCRATCH + 8,
> -                           FAU_NUM_PACKET_BUFFERS_TO_FREE,
> -                           0);
> -        cvmx_fau_async_fetch_and_add32(CVMX_SCR_SCRATCH,
> -                           priv->fau + qos * 4,
> -                           MAX_SKB_TO_FREE);
> -    }
> -
> -    /*
> -     * We have space for 6 segment pointers, If there will be more
> -     * than that, we must linearize.
> -     */
> -    if (unlikely(skb_shinfo(skb)->nr_frags > 5)) {
> -        if (unlikely(__skb_linearize(skb))) {
> -            queue_type = QUEUE_DROP;
> -            if (USE_ASYNC_IOBDMA) {
> -                /*
> -                 * Get the number of skbuffs in use
> -                 * by the hardware
> -                 */
> -                CVMX_SYNCIOBDMA;
> -                skb_to_free =
> -                    cvmx_scratch_read64(CVMX_SCR_SCRATCH);
> -            } else {
> -                /*
> -                 * Get the number of skbuffs in use
> -                 * by the hardware
> -                 */
> -                skb_to_free =
> -                     cvmx_fau_fetch_and_add32(priv->fau +
> -                                  qos * 4,
> -                                  MAX_SKB_TO_FREE);
> -            }
> -            skb_to_free = cvm_oct_adjust_skb_to_free(skb_to_free,
> -                                 priv->fau +
> -                                 qos * 4);
> -            spin_lock_irqsave(&priv->tx_free_list[qos].lock, flags);
> -            goto skip_xmit;
> -        }
> -    }
> -
> -    /*
> -     * The CN3XXX series of parts has an errata (GMX-401) which
> -     * causes the GMX block to hang if a collision occurs towards
> -     * the end of a <68 byte packet. As a workaround for this, we
> -     * pad packets to be 68 bytes whenever we are in half duplex
> -     * mode. We don't handle the case of having a small packet but
> -     * no room to add the padding.  The kernel should always give
> -     * us at least a cache line
> -     */
> -    if ((skb->len < 64) && OCTEON_IS_MODEL(OCTEON_CN3XXX)) {
> -        union cvmx_gmxx_prtx_cfg gmx_prt_cfg;
> -        int interface = INTERFACE(priv->port);
> -        int index = INDEX(priv->port);
> -
> -        if (interface < 2) {
> -            /* We only need to pad packet in half duplex mode */
> -            gmx_prt_cfg.u64 =
> -                cvmx_read_csr(CVMX_GMXX_PRTX_CFG(index, interface));
> -            if (gmx_prt_cfg.s.duplex == 0) {
> -                int add_bytes = 64 - skb->len;
> -
> -                if ((skb_tail_pointer(skb) + add_bytes) <=
> -                    skb_end_pointer(skb))
> -                    __skb_put_zero(skb, add_bytes);
> -            }
> -        }
> -    }
> -
> -    /* Build the PKO command */
> -    pko_command.u64 = 0;
> -#ifdef __LITTLE_ENDIAN
> -    pko_command.s.le = 1;
> -#endif
> -    pko_command.s.n2 = 1;    /* Don't pollute L2 with the outgoing packet */
> -    pko_command.s.segs = 1;
> -    pko_command.s.total_bytes = skb->len;
> -    pko_command.s.size0 = CVMX_FAU_OP_SIZE_32;
> -    pko_command.s.subone0 = 1;
> -
> -    pko_command.s.dontfree = 1;
> -
> -    /* Build the PKO buffer pointer */
> -    hw_buffer.u64 = 0;
> -    if (skb_shinfo(skb)->nr_frags == 0) {
> -        hw_buffer.s.addr = XKPHYS_TO_PHYS((uintptr_t)skb->data);
> -        hw_buffer.s.pool = 0;
> -        hw_buffer.s.size = skb->len;
> -    } else {
> -        hw_buffer.s.addr = XKPHYS_TO_PHYS((uintptr_t)skb->data);
> -        hw_buffer.s.pool = 0;
> -        hw_buffer.s.size = skb_headlen(skb);
> -        CVM_OCT_SKB_CB(skb)[0] = hw_buffer.u64;
> -        for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
> -            skb_frag_t *fs = skb_shinfo(skb)->frags + i;
> -
> -            hw_buffer.s.addr =
> -                XKPHYS_TO_PHYS((uintptr_t)skb_frag_address(fs));
> -            hw_buffer.s.size = skb_frag_size(fs);
> -            CVM_OCT_SKB_CB(skb)[i + 1] = hw_buffer.u64;
> -        }
> -        hw_buffer.s.addr =
> -            XKPHYS_TO_PHYS((uintptr_t)CVM_OCT_SKB_CB(skb));
> -        hw_buffer.s.size = skb_shinfo(skb)->nr_frags + 1;
> -        pko_command.s.segs = skb_shinfo(skb)->nr_frags + 1;
> -        pko_command.s.gather = 1;
> -        goto dont_put_skbuff_in_hw;
> -    }
> -
> -    /*
> -     * See if we can put this skb in the FPA pool. Any strange
> -     * behavior from the Linux networking stack will most likely
> -     * be caused by a bug in the following code. If some field is
> -     * in use by the network stack and gets carried over when a
> -     * buffer is reused, bad things may happen.  If in doubt and
> -     * you dont need the absolute best performance, disable the
> -     * define REUSE_SKBUFFS_WITHOUT_FREE. The reuse of buffers has
> -     * shown a 25% increase in performance under some loads.
> -     */
> -#if REUSE_SKBUFFS_WITHOUT_FREE
> -    fpa_head = skb->head + 256 - ((unsigned long)skb->head & 0x7f);
> -    if (unlikely(skb->data < fpa_head)) {
> -        /* TX buffer beginning can't meet FPA alignment constraints */
> -        goto dont_put_skbuff_in_hw;
> -    }
> -    if (unlikely
> -        ((skb_end_pointer(skb) - fpa_head) < CVMX_FPA_PACKET_POOL_SIZE)) {
> -        /* TX buffer isn't large enough for the FPA */
> -        goto dont_put_skbuff_in_hw;
> -    }
> -    if (unlikely(skb_shared(skb))) {
> -        /* TX buffer sharing data with someone else */
> -        goto dont_put_skbuff_in_hw;
> -    }
> -    if (unlikely(skb_cloned(skb))) {
> -        /* TX buffer has been cloned */
> -        goto dont_put_skbuff_in_hw;
> -    }
> -    if (unlikely(skb_header_cloned(skb))) {
> -        /* TX buffer header has been cloned */
> -        goto dont_put_skbuff_in_hw;
> -    }
> -    if (unlikely(skb->destructor)) {
> -        /* TX buffer has a destructor */
> -        goto dont_put_skbuff_in_hw;
> -    }
> -    if (unlikely(skb_shinfo(skb)->nr_frags)) {
> -        /* TX buffer has fragments */
> -        goto dont_put_skbuff_in_hw;
> -    }
> -    if (unlikely
> -        (skb->truesize !=
> -         sizeof(*skb) + skb_end_offset(skb))) {
> -        /* TX buffer truesize has been changed */
> -        goto dont_put_skbuff_in_hw;
> -    }
> -
> -    /*
> -     * We can use this buffer in the FPA.  We don't need the FAU
> -     * update anymore
> -     */
> -    pko_command.s.dontfree = 0;
> -
> -    hw_buffer.s.back = ((unsigned long)skb->data >> 7) -
> -               ((unsigned long)fpa_head >> 7);
> -
> -    *(struct sk_buff **)(fpa_head - sizeof(void *)) = skb;
> -
> -    /*
> -     * The skbuff will be reused without ever being freed. We must
> -     * cleanup a bunch of core things.
> -     */
> -    dst_release(skb_dst(skb));
> -    skb_dst_set(skb, NULL);
> -    skb_ext_reset(skb);
> -    nf_reset_ct(skb);
> -
> -#ifdef CONFIG_NET_SCHED
> -    skb->tc_index = 0;
> -    skb_reset_tc(skb);
> -#endif /* CONFIG_NET_SCHED */
> -#endif /* REUSE_SKBUFFS_WITHOUT_FREE */
> -
> -dont_put_skbuff_in_hw:
> -
> -    /* Check if we can use the hardware checksumming */
> -    if ((skb->protocol == htons(ETH_P_IP)) &&
> -        (ip_hdr(skb)->version == 4) &&
> -        (ip_hdr(skb)->ihl == 5) &&
> -        ((ip_hdr(skb)->frag_off == 0) ||
> -         (ip_hdr(skb)->frag_off == htons(1 << 14))) &&
> -        ((ip_hdr(skb)->protocol == IPPROTO_TCP) ||
> -         (ip_hdr(skb)->protocol == IPPROTO_UDP))) {
> -        /* Use hardware checksum calc */
> -        pko_command.s.ipoffp1 = skb_network_offset(skb) + 1;
> -    }
> -
> -    if (USE_ASYNC_IOBDMA) {
> -        /* Get the number of skbuffs in use by the hardware */
> -        CVMX_SYNCIOBDMA;
> -        skb_to_free = cvmx_scratch_read64(CVMX_SCR_SCRATCH);
> -        buffers_to_free = cvmx_scratch_read64(CVMX_SCR_SCRATCH + 8);
> -    } else {
> -        /* Get the number of skbuffs in use by the hardware */
> -        skb_to_free = cvmx_fau_fetch_and_add32(priv->fau + qos * 4,
> -                               MAX_SKB_TO_FREE);
> -        buffers_to_free =
> -            cvmx_fau_fetch_and_add32(FAU_NUM_PACKET_BUFFERS_TO_FREE, 0);
> -    }
> -
> -    skb_to_free = cvm_oct_adjust_skb_to_free(skb_to_free,
> -                         priv->fau + qos * 4);
> -
> -    /*
> -     * If we're sending faster than the receive can free them then
> -     * don't do the HW free.
> -     */
> -    if ((buffers_to_free < -100) && !pko_command.s.dontfree)
> -        pko_command.s.dontfree = 1;
> -
> -    if (pko_command.s.dontfree) {
> -        queue_type = QUEUE_CORE;
> -        pko_command.s.reg0 = priv->fau + qos * 4;
> -    } else {
> -        queue_type = QUEUE_HW;
> -    }
> -    if (USE_ASYNC_IOBDMA)
> -        cvmx_fau_async_fetch_and_add32(CVMX_SCR_SCRATCH,
> -                           FAU_TOTAL_TX_TO_CLEAN, 1);
> -
> -    spin_lock_irqsave(&priv->tx_free_list[qos].lock, flags);
> -
> -    /* Drop this packet if we have too many already queued to the HW */
> -    if (unlikely(skb_queue_len(&priv->tx_free_list[qos]) >=
> -             MAX_OUT_QUEUE_DEPTH)) {
> -        if (dev->tx_queue_len != 0) {
> -            /* Drop the lock when notifying the core.  */
> -            spin_unlock_irqrestore(&priv->tx_free_list[qos].lock,
> -                           flags);
> -            netif_stop_queue(dev);
> -            spin_lock_irqsave(&priv->tx_free_list[qos].lock,
> -                      flags);
> -        } else {
> -            /* If not using normal queueing.  */
> -            queue_type = QUEUE_DROP;
> -            goto skip_xmit;
> -        }
> -    }
> -
> -    cvmx_pko_send_packet_prepare(priv->port, priv->queue + qos,
> -                     CVMX_PKO_LOCK_NONE);
> -
> -    /* Send the packet to the output queue */
> -    if (unlikely(cvmx_pko_send_packet_finish(priv->port,
> -                         priv->queue + qos,
> -                         pko_command, hw_buffer,
> -                         CVMX_PKO_LOCK_NONE))) {
> -        printk_ratelimited("%s: Failed to send the packet\n",
> -                   dev->name);
> -        queue_type = QUEUE_DROP;
> -    }
> -skip_xmit:
> -    to_free_list = NULL;
> -
> -    switch (queue_type) {
> -    case QUEUE_DROP:
> -        skb->next = to_free_list;
> -        to_free_list = skb;
> -        dev->stats.tx_dropped++;
> -        break;
> -    case QUEUE_HW:
> -        cvmx_fau_atomic_add32(FAU_NUM_PACKET_BUFFERS_TO_FREE, -1);
> -        break;
> -    case QUEUE_CORE:
> -        __skb_queue_tail(&priv->tx_free_list[qos], skb);
> -        break;
> -    default:
> -        BUG();
> -    }
> -
> -    while (skb_to_free > 0) {
> -        struct sk_buff *t = __skb_dequeue(&priv->tx_free_list[qos]);
> -
> -        t->next = to_free_list;
> -        to_free_list = t;
> -        skb_to_free--;
> -    }
> -
> -    spin_unlock_irqrestore(&priv->tx_free_list[qos].lock, flags);
> -
> -    /* Do the actual freeing outside of the lock. */
> -    while (to_free_list) {
> -        struct sk_buff *t = to_free_list;
> -
> -        to_free_list = to_free_list->next;
> -        dev_kfree_skb_any(t);
> -    }
> -
> -    if (USE_ASYNC_IOBDMA) {
> -        CVMX_SYNCIOBDMA;
> -        total_to_clean = cvmx_scratch_read64(CVMX_SCR_SCRATCH);
> -        /* Restore the scratch area */
> -        cvmx_scratch_write64(CVMX_SCR_SCRATCH, old_scratch);
> -        cvmx_scratch_write64(CVMX_SCR_SCRATCH + 8, old_scratch2);
> -    } else {
> -        total_to_clean =
> -            cvmx_fau_fetch_and_add32(FAU_TOTAL_TX_TO_CLEAN, 1);
> -    }
> -
> -    if (total_to_clean & 0x3ff) {
> -        /*
> -         * Schedule the cleanup tasklet every 1024 packets for
> -         * the pathological case of high traffic on one port
> -         * delaying clean up of packets on a different port
> -         * that is blocked waiting for the cleanup.
> -         */
> -        tasklet_schedule(&cvm_oct_tx_cleanup_tasklet);
> -    }
> -
> -    cvm_oct_kick_tx_poll_watchdog();
> -
> -    return NETDEV_TX_OK;
> -}
> -
> -/**
> - * cvm_oct_xmit_pow - transmit a packet to the POW
> - * @skb:    Packet to send
> - * @dev:    Device info structure
> -
> - * Returns Always returns zero
> - */
> -int cvm_oct_xmit_pow(struct sk_buff *skb, struct net_device *dev)
> -{
> -    struct octeon_ethernet *priv = netdev_priv(dev);
> -    void *packet_buffer;
> -    void *copy_location;
> -
> -    /* Get a work queue entry */
> -    struct cvmx_wqe *work = cvmx_fpa_alloc(CVMX_FPA_WQE_POOL);
> -
> -    if (unlikely(!work)) {
> -        printk_ratelimited("%s: Failed to allocate a work queue entry\n",
> -                   dev->name);
> -        dev->stats.tx_dropped++;
> -        dev_kfree_skb_any(skb);
> -        return 0;
> -    }
> -
> -    /* Get a packet buffer */
> -    packet_buffer = cvmx_fpa_alloc(CVMX_FPA_PACKET_POOL);
> -    if (unlikely(!packet_buffer)) {
> -        printk_ratelimited("%s: Failed to allocate a packet buffer\n",
> -                   dev->name);
> -        cvmx_fpa_free(work, CVMX_FPA_WQE_POOL, 1);
> -        dev->stats.tx_dropped++;
> -        dev_kfree_skb_any(skb);
> -        return 0;
> -    }
> -
> -    /*
> -     * Calculate where we need to copy the data to. We need to
> -     * leave 8 bytes for a next pointer (unused). We also need to
> -     * include any configure skip. Then we need to align the IP
> -     * packet src and dest into the same 64bit word. The below
> -     * calculation may add a little extra, but that doesn't
> -     * hurt.
> -     */
> -    copy_location = packet_buffer + sizeof(u64);
> -    copy_location += ((CVMX_HELPER_FIRST_MBUFF_SKIP + 7) & 0xfff8) + 6;
> -
> -    /*
> -     * We have to copy the packet since whoever processes this
> -     * packet will free it to a hardware pool. We can't use the
> -     * trick of counting outstanding packets like in
> -     * cvm_oct_xmit.
> -     */
> -    memcpy(copy_location, skb->data, skb->len);
> -
> -    /*
> -     * Fill in some of the work queue fields. We may need to add
> -     * more if the software at the other end needs them.
> -     */
> -    if (!OCTEON_IS_MODEL(OCTEON_CN68XX))
> -        work->word0.pip.cn38xx.hw_chksum = skb->csum;
> -    work->word1.len = skb->len;
> -    cvmx_wqe_set_port(work, priv->port);
> -    cvmx_wqe_set_qos(work, priv->port & 0x7);
> -    cvmx_wqe_set_grp(work, pow_send_group);
> -    work->word1.tag_type = CVMX_HELPER_INPUT_TAG_TYPE;
> -    work->word1.tag = pow_send_group;    /* FIXME */
> -    /* Default to zero. Sets of zero later are commented out */
> -    work->word2.u64 = 0;
> -    work->word2.s.bufs = 1;
> -    work->packet_ptr.u64 = 0;
> -    work->packet_ptr.s.addr = cvmx_ptr_to_phys(copy_location);
> -    work->packet_ptr.s.pool = CVMX_FPA_PACKET_POOL;
> -    work->packet_ptr.s.size = CVMX_FPA_PACKET_POOL_SIZE;
> -    work->packet_ptr.s.back = (copy_location - packet_buffer) >> 7;
> -
> -    if (skb->protocol == htons(ETH_P_IP)) {
> -        work->word2.s.ip_offset = 14;
> -#if 0
> -        work->word2.s.vlan_valid = 0;    /* FIXME */
> -        work->word2.s.vlan_cfi = 0;    /* FIXME */
> -        work->word2.s.vlan_id = 0;    /* FIXME */
> -        work->word2.s.dec_ipcomp = 0;    /* FIXME */
> -#endif
> -        work->word2.s.tcp_or_udp =
> -            (ip_hdr(skb)->protocol == IPPROTO_TCP) ||
> -            (ip_hdr(skb)->protocol == IPPROTO_UDP);
> -#if 0
> -        /* FIXME */
> -        work->word2.s.dec_ipsec = 0;
> -        /* We only support IPv4 right now */
> -        work->word2.s.is_v6 = 0;
> -        /* Hardware would set to zero */
> -        work->word2.s.software = 0;
> -        /* No error, packet is internal */
> -        work->word2.s.L4_error = 0;
> -#endif
> -        work->word2.s.is_frag = !((ip_hdr(skb)->frag_off == 0) ||
> -                      (ip_hdr(skb)->frag_off ==
> -                          cpu_to_be16(1 << 14)));
> -#if 0
> -        /* Assume Linux is sending a good packet */
> -        work->word2.s.IP_exc = 0;
> -#endif
> -        work->word2.s.is_bcast = (skb->pkt_type == PACKET_BROADCAST);
> -        work->word2.s.is_mcast = (skb->pkt_type == PACKET_MULTICAST);
> -#if 0
> -        /* This is an IP packet */
> -        work->word2.s.not_IP = 0;
> -        /* No error, packet is internal */
> -        work->word2.s.rcv_error = 0;
> -        /* No error, packet is internal */
> -        work->word2.s.err_code = 0;
> -#endif
> -
> -        /*
> -         * When copying the data, include 4 bytes of the
> -         * ethernet header to align the same way hardware
> -         * does.
> -         */
> -        memcpy(work->packet_data, skb->data + 10,
> -               sizeof(work->packet_data));
> -    } else {
> -#if 0
> -        work->word2.snoip.vlan_valid = 0;    /* FIXME */
> -        work->word2.snoip.vlan_cfi = 0;    /* FIXME */
> -        work->word2.snoip.vlan_id = 0;    /* FIXME */
> -        work->word2.snoip.software = 0;    /* Hardware would set to zero */
> -#endif
> -        work->word2.snoip.is_rarp = skb->protocol == htons(ETH_P_RARP);
> -        work->word2.snoip.is_arp = skb->protocol == htons(ETH_P_ARP);
> -        work->word2.snoip.is_bcast =
> -            (skb->pkt_type == PACKET_BROADCAST);
> -        work->word2.snoip.is_mcast =
> -            (skb->pkt_type == PACKET_MULTICAST);
> -        work->word2.snoip.not_IP = 1;    /* IP was done up above */
> -#if 0
> -        /* No error, packet is internal */
> -        work->word2.snoip.rcv_error = 0;
> -        /* No error, packet is internal */
> -        work->word2.snoip.err_code = 0;
> -#endif
> -        memcpy(work->packet_data, skb->data, sizeof(work->packet_data));
> -    }
> -
> -    /* Submit the packet to the POW */
> -    cvmx_pow_work_submit(work, work->word1.tag, work->word1.tag_type,
> -                 cvmx_wqe_get_qos(work), cvmx_wqe_get_grp(work));
> -    dev->stats.tx_packets++;
> -    dev->stats.tx_bytes += skb->len;
> -    dev_consume_skb_any(skb);
> -    return 0;
> -}
> -
> -/**
> - * cvm_oct_tx_shutdown_dev - free all skb that are currently queued for TX.
> - * @dev:    Device being shutdown
> - *
> - */
> -void cvm_oct_tx_shutdown_dev(struct net_device *dev)
> -{
> -    struct octeon_ethernet *priv = netdev_priv(dev);
> -    unsigned long flags;
> -    int qos;
> -
> -    for (qos = 0; qos < 16; qos++) {
> -        spin_lock_irqsave(&priv->tx_free_list[qos].lock, flags);
> -        while (skb_queue_len(&priv->tx_free_list[qos]))
> -            dev_kfree_skb_any(__skb_dequeue
> -                      (&priv->tx_free_list[qos]));
> -        spin_unlock_irqrestore(&priv->tx_free_list[qos].lock, flags);
> -    }
> -}
> -
> -static void cvm_oct_tx_do_cleanup(unsigned long arg)
> -{
> -    int port;
> -
> -    for (port = 0; port < TOTAL_NUMBER_OF_PORTS; port++) {
> -        if (cvm_oct_device[port]) {
> -            struct net_device *dev = cvm_oct_device[port];
> -
> -            cvm_oct_free_tx_skbs(dev);
> -        }
> -    }
> -}
> -
> -static irqreturn_t cvm_oct_tx_cleanup_watchdog(int cpl, void *dev_id)
> -{
> -    /* Disable the interrupt.  */
> -    cvmx_write_csr(CVMX_CIU_TIMX(1), 0);
> -    /* Do the work in the tasklet.  */
> -    tasklet_schedule(&cvm_oct_tx_cleanup_tasklet);
> -    return IRQ_HANDLED;
> -}
> -
> -void cvm_oct_tx_initialize(void)
> -{
> -    int i;
> -
> -    /* Disable the interrupt.  */
> -    cvmx_write_csr(CVMX_CIU_TIMX(1), 0);
> -    /* Register an IRQ handler to receive CIU_TIMX(1) interrupts */
> -    i = request_irq(OCTEON_IRQ_TIMER1,
> -            cvm_oct_tx_cleanup_watchdog, 0,
> -            "Ethernet", cvm_oct_device);
> -
> -    if (i)
> -        panic("Could not acquire Ethernet IRQ %d\n", OCTEON_IRQ_TIMER1);
> -}
> -
> -void cvm_oct_tx_shutdown(void)
> -{
> -    /* Free the interrupt handler */
> -    free_irq(OCTEON_IRQ_TIMER1, cvm_oct_device);
> -}
> diff --git a/drivers/staging/octeon/ethernet-tx.h b/drivers/staging/octeon/ethernet-tx.h
> deleted file mode 100644
> index 78936e9b33b0..000000000000
> --- a/drivers/staging/octeon/ethernet-tx.h
> +++ /dev/null
> @@ -1,14 +0,0 @@
> -/* SPDX-License-Identifier: GPL-2.0 */
> -/*
> - * This file is based on code from OCTEON SDK by Cavium Networks.
> - *
> - * Copyright (c) 2003-2007 Cavium Networks
> - */
> -
> -int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev);
> -int cvm_oct_xmit_pow(struct sk_buff *skb, struct net_device *dev);
> -int cvm_oct_transmit_qos(struct net_device *dev, void *work_queue_entry,
> -             int do_free, int qos);
> -void cvm_oct_tx_initialize(void);
> -void cvm_oct_tx_shutdown(void);
> -void cvm_oct_tx_shutdown_dev(struct net_device *dev);
> diff --git a/drivers/staging/octeon/ethernet-util.h b/drivers/staging/octeon/ethernet-util.h
> deleted file mode 100644
> index 2af83a12ca78..000000000000
> --- a/drivers/staging/octeon/ethernet-util.h
> +++ /dev/null
> @@ -1,47 +0,0 @@
> -/* SPDX-License-Identifier: GPL-2.0 */
> -/*
> - * This file is based on code from OCTEON SDK by Cavium Networks.
> - *
> - * Copyright (c) 2003-2007 Cavium Networks
> - */
> -
> -/**
> - * cvm_oct_get_buffer_ptr - convert packet data address to pointer
> - * @packet_ptr: Packet data hardware address
> - *
> - * Returns Packet buffer pointer
> - */
> -static inline void *cvm_oct_get_buffer_ptr(union cvmx_buf_ptr packet_ptr)
> -{
> -    return cvmx_phys_to_ptr(((packet_ptr.s.addr >> 7) - packet_ptr.s.back)
> -                << 7);
> -}
> -
> -/**
> - * INTERFACE - convert IPD port to logical interface
> - * @ipd_port: Port to check
> - *
> - * Returns Logical interface
> - */
> -static inline int INTERFACE(int ipd_port)
> -{
> -    int interface;
> -
> -    if (ipd_port == CVMX_PIP_NUM_INPUT_PORTS)
> -        return 10;
> -    interface = cvmx_helper_get_interface_num(ipd_port);
> -    if (interface >= 0)
> -        return interface;
> -    panic("Illegal ipd_port %d passed to %s\n", ipd_port, __func__);
> -}
> -
> -/**
> - * INDEX - convert IPD/PKO port number to the port's interface index
> - * @ipd_port: Port to check
> - *
> - * Returns Index into interface port list
> - */
> -static inline int INDEX(int ipd_port)
> -{
> -    return cvmx_helper_get_interface_index_num(ipd_port);
> -}
> diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c
> deleted file mode 100644
> index f42c3816ce49..000000000000
> --- a/drivers/staging/octeon/ethernet.c
> +++ /dev/null
> @@ -1,992 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0
> -/*
> - * This file is based on code from OCTEON SDK by Cavium Networks.
> - *
> - * Copyright (c) 2003-2007 Cavium Networks
> - */
> -
> -#include <linux/platform_device.h>
> -#include <linux/kernel.h>
> -#include <linux/module.h>
> -#include <linux/netdevice.h>
> -#include <linux/etherdevice.h>
> -#include <linux/phy.h>
> -#include <linux/slab.h>
> -#include <linux/interrupt.h>
> -#include <linux/of_net.h>
> -#include <linux/if_ether.h>
> -#include <linux/if_vlan.h>
> -
> -#include <net/dst.h>
> -
> -#include "octeon-ethernet.h"
> -#include "ethernet-defines.h"
> -#include "ethernet-mem.h"
> -#include "ethernet-rx.h"
> -#include "ethernet-tx.h"
> -#include "ethernet-mdio.h"
> -#include "ethernet-util.h"
> -
> -#define OCTEON_MAX_MTU 65392
> -
> -static int num_packet_buffers = 1024;
> -module_param(num_packet_buffers, int, 0444);
> -MODULE_PARM_DESC(num_packet_buffers, "\n"
> -    "\tNumber of packet buffers to allocate and store in the\n"
> -    "\tFPA. By default, 1024 packet buffers are used.\n");
> -
> -static int pow_receive_group = 15;
> -module_param(pow_receive_group, int, 0444);
> -MODULE_PARM_DESC(pow_receive_group, "\n"
> -    "\tPOW group to receive packets from. All ethernet hardware\n"
> -    "\twill be configured to send incoming packets to this POW\n"
> -    "\tgroup. Also any other software can submit packets to this\n"
> -    "\tgroup for the kernel to process.");
> -
> -static int receive_group_order;
> -module_param(receive_group_order, int, 0444);
> -MODULE_PARM_DESC(receive_group_order, "\n"
> -    "\tOrder (0..4) of receive groups to take into use. Ethernet hardware\n"
> -    "\twill be configured to send incoming packets to multiple POW\n"
> -    "\tgroups. pow_receive_group parameter is ignored when multiple\n"
> -    "\tgroups are taken into use and groups are allocated starting\n"
> -    "\tfrom 0. By default, a single group is used.\n");
> -
> -int pow_send_group = -1;
> -module_param(pow_send_group, int, 0644);
> -MODULE_PARM_DESC(pow_send_group, "\n"
> -    "\tPOW group to send packets to other software on. This\n"
> -    "\tcontrols the creation of the virtual device pow0.\n"
> -    "\talways_use_pow also depends on this value.");
> -
> -int always_use_pow;
> -module_param(always_use_pow, int, 0444);
> -MODULE_PARM_DESC(always_use_pow, "\n"
> -    "\tWhen set, always send to the pow group. This will cause\n"
> -    "\tpackets sent to real ethernet devices to be sent to the\n"
> -    "\tPOW group instead of the hardware. Unless some other\n"
> -    "\tapplication changes the config, packets will still be\n"
> -    "\treceived from the low level hardware. Use this option\n"
> -    "\tto allow a CVMX app to intercept all packets from the\n"
> -    "\tlinux kernel. You must specify pow_send_group along with\n"
> -    "\tthis option.");
> -
> -char pow_send_list[128] = "";
> -module_param_string(pow_send_list, pow_send_list, sizeof(pow_send_list), 0444);
> -MODULE_PARM_DESC(pow_send_list, "\n"
> -    "\tComma separated list of ethernet devices that should use the\n"
> -    "\tPOW for transmit instead of the actual ethernet hardware. This\n"
> -    "\tis a per port version of always_use_pow. always_use_pow takes\n"
> -    "\tprecedence over this list. For example, setting this to\n"
> -    "\t\"eth2,spi3,spi7\" would cause these three devices to transmit\n"
> -    "\tusing the pow_send_group.");
> -
> -int rx_napi_weight = 32;
> -module_param(rx_napi_weight, int, 0444);
> -MODULE_PARM_DESC(rx_napi_weight, "The NAPI WEIGHT parameter.");
> -
> -/* Mask indicating which receive groups are in use. */
> -int pow_receive_groups;
> -
> -/*
> - * cvm_oct_poll_queue_stopping - flag to indicate polling should stop.
> - *
> - * Set to one right before cvm_oct_poll_queue is destroyed.
> - */
> -atomic_t cvm_oct_poll_queue_stopping = ATOMIC_INIT(0);
> -
> -/*
> - * Array of every ethernet device owned by this driver indexed by
> - * the ipd input port number.
> - */
> -struct net_device *cvm_oct_device[TOTAL_NUMBER_OF_PORTS];
> -
> -u64 cvm_oct_tx_poll_interval;
> -
> -static void cvm_oct_rx_refill_worker(struct work_struct *work);
> -static DECLARE_DELAYED_WORK(cvm_oct_rx_refill_work, cvm_oct_rx_refill_worker);
> -
> -static void cvm_oct_rx_refill_worker(struct work_struct *work)
> -{
> -    /*
> -     * FPA 0 may have been drained, try to refill it if we need
> -     * more than num_packet_buffers / 2, otherwise normal receive
> -     * processing will refill it.  If it were drained, no packets
> -     * could be received so cvm_oct_napi_poll would never be
> -     * invoked to do the refill.
> -     */
> -    cvm_oct_rx_refill_pool(num_packet_buffers / 2);
> -
> -    if (!atomic_read(&cvm_oct_poll_queue_stopping))
> -        schedule_delayed_work(&cvm_oct_rx_refill_work, HZ);
> -}
> -
> -static void cvm_oct_periodic_worker(struct work_struct *work)
> -{
> -    struct octeon_ethernet *priv = container_of(work,
> -                            struct octeon_ethernet,
> -                            port_periodic_work.work);
> -
> -    if (priv->poll)
> -        priv->poll(cvm_oct_device[priv->port]);
> -
> -    cvm_oct_device[priv->port]->netdev_ops->ndo_get_stats
> -                        (cvm_oct_device[priv->port]);
> -
> -    if (!atomic_read(&cvm_oct_poll_queue_stopping))
> -        schedule_delayed_work(&priv->port_periodic_work, HZ);
> -}
> -
> -static void cvm_oct_configure_common_hw(void)
> -{
> -    /* Setup the FPA */
> -    cvmx_fpa_enable();
> -    cvm_oct_mem_fill_fpa(CVMX_FPA_PACKET_POOL, CVMX_FPA_PACKET_POOL_SIZE,
> -                 num_packet_buffers);
> -    cvm_oct_mem_fill_fpa(CVMX_FPA_WQE_POOL, CVMX_FPA_WQE_POOL_SIZE,
> -                 num_packet_buffers);
> -    if (CVMX_FPA_OUTPUT_BUFFER_POOL != CVMX_FPA_PACKET_POOL)
> -        cvm_oct_mem_fill_fpa(CVMX_FPA_OUTPUT_BUFFER_POOL,
> -                     CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE, 1024);
> -
> -#ifdef __LITTLE_ENDIAN
> -    {
> -        union cvmx_ipd_ctl_status ipd_ctl_status;
> -
> -        ipd_ctl_status.u64 = cvmx_read_csr(CVMX_IPD_CTL_STATUS);
> -        ipd_ctl_status.s.pkt_lend = 1;
> -        ipd_ctl_status.s.wqe_lend = 1;
> -        cvmx_write_csr(CVMX_IPD_CTL_STATUS, ipd_ctl_status.u64);
> -    }
> -#endif
> -
> -    cvmx_helper_setup_red(num_packet_buffers / 4, num_packet_buffers / 8);
> -}
> -
> -/**
> - * cvm_oct_free_work- Free a work queue entry
> - *
> - * @work_queue_entry: Work queue entry to free
> - *
> - * Returns Zero on success, Negative on failure.
> - */
> -int cvm_oct_free_work(void *work_queue_entry)
> -{
> -    struct cvmx_wqe *work = work_queue_entry;
> -
> -    int segments = work->word2.s.bufs;
> -    union cvmx_buf_ptr segment_ptr = work->packet_ptr;
> -
> -    while (segments--) {
> -        union cvmx_buf_ptr next_ptr = *(union cvmx_buf_ptr *)
> -            cvmx_phys_to_ptr(segment_ptr.s.addr - 8);
> -        if (unlikely(!segment_ptr.s.i))
> -            cvmx_fpa_free(cvm_oct_get_buffer_ptr(segment_ptr),
> -                      segment_ptr.s.pool,
> -                      CVMX_FPA_PACKET_POOL_SIZE / 128);
> -        segment_ptr = next_ptr;
> -    }
> -    cvmx_fpa_free(work, CVMX_FPA_WQE_POOL, 1);
> -
> -    return 0;
> -}
> -EXPORT_SYMBOL(cvm_oct_free_work);
> -
> -/**
> - * cvm_oct_common_get_stats - get the low level ethernet statistics
> - * @dev:    Device to get the statistics from
> - *
> - * Returns Pointer to the statistics
> - */
> -static struct net_device_stats *cvm_oct_common_get_stats(struct net_device *dev)
> -{
> -    cvmx_pip_port_status_t rx_status;
> -    cvmx_pko_port_status_t tx_status;
> -    struct octeon_ethernet *priv = netdev_priv(dev);
> -
> -    if (priv->port < CVMX_PIP_NUM_INPUT_PORTS) {
> -        if (octeon_is_simulation()) {
> -            /* The simulator doesn't support statistics */
> -            memset(&rx_status, 0, sizeof(rx_status));
> -            memset(&tx_status, 0, sizeof(tx_status));
> -        } else {
> -            cvmx_pip_get_port_status(priv->port, 1, &rx_status);
> -            cvmx_pko_get_port_status(priv->port, 1, &tx_status);
> -        }
> -
> -        dev->stats.rx_packets += rx_status.inb_packets;
> -        dev->stats.tx_packets += tx_status.packets;
> -        dev->stats.rx_bytes += rx_status.inb_octets;
> -        dev->stats.tx_bytes += tx_status.octets;
> -        dev->stats.multicast += rx_status.multicast_packets;
> -        dev->stats.rx_crc_errors += rx_status.inb_errors;
> -        dev->stats.rx_frame_errors += rx_status.fcs_align_err_packets;
> -        dev->stats.rx_dropped += rx_status.dropped_packets;
> -    }
> -
> -    return &dev->stats;
> -}
> -
> -/**
> - * cvm_oct_common_change_mtu - change the link MTU
> - * @dev:     Device to change
> - * @new_mtu: The new MTU
> - *
> - * Returns Zero on success
> - */
> -static int cvm_oct_common_change_mtu(struct net_device *dev, int new_mtu)
> -{
> -    struct octeon_ethernet *priv = netdev_priv(dev);
> -    int interface = INTERFACE(priv->port);
> -#if IS_ENABLED(CONFIG_VLAN_8021Q)
> -    int vlan_bytes = VLAN_HLEN;
> -#else
> -    int vlan_bytes = 0;
> -#endif
> -    int mtu_overhead = ETH_HLEN + ETH_FCS_LEN + vlan_bytes;
> -
> -    dev->mtu = new_mtu;
> -
> -    if ((interface < 2) &&
> -        (cvmx_helper_interface_get_mode(interface) !=
> -        CVMX_HELPER_INTERFACE_MODE_SPI)) {
> -        int index = INDEX(priv->port);
> -        /* Add ethernet header and FCS, and VLAN if configured. */
> -        int max_packet = new_mtu + mtu_overhead;
> -
> -        if (OCTEON_IS_MODEL(OCTEON_CN3XXX) ||
> -            OCTEON_IS_MODEL(OCTEON_CN58XX)) {
> -            /* Signal errors on packets larger than the MTU */
> -            cvmx_write_csr(CVMX_GMXX_RXX_FRM_MAX(index, interface),
> -                       max_packet);
> -        } else {
> -            /*
> -             * Set the hardware to truncate packets larger
> -             * than the MTU and smaller the 64 bytes.
> -             */
> -            union cvmx_pip_frm_len_chkx frm_len_chk;
> -
> -            frm_len_chk.u64 = 0;
> -            frm_len_chk.s.minlen = VLAN_ETH_ZLEN;
> -            frm_len_chk.s.maxlen = max_packet;
> -            cvmx_write_csr(CVMX_PIP_FRM_LEN_CHKX(interface),
> -                       frm_len_chk.u64);
> -        }
> -        /*
> -         * Set the hardware to truncate packets larger than
> -         * the MTU. The jabber register must be set to a
> -         * multiple of 8 bytes, so round up.
> -         */
> -        cvmx_write_csr(CVMX_GMXX_RXX_JABBER(index, interface),
> -                   (max_packet + 7) & ~7u);
> -    }
> -    return 0;
> -}
> -
> -/**
> - * cvm_oct_common_set_multicast_list - set the multicast list
> - * @dev:    Device to work on
> - */
> -static void cvm_oct_common_set_multicast_list(struct net_device *dev)
> -{
> -    union cvmx_gmxx_prtx_cfg gmx_cfg;
> -    struct octeon_ethernet *priv = netdev_priv(dev);
> -    int interface = INTERFACE(priv->port);
> -
> -    if ((interface < 2) &&
> -        (cvmx_helper_interface_get_mode(interface) !=
> -        CVMX_HELPER_INTERFACE_MODE_SPI)) {
> -        union cvmx_gmxx_rxx_adr_ctl control;
> -        int index = INDEX(priv->port);
> -
> -        control.u64 = 0;
> -        control.s.bcst = 1;    /* Allow broadcast MAC addresses */
> -
> -        if (!netdev_mc_empty(dev) || (dev->flags & IFF_ALLMULTI) ||
> -            (dev->flags & IFF_PROMISC))
> -            /* Force accept multicast packets */
> -            control.s.mcst = 2;
> -        else
> -            /* Force reject multicast packets */
> -            control.s.mcst = 1;
> -
> -        if (dev->flags & IFF_PROMISC)
> -            /*
> -             * Reject matches if promisc. Since CAM is
> -             * shut off, should accept everything.
> -             */
> -            control.s.cam_mode = 0;
> -        else
> -            /* Filter packets based on the CAM */
> -            control.s.cam_mode = 1;
> -
> -        gmx_cfg.u64 =
> -            cvmx_read_csr(CVMX_GMXX_PRTX_CFG(index, interface));
> -        cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface),
> -                   gmx_cfg.u64 & ~1ull);
> -
> -        cvmx_write_csr(CVMX_GMXX_RXX_ADR_CTL(index, interface),
> -                   control.u64);
> -        if (dev->flags & IFF_PROMISC)
> -            cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM_EN
> -                       (index, interface), 0);
> -        else
> -            cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM_EN
> -                       (index, interface), 1);
> -
> -        cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface),
> -                   gmx_cfg.u64);
> -    }
> -}
> -
> -static int cvm_oct_set_mac_filter(struct net_device *dev)
> -{
> -    struct octeon_ethernet *priv = netdev_priv(dev);
> -    union cvmx_gmxx_prtx_cfg gmx_cfg;
> -    int interface = INTERFACE(priv->port);
> -
> -    if ((interface < 2) &&
> -        (cvmx_helper_interface_get_mode(interface) !=
> -        CVMX_HELPER_INTERFACE_MODE_SPI)) {
> -        int i;
> -        u8 *ptr = dev->dev_addr;
> -        u64 mac = 0;
> -        int index = INDEX(priv->port);
> -
> -        for (i = 0; i < 6; i++)
> -            mac = (mac << 8) | (u64)ptr[i];
> -
> -        gmx_cfg.u64 =
> -            cvmx_read_csr(CVMX_GMXX_PRTX_CFG(index, interface));
> -        cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface),
> -                   gmx_cfg.u64 & ~1ull);
> -
> -        cvmx_write_csr(CVMX_GMXX_SMACX(index, interface), mac);
> -        cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM0(index, interface),
> -                   ptr[0]);
> -        cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM1(index, interface),
> -                   ptr[1]);
> -        cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM2(index, interface),
> -                   ptr[2]);
> -        cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM3(index, interface),
> -                   ptr[3]);
> -        cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM4(index, interface),
> -                   ptr[4]);
> -        cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM5(index, interface),
> -                   ptr[5]);
> -        cvm_oct_common_set_multicast_list(dev);
> -        cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface),
> -                   gmx_cfg.u64);
> -    }
> -    return 0;
> -}
> -
> -/**
> - * cvm_oct_common_set_mac_address - set the hardware MAC address for a device
> - * @dev:    The device in question.
> - * @addr:   Socket address.
> - *
> - * Returns Zero on success
> - */
> -static int cvm_oct_common_set_mac_address(struct net_device *dev, void *addr)
> -{
> -    int r = eth_mac_addr(dev, addr);
> -
> -    if (r)
> -        return r;
> -    return cvm_oct_set_mac_filter(dev);
> -}
> -
> -/**
> - * cvm_oct_common_init - per network device initialization
> - * @dev:    Device to initialize
> - *
> - * Returns Zero on success
> - */
> -int cvm_oct_common_init(struct net_device *dev)
> -{
> -    struct octeon_ethernet *priv = netdev_priv(dev);
> -    const u8 *mac = NULL;
> -
> -    if (priv->of_node)
> -        mac = of_get_mac_address(priv->of_node);
> -
> -    if (!IS_ERR_OR_NULL(mac))
> -        ether_addr_copy(dev->dev_addr, mac);
> -    else
> -        eth_hw_addr_random(dev);
> -
> -    /*
> -     * Force the interface to use the POW send if always_use_pow
> -     * was specified or it is in the pow send list.
> -     */
> -    if ((pow_send_group != -1) &&
> -        (always_use_pow || strstr(pow_send_list, dev->name)))
> -        priv->queue = -1;
> -
> -    if (priv->queue != -1)
> -        dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM;
> -
> -    /* We do our own locking, Linux doesn't need to */
> -    dev->features |= NETIF_F_LLTX;
> -    dev->ethtool_ops = &cvm_oct_ethtool_ops;
> -
> -    cvm_oct_set_mac_filter(dev);
> -    dev_set_mtu(dev, dev->mtu);
> -
> -    /*
> -     * Zero out stats for port so we won't mistakenly show
> -     * counters from the bootloader.
> -     */
> -    memset(dev->netdev_ops->ndo_get_stats(dev), 0,
> -           sizeof(struct net_device_stats));
> -
> -    if (dev->netdev_ops->ndo_stop)
> -        dev->netdev_ops->ndo_stop(dev);
> -
> -    return 0;
> -}
> -
> -void cvm_oct_common_uninit(struct net_device *dev)
> -{
> -    if (dev->phydev)
> -        phy_disconnect(dev->phydev);
> -}
> -
> -int cvm_oct_common_open(struct net_device *dev,
> -            void (*link_poll)(struct net_device *))
> -{
> -    union cvmx_gmxx_prtx_cfg gmx_cfg;
> -    struct octeon_ethernet *priv = netdev_priv(dev);
> -    int interface = INTERFACE(priv->port);
> -    int index = INDEX(priv->port);
> -    union cvmx_helper_link_info link_info;
> -    int rv;
> -
> -    rv = cvm_oct_phy_setup_device(dev);
> -    if (rv)
> -        return rv;
> -
> -    gmx_cfg.u64 = cvmx_read_csr(CVMX_GMXX_PRTX_CFG(index, interface));
> -    gmx_cfg.s.en = 1;
> -    if (octeon_has_feature(OCTEON_FEATURE_PKND))
> -        gmx_cfg.s.pknd = priv->port;
> -    cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface), gmx_cfg.u64);
> -
> -    if (octeon_is_simulation())
> -        return 0;
> -
> -    if (dev->phydev) {
> -        int r = phy_read_status(dev->phydev);
> -
> -        if (r == 0 && dev->phydev->link == 0)
> -            netif_carrier_off(dev);
> -        cvm_oct_adjust_link(dev);
> -    } else {
> -        link_info = cvmx_helper_link_get(priv->port);
> -        if (!link_info.s.link_up)
> -            netif_carrier_off(dev);
> -        priv->poll = link_poll;
> -        link_poll(dev);
> -    }
> -
> -    return 0;
> -}
> -
> -void cvm_oct_link_poll(struct net_device *dev)
> -{
> -    struct octeon_ethernet *priv = netdev_priv(dev);
> -    union cvmx_helper_link_info link_info;
> -
> -    link_info = cvmx_helper_link_get(priv->port);
> -    if (link_info.u64 == priv->link_info)
> -        return;
> -
> -    if (cvmx_helper_link_set(priv->port, link_info))
> -        link_info.u64 = priv->link_info;
> -    else
> -        priv->link_info = link_info.u64;
> -
> -    if (link_info.s.link_up) {
> -        if (!netif_carrier_ok(dev))
> -            netif_carrier_on(dev);
> -    } else if (netif_carrier_ok(dev)) {
> -        netif_carrier_off(dev);
> -    }
> -    cvm_oct_note_carrier(priv, link_info);
> -}
> -
> -static int cvm_oct_xaui_open(struct net_device *dev)
> -{
> -    return cvm_oct_common_open(dev, cvm_oct_link_poll);
> -}
> -
> -static const struct net_device_ops cvm_oct_npi_netdev_ops = {
> -    .ndo_init        = cvm_oct_common_init,
> -    .ndo_uninit        = cvm_oct_common_uninit,
> -    .ndo_start_xmit        = cvm_oct_xmit,
> -    .ndo_set_rx_mode    = cvm_oct_common_set_multicast_list,
> -    .ndo_set_mac_address    = cvm_oct_common_set_mac_address,
> -    .ndo_do_ioctl        = cvm_oct_ioctl,
> -    .ndo_change_mtu        = cvm_oct_common_change_mtu,
> -    .ndo_get_stats        = cvm_oct_common_get_stats,
> -#ifdef CONFIG_NET_POLL_CONTROLLER
> -    .ndo_poll_controller    = cvm_oct_poll_controller,
> -#endif
> -};
> -
> -static const struct net_device_ops cvm_oct_xaui_netdev_ops = {
> -    .ndo_init        = cvm_oct_common_init,
> -    .ndo_uninit        = cvm_oct_common_uninit,
> -    .ndo_open        = cvm_oct_xaui_open,
> -    .ndo_stop        = cvm_oct_common_stop,
> -    .ndo_start_xmit        = cvm_oct_xmit,
> -    .ndo_set_rx_mode    = cvm_oct_common_set_multicast_list,
> -    .ndo_set_mac_address    = cvm_oct_common_set_mac_address,
> -    .ndo_do_ioctl        = cvm_oct_ioctl,
> -    .ndo_change_mtu        = cvm_oct_common_change_mtu,
> -    .ndo_get_stats        = cvm_oct_common_get_stats,
> -#ifdef CONFIG_NET_POLL_CONTROLLER
> -    .ndo_poll_controller    = cvm_oct_poll_controller,
> -#endif
> -};
> -
> -static const struct net_device_ops cvm_oct_sgmii_netdev_ops = {
> -    .ndo_init        = cvm_oct_sgmii_init,
> -    .ndo_uninit        = cvm_oct_common_uninit,
> -    .ndo_open        = cvm_oct_sgmii_open,
> -    .ndo_stop        = cvm_oct_common_stop,
> -    .ndo_start_xmit        = cvm_oct_xmit,
> -    .ndo_set_rx_mode    = cvm_oct_common_set_multicast_list,
> -    .ndo_set_mac_address    = cvm_oct_common_set_mac_address,
> -    .ndo_do_ioctl        = cvm_oct_ioctl,
> -    .ndo_change_mtu        = cvm_oct_common_change_mtu,
> -    .ndo_get_stats        = cvm_oct_common_get_stats,
> -#ifdef CONFIG_NET_POLL_CONTROLLER
> -    .ndo_poll_controller    = cvm_oct_poll_controller,
> -#endif
> -};
> -
> -static const struct net_device_ops cvm_oct_spi_netdev_ops = {
> -    .ndo_init        = cvm_oct_spi_init,
> -    .ndo_uninit        = cvm_oct_spi_uninit,
> -    .ndo_start_xmit        = cvm_oct_xmit,
> -    .ndo_set_rx_mode    = cvm_oct_common_set_multicast_list,
> -    .ndo_set_mac_address    = cvm_oct_common_set_mac_address,
> -    .ndo_do_ioctl        = cvm_oct_ioctl,
> -    .ndo_change_mtu        = cvm_oct_common_change_mtu,
> -    .ndo_get_stats        = cvm_oct_common_get_stats,
> -#ifdef CONFIG_NET_POLL_CONTROLLER
> -    .ndo_poll_controller    = cvm_oct_poll_controller,
> -#endif
> -};
> -
> -static const struct net_device_ops cvm_oct_rgmii_netdev_ops = {
> -    .ndo_init        = cvm_oct_common_init,
> -    .ndo_uninit        = cvm_oct_common_uninit,
> -    .ndo_open        = cvm_oct_rgmii_open,
> -    .ndo_stop        = cvm_oct_common_stop,
> -    .ndo_start_xmit        = cvm_oct_xmit,
> -    .ndo_set_rx_mode    = cvm_oct_common_set_multicast_list,
> -    .ndo_set_mac_address    = cvm_oct_common_set_mac_address,
> -    .ndo_do_ioctl        = cvm_oct_ioctl,
> -    .ndo_change_mtu        = cvm_oct_common_change_mtu,
> -    .ndo_get_stats        = cvm_oct_common_get_stats,
> -#ifdef CONFIG_NET_POLL_CONTROLLER
> -    .ndo_poll_controller    = cvm_oct_poll_controller,
> -#endif
> -};
> -
> -static const struct net_device_ops cvm_oct_pow_netdev_ops = {
> -    .ndo_init        = cvm_oct_common_init,
> -    .ndo_start_xmit        = cvm_oct_xmit_pow,
> -    .ndo_set_rx_mode    = cvm_oct_common_set_multicast_list,
> -    .ndo_set_mac_address    = cvm_oct_common_set_mac_address,
> -    .ndo_do_ioctl        = cvm_oct_ioctl,
> -    .ndo_change_mtu        = cvm_oct_common_change_mtu,
> -    .ndo_get_stats        = cvm_oct_common_get_stats,
> -#ifdef CONFIG_NET_POLL_CONTROLLER
> -    .ndo_poll_controller    = cvm_oct_poll_controller,
> -#endif
> -};
> -
> -static struct device_node *cvm_oct_of_get_child
> -                (const struct device_node *parent, int reg_val)
> -{
> -    struct device_node *node = NULL;
> -    int size;
> -    const __be32 *addr;
> -
> -    for (;;) {
> -        node = of_get_next_child(parent, node);
> -        if (!node)
> -            break;
> -        addr = of_get_property(node, "reg", &size);
> -        if (addr && (be32_to_cpu(*addr) == reg_val))
> -            break;
> -    }
> -    return node;
> -}
> -
> -static struct device_node *cvm_oct_node_for_port(struct device_node *pip,
> -                         int interface, int port)
> -{
> -    struct device_node *ni, *np;
> -
> -    ni = cvm_oct_of_get_child(pip, interface);
> -    if (!ni)
> -        return NULL;
> -
> -    np = cvm_oct_of_get_child(ni, port);
> -    of_node_put(ni);
> -
> -    return np;
> -}
> -
> -static void cvm_set_rgmii_delay(struct octeon_ethernet *priv, int iface,
> -                int port)
> -{
> -    struct device_node *np = priv->of_node;
> -    u32 delay_value;
> -    bool rx_delay;
> -    bool tx_delay;
> -
> -    /* By default, both RX/TX delay is enabled in
> -     * __cvmx_helper_rgmii_enable().
> -     */
> -    rx_delay = true;
> -    tx_delay = true;
> -
> -    if (!of_property_read_u32(np, "rx-delay", &delay_value)) {
> -        cvmx_write_csr(CVMX_ASXX_RX_CLK_SETX(port, iface), delay_value);
> -        rx_delay = delay_value > 0;
> -    }
> -    if (!of_property_read_u32(np, "tx-delay", &delay_value)) {
> -        cvmx_write_csr(CVMX_ASXX_TX_CLK_SETX(port, iface), delay_value);
> -        tx_delay = delay_value > 0;
> -    }
> -
> -    if (!rx_delay && !tx_delay)
> -        priv->phy_mode = PHY_INTERFACE_MODE_RGMII_ID;
> -    else if (!rx_delay)
> -        priv->phy_mode = PHY_INTERFACE_MODE_RGMII_RXID;
> -    else if (!tx_delay)
> -        priv->phy_mode = PHY_INTERFACE_MODE_RGMII_TXID;
> -    else
> -        priv->phy_mode = PHY_INTERFACE_MODE_RGMII;
> -}
> -
> -static int cvm_oct_probe(struct platform_device *pdev)
> -{
> -    int num_interfaces;
> -    int interface;
> -    int fau = FAU_NUM_PACKET_BUFFERS_TO_FREE;
> -    int qos;
> -    struct device_node *pip;
> -    int mtu_overhead = ETH_HLEN + ETH_FCS_LEN;
> -
> -#if IS_ENABLED(CONFIG_VLAN_8021Q)
> -    mtu_overhead += VLAN_HLEN;
> -#endif
> -
> -    octeon_mdiobus_force_mod_depencency();
> -
> -    pip = pdev->dev.of_node;
> -    if (!pip) {
> -        pr_err("Error: No 'pip' in /aliases\n");
> -        return -EINVAL;
> -    }
> -
> -    cvm_oct_configure_common_hw();
> -
> -    cvmx_helper_initialize_packet_io_global();
> -
> -    if (receive_group_order) {
> -        if (receive_group_order > 4)
> -            receive_group_order = 4;
> -        pow_receive_groups = (1 << (1 << receive_group_order)) - 1;
> -    } else {
> -        pow_receive_groups = BIT(pow_receive_group);
> -    }
> -
> -    /* Change the input group for all ports before input is enabled */
> -    num_interfaces = cvmx_helper_get_number_of_interfaces();
> -    for (interface = 0; interface < num_interfaces; interface++) {
> -        int num_ports = cvmx_helper_ports_on_interface(interface);
> -        int port;
> -
> -        for (port = cvmx_helper_get_ipd_port(interface, 0);
> -             port < cvmx_helper_get_ipd_port(interface, num_ports);
> -             port++) {
> -            union cvmx_pip_prt_tagx pip_prt_tagx;
> -
> -            pip_prt_tagx.u64 =
> -                cvmx_read_csr(CVMX_PIP_PRT_TAGX(port));
> -
> -            if (receive_group_order) {
> -                int tag_mask;
> -
> -                /* We support only 16 groups at the moment, so
> -                 * always disable the two additional "hidden"
> -                 * tag_mask bits on CN68XX.
> -                 */
> -                if (OCTEON_IS_MODEL(OCTEON_CN68XX))
> -                    pip_prt_tagx.u64 |= 0x3ull << 44;
> -
> -                tag_mask = ~((1 << receive_group_order) - 1);
> -                pip_prt_tagx.s.grptagbase    = 0;
> -                pip_prt_tagx.s.grptagmask    = tag_mask;
> -                pip_prt_tagx.s.grptag        = 1;
> -                pip_prt_tagx.s.tag_mode        = 0;
> -                pip_prt_tagx.s.inc_prt_flag    = 1;
> -                pip_prt_tagx.s.ip6_dprt_flag    = 1;
> -                pip_prt_tagx.s.ip4_dprt_flag    = 1;
> -                pip_prt_tagx.s.ip6_sprt_flag    = 1;
> -                pip_prt_tagx.s.ip4_sprt_flag    = 1;
> -                pip_prt_tagx.s.ip6_dst_flag    = 1;
> -                pip_prt_tagx.s.ip4_dst_flag    = 1;
> -                pip_prt_tagx.s.ip6_src_flag    = 1;
> -                pip_prt_tagx.s.ip4_src_flag    = 1;
> -                pip_prt_tagx.s.grp        = 0;
> -            } else {
> -                pip_prt_tagx.s.grptag    = 0;
> -                pip_prt_tagx.s.grp    = pow_receive_group;
> -            }
> -
> -            cvmx_write_csr(CVMX_PIP_PRT_TAGX(port),
> -                       pip_prt_tagx.u64);
> -        }
> -    }
> -
> -    cvmx_helper_ipd_and_packet_input_enable();
> -
> -    memset(cvm_oct_device, 0, sizeof(cvm_oct_device));
> -
> -    /*
> -     * Initialize the FAU used for counting packet buffers that
> -     * need to be freed.
> -     */
> -    cvmx_fau_atomic_write32(FAU_NUM_PACKET_BUFFERS_TO_FREE, 0);
> -
> -    /* Initialize the FAU used for counting tx SKBs that need to be freed */
> -    cvmx_fau_atomic_write32(FAU_TOTAL_TX_TO_CLEAN, 0);
> -
> -    if ((pow_send_group != -1)) {
> -        struct net_device *dev;
> -
> -        dev = alloc_etherdev(sizeof(struct octeon_ethernet));
> -        if (dev) {
> -            /* Initialize the device private structure. */
> -            struct octeon_ethernet *priv = netdev_priv(dev);
> -
> -            SET_NETDEV_DEV(dev, &pdev->dev);
> -            dev->netdev_ops = &cvm_oct_pow_netdev_ops;
> -            priv->imode = CVMX_HELPER_INTERFACE_MODE_DISABLED;
> -            priv->port = CVMX_PIP_NUM_INPUT_PORTS;
> -            priv->queue = -1;
> -            strscpy(dev->name, "pow%d", sizeof(dev->name));
> -            for (qos = 0; qos < 16; qos++)
> -                skb_queue_head_init(&priv->tx_free_list[qos]);
> -            dev->min_mtu = VLAN_ETH_ZLEN - mtu_overhead;
> -            dev->max_mtu = OCTEON_MAX_MTU - mtu_overhead;
> -
> -            if (register_netdev(dev) < 0) {
> -                pr_err("Failed to register ethernet device for POW\n");
> -                free_netdev(dev);
> -            } else {
> -                cvm_oct_device[CVMX_PIP_NUM_INPUT_PORTS] = dev;
> -                pr_info("%s: POW send group %d, receive group %d\n",
> -                    dev->name, pow_send_group,
> -                    pow_receive_group);
> -            }
> -        } else {
> -            pr_err("Failed to allocate ethernet device for POW\n");
> -        }
> -    }
> -
> -    num_interfaces = cvmx_helper_get_number_of_interfaces();
> -    for (interface = 0; interface < num_interfaces; interface++) {
> -        cvmx_helper_interface_mode_t imode =
> -            cvmx_helper_interface_get_mode(interface);
> -        int num_ports = cvmx_helper_ports_on_interface(interface);
> -        int port;
> -        int port_index;
> -
> -        for (port_index = 0,
> -             port = cvmx_helper_get_ipd_port(interface, 0);
> -             port < cvmx_helper_get_ipd_port(interface, num_ports);
> -             port_index++, port++) {
> -            struct octeon_ethernet *priv;
> -            struct net_device *dev =
> -                alloc_etherdev(sizeof(struct octeon_ethernet));
> -            if (!dev) {
> -                pr_err("Failed to allocate ethernet device for port %d\n",
> -                       port);
> -                continue;
> -            }
> -
> -            /* Initialize the device private structure. */
> -            SET_NETDEV_DEV(dev, &pdev->dev);
> -            priv = netdev_priv(dev);
> -            priv->netdev = dev;
> -            priv->of_node = cvm_oct_node_for_port(pip, interface,
> -                                  port_index);
> -
> -            INIT_DELAYED_WORK(&priv->port_periodic_work,
> -                      cvm_oct_periodic_worker);
> -            priv->imode = imode;
> -            priv->port = port;
> -            priv->queue = cvmx_pko_get_base_queue(priv->port);
> -            priv->fau = fau - cvmx_pko_get_num_queues(port) * 4;
> -            priv->phy_mode = PHY_INTERFACE_MODE_NA;
> -            for (qos = 0; qos < 16; qos++)
> -                skb_queue_head_init(&priv->tx_free_list[qos]);
> -            for (qos = 0; qos < cvmx_pko_get_num_queues(port);
> -                 qos++)
> -                cvmx_fau_atomic_write32(priv->fau + qos * 4, 0);
> -            dev->min_mtu = VLAN_ETH_ZLEN - mtu_overhead;
> -            dev->max_mtu = OCTEON_MAX_MTU - mtu_overhead;
> -
> -            switch (priv->imode) {
> -            /* These types don't support ports to IPD/PKO */
> -            case CVMX_HELPER_INTERFACE_MODE_DISABLED:
> -            case CVMX_HELPER_INTERFACE_MODE_PCIE:
> -            case CVMX_HELPER_INTERFACE_MODE_PICMG:
> -                break;
> -
> -            case CVMX_HELPER_INTERFACE_MODE_NPI:
> -                dev->netdev_ops = &cvm_oct_npi_netdev_ops;
> -                strscpy(dev->name, "npi%d", sizeof(dev->name));
> -                break;
> -
> -            case CVMX_HELPER_INTERFACE_MODE_XAUI:
> -                dev->netdev_ops = &cvm_oct_xaui_netdev_ops;
> -                strscpy(dev->name, "xaui%d", sizeof(dev->name));
> -                break;
> -
> -            case CVMX_HELPER_INTERFACE_MODE_LOOP:
> -                dev->netdev_ops = &cvm_oct_npi_netdev_ops;
> -                strscpy(dev->name, "loop%d", sizeof(dev->name));
> -                break;
> -
> -            case CVMX_HELPER_INTERFACE_MODE_SGMII:
> -                priv->phy_mode = PHY_INTERFACE_MODE_SGMII;
> -                dev->netdev_ops = &cvm_oct_sgmii_netdev_ops;
> -                strscpy(dev->name, "eth%d", sizeof(dev->name));
> -                break;
> -
> -            case CVMX_HELPER_INTERFACE_MODE_SPI:
> -                dev->netdev_ops = &cvm_oct_spi_netdev_ops;
> -                strscpy(dev->name, "spi%d", sizeof(dev->name));
> -                break;
> -
> -            case CVMX_HELPER_INTERFACE_MODE_GMII:
> -                priv->phy_mode = PHY_INTERFACE_MODE_GMII;
> -                dev->netdev_ops = &cvm_oct_rgmii_netdev_ops;
> -                strscpy(dev->name, "eth%d", sizeof(dev->name));
> -                break;
> -
> -            case CVMX_HELPER_INTERFACE_MODE_RGMII:
> -                dev->netdev_ops = &cvm_oct_rgmii_netdev_ops;
> -                strscpy(dev->name, "eth%d", sizeof(dev->name));
> -                cvm_set_rgmii_delay(priv, interface,
> -                            port_index);
> -                break;
> -            }
> -
> -            if (!dev->netdev_ops) {
> -                free_netdev(dev);
> -            } else if (register_netdev(dev) < 0) {
> -                pr_err("Failed to register ethernet device for interface %d, port %d\n",
> -                       interface, priv->port);
> -                free_netdev(dev);
> -            } else {
> -                cvm_oct_device[priv->port] = dev;
> -                fau -=
> -                    cvmx_pko_get_num_queues(priv->port) *
> -                    sizeof(u32);
> -                schedule_delayed_work(&priv->port_periodic_work,
> -                              HZ);
> -            }
> -        }
> -    }
> -
> -    cvm_oct_tx_initialize();
> -    cvm_oct_rx_initialize();
> -
> -    /*
> -     * 150 uS: about 10 1500-byte packets at 1GE.
> -     */
> -    cvm_oct_tx_poll_interval = 150 * (octeon_get_clock_rate() / 1000000);
> -
> -    schedule_delayed_work(&cvm_oct_rx_refill_work, HZ);
> -
> -    return 0;
> -}
> -
> -static int cvm_oct_remove(struct platform_device *pdev)
> -{
> -    int port;
> -
> -    cvmx_ipd_disable();
> -
> -    atomic_inc_return(&cvm_oct_poll_queue_stopping);
> -    cancel_delayed_work_sync(&cvm_oct_rx_refill_work);
> -
> -    cvm_oct_rx_shutdown();
> -    cvm_oct_tx_shutdown();
> -
> -    cvmx_pko_disable();
> -
> -    /* Free the ethernet devices */
> -    for (port = 0; port < TOTAL_NUMBER_OF_PORTS; port++) {
> -        if (cvm_oct_device[port]) {
> -            struct net_device *dev = cvm_oct_device[port];
> -            struct octeon_ethernet *priv = netdev_priv(dev);
> -
> -            cancel_delayed_work_sync(&priv->port_periodic_work);
> -
> -            cvm_oct_tx_shutdown_dev(dev);
> -            unregister_netdev(dev);
> -            free_netdev(dev);
> -            cvm_oct_device[port] = NULL;
> -        }
> -    }
> -
> -    cvmx_pko_shutdown();
> -
> -    cvmx_ipd_free_ptr();
> -
> -    /* Free the HW pools */
> -    cvm_oct_mem_empty_fpa(CVMX_FPA_PACKET_POOL, CVMX_FPA_PACKET_POOL_SIZE,
> -                  num_packet_buffers);
> -    cvm_oct_mem_empty_fpa(CVMX_FPA_WQE_POOL, CVMX_FPA_WQE_POOL_SIZE,
> -                  num_packet_buffers);
> -    if (CVMX_FPA_OUTPUT_BUFFER_POOL != CVMX_FPA_PACKET_POOL)
> -        cvm_oct_mem_empty_fpa(CVMX_FPA_OUTPUT_BUFFER_POOL,
> -                      CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE, 128);
> -    return 0;
> -}
> -
> -static const struct of_device_id cvm_oct_match[] = {
> -    {
> -        .compatible = "cavium,octeon-3860-pip",
> -    },
> -    {},
> -};
> -MODULE_DEVICE_TABLE(of, cvm_oct_match);
> -
> -static struct platform_driver cvm_oct_driver = {
> -    .probe        = cvm_oct_probe,
> -    .remove        = cvm_oct_remove,
> -    .driver        = {
> -        .name    = KBUILD_MODNAME,
> -        .of_match_table = cvm_oct_match,
> -    },
> -};
> -
> -module_platform_driver(cvm_oct_driver);
> -
> -MODULE_LICENSE("GPL");
> -MODULE_AUTHOR("Cavium Networks <support@caviumnetworks.com>");
> -MODULE_DESCRIPTION("Cavium Networks Octeon ethernet driver.");
> diff --git a/drivers/staging/octeon/octeon-ethernet.h b/drivers/staging/octeon/octeon-ethernet.h
> deleted file mode 100644
> index a6140705706f..000000000000
> --- a/drivers/staging/octeon/octeon-ethernet.h
> +++ /dev/null
> @@ -1,107 +0,0 @@
> -/* SPDX-License-Identifier: GPL-2.0 */
> -/*
> - * This file is based on code from OCTEON SDK by Cavium Networks.
> - *
> - * Copyright (c) 2003-2010 Cavium Networks
> - */
> -
> -/*
> - * External interface for the Cavium Octeon ethernet driver.
> - */
> -#ifndef OCTEON_ETHERNET_H
> -#define OCTEON_ETHERNET_H
> -
> -#include <linux/of.h>
> -#include <linux/phy.h>
> -
> -#ifdef CONFIG_CAVIUM_OCTEON_SOC
> -
> -#include <asm/octeon/octeon.h>
> -
> -#include <asm/octeon/cvmx-asxx-defs.h>
> -#include <asm/octeon/cvmx-config.h>
> -#include <asm/octeon/cvmx-fau.h>
> -#include <asm/octeon/cvmx-gmxx-defs.h>
> -#include <asm/octeon/cvmx-helper.h>
> -#include <asm/octeon/cvmx-helper-util.h>
> -#include <asm/octeon/cvmx-ipd.h>
> -#include <asm/octeon/cvmx-ipd-defs.h>
> -#include <asm/octeon/cvmx-npi-defs.h>
> -#include <asm/octeon/cvmx-pip.h>
> -#include <asm/octeon/cvmx-pko.h>
> -#include <asm/octeon/cvmx-pow.h>
> -#include <asm/octeon/cvmx-scratch.h>
> -#include <asm/octeon/cvmx-spi.h>
> -#include <asm/octeon/cvmx-spxx-defs.h>
> -#include <asm/octeon/cvmx-stxx-defs.h>
> -#include <asm/octeon/cvmx-wqe.h>
> -
> -#else
> -
> -#include "octeon-stubs.h"
> -
> -#endif
> -
> -/**
> - * This is the definition of the Ethernet driver's private
> - * driver state stored in netdev_priv(dev).
> - */
> -struct octeon_ethernet {
> -    /* PKO hardware output port */
> -    int port;
> -    /* PKO hardware queue for the port */
> -    int queue;
> -    /* Hardware fetch and add to count outstanding tx buffers */
> -    int fau;
> -    /* My netdev. */
> -    struct net_device *netdev;
> -    /*
> -     * Type of port. This is one of the enums in
> -     * cvmx_helper_interface_mode_t
> -     */
> -    int imode;
> -    /* PHY mode */
> -    phy_interface_t phy_mode;
> -    /* List of outstanding tx buffers per queue */
> -    struct sk_buff_head tx_free_list[16];
> -    unsigned int last_speed;
> -    unsigned int last_link;
> -    /* Last negotiated link state */
> -    u64 link_info;
> -    /* Called periodically to check link status */
> -    void (*poll)(struct net_device *dev);
> -    struct delayed_work    port_periodic_work;
> -    struct device_node    *of_node;
> -};
> -
> -int cvm_oct_free_work(void *work_queue_entry);
> -
> -int cvm_oct_rgmii_open(struct net_device *dev);
> -
> -int cvm_oct_sgmii_init(struct net_device *dev);
> -int cvm_oct_sgmii_open(struct net_device *dev);
> -
> -int cvm_oct_spi_init(struct net_device *dev);
> -void cvm_oct_spi_uninit(struct net_device *dev);
> -
> -int cvm_oct_common_init(struct net_device *dev);
> -void cvm_oct_common_uninit(struct net_device *dev);
> -void cvm_oct_adjust_link(struct net_device *dev);
> -int cvm_oct_common_stop(struct net_device *dev);
> -int cvm_oct_common_open(struct net_device *dev,
> -            void (*link_poll)(struct net_device *));
> -void cvm_oct_note_carrier(struct octeon_ethernet *priv,
> -              union cvmx_helper_link_info li);
> -void cvm_oct_link_poll(struct net_device *dev);
> -
> -extern int always_use_pow;
> -extern int pow_send_group;
> -extern int pow_receive_groups;
> -extern char pow_send_list[];
> -extern struct net_device *cvm_oct_device[];
> -extern atomic_t cvm_oct_poll_queue_stopping;
> -extern u64 cvm_oct_tx_poll_interval;
> -
> -extern int rx_napi_weight;
> -
> -#endif
> diff --git a/drivers/staging/octeon/octeon-stubs.h b/drivers/staging/octeon/octeon-stubs.h
> deleted file mode 100644
> index 79213c045504..000000000000
> --- a/drivers/staging/octeon/octeon-stubs.h
> +++ /dev/null
> @@ -1,1433 +0,0 @@
> -#define CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE    512
> -
> -#ifndef XKPHYS_TO_PHYS
> -# define XKPHYS_TO_PHYS(p)            (p)
> -#endif
> -
> -#define OCTEON_IRQ_WORKQ0 0
> -#define OCTEON_IRQ_RML 0
> -#define OCTEON_IRQ_TIMER1 0
> -#define OCTEON_IS_MODEL(x) 0
> -#define octeon_has_feature(x)    0
> -#define octeon_get_clock_rate()    0
> -
> -#define CVMX_SYNCIOBDMA        do { } while(0)
> -
> -#define CVMX_HELPER_INPUT_TAG_TYPE    0
> -#define CVMX_HELPER_FIRST_MBUFF_SKIP    7
> -#define CVMX_FAU_REG_END        (2048)
> -#define CVMX_FPA_OUTPUT_BUFFER_POOL        (2)
> -#define CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE    16
> -#define CVMX_FPA_PACKET_POOL            (0)
> -#define CVMX_FPA_PACKET_POOL_SIZE        16
> -#define CVMX_FPA_WQE_POOL            (1)
> -#define CVMX_FPA_WQE_POOL_SIZE            16
> -#define CVMX_GMXX_RXX_ADR_CAM_EN(a, b)    ((a)+(b))
> -#define CVMX_GMXX_RXX_ADR_CTL(a, b)    ((a)+(b))
> -#define CVMX_GMXX_PRTX_CFG(a, b)    ((a)+(b))
> -#define CVMX_GMXX_RXX_FRM_MAX(a, b)    ((a)+(b))
> -#define CVMX_GMXX_RXX_JABBER(a, b)    ((a)+(b))
> -#define CVMX_IPD_CTL_STATUS        0
> -#define CVMX_PIP_FRM_LEN_CHKX(a)    (a)
> -#define CVMX_PIP_NUM_INPUT_PORTS    1
> -#define CVMX_SCR_SCRATCH        0
> -#define CVMX_PKO_QUEUES_PER_PORT_INTERFACE0    2
> -#define CVMX_PKO_QUEUES_PER_PORT_INTERFACE1    2
> -#define CVMX_IPD_SUB_PORT_FCS        0
> -#define CVMX_SSO_WQ_IQ_DIS        0
> -#define CVMX_SSO_WQ_INT            0
> -#define CVMX_POW_WQ_INT            0
> -#define CVMX_SSO_WQ_INT_PC        0
> -#define CVMX_NPI_RSL_INT_BLOCKS        0
> -#define CVMX_POW_WQ_INT_PC        0
> -
> -union cvmx_pip_wqe_word2 {
> -    uint64_t u64;
> -    struct {
> -        uint64_t bufs:8;
> -        uint64_t ip_offset:8;
> -        uint64_t vlan_valid:1;
> -        uint64_t vlan_stacked:1;
> -        uint64_t unassigned:1;
> -        uint64_t vlan_cfi:1;
> -        uint64_t vlan_id:12;
> -        uint64_t pr:4;
> -        uint64_t unassigned2:8;
> -        uint64_t dec_ipcomp:1;
> -        uint64_t tcp_or_udp:1;
> -        uint64_t dec_ipsec:1;
> -        uint64_t is_v6:1;
> -        uint64_t software:1;
> -        uint64_t L4_error:1;
> -        uint64_t is_frag:1;
> -        uint64_t IP_exc:1;
> -        uint64_t is_bcast:1;
> -        uint64_t is_mcast:1;
> -        uint64_t not_IP:1;
> -        uint64_t rcv_error:1;
> -        uint64_t err_code:8;
> -    } s;
> -    struct {
> -        uint64_t bufs:8;
> -        uint64_t ip_offset:8;
> -        uint64_t vlan_valid:1;
> -        uint64_t vlan_stacked:1;
> -        uint64_t unassigned:1;
> -        uint64_t vlan_cfi:1;
> -        uint64_t vlan_id:12;
> -        uint64_t port:12;
> -        uint64_t dec_ipcomp:1;
> -        uint64_t tcp_or_udp:1;
> -        uint64_t dec_ipsec:1;
> -        uint64_t is_v6:1;
> -        uint64_t software:1;
> -        uint64_t L4_error:1;
> -        uint64_t is_frag:1;
> -        uint64_t IP_exc:1;
> -        uint64_t is_bcast:1;
> -        uint64_t is_mcast:1;
> -        uint64_t not_IP:1;
> -        uint64_t rcv_error:1;
> -        uint64_t err_code:8;
> -    } s_cn68xx;
> -
> -    struct {
> -        uint64_t unused1:16;
> -        uint64_t vlan:16;
> -        uint64_t unused2:32;
> -    } svlan;
> -    struct {
> -        uint64_t bufs:8;
> -        uint64_t unused:8;
> -        uint64_t vlan_valid:1;
> -        uint64_t vlan_stacked:1;
> -        uint64_t unassigned:1;
> -        uint64_t vlan_cfi:1;
> -        uint64_t vlan_id:12;
> -        uint64_t pr:4;
> -        uint64_t unassigned2:12;
> -        uint64_t software:1;
> -        uint64_t unassigned3:1;
> -        uint64_t is_rarp:1;
> -        uint64_t is_arp:1;
> -        uint64_t is_bcast:1;
> -        uint64_t is_mcast:1;
> -        uint64_t not_IP:1;
> -        uint64_t rcv_error:1;
> -        uint64_t err_code:8;
> -    } snoip;
> -
> -};
> -
> -union cvmx_pip_wqe_word0 {
> -    struct {
> -        uint64_t next_ptr:40;
> -        uint8_t unused;
> -        __wsum hw_chksum;
> -    } cn38xx;
> -    struct {
> -        uint64_t pknd:6;        /* 0..5 */
> -        uint64_t unused2:2;     /* 6..7 */
> -        uint64_t bpid:6;        /* 8..13 */
> -        uint64_t unused1:18;    /* 14..31 */
> -        uint64_t l2ptr:8;       /* 32..39 */
> -        uint64_t l3ptr:8;       /* 40..47 */
> -        uint64_t unused0:8;     /* 48..55 */
> -        uint64_t l4ptr:8;       /* 56..63 */
> -    } cn68xx;
> -};
> -
> -union cvmx_wqe_word0 {
> -    uint64_t u64;
> -    union cvmx_pip_wqe_word0 pip;
> -};
> -
> -union cvmx_wqe_word1 {
> -    uint64_t u64;
> -    struct {
> -        uint64_t tag:32;
> -        uint64_t tag_type:2;
> -        uint64_t varies:14;
> -        uint64_t len:16;
> -    };
> -    struct {
> -        uint64_t tag:32;
> -        uint64_t tag_type:2;
> -        uint64_t zero_2:3;
> -        uint64_t grp:6;
> -        uint64_t zero_1:1;
> -        uint64_t qos:3;
> -        uint64_t zero_0:1;
> -        uint64_t len:16;
> -    } cn68xx;
> -    struct {
> -        uint64_t tag:32;
> -        uint64_t tag_type:2;
> -        uint64_t zero_2:1;
> -        uint64_t grp:4;
> -        uint64_t qos:3;
> -        uint64_t ipprt:6;
> -        uint64_t len:16;
> -    } cn38xx;
> -};
> -
> -union cvmx_buf_ptr {
> -    void *ptr;
> -    uint64_t u64;
> -    struct {
> -        uint64_t i:1;
> -        uint64_t back:4;
> -        uint64_t pool:3;
> -        uint64_t size:16;
> -        uint64_t addr:40;
> -    } s;
> -};
> -
> -struct cvmx_wqe {
> -    union cvmx_wqe_word0 word0;
> -    union cvmx_wqe_word1 word1;
> -    union cvmx_pip_wqe_word2 word2;
> -    union cvmx_buf_ptr packet_ptr;
> -    uint8_t packet_data[96];
> -};
> -
> -union cvmx_helper_link_info {
> -    uint64_t u64;
> -    struct {
> -        uint64_t reserved_20_63:44;
> -        uint64_t link_up:1;        /**< Is the physical link up? */
> -        uint64_t full_duplex:1;        /**< 1 if the link is full duplex */
> -        uint64_t speed:18;        /**< Speed of the link in Mbps */
> -    } s;
> -};
> -
> -enum cvmx_fau_reg_32 {
> -    CVMX_FAU_REG_32_START    = 0,
> -};
> -
> -enum cvmx_fau_op_size {
> -    CVMX_FAU_OP_SIZE_8 = 0,
> -    CVMX_FAU_OP_SIZE_16 = 1,
> -    CVMX_FAU_OP_SIZE_32 = 2,
> -    CVMX_FAU_OP_SIZE_64 = 3
> -};
> -
> -typedef enum {
> -    CVMX_SPI_MODE_UNKNOWN = 0,
> -    CVMX_SPI_MODE_TX_HALFPLEX = 1,
> -    CVMX_SPI_MODE_RX_HALFPLEX = 2,
> -    CVMX_SPI_MODE_DUPLEX = 3
> -} cvmx_spi_mode_t;
> -
> -typedef enum {
> -    CVMX_HELPER_INTERFACE_MODE_DISABLED,
> -    CVMX_HELPER_INTERFACE_MODE_RGMII,
> -    CVMX_HELPER_INTERFACE_MODE_GMII,
> -    CVMX_HELPER_INTERFACE_MODE_SPI,
> -    CVMX_HELPER_INTERFACE_MODE_PCIE,
> -    CVMX_HELPER_INTERFACE_MODE_XAUI,
> -    CVMX_HELPER_INTERFACE_MODE_SGMII,
> -    CVMX_HELPER_INTERFACE_MODE_PICMG,
> -    CVMX_HELPER_INTERFACE_MODE_NPI,
> -    CVMX_HELPER_INTERFACE_MODE_LOOP,
> -} cvmx_helper_interface_mode_t;
> -
> -typedef enum {
> -    CVMX_POW_WAIT = 1,
> -    CVMX_POW_NO_WAIT = 0,
> -} cvmx_pow_wait_t;
> -
> -typedef enum {
> -    CVMX_PKO_LOCK_NONE = 0,
> -    CVMX_PKO_LOCK_ATOMIC_TAG = 1,
> -    CVMX_PKO_LOCK_CMD_QUEUE = 2,
> -} cvmx_pko_lock_t;
> -
> -typedef enum {
> -    CVMX_PKO_SUCCESS,
> -    CVMX_PKO_INVALID_PORT,
> -    CVMX_PKO_INVALID_QUEUE,
> -    CVMX_PKO_INVALID_PRIORITY,
> -    CVMX_PKO_NO_MEMORY,
> -    CVMX_PKO_PORT_ALREADY_SETUP,
> -    CVMX_PKO_CMD_QUEUE_INIT_ERROR
> -} cvmx_pko_status_t;
> -
> -enum cvmx_pow_tag_type {
> -    CVMX_POW_TAG_TYPE_ORDERED   = 0L,
> -    CVMX_POW_TAG_TYPE_ATOMIC    = 1L,
> -    CVMX_POW_TAG_TYPE_NULL        = 2L,
> -    CVMX_POW_TAG_TYPE_NULL_NULL = 3L
> -};
> -
> -union cvmx_ipd_ctl_status {
> -    uint64_t u64;
> -    struct cvmx_ipd_ctl_status_s {
> -        uint64_t reserved_18_63:46;
> -        uint64_t use_sop:1;
> -        uint64_t rst_done:1;
> -        uint64_t clken:1;
> -        uint64_t no_wptr:1;
> -        uint64_t pq_apkt:1;
> -        uint64_t pq_nabuf:1;
> -        uint64_t ipd_full:1;
> -        uint64_t pkt_off:1;
> -        uint64_t len_m8:1;
> -        uint64_t reset:1;
> -        uint64_t addpkt:1;
> -        uint64_t naddbuf:1;
> -        uint64_t pkt_lend:1;
> -        uint64_t wqe_lend:1;
> -        uint64_t pbp_en:1;
> -        uint64_t opc_mode:2;
> -        uint64_t ipd_en:1;
> -    } s;
> -    struct cvmx_ipd_ctl_status_cn30xx {
> -        uint64_t reserved_10_63:54;
> -        uint64_t len_m8:1;
> -        uint64_t reset:1;
> -        uint64_t addpkt:1;
> -        uint64_t naddbuf:1;
> -        uint64_t pkt_lend:1;
> -        uint64_t wqe_lend:1;
> -        uint64_t pbp_en:1;
> -        uint64_t opc_mode:2;
> -        uint64_t ipd_en:1;
> -    } cn30xx;
> -    struct cvmx_ipd_ctl_status_cn38xxp2 {
> -        uint64_t reserved_9_63:55;
> -        uint64_t reset:1;
> -        uint64_t addpkt:1;
> -        uint64_t naddbuf:1;
> -        uint64_t pkt_lend:1;
> -        uint64_t wqe_lend:1;
> -        uint64_t pbp_en:1;
> -        uint64_t opc_mode:2;
> -        uint64_t ipd_en:1;
> -    } cn38xxp2;
> -    struct cvmx_ipd_ctl_status_cn50xx {
> -        uint64_t reserved_15_63:49;
> -        uint64_t no_wptr:1;
> -        uint64_t pq_apkt:1;
> -        uint64_t pq_nabuf:1;
> -        uint64_t ipd_full:1;
> -        uint64_t pkt_off:1;
> -        uint64_t len_m8:1;
> -        uint64_t reset:1;
> -        uint64_t addpkt:1;
> -        uint64_t naddbuf:1;
> -        uint64_t pkt_lend:1;
> -        uint64_t wqe_lend:1;
> -        uint64_t pbp_en:1;
> -        uint64_t opc_mode:2;
> -        uint64_t ipd_en:1;
> -    } cn50xx;
> -    struct cvmx_ipd_ctl_status_cn58xx {
> -        uint64_t reserved_12_63:52;
> -        uint64_t ipd_full:1;
> -        uint64_t pkt_off:1;
> -        uint64_t len_m8:1;
> -        uint64_t reset:1;
> -        uint64_t addpkt:1;
> -        uint64_t naddbuf:1;
> -        uint64_t pkt_lend:1;
> -        uint64_t wqe_lend:1;
> -        uint64_t pbp_en:1;
> -        uint64_t opc_mode:2;
> -        uint64_t ipd_en:1;
> -    } cn58xx;
> -    struct cvmx_ipd_ctl_status_cn63xxp1 {
> -        uint64_t reserved_16_63:48;
> -        uint64_t clken:1;
> -        uint64_t no_wptr:1;
> -        uint64_t pq_apkt:1;
> -        uint64_t pq_nabuf:1;
> -        uint64_t ipd_full:1;
> -        uint64_t pkt_off:1;
> -        uint64_t len_m8:1;
> -        uint64_t reset:1;
> -        uint64_t addpkt:1;
> -        uint64_t naddbuf:1;
> -        uint64_t pkt_lend:1;
> -        uint64_t wqe_lend:1;
> -        uint64_t pbp_en:1;
> -        uint64_t opc_mode:2;
> -        uint64_t ipd_en:1;
> -    } cn63xxp1;
> -};
> -
> -union cvmx_ipd_sub_port_fcs {
> -    uint64_t u64;
> -    struct cvmx_ipd_sub_port_fcs_s {
> -        uint64_t port_bit:32;
> -        uint64_t reserved_32_35:4;
> -        uint64_t port_bit2:4;
> -        uint64_t reserved_40_63:24;
> -    } s;
> -    struct cvmx_ipd_sub_port_fcs_cn30xx {
> -        uint64_t port_bit:3;
> -        uint64_t reserved_3_63:61;
> -    } cn30xx;
> -    struct cvmx_ipd_sub_port_fcs_cn38xx {
> -        uint64_t port_bit:32;
> -        uint64_t reserved_32_63:32;
> -    } cn38xx;
> -};
> -
> -union cvmx_ipd_sub_port_qos_cnt {
> -    uint64_t u64;
> -    struct cvmx_ipd_sub_port_qos_cnt_s {
> -        uint64_t cnt:32;
> -        uint64_t port_qos:9;
> -        uint64_t reserved_41_63:23;
> -    } s;
> -};
> -typedef struct {
> -    uint32_t dropped_octets;
> -    uint32_t dropped_packets;
> -    uint32_t pci_raw_packets;
> -    uint32_t octets;
> -    uint32_t packets;
> -    uint32_t multicast_packets;
> -    uint32_t broadcast_packets;
> -    uint32_t len_64_packets;
> -    uint32_t len_65_127_packets;
> -    uint32_t len_128_255_packets;
> -    uint32_t len_256_511_packets;
> -    uint32_t len_512_1023_packets;
> -    uint32_t len_1024_1518_packets;
> -    uint32_t len_1519_max_packets;
> -    uint32_t fcs_align_err_packets;
> -    uint32_t runt_packets;
> -    uint32_t runt_crc_packets;
> -    uint32_t oversize_packets;
> -    uint32_t oversize_crc_packets;
> -    uint32_t inb_packets;
> -    uint64_t inb_octets;
> -    uint16_t inb_errors;
> -} cvmx_pip_port_status_t;
> -
> -typedef struct {
> -    uint32_t packets;
> -    uint64_t octets;
> -    uint64_t doorbell;
> -} cvmx_pko_port_status_t;
> -
> -union cvmx_pip_frm_len_chkx {
> -    uint64_t u64;
> -    struct cvmx_pip_frm_len_chkx_s {
> -        uint64_t reserved_32_63:32;
> -        uint64_t maxlen:16;
> -        uint64_t minlen:16;
> -    } s;
> -};
> -
> -union cvmx_gmxx_rxx_frm_ctl {
> -    uint64_t u64;
> -    struct cvmx_gmxx_rxx_frm_ctl_s {
> -        uint64_t pre_chk:1;
> -        uint64_t pre_strp:1;
> -        uint64_t ctl_drp:1;
> -        uint64_t ctl_bck:1;
> -        uint64_t ctl_mcst:1;
> -        uint64_t ctl_smac:1;
> -        uint64_t pre_free:1;
> -        uint64_t vlan_len:1;
> -        uint64_t pad_len:1;
> -        uint64_t pre_align:1;
> -        uint64_t null_dis:1;
> -        uint64_t reserved_11_11:1;
> -        uint64_t ptp_mode:1;
> -        uint64_t reserved_13_63:51;
> -    } s;
> -    struct cvmx_gmxx_rxx_frm_ctl_cn30xx {
> -        uint64_t pre_chk:1;
> -        uint64_t pre_strp:1;
> -        uint64_t ctl_drp:1;
> -        uint64_t ctl_bck:1;
> -        uint64_t ctl_mcst:1;
> -        uint64_t ctl_smac:1;
> -        uint64_t pre_free:1;
> -        uint64_t vlan_len:1;
> -        uint64_t pad_len:1;
> -        uint64_t reserved_9_63:55;
> -    } cn30xx;
> -    struct cvmx_gmxx_rxx_frm_ctl_cn31xx {
> -        uint64_t pre_chk:1;
> -        uint64_t pre_strp:1;
> -        uint64_t ctl_drp:1;
> -        uint64_t ctl_bck:1;
> -        uint64_t ctl_mcst:1;
> -        uint64_t ctl_smac:1;
> -        uint64_t pre_free:1;
> -        uint64_t vlan_len:1;
> -        uint64_t reserved_8_63:56;
> -    } cn31xx;
> -    struct cvmx_gmxx_rxx_frm_ctl_cn50xx {
> -        uint64_t pre_chk:1;
> -        uint64_t pre_strp:1;
> -        uint64_t ctl_drp:1;
> -        uint64_t ctl_bck:1;
> -        uint64_t ctl_mcst:1;
> -        uint64_t ctl_smac:1;
> -        uint64_t pre_free:1;
> -        uint64_t reserved_7_8:2;
> -        uint64_t pre_align:1;
> -        uint64_t null_dis:1;
> -        uint64_t reserved_11_63:53;
> -    } cn50xx;
> -    struct cvmx_gmxx_rxx_frm_ctl_cn56xxp1 {
> -        uint64_t pre_chk:1;
> -        uint64_t pre_strp:1;
> -        uint64_t ctl_drp:1;
> -        uint64_t ctl_bck:1;
> -        uint64_t ctl_mcst:1;
> -        uint64_t ctl_smac:1;
> -        uint64_t pre_free:1;
> -        uint64_t reserved_7_8:2;
> -        uint64_t pre_align:1;
> -        uint64_t reserved_10_63:54;
> -    } cn56xxp1;
> -    struct cvmx_gmxx_rxx_frm_ctl_cn58xx {
> -        uint64_t pre_chk:1;
> -        uint64_t pre_strp:1;
> -        uint64_t ctl_drp:1;
> -        uint64_t ctl_bck:1;
> -        uint64_t ctl_mcst:1;
> -        uint64_t ctl_smac:1;
> -        uint64_t pre_free:1;
> -        uint64_t vlan_len:1;
> -        uint64_t pad_len:1;
> -        uint64_t pre_align:1;
> -        uint64_t null_dis:1;
> -        uint64_t reserved_11_63:53;
> -    } cn58xx;
> -    struct cvmx_gmxx_rxx_frm_ctl_cn61xx {
> -        uint64_t pre_chk:1;
> -        uint64_t pre_strp:1;
> -        uint64_t ctl_drp:1;
> -        uint64_t ctl_bck:1;
> -        uint64_t ctl_mcst:1;
> -        uint64_t ctl_smac:1;
> -        uint64_t pre_free:1;
> -        uint64_t reserved_7_8:2;
> -        uint64_t pre_align:1;
> -        uint64_t null_dis:1;
> -        uint64_t reserved_11_11:1;
> -        uint64_t ptp_mode:1;
> -        uint64_t reserved_13_63:51;
> -    } cn61xx;
> -};
> -
> -union cvmx_gmxx_rxx_int_reg {
> -    uint64_t u64;
> -    struct cvmx_gmxx_rxx_int_reg_s {
> -        uint64_t minerr:1;
> -        uint64_t carext:1;
> -        uint64_t maxerr:1;
> -        uint64_t jabber:1;
> -        uint64_t fcserr:1;
> -        uint64_t alnerr:1;
> -        uint64_t lenerr:1;
> -        uint64_t rcverr:1;
> -        uint64_t skperr:1;
> -        uint64_t niberr:1;
> -        uint64_t ovrerr:1;
> -        uint64_t pcterr:1;
> -        uint64_t rsverr:1;
> -        uint64_t falerr:1;
> -        uint64_t coldet:1;
> -        uint64_t ifgerr:1;
> -        uint64_t phy_link:1;
> -        uint64_t phy_spd:1;
> -        uint64_t phy_dupx:1;
> -        uint64_t pause_drp:1;
> -        uint64_t loc_fault:1;
> -        uint64_t rem_fault:1;
> -        uint64_t bad_seq:1;
> -        uint64_t bad_term:1;
> -        uint64_t unsop:1;
> -        uint64_t uneop:1;
> -        uint64_t undat:1;
> -        uint64_t hg2fld:1;
> -        uint64_t hg2cc:1;
> -        uint64_t reserved_29_63:35;
> -    } s;
> -    struct cvmx_gmxx_rxx_int_reg_cn30xx {
> -        uint64_t minerr:1;
> -        uint64_t carext:1;
> -        uint64_t maxerr:1;
> -        uint64_t jabber:1;
> -        uint64_t fcserr:1;
> -        uint64_t alnerr:1;
> -        uint64_t lenerr:1;
> -        uint64_t rcverr:1;
> -        uint64_t skperr:1;
> -        uint64_t niberr:1;
> -        uint64_t ovrerr:1;
> -        uint64_t pcterr:1;
> -        uint64_t rsverr:1;
> -        uint64_t falerr:1;
> -        uint64_t coldet:1;
> -        uint64_t ifgerr:1;
> -        uint64_t phy_link:1;
> -        uint64_t phy_spd:1;
> -        uint64_t phy_dupx:1;
> -        uint64_t reserved_19_63:45;
> -    } cn30xx;
> -    struct cvmx_gmxx_rxx_int_reg_cn50xx {
> -        uint64_t reserved_0_0:1;
> -        uint64_t carext:1;
> -        uint64_t reserved_2_2:1;
> -        uint64_t jabber:1;
> -        uint64_t fcserr:1;
> -        uint64_t alnerr:1;
> -        uint64_t reserved_6_6:1;
> -        uint64_t rcverr:1;
> -        uint64_t skperr:1;
> -        uint64_t niberr:1;
> -        uint64_t ovrerr:1;
> -        uint64_t pcterr:1;
> -        uint64_t rsverr:1;
> -        uint64_t falerr:1;
> -        uint64_t coldet:1;
> -        uint64_t ifgerr:1;
> -        uint64_t phy_link:1;
> -        uint64_t phy_spd:1;
> -        uint64_t phy_dupx:1;
> -        uint64_t pause_drp:1;
> -        uint64_t reserved_20_63:44;
> -    } cn50xx;
> -    struct cvmx_gmxx_rxx_int_reg_cn52xx {
> -        uint64_t reserved_0_0:1;
> -        uint64_t carext:1;
> -        uint64_t reserved_2_2:1;
> -        uint64_t jabber:1;
> -        uint64_t fcserr:1;
> -        uint64_t reserved_5_6:2;
> -        uint64_t rcverr:1;
> -        uint64_t skperr:1;
> -        uint64_t reserved_9_9:1;
> -        uint64_t ovrerr:1;
> -        uint64_t pcterr:1;
> -        uint64_t rsverr:1;
> -        uint64_t falerr:1;
> -        uint64_t coldet:1;
> -        uint64_t ifgerr:1;
> -        uint64_t reserved_16_18:3;
> -        uint64_t pause_drp:1;
> -        uint64_t loc_fault:1;
> -        uint64_t rem_fault:1;
> -        uint64_t bad_seq:1;
> -        uint64_t bad_term:1;
> -        uint64_t unsop:1;
> -        uint64_t uneop:1;
> -        uint64_t undat:1;
> -        uint64_t hg2fld:1;
> -        uint64_t hg2cc:1;
> -        uint64_t reserved_29_63:35;
> -    } cn52xx;
> -    struct cvmx_gmxx_rxx_int_reg_cn56xxp1 {
> -        uint64_t reserved_0_0:1;
> -        uint64_t carext:1;
> -        uint64_t reserved_2_2:1;
> -        uint64_t jabber:1;
> -        uint64_t fcserr:1;
> -        uint64_t reserved_5_6:2;
> -        uint64_t rcverr:1;
> -        uint64_t skperr:1;
> -        uint64_t reserved_9_9:1;
> -        uint64_t ovrerr:1;
> -        uint64_t pcterr:1;
> -        uint64_t rsverr:1;
> -        uint64_t falerr:1;
> -        uint64_t coldet:1;
> -        uint64_t ifgerr:1;
> -        uint64_t reserved_16_18:3;
> -        uint64_t pause_drp:1;
> -        uint64_t loc_fault:1;
> -        uint64_t rem_fault:1;
> -        uint64_t bad_seq:1;
> -        uint64_t bad_term:1;
> -        uint64_t unsop:1;
> -        uint64_t uneop:1;
> -        uint64_t undat:1;
> -        uint64_t reserved_27_63:37;
> -    } cn56xxp1;
> -    struct cvmx_gmxx_rxx_int_reg_cn58xx {
> -        uint64_t minerr:1;
> -        uint64_t carext:1;
> -        uint64_t maxerr:1;
> -        uint64_t jabber:1;
> -        uint64_t fcserr:1;
> -        uint64_t alnerr:1;
> -        uint64_t lenerr:1;
> -        uint64_t rcverr:1;
> -        uint64_t skperr:1;
> -        uint64_t niberr:1;
> -        uint64_t ovrerr:1;
> -        uint64_t pcterr:1;
> -        uint64_t rsverr:1;
> -        uint64_t falerr:1;
> -        uint64_t coldet:1;
> -        uint64_t ifgerr:1;
> -        uint64_t phy_link:1;
> -        uint64_t phy_spd:1;
> -        uint64_t phy_dupx:1;
> -        uint64_t pause_drp:1;
> -        uint64_t reserved_20_63:44;
> -    } cn58xx;
> -    struct cvmx_gmxx_rxx_int_reg_cn61xx {
> -        uint64_t minerr:1;
> -        uint64_t carext:1;
> -        uint64_t reserved_2_2:1;
> -        uint64_t jabber:1;
> -        uint64_t fcserr:1;
> -        uint64_t reserved_5_6:2;
> -        uint64_t rcverr:1;
> -        uint64_t skperr:1;
> -        uint64_t reserved_9_9:1;
> -        uint64_t ovrerr:1;
> -        uint64_t pcterr:1;
> -        uint64_t rsverr:1;
> -        uint64_t falerr:1;
> -        uint64_t coldet:1;
> -        uint64_t ifgerr:1;
> -        uint64_t reserved_16_18:3;
> -        uint64_t pause_drp:1;
> -        uint64_t loc_fault:1;
> -        uint64_t rem_fault:1;
> -        uint64_t bad_seq:1;
> -        uint64_t bad_term:1;
> -        uint64_t unsop:1;
> -        uint64_t uneop:1;
> -        uint64_t undat:1;
> -        uint64_t hg2fld:1;
> -        uint64_t hg2cc:1;
> -        uint64_t reserved_29_63:35;
> -    } cn61xx;
> -};
> -
> -union cvmx_gmxx_prtx_cfg {
> -    uint64_t u64;
> -    struct cvmx_gmxx_prtx_cfg_s {
> -        uint64_t reserved_22_63:42;
> -        uint64_t pknd:6;
> -        uint64_t reserved_14_15:2;
> -        uint64_t tx_idle:1;
> -        uint64_t rx_idle:1;
> -        uint64_t reserved_9_11:3;
> -        uint64_t speed_msb:1;
> -        uint64_t reserved_4_7:4;
> -        uint64_t slottime:1;
> -        uint64_t duplex:1;
> -        uint64_t speed:1;
> -        uint64_t en:1;
> -    } s;
> -    struct cvmx_gmxx_prtx_cfg_cn30xx {
> -        uint64_t reserved_4_63:60;
> -        uint64_t slottime:1;
> -        uint64_t duplex:1;
> -        uint64_t speed:1;
> -        uint64_t en:1;
> -    } cn30xx;
> -    struct cvmx_gmxx_prtx_cfg_cn52xx {
> -        uint64_t reserved_14_63:50;
> -        uint64_t tx_idle:1;
> -        uint64_t rx_idle:1;
> -        uint64_t reserved_9_11:3;
> -        uint64_t speed_msb:1;
> -        uint64_t reserved_4_7:4;
> -        uint64_t slottime:1;
> -        uint64_t duplex:1;
> -        uint64_t speed:1;
> -        uint64_t en:1;
> -    } cn52xx;
> -};
> -
> -union cvmx_gmxx_rxx_adr_ctl {
> -    uint64_t u64;
> -    struct cvmx_gmxx_rxx_adr_ctl_s {
> -        uint64_t reserved_4_63:60;
> -        uint64_t cam_mode:1;
> -        uint64_t mcst:2;
> -        uint64_t bcst:1;
> -    } s;
> -};
> -
> -union cvmx_pip_prt_tagx {
> -    uint64_t u64;
> -    struct cvmx_pip_prt_tagx_s {
> -        uint64_t reserved_54_63:10;
> -        uint64_t portadd_en:1;
> -        uint64_t inc_hwchk:1;
> -        uint64_t reserved_50_51:2;
> -        uint64_t grptagbase_msb:2;
> -        uint64_t reserved_46_47:2;
> -        uint64_t grptagmask_msb:2;
> -        uint64_t reserved_42_43:2;
> -        uint64_t grp_msb:2;
> -        uint64_t grptagbase:4;
> -        uint64_t grptagmask:4;
> -        uint64_t grptag:1;
> -        uint64_t grptag_mskip:1;
> -        uint64_t tag_mode:2;
> -        uint64_t inc_vs:2;
> -        uint64_t inc_vlan:1;
> -        uint64_t inc_prt_flag:1;
> -        uint64_t ip6_dprt_flag:1;
> -        uint64_t ip4_dprt_flag:1;
> -        uint64_t ip6_sprt_flag:1;
> -        uint64_t ip4_sprt_flag:1;
> -        uint64_t ip6_nxth_flag:1;
> -        uint64_t ip4_pctl_flag:1;
> -        uint64_t ip6_dst_flag:1;
> -        uint64_t ip4_dst_flag:1;
> -        uint64_t ip6_src_flag:1;
> -        uint64_t ip4_src_flag:1;
> -        uint64_t tcp6_tag_type:2;
> -        uint64_t tcp4_tag_type:2;
> -        uint64_t ip6_tag_type:2;
> -        uint64_t ip4_tag_type:2;
> -        uint64_t non_tag_type:2;
> -        uint64_t grp:4;
> -    } s;
> -    struct cvmx_pip_prt_tagx_cn30xx {
> -        uint64_t reserved_40_63:24;
> -        uint64_t grptagbase:4;
> -        uint64_t grptagmask:4;
> -        uint64_t grptag:1;
> -        uint64_t reserved_30_30:1;
> -        uint64_t tag_mode:2;
> -        uint64_t inc_vs:2;
> -        uint64_t inc_vlan:1;
> -        uint64_t inc_prt_flag:1;
> -        uint64_t ip6_dprt_flag:1;
> -        uint64_t ip4_dprt_flag:1;
> -        uint64_t ip6_sprt_flag:1;
> -        uint64_t ip4_sprt_flag:1;
> -        uint64_t ip6_nxth_flag:1;
> -        uint64_t ip4_pctl_flag:1;
> -        uint64_t ip6_dst_flag:1;
> -        uint64_t ip4_dst_flag:1;
> -        uint64_t ip6_src_flag:1;
> -        uint64_t ip4_src_flag:1;
> -        uint64_t tcp6_tag_type:2;
> -        uint64_t tcp4_tag_type:2;
> -        uint64_t ip6_tag_type:2;
> -        uint64_t ip4_tag_type:2;
> -        uint64_t non_tag_type:2;
> -        uint64_t grp:4;
> -    } cn30xx;
> -    struct cvmx_pip_prt_tagx_cn50xx {
> -        uint64_t reserved_40_63:24;
> -        uint64_t grptagbase:4;
> -        uint64_t grptagmask:4;
> -        uint64_t grptag:1;
> -        uint64_t grptag_mskip:1;
> -        uint64_t tag_mode:2;
> -        uint64_t inc_vs:2;
> -        uint64_t inc_vlan:1;
> -        uint64_t inc_prt_flag:1;
> -        uint64_t ip6_dprt_flag:1;
> -        uint64_t ip4_dprt_flag:1;
> -        uint64_t ip6_sprt_flag:1;
> -        uint64_t ip4_sprt_flag:1;
> -        uint64_t ip6_nxth_flag:1;
> -        uint64_t ip4_pctl_flag:1;
> -        uint64_t ip6_dst_flag:1;
> -        uint64_t ip4_dst_flag:1;
> -        uint64_t ip6_src_flag:1;
> -        uint64_t ip4_src_flag:1;
> -        uint64_t tcp6_tag_type:2;
> -        uint64_t tcp4_tag_type:2;
> -        uint64_t ip6_tag_type:2;
> -        uint64_t ip4_tag_type:2;
> -        uint64_t non_tag_type:2;
> -        uint64_t grp:4;
> -    } cn50xx;
> -};
> -
> -union cvmx_spxx_int_reg {
> -    uint64_t u64;
> -    struct cvmx_spxx_int_reg_s {
> -        uint64_t reserved_32_63:32;
> -        uint64_t spf:1;
> -        uint64_t reserved_12_30:19;
> -        uint64_t calerr:1;
> -        uint64_t syncerr:1;
> -        uint64_t diperr:1;
> -        uint64_t tpaovr:1;
> -        uint64_t rsverr:1;
> -        uint64_t drwnng:1;
> -        uint64_t clserr:1;
> -        uint64_t spiovr:1;
> -        uint64_t reserved_2_3:2;
> -        uint64_t abnorm:1;
> -        uint64_t prtnxa:1;
> -    } s;
> -};
> -
> -union cvmx_spxx_int_msk {
> -    uint64_t u64;
> -    struct cvmx_spxx_int_msk_s {
> -        uint64_t reserved_12_63:52;
> -        uint64_t calerr:1;
> -        uint64_t syncerr:1;
> -        uint64_t diperr:1;
> -        uint64_t tpaovr:1;
> -        uint64_t rsverr:1;
> -        uint64_t drwnng:1;
> -        uint64_t clserr:1;
> -        uint64_t spiovr:1;
> -        uint64_t reserved_2_3:2;
> -        uint64_t abnorm:1;
> -        uint64_t prtnxa:1;
> -    } s;
> -};
> -
> -union cvmx_pow_wq_int {
> -    uint64_t u64;
> -    struct cvmx_pow_wq_int_s {
> -        uint64_t wq_int:16;
> -        uint64_t iq_dis:16;
> -        uint64_t reserved_32_63:32;
> -    } s;
> -};
> -
> -union cvmx_sso_wq_int_thrx {
> -    uint64_t u64;
> -    struct {
> -        uint64_t iq_thr:12;
> -        uint64_t reserved_12_13:2;
> -        uint64_t ds_thr:12;
> -        uint64_t reserved_26_27:2;
> -        uint64_t tc_thr:4;
> -        uint64_t tc_en:1;
> -        uint64_t reserved_33_63:31;
> -    } s;
> -};
> -
> -union cvmx_stxx_int_reg {
> -    uint64_t u64;
> -    struct cvmx_stxx_int_reg_s {
> -        uint64_t reserved_9_63:55;
> -        uint64_t syncerr:1;
> -        uint64_t frmerr:1;
> -        uint64_t unxfrm:1;
> -        uint64_t nosync:1;
> -        uint64_t diperr:1;
> -        uint64_t datovr:1;
> -        uint64_t ovrbst:1;
> -        uint64_t calpar1:1;
> -        uint64_t calpar0:1;
> -    } s;
> -};
> -
> -union cvmx_stxx_int_msk {
> -    uint64_t u64;
> -    struct cvmx_stxx_int_msk_s {
> -        uint64_t reserved_8_63:56;
> -        uint64_t frmerr:1;
> -        uint64_t unxfrm:1;
> -        uint64_t nosync:1;
> -        uint64_t diperr:1;
> -        uint64_t datovr:1;
> -        uint64_t ovrbst:1;
> -        uint64_t calpar1:1;
> -        uint64_t calpar0:1;
> -    } s;
> -};
> -
> -union cvmx_pow_wq_int_pc {
> -    uint64_t u64;
> -    struct cvmx_pow_wq_int_pc_s {
> -        uint64_t reserved_0_7:8;
> -        uint64_t pc_thr:20;
> -        uint64_t reserved_28_31:4;
> -        uint64_t pc:28;
> -        uint64_t reserved_60_63:4;
> -    } s;
> -};
> -
> -union cvmx_pow_wq_int_thrx {
> -    uint64_t u64;
> -    struct cvmx_pow_wq_int_thrx_s {
> -        uint64_t reserved_29_63:35;
> -        uint64_t tc_en:1;
> -        uint64_t tc_thr:4;
> -        uint64_t reserved_23_23:1;
> -        uint64_t ds_thr:11;
> -        uint64_t reserved_11_11:1;
> -        uint64_t iq_thr:11;
> -    } s;
> -    struct cvmx_pow_wq_int_thrx_cn30xx {
> -        uint64_t reserved_29_63:35;
> -        uint64_t tc_en:1;
> -        uint64_t tc_thr:4;
> -        uint64_t reserved_18_23:6;
> -        uint64_t ds_thr:6;
> -        uint64_t reserved_6_11:6;
> -        uint64_t iq_thr:6;
> -    } cn30xx;
> -    struct cvmx_pow_wq_int_thrx_cn31xx {
> -        uint64_t reserved_29_63:35;
> -        uint64_t tc_en:1;
> -        uint64_t tc_thr:4;
> -        uint64_t reserved_20_23:4;
> -        uint64_t ds_thr:8;
> -        uint64_t reserved_8_11:4;
> -        uint64_t iq_thr:8;
> -    } cn31xx;
> -    struct cvmx_pow_wq_int_thrx_cn52xx {
> -        uint64_t reserved_29_63:35;
> -        uint64_t tc_en:1;
> -        uint64_t tc_thr:4;
> -        uint64_t reserved_21_23:3;
> -        uint64_t ds_thr:9;
> -        uint64_t reserved_9_11:3;
> -        uint64_t iq_thr:9;
> -    } cn52xx;
> -    struct cvmx_pow_wq_int_thrx_cn63xx {
> -        uint64_t reserved_29_63:35;
> -        uint64_t tc_en:1;
> -        uint64_t tc_thr:4;
> -        uint64_t reserved_22_23:2;
> -        uint64_t ds_thr:10;
> -        uint64_t reserved_10_11:2;
> -        uint64_t iq_thr:10;
> -    } cn63xx;
> -};
> -
> -union cvmx_npi_rsl_int_blocks {
> -    uint64_t u64;
> -    struct cvmx_npi_rsl_int_blocks_s {
> -        uint64_t reserved_32_63:32;
> -        uint64_t rint_31:1;
> -        uint64_t iob:1;
> -        uint64_t reserved_28_29:2;
> -        uint64_t rint_27:1;
> -        uint64_t rint_26:1;
> -        uint64_t rint_25:1;
> -        uint64_t rint_24:1;
> -        uint64_t asx1:1;
> -        uint64_t asx0:1;
> -        uint64_t rint_21:1;
> -        uint64_t pip:1;
> -        uint64_t spx1:1;
> -        uint64_t spx0:1;
> -        uint64_t lmc:1;
> -        uint64_t l2c:1;
> -        uint64_t rint_15:1;
> -        uint64_t reserved_13_14:2;
> -        uint64_t pow:1;
> -        uint64_t tim:1;
> -        uint64_t pko:1;
> -        uint64_t ipd:1;
> -        uint64_t rint_8:1;
> -        uint64_t zip:1;
> -        uint64_t dfa:1;
> -        uint64_t fpa:1;
> -        uint64_t key:1;
> -        uint64_t npi:1;
> -        uint64_t gmx1:1;
> -        uint64_t gmx0:1;
> -        uint64_t mio:1;
> -    } s;
> -    struct cvmx_npi_rsl_int_blocks_cn30xx {
> -        uint64_t reserved_32_63:32;
> -        uint64_t rint_31:1;
> -        uint64_t iob:1;
> -        uint64_t rint_29:1;
> -        uint64_t rint_28:1;
> -        uint64_t rint_27:1;
> -        uint64_t rint_26:1;
> -        uint64_t rint_25:1;
> -        uint64_t rint_24:1;
> -        uint64_t asx1:1;
> -        uint64_t asx0:1;
> -        uint64_t rint_21:1;
> -        uint64_t pip:1;
> -        uint64_t spx1:1;
> -        uint64_t spx0:1;
> -        uint64_t lmc:1;
> -        uint64_t l2c:1;
> -        uint64_t rint_15:1;
> -        uint64_t rint_14:1;
> -        uint64_t usb:1;
> -        uint64_t pow:1;
> -        uint64_t tim:1;
> -        uint64_t pko:1;
> -        uint64_t ipd:1;
> -        uint64_t rint_8:1;
> -        uint64_t zip:1;
> -        uint64_t dfa:1;
> -        uint64_t fpa:1;
> -        uint64_t key:1;
> -        uint64_t npi:1;
> -        uint64_t gmx1:1;
> -        uint64_t gmx0:1;
> -        uint64_t mio:1;
> -    } cn30xx;
> -    struct cvmx_npi_rsl_int_blocks_cn38xx {
> -        uint64_t reserved_32_63:32;
> -        uint64_t rint_31:1;
> -        uint64_t iob:1;
> -        uint64_t rint_29:1;
> -        uint64_t rint_28:1;
> -        uint64_t rint_27:1;
> -        uint64_t rint_26:1;
> -        uint64_t rint_25:1;
> -        uint64_t rint_24:1;
> -        uint64_t asx1:1;
> -        uint64_t asx0:1;
> -        uint64_t rint_21:1;
> -        uint64_t pip:1;
> -        uint64_t spx1:1;
> -        uint64_t spx0:1;
> -        uint64_t lmc:1;
> -        uint64_t l2c:1;
> -        uint64_t rint_15:1;
> -        uint64_t rint_14:1;
> -        uint64_t rint_13:1;
> -        uint64_t pow:1;
> -        uint64_t tim:1;
> -        uint64_t pko:1;
> -        uint64_t ipd:1;
> -        uint64_t rint_8:1;
> -        uint64_t zip:1;
> -        uint64_t dfa:1;
> -        uint64_t fpa:1;
> -        uint64_t key:1;
> -        uint64_t npi:1;
> -        uint64_t gmx1:1;
> -        uint64_t gmx0:1;
> -        uint64_t mio:1;
> -    } cn38xx;
> -    struct cvmx_npi_rsl_int_blocks_cn50xx {
> -        uint64_t reserved_31_63:33;
> -        uint64_t iob:1;
> -        uint64_t lmc1:1;
> -        uint64_t agl:1;
> -        uint64_t reserved_24_27:4;
> -        uint64_t asx1:1;
> -        uint64_t asx0:1;
> -        uint64_t reserved_21_21:1;
> -        uint64_t pip:1;
> -        uint64_t spx1:1;
> -        uint64_t spx0:1;
> -        uint64_t lmc:1;
> -        uint64_t l2c:1;
> -        uint64_t reserved_15_15:1;
> -        uint64_t rad:1;
> -        uint64_t usb:1;
> -        uint64_t pow:1;
> -        uint64_t tim:1;
> -        uint64_t pko:1;
> -        uint64_t ipd:1;
> -        uint64_t reserved_8_8:1;
> -        uint64_t zip:1;
> -        uint64_t dfa:1;
> -        uint64_t fpa:1;
> -        uint64_t key:1;
> -        uint64_t npi:1;
> -        uint64_t gmx1:1;
> -        uint64_t gmx0:1;
> -        uint64_t mio:1;
> -    } cn50xx;
> -};
> -
> -union cvmx_pko_command_word0 {
> -    uint64_t u64;
> -    struct {
> -        uint64_t total_bytes:16;
> -        uint64_t segs:6;
> -        uint64_t dontfree:1;
> -        uint64_t ignore_i:1;
> -        uint64_t ipoffp1:7;
> -        uint64_t gather:1;
> -        uint64_t rsp:1;
> -        uint64_t wqp:1;
> -        uint64_t n2:1;
> -        uint64_t le:1;
> -        uint64_t reg0:11;
> -        uint64_t subone0:1;
> -        uint64_t reg1:11;
> -        uint64_t subone1:1;
> -        uint64_t size0:2;
> -        uint64_t size1:2;
> -    } s;
> -};
> -
> -union cvmx_ciu_timx {
> -    uint64_t u64;
> -    struct cvmx_ciu_timx_s {
> -        uint64_t reserved_37_63:27;
> -        uint64_t one_shot:1;
> -        uint64_t len:36;
> -    } s;
> -};
> -
> -union cvmx_gmxx_rxx_rx_inbnd {
> -    uint64_t u64;
> -    struct cvmx_gmxx_rxx_rx_inbnd_s {
> -        uint64_t status:1;
> -        uint64_t speed:2;
> -        uint64_t duplex:1;
> -        uint64_t reserved_4_63:60;
> -    } s;
> -};
> -
> -static inline int32_t cvmx_fau_fetch_and_add32(enum cvmx_fau_reg_32 reg,
> -                           int32_t value)
> -{
> -    return value;
> -}
> -
> -static inline void cvmx_fau_atomic_add32(enum cvmx_fau_reg_32 reg,
> -                     int32_t value)
> -{ }
> -
> -static inline void cvmx_fau_atomic_write32(enum cvmx_fau_reg_32 reg,
> -                       int32_t value)
> -{ }
> -
> -static inline uint64_t cvmx_scratch_read64(uint64_t address)
> -{
> -    return 0;
> -}
> -
> -static inline void cvmx_scratch_write64(uint64_t address, uint64_t value)
> -{ }
> -
> -static inline int cvmx_wqe_get_grp(struct cvmx_wqe *work)
> -{
> -    return 0;
> -}
> -
> -static inline void *cvmx_phys_to_ptr(uint64_t physical_address)
> -{
> -    return (void *)(uintptr_t)(physical_address);
> -}
> -
> -static inline uint64_t cvmx_ptr_to_phys(void *ptr)
> -{
> -    return (unsigned long)ptr;
> -}
> -
> -static inline int cvmx_helper_get_interface_num(int ipd_port)
> -{
> -    return ipd_port;
> -}
> -
> -static inline int cvmx_helper_get_interface_index_num(int ipd_port)
> -{
> -    return ipd_port;
> -}
> -
> -static inline void cvmx_fpa_enable(void)
> -{ }
> -
> -static inline uint64_t cvmx_read_csr(uint64_t csr_addr)
> -{
> -    return 0;
> -}
> -
> -static inline void cvmx_write_csr(uint64_t csr_addr, uint64_t val)
> -{ }
> -
> -static inline int cvmx_helper_setup_red(int pass_thresh, int drop_thresh)
> -{
> -    return 0;
> -}
> -
> -static inline void *cvmx_fpa_alloc(uint64_t pool)
> -{
> -    return NULL;
> -}
> -
> -static inline void cvmx_fpa_free(void *ptr, uint64_t pool,
> -                 uint64_t num_cache_lines)
> -{ }
> -
> -static inline int octeon_is_simulation(void)
> -{
> -    return 1;
> -}
> -
> -static inline void cvmx_pip_get_port_status(uint64_t port_num, uint64_t clear,
> -                        cvmx_pip_port_status_t *status)
> -{ }
> -
> -static inline void cvmx_pko_get_port_status(uint64_t port_num, uint64_t clear,
> -                        cvmx_pko_port_status_t *status)
> -{ }
> -
> -static inline cvmx_helper_interface_mode_t cvmx_helper_interface_get_mode(int
> -                                   interface)
> -{
> -    return 0;
> -}
> -
> -static inline union cvmx_helper_link_info cvmx_helper_link_get(int ipd_port)
> -{
> -    union cvmx_helper_link_info ret = { .u64 = 0 };
> -
> -    return ret;
> -}
> -
> -static inline int cvmx_helper_link_set(int ipd_port,
> -                       union cvmx_helper_link_info link_info)
> -{
> -    return 0;
> -}
> -
> -static inline int cvmx_helper_initialize_packet_io_global(void)
> -{
> -    return 0;
> -}
> -
> -static inline int cvmx_helper_get_number_of_interfaces(void)
> -{
> -    return 2;
> -}
> -
> -static inline int cvmx_helper_ports_on_interface(int interface)
> -{
> -    return 1;
> -}
> -
> -static inline int cvmx_helper_get_ipd_port(int interface, int port)
> -{
> -    return 0;
> -}
> -
> -static inline int cvmx_helper_ipd_and_packet_input_enable(void)
> -{
> -    return 0;
> -}
> -
> -static inline void cvmx_ipd_disable(void)
> -{ }
> -
> -static inline void cvmx_ipd_free_ptr(void)
> -{ }
> -
> -static inline void cvmx_pko_disable(void)
> -{ }
> -
> -static inline void cvmx_pko_shutdown(void)
> -{ }
> -
> -static inline int cvmx_pko_get_base_queue_per_core(int port, int core)
> -{
> -    return port;
> -}
> -
> -static inline int cvmx_pko_get_base_queue(int port)
> -{
> -    return port;
> -}
> -
> -static inline int cvmx_pko_get_num_queues(int port)
> -{
> -    return port;
> -}
> -
> -static inline unsigned int cvmx_get_core_num(void)
> -{
> -    return 0;
> -}
> -
> -static inline void cvmx_pow_work_request_async_nocheck(int scr_addr,
> -                               cvmx_pow_wait_t wait)
> -{ }
> -
> -static inline void cvmx_pow_work_request_async(int scr_addr,
> -                               cvmx_pow_wait_t wait)
> -{ }
> -
> -static inline struct cvmx_wqe *cvmx_pow_work_response_async(int scr_addr)
> -{
> -    struct cvmx_wqe *wqe = (void *)(unsigned long)scr_addr;
> -
> -    return wqe;
> -}
> -
> -static inline struct cvmx_wqe *cvmx_pow_work_request_sync(cvmx_pow_wait_t wait)
> -{
> -    return (void *)(unsigned long)wait;
> -}
> -
> -static inline int cvmx_spi_restart_interface(int interface,
> -                    cvmx_spi_mode_t mode, int timeout)
> -{
> -    return 0;
> -}
> -
> -static inline void cvmx_fau_async_fetch_and_add32(uint64_t scraddr,
> -                          enum cvmx_fau_reg_32 reg,
> -                          int32_t value)
> -{ }
> -
> -static inline union cvmx_gmxx_rxx_rx_inbnd cvmx_spi4000_check_speed(
> -    int interface,
> -    int port)
> -{
> -    union cvmx_gmxx_rxx_rx_inbnd r;
> -
> -    r.u64 = 0;
> -    return r;
> -}
> -
> -static inline void cvmx_pko_send_packet_prepare(uint64_t port, uint64_t queue,
> -                        cvmx_pko_lock_t use_locking)
> -{ }
> -
> -static inline cvmx_pko_status_t cvmx_pko_send_packet_finish(uint64_t port,
> -        uint64_t queue, union cvmx_pko_command_word0 pko_command,
> -        union cvmx_buf_ptr packet, cvmx_pko_lock_t use_locking)
> -{
> -    return 0;
> -}
> -
> -static inline void cvmx_wqe_set_port(struct cvmx_wqe *work, int port)
> -{ }
> -
> -static inline void cvmx_wqe_set_qos(struct cvmx_wqe *work, int qos)
> -{ }
> -
> -static inline int cvmx_wqe_get_qos(struct cvmx_wqe *work)
> -{
> -    return 0;
> -}
> -
> -static inline void cvmx_wqe_set_grp(struct cvmx_wqe *work, int grp)
> -{ }
> -
> -static inline void cvmx_pow_work_submit(struct cvmx_wqe *wqp, uint32_t tag,
> -                    enum cvmx_pow_tag_type tag_type,
> -                    uint64_t qos, uint64_t grp)
> -{ }
> -
> -#define CVMX_ASXX_RX_CLK_SETX(a, b)    ((a)+(b))
> -#define CVMX_ASXX_TX_CLK_SETX(a, b)    ((a)+(b))
> -#define CVMX_CIU_TIMX(a)        (a)
> -#define CVMX_GMXX_RXX_ADR_CAM0(a, b)    ((a)+(b))
> -#define CVMX_GMXX_RXX_ADR_CAM1(a, b)    ((a)+(b))
> -#define CVMX_GMXX_RXX_ADR_CAM2(a, b)    ((a)+(b))
> -#define CVMX_GMXX_RXX_ADR_CAM3(a, b)    ((a)+(b))
> -#define CVMX_GMXX_RXX_ADR_CAM4(a, b)    ((a)+(b))
> -#define CVMX_GMXX_RXX_ADR_CAM5(a, b)    ((a)+(b))
> -#define CVMX_GMXX_RXX_FRM_CTL(a, b)    ((a)+(b))
> -#define CVMX_GMXX_RXX_INT_REG(a, b)    ((a)+(b))
> -#define CVMX_GMXX_SMACX(a, b)        ((a)+(b))
> -#define CVMX_PIP_PRT_TAGX(a)        (a)
> -#define CVMX_POW_PP_GRP_MSKX(a)        (a)
> -#define CVMX_POW_WQ_INT_THRX(a)        (a)
> -#define CVMX_SPXX_INT_MSK(a)        (a)
> -#define CVMX_SPXX_INT_REG(a)        (a)
> -#define CVMX_SSO_PPX_GRP_MSK(a)        (a)
> -#define CVMX_SSO_WQ_INT_THRX(a)        (a)
> -#define CVMX_STXX_INT_MSK(a)        (a)
> -#define CVMX_STXX_INT_REG(a)        (a)
> -- 
> 2.24.0
> 

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 1/2] staging: octeon: delete driver
  2019-12-10 11:40   ` Sandro Volery
@ 2019-12-10 12:01     ` Greg Kroah-Hartman
  -1 siblings, 0 replies; 59+ messages in thread
From: Greg Kroah-Hartman @ 2019-12-10 12:01 UTC (permalink / raw)
  To: Sandro Volery
  Cc: devel, linux-kernel, Guenter Roeck, David Daney, David S. Miller,
	Matthew Wilcox (Oracle),
	YueHaibing, Aaro Koskinen, Wambui Karuga, Julia Lawall,
	Florian Westphal, Geert Uytterhoeven, Branden Bonaby,
	Petr Štetiar, Paul Burton, Dan Carpenter,
	Giovanni Gherdovich, Valery Ivanov

On Tue, Dec 10, 2019 at 12:40:54PM +0100, Sandro Volery wrote:
> Doesn't octeon have drivers out of staging already?
> What is this module for?

I have no idea :(


^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 1/2] staging: octeon: delete driver
@ 2019-12-10 12:01     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 59+ messages in thread
From: Greg Kroah-Hartman @ 2019-12-10 12:01 UTC (permalink / raw)
  To: Sandro Volery
  Cc: devel, Branden Bonaby, Giovanni Gherdovich, Paul Burton,
	Aaro Koskinen, Florian Westphal, YueHaibing, linux-kernel,
	Matthew Wilcox (Oracle),
	David Daney, Julia Lawall, Geert Uytterhoeven, Dan Carpenter,
	Valery Ivanov, Petr Štetiar, David S. Miller, Guenter Roeck,
	Wambui Karuga

On Tue, Dec 10, 2019 at 12:40:54PM +0100, Sandro Volery wrote:
> Doesn't octeon have drivers out of staging already?
> What is this module for?

I have no idea :(

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 1/2] staging: octeon: delete driver
  2019-12-10 12:01     ` Greg Kroah-Hartman
@ 2019-12-10 12:54       ` Sandro Volery
  -1 siblings, 0 replies; 59+ messages in thread
From: Sandro Volery @ 2019-12-10 12:54 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, linux-kernel, Guenter Roeck, David Daney, David S. Miller,
	Matthew Wilcox (Oracle),
	YueHaibing, Aaro Koskinen, Wambui Karuga, Julia Lawall,
	Florian Westphal, Geert Uytterhoeven, Branden Bonaby,
	Petr Štetiar, Paul Burton, Dan Carpenter,
	Giovanni Gherdovich, Valery Ivanov


Well if documentation is missing then it's their fault.. 
Go ahead and delete it, even tho it kills me since my first 
patch was in there :)

Sandro V

> On 10 Dec 2019, at 13:01, Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
> 
> On Tue, Dec 10, 2019 at 12:40:54PM +0100, Sandro Volery wrote:
>> Doesn't octeon have drivers out of staging already?
>> What is this module for?
> 
> I have no idea :(
> 


^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 1/2] staging: octeon: delete driver
@ 2019-12-10 12:54       ` Sandro Volery
  0 siblings, 0 replies; 59+ messages in thread
From: Sandro Volery @ 2019-12-10 12:54 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, Branden Bonaby, Giovanni Gherdovich, Paul Burton,
	Aaro Koskinen, Florian Westphal, YueHaibing, linux-kernel,
	Matthew Wilcox (Oracle),
	David Daney, Julia Lawall, Geert Uytterhoeven, Dan Carpenter,
	Valery Ivanov, Petr Štetiar, David S. Miller, Guenter Roeck,
	Wambui Karuga


Well if documentation is missing then it's their fault.. 
Go ahead and delete it, even tho it kills me since my first 
patch was in there :)

Sandro V

> On 10 Dec 2019, at 13:01, Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
> 
> On Tue, Dec 10, 2019 at 12:40:54PM +0100, Sandro Volery wrote:
>> Doesn't octeon have drivers out of staging already?
>> What is this module for?
> 
> I have no idea :(
> 

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 2/2] staging: octeon-usb: delete the octeon usb host controller driver
  2019-12-10  9:15   ` Greg Kroah-Hartman
@ 2019-12-10 19:31     ` Aaro Koskinen
  -1 siblings, 0 replies; 59+ messages in thread
From: Aaro Koskinen @ 2019-12-10 19:31 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, linux-kernel, David Daney, Nishka Dasgupta,
	Himadri Pandya, Frank A. Cancio Bello, Sumit Pundir,
	Laura Lazzati

Hi,

On Tue, Dec 10, 2019 at 10:15:09AM +0100, Greg Kroah-Hartman wrote:
> This driver was merged back in 2013 and shows no progress toward every
> being merged into the "correct" part of the kernel.

Do you mean all the patches since 2013 were "no progress"? Thanks.

> The code doesn't even build for anyone unless you have the specific
> hardware platform selected, so odds are it doesn't even work anymore.

I used it in production almost a decade with no issues with unpatched
mainline kernel. All reported issues were fixed. Last kernel I ran
was v5.3.

> Remove it for now and is someone comes along that has the hardware and
> is willing to fix it up, it can be reverted.

Probably the next one who tries it, should try add support in
dwc2. Originally the maintainer of that driver did not prefer this,
maybe the current one does not mind...

A.

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 2/2] staging: octeon-usb: delete the octeon usb host controller driver
@ 2019-12-10 19:31     ` Aaro Koskinen
  0 siblings, 0 replies; 59+ messages in thread
From: Aaro Koskinen @ 2019-12-10 19:31 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, Nishka Dasgupta, Sumit Pundir, linux-kernel, David Daney,
	Frank A. Cancio Bello, Laura Lazzati

Hi,

On Tue, Dec 10, 2019 at 10:15:09AM +0100, Greg Kroah-Hartman wrote:
> This driver was merged back in 2013 and shows no progress toward every
> being merged into the "correct" part of the kernel.

Do you mean all the patches since 2013 were "no progress"? Thanks.

> The code doesn't even build for anyone unless you have the specific
> hardware platform selected, so odds are it doesn't even work anymore.

I used it in production almost a decade with no issues with unpatched
mainline kernel. All reported issues were fixed. Last kernel I ran
was v5.3.

> Remove it for now and is someone comes along that has the hardware and
> is willing to fix it up, it can be reverted.

Probably the next one who tries it, should try add support in
dwc2. Originally the maintainer of that driver did not prefer this,
maybe the current one does not mind...

A.
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 1/2] staging: octeon: delete driver
  2019-12-10 12:01     ` Greg Kroah-Hartman
@ 2019-12-10 19:46       ` Aaro Koskinen
  -1 siblings, 0 replies; 59+ messages in thread
From: Aaro Koskinen @ 2019-12-10 19:46 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Sandro Volery
  Cc: devel, linux-kernel, Guenter Roeck, David S. Miller,
	Matthew Wilcox (Oracle),
	YueHaibing, Wambui Karuga, Julia Lawall, Florian Westphal,
	Geert Uytterhoeven, Branden Bonaby, Petr Štetiar,
	Paul Burton, Dan Carpenter, Giovanni Gherdovich, Valery Ivanov

On Tue, Dec 10, 2019 at 01:01:20PM +0100, Greg Kroah-Hartman wrote:
> On Tue, Dec 10, 2019 at 12:40:54PM +0100, Sandro Volery wrote:
> > Doesn't octeon have drivers out of staging already?
> > What is this module for?
> 
> I have no idea :(

It's stated in the TODO file you are deleting (visible in your
patch): "This driver is functional and supports Ethernet on
OCTEON+/OCTEON2/OCTEON3 chips at least up to CN7030."

This includes e.g. some D-Link routers and Uniquiti EdgeRouters. You
can check from /proc/cpuinfo if you are running on this MIPS SoC.

A.

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 1/2] staging: octeon: delete driver
@ 2019-12-10 19:46       ` Aaro Koskinen
  0 siblings, 0 replies; 59+ messages in thread
From: Aaro Koskinen @ 2019-12-10 19:46 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Sandro Volery
  Cc: devel, Branden Bonaby, Paul Burton, Giovanni Gherdovich,
	Florian Westphal, YueHaibing, linux-kernel,
	Matthew Wilcox (Oracle),
	Julia Lawall, Geert Uytterhoeven, Dan Carpenter, Valery Ivanov,
	Petr Štetiar, David S. Miller, Guenter Roeck, Wambui Karuga

On Tue, Dec 10, 2019 at 01:01:20PM +0100, Greg Kroah-Hartman wrote:
> On Tue, Dec 10, 2019 at 12:40:54PM +0100, Sandro Volery wrote:
> > Doesn't octeon have drivers out of staging already?
> > What is this module for?
> 
> I have no idea :(

It's stated in the TODO file you are deleting (visible in your
patch): "This driver is functional and supports Ethernet on
OCTEON+/OCTEON2/OCTEON3 chips at least up to CN7030."

This includes e.g. some D-Link routers and Uniquiti EdgeRouters. You
can check from /proc/cpuinfo if you are running on this MIPS SoC.

A.
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 1/2] staging: octeon: delete driver
  2019-12-10 19:46       ` Aaro Koskinen
@ 2019-12-10 20:15         ` Guenter Roeck
  -1 siblings, 0 replies; 59+ messages in thread
From: Guenter Roeck @ 2019-12-10 20:15 UTC (permalink / raw)
  To: Aaro Koskinen
  Cc: Greg Kroah-Hartman, Sandro Volery, devel, linux-kernel,
	David S. Miller, Matthew Wilcox (Oracle),
	YueHaibing, Wambui Karuga, Julia Lawall, Florian Westphal,
	Geert Uytterhoeven, Branden Bonaby, Petr Štetiar,
	Paul Burton, Dan Carpenter, Giovanni Gherdovich, Valery Ivanov

On Tue, Dec 10, 2019 at 09:46:59PM +0200, Aaro Koskinen wrote:
> On Tue, Dec 10, 2019 at 01:01:20PM +0100, Greg Kroah-Hartman wrote:
> > On Tue, Dec 10, 2019 at 12:40:54PM +0100, Sandro Volery wrote:
> > > Doesn't octeon have drivers out of staging already?
> > > What is this module for?
> > 
> > I have no idea :(
> 
> It's stated in the TODO file you are deleting (visible in your
> patch): "This driver is functional and supports Ethernet on
> OCTEON+/OCTEON2/OCTEON3 chips at least up to CN7030."
> 
> This includes e.g. some D-Link routers and Uniquiti EdgeRouters. You
> can check from /proc/cpuinfo if you are running on this MIPS SoC.
> 

It also results in "mips:allmodconfig" build failures in mainline
and is for that reason being marked as BROKEN. Unfortunately,
misguided attempts to clean it up had the opposite effect.

Guenter

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 1/2] staging: octeon: delete driver
@ 2019-12-10 20:15         ` Guenter Roeck
  0 siblings, 0 replies; 59+ messages in thread
From: Guenter Roeck @ 2019-12-10 20:15 UTC (permalink / raw)
  To: Aaro Koskinen
  Cc: devel, Branden Bonaby, Florian Westphal, Paul Burton,
	Giovanni Gherdovich, Greg Kroah-Hartman, YueHaibing,
	linux-kernel, Matthew Wilcox (Oracle),
	Julia Lawall, Sandro Volery, Geert Uytterhoeven, Valery Ivanov,
	Petr Štetiar, David S. Miller, Dan Carpenter, Wambui Karuga

On Tue, Dec 10, 2019 at 09:46:59PM +0200, Aaro Koskinen wrote:
> On Tue, Dec 10, 2019 at 01:01:20PM +0100, Greg Kroah-Hartman wrote:
> > On Tue, Dec 10, 2019 at 12:40:54PM +0100, Sandro Volery wrote:
> > > Doesn't octeon have drivers out of staging already?
> > > What is this module for?
> > 
> > I have no idea :(
> 
> It's stated in the TODO file you are deleting (visible in your
> patch): "This driver is functional and supports Ethernet on
> OCTEON+/OCTEON2/OCTEON3 chips at least up to CN7030."
> 
> This includes e.g. some D-Link routers and Uniquiti EdgeRouters. You
> can check from /proc/cpuinfo if you are running on this MIPS SoC.
> 

It also results in "mips:allmodconfig" build failures in mainline
and is for that reason being marked as BROKEN. Unfortunately,
misguided attempts to clean it up had the opposite effect.

Guenter
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 2/2] staging: octeon-usb: delete the octeon usb host controller driver
  2019-12-10 19:31     ` Aaro Koskinen
@ 2019-12-10 20:19       ` Greg Kroah-Hartman
  -1 siblings, 0 replies; 59+ messages in thread
From: Greg Kroah-Hartman @ 2019-12-10 20:19 UTC (permalink / raw)
  To: Aaro Koskinen
  Cc: devel, Nishka Dasgupta, Sumit Pundir, linux-kernel, David Daney,
	Frank A. Cancio Bello, Laura Lazzati

On Tue, Dec 10, 2019 at 09:31:54PM +0200, Aaro Koskinen wrote:
> Hi,
> 
> On Tue, Dec 10, 2019 at 10:15:09AM +0100, Greg Kroah-Hartman wrote:
> > This driver was merged back in 2013 and shows no progress toward every
> > being merged into the "correct" part of the kernel.
> 
> Do you mean all the patches since 2013 were "no progress"? Thanks.

I have not seen any proposals to get it out of staging at all.  If the
only thing left really is just those two simple TODO lines, then why has
it taken 6 years to do that?

> > The code doesn't even build for anyone unless you have the specific
> > hardware platform selected, so odds are it doesn't even work anymore.
> 
> I used it in production almost a decade with no issues with unpatched
> mainline kernel. All reported issues were fixed. Last kernel I ran
> was v5.3.

Then why has it not been merged out of staging?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 2/2] staging: octeon-usb: delete the octeon usb host controller driver
@ 2019-12-10 20:19       ` Greg Kroah-Hartman
  0 siblings, 0 replies; 59+ messages in thread
From: Greg Kroah-Hartman @ 2019-12-10 20:19 UTC (permalink / raw)
  To: Aaro Koskinen
  Cc: devel, Sumit Pundir, linux-kernel, David Daney, Nishka Dasgupta,
	Frank A. Cancio Bello, Laura Lazzati

On Tue, Dec 10, 2019 at 09:31:54PM +0200, Aaro Koskinen wrote:
> Hi,
> 
> On Tue, Dec 10, 2019 at 10:15:09AM +0100, Greg Kroah-Hartman wrote:
> > This driver was merged back in 2013 and shows no progress toward every
> > being merged into the "correct" part of the kernel.
> 
> Do you mean all the patches since 2013 were "no progress"? Thanks.

I have not seen any proposals to get it out of staging at all.  If the
only thing left really is just those two simple TODO lines, then why has
it taken 6 years to do that?

> > The code doesn't even build for anyone unless you have the specific
> > hardware platform selected, so odds are it doesn't even work anymore.
> 
> I used it in production almost a decade with no issues with unpatched
> mainline kernel. All reported issues were fixed. Last kernel I ran
> was v5.3.

Then why has it not been merged out of staging?

thanks,

greg k-h
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 2/2] staging: octeon-usb: delete the octeon usb host controller driver
  2019-12-10 20:19       ` Greg Kroah-Hartman
@ 2019-12-10 21:27         ` Aaro Koskinen
  -1 siblings, 0 replies; 59+ messages in thread
From: Aaro Koskinen @ 2019-12-10 21:27 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, Nishka Dasgupta, Sumit Pundir, linux-kernel, David Daney,
	Frank A. Cancio Bello, Laura Lazzati

On Tue, Dec 10, 2019 at 09:19:57PM +0100, Greg Kroah-Hartman wrote:
> On Tue, Dec 10, 2019 at 09:31:54PM +0200, Aaro Koskinen wrote:
> > Hi,
> > 
> > On Tue, Dec 10, 2019 at 10:15:09AM +0100, Greg Kroah-Hartman wrote:
> > > This driver was merged back in 2013 and shows no progress toward every
> > > being merged into the "correct" part of the kernel.
> > 
> > Do you mean all the patches since 2013 were "no progress"? Thanks.
> 
> I have not seen any proposals to get it out of staging at all.  If the
> only thing left really is just those two simple TODO lines, then why has
> it taken 6 years to do that?

Do you mean you did not see the below thread when I asked for help;
it was a kind of propsal, no? Also things take time when you are just a
hobbyist reverse engineering undocumented hardware that you also run in
production. Yes, I'm slow, but the starting point wasn't also a very good.

https://marc.info/?t=155839354700002&r=1&w=2

I don't mind you deleting the driver, and if you think that "no progress"
is true then I'm very sorry for all those commits/noise.

A.

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 2/2] staging: octeon-usb: delete the octeon usb host controller driver
@ 2019-12-10 21:27         ` Aaro Koskinen
  0 siblings, 0 replies; 59+ messages in thread
From: Aaro Koskinen @ 2019-12-10 21:27 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, Sumit Pundir, linux-kernel, David Daney, Nishka Dasgupta,
	Frank A. Cancio Bello, Laura Lazzati

On Tue, Dec 10, 2019 at 09:19:57PM +0100, Greg Kroah-Hartman wrote:
> On Tue, Dec 10, 2019 at 09:31:54PM +0200, Aaro Koskinen wrote:
> > Hi,
> > 
> > On Tue, Dec 10, 2019 at 10:15:09AM +0100, Greg Kroah-Hartman wrote:
> > > This driver was merged back in 2013 and shows no progress toward every
> > > being merged into the "correct" part of the kernel.
> > 
> > Do you mean all the patches since 2013 were "no progress"? Thanks.
> 
> I have not seen any proposals to get it out of staging at all.  If the
> only thing left really is just those two simple TODO lines, then why has
> it taken 6 years to do that?

Do you mean you did not see the below thread when I asked for help;
it was a kind of propsal, no? Also things take time when you are just a
hobbyist reverse engineering undocumented hardware that you also run in
production. Yes, I'm slow, but the starting point wasn't also a very good.

https://marc.info/?t=155839354700002&r=1&w=2

I don't mind you deleting the driver, and if you think that "no progress"
is true then I'm very sorry for all those commits/noise.

A.
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 1/2] staging: octeon: delete driver
  2019-12-10 20:15         ` Guenter Roeck
@ 2019-12-10 21:48           ` Aaro Koskinen
  -1 siblings, 0 replies; 59+ messages in thread
From: Aaro Koskinen @ 2019-12-10 21:48 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: devel, Branden Bonaby, Florian Westphal, Paul Burton,
	Giovanni Gherdovich, Greg Kroah-Hartman, YueHaibing,
	linux-kernel, Matthew Wilcox (Oracle),
	Julia Lawall, Sandro Volery, Geert Uytterhoeven, Valery Ivanov,
	Petr Štetiar, David S. Miller, Dan Carpenter, Wambui Karuga

On Tue, Dec 10, 2019 at 12:15:15PM -0800, Guenter Roeck wrote:
> On Tue, Dec 10, 2019 at 09:46:59PM +0200, Aaro Koskinen wrote:
> > On Tue, Dec 10, 2019 at 01:01:20PM +0100, Greg Kroah-Hartman wrote:
> > > I have no idea :(
> > 
> > It's stated in the TODO file you are deleting (visible in your
> > patch): "This driver is functional and supports Ethernet on
> > OCTEON+/OCTEON2/OCTEON3 chips at least up to CN7030."
> > 
> > This includes e.g. some D-Link routers and Uniquiti EdgeRouters. You
> > can check from /proc/cpuinfo if you are running on this MIPS SoC.
> 
> It also results in "mips:allmodconfig" build failures in mainline
> and is for that reason being marked as BROKEN. Unfortunately,
> misguided attempts to clean it up had the opposite effect.

This was because of stubs hack added by someone - people who do not run
or care about the hardware can now break it for others with their
silly x86 "compile test"s.

A.

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 1/2] staging: octeon: delete driver
@ 2019-12-10 21:48           ` Aaro Koskinen
  0 siblings, 0 replies; 59+ messages in thread
From: Aaro Koskinen @ 2019-12-10 21:48 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: devel, Branden Bonaby, YueHaibing, Paul Burton, Julia Lawall,
	Greg Kroah-Hartman, Florian Westphal, linux-kernel,
	Matthew Wilcox (Oracle),
	Giovanni Gherdovich, Sandro Volery, Geert Uytterhoeven,
	Valery Ivanov, Petr Štetiar, David S. Miller, Dan Carpenter,
	Wambui Karuga

On Tue, Dec 10, 2019 at 12:15:15PM -0800, Guenter Roeck wrote:
> On Tue, Dec 10, 2019 at 09:46:59PM +0200, Aaro Koskinen wrote:
> > On Tue, Dec 10, 2019 at 01:01:20PM +0100, Greg Kroah-Hartman wrote:
> > > I have no idea :(
> > 
> > It's stated in the TODO file you are deleting (visible in your
> > patch): "This driver is functional and supports Ethernet on
> > OCTEON+/OCTEON2/OCTEON3 chips at least up to CN7030."
> > 
> > This includes e.g. some D-Link routers and Uniquiti EdgeRouters. You
> > can check from /proc/cpuinfo if you are running on this MIPS SoC.
> 
> It also results in "mips:allmodconfig" build failures in mainline
> and is for that reason being marked as BROKEN. Unfortunately,
> misguided attempts to clean it up had the opposite effect.

This was because of stubs hack added by someone - people who do not run
or care about the hardware can now break it for others with their
silly x86 "compile test"s.

A.
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 1/2] staging: octeon: delete driver
  2019-12-10 21:48           ` Aaro Koskinen
@ 2019-12-10 22:48             ` Guenter Roeck
  -1 siblings, 0 replies; 59+ messages in thread
From: Guenter Roeck @ 2019-12-10 22:48 UTC (permalink / raw)
  To: Aaro Koskinen
  Cc: devel, Branden Bonaby, Florian Westphal, Paul Burton,
	Giovanni Gherdovich, Greg Kroah-Hartman, YueHaibing,
	linux-kernel, Matthew Wilcox (Oracle),
	Julia Lawall, Sandro Volery, Geert Uytterhoeven, Valery Ivanov,
	Petr Štetiar, David S. Miller, Dan Carpenter, Wambui Karuga

On Tue, Dec 10, 2019 at 11:48:49PM +0200, Aaro Koskinen wrote:
> On Tue, Dec 10, 2019 at 12:15:15PM -0800, Guenter Roeck wrote:
> > On Tue, Dec 10, 2019 at 09:46:59PM +0200, Aaro Koskinen wrote:
> > > On Tue, Dec 10, 2019 at 01:01:20PM +0100, Greg Kroah-Hartman wrote:
> > > > I have no idea :(
> > > 
> > > It's stated in the TODO file you are deleting (visible in your
> > > patch): "This driver is functional and supports Ethernet on
> > > OCTEON+/OCTEON2/OCTEON3 chips at least up to CN7030."
> > > 
> > > This includes e.g. some D-Link routers and Uniquiti EdgeRouters. You
> > > can check from /proc/cpuinfo if you are running on this MIPS SoC.
> > 
> > It also results in "mips:allmodconfig" build failures in mainline
> > and is for that reason being marked as BROKEN. Unfortunately,
> > misguided attempts to clean it up had the opposite effect.
> 
> This was because of stubs hack added by someone - people who do not run
> or care about the hardware can now break it for others with their
> silly x86 "compile test"s.
> 

Thast was the first breakage. The second was to replace typedefs with
structures without considering that those typedefs are still used
throughout the Cavium code, creating conflicts between "mystruct_t" and
"struct mystruct" in various API calls. It may well be that this
"improvement" was tested with x86_64:allmodconfig - if it was tested
in the first place. It was most definitely not tested with
cavium_octeon_defconfig, much less with real hardware.

Pretty much none of the changes made to the driver in the recent
past have improved it. On the contrary, it is getting worse. With no
one committed to get the driver out of staging, I don't think there
is a reasonable alternative to removing it. For my part I am for sure
not looking forward having to deal with it breaking over and over
again and having to spend time tracking down the breakage.

Guenter

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 1/2] staging: octeon: delete driver
@ 2019-12-10 22:48             ` Guenter Roeck
  0 siblings, 0 replies; 59+ messages in thread
From: Guenter Roeck @ 2019-12-10 22:48 UTC (permalink / raw)
  To: Aaro Koskinen
  Cc: devel, Branden Bonaby, YueHaibing, Paul Burton, Julia Lawall,
	Greg Kroah-Hartman, Florian Westphal, linux-kernel,
	Matthew Wilcox (Oracle),
	Giovanni Gherdovich, Sandro Volery, Geert Uytterhoeven,
	Valery Ivanov, Petr Štetiar, David S. Miller, Dan Carpenter,
	Wambui Karuga

On Tue, Dec 10, 2019 at 11:48:49PM +0200, Aaro Koskinen wrote:
> On Tue, Dec 10, 2019 at 12:15:15PM -0800, Guenter Roeck wrote:
> > On Tue, Dec 10, 2019 at 09:46:59PM +0200, Aaro Koskinen wrote:
> > > On Tue, Dec 10, 2019 at 01:01:20PM +0100, Greg Kroah-Hartman wrote:
> > > > I have no idea :(
> > > 
> > > It's stated in the TODO file you are deleting (visible in your
> > > patch): "This driver is functional and supports Ethernet on
> > > OCTEON+/OCTEON2/OCTEON3 chips at least up to CN7030."
> > > 
> > > This includes e.g. some D-Link routers and Uniquiti EdgeRouters. You
> > > can check from /proc/cpuinfo if you are running on this MIPS SoC.
> > 
> > It also results in "mips:allmodconfig" build failures in mainline
> > and is for that reason being marked as BROKEN. Unfortunately,
> > misguided attempts to clean it up had the opposite effect.
> 
> This was because of stubs hack added by someone - people who do not run
> or care about the hardware can now break it for others with their
> silly x86 "compile test"s.
> 

Thast was the first breakage. The second was to replace typedefs with
structures without considering that those typedefs are still used
throughout the Cavium code, creating conflicts between "mystruct_t" and
"struct mystruct" in various API calls. It may well be that this
"improvement" was tested with x86_64:allmodconfig - if it was tested
in the first place. It was most definitely not tested with
cavium_octeon_defconfig, much less with real hardware.

Pretty much none of the changes made to the driver in the recent
past have improved it. On the contrary, it is getting worse. With no
one committed to get the driver out of staging, I don't think there
is a reasonable alternative to removing it. For my part I am for sure
not looking forward having to deal with it breaking over and over
again and having to spend time tracking down the breakage.

Guenter
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 1/2] staging: octeon: delete driver
  2019-12-10 21:48           ` Aaro Koskinen
@ 2019-12-11  7:22             ` Dan Carpenter
  -1 siblings, 0 replies; 59+ messages in thread
From: Dan Carpenter @ 2019-12-11  7:22 UTC (permalink / raw)
  To: Aaro Koskinen
  Cc: Guenter Roeck, devel, Branden Bonaby, YueHaibing, Paul Burton,
	Julia Lawall, Greg Kroah-Hartman, Florian Westphal, linux-kernel,
	Matthew Wilcox (Oracle),
	Giovanni Gherdovich, Sandro Volery, Geert Uytterhoeven,
	Valery Ivanov, Petr Štetiar, David S. Miller, Wambui Karuga

On Tue, Dec 10, 2019 at 11:48:49PM +0200, Aaro Koskinen wrote:
> On Tue, Dec 10, 2019 at 12:15:15PM -0800, Guenter Roeck wrote:
> > On Tue, Dec 10, 2019 at 09:46:59PM +0200, Aaro Koskinen wrote:
> > > On Tue, Dec 10, 2019 at 01:01:20PM +0100, Greg Kroah-Hartman wrote:
> > > > I have no idea :(
> > > 
> > > It's stated in the TODO file you are deleting (visible in your
> > > patch): "This driver is functional and supports Ethernet on
> > > OCTEON+/OCTEON2/OCTEON3 chips at least up to CN7030."
> > > 
> > > This includes e.g. some D-Link routers and Uniquiti EdgeRouters. You
> > > can check from /proc/cpuinfo if you are running on this MIPS SoC.
> > 
> > It also results in "mips:allmodconfig" build failures in mainline
> > and is for that reason being marked as BROKEN. Unfortunately,
> > misguided attempts to clean it up had the opposite effect.
> 
> This was because of stubs hack added by someone - people who do not run
> or care about the hardware can now break it for others with their
> silly x86 "compile test"s.

Compile tests are nice in theory for finding static analysis bugs but
often they introduce static checker false positives because we don't
initialize *param variables in the stub functions.

And those compat stubs in particular were a headache to review.  We
broke the build a couple times, but we *almost* broke the build a *lot*
of times...

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 1/2] staging: octeon: delete driver
@ 2019-12-11  7:22             ` Dan Carpenter
  0 siblings, 0 replies; 59+ messages in thread
From: Dan Carpenter @ 2019-12-11  7:22 UTC (permalink / raw)
  To: Aaro Koskinen
  Cc: devel, Branden Bonaby, Florian Westphal, Paul Burton,
	Giovanni Gherdovich, Greg Kroah-Hartman, YueHaibing,
	linux-kernel, Matthew Wilcox (Oracle),
	Julia Lawall, Sandro Volery, Geert Uytterhoeven, Valery Ivanov,
	Petr Štetiar, David S. Miller, Guenter Roeck, Wambui Karuga

On Tue, Dec 10, 2019 at 11:48:49PM +0200, Aaro Koskinen wrote:
> On Tue, Dec 10, 2019 at 12:15:15PM -0800, Guenter Roeck wrote:
> > On Tue, Dec 10, 2019 at 09:46:59PM +0200, Aaro Koskinen wrote:
> > > On Tue, Dec 10, 2019 at 01:01:20PM +0100, Greg Kroah-Hartman wrote:
> > > > I have no idea :(
> > > 
> > > It's stated in the TODO file you are deleting (visible in your
> > > patch): "This driver is functional and supports Ethernet on
> > > OCTEON+/OCTEON2/OCTEON3 chips at least up to CN7030."
> > > 
> > > This includes e.g. some D-Link routers and Uniquiti EdgeRouters. You
> > > can check from /proc/cpuinfo if you are running on this MIPS SoC.
> > 
> > It also results in "mips:allmodconfig" build failures in mainline
> > and is for that reason being marked as BROKEN. Unfortunately,
> > misguided attempts to clean it up had the opposite effect.
> 
> This was because of stubs hack added by someone - people who do not run
> or care about the hardware can now break it for others with their
> silly x86 "compile test"s.

Compile tests are nice in theory for finding static analysis bugs but
often they introduce static checker false positives because we don't
initialize *param variables in the stub functions.

And those compat stubs in particular were a headache to review.  We
broke the build a couple times, but we *almost* broke the build a *lot*
of times...

regards,
dan carpenter

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 2/2] staging: octeon-usb: delete the octeon usb host controller driver
  2019-12-10 21:27         ` Aaro Koskinen
@ 2019-12-11  7:42           ` Greg Kroah-Hartman
  -1 siblings, 0 replies; 59+ messages in thread
From: Greg Kroah-Hartman @ 2019-12-11  7:42 UTC (permalink / raw)
  To: Aaro Koskinen
  Cc: devel, Sumit Pundir, linux-kernel, David Daney, Nishka Dasgupta,
	Frank A. Cancio Bello, Laura Lazzati

On Tue, Dec 10, 2019 at 11:27:44PM +0200, Aaro Koskinen wrote:
> On Tue, Dec 10, 2019 at 09:19:57PM +0100, Greg Kroah-Hartman wrote:
> > On Tue, Dec 10, 2019 at 09:31:54PM +0200, Aaro Koskinen wrote:
> > > Hi,
> > > 
> > > On Tue, Dec 10, 2019 at 10:15:09AM +0100, Greg Kroah-Hartman wrote:
> > > > This driver was merged back in 2013 and shows no progress toward every
> > > > being merged into the "correct" part of the kernel.
> > > 
> > > Do you mean all the patches since 2013 were "no progress"? Thanks.
> > 
> > I have not seen any proposals to get it out of staging at all.  If the
> > only thing left really is just those two simple TODO lines, then why has
> > it taken 6 years to do that?
> 
> Do you mean you did not see the below thread when I asked for help;
> it was a kind of propsal, no? Also things take time when you are just a
> hobbyist reverse engineering undocumented hardware that you also run in
> production. Yes, I'm slow, but the starting point wasn't also a very good.
> 
> https://marc.info/?t=155839354700002&r=1&w=2

I have the short-term memory of a squirrel, remember I get 1000 emails a
day to deal with.

That thread was from back in May, the instructions on what was needed to
be done is quite simple, so there should not have been a multi-month
delay from then until now.  What happened?

> I don't mind you deleting the driver, and if you think that "no progress"
> is true then I'm very sorry for all those commits/noise.

Don't be sorry, you have fixed it up to make it ready to be merged
properly.  But yes, there is no progress being made now, so it should
either be dropped or merged properly.

If you don't have the time now to do it, that's fine, the revert to get
the code back just takes one single git command when you, or someone
else, can get the chance to do it.

Don't take it personally, this is about to happen to almost all of the
staging drivers that have been languishing around :)

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 2/2] staging: octeon-usb: delete the octeon usb host controller driver
@ 2019-12-11  7:42           ` Greg Kroah-Hartman
  0 siblings, 0 replies; 59+ messages in thread
From: Greg Kroah-Hartman @ 2019-12-11  7:42 UTC (permalink / raw)
  To: Aaro Koskinen
  Cc: devel, Sumit Pundir, linux-kernel, David Daney, Nishka Dasgupta,
	Frank A. Cancio Bello, Laura Lazzati

On Tue, Dec 10, 2019 at 11:27:44PM +0200, Aaro Koskinen wrote:
> On Tue, Dec 10, 2019 at 09:19:57PM +0100, Greg Kroah-Hartman wrote:
> > On Tue, Dec 10, 2019 at 09:31:54PM +0200, Aaro Koskinen wrote:
> > > Hi,
> > > 
> > > On Tue, Dec 10, 2019 at 10:15:09AM +0100, Greg Kroah-Hartman wrote:
> > > > This driver was merged back in 2013 and shows no progress toward every
> > > > being merged into the "correct" part of the kernel.
> > > 
> > > Do you mean all the patches since 2013 were "no progress"? Thanks.
> > 
> > I have not seen any proposals to get it out of staging at all.  If the
> > only thing left really is just those two simple TODO lines, then why has
> > it taken 6 years to do that?
> 
> Do you mean you did not see the below thread when I asked for help;
> it was a kind of propsal, no? Also things take time when you are just a
> hobbyist reverse engineering undocumented hardware that you also run in
> production. Yes, I'm slow, but the starting point wasn't also a very good.
> 
> https://marc.info/?t=155839354700002&r=1&w=2

I have the short-term memory of a squirrel, remember I get 1000 emails a
day to deal with.

That thread was from back in May, the instructions on what was needed to
be done is quite simple, so there should not have been a multi-month
delay from then until now.  What happened?

> I don't mind you deleting the driver, and if you think that "no progress"
> is true then I'm very sorry for all those commits/noise.

Don't be sorry, you have fixed it up to make it ready to be merged
properly.  But yes, there is no progress being made now, so it should
either be dropped or merged properly.

If you don't have the time now to do it, that's fine, the revert to get
the code back just takes one single git command when you, or someone
else, can get the chance to do it.

Don't take it personally, this is about to happen to almost all of the
staging drivers that have been languishing around :)

thanks,

greg k-h
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 1/2] staging: octeon: delete driver
  2019-12-10 10:42   ` Guenter Roeck
@ 2020-02-04  4:02     ` Chris Packham
  -1 siblings, 0 replies; 59+ messages in thread
From: Chris Packham @ 2020-02-04  4:02 UTC (permalink / raw)
  To: linux, gregkh, devel
  Cc: linux-kernel, wambui.karugax, dan.carpenter, bobdc9664, fw,
	aaro.koskinen, willy, yuehaibing, brandonbonaby94, sandro,
	paulburton, ddaney, ynezz, julia.lawall, ivalery111, davem,
	geert

I'll pipe up on this thread too

On Tue, 2019-12-10 at 02:42 -0800, Guenter Roeck wrote:
> On 12/10/19 1:15 AM, Greg Kroah-Hartman wrote:
> > This driver has been in the tree since 2009 with no real movement to get
> > it out.  Now it is starting to cause build issues and other problems for
> > people who want to fix coding style problems, but can not actually build
> > it.
> > 
> > As nothing is happening here, just delete the module entirely.
> > 
> > Reported-by: Guenter Roeck <linux@roeck-us.net>
> > Cc: David Daney <ddaney@caviumnetworks.com>
> > Cc: "David S. Miller" <davem@davemloft.net>
> > Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
> > Cc: Guenter Roeck <linux@roeck-us.net>
> > Cc: YueHaibing <yuehaibing@huawei.com>
> > Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
> > Cc: Wambui Karuga <wambui.karugax@gmail.com>
> > Cc: Julia Lawall <julia.lawall@lip6.fr>
> > Cc: Florian Westphal <fw@strlen.de>
> > Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> > Cc: Branden Bonaby <brandonbonaby94@gmail.com>
> > Cc: "Petr Štetiar" <ynezz@true.cz>
> > Cc: Sandro Volery <sandro@volery.com>
> > Cc: Paul Burton <paulburton@kernel.org>
> > Cc: Dan Carpenter <dan.carpenter@oracle.com>
> > Cc: Giovanni Gherdovich <bobdc9664@seznam.cz>
> > Cc: Valery Ivanov <ivalery111@gmail.com>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> 
> Acked-by: Guenter Roeck <linux@roeck-us.net>

Please can we keep this driver. We do have platforms using it and we
would like it to stay around.

Clearly we'll need to sort things out to a point where they build
successfully. We've been hoping to see this move out of staging ever
since we selected Cavium as a vendor.

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 1/2] staging: octeon: delete driver
@ 2020-02-04  4:02     ` Chris Packham
  0 siblings, 0 replies; 59+ messages in thread
From: Chris Packham @ 2020-02-04  4:02 UTC (permalink / raw)
  To: linux, gregkh, devel
  Cc: brandonbonaby94, julia.lawall, paulburton, aaro.koskinen,
	yuehaibing, fw, linux-kernel, willy, ddaney, bobdc9664, sandro,
	geert, ivalery111, ynezz, davem, dan.carpenter, wambui.karugax

I'll pipe up on this thread too

On Tue, 2019-12-10 at 02:42 -0800, Guenter Roeck wrote:
> On 12/10/19 1:15 AM, Greg Kroah-Hartman wrote:
> > This driver has been in the tree since 2009 with no real movement to get
> > it out.  Now it is starting to cause build issues and other problems for
> > people who want to fix coding style problems, but can not actually build
> > it.
> > 
> > As nothing is happening here, just delete the module entirely.
> > 
> > Reported-by: Guenter Roeck <linux@roeck-us.net>
> > Cc: David Daney <ddaney@caviumnetworks.com>
> > Cc: "David S. Miller" <davem@davemloft.net>
> > Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
> > Cc: Guenter Roeck <linux@roeck-us.net>
> > Cc: YueHaibing <yuehaibing@huawei.com>
> > Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
> > Cc: Wambui Karuga <wambui.karugax@gmail.com>
> > Cc: Julia Lawall <julia.lawall@lip6.fr>
> > Cc: Florian Westphal <fw@strlen.de>
> > Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> > Cc: Branden Bonaby <brandonbonaby94@gmail.com>
> > Cc: "Petr Štetiar" <ynezz@true.cz>
> > Cc: Sandro Volery <sandro@volery.com>
> > Cc: Paul Burton <paulburton@kernel.org>
> > Cc: Dan Carpenter <dan.carpenter@oracle.com>
> > Cc: Giovanni Gherdovich <bobdc9664@seznam.cz>
> > Cc: Valery Ivanov <ivalery111@gmail.com>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> 
> Acked-by: Guenter Roeck <linux@roeck-us.net>

Please can we keep this driver. We do have platforms using it and we
would like it to stay around.

Clearly we'll need to sort things out to a point where they build
successfully. We've been hoping to see this move out of staging ever
since we selected Cavium as a vendor.
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 2/2] staging: octeon-usb: delete the octeon usb host controller driver
  2019-12-10  9:15   ` Greg Kroah-Hartman
@ 2020-02-04  4:06     ` Chris Packham
  -1 siblings, 0 replies; 59+ messages in thread
From: Chris Packham @ 2020-02-04  4:06 UTC (permalink / raw)
  To: gregkh, devel
  Cc: frank, aaro.koskinen, ddaney.cavm, laura.lazzati.15,
	linux-kernel, nishkadg.linux, pundirsumit11

On Tue, 2019-12-10 at 10:15 +0100, Greg Kroah-Hartman wrote:
> This driver was merged back in 2013 and shows no progress toward every
> being merged into the "correct" part of the kernel.  The code doesn't
> even build for anyone unless you have the specific hardware platform
> selected, so odds are it doesn't even work anymore.
> 
> Remove it for now and is someone comes along that has the hardware and
> is willing to fix it up, it can be reverted.
> 
> Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
> Cc: David Daney <ddaney.cavm@gmail.com>
> Cc: Nishka Dasgupta <nishkadg.linux@gmail.com>
> Cc: Himadri Pandya <himadri18.07@gmail.com>
> Cc: "Frank A. Cancio Bello" <frank@generalsoftwareinc.com>
> Cc: Sumit Pundir <pundirsumit11@gmail.com>
> Cc: Laura Lazzati <laura.lazzati.15@gmail.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---

Similarly we'd really like to keep this too.


>  drivers/staging/Kconfig                 |    2 -
>  drivers/staging/Makefile                |    1 -
>  drivers/staging/octeon-usb/Kconfig      |   11 -
>  drivers/staging/octeon-usb/Makefile     |    2 -
>  drivers/staging/octeon-usb/TODO         |    8 -
>  drivers/staging/octeon-usb/octeon-hcd.c | 3737 -----------------------
>  drivers/staging/octeon-usb/octeon-hcd.h | 1847 -----------
>  7 files changed, 5608 deletions(-)
>  delete mode 100644 drivers/staging/octeon-usb/Kconfig
>  delete mode 100644 drivers/staging/octeon-usb/Makefile
>  delete mode 100644 drivers/staging/octeon-usb/TODO
>  delete mode 100644 drivers/staging/octeon-usb/octeon-hcd.c
>  delete mode 100644 drivers/staging/octeon-usb/octeon-hcd.h
> 
> diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
> index 15d3549e7cc7..198bf59bc1e6 100644
> --- a/drivers/staging/Kconfig
> +++ b/drivers/staging/Kconfig
> @@ -42,8 +42,6 @@ source "drivers/staging/rtl8188eu/Kconfig"
>  
>  source "drivers/staging/rts5208/Kconfig"
>  
> -source "drivers/staging/octeon-usb/Kconfig"
> -
>  source "drivers/staging/vt6655/Kconfig"
>  
>  source "drivers/staging/vt6656/Kconfig"
> diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
> index c521204220b5..bf230a830338 100644
> --- a/drivers/staging/Makefile
> +++ b/drivers/staging/Makefile
> @@ -12,7 +12,6 @@ obj-$(CONFIG_R8712U)		+= rtl8712/
>  obj-$(CONFIG_R8188EU)		+= rtl8188eu/
>  obj-$(CONFIG_RTS5208)		+= rts5208/
>  obj-$(CONFIG_NETLOGIC_XLR_NET)	+= netlogic/
> -obj-$(CONFIG_OCTEON_USB)	+= octeon-usb/
>  obj-$(CONFIG_VT6655)		+= vt6655/
>  obj-$(CONFIG_VT6656)		+= vt6656/
>  obj-$(CONFIG_VME_BUS)		+= vme/
> diff --git a/drivers/staging/octeon-usb/Kconfig b/drivers/staging/octeon-usb/Kconfig
> deleted file mode 100644
> index 6a5d842ee0f2..000000000000
> --- a/drivers/staging/octeon-usb/Kconfig
> +++ /dev/null
> @@ -1,11 +0,0 @@
> -# SPDX-License-Identifier: GPL-2.0
> -config OCTEON_USB
> -	tristate "Cavium Networks Octeon USB support"
> -	depends on CAVIUM_OCTEON_SOC && USB
> -	help
> -	  This driver supports USB host controller on some Cavium
> -	  Networks' products in the Octeon family.
> -
> -	  To compile this driver as a module, choose M here. The module
> -	  will be called octeon-hcd.
> -
> diff --git a/drivers/staging/octeon-usb/Makefile b/drivers/staging/octeon-usb/Makefile
> deleted file mode 100644
> index 9873a0130ad5..000000000000
> --- a/drivers/staging/octeon-usb/Makefile
> +++ /dev/null
> @@ -1,2 +0,0 @@
> -# SPDX-License-Identifier: GPL-2.0
> -obj-${CONFIG_OCTEON_USB} := octeon-hcd.o
> diff --git a/drivers/staging/octeon-usb/TODO b/drivers/staging/octeon-usb/TODO
> deleted file mode 100644
> index 2b29acca5caa..000000000000
> --- a/drivers/staging/octeon-usb/TODO
> +++ /dev/null
> @@ -1,8 +0,0 @@
> -This driver is functional and has been tested on EdgeRouter Lite,
> -D-Link DSR-1000N and EBH5600 evaluation board with USB mass storage.
> -
> -TODO:
> -	- kernel coding style
> -	- checkpatch warnings
> -
> -Contact: Aaro Koskinen <aaro.koskinen@iki.fi>
> diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c
> deleted file mode 100644
> index 582c9187559d..000000000000
> --- a/drivers/staging/octeon-usb/octeon-hcd.c
> +++ /dev/null
> @@ -1,3737 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0
> -/*
> - * This file is subject to the terms and conditions of the GNU General Public
> - * License.  See the file "COPYING" in the main directory of this archive
> - * for more details.
> - *
> - * Copyright (C) 2008 Cavium Networks
> - *
> - * Some parts of the code were originally released under BSD license:
> - *
> - * Copyright (c) 2003-2010 Cavium Networks (support@cavium.com). All rights
> - * reserved.
> - *
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions are
> - * met:
> - *
> - *   * Redistributions of source code must retain the above copyright
> - *     notice, this list of conditions and the following disclaimer.
> - *
> - *   * Redistributions in binary form must reproduce the above
> - *     copyright notice, this list of conditions and the following
> - *     disclaimer in the documentation and/or other materials provided
> - *     with the distribution.
> - *
> - *   * Neither the name of Cavium Networks nor the names of
> - *     its contributors may be used to endorse or promote products
> - *     derived from this software without specific prior written
> - *     permission.
> - *
> - * This Software, including technical data, may be subject to U.S. export
> - * control laws, including the U.S. Export Administration Act and its associated
> - * regulations, and may be subject to export or import regulations in other
> - * countries.
> - *
> - * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
> - * AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR
> - * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
> - * THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION
> - * OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
> - * SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
> - * MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
> - * VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
> - * CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
> - * PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
> - */
> -
> -#include <linux/usb.h>
> -#include <linux/slab.h>
> -#include <linux/module.h>
> -#include <linux/usb/hcd.h>
> -#include <linux/prefetch.h>
> -#include <linux/dma-mapping.h>
> -#include <linux/platform_device.h>
> -
> -#include <asm/octeon/octeon.h>
> -
> -#include "octeon-hcd.h"
> -
> -/**
> - * enum cvmx_usb_speed - the possible USB device speeds
> - *
> - * @CVMX_USB_SPEED_HIGH: Device is operation at 480Mbps
> - * @CVMX_USB_SPEED_FULL: Device is operation at 12Mbps
> - * @CVMX_USB_SPEED_LOW:  Device is operation at 1.5Mbps
> - */
> -enum cvmx_usb_speed {
> -	CVMX_USB_SPEED_HIGH = 0,
> -	CVMX_USB_SPEED_FULL = 1,
> -	CVMX_USB_SPEED_LOW = 2,
> -};
> -
> -/**
> - * enum cvmx_usb_transfer - the possible USB transfer types
> - *
> - * @CVMX_USB_TRANSFER_CONTROL:	   USB transfer type control for hub and status
> - *				   transfers
> - * @CVMX_USB_TRANSFER_ISOCHRONOUS: USB transfer type isochronous for low
> - *				   priority periodic transfers
> - * @CVMX_USB_TRANSFER_BULK:	   USB transfer type bulk for large low priority
> - *				   transfers
> - * @CVMX_USB_TRANSFER_INTERRUPT:   USB transfer type interrupt for high priority
> - *				   periodic transfers
> - */
> -enum cvmx_usb_transfer {
> -	CVMX_USB_TRANSFER_CONTROL = 0,
> -	CVMX_USB_TRANSFER_ISOCHRONOUS = 1,
> -	CVMX_USB_TRANSFER_BULK = 2,
> -	CVMX_USB_TRANSFER_INTERRUPT = 3,
> -};
> -
> -/**
> - * enum cvmx_usb_direction - the transfer directions
> - *
> - * @CVMX_USB_DIRECTION_OUT: Data is transferring from Octeon to the device/host
> - * @CVMX_USB_DIRECTION_IN:  Data is transferring from the device/host to Octeon
> - */
> -enum cvmx_usb_direction {
> -	CVMX_USB_DIRECTION_OUT,
> -	CVMX_USB_DIRECTION_IN,
> -};
> -
> -/**
> - * enum cvmx_usb_status - possible callback function status codes
> - *
> - * @CVMX_USB_STATUS_OK:		  The transaction / operation finished without
> - *				  any errors
> - * @CVMX_USB_STATUS_SHORT:	  FIXME: This is currently not implemented
> - * @CVMX_USB_STATUS_CANCEL:	  The transaction was canceled while in flight
> - *				  by a user call to cvmx_usb_cancel
> - * @CVMX_USB_STATUS_ERROR:	  The transaction aborted with an unexpected
> - *				  error status
> - * @CVMX_USB_STATUS_STALL:	  The transaction received a USB STALL response
> - *				  from the device
> - * @CVMX_USB_STATUS_XACTERR:	  The transaction failed with an error from the
> - *				  device even after a number of retries
> - * @CVMX_USB_STATUS_DATATGLERR:	  The transaction failed with a data toggle
> - *				  error even after a number of retries
> - * @CVMX_USB_STATUS_BABBLEERR:	  The transaction failed with a babble error
> - * @CVMX_USB_STATUS_FRAMEERR:	  The transaction failed with a frame error
> - *				  even after a number of retries
> - */
> -enum cvmx_usb_status {
> -	CVMX_USB_STATUS_OK,
> -	CVMX_USB_STATUS_SHORT,
> -	CVMX_USB_STATUS_CANCEL,
> -	CVMX_USB_STATUS_ERROR,
> -	CVMX_USB_STATUS_STALL,
> -	CVMX_USB_STATUS_XACTERR,
> -	CVMX_USB_STATUS_DATATGLERR,
> -	CVMX_USB_STATUS_BABBLEERR,
> -	CVMX_USB_STATUS_FRAMEERR,
> -};
> -
> -/**
> - * struct cvmx_usb_port_status - the USB port status information
> - *
> - * @port_enabled:	1 = Usb port is enabled, 0 = disabled
> - * @port_over_current:	1 = Over current detected, 0 = Over current not
> - *			detected. Octeon doesn't support over current detection.
> - * @port_powered:	1 = Port power is being supplied to the device, 0 =
> - *			power is off. Octeon doesn't support turning port power
> - *			off.
> - * @port_speed:		Current port speed.
> - * @connected:		1 = A device is connected to the port, 0 = No device is
> - *			connected.
> - * @connect_change:	1 = Device connected state changed since the last set
> - *			status call.
> - */
> -struct cvmx_usb_port_status {
> -	u32 reserved			: 25;
> -	u32 port_enabled		: 1;
> -	u32 port_over_current		: 1;
> -	u32 port_powered		: 1;
> -	enum cvmx_usb_speed port_speed	: 2;
> -	u32 connected			: 1;
> -	u32 connect_change		: 1;
> -};
> -
> -/**
> - * struct cvmx_usb_iso_packet - descriptor for Isochronous packets
> - *
> - * @offset:	This is the offset in bytes into the main buffer where this data
> - *		is stored.
> - * @length:	This is the length in bytes of the data.
> - * @status:	This is the status of this individual packet transfer.
> - */
> -struct cvmx_usb_iso_packet {
> -	int offset;
> -	int length;
> -	enum cvmx_usb_status status;
> -};
> -
> -/**
> - * enum cvmx_usb_initialize_flags - flags used by the initialization function
> - *
> - * @CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_XI:    The USB port uses a 12MHz crystal
> - *					      as clock source at USB_XO and
> - *					      USB_XI.
> - * @CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_GND:   The USB port uses 12/24/48MHz 2.5V
> - *					      board clock source at USB_XO.
> - *					      USB_XI should be tied to GND.
> - * @CVMX_USB_INITIALIZE_FLAGS_CLOCK_MHZ_MASK: Mask for clock speed field
> - * @CVMX_USB_INITIALIZE_FLAGS_CLOCK_12MHZ:    Speed of reference clock or
> - *					      crystal
> - * @CVMX_USB_INITIALIZE_FLAGS_CLOCK_24MHZ:    Speed of reference clock
> - * @CVMX_USB_INITIALIZE_FLAGS_CLOCK_48MHZ:    Speed of reference clock
> - * @CVMX_USB_INITIALIZE_FLAGS_NO_DMA:	      Disable DMA and used polled IO for
> - *					      data transfer use for the USB
> - */
> -enum cvmx_usb_initialize_flags {
> -	CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_XI		= 1 << 0,
> -	CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_GND		= 1 << 1,
> -	CVMX_USB_INITIALIZE_FLAGS_CLOCK_MHZ_MASK	= 3 << 3,
> -	CVMX_USB_INITIALIZE_FLAGS_CLOCK_12MHZ		= 1 << 3,
> -	CVMX_USB_INITIALIZE_FLAGS_CLOCK_24MHZ		= 2 << 3,
> -	CVMX_USB_INITIALIZE_FLAGS_CLOCK_48MHZ		= 3 << 3,
> -	/* Bits 3-4 used to encode the clock frequency */
> -	CVMX_USB_INITIALIZE_FLAGS_NO_DMA		= 1 << 5,
> -};
> -
> -/**
> - * enum cvmx_usb_pipe_flags - internal flags for a pipe.
> - *
> - * @CVMX_USB_PIPE_FLAGS_SCHEDULED: Used internally to determine if a pipe is
> - *				   actively using hardware.
> - * @CVMX_USB_PIPE_FLAGS_NEED_PING: Used internally to determine if a high speed
> - *				   pipe is in the ping state.
> - */
> -enum cvmx_usb_pipe_flags {
> -	CVMX_USB_PIPE_FLAGS_SCHEDULED	= 1 << 17,
> -	CVMX_USB_PIPE_FLAGS_NEED_PING	= 1 << 18,
> -};
> -
> -/* Maximum number of times to retry failed transactions */
> -#define MAX_RETRIES		3
> -
> -/* Maximum number of hardware channels supported by the USB block */
> -#define MAX_CHANNELS		8
> -
> -/*
> - * The low level hardware can transfer a maximum of this number of bytes in each
> - * transfer. The field is 19 bits wide
> - */
> -#define MAX_TRANSFER_BYTES	((1 << 19) - 1)
> -
> -/*
> - * The low level hardware can transfer a maximum of this number of packets in
> - * each transfer. The field is 10 bits wide
> - */
> -#define MAX_TRANSFER_PACKETS	((1 << 10) - 1)
> -
> -/**
> - * Logical transactions may take numerous low level
> - * transactions, especially when splits are concerned. This
> - * enum represents all of the possible stages a transaction can
> - * be in. Note that split completes are always even. This is so
> - * the NAK handler can backup to the previous low level
> - * transaction with a simple clearing of bit 0.
> - */
> -enum cvmx_usb_stage {
> -	CVMX_USB_STAGE_NON_CONTROL,
> -	CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE,
> -	CVMX_USB_STAGE_SETUP,
> -	CVMX_USB_STAGE_SETUP_SPLIT_COMPLETE,
> -	CVMX_USB_STAGE_DATA,
> -	CVMX_USB_STAGE_DATA_SPLIT_COMPLETE,
> -	CVMX_USB_STAGE_STATUS,
> -	CVMX_USB_STAGE_STATUS_SPLIT_COMPLETE,
> -};
> -
> -/**
> - * struct cvmx_usb_transaction - describes each pending USB transaction
> - *				 regardless of type. These are linked together
> - *				 to form a list of pending requests for a pipe.
> - *
> - * @node:		List node for transactions in the pipe.
> - * @type:		Type of transaction, duplicated of the pipe.
> - * @flags:		State flags for this transaction.
> - * @buffer:		User's physical buffer address to read/write.
> - * @buffer_length:	Size of the user's buffer in bytes.
> - * @control_header:	For control transactions, physical address of the 8
> - *			byte standard header.
> - * @iso_start_frame:	For ISO transactions, the starting frame number.
> - * @iso_number_packets:	For ISO transactions, the number of packets in the
> - *			request.
> - * @iso_packets:	For ISO transactions, the sub packets in the request.
> - * @actual_bytes:	Actual bytes transfer for this transaction.
> - * @stage:		For control transactions, the current stage.
> - * @urb:		URB.
> - */
> -struct cvmx_usb_transaction {
> -	struct list_head node;
> -	enum cvmx_usb_transfer type;
> -	u64 buffer;
> -	int buffer_length;
> -	u64 control_header;
> -	int iso_start_frame;
> -	int iso_number_packets;
> -	struct cvmx_usb_iso_packet *iso_packets;
> -	int xfersize;
> -	int pktcnt;
> -	int retries;
> -	int actual_bytes;
> -	enum cvmx_usb_stage stage;
> -	struct urb *urb;
> -};
> -
> -/**
> - * struct cvmx_usb_pipe - a pipe represents a virtual connection between Octeon
> - *			  and some USB device. It contains a list of pending
> - *			  request to the device.
> - *
> - * @node:		List node for pipe list
> - * @next:		Pipe after this one in the list
> - * @transactions:	List of pending transactions
> - * @interval:		For periodic pipes, the interval between packets in
> - *			frames
> - * @next_tx_frame:	The next frame this pipe is allowed to transmit on
> - * @flags:		State flags for this pipe
> - * @device_speed:	Speed of device connected to this pipe
> - * @transfer_type:	Type of transaction supported by this pipe
> - * @transfer_dir:	IN or OUT. Ignored for Control
> - * @multi_count:	Max packet in a row for the device
> - * @max_packet:		The device's maximum packet size in bytes
> - * @device_addr:	USB device address at other end of pipe
> - * @endpoint_num:	USB endpoint number at other end of pipe
> - * @hub_device_addr:	Hub address this device is connected to
> - * @hub_port:		Hub port this device is connected to
> - * @pid_toggle:		This toggles between 0/1 on every packet send to track
> - *			the data pid needed
> - * @channel:		Hardware DMA channel for this pipe
> - * @split_sc_frame:	The low order bits of the frame number the split
> - *			complete should be sent on
> - */
> -struct cvmx_usb_pipe {
> -	struct list_head node;
> -	struct list_head transactions;
> -	u64 interval;
> -	u64 next_tx_frame;
> -	enum cvmx_usb_pipe_flags flags;
> -	enum cvmx_usb_speed device_speed;
> -	enum cvmx_usb_transfer transfer_type;
> -	enum cvmx_usb_direction transfer_dir;
> -	int multi_count;
> -	u16 max_packet;
> -	u8 device_addr;
> -	u8 endpoint_num;
> -	u8 hub_device_addr;
> -	u8 hub_port;
> -	u8 pid_toggle;
> -	u8 channel;
> -	s8 split_sc_frame;
> -};
> -
> -struct cvmx_usb_tx_fifo {
> -	struct {
> -		int channel;
> -		int size;
> -		u64 address;
> -	} entry[MAX_CHANNELS + 1];
> -	int head;
> -	int tail;
> -};
> -
> -/**
> - * struct octeon_hcd - the state of the USB block
> - *
> - * lock:		   Serialization lock.
> - * init_flags:		   Flags passed to initialize.
> - * index:		   Which USB block this is for.
> - * idle_hardware_channels: Bit set for every idle hardware channel.
> - * usbcx_hprt:		   Stored port status so we don't need to read a CSR to
> - *			   determine splits.
> - * pipe_for_channel:	   Map channels to pipes.
> - * pipe:		   Storage for pipes.
> - * indent:		   Used by debug output to indent functions.
> - * port_status:		   Last port status used for change notification.
> - * idle_pipes:		   List of open pipes that have no transactions.
> - * active_pipes:	   Active pipes indexed by transfer type.
> - * frame_number:	   Increments every SOF interrupt for time keeping.
> - * active_split:	   Points to the current active split, or NULL.
> - */
> -struct octeon_hcd {
> -	spinlock_t lock; /* serialization lock */
> -	int init_flags;
> -	int index;
> -	int idle_hardware_channels;
> -	union cvmx_usbcx_hprt usbcx_hprt;
> -	struct cvmx_usb_pipe *pipe_for_channel[MAX_CHANNELS];
> -	int indent;
> -	struct cvmx_usb_port_status port_status;
> -	struct list_head idle_pipes;
> -	struct list_head active_pipes[4];
> -	u64 frame_number;
> -	struct cvmx_usb_transaction *active_split;
> -	struct cvmx_usb_tx_fifo periodic;
> -	struct cvmx_usb_tx_fifo nonperiodic;
> -};
> -
> -/*
> - * This macro logically sets a single field in a CSR. It does the sequence
> - * read, modify, and write
> - */
> -#define USB_SET_FIELD32(address, _union, field, value)		\
> -	do {							\
> -		union _union c;					\
> -								\
> -		c.u32 = cvmx_usb_read_csr32(usb, address);	\
> -		c.s.field = value;				\
> -		cvmx_usb_write_csr32(usb, address, c.u32);	\
> -	} while (0)
> -
> -/* Returns the IO address to push/pop stuff data from the FIFOs */
> -#define USB_FIFO_ADDRESS(channel, usb_index) \
> -	(CVMX_USBCX_GOTGCTL(usb_index) + ((channel) + 1) * 0x1000)
> -
> -/**
> - * struct octeon_temp_buffer - a bounce buffer for USB transfers
> - * @orig_buffer: the original buffer passed by the USB stack
> - * @data:	 the newly allocated temporary buffer (excluding meta-data)
> - *
> - * Both the DMA engine and FIFO mode will always transfer full 32-bit words. If
> - * the buffer is too short, we need to allocate a temporary one, and this struct
> - * represents it.
> - */
> -struct octeon_temp_buffer {
> -	void *orig_buffer;
> -	u8 data[0];
> -};
> -
> -static inline struct usb_hcd *octeon_to_hcd(struct octeon_hcd *p)
> -{
> -	return container_of((void *)p, struct usb_hcd, hcd_priv);
> -}
> -
> -/**
> - * octeon_alloc_temp_buffer - allocate a temporary buffer for USB transfer
> - *                            (if needed)
> - * @urb:	URB.
> - * @mem_flags:	Memory allocation flags.
> - *
> - * This function allocates a temporary bounce buffer whenever it's needed
> - * due to HW limitations.
> - */
> -static int octeon_alloc_temp_buffer(struct urb *urb, gfp_t mem_flags)
> -{
> -	struct octeon_temp_buffer *temp;
> -
> -	if (urb->num_sgs || urb->sg ||
> -	    (urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP) ||
> -	    !(urb->transfer_buffer_length % sizeof(u32)))
> -		return 0;
> -
> -	temp = kmalloc(ALIGN(urb->transfer_buffer_length, sizeof(u32)) +
> -		       sizeof(*temp), mem_flags);
> -	if (!temp)
> -		return -ENOMEM;
> -
> -	temp->orig_buffer = urb->transfer_buffer;
> -	if (usb_urb_dir_out(urb))
> -		memcpy(temp->data, urb->transfer_buffer,
> -		       urb->transfer_buffer_length);
> -	urb->transfer_buffer = temp->data;
> -	urb->transfer_flags |= URB_ALIGNED_TEMP_BUFFER;
> -
> -	return 0;
> -}
> -
> -/**
> - * octeon_free_temp_buffer - free a temporary buffer used by USB transfers.
> - * @urb: URB.
> - *
> - * Frees a buffer allocated by octeon_alloc_temp_buffer().
> - */
> -static void octeon_free_temp_buffer(struct urb *urb)
> -{
> -	struct octeon_temp_buffer *temp;
> -	size_t length;
> -
> -	if (!(urb->transfer_flags & URB_ALIGNED_TEMP_BUFFER))
> -		return;
> -
> -	temp = container_of(urb->transfer_buffer, struct octeon_temp_buffer,
> -			    data);
> -	if (usb_urb_dir_in(urb)) {
> -		if (usb_pipeisoc(urb->pipe))
> -			length = urb->transfer_buffer_length;
> -		else
> -			length = urb->actual_length;
> -
> -		memcpy(temp->orig_buffer, urb->transfer_buffer, length);
> -	}
> -	urb->transfer_buffer = temp->orig_buffer;
> -	urb->transfer_flags &= ~URB_ALIGNED_TEMP_BUFFER;
> -	kfree(temp);
> -}
> -
> -/**
> - * octeon_map_urb_for_dma - Octeon-specific map_urb_for_dma().
> - * @hcd:	USB HCD structure.
> - * @urb:	URB.
> - * @mem_flags:	Memory allocation flags.
> - */
> -static int octeon_map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb,
> -				  gfp_t mem_flags)
> -{
> -	int ret;
> -
> -	ret = octeon_alloc_temp_buffer(urb, mem_flags);
> -	if (ret)
> -		return ret;
> -
> -	ret = usb_hcd_map_urb_for_dma(hcd, urb, mem_flags);
> -	if (ret)
> -		octeon_free_temp_buffer(urb);
> -
> -	return ret;
> -}
> -
> -/**
> - * octeon_unmap_urb_for_dma - Octeon-specific unmap_urb_for_dma()
> - * @hcd:	USB HCD structure.
> - * @urb:	URB.
> - */
> -static void octeon_unmap_urb_for_dma(struct usb_hcd *hcd, struct urb *urb)
> -{
> -	usb_hcd_unmap_urb_for_dma(hcd, urb);
> -	octeon_free_temp_buffer(urb);
> -}
> -
> -/**
> - * Read a USB 32bit CSR. It performs the necessary address swizzle
> - * for 32bit CSRs and logs the value in a readable format if
> - * debugging is on.
> - *
> - * @usb:     USB block this access is for
> - * @address: 64bit address to read
> - *
> - * Returns: Result of the read
> - */
> -static inline u32 cvmx_usb_read_csr32(struct octeon_hcd *usb, u64 address)
> -{
> -	return cvmx_read64_uint32(address ^ 4);
> -}
> -
> -/**
> - * Write a USB 32bit CSR. It performs the necessary address
> - * swizzle for 32bit CSRs and logs the value in a readable format
> - * if debugging is on.
> - *
> - * @usb:     USB block this access is for
> - * @address: 64bit address to write
> - * @value:   Value to write
> - */
> -static inline void cvmx_usb_write_csr32(struct octeon_hcd *usb,
> -					u64 address, u32 value)
> -{
> -	cvmx_write64_uint32(address ^ 4, value);
> -	cvmx_read64_uint64(CVMX_USBNX_DMA0_INB_CHN0(usb->index));
> -}
> -
> -/**
> - * Return non zero if this pipe connects to a non HIGH speed
> - * device through a high speed hub.
> - *
> - * @usb:    USB block this access is for
> - * @pipe:   Pipe to check
> - *
> - * Returns: Non zero if we need to do split transactions
> - */
> -static inline int cvmx_usb_pipe_needs_split(struct octeon_hcd *usb,
> -					    struct cvmx_usb_pipe *pipe)
> -{
> -	return pipe->device_speed != CVMX_USB_SPEED_HIGH &&
> -	       usb->usbcx_hprt.s.prtspd == CVMX_USB_SPEED_HIGH;
> -}
> -
> -/**
> - * Trivial utility function to return the correct PID for a pipe
> - *
> - * @pipe:   pipe to check
> - *
> - * Returns: PID for pipe
> - */
> -static inline int cvmx_usb_get_data_pid(struct cvmx_usb_pipe *pipe)
> -{
> -	if (pipe->pid_toggle)
> -		return 2; /* Data1 */
> -	return 0; /* Data0 */
> -}
> -
> -/* Loops through register until txfflsh or rxfflsh become zero.*/
> -static int cvmx_wait_tx_rx(struct octeon_hcd *usb, int fflsh_type)
> -{
> -	int result;
> -	u64 address = CVMX_USBCX_GRSTCTL(usb->index);
> -	u64 done = cvmx_get_cycle() + 100 *
> -		   (u64)octeon_get_clock_rate / 1000000;
> -	union cvmx_usbcx_grstctl c;
> -
> -	while (1) {
> -		c.u32 = cvmx_usb_read_csr32(usb, address);
> -		if (fflsh_type == 0 && c.s.txfflsh == 0) {
> -			result = 0;
> -			break;
> -		} else if (fflsh_type == 1 && c.s.rxfflsh == 0) {
> -			result = 0;
> -			break;
> -		} else if (cvmx_get_cycle() > done) {
> -			result = -1;
> -			break;
> -		}
> -
> -		__delay(100);
> -	}
> -	return result;
> -}
> -
> -static void cvmx_fifo_setup(struct octeon_hcd *usb)
> -{
> -	union cvmx_usbcx_ghwcfg3 usbcx_ghwcfg3;
> -	union cvmx_usbcx_gnptxfsiz npsiz;
> -	union cvmx_usbcx_hptxfsiz psiz;
> -
> -	usbcx_ghwcfg3.u32 = cvmx_usb_read_csr32(usb,
> -						CVMX_USBCX_GHWCFG3(usb->index));
> -
> -	/*
> -	 * Program the USBC_GRXFSIZ register to select the size of the receive
> -	 * FIFO (25%).
> -	 */
> -	USB_SET_FIELD32(CVMX_USBCX_GRXFSIZ(usb->index), cvmx_usbcx_grxfsiz,
> -			rxfdep, usbcx_ghwcfg3.s.dfifodepth / 4);
> -
> -	/*
> -	 * Program the USBC_GNPTXFSIZ register to select the size and the start
> -	 * address of the non-periodic transmit FIFO for nonperiodic
> -	 * transactions (50%).
> -	 */
> -	npsiz.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_GNPTXFSIZ(usb->index));
> -	npsiz.s.nptxfdep = usbcx_ghwcfg3.s.dfifodepth / 2;
> -	npsiz.s.nptxfstaddr = usbcx_ghwcfg3.s.dfifodepth / 4;
> -	cvmx_usb_write_csr32(usb, CVMX_USBCX_GNPTXFSIZ(usb->index), npsiz.u32);
> -
> -	/*
> -	 * Program the USBC_HPTXFSIZ register to select the size and start
> -	 * address of the periodic transmit FIFO for periodic transactions
> -	 * (25%).
> -	 */
> -	psiz.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HPTXFSIZ(usb->index));
> -	psiz.s.ptxfsize = usbcx_ghwcfg3.s.dfifodepth / 4;
> -	psiz.s.ptxfstaddr = 3 * usbcx_ghwcfg3.s.dfifodepth / 4;
> -	cvmx_usb_write_csr32(usb, CVMX_USBCX_HPTXFSIZ(usb->index), psiz.u32);
> -
> -	/* Flush all FIFOs */
> -	USB_SET_FIELD32(CVMX_USBCX_GRSTCTL(usb->index),
> -			cvmx_usbcx_grstctl, txfnum, 0x10);
> -	USB_SET_FIELD32(CVMX_USBCX_GRSTCTL(usb->index),
> -			cvmx_usbcx_grstctl, txfflsh, 1);
> -	cvmx_wait_tx_rx(usb, 0);
> -	USB_SET_FIELD32(CVMX_USBCX_GRSTCTL(usb->index),
> -			cvmx_usbcx_grstctl, rxfflsh, 1);
> -	cvmx_wait_tx_rx(usb, 1);
> -}
> -
> -/**
> - * Shutdown a USB port after a call to cvmx_usb_initialize().
> - * The port should be disabled with all pipes closed when this
> - * function is called.
> - *
> - * @usb: USB device state populated by cvmx_usb_initialize().
> - *
> - * Returns: 0 or a negative error code.
> - */
> -static int cvmx_usb_shutdown(struct octeon_hcd *usb)
> -{
> -	union cvmx_usbnx_clk_ctl usbn_clk_ctl;
> -
> -	/* Make sure all pipes are closed */
> -	if (!list_empty(&usb->idle_pipes) ||
> -	    !list_empty(&usb->active_pipes[CVMX_USB_TRANSFER_ISOCHRONOUS]) ||
> -	    !list_empty(&usb->active_pipes[CVMX_USB_TRANSFER_INTERRUPT]) ||
> -	    !list_empty(&usb->active_pipes[CVMX_USB_TRANSFER_CONTROL]) ||
> -	    !list_empty(&usb->active_pipes[CVMX_USB_TRANSFER_BULK]))
> -		return -EBUSY;
> -
> -	/* Disable the clocks and put them in power on reset */
> -	usbn_clk_ctl.u64 = cvmx_read64_uint64(CVMX_USBNX_CLK_CTL(usb->index));
> -	usbn_clk_ctl.s.enable = 1;
> -	usbn_clk_ctl.s.por = 1;
> -	usbn_clk_ctl.s.hclk_rst = 1;
> -	usbn_clk_ctl.s.prst = 0;
> -	usbn_clk_ctl.s.hrst = 0;
> -	cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64);
> -	return 0;
> -}
> -
> -/**
> - * Initialize a USB port for use. This must be called before any
> - * other access to the Octeon USB port is made. The port starts
> - * off in the disabled state.
> - *
> - * @dev:	 Pointer to struct device for logging purposes.
> - * @usb:	 Pointer to struct octeon_hcd.
> - *
> - * Returns: 0 or a negative error code.
> - */
> -static int cvmx_usb_initialize(struct device *dev,
> -			       struct octeon_hcd *usb)
> -{
> -	int channel;
> -	int divisor;
> -	int retries = 0;
> -	union cvmx_usbcx_hcfg usbcx_hcfg;
> -	union cvmx_usbnx_clk_ctl usbn_clk_ctl;
> -	union cvmx_usbcx_gintsts usbc_gintsts;
> -	union cvmx_usbcx_gahbcfg usbcx_gahbcfg;
> -	union cvmx_usbcx_gintmsk usbcx_gintmsk;
> -	union cvmx_usbcx_gusbcfg usbcx_gusbcfg;
> -	union cvmx_usbnx_usbp_ctl_status usbn_usbp_ctl_status;
> -
> -retry:
> -	/*
> -	 * Power On Reset and PHY Initialization
> -	 *
> -	 * 1. Wait for DCOK to assert (nothing to do)
> -	 *
> -	 * 2a. Write USBN0/1_CLK_CTL[POR] = 1 and
> -	 *     USBN0/1_CLK_CTL[HRST,PRST,HCLK_RST] = 0
> -	 */
> -	usbn_clk_ctl.u64 = cvmx_read64_uint64(CVMX_USBNX_CLK_CTL(usb->index));
> -	usbn_clk_ctl.s.por = 1;
> -	usbn_clk_ctl.s.hrst = 0;
> -	usbn_clk_ctl.s.prst = 0;
> -	usbn_clk_ctl.s.hclk_rst = 0;
> -	usbn_clk_ctl.s.enable = 0;
> -	/*
> -	 * 2b. Select the USB reference clock/crystal parameters by writing
> -	 *     appropriate values to USBN0/1_CLK_CTL[P_C_SEL, P_RTYPE, P_COM_ON]
> -	 */
> -	if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_GND) {
> -		/*
> -		 * The USB port uses 12/24/48MHz 2.5V board clock
> -		 * source at USB_XO. USB_XI should be tied to GND.
> -		 * Most Octeon evaluation boards require this setting
> -		 */
> -		if (OCTEON_IS_MODEL(OCTEON_CN3XXX) ||
> -		    OCTEON_IS_MODEL(OCTEON_CN56XX) ||
> -		    OCTEON_IS_MODEL(OCTEON_CN50XX))
> -			/* From CN56XX,CN50XX,CN31XX,CN30XX manuals */
> -			usbn_clk_ctl.s.p_rtype = 2; /* p_rclk=1 & p_xenbn=0 */
> -		else
> -			/* From CN52XX manual */
> -			usbn_clk_ctl.s.p_rtype = 1;
> -
> -		switch (usb->init_flags &
> -			CVMX_USB_INITIALIZE_FLAGS_CLOCK_MHZ_MASK) {
> -		case CVMX_USB_INITIALIZE_FLAGS_CLOCK_12MHZ:
> -			usbn_clk_ctl.s.p_c_sel = 0;
> -			break;
> -		case CVMX_USB_INITIALIZE_FLAGS_CLOCK_24MHZ:
> -			usbn_clk_ctl.s.p_c_sel = 1;
> -			break;
> -		case CVMX_USB_INITIALIZE_FLAGS_CLOCK_48MHZ:
> -			usbn_clk_ctl.s.p_c_sel = 2;
> -			break;
> -		}
> -	} else {
> -		/*
> -		 * The USB port uses a 12MHz crystal as clock source
> -		 * at USB_XO and USB_XI
> -		 */
> -		if (OCTEON_IS_MODEL(OCTEON_CN3XXX))
> -			/* From CN31XX,CN30XX manual */
> -			usbn_clk_ctl.s.p_rtype = 3; /* p_rclk=1 & p_xenbn=1 */
> -		else
> -			/* From CN56XX,CN52XX,CN50XX manuals. */
> -			usbn_clk_ctl.s.p_rtype = 0;
> -
> -		usbn_clk_ctl.s.p_c_sel = 0;
> -	}
> -	/*
> -	 * 2c. Select the HCLK via writing USBN0/1_CLK_CTL[DIVIDE, DIVIDE2] and
> -	 *     setting USBN0/1_CLK_CTL[ENABLE] = 1. Divide the core clock down
> -	 *     such that USB is as close as possible to 125Mhz
> -	 */
> -	divisor = DIV_ROUND_UP(octeon_get_clock_rate(), 125000000);
> -	/* Lower than 4 doesn't seem to work properly */
> -	if (divisor < 4)
> -		divisor = 4;
> -	usbn_clk_ctl.s.divide = divisor;
> -	usbn_clk_ctl.s.divide2 = 0;
> -	cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64);
> -
> -	/* 2d. Write USBN0/1_CLK_CTL[HCLK_RST] = 1 */
> -	usbn_clk_ctl.s.hclk_rst = 1;
> -	cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64);
> -	/* 2e.  Wait 64 core-clock cycles for HCLK to stabilize */
> -	__delay(64);
> -	/*
> -	 * 3. Program the power-on reset field in the USBN clock-control
> -	 *    register:
> -	 *    USBN_CLK_CTL[POR] = 0
> -	 */
> -	usbn_clk_ctl.s.por = 0;
> -	cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64);
> -	/* 4. Wait 1 ms for PHY clock to start */
> -	mdelay(1);
> -	/*
> -	 * 5. Program the Reset input from automatic test equipment field in the
> -	 *    USBP control and status register:
> -	 *    USBN_USBP_CTL_STATUS[ATE_RESET] = 1
> -	 */
> -	usbn_usbp_ctl_status.u64 =
> -		cvmx_read64_uint64(CVMX_USBNX_USBP_CTL_STATUS(usb->index));
> -	usbn_usbp_ctl_status.s.ate_reset = 1;
> -	cvmx_write64_uint64(CVMX_USBNX_USBP_CTL_STATUS(usb->index),
> -			    usbn_usbp_ctl_status.u64);
> -	/* 6. Wait 10 cycles */
> -	__delay(10);
> -	/*
> -	 * 7. Clear ATE_RESET field in the USBN clock-control register:
> -	 *    USBN_USBP_CTL_STATUS[ATE_RESET] = 0
> -	 */
> -	usbn_usbp_ctl_status.s.ate_reset = 0;
> -	cvmx_write64_uint64(CVMX_USBNX_USBP_CTL_STATUS(usb->index),
> -			    usbn_usbp_ctl_status.u64);
> -	/*
> -	 * 8. Program the PHY reset field in the USBN clock-control register:
> -	 *    USBN_CLK_CTL[PRST] = 1
> -	 */
> -	usbn_clk_ctl.s.prst = 1;
> -	cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64);
> -	/*
> -	 * 9. Program the USBP control and status register to select host or
> -	 *    device mode. USBN_USBP_CTL_STATUS[HST_MODE] = 0 for host, = 1 for
> -	 *    device
> -	 */
> -	usbn_usbp_ctl_status.s.hst_mode = 0;
> -	cvmx_write64_uint64(CVMX_USBNX_USBP_CTL_STATUS(usb->index),
> -			    usbn_usbp_ctl_status.u64);
> -	/* 10. Wait 1 us */
> -	udelay(1);
> -	/*
> -	 * 11. Program the hreset_n field in the USBN clock-control register:
> -	 *     USBN_CLK_CTL[HRST] = 1
> -	 */
> -	usbn_clk_ctl.s.hrst = 1;
> -	cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64);
> -	/* 12. Proceed to USB core initialization */
> -	usbn_clk_ctl.s.enable = 1;
> -	cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64);
> -	udelay(1);
> -
> -	/*
> -	 * USB Core Initialization
> -	 *
> -	 * 1. Read USBC_GHWCFG1, USBC_GHWCFG2, USBC_GHWCFG3, USBC_GHWCFG4 to
> -	 *    determine USB core configuration parameters.
> -	 *
> -	 *    Nothing needed
> -	 *
> -	 * 2. Program the following fields in the global AHB configuration
> -	 *    register (USBC_GAHBCFG)
> -	 *    DMA mode, USBC_GAHBCFG[DMAEn]: 1 = DMA mode, 0 = slave mode
> -	 *    Burst length, USBC_GAHBCFG[HBSTLEN] = 0
> -	 *    Nonperiodic TxFIFO empty level (slave mode only),
> -	 *    USBC_GAHBCFG[NPTXFEMPLVL]
> -	 *    Periodic TxFIFO empty level (slave mode only),
> -	 *    USBC_GAHBCFG[PTXFEMPLVL]
> -	 *    Global interrupt mask, USBC_GAHBCFG[GLBLINTRMSK] = 1
> -	 */
> -	usbcx_gahbcfg.u32 = 0;
> -	usbcx_gahbcfg.s.dmaen = !(usb->init_flags &
> -				  CVMX_USB_INITIALIZE_FLAGS_NO_DMA);
> -	usbcx_gahbcfg.s.hbstlen = 0;
> -	usbcx_gahbcfg.s.nptxfemplvl = 1;
> -	usbcx_gahbcfg.s.ptxfemplvl = 1;
> -	usbcx_gahbcfg.s.glblintrmsk = 1;
> -	cvmx_usb_write_csr32(usb, CVMX_USBCX_GAHBCFG(usb->index),
> -			     usbcx_gahbcfg.u32);
> -
> -	/*
> -	 * 3. Program the following fields in USBC_GUSBCFG register.
> -	 *    HS/FS timeout calibration, USBC_GUSBCFG[TOUTCAL] = 0
> -	 *    ULPI DDR select, USBC_GUSBCFG[DDRSEL] = 0
> -	 *    USB turnaround time, USBC_GUSBCFG[USBTRDTIM] = 0x5
> -	 *    PHY low-power clock select, USBC_GUSBCFG[PHYLPWRCLKSEL] = 0
> -	 */
> -	usbcx_gusbcfg.u32 = cvmx_usb_read_csr32(usb,
> -						CVMX_USBCX_GUSBCFG(usb->index));
> -	usbcx_gusbcfg.s.toutcal = 0;
> -	usbcx_gusbcfg.s.ddrsel = 0;
> -	usbcx_gusbcfg.s.usbtrdtim = 0x5;
> -	usbcx_gusbcfg.s.phylpwrclksel = 0;
> -	cvmx_usb_write_csr32(usb, CVMX_USBCX_GUSBCFG(usb->index),
> -			     usbcx_gusbcfg.u32);
> -
> -	/*
> -	 * 4. The software must unmask the following bits in the USBC_GINTMSK
> -	 *    register.
> -	 *    OTG interrupt mask, USBC_GINTMSK[OTGINTMSK] = 1
> -	 *    Mode mismatch interrupt mask, USBC_GINTMSK[MODEMISMSK] = 1
> -	 */
> -	usbcx_gintmsk.u32 = cvmx_usb_read_csr32(usb,
> -						CVMX_USBCX_GINTMSK(usb->index));
> -	usbcx_gintmsk.s.otgintmsk = 1;
> -	usbcx_gintmsk.s.modemismsk = 1;
> -	usbcx_gintmsk.s.hchintmsk = 1;
> -	usbcx_gintmsk.s.sofmsk = 0;
> -	/* We need RX FIFO interrupts if we don't have DMA */
> -	if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA)
> -		usbcx_gintmsk.s.rxflvlmsk = 1;
> -	cvmx_usb_write_csr32(usb, CVMX_USBCX_GINTMSK(usb->index),
> -			     usbcx_gintmsk.u32);
> -
> -	/*
> -	 * Disable all channel interrupts. We'll enable them per channel later.
> -	 */
> -	for (channel = 0; channel < 8; channel++)
> -		cvmx_usb_write_csr32(usb,
> -				     CVMX_USBCX_HCINTMSKX(channel, usb->index),
> -				     0);
> -
> -	/*
> -	 * Host Port Initialization
> -	 *
> -	 * 1. Program the host-port interrupt-mask field to unmask,
> -	 *    USBC_GINTMSK[PRTINT] = 1
> -	 */
> -	USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index),
> -			cvmx_usbcx_gintmsk, prtintmsk, 1);
> -	USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index),
> -			cvmx_usbcx_gintmsk, disconnintmsk, 1);
> -
> -	/*
> -	 * 2. Program the USBC_HCFG register to select full-speed host
> -	 *    or high-speed host.
> -	 */
> -	usbcx_hcfg.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HCFG(usb->index));
> -	usbcx_hcfg.s.fslssupp = 0;
> -	usbcx_hcfg.s.fslspclksel = 0;
> -	cvmx_usb_write_csr32(usb, CVMX_USBCX_HCFG(usb->index), usbcx_hcfg.u32);
> -
> -	cvmx_fifo_setup(usb);
> -
> -	/*
> -	 * If the controller is getting port events right after the reset, it
> -	 * means the initialization failed. Try resetting the controller again
> -	 * in such case. This is seen to happen after cold boot on DSR-1000N.
> -	 */
> -	usbc_gintsts.u32 = cvmx_usb_read_csr32(usb,
> -					       CVMX_USBCX_GINTSTS(usb->index));
> -	cvmx_usb_write_csr32(usb, CVMX_USBCX_GINTSTS(usb->index),
> -			     usbc_gintsts.u32);
> -	dev_dbg(dev, "gintsts after reset: 0x%x\n", (int)usbc_gintsts.u32);
> -	if (!usbc_gintsts.s.disconnint && !usbc_gintsts.s.prtint)
> -		return 0;
> -	if (retries++ >= 5)
> -		return -EAGAIN;
> -	dev_info(dev, "controller reset failed (gintsts=0x%x) - retrying\n",
> -		 (int)usbc_gintsts.u32);
> -	msleep(50);
> -	cvmx_usb_shutdown(usb);
> -	msleep(50);
> -	goto retry;
> -}
> -
> -/**
> - * Reset a USB port. After this call succeeds, the USB port is
> - * online and servicing requests.
> - *
> - * @usb: USB device state populated by cvmx_usb_initialize().
> - */
> -static void cvmx_usb_reset_port(struct octeon_hcd *usb)
> -{
> -	usb->usbcx_hprt.u32 = cvmx_usb_read_csr32(usb,
> -						  CVMX_USBCX_HPRT(usb->index));
> -
> -	/* Program the port reset bit to start the reset process */
> -	USB_SET_FIELD32(CVMX_USBCX_HPRT(usb->index), cvmx_usbcx_hprt,
> -			prtrst, 1);
> -
> -	/*
> -	 * Wait at least 50ms (high speed), or 10ms (full speed) for the reset
> -	 * process to complete.
> -	 */
> -	mdelay(50);
> -
> -	/* Program the port reset bit to 0, USBC_HPRT[PRTRST] = 0 */
> -	USB_SET_FIELD32(CVMX_USBCX_HPRT(usb->index), cvmx_usbcx_hprt,
> -			prtrst, 0);
> -
> -	/*
> -	 * Read the port speed field to get the enumerated speed,
> -	 * USBC_HPRT[PRTSPD].
> -	 */
> -	usb->usbcx_hprt.u32 = cvmx_usb_read_csr32(usb,
> -						  CVMX_USBCX_HPRT(usb->index));
> -}
> -
> -/**
> - * Disable a USB port. After this call the USB port will not
> - * generate data transfers and will not generate events.
> - * Transactions in process will fail and call their
> - * associated callbacks.
> - *
> - * @usb: USB device state populated by cvmx_usb_initialize().
> - *
> - * Returns: 0 or a negative error code.
> - */
> -static int cvmx_usb_disable(struct octeon_hcd *usb)
> -{
> -	/* Disable the port */
> -	USB_SET_FIELD32(CVMX_USBCX_HPRT(usb->index), cvmx_usbcx_hprt,
> -			prtena, 1);
> -	return 0;
> -}
> -
> -/**
> - * Get the current state of the USB port. Use this call to
> - * determine if the usb port has anything connected, is enabled,
> - * or has some sort of error condition. The return value of this
> - * call has "changed" bits to signal of the value of some fields
> - * have changed between calls.
> - *
> - * @usb: USB device state populated by cvmx_usb_initialize().
> - *
> - * Returns: Port status information
> - */
> -static struct cvmx_usb_port_status cvmx_usb_get_status(struct octeon_hcd *usb)
> -{
> -	union cvmx_usbcx_hprt usbc_hprt;
> -	struct cvmx_usb_port_status result;
> -
> -	memset(&result, 0, sizeof(result));
> -
> -	usbc_hprt.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HPRT(usb->index));
> -	result.port_enabled = usbc_hprt.s.prtena;
> -	result.port_over_current = usbc_hprt.s.prtovrcurract;
> -	result.port_powered = usbc_hprt.s.prtpwr;
> -	result.port_speed = usbc_hprt.s.prtspd;
> -	result.connected = usbc_hprt.s.prtconnsts;
> -	result.connect_change =
> -		result.connected != usb->port_status.connected;
> -
> -	return result;
> -}
> -
> -/**
> - * Open a virtual pipe between the host and a USB device. A pipe
> - * must be opened before data can be transferred between a device
> - * and Octeon.
> - *
> - * @usb:	     USB device state populated by cvmx_usb_initialize().
> - * @device_addr:
> - *		     USB device address to open the pipe to
> - *		     (0-127).
> - * @endpoint_num:
> - *		     USB endpoint number to open the pipe to
> - *		     (0-15).
> - * @device_speed:
> - *		     The speed of the device the pipe is going
> - *		     to. This must match the device's speed,
> - *		     which may be different than the port speed.
> - * @max_packet:	     The maximum packet length the device can
> - *		     transmit/receive (low speed=0-8, full
> - *		     speed=0-1023, high speed=0-1024). This value
> - *		     comes from the standard endpoint descriptor
> - *		     field wMaxPacketSize bits <10:0>.
> - * @transfer_type:
> - *		     The type of transfer this pipe is for.
> - * @transfer_dir:
> - *		     The direction the pipe is in. This is not
> - *		     used for control pipes.
> - * @interval:	     For ISOCHRONOUS and INTERRUPT transfers,
> - *		     this is how often the transfer is scheduled
> - *		     for. All other transfers should specify
> - *		     zero. The units are in frames (8000/sec at
> - *		     high speed, 1000/sec for full speed).
> - * @multi_count:
> - *		     For high speed devices, this is the maximum
> - *		     allowed number of packet per microframe.
> - *		     Specify zero for non high speed devices. This
> - *		     value comes from the standard endpoint descriptor
> - *		     field wMaxPacketSize bits <12:11>.
> - * @hub_device_addr:
> - *		     Hub device address this device is connected
> - *		     to. Devices connected directly to Octeon
> - *		     use zero. This is only used when the device
> - *		     is full/low speed behind a high speed hub.
> - *		     The address will be of the high speed hub,
> - *		     not and full speed hubs after it.
> - * @hub_port:	     Which port on the hub the device is
> - *		     connected. Use zero for devices connected
> - *		     directly to Octeon. Like hub_device_addr,
> - *		     this is only used for full/low speed
> - *		     devices behind a high speed hub.
> - *
> - * Returns: A non-NULL value is a pipe. NULL means an error.
> - */
> -static struct cvmx_usb_pipe *cvmx_usb_open_pipe(struct octeon_hcd *usb,
> -						int device_addr,
> -						int endpoint_num,
> -						enum cvmx_usb_speed
> -							device_speed,
> -						int max_packet,
> -						enum cvmx_usb_transfer
> -							transfer_type,
> -						enum cvmx_usb_direction
> -							transfer_dir,
> -						int interval, int multi_count,
> -						int hub_device_addr,
> -						int hub_port)
> -{
> -	struct cvmx_usb_pipe *pipe;
> -
> -	pipe = kzalloc(sizeof(*pipe), GFP_ATOMIC);
> -	if (!pipe)
> -		return NULL;
> -	if ((device_speed == CVMX_USB_SPEED_HIGH) &&
> -	    (transfer_dir == CVMX_USB_DIRECTION_OUT) &&
> -	    (transfer_type == CVMX_USB_TRANSFER_BULK))
> -		pipe->flags |= CVMX_USB_PIPE_FLAGS_NEED_PING;
> -	pipe->device_addr = device_addr;
> -	pipe->endpoint_num = endpoint_num;
> -	pipe->device_speed = device_speed;
> -	pipe->max_packet = max_packet;
> -	pipe->transfer_type = transfer_type;
> -	pipe->transfer_dir = transfer_dir;
> -	INIT_LIST_HEAD(&pipe->transactions);
> -
> -	/*
> -	 * All pipes use interval to rate limit NAK processing. Force an
> -	 * interval if one wasn't supplied
> -	 */
> -	if (!interval)
> -		interval = 1;
> -	if (cvmx_usb_pipe_needs_split(usb, pipe)) {
> -		pipe->interval = interval * 8;
> -		/* Force start splits to be schedule on uFrame 0 */
> -		pipe->next_tx_frame = ((usb->frame_number + 7) & ~7) +
> -					pipe->interval;
> -	} else {
> -		pipe->interval = interval;
> -		pipe->next_tx_frame = usb->frame_number + pipe->interval;
> -	}
> -	pipe->multi_count = multi_count;
> -	pipe->hub_device_addr = hub_device_addr;
> -	pipe->hub_port = hub_port;
> -	pipe->pid_toggle = 0;
> -	pipe->split_sc_frame = -1;
> -	list_add_tail(&pipe->node, &usb->idle_pipes);
> -
> -	/*
> -	 * We don't need to tell the hardware about this pipe yet since
> -	 * it doesn't have any submitted requests
> -	 */
> -
> -	return pipe;
> -}
> -
> -/**
> - * Poll the RX FIFOs and remove data as needed. This function is only used
> - * in non DMA mode. It is very important that this function be called quickly
> - * enough to prevent FIFO overflow.
> - *
> - * @usb:	USB device state populated by cvmx_usb_initialize().
> - */
> -static void cvmx_usb_poll_rx_fifo(struct octeon_hcd *usb)
> -{
> -	union cvmx_usbcx_grxstsph rx_status;
> -	int channel;
> -	int bytes;
> -	u64 address;
> -	u32 *ptr;
> -
> -	rx_status.u32 = cvmx_usb_read_csr32(usb,
> -					    CVMX_USBCX_GRXSTSPH(usb->index));
> -	/* Only read data if IN data is there */
> -	if (rx_status.s.pktsts != 2)
> -		return;
> -	/* Check if no data is available */
> -	if (!rx_status.s.bcnt)
> -		return;
> -
> -	channel = rx_status.s.chnum;
> -	bytes = rx_status.s.bcnt;
> -	if (!bytes)
> -		return;
> -
> -	/* Get where the DMA engine would have written this data */
> -	address = cvmx_read64_uint64(CVMX_USBNX_DMA0_INB_CHN0(usb->index) +
> -				     channel * 8);
> -
> -	ptr = cvmx_phys_to_ptr(address);
> -	cvmx_write64_uint64(CVMX_USBNX_DMA0_INB_CHN0(usb->index) + channel * 8,
> -			    address + bytes);
> -
> -	/* Loop writing the FIFO data for this packet into memory */
> -	while (bytes > 0) {
> -		*ptr++ = cvmx_usb_read_csr32(usb,
> -					USB_FIFO_ADDRESS(channel, usb->index));
> -		bytes -= 4;
> -	}
> -	CVMX_SYNCW;
> -}
> -
> -/**
> - * Fill the TX hardware fifo with data out of the software
> - * fifos
> - *
> - * @usb:	    USB device state populated by cvmx_usb_initialize().
> - * @fifo:	    Software fifo to use
> - * @available:	    Amount of space in the hardware fifo
> - *
> - * Returns: Non zero if the hardware fifo was too small and needs
> - *	    to be serviced again.
> - */
> -static int cvmx_usb_fill_tx_hw(struct octeon_hcd *usb,
> -			       struct cvmx_usb_tx_fifo *fifo, int available)
> -{
> -	/*
> -	 * We're done either when there isn't anymore space or the software FIFO
> -	 * is empty
> -	 */
> -	while (available && (fifo->head != fifo->tail)) {
> -		int i = fifo->tail;
> -		const u32 *ptr = cvmx_phys_to_ptr(fifo->entry[i].address);
> -		u64 csr_address = USB_FIFO_ADDRESS(fifo->entry[i].channel,
> -						   usb->index) ^ 4;
> -		int words = available;
> -
> -		/* Limit the amount of data to what the SW fifo has */
> -		if (fifo->entry[i].size <= available) {
> -			words = fifo->entry[i].size;
> -			fifo->tail++;
> -			if (fifo->tail > MAX_CHANNELS)
> -				fifo->tail = 0;
> -		}
> -
> -		/* Update the next locations and counts */
> -		available -= words;
> -		fifo->entry[i].address += words * 4;
> -		fifo->entry[i].size -= words;
> -
> -		/*
> -		 * Write the HW fifo data. The read every three writes is due
> -		 * to an errata on CN3XXX chips
> -		 */
> -		while (words > 3) {
> -			cvmx_write64_uint32(csr_address, *ptr++);
> -			cvmx_write64_uint32(csr_address, *ptr++);
> -			cvmx_write64_uint32(csr_address, *ptr++);
> -			cvmx_read64_uint64(
> -					CVMX_USBNX_DMA0_INB_CHN0(usb->index));
> -			words -= 3;
> -		}
> -		cvmx_write64_uint32(csr_address, *ptr++);
> -		if (--words) {
> -			cvmx_write64_uint32(csr_address, *ptr++);
> -			if (--words)
> -				cvmx_write64_uint32(csr_address, *ptr++);
> -		}
> -		cvmx_read64_uint64(CVMX_USBNX_DMA0_INB_CHN0(usb->index));
> -	}
> -	return fifo->head != fifo->tail;
> -}
> -
> -/**
> - * Check the hardware FIFOs and fill them as needed
> - *
> - * @usb:	USB device state populated by cvmx_usb_initialize().
> - */
> -static void cvmx_usb_poll_tx_fifo(struct octeon_hcd *usb)
> -{
> -	if (usb->periodic.head != usb->periodic.tail) {
> -		union cvmx_usbcx_hptxsts tx_status;
> -
> -		tx_status.u32 = cvmx_usb_read_csr32(usb,
> -					CVMX_USBCX_HPTXSTS(usb->index));
> -		if (cvmx_usb_fill_tx_hw(usb, &usb->periodic,
> -					tx_status.s.ptxfspcavail))
> -			USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index),
> -					cvmx_usbcx_gintmsk, ptxfempmsk, 1);
> -		else
> -			USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index),
> -					cvmx_usbcx_gintmsk, ptxfempmsk, 0);
> -	}
> -
> -	if (usb->nonperiodic.head != usb->nonperiodic.tail) {
> -		union cvmx_usbcx_gnptxsts tx_status;
> -
> -		tx_status.u32 = cvmx_usb_read_csr32(usb,
> -					CVMX_USBCX_GNPTXSTS(usb->index));
> -		if (cvmx_usb_fill_tx_hw(usb, &usb->nonperiodic,
> -					tx_status.s.nptxfspcavail))
> -			USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index),
> -					cvmx_usbcx_gintmsk, nptxfempmsk, 1);
> -		else
> -			USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index),
> -					cvmx_usbcx_gintmsk, nptxfempmsk, 0);
> -	}
> -}
> -
> -/**
> - * Fill the TX FIFO with an outgoing packet
> - *
> - * @usb:	  USB device state populated by cvmx_usb_initialize().
> - * @channel:	  Channel number to get packet from
> - */
> -static void cvmx_usb_fill_tx_fifo(struct octeon_hcd *usb, int channel)
> -{
> -	union cvmx_usbcx_hccharx hcchar;
> -	union cvmx_usbcx_hcspltx usbc_hcsplt;
> -	union cvmx_usbcx_hctsizx usbc_hctsiz;
> -	struct cvmx_usb_tx_fifo *fifo;
> -
> -	/* We only need to fill data on outbound channels */
> -	hcchar.u32 = cvmx_usb_read_csr32(usb,
> -			CVMX_USBCX_HCCHARX(channel, usb->index));
> -	if (hcchar.s.epdir != CVMX_USB_DIRECTION_OUT)
> -		return;
> -
> -	/* OUT Splits only have data on the start and not the complete */
> -	usbc_hcsplt.u32 = cvmx_usb_read_csr32(usb,
> -				CVMX_USBCX_HCSPLTX(channel, usb->index));
> -	if (usbc_hcsplt.s.spltena && usbc_hcsplt.s.compsplt)
> -		return;
> -
> -	/*
> -	 * Find out how many bytes we need to fill and convert it into 32bit
> -	 * words.
> -	 */
> -	usbc_hctsiz.u32 = cvmx_usb_read_csr32(usb,
> -				CVMX_USBCX_HCTSIZX(channel, usb->index));
> -	if (!usbc_hctsiz.s.xfersize)
> -		return;
> -
> -	if ((hcchar.s.eptype == CVMX_USB_TRANSFER_INTERRUPT) ||
> -	    (hcchar.s.eptype == CVMX_USB_TRANSFER_ISOCHRONOUS))
> -		fifo = &usb->periodic;
> -	else
> -		fifo = &usb->nonperiodic;
> -
> -	fifo->entry[fifo->head].channel = channel;
> -	fifo->entry[fifo->head].address =
> -		cvmx_read64_uint64(CVMX_USBNX_DMA0_OUTB_CHN0(usb->index) +
> -				   channel * 8);
> -	fifo->entry[fifo->head].size = (usbc_hctsiz.s.xfersize + 3) >> 2;
> -	fifo->head++;
> -	if (fifo->head > MAX_CHANNELS)
> -		fifo->head = 0;
> -
> -	cvmx_usb_poll_tx_fifo(usb);
> -}
> -
> -/**
> - * Perform channel specific setup for Control transactions. All
> - * the generic stuff will already have been done in cvmx_usb_start_channel().
> - *
> - * @usb:	  USB device state populated by cvmx_usb_initialize().
> - * @channel:	  Channel to setup
> - * @pipe:	  Pipe for control transaction
> - */
> -static void cvmx_usb_start_channel_control(struct octeon_hcd *usb,
> -					   int channel,
> -					   struct cvmx_usb_pipe *pipe)
> -{
> -	struct usb_hcd *hcd = octeon_to_hcd(usb);
> -	struct device *dev = hcd->self.controller;
> -	struct cvmx_usb_transaction *transaction =
> -		list_first_entry(&pipe->transactions, typeof(*transaction),
> -				 node);
> -	struct usb_ctrlrequest *header =
> -		cvmx_phys_to_ptr(transaction->control_header);
> -	int bytes_to_transfer = transaction->buffer_length -
> -		transaction->actual_bytes;
> -	int packets_to_transfer;
> -	union cvmx_usbcx_hctsizx usbc_hctsiz;
> -
> -	usbc_hctsiz.u32 = cvmx_usb_read_csr32(usb,
> -				CVMX_USBCX_HCTSIZX(channel, usb->index));
> -
> -	switch (transaction->stage) {
> -	case CVMX_USB_STAGE_NON_CONTROL:
> -	case CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE:
> -		dev_err(dev, "%s: ERROR - Non control stage\n", __func__);
> -		break;
> -	case CVMX_USB_STAGE_SETUP:
> -		usbc_hctsiz.s.pid = 3; /* Setup */
> -		bytes_to_transfer = sizeof(*header);
> -		/* All Control operations start with a setup going OUT */
> -		USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index),
> -				cvmx_usbcx_hccharx, epdir,
> -				CVMX_USB_DIRECTION_OUT);
> -		/*
> -		 * Setup send the control header instead of the buffer data. The
> -		 * buffer data will be used in the next stage
> -		 */
> -		cvmx_write64_uint64(CVMX_USBNX_DMA0_OUTB_CHN0(usb->index) +
> -					channel * 8,
> -				    transaction->control_header);
> -		break;
> -	case CVMX_USB_STAGE_SETUP_SPLIT_COMPLETE:
> -		usbc_hctsiz.s.pid = 3; /* Setup */
> -		bytes_to_transfer = 0;
> -		/* All Control operations start with a setup going OUT */
> -		USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index),
> -				cvmx_usbcx_hccharx, epdir,
> -				CVMX_USB_DIRECTION_OUT);
> -
> -		USB_SET_FIELD32(CVMX_USBCX_HCSPLTX(channel, usb->index),
> -				cvmx_usbcx_hcspltx, compsplt, 1);
> -		break;
> -	case CVMX_USB_STAGE_DATA:
> -		usbc_hctsiz.s.pid = cvmx_usb_get_data_pid(pipe);
> -		if (cvmx_usb_pipe_needs_split(usb, pipe)) {
> -			if (header->bRequestType & USB_DIR_IN)
> -				bytes_to_transfer = 0;
> -			else if (bytes_to_transfer > pipe->max_packet)
> -				bytes_to_transfer = pipe->max_packet;
> -		}
> -		USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index),
> -				cvmx_usbcx_hccharx, epdir,
> -				((header->bRequestType & USB_DIR_IN) ?
> -					CVMX_USB_DIRECTION_IN :
> -					CVMX_USB_DIRECTION_OUT));
> -		break;
> -	case CVMX_USB_STAGE_DATA_SPLIT_COMPLETE:
> -		usbc_hctsiz.s.pid = cvmx_usb_get_data_pid(pipe);
> -		if (!(header->bRequestType & USB_DIR_IN))
> -			bytes_to_transfer = 0;
> -		USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index),
> -				cvmx_usbcx_hccharx, epdir,
> -				((header->bRequestType & USB_DIR_IN) ?
> -					CVMX_USB_DIRECTION_IN :
> -					CVMX_USB_DIRECTION_OUT));
> -		USB_SET_FIELD32(CVMX_USBCX_HCSPLTX(channel, usb->index),
> -				cvmx_usbcx_hcspltx, compsplt, 1);
> -		break;
> -	case CVMX_USB_STAGE_STATUS:
> -		usbc_hctsiz.s.pid = cvmx_usb_get_data_pid(pipe);
> -		bytes_to_transfer = 0;
> -		USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index),
> -				cvmx_usbcx_hccharx, epdir,
> -				((header->bRequestType & USB_DIR_IN) ?
> -					CVMX_USB_DIRECTION_OUT :
> -					CVMX_USB_DIRECTION_IN));
> -		break;
> -	case CVMX_USB_STAGE_STATUS_SPLIT_COMPLETE:
> -		usbc_hctsiz.s.pid = cvmx_usb_get_data_pid(pipe);
> -		bytes_to_transfer = 0;
> -		USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index),
> -				cvmx_usbcx_hccharx, epdir,
> -				((header->bRequestType & USB_DIR_IN) ?
> -					CVMX_USB_DIRECTION_OUT :
> -					CVMX_USB_DIRECTION_IN));
> -		USB_SET_FIELD32(CVMX_USBCX_HCSPLTX(channel, usb->index),
> -				cvmx_usbcx_hcspltx, compsplt, 1);
> -		break;
> -	}
> -
> -	/*
> -	 * Make sure the transfer never exceeds the byte limit of the hardware.
> -	 * Further bytes will be sent as continued transactions
> -	 */
> -	if (bytes_to_transfer > MAX_TRANSFER_BYTES) {
> -		/* Round MAX_TRANSFER_BYTES to a multiple of out packet size */
> -		bytes_to_transfer = MAX_TRANSFER_BYTES / pipe->max_packet;
> -		bytes_to_transfer *= pipe->max_packet;
> -	}
> -
> -	/*
> -	 * Calculate the number of packets to transfer. If the length is zero
> -	 * we still need to transfer one packet
> -	 */
> -	packets_to_transfer = DIV_ROUND_UP(bytes_to_transfer,
> -					   pipe->max_packet);
> -	if (packets_to_transfer == 0) {
> -		packets_to_transfer = 1;
> -	} else if ((packets_to_transfer > 1) &&
> -			(usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA)) {
> -		/*
> -		 * Limit to one packet when not using DMA. Channels must be
> -		 * restarted between every packet for IN transactions, so there
> -		 * is no reason to do multiple packets in a row
> -		 */
> -		packets_to_transfer = 1;
> -		bytes_to_transfer = packets_to_transfer * pipe->max_packet;
> -	} else if (packets_to_transfer > MAX_TRANSFER_PACKETS) {
> -		/*
> -		 * Limit the number of packet and data transferred to what the
> -		 * hardware can handle
> -		 */
> -		packets_to_transfer = MAX_TRANSFER_PACKETS;
> -		bytes_to_transfer = packets_to_transfer * pipe->max_packet;
> -	}
> -
> -	usbc_hctsiz.s.xfersize = bytes_to_transfer;
> -	usbc_hctsiz.s.pktcnt = packets_to_transfer;
> -
> -	cvmx_usb_write_csr32(usb, CVMX_USBCX_HCTSIZX(channel, usb->index),
> -			     usbc_hctsiz.u32);
> -}
> -
> -/**
> - * Start a channel to perform the pipe's head transaction
> - *
> - * @usb:	  USB device state populated by cvmx_usb_initialize().
> - * @channel:	  Channel to setup
> - * @pipe:	  Pipe to start
> - */
> -static void cvmx_usb_start_channel(struct octeon_hcd *usb, int channel,
> -				   struct cvmx_usb_pipe *pipe)
> -{
> -	struct cvmx_usb_transaction *transaction =
> -		list_first_entry(&pipe->transactions, typeof(*transaction),
> -				 node);
> -
> -	/* Make sure all writes to the DMA region get flushed */
> -	CVMX_SYNCW;
> -
> -	/* Attach the channel to the pipe */
> -	usb->pipe_for_channel[channel] = pipe;
> -	pipe->channel = channel;
> -	pipe->flags |= CVMX_USB_PIPE_FLAGS_SCHEDULED;
> -
> -	/* Mark this channel as in use */
> -	usb->idle_hardware_channels &= ~(1 << channel);
> -
> -	/* Enable the channel interrupt bits */
> -	{
> -		union cvmx_usbcx_hcintx usbc_hcint;
> -		union cvmx_usbcx_hcintmskx usbc_hcintmsk;
> -		union cvmx_usbcx_haintmsk usbc_haintmsk;
> -
> -		/* Clear all channel status bits */
> -		usbc_hcint.u32 = cvmx_usb_read_csr32(usb,
> -					CVMX_USBCX_HCINTX(channel, usb->index));
> -
> -		cvmx_usb_write_csr32(usb,
> -				     CVMX_USBCX_HCINTX(channel, usb->index),
> -				     usbc_hcint.u32);
> -
> -		usbc_hcintmsk.u32 = 0;
> -		usbc_hcintmsk.s.chhltdmsk = 1;
> -		if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA) {
> -			/*
> -			 * Channels need these extra interrupts when we aren't
> -			 * in DMA mode.
> -			 */
> -			usbc_hcintmsk.s.datatglerrmsk = 1;
> -			usbc_hcintmsk.s.frmovrunmsk = 1;
> -			usbc_hcintmsk.s.bblerrmsk = 1;
> -			usbc_hcintmsk.s.xacterrmsk = 1;
> -			if (cvmx_usb_pipe_needs_split(usb, pipe)) {
> -				/*
> -				 * Splits don't generate xfercompl, so we need
> -				 * ACK and NYET.
> -				 */
> -				usbc_hcintmsk.s.nyetmsk = 1;
> -				usbc_hcintmsk.s.ackmsk = 1;
> -			}
> -			usbc_hcintmsk.s.nakmsk = 1;
> -			usbc_hcintmsk.s.stallmsk = 1;
> -			usbc_hcintmsk.s.xfercomplmsk = 1;
> -		}
> -		cvmx_usb_write_csr32(usb,
> -				     CVMX_USBCX_HCINTMSKX(channel, usb->index),
> -				     usbc_hcintmsk.u32);
> -
> -		/* Enable the channel interrupt to propagate */
> -		usbc_haintmsk.u32 = cvmx_usb_read_csr32(usb,
> -					CVMX_USBCX_HAINTMSK(usb->index));
> -		usbc_haintmsk.s.haintmsk |= 1 << channel;
> -		cvmx_usb_write_csr32(usb, CVMX_USBCX_HAINTMSK(usb->index),
> -				     usbc_haintmsk.u32);
> -	}
> -
> -	/* Setup the location the DMA engine uses. */
> -	{
> -		u64 reg;
> -		u64 dma_address = transaction->buffer +
> -				  transaction->actual_bytes;
> -
> -		if (transaction->type == CVMX_USB_TRANSFER_ISOCHRONOUS)
> -			dma_address = transaction->buffer +
> -					transaction->iso_packets[0].offset +
> -					transaction->actual_bytes;
> -
> -		if (pipe->transfer_dir == CVMX_USB_DIRECTION_OUT)
> -			reg = CVMX_USBNX_DMA0_OUTB_CHN0(usb->index);
> -		else
> -			reg = CVMX_USBNX_DMA0_INB_CHN0(usb->index);
> -		cvmx_write64_uint64(reg + channel * 8, dma_address);
> -	}
> -
> -	/* Setup both the size of the transfer and the SPLIT characteristics */
> -	{
> -		union cvmx_usbcx_hcspltx usbc_hcsplt = {.u32 = 0};
> -		union cvmx_usbcx_hctsizx usbc_hctsiz = {.u32 = 0};
> -		int packets_to_transfer;
> -		int bytes_to_transfer = transaction->buffer_length -
> -			transaction->actual_bytes;
> -
> -		/*
> -		 * ISOCHRONOUS transactions store each individual transfer size
> -		 * in the packet structure, not the global buffer_length
> -		 */
> -		if (transaction->type == CVMX_USB_TRANSFER_ISOCHRONOUS)
> -			bytes_to_transfer =
> -				transaction->iso_packets[0].length -
> -				transaction->actual_bytes;
> -
> -		/*
> -		 * We need to do split transactions when we are talking to non
> -		 * high speed devices that are behind a high speed hub
> -		 */
> -		if (cvmx_usb_pipe_needs_split(usb, pipe)) {
> -			/*
> -			 * On the start split phase (stage is even) record the
> -			 * frame number we will need to send the split complete.
> -			 * We only store the lower two bits since the time ahead
> -			 * can only be two frames
> -			 */
> -			if ((transaction->stage & 1) == 0) {
> -				if (transaction->type == CVMX_USB_TRANSFER_BULK)
> -					pipe->split_sc_frame =
> -						(usb->frame_number + 1) & 0x7f;
> -				else
> -					pipe->split_sc_frame =
> -						(usb->frame_number + 2) & 0x7f;
> -			} else {
> -				pipe->split_sc_frame = -1;
> -			}
> -
> -			usbc_hcsplt.s.spltena = 1;
> -			usbc_hcsplt.s.hubaddr = pipe->hub_device_addr;
> -			usbc_hcsplt.s.prtaddr = pipe->hub_port;
> -			usbc_hcsplt.s.compsplt = (transaction->stage ==
> -				CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE);
> -
> -			/*
> -			 * SPLIT transactions can only ever transmit one data
> -			 * packet so limit the transfer size to the max packet
> -			 * size
> -			 */
> -			if (bytes_to_transfer > pipe->max_packet)
> -				bytes_to_transfer = pipe->max_packet;
> -
> -			/*
> -			 * ISOCHRONOUS OUT splits are unique in that they limit
> -			 * data transfers to 188 byte chunks representing the
> -			 * begin/middle/end of the data or all
> -			 */
> -			if (!usbc_hcsplt.s.compsplt &&
> -			    (pipe->transfer_dir == CVMX_USB_DIRECTION_OUT) &&
> -			    (pipe->transfer_type ==
> -			     CVMX_USB_TRANSFER_ISOCHRONOUS)) {
> -				/*
> -				 * Clear the split complete frame number as
> -				 * there isn't going to be a split complete
> -				 */
> -				pipe->split_sc_frame = -1;
> -				/*
> -				 * See if we've started this transfer and sent
> -				 * data
> -				 */
> -				if (transaction->actual_bytes == 0) {
> -					/*
> -					 * Nothing sent yet, this is either a
> -					 * begin or the entire payload
> -					 */
> -					if (bytes_to_transfer <= 188)
> -						/* Entire payload in one go */
> -						usbc_hcsplt.s.xactpos = 3;
> -					else
> -						/* First part of payload */
> -						usbc_hcsplt.s.xactpos = 2;
> -				} else {
> -					/*
> -					 * Continuing the previous data, we must
> -					 * either be in the middle or at the end
> -					 */
> -					if (bytes_to_transfer <= 188)
> -						/* End of payload */
> -						usbc_hcsplt.s.xactpos = 1;
> -					else
> -						/* Middle of payload */
> -						usbc_hcsplt.s.xactpos = 0;
> -				}
> -				/*
> -				 * Again, the transfer size is limited to 188
> -				 * bytes
> -				 */
> -				if (bytes_to_transfer > 188)
> -					bytes_to_transfer = 188;
> -			}
> -		}
> -
> -		/*
> -		 * Make sure the transfer never exceeds the byte limit of the
> -		 * hardware. Further bytes will be sent as continued
> -		 * transactions
> -		 */
> -		if (bytes_to_transfer > MAX_TRANSFER_BYTES) {
> -			/*
> -			 * Round MAX_TRANSFER_BYTES to a multiple of out packet
> -			 * size
> -			 */
> -			bytes_to_transfer = MAX_TRANSFER_BYTES /
> -				pipe->max_packet;
> -			bytes_to_transfer *= pipe->max_packet;
> -		}
> -
> -		/*
> -		 * Calculate the number of packets to transfer. If the length is
> -		 * zero we still need to transfer one packet
> -		 */
> -		packets_to_transfer =
> -			DIV_ROUND_UP(bytes_to_transfer, pipe->max_packet);
> -		if (packets_to_transfer == 0) {
> -			packets_to_transfer = 1;
> -		} else if ((packets_to_transfer > 1) &&
> -			   (usb->init_flags &
> -			    CVMX_USB_INITIALIZE_FLAGS_NO_DMA)) {
> -			/*
> -			 * Limit to one packet when not using DMA. Channels must
> -			 * be restarted between every packet for IN
> -			 * transactions, so there is no reason to do multiple
> -			 * packets in a row
> -			 */
> -			packets_to_transfer = 1;
> -			bytes_to_transfer = packets_to_transfer *
> -				pipe->max_packet;
> -		} else if (packets_to_transfer > MAX_TRANSFER_PACKETS) {
> -			/*
> -			 * Limit the number of packet and data transferred to
> -			 * what the hardware can handle
> -			 */
> -			packets_to_transfer = MAX_TRANSFER_PACKETS;
> -			bytes_to_transfer = packets_to_transfer *
> -				pipe->max_packet;
> -		}
> -
> -		usbc_hctsiz.s.xfersize = bytes_to_transfer;
> -		usbc_hctsiz.s.pktcnt = packets_to_transfer;
> -
> -		/* Update the DATA0/DATA1 toggle */
> -		usbc_hctsiz.s.pid = cvmx_usb_get_data_pid(pipe);
> -		/*
> -		 * High speed pipes may need a hardware ping before they start
> -		 */
> -		if (pipe->flags & CVMX_USB_PIPE_FLAGS_NEED_PING)
> -			usbc_hctsiz.s.dopng = 1;
> -
> -		cvmx_usb_write_csr32(usb,
> -				     CVMX_USBCX_HCSPLTX(channel, usb->index),
> -				     usbc_hcsplt.u32);
> -		cvmx_usb_write_csr32(usb,
> -				     CVMX_USBCX_HCTSIZX(channel, usb->index),
> -				     usbc_hctsiz.u32);
> -	}
> -
> -	/* Setup the Host Channel Characteristics Register */
> -	{
> -		union cvmx_usbcx_hccharx usbc_hcchar = {.u32 = 0};
> -
> -		/*
> -		 * Set the startframe odd/even properly. This is only used for
> -		 * periodic
> -		 */
> -		usbc_hcchar.s.oddfrm = usb->frame_number & 1;
> -
> -		/*
> -		 * Set the number of back to back packets allowed by this
> -		 * endpoint. Split transactions interpret "ec" as the number of
> -		 * immediate retries of failure. These retries happen too
> -		 * quickly, so we disable these entirely for splits
> -		 */
> -		if (cvmx_usb_pipe_needs_split(usb, pipe))
> -			usbc_hcchar.s.ec = 1;
> -		else if (pipe->multi_count < 1)
> -			usbc_hcchar.s.ec = 1;
> -		else if (pipe->multi_count > 3)
> -			usbc_hcchar.s.ec = 3;
> -		else
> -			usbc_hcchar.s.ec = pipe->multi_count;
> -
> -		/* Set the rest of the endpoint specific settings */
> -		usbc_hcchar.s.devaddr = pipe->device_addr;
> -		usbc_hcchar.s.eptype = transaction->type;
> -		usbc_hcchar.s.lspddev =
> -			(pipe->device_speed == CVMX_USB_SPEED_LOW);
> -		usbc_hcchar.s.epdir = pipe->transfer_dir;
> -		usbc_hcchar.s.epnum = pipe->endpoint_num;
> -		usbc_hcchar.s.mps = pipe->max_packet;
> -		cvmx_usb_write_csr32(usb,
> -				     CVMX_USBCX_HCCHARX(channel, usb->index),
> -				     usbc_hcchar.u32);
> -	}
> -
> -	/* Do transaction type specific fixups as needed */
> -	switch (transaction->type) {
> -	case CVMX_USB_TRANSFER_CONTROL:
> -		cvmx_usb_start_channel_control(usb, channel, pipe);
> -		break;
> -	case CVMX_USB_TRANSFER_BULK:
> -	case CVMX_USB_TRANSFER_INTERRUPT:
> -		break;
> -	case CVMX_USB_TRANSFER_ISOCHRONOUS:
> -		if (!cvmx_usb_pipe_needs_split(usb, pipe)) {
> -			/*
> -			 * ISO transactions require different PIDs depending on
> -			 * direction and how many packets are needed
> -			 */
> -			if (pipe->transfer_dir == CVMX_USB_DIRECTION_OUT) {
> -				if (pipe->multi_count < 2) /* Need DATA0 */
> -					USB_SET_FIELD32(
> -						CVMX_USBCX_HCTSIZX(channel,
> -								   usb->index),
> -						cvmx_usbcx_hctsizx, pid, 0);
> -				else /* Need MDATA */
> -					USB_SET_FIELD32(
> -						CVMX_USBCX_HCTSIZX(channel,
> -								   usb->index),
> -						cvmx_usbcx_hctsizx, pid, 3);
> -			}
> -		}
> -		break;
> -	}
> -	{
> -		union cvmx_usbcx_hctsizx usbc_hctsiz = { .u32 =
> -			cvmx_usb_read_csr32(usb,
> -					    CVMX_USBCX_HCTSIZX(channel,
> -							       usb->index))
> -		};
> -		transaction->xfersize = usbc_hctsiz.s.xfersize;
> -		transaction->pktcnt = usbc_hctsiz.s.pktcnt;
> -	}
> -	/* Remember when we start a split transaction */
> -	if (cvmx_usb_pipe_needs_split(usb, pipe))
> -		usb->active_split = transaction;
> -	USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index),
> -			cvmx_usbcx_hccharx, chena, 1);
> -	if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA)
> -		cvmx_usb_fill_tx_fifo(usb, channel);
> -}
> -
> -/**
> - * Find a pipe that is ready to be scheduled to hardware.
> - * @usb:	 USB device state populated by cvmx_usb_initialize().
> - * @xfer_type:	 Transfer type
> - *
> - * Returns: Pipe or NULL if none are ready
> - */
> -static struct cvmx_usb_pipe *cvmx_usb_find_ready_pipe(struct octeon_hcd *usb,
> -		enum cvmx_usb_transfer xfer_type)
> -{
> -	struct list_head *list = usb->active_pipes + xfer_type;
> -	u64 current_frame = usb->frame_number;
> -	struct cvmx_usb_pipe *pipe;
> -
> -	list_for_each_entry(pipe, list, node) {
> -		struct cvmx_usb_transaction *t =
> -			list_first_entry(&pipe->transactions, typeof(*t),
> -					 node);
> -		if (!(pipe->flags & CVMX_USB_PIPE_FLAGS_SCHEDULED) && t &&
> -		    (pipe->next_tx_frame <= current_frame) &&
> -		    ((pipe->split_sc_frame == -1) ||
> -		     ((((int)current_frame - pipe->split_sc_frame) & 0x7f) <
> -		      0x40)) &&
> -		    (!usb->active_split || (usb->active_split == t))) {
> -			prefetch(t);
> -			return pipe;
> -		}
> -	}
> -	return NULL;
> -}
> -
> -static struct cvmx_usb_pipe *cvmx_usb_next_pipe(struct octeon_hcd *usb,
> -						int is_sof)
> -{
> -	struct cvmx_usb_pipe *pipe;
> -
> -	/* Find a pipe needing service. */
> -	if (is_sof) {
> -		/*
> -		 * Only process periodic pipes on SOF interrupts. This way we
> -		 * are sure that the periodic data is sent in the beginning of
> -		 * the frame.
> -		 */
> -		pipe = cvmx_usb_find_ready_pipe(usb,
> -						CVMX_USB_TRANSFER_ISOCHRONOUS);
> -		if (pipe)
> -			return pipe;
> -		pipe = cvmx_usb_find_ready_pipe(usb,
> -						CVMX_USB_TRANSFER_INTERRUPT);
> -		if (pipe)
> -			return pipe;
> -	}
> -	pipe = cvmx_usb_find_ready_pipe(usb, CVMX_USB_TRANSFER_CONTROL);
> -	if (pipe)
> -		return pipe;
> -	return cvmx_usb_find_ready_pipe(usb, CVMX_USB_TRANSFER_BULK);
> -}
> -
> -/**
> - * Called whenever a pipe might need to be scheduled to the
> - * hardware.
> - *
> - * @usb:	 USB device state populated by cvmx_usb_initialize().
> - * @is_sof:	 True if this schedule was called on a SOF interrupt.
> - */
> -static void cvmx_usb_schedule(struct octeon_hcd *usb, int is_sof)
> -{
> -	int channel;
> -	struct cvmx_usb_pipe *pipe;
> -	int need_sof;
> -	enum cvmx_usb_transfer ttype;
> -
> -	if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA) {
> -		/*
> -		 * Without DMA we need to be careful to not schedule something
> -		 * at the end of a frame and cause an overrun.
> -		 */
> -		union cvmx_usbcx_hfnum hfnum = {
> -			.u32 = cvmx_usb_read_csr32(usb,
> -						CVMX_USBCX_HFNUM(usb->index))
> -		};
> -
> -		union cvmx_usbcx_hfir hfir = {
> -			.u32 = cvmx_usb_read_csr32(usb,
> -						CVMX_USBCX_HFIR(usb->index))
> -		};
> -
> -		if (hfnum.s.frrem < hfir.s.frint / 4)
> -			goto done;
> -	}
> -
> -	while (usb->idle_hardware_channels) {
> -		/* Find an idle channel */
> -		channel = __fls(usb->idle_hardware_channels);
> -		if (unlikely(channel > 7))
> -			break;
> -
> -		pipe = cvmx_usb_next_pipe(usb, is_sof);
> -		if (!pipe)
> -			break;
> -
> -		cvmx_usb_start_channel(usb, channel, pipe);
> -	}
> -
> -done:
> -	/*
> -	 * Only enable SOF interrupts when we have transactions pending in the
> -	 * future that might need to be scheduled
> -	 */
> -	need_sof = 0;
> -	for (ttype = CVMX_USB_TRANSFER_CONTROL;
> -	     ttype <= CVMX_USB_TRANSFER_INTERRUPT; ttype++) {
> -		list_for_each_entry(pipe, &usb->active_pipes[ttype], node) {
> -			if (pipe->next_tx_frame > usb->frame_number) {
> -				need_sof = 1;
> -				break;
> -			}
> -		}
> -	}
> -	USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index),
> -			cvmx_usbcx_gintmsk, sofmsk, need_sof);
> -}
> -
> -static void octeon_usb_urb_complete_callback(struct octeon_hcd *usb,
> -					     enum cvmx_usb_status status,
> -					     struct cvmx_usb_pipe *pipe,
> -					     struct cvmx_usb_transaction
> -						*transaction,
> -					     int bytes_transferred,
> -					     struct urb *urb)
> -{
> -	struct usb_hcd *hcd = octeon_to_hcd(usb);
> -	struct device *dev = hcd->self.controller;
> -
> -	if (likely(status == CVMX_USB_STATUS_OK))
> -		urb->actual_length = bytes_transferred;
> -	else
> -		urb->actual_length = 0;
> -
> -	urb->hcpriv = NULL;
> -
> -	/* For Isochronous transactions we need to update the URB packet status
> -	 * list from data in our private copy
> -	 */
> -	if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) {
> -		int i;
> -		/*
> -		 * The pointer to the private list is stored in the setup_packet
> -		 * field.
> -		 */
> -		struct cvmx_usb_iso_packet *iso_packet =
> -			(struct cvmx_usb_iso_packet *)urb->setup_packet;
> -		/* Recalculate the transfer size by adding up each packet */
> -		urb->actual_length = 0;
> -		for (i = 0; i < urb->number_of_packets; i++) {
> -			if (iso_packet[i].status == CVMX_USB_STATUS_OK) {
> -				urb->iso_frame_desc[i].status = 0;
> -				urb->iso_frame_desc[i].actual_length =
> -					iso_packet[i].length;
> -				urb->actual_length +=
> -					urb->iso_frame_desc[i].actual_length;
> -			} else {
> -				dev_dbg(dev, "ISOCHRONOUS packet=%d of %d status=%d pipe=%p transaction=%p size=%d\n",
> -					i, urb->number_of_packets,
> -					iso_packet[i].status, pipe,
> -					transaction, iso_packet[i].length);
> -				urb->iso_frame_desc[i].status = -EREMOTEIO;
> -			}
> -		}
> -		/* Free the private list now that we don't need it anymore */
> -		kfree(iso_packet);
> -		urb->setup_packet = NULL;
> -	}
> -
> -	switch (status) {
> -	case CVMX_USB_STATUS_OK:
> -		urb->status = 0;
> -		break;
> -	case CVMX_USB_STATUS_CANCEL:
> -		if (urb->status == 0)
> -			urb->status = -ENOENT;
> -		break;
> -	case CVMX_USB_STATUS_STALL:
> -		dev_dbg(dev, "status=stall pipe=%p transaction=%p size=%d\n",
> -			pipe, transaction, bytes_transferred);
> -		urb->status = -EPIPE;
> -		break;
> -	case CVMX_USB_STATUS_BABBLEERR:
> -		dev_dbg(dev, "status=babble pipe=%p transaction=%p size=%d\n",
> -			pipe, transaction, bytes_transferred);
> -		urb->status = -EPIPE;
> -		break;
> -	case CVMX_USB_STATUS_SHORT:
> -		dev_dbg(dev, "status=short pipe=%p transaction=%p size=%d\n",
> -			pipe, transaction, bytes_transferred);
> -		urb->status = -EREMOTEIO;
> -		break;
> -	case CVMX_USB_STATUS_ERROR:
> -	case CVMX_USB_STATUS_XACTERR:
> -	case CVMX_USB_STATUS_DATATGLERR:
> -	case CVMX_USB_STATUS_FRAMEERR:
> -		dev_dbg(dev, "status=%d pipe=%p transaction=%p size=%d\n",
> -			status, pipe, transaction, bytes_transferred);
> -		urb->status = -EPROTO;
> -		break;
> -	}
> -	usb_hcd_unlink_urb_from_ep(octeon_to_hcd(usb), urb);
> -	spin_unlock(&usb->lock);
> -	usb_hcd_giveback_urb(octeon_to_hcd(usb), urb, urb->status);
> -	spin_lock(&usb->lock);
> -}
> -
> -/**
> - * Signal the completion of a transaction and free it. The
> - * transaction will be removed from the pipe transaction list.
> - *
> - * @usb:	 USB device state populated by cvmx_usb_initialize().
> - * @pipe:	 Pipe the transaction is on
> - * @transaction:
> - *		 Transaction that completed
> - * @complete_code:
> - *		 Completion code
> - */
> -static void cvmx_usb_complete(struct octeon_hcd *usb,
> -			      struct cvmx_usb_pipe *pipe,
> -			      struct cvmx_usb_transaction *transaction,
> -			      enum cvmx_usb_status complete_code)
> -{
> -	/* If this was a split then clear our split in progress marker */
> -	if (usb->active_split == transaction)
> -		usb->active_split = NULL;
> -
> -	/*
> -	 * Isochronous transactions need extra processing as they might not be
> -	 * done after a single data transfer
> -	 */
> -	if (unlikely(transaction->type == CVMX_USB_TRANSFER_ISOCHRONOUS)) {
> -		/* Update the number of bytes transferred in this ISO packet */
> -		transaction->iso_packets[0].length = transaction->actual_bytes;
> -		transaction->iso_packets[0].status = complete_code;
> -
> -		/*
> -		 * If there are more ISOs pending and we succeeded, schedule the
> -		 * next one
> -		 */
> -		if ((transaction->iso_number_packets > 1) &&
> -		    (complete_code == CVMX_USB_STATUS_OK)) {
> -			/* No bytes transferred for this packet as of yet */
> -			transaction->actual_bytes = 0;
> -			/* One less ISO waiting to transfer */
> -			transaction->iso_number_packets--;
> -			/* Increment to the next location in our packet array */
> -			transaction->iso_packets++;
> -			transaction->stage = CVMX_USB_STAGE_NON_CONTROL;
> -			return;
> -		}
> -	}
> -
> -	/* Remove the transaction from the pipe list */
> -	list_del(&transaction->node);
> -	if (list_empty(&pipe->transactions))
> -		list_move_tail(&pipe->node, &usb->idle_pipes);
> -	octeon_usb_urb_complete_callback(usb, complete_code, pipe,
> -					 transaction,
> -					 transaction->actual_bytes,
> -					 transaction->urb);
> -	kfree(transaction);
> -}
> -
> -/**
> - * Submit a usb transaction to a pipe. Called for all types
> - * of transactions.
> - *
> - * @usb:
> - * @pipe:	    Which pipe to submit to.
> - * @type:	    Transaction type
> - * @buffer:	    User buffer for the transaction
> - * @buffer_length:
> - *		    User buffer's length in bytes
> - * @control_header:
> - *		    For control transactions, the 8 byte standard header
> - * @iso_start_frame:
> - *		    For ISO transactions, the start frame
> - * @iso_number_packets:
> - *		    For ISO, the number of packet in the transaction.
> - * @iso_packets:
> - *		    A description of each ISO packet
> - * @urb:	    URB for the callback
> - *
> - * Returns: Transaction or NULL on failure.
> - */
> -static struct cvmx_usb_transaction *cvmx_usb_submit_transaction(
> -				struct octeon_hcd *usb,
> -				struct cvmx_usb_pipe *pipe,
> -				enum cvmx_usb_transfer type,
> -				u64 buffer,
> -				int buffer_length,
> -				u64 control_header,
> -				int iso_start_frame,
> -				int iso_number_packets,
> -				struct cvmx_usb_iso_packet *iso_packets,
> -				struct urb *urb)
> -{
> -	struct cvmx_usb_transaction *transaction;
> -
> -	if (unlikely(pipe->transfer_type != type))
> -		return NULL;
> -
> -	transaction = kzalloc(sizeof(*transaction), GFP_ATOMIC);
> -	if (unlikely(!transaction))
> -		return NULL;
> -
> -	transaction->type = type;
> -	transaction->buffer = buffer;
> -	transaction->buffer_length = buffer_length;
> -	transaction->control_header = control_header;
> -	/* FIXME: This is not used, implement it. */
> -	transaction->iso_start_frame = iso_start_frame;
> -	transaction->iso_number_packets = iso_number_packets;
> -	transaction->iso_packets = iso_packets;
> -	transaction->urb = urb;
> -	if (transaction->type == CVMX_USB_TRANSFER_CONTROL)
> -		transaction->stage = CVMX_USB_STAGE_SETUP;
> -	else
> -		transaction->stage = CVMX_USB_STAGE_NON_CONTROL;
> -
> -	if (!list_empty(&pipe->transactions)) {
> -		list_add_tail(&transaction->node, &pipe->transactions);
> -	} else {
> -		list_add_tail(&transaction->node, &pipe->transactions);
> -		list_move_tail(&pipe->node,
> -			       &usb->active_pipes[pipe->transfer_type]);
> -
> -		/*
> -		 * We may need to schedule the pipe if this was the head of the
> -		 * pipe.
> -		 */
> -		cvmx_usb_schedule(usb, 0);
> -	}
> -
> -	return transaction;
> -}
> -
> -/**
> - * Call to submit a USB Bulk transfer to a pipe.
> - *
> - * @usb:	    USB device state populated by cvmx_usb_initialize().
> - * @pipe:	    Handle to the pipe for the transfer.
> - * @urb:	    URB.
> - *
> - * Returns: A submitted transaction or NULL on failure.
> - */
> -static struct cvmx_usb_transaction *cvmx_usb_submit_bulk(
> -						struct octeon_hcd *usb,
> -						struct cvmx_usb_pipe *pipe,
> -						struct urb *urb)
> -{
> -	return cvmx_usb_submit_transaction(usb, pipe, CVMX_USB_TRANSFER_BULK,
> -					   urb->transfer_dma,
> -					   urb->transfer_buffer_length,
> -					   0, /* control_header */
> -					   0, /* iso_start_frame */
> -					   0, /* iso_number_packets */
> -					   NULL, /* iso_packets */
> -					   urb);
> -}
> -
> -/**
> - * Call to submit a USB Interrupt transfer to a pipe.
> - *
> - * @usb:	    USB device state populated by cvmx_usb_initialize().
> - * @pipe:	    Handle to the pipe for the transfer.
> - * @urb:	    URB returned when the callback is called.
> - *
> - * Returns: A submitted transaction or NULL on failure.
> - */
> -static struct cvmx_usb_transaction *cvmx_usb_submit_interrupt(
> -						struct octeon_hcd *usb,
> -						struct cvmx_usb_pipe *pipe,
> -						struct urb *urb)
> -{
> -	return cvmx_usb_submit_transaction(usb, pipe,
> -					   CVMX_USB_TRANSFER_INTERRUPT,
> -					   urb->transfer_dma,
> -					   urb->transfer_buffer_length,
> -					   0, /* control_header */
> -					   0, /* iso_start_frame */
> -					   0, /* iso_number_packets */
> -					   NULL, /* iso_packets */
> -					   urb);
> -}
> -
> -/**
> - * Call to submit a USB Control transfer to a pipe.
> - *
> - * @usb:	    USB device state populated by cvmx_usb_initialize().
> - * @pipe:	    Handle to the pipe for the transfer.
> - * @urb:	    URB.
> - *
> - * Returns: A submitted transaction or NULL on failure.
> - */
> -static struct cvmx_usb_transaction *cvmx_usb_submit_control(
> -						struct octeon_hcd *usb,
> -						struct cvmx_usb_pipe *pipe,
> -						struct urb *urb)
> -{
> -	int buffer_length = urb->transfer_buffer_length;
> -	u64 control_header = urb->setup_dma;
> -	struct usb_ctrlrequest *header = cvmx_phys_to_ptr(control_header);
> -
> -	if ((header->bRequestType & USB_DIR_IN) == 0)
> -		buffer_length = le16_to_cpu(header->wLength);
> -
> -	return cvmx_usb_submit_transaction(usb, pipe,
> -					   CVMX_USB_TRANSFER_CONTROL,
> -					   urb->transfer_dma, buffer_length,
> -					   control_header,
> -					   0, /* iso_start_frame */
> -					   0, /* iso_number_packets */
> -					   NULL, /* iso_packets */
> -					   urb);
> -}
> -
> -/**
> - * Call to submit a USB Isochronous transfer to a pipe.
> - *
> - * @usb:	    USB device state populated by cvmx_usb_initialize().
> - * @pipe:	    Handle to the pipe for the transfer.
> - * @urb:	    URB returned when the callback is called.
> - *
> - * Returns: A submitted transaction or NULL on failure.
> - */
> -static struct cvmx_usb_transaction *cvmx_usb_submit_isochronous(
> -						struct octeon_hcd *usb,
> -						struct cvmx_usb_pipe *pipe,
> -						struct urb *urb)
> -{
> -	struct cvmx_usb_iso_packet *packets;
> -
> -	packets = (struct cvmx_usb_iso_packet *)urb->setup_packet;
> -	return cvmx_usb_submit_transaction(usb, pipe,
> -					   CVMX_USB_TRANSFER_ISOCHRONOUS,
> -					   urb->transfer_dma,
> -					   urb->transfer_buffer_length,
> -					   0, /* control_header */
> -					   urb->start_frame,
> -					   urb->number_of_packets,
> -					   packets, urb);
> -}
> -
> -/**
> - * Cancel one outstanding request in a pipe. Canceling a request
> - * can fail if the transaction has already completed before cancel
> - * is called. Even after a successful cancel call, it may take
> - * a frame or two for the cvmx_usb_poll() function to call the
> - * associated callback.
> - *
> - * @usb:	 USB device state populated by cvmx_usb_initialize().
> - * @pipe:	 Pipe to cancel requests in.
> - * @transaction: Transaction to cancel, returned by the submit function.
> - *
> - * Returns: 0 or a negative error code.
> - */
> -static int cvmx_usb_cancel(struct octeon_hcd *usb,
> -			   struct cvmx_usb_pipe *pipe,
> -			   struct cvmx_usb_transaction *transaction)
> -{
> -	/*
> -	 * If the transaction is the HEAD of the queue and scheduled. We need to
> -	 * treat it special
> -	 */
> -	if (list_first_entry(&pipe->transactions, typeof(*transaction), node) ==
> -	    transaction && (pipe->flags & CVMX_USB_PIPE_FLAGS_SCHEDULED)) {
> -		union cvmx_usbcx_hccharx usbc_hcchar;
> -
> -		usb->pipe_for_channel[pipe->channel] = NULL;
> -		pipe->flags &= ~CVMX_USB_PIPE_FLAGS_SCHEDULED;
> -
> -		CVMX_SYNCW;
> -
> -		usbc_hcchar.u32 = cvmx_usb_read_csr32(usb,
> -				CVMX_USBCX_HCCHARX(pipe->channel, usb->index));
> -		/*
> -		 * If the channel isn't enabled then the transaction already
> -		 * completed.
> -		 */
> -		if (usbc_hcchar.s.chena) {
> -			usbc_hcchar.s.chdis = 1;
> -			cvmx_usb_write_csr32(usb,
> -					     CVMX_USBCX_HCCHARX(pipe->channel,
> -								usb->index),
> -					     usbc_hcchar.u32);
> -		}
> -	}
> -	cvmx_usb_complete(usb, pipe, transaction, CVMX_USB_STATUS_CANCEL);
> -	return 0;
> -}
> -
> -/**
> - * Cancel all outstanding requests in a pipe. Logically all this
> - * does is call cvmx_usb_cancel() in a loop.
> - *
> - * @usb:	 USB device state populated by cvmx_usb_initialize().
> - * @pipe:	 Pipe to cancel requests in.
> - *
> - * Returns: 0 or a negative error code.
> - */
> -static int cvmx_usb_cancel_all(struct octeon_hcd *usb,
> -			       struct cvmx_usb_pipe *pipe)
> -{
> -	struct cvmx_usb_transaction *transaction, *next;
> -
> -	/* Simply loop through and attempt to cancel each transaction */
> -	list_for_each_entry_safe(transaction, next, &pipe->transactions, node) {
> -		int result = cvmx_usb_cancel(usb, pipe, transaction);
> -
> -		if (unlikely(result != 0))
> -			return result;
> -	}
> -	return 0;
> -}
> -
> -/**
> - * Close a pipe created with cvmx_usb_open_pipe().
> - *
> - * @usb:	 USB device state populated by cvmx_usb_initialize().
> - * @pipe:	 Pipe to close.
> - *
> - * Returns: 0 or a negative error code. EBUSY is returned if the pipe has
> - *	    outstanding transfers.
> - */
> -static int cvmx_usb_close_pipe(struct octeon_hcd *usb,
> -			       struct cvmx_usb_pipe *pipe)
> -{
> -	/* Fail if the pipe has pending transactions */
> -	if (!list_empty(&pipe->transactions))
> -		return -EBUSY;
> -
> -	list_del(&pipe->node);
> -	kfree(pipe);
> -
> -	return 0;
> -}
> -
> -/**
> - * Get the current USB protocol level frame number. The frame
> - * number is always in the range of 0-0x7ff.
> - *
> - * @usb: USB device state populated by cvmx_usb_initialize().
> - *
> - * Returns: USB frame number
> - */
> -static int cvmx_usb_get_frame_number(struct octeon_hcd *usb)
> -{
> -	union cvmx_usbcx_hfnum usbc_hfnum;
> -
> -	usbc_hfnum.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HFNUM(usb->index));
> -
> -	return usbc_hfnum.s.frnum;
> -}
> -
> -static void cvmx_usb_transfer_control(struct octeon_hcd *usb,
> -				      struct cvmx_usb_pipe *pipe,
> -				      struct cvmx_usb_transaction *transaction,
> -				      union cvmx_usbcx_hccharx usbc_hcchar,
> -				      int buffer_space_left,
> -				      int bytes_in_last_packet)
> -{
> -	switch (transaction->stage) {
> -	case CVMX_USB_STAGE_NON_CONTROL:
> -	case CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE:
> -		/* This should be impossible */
> -		cvmx_usb_complete(usb, pipe, transaction,
> -				  CVMX_USB_STATUS_ERROR);
> -		break;
> -	case CVMX_USB_STAGE_SETUP:
> -		pipe->pid_toggle = 1;
> -		if (cvmx_usb_pipe_needs_split(usb, pipe)) {
> -			transaction->stage =
> -				CVMX_USB_STAGE_SETUP_SPLIT_COMPLETE;
> -		} else {
> -			struct usb_ctrlrequest *header =
> -				cvmx_phys_to_ptr(transaction->control_header);
> -			if (header->wLength)
> -				transaction->stage = CVMX_USB_STAGE_DATA;
> -			else
> -				transaction->stage = CVMX_USB_STAGE_STATUS;
> -		}
> -		break;
> -	case CVMX_USB_STAGE_SETUP_SPLIT_COMPLETE:
> -		{
> -			struct usb_ctrlrequest *header =
> -				cvmx_phys_to_ptr(transaction->control_header);
> -			if (header->wLength)
> -				transaction->stage = CVMX_USB_STAGE_DATA;
> -			else
> -				transaction->stage = CVMX_USB_STAGE_STATUS;
> -		}
> -		break;
> -	case CVMX_USB_STAGE_DATA:
> -		if (cvmx_usb_pipe_needs_split(usb, pipe)) {
> -			transaction->stage = CVMX_USB_STAGE_DATA_SPLIT_COMPLETE;
> -			/*
> -			 * For setup OUT data that are splits,
> -			 * the hardware doesn't appear to count
> -			 * transferred data. Here we manually
> -			 * update the data transferred
> -			 */
> -			if (!usbc_hcchar.s.epdir) {
> -				if (buffer_space_left < pipe->max_packet)
> -					transaction->actual_bytes +=
> -						buffer_space_left;
> -				else
> -					transaction->actual_bytes +=
> -						pipe->max_packet;
> -			}
> -		} else if ((buffer_space_left == 0) ||
> -			   (bytes_in_last_packet < pipe->max_packet)) {
> -			pipe->pid_toggle = 1;
> -			transaction->stage = CVMX_USB_STAGE_STATUS;
> -		}
> -		break;
> -	case CVMX_USB_STAGE_DATA_SPLIT_COMPLETE:
> -		if ((buffer_space_left == 0) ||
> -		    (bytes_in_last_packet < pipe->max_packet)) {
> -			pipe->pid_toggle = 1;
> -			transaction->stage = CVMX_USB_STAGE_STATUS;
> -		} else {
> -			transaction->stage = CVMX_USB_STAGE_DATA;
> -		}
> -		break;
> -	case CVMX_USB_STAGE_STATUS:
> -		if (cvmx_usb_pipe_needs_split(usb, pipe))
> -			transaction->stage =
> -				CVMX_USB_STAGE_STATUS_SPLIT_COMPLETE;
> -		else
> -			cvmx_usb_complete(usb, pipe, transaction,
> -					  CVMX_USB_STATUS_OK);
> -		break;
> -	case CVMX_USB_STAGE_STATUS_SPLIT_COMPLETE:
> -		cvmx_usb_complete(usb, pipe, transaction, CVMX_USB_STATUS_OK);
> -		break;
> -	}
> -}
> -
> -static void cvmx_usb_transfer_bulk(struct octeon_hcd *usb,
> -				   struct cvmx_usb_pipe *pipe,
> -				   struct cvmx_usb_transaction *transaction,
> -				   union cvmx_usbcx_hcintx usbc_hcint,
> -				   int buffer_space_left,
> -				   int bytes_in_last_packet)
> -{
> -	/*
> -	 * The only time a bulk transfer isn't complete when it finishes with
> -	 * an ACK is during a split transaction. For splits we need to continue
> -	 * the transfer if more data is needed.
> -	 */
> -	if (cvmx_usb_pipe_needs_split(usb, pipe)) {
> -		if (transaction->stage == CVMX_USB_STAGE_NON_CONTROL)
> -			transaction->stage =
> -				CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE;
> -		else if (buffer_space_left &&
> -			 (bytes_in_last_packet == pipe->max_packet))
> -			transaction->stage = CVMX_USB_STAGE_NON_CONTROL;
> -		else
> -			cvmx_usb_complete(usb, pipe, transaction,
> -					  CVMX_USB_STATUS_OK);
> -	} else {
> -		if ((pipe->device_speed == CVMX_USB_SPEED_HIGH) &&
> -		    (pipe->transfer_dir == CVMX_USB_DIRECTION_OUT) &&
> -		    (usbc_hcint.s.nak))
> -			pipe->flags |= CVMX_USB_PIPE_FLAGS_NEED_PING;
> -		if (!buffer_space_left ||
> -		    (bytes_in_last_packet < pipe->max_packet))
> -			cvmx_usb_complete(usb, pipe, transaction,
> -					  CVMX_USB_STATUS_OK);
> -	}
> -}
> -
> -static void cvmx_usb_transfer_intr(struct octeon_hcd *usb,
> -				   struct cvmx_usb_pipe *pipe,
> -				   struct cvmx_usb_transaction *transaction,
> -				   int buffer_space_left,
> -				   int bytes_in_last_packet)
> -{
> -	if (cvmx_usb_pipe_needs_split(usb, pipe)) {
> -		if (transaction->stage == CVMX_USB_STAGE_NON_CONTROL) {
> -			transaction->stage =
> -				CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE;
> -		} else if (buffer_space_left &&
> -			   (bytes_in_last_packet == pipe->max_packet)) {
> -			transaction->stage = CVMX_USB_STAGE_NON_CONTROL;
> -		} else {
> -			pipe->next_tx_frame += pipe->interval;
> -			cvmx_usb_complete(usb, pipe, transaction,
> -					  CVMX_USB_STATUS_OK);
> -		}
> -	} else if (!buffer_space_left ||
> -		   (bytes_in_last_packet < pipe->max_packet)) {
> -		pipe->next_tx_frame += pipe->interval;
> -		cvmx_usb_complete(usb, pipe, transaction, CVMX_USB_STATUS_OK);
> -	}
> -}
> -
> -static void cvmx_usb_transfer_isoc(struct octeon_hcd *usb,
> -				   struct cvmx_usb_pipe *pipe,
> -				   struct cvmx_usb_transaction *transaction,
> -				   int buffer_space_left,
> -				   int bytes_in_last_packet,
> -				   int bytes_this_transfer)
> -{
> -	if (cvmx_usb_pipe_needs_split(usb, pipe)) {
> -		/*
> -		 * ISOCHRONOUS OUT splits don't require a complete split stage.
> -		 * Instead they use a sequence of begin OUT splits to transfer
> -		 * the data 188 bytes at a time. Once the transfer is complete,
> -		 * the pipe sleeps until the next schedule interval.
> -		 */
> -		if (pipe->transfer_dir == CVMX_USB_DIRECTION_OUT) {
> -			/*
> -			 * If no space left or this wasn't a max size packet
> -			 * then this transfer is complete. Otherwise start it
> -			 * again to send the next 188 bytes
> -			 */
> -			if (!buffer_space_left || (bytes_this_transfer < 188)) {
> -				pipe->next_tx_frame += pipe->interval;
> -				cvmx_usb_complete(usb, pipe, transaction,
> -						  CVMX_USB_STATUS_OK);
> -			}
> -			return;
> -		}
> -		if (transaction->stage ==
> -		    CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE) {
> -			/*
> -			 * We are in the incoming data phase. Keep getting data
> -			 * until we run out of space or get a small packet
> -			 */
> -			if ((buffer_space_left == 0) ||
> -			    (bytes_in_last_packet < pipe->max_packet)) {
> -				pipe->next_tx_frame += pipe->interval;
> -				cvmx_usb_complete(usb, pipe, transaction,
> -						  CVMX_USB_STATUS_OK);
> -			}
> -		} else {
> -			transaction->stage =
> -				CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE;
> -		}
> -	} else {
> -		pipe->next_tx_frame += pipe->interval;
> -		cvmx_usb_complete(usb, pipe, transaction, CVMX_USB_STATUS_OK);
> -	}
> -}
> -
> -/**
> - * Poll a channel for status
> - *
> - * @usb:     USB device
> - * @channel: Channel to poll
> - *
> - * Returns: Zero on success
> - */
> -static int cvmx_usb_poll_channel(struct octeon_hcd *usb, int channel)
> -{
> -	struct usb_hcd *hcd = octeon_to_hcd(usb);
> -	struct device *dev = hcd->self.controller;
> -	union cvmx_usbcx_hcintx usbc_hcint;
> -	union cvmx_usbcx_hctsizx usbc_hctsiz;
> -	union cvmx_usbcx_hccharx usbc_hcchar;
> -	struct cvmx_usb_pipe *pipe;
> -	struct cvmx_usb_transaction *transaction;
> -	int bytes_this_transfer;
> -	int bytes_in_last_packet;
> -	int packets_processed;
> -	int buffer_space_left;
> -
> -	/* Read the interrupt status bits for the channel */
> -	usbc_hcint.u32 = cvmx_usb_read_csr32(usb,
> -				CVMX_USBCX_HCINTX(channel, usb->index));
> -
> -	if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA) {
> -		usbc_hcchar.u32 = cvmx_usb_read_csr32(usb,
> -				CVMX_USBCX_HCCHARX(channel, usb->index));
> -
> -		if (usbc_hcchar.s.chena && usbc_hcchar.s.chdis) {
> -			/*
> -			 * There seems to be a bug in CN31XX which can cause
> -			 * interrupt IN transfers to get stuck until we do a
> -			 * write of HCCHARX without changing things
> -			 */
> -			cvmx_usb_write_csr32(usb,
> -					     CVMX_USBCX_HCCHARX(channel,
> -								usb->index),
> -					     usbc_hcchar.u32);
> -			return 0;
> -		}
> -
> -		/*
> -		 * In non DMA mode the channels don't halt themselves. We need
> -		 * to manually disable channels that are left running
> -		 */
> -		if (!usbc_hcint.s.chhltd) {
> -			if (usbc_hcchar.s.chena) {
> -				union cvmx_usbcx_hcintmskx hcintmsk;
> -				/* Disable all interrupts except CHHLTD */
> -				hcintmsk.u32 = 0;
> -				hcintmsk.s.chhltdmsk = 1;
> -				cvmx_usb_write_csr32(usb,
> -						     CVMX_USBCX_HCINTMSKX(channel, usb->index),
> -						     hcintmsk.u32);
> -				usbc_hcchar.s.chdis = 1;
> -				cvmx_usb_write_csr32(usb,
> -						     CVMX_USBCX_HCCHARX(channel, usb->index),
> -						     usbc_hcchar.u32);
> -				return 0;
> -			} else if (usbc_hcint.s.xfercompl) {
> -				/*
> -				 * Successful IN/OUT with transfer complete.
> -				 * Channel halt isn't needed.
> -				 */
> -			} else {
> -				dev_err(dev, "USB%d: Channel %d interrupt without halt\n",
> -					usb->index, channel);
> -				return 0;
> -			}
> -		}
> -	} else {
> -		/*
> -		 * There is are no interrupts that we need to process when the
> -		 * channel is still running
> -		 */
> -		if (!usbc_hcint.s.chhltd)
> -			return 0;
> -	}
> -
> -	/* Disable the channel interrupts now that it is done */
> -	cvmx_usb_write_csr32(usb, CVMX_USBCX_HCINTMSKX(channel, usb->index), 0);
> -	usb->idle_hardware_channels |= (1 << channel);
> -
> -	/* Make sure this channel is tied to a valid pipe */
> -	pipe = usb->pipe_for_channel[channel];
> -	prefetch(pipe);
> -	if (!pipe)
> -		return 0;
> -	transaction = list_first_entry(&pipe->transactions,
> -				       typeof(*transaction),
> -				       node);
> -	prefetch(transaction);
> -
> -	/*
> -	 * Disconnect this pipe from the HW channel. Later the schedule
> -	 * function will figure out which pipe needs to go
> -	 */
> -	usb->pipe_for_channel[channel] = NULL;
> -	pipe->flags &= ~CVMX_USB_PIPE_FLAGS_SCHEDULED;
> -
> -	/*
> -	 * Read the channel config info so we can figure out how much data
> -	 * transferred
> -	 */
> -	usbc_hcchar.u32 = cvmx_usb_read_csr32(usb,
> -			CVMX_USBCX_HCCHARX(channel, usb->index));
> -	usbc_hctsiz.u32 = cvmx_usb_read_csr32(usb,
> -			CVMX_USBCX_HCTSIZX(channel, usb->index));
> -
> -	/*
> -	 * Calculating the number of bytes successfully transferred is dependent
> -	 * on the transfer direction
> -	 */
> -	packets_processed = transaction->pktcnt - usbc_hctsiz.s.pktcnt;
> -	if (usbc_hcchar.s.epdir) {
> -		/*
> -		 * IN transactions are easy. For every byte received the
> -		 * hardware decrements xfersize. All we need to do is subtract
> -		 * the current value of xfersize from its starting value and we
> -		 * know how many bytes were written to the buffer
> -		 */
> -		bytes_this_transfer = transaction->xfersize -
> -			usbc_hctsiz.s.xfersize;
> -	} else {
> -		/*
> -		 * OUT transaction don't decrement xfersize. Instead pktcnt is
> -		 * decremented on every successful packet send. The hardware
> -		 * does this when it receives an ACK, or NYET. If it doesn't
> -		 * receive one of these responses pktcnt doesn't change
> -		 */
> -		bytes_this_transfer = packets_processed * usbc_hcchar.s.mps;
> -		/*
> -		 * The last packet may not be a full transfer if we didn't have
> -		 * enough data
> -		 */
> -		if (bytes_this_transfer > transaction->xfersize)
> -			bytes_this_transfer = transaction->xfersize;
> -	}
> -	/* Figure out how many bytes were in the last packet of the transfer */
> -	if (packets_processed)
> -		bytes_in_last_packet = bytes_this_transfer -
> -			(packets_processed - 1) * usbc_hcchar.s.mps;
> -	else
> -		bytes_in_last_packet = bytes_this_transfer;
> -
> -	/*
> -	 * As a special case, setup transactions output the setup header, not
> -	 * the user's data. For this reason we don't count setup data as bytes
> -	 * transferred
> -	 */
> -	if ((transaction->stage == CVMX_USB_STAGE_SETUP) ||
> -	    (transaction->stage == CVMX_USB_STAGE_SETUP_SPLIT_COMPLETE))
> -		bytes_this_transfer = 0;
> -
> -	/*
> -	 * Add the bytes transferred to the running total. It is important that
> -	 * bytes_this_transfer doesn't count any data that needs to be
> -	 * retransmitted
> -	 */
> -	transaction->actual_bytes += bytes_this_transfer;
> -	if (transaction->type == CVMX_USB_TRANSFER_ISOCHRONOUS)
> -		buffer_space_left = transaction->iso_packets[0].length -
> -			transaction->actual_bytes;
> -	else
> -		buffer_space_left = transaction->buffer_length -
> -			transaction->actual_bytes;
> -
> -	/*
> -	 * We need to remember the PID toggle state for the next transaction.
> -	 * The hardware already updated it for the next transaction
> -	 */
> -	pipe->pid_toggle = !(usbc_hctsiz.s.pid == 0);
> -
> -	/*
> -	 * For high speed bulk out, assume the next transaction will need to do
> -	 * a ping before proceeding. If this isn't true the ACK processing below
> -	 * will clear this flag
> -	 */
> -	if ((pipe->device_speed == CVMX_USB_SPEED_HIGH) &&
> -	    (pipe->transfer_type == CVMX_USB_TRANSFER_BULK) &&
> -	    (pipe->transfer_dir == CVMX_USB_DIRECTION_OUT))
> -		pipe->flags |= CVMX_USB_PIPE_FLAGS_NEED_PING;
> -
> -	if (WARN_ON_ONCE(bytes_this_transfer < 0)) {
> -		/*
> -		 * In some rare cases the DMA engine seems to get stuck and
> -		 * keeps substracting same byte count over and over again. In
> -		 * such case we just need to fail every transaction.
> -		 */
> -		cvmx_usb_complete(usb, pipe, transaction,
> -				  CVMX_USB_STATUS_ERROR);
> -		return 0;
> -	}
> -
> -	if (usbc_hcint.s.stall) {
> -		/*
> -		 * STALL as a response means this transaction cannot be
> -		 * completed because the device can't process transactions. Tell
> -		 * the user. Any data that was transferred will be counted on
> -		 * the actual bytes transferred
> -		 */
> -		pipe->pid_toggle = 0;
> -		cvmx_usb_complete(usb, pipe, transaction,
> -				  CVMX_USB_STATUS_STALL);
> -	} else if (usbc_hcint.s.xacterr) {
> -		/*
> -		 * XactErr as a response means the device signaled
> -		 * something wrong with the transfer. For example, PID
> -		 * toggle errors cause these.
> -		 */
> -		cvmx_usb_complete(usb, pipe, transaction,
> -				  CVMX_USB_STATUS_XACTERR);
> -	} else if (usbc_hcint.s.bblerr) {
> -		/* Babble Error (BblErr) */
> -		cvmx_usb_complete(usb, pipe, transaction,
> -				  CVMX_USB_STATUS_BABBLEERR);
> -	} else if (usbc_hcint.s.datatglerr) {
> -		/* Data toggle error */
> -		cvmx_usb_complete(usb, pipe, transaction,
> -				  CVMX_USB_STATUS_DATATGLERR);
> -	} else if (usbc_hcint.s.nyet) {
> -		/*
> -		 * NYET as a response is only allowed in three cases: as a
> -		 * response to a ping, as a response to a split transaction, and
> -		 * as a response to a bulk out. The ping case is handled by
> -		 * hardware, so we only have splits and bulk out
> -		 */
> -		if (!cvmx_usb_pipe_needs_split(usb, pipe)) {
> -			transaction->retries = 0;
> -			/*
> -			 * If there is more data to go then we need to try
> -			 * again. Otherwise this transaction is complete
> -			 */
> -			if ((buffer_space_left == 0) ||
> -			    (bytes_in_last_packet < pipe->max_packet))
> -				cvmx_usb_complete(usb, pipe,
> -						  transaction,
> -						  CVMX_USB_STATUS_OK);
> -		} else {
> -			/*
> -			 * Split transactions retry the split complete 4 times
> -			 * then rewind to the start split and do the entire
> -			 * transactions again
> -			 */
> -			transaction->retries++;
> -			if ((transaction->retries & 0x3) == 0) {
> -				/*
> -				 * Rewind to the beginning of the transaction by
> -				 * anding off the split complete bit
> -				 */
> -				transaction->stage &= ~1;
> -				pipe->split_sc_frame = -1;
> -			}
> -		}
> -	} else if (usbc_hcint.s.ack) {
> -		transaction->retries = 0;
> -		/*
> -		 * The ACK bit can only be checked after the other error bits.
> -		 * This is because a multi packet transfer may succeed in a
> -		 * number of packets and then get a different response on the
> -		 * last packet. In this case both ACK and the last response bit
> -		 * will be set. If none of the other response bits is set, then
> -		 * the last packet must have been an ACK
> -		 *
> -		 * Since we got an ACK, we know we don't need to do a ping on
> -		 * this pipe
> -		 */
> -		pipe->flags &= ~CVMX_USB_PIPE_FLAGS_NEED_PING;
> -
> -		switch (transaction->type) {
> -		case CVMX_USB_TRANSFER_CONTROL:
> -			cvmx_usb_transfer_control(usb, pipe, transaction,
> -						  usbc_hcchar,
> -						  buffer_space_left,
> -						  bytes_in_last_packet);
> -			break;
> -		case CVMX_USB_TRANSFER_BULK:
> -			cvmx_usb_transfer_bulk(usb, pipe, transaction,
> -					       usbc_hcint, buffer_space_left,
> -					       bytes_in_last_packet);
> -			break;
> -		case CVMX_USB_TRANSFER_INTERRUPT:
> -			cvmx_usb_transfer_intr(usb, pipe, transaction,
> -					       buffer_space_left,
> -					       bytes_in_last_packet);
> -			break;
> -		case CVMX_USB_TRANSFER_ISOCHRONOUS:
> -			cvmx_usb_transfer_isoc(usb, pipe, transaction,
> -					       buffer_space_left,
> -					       bytes_in_last_packet,
> -					       bytes_this_transfer);
> -			break;
> -		}
> -	} else if (usbc_hcint.s.nak) {
> -		/*
> -		 * If this was a split then clear our split in progress marker.
> -		 */
> -		if (usb->active_split == transaction)
> -			usb->active_split = NULL;
> -		/*
> -		 * NAK as a response means the device couldn't accept the
> -		 * transaction, but it should be retried in the future. Rewind
> -		 * to the beginning of the transaction by anding off the split
> -		 * complete bit. Retry in the next interval
> -		 */
> -		transaction->retries = 0;
> -		transaction->stage &= ~1;
> -		pipe->next_tx_frame += pipe->interval;
> -		if (pipe->next_tx_frame < usb->frame_number)
> -			pipe->next_tx_frame = usb->frame_number +
> -				pipe->interval -
> -				(usb->frame_number - pipe->next_tx_frame) %
> -				pipe->interval;
> -	} else {
> -		struct cvmx_usb_port_status port;
> -
> -		port = cvmx_usb_get_status(usb);
> -		if (port.port_enabled) {
> -			/* We'll retry the exact same transaction again */
> -			transaction->retries++;
> -		} else {
> -			/*
> -			 * We get channel halted interrupts with no result bits
> -			 * sets when the cable is unplugged
> -			 */
> -			cvmx_usb_complete(usb, pipe, transaction,
> -					  CVMX_USB_STATUS_ERROR);
> -		}
> -	}
> -	return 0;
> -}
> -
> -static void octeon_usb_port_callback(struct octeon_hcd *usb)
> -{
> -	spin_unlock(&usb->lock);
> -	usb_hcd_poll_rh_status(octeon_to_hcd(usb));
> -	spin_lock(&usb->lock);
> -}
> -
> -/**
> - * Poll the USB block for status and call all needed callback
> - * handlers. This function is meant to be called in the interrupt
> - * handler for the USB controller. It can also be called
> - * periodically in a loop for non-interrupt based operation.
> - *
> - * @usb: USB device state populated by cvmx_usb_initialize().
> - *
> - * Returns: 0 or a negative error code.
> - */
> -static int cvmx_usb_poll(struct octeon_hcd *usb)
> -{
> -	union cvmx_usbcx_hfnum usbc_hfnum;
> -	union cvmx_usbcx_gintsts usbc_gintsts;
> -
> -	prefetch_range(usb, sizeof(*usb));
> -
> -	/* Update the frame counter */
> -	usbc_hfnum.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HFNUM(usb->index));
> -	if ((usb->frame_number & 0x3fff) > usbc_hfnum.s.frnum)
> -		usb->frame_number += 0x4000;
> -	usb->frame_number &= ~0x3fffull;
> -	usb->frame_number |= usbc_hfnum.s.frnum;
> -
> -	/* Read the pending interrupts */
> -	usbc_gintsts.u32 = cvmx_usb_read_csr32(usb,
> -					       CVMX_USBCX_GINTSTS(usb->index));
> -
> -	/* Clear the interrupts now that we know about them */
> -	cvmx_usb_write_csr32(usb, CVMX_USBCX_GINTSTS(usb->index),
> -			     usbc_gintsts.u32);
> -
> -	if (usbc_gintsts.s.rxflvl) {
> -		/*
> -		 * RxFIFO Non-Empty (RxFLvl)
> -		 * Indicates that there is at least one packet pending to be
> -		 * read from the RxFIFO.
> -		 *
> -		 * In DMA mode this is handled by hardware
> -		 */
> -		if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA)
> -			cvmx_usb_poll_rx_fifo(usb);
> -	}
> -	if (usbc_gintsts.s.ptxfemp || usbc_gintsts.s.nptxfemp) {
> -		/* Fill the Tx FIFOs when not in DMA mode */
> -		if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA)
> -			cvmx_usb_poll_tx_fifo(usb);
> -	}
> -	if (usbc_gintsts.s.disconnint || usbc_gintsts.s.prtint) {
> -		union cvmx_usbcx_hprt usbc_hprt;
> -		/*
> -		 * Disconnect Detected Interrupt (DisconnInt)
> -		 * Asserted when a device disconnect is detected.
> -		 *
> -		 * Host Port Interrupt (PrtInt)
> -		 * The core sets this bit to indicate a change in port status of
> -		 * one of the O2P USB core ports in Host mode. The application
> -		 * must read the Host Port Control and Status (HPRT) register to
> -		 * determine the exact event that caused this interrupt. The
> -		 * application must clear the appropriate status bit in the Host
> -		 * Port Control and Status register to clear this bit.
> -		 *
> -		 * Call the user's port callback
> -		 */
> -		octeon_usb_port_callback(usb);
> -		/* Clear the port change bits */
> -		usbc_hprt.u32 =
> -			cvmx_usb_read_csr32(usb, CVMX_USBCX_HPRT(usb->index));
> -		usbc_hprt.s.prtena = 0;
> -		cvmx_usb_write_csr32(usb, CVMX_USBCX_HPRT(usb->index),
> -				     usbc_hprt.u32);
> -	}
> -	if (usbc_gintsts.s.hchint) {
> -		/*
> -		 * Host Channels Interrupt (HChInt)
> -		 * The core sets this bit to indicate that an interrupt is
> -		 * pending on one of the channels of the core (in Host mode).
> -		 * The application must read the Host All Channels Interrupt
> -		 * (HAINT) register to determine the exact number of the channel
> -		 * on which the interrupt occurred, and then read the
> -		 * corresponding Host Channel-n Interrupt (HCINTn) register to
> -		 * determine the exact cause of the interrupt. The application
> -		 * must clear the appropriate status bit in the HCINTn register
> -		 * to clear this bit.
> -		 */
> -		union cvmx_usbcx_haint usbc_haint;
> -
> -		usbc_haint.u32 = cvmx_usb_read_csr32(usb,
> -					CVMX_USBCX_HAINT(usb->index));
> -		while (usbc_haint.u32) {
> -			int channel;
> -
> -			channel = __fls(usbc_haint.u32);
> -			cvmx_usb_poll_channel(usb, channel);
> -			usbc_haint.u32 ^= 1 << channel;
> -		}
> -	}
> -
> -	cvmx_usb_schedule(usb, usbc_gintsts.s.sof);
> -
> -	return 0;
> -}
> -
> -/* convert between an HCD pointer and the corresponding struct octeon_hcd */
> -static inline struct octeon_hcd *hcd_to_octeon(struct usb_hcd *hcd)
> -{
> -	return (struct octeon_hcd *)(hcd->hcd_priv);
> -}
> -
> -static irqreturn_t octeon_usb_irq(struct usb_hcd *hcd)
> -{
> -	struct octeon_hcd *usb = hcd_to_octeon(hcd);
> -	unsigned long flags;
> -
> -	spin_lock_irqsave(&usb->lock, flags);
> -	cvmx_usb_poll(usb);
> -	spin_unlock_irqrestore(&usb->lock, flags);
> -	return IRQ_HANDLED;
> -}
> -
> -static int octeon_usb_start(struct usb_hcd *hcd)
> -{
> -	hcd->state = HC_STATE_RUNNING;
> -	return 0;
> -}
> -
> -static void octeon_usb_stop(struct usb_hcd *hcd)
> -{
> -	hcd->state = HC_STATE_HALT;
> -}
> -
> -static int octeon_usb_get_frame_number(struct usb_hcd *hcd)
> -{
> -	struct octeon_hcd *usb = hcd_to_octeon(hcd);
> -
> -	return cvmx_usb_get_frame_number(usb);
> -}
> -
> -static int octeon_usb_urb_enqueue(struct usb_hcd *hcd,
> -				  struct urb *urb,
> -				  gfp_t mem_flags)
> -{
> -	struct octeon_hcd *usb = hcd_to_octeon(hcd);
> -	struct device *dev = hcd->self.controller;
> -	struct cvmx_usb_transaction *transaction = NULL;
> -	struct cvmx_usb_pipe *pipe;
> -	unsigned long flags;
> -	struct cvmx_usb_iso_packet *iso_packet;
> -	struct usb_host_endpoint *ep = urb->ep;
> -	int rc;
> -
> -	urb->status = 0;
> -	spin_lock_irqsave(&usb->lock, flags);
> -
> -	rc = usb_hcd_link_urb_to_ep(hcd, urb);
> -	if (rc) {
> -		spin_unlock_irqrestore(&usb->lock, flags);
> -		return rc;
> -	}
> -
> -	if (!ep->hcpriv) {
> -		enum cvmx_usb_transfer transfer_type;
> -		enum cvmx_usb_speed speed;
> -		int split_device = 0;
> -		int split_port = 0;
> -
> -		switch (usb_pipetype(urb->pipe)) {
> -		case PIPE_ISOCHRONOUS:
> -			transfer_type = CVMX_USB_TRANSFER_ISOCHRONOUS;
> -			break;
> -		case PIPE_INTERRUPT:
> -			transfer_type = CVMX_USB_TRANSFER_INTERRUPT;
> -			break;
> -		case PIPE_CONTROL:
> -			transfer_type = CVMX_USB_TRANSFER_CONTROL;
> -			break;
> -		default:
> -			transfer_type = CVMX_USB_TRANSFER_BULK;
> -			break;
> -		}
> -		switch (urb->dev->speed) {
> -		case USB_SPEED_LOW:
> -			speed = CVMX_USB_SPEED_LOW;
> -			break;
> -		case USB_SPEED_FULL:
> -			speed = CVMX_USB_SPEED_FULL;
> -			break;
> -		default:
> -			speed = CVMX_USB_SPEED_HIGH;
> -			break;
> -		}
> -		/*
> -		 * For slow devices on high speed ports we need to find the hub
> -		 * that does the speed translation so we know where to send the
> -		 * split transactions.
> -		 */
> -		if (speed != CVMX_USB_SPEED_HIGH) {
> -			/*
> -			 * Start at this device and work our way up the usb
> -			 * tree.
> -			 */
> -			struct usb_device *dev = urb->dev;
> -
> -			while (dev->parent) {
> -				/*
> -				 * If our parent is high speed then he'll
> -				 * receive the splits.
> -				 */
> -				if (dev->parent->speed == USB_SPEED_HIGH) {
> -					split_device = dev->parent->devnum;
> -					split_port = dev->portnum;
> -					break;
> -				}
> -				/*
> -				 * Move up the tree one level. If we make it all
> -				 * the way up the tree, then the port must not
> -				 * be in high speed mode and we don't need a
> -				 * split.
> -				 */
> -				dev = dev->parent;
> -			}
> -		}
> -		pipe = cvmx_usb_open_pipe(usb, usb_pipedevice(urb->pipe),
> -					  usb_pipeendpoint(urb->pipe), speed,
> -					  le16_to_cpu(ep->desc.wMaxPacketSize)
> -					  & 0x7ff,
> -					  transfer_type,
> -					  usb_pipein(urb->pipe) ?
> -						CVMX_USB_DIRECTION_IN :
> -						CVMX_USB_DIRECTION_OUT,
> -					  urb->interval,
> -					  (le16_to_cpu(ep->desc.wMaxPacketSize)
> -					   >> 11) & 0x3,
> -					  split_device, split_port);
> -		if (!pipe) {
> -			usb_hcd_unlink_urb_from_ep(hcd, urb);
> -			spin_unlock_irqrestore(&usb->lock, flags);
> -			dev_dbg(dev, "Failed to create pipe\n");
> -			return -ENOMEM;
> -		}
> -		ep->hcpriv = pipe;
> -	} else {
> -		pipe = ep->hcpriv;
> -	}
> -
> -	switch (usb_pipetype(urb->pipe)) {
> -	case PIPE_ISOCHRONOUS:
> -		dev_dbg(dev, "Submit isochronous to %d.%d\n",
> -			usb_pipedevice(urb->pipe),
> -			usb_pipeendpoint(urb->pipe));
> -		/*
> -		 * Allocate a structure to use for our private list of
> -		 * isochronous packets.
> -		 */
> -		iso_packet = kmalloc_array(urb->number_of_packets,
> -					   sizeof(struct cvmx_usb_iso_packet),
> -					   GFP_ATOMIC);
> -		if (iso_packet) {
> -			int i;
> -			/* Fill the list with the data from the URB */
> -			for (i = 0; i < urb->number_of_packets; i++) {
> -				iso_packet[i].offset =
> -					urb->iso_frame_desc[i].offset;
> -				iso_packet[i].length =
> -					urb->iso_frame_desc[i].length;
> -				iso_packet[i].status = CVMX_USB_STATUS_ERROR;
> -			}
> -			/*
> -			 * Store a pointer to the list in the URB setup_packet
> -			 * field. We know this currently isn't being used and
> -			 * this saves us a bunch of logic.
> -			 */
> -			urb->setup_packet = (char *)iso_packet;
> -			transaction = cvmx_usb_submit_isochronous(usb,
> -								  pipe, urb);
> -			/*
> -			 * If submit failed we need to free our private packet
> -			 * list.
> -			 */
> -			if (!transaction) {
> -				urb->setup_packet = NULL;
> -				kfree(iso_packet);
> -			}
> -		}
> -		break;
> -	case PIPE_INTERRUPT:
> -		dev_dbg(dev, "Submit interrupt to %d.%d\n",
> -			usb_pipedevice(urb->pipe),
> -			usb_pipeendpoint(urb->pipe));
> -		transaction = cvmx_usb_submit_interrupt(usb, pipe, urb);
> -		break;
> -	case PIPE_CONTROL:
> -		dev_dbg(dev, "Submit control to %d.%d\n",
> -			usb_pipedevice(urb->pipe),
> -			usb_pipeendpoint(urb->pipe));
> -		transaction = cvmx_usb_submit_control(usb, pipe, urb);
> -		break;
> -	case PIPE_BULK:
> -		dev_dbg(dev, "Submit bulk to %d.%d\n",
> -			usb_pipedevice(urb->pipe),
> -			usb_pipeendpoint(urb->pipe));
> -		transaction = cvmx_usb_submit_bulk(usb, pipe, urb);
> -		break;
> -	}
> -	if (!transaction) {
> -		usb_hcd_unlink_urb_from_ep(hcd, urb);
> -		spin_unlock_irqrestore(&usb->lock, flags);
> -		dev_dbg(dev, "Failed to submit\n");
> -		return -ENOMEM;
> -	}
> -	urb->hcpriv = transaction;
> -	spin_unlock_irqrestore(&usb->lock, flags);
> -	return 0;
> -}
> -
> -static int octeon_usb_urb_dequeue(struct usb_hcd *hcd,
> -				  struct urb *urb,
> -				  int status)
> -{
> -	struct octeon_hcd *usb = hcd_to_octeon(hcd);
> -	unsigned long flags;
> -	int rc;
> -
> -	if (!urb->dev)
> -		return -EINVAL;
> -
> -	spin_lock_irqsave(&usb->lock, flags);
> -
> -	rc = usb_hcd_check_unlink_urb(hcd, urb, status);
> -	if (rc)
> -		goto out;
> -
> -	urb->status = status;
> -	cvmx_usb_cancel(usb, urb->ep->hcpriv, urb->hcpriv);
> -
> -out:
> -	spin_unlock_irqrestore(&usb->lock, flags);
> -
> -	return rc;
> -}
> -
> -static void octeon_usb_endpoint_disable(struct usb_hcd *hcd,
> -					struct usb_host_endpoint *ep)
> -{
> -	struct device *dev = hcd->self.controller;
> -
> -	if (ep->hcpriv) {
> -		struct octeon_hcd *usb = hcd_to_octeon(hcd);
> -		struct cvmx_usb_pipe *pipe = ep->hcpriv;
> -		unsigned long flags;
> -
> -		spin_lock_irqsave(&usb->lock, flags);
> -		cvmx_usb_cancel_all(usb, pipe);
> -		if (cvmx_usb_close_pipe(usb, pipe))
> -			dev_dbg(dev, "Closing pipe %p failed\n", pipe);
> -		spin_unlock_irqrestore(&usb->lock, flags);
> -		ep->hcpriv = NULL;
> -	}
> -}
> -
> -static int octeon_usb_hub_status_data(struct usb_hcd *hcd, char *buf)
> -{
> -	struct octeon_hcd *usb = hcd_to_octeon(hcd);
> -	struct cvmx_usb_port_status port_status;
> -	unsigned long flags;
> -
> -	spin_lock_irqsave(&usb->lock, flags);
> -	port_status = cvmx_usb_get_status(usb);
> -	spin_unlock_irqrestore(&usb->lock, flags);
> -	buf[0] = port_status.connect_change << 1;
> -
> -	return buf[0] != 0;
> -}
> -
> -static int octeon_usb_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
> -				  u16 wIndex, char *buf, u16 wLength)
> -{
> -	struct octeon_hcd *usb = hcd_to_octeon(hcd);
> -	struct device *dev = hcd->self.controller;
> -	struct cvmx_usb_port_status usb_port_status;
> -	int port_status;
> -	struct usb_hub_descriptor *desc;
> -	unsigned long flags;
> -
> -	switch (typeReq) {
> -	case ClearHubFeature:
> -		dev_dbg(dev, "ClearHubFeature\n");
> -		switch (wValue) {
> -		case C_HUB_LOCAL_POWER:
> -		case C_HUB_OVER_CURRENT:
> -			/* Nothing required here */
> -			break;
> -		default:
> -			return -EINVAL;
> -		}
> -		break;
> -	case ClearPortFeature:
> -		dev_dbg(dev, "ClearPortFeature\n");
> -		if (wIndex != 1) {
> -			dev_dbg(dev, " INVALID\n");
> -			return -EINVAL;
> -		}
> -
> -		switch (wValue) {
> -		case USB_PORT_FEAT_ENABLE:
> -			dev_dbg(dev, " ENABLE\n");
> -			spin_lock_irqsave(&usb->lock, flags);
> -			cvmx_usb_disable(usb);
> -			spin_unlock_irqrestore(&usb->lock, flags);
> -			break;
> -		case USB_PORT_FEAT_SUSPEND:
> -			dev_dbg(dev, " SUSPEND\n");
> -			/* Not supported on Octeon */
> -			break;
> -		case USB_PORT_FEAT_POWER:
> -			dev_dbg(dev, " POWER\n");
> -			/* Not supported on Octeon */
> -			break;
> -		case USB_PORT_FEAT_INDICATOR:
> -			dev_dbg(dev, " INDICATOR\n");
> -			/* Port inidicator not supported */
> -			break;
> -		case USB_PORT_FEAT_C_CONNECTION:
> -			dev_dbg(dev, " C_CONNECTION\n");
> -			/* Clears drivers internal connect status change flag */
> -			spin_lock_irqsave(&usb->lock, flags);
> -			usb->port_status = cvmx_usb_get_status(usb);
> -			spin_unlock_irqrestore(&usb->lock, flags);
> -			break;
> -		case USB_PORT_FEAT_C_RESET:
> -			dev_dbg(dev, " C_RESET\n");
> -			/*
> -			 * Clears the driver's internal Port Reset Change flag.
> -			 */
> -			spin_lock_irqsave(&usb->lock, flags);
> -			usb->port_status = cvmx_usb_get_status(usb);
> -			spin_unlock_irqrestore(&usb->lock, flags);
> -			break;
> -		case USB_PORT_FEAT_C_ENABLE:
> -			dev_dbg(dev, " C_ENABLE\n");
> -			/*
> -			 * Clears the driver's internal Port Enable/Disable
> -			 * Change flag.
> -			 */
> -			spin_lock_irqsave(&usb->lock, flags);
> -			usb->port_status = cvmx_usb_get_status(usb);
> -			spin_unlock_irqrestore(&usb->lock, flags);
> -			break;
> -		case USB_PORT_FEAT_C_SUSPEND:
> -			dev_dbg(dev, " C_SUSPEND\n");
> -			/*
> -			 * Clears the driver's internal Port Suspend Change
> -			 * flag, which is set when resume signaling on the host
> -			 * port is complete.
> -			 */
> -			break;
> -		case USB_PORT_FEAT_C_OVER_CURRENT:
> -			dev_dbg(dev, " C_OVER_CURRENT\n");
> -			/* Clears the driver's overcurrent Change flag */
> -			spin_lock_irqsave(&usb->lock, flags);
> -			usb->port_status = cvmx_usb_get_status(usb);
> -			spin_unlock_irqrestore(&usb->lock, flags);
> -			break;
> -		default:
> -			dev_dbg(dev, " UNKNOWN\n");
> -			return -EINVAL;
> -		}
> -		break;
> -	case GetHubDescriptor:
> -		dev_dbg(dev, "GetHubDescriptor\n");
> -		desc = (struct usb_hub_descriptor *)buf;
> -		desc->bDescLength = 9;
> -		desc->bDescriptorType = 0x29;
> -		desc->bNbrPorts = 1;
> -		desc->wHubCharacteristics = cpu_to_le16(0x08);
> -		desc->bPwrOn2PwrGood = 1;
> -		desc->bHubContrCurrent = 0;
> -		desc->u.hs.DeviceRemovable[0] = 0;
> -		desc->u.hs.DeviceRemovable[1] = 0xff;
> -		break;
> -	case GetHubStatus:
> -		dev_dbg(dev, "GetHubStatus\n");
> -		*(__le32 *)buf = 0;
> -		break;
> -	case GetPortStatus:
> -		dev_dbg(dev, "GetPortStatus\n");
> -		if (wIndex != 1) {
> -			dev_dbg(dev, " INVALID\n");
> -			return -EINVAL;
> -		}
> -
> -		spin_lock_irqsave(&usb->lock, flags);
> -		usb_port_status = cvmx_usb_get_status(usb);
> -		spin_unlock_irqrestore(&usb->lock, flags);
> -		port_status = 0;
> -
> -		if (usb_port_status.connect_change) {
> -			port_status |= (1 << USB_PORT_FEAT_C_CONNECTION);
> -			dev_dbg(dev, " C_CONNECTION\n");
> -		}
> -
> -		if (usb_port_status.port_enabled) {
> -			port_status |= (1 << USB_PORT_FEAT_C_ENABLE);
> -			dev_dbg(dev, " C_ENABLE\n");
> -		}
> -
> -		if (usb_port_status.connected) {
> -			port_status |= (1 << USB_PORT_FEAT_CONNECTION);
> -			dev_dbg(dev, " CONNECTION\n");
> -		}
> -
> -		if (usb_port_status.port_enabled) {
> -			port_status |= (1 << USB_PORT_FEAT_ENABLE);
> -			dev_dbg(dev, " ENABLE\n");
> -		}
> -
> -		if (usb_port_status.port_over_current) {
> -			port_status |= (1 << USB_PORT_FEAT_OVER_CURRENT);
> -			dev_dbg(dev, " OVER_CURRENT\n");
> -		}
> -
> -		if (usb_port_status.port_powered) {
> -			port_status |= (1 << USB_PORT_FEAT_POWER);
> -			dev_dbg(dev, " POWER\n");
> -		}
> -
> -		if (usb_port_status.port_speed == CVMX_USB_SPEED_HIGH) {
> -			port_status |= USB_PORT_STAT_HIGH_SPEED;
> -			dev_dbg(dev, " HIGHSPEED\n");
> -		} else if (usb_port_status.port_speed == CVMX_USB_SPEED_LOW) {
> -			port_status |= (1 << USB_PORT_FEAT_LOWSPEED);
> -			dev_dbg(dev, " LOWSPEED\n");
> -		}
> -
> -		*((__le32 *)buf) = cpu_to_le32(port_status);
> -		break;
> -	case SetHubFeature:
> -		dev_dbg(dev, "SetHubFeature\n");
> -		/* No HUB features supported */
> -		break;
> -	case SetPortFeature:
> -		dev_dbg(dev, "SetPortFeature\n");
> -		if (wIndex != 1) {
> -			dev_dbg(dev, " INVALID\n");
> -			return -EINVAL;
> -		}
> -
> -		switch (wValue) {
> -		case USB_PORT_FEAT_SUSPEND:
> -			dev_dbg(dev, " SUSPEND\n");
> -			return -EINVAL;
> -		case USB_PORT_FEAT_POWER:
> -			dev_dbg(dev, " POWER\n");
> -			/*
> -			 * Program the port power bit to drive VBUS on the USB.
> -			 */
> -			spin_lock_irqsave(&usb->lock, flags);
> -			USB_SET_FIELD32(CVMX_USBCX_HPRT(usb->index),
> -					cvmx_usbcx_hprt, prtpwr, 1);
> -			spin_unlock_irqrestore(&usb->lock, flags);
> -			return 0;
> -		case USB_PORT_FEAT_RESET:
> -			dev_dbg(dev, " RESET\n");
> -			spin_lock_irqsave(&usb->lock, flags);
> -			cvmx_usb_reset_port(usb);
> -			spin_unlock_irqrestore(&usb->lock, flags);
> -			return 0;
> -		case USB_PORT_FEAT_INDICATOR:
> -			dev_dbg(dev, " INDICATOR\n");
> -			/* Not supported */
> -			break;
> -		default:
> -			dev_dbg(dev, " UNKNOWN\n");
> -			return -EINVAL;
> -		}
> -		break;
> -	default:
> -		dev_dbg(dev, "Unknown root hub request\n");
> -		return -EINVAL;
> -	}
> -	return 0;
> -}
> -
> -static const struct hc_driver octeon_hc_driver = {
> -	.description		= "Octeon USB",
> -	.product_desc		= "Octeon Host Controller",
> -	.hcd_priv_size		= sizeof(struct octeon_hcd),
> -	.irq			= octeon_usb_irq,
> -	.flags			= HCD_MEMORY | HCD_DMA | HCD_USB2,
> -	.start			= octeon_usb_start,
> -	.stop			= octeon_usb_stop,
> -	.urb_enqueue		= octeon_usb_urb_enqueue,
> -	.urb_dequeue		= octeon_usb_urb_dequeue,
> -	.endpoint_disable	= octeon_usb_endpoint_disable,
> -	.get_frame_number	= octeon_usb_get_frame_number,
> -	.hub_status_data	= octeon_usb_hub_status_data,
> -	.hub_control		= octeon_usb_hub_control,
> -	.map_urb_for_dma	= octeon_map_urb_for_dma,
> -	.unmap_urb_for_dma	= octeon_unmap_urb_for_dma,
> -};
> -
> -static int octeon_usb_probe(struct platform_device *pdev)
> -{
> -	int status;
> -	int initialize_flags;
> -	int usb_num;
> -	struct resource *res_mem;
> -	struct device_node *usbn_node;
> -	int irq = platform_get_irq(pdev, 0);
> -	struct device *dev = &pdev->dev;
> -	struct octeon_hcd *usb;
> -	struct usb_hcd *hcd;
> -	u32 clock_rate = 48000000;
> -	bool is_crystal_clock = false;
> -	const char *clock_type;
> -	int i;
> -
> -	if (!dev->of_node) {
> -		dev_err(dev, "Error: empty of_node\n");
> -		return -ENXIO;
> -	}
> -	usbn_node = dev->of_node->parent;
> -
> -	i = of_property_read_u32(usbn_node,
> -				 "clock-frequency", &clock_rate);
> -	if (i)
> -		i = of_property_read_u32(usbn_node,
> -					 "refclk-frequency", &clock_rate);
> -	if (i) {
> -		dev_err(dev, "No USBN \"clock-frequency\"\n");
> -		return -ENXIO;
> -	}
> -	switch (clock_rate) {
> -	case 12000000:
> -		initialize_flags = CVMX_USB_INITIALIZE_FLAGS_CLOCK_12MHZ;
> -		break;
> -	case 24000000:
> -		initialize_flags = CVMX_USB_INITIALIZE_FLAGS_CLOCK_24MHZ;
> -		break;
> -	case 48000000:
> -		initialize_flags = CVMX_USB_INITIALIZE_FLAGS_CLOCK_48MHZ;
> -		break;
> -	default:
> -		dev_err(dev, "Illegal USBN \"clock-frequency\" %u\n",
> -			clock_rate);
> -		return -ENXIO;
> -	}
> -
> -	i = of_property_read_string(usbn_node,
> -				    "cavium,refclk-type", &clock_type);
> -	if (i)
> -		i = of_property_read_string(usbn_node,
> -					    "refclk-type", &clock_type);
> -
> -	if (!i && strcmp("crystal", clock_type) == 0)
> -		is_crystal_clock = true;
> -
> -	if (is_crystal_clock)
> -		initialize_flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_XI;
> -	else
> -		initialize_flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_GND;
> -
> -	res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	if (!res_mem) {
> -		dev_err(dev, "found no memory resource\n");
> -		return -ENXIO;
> -	}
> -	usb_num = (res_mem->start >> 44) & 1;
> -
> -	if (irq < 0) {
> -		/* Defective device tree, but we know how to fix it. */
> -		irq_hw_number_t hwirq = usb_num ? (1 << 6) + 17 : 56;
> -
> -		irq = irq_create_mapping(NULL, hwirq);
> -	}
> -
> -	/*
> -	 * Set the DMA mask to 64bits so we get buffers already translated for
> -	 * DMA.
> -	 */
> -	i = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64));
> -	if (i)
> -		return i;
> -
> -	/*
> -	 * Only cn52XX and cn56XX have DWC_OTG USB hardware and the
> -	 * IOB priority registers.  Under heavy network load USB
> -	 * hardware can be starved by the IOB causing a crash.  Give
> -	 * it a priority boost if it has been waiting more than 400
> -	 * cycles to avoid this situation.
> -	 *
> -	 * Testing indicates that a cnt_val of 8192 is not sufficient,
> -	 * but no failures are seen with 4096.  We choose a value of
> -	 * 400 to give a safety factor of 10.
> -	 */
> -	if (OCTEON_IS_MODEL(OCTEON_CN52XX) || OCTEON_IS_MODEL(OCTEON_CN56XX)) {
> -		union cvmx_iob_n2c_l2c_pri_cnt pri_cnt;
> -
> -		pri_cnt.u64 = 0;
> -		pri_cnt.s.cnt_enb = 1;
> -		pri_cnt.s.cnt_val = 400;
> -		cvmx_write_csr(CVMX_IOB_N2C_L2C_PRI_CNT, pri_cnt.u64);
> -	}
> -
> -	hcd = usb_create_hcd(&octeon_hc_driver, dev, dev_name(dev));
> -	if (!hcd) {
> -		dev_dbg(dev, "Failed to allocate memory for HCD\n");
> -		return -1;
> -	}
> -	hcd->uses_new_polling = 1;
> -	usb = (struct octeon_hcd *)hcd->hcd_priv;
> -
> -	spin_lock_init(&usb->lock);
> -
> -	usb->init_flags = initialize_flags;
> -
> -	/* Initialize the USB state structure */
> -	usb->index = usb_num;
> -	INIT_LIST_HEAD(&usb->idle_pipes);
> -	for (i = 0; i < ARRAY_SIZE(usb->active_pipes); i++)
> -		INIT_LIST_HEAD(&usb->active_pipes[i]);
> -
> -	/* Due to an errata, CN31XX doesn't support DMA */
> -	if (OCTEON_IS_MODEL(OCTEON_CN31XX)) {
> -		usb->init_flags |= CVMX_USB_INITIALIZE_FLAGS_NO_DMA;
> -		/* Only use one channel with non DMA */
> -		usb->idle_hardware_channels = 0x1;
> -	} else if (OCTEON_IS_MODEL(OCTEON_CN5XXX)) {
> -		/* CN5XXX have an errata with channel 3 */
> -		usb->idle_hardware_channels = 0xf7;
> -	} else {
> -		usb->idle_hardware_channels = 0xff;
> -	}
> -
> -	status = cvmx_usb_initialize(dev, usb);
> -	if (status) {
> -		dev_dbg(dev, "USB initialization failed with %d\n", status);
> -		usb_put_hcd(hcd);
> -		return -1;
> -	}
> -
> -	status = usb_add_hcd(hcd, irq, 0);
> -	if (status) {
> -		dev_dbg(dev, "USB add HCD failed with %d\n", status);
> -		usb_put_hcd(hcd);
> -		return -1;
> -	}
> -	device_wakeup_enable(hcd->self.controller);
> -
> -	dev_info(dev, "Registered HCD for port %d on irq %d\n", usb_num, irq);
> -
> -	return 0;
> -}
> -
> -static int octeon_usb_remove(struct platform_device *pdev)
> -{
> -	int status;
> -	struct device *dev = &pdev->dev;
> -	struct usb_hcd *hcd = dev_get_drvdata(dev);
> -	struct octeon_hcd *usb = hcd_to_octeon(hcd);
> -	unsigned long flags;
> -
> -	usb_remove_hcd(hcd);
> -	spin_lock_irqsave(&usb->lock, flags);
> -	status = cvmx_usb_shutdown(usb);
> -	spin_unlock_irqrestore(&usb->lock, flags);
> -	if (status)
> -		dev_dbg(dev, "USB shutdown failed with %d\n", status);
> -
> -	usb_put_hcd(hcd);
> -
> -	return 0;
> -}
> -
> -static const struct of_device_id octeon_usb_match[] = {
> -	{
> -		.compatible = "cavium,octeon-5750-usbc",
> -	},
> -	{},
> -};
> -MODULE_DEVICE_TABLE(of, octeon_usb_match);
> -
> -static struct platform_driver octeon_usb_driver = {
> -	.driver = {
> -		.name		= "octeon-hcd",
> -		.of_match_table = octeon_usb_match,
> -	},
> -	.probe      = octeon_usb_probe,
> -	.remove     = octeon_usb_remove,
> -};
> -
> -static int __init octeon_usb_driver_init(void)
> -{
> -	if (usb_disabled())
> -		return 0;
> -
> -	return platform_driver_register(&octeon_usb_driver);
> -}
> -module_init(octeon_usb_driver_init);
> -
> -static void __exit octeon_usb_driver_exit(void)
> -{
> -	if (usb_disabled())
> -		return;
> -
> -	platform_driver_unregister(&octeon_usb_driver);
> -}
> -module_exit(octeon_usb_driver_exit);
> -
> -MODULE_LICENSE("GPL");
> -MODULE_AUTHOR("Cavium, Inc. <support@cavium.com>");
> -MODULE_DESCRIPTION("Cavium Inc. OCTEON USB Host driver.");
> diff --git a/drivers/staging/octeon-usb/octeon-hcd.h b/drivers/staging/octeon-usb/octeon-hcd.h
> deleted file mode 100644
> index 9ed619c93a4e..000000000000
> --- a/drivers/staging/octeon-usb/octeon-hcd.h
> +++ /dev/null
> @@ -1,1847 +0,0 @@
> -/* SPDX-License-Identifier: GPL-2.0 */
> -/*
> - * Octeon HCD hardware register definitions.
> - *
> - * This file is subject to the terms and conditions of the GNU General Public
> - * License. See the file "COPYING" in the main directory of this archive
> - * for more details.
> - *
> - * Some parts of the code were originally released under BSD license:
> - *
> - * Copyright (c) 2003-2010 Cavium Networks (support@cavium.com). All rights
> - * reserved.
> - *
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions are
> - * met:
> - *
> - *   * Redistributions of source code must retain the above copyright
> - *     notice, this list of conditions and the following disclaimer.
> - *
> - *   * Redistributions in binary form must reproduce the above
> - *     copyright notice, this list of conditions and the following
> - *     disclaimer in the documentation and/or other materials provided
> - *     with the distribution.
> - *
> - *   * Neither the name of Cavium Networks nor the names of
> - *     its contributors may be used to endorse or promote products
> - *     derived from this software without specific prior written
> - *     permission.
> - *
> - * This Software, including technical data, may be subject to U.S. export
> - * control laws, including the U.S. Export Administration Act and its associated
> - * regulations, and may be subject to export or import regulations in other
> - * countries.
> - *
> - * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
> - * AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR
> - * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
> - * THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION
> - * OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
> - * SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
> - * MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
> - * VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
> - * CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
> - * PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
> - */
> -
> -#ifndef __OCTEON_HCD_H__
> -#define __OCTEON_HCD_H__
> -
> -#include <asm/bitfield.h>
> -
> -#define CVMX_USBCXBASE 0x00016F0010000000ull
> -#define CVMX_USBCXREG1(reg, bid) \
> -	(CVMX_ADD_IO_SEG(CVMX_USBCXBASE | reg) + \
> -	 ((bid) & 1) * 0x100000000000ull)
> -#define CVMX_USBCXREG2(reg, bid, off) \
> -	(CVMX_ADD_IO_SEG(CVMX_USBCXBASE | reg) + \
> -	 (((off) & 7) + ((bid) & 1) * 0x8000000000ull) * 32)
> -
> -#define CVMX_USBCX_GAHBCFG(bid)		CVMX_USBCXREG1(0x008, bid)
> -#define CVMX_USBCX_GHWCFG3(bid)		CVMX_USBCXREG1(0x04c, bid)
> -#define CVMX_USBCX_GINTMSK(bid)		CVMX_USBCXREG1(0x018, bid)
> -#define CVMX_USBCX_GINTSTS(bid)		CVMX_USBCXREG1(0x014, bid)
> -#define CVMX_USBCX_GNPTXFSIZ(bid)	CVMX_USBCXREG1(0x028, bid)
> -#define CVMX_USBCX_GNPTXSTS(bid)	CVMX_USBCXREG1(0x02c, bid)
> -#define CVMX_USBCX_GOTGCTL(bid)		CVMX_USBCXREG1(0x000, bid)
> -#define CVMX_USBCX_GRSTCTL(bid)		CVMX_USBCXREG1(0x010, bid)
> -#define CVMX_USBCX_GRXFSIZ(bid)		CVMX_USBCXREG1(0x024, bid)
> -#define CVMX_USBCX_GRXSTSPH(bid)	CVMX_USBCXREG1(0x020, bid)
> -#define CVMX_USBCX_GUSBCFG(bid)		CVMX_USBCXREG1(0x00c, bid)
> -#define CVMX_USBCX_HAINT(bid)		CVMX_USBCXREG1(0x414, bid)
> -#define CVMX_USBCX_HAINTMSK(bid)	CVMX_USBCXREG1(0x418, bid)
> -#define CVMX_USBCX_HCCHARX(off, bid)	CVMX_USBCXREG2(0x500, bid, off)
> -#define CVMX_USBCX_HCFG(bid)		CVMX_USBCXREG1(0x400, bid)
> -#define CVMX_USBCX_HCINTMSKX(off, bid)	CVMX_USBCXREG2(0x50c, bid, off)
> -#define CVMX_USBCX_HCINTX(off, bid)	CVMX_USBCXREG2(0x508, bid, off)
> -#define CVMX_USBCX_HCSPLTX(off, bid)	CVMX_USBCXREG2(0x504, bid, off)
> -#define CVMX_USBCX_HCTSIZX(off, bid)	CVMX_USBCXREG2(0x510, bid, off)
> -#define CVMX_USBCX_HFIR(bid)		CVMX_USBCXREG1(0x404, bid)
> -#define CVMX_USBCX_HFNUM(bid)		CVMX_USBCXREG1(0x408, bid)
> -#define CVMX_USBCX_HPRT(bid)		CVMX_USBCXREG1(0x440, bid)
> -#define CVMX_USBCX_HPTXFSIZ(bid)	CVMX_USBCXREG1(0x100, bid)
> -#define CVMX_USBCX_HPTXSTS(bid)		CVMX_USBCXREG1(0x410, bid)
> -
> -#define CVMX_USBNXBID1(bid) (((bid) & 1) * 0x10000000ull)
> -#define CVMX_USBNXBID2(bid) (((bid) & 1) * 0x100000000000ull)
> -
> -#define CVMX_USBNXREG1(reg, bid) \
> -	(CVMX_ADD_IO_SEG(0x0001180068000000ull | reg) + CVMX_USBNXBID1(bid))
> -#define CVMX_USBNXREG2(reg, bid) \
> -	(CVMX_ADD_IO_SEG(0x00016F0000000000ull | reg) + CVMX_USBNXBID2(bid))
> -
> -#define CVMX_USBNX_CLK_CTL(bid)		CVMX_USBNXREG1(0x10, bid)
> -#define CVMX_USBNX_DMA0_INB_CHN0(bid)	CVMX_USBNXREG2(0x818, bid)
> -#define CVMX_USBNX_DMA0_OUTB_CHN0(bid)	CVMX_USBNXREG2(0x858, bid)
> -#define CVMX_USBNX_USBP_CTL_STATUS(bid)	CVMX_USBNXREG1(0x18, bid)
> -
> -/**
> - * cvmx_usbc#_gahbcfg
> - *
> - * Core AHB Configuration Register (GAHBCFG)
> - *
> - * This register can be used to configure the core after power-on or a change in
> - * mode of operation. This register mainly contains AHB system-related
> - * configuration parameters. The AHB is the processor interface to the O2P USB
> - * core. In general, software need not know about this interface except to
> - * program the values as specified.
> - *
> - * The application must program this register as part of the O2P USB core
> - * initialization. Do not change this register after the initial programming.
> - */
> -union cvmx_usbcx_gahbcfg {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_gahbcfg_s
> -	 * @ptxfemplvl: Periodic TxFIFO Empty Level (PTxFEmpLvl)
> -	 *	Software should set this bit to 0x1.
> -	 *	Indicates when the Periodic TxFIFO Empty Interrupt bit in the
> -	 *	Core Interrupt register (GINTSTS.PTxFEmp) is triggered. This
> -	 *	bit is used only in Slave mode.
> -	 *	* 1'b0: GINTSTS.PTxFEmp interrupt indicates that the Periodic
> -	 *	TxFIFO is half empty
> -	 *	* 1'b1: GINTSTS.PTxFEmp interrupt indicates that the Periodic
> -	 *	TxFIFO is completely empty
> -	 * @nptxfemplvl: Non-Periodic TxFIFO Empty Level (NPTxFEmpLvl)
> -	 *	Software should set this bit to 0x1.
> -	 *	Indicates when the Non-Periodic TxFIFO Empty Interrupt bit in
> -	 *	the Core Interrupt register (GINTSTS.NPTxFEmp) is triggered.
> -	 *	This bit is used only in Slave mode.
> -	 *	* 1'b0: GINTSTS.NPTxFEmp interrupt indicates that the Non-
> -	 *	Periodic TxFIFO is half empty
> -	 *	* 1'b1: GINTSTS.NPTxFEmp interrupt indicates that the Non-
> -	 *	Periodic TxFIFO is completely empty
> -	 * @dmaen: DMA Enable (DMAEn)
> -	 *	* 1'b0: Core operates in Slave mode
> -	 *	* 1'b1: Core operates in a DMA mode
> -	 * @hbstlen: Burst Length/Type (HBstLen)
> -	 *	This field has not effect and should be left as 0x0.
> -	 * @glblintrmsk: Global Interrupt Mask (GlblIntrMsk)
> -	 *	Software should set this field to 0x1.
> -	 *	The application uses this bit to mask or unmask the interrupt
> -	 *	line assertion to itself. Irrespective of this bit's setting,
> -	 *	the interrupt status registers are updated by the core.
> -	 *	* 1'b0: Mask the interrupt assertion to the application.
> -	 *	* 1'b1: Unmask the interrupt assertion to the application.
> -	 */
> -	struct cvmx_usbcx_gahbcfg_s {
> -		__BITFIELD_FIELD(u32 reserved_9_31	: 23,
> -		__BITFIELD_FIELD(u32 ptxfemplvl		: 1,
> -		__BITFIELD_FIELD(u32 nptxfemplvl	: 1,
> -		__BITFIELD_FIELD(u32 reserved_6_6	: 1,
> -		__BITFIELD_FIELD(u32 dmaen		: 1,
> -		__BITFIELD_FIELD(u32 hbstlen		: 4,
> -		__BITFIELD_FIELD(u32 glblintrmsk	: 1,
> -		;)))))))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_ghwcfg3
> - *
> - * User HW Config3 Register (GHWCFG3)
> - *
> - * This register contains the configuration options of the O2P USB core.
> - */
> -union cvmx_usbcx_ghwcfg3 {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_ghwcfg3_s
> -	 * @dfifodepth: DFIFO Depth (DfifoDepth)
> -	 *	This value is in terms of 32-bit words.
> -	 *	* Minimum value is 32
> -	 *	* Maximum value is 32768
> -	 * @ahbphysync: AHB and PHY Synchronous (AhbPhySync)
> -	 *	Indicates whether AHB and PHY clocks are synchronous to
> -	 *	each other.
> -	 *	* 1'b0: No
> -	 *	* 1'b1: Yes
> -	 *	This bit is tied to 1.
> -	 * @rsttype: Reset Style for Clocked always Blocks in RTL (RstType)
> -	 *	* 1'b0: Asynchronous reset is used in the core
> -	 *	* 1'b1: Synchronous reset is used in the core
> -	 * @optfeature: Optional Features Removed (OptFeature)
> -	 *	Indicates whether the User ID register, GPIO interface ports,
> -	 *	and SOF toggle and counter ports were removed for gate count
> -	 *	optimization.
> -	 * @vendor_control_interface_support: Vendor Control Interface Support
> -	 *	* 1'b0: Vendor Control Interface is not available on the core.
> -	 *	* 1'b1: Vendor Control Interface is available.
> -	 * @i2c_selection: I2C Selection
> -	 *	* 1'b0: I2C Interface is not available on the core.
> -	 *	* 1'b1: I2C Interface is available on the core.
> -	 * @otgen: OTG Function Enabled (OtgEn)
> -	 *	The application uses this bit to indicate the O2P USB core's
> -	 *	OTG capabilities.
> -	 *	* 1'b0: Not OTG capable
> -	 *	* 1'b1: OTG Capable
> -	 * @pktsizewidth: Width of Packet Size Counters (PktSizeWidth)
> -	 *	* 3'b000: 4 bits
> -	 *	* 3'b001: 5 bits
> -	 *	* 3'b010: 6 bits
> -	 *	* 3'b011: 7 bits
> -	 *	* 3'b100: 8 bits
> -	 *	* 3'b101: 9 bits
> -	 *	* 3'b110: 10 bits
> -	 *	* Others: Reserved
> -	 * @xfersizewidth: Width of Transfer Size Counters (XferSizeWidth)
> -	 *	* 4'b0000: 11 bits
> -	 *	* 4'b0001: 12 bits
> -	 *	- ...
> -	 *	* 4'b1000: 19 bits
> -	 *	* Others: Reserved
> -	 */
> -	struct cvmx_usbcx_ghwcfg3_s {
> -		__BITFIELD_FIELD(u32 dfifodepth				: 16,
> -		__BITFIELD_FIELD(u32 reserved_13_15			: 3,
> -		__BITFIELD_FIELD(u32 ahbphysync				: 1,
> -		__BITFIELD_FIELD(u32 rsttype				: 1,
> -		__BITFIELD_FIELD(u32 optfeature				: 1,
> -		__BITFIELD_FIELD(u32 vendor_control_interface_support	: 1,
> -		__BITFIELD_FIELD(u32 i2c_selection			: 1,
> -		__BITFIELD_FIELD(u32 otgen				: 1,
> -		__BITFIELD_FIELD(u32 pktsizewidth			: 3,
> -		__BITFIELD_FIELD(u32 xfersizewidth			: 4,
> -		;))))))))))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_gintmsk
> - *
> - * Core Interrupt Mask Register (GINTMSK)
> - *
> - * This register works with the Core Interrupt register to interrupt the
> - * application. When an interrupt bit is masked, the interrupt associated with
> - * that bit will not be generated. However, the Core Interrupt (GINTSTS)
> - * register bit corresponding to that interrupt will still be set.
> - * Mask interrupt: 1'b0, Unmask interrupt: 1'b1
> - */
> -union cvmx_usbcx_gintmsk {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_gintmsk_s
> -	 * @wkupintmsk: Resume/Remote Wakeup Detected Interrupt Mask
> -	 *	(WkUpIntMsk)
> -	 * @sessreqintmsk: Session Request/New Session Detected Interrupt Mask
> -	 *	(SessReqIntMsk)
> -	 * @disconnintmsk: Disconnect Detected Interrupt Mask (DisconnIntMsk)
> -	 * @conidstschngmsk: Connector ID Status Change Mask (ConIDStsChngMsk)
> -	 * @ptxfempmsk: Periodic TxFIFO Empty Mask (PTxFEmpMsk)
> -	 * @hchintmsk: Host Channels Interrupt Mask (HChIntMsk)
> -	 * @prtintmsk: Host Port Interrupt Mask (PrtIntMsk)
> -	 * @fetsuspmsk: Data Fetch Suspended Mask (FetSuspMsk)
> -	 * @incomplpmsk: Incomplete Periodic Transfer Mask (incomplPMsk)
> -	 *	Incomplete Isochronous OUT Transfer Mask
> -	 *	(incompISOOUTMsk)
> -	 * @incompisoinmsk: Incomplete Isochronous IN Transfer Mask
> -	 *		    (incompISOINMsk)
> -	 * @oepintmsk: OUT Endpoints Interrupt Mask (OEPIntMsk)
> -	 * @inepintmsk: IN Endpoints Interrupt Mask (INEPIntMsk)
> -	 * @epmismsk: Endpoint Mismatch Interrupt Mask (EPMisMsk)
> -	 * @eopfmsk: End of Periodic Frame Interrupt Mask (EOPFMsk)
> -	 * @isooutdropmsk: Isochronous OUT Packet Dropped Interrupt Mask
> -	 *	(ISOOutDropMsk)
> -	 * @enumdonemsk: Enumeration Done Mask (EnumDoneMsk)
> -	 * @usbrstmsk: USB Reset Mask (USBRstMsk)
> -	 * @usbsuspmsk: USB Suspend Mask (USBSuspMsk)
> -	 * @erlysuspmsk: Early Suspend Mask (ErlySuspMsk)
> -	 * @i2cint: I2C Interrupt Mask (I2CINT)
> -	 * @ulpickintmsk: ULPI Carkit Interrupt Mask (ULPICKINTMsk)
> -	 *	I2C Carkit Interrupt Mask (I2CCKINTMsk)
> -	 * @goutnakeffmsk: Global OUT NAK Effective Mask (GOUTNakEffMsk)
> -	 * @ginnakeffmsk: Global Non-Periodic IN NAK Effective Mask
> -	 *		  (GINNakEffMsk)
> -	 * @nptxfempmsk: Non-Periodic TxFIFO Empty Mask (NPTxFEmpMsk)
> -	 * @rxflvlmsk: Receive FIFO Non-Empty Mask (RxFLvlMsk)
> -	 * @sofmsk: Start of (micro)Frame Mask (SofMsk)
> -	 * @otgintmsk: OTG Interrupt Mask (OTGIntMsk)
> -	 * @modemismsk: Mode Mismatch Interrupt Mask (ModeMisMsk)
> -	 */
> -	struct cvmx_usbcx_gintmsk_s {
> -		__BITFIELD_FIELD(u32 wkupintmsk		: 1,
> -		__BITFIELD_FIELD(u32 sessreqintmsk	: 1,
> -		__BITFIELD_FIELD(u32 disconnintmsk	: 1,
> -		__BITFIELD_FIELD(u32 conidstschngmsk	: 1,
> -		__BITFIELD_FIELD(u32 reserved_27_27	: 1,
> -		__BITFIELD_FIELD(u32 ptxfempmsk		: 1,
> -		__BITFIELD_FIELD(u32 hchintmsk		: 1,
> -		__BITFIELD_FIELD(u32 prtintmsk		: 1,
> -		__BITFIELD_FIELD(u32 reserved_23_23	: 1,
> -		__BITFIELD_FIELD(u32 fetsuspmsk		: 1,
> -		__BITFIELD_FIELD(u32 incomplpmsk	: 1,
> -		__BITFIELD_FIELD(u32 incompisoinmsk	: 1,
> -		__BITFIELD_FIELD(u32 oepintmsk		: 1,
> -		__BITFIELD_FIELD(u32 inepintmsk		: 1,
> -		__BITFIELD_FIELD(u32 epmismsk		: 1,
> -		__BITFIELD_FIELD(u32 reserved_16_16	: 1,
> -		__BITFIELD_FIELD(u32 eopfmsk		: 1,
> -		__BITFIELD_FIELD(u32 isooutdropmsk	: 1,
> -		__BITFIELD_FIELD(u32 enumdonemsk	: 1,
> -		__BITFIELD_FIELD(u32 usbrstmsk		: 1,
> -		__BITFIELD_FIELD(u32 usbsuspmsk		: 1,
> -		__BITFIELD_FIELD(u32 erlysuspmsk	: 1,
> -		__BITFIELD_FIELD(u32 i2cint		: 1,
> -		__BITFIELD_FIELD(u32 ulpickintmsk	: 1,
> -		__BITFIELD_FIELD(u32 goutnakeffmsk	: 1,
> -		__BITFIELD_FIELD(u32 ginnakeffmsk	: 1,
> -		__BITFIELD_FIELD(u32 nptxfempmsk	: 1,
> -		__BITFIELD_FIELD(u32 rxflvlmsk		: 1,
> -		__BITFIELD_FIELD(u32 sofmsk		: 1,
> -		__BITFIELD_FIELD(u32 otgintmsk		: 1,
> -		__BITFIELD_FIELD(u32 modemismsk		: 1,
> -		__BITFIELD_FIELD(u32 reserved_0_0	: 1,
> -		;))))))))))))))))))))))))))))))))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_gintsts
> - *
> - * Core Interrupt Register (GINTSTS)
> - *
> - * This register interrupts the application for system-level events in the
> - * current mode of operation (Device mode or Host mode). It is shown in
> - * Interrupt. Some of the bits in this register are valid only in Host mode,
> - * while others are valid in Device mode only. This register also indicates the
> - * current mode of operation. In order to clear the interrupt status bits of
> - * type R_SS_WC, the application must write 1'b1 into the bit. The FIFO status
> - * interrupts are read only; once software reads from or writes to the FIFO
> - * while servicing these interrupts, FIFO interrupt conditions are cleared
> - * automatically.
> - */
> -union cvmx_usbcx_gintsts {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_gintsts_s
> -	 * @wkupint: Resume/Remote Wakeup Detected Interrupt (WkUpInt)
> -	 *	In Device mode, this interrupt is asserted when a resume is
> -	 *	detected on the USB. In Host mode, this interrupt is asserted
> -	 *	when a remote wakeup is detected on the USB.
> -	 *	For more information on how to use this interrupt, see "Partial
> -	 *	Power-Down and Clock Gating Programming Model" on
> -	 *	page 353.
> -	 * @sessreqint: Session Request/New Session Detected Interrupt
> -	 *		(SessReqInt)
> -	 *	In Host mode, this interrupt is asserted when a session request
> -	 *	is detected from the device. In Device mode, this interrupt is
> -	 *	asserted when the utmiotg_bvalid signal goes high.
> -	 *	For more information on how to use this interrupt, see "Partial
> -	 *	Power-Down and Clock Gating Programming Model" on
> -	 *	page 353.
> -	 * @disconnint: Disconnect Detected Interrupt (DisconnInt)
> -	 *	Asserted when a device disconnect is detected.
> -	 * @conidstschng: Connector ID Status Change (ConIDStsChng)
> -	 *	The core sets this bit when there is a change in connector ID
> -	 *	status.
> -	 * @ptxfemp: Periodic TxFIFO Empty (PTxFEmp)
> -	 *	Asserted when the Periodic Transmit FIFO is either half or
> -	 *	completely empty and there is space for at least one entry to be
> -	 *	written in the Periodic Request Queue. The half or completely
> -	 *	empty status is determined by the Periodic TxFIFO Empty Level
> -	 *	bit in the Core AHB Configuration register
> -	 *	(GAHBCFG.PTxFEmpLvl).
> -	 * @hchint: Host Channels Interrupt (HChInt)
> -	 *	The core sets this bit to indicate that an interrupt is pending
> -	 *	on one of the channels of the core (in Host mode). The
> -	 *	application must read the Host All Channels Interrupt (HAINT)
> -	 *	register to determine the exact number of the channel on which
> -	 *	the interrupt occurred, and then read the corresponding Host
> -	 *	Channel-n Interrupt (HCINTn) register to determine the exact
> -	 *	cause of the interrupt. The application must clear the
> -	 *	appropriate status bit in the HCINTn register to clear this bit.
> -	 * @prtint: Host Port Interrupt (PrtInt)
> -	 *	The core sets this bit to indicate a change in port status of
> -	 *	one of the O2P USB core ports in Host mode. The application must
> -	 *	read the Host Port Control and Status (HPRT) register to
> -	 *	determine the exact event that caused this interrupt. The
> -	 *	application must clear the appropriate status bit in the Host
> -	 *	Port Control and Status register to clear this bit.
> -	 * @fetsusp: Data Fetch Suspended (FetSusp)
> -	 *	This interrupt is valid only in DMA mode. This interrupt
> -	 *	indicates that the core has stopped fetching data for IN
> -	 *	endpoints due to the unavailability of TxFIFO space or Request
> -	 *	Queue space. This interrupt is used by the application for an
> -	 *	endpoint mismatch algorithm.
> -	 * @incomplp: Incomplete Periodic Transfer (incomplP)
> -	 *	In Host mode, the core sets this interrupt bit when there are
> -	 *	incomplete periodic transactions still pending which are
> -	 *	scheduled for the current microframe.
> -	 *	Incomplete Isochronous OUT Transfer (incompISOOUT)
> -	 *	The Device mode, the core sets this interrupt to indicate that
> -	 *	there is at least one isochronous OUT endpoint on which the
> -	 *	transfer is not completed in the current microframe. This
> -	 *	interrupt is asserted along with the End of Periodic Frame
> -	 *	Interrupt (EOPF) bit in this register.
> -	 * @incompisoin: Incomplete Isochronous IN Transfer (incompISOIN)
> -	 *	The core sets this interrupt to indicate that there is at least
> -	 *	one isochronous IN endpoint on which the transfer is not
> -	 *	completed in the current microframe. This interrupt is asserted
> -	 *	along with the End of Periodic Frame Interrupt (EOPF) bit in
> -	 *	this register.
> -	 * @oepint: OUT Endpoints Interrupt (OEPInt)
> -	 *	The core sets this bit to indicate that an interrupt is pending
> -	 *	on one of the OUT endpoints of the core (in Device mode). The
> -	 *	application must read the Device All Endpoints Interrupt
> -	 *	(DAINT) register to determine the exact number of the OUT
> -	 *	endpoint on which the interrupt occurred, and then read the
> -	 *	corresponding Device OUT Endpoint-n Interrupt (DOEPINTn)
> -	 *	register to determine the exact cause of the interrupt. The
> -	 *	application must clear the appropriate status bit in the
> -	 *	corresponding DOEPINTn register to clear this bit.
> -	 * @iepint: IN Endpoints Interrupt (IEPInt)
> -	 *	The core sets this bit to indicate that an interrupt is pending
> -	 *	on one of the IN endpoints of the core (in Device mode). The
> -	 *	application must read the Device All Endpoints Interrupt
> -	 *	(DAINT) register to determine the exact number of the IN
> -	 *	endpoint on which the interrupt occurred, and then read the
> -	 *	corresponding Device IN Endpoint-n Interrupt (DIEPINTn)
> -	 *	register to determine the exact cause of the interrupt. The
> -	 *	application must clear the appropriate status bit in the
> -	 *	corresponding DIEPINTn register to clear this bit.
> -	 * @epmis: Endpoint Mismatch Interrupt (EPMis)
> -	 *	Indicates that an IN token has been received for a non-periodic
> -	 *	endpoint, but the data for another endpoint is present in the
> -	 *	top of the Non-Periodic Transmit FIFO and the IN endpoint
> -	 *	mismatch count programmed by the application has expired.
> -	 * @eopf: End of Periodic Frame Interrupt (EOPF)
> -	 *	Indicates that the period specified in the Periodic Frame
> -	 *	Interval field of the Device Configuration register
> -	 *	(DCFG.PerFrInt) has been reached in the current microframe.
> -	 * @isooutdrop: Isochronous OUT Packet Dropped Interrupt (ISOOutDrop)
> -	 *	The core sets this bit when it fails to write an isochronous OUT
> -	 *	packet into the RxFIFO because the RxFIFO doesn't have
> -	 *	enough space to accommodate a maximum packet size packet
> -	 *	for the isochronous OUT endpoint.
> -	 * @enumdone: Enumeration Done (EnumDone)
> -	 *	The core sets this bit to indicate that speed enumeration is
> -	 *	complete. The application must read the Device Status (DSTS)
> -	 *	register to obtain the enumerated speed.
> -	 * @usbrst: USB Reset (USBRst)
> -	 *	The core sets this bit to indicate that a reset is detected on
> -	 *	the USB.
> -	 * @usbsusp: USB Suspend (USBSusp)
> -	 *	The core sets this bit to indicate that a suspend was detected
> -	 *	on the USB. The core enters the Suspended state when there
> -	 *	is no activity on the phy_line_state_i signal for an extended
> -	 *	period of time.
> -	 * @erlysusp: Early Suspend (ErlySusp)
> -	 *	The core sets this bit to indicate that an Idle state has been
> -	 *	detected on the USB for 3 ms.
> -	 * @i2cint: I2C Interrupt (I2CINT)
> -	 *	This bit is always 0x0.
> -	 * @ulpickint: ULPI Carkit Interrupt (ULPICKINT)
> -	 *	This bit is always 0x0.
> -	 * @goutnakeff: Global OUT NAK Effective (GOUTNakEff)
> -	 *	Indicates that the Set Global OUT NAK bit in the Device Control
> -	 *	register (DCTL.SGOUTNak), set by the application, has taken
> -	 *	effect in the core. This bit can be cleared by writing the Clear
> -	 *	Global OUT NAK bit in the Device Control register
> -	 *	(DCTL.CGOUTNak).
> -	 * @ginnakeff: Global IN Non-Periodic NAK Effective (GINNakEff)
> -	 *	Indicates that the Set Global Non-Periodic IN NAK bit in the
> -	 *	Device Control register (DCTL.SGNPInNak), set by the
> -	 *	application, has taken effect in the core. That is, the core has
> -	 *	sampled the Global IN NAK bit set by the application. This bit
> -	 *	can be cleared by clearing the Clear Global Non-Periodic IN
> -	 *	NAK bit in the Device Control register (DCTL.CGNPInNak).
> -	 *	This interrupt does not necessarily mean that a NAK handshake
> -	 *	is sent out on the USB. The STALL bit takes precedence over
> -	 *	the NAK bit.
> -	 * @nptxfemp: Non-Periodic TxFIFO Empty (NPTxFEmp)
> -	 *	This interrupt is asserted when the Non-Periodic TxFIFO is
> -	 *	either half or completely empty, and there is space for at least
> -	 *	one entry to be written to the Non-Periodic Transmit Request
> -	 *	Queue. The half or completely empty status is determined by
> -	 *	the Non-Periodic TxFIFO Empty Level bit in the Core AHB
> -	 *	Configuration register (GAHBCFG.NPTxFEmpLvl).
> -	 * @rxflvl: RxFIFO Non-Empty (RxFLvl)
> -	 *	Indicates that there is at least one packet pending to be read
> -	 *	from the RxFIFO.
> -	 * @sof: Start of (micro)Frame (Sof)
> -	 *	In Host mode, the core sets this bit to indicate that an SOF
> -	 *	(FS), micro-SOF (HS), or Keep-Alive (LS) is transmitted on the
> -	 *	USB. The application must write a 1 to this bit to clear the
> -	 *	interrupt.
> -	 *	In Device mode, in the core sets this bit to indicate that an
> -	 *	SOF token has been received on the USB. The application can read
> -	 *	the Device Status register to get the current (micro)frame
> -	 *	number. This interrupt is seen only when the core is operating
> -	 *	at either HS or FS.
> -	 * @otgint: OTG Interrupt (OTGInt)
> -	 *	The core sets this bit to indicate an OTG protocol event. The
> -	 *	application must read the OTG Interrupt Status (GOTGINT)
> -	 *	register to determine the exact event that caused this
> -	 *	interrupt. The application must clear the appropriate status bit
> -	 *	in the GOTGINT register to clear this bit.
> -	 * @modemis: Mode Mismatch Interrupt (ModeMis)
> -	 *	The core sets this bit when the application is trying to access:
> -	 *	* A Host mode register, when the core is operating in Device
> -	 *	mode
> -	 *	* A Device mode register, when the core is operating in Host
> -	 *	mode
> -	 *	The register access is completed on the AHB with an OKAY
> -	 *	response, but is ignored by the core internally and doesn't
> -	 *	affect the operation of the core.
> -	 * @curmod: Current Mode of Operation (CurMod)
> -	 *	Indicates the current mode of operation.
> -	 *	* 1'b0: Device mode
> -	 *	* 1'b1: Host mode
> -	 */
> -	struct cvmx_usbcx_gintsts_s {
> -		__BITFIELD_FIELD(u32 wkupint		: 1,
> -		__BITFIELD_FIELD(u32 sessreqint		: 1,
> -		__BITFIELD_FIELD(u32 disconnint		: 1,
> -		__BITFIELD_FIELD(u32 conidstschng	: 1,
> -		__BITFIELD_FIELD(u32 reserved_27_27	: 1,
> -		__BITFIELD_FIELD(u32 ptxfemp		: 1,
> -		__BITFIELD_FIELD(u32 hchint		: 1,
> -		__BITFIELD_FIELD(u32 prtint		: 1,
> -		__BITFIELD_FIELD(u32 reserved_23_23	: 1,
> -		__BITFIELD_FIELD(u32 fetsusp		: 1,
> -		__BITFIELD_FIELD(u32 incomplp		: 1,
> -		__BITFIELD_FIELD(u32 incompisoin	: 1,
> -		__BITFIELD_FIELD(u32 oepint		: 1,
> -		__BITFIELD_FIELD(u32 iepint		: 1,
> -		__BITFIELD_FIELD(u32 epmis		: 1,
> -		__BITFIELD_FIELD(u32 reserved_16_16	: 1,
> -		__BITFIELD_FIELD(u32 eopf		: 1,
> -		__BITFIELD_FIELD(u32 isooutdrop		: 1,
> -		__BITFIELD_FIELD(u32 enumdone		: 1,
> -		__BITFIELD_FIELD(u32 usbrst		: 1,
> -		__BITFIELD_FIELD(u32 usbsusp		: 1,
> -		__BITFIELD_FIELD(u32 erlysusp		: 1,
> -		__BITFIELD_FIELD(u32 i2cint		: 1,
> -		__BITFIELD_FIELD(u32 ulpickint		: 1,
> -		__BITFIELD_FIELD(u32 goutnakeff		: 1,
> -		__BITFIELD_FIELD(u32 ginnakeff		: 1,
> -		__BITFIELD_FIELD(u32 nptxfemp		: 1,
> -		__BITFIELD_FIELD(u32 rxflvl		: 1,
> -		__BITFIELD_FIELD(u32 sof		: 1,
> -		__BITFIELD_FIELD(u32 otgint		: 1,
> -		__BITFIELD_FIELD(u32 modemis		: 1,
> -		__BITFIELD_FIELD(u32 curmod		: 1,
> -		;))))))))))))))))))))))))))))))))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_gnptxfsiz
> - *
> - * Non-Periodic Transmit FIFO Size Register (GNPTXFSIZ)
> - *
> - * The application can program the RAM size and the memory start address for the
> - * Non-Periodic TxFIFO.
> - */
> -union cvmx_usbcx_gnptxfsiz {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_gnptxfsiz_s
> -	 * @nptxfdep: Non-Periodic TxFIFO Depth (NPTxFDep)
> -	 *	This value is in terms of 32-bit words.
> -	 *	Minimum value is 16
> -	 *	Maximum value is 32768
> -	 * @nptxfstaddr: Non-Periodic Transmit RAM Start Address (NPTxFStAddr)
> -	 *	This field contains the memory start address for Non-Periodic
> -	 *	Transmit FIFO RAM.
> -	 */
> -	struct cvmx_usbcx_gnptxfsiz_s {
> -		__BITFIELD_FIELD(u32 nptxfdep		: 16,
> -		__BITFIELD_FIELD(u32 nptxfstaddr	: 16,
> -		;))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_gnptxsts
> - *
> - * Non-Periodic Transmit FIFO/Queue Status Register (GNPTXSTS)
> - *
> - * This read-only register contains the free space information for the
> - * Non-Periodic TxFIFO and the Non-Periodic Transmit Request Queue.
> - */
> -union cvmx_usbcx_gnptxsts {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_gnptxsts_s
> -	 * @nptxqtop: Top of the Non-Periodic Transmit Request Queue (NPTxQTop)
> -	 *	Entry in the Non-Periodic Tx Request Queue that is currently
> -	 *	being processed by the MAC.
> -	 *	* Bits [30:27]: Channel/endpoint number
> -	 *	* Bits [26:25]:
> -	 *	- 2'b00: IN/OUT token
> -	 *	- 2'b01: Zero-length transmit packet (device IN/host OUT)
> -	 *	- 2'b10: PING/CSPLIT token
> -	 *	- 2'b11: Channel halt command
> -	 *	* Bit [24]: Terminate (last entry for selected channel/endpoint)
> -	 * @nptxqspcavail: Non-Periodic Transmit Request Queue Space Available
> -	 *	(NPTxQSpcAvail)
> -	 *	Indicates the amount of free space available in the Non-
> -	 *	Periodic Transmit Request Queue. This queue holds both IN
> -	 *	and OUT requests in Host mode. Device mode has only IN
> -	 *	requests.
> -	 *	* 8'h0: Non-Periodic Transmit Request Queue is full
> -	 *	* 8'h1: 1 location available
> -	 *	* 8'h2: 2 locations available
> -	 *	* n: n locations available (0..8)
> -	 *	* Others: Reserved
> -	 * @nptxfspcavail: Non-Periodic TxFIFO Space Avail (NPTxFSpcAvail)
> -	 *	Indicates the amount of free space available in the Non-
> -	 *	Periodic TxFIFO.
> -	 *	Values are in terms of 32-bit words.
> -	 *	* 16'h0: Non-Periodic TxFIFO is full
> -	 *	* 16'h1: 1 word available
> -	 *	* 16'h2: 2 words available
> -	 *	* 16'hn: n words available (where 0..32768)
> -	 *	* 16'h8000: 32768 words available
> -	 *	* Others: Reserved
> -	 */
> -	struct cvmx_usbcx_gnptxsts_s {
> -		__BITFIELD_FIELD(u32 reserved_31_31	: 1,
> -		__BITFIELD_FIELD(u32 nptxqtop		: 7,
> -		__BITFIELD_FIELD(u32 nptxqspcavail	: 8,
> -		__BITFIELD_FIELD(u32 nptxfspcavail	: 16,
> -		;))))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_grstctl
> - *
> - * Core Reset Register (GRSTCTL)
> - *
> - * The application uses this register to reset various hardware features inside
> - * the core.
> - */
> -union cvmx_usbcx_grstctl {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_grstctl_s
> -	 * @ahbidle: AHB Master Idle (AHBIdle)
> -	 *	Indicates that the AHB Master State Machine is in the IDLE
> -	 *	condition.
> -	 * @dmareq: DMA Request Signal (DMAReq)
> -	 *	Indicates that the DMA request is in progress. Used for debug.
> -	 * @txfnum: TxFIFO Number (TxFNum)
> -	 *	This is the FIFO number that must be flushed using the TxFIFO
> -	 *	Flush bit. This field must not be changed until the core clears
> -	 *	the TxFIFO Flush bit.
> -	 *	* 5'h0: Non-Periodic TxFIFO flush
> -	 *	* 5'h1: Periodic TxFIFO 1 flush in Device mode or Periodic
> -	 *	TxFIFO flush in Host mode
> -	 *	* 5'h2: Periodic TxFIFO 2 flush in Device mode
> -	 *	- ...
> -	 *	* 5'hF: Periodic TxFIFO 15 flush in Device mode
> -	 *	* 5'h10: Flush all the Periodic and Non-Periodic TxFIFOs in the
> -	 *	core
> -	 * @txfflsh: TxFIFO Flush (TxFFlsh)
> -	 *	This bit selectively flushes a single or all transmit FIFOs, but
> -	 *	cannot do so if the core is in the midst of a transaction.
> -	 *	The application must only write this bit after checking that the
> -	 *	core is neither writing to the TxFIFO nor reading from the
> -	 *	TxFIFO.
> -	 *	The application must wait until the core clears this bit before
> -	 *	performing any operations. This bit takes 8 clocks (of phy_clk
> -	 *	or hclk, whichever is slower) to clear.
> -	 * @rxfflsh: RxFIFO Flush (RxFFlsh)
> -	 *	The application can flush the entire RxFIFO using this bit, but
> -	 *	must first ensure that the core is not in the middle of a
> -	 *	transaction.
> -	 *	The application must only write to this bit after checking that
> -	 *	the core is neither reading from the RxFIFO nor writing to the
> -	 *	RxFIFO.
> -	 *	The application must wait until the bit is cleared before
> -	 *	performing any other operations. This bit will take 8 clocks
> -	 *	(slowest of PHY or AHB clock) to clear.
> -	 * @intknqflsh: IN Token Sequence Learning Queue Flush (INTknQFlsh)
> -	 *	The application writes this bit to flush the IN Token Sequence
> -	 *	Learning Queue.
> -	 * @frmcntrrst: Host Frame Counter Reset (FrmCntrRst)
> -	 *	The application writes this bit to reset the (micro)frame number
> -	 *	counter inside the core. When the (micro)frame counter is reset,
> -	 *	the subsequent SOF sent out by the core will have a
> -	 *	(micro)frame number of 0.
> -	 * @hsftrst: HClk Soft Reset (HSftRst)
> -	 *	The application uses this bit to flush the control logic in the
> -	 *	AHB Clock domain. Only AHB Clock Domain pipelines are reset.
> -	 *	* FIFOs are not flushed with this bit.
> -	 *	* All state machines in the AHB clock domain are reset to the
> -	 *	Idle state after terminating the transactions on the AHB,
> -	 *	following the protocol.
> -	 *	* CSR control bits used by the AHB clock domain state
> -	 *	machines are cleared.
> -	 *	* To clear this interrupt, status mask bits that control the
> -	 *	interrupt status and are generated by the AHB clock domain
> -	 *	state machine are cleared.
> -	 *	* Because interrupt status bits are not cleared, the application
> -	 *	can get the status of any core events that occurred after it set
> -	 *	this bit.
> -	 *	This is a self-clearing bit that the core clears after all
> -	 *	necessary logic is reset in the core. This may take several
> -	 *	clocks, depending on the core's current state.
> -	 * @csftrst: Core Soft Reset (CSftRst)
> -	 *	Resets the hclk and phy_clock domains as follows:
> -	 *	* Clears the interrupts and all the CSR registers except the
> -	 *	following register bits:
> -	 *	- PCGCCTL.RstPdwnModule
> -	 *	- PCGCCTL.GateHclk
> -	 *	- PCGCCTL.PwrClmp
> -	 *	- PCGCCTL.StopPPhyLPwrClkSelclk
> -	 *	- GUSBCFG.PhyLPwrClkSel
> -	 *	- GUSBCFG.DDRSel
> -	 *	- GUSBCFG.PHYSel
> -	 *	- GUSBCFG.FSIntf
> -	 *	- GUSBCFG.ULPI_UTMI_Sel
> -	 *	- GUSBCFG.PHYIf
> -	 *	- HCFG.FSLSPclkSel
> -	 *	- DCFG.DevSpd
> -	 *	* All module state machines (except the AHB Slave Unit) are
> -	 *	reset to the IDLE state, and all the transmit FIFOs and the
> -	 *	receive FIFO are flushed.
> -	 *	* Any transactions on the AHB Master are terminated as soon
> -	 *	as possible, after gracefully completing the last data phase of
> -	 *	an AHB transfer. Any transactions on the USB are terminated
> -	 *	immediately.
> -	 *	The application can write to this bit any time it wants to reset
> -	 *	the core. This is a self-clearing bit and the core clears this
> -	 *	bit after all the necessary logic is reset in the core, which
> -	 *	may take several clocks, depending on the current state of the
> -	 *	core. Once this bit is cleared software should wait at least 3
> -	 *	PHY clocks before doing any access to the PHY domain
> -	 *	(synchronization delay). Software should also should check that
> -	 *	bit 31 of this register is 1 (AHB Master is IDLE) before
> -	 *	starting any operation.
> -	 *	Typically software reset is used during software development
> -	 *	and also when you dynamically change the PHY selection bits
> -	 *	in the USB configuration registers listed above. When you
> -	 *	change the PHY, the corresponding clock for the PHY is
> -	 *	selected and used in the PHY domain. Once a new clock is
> -	 *	selected, the PHY domain has to be reset for proper operation.
> -	 */
> -	struct cvmx_usbcx_grstctl_s {
> -		__BITFIELD_FIELD(u32 ahbidle		: 1,
> -		__BITFIELD_FIELD(u32 dmareq		: 1,
> -		__BITFIELD_FIELD(u32 reserved_11_29	: 19,
> -		__BITFIELD_FIELD(u32 txfnum		: 5,
> -		__BITFIELD_FIELD(u32 txfflsh		: 1,
> -		__BITFIELD_FIELD(u32 rxfflsh		: 1,
> -		__BITFIELD_FIELD(u32 intknqflsh		: 1,
> -		__BITFIELD_FIELD(u32 frmcntrrst		: 1,
> -		__BITFIELD_FIELD(u32 hsftrst		: 1,
> -		__BITFIELD_FIELD(u32 csftrst		: 1,
> -		;))))))))))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_grxfsiz
> - *
> - * Receive FIFO Size Register (GRXFSIZ)
> - *
> - * The application can program the RAM size that must be allocated to the
> - * RxFIFO.
> - */
> -union cvmx_usbcx_grxfsiz {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_grxfsiz_s
> -	 * @rxfdep: RxFIFO Depth (RxFDep)
> -	 *	This value is in terms of 32-bit words.
> -	 *	* Minimum value is 16
> -	 *	* Maximum value is 32768
> -	 */
> -	struct cvmx_usbcx_grxfsiz_s {
> -		__BITFIELD_FIELD(u32 reserved_16_31	: 16,
> -		__BITFIELD_FIELD(u32 rxfdep		: 16,
> -		;))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_grxstsph
> - *
> - * Receive Status Read and Pop Register, Host Mode (GRXSTSPH)
> - *
> - * A read to the Receive Status Read and Pop register returns and additionally
> - * pops the top data entry out of the RxFIFO.
> - * This Description is only valid when the core is in Host Mode. For Device Mode
> - * use USBC_GRXSTSPD instead.
> - * NOTE: GRXSTSPH and GRXSTSPD are physically the same register and share the
> - *	 same offset in the O2P USB core. The offset difference shown in this
> - *	 document is for software clarity and is actually ignored by the
> - *       hardware.
> - */
> -union cvmx_usbcx_grxstsph {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_grxstsph_s
> -	 * @pktsts: Packet Status (PktSts)
> -	 *	Indicates the status of the received packet
> -	 *	* 4'b0010: IN data packet received
> -	 *	* 4'b0011: IN transfer completed (triggers an interrupt)
> -	 *	* 4'b0101: Data toggle error (triggers an interrupt)
> -	 *	* 4'b0111: Channel halted (triggers an interrupt)
> -	 *	* Others: Reserved
> -	 * @dpid: Data PID (DPID)
> -	 *	* 2'b00: DATA0
> -	 *	* 2'b10: DATA1
> -	 *	* 2'b01: DATA2
> -	 *	* 2'b11: MDATA
> -	 * @bcnt: Byte Count (BCnt)
> -	 *	Indicates the byte count of the received IN data packet
> -	 * @chnum: Channel Number (ChNum)
> -	 *	Indicates the channel number to which the current received
> -	 *	packet belongs.
> -	 */
> -	struct cvmx_usbcx_grxstsph_s {
> -		__BITFIELD_FIELD(u32 reserved_21_31	: 11,
> -		__BITFIELD_FIELD(u32 pktsts		: 4,
> -		__BITFIELD_FIELD(u32 dpid		: 2,
> -		__BITFIELD_FIELD(u32 bcnt		: 11,
> -		__BITFIELD_FIELD(u32 chnum		: 4,
> -		;)))))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_gusbcfg
> - *
> - * Core USB Configuration Register (GUSBCFG)
> - *
> - * This register can be used to configure the core after power-on or a changing
> - * to Host mode or Device mode. It contains USB and USB-PHY related
> - * configuration parameters. The application must program this register before
> - * starting any transactions on either the AHB or the USB. Do not make changes
> - * to this register after the initial programming.
> - */
> -union cvmx_usbcx_gusbcfg {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_gusbcfg_s
> -	 * @otgi2csel: UTMIFS or I2C Interface Select (OtgI2CSel)
> -	 *	This bit is always 0x0.
> -	 * @phylpwrclksel: PHY Low-Power Clock Select (PhyLPwrClkSel)
> -	 *	Software should set this bit to 0x0.
> -	 *	Selects either 480-MHz or 48-MHz (low-power) PHY mode. In
> -	 *	FS and LS modes, the PHY can usually operate on a 48-MHz
> -	 *	clock to save power.
> -	 *	* 1'b0: 480-MHz Internal PLL clock
> -	 *	* 1'b1: 48-MHz External Clock
> -	 *	In 480 MHz mode, the UTMI interface operates at either 60 or
> -	 *	30-MHz, depending upon whether 8- or 16-bit data width is
> -	 *	selected. In 48-MHz mode, the UTMI interface operates at 48
> -	 *	MHz in FS mode and at either 48 or 6 MHz in LS mode
> -	 *	(depending on the PHY vendor).
> -	 *	This bit drives the utmi_fsls_low_power core output signal, and
> -	 *	is valid only for UTMI+ PHYs.
> -	 * @usbtrdtim: USB Turnaround Time (USBTrdTim)
> -	 *	Sets the turnaround time in PHY clocks.
> -	 *	Specifies the response time for a MAC request to the Packet
> -	 *	FIFO Controller (PFC) to fetch data from the DFIFO (SPRAM).
> -	 *	This must be programmed to 0x5.
> -	 * @hnpcap: HNP-Capable (HNPCap)
> -	 *	This bit is always 0x0.
> -	 * @srpcap: SRP-Capable (SRPCap)
> -	 *	This bit is always 0x0.
> -	 * @ddrsel: ULPI DDR Select (DDRSel)
> -	 *	Software should set this bit to 0x0.
> -	 * @physel: USB 2.0 High-Speed PHY or USB 1.1 Full-Speed Serial
> -	 *	Software should set this bit to 0x0.
> -	 * @fsintf: Full-Speed Serial Interface Select (FSIntf)
> -	 *	Software should set this bit to 0x0.
> -	 * @ulpi_utmi_sel: ULPI or UTMI+ Select (ULPI_UTMI_Sel)
> -	 *	This bit is always 0x0.
> -	 * @phyif: PHY Interface (PHYIf)
> -	 *	This bit is always 0x1.
> -	 * @toutcal: HS/FS Timeout Calibration (TOutCal)
> -	 *	The number of PHY clocks that the application programs in this
> -	 *	field is added to the high-speed/full-speed interpacket timeout
> -	 *	duration in the core to account for any additional delays
> -	 *	introduced by the PHY. This may be required, since the delay
> -	 *	introduced by the PHY in generating the linestate condition may
> -	 *	vary from one PHY to another.
> -	 *	The USB standard timeout value for high-speed operation is
> -	 *	736 to 816 (inclusive) bit times. The USB standard timeout
> -	 *	value for full-speed operation is 16 to 18 (inclusive) bit
> -	 *	times. The application must program this field based on the
> -	 *	speed of enumeration. The number of bit times added per PHY
> -	 *	clock are:
> -	 *	High-speed operation:
> -	 *	* One 30-MHz PHY clock = 16 bit times
> -	 *	* One 60-MHz PHY clock = 8 bit times
> -	 *	Full-speed operation:
> -	 *	* One 30-MHz PHY clock = 0.4 bit times
> -	 *	* One 60-MHz PHY clock = 0.2 bit times
> -	 *	* One 48-MHz PHY clock = 0.25 bit times
> -	 */
> -	struct cvmx_usbcx_gusbcfg_s {
> -		__BITFIELD_FIELD(u32 reserved_17_31	: 15,
> -		__BITFIELD_FIELD(u32 otgi2csel		: 1,
> -		__BITFIELD_FIELD(u32 phylpwrclksel	: 1,
> -		__BITFIELD_FIELD(u32 reserved_14_14	: 1,
> -		__BITFIELD_FIELD(u32 usbtrdtim		: 4,
> -		__BITFIELD_FIELD(u32 hnpcap		: 1,
> -		__BITFIELD_FIELD(u32 srpcap		: 1,
> -		__BITFIELD_FIELD(u32 ddrsel		: 1,
> -		__BITFIELD_FIELD(u32 physel		: 1,
> -		__BITFIELD_FIELD(u32 fsintf		: 1,
> -		__BITFIELD_FIELD(u32 ulpi_utmi_sel	: 1,
> -		__BITFIELD_FIELD(u32 phyif		: 1,
> -		__BITFIELD_FIELD(u32 toutcal		: 3,
> -		;)))))))))))))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_haint
> - *
> - * Host All Channels Interrupt Register (HAINT)
> - *
> - * When a significant event occurs on a channel, the Host All Channels Interrupt
> - * register interrupts the application using the Host Channels Interrupt bit of
> - * the Core Interrupt register (GINTSTS.HChInt). This is shown in Interrupt.
> - * There is one interrupt bit per channel, up to a maximum of 16 bits. Bits in
> - * this register are set and cleared when the application sets and clears bits
> - * in the corresponding Host Channel-n Interrupt register.
> - */
> -union cvmx_usbcx_haint {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_haint_s
> -	 * @haint: Channel Interrupts (HAINT)
> -	 *	One bit per channel: Bit 0 for Channel 0, bit 15 for Channel 15
> -	 */
> -	struct cvmx_usbcx_haint_s {
> -		__BITFIELD_FIELD(u32 reserved_16_31	: 16,
> -		__BITFIELD_FIELD(u32 haint		: 16,
> -		;))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_haintmsk
> - *
> - * Host All Channels Interrupt Mask Register (HAINTMSK)
> - *
> - * The Host All Channel Interrupt Mask register works with the Host All Channel
> - * Interrupt register to interrupt the application when an event occurs on a
> - * channel. There is one interrupt mask bit per channel, up to a maximum of 16
> - * bits.
> - * Mask interrupt: 1'b0 Unmask interrupt: 1'b1
> - */
> -union cvmx_usbcx_haintmsk {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_haintmsk_s
> -	 * @haintmsk: Channel Interrupt Mask (HAINTMsk)
> -	 *	One bit per channel: Bit 0 for channel 0, bit 15 for channel 15
> -	 */
> -	struct cvmx_usbcx_haintmsk_s {
> -		__BITFIELD_FIELD(u32 reserved_16_31	: 16,
> -		__BITFIELD_FIELD(u32 haintmsk		: 16,
> -		;))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_hcchar#
> - *
> - * Host Channel-n Characteristics Register (HCCHAR)
> - *
> - */
> -union cvmx_usbcx_hccharx {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_hccharx_s
> -	 * @chena: Channel Enable (ChEna)
> -	 *	This field is set by the application and cleared by the OTG
> -	 *	host.
> -	 *	* 1'b0: Channel disabled
> -	 *	* 1'b1: Channel enabled
> -	 * @chdis: Channel Disable (ChDis)
> -	 *	The application sets this bit to stop transmitting/receiving
> -	 *	data on a channel, even before the transfer for that channel is
> -	 *	complete. The application must wait for the Channel Disabled
> -	 *	interrupt before treating the channel as disabled.
> -	 * @oddfrm: Odd Frame (OddFrm)
> -	 *	This field is set (reset) by the application to indicate that
> -	 *	the OTG host must perform a transfer in an odd (micro)frame.
> -	 *	This field is applicable for only periodic (isochronous and
> -	 *	interrupt) transactions.
> -	 *	* 1'b0: Even (micro)frame
> -	 *	* 1'b1: Odd (micro)frame
> -	 * @devaddr: Device Address (DevAddr)
> -	 *	This field selects the specific device serving as the data
> -	 *	source or sink.
> -	 * @ec: Multi Count (MC) / Error Count (EC)
> -	 *	When the Split Enable bit of the Host Channel-n Split Control
> -	 *	register (HCSPLTn.SpltEna) is reset (1'b0), this field indicates
> -	 *	to the host the number of transactions that should be executed
> -	 *	per microframe for this endpoint.
> -	 *	* 2'b00: Reserved. This field yields undefined results.
> -	 *	* 2'b01: 1 transaction
> -	 *	* 2'b10: 2 transactions to be issued for this endpoint per
> -	 *	microframe
> -	 *	* 2'b11: 3 transactions to be issued for this endpoint per
> -	 *	microframe
> -	 *	When HCSPLTn.SpltEna is set (1'b1), this field indicates the
> -	 *	number of immediate retries to be performed for a periodic split
> -	 *	transactions on transaction errors. This field must be set to at
> -	 *	least 2'b01.
> -	 * @eptype: Endpoint Type (EPType)
> -	 *	Indicates the transfer type selected.
> -	 *	* 2'b00: Control
> -	 *	* 2'b01: Isochronous
> -	 *	* 2'b10: Bulk
> -	 *	* 2'b11: Interrupt
> -	 * @lspddev: Low-Speed Device (LSpdDev)
> -	 *	This field is set by the application to indicate that this
> -	 *	channel is communicating to a low-speed device.
> -	 * @epdir: Endpoint Direction (EPDir)
> -	 *	Indicates whether the transaction is IN or OUT.
> -	 *	* 1'b0: OUT
> -	 *	* 1'b1: IN
> -	 * @epnum: Endpoint Number (EPNum)
> -	 *	Indicates the endpoint number on the device serving as the
> -	 *	data source or sink.
> -	 * @mps: Maximum Packet Size (MPS)
> -	 *	Indicates the maximum packet size of the associated endpoint.
> -	 */
> -	struct cvmx_usbcx_hccharx_s {
> -		__BITFIELD_FIELD(u32 chena		: 1,
> -		__BITFIELD_FIELD(u32 chdis		: 1,
> -		__BITFIELD_FIELD(u32 oddfrm		: 1,
> -		__BITFIELD_FIELD(u32 devaddr		: 7,
> -		__BITFIELD_FIELD(u32 ec			: 2,
> -		__BITFIELD_FIELD(u32 eptype		: 2,
> -		__BITFIELD_FIELD(u32 lspddev		: 1,
> -		__BITFIELD_FIELD(u32 reserved_16_16	: 1,
> -		__BITFIELD_FIELD(u32 epdir		: 1,
> -		__BITFIELD_FIELD(u32 epnum		: 4,
> -		__BITFIELD_FIELD(u32 mps		: 11,
> -		;)))))))))))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_hcfg
> - *
> - * Host Configuration Register (HCFG)
> - *
> - * This register configures the core after power-on. Do not make changes to this
> - * register after initializing the host.
> - */
> -union cvmx_usbcx_hcfg {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_hcfg_s
> -	 * @fslssupp: FS- and LS-Only Support (FSLSSupp)
> -	 *	The application uses this bit to control the core's enumeration
> -	 *	speed. Using this bit, the application can make the core
> -	 *	enumerate as a FS host, even if the connected device supports
> -	 *	HS traffic. Do not make changes to this field after initial
> -	 *	programming.
> -	 *	* 1'b0: HS/FS/LS, based on the maximum speed supported by
> -	 *	the connected device
> -	 *	* 1'b1: FS/LS-only, even if the connected device can support HS
> -	 * @fslspclksel: FS/LS PHY Clock Select (FSLSPclkSel)
> -	 *	When the core is in FS Host mode
> -	 *	* 2'b00: PHY clock is running at 30/60 MHz
> -	 *	* 2'b01: PHY clock is running at 48 MHz
> -	 *	* Others: Reserved
> -	 *	When the core is in LS Host mode
> -	 *	* 2'b00: PHY clock is running at 30/60 MHz. When the
> -	 *	UTMI+/ULPI PHY Low Power mode is not selected, use
> -	 *	30/60 MHz.
> -	 *	* 2'b01: PHY clock is running at 48 MHz. When the UTMI+
> -	 *	PHY Low Power mode is selected, use 48MHz if the PHY
> -	 *	supplies a 48 MHz clock during LS mode.
> -	 *	* 2'b10: PHY clock is running at 6 MHz. In USB 1.1 FS mode,
> -	 *	use 6 MHz when the UTMI+ PHY Low Power mode is
> -	 *	selected and the PHY supplies a 6 MHz clock during LS
> -	 *	mode. If you select a 6 MHz clock during LS mode, you must
> -	 *	do a soft reset.
> -	 *	* 2'b11: Reserved
> -	 */
> -	struct cvmx_usbcx_hcfg_s {
> -		__BITFIELD_FIELD(u32 reserved_3_31	: 29,
> -		__BITFIELD_FIELD(u32 fslssupp		: 1,
> -		__BITFIELD_FIELD(u32 fslspclksel	: 2,
> -		;)))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_hcint#
> - *
> - * Host Channel-n Interrupt Register (HCINT)
> - *
> - * This register indicates the status of a channel with respect to USB- and
> - * AHB-related events. The application must read this register when the Host
> - * Channels Interrupt bit of the Core Interrupt register (GINTSTS.HChInt) is
> - * set. Before the application can read this register, it must first read
> - * the Host All Channels Interrupt (HAINT) register to get the exact channel
> - * number for the Host Channel-n Interrupt register. The application must clear
> - * the appropriate bit in this register to clear the corresponding bits in the
> - * HAINT and GINTSTS registers.
> - */
> -union cvmx_usbcx_hcintx {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_hcintx_s
> -	 * @datatglerr: Data Toggle Error (DataTglErr)
> -	 * @frmovrun: Frame Overrun (FrmOvrun)
> -	 * @bblerr: Babble Error (BblErr)
> -	 * @xacterr: Transaction Error (XactErr)
> -	 * @nyet: NYET Response Received Interrupt (NYET)
> -	 * @ack: ACK Response Received Interrupt (ACK)
> -	 * @nak: NAK Response Received Interrupt (NAK)
> -	 * @stall: STALL Response Received Interrupt (STALL)
> -	 * @ahberr: This bit is always 0x0.
> -	 * @chhltd: Channel Halted (ChHltd)
> -	 *	Indicates the transfer completed abnormally either because of
> -	 *	any USB transaction error or in response to disable request by
> -	 *	the application.
> -	 * @xfercompl: Transfer Completed (XferCompl)
> -	 *	Transfer completed normally without any errors.
> -	 */
> -	struct cvmx_usbcx_hcintx_s {
> -		__BITFIELD_FIELD(u32 reserved_11_31	: 21,
> -		__BITFIELD_FIELD(u32 datatglerr		: 1,
> -		__BITFIELD_FIELD(u32 frmovrun		: 1,
> -		__BITFIELD_FIELD(u32 bblerr		: 1,
> -		__BITFIELD_FIELD(u32 xacterr		: 1,
> -		__BITFIELD_FIELD(u32 nyet		: 1,
> -		__BITFIELD_FIELD(u32 ack		: 1,
> -		__BITFIELD_FIELD(u32 nak		: 1,
> -		__BITFIELD_FIELD(u32 stall		: 1,
> -		__BITFIELD_FIELD(u32 ahberr		: 1,
> -		__BITFIELD_FIELD(u32 chhltd		: 1,
> -		__BITFIELD_FIELD(u32 xfercompl		: 1,
> -		;))))))))))))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_hcintmsk#
> - *
> - * Host Channel-n Interrupt Mask Register (HCINTMSKn)
> - *
> - * This register reflects the mask for each channel status described in the
> - * previous section.
> - * Mask interrupt: 1'b0 Unmask interrupt: 1'b1
> - */
> -union cvmx_usbcx_hcintmskx {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_hcintmskx_s
> -	 * @datatglerrmsk: Data Toggle Error Mask (DataTglErrMsk)
> -	 * @frmovrunmsk: Frame Overrun Mask (FrmOvrunMsk)
> -	 * @bblerrmsk: Babble Error Mask (BblErrMsk)
> -	 * @xacterrmsk: Transaction Error Mask (XactErrMsk)
> -	 * @nyetmsk: NYET Response Received Interrupt Mask (NyetMsk)
> -	 * @ackmsk: ACK Response Received Interrupt Mask (AckMsk)
> -	 * @nakmsk: NAK Response Received Interrupt Mask (NakMsk)
> -	 * @stallmsk: STALL Response Received Interrupt Mask (StallMsk)
> -	 * @ahberrmsk: AHB Error Mask (AHBErrMsk)
> -	 * @chhltdmsk: Channel Halted Mask (ChHltdMsk)
> -	 * @xfercomplmsk: Transfer Completed Mask (XferComplMsk)
> -	 */
> -	struct cvmx_usbcx_hcintmskx_s {
> -		__BITFIELD_FIELD(u32 reserved_11_31		: 21,
> -		__BITFIELD_FIELD(u32 datatglerrmsk		: 1,
> -		__BITFIELD_FIELD(u32 frmovrunmsk		: 1,
> -		__BITFIELD_FIELD(u32 bblerrmsk			: 1,
> -		__BITFIELD_FIELD(u32 xacterrmsk			: 1,
> -		__BITFIELD_FIELD(u32 nyetmsk			: 1,
> -		__BITFIELD_FIELD(u32 ackmsk			: 1,
> -		__BITFIELD_FIELD(u32 nakmsk			: 1,
> -		__BITFIELD_FIELD(u32 stallmsk			: 1,
> -		__BITFIELD_FIELD(u32 ahberrmsk			: 1,
> -		__BITFIELD_FIELD(u32 chhltdmsk			: 1,
> -		__BITFIELD_FIELD(u32 xfercomplmsk		: 1,
> -		;))))))))))))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_hcsplt#
> - *
> - * Host Channel-n Split Control Register (HCSPLT)
> - *
> - */
> -union cvmx_usbcx_hcspltx {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_hcspltx_s
> -	 * @spltena: Split Enable (SpltEna)
> -	 *	The application sets this field to indicate that this channel is
> -	 *	enabled to perform split transactions.
> -	 * @compsplt: Do Complete Split (CompSplt)
> -	 *	The application sets this field to request the OTG host to
> -	 *	perform a complete split transaction.
> -	 * @xactpos: Transaction Position (XactPos)
> -	 *	This field is used to determine whether to send all, first,
> -	 *	middle, or last payloads with each OUT transaction.
> -	 *	* 2'b11: All. This is the entire data payload is of this
> -	 *	transaction (which is less than or equal to 188 bytes).
> -	 *	* 2'b10: Begin. This is the first data payload of this
> -	 *	transaction (which is larger than 188 bytes).
> -	 *	* 2'b00: Mid. This is the middle payload of this transaction
> -	 *	(which is larger than 188 bytes).
> -	 *	* 2'b01: End. This is the last payload of this transaction
> -	 *	(which is larger than 188 bytes).
> -	 * @hubaddr: Hub Address (HubAddr)
> -	 *	This field holds the device address of the transaction
> -	 *	translator's hub.
> -	 * @prtaddr: Port Address (PrtAddr)
> -	 *	This field is the port number of the recipient transaction
> -	 *	translator.
> -	 */
> -	struct cvmx_usbcx_hcspltx_s {
> -		__BITFIELD_FIELD(u32 spltena			: 1,
> -		__BITFIELD_FIELD(u32 reserved_17_30		: 14,
> -		__BITFIELD_FIELD(u32 compsplt			: 1,
> -		__BITFIELD_FIELD(u32 xactpos			: 2,
> -		__BITFIELD_FIELD(u32 hubaddr			: 7,
> -		__BITFIELD_FIELD(u32 prtaddr			: 7,
> -		;))))))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_hctsiz#
> - *
> - * Host Channel-n Transfer Size Register (HCTSIZ)
> - *
> - */
> -union cvmx_usbcx_hctsizx {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_hctsizx_s
> -	 * @dopng: Do Ping (DoPng)
> -	 *	Setting this field to 1 directs the host to do PING protocol.
> -	 * @pid: PID (Pid)
> -	 *	The application programs this field with the type of PID to use
> -	 *	for the initial transaction. The host will maintain this field
> -	 *	for the rest of the transfer.
> -	 *	* 2'b00: DATA0
> -	 *	* 2'b01: DATA2
> -	 *	* 2'b10: DATA1
> -	 *	* 2'b11: MDATA (non-control)/SETUP (control)
> -	 * @pktcnt: Packet Count (PktCnt)
> -	 *	This field is programmed by the application with the expected
> -	 *	number of packets to be transmitted (OUT) or received (IN).
> -	 *	The host decrements this count on every successful
> -	 *	transmission or reception of an OUT/IN packet. Once this count
> -	 *	reaches zero, the application is interrupted to indicate normal
> -	 *	completion.
> -	 * @xfersize: Transfer Size (XferSize)
> -	 *	For an OUT, this field is the number of data bytes the host will
> -	 *	send during the transfer.
> -	 *	For an IN, this field is the buffer size that the application
> -	 *	has reserved for the transfer. The application is expected to
> -	 *	program this field as an integer multiple of the maximum packet
> -	 *	size for IN transactions (periodic and non-periodic).
> -	 */
> -	struct cvmx_usbcx_hctsizx_s {
> -		__BITFIELD_FIELD(u32 dopng		: 1,
> -		__BITFIELD_FIELD(u32 pid		: 2,
> -		__BITFIELD_FIELD(u32 pktcnt		: 10,
> -		__BITFIELD_FIELD(u32 xfersize		: 19,
> -		;))))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_hfir
> - *
> - * Host Frame Interval Register (HFIR)
> - *
> - * This register stores the frame interval information for the current speed to
> - * which the O2P USB core has enumerated.
> - */
> -union cvmx_usbcx_hfir {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_hfir_s
> -	 * @frint: Frame Interval (FrInt)
> -	 *	The value that the application programs to this field specifies
> -	 *	the interval between two consecutive SOFs (FS) or micro-
> -	 *	SOFs (HS) or Keep-Alive tokens (HS). This field contains the
> -	 *	number of PHY clocks that constitute the required frame
> -	 *	interval. The default value set in this field for a FS operation
> -	 *	when the PHY clock frequency is 60 MHz. The application can
> -	 *	write a value to this register only after the Port Enable bit of
> -	 *	the Host Port Control and Status register (HPRT.PrtEnaPort)
> -	 *	has been set. If no value is programmed, the core calculates
> -	 *	the value based on the PHY clock specified in the FS/LS PHY
> -	 *	Clock Select field of the Host Configuration register
> -	 *	(HCFG.FSLSPclkSel). Do not change the value of this field
> -	 *	after the initial configuration.
> -	 *	* 125 us (PHY clock frequency for HS)
> -	 *	* 1 ms (PHY clock frequency for FS/LS)
> -	 */
> -	struct cvmx_usbcx_hfir_s {
> -		__BITFIELD_FIELD(u32 reserved_16_31		: 16,
> -		__BITFIELD_FIELD(u32 frint			: 16,
> -		;))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_hfnum
> - *
> - * Host Frame Number/Frame Time Remaining Register (HFNUM)
> - *
> - * This register indicates the current frame number.
> - * It also indicates the time remaining (in terms of the number of PHY clocks)
> - * in the current (micro)frame.
> - */
> -union cvmx_usbcx_hfnum {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_hfnum_s
> -	 * @frrem: Frame Time Remaining (FrRem)
> -	 *	Indicates the amount of time remaining in the current
> -	 *	microframe (HS) or frame (FS/LS), in terms of PHY clocks.
> -	 *	This field decrements on each PHY clock. When it reaches
> -	 *	zero, this field is reloaded with the value in the Frame
> -	 *	Interval register and a new SOF is transmitted on the USB.
> -	 * @frnum: Frame Number (FrNum)
> -	 *	This field increments when a new SOF is transmitted on the
> -	 *	USB, and is reset to 0 when it reaches 16'h3FFF.
> -	 */
> -	struct cvmx_usbcx_hfnum_s {
> -		__BITFIELD_FIELD(u32 frrem		: 16,
> -		__BITFIELD_FIELD(u32 frnum		: 16,
> -		;))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_hprt
> - *
> - * Host Port Control and Status Register (HPRT)
> - *
> - * This register is available in both Host and Device modes.
> - * Currently, the OTG Host supports only one port.
> - * A single register holds USB port-related information such as USB reset,
> - * enable, suspend, resume, connect status, and test mode for each port. The
> - * R_SS_WC bits in this register can trigger an interrupt to the application
> - * through the Host Port Interrupt bit of the Core Interrupt register
> - * (GINTSTS.PrtInt). On a Port Interrupt, the application must read this
> - * register and clear the bit that caused the interrupt. For the R_SS_WC bits,
> - * the application must write a 1 to the bit to clear the interrupt.
> - */
> -union cvmx_usbcx_hprt {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_hprt_s
> -	 * @prtspd: Port Speed (PrtSpd)
> -	 *	Indicates the speed of the device attached to this port.
> -	 *	* 2'b00: High speed
> -	 *	* 2'b01: Full speed
> -	 *	* 2'b10: Low speed
> -	 *	* 2'b11: Reserved
> -	 * @prttstctl: Port Test Control (PrtTstCtl)
> -	 *	The application writes a nonzero value to this field to put
> -	 *	the port into a Test mode, and the corresponding pattern is
> -	 *	signaled on the port.
> -	 *	* 4'b0000: Test mode disabled
> -	 *	* 4'b0001: Test_J mode
> -	 *	* 4'b0010: Test_K mode
> -	 *	* 4'b0011: Test_SE0_NAK mode
> -	 *	* 4'b0100: Test_Packet mode
> -	 *	* 4'b0101: Test_Force_Enable
> -	 *	* Others: Reserved
> -	 *	PrtSpd must be zero (i.e. the interface must be in high-speed
> -	 *	mode) to use the PrtTstCtl test modes.
> -	 * @prtpwr: Port Power (PrtPwr)
> -	 *	The application uses this field to control power to this port,
> -	 *	and the core clears this bit on an overcurrent condition.
> -	 *	* 1'b0: Power off
> -	 *	* 1'b1: Power on
> -	 * @prtlnsts: Port Line Status (PrtLnSts)
> -	 *	Indicates the current logic level USB data lines
> -	 *	* Bit [10]: Logic level of D-
> -	 *	* Bit [11]: Logic level of D+
> -	 * @prtrst: Port Reset (PrtRst)
> -	 *	When the application sets this bit, a reset sequence is
> -	 *	started on this port. The application must time the reset
> -	 *	period and clear this bit after the reset sequence is
> -	 *	complete.
> -	 *	* 1'b0: Port not in reset
> -	 *	* 1'b1: Port in reset
> -	 *	The application must leave this bit set for at least a
> -	 *	minimum duration mentioned below to start a reset on the
> -	 *	port. The application can leave it set for another 10 ms in
> -	 *	addition to the required minimum duration, before clearing
> -	 *	the bit, even though there is no maximum limit set by the
> -	 *	USB standard.
> -	 *	* High speed: 50 ms
> -	 *	* Full speed/Low speed: 10 ms
> -	 * @prtsusp: Port Suspend (PrtSusp)
> -	 *	The application sets this bit to put this port in Suspend
> -	 *	mode. The core only stops sending SOFs when this is set.
> -	 *	To stop the PHY clock, the application must set the Port
> -	 *	Clock Stop bit, which will assert the suspend input pin of
> -	 *	the PHY.
> -	 *	The read value of this bit reflects the current suspend
> -	 *	status of the port. This bit is cleared by the core after a
> -	 *	remote wakeup signal is detected or the application sets
> -	 *	the Port Reset bit or Port Resume bit in this register or the
> -	 *	Resume/Remote Wakeup Detected Interrupt bit or
> -	 *	Disconnect Detected Interrupt bit in the Core Interrupt
> -	 *	register (GINTSTS.WkUpInt or GINTSTS.DisconnInt,
> -	 *	respectively).
> -	 *	* 1'b0: Port not in Suspend mode
> -	 *	* 1'b1: Port in Suspend mode
> -	 * @prtres: Port Resume (PrtRes)
> -	 *	The application sets this bit to drive resume signaling on
> -	 *	the port. The core continues to drive the resume signal
> -	 *	until the application clears this bit.
> -	 *	If the core detects a USB remote wakeup sequence, as
> -	 *	indicated by the Port Resume/Remote Wakeup Detected
> -	 *	Interrupt bit of the Core Interrupt register
> -	 *	(GINTSTS.WkUpInt), the core starts driving resume
> -	 *	signaling without application intervention and clears this bit
> -	 *	when it detects a disconnect condition. The read value of
> -	 *	this bit indicates whether the core is currently driving
> -	 *	resume signaling.
> -	 *	* 1'b0: No resume driven
> -	 *	* 1'b1: Resume driven
> -	 * @prtovrcurrchng: Port Overcurrent Change (PrtOvrCurrChng)
> -	 *	The core sets this bit when the status of the Port
> -	 *	Overcurrent Active bit (bit 4) in this register changes.
> -	 * @prtovrcurract: Port Overcurrent Active (PrtOvrCurrAct)
> -	 *	Indicates the overcurrent condition of the port.
> -	 *	* 1'b0: No overcurrent condition
> -	 *	* 1'b1: Overcurrent condition
> -	 * @prtenchng: Port Enable/Disable Change (PrtEnChng)
> -	 *	The core sets this bit when the status of the Port Enable bit
> -	 *	[2] of this register changes.
> -	 * @prtena: Port Enable (PrtEna)
> -	 *	A port is enabled only by the core after a reset sequence,
> -	 *	and is disabled by an overcurrent condition, a disconnect
> -	 *	condition, or by the application clearing this bit. The
> -	 *	application cannot set this bit by a register write. It can only
> -	 *	clear it to disable the port. This bit does not trigger any
> -	 *	interrupt to the application.
> -	 *	* 1'b0: Port disabled
> -	 *	* 1'b1: Port enabled
> -	 * @prtconndet: Port Connect Detected (PrtConnDet)
> -	 *	The core sets this bit when a device connection is detected
> -	 *	to trigger an interrupt to the application using the Host Port
> -	 *	Interrupt bit of the Core Interrupt register (GINTSTS.PrtInt).
> -	 *	The application must write a 1 to this bit to clear the
> -	 *	interrupt.
> -	 * @prtconnsts: Port Connect Status (PrtConnSts)
> -	 *	* 0: No device is attached to the port.
> -	 *	* 1: A device is attached to the port.
> -	 */
> -	struct cvmx_usbcx_hprt_s {
> -		__BITFIELD_FIELD(u32 reserved_19_31	: 13,
> -		__BITFIELD_FIELD(u32 prtspd		: 2,
> -		__BITFIELD_FIELD(u32 prttstctl		: 4,
> -		__BITFIELD_FIELD(u32 prtpwr		: 1,
> -		__BITFIELD_FIELD(u32 prtlnsts		: 2,
> -		__BITFIELD_FIELD(u32 reserved_9_9	: 1,
> -		__BITFIELD_FIELD(u32 prtrst		: 1,
> -		__BITFIELD_FIELD(u32 prtsusp		: 1,
> -		__BITFIELD_FIELD(u32 prtres		: 1,
> -		__BITFIELD_FIELD(u32 prtovrcurrchng	: 1,
> -		__BITFIELD_FIELD(u32 prtovrcurract	: 1,
> -		__BITFIELD_FIELD(u32 prtenchng		: 1,
> -		__BITFIELD_FIELD(u32 prtena		: 1,
> -		__BITFIELD_FIELD(u32 prtconndet		: 1,
> -		__BITFIELD_FIELD(u32 prtconnsts		: 1,
> -		;)))))))))))))))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_hptxfsiz
> - *
> - * Host Periodic Transmit FIFO Size Register (HPTXFSIZ)
> - *
> - * This register holds the size and the memory start address of the Periodic
> - * TxFIFO, as shown in Figures 310 and 311.
> - */
> -union cvmx_usbcx_hptxfsiz {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_hptxfsiz_s
> -	 * @ptxfsize: Host Periodic TxFIFO Depth (PTxFSize)
> -	 *	This value is in terms of 32-bit words.
> -	 *	* Minimum value is 16
> -	 *	* Maximum value is 32768
> -	 * @ptxfstaddr: Host Periodic TxFIFO Start Address (PTxFStAddr)
> -	 */
> -	struct cvmx_usbcx_hptxfsiz_s {
> -		__BITFIELD_FIELD(u32 ptxfsize	: 16,
> -		__BITFIELD_FIELD(u32 ptxfstaddr	: 16,
> -		;))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_hptxsts
> - *
> - * Host Periodic Transmit FIFO/Queue Status Register (HPTXSTS)
> - *
> - * This read-only register contains the free space information for the Periodic
> - * TxFIFO and the Periodic Transmit Request Queue
> - */
> -union cvmx_usbcx_hptxsts {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_hptxsts_s
> -	 * @ptxqtop: Top of the Periodic Transmit Request Queue (PTxQTop)
> -	 *	This indicates the entry in the Periodic Tx Request Queue that
> -	 *	is currently being processes by the MAC.
> -	 *	This register is used for debugging.
> -	 *	* Bit [31]: Odd/Even (micro)frame
> -	 *	- 1'b0: send in even (micro)frame
> -	 *	- 1'b1: send in odd (micro)frame
> -	 *	* Bits [30:27]: Channel/endpoint number
> -	 *	* Bits [26:25]: Type
> -	 *	- 2'b00: IN/OUT
> -	 *	- 2'b01: Zero-length packet
> -	 *	- 2'b10: CSPLIT
> -	 *	- 2'b11: Disable channel command
> -	 *	* Bit [24]: Terminate (last entry for the selected
> -	 *	channel/endpoint)
> -	 * @ptxqspcavail: Periodic Transmit Request Queue Space Available
> -	 *	(PTxQSpcAvail)
> -	 *	Indicates the number of free locations available to be written
> -	 *	in the Periodic Transmit Request Queue. This queue holds both
> -	 *	IN and OUT requests.
> -	 *	* 8'h0: Periodic Transmit Request Queue is full
> -	 *	* 8'h1: 1 location available
> -	 *	* 8'h2: 2 locations available
> -	 *	* n: n locations available (0..8)
> -	 *	* Others: Reserved
> -	 * @ptxfspcavail: Periodic Transmit Data FIFO Space Available
> -	 *		  (PTxFSpcAvail)
> -	 *	Indicates the number of free locations available to be written
> -	 *	to in the Periodic TxFIFO.
> -	 *	Values are in terms of 32-bit words
> -	 *	* 16'h0: Periodic TxFIFO is full
> -	 *	* 16'h1: 1 word available
> -	 *	* 16'h2: 2 words available
> -	 *	* 16'hn: n words available (where 0..32768)
> -	 *	* 16'h8000: 32768 words available
> -	 *	* Others: Reserved
> -	 */
> -	struct cvmx_usbcx_hptxsts_s {
> -		__BITFIELD_FIELD(u32 ptxqtop		: 8,
> -		__BITFIELD_FIELD(u32 ptxqspcavail	: 8,
> -		__BITFIELD_FIELD(u32 ptxfspcavail	: 16,
> -		;)))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbn#_clk_ctl
> - *
> - * USBN_CLK_CTL = USBN's Clock Control
> - *
> - * This register is used to control the frequency of the hclk and the
> - * hreset and phy_rst signals.
> - */
> -union cvmx_usbnx_clk_ctl {
> -	u64 u64;
> -	/**
> -	 * struct cvmx_usbnx_clk_ctl_s
> -	 * @divide2: The 'hclk' used by the USB subsystem is derived
> -	 *	from the eclk.
> -	 *	Also see the field DIVIDE. DIVIDE2<1> must currently
> -	 *	be zero because it is not implemented, so the maximum
> -	 *	ratio of eclk/hclk is currently 16.
> -	 *	The actual divide number for hclk is:
> -	 *	(DIVIDE2 + 1) * (DIVIDE + 1)
> -	 * @hclk_rst: When this field is '0' the HCLK-DIVIDER used to
> -	 *	generate the hclk in the USB Subsystem is held
> -	 *	in reset. This bit must be set to '0' before
> -	 *	changing the value os DIVIDE in this register.
> -	 *	The reset to the HCLK_DIVIDERis also asserted
> -	 *	when core reset is asserted.
> -	 * @p_x_on: Force USB-PHY on during suspend.
> -	 *	'1' USB-PHY XO block is powered-down during
> -	 *	suspend.
> -	 *	'0' USB-PHY XO block is powered-up during
> -	 *	suspend.
> -	 *	The value of this field must be set while POR is
> -	 *	active.
> -	 * @p_rtype: PHY reference clock type
> -	 *	On CN50XX/CN52XX/CN56XX the values are:
> -	 *		'0' The USB-PHY uses a 12MHz crystal as a clock source
> -	 *		    at the USB_XO and USB_XI pins.
> -	 *		'1' Reserved.
> -	 *		'2' The USB_PHY uses 12/24/48MHz 2.5V board clock at the
> -	 *		    USB_XO pin. USB_XI should be tied to ground in this
> -	 *		    case.
> -	 *		'3' Reserved.
> -	 *	On CN3xxx bits 14 and 15 are p_xenbn and p_rclk and values are:
> -	 *		'0' Reserved.
> -	 *		'1' Reserved.
> -	 *		'2' The PHY PLL uses the XO block output as a reference.
> -	 *		    The XO block uses an external clock supplied on the
> -	 *		    XO pin. USB_XI should be tied to ground for this
> -	 *		    usage.
> -	 *		'3' The XO block uses the clock from a crystal.
> -	 * @p_com_on: '0' Force USB-PHY XO Bias, Bandgap and PLL to
> -	 *	remain powered in Suspend Mode.
> -	 *	'1' The USB-PHY XO Bias, Bandgap and PLL are
> -	 *	powered down in suspend mode.
> -	 *	The value of this field must be set while POR is
> -	 *	active.
> -	 * @p_c_sel: Phy clock speed select.
> -	 *	Selects the reference clock / crystal frequency.
> -	 *	'11': Reserved
> -	 *	'10': 48 MHz (reserved when a crystal is used)
> -	 *	'01': 24 MHz (reserved when a crystal is used)
> -	 *	'00': 12 MHz
> -	 *	The value of this field must be set while POR is
> -	 *	active.
> -	 *	NOTE: if a crystal is used as a reference clock,
> -	 *	this field must be set to 12 MHz.
> -	 * @cdiv_byp: Used to enable the bypass input to the USB_CLK_DIV.
> -	 * @sd_mode: Scaledown mode for the USBC. Control timing events
> -	 *	in the USBC, for normal operation this must be '0'.
> -	 * @s_bist: Starts bist on the hclk memories, during the '0'
> -	 *	to '1' transition.
> -	 * @por: Power On Reset for the PHY.
> -	 *	Resets all the PHYS registers and state machines.
> -	 * @enable: When '1' allows the generation of the hclk. When
> -	 *	'0' the hclk will not be generated. SEE DIVIDE
> -	 *	field of this register.
> -	 * @prst: When this field is '0' the reset associated with
> -	 *	the phy_clk functionality in the USB Subsystem is
> -	 *	help in reset. This bit should not be set to '1'
> -	 *	until the time it takes 6 clocks (hclk or phy_clk,
> -	 *	whichever is slower) has passed. Under normal
> -	 *	operation once this bit is set to '1' it should not
> -	 *	be set to '0'.
> -	 * @hrst: When this field is '0' the reset associated with
> -	 *	the hclk functioanlity in the USB Subsystem is
> -	 *	held in reset.This bit should not be set to '1'
> -	 *	until 12ms after phy_clk is stable. Under normal
> -	 *	operation, once this bit is set to '1' it should
> -	 *	not be set to '0'.
> -	 * @divide: The frequency of 'hclk' used by the USB subsystem
> -	 *	is the eclk frequency divided by the value of
> -	 *	(DIVIDE2 + 1) * (DIVIDE + 1), also see the field
> -	 *	DIVIDE2 of this register.
> -	 *	The hclk frequency should be less than 125Mhz.
> -	 *	After writing a value to this field the SW should
> -	 *	read the field for the value written.
> -	 *	The ENABLE field of this register should not be set
> -	 *	until AFTER this field is set and then read.
> -	 */
> -	struct cvmx_usbnx_clk_ctl_s {
> -		__BITFIELD_FIELD(u64 reserved_20_63	: 44,
> -		__BITFIELD_FIELD(u64 divide2		: 2,
> -		__BITFIELD_FIELD(u64 hclk_rst		: 1,
> -		__BITFIELD_FIELD(u64 p_x_on		: 1,
> -		__BITFIELD_FIELD(u64 p_rtype		: 2,
> -		__BITFIELD_FIELD(u64 p_com_on		: 1,
> -		__BITFIELD_FIELD(u64 p_c_sel		: 2,
> -		__BITFIELD_FIELD(u64 cdiv_byp		: 1,
> -		__BITFIELD_FIELD(u64 sd_mode		: 2,
> -		__BITFIELD_FIELD(u64 s_bist		: 1,
> -		__BITFIELD_FIELD(u64 por		: 1,
> -		__BITFIELD_FIELD(u64 enable		: 1,
> -		__BITFIELD_FIELD(u64 prst		: 1,
> -		__BITFIELD_FIELD(u64 hrst		: 1,
> -		__BITFIELD_FIELD(u64 divide		: 3,
> -		;)))))))))))))))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbn#_usbp_ctl_status
> - *
> - * USBN_USBP_CTL_STATUS = USBP Control And Status Register
> - *
> - * Contains general control and status information for the USBN block.
> - */
> -union cvmx_usbnx_usbp_ctl_status {
> -	u64 u64;
> -	/**
> -	 * struct cvmx_usbnx_usbp_ctl_status_s
> -	 * @txrisetune: HS Transmitter Rise/Fall Time Adjustment
> -	 * @txvreftune: HS DC Voltage Level Adjustment
> -	 * @txfslstune: FS/LS Source Impedance Adjustment
> -	 * @txhsxvtune: Transmitter High-Speed Crossover Adjustment
> -	 * @sqrxtune: Squelch Threshold Adjustment
> -	 * @compdistune: Disconnect Threshold Adjustment
> -	 * @otgtune: VBUS Valid Threshold Adjustment
> -	 * @otgdisable: OTG Block Disable
> -	 * @portreset: Per_Port Reset
> -	 * @drvvbus: Drive VBUS
> -	 * @lsbist: Low-Speed BIST Enable.
> -	 * @fsbist: Full-Speed BIST Enable.
> -	 * @hsbist: High-Speed BIST Enable.
> -	 * @bist_done: PHY Bist Done.
> -	 *	Asserted at the end of the PHY BIST sequence.
> -	 * @bist_err: PHY Bist Error.
> -	 *	Indicates an internal error was detected during
> -	 *	the BIST sequence.
> -	 * @tdata_out: PHY Test Data Out.
> -	 *	Presents either internally generated signals or
> -	 *	test register contents, based upon the value of
> -	 *	test_data_out_sel.
> -	 * @siddq: Drives the USBP (USB-PHY) SIDDQ input.
> -	 *	Normally should be set to zero.
> -	 *	When customers have no intent to use USB PHY
> -	 *	interface, they should:
> -	 *	- still provide 3.3V to USB_VDD33, and
> -	 *	- tie USB_REXT to 3.3V supply, and
> -	 *	- set USBN*_USBP_CTL_STATUS[SIDDQ]=1
> -	 * @txpreemphasistune: HS Transmitter Pre-Emphasis Enable
> -	 * @dma_bmode: When set to 1 the L2C DMA address will be updated
> -	 *	with byte-counts between packets. When set to 0
> -	 *	the L2C DMA address is incremented to the next
> -	 *	4-byte aligned address after adding byte-count.
> -	 * @usbc_end: Bigendian input to the USB Core. This should be
> -	 *	set to '0' for operation.
> -	 * @usbp_bist: PHY, This is cleared '0' to run BIST on the USBP.
> -	 * @tclk: PHY Test Clock, used to load TDATA_IN to the USBP.
> -	 * @dp_pulld: PHY DP_PULLDOWN input to the USB-PHY.
> -	 *	This signal enables the pull-down resistance on
> -	 *	the D+ line. '1' pull down-resistance is connected
> -	 *	to D+/ '0' pull down resistance is not connected
> -	 *	to D+. When an A/B device is acting as a host
> -	 *	(downstream-facing port), dp_pulldown and
> -	 *	dm_pulldown are enabled. This must not toggle
> -	 *	during normal operation.
> -	 * @dm_pulld: PHY DM_PULLDOWN input to the USB-PHY.
> -	 *	This signal enables the pull-down resistance on
> -	 *	the D- line. '1' pull down-resistance is connected
> -	 *	to D-. '0' pull down resistance is not connected
> -	 *	to D-. When an A/B device is acting as a host
> -	 *	(downstream-facing port), dp_pulldown and
> -	 *	dm_pulldown are enabled. This must not toggle
> -	 *	during normal operation.
> -	 * @hst_mode: When '0' the USB is acting as HOST, when '1'
> -	 *	USB is acting as device. This field needs to be
> -	 *	set while the USB is in reset.
> -	 * @tuning: Transmitter Tuning for High-Speed Operation.
> -	 *	Tunes the current supply and rise/fall output
> -	 *	times for high-speed operation.
> -	 *	[20:19] == 11: Current supply increased
> -	 *	approximately 9%
> -	 *	[20:19] == 10: Current supply increased
> -	 *	approximately 4.5%
> -	 *	[20:19] == 01: Design default.
> -	 *	[20:19] == 00: Current supply decreased
> -	 *	approximately 4.5%
> -	 *	[22:21] == 11: Rise and fall times are increased.
> -	 *	[22:21] == 10: Design default.
> -	 *	[22:21] == 01: Rise and fall times are decreased.
> -	 *	[22:21] == 00: Rise and fall times are decreased
> -	 *	further as compared to the 01 setting.
> -	 * @tx_bs_enh: Transmit Bit Stuffing on [15:8].
> -	 *	Enables or disables bit stuffing on data[15:8]
> -	 *	when bit-stuffing is enabled.
> -	 * @tx_bs_en: Transmit Bit Stuffing on [7:0].
> -	 *	Enables or disables bit stuffing on data[7:0]
> -	 *	when bit-stuffing is enabled.
> -	 * @loop_enb: PHY Loopback Test Enable.
> -	 *	'1': During data transmission the receive is
> -	 *	enabled.
> -	 *	'0': During data transmission the receive is
> -	 *	disabled.
> -	 *	Must be '0' for normal operation.
> -	 * @vtest_enb: Analog Test Pin Enable.
> -	 *	'1' The PHY's analog_test pin is enabled for the
> -	 *	input and output of applicable analog test signals.
> -	 *	'0' THe analog_test pin is disabled.
> -	 * @bist_enb: Built-In Self Test Enable.
> -	 *	Used to activate BIST in the PHY.
> -	 * @tdata_sel: Test Data Out Select.
> -	 *	'1' test_data_out[3:0] (PHY) register contents
> -	 *	are output. '0' internally generated signals are
> -	 *	output.
> -	 * @taddr_in: Mode Address for Test Interface.
> -	 *	Specifies the register address for writing to or
> -	 *	reading from the PHY test interface register.
> -	 * @tdata_in: Internal Testing Register Input Data and Select
> -	 *	This is a test bus. Data is present on [3:0],
> -	 *	and its corresponding select (enable) is present
> -	 *	on bits [7:4].
> -	 * @ate_reset: Reset input from automatic test equipment.
> -	 *	This is a test signal. When the USB Core is
> -	 *	powered up (not in Susned Mode), an automatic
> -	 *	tester can use this to disable phy_clock and
> -	 *	free_clk, then re-enable them with an aligned
> -	 *	phase.
> -	 *	'1': The phy_clk and free_clk outputs are
> -	 *	disabled. "0": The phy_clock and free_clk outputs
> -	 *	are available within a specific period after the
> -	 *	de-assertion.
> -	 */
> -	struct cvmx_usbnx_usbp_ctl_status_s {
> -		__BITFIELD_FIELD(u64 txrisetune		: 1,
> -		__BITFIELD_FIELD(u64 txvreftune		: 4,
> -		__BITFIELD_FIELD(u64 txfslstune		: 4,
> -		__BITFIELD_FIELD(u64 txhsxvtune		: 2,
> -		__BITFIELD_FIELD(u64 sqrxtune		: 3,
> -		__BITFIELD_FIELD(u64 compdistune	: 3,
> -		__BITFIELD_FIELD(u64 otgtune		: 3,
> -		__BITFIELD_FIELD(u64 otgdisable		: 1,
> -		__BITFIELD_FIELD(u64 portreset		: 1,
> -		__BITFIELD_FIELD(u64 drvvbus		: 1,
> -		__BITFIELD_FIELD(u64 lsbist		: 1,
> -		__BITFIELD_FIELD(u64 fsbist		: 1,
> -		__BITFIELD_FIELD(u64 hsbist		: 1,
> -		__BITFIELD_FIELD(u64 bist_done		: 1,
> -		__BITFIELD_FIELD(u64 bist_err		: 1,
> -		__BITFIELD_FIELD(u64 tdata_out		: 4,
> -		__BITFIELD_FIELD(u64 siddq		: 1,
> -		__BITFIELD_FIELD(u64 txpreemphasistune	: 1,
> -		__BITFIELD_FIELD(u64 dma_bmode		: 1,
> -		__BITFIELD_FIELD(u64 usbc_end		: 1,
> -		__BITFIELD_FIELD(u64 usbp_bist		: 1,
> -		__BITFIELD_FIELD(u64 tclk		: 1,
> -		__BITFIELD_FIELD(u64 dp_pulld		: 1,
> -		__BITFIELD_FIELD(u64 dm_pulld		: 1,
> -		__BITFIELD_FIELD(u64 hst_mode		: 1,
> -		__BITFIELD_FIELD(u64 tuning		: 4,
> -		__BITFIELD_FIELD(u64 tx_bs_enh		: 1,
> -		__BITFIELD_FIELD(u64 tx_bs_en		: 1,
> -		__BITFIELD_FIELD(u64 loop_enb		: 1,
> -		__BITFIELD_FIELD(u64 vtest_enb		: 1,
> -		__BITFIELD_FIELD(u64 bist_enb		: 1,
> -		__BITFIELD_FIELD(u64 tdata_sel		: 1,
> -		__BITFIELD_FIELD(u64 taddr_in		: 4,
> -		__BITFIELD_FIELD(u64 tdata_in		: 8,
> -		__BITFIELD_FIELD(u64 ate_reset		: 1,
> -		;)))))))))))))))))))))))))))))))))))
> -	} s;
> -};
> -
> -#endif /* __OCTEON_HCD_H__ */

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 2/2] staging: octeon-usb: delete the octeon usb host controller driver
@ 2020-02-04  4:06     ` Chris Packham
  0 siblings, 0 replies; 59+ messages in thread
From: Chris Packham @ 2020-02-04  4:06 UTC (permalink / raw)
  To: gregkh, devel
  Cc: ddaney.cavm, pundirsumit11, aaro.koskinen, linux-kernel,
	nishkadg.linux, frank, laura.lazzati.15

On Tue, 2019-12-10 at 10:15 +0100, Greg Kroah-Hartman wrote:
> This driver was merged back in 2013 and shows no progress toward every
> being merged into the "correct" part of the kernel.  The code doesn't
> even build for anyone unless you have the specific hardware platform
> selected, so odds are it doesn't even work anymore.
> 
> Remove it for now and is someone comes along that has the hardware and
> is willing to fix it up, it can be reverted.
> 
> Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
> Cc: David Daney <ddaney.cavm@gmail.com>
> Cc: Nishka Dasgupta <nishkadg.linux@gmail.com>
> Cc: Himadri Pandya <himadri18.07@gmail.com>
> Cc: "Frank A. Cancio Bello" <frank@generalsoftwareinc.com>
> Cc: Sumit Pundir <pundirsumit11@gmail.com>
> Cc: Laura Lazzati <laura.lazzati.15@gmail.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---

Similarly we'd really like to keep this too.


>  drivers/staging/Kconfig                 |    2 -
>  drivers/staging/Makefile                |    1 -
>  drivers/staging/octeon-usb/Kconfig      |   11 -
>  drivers/staging/octeon-usb/Makefile     |    2 -
>  drivers/staging/octeon-usb/TODO         |    8 -
>  drivers/staging/octeon-usb/octeon-hcd.c | 3737 -----------------------
>  drivers/staging/octeon-usb/octeon-hcd.h | 1847 -----------
>  7 files changed, 5608 deletions(-)
>  delete mode 100644 drivers/staging/octeon-usb/Kconfig
>  delete mode 100644 drivers/staging/octeon-usb/Makefile
>  delete mode 100644 drivers/staging/octeon-usb/TODO
>  delete mode 100644 drivers/staging/octeon-usb/octeon-hcd.c
>  delete mode 100644 drivers/staging/octeon-usb/octeon-hcd.h
> 
> diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
> index 15d3549e7cc7..198bf59bc1e6 100644
> --- a/drivers/staging/Kconfig
> +++ b/drivers/staging/Kconfig
> @@ -42,8 +42,6 @@ source "drivers/staging/rtl8188eu/Kconfig"
>  
>  source "drivers/staging/rts5208/Kconfig"
>  
> -source "drivers/staging/octeon-usb/Kconfig"
> -
>  source "drivers/staging/vt6655/Kconfig"
>  
>  source "drivers/staging/vt6656/Kconfig"
> diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
> index c521204220b5..bf230a830338 100644
> --- a/drivers/staging/Makefile
> +++ b/drivers/staging/Makefile
> @@ -12,7 +12,6 @@ obj-$(CONFIG_R8712U)		+= rtl8712/
>  obj-$(CONFIG_R8188EU)		+= rtl8188eu/
>  obj-$(CONFIG_RTS5208)		+= rts5208/
>  obj-$(CONFIG_NETLOGIC_XLR_NET)	+= netlogic/
> -obj-$(CONFIG_OCTEON_USB)	+= octeon-usb/
>  obj-$(CONFIG_VT6655)		+= vt6655/
>  obj-$(CONFIG_VT6656)		+= vt6656/
>  obj-$(CONFIG_VME_BUS)		+= vme/
> diff --git a/drivers/staging/octeon-usb/Kconfig b/drivers/staging/octeon-usb/Kconfig
> deleted file mode 100644
> index 6a5d842ee0f2..000000000000
> --- a/drivers/staging/octeon-usb/Kconfig
> +++ /dev/null
> @@ -1,11 +0,0 @@
> -# SPDX-License-Identifier: GPL-2.0
> -config OCTEON_USB
> -	tristate "Cavium Networks Octeon USB support"
> -	depends on CAVIUM_OCTEON_SOC && USB
> -	help
> -	  This driver supports USB host controller on some Cavium
> -	  Networks' products in the Octeon family.
> -
> -	  To compile this driver as a module, choose M here. The module
> -	  will be called octeon-hcd.
> -
> diff --git a/drivers/staging/octeon-usb/Makefile b/drivers/staging/octeon-usb/Makefile
> deleted file mode 100644
> index 9873a0130ad5..000000000000
> --- a/drivers/staging/octeon-usb/Makefile
> +++ /dev/null
> @@ -1,2 +0,0 @@
> -# SPDX-License-Identifier: GPL-2.0
> -obj-${CONFIG_OCTEON_USB} := octeon-hcd.o
> diff --git a/drivers/staging/octeon-usb/TODO b/drivers/staging/octeon-usb/TODO
> deleted file mode 100644
> index 2b29acca5caa..000000000000
> --- a/drivers/staging/octeon-usb/TODO
> +++ /dev/null
> @@ -1,8 +0,0 @@
> -This driver is functional and has been tested on EdgeRouter Lite,
> -D-Link DSR-1000N and EBH5600 evaluation board with USB mass storage.
> -
> -TODO:
> -	- kernel coding style
> -	- checkpatch warnings
> -
> -Contact: Aaro Koskinen <aaro.koskinen@iki.fi>
> diff --git a/drivers/staging/octeon-usb/octeon-hcd.c b/drivers/staging/octeon-usb/octeon-hcd.c
> deleted file mode 100644
> index 582c9187559d..000000000000
> --- a/drivers/staging/octeon-usb/octeon-hcd.c
> +++ /dev/null
> @@ -1,3737 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0
> -/*
> - * This file is subject to the terms and conditions of the GNU General Public
> - * License.  See the file "COPYING" in the main directory of this archive
> - * for more details.
> - *
> - * Copyright (C) 2008 Cavium Networks
> - *
> - * Some parts of the code were originally released under BSD license:
> - *
> - * Copyright (c) 2003-2010 Cavium Networks (support@cavium.com). All rights
> - * reserved.
> - *
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions are
> - * met:
> - *
> - *   * Redistributions of source code must retain the above copyright
> - *     notice, this list of conditions and the following disclaimer.
> - *
> - *   * Redistributions in binary form must reproduce the above
> - *     copyright notice, this list of conditions and the following
> - *     disclaimer in the documentation and/or other materials provided
> - *     with the distribution.
> - *
> - *   * Neither the name of Cavium Networks nor the names of
> - *     its contributors may be used to endorse or promote products
> - *     derived from this software without specific prior written
> - *     permission.
> - *
> - * This Software, including technical data, may be subject to U.S. export
> - * control laws, including the U.S. Export Administration Act and its associated
> - * regulations, and may be subject to export or import regulations in other
> - * countries.
> - *
> - * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
> - * AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR
> - * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
> - * THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION
> - * OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
> - * SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
> - * MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
> - * VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
> - * CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
> - * PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
> - */
> -
> -#include <linux/usb.h>
> -#include <linux/slab.h>
> -#include <linux/module.h>
> -#include <linux/usb/hcd.h>
> -#include <linux/prefetch.h>
> -#include <linux/dma-mapping.h>
> -#include <linux/platform_device.h>
> -
> -#include <asm/octeon/octeon.h>
> -
> -#include "octeon-hcd.h"
> -
> -/**
> - * enum cvmx_usb_speed - the possible USB device speeds
> - *
> - * @CVMX_USB_SPEED_HIGH: Device is operation at 480Mbps
> - * @CVMX_USB_SPEED_FULL: Device is operation at 12Mbps
> - * @CVMX_USB_SPEED_LOW:  Device is operation at 1.5Mbps
> - */
> -enum cvmx_usb_speed {
> -	CVMX_USB_SPEED_HIGH = 0,
> -	CVMX_USB_SPEED_FULL = 1,
> -	CVMX_USB_SPEED_LOW = 2,
> -};
> -
> -/**
> - * enum cvmx_usb_transfer - the possible USB transfer types
> - *
> - * @CVMX_USB_TRANSFER_CONTROL:	   USB transfer type control for hub and status
> - *				   transfers
> - * @CVMX_USB_TRANSFER_ISOCHRONOUS: USB transfer type isochronous for low
> - *				   priority periodic transfers
> - * @CVMX_USB_TRANSFER_BULK:	   USB transfer type bulk for large low priority
> - *				   transfers
> - * @CVMX_USB_TRANSFER_INTERRUPT:   USB transfer type interrupt for high priority
> - *				   periodic transfers
> - */
> -enum cvmx_usb_transfer {
> -	CVMX_USB_TRANSFER_CONTROL = 0,
> -	CVMX_USB_TRANSFER_ISOCHRONOUS = 1,
> -	CVMX_USB_TRANSFER_BULK = 2,
> -	CVMX_USB_TRANSFER_INTERRUPT = 3,
> -};
> -
> -/**
> - * enum cvmx_usb_direction - the transfer directions
> - *
> - * @CVMX_USB_DIRECTION_OUT: Data is transferring from Octeon to the device/host
> - * @CVMX_USB_DIRECTION_IN:  Data is transferring from the device/host to Octeon
> - */
> -enum cvmx_usb_direction {
> -	CVMX_USB_DIRECTION_OUT,
> -	CVMX_USB_DIRECTION_IN,
> -};
> -
> -/**
> - * enum cvmx_usb_status - possible callback function status codes
> - *
> - * @CVMX_USB_STATUS_OK:		  The transaction / operation finished without
> - *				  any errors
> - * @CVMX_USB_STATUS_SHORT:	  FIXME: This is currently not implemented
> - * @CVMX_USB_STATUS_CANCEL:	  The transaction was canceled while in flight
> - *				  by a user call to cvmx_usb_cancel
> - * @CVMX_USB_STATUS_ERROR:	  The transaction aborted with an unexpected
> - *				  error status
> - * @CVMX_USB_STATUS_STALL:	  The transaction received a USB STALL response
> - *				  from the device
> - * @CVMX_USB_STATUS_XACTERR:	  The transaction failed with an error from the
> - *				  device even after a number of retries
> - * @CVMX_USB_STATUS_DATATGLERR:	  The transaction failed with a data toggle
> - *				  error even after a number of retries
> - * @CVMX_USB_STATUS_BABBLEERR:	  The transaction failed with a babble error
> - * @CVMX_USB_STATUS_FRAMEERR:	  The transaction failed with a frame error
> - *				  even after a number of retries
> - */
> -enum cvmx_usb_status {
> -	CVMX_USB_STATUS_OK,
> -	CVMX_USB_STATUS_SHORT,
> -	CVMX_USB_STATUS_CANCEL,
> -	CVMX_USB_STATUS_ERROR,
> -	CVMX_USB_STATUS_STALL,
> -	CVMX_USB_STATUS_XACTERR,
> -	CVMX_USB_STATUS_DATATGLERR,
> -	CVMX_USB_STATUS_BABBLEERR,
> -	CVMX_USB_STATUS_FRAMEERR,
> -};
> -
> -/**
> - * struct cvmx_usb_port_status - the USB port status information
> - *
> - * @port_enabled:	1 = Usb port is enabled, 0 = disabled
> - * @port_over_current:	1 = Over current detected, 0 = Over current not
> - *			detected. Octeon doesn't support over current detection.
> - * @port_powered:	1 = Port power is being supplied to the device, 0 =
> - *			power is off. Octeon doesn't support turning port power
> - *			off.
> - * @port_speed:		Current port speed.
> - * @connected:		1 = A device is connected to the port, 0 = No device is
> - *			connected.
> - * @connect_change:	1 = Device connected state changed since the last set
> - *			status call.
> - */
> -struct cvmx_usb_port_status {
> -	u32 reserved			: 25;
> -	u32 port_enabled		: 1;
> -	u32 port_over_current		: 1;
> -	u32 port_powered		: 1;
> -	enum cvmx_usb_speed port_speed	: 2;
> -	u32 connected			: 1;
> -	u32 connect_change		: 1;
> -};
> -
> -/**
> - * struct cvmx_usb_iso_packet - descriptor for Isochronous packets
> - *
> - * @offset:	This is the offset in bytes into the main buffer where this data
> - *		is stored.
> - * @length:	This is the length in bytes of the data.
> - * @status:	This is the status of this individual packet transfer.
> - */
> -struct cvmx_usb_iso_packet {
> -	int offset;
> -	int length;
> -	enum cvmx_usb_status status;
> -};
> -
> -/**
> - * enum cvmx_usb_initialize_flags - flags used by the initialization function
> - *
> - * @CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_XI:    The USB port uses a 12MHz crystal
> - *					      as clock source at USB_XO and
> - *					      USB_XI.
> - * @CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_GND:   The USB port uses 12/24/48MHz 2.5V
> - *					      board clock source at USB_XO.
> - *					      USB_XI should be tied to GND.
> - * @CVMX_USB_INITIALIZE_FLAGS_CLOCK_MHZ_MASK: Mask for clock speed field
> - * @CVMX_USB_INITIALIZE_FLAGS_CLOCK_12MHZ:    Speed of reference clock or
> - *					      crystal
> - * @CVMX_USB_INITIALIZE_FLAGS_CLOCK_24MHZ:    Speed of reference clock
> - * @CVMX_USB_INITIALIZE_FLAGS_CLOCK_48MHZ:    Speed of reference clock
> - * @CVMX_USB_INITIALIZE_FLAGS_NO_DMA:	      Disable DMA and used polled IO for
> - *					      data transfer use for the USB
> - */
> -enum cvmx_usb_initialize_flags {
> -	CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_XI		= 1 << 0,
> -	CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_GND		= 1 << 1,
> -	CVMX_USB_INITIALIZE_FLAGS_CLOCK_MHZ_MASK	= 3 << 3,
> -	CVMX_USB_INITIALIZE_FLAGS_CLOCK_12MHZ		= 1 << 3,
> -	CVMX_USB_INITIALIZE_FLAGS_CLOCK_24MHZ		= 2 << 3,
> -	CVMX_USB_INITIALIZE_FLAGS_CLOCK_48MHZ		= 3 << 3,
> -	/* Bits 3-4 used to encode the clock frequency */
> -	CVMX_USB_INITIALIZE_FLAGS_NO_DMA		= 1 << 5,
> -};
> -
> -/**
> - * enum cvmx_usb_pipe_flags - internal flags for a pipe.
> - *
> - * @CVMX_USB_PIPE_FLAGS_SCHEDULED: Used internally to determine if a pipe is
> - *				   actively using hardware.
> - * @CVMX_USB_PIPE_FLAGS_NEED_PING: Used internally to determine if a high speed
> - *				   pipe is in the ping state.
> - */
> -enum cvmx_usb_pipe_flags {
> -	CVMX_USB_PIPE_FLAGS_SCHEDULED	= 1 << 17,
> -	CVMX_USB_PIPE_FLAGS_NEED_PING	= 1 << 18,
> -};
> -
> -/* Maximum number of times to retry failed transactions */
> -#define MAX_RETRIES		3
> -
> -/* Maximum number of hardware channels supported by the USB block */
> -#define MAX_CHANNELS		8
> -
> -/*
> - * The low level hardware can transfer a maximum of this number of bytes in each
> - * transfer. The field is 19 bits wide
> - */
> -#define MAX_TRANSFER_BYTES	((1 << 19) - 1)
> -
> -/*
> - * The low level hardware can transfer a maximum of this number of packets in
> - * each transfer. The field is 10 bits wide
> - */
> -#define MAX_TRANSFER_PACKETS	((1 << 10) - 1)
> -
> -/**
> - * Logical transactions may take numerous low level
> - * transactions, especially when splits are concerned. This
> - * enum represents all of the possible stages a transaction can
> - * be in. Note that split completes are always even. This is so
> - * the NAK handler can backup to the previous low level
> - * transaction with a simple clearing of bit 0.
> - */
> -enum cvmx_usb_stage {
> -	CVMX_USB_STAGE_NON_CONTROL,
> -	CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE,
> -	CVMX_USB_STAGE_SETUP,
> -	CVMX_USB_STAGE_SETUP_SPLIT_COMPLETE,
> -	CVMX_USB_STAGE_DATA,
> -	CVMX_USB_STAGE_DATA_SPLIT_COMPLETE,
> -	CVMX_USB_STAGE_STATUS,
> -	CVMX_USB_STAGE_STATUS_SPLIT_COMPLETE,
> -};
> -
> -/**
> - * struct cvmx_usb_transaction - describes each pending USB transaction
> - *				 regardless of type. These are linked together
> - *				 to form a list of pending requests for a pipe.
> - *
> - * @node:		List node for transactions in the pipe.
> - * @type:		Type of transaction, duplicated of the pipe.
> - * @flags:		State flags for this transaction.
> - * @buffer:		User's physical buffer address to read/write.
> - * @buffer_length:	Size of the user's buffer in bytes.
> - * @control_header:	For control transactions, physical address of the 8
> - *			byte standard header.
> - * @iso_start_frame:	For ISO transactions, the starting frame number.
> - * @iso_number_packets:	For ISO transactions, the number of packets in the
> - *			request.
> - * @iso_packets:	For ISO transactions, the sub packets in the request.
> - * @actual_bytes:	Actual bytes transfer for this transaction.
> - * @stage:		For control transactions, the current stage.
> - * @urb:		URB.
> - */
> -struct cvmx_usb_transaction {
> -	struct list_head node;
> -	enum cvmx_usb_transfer type;
> -	u64 buffer;
> -	int buffer_length;
> -	u64 control_header;
> -	int iso_start_frame;
> -	int iso_number_packets;
> -	struct cvmx_usb_iso_packet *iso_packets;
> -	int xfersize;
> -	int pktcnt;
> -	int retries;
> -	int actual_bytes;
> -	enum cvmx_usb_stage stage;
> -	struct urb *urb;
> -};
> -
> -/**
> - * struct cvmx_usb_pipe - a pipe represents a virtual connection between Octeon
> - *			  and some USB device. It contains a list of pending
> - *			  request to the device.
> - *
> - * @node:		List node for pipe list
> - * @next:		Pipe after this one in the list
> - * @transactions:	List of pending transactions
> - * @interval:		For periodic pipes, the interval between packets in
> - *			frames
> - * @next_tx_frame:	The next frame this pipe is allowed to transmit on
> - * @flags:		State flags for this pipe
> - * @device_speed:	Speed of device connected to this pipe
> - * @transfer_type:	Type of transaction supported by this pipe
> - * @transfer_dir:	IN or OUT. Ignored for Control
> - * @multi_count:	Max packet in a row for the device
> - * @max_packet:		The device's maximum packet size in bytes
> - * @device_addr:	USB device address at other end of pipe
> - * @endpoint_num:	USB endpoint number at other end of pipe
> - * @hub_device_addr:	Hub address this device is connected to
> - * @hub_port:		Hub port this device is connected to
> - * @pid_toggle:		This toggles between 0/1 on every packet send to track
> - *			the data pid needed
> - * @channel:		Hardware DMA channel for this pipe
> - * @split_sc_frame:	The low order bits of the frame number the split
> - *			complete should be sent on
> - */
> -struct cvmx_usb_pipe {
> -	struct list_head node;
> -	struct list_head transactions;
> -	u64 interval;
> -	u64 next_tx_frame;
> -	enum cvmx_usb_pipe_flags flags;
> -	enum cvmx_usb_speed device_speed;
> -	enum cvmx_usb_transfer transfer_type;
> -	enum cvmx_usb_direction transfer_dir;
> -	int multi_count;
> -	u16 max_packet;
> -	u8 device_addr;
> -	u8 endpoint_num;
> -	u8 hub_device_addr;
> -	u8 hub_port;
> -	u8 pid_toggle;
> -	u8 channel;
> -	s8 split_sc_frame;
> -};
> -
> -struct cvmx_usb_tx_fifo {
> -	struct {
> -		int channel;
> -		int size;
> -		u64 address;
> -	} entry[MAX_CHANNELS + 1];
> -	int head;
> -	int tail;
> -};
> -
> -/**
> - * struct octeon_hcd - the state of the USB block
> - *
> - * lock:		   Serialization lock.
> - * init_flags:		   Flags passed to initialize.
> - * index:		   Which USB block this is for.
> - * idle_hardware_channels: Bit set for every idle hardware channel.
> - * usbcx_hprt:		   Stored port status so we don't need to read a CSR to
> - *			   determine splits.
> - * pipe_for_channel:	   Map channels to pipes.
> - * pipe:		   Storage for pipes.
> - * indent:		   Used by debug output to indent functions.
> - * port_status:		   Last port status used for change notification.
> - * idle_pipes:		   List of open pipes that have no transactions.
> - * active_pipes:	   Active pipes indexed by transfer type.
> - * frame_number:	   Increments every SOF interrupt for time keeping.
> - * active_split:	   Points to the current active split, or NULL.
> - */
> -struct octeon_hcd {
> -	spinlock_t lock; /* serialization lock */
> -	int init_flags;
> -	int index;
> -	int idle_hardware_channels;
> -	union cvmx_usbcx_hprt usbcx_hprt;
> -	struct cvmx_usb_pipe *pipe_for_channel[MAX_CHANNELS];
> -	int indent;
> -	struct cvmx_usb_port_status port_status;
> -	struct list_head idle_pipes;
> -	struct list_head active_pipes[4];
> -	u64 frame_number;
> -	struct cvmx_usb_transaction *active_split;
> -	struct cvmx_usb_tx_fifo periodic;
> -	struct cvmx_usb_tx_fifo nonperiodic;
> -};
> -
> -/*
> - * This macro logically sets a single field in a CSR. It does the sequence
> - * read, modify, and write
> - */
> -#define USB_SET_FIELD32(address, _union, field, value)		\
> -	do {							\
> -		union _union c;					\
> -								\
> -		c.u32 = cvmx_usb_read_csr32(usb, address);	\
> -		c.s.field = value;				\
> -		cvmx_usb_write_csr32(usb, address, c.u32);	\
> -	} while (0)
> -
> -/* Returns the IO address to push/pop stuff data from the FIFOs */
> -#define USB_FIFO_ADDRESS(channel, usb_index) \
> -	(CVMX_USBCX_GOTGCTL(usb_index) + ((channel) + 1) * 0x1000)
> -
> -/**
> - * struct octeon_temp_buffer - a bounce buffer for USB transfers
> - * @orig_buffer: the original buffer passed by the USB stack
> - * @data:	 the newly allocated temporary buffer (excluding meta-data)
> - *
> - * Both the DMA engine and FIFO mode will always transfer full 32-bit words. If
> - * the buffer is too short, we need to allocate a temporary one, and this struct
> - * represents it.
> - */
> -struct octeon_temp_buffer {
> -	void *orig_buffer;
> -	u8 data[0];
> -};
> -
> -static inline struct usb_hcd *octeon_to_hcd(struct octeon_hcd *p)
> -{
> -	return container_of((void *)p, struct usb_hcd, hcd_priv);
> -}
> -
> -/**
> - * octeon_alloc_temp_buffer - allocate a temporary buffer for USB transfer
> - *                            (if needed)
> - * @urb:	URB.
> - * @mem_flags:	Memory allocation flags.
> - *
> - * This function allocates a temporary bounce buffer whenever it's needed
> - * due to HW limitations.
> - */
> -static int octeon_alloc_temp_buffer(struct urb *urb, gfp_t mem_flags)
> -{
> -	struct octeon_temp_buffer *temp;
> -
> -	if (urb->num_sgs || urb->sg ||
> -	    (urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP) ||
> -	    !(urb->transfer_buffer_length % sizeof(u32)))
> -		return 0;
> -
> -	temp = kmalloc(ALIGN(urb->transfer_buffer_length, sizeof(u32)) +
> -		       sizeof(*temp), mem_flags);
> -	if (!temp)
> -		return -ENOMEM;
> -
> -	temp->orig_buffer = urb->transfer_buffer;
> -	if (usb_urb_dir_out(urb))
> -		memcpy(temp->data, urb->transfer_buffer,
> -		       urb->transfer_buffer_length);
> -	urb->transfer_buffer = temp->data;
> -	urb->transfer_flags |= URB_ALIGNED_TEMP_BUFFER;
> -
> -	return 0;
> -}
> -
> -/**
> - * octeon_free_temp_buffer - free a temporary buffer used by USB transfers.
> - * @urb: URB.
> - *
> - * Frees a buffer allocated by octeon_alloc_temp_buffer().
> - */
> -static void octeon_free_temp_buffer(struct urb *urb)
> -{
> -	struct octeon_temp_buffer *temp;
> -	size_t length;
> -
> -	if (!(urb->transfer_flags & URB_ALIGNED_TEMP_BUFFER))
> -		return;
> -
> -	temp = container_of(urb->transfer_buffer, struct octeon_temp_buffer,
> -			    data);
> -	if (usb_urb_dir_in(urb)) {
> -		if (usb_pipeisoc(urb->pipe))
> -			length = urb->transfer_buffer_length;
> -		else
> -			length = urb->actual_length;
> -
> -		memcpy(temp->orig_buffer, urb->transfer_buffer, length);
> -	}
> -	urb->transfer_buffer = temp->orig_buffer;
> -	urb->transfer_flags &= ~URB_ALIGNED_TEMP_BUFFER;
> -	kfree(temp);
> -}
> -
> -/**
> - * octeon_map_urb_for_dma - Octeon-specific map_urb_for_dma().
> - * @hcd:	USB HCD structure.
> - * @urb:	URB.
> - * @mem_flags:	Memory allocation flags.
> - */
> -static int octeon_map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb,
> -				  gfp_t mem_flags)
> -{
> -	int ret;
> -
> -	ret = octeon_alloc_temp_buffer(urb, mem_flags);
> -	if (ret)
> -		return ret;
> -
> -	ret = usb_hcd_map_urb_for_dma(hcd, urb, mem_flags);
> -	if (ret)
> -		octeon_free_temp_buffer(urb);
> -
> -	return ret;
> -}
> -
> -/**
> - * octeon_unmap_urb_for_dma - Octeon-specific unmap_urb_for_dma()
> - * @hcd:	USB HCD structure.
> - * @urb:	URB.
> - */
> -static void octeon_unmap_urb_for_dma(struct usb_hcd *hcd, struct urb *urb)
> -{
> -	usb_hcd_unmap_urb_for_dma(hcd, urb);
> -	octeon_free_temp_buffer(urb);
> -}
> -
> -/**
> - * Read a USB 32bit CSR. It performs the necessary address swizzle
> - * for 32bit CSRs and logs the value in a readable format if
> - * debugging is on.
> - *
> - * @usb:     USB block this access is for
> - * @address: 64bit address to read
> - *
> - * Returns: Result of the read
> - */
> -static inline u32 cvmx_usb_read_csr32(struct octeon_hcd *usb, u64 address)
> -{
> -	return cvmx_read64_uint32(address ^ 4);
> -}
> -
> -/**
> - * Write a USB 32bit CSR. It performs the necessary address
> - * swizzle for 32bit CSRs and logs the value in a readable format
> - * if debugging is on.
> - *
> - * @usb:     USB block this access is for
> - * @address: 64bit address to write
> - * @value:   Value to write
> - */
> -static inline void cvmx_usb_write_csr32(struct octeon_hcd *usb,
> -					u64 address, u32 value)
> -{
> -	cvmx_write64_uint32(address ^ 4, value);
> -	cvmx_read64_uint64(CVMX_USBNX_DMA0_INB_CHN0(usb->index));
> -}
> -
> -/**
> - * Return non zero if this pipe connects to a non HIGH speed
> - * device through a high speed hub.
> - *
> - * @usb:    USB block this access is for
> - * @pipe:   Pipe to check
> - *
> - * Returns: Non zero if we need to do split transactions
> - */
> -static inline int cvmx_usb_pipe_needs_split(struct octeon_hcd *usb,
> -					    struct cvmx_usb_pipe *pipe)
> -{
> -	return pipe->device_speed != CVMX_USB_SPEED_HIGH &&
> -	       usb->usbcx_hprt.s.prtspd == CVMX_USB_SPEED_HIGH;
> -}
> -
> -/**
> - * Trivial utility function to return the correct PID for a pipe
> - *
> - * @pipe:   pipe to check
> - *
> - * Returns: PID for pipe
> - */
> -static inline int cvmx_usb_get_data_pid(struct cvmx_usb_pipe *pipe)
> -{
> -	if (pipe->pid_toggle)
> -		return 2; /* Data1 */
> -	return 0; /* Data0 */
> -}
> -
> -/* Loops through register until txfflsh or rxfflsh become zero.*/
> -static int cvmx_wait_tx_rx(struct octeon_hcd *usb, int fflsh_type)
> -{
> -	int result;
> -	u64 address = CVMX_USBCX_GRSTCTL(usb->index);
> -	u64 done = cvmx_get_cycle() + 100 *
> -		   (u64)octeon_get_clock_rate / 1000000;
> -	union cvmx_usbcx_grstctl c;
> -
> -	while (1) {
> -		c.u32 = cvmx_usb_read_csr32(usb, address);
> -		if (fflsh_type == 0 && c.s.txfflsh == 0) {
> -			result = 0;
> -			break;
> -		} else if (fflsh_type == 1 && c.s.rxfflsh == 0) {
> -			result = 0;
> -			break;
> -		} else if (cvmx_get_cycle() > done) {
> -			result = -1;
> -			break;
> -		}
> -
> -		__delay(100);
> -	}
> -	return result;
> -}
> -
> -static void cvmx_fifo_setup(struct octeon_hcd *usb)
> -{
> -	union cvmx_usbcx_ghwcfg3 usbcx_ghwcfg3;
> -	union cvmx_usbcx_gnptxfsiz npsiz;
> -	union cvmx_usbcx_hptxfsiz psiz;
> -
> -	usbcx_ghwcfg3.u32 = cvmx_usb_read_csr32(usb,
> -						CVMX_USBCX_GHWCFG3(usb->index));
> -
> -	/*
> -	 * Program the USBC_GRXFSIZ register to select the size of the receive
> -	 * FIFO (25%).
> -	 */
> -	USB_SET_FIELD32(CVMX_USBCX_GRXFSIZ(usb->index), cvmx_usbcx_grxfsiz,
> -			rxfdep, usbcx_ghwcfg3.s.dfifodepth / 4);
> -
> -	/*
> -	 * Program the USBC_GNPTXFSIZ register to select the size and the start
> -	 * address of the non-periodic transmit FIFO for nonperiodic
> -	 * transactions (50%).
> -	 */
> -	npsiz.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_GNPTXFSIZ(usb->index));
> -	npsiz.s.nptxfdep = usbcx_ghwcfg3.s.dfifodepth / 2;
> -	npsiz.s.nptxfstaddr = usbcx_ghwcfg3.s.dfifodepth / 4;
> -	cvmx_usb_write_csr32(usb, CVMX_USBCX_GNPTXFSIZ(usb->index), npsiz.u32);
> -
> -	/*
> -	 * Program the USBC_HPTXFSIZ register to select the size and start
> -	 * address of the periodic transmit FIFO for periodic transactions
> -	 * (25%).
> -	 */
> -	psiz.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HPTXFSIZ(usb->index));
> -	psiz.s.ptxfsize = usbcx_ghwcfg3.s.dfifodepth / 4;
> -	psiz.s.ptxfstaddr = 3 * usbcx_ghwcfg3.s.dfifodepth / 4;
> -	cvmx_usb_write_csr32(usb, CVMX_USBCX_HPTXFSIZ(usb->index), psiz.u32);
> -
> -	/* Flush all FIFOs */
> -	USB_SET_FIELD32(CVMX_USBCX_GRSTCTL(usb->index),
> -			cvmx_usbcx_grstctl, txfnum, 0x10);
> -	USB_SET_FIELD32(CVMX_USBCX_GRSTCTL(usb->index),
> -			cvmx_usbcx_grstctl, txfflsh, 1);
> -	cvmx_wait_tx_rx(usb, 0);
> -	USB_SET_FIELD32(CVMX_USBCX_GRSTCTL(usb->index),
> -			cvmx_usbcx_grstctl, rxfflsh, 1);
> -	cvmx_wait_tx_rx(usb, 1);
> -}
> -
> -/**
> - * Shutdown a USB port after a call to cvmx_usb_initialize().
> - * The port should be disabled with all pipes closed when this
> - * function is called.
> - *
> - * @usb: USB device state populated by cvmx_usb_initialize().
> - *
> - * Returns: 0 or a negative error code.
> - */
> -static int cvmx_usb_shutdown(struct octeon_hcd *usb)
> -{
> -	union cvmx_usbnx_clk_ctl usbn_clk_ctl;
> -
> -	/* Make sure all pipes are closed */
> -	if (!list_empty(&usb->idle_pipes) ||
> -	    !list_empty(&usb->active_pipes[CVMX_USB_TRANSFER_ISOCHRONOUS]) ||
> -	    !list_empty(&usb->active_pipes[CVMX_USB_TRANSFER_INTERRUPT]) ||
> -	    !list_empty(&usb->active_pipes[CVMX_USB_TRANSFER_CONTROL]) ||
> -	    !list_empty(&usb->active_pipes[CVMX_USB_TRANSFER_BULK]))
> -		return -EBUSY;
> -
> -	/* Disable the clocks and put them in power on reset */
> -	usbn_clk_ctl.u64 = cvmx_read64_uint64(CVMX_USBNX_CLK_CTL(usb->index));
> -	usbn_clk_ctl.s.enable = 1;
> -	usbn_clk_ctl.s.por = 1;
> -	usbn_clk_ctl.s.hclk_rst = 1;
> -	usbn_clk_ctl.s.prst = 0;
> -	usbn_clk_ctl.s.hrst = 0;
> -	cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64);
> -	return 0;
> -}
> -
> -/**
> - * Initialize a USB port for use. This must be called before any
> - * other access to the Octeon USB port is made. The port starts
> - * off in the disabled state.
> - *
> - * @dev:	 Pointer to struct device for logging purposes.
> - * @usb:	 Pointer to struct octeon_hcd.
> - *
> - * Returns: 0 or a negative error code.
> - */
> -static int cvmx_usb_initialize(struct device *dev,
> -			       struct octeon_hcd *usb)
> -{
> -	int channel;
> -	int divisor;
> -	int retries = 0;
> -	union cvmx_usbcx_hcfg usbcx_hcfg;
> -	union cvmx_usbnx_clk_ctl usbn_clk_ctl;
> -	union cvmx_usbcx_gintsts usbc_gintsts;
> -	union cvmx_usbcx_gahbcfg usbcx_gahbcfg;
> -	union cvmx_usbcx_gintmsk usbcx_gintmsk;
> -	union cvmx_usbcx_gusbcfg usbcx_gusbcfg;
> -	union cvmx_usbnx_usbp_ctl_status usbn_usbp_ctl_status;
> -
> -retry:
> -	/*
> -	 * Power On Reset and PHY Initialization
> -	 *
> -	 * 1. Wait for DCOK to assert (nothing to do)
> -	 *
> -	 * 2a. Write USBN0/1_CLK_CTL[POR] = 1 and
> -	 *     USBN0/1_CLK_CTL[HRST,PRST,HCLK_RST] = 0
> -	 */
> -	usbn_clk_ctl.u64 = cvmx_read64_uint64(CVMX_USBNX_CLK_CTL(usb->index));
> -	usbn_clk_ctl.s.por = 1;
> -	usbn_clk_ctl.s.hrst = 0;
> -	usbn_clk_ctl.s.prst = 0;
> -	usbn_clk_ctl.s.hclk_rst = 0;
> -	usbn_clk_ctl.s.enable = 0;
> -	/*
> -	 * 2b. Select the USB reference clock/crystal parameters by writing
> -	 *     appropriate values to USBN0/1_CLK_CTL[P_C_SEL, P_RTYPE, P_COM_ON]
> -	 */
> -	if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_GND) {
> -		/*
> -		 * The USB port uses 12/24/48MHz 2.5V board clock
> -		 * source at USB_XO. USB_XI should be tied to GND.
> -		 * Most Octeon evaluation boards require this setting
> -		 */
> -		if (OCTEON_IS_MODEL(OCTEON_CN3XXX) ||
> -		    OCTEON_IS_MODEL(OCTEON_CN56XX) ||
> -		    OCTEON_IS_MODEL(OCTEON_CN50XX))
> -			/* From CN56XX,CN50XX,CN31XX,CN30XX manuals */
> -			usbn_clk_ctl.s.p_rtype = 2; /* p_rclk=1 & p_xenbn=0 */
> -		else
> -			/* From CN52XX manual */
> -			usbn_clk_ctl.s.p_rtype = 1;
> -
> -		switch (usb->init_flags &
> -			CVMX_USB_INITIALIZE_FLAGS_CLOCK_MHZ_MASK) {
> -		case CVMX_USB_INITIALIZE_FLAGS_CLOCK_12MHZ:
> -			usbn_clk_ctl.s.p_c_sel = 0;
> -			break;
> -		case CVMX_USB_INITIALIZE_FLAGS_CLOCK_24MHZ:
> -			usbn_clk_ctl.s.p_c_sel = 1;
> -			break;
> -		case CVMX_USB_INITIALIZE_FLAGS_CLOCK_48MHZ:
> -			usbn_clk_ctl.s.p_c_sel = 2;
> -			break;
> -		}
> -	} else {
> -		/*
> -		 * The USB port uses a 12MHz crystal as clock source
> -		 * at USB_XO and USB_XI
> -		 */
> -		if (OCTEON_IS_MODEL(OCTEON_CN3XXX))
> -			/* From CN31XX,CN30XX manual */
> -			usbn_clk_ctl.s.p_rtype = 3; /* p_rclk=1 & p_xenbn=1 */
> -		else
> -			/* From CN56XX,CN52XX,CN50XX manuals. */
> -			usbn_clk_ctl.s.p_rtype = 0;
> -
> -		usbn_clk_ctl.s.p_c_sel = 0;
> -	}
> -	/*
> -	 * 2c. Select the HCLK via writing USBN0/1_CLK_CTL[DIVIDE, DIVIDE2] and
> -	 *     setting USBN0/1_CLK_CTL[ENABLE] = 1. Divide the core clock down
> -	 *     such that USB is as close as possible to 125Mhz
> -	 */
> -	divisor = DIV_ROUND_UP(octeon_get_clock_rate(), 125000000);
> -	/* Lower than 4 doesn't seem to work properly */
> -	if (divisor < 4)
> -		divisor = 4;
> -	usbn_clk_ctl.s.divide = divisor;
> -	usbn_clk_ctl.s.divide2 = 0;
> -	cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64);
> -
> -	/* 2d. Write USBN0/1_CLK_CTL[HCLK_RST] = 1 */
> -	usbn_clk_ctl.s.hclk_rst = 1;
> -	cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64);
> -	/* 2e.  Wait 64 core-clock cycles for HCLK to stabilize */
> -	__delay(64);
> -	/*
> -	 * 3. Program the power-on reset field in the USBN clock-control
> -	 *    register:
> -	 *    USBN_CLK_CTL[POR] = 0
> -	 */
> -	usbn_clk_ctl.s.por = 0;
> -	cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64);
> -	/* 4. Wait 1 ms for PHY clock to start */
> -	mdelay(1);
> -	/*
> -	 * 5. Program the Reset input from automatic test equipment field in the
> -	 *    USBP control and status register:
> -	 *    USBN_USBP_CTL_STATUS[ATE_RESET] = 1
> -	 */
> -	usbn_usbp_ctl_status.u64 =
> -		cvmx_read64_uint64(CVMX_USBNX_USBP_CTL_STATUS(usb->index));
> -	usbn_usbp_ctl_status.s.ate_reset = 1;
> -	cvmx_write64_uint64(CVMX_USBNX_USBP_CTL_STATUS(usb->index),
> -			    usbn_usbp_ctl_status.u64);
> -	/* 6. Wait 10 cycles */
> -	__delay(10);
> -	/*
> -	 * 7. Clear ATE_RESET field in the USBN clock-control register:
> -	 *    USBN_USBP_CTL_STATUS[ATE_RESET] = 0
> -	 */
> -	usbn_usbp_ctl_status.s.ate_reset = 0;
> -	cvmx_write64_uint64(CVMX_USBNX_USBP_CTL_STATUS(usb->index),
> -			    usbn_usbp_ctl_status.u64);
> -	/*
> -	 * 8. Program the PHY reset field in the USBN clock-control register:
> -	 *    USBN_CLK_CTL[PRST] = 1
> -	 */
> -	usbn_clk_ctl.s.prst = 1;
> -	cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64);
> -	/*
> -	 * 9. Program the USBP control and status register to select host or
> -	 *    device mode. USBN_USBP_CTL_STATUS[HST_MODE] = 0 for host, = 1 for
> -	 *    device
> -	 */
> -	usbn_usbp_ctl_status.s.hst_mode = 0;
> -	cvmx_write64_uint64(CVMX_USBNX_USBP_CTL_STATUS(usb->index),
> -			    usbn_usbp_ctl_status.u64);
> -	/* 10. Wait 1 us */
> -	udelay(1);
> -	/*
> -	 * 11. Program the hreset_n field in the USBN clock-control register:
> -	 *     USBN_CLK_CTL[HRST] = 1
> -	 */
> -	usbn_clk_ctl.s.hrst = 1;
> -	cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64);
> -	/* 12. Proceed to USB core initialization */
> -	usbn_clk_ctl.s.enable = 1;
> -	cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64);
> -	udelay(1);
> -
> -	/*
> -	 * USB Core Initialization
> -	 *
> -	 * 1. Read USBC_GHWCFG1, USBC_GHWCFG2, USBC_GHWCFG3, USBC_GHWCFG4 to
> -	 *    determine USB core configuration parameters.
> -	 *
> -	 *    Nothing needed
> -	 *
> -	 * 2. Program the following fields in the global AHB configuration
> -	 *    register (USBC_GAHBCFG)
> -	 *    DMA mode, USBC_GAHBCFG[DMAEn]: 1 = DMA mode, 0 = slave mode
> -	 *    Burst length, USBC_GAHBCFG[HBSTLEN] = 0
> -	 *    Nonperiodic TxFIFO empty level (slave mode only),
> -	 *    USBC_GAHBCFG[NPTXFEMPLVL]
> -	 *    Periodic TxFIFO empty level (slave mode only),
> -	 *    USBC_GAHBCFG[PTXFEMPLVL]
> -	 *    Global interrupt mask, USBC_GAHBCFG[GLBLINTRMSK] = 1
> -	 */
> -	usbcx_gahbcfg.u32 = 0;
> -	usbcx_gahbcfg.s.dmaen = !(usb->init_flags &
> -				  CVMX_USB_INITIALIZE_FLAGS_NO_DMA);
> -	usbcx_gahbcfg.s.hbstlen = 0;
> -	usbcx_gahbcfg.s.nptxfemplvl = 1;
> -	usbcx_gahbcfg.s.ptxfemplvl = 1;
> -	usbcx_gahbcfg.s.glblintrmsk = 1;
> -	cvmx_usb_write_csr32(usb, CVMX_USBCX_GAHBCFG(usb->index),
> -			     usbcx_gahbcfg.u32);
> -
> -	/*
> -	 * 3. Program the following fields in USBC_GUSBCFG register.
> -	 *    HS/FS timeout calibration, USBC_GUSBCFG[TOUTCAL] = 0
> -	 *    ULPI DDR select, USBC_GUSBCFG[DDRSEL] = 0
> -	 *    USB turnaround time, USBC_GUSBCFG[USBTRDTIM] = 0x5
> -	 *    PHY low-power clock select, USBC_GUSBCFG[PHYLPWRCLKSEL] = 0
> -	 */
> -	usbcx_gusbcfg.u32 = cvmx_usb_read_csr32(usb,
> -						CVMX_USBCX_GUSBCFG(usb->index));
> -	usbcx_gusbcfg.s.toutcal = 0;
> -	usbcx_gusbcfg.s.ddrsel = 0;
> -	usbcx_gusbcfg.s.usbtrdtim = 0x5;
> -	usbcx_gusbcfg.s.phylpwrclksel = 0;
> -	cvmx_usb_write_csr32(usb, CVMX_USBCX_GUSBCFG(usb->index),
> -			     usbcx_gusbcfg.u32);
> -
> -	/*
> -	 * 4. The software must unmask the following bits in the USBC_GINTMSK
> -	 *    register.
> -	 *    OTG interrupt mask, USBC_GINTMSK[OTGINTMSK] = 1
> -	 *    Mode mismatch interrupt mask, USBC_GINTMSK[MODEMISMSK] = 1
> -	 */
> -	usbcx_gintmsk.u32 = cvmx_usb_read_csr32(usb,
> -						CVMX_USBCX_GINTMSK(usb->index));
> -	usbcx_gintmsk.s.otgintmsk = 1;
> -	usbcx_gintmsk.s.modemismsk = 1;
> -	usbcx_gintmsk.s.hchintmsk = 1;
> -	usbcx_gintmsk.s.sofmsk = 0;
> -	/* We need RX FIFO interrupts if we don't have DMA */
> -	if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA)
> -		usbcx_gintmsk.s.rxflvlmsk = 1;
> -	cvmx_usb_write_csr32(usb, CVMX_USBCX_GINTMSK(usb->index),
> -			     usbcx_gintmsk.u32);
> -
> -	/*
> -	 * Disable all channel interrupts. We'll enable them per channel later.
> -	 */
> -	for (channel = 0; channel < 8; channel++)
> -		cvmx_usb_write_csr32(usb,
> -				     CVMX_USBCX_HCINTMSKX(channel, usb->index),
> -				     0);
> -
> -	/*
> -	 * Host Port Initialization
> -	 *
> -	 * 1. Program the host-port interrupt-mask field to unmask,
> -	 *    USBC_GINTMSK[PRTINT] = 1
> -	 */
> -	USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index),
> -			cvmx_usbcx_gintmsk, prtintmsk, 1);
> -	USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index),
> -			cvmx_usbcx_gintmsk, disconnintmsk, 1);
> -
> -	/*
> -	 * 2. Program the USBC_HCFG register to select full-speed host
> -	 *    or high-speed host.
> -	 */
> -	usbcx_hcfg.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HCFG(usb->index));
> -	usbcx_hcfg.s.fslssupp = 0;
> -	usbcx_hcfg.s.fslspclksel = 0;
> -	cvmx_usb_write_csr32(usb, CVMX_USBCX_HCFG(usb->index), usbcx_hcfg.u32);
> -
> -	cvmx_fifo_setup(usb);
> -
> -	/*
> -	 * If the controller is getting port events right after the reset, it
> -	 * means the initialization failed. Try resetting the controller again
> -	 * in such case. This is seen to happen after cold boot on DSR-1000N.
> -	 */
> -	usbc_gintsts.u32 = cvmx_usb_read_csr32(usb,
> -					       CVMX_USBCX_GINTSTS(usb->index));
> -	cvmx_usb_write_csr32(usb, CVMX_USBCX_GINTSTS(usb->index),
> -			     usbc_gintsts.u32);
> -	dev_dbg(dev, "gintsts after reset: 0x%x\n", (int)usbc_gintsts.u32);
> -	if (!usbc_gintsts.s.disconnint && !usbc_gintsts.s.prtint)
> -		return 0;
> -	if (retries++ >= 5)
> -		return -EAGAIN;
> -	dev_info(dev, "controller reset failed (gintsts=0x%x) - retrying\n",
> -		 (int)usbc_gintsts.u32);
> -	msleep(50);
> -	cvmx_usb_shutdown(usb);
> -	msleep(50);
> -	goto retry;
> -}
> -
> -/**
> - * Reset a USB port. After this call succeeds, the USB port is
> - * online and servicing requests.
> - *
> - * @usb: USB device state populated by cvmx_usb_initialize().
> - */
> -static void cvmx_usb_reset_port(struct octeon_hcd *usb)
> -{
> -	usb->usbcx_hprt.u32 = cvmx_usb_read_csr32(usb,
> -						  CVMX_USBCX_HPRT(usb->index));
> -
> -	/* Program the port reset bit to start the reset process */
> -	USB_SET_FIELD32(CVMX_USBCX_HPRT(usb->index), cvmx_usbcx_hprt,
> -			prtrst, 1);
> -
> -	/*
> -	 * Wait at least 50ms (high speed), or 10ms (full speed) for the reset
> -	 * process to complete.
> -	 */
> -	mdelay(50);
> -
> -	/* Program the port reset bit to 0, USBC_HPRT[PRTRST] = 0 */
> -	USB_SET_FIELD32(CVMX_USBCX_HPRT(usb->index), cvmx_usbcx_hprt,
> -			prtrst, 0);
> -
> -	/*
> -	 * Read the port speed field to get the enumerated speed,
> -	 * USBC_HPRT[PRTSPD].
> -	 */
> -	usb->usbcx_hprt.u32 = cvmx_usb_read_csr32(usb,
> -						  CVMX_USBCX_HPRT(usb->index));
> -}
> -
> -/**
> - * Disable a USB port. After this call the USB port will not
> - * generate data transfers and will not generate events.
> - * Transactions in process will fail and call their
> - * associated callbacks.
> - *
> - * @usb: USB device state populated by cvmx_usb_initialize().
> - *
> - * Returns: 0 or a negative error code.
> - */
> -static int cvmx_usb_disable(struct octeon_hcd *usb)
> -{
> -	/* Disable the port */
> -	USB_SET_FIELD32(CVMX_USBCX_HPRT(usb->index), cvmx_usbcx_hprt,
> -			prtena, 1);
> -	return 0;
> -}
> -
> -/**
> - * Get the current state of the USB port. Use this call to
> - * determine if the usb port has anything connected, is enabled,
> - * or has some sort of error condition. The return value of this
> - * call has "changed" bits to signal of the value of some fields
> - * have changed between calls.
> - *
> - * @usb: USB device state populated by cvmx_usb_initialize().
> - *
> - * Returns: Port status information
> - */
> -static struct cvmx_usb_port_status cvmx_usb_get_status(struct octeon_hcd *usb)
> -{
> -	union cvmx_usbcx_hprt usbc_hprt;
> -	struct cvmx_usb_port_status result;
> -
> -	memset(&result, 0, sizeof(result));
> -
> -	usbc_hprt.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HPRT(usb->index));
> -	result.port_enabled = usbc_hprt.s.prtena;
> -	result.port_over_current = usbc_hprt.s.prtovrcurract;
> -	result.port_powered = usbc_hprt.s.prtpwr;
> -	result.port_speed = usbc_hprt.s.prtspd;
> -	result.connected = usbc_hprt.s.prtconnsts;
> -	result.connect_change =
> -		result.connected != usb->port_status.connected;
> -
> -	return result;
> -}
> -
> -/**
> - * Open a virtual pipe between the host and a USB device. A pipe
> - * must be opened before data can be transferred between a device
> - * and Octeon.
> - *
> - * @usb:	     USB device state populated by cvmx_usb_initialize().
> - * @device_addr:
> - *		     USB device address to open the pipe to
> - *		     (0-127).
> - * @endpoint_num:
> - *		     USB endpoint number to open the pipe to
> - *		     (0-15).
> - * @device_speed:
> - *		     The speed of the device the pipe is going
> - *		     to. This must match the device's speed,
> - *		     which may be different than the port speed.
> - * @max_packet:	     The maximum packet length the device can
> - *		     transmit/receive (low speed=0-8, full
> - *		     speed=0-1023, high speed=0-1024). This value
> - *		     comes from the standard endpoint descriptor
> - *		     field wMaxPacketSize bits <10:0>.
> - * @transfer_type:
> - *		     The type of transfer this pipe is for.
> - * @transfer_dir:
> - *		     The direction the pipe is in. This is not
> - *		     used for control pipes.
> - * @interval:	     For ISOCHRONOUS and INTERRUPT transfers,
> - *		     this is how often the transfer is scheduled
> - *		     for. All other transfers should specify
> - *		     zero. The units are in frames (8000/sec at
> - *		     high speed, 1000/sec for full speed).
> - * @multi_count:
> - *		     For high speed devices, this is the maximum
> - *		     allowed number of packet per microframe.
> - *		     Specify zero for non high speed devices. This
> - *		     value comes from the standard endpoint descriptor
> - *		     field wMaxPacketSize bits <12:11>.
> - * @hub_device_addr:
> - *		     Hub device address this device is connected
> - *		     to. Devices connected directly to Octeon
> - *		     use zero. This is only used when the device
> - *		     is full/low speed behind a high speed hub.
> - *		     The address will be of the high speed hub,
> - *		     not and full speed hubs after it.
> - * @hub_port:	     Which port on the hub the device is
> - *		     connected. Use zero for devices connected
> - *		     directly to Octeon. Like hub_device_addr,
> - *		     this is only used for full/low speed
> - *		     devices behind a high speed hub.
> - *
> - * Returns: A non-NULL value is a pipe. NULL means an error.
> - */
> -static struct cvmx_usb_pipe *cvmx_usb_open_pipe(struct octeon_hcd *usb,
> -						int device_addr,
> -						int endpoint_num,
> -						enum cvmx_usb_speed
> -							device_speed,
> -						int max_packet,
> -						enum cvmx_usb_transfer
> -							transfer_type,
> -						enum cvmx_usb_direction
> -							transfer_dir,
> -						int interval, int multi_count,
> -						int hub_device_addr,
> -						int hub_port)
> -{
> -	struct cvmx_usb_pipe *pipe;
> -
> -	pipe = kzalloc(sizeof(*pipe), GFP_ATOMIC);
> -	if (!pipe)
> -		return NULL;
> -	if ((device_speed == CVMX_USB_SPEED_HIGH) &&
> -	    (transfer_dir == CVMX_USB_DIRECTION_OUT) &&
> -	    (transfer_type == CVMX_USB_TRANSFER_BULK))
> -		pipe->flags |= CVMX_USB_PIPE_FLAGS_NEED_PING;
> -	pipe->device_addr = device_addr;
> -	pipe->endpoint_num = endpoint_num;
> -	pipe->device_speed = device_speed;
> -	pipe->max_packet = max_packet;
> -	pipe->transfer_type = transfer_type;
> -	pipe->transfer_dir = transfer_dir;
> -	INIT_LIST_HEAD(&pipe->transactions);
> -
> -	/*
> -	 * All pipes use interval to rate limit NAK processing. Force an
> -	 * interval if one wasn't supplied
> -	 */
> -	if (!interval)
> -		interval = 1;
> -	if (cvmx_usb_pipe_needs_split(usb, pipe)) {
> -		pipe->interval = interval * 8;
> -		/* Force start splits to be schedule on uFrame 0 */
> -		pipe->next_tx_frame = ((usb->frame_number + 7) & ~7) +
> -					pipe->interval;
> -	} else {
> -		pipe->interval = interval;
> -		pipe->next_tx_frame = usb->frame_number + pipe->interval;
> -	}
> -	pipe->multi_count = multi_count;
> -	pipe->hub_device_addr = hub_device_addr;
> -	pipe->hub_port = hub_port;
> -	pipe->pid_toggle = 0;
> -	pipe->split_sc_frame = -1;
> -	list_add_tail(&pipe->node, &usb->idle_pipes);
> -
> -	/*
> -	 * We don't need to tell the hardware about this pipe yet since
> -	 * it doesn't have any submitted requests
> -	 */
> -
> -	return pipe;
> -}
> -
> -/**
> - * Poll the RX FIFOs and remove data as needed. This function is only used
> - * in non DMA mode. It is very important that this function be called quickly
> - * enough to prevent FIFO overflow.
> - *
> - * @usb:	USB device state populated by cvmx_usb_initialize().
> - */
> -static void cvmx_usb_poll_rx_fifo(struct octeon_hcd *usb)
> -{
> -	union cvmx_usbcx_grxstsph rx_status;
> -	int channel;
> -	int bytes;
> -	u64 address;
> -	u32 *ptr;
> -
> -	rx_status.u32 = cvmx_usb_read_csr32(usb,
> -					    CVMX_USBCX_GRXSTSPH(usb->index));
> -	/* Only read data if IN data is there */
> -	if (rx_status.s.pktsts != 2)
> -		return;
> -	/* Check if no data is available */
> -	if (!rx_status.s.bcnt)
> -		return;
> -
> -	channel = rx_status.s.chnum;
> -	bytes = rx_status.s.bcnt;
> -	if (!bytes)
> -		return;
> -
> -	/* Get where the DMA engine would have written this data */
> -	address = cvmx_read64_uint64(CVMX_USBNX_DMA0_INB_CHN0(usb->index) +
> -				     channel * 8);
> -
> -	ptr = cvmx_phys_to_ptr(address);
> -	cvmx_write64_uint64(CVMX_USBNX_DMA0_INB_CHN0(usb->index) + channel * 8,
> -			    address + bytes);
> -
> -	/* Loop writing the FIFO data for this packet into memory */
> -	while (bytes > 0) {
> -		*ptr++ = cvmx_usb_read_csr32(usb,
> -					USB_FIFO_ADDRESS(channel, usb->index));
> -		bytes -= 4;
> -	}
> -	CVMX_SYNCW;
> -}
> -
> -/**
> - * Fill the TX hardware fifo with data out of the software
> - * fifos
> - *
> - * @usb:	    USB device state populated by cvmx_usb_initialize().
> - * @fifo:	    Software fifo to use
> - * @available:	    Amount of space in the hardware fifo
> - *
> - * Returns: Non zero if the hardware fifo was too small and needs
> - *	    to be serviced again.
> - */
> -static int cvmx_usb_fill_tx_hw(struct octeon_hcd *usb,
> -			       struct cvmx_usb_tx_fifo *fifo, int available)
> -{
> -	/*
> -	 * We're done either when there isn't anymore space or the software FIFO
> -	 * is empty
> -	 */
> -	while (available && (fifo->head != fifo->tail)) {
> -		int i = fifo->tail;
> -		const u32 *ptr = cvmx_phys_to_ptr(fifo->entry[i].address);
> -		u64 csr_address = USB_FIFO_ADDRESS(fifo->entry[i].channel,
> -						   usb->index) ^ 4;
> -		int words = available;
> -
> -		/* Limit the amount of data to what the SW fifo has */
> -		if (fifo->entry[i].size <= available) {
> -			words = fifo->entry[i].size;
> -			fifo->tail++;
> -			if (fifo->tail > MAX_CHANNELS)
> -				fifo->tail = 0;
> -		}
> -
> -		/* Update the next locations and counts */
> -		available -= words;
> -		fifo->entry[i].address += words * 4;
> -		fifo->entry[i].size -= words;
> -
> -		/*
> -		 * Write the HW fifo data. The read every three writes is due
> -		 * to an errata on CN3XXX chips
> -		 */
> -		while (words > 3) {
> -			cvmx_write64_uint32(csr_address, *ptr++);
> -			cvmx_write64_uint32(csr_address, *ptr++);
> -			cvmx_write64_uint32(csr_address, *ptr++);
> -			cvmx_read64_uint64(
> -					CVMX_USBNX_DMA0_INB_CHN0(usb->index));
> -			words -= 3;
> -		}
> -		cvmx_write64_uint32(csr_address, *ptr++);
> -		if (--words) {
> -			cvmx_write64_uint32(csr_address, *ptr++);
> -			if (--words)
> -				cvmx_write64_uint32(csr_address, *ptr++);
> -		}
> -		cvmx_read64_uint64(CVMX_USBNX_DMA0_INB_CHN0(usb->index));
> -	}
> -	return fifo->head != fifo->tail;
> -}
> -
> -/**
> - * Check the hardware FIFOs and fill them as needed
> - *
> - * @usb:	USB device state populated by cvmx_usb_initialize().
> - */
> -static void cvmx_usb_poll_tx_fifo(struct octeon_hcd *usb)
> -{
> -	if (usb->periodic.head != usb->periodic.tail) {
> -		union cvmx_usbcx_hptxsts tx_status;
> -
> -		tx_status.u32 = cvmx_usb_read_csr32(usb,
> -					CVMX_USBCX_HPTXSTS(usb->index));
> -		if (cvmx_usb_fill_tx_hw(usb, &usb->periodic,
> -					tx_status.s.ptxfspcavail))
> -			USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index),
> -					cvmx_usbcx_gintmsk, ptxfempmsk, 1);
> -		else
> -			USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index),
> -					cvmx_usbcx_gintmsk, ptxfempmsk, 0);
> -	}
> -
> -	if (usb->nonperiodic.head != usb->nonperiodic.tail) {
> -		union cvmx_usbcx_gnptxsts tx_status;
> -
> -		tx_status.u32 = cvmx_usb_read_csr32(usb,
> -					CVMX_USBCX_GNPTXSTS(usb->index));
> -		if (cvmx_usb_fill_tx_hw(usb, &usb->nonperiodic,
> -					tx_status.s.nptxfspcavail))
> -			USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index),
> -					cvmx_usbcx_gintmsk, nptxfempmsk, 1);
> -		else
> -			USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index),
> -					cvmx_usbcx_gintmsk, nptxfempmsk, 0);
> -	}
> -}
> -
> -/**
> - * Fill the TX FIFO with an outgoing packet
> - *
> - * @usb:	  USB device state populated by cvmx_usb_initialize().
> - * @channel:	  Channel number to get packet from
> - */
> -static void cvmx_usb_fill_tx_fifo(struct octeon_hcd *usb, int channel)
> -{
> -	union cvmx_usbcx_hccharx hcchar;
> -	union cvmx_usbcx_hcspltx usbc_hcsplt;
> -	union cvmx_usbcx_hctsizx usbc_hctsiz;
> -	struct cvmx_usb_tx_fifo *fifo;
> -
> -	/* We only need to fill data on outbound channels */
> -	hcchar.u32 = cvmx_usb_read_csr32(usb,
> -			CVMX_USBCX_HCCHARX(channel, usb->index));
> -	if (hcchar.s.epdir != CVMX_USB_DIRECTION_OUT)
> -		return;
> -
> -	/* OUT Splits only have data on the start and not the complete */
> -	usbc_hcsplt.u32 = cvmx_usb_read_csr32(usb,
> -				CVMX_USBCX_HCSPLTX(channel, usb->index));
> -	if (usbc_hcsplt.s.spltena && usbc_hcsplt.s.compsplt)
> -		return;
> -
> -	/*
> -	 * Find out how many bytes we need to fill and convert it into 32bit
> -	 * words.
> -	 */
> -	usbc_hctsiz.u32 = cvmx_usb_read_csr32(usb,
> -				CVMX_USBCX_HCTSIZX(channel, usb->index));
> -	if (!usbc_hctsiz.s.xfersize)
> -		return;
> -
> -	if ((hcchar.s.eptype == CVMX_USB_TRANSFER_INTERRUPT) ||
> -	    (hcchar.s.eptype == CVMX_USB_TRANSFER_ISOCHRONOUS))
> -		fifo = &usb->periodic;
> -	else
> -		fifo = &usb->nonperiodic;
> -
> -	fifo->entry[fifo->head].channel = channel;
> -	fifo->entry[fifo->head].address =
> -		cvmx_read64_uint64(CVMX_USBNX_DMA0_OUTB_CHN0(usb->index) +
> -				   channel * 8);
> -	fifo->entry[fifo->head].size = (usbc_hctsiz.s.xfersize + 3) >> 2;
> -	fifo->head++;
> -	if (fifo->head > MAX_CHANNELS)
> -		fifo->head = 0;
> -
> -	cvmx_usb_poll_tx_fifo(usb);
> -}
> -
> -/**
> - * Perform channel specific setup for Control transactions. All
> - * the generic stuff will already have been done in cvmx_usb_start_channel().
> - *
> - * @usb:	  USB device state populated by cvmx_usb_initialize().
> - * @channel:	  Channel to setup
> - * @pipe:	  Pipe for control transaction
> - */
> -static void cvmx_usb_start_channel_control(struct octeon_hcd *usb,
> -					   int channel,
> -					   struct cvmx_usb_pipe *pipe)
> -{
> -	struct usb_hcd *hcd = octeon_to_hcd(usb);
> -	struct device *dev = hcd->self.controller;
> -	struct cvmx_usb_transaction *transaction =
> -		list_first_entry(&pipe->transactions, typeof(*transaction),
> -				 node);
> -	struct usb_ctrlrequest *header =
> -		cvmx_phys_to_ptr(transaction->control_header);
> -	int bytes_to_transfer = transaction->buffer_length -
> -		transaction->actual_bytes;
> -	int packets_to_transfer;
> -	union cvmx_usbcx_hctsizx usbc_hctsiz;
> -
> -	usbc_hctsiz.u32 = cvmx_usb_read_csr32(usb,
> -				CVMX_USBCX_HCTSIZX(channel, usb->index));
> -
> -	switch (transaction->stage) {
> -	case CVMX_USB_STAGE_NON_CONTROL:
> -	case CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE:
> -		dev_err(dev, "%s: ERROR - Non control stage\n", __func__);
> -		break;
> -	case CVMX_USB_STAGE_SETUP:
> -		usbc_hctsiz.s.pid = 3; /* Setup */
> -		bytes_to_transfer = sizeof(*header);
> -		/* All Control operations start with a setup going OUT */
> -		USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index),
> -				cvmx_usbcx_hccharx, epdir,
> -				CVMX_USB_DIRECTION_OUT);
> -		/*
> -		 * Setup send the control header instead of the buffer data. The
> -		 * buffer data will be used in the next stage
> -		 */
> -		cvmx_write64_uint64(CVMX_USBNX_DMA0_OUTB_CHN0(usb->index) +
> -					channel * 8,
> -				    transaction->control_header);
> -		break;
> -	case CVMX_USB_STAGE_SETUP_SPLIT_COMPLETE:
> -		usbc_hctsiz.s.pid = 3; /* Setup */
> -		bytes_to_transfer = 0;
> -		/* All Control operations start with a setup going OUT */
> -		USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index),
> -				cvmx_usbcx_hccharx, epdir,
> -				CVMX_USB_DIRECTION_OUT);
> -
> -		USB_SET_FIELD32(CVMX_USBCX_HCSPLTX(channel, usb->index),
> -				cvmx_usbcx_hcspltx, compsplt, 1);
> -		break;
> -	case CVMX_USB_STAGE_DATA:
> -		usbc_hctsiz.s.pid = cvmx_usb_get_data_pid(pipe);
> -		if (cvmx_usb_pipe_needs_split(usb, pipe)) {
> -			if (header->bRequestType & USB_DIR_IN)
> -				bytes_to_transfer = 0;
> -			else if (bytes_to_transfer > pipe->max_packet)
> -				bytes_to_transfer = pipe->max_packet;
> -		}
> -		USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index),
> -				cvmx_usbcx_hccharx, epdir,
> -				((header->bRequestType & USB_DIR_IN) ?
> -					CVMX_USB_DIRECTION_IN :
> -					CVMX_USB_DIRECTION_OUT));
> -		break;
> -	case CVMX_USB_STAGE_DATA_SPLIT_COMPLETE:
> -		usbc_hctsiz.s.pid = cvmx_usb_get_data_pid(pipe);
> -		if (!(header->bRequestType & USB_DIR_IN))
> -			bytes_to_transfer = 0;
> -		USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index),
> -				cvmx_usbcx_hccharx, epdir,
> -				((header->bRequestType & USB_DIR_IN) ?
> -					CVMX_USB_DIRECTION_IN :
> -					CVMX_USB_DIRECTION_OUT));
> -		USB_SET_FIELD32(CVMX_USBCX_HCSPLTX(channel, usb->index),
> -				cvmx_usbcx_hcspltx, compsplt, 1);
> -		break;
> -	case CVMX_USB_STAGE_STATUS:
> -		usbc_hctsiz.s.pid = cvmx_usb_get_data_pid(pipe);
> -		bytes_to_transfer = 0;
> -		USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index),
> -				cvmx_usbcx_hccharx, epdir,
> -				((header->bRequestType & USB_DIR_IN) ?
> -					CVMX_USB_DIRECTION_OUT :
> -					CVMX_USB_DIRECTION_IN));
> -		break;
> -	case CVMX_USB_STAGE_STATUS_SPLIT_COMPLETE:
> -		usbc_hctsiz.s.pid = cvmx_usb_get_data_pid(pipe);
> -		bytes_to_transfer = 0;
> -		USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index),
> -				cvmx_usbcx_hccharx, epdir,
> -				((header->bRequestType & USB_DIR_IN) ?
> -					CVMX_USB_DIRECTION_OUT :
> -					CVMX_USB_DIRECTION_IN));
> -		USB_SET_FIELD32(CVMX_USBCX_HCSPLTX(channel, usb->index),
> -				cvmx_usbcx_hcspltx, compsplt, 1);
> -		break;
> -	}
> -
> -	/*
> -	 * Make sure the transfer never exceeds the byte limit of the hardware.
> -	 * Further bytes will be sent as continued transactions
> -	 */
> -	if (bytes_to_transfer > MAX_TRANSFER_BYTES) {
> -		/* Round MAX_TRANSFER_BYTES to a multiple of out packet size */
> -		bytes_to_transfer = MAX_TRANSFER_BYTES / pipe->max_packet;
> -		bytes_to_transfer *= pipe->max_packet;
> -	}
> -
> -	/*
> -	 * Calculate the number of packets to transfer. If the length is zero
> -	 * we still need to transfer one packet
> -	 */
> -	packets_to_transfer = DIV_ROUND_UP(bytes_to_transfer,
> -					   pipe->max_packet);
> -	if (packets_to_transfer == 0) {
> -		packets_to_transfer = 1;
> -	} else if ((packets_to_transfer > 1) &&
> -			(usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA)) {
> -		/*
> -		 * Limit to one packet when not using DMA. Channels must be
> -		 * restarted between every packet for IN transactions, so there
> -		 * is no reason to do multiple packets in a row
> -		 */
> -		packets_to_transfer = 1;
> -		bytes_to_transfer = packets_to_transfer * pipe->max_packet;
> -	} else if (packets_to_transfer > MAX_TRANSFER_PACKETS) {
> -		/*
> -		 * Limit the number of packet and data transferred to what the
> -		 * hardware can handle
> -		 */
> -		packets_to_transfer = MAX_TRANSFER_PACKETS;
> -		bytes_to_transfer = packets_to_transfer * pipe->max_packet;
> -	}
> -
> -	usbc_hctsiz.s.xfersize = bytes_to_transfer;
> -	usbc_hctsiz.s.pktcnt = packets_to_transfer;
> -
> -	cvmx_usb_write_csr32(usb, CVMX_USBCX_HCTSIZX(channel, usb->index),
> -			     usbc_hctsiz.u32);
> -}
> -
> -/**
> - * Start a channel to perform the pipe's head transaction
> - *
> - * @usb:	  USB device state populated by cvmx_usb_initialize().
> - * @channel:	  Channel to setup
> - * @pipe:	  Pipe to start
> - */
> -static void cvmx_usb_start_channel(struct octeon_hcd *usb, int channel,
> -				   struct cvmx_usb_pipe *pipe)
> -{
> -	struct cvmx_usb_transaction *transaction =
> -		list_first_entry(&pipe->transactions, typeof(*transaction),
> -				 node);
> -
> -	/* Make sure all writes to the DMA region get flushed */
> -	CVMX_SYNCW;
> -
> -	/* Attach the channel to the pipe */
> -	usb->pipe_for_channel[channel] = pipe;
> -	pipe->channel = channel;
> -	pipe->flags |= CVMX_USB_PIPE_FLAGS_SCHEDULED;
> -
> -	/* Mark this channel as in use */
> -	usb->idle_hardware_channels &= ~(1 << channel);
> -
> -	/* Enable the channel interrupt bits */
> -	{
> -		union cvmx_usbcx_hcintx usbc_hcint;
> -		union cvmx_usbcx_hcintmskx usbc_hcintmsk;
> -		union cvmx_usbcx_haintmsk usbc_haintmsk;
> -
> -		/* Clear all channel status bits */
> -		usbc_hcint.u32 = cvmx_usb_read_csr32(usb,
> -					CVMX_USBCX_HCINTX(channel, usb->index));
> -
> -		cvmx_usb_write_csr32(usb,
> -				     CVMX_USBCX_HCINTX(channel, usb->index),
> -				     usbc_hcint.u32);
> -
> -		usbc_hcintmsk.u32 = 0;
> -		usbc_hcintmsk.s.chhltdmsk = 1;
> -		if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA) {
> -			/*
> -			 * Channels need these extra interrupts when we aren't
> -			 * in DMA mode.
> -			 */
> -			usbc_hcintmsk.s.datatglerrmsk = 1;
> -			usbc_hcintmsk.s.frmovrunmsk = 1;
> -			usbc_hcintmsk.s.bblerrmsk = 1;
> -			usbc_hcintmsk.s.xacterrmsk = 1;
> -			if (cvmx_usb_pipe_needs_split(usb, pipe)) {
> -				/*
> -				 * Splits don't generate xfercompl, so we need
> -				 * ACK and NYET.
> -				 */
> -				usbc_hcintmsk.s.nyetmsk = 1;
> -				usbc_hcintmsk.s.ackmsk = 1;
> -			}
> -			usbc_hcintmsk.s.nakmsk = 1;
> -			usbc_hcintmsk.s.stallmsk = 1;
> -			usbc_hcintmsk.s.xfercomplmsk = 1;
> -		}
> -		cvmx_usb_write_csr32(usb,
> -				     CVMX_USBCX_HCINTMSKX(channel, usb->index),
> -				     usbc_hcintmsk.u32);
> -
> -		/* Enable the channel interrupt to propagate */
> -		usbc_haintmsk.u32 = cvmx_usb_read_csr32(usb,
> -					CVMX_USBCX_HAINTMSK(usb->index));
> -		usbc_haintmsk.s.haintmsk |= 1 << channel;
> -		cvmx_usb_write_csr32(usb, CVMX_USBCX_HAINTMSK(usb->index),
> -				     usbc_haintmsk.u32);
> -	}
> -
> -	/* Setup the location the DMA engine uses. */
> -	{
> -		u64 reg;
> -		u64 dma_address = transaction->buffer +
> -				  transaction->actual_bytes;
> -
> -		if (transaction->type == CVMX_USB_TRANSFER_ISOCHRONOUS)
> -			dma_address = transaction->buffer +
> -					transaction->iso_packets[0].offset +
> -					transaction->actual_bytes;
> -
> -		if (pipe->transfer_dir == CVMX_USB_DIRECTION_OUT)
> -			reg = CVMX_USBNX_DMA0_OUTB_CHN0(usb->index);
> -		else
> -			reg = CVMX_USBNX_DMA0_INB_CHN0(usb->index);
> -		cvmx_write64_uint64(reg + channel * 8, dma_address);
> -	}
> -
> -	/* Setup both the size of the transfer and the SPLIT characteristics */
> -	{
> -		union cvmx_usbcx_hcspltx usbc_hcsplt = {.u32 = 0};
> -		union cvmx_usbcx_hctsizx usbc_hctsiz = {.u32 = 0};
> -		int packets_to_transfer;
> -		int bytes_to_transfer = transaction->buffer_length -
> -			transaction->actual_bytes;
> -
> -		/*
> -		 * ISOCHRONOUS transactions store each individual transfer size
> -		 * in the packet structure, not the global buffer_length
> -		 */
> -		if (transaction->type == CVMX_USB_TRANSFER_ISOCHRONOUS)
> -			bytes_to_transfer =
> -				transaction->iso_packets[0].length -
> -				transaction->actual_bytes;
> -
> -		/*
> -		 * We need to do split transactions when we are talking to non
> -		 * high speed devices that are behind a high speed hub
> -		 */
> -		if (cvmx_usb_pipe_needs_split(usb, pipe)) {
> -			/*
> -			 * On the start split phase (stage is even) record the
> -			 * frame number we will need to send the split complete.
> -			 * We only store the lower two bits since the time ahead
> -			 * can only be two frames
> -			 */
> -			if ((transaction->stage & 1) == 0) {
> -				if (transaction->type == CVMX_USB_TRANSFER_BULK)
> -					pipe->split_sc_frame =
> -						(usb->frame_number + 1) & 0x7f;
> -				else
> -					pipe->split_sc_frame =
> -						(usb->frame_number + 2) & 0x7f;
> -			} else {
> -				pipe->split_sc_frame = -1;
> -			}
> -
> -			usbc_hcsplt.s.spltena = 1;
> -			usbc_hcsplt.s.hubaddr = pipe->hub_device_addr;
> -			usbc_hcsplt.s.prtaddr = pipe->hub_port;
> -			usbc_hcsplt.s.compsplt = (transaction->stage ==
> -				CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE);
> -
> -			/*
> -			 * SPLIT transactions can only ever transmit one data
> -			 * packet so limit the transfer size to the max packet
> -			 * size
> -			 */
> -			if (bytes_to_transfer > pipe->max_packet)
> -				bytes_to_transfer = pipe->max_packet;
> -
> -			/*
> -			 * ISOCHRONOUS OUT splits are unique in that they limit
> -			 * data transfers to 188 byte chunks representing the
> -			 * begin/middle/end of the data or all
> -			 */
> -			if (!usbc_hcsplt.s.compsplt &&
> -			    (pipe->transfer_dir == CVMX_USB_DIRECTION_OUT) &&
> -			    (pipe->transfer_type ==
> -			     CVMX_USB_TRANSFER_ISOCHRONOUS)) {
> -				/*
> -				 * Clear the split complete frame number as
> -				 * there isn't going to be a split complete
> -				 */
> -				pipe->split_sc_frame = -1;
> -				/*
> -				 * See if we've started this transfer and sent
> -				 * data
> -				 */
> -				if (transaction->actual_bytes == 0) {
> -					/*
> -					 * Nothing sent yet, this is either a
> -					 * begin or the entire payload
> -					 */
> -					if (bytes_to_transfer <= 188)
> -						/* Entire payload in one go */
> -						usbc_hcsplt.s.xactpos = 3;
> -					else
> -						/* First part of payload */
> -						usbc_hcsplt.s.xactpos = 2;
> -				} else {
> -					/*
> -					 * Continuing the previous data, we must
> -					 * either be in the middle or at the end
> -					 */
> -					if (bytes_to_transfer <= 188)
> -						/* End of payload */
> -						usbc_hcsplt.s.xactpos = 1;
> -					else
> -						/* Middle of payload */
> -						usbc_hcsplt.s.xactpos = 0;
> -				}
> -				/*
> -				 * Again, the transfer size is limited to 188
> -				 * bytes
> -				 */
> -				if (bytes_to_transfer > 188)
> -					bytes_to_transfer = 188;
> -			}
> -		}
> -
> -		/*
> -		 * Make sure the transfer never exceeds the byte limit of the
> -		 * hardware. Further bytes will be sent as continued
> -		 * transactions
> -		 */
> -		if (bytes_to_transfer > MAX_TRANSFER_BYTES) {
> -			/*
> -			 * Round MAX_TRANSFER_BYTES to a multiple of out packet
> -			 * size
> -			 */
> -			bytes_to_transfer = MAX_TRANSFER_BYTES /
> -				pipe->max_packet;
> -			bytes_to_transfer *= pipe->max_packet;
> -		}
> -
> -		/*
> -		 * Calculate the number of packets to transfer. If the length is
> -		 * zero we still need to transfer one packet
> -		 */
> -		packets_to_transfer =
> -			DIV_ROUND_UP(bytes_to_transfer, pipe->max_packet);
> -		if (packets_to_transfer == 0) {
> -			packets_to_transfer = 1;
> -		} else if ((packets_to_transfer > 1) &&
> -			   (usb->init_flags &
> -			    CVMX_USB_INITIALIZE_FLAGS_NO_DMA)) {
> -			/*
> -			 * Limit to one packet when not using DMA. Channels must
> -			 * be restarted between every packet for IN
> -			 * transactions, so there is no reason to do multiple
> -			 * packets in a row
> -			 */
> -			packets_to_transfer = 1;
> -			bytes_to_transfer = packets_to_transfer *
> -				pipe->max_packet;
> -		} else if (packets_to_transfer > MAX_TRANSFER_PACKETS) {
> -			/*
> -			 * Limit the number of packet and data transferred to
> -			 * what the hardware can handle
> -			 */
> -			packets_to_transfer = MAX_TRANSFER_PACKETS;
> -			bytes_to_transfer = packets_to_transfer *
> -				pipe->max_packet;
> -		}
> -
> -		usbc_hctsiz.s.xfersize = bytes_to_transfer;
> -		usbc_hctsiz.s.pktcnt = packets_to_transfer;
> -
> -		/* Update the DATA0/DATA1 toggle */
> -		usbc_hctsiz.s.pid = cvmx_usb_get_data_pid(pipe);
> -		/*
> -		 * High speed pipes may need a hardware ping before they start
> -		 */
> -		if (pipe->flags & CVMX_USB_PIPE_FLAGS_NEED_PING)
> -			usbc_hctsiz.s.dopng = 1;
> -
> -		cvmx_usb_write_csr32(usb,
> -				     CVMX_USBCX_HCSPLTX(channel, usb->index),
> -				     usbc_hcsplt.u32);
> -		cvmx_usb_write_csr32(usb,
> -				     CVMX_USBCX_HCTSIZX(channel, usb->index),
> -				     usbc_hctsiz.u32);
> -	}
> -
> -	/* Setup the Host Channel Characteristics Register */
> -	{
> -		union cvmx_usbcx_hccharx usbc_hcchar = {.u32 = 0};
> -
> -		/*
> -		 * Set the startframe odd/even properly. This is only used for
> -		 * periodic
> -		 */
> -		usbc_hcchar.s.oddfrm = usb->frame_number & 1;
> -
> -		/*
> -		 * Set the number of back to back packets allowed by this
> -		 * endpoint. Split transactions interpret "ec" as the number of
> -		 * immediate retries of failure. These retries happen too
> -		 * quickly, so we disable these entirely for splits
> -		 */
> -		if (cvmx_usb_pipe_needs_split(usb, pipe))
> -			usbc_hcchar.s.ec = 1;
> -		else if (pipe->multi_count < 1)
> -			usbc_hcchar.s.ec = 1;
> -		else if (pipe->multi_count > 3)
> -			usbc_hcchar.s.ec = 3;
> -		else
> -			usbc_hcchar.s.ec = pipe->multi_count;
> -
> -		/* Set the rest of the endpoint specific settings */
> -		usbc_hcchar.s.devaddr = pipe->device_addr;
> -		usbc_hcchar.s.eptype = transaction->type;
> -		usbc_hcchar.s.lspddev =
> -			(pipe->device_speed == CVMX_USB_SPEED_LOW);
> -		usbc_hcchar.s.epdir = pipe->transfer_dir;
> -		usbc_hcchar.s.epnum = pipe->endpoint_num;
> -		usbc_hcchar.s.mps = pipe->max_packet;
> -		cvmx_usb_write_csr32(usb,
> -				     CVMX_USBCX_HCCHARX(channel, usb->index),
> -				     usbc_hcchar.u32);
> -	}
> -
> -	/* Do transaction type specific fixups as needed */
> -	switch (transaction->type) {
> -	case CVMX_USB_TRANSFER_CONTROL:
> -		cvmx_usb_start_channel_control(usb, channel, pipe);
> -		break;
> -	case CVMX_USB_TRANSFER_BULK:
> -	case CVMX_USB_TRANSFER_INTERRUPT:
> -		break;
> -	case CVMX_USB_TRANSFER_ISOCHRONOUS:
> -		if (!cvmx_usb_pipe_needs_split(usb, pipe)) {
> -			/*
> -			 * ISO transactions require different PIDs depending on
> -			 * direction and how many packets are needed
> -			 */
> -			if (pipe->transfer_dir == CVMX_USB_DIRECTION_OUT) {
> -				if (pipe->multi_count < 2) /* Need DATA0 */
> -					USB_SET_FIELD32(
> -						CVMX_USBCX_HCTSIZX(channel,
> -								   usb->index),
> -						cvmx_usbcx_hctsizx, pid, 0);
> -				else /* Need MDATA */
> -					USB_SET_FIELD32(
> -						CVMX_USBCX_HCTSIZX(channel,
> -								   usb->index),
> -						cvmx_usbcx_hctsizx, pid, 3);
> -			}
> -		}
> -		break;
> -	}
> -	{
> -		union cvmx_usbcx_hctsizx usbc_hctsiz = { .u32 =
> -			cvmx_usb_read_csr32(usb,
> -					    CVMX_USBCX_HCTSIZX(channel,
> -							       usb->index))
> -		};
> -		transaction->xfersize = usbc_hctsiz.s.xfersize;
> -		transaction->pktcnt = usbc_hctsiz.s.pktcnt;
> -	}
> -	/* Remember when we start a split transaction */
> -	if (cvmx_usb_pipe_needs_split(usb, pipe))
> -		usb->active_split = transaction;
> -	USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index),
> -			cvmx_usbcx_hccharx, chena, 1);
> -	if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA)
> -		cvmx_usb_fill_tx_fifo(usb, channel);
> -}
> -
> -/**
> - * Find a pipe that is ready to be scheduled to hardware.
> - * @usb:	 USB device state populated by cvmx_usb_initialize().
> - * @xfer_type:	 Transfer type
> - *
> - * Returns: Pipe or NULL if none are ready
> - */
> -static struct cvmx_usb_pipe *cvmx_usb_find_ready_pipe(struct octeon_hcd *usb,
> -		enum cvmx_usb_transfer xfer_type)
> -{
> -	struct list_head *list = usb->active_pipes + xfer_type;
> -	u64 current_frame = usb->frame_number;
> -	struct cvmx_usb_pipe *pipe;
> -
> -	list_for_each_entry(pipe, list, node) {
> -		struct cvmx_usb_transaction *t =
> -			list_first_entry(&pipe->transactions, typeof(*t),
> -					 node);
> -		if (!(pipe->flags & CVMX_USB_PIPE_FLAGS_SCHEDULED) && t &&
> -		    (pipe->next_tx_frame <= current_frame) &&
> -		    ((pipe->split_sc_frame == -1) ||
> -		     ((((int)current_frame - pipe->split_sc_frame) & 0x7f) <
> -		      0x40)) &&
> -		    (!usb->active_split || (usb->active_split == t))) {
> -			prefetch(t);
> -			return pipe;
> -		}
> -	}
> -	return NULL;
> -}
> -
> -static struct cvmx_usb_pipe *cvmx_usb_next_pipe(struct octeon_hcd *usb,
> -						int is_sof)
> -{
> -	struct cvmx_usb_pipe *pipe;
> -
> -	/* Find a pipe needing service. */
> -	if (is_sof) {
> -		/*
> -		 * Only process periodic pipes on SOF interrupts. This way we
> -		 * are sure that the periodic data is sent in the beginning of
> -		 * the frame.
> -		 */
> -		pipe = cvmx_usb_find_ready_pipe(usb,
> -						CVMX_USB_TRANSFER_ISOCHRONOUS);
> -		if (pipe)
> -			return pipe;
> -		pipe = cvmx_usb_find_ready_pipe(usb,
> -						CVMX_USB_TRANSFER_INTERRUPT);
> -		if (pipe)
> -			return pipe;
> -	}
> -	pipe = cvmx_usb_find_ready_pipe(usb, CVMX_USB_TRANSFER_CONTROL);
> -	if (pipe)
> -		return pipe;
> -	return cvmx_usb_find_ready_pipe(usb, CVMX_USB_TRANSFER_BULK);
> -}
> -
> -/**
> - * Called whenever a pipe might need to be scheduled to the
> - * hardware.
> - *
> - * @usb:	 USB device state populated by cvmx_usb_initialize().
> - * @is_sof:	 True if this schedule was called on a SOF interrupt.
> - */
> -static void cvmx_usb_schedule(struct octeon_hcd *usb, int is_sof)
> -{
> -	int channel;
> -	struct cvmx_usb_pipe *pipe;
> -	int need_sof;
> -	enum cvmx_usb_transfer ttype;
> -
> -	if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA) {
> -		/*
> -		 * Without DMA we need to be careful to not schedule something
> -		 * at the end of a frame and cause an overrun.
> -		 */
> -		union cvmx_usbcx_hfnum hfnum = {
> -			.u32 = cvmx_usb_read_csr32(usb,
> -						CVMX_USBCX_HFNUM(usb->index))
> -		};
> -
> -		union cvmx_usbcx_hfir hfir = {
> -			.u32 = cvmx_usb_read_csr32(usb,
> -						CVMX_USBCX_HFIR(usb->index))
> -		};
> -
> -		if (hfnum.s.frrem < hfir.s.frint / 4)
> -			goto done;
> -	}
> -
> -	while (usb->idle_hardware_channels) {
> -		/* Find an idle channel */
> -		channel = __fls(usb->idle_hardware_channels);
> -		if (unlikely(channel > 7))
> -			break;
> -
> -		pipe = cvmx_usb_next_pipe(usb, is_sof);
> -		if (!pipe)
> -			break;
> -
> -		cvmx_usb_start_channel(usb, channel, pipe);
> -	}
> -
> -done:
> -	/*
> -	 * Only enable SOF interrupts when we have transactions pending in the
> -	 * future that might need to be scheduled
> -	 */
> -	need_sof = 0;
> -	for (ttype = CVMX_USB_TRANSFER_CONTROL;
> -	     ttype <= CVMX_USB_TRANSFER_INTERRUPT; ttype++) {
> -		list_for_each_entry(pipe, &usb->active_pipes[ttype], node) {
> -			if (pipe->next_tx_frame > usb->frame_number) {
> -				need_sof = 1;
> -				break;
> -			}
> -		}
> -	}
> -	USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index),
> -			cvmx_usbcx_gintmsk, sofmsk, need_sof);
> -}
> -
> -static void octeon_usb_urb_complete_callback(struct octeon_hcd *usb,
> -					     enum cvmx_usb_status status,
> -					     struct cvmx_usb_pipe *pipe,
> -					     struct cvmx_usb_transaction
> -						*transaction,
> -					     int bytes_transferred,
> -					     struct urb *urb)
> -{
> -	struct usb_hcd *hcd = octeon_to_hcd(usb);
> -	struct device *dev = hcd->self.controller;
> -
> -	if (likely(status == CVMX_USB_STATUS_OK))
> -		urb->actual_length = bytes_transferred;
> -	else
> -		urb->actual_length = 0;
> -
> -	urb->hcpriv = NULL;
> -
> -	/* For Isochronous transactions we need to update the URB packet status
> -	 * list from data in our private copy
> -	 */
> -	if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) {
> -		int i;
> -		/*
> -		 * The pointer to the private list is stored in the setup_packet
> -		 * field.
> -		 */
> -		struct cvmx_usb_iso_packet *iso_packet =
> -			(struct cvmx_usb_iso_packet *)urb->setup_packet;
> -		/* Recalculate the transfer size by adding up each packet */
> -		urb->actual_length = 0;
> -		for (i = 0; i < urb->number_of_packets; i++) {
> -			if (iso_packet[i].status == CVMX_USB_STATUS_OK) {
> -				urb->iso_frame_desc[i].status = 0;
> -				urb->iso_frame_desc[i].actual_length =
> -					iso_packet[i].length;
> -				urb->actual_length +=
> -					urb->iso_frame_desc[i].actual_length;
> -			} else {
> -				dev_dbg(dev, "ISOCHRONOUS packet=%d of %d status=%d pipe=%p transaction=%p size=%d\n",
> -					i, urb->number_of_packets,
> -					iso_packet[i].status, pipe,
> -					transaction, iso_packet[i].length);
> -				urb->iso_frame_desc[i].status = -EREMOTEIO;
> -			}
> -		}
> -		/* Free the private list now that we don't need it anymore */
> -		kfree(iso_packet);
> -		urb->setup_packet = NULL;
> -	}
> -
> -	switch (status) {
> -	case CVMX_USB_STATUS_OK:
> -		urb->status = 0;
> -		break;
> -	case CVMX_USB_STATUS_CANCEL:
> -		if (urb->status == 0)
> -			urb->status = -ENOENT;
> -		break;
> -	case CVMX_USB_STATUS_STALL:
> -		dev_dbg(dev, "status=stall pipe=%p transaction=%p size=%d\n",
> -			pipe, transaction, bytes_transferred);
> -		urb->status = -EPIPE;
> -		break;
> -	case CVMX_USB_STATUS_BABBLEERR:
> -		dev_dbg(dev, "status=babble pipe=%p transaction=%p size=%d\n",
> -			pipe, transaction, bytes_transferred);
> -		urb->status = -EPIPE;
> -		break;
> -	case CVMX_USB_STATUS_SHORT:
> -		dev_dbg(dev, "status=short pipe=%p transaction=%p size=%d\n",
> -			pipe, transaction, bytes_transferred);
> -		urb->status = -EREMOTEIO;
> -		break;
> -	case CVMX_USB_STATUS_ERROR:
> -	case CVMX_USB_STATUS_XACTERR:
> -	case CVMX_USB_STATUS_DATATGLERR:
> -	case CVMX_USB_STATUS_FRAMEERR:
> -		dev_dbg(dev, "status=%d pipe=%p transaction=%p size=%d\n",
> -			status, pipe, transaction, bytes_transferred);
> -		urb->status = -EPROTO;
> -		break;
> -	}
> -	usb_hcd_unlink_urb_from_ep(octeon_to_hcd(usb), urb);
> -	spin_unlock(&usb->lock);
> -	usb_hcd_giveback_urb(octeon_to_hcd(usb), urb, urb->status);
> -	spin_lock(&usb->lock);
> -}
> -
> -/**
> - * Signal the completion of a transaction and free it. The
> - * transaction will be removed from the pipe transaction list.
> - *
> - * @usb:	 USB device state populated by cvmx_usb_initialize().
> - * @pipe:	 Pipe the transaction is on
> - * @transaction:
> - *		 Transaction that completed
> - * @complete_code:
> - *		 Completion code
> - */
> -static void cvmx_usb_complete(struct octeon_hcd *usb,
> -			      struct cvmx_usb_pipe *pipe,
> -			      struct cvmx_usb_transaction *transaction,
> -			      enum cvmx_usb_status complete_code)
> -{
> -	/* If this was a split then clear our split in progress marker */
> -	if (usb->active_split == transaction)
> -		usb->active_split = NULL;
> -
> -	/*
> -	 * Isochronous transactions need extra processing as they might not be
> -	 * done after a single data transfer
> -	 */
> -	if (unlikely(transaction->type == CVMX_USB_TRANSFER_ISOCHRONOUS)) {
> -		/* Update the number of bytes transferred in this ISO packet */
> -		transaction->iso_packets[0].length = transaction->actual_bytes;
> -		transaction->iso_packets[0].status = complete_code;
> -
> -		/*
> -		 * If there are more ISOs pending and we succeeded, schedule the
> -		 * next one
> -		 */
> -		if ((transaction->iso_number_packets > 1) &&
> -		    (complete_code == CVMX_USB_STATUS_OK)) {
> -			/* No bytes transferred for this packet as of yet */
> -			transaction->actual_bytes = 0;
> -			/* One less ISO waiting to transfer */
> -			transaction->iso_number_packets--;
> -			/* Increment to the next location in our packet array */
> -			transaction->iso_packets++;
> -			transaction->stage = CVMX_USB_STAGE_NON_CONTROL;
> -			return;
> -		}
> -	}
> -
> -	/* Remove the transaction from the pipe list */
> -	list_del(&transaction->node);
> -	if (list_empty(&pipe->transactions))
> -		list_move_tail(&pipe->node, &usb->idle_pipes);
> -	octeon_usb_urb_complete_callback(usb, complete_code, pipe,
> -					 transaction,
> -					 transaction->actual_bytes,
> -					 transaction->urb);
> -	kfree(transaction);
> -}
> -
> -/**
> - * Submit a usb transaction to a pipe. Called for all types
> - * of transactions.
> - *
> - * @usb:
> - * @pipe:	    Which pipe to submit to.
> - * @type:	    Transaction type
> - * @buffer:	    User buffer for the transaction
> - * @buffer_length:
> - *		    User buffer's length in bytes
> - * @control_header:
> - *		    For control transactions, the 8 byte standard header
> - * @iso_start_frame:
> - *		    For ISO transactions, the start frame
> - * @iso_number_packets:
> - *		    For ISO, the number of packet in the transaction.
> - * @iso_packets:
> - *		    A description of each ISO packet
> - * @urb:	    URB for the callback
> - *
> - * Returns: Transaction or NULL on failure.
> - */
> -static struct cvmx_usb_transaction *cvmx_usb_submit_transaction(
> -				struct octeon_hcd *usb,
> -				struct cvmx_usb_pipe *pipe,
> -				enum cvmx_usb_transfer type,
> -				u64 buffer,
> -				int buffer_length,
> -				u64 control_header,
> -				int iso_start_frame,
> -				int iso_number_packets,
> -				struct cvmx_usb_iso_packet *iso_packets,
> -				struct urb *urb)
> -{
> -	struct cvmx_usb_transaction *transaction;
> -
> -	if (unlikely(pipe->transfer_type != type))
> -		return NULL;
> -
> -	transaction = kzalloc(sizeof(*transaction), GFP_ATOMIC);
> -	if (unlikely(!transaction))
> -		return NULL;
> -
> -	transaction->type = type;
> -	transaction->buffer = buffer;
> -	transaction->buffer_length = buffer_length;
> -	transaction->control_header = control_header;
> -	/* FIXME: This is not used, implement it. */
> -	transaction->iso_start_frame = iso_start_frame;
> -	transaction->iso_number_packets = iso_number_packets;
> -	transaction->iso_packets = iso_packets;
> -	transaction->urb = urb;
> -	if (transaction->type == CVMX_USB_TRANSFER_CONTROL)
> -		transaction->stage = CVMX_USB_STAGE_SETUP;
> -	else
> -		transaction->stage = CVMX_USB_STAGE_NON_CONTROL;
> -
> -	if (!list_empty(&pipe->transactions)) {
> -		list_add_tail(&transaction->node, &pipe->transactions);
> -	} else {
> -		list_add_tail(&transaction->node, &pipe->transactions);
> -		list_move_tail(&pipe->node,
> -			       &usb->active_pipes[pipe->transfer_type]);
> -
> -		/*
> -		 * We may need to schedule the pipe if this was the head of the
> -		 * pipe.
> -		 */
> -		cvmx_usb_schedule(usb, 0);
> -	}
> -
> -	return transaction;
> -}
> -
> -/**
> - * Call to submit a USB Bulk transfer to a pipe.
> - *
> - * @usb:	    USB device state populated by cvmx_usb_initialize().
> - * @pipe:	    Handle to the pipe for the transfer.
> - * @urb:	    URB.
> - *
> - * Returns: A submitted transaction or NULL on failure.
> - */
> -static struct cvmx_usb_transaction *cvmx_usb_submit_bulk(
> -						struct octeon_hcd *usb,
> -						struct cvmx_usb_pipe *pipe,
> -						struct urb *urb)
> -{
> -	return cvmx_usb_submit_transaction(usb, pipe, CVMX_USB_TRANSFER_BULK,
> -					   urb->transfer_dma,
> -					   urb->transfer_buffer_length,
> -					   0, /* control_header */
> -					   0, /* iso_start_frame */
> -					   0, /* iso_number_packets */
> -					   NULL, /* iso_packets */
> -					   urb);
> -}
> -
> -/**
> - * Call to submit a USB Interrupt transfer to a pipe.
> - *
> - * @usb:	    USB device state populated by cvmx_usb_initialize().
> - * @pipe:	    Handle to the pipe for the transfer.
> - * @urb:	    URB returned when the callback is called.
> - *
> - * Returns: A submitted transaction or NULL on failure.
> - */
> -static struct cvmx_usb_transaction *cvmx_usb_submit_interrupt(
> -						struct octeon_hcd *usb,
> -						struct cvmx_usb_pipe *pipe,
> -						struct urb *urb)
> -{
> -	return cvmx_usb_submit_transaction(usb, pipe,
> -					   CVMX_USB_TRANSFER_INTERRUPT,
> -					   urb->transfer_dma,
> -					   urb->transfer_buffer_length,
> -					   0, /* control_header */
> -					   0, /* iso_start_frame */
> -					   0, /* iso_number_packets */
> -					   NULL, /* iso_packets */
> -					   urb);
> -}
> -
> -/**
> - * Call to submit a USB Control transfer to a pipe.
> - *
> - * @usb:	    USB device state populated by cvmx_usb_initialize().
> - * @pipe:	    Handle to the pipe for the transfer.
> - * @urb:	    URB.
> - *
> - * Returns: A submitted transaction or NULL on failure.
> - */
> -static struct cvmx_usb_transaction *cvmx_usb_submit_control(
> -						struct octeon_hcd *usb,
> -						struct cvmx_usb_pipe *pipe,
> -						struct urb *urb)
> -{
> -	int buffer_length = urb->transfer_buffer_length;
> -	u64 control_header = urb->setup_dma;
> -	struct usb_ctrlrequest *header = cvmx_phys_to_ptr(control_header);
> -
> -	if ((header->bRequestType & USB_DIR_IN) == 0)
> -		buffer_length = le16_to_cpu(header->wLength);
> -
> -	return cvmx_usb_submit_transaction(usb, pipe,
> -					   CVMX_USB_TRANSFER_CONTROL,
> -					   urb->transfer_dma, buffer_length,
> -					   control_header,
> -					   0, /* iso_start_frame */
> -					   0, /* iso_number_packets */
> -					   NULL, /* iso_packets */
> -					   urb);
> -}
> -
> -/**
> - * Call to submit a USB Isochronous transfer to a pipe.
> - *
> - * @usb:	    USB device state populated by cvmx_usb_initialize().
> - * @pipe:	    Handle to the pipe for the transfer.
> - * @urb:	    URB returned when the callback is called.
> - *
> - * Returns: A submitted transaction or NULL on failure.
> - */
> -static struct cvmx_usb_transaction *cvmx_usb_submit_isochronous(
> -						struct octeon_hcd *usb,
> -						struct cvmx_usb_pipe *pipe,
> -						struct urb *urb)
> -{
> -	struct cvmx_usb_iso_packet *packets;
> -
> -	packets = (struct cvmx_usb_iso_packet *)urb->setup_packet;
> -	return cvmx_usb_submit_transaction(usb, pipe,
> -					   CVMX_USB_TRANSFER_ISOCHRONOUS,
> -					   urb->transfer_dma,
> -					   urb->transfer_buffer_length,
> -					   0, /* control_header */
> -					   urb->start_frame,
> -					   urb->number_of_packets,
> -					   packets, urb);
> -}
> -
> -/**
> - * Cancel one outstanding request in a pipe. Canceling a request
> - * can fail if the transaction has already completed before cancel
> - * is called. Even after a successful cancel call, it may take
> - * a frame or two for the cvmx_usb_poll() function to call the
> - * associated callback.
> - *
> - * @usb:	 USB device state populated by cvmx_usb_initialize().
> - * @pipe:	 Pipe to cancel requests in.
> - * @transaction: Transaction to cancel, returned by the submit function.
> - *
> - * Returns: 0 or a negative error code.
> - */
> -static int cvmx_usb_cancel(struct octeon_hcd *usb,
> -			   struct cvmx_usb_pipe *pipe,
> -			   struct cvmx_usb_transaction *transaction)
> -{
> -	/*
> -	 * If the transaction is the HEAD of the queue and scheduled. We need to
> -	 * treat it special
> -	 */
> -	if (list_first_entry(&pipe->transactions, typeof(*transaction), node) ==
> -	    transaction && (pipe->flags & CVMX_USB_PIPE_FLAGS_SCHEDULED)) {
> -		union cvmx_usbcx_hccharx usbc_hcchar;
> -
> -		usb->pipe_for_channel[pipe->channel] = NULL;
> -		pipe->flags &= ~CVMX_USB_PIPE_FLAGS_SCHEDULED;
> -
> -		CVMX_SYNCW;
> -
> -		usbc_hcchar.u32 = cvmx_usb_read_csr32(usb,
> -				CVMX_USBCX_HCCHARX(pipe->channel, usb->index));
> -		/*
> -		 * If the channel isn't enabled then the transaction already
> -		 * completed.
> -		 */
> -		if (usbc_hcchar.s.chena) {
> -			usbc_hcchar.s.chdis = 1;
> -			cvmx_usb_write_csr32(usb,
> -					     CVMX_USBCX_HCCHARX(pipe->channel,
> -								usb->index),
> -					     usbc_hcchar.u32);
> -		}
> -	}
> -	cvmx_usb_complete(usb, pipe, transaction, CVMX_USB_STATUS_CANCEL);
> -	return 0;
> -}
> -
> -/**
> - * Cancel all outstanding requests in a pipe. Logically all this
> - * does is call cvmx_usb_cancel() in a loop.
> - *
> - * @usb:	 USB device state populated by cvmx_usb_initialize().
> - * @pipe:	 Pipe to cancel requests in.
> - *
> - * Returns: 0 or a negative error code.
> - */
> -static int cvmx_usb_cancel_all(struct octeon_hcd *usb,
> -			       struct cvmx_usb_pipe *pipe)
> -{
> -	struct cvmx_usb_transaction *transaction, *next;
> -
> -	/* Simply loop through and attempt to cancel each transaction */
> -	list_for_each_entry_safe(transaction, next, &pipe->transactions, node) {
> -		int result = cvmx_usb_cancel(usb, pipe, transaction);
> -
> -		if (unlikely(result != 0))
> -			return result;
> -	}
> -	return 0;
> -}
> -
> -/**
> - * Close a pipe created with cvmx_usb_open_pipe().
> - *
> - * @usb:	 USB device state populated by cvmx_usb_initialize().
> - * @pipe:	 Pipe to close.
> - *
> - * Returns: 0 or a negative error code. EBUSY is returned if the pipe has
> - *	    outstanding transfers.
> - */
> -static int cvmx_usb_close_pipe(struct octeon_hcd *usb,
> -			       struct cvmx_usb_pipe *pipe)
> -{
> -	/* Fail if the pipe has pending transactions */
> -	if (!list_empty(&pipe->transactions))
> -		return -EBUSY;
> -
> -	list_del(&pipe->node);
> -	kfree(pipe);
> -
> -	return 0;
> -}
> -
> -/**
> - * Get the current USB protocol level frame number. The frame
> - * number is always in the range of 0-0x7ff.
> - *
> - * @usb: USB device state populated by cvmx_usb_initialize().
> - *
> - * Returns: USB frame number
> - */
> -static int cvmx_usb_get_frame_number(struct octeon_hcd *usb)
> -{
> -	union cvmx_usbcx_hfnum usbc_hfnum;
> -
> -	usbc_hfnum.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HFNUM(usb->index));
> -
> -	return usbc_hfnum.s.frnum;
> -}
> -
> -static void cvmx_usb_transfer_control(struct octeon_hcd *usb,
> -				      struct cvmx_usb_pipe *pipe,
> -				      struct cvmx_usb_transaction *transaction,
> -				      union cvmx_usbcx_hccharx usbc_hcchar,
> -				      int buffer_space_left,
> -				      int bytes_in_last_packet)
> -{
> -	switch (transaction->stage) {
> -	case CVMX_USB_STAGE_NON_CONTROL:
> -	case CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE:
> -		/* This should be impossible */
> -		cvmx_usb_complete(usb, pipe, transaction,
> -				  CVMX_USB_STATUS_ERROR);
> -		break;
> -	case CVMX_USB_STAGE_SETUP:
> -		pipe->pid_toggle = 1;
> -		if (cvmx_usb_pipe_needs_split(usb, pipe)) {
> -			transaction->stage =
> -				CVMX_USB_STAGE_SETUP_SPLIT_COMPLETE;
> -		} else {
> -			struct usb_ctrlrequest *header =
> -				cvmx_phys_to_ptr(transaction->control_header);
> -			if (header->wLength)
> -				transaction->stage = CVMX_USB_STAGE_DATA;
> -			else
> -				transaction->stage = CVMX_USB_STAGE_STATUS;
> -		}
> -		break;
> -	case CVMX_USB_STAGE_SETUP_SPLIT_COMPLETE:
> -		{
> -			struct usb_ctrlrequest *header =
> -				cvmx_phys_to_ptr(transaction->control_header);
> -			if (header->wLength)
> -				transaction->stage = CVMX_USB_STAGE_DATA;
> -			else
> -				transaction->stage = CVMX_USB_STAGE_STATUS;
> -		}
> -		break;
> -	case CVMX_USB_STAGE_DATA:
> -		if (cvmx_usb_pipe_needs_split(usb, pipe)) {
> -			transaction->stage = CVMX_USB_STAGE_DATA_SPLIT_COMPLETE;
> -			/*
> -			 * For setup OUT data that are splits,
> -			 * the hardware doesn't appear to count
> -			 * transferred data. Here we manually
> -			 * update the data transferred
> -			 */
> -			if (!usbc_hcchar.s.epdir) {
> -				if (buffer_space_left < pipe->max_packet)
> -					transaction->actual_bytes +=
> -						buffer_space_left;
> -				else
> -					transaction->actual_bytes +=
> -						pipe->max_packet;
> -			}
> -		} else if ((buffer_space_left == 0) ||
> -			   (bytes_in_last_packet < pipe->max_packet)) {
> -			pipe->pid_toggle = 1;
> -			transaction->stage = CVMX_USB_STAGE_STATUS;
> -		}
> -		break;
> -	case CVMX_USB_STAGE_DATA_SPLIT_COMPLETE:
> -		if ((buffer_space_left == 0) ||
> -		    (bytes_in_last_packet < pipe->max_packet)) {
> -			pipe->pid_toggle = 1;
> -			transaction->stage = CVMX_USB_STAGE_STATUS;
> -		} else {
> -			transaction->stage = CVMX_USB_STAGE_DATA;
> -		}
> -		break;
> -	case CVMX_USB_STAGE_STATUS:
> -		if (cvmx_usb_pipe_needs_split(usb, pipe))
> -			transaction->stage =
> -				CVMX_USB_STAGE_STATUS_SPLIT_COMPLETE;
> -		else
> -			cvmx_usb_complete(usb, pipe, transaction,
> -					  CVMX_USB_STATUS_OK);
> -		break;
> -	case CVMX_USB_STAGE_STATUS_SPLIT_COMPLETE:
> -		cvmx_usb_complete(usb, pipe, transaction, CVMX_USB_STATUS_OK);
> -		break;
> -	}
> -}
> -
> -static void cvmx_usb_transfer_bulk(struct octeon_hcd *usb,
> -				   struct cvmx_usb_pipe *pipe,
> -				   struct cvmx_usb_transaction *transaction,
> -				   union cvmx_usbcx_hcintx usbc_hcint,
> -				   int buffer_space_left,
> -				   int bytes_in_last_packet)
> -{
> -	/*
> -	 * The only time a bulk transfer isn't complete when it finishes with
> -	 * an ACK is during a split transaction. For splits we need to continue
> -	 * the transfer if more data is needed.
> -	 */
> -	if (cvmx_usb_pipe_needs_split(usb, pipe)) {
> -		if (transaction->stage == CVMX_USB_STAGE_NON_CONTROL)
> -			transaction->stage =
> -				CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE;
> -		else if (buffer_space_left &&
> -			 (bytes_in_last_packet == pipe->max_packet))
> -			transaction->stage = CVMX_USB_STAGE_NON_CONTROL;
> -		else
> -			cvmx_usb_complete(usb, pipe, transaction,
> -					  CVMX_USB_STATUS_OK);
> -	} else {
> -		if ((pipe->device_speed == CVMX_USB_SPEED_HIGH) &&
> -		    (pipe->transfer_dir == CVMX_USB_DIRECTION_OUT) &&
> -		    (usbc_hcint.s.nak))
> -			pipe->flags |= CVMX_USB_PIPE_FLAGS_NEED_PING;
> -		if (!buffer_space_left ||
> -		    (bytes_in_last_packet < pipe->max_packet))
> -			cvmx_usb_complete(usb, pipe, transaction,
> -					  CVMX_USB_STATUS_OK);
> -	}
> -}
> -
> -static void cvmx_usb_transfer_intr(struct octeon_hcd *usb,
> -				   struct cvmx_usb_pipe *pipe,
> -				   struct cvmx_usb_transaction *transaction,
> -				   int buffer_space_left,
> -				   int bytes_in_last_packet)
> -{
> -	if (cvmx_usb_pipe_needs_split(usb, pipe)) {
> -		if (transaction->stage == CVMX_USB_STAGE_NON_CONTROL) {
> -			transaction->stage =
> -				CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE;
> -		} else if (buffer_space_left &&
> -			   (bytes_in_last_packet == pipe->max_packet)) {
> -			transaction->stage = CVMX_USB_STAGE_NON_CONTROL;
> -		} else {
> -			pipe->next_tx_frame += pipe->interval;
> -			cvmx_usb_complete(usb, pipe, transaction,
> -					  CVMX_USB_STATUS_OK);
> -		}
> -	} else if (!buffer_space_left ||
> -		   (bytes_in_last_packet < pipe->max_packet)) {
> -		pipe->next_tx_frame += pipe->interval;
> -		cvmx_usb_complete(usb, pipe, transaction, CVMX_USB_STATUS_OK);
> -	}
> -}
> -
> -static void cvmx_usb_transfer_isoc(struct octeon_hcd *usb,
> -				   struct cvmx_usb_pipe *pipe,
> -				   struct cvmx_usb_transaction *transaction,
> -				   int buffer_space_left,
> -				   int bytes_in_last_packet,
> -				   int bytes_this_transfer)
> -{
> -	if (cvmx_usb_pipe_needs_split(usb, pipe)) {
> -		/*
> -		 * ISOCHRONOUS OUT splits don't require a complete split stage.
> -		 * Instead they use a sequence of begin OUT splits to transfer
> -		 * the data 188 bytes at a time. Once the transfer is complete,
> -		 * the pipe sleeps until the next schedule interval.
> -		 */
> -		if (pipe->transfer_dir == CVMX_USB_DIRECTION_OUT) {
> -			/*
> -			 * If no space left or this wasn't a max size packet
> -			 * then this transfer is complete. Otherwise start it
> -			 * again to send the next 188 bytes
> -			 */
> -			if (!buffer_space_left || (bytes_this_transfer < 188)) {
> -				pipe->next_tx_frame += pipe->interval;
> -				cvmx_usb_complete(usb, pipe, transaction,
> -						  CVMX_USB_STATUS_OK);
> -			}
> -			return;
> -		}
> -		if (transaction->stage ==
> -		    CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE) {
> -			/*
> -			 * We are in the incoming data phase. Keep getting data
> -			 * until we run out of space or get a small packet
> -			 */
> -			if ((buffer_space_left == 0) ||
> -			    (bytes_in_last_packet < pipe->max_packet)) {
> -				pipe->next_tx_frame += pipe->interval;
> -				cvmx_usb_complete(usb, pipe, transaction,
> -						  CVMX_USB_STATUS_OK);
> -			}
> -		} else {
> -			transaction->stage =
> -				CVMX_USB_STAGE_NON_CONTROL_SPLIT_COMPLETE;
> -		}
> -	} else {
> -		pipe->next_tx_frame += pipe->interval;
> -		cvmx_usb_complete(usb, pipe, transaction, CVMX_USB_STATUS_OK);
> -	}
> -}
> -
> -/**
> - * Poll a channel for status
> - *
> - * @usb:     USB device
> - * @channel: Channel to poll
> - *
> - * Returns: Zero on success
> - */
> -static int cvmx_usb_poll_channel(struct octeon_hcd *usb, int channel)
> -{
> -	struct usb_hcd *hcd = octeon_to_hcd(usb);
> -	struct device *dev = hcd->self.controller;
> -	union cvmx_usbcx_hcintx usbc_hcint;
> -	union cvmx_usbcx_hctsizx usbc_hctsiz;
> -	union cvmx_usbcx_hccharx usbc_hcchar;
> -	struct cvmx_usb_pipe *pipe;
> -	struct cvmx_usb_transaction *transaction;
> -	int bytes_this_transfer;
> -	int bytes_in_last_packet;
> -	int packets_processed;
> -	int buffer_space_left;
> -
> -	/* Read the interrupt status bits for the channel */
> -	usbc_hcint.u32 = cvmx_usb_read_csr32(usb,
> -				CVMX_USBCX_HCINTX(channel, usb->index));
> -
> -	if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA) {
> -		usbc_hcchar.u32 = cvmx_usb_read_csr32(usb,
> -				CVMX_USBCX_HCCHARX(channel, usb->index));
> -
> -		if (usbc_hcchar.s.chena && usbc_hcchar.s.chdis) {
> -			/*
> -			 * There seems to be a bug in CN31XX which can cause
> -			 * interrupt IN transfers to get stuck until we do a
> -			 * write of HCCHARX without changing things
> -			 */
> -			cvmx_usb_write_csr32(usb,
> -					     CVMX_USBCX_HCCHARX(channel,
> -								usb->index),
> -					     usbc_hcchar.u32);
> -			return 0;
> -		}
> -
> -		/*
> -		 * In non DMA mode the channels don't halt themselves. We need
> -		 * to manually disable channels that are left running
> -		 */
> -		if (!usbc_hcint.s.chhltd) {
> -			if (usbc_hcchar.s.chena) {
> -				union cvmx_usbcx_hcintmskx hcintmsk;
> -				/* Disable all interrupts except CHHLTD */
> -				hcintmsk.u32 = 0;
> -				hcintmsk.s.chhltdmsk = 1;
> -				cvmx_usb_write_csr32(usb,
> -						     CVMX_USBCX_HCINTMSKX(channel, usb->index),
> -						     hcintmsk.u32);
> -				usbc_hcchar.s.chdis = 1;
> -				cvmx_usb_write_csr32(usb,
> -						     CVMX_USBCX_HCCHARX(channel, usb->index),
> -						     usbc_hcchar.u32);
> -				return 0;
> -			} else if (usbc_hcint.s.xfercompl) {
> -				/*
> -				 * Successful IN/OUT with transfer complete.
> -				 * Channel halt isn't needed.
> -				 */
> -			} else {
> -				dev_err(dev, "USB%d: Channel %d interrupt without halt\n",
> -					usb->index, channel);
> -				return 0;
> -			}
> -		}
> -	} else {
> -		/*
> -		 * There is are no interrupts that we need to process when the
> -		 * channel is still running
> -		 */
> -		if (!usbc_hcint.s.chhltd)
> -			return 0;
> -	}
> -
> -	/* Disable the channel interrupts now that it is done */
> -	cvmx_usb_write_csr32(usb, CVMX_USBCX_HCINTMSKX(channel, usb->index), 0);
> -	usb->idle_hardware_channels |= (1 << channel);
> -
> -	/* Make sure this channel is tied to a valid pipe */
> -	pipe = usb->pipe_for_channel[channel];
> -	prefetch(pipe);
> -	if (!pipe)
> -		return 0;
> -	transaction = list_first_entry(&pipe->transactions,
> -				       typeof(*transaction),
> -				       node);
> -	prefetch(transaction);
> -
> -	/*
> -	 * Disconnect this pipe from the HW channel. Later the schedule
> -	 * function will figure out which pipe needs to go
> -	 */
> -	usb->pipe_for_channel[channel] = NULL;
> -	pipe->flags &= ~CVMX_USB_PIPE_FLAGS_SCHEDULED;
> -
> -	/*
> -	 * Read the channel config info so we can figure out how much data
> -	 * transferred
> -	 */
> -	usbc_hcchar.u32 = cvmx_usb_read_csr32(usb,
> -			CVMX_USBCX_HCCHARX(channel, usb->index));
> -	usbc_hctsiz.u32 = cvmx_usb_read_csr32(usb,
> -			CVMX_USBCX_HCTSIZX(channel, usb->index));
> -
> -	/*
> -	 * Calculating the number of bytes successfully transferred is dependent
> -	 * on the transfer direction
> -	 */
> -	packets_processed = transaction->pktcnt - usbc_hctsiz.s.pktcnt;
> -	if (usbc_hcchar.s.epdir) {
> -		/*
> -		 * IN transactions are easy. For every byte received the
> -		 * hardware decrements xfersize. All we need to do is subtract
> -		 * the current value of xfersize from its starting value and we
> -		 * know how many bytes were written to the buffer
> -		 */
> -		bytes_this_transfer = transaction->xfersize -
> -			usbc_hctsiz.s.xfersize;
> -	} else {
> -		/*
> -		 * OUT transaction don't decrement xfersize. Instead pktcnt is
> -		 * decremented on every successful packet send. The hardware
> -		 * does this when it receives an ACK, or NYET. If it doesn't
> -		 * receive one of these responses pktcnt doesn't change
> -		 */
> -		bytes_this_transfer = packets_processed * usbc_hcchar.s.mps;
> -		/*
> -		 * The last packet may not be a full transfer if we didn't have
> -		 * enough data
> -		 */
> -		if (bytes_this_transfer > transaction->xfersize)
> -			bytes_this_transfer = transaction->xfersize;
> -	}
> -	/* Figure out how many bytes were in the last packet of the transfer */
> -	if (packets_processed)
> -		bytes_in_last_packet = bytes_this_transfer -
> -			(packets_processed - 1) * usbc_hcchar.s.mps;
> -	else
> -		bytes_in_last_packet = bytes_this_transfer;
> -
> -	/*
> -	 * As a special case, setup transactions output the setup header, not
> -	 * the user's data. For this reason we don't count setup data as bytes
> -	 * transferred
> -	 */
> -	if ((transaction->stage == CVMX_USB_STAGE_SETUP) ||
> -	    (transaction->stage == CVMX_USB_STAGE_SETUP_SPLIT_COMPLETE))
> -		bytes_this_transfer = 0;
> -
> -	/*
> -	 * Add the bytes transferred to the running total. It is important that
> -	 * bytes_this_transfer doesn't count any data that needs to be
> -	 * retransmitted
> -	 */
> -	transaction->actual_bytes += bytes_this_transfer;
> -	if (transaction->type == CVMX_USB_TRANSFER_ISOCHRONOUS)
> -		buffer_space_left = transaction->iso_packets[0].length -
> -			transaction->actual_bytes;
> -	else
> -		buffer_space_left = transaction->buffer_length -
> -			transaction->actual_bytes;
> -
> -	/*
> -	 * We need to remember the PID toggle state for the next transaction.
> -	 * The hardware already updated it for the next transaction
> -	 */
> -	pipe->pid_toggle = !(usbc_hctsiz.s.pid == 0);
> -
> -	/*
> -	 * For high speed bulk out, assume the next transaction will need to do
> -	 * a ping before proceeding. If this isn't true the ACK processing below
> -	 * will clear this flag
> -	 */
> -	if ((pipe->device_speed == CVMX_USB_SPEED_HIGH) &&
> -	    (pipe->transfer_type == CVMX_USB_TRANSFER_BULK) &&
> -	    (pipe->transfer_dir == CVMX_USB_DIRECTION_OUT))
> -		pipe->flags |= CVMX_USB_PIPE_FLAGS_NEED_PING;
> -
> -	if (WARN_ON_ONCE(bytes_this_transfer < 0)) {
> -		/*
> -		 * In some rare cases the DMA engine seems to get stuck and
> -		 * keeps substracting same byte count over and over again. In
> -		 * such case we just need to fail every transaction.
> -		 */
> -		cvmx_usb_complete(usb, pipe, transaction,
> -				  CVMX_USB_STATUS_ERROR);
> -		return 0;
> -	}
> -
> -	if (usbc_hcint.s.stall) {
> -		/*
> -		 * STALL as a response means this transaction cannot be
> -		 * completed because the device can't process transactions. Tell
> -		 * the user. Any data that was transferred will be counted on
> -		 * the actual bytes transferred
> -		 */
> -		pipe->pid_toggle = 0;
> -		cvmx_usb_complete(usb, pipe, transaction,
> -				  CVMX_USB_STATUS_STALL);
> -	} else if (usbc_hcint.s.xacterr) {
> -		/*
> -		 * XactErr as a response means the device signaled
> -		 * something wrong with the transfer. For example, PID
> -		 * toggle errors cause these.
> -		 */
> -		cvmx_usb_complete(usb, pipe, transaction,
> -				  CVMX_USB_STATUS_XACTERR);
> -	} else if (usbc_hcint.s.bblerr) {
> -		/* Babble Error (BblErr) */
> -		cvmx_usb_complete(usb, pipe, transaction,
> -				  CVMX_USB_STATUS_BABBLEERR);
> -	} else if (usbc_hcint.s.datatglerr) {
> -		/* Data toggle error */
> -		cvmx_usb_complete(usb, pipe, transaction,
> -				  CVMX_USB_STATUS_DATATGLERR);
> -	} else if (usbc_hcint.s.nyet) {
> -		/*
> -		 * NYET as a response is only allowed in three cases: as a
> -		 * response to a ping, as a response to a split transaction, and
> -		 * as a response to a bulk out. The ping case is handled by
> -		 * hardware, so we only have splits and bulk out
> -		 */
> -		if (!cvmx_usb_pipe_needs_split(usb, pipe)) {
> -			transaction->retries = 0;
> -			/*
> -			 * If there is more data to go then we need to try
> -			 * again. Otherwise this transaction is complete
> -			 */
> -			if ((buffer_space_left == 0) ||
> -			    (bytes_in_last_packet < pipe->max_packet))
> -				cvmx_usb_complete(usb, pipe,
> -						  transaction,
> -						  CVMX_USB_STATUS_OK);
> -		} else {
> -			/*
> -			 * Split transactions retry the split complete 4 times
> -			 * then rewind to the start split and do the entire
> -			 * transactions again
> -			 */
> -			transaction->retries++;
> -			if ((transaction->retries & 0x3) == 0) {
> -				/*
> -				 * Rewind to the beginning of the transaction by
> -				 * anding off the split complete bit
> -				 */
> -				transaction->stage &= ~1;
> -				pipe->split_sc_frame = -1;
> -			}
> -		}
> -	} else if (usbc_hcint.s.ack) {
> -		transaction->retries = 0;
> -		/*
> -		 * The ACK bit can only be checked after the other error bits.
> -		 * This is because a multi packet transfer may succeed in a
> -		 * number of packets and then get a different response on the
> -		 * last packet. In this case both ACK and the last response bit
> -		 * will be set. If none of the other response bits is set, then
> -		 * the last packet must have been an ACK
> -		 *
> -		 * Since we got an ACK, we know we don't need to do a ping on
> -		 * this pipe
> -		 */
> -		pipe->flags &= ~CVMX_USB_PIPE_FLAGS_NEED_PING;
> -
> -		switch (transaction->type) {
> -		case CVMX_USB_TRANSFER_CONTROL:
> -			cvmx_usb_transfer_control(usb, pipe, transaction,
> -						  usbc_hcchar,
> -						  buffer_space_left,
> -						  bytes_in_last_packet);
> -			break;
> -		case CVMX_USB_TRANSFER_BULK:
> -			cvmx_usb_transfer_bulk(usb, pipe, transaction,
> -					       usbc_hcint, buffer_space_left,
> -					       bytes_in_last_packet);
> -			break;
> -		case CVMX_USB_TRANSFER_INTERRUPT:
> -			cvmx_usb_transfer_intr(usb, pipe, transaction,
> -					       buffer_space_left,
> -					       bytes_in_last_packet);
> -			break;
> -		case CVMX_USB_TRANSFER_ISOCHRONOUS:
> -			cvmx_usb_transfer_isoc(usb, pipe, transaction,
> -					       buffer_space_left,
> -					       bytes_in_last_packet,
> -					       bytes_this_transfer);
> -			break;
> -		}
> -	} else if (usbc_hcint.s.nak) {
> -		/*
> -		 * If this was a split then clear our split in progress marker.
> -		 */
> -		if (usb->active_split == transaction)
> -			usb->active_split = NULL;
> -		/*
> -		 * NAK as a response means the device couldn't accept the
> -		 * transaction, but it should be retried in the future. Rewind
> -		 * to the beginning of the transaction by anding off the split
> -		 * complete bit. Retry in the next interval
> -		 */
> -		transaction->retries = 0;
> -		transaction->stage &= ~1;
> -		pipe->next_tx_frame += pipe->interval;
> -		if (pipe->next_tx_frame < usb->frame_number)
> -			pipe->next_tx_frame = usb->frame_number +
> -				pipe->interval -
> -				(usb->frame_number - pipe->next_tx_frame) %
> -				pipe->interval;
> -	} else {
> -		struct cvmx_usb_port_status port;
> -
> -		port = cvmx_usb_get_status(usb);
> -		if (port.port_enabled) {
> -			/* We'll retry the exact same transaction again */
> -			transaction->retries++;
> -		} else {
> -			/*
> -			 * We get channel halted interrupts with no result bits
> -			 * sets when the cable is unplugged
> -			 */
> -			cvmx_usb_complete(usb, pipe, transaction,
> -					  CVMX_USB_STATUS_ERROR);
> -		}
> -	}
> -	return 0;
> -}
> -
> -static void octeon_usb_port_callback(struct octeon_hcd *usb)
> -{
> -	spin_unlock(&usb->lock);
> -	usb_hcd_poll_rh_status(octeon_to_hcd(usb));
> -	spin_lock(&usb->lock);
> -}
> -
> -/**
> - * Poll the USB block for status and call all needed callback
> - * handlers. This function is meant to be called in the interrupt
> - * handler for the USB controller. It can also be called
> - * periodically in a loop for non-interrupt based operation.
> - *
> - * @usb: USB device state populated by cvmx_usb_initialize().
> - *
> - * Returns: 0 or a negative error code.
> - */
> -static int cvmx_usb_poll(struct octeon_hcd *usb)
> -{
> -	union cvmx_usbcx_hfnum usbc_hfnum;
> -	union cvmx_usbcx_gintsts usbc_gintsts;
> -
> -	prefetch_range(usb, sizeof(*usb));
> -
> -	/* Update the frame counter */
> -	usbc_hfnum.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HFNUM(usb->index));
> -	if ((usb->frame_number & 0x3fff) > usbc_hfnum.s.frnum)
> -		usb->frame_number += 0x4000;
> -	usb->frame_number &= ~0x3fffull;
> -	usb->frame_number |= usbc_hfnum.s.frnum;
> -
> -	/* Read the pending interrupts */
> -	usbc_gintsts.u32 = cvmx_usb_read_csr32(usb,
> -					       CVMX_USBCX_GINTSTS(usb->index));
> -
> -	/* Clear the interrupts now that we know about them */
> -	cvmx_usb_write_csr32(usb, CVMX_USBCX_GINTSTS(usb->index),
> -			     usbc_gintsts.u32);
> -
> -	if (usbc_gintsts.s.rxflvl) {
> -		/*
> -		 * RxFIFO Non-Empty (RxFLvl)
> -		 * Indicates that there is at least one packet pending to be
> -		 * read from the RxFIFO.
> -		 *
> -		 * In DMA mode this is handled by hardware
> -		 */
> -		if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA)
> -			cvmx_usb_poll_rx_fifo(usb);
> -	}
> -	if (usbc_gintsts.s.ptxfemp || usbc_gintsts.s.nptxfemp) {
> -		/* Fill the Tx FIFOs when not in DMA mode */
> -		if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA)
> -			cvmx_usb_poll_tx_fifo(usb);
> -	}
> -	if (usbc_gintsts.s.disconnint || usbc_gintsts.s.prtint) {
> -		union cvmx_usbcx_hprt usbc_hprt;
> -		/*
> -		 * Disconnect Detected Interrupt (DisconnInt)
> -		 * Asserted when a device disconnect is detected.
> -		 *
> -		 * Host Port Interrupt (PrtInt)
> -		 * The core sets this bit to indicate a change in port status of
> -		 * one of the O2P USB core ports in Host mode. The application
> -		 * must read the Host Port Control and Status (HPRT) register to
> -		 * determine the exact event that caused this interrupt. The
> -		 * application must clear the appropriate status bit in the Host
> -		 * Port Control and Status register to clear this bit.
> -		 *
> -		 * Call the user's port callback
> -		 */
> -		octeon_usb_port_callback(usb);
> -		/* Clear the port change bits */
> -		usbc_hprt.u32 =
> -			cvmx_usb_read_csr32(usb, CVMX_USBCX_HPRT(usb->index));
> -		usbc_hprt.s.prtena = 0;
> -		cvmx_usb_write_csr32(usb, CVMX_USBCX_HPRT(usb->index),
> -				     usbc_hprt.u32);
> -	}
> -	if (usbc_gintsts.s.hchint) {
> -		/*
> -		 * Host Channels Interrupt (HChInt)
> -		 * The core sets this bit to indicate that an interrupt is
> -		 * pending on one of the channels of the core (in Host mode).
> -		 * The application must read the Host All Channels Interrupt
> -		 * (HAINT) register to determine the exact number of the channel
> -		 * on which the interrupt occurred, and then read the
> -		 * corresponding Host Channel-n Interrupt (HCINTn) register to
> -		 * determine the exact cause of the interrupt. The application
> -		 * must clear the appropriate status bit in the HCINTn register
> -		 * to clear this bit.
> -		 */
> -		union cvmx_usbcx_haint usbc_haint;
> -
> -		usbc_haint.u32 = cvmx_usb_read_csr32(usb,
> -					CVMX_USBCX_HAINT(usb->index));
> -		while (usbc_haint.u32) {
> -			int channel;
> -
> -			channel = __fls(usbc_haint.u32);
> -			cvmx_usb_poll_channel(usb, channel);
> -			usbc_haint.u32 ^= 1 << channel;
> -		}
> -	}
> -
> -	cvmx_usb_schedule(usb, usbc_gintsts.s.sof);
> -
> -	return 0;
> -}
> -
> -/* convert between an HCD pointer and the corresponding struct octeon_hcd */
> -static inline struct octeon_hcd *hcd_to_octeon(struct usb_hcd *hcd)
> -{
> -	return (struct octeon_hcd *)(hcd->hcd_priv);
> -}
> -
> -static irqreturn_t octeon_usb_irq(struct usb_hcd *hcd)
> -{
> -	struct octeon_hcd *usb = hcd_to_octeon(hcd);
> -	unsigned long flags;
> -
> -	spin_lock_irqsave(&usb->lock, flags);
> -	cvmx_usb_poll(usb);
> -	spin_unlock_irqrestore(&usb->lock, flags);
> -	return IRQ_HANDLED;
> -}
> -
> -static int octeon_usb_start(struct usb_hcd *hcd)
> -{
> -	hcd->state = HC_STATE_RUNNING;
> -	return 0;
> -}
> -
> -static void octeon_usb_stop(struct usb_hcd *hcd)
> -{
> -	hcd->state = HC_STATE_HALT;
> -}
> -
> -static int octeon_usb_get_frame_number(struct usb_hcd *hcd)
> -{
> -	struct octeon_hcd *usb = hcd_to_octeon(hcd);
> -
> -	return cvmx_usb_get_frame_number(usb);
> -}
> -
> -static int octeon_usb_urb_enqueue(struct usb_hcd *hcd,
> -				  struct urb *urb,
> -				  gfp_t mem_flags)
> -{
> -	struct octeon_hcd *usb = hcd_to_octeon(hcd);
> -	struct device *dev = hcd->self.controller;
> -	struct cvmx_usb_transaction *transaction = NULL;
> -	struct cvmx_usb_pipe *pipe;
> -	unsigned long flags;
> -	struct cvmx_usb_iso_packet *iso_packet;
> -	struct usb_host_endpoint *ep = urb->ep;
> -	int rc;
> -
> -	urb->status = 0;
> -	spin_lock_irqsave(&usb->lock, flags);
> -
> -	rc = usb_hcd_link_urb_to_ep(hcd, urb);
> -	if (rc) {
> -		spin_unlock_irqrestore(&usb->lock, flags);
> -		return rc;
> -	}
> -
> -	if (!ep->hcpriv) {
> -		enum cvmx_usb_transfer transfer_type;
> -		enum cvmx_usb_speed speed;
> -		int split_device = 0;
> -		int split_port = 0;
> -
> -		switch (usb_pipetype(urb->pipe)) {
> -		case PIPE_ISOCHRONOUS:
> -			transfer_type = CVMX_USB_TRANSFER_ISOCHRONOUS;
> -			break;
> -		case PIPE_INTERRUPT:
> -			transfer_type = CVMX_USB_TRANSFER_INTERRUPT;
> -			break;
> -		case PIPE_CONTROL:
> -			transfer_type = CVMX_USB_TRANSFER_CONTROL;
> -			break;
> -		default:
> -			transfer_type = CVMX_USB_TRANSFER_BULK;
> -			break;
> -		}
> -		switch (urb->dev->speed) {
> -		case USB_SPEED_LOW:
> -			speed = CVMX_USB_SPEED_LOW;
> -			break;
> -		case USB_SPEED_FULL:
> -			speed = CVMX_USB_SPEED_FULL;
> -			break;
> -		default:
> -			speed = CVMX_USB_SPEED_HIGH;
> -			break;
> -		}
> -		/*
> -		 * For slow devices on high speed ports we need to find the hub
> -		 * that does the speed translation so we know where to send the
> -		 * split transactions.
> -		 */
> -		if (speed != CVMX_USB_SPEED_HIGH) {
> -			/*
> -			 * Start at this device and work our way up the usb
> -			 * tree.
> -			 */
> -			struct usb_device *dev = urb->dev;
> -
> -			while (dev->parent) {
> -				/*
> -				 * If our parent is high speed then he'll
> -				 * receive the splits.
> -				 */
> -				if (dev->parent->speed == USB_SPEED_HIGH) {
> -					split_device = dev->parent->devnum;
> -					split_port = dev->portnum;
> -					break;
> -				}
> -				/*
> -				 * Move up the tree one level. If we make it all
> -				 * the way up the tree, then the port must not
> -				 * be in high speed mode and we don't need a
> -				 * split.
> -				 */
> -				dev = dev->parent;
> -			}
> -		}
> -		pipe = cvmx_usb_open_pipe(usb, usb_pipedevice(urb->pipe),
> -					  usb_pipeendpoint(urb->pipe), speed,
> -					  le16_to_cpu(ep->desc.wMaxPacketSize)
> -					  & 0x7ff,
> -					  transfer_type,
> -					  usb_pipein(urb->pipe) ?
> -						CVMX_USB_DIRECTION_IN :
> -						CVMX_USB_DIRECTION_OUT,
> -					  urb->interval,
> -					  (le16_to_cpu(ep->desc.wMaxPacketSize)
> -					   >> 11) & 0x3,
> -					  split_device, split_port);
> -		if (!pipe) {
> -			usb_hcd_unlink_urb_from_ep(hcd, urb);
> -			spin_unlock_irqrestore(&usb->lock, flags);
> -			dev_dbg(dev, "Failed to create pipe\n");
> -			return -ENOMEM;
> -		}
> -		ep->hcpriv = pipe;
> -	} else {
> -		pipe = ep->hcpriv;
> -	}
> -
> -	switch (usb_pipetype(urb->pipe)) {
> -	case PIPE_ISOCHRONOUS:
> -		dev_dbg(dev, "Submit isochronous to %d.%d\n",
> -			usb_pipedevice(urb->pipe),
> -			usb_pipeendpoint(urb->pipe));
> -		/*
> -		 * Allocate a structure to use for our private list of
> -		 * isochronous packets.
> -		 */
> -		iso_packet = kmalloc_array(urb->number_of_packets,
> -					   sizeof(struct cvmx_usb_iso_packet),
> -					   GFP_ATOMIC);
> -		if (iso_packet) {
> -			int i;
> -			/* Fill the list with the data from the URB */
> -			for (i = 0; i < urb->number_of_packets; i++) {
> -				iso_packet[i].offset =
> -					urb->iso_frame_desc[i].offset;
> -				iso_packet[i].length =
> -					urb->iso_frame_desc[i].length;
> -				iso_packet[i].status = CVMX_USB_STATUS_ERROR;
> -			}
> -			/*
> -			 * Store a pointer to the list in the URB setup_packet
> -			 * field. We know this currently isn't being used and
> -			 * this saves us a bunch of logic.
> -			 */
> -			urb->setup_packet = (char *)iso_packet;
> -			transaction = cvmx_usb_submit_isochronous(usb,
> -								  pipe, urb);
> -			/*
> -			 * If submit failed we need to free our private packet
> -			 * list.
> -			 */
> -			if (!transaction) {
> -				urb->setup_packet = NULL;
> -				kfree(iso_packet);
> -			}
> -		}
> -		break;
> -	case PIPE_INTERRUPT:
> -		dev_dbg(dev, "Submit interrupt to %d.%d\n",
> -			usb_pipedevice(urb->pipe),
> -			usb_pipeendpoint(urb->pipe));
> -		transaction = cvmx_usb_submit_interrupt(usb, pipe, urb);
> -		break;
> -	case PIPE_CONTROL:
> -		dev_dbg(dev, "Submit control to %d.%d\n",
> -			usb_pipedevice(urb->pipe),
> -			usb_pipeendpoint(urb->pipe));
> -		transaction = cvmx_usb_submit_control(usb, pipe, urb);
> -		break;
> -	case PIPE_BULK:
> -		dev_dbg(dev, "Submit bulk to %d.%d\n",
> -			usb_pipedevice(urb->pipe),
> -			usb_pipeendpoint(urb->pipe));
> -		transaction = cvmx_usb_submit_bulk(usb, pipe, urb);
> -		break;
> -	}
> -	if (!transaction) {
> -		usb_hcd_unlink_urb_from_ep(hcd, urb);
> -		spin_unlock_irqrestore(&usb->lock, flags);
> -		dev_dbg(dev, "Failed to submit\n");
> -		return -ENOMEM;
> -	}
> -	urb->hcpriv = transaction;
> -	spin_unlock_irqrestore(&usb->lock, flags);
> -	return 0;
> -}
> -
> -static int octeon_usb_urb_dequeue(struct usb_hcd *hcd,
> -				  struct urb *urb,
> -				  int status)
> -{
> -	struct octeon_hcd *usb = hcd_to_octeon(hcd);
> -	unsigned long flags;
> -	int rc;
> -
> -	if (!urb->dev)
> -		return -EINVAL;
> -
> -	spin_lock_irqsave(&usb->lock, flags);
> -
> -	rc = usb_hcd_check_unlink_urb(hcd, urb, status);
> -	if (rc)
> -		goto out;
> -
> -	urb->status = status;
> -	cvmx_usb_cancel(usb, urb->ep->hcpriv, urb->hcpriv);
> -
> -out:
> -	spin_unlock_irqrestore(&usb->lock, flags);
> -
> -	return rc;
> -}
> -
> -static void octeon_usb_endpoint_disable(struct usb_hcd *hcd,
> -					struct usb_host_endpoint *ep)
> -{
> -	struct device *dev = hcd->self.controller;
> -
> -	if (ep->hcpriv) {
> -		struct octeon_hcd *usb = hcd_to_octeon(hcd);
> -		struct cvmx_usb_pipe *pipe = ep->hcpriv;
> -		unsigned long flags;
> -
> -		spin_lock_irqsave(&usb->lock, flags);
> -		cvmx_usb_cancel_all(usb, pipe);
> -		if (cvmx_usb_close_pipe(usb, pipe))
> -			dev_dbg(dev, "Closing pipe %p failed\n", pipe);
> -		spin_unlock_irqrestore(&usb->lock, flags);
> -		ep->hcpriv = NULL;
> -	}
> -}
> -
> -static int octeon_usb_hub_status_data(struct usb_hcd *hcd, char *buf)
> -{
> -	struct octeon_hcd *usb = hcd_to_octeon(hcd);
> -	struct cvmx_usb_port_status port_status;
> -	unsigned long flags;
> -
> -	spin_lock_irqsave(&usb->lock, flags);
> -	port_status = cvmx_usb_get_status(usb);
> -	spin_unlock_irqrestore(&usb->lock, flags);
> -	buf[0] = port_status.connect_change << 1;
> -
> -	return buf[0] != 0;
> -}
> -
> -static int octeon_usb_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
> -				  u16 wIndex, char *buf, u16 wLength)
> -{
> -	struct octeon_hcd *usb = hcd_to_octeon(hcd);
> -	struct device *dev = hcd->self.controller;
> -	struct cvmx_usb_port_status usb_port_status;
> -	int port_status;
> -	struct usb_hub_descriptor *desc;
> -	unsigned long flags;
> -
> -	switch (typeReq) {
> -	case ClearHubFeature:
> -		dev_dbg(dev, "ClearHubFeature\n");
> -		switch (wValue) {
> -		case C_HUB_LOCAL_POWER:
> -		case C_HUB_OVER_CURRENT:
> -			/* Nothing required here */
> -			break;
> -		default:
> -			return -EINVAL;
> -		}
> -		break;
> -	case ClearPortFeature:
> -		dev_dbg(dev, "ClearPortFeature\n");
> -		if (wIndex != 1) {
> -			dev_dbg(dev, " INVALID\n");
> -			return -EINVAL;
> -		}
> -
> -		switch (wValue) {
> -		case USB_PORT_FEAT_ENABLE:
> -			dev_dbg(dev, " ENABLE\n");
> -			spin_lock_irqsave(&usb->lock, flags);
> -			cvmx_usb_disable(usb);
> -			spin_unlock_irqrestore(&usb->lock, flags);
> -			break;
> -		case USB_PORT_FEAT_SUSPEND:
> -			dev_dbg(dev, " SUSPEND\n");
> -			/* Not supported on Octeon */
> -			break;
> -		case USB_PORT_FEAT_POWER:
> -			dev_dbg(dev, " POWER\n");
> -			/* Not supported on Octeon */
> -			break;
> -		case USB_PORT_FEAT_INDICATOR:
> -			dev_dbg(dev, " INDICATOR\n");
> -			/* Port inidicator not supported */
> -			break;
> -		case USB_PORT_FEAT_C_CONNECTION:
> -			dev_dbg(dev, " C_CONNECTION\n");
> -			/* Clears drivers internal connect status change flag */
> -			spin_lock_irqsave(&usb->lock, flags);
> -			usb->port_status = cvmx_usb_get_status(usb);
> -			spin_unlock_irqrestore(&usb->lock, flags);
> -			break;
> -		case USB_PORT_FEAT_C_RESET:
> -			dev_dbg(dev, " C_RESET\n");
> -			/*
> -			 * Clears the driver's internal Port Reset Change flag.
> -			 */
> -			spin_lock_irqsave(&usb->lock, flags);
> -			usb->port_status = cvmx_usb_get_status(usb);
> -			spin_unlock_irqrestore(&usb->lock, flags);
> -			break;
> -		case USB_PORT_FEAT_C_ENABLE:
> -			dev_dbg(dev, " C_ENABLE\n");
> -			/*
> -			 * Clears the driver's internal Port Enable/Disable
> -			 * Change flag.
> -			 */
> -			spin_lock_irqsave(&usb->lock, flags);
> -			usb->port_status = cvmx_usb_get_status(usb);
> -			spin_unlock_irqrestore(&usb->lock, flags);
> -			break;
> -		case USB_PORT_FEAT_C_SUSPEND:
> -			dev_dbg(dev, " C_SUSPEND\n");
> -			/*
> -			 * Clears the driver's internal Port Suspend Change
> -			 * flag, which is set when resume signaling on the host
> -			 * port is complete.
> -			 */
> -			break;
> -		case USB_PORT_FEAT_C_OVER_CURRENT:
> -			dev_dbg(dev, " C_OVER_CURRENT\n");
> -			/* Clears the driver's overcurrent Change flag */
> -			spin_lock_irqsave(&usb->lock, flags);
> -			usb->port_status = cvmx_usb_get_status(usb);
> -			spin_unlock_irqrestore(&usb->lock, flags);
> -			break;
> -		default:
> -			dev_dbg(dev, " UNKNOWN\n");
> -			return -EINVAL;
> -		}
> -		break;
> -	case GetHubDescriptor:
> -		dev_dbg(dev, "GetHubDescriptor\n");
> -		desc = (struct usb_hub_descriptor *)buf;
> -		desc->bDescLength = 9;
> -		desc->bDescriptorType = 0x29;
> -		desc->bNbrPorts = 1;
> -		desc->wHubCharacteristics = cpu_to_le16(0x08);
> -		desc->bPwrOn2PwrGood = 1;
> -		desc->bHubContrCurrent = 0;
> -		desc->u.hs.DeviceRemovable[0] = 0;
> -		desc->u.hs.DeviceRemovable[1] = 0xff;
> -		break;
> -	case GetHubStatus:
> -		dev_dbg(dev, "GetHubStatus\n");
> -		*(__le32 *)buf = 0;
> -		break;
> -	case GetPortStatus:
> -		dev_dbg(dev, "GetPortStatus\n");
> -		if (wIndex != 1) {
> -			dev_dbg(dev, " INVALID\n");
> -			return -EINVAL;
> -		}
> -
> -		spin_lock_irqsave(&usb->lock, flags);
> -		usb_port_status = cvmx_usb_get_status(usb);
> -		spin_unlock_irqrestore(&usb->lock, flags);
> -		port_status = 0;
> -
> -		if (usb_port_status.connect_change) {
> -			port_status |= (1 << USB_PORT_FEAT_C_CONNECTION);
> -			dev_dbg(dev, " C_CONNECTION\n");
> -		}
> -
> -		if (usb_port_status.port_enabled) {
> -			port_status |= (1 << USB_PORT_FEAT_C_ENABLE);
> -			dev_dbg(dev, " C_ENABLE\n");
> -		}
> -
> -		if (usb_port_status.connected) {
> -			port_status |= (1 << USB_PORT_FEAT_CONNECTION);
> -			dev_dbg(dev, " CONNECTION\n");
> -		}
> -
> -		if (usb_port_status.port_enabled) {
> -			port_status |= (1 << USB_PORT_FEAT_ENABLE);
> -			dev_dbg(dev, " ENABLE\n");
> -		}
> -
> -		if (usb_port_status.port_over_current) {
> -			port_status |= (1 << USB_PORT_FEAT_OVER_CURRENT);
> -			dev_dbg(dev, " OVER_CURRENT\n");
> -		}
> -
> -		if (usb_port_status.port_powered) {
> -			port_status |= (1 << USB_PORT_FEAT_POWER);
> -			dev_dbg(dev, " POWER\n");
> -		}
> -
> -		if (usb_port_status.port_speed == CVMX_USB_SPEED_HIGH) {
> -			port_status |= USB_PORT_STAT_HIGH_SPEED;
> -			dev_dbg(dev, " HIGHSPEED\n");
> -		} else if (usb_port_status.port_speed == CVMX_USB_SPEED_LOW) {
> -			port_status |= (1 << USB_PORT_FEAT_LOWSPEED);
> -			dev_dbg(dev, " LOWSPEED\n");
> -		}
> -
> -		*((__le32 *)buf) = cpu_to_le32(port_status);
> -		break;
> -	case SetHubFeature:
> -		dev_dbg(dev, "SetHubFeature\n");
> -		/* No HUB features supported */
> -		break;
> -	case SetPortFeature:
> -		dev_dbg(dev, "SetPortFeature\n");
> -		if (wIndex != 1) {
> -			dev_dbg(dev, " INVALID\n");
> -			return -EINVAL;
> -		}
> -
> -		switch (wValue) {
> -		case USB_PORT_FEAT_SUSPEND:
> -			dev_dbg(dev, " SUSPEND\n");
> -			return -EINVAL;
> -		case USB_PORT_FEAT_POWER:
> -			dev_dbg(dev, " POWER\n");
> -			/*
> -			 * Program the port power bit to drive VBUS on the USB.
> -			 */
> -			spin_lock_irqsave(&usb->lock, flags);
> -			USB_SET_FIELD32(CVMX_USBCX_HPRT(usb->index),
> -					cvmx_usbcx_hprt, prtpwr, 1);
> -			spin_unlock_irqrestore(&usb->lock, flags);
> -			return 0;
> -		case USB_PORT_FEAT_RESET:
> -			dev_dbg(dev, " RESET\n");
> -			spin_lock_irqsave(&usb->lock, flags);
> -			cvmx_usb_reset_port(usb);
> -			spin_unlock_irqrestore(&usb->lock, flags);
> -			return 0;
> -		case USB_PORT_FEAT_INDICATOR:
> -			dev_dbg(dev, " INDICATOR\n");
> -			/* Not supported */
> -			break;
> -		default:
> -			dev_dbg(dev, " UNKNOWN\n");
> -			return -EINVAL;
> -		}
> -		break;
> -	default:
> -		dev_dbg(dev, "Unknown root hub request\n");
> -		return -EINVAL;
> -	}
> -	return 0;
> -}
> -
> -static const struct hc_driver octeon_hc_driver = {
> -	.description		= "Octeon USB",
> -	.product_desc		= "Octeon Host Controller",
> -	.hcd_priv_size		= sizeof(struct octeon_hcd),
> -	.irq			= octeon_usb_irq,
> -	.flags			= HCD_MEMORY | HCD_DMA | HCD_USB2,
> -	.start			= octeon_usb_start,
> -	.stop			= octeon_usb_stop,
> -	.urb_enqueue		= octeon_usb_urb_enqueue,
> -	.urb_dequeue		= octeon_usb_urb_dequeue,
> -	.endpoint_disable	= octeon_usb_endpoint_disable,
> -	.get_frame_number	= octeon_usb_get_frame_number,
> -	.hub_status_data	= octeon_usb_hub_status_data,
> -	.hub_control		= octeon_usb_hub_control,
> -	.map_urb_for_dma	= octeon_map_urb_for_dma,
> -	.unmap_urb_for_dma	= octeon_unmap_urb_for_dma,
> -};
> -
> -static int octeon_usb_probe(struct platform_device *pdev)
> -{
> -	int status;
> -	int initialize_flags;
> -	int usb_num;
> -	struct resource *res_mem;
> -	struct device_node *usbn_node;
> -	int irq = platform_get_irq(pdev, 0);
> -	struct device *dev = &pdev->dev;
> -	struct octeon_hcd *usb;
> -	struct usb_hcd *hcd;
> -	u32 clock_rate = 48000000;
> -	bool is_crystal_clock = false;
> -	const char *clock_type;
> -	int i;
> -
> -	if (!dev->of_node) {
> -		dev_err(dev, "Error: empty of_node\n");
> -		return -ENXIO;
> -	}
> -	usbn_node = dev->of_node->parent;
> -
> -	i = of_property_read_u32(usbn_node,
> -				 "clock-frequency", &clock_rate);
> -	if (i)
> -		i = of_property_read_u32(usbn_node,
> -					 "refclk-frequency", &clock_rate);
> -	if (i) {
> -		dev_err(dev, "No USBN \"clock-frequency\"\n");
> -		return -ENXIO;
> -	}
> -	switch (clock_rate) {
> -	case 12000000:
> -		initialize_flags = CVMX_USB_INITIALIZE_FLAGS_CLOCK_12MHZ;
> -		break;
> -	case 24000000:
> -		initialize_flags = CVMX_USB_INITIALIZE_FLAGS_CLOCK_24MHZ;
> -		break;
> -	case 48000000:
> -		initialize_flags = CVMX_USB_INITIALIZE_FLAGS_CLOCK_48MHZ;
> -		break;
> -	default:
> -		dev_err(dev, "Illegal USBN \"clock-frequency\" %u\n",
> -			clock_rate);
> -		return -ENXIO;
> -	}
> -
> -	i = of_property_read_string(usbn_node,
> -				    "cavium,refclk-type", &clock_type);
> -	if (i)
> -		i = of_property_read_string(usbn_node,
> -					    "refclk-type", &clock_type);
> -
> -	if (!i && strcmp("crystal", clock_type) == 0)
> -		is_crystal_clock = true;
> -
> -	if (is_crystal_clock)
> -		initialize_flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_XI;
> -	else
> -		initialize_flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_GND;
> -
> -	res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	if (!res_mem) {
> -		dev_err(dev, "found no memory resource\n");
> -		return -ENXIO;
> -	}
> -	usb_num = (res_mem->start >> 44) & 1;
> -
> -	if (irq < 0) {
> -		/* Defective device tree, but we know how to fix it. */
> -		irq_hw_number_t hwirq = usb_num ? (1 << 6) + 17 : 56;
> -
> -		irq = irq_create_mapping(NULL, hwirq);
> -	}
> -
> -	/*
> -	 * Set the DMA mask to 64bits so we get buffers already translated for
> -	 * DMA.
> -	 */
> -	i = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64));
> -	if (i)
> -		return i;
> -
> -	/*
> -	 * Only cn52XX and cn56XX have DWC_OTG USB hardware and the
> -	 * IOB priority registers.  Under heavy network load USB
> -	 * hardware can be starved by the IOB causing a crash.  Give
> -	 * it a priority boost if it has been waiting more than 400
> -	 * cycles to avoid this situation.
> -	 *
> -	 * Testing indicates that a cnt_val of 8192 is not sufficient,
> -	 * but no failures are seen with 4096.  We choose a value of
> -	 * 400 to give a safety factor of 10.
> -	 */
> -	if (OCTEON_IS_MODEL(OCTEON_CN52XX) || OCTEON_IS_MODEL(OCTEON_CN56XX)) {
> -		union cvmx_iob_n2c_l2c_pri_cnt pri_cnt;
> -
> -		pri_cnt.u64 = 0;
> -		pri_cnt.s.cnt_enb = 1;
> -		pri_cnt.s.cnt_val = 400;
> -		cvmx_write_csr(CVMX_IOB_N2C_L2C_PRI_CNT, pri_cnt.u64);
> -	}
> -
> -	hcd = usb_create_hcd(&octeon_hc_driver, dev, dev_name(dev));
> -	if (!hcd) {
> -		dev_dbg(dev, "Failed to allocate memory for HCD\n");
> -		return -1;
> -	}
> -	hcd->uses_new_polling = 1;
> -	usb = (struct octeon_hcd *)hcd->hcd_priv;
> -
> -	spin_lock_init(&usb->lock);
> -
> -	usb->init_flags = initialize_flags;
> -
> -	/* Initialize the USB state structure */
> -	usb->index = usb_num;
> -	INIT_LIST_HEAD(&usb->idle_pipes);
> -	for (i = 0; i < ARRAY_SIZE(usb->active_pipes); i++)
> -		INIT_LIST_HEAD(&usb->active_pipes[i]);
> -
> -	/* Due to an errata, CN31XX doesn't support DMA */
> -	if (OCTEON_IS_MODEL(OCTEON_CN31XX)) {
> -		usb->init_flags |= CVMX_USB_INITIALIZE_FLAGS_NO_DMA;
> -		/* Only use one channel with non DMA */
> -		usb->idle_hardware_channels = 0x1;
> -	} else if (OCTEON_IS_MODEL(OCTEON_CN5XXX)) {
> -		/* CN5XXX have an errata with channel 3 */
> -		usb->idle_hardware_channels = 0xf7;
> -	} else {
> -		usb->idle_hardware_channels = 0xff;
> -	}
> -
> -	status = cvmx_usb_initialize(dev, usb);
> -	if (status) {
> -		dev_dbg(dev, "USB initialization failed with %d\n", status);
> -		usb_put_hcd(hcd);
> -		return -1;
> -	}
> -
> -	status = usb_add_hcd(hcd, irq, 0);
> -	if (status) {
> -		dev_dbg(dev, "USB add HCD failed with %d\n", status);
> -		usb_put_hcd(hcd);
> -		return -1;
> -	}
> -	device_wakeup_enable(hcd->self.controller);
> -
> -	dev_info(dev, "Registered HCD for port %d on irq %d\n", usb_num, irq);
> -
> -	return 0;
> -}
> -
> -static int octeon_usb_remove(struct platform_device *pdev)
> -{
> -	int status;
> -	struct device *dev = &pdev->dev;
> -	struct usb_hcd *hcd = dev_get_drvdata(dev);
> -	struct octeon_hcd *usb = hcd_to_octeon(hcd);
> -	unsigned long flags;
> -
> -	usb_remove_hcd(hcd);
> -	spin_lock_irqsave(&usb->lock, flags);
> -	status = cvmx_usb_shutdown(usb);
> -	spin_unlock_irqrestore(&usb->lock, flags);
> -	if (status)
> -		dev_dbg(dev, "USB shutdown failed with %d\n", status);
> -
> -	usb_put_hcd(hcd);
> -
> -	return 0;
> -}
> -
> -static const struct of_device_id octeon_usb_match[] = {
> -	{
> -		.compatible = "cavium,octeon-5750-usbc",
> -	},
> -	{},
> -};
> -MODULE_DEVICE_TABLE(of, octeon_usb_match);
> -
> -static struct platform_driver octeon_usb_driver = {
> -	.driver = {
> -		.name		= "octeon-hcd",
> -		.of_match_table = octeon_usb_match,
> -	},
> -	.probe      = octeon_usb_probe,
> -	.remove     = octeon_usb_remove,
> -};
> -
> -static int __init octeon_usb_driver_init(void)
> -{
> -	if (usb_disabled())
> -		return 0;
> -
> -	return platform_driver_register(&octeon_usb_driver);
> -}
> -module_init(octeon_usb_driver_init);
> -
> -static void __exit octeon_usb_driver_exit(void)
> -{
> -	if (usb_disabled())
> -		return;
> -
> -	platform_driver_unregister(&octeon_usb_driver);
> -}
> -module_exit(octeon_usb_driver_exit);
> -
> -MODULE_LICENSE("GPL");
> -MODULE_AUTHOR("Cavium, Inc. <support@cavium.com>");
> -MODULE_DESCRIPTION("Cavium Inc. OCTEON USB Host driver.");
> diff --git a/drivers/staging/octeon-usb/octeon-hcd.h b/drivers/staging/octeon-usb/octeon-hcd.h
> deleted file mode 100644
> index 9ed619c93a4e..000000000000
> --- a/drivers/staging/octeon-usb/octeon-hcd.h
> +++ /dev/null
> @@ -1,1847 +0,0 @@
> -/* SPDX-License-Identifier: GPL-2.0 */
> -/*
> - * Octeon HCD hardware register definitions.
> - *
> - * This file is subject to the terms and conditions of the GNU General Public
> - * License. See the file "COPYING" in the main directory of this archive
> - * for more details.
> - *
> - * Some parts of the code were originally released under BSD license:
> - *
> - * Copyright (c) 2003-2010 Cavium Networks (support@cavium.com). All rights
> - * reserved.
> - *
> - * Redistribution and use in source and binary forms, with or without
> - * modification, are permitted provided that the following conditions are
> - * met:
> - *
> - *   * Redistributions of source code must retain the above copyright
> - *     notice, this list of conditions and the following disclaimer.
> - *
> - *   * Redistributions in binary form must reproduce the above
> - *     copyright notice, this list of conditions and the following
> - *     disclaimer in the documentation and/or other materials provided
> - *     with the distribution.
> - *
> - *   * Neither the name of Cavium Networks nor the names of
> - *     its contributors may be used to endorse or promote products
> - *     derived from this software without specific prior written
> - *     permission.
> - *
> - * This Software, including technical data, may be subject to U.S. export
> - * control laws, including the U.S. Export Administration Act and its associated
> - * regulations, and may be subject to export or import regulations in other
> - * countries.
> - *
> - * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
> - * AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR
> - * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
> - * THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION
> - * OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
> - * SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
> - * MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
> - * VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
> - * CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
> - * PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
> - */
> -
> -#ifndef __OCTEON_HCD_H__
> -#define __OCTEON_HCD_H__
> -
> -#include <asm/bitfield.h>
> -
> -#define CVMX_USBCXBASE 0x00016F0010000000ull
> -#define CVMX_USBCXREG1(reg, bid) \
> -	(CVMX_ADD_IO_SEG(CVMX_USBCXBASE | reg) + \
> -	 ((bid) & 1) * 0x100000000000ull)
> -#define CVMX_USBCXREG2(reg, bid, off) \
> -	(CVMX_ADD_IO_SEG(CVMX_USBCXBASE | reg) + \
> -	 (((off) & 7) + ((bid) & 1) * 0x8000000000ull) * 32)
> -
> -#define CVMX_USBCX_GAHBCFG(bid)		CVMX_USBCXREG1(0x008, bid)
> -#define CVMX_USBCX_GHWCFG3(bid)		CVMX_USBCXREG1(0x04c, bid)
> -#define CVMX_USBCX_GINTMSK(bid)		CVMX_USBCXREG1(0x018, bid)
> -#define CVMX_USBCX_GINTSTS(bid)		CVMX_USBCXREG1(0x014, bid)
> -#define CVMX_USBCX_GNPTXFSIZ(bid)	CVMX_USBCXREG1(0x028, bid)
> -#define CVMX_USBCX_GNPTXSTS(bid)	CVMX_USBCXREG1(0x02c, bid)
> -#define CVMX_USBCX_GOTGCTL(bid)		CVMX_USBCXREG1(0x000, bid)
> -#define CVMX_USBCX_GRSTCTL(bid)		CVMX_USBCXREG1(0x010, bid)
> -#define CVMX_USBCX_GRXFSIZ(bid)		CVMX_USBCXREG1(0x024, bid)
> -#define CVMX_USBCX_GRXSTSPH(bid)	CVMX_USBCXREG1(0x020, bid)
> -#define CVMX_USBCX_GUSBCFG(bid)		CVMX_USBCXREG1(0x00c, bid)
> -#define CVMX_USBCX_HAINT(bid)		CVMX_USBCXREG1(0x414, bid)
> -#define CVMX_USBCX_HAINTMSK(bid)	CVMX_USBCXREG1(0x418, bid)
> -#define CVMX_USBCX_HCCHARX(off, bid)	CVMX_USBCXREG2(0x500, bid, off)
> -#define CVMX_USBCX_HCFG(bid)		CVMX_USBCXREG1(0x400, bid)
> -#define CVMX_USBCX_HCINTMSKX(off, bid)	CVMX_USBCXREG2(0x50c, bid, off)
> -#define CVMX_USBCX_HCINTX(off, bid)	CVMX_USBCXREG2(0x508, bid, off)
> -#define CVMX_USBCX_HCSPLTX(off, bid)	CVMX_USBCXREG2(0x504, bid, off)
> -#define CVMX_USBCX_HCTSIZX(off, bid)	CVMX_USBCXREG2(0x510, bid, off)
> -#define CVMX_USBCX_HFIR(bid)		CVMX_USBCXREG1(0x404, bid)
> -#define CVMX_USBCX_HFNUM(bid)		CVMX_USBCXREG1(0x408, bid)
> -#define CVMX_USBCX_HPRT(bid)		CVMX_USBCXREG1(0x440, bid)
> -#define CVMX_USBCX_HPTXFSIZ(bid)	CVMX_USBCXREG1(0x100, bid)
> -#define CVMX_USBCX_HPTXSTS(bid)		CVMX_USBCXREG1(0x410, bid)
> -
> -#define CVMX_USBNXBID1(bid) (((bid) & 1) * 0x10000000ull)
> -#define CVMX_USBNXBID2(bid) (((bid) & 1) * 0x100000000000ull)
> -
> -#define CVMX_USBNXREG1(reg, bid) \
> -	(CVMX_ADD_IO_SEG(0x0001180068000000ull | reg) + CVMX_USBNXBID1(bid))
> -#define CVMX_USBNXREG2(reg, bid) \
> -	(CVMX_ADD_IO_SEG(0x00016F0000000000ull | reg) + CVMX_USBNXBID2(bid))
> -
> -#define CVMX_USBNX_CLK_CTL(bid)		CVMX_USBNXREG1(0x10, bid)
> -#define CVMX_USBNX_DMA0_INB_CHN0(bid)	CVMX_USBNXREG2(0x818, bid)
> -#define CVMX_USBNX_DMA0_OUTB_CHN0(bid)	CVMX_USBNXREG2(0x858, bid)
> -#define CVMX_USBNX_USBP_CTL_STATUS(bid)	CVMX_USBNXREG1(0x18, bid)
> -
> -/**
> - * cvmx_usbc#_gahbcfg
> - *
> - * Core AHB Configuration Register (GAHBCFG)
> - *
> - * This register can be used to configure the core after power-on or a change in
> - * mode of operation. This register mainly contains AHB system-related
> - * configuration parameters. The AHB is the processor interface to the O2P USB
> - * core. In general, software need not know about this interface except to
> - * program the values as specified.
> - *
> - * The application must program this register as part of the O2P USB core
> - * initialization. Do not change this register after the initial programming.
> - */
> -union cvmx_usbcx_gahbcfg {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_gahbcfg_s
> -	 * @ptxfemplvl: Periodic TxFIFO Empty Level (PTxFEmpLvl)
> -	 *	Software should set this bit to 0x1.
> -	 *	Indicates when the Periodic TxFIFO Empty Interrupt bit in the
> -	 *	Core Interrupt register (GINTSTS.PTxFEmp) is triggered. This
> -	 *	bit is used only in Slave mode.
> -	 *	* 1'b0: GINTSTS.PTxFEmp interrupt indicates that the Periodic
> -	 *	TxFIFO is half empty
> -	 *	* 1'b1: GINTSTS.PTxFEmp interrupt indicates that the Periodic
> -	 *	TxFIFO is completely empty
> -	 * @nptxfemplvl: Non-Periodic TxFIFO Empty Level (NPTxFEmpLvl)
> -	 *	Software should set this bit to 0x1.
> -	 *	Indicates when the Non-Periodic TxFIFO Empty Interrupt bit in
> -	 *	the Core Interrupt register (GINTSTS.NPTxFEmp) is triggered.
> -	 *	This bit is used only in Slave mode.
> -	 *	* 1'b0: GINTSTS.NPTxFEmp interrupt indicates that the Non-
> -	 *	Periodic TxFIFO is half empty
> -	 *	* 1'b1: GINTSTS.NPTxFEmp interrupt indicates that the Non-
> -	 *	Periodic TxFIFO is completely empty
> -	 * @dmaen: DMA Enable (DMAEn)
> -	 *	* 1'b0: Core operates in Slave mode
> -	 *	* 1'b1: Core operates in a DMA mode
> -	 * @hbstlen: Burst Length/Type (HBstLen)
> -	 *	This field has not effect and should be left as 0x0.
> -	 * @glblintrmsk: Global Interrupt Mask (GlblIntrMsk)
> -	 *	Software should set this field to 0x1.
> -	 *	The application uses this bit to mask or unmask the interrupt
> -	 *	line assertion to itself. Irrespective of this bit's setting,
> -	 *	the interrupt status registers are updated by the core.
> -	 *	* 1'b0: Mask the interrupt assertion to the application.
> -	 *	* 1'b1: Unmask the interrupt assertion to the application.
> -	 */
> -	struct cvmx_usbcx_gahbcfg_s {
> -		__BITFIELD_FIELD(u32 reserved_9_31	: 23,
> -		__BITFIELD_FIELD(u32 ptxfemplvl		: 1,
> -		__BITFIELD_FIELD(u32 nptxfemplvl	: 1,
> -		__BITFIELD_FIELD(u32 reserved_6_6	: 1,
> -		__BITFIELD_FIELD(u32 dmaen		: 1,
> -		__BITFIELD_FIELD(u32 hbstlen		: 4,
> -		__BITFIELD_FIELD(u32 glblintrmsk	: 1,
> -		;)))))))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_ghwcfg3
> - *
> - * User HW Config3 Register (GHWCFG3)
> - *
> - * This register contains the configuration options of the O2P USB core.
> - */
> -union cvmx_usbcx_ghwcfg3 {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_ghwcfg3_s
> -	 * @dfifodepth: DFIFO Depth (DfifoDepth)
> -	 *	This value is in terms of 32-bit words.
> -	 *	* Minimum value is 32
> -	 *	* Maximum value is 32768
> -	 * @ahbphysync: AHB and PHY Synchronous (AhbPhySync)
> -	 *	Indicates whether AHB and PHY clocks are synchronous to
> -	 *	each other.
> -	 *	* 1'b0: No
> -	 *	* 1'b1: Yes
> -	 *	This bit is tied to 1.
> -	 * @rsttype: Reset Style for Clocked always Blocks in RTL (RstType)
> -	 *	* 1'b0: Asynchronous reset is used in the core
> -	 *	* 1'b1: Synchronous reset is used in the core
> -	 * @optfeature: Optional Features Removed (OptFeature)
> -	 *	Indicates whether the User ID register, GPIO interface ports,
> -	 *	and SOF toggle and counter ports were removed for gate count
> -	 *	optimization.
> -	 * @vendor_control_interface_support: Vendor Control Interface Support
> -	 *	* 1'b0: Vendor Control Interface is not available on the core.
> -	 *	* 1'b1: Vendor Control Interface is available.
> -	 * @i2c_selection: I2C Selection
> -	 *	* 1'b0: I2C Interface is not available on the core.
> -	 *	* 1'b1: I2C Interface is available on the core.
> -	 * @otgen: OTG Function Enabled (OtgEn)
> -	 *	The application uses this bit to indicate the O2P USB core's
> -	 *	OTG capabilities.
> -	 *	* 1'b0: Not OTG capable
> -	 *	* 1'b1: OTG Capable
> -	 * @pktsizewidth: Width of Packet Size Counters (PktSizeWidth)
> -	 *	* 3'b000: 4 bits
> -	 *	* 3'b001: 5 bits
> -	 *	* 3'b010: 6 bits
> -	 *	* 3'b011: 7 bits
> -	 *	* 3'b100: 8 bits
> -	 *	* 3'b101: 9 bits
> -	 *	* 3'b110: 10 bits
> -	 *	* Others: Reserved
> -	 * @xfersizewidth: Width of Transfer Size Counters (XferSizeWidth)
> -	 *	* 4'b0000: 11 bits
> -	 *	* 4'b0001: 12 bits
> -	 *	- ...
> -	 *	* 4'b1000: 19 bits
> -	 *	* Others: Reserved
> -	 */
> -	struct cvmx_usbcx_ghwcfg3_s {
> -		__BITFIELD_FIELD(u32 dfifodepth				: 16,
> -		__BITFIELD_FIELD(u32 reserved_13_15			: 3,
> -		__BITFIELD_FIELD(u32 ahbphysync				: 1,
> -		__BITFIELD_FIELD(u32 rsttype				: 1,
> -		__BITFIELD_FIELD(u32 optfeature				: 1,
> -		__BITFIELD_FIELD(u32 vendor_control_interface_support	: 1,
> -		__BITFIELD_FIELD(u32 i2c_selection			: 1,
> -		__BITFIELD_FIELD(u32 otgen				: 1,
> -		__BITFIELD_FIELD(u32 pktsizewidth			: 3,
> -		__BITFIELD_FIELD(u32 xfersizewidth			: 4,
> -		;))))))))))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_gintmsk
> - *
> - * Core Interrupt Mask Register (GINTMSK)
> - *
> - * This register works with the Core Interrupt register to interrupt the
> - * application. When an interrupt bit is masked, the interrupt associated with
> - * that bit will not be generated. However, the Core Interrupt (GINTSTS)
> - * register bit corresponding to that interrupt will still be set.
> - * Mask interrupt: 1'b0, Unmask interrupt: 1'b1
> - */
> -union cvmx_usbcx_gintmsk {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_gintmsk_s
> -	 * @wkupintmsk: Resume/Remote Wakeup Detected Interrupt Mask
> -	 *	(WkUpIntMsk)
> -	 * @sessreqintmsk: Session Request/New Session Detected Interrupt Mask
> -	 *	(SessReqIntMsk)
> -	 * @disconnintmsk: Disconnect Detected Interrupt Mask (DisconnIntMsk)
> -	 * @conidstschngmsk: Connector ID Status Change Mask (ConIDStsChngMsk)
> -	 * @ptxfempmsk: Periodic TxFIFO Empty Mask (PTxFEmpMsk)
> -	 * @hchintmsk: Host Channels Interrupt Mask (HChIntMsk)
> -	 * @prtintmsk: Host Port Interrupt Mask (PrtIntMsk)
> -	 * @fetsuspmsk: Data Fetch Suspended Mask (FetSuspMsk)
> -	 * @incomplpmsk: Incomplete Periodic Transfer Mask (incomplPMsk)
> -	 *	Incomplete Isochronous OUT Transfer Mask
> -	 *	(incompISOOUTMsk)
> -	 * @incompisoinmsk: Incomplete Isochronous IN Transfer Mask
> -	 *		    (incompISOINMsk)
> -	 * @oepintmsk: OUT Endpoints Interrupt Mask (OEPIntMsk)
> -	 * @inepintmsk: IN Endpoints Interrupt Mask (INEPIntMsk)
> -	 * @epmismsk: Endpoint Mismatch Interrupt Mask (EPMisMsk)
> -	 * @eopfmsk: End of Periodic Frame Interrupt Mask (EOPFMsk)
> -	 * @isooutdropmsk: Isochronous OUT Packet Dropped Interrupt Mask
> -	 *	(ISOOutDropMsk)
> -	 * @enumdonemsk: Enumeration Done Mask (EnumDoneMsk)
> -	 * @usbrstmsk: USB Reset Mask (USBRstMsk)
> -	 * @usbsuspmsk: USB Suspend Mask (USBSuspMsk)
> -	 * @erlysuspmsk: Early Suspend Mask (ErlySuspMsk)
> -	 * @i2cint: I2C Interrupt Mask (I2CINT)
> -	 * @ulpickintmsk: ULPI Carkit Interrupt Mask (ULPICKINTMsk)
> -	 *	I2C Carkit Interrupt Mask (I2CCKINTMsk)
> -	 * @goutnakeffmsk: Global OUT NAK Effective Mask (GOUTNakEffMsk)
> -	 * @ginnakeffmsk: Global Non-Periodic IN NAK Effective Mask
> -	 *		  (GINNakEffMsk)
> -	 * @nptxfempmsk: Non-Periodic TxFIFO Empty Mask (NPTxFEmpMsk)
> -	 * @rxflvlmsk: Receive FIFO Non-Empty Mask (RxFLvlMsk)
> -	 * @sofmsk: Start of (micro)Frame Mask (SofMsk)
> -	 * @otgintmsk: OTG Interrupt Mask (OTGIntMsk)
> -	 * @modemismsk: Mode Mismatch Interrupt Mask (ModeMisMsk)
> -	 */
> -	struct cvmx_usbcx_gintmsk_s {
> -		__BITFIELD_FIELD(u32 wkupintmsk		: 1,
> -		__BITFIELD_FIELD(u32 sessreqintmsk	: 1,
> -		__BITFIELD_FIELD(u32 disconnintmsk	: 1,
> -		__BITFIELD_FIELD(u32 conidstschngmsk	: 1,
> -		__BITFIELD_FIELD(u32 reserved_27_27	: 1,
> -		__BITFIELD_FIELD(u32 ptxfempmsk		: 1,
> -		__BITFIELD_FIELD(u32 hchintmsk		: 1,
> -		__BITFIELD_FIELD(u32 prtintmsk		: 1,
> -		__BITFIELD_FIELD(u32 reserved_23_23	: 1,
> -		__BITFIELD_FIELD(u32 fetsuspmsk		: 1,
> -		__BITFIELD_FIELD(u32 incomplpmsk	: 1,
> -		__BITFIELD_FIELD(u32 incompisoinmsk	: 1,
> -		__BITFIELD_FIELD(u32 oepintmsk		: 1,
> -		__BITFIELD_FIELD(u32 inepintmsk		: 1,
> -		__BITFIELD_FIELD(u32 epmismsk		: 1,
> -		__BITFIELD_FIELD(u32 reserved_16_16	: 1,
> -		__BITFIELD_FIELD(u32 eopfmsk		: 1,
> -		__BITFIELD_FIELD(u32 isooutdropmsk	: 1,
> -		__BITFIELD_FIELD(u32 enumdonemsk	: 1,
> -		__BITFIELD_FIELD(u32 usbrstmsk		: 1,
> -		__BITFIELD_FIELD(u32 usbsuspmsk		: 1,
> -		__BITFIELD_FIELD(u32 erlysuspmsk	: 1,
> -		__BITFIELD_FIELD(u32 i2cint		: 1,
> -		__BITFIELD_FIELD(u32 ulpickintmsk	: 1,
> -		__BITFIELD_FIELD(u32 goutnakeffmsk	: 1,
> -		__BITFIELD_FIELD(u32 ginnakeffmsk	: 1,
> -		__BITFIELD_FIELD(u32 nptxfempmsk	: 1,
> -		__BITFIELD_FIELD(u32 rxflvlmsk		: 1,
> -		__BITFIELD_FIELD(u32 sofmsk		: 1,
> -		__BITFIELD_FIELD(u32 otgintmsk		: 1,
> -		__BITFIELD_FIELD(u32 modemismsk		: 1,
> -		__BITFIELD_FIELD(u32 reserved_0_0	: 1,
> -		;))))))))))))))))))))))))))))))))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_gintsts
> - *
> - * Core Interrupt Register (GINTSTS)
> - *
> - * This register interrupts the application for system-level events in the
> - * current mode of operation (Device mode or Host mode). It is shown in
> - * Interrupt. Some of the bits in this register are valid only in Host mode,
> - * while others are valid in Device mode only. This register also indicates the
> - * current mode of operation. In order to clear the interrupt status bits of
> - * type R_SS_WC, the application must write 1'b1 into the bit. The FIFO status
> - * interrupts are read only; once software reads from or writes to the FIFO
> - * while servicing these interrupts, FIFO interrupt conditions are cleared
> - * automatically.
> - */
> -union cvmx_usbcx_gintsts {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_gintsts_s
> -	 * @wkupint: Resume/Remote Wakeup Detected Interrupt (WkUpInt)
> -	 *	In Device mode, this interrupt is asserted when a resume is
> -	 *	detected on the USB. In Host mode, this interrupt is asserted
> -	 *	when a remote wakeup is detected on the USB.
> -	 *	For more information on how to use this interrupt, see "Partial
> -	 *	Power-Down and Clock Gating Programming Model" on
> -	 *	page 353.
> -	 * @sessreqint: Session Request/New Session Detected Interrupt
> -	 *		(SessReqInt)
> -	 *	In Host mode, this interrupt is asserted when a session request
> -	 *	is detected from the device. In Device mode, this interrupt is
> -	 *	asserted when the utmiotg_bvalid signal goes high.
> -	 *	For more information on how to use this interrupt, see "Partial
> -	 *	Power-Down and Clock Gating Programming Model" on
> -	 *	page 353.
> -	 * @disconnint: Disconnect Detected Interrupt (DisconnInt)
> -	 *	Asserted when a device disconnect is detected.
> -	 * @conidstschng: Connector ID Status Change (ConIDStsChng)
> -	 *	The core sets this bit when there is a change in connector ID
> -	 *	status.
> -	 * @ptxfemp: Periodic TxFIFO Empty (PTxFEmp)
> -	 *	Asserted when the Periodic Transmit FIFO is either half or
> -	 *	completely empty and there is space for at least one entry to be
> -	 *	written in the Periodic Request Queue. The half or completely
> -	 *	empty status is determined by the Periodic TxFIFO Empty Level
> -	 *	bit in the Core AHB Configuration register
> -	 *	(GAHBCFG.PTxFEmpLvl).
> -	 * @hchint: Host Channels Interrupt (HChInt)
> -	 *	The core sets this bit to indicate that an interrupt is pending
> -	 *	on one of the channels of the core (in Host mode). The
> -	 *	application must read the Host All Channels Interrupt (HAINT)
> -	 *	register to determine the exact number of the channel on which
> -	 *	the interrupt occurred, and then read the corresponding Host
> -	 *	Channel-n Interrupt (HCINTn) register to determine the exact
> -	 *	cause of the interrupt. The application must clear the
> -	 *	appropriate status bit in the HCINTn register to clear this bit.
> -	 * @prtint: Host Port Interrupt (PrtInt)
> -	 *	The core sets this bit to indicate a change in port status of
> -	 *	one of the O2P USB core ports in Host mode. The application must
> -	 *	read the Host Port Control and Status (HPRT) register to
> -	 *	determine the exact event that caused this interrupt. The
> -	 *	application must clear the appropriate status bit in the Host
> -	 *	Port Control and Status register to clear this bit.
> -	 * @fetsusp: Data Fetch Suspended (FetSusp)
> -	 *	This interrupt is valid only in DMA mode. This interrupt
> -	 *	indicates that the core has stopped fetching data for IN
> -	 *	endpoints due to the unavailability of TxFIFO space or Request
> -	 *	Queue space. This interrupt is used by the application for an
> -	 *	endpoint mismatch algorithm.
> -	 * @incomplp: Incomplete Periodic Transfer (incomplP)
> -	 *	In Host mode, the core sets this interrupt bit when there are
> -	 *	incomplete periodic transactions still pending which are
> -	 *	scheduled for the current microframe.
> -	 *	Incomplete Isochronous OUT Transfer (incompISOOUT)
> -	 *	The Device mode, the core sets this interrupt to indicate that
> -	 *	there is at least one isochronous OUT endpoint on which the
> -	 *	transfer is not completed in the current microframe. This
> -	 *	interrupt is asserted along with the End of Periodic Frame
> -	 *	Interrupt (EOPF) bit in this register.
> -	 * @incompisoin: Incomplete Isochronous IN Transfer (incompISOIN)
> -	 *	The core sets this interrupt to indicate that there is at least
> -	 *	one isochronous IN endpoint on which the transfer is not
> -	 *	completed in the current microframe. This interrupt is asserted
> -	 *	along with the End of Periodic Frame Interrupt (EOPF) bit in
> -	 *	this register.
> -	 * @oepint: OUT Endpoints Interrupt (OEPInt)
> -	 *	The core sets this bit to indicate that an interrupt is pending
> -	 *	on one of the OUT endpoints of the core (in Device mode). The
> -	 *	application must read the Device All Endpoints Interrupt
> -	 *	(DAINT) register to determine the exact number of the OUT
> -	 *	endpoint on which the interrupt occurred, and then read the
> -	 *	corresponding Device OUT Endpoint-n Interrupt (DOEPINTn)
> -	 *	register to determine the exact cause of the interrupt. The
> -	 *	application must clear the appropriate status bit in the
> -	 *	corresponding DOEPINTn register to clear this bit.
> -	 * @iepint: IN Endpoints Interrupt (IEPInt)
> -	 *	The core sets this bit to indicate that an interrupt is pending
> -	 *	on one of the IN endpoints of the core (in Device mode). The
> -	 *	application must read the Device All Endpoints Interrupt
> -	 *	(DAINT) register to determine the exact number of the IN
> -	 *	endpoint on which the interrupt occurred, and then read the
> -	 *	corresponding Device IN Endpoint-n Interrupt (DIEPINTn)
> -	 *	register to determine the exact cause of the interrupt. The
> -	 *	application must clear the appropriate status bit in the
> -	 *	corresponding DIEPINTn register to clear this bit.
> -	 * @epmis: Endpoint Mismatch Interrupt (EPMis)
> -	 *	Indicates that an IN token has been received for a non-periodic
> -	 *	endpoint, but the data for another endpoint is present in the
> -	 *	top of the Non-Periodic Transmit FIFO and the IN endpoint
> -	 *	mismatch count programmed by the application has expired.
> -	 * @eopf: End of Periodic Frame Interrupt (EOPF)
> -	 *	Indicates that the period specified in the Periodic Frame
> -	 *	Interval field of the Device Configuration register
> -	 *	(DCFG.PerFrInt) has been reached in the current microframe.
> -	 * @isooutdrop: Isochronous OUT Packet Dropped Interrupt (ISOOutDrop)
> -	 *	The core sets this bit when it fails to write an isochronous OUT
> -	 *	packet into the RxFIFO because the RxFIFO doesn't have
> -	 *	enough space to accommodate a maximum packet size packet
> -	 *	for the isochronous OUT endpoint.
> -	 * @enumdone: Enumeration Done (EnumDone)
> -	 *	The core sets this bit to indicate that speed enumeration is
> -	 *	complete. The application must read the Device Status (DSTS)
> -	 *	register to obtain the enumerated speed.
> -	 * @usbrst: USB Reset (USBRst)
> -	 *	The core sets this bit to indicate that a reset is detected on
> -	 *	the USB.
> -	 * @usbsusp: USB Suspend (USBSusp)
> -	 *	The core sets this bit to indicate that a suspend was detected
> -	 *	on the USB. The core enters the Suspended state when there
> -	 *	is no activity on the phy_line_state_i signal for an extended
> -	 *	period of time.
> -	 * @erlysusp: Early Suspend (ErlySusp)
> -	 *	The core sets this bit to indicate that an Idle state has been
> -	 *	detected on the USB for 3 ms.
> -	 * @i2cint: I2C Interrupt (I2CINT)
> -	 *	This bit is always 0x0.
> -	 * @ulpickint: ULPI Carkit Interrupt (ULPICKINT)
> -	 *	This bit is always 0x0.
> -	 * @goutnakeff: Global OUT NAK Effective (GOUTNakEff)
> -	 *	Indicates that the Set Global OUT NAK bit in the Device Control
> -	 *	register (DCTL.SGOUTNak), set by the application, has taken
> -	 *	effect in the core. This bit can be cleared by writing the Clear
> -	 *	Global OUT NAK bit in the Device Control register
> -	 *	(DCTL.CGOUTNak).
> -	 * @ginnakeff: Global IN Non-Periodic NAK Effective (GINNakEff)
> -	 *	Indicates that the Set Global Non-Periodic IN NAK bit in the
> -	 *	Device Control register (DCTL.SGNPInNak), set by the
> -	 *	application, has taken effect in the core. That is, the core has
> -	 *	sampled the Global IN NAK bit set by the application. This bit
> -	 *	can be cleared by clearing the Clear Global Non-Periodic IN
> -	 *	NAK bit in the Device Control register (DCTL.CGNPInNak).
> -	 *	This interrupt does not necessarily mean that a NAK handshake
> -	 *	is sent out on the USB. The STALL bit takes precedence over
> -	 *	the NAK bit.
> -	 * @nptxfemp: Non-Periodic TxFIFO Empty (NPTxFEmp)
> -	 *	This interrupt is asserted when the Non-Periodic TxFIFO is
> -	 *	either half or completely empty, and there is space for at least
> -	 *	one entry to be written to the Non-Periodic Transmit Request
> -	 *	Queue. The half or completely empty status is determined by
> -	 *	the Non-Periodic TxFIFO Empty Level bit in the Core AHB
> -	 *	Configuration register (GAHBCFG.NPTxFEmpLvl).
> -	 * @rxflvl: RxFIFO Non-Empty (RxFLvl)
> -	 *	Indicates that there is at least one packet pending to be read
> -	 *	from the RxFIFO.
> -	 * @sof: Start of (micro)Frame (Sof)
> -	 *	In Host mode, the core sets this bit to indicate that an SOF
> -	 *	(FS), micro-SOF (HS), or Keep-Alive (LS) is transmitted on the
> -	 *	USB. The application must write a 1 to this bit to clear the
> -	 *	interrupt.
> -	 *	In Device mode, in the core sets this bit to indicate that an
> -	 *	SOF token has been received on the USB. The application can read
> -	 *	the Device Status register to get the current (micro)frame
> -	 *	number. This interrupt is seen only when the core is operating
> -	 *	at either HS or FS.
> -	 * @otgint: OTG Interrupt (OTGInt)
> -	 *	The core sets this bit to indicate an OTG protocol event. The
> -	 *	application must read the OTG Interrupt Status (GOTGINT)
> -	 *	register to determine the exact event that caused this
> -	 *	interrupt. The application must clear the appropriate status bit
> -	 *	in the GOTGINT register to clear this bit.
> -	 * @modemis: Mode Mismatch Interrupt (ModeMis)
> -	 *	The core sets this bit when the application is trying to access:
> -	 *	* A Host mode register, when the core is operating in Device
> -	 *	mode
> -	 *	* A Device mode register, when the core is operating in Host
> -	 *	mode
> -	 *	The register access is completed on the AHB with an OKAY
> -	 *	response, but is ignored by the core internally and doesn't
> -	 *	affect the operation of the core.
> -	 * @curmod: Current Mode of Operation (CurMod)
> -	 *	Indicates the current mode of operation.
> -	 *	* 1'b0: Device mode
> -	 *	* 1'b1: Host mode
> -	 */
> -	struct cvmx_usbcx_gintsts_s {
> -		__BITFIELD_FIELD(u32 wkupint		: 1,
> -		__BITFIELD_FIELD(u32 sessreqint		: 1,
> -		__BITFIELD_FIELD(u32 disconnint		: 1,
> -		__BITFIELD_FIELD(u32 conidstschng	: 1,
> -		__BITFIELD_FIELD(u32 reserved_27_27	: 1,
> -		__BITFIELD_FIELD(u32 ptxfemp		: 1,
> -		__BITFIELD_FIELD(u32 hchint		: 1,
> -		__BITFIELD_FIELD(u32 prtint		: 1,
> -		__BITFIELD_FIELD(u32 reserved_23_23	: 1,
> -		__BITFIELD_FIELD(u32 fetsusp		: 1,
> -		__BITFIELD_FIELD(u32 incomplp		: 1,
> -		__BITFIELD_FIELD(u32 incompisoin	: 1,
> -		__BITFIELD_FIELD(u32 oepint		: 1,
> -		__BITFIELD_FIELD(u32 iepint		: 1,
> -		__BITFIELD_FIELD(u32 epmis		: 1,
> -		__BITFIELD_FIELD(u32 reserved_16_16	: 1,
> -		__BITFIELD_FIELD(u32 eopf		: 1,
> -		__BITFIELD_FIELD(u32 isooutdrop		: 1,
> -		__BITFIELD_FIELD(u32 enumdone		: 1,
> -		__BITFIELD_FIELD(u32 usbrst		: 1,
> -		__BITFIELD_FIELD(u32 usbsusp		: 1,
> -		__BITFIELD_FIELD(u32 erlysusp		: 1,
> -		__BITFIELD_FIELD(u32 i2cint		: 1,
> -		__BITFIELD_FIELD(u32 ulpickint		: 1,
> -		__BITFIELD_FIELD(u32 goutnakeff		: 1,
> -		__BITFIELD_FIELD(u32 ginnakeff		: 1,
> -		__BITFIELD_FIELD(u32 nptxfemp		: 1,
> -		__BITFIELD_FIELD(u32 rxflvl		: 1,
> -		__BITFIELD_FIELD(u32 sof		: 1,
> -		__BITFIELD_FIELD(u32 otgint		: 1,
> -		__BITFIELD_FIELD(u32 modemis		: 1,
> -		__BITFIELD_FIELD(u32 curmod		: 1,
> -		;))))))))))))))))))))))))))))))))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_gnptxfsiz
> - *
> - * Non-Periodic Transmit FIFO Size Register (GNPTXFSIZ)
> - *
> - * The application can program the RAM size and the memory start address for the
> - * Non-Periodic TxFIFO.
> - */
> -union cvmx_usbcx_gnptxfsiz {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_gnptxfsiz_s
> -	 * @nptxfdep: Non-Periodic TxFIFO Depth (NPTxFDep)
> -	 *	This value is in terms of 32-bit words.
> -	 *	Minimum value is 16
> -	 *	Maximum value is 32768
> -	 * @nptxfstaddr: Non-Periodic Transmit RAM Start Address (NPTxFStAddr)
> -	 *	This field contains the memory start address for Non-Periodic
> -	 *	Transmit FIFO RAM.
> -	 */
> -	struct cvmx_usbcx_gnptxfsiz_s {
> -		__BITFIELD_FIELD(u32 nptxfdep		: 16,
> -		__BITFIELD_FIELD(u32 nptxfstaddr	: 16,
> -		;))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_gnptxsts
> - *
> - * Non-Periodic Transmit FIFO/Queue Status Register (GNPTXSTS)
> - *
> - * This read-only register contains the free space information for the
> - * Non-Periodic TxFIFO and the Non-Periodic Transmit Request Queue.
> - */
> -union cvmx_usbcx_gnptxsts {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_gnptxsts_s
> -	 * @nptxqtop: Top of the Non-Periodic Transmit Request Queue (NPTxQTop)
> -	 *	Entry in the Non-Periodic Tx Request Queue that is currently
> -	 *	being processed by the MAC.
> -	 *	* Bits [30:27]: Channel/endpoint number
> -	 *	* Bits [26:25]:
> -	 *	- 2'b00: IN/OUT token
> -	 *	- 2'b01: Zero-length transmit packet (device IN/host OUT)
> -	 *	- 2'b10: PING/CSPLIT token
> -	 *	- 2'b11: Channel halt command
> -	 *	* Bit [24]: Terminate (last entry for selected channel/endpoint)
> -	 * @nptxqspcavail: Non-Periodic Transmit Request Queue Space Available
> -	 *	(NPTxQSpcAvail)
> -	 *	Indicates the amount of free space available in the Non-
> -	 *	Periodic Transmit Request Queue. This queue holds both IN
> -	 *	and OUT requests in Host mode. Device mode has only IN
> -	 *	requests.
> -	 *	* 8'h0: Non-Periodic Transmit Request Queue is full
> -	 *	* 8'h1: 1 location available
> -	 *	* 8'h2: 2 locations available
> -	 *	* n: n locations available (0..8)
> -	 *	* Others: Reserved
> -	 * @nptxfspcavail: Non-Periodic TxFIFO Space Avail (NPTxFSpcAvail)
> -	 *	Indicates the amount of free space available in the Non-
> -	 *	Periodic TxFIFO.
> -	 *	Values are in terms of 32-bit words.
> -	 *	* 16'h0: Non-Periodic TxFIFO is full
> -	 *	* 16'h1: 1 word available
> -	 *	* 16'h2: 2 words available
> -	 *	* 16'hn: n words available (where 0..32768)
> -	 *	* 16'h8000: 32768 words available
> -	 *	* Others: Reserved
> -	 */
> -	struct cvmx_usbcx_gnptxsts_s {
> -		__BITFIELD_FIELD(u32 reserved_31_31	: 1,
> -		__BITFIELD_FIELD(u32 nptxqtop		: 7,
> -		__BITFIELD_FIELD(u32 nptxqspcavail	: 8,
> -		__BITFIELD_FIELD(u32 nptxfspcavail	: 16,
> -		;))))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_grstctl
> - *
> - * Core Reset Register (GRSTCTL)
> - *
> - * The application uses this register to reset various hardware features inside
> - * the core.
> - */
> -union cvmx_usbcx_grstctl {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_grstctl_s
> -	 * @ahbidle: AHB Master Idle (AHBIdle)
> -	 *	Indicates that the AHB Master State Machine is in the IDLE
> -	 *	condition.
> -	 * @dmareq: DMA Request Signal (DMAReq)
> -	 *	Indicates that the DMA request is in progress. Used for debug.
> -	 * @txfnum: TxFIFO Number (TxFNum)
> -	 *	This is the FIFO number that must be flushed using the TxFIFO
> -	 *	Flush bit. This field must not be changed until the core clears
> -	 *	the TxFIFO Flush bit.
> -	 *	* 5'h0: Non-Periodic TxFIFO flush
> -	 *	* 5'h1: Periodic TxFIFO 1 flush in Device mode or Periodic
> -	 *	TxFIFO flush in Host mode
> -	 *	* 5'h2: Periodic TxFIFO 2 flush in Device mode
> -	 *	- ...
> -	 *	* 5'hF: Periodic TxFIFO 15 flush in Device mode
> -	 *	* 5'h10: Flush all the Periodic and Non-Periodic TxFIFOs in the
> -	 *	core
> -	 * @txfflsh: TxFIFO Flush (TxFFlsh)
> -	 *	This bit selectively flushes a single or all transmit FIFOs, but
> -	 *	cannot do so if the core is in the midst of a transaction.
> -	 *	The application must only write this bit after checking that the
> -	 *	core is neither writing to the TxFIFO nor reading from the
> -	 *	TxFIFO.
> -	 *	The application must wait until the core clears this bit before
> -	 *	performing any operations. This bit takes 8 clocks (of phy_clk
> -	 *	or hclk, whichever is slower) to clear.
> -	 * @rxfflsh: RxFIFO Flush (RxFFlsh)
> -	 *	The application can flush the entire RxFIFO using this bit, but
> -	 *	must first ensure that the core is not in the middle of a
> -	 *	transaction.
> -	 *	The application must only write to this bit after checking that
> -	 *	the core is neither reading from the RxFIFO nor writing to the
> -	 *	RxFIFO.
> -	 *	The application must wait until the bit is cleared before
> -	 *	performing any other operations. This bit will take 8 clocks
> -	 *	(slowest of PHY or AHB clock) to clear.
> -	 * @intknqflsh: IN Token Sequence Learning Queue Flush (INTknQFlsh)
> -	 *	The application writes this bit to flush the IN Token Sequence
> -	 *	Learning Queue.
> -	 * @frmcntrrst: Host Frame Counter Reset (FrmCntrRst)
> -	 *	The application writes this bit to reset the (micro)frame number
> -	 *	counter inside the core. When the (micro)frame counter is reset,
> -	 *	the subsequent SOF sent out by the core will have a
> -	 *	(micro)frame number of 0.
> -	 * @hsftrst: HClk Soft Reset (HSftRst)
> -	 *	The application uses this bit to flush the control logic in the
> -	 *	AHB Clock domain. Only AHB Clock Domain pipelines are reset.
> -	 *	* FIFOs are not flushed with this bit.
> -	 *	* All state machines in the AHB clock domain are reset to the
> -	 *	Idle state after terminating the transactions on the AHB,
> -	 *	following the protocol.
> -	 *	* CSR control bits used by the AHB clock domain state
> -	 *	machines are cleared.
> -	 *	* To clear this interrupt, status mask bits that control the
> -	 *	interrupt status and are generated by the AHB clock domain
> -	 *	state machine are cleared.
> -	 *	* Because interrupt status bits are not cleared, the application
> -	 *	can get the status of any core events that occurred after it set
> -	 *	this bit.
> -	 *	This is a self-clearing bit that the core clears after all
> -	 *	necessary logic is reset in the core. This may take several
> -	 *	clocks, depending on the core's current state.
> -	 * @csftrst: Core Soft Reset (CSftRst)
> -	 *	Resets the hclk and phy_clock domains as follows:
> -	 *	* Clears the interrupts and all the CSR registers except the
> -	 *	following register bits:
> -	 *	- PCGCCTL.RstPdwnModule
> -	 *	- PCGCCTL.GateHclk
> -	 *	- PCGCCTL.PwrClmp
> -	 *	- PCGCCTL.StopPPhyLPwrClkSelclk
> -	 *	- GUSBCFG.PhyLPwrClkSel
> -	 *	- GUSBCFG.DDRSel
> -	 *	- GUSBCFG.PHYSel
> -	 *	- GUSBCFG.FSIntf
> -	 *	- GUSBCFG.ULPI_UTMI_Sel
> -	 *	- GUSBCFG.PHYIf
> -	 *	- HCFG.FSLSPclkSel
> -	 *	- DCFG.DevSpd
> -	 *	* All module state machines (except the AHB Slave Unit) are
> -	 *	reset to the IDLE state, and all the transmit FIFOs and the
> -	 *	receive FIFO are flushed.
> -	 *	* Any transactions on the AHB Master are terminated as soon
> -	 *	as possible, after gracefully completing the last data phase of
> -	 *	an AHB transfer. Any transactions on the USB are terminated
> -	 *	immediately.
> -	 *	The application can write to this bit any time it wants to reset
> -	 *	the core. This is a self-clearing bit and the core clears this
> -	 *	bit after all the necessary logic is reset in the core, which
> -	 *	may take several clocks, depending on the current state of the
> -	 *	core. Once this bit is cleared software should wait at least 3
> -	 *	PHY clocks before doing any access to the PHY domain
> -	 *	(synchronization delay). Software should also should check that
> -	 *	bit 31 of this register is 1 (AHB Master is IDLE) before
> -	 *	starting any operation.
> -	 *	Typically software reset is used during software development
> -	 *	and also when you dynamically change the PHY selection bits
> -	 *	in the USB configuration registers listed above. When you
> -	 *	change the PHY, the corresponding clock for the PHY is
> -	 *	selected and used in the PHY domain. Once a new clock is
> -	 *	selected, the PHY domain has to be reset for proper operation.
> -	 */
> -	struct cvmx_usbcx_grstctl_s {
> -		__BITFIELD_FIELD(u32 ahbidle		: 1,
> -		__BITFIELD_FIELD(u32 dmareq		: 1,
> -		__BITFIELD_FIELD(u32 reserved_11_29	: 19,
> -		__BITFIELD_FIELD(u32 txfnum		: 5,
> -		__BITFIELD_FIELD(u32 txfflsh		: 1,
> -		__BITFIELD_FIELD(u32 rxfflsh		: 1,
> -		__BITFIELD_FIELD(u32 intknqflsh		: 1,
> -		__BITFIELD_FIELD(u32 frmcntrrst		: 1,
> -		__BITFIELD_FIELD(u32 hsftrst		: 1,
> -		__BITFIELD_FIELD(u32 csftrst		: 1,
> -		;))))))))))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_grxfsiz
> - *
> - * Receive FIFO Size Register (GRXFSIZ)
> - *
> - * The application can program the RAM size that must be allocated to the
> - * RxFIFO.
> - */
> -union cvmx_usbcx_grxfsiz {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_grxfsiz_s
> -	 * @rxfdep: RxFIFO Depth (RxFDep)
> -	 *	This value is in terms of 32-bit words.
> -	 *	* Minimum value is 16
> -	 *	* Maximum value is 32768
> -	 */
> -	struct cvmx_usbcx_grxfsiz_s {
> -		__BITFIELD_FIELD(u32 reserved_16_31	: 16,
> -		__BITFIELD_FIELD(u32 rxfdep		: 16,
> -		;))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_grxstsph
> - *
> - * Receive Status Read and Pop Register, Host Mode (GRXSTSPH)
> - *
> - * A read to the Receive Status Read and Pop register returns and additionally
> - * pops the top data entry out of the RxFIFO.
> - * This Description is only valid when the core is in Host Mode. For Device Mode
> - * use USBC_GRXSTSPD instead.
> - * NOTE: GRXSTSPH and GRXSTSPD are physically the same register and share the
> - *	 same offset in the O2P USB core. The offset difference shown in this
> - *	 document is for software clarity and is actually ignored by the
> - *       hardware.
> - */
> -union cvmx_usbcx_grxstsph {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_grxstsph_s
> -	 * @pktsts: Packet Status (PktSts)
> -	 *	Indicates the status of the received packet
> -	 *	* 4'b0010: IN data packet received
> -	 *	* 4'b0011: IN transfer completed (triggers an interrupt)
> -	 *	* 4'b0101: Data toggle error (triggers an interrupt)
> -	 *	* 4'b0111: Channel halted (triggers an interrupt)
> -	 *	* Others: Reserved
> -	 * @dpid: Data PID (DPID)
> -	 *	* 2'b00: DATA0
> -	 *	* 2'b10: DATA1
> -	 *	* 2'b01: DATA2
> -	 *	* 2'b11: MDATA
> -	 * @bcnt: Byte Count (BCnt)
> -	 *	Indicates the byte count of the received IN data packet
> -	 * @chnum: Channel Number (ChNum)
> -	 *	Indicates the channel number to which the current received
> -	 *	packet belongs.
> -	 */
> -	struct cvmx_usbcx_grxstsph_s {
> -		__BITFIELD_FIELD(u32 reserved_21_31	: 11,
> -		__BITFIELD_FIELD(u32 pktsts		: 4,
> -		__BITFIELD_FIELD(u32 dpid		: 2,
> -		__BITFIELD_FIELD(u32 bcnt		: 11,
> -		__BITFIELD_FIELD(u32 chnum		: 4,
> -		;)))))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_gusbcfg
> - *
> - * Core USB Configuration Register (GUSBCFG)
> - *
> - * This register can be used to configure the core after power-on or a changing
> - * to Host mode or Device mode. It contains USB and USB-PHY related
> - * configuration parameters. The application must program this register before
> - * starting any transactions on either the AHB or the USB. Do not make changes
> - * to this register after the initial programming.
> - */
> -union cvmx_usbcx_gusbcfg {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_gusbcfg_s
> -	 * @otgi2csel: UTMIFS or I2C Interface Select (OtgI2CSel)
> -	 *	This bit is always 0x0.
> -	 * @phylpwrclksel: PHY Low-Power Clock Select (PhyLPwrClkSel)
> -	 *	Software should set this bit to 0x0.
> -	 *	Selects either 480-MHz or 48-MHz (low-power) PHY mode. In
> -	 *	FS and LS modes, the PHY can usually operate on a 48-MHz
> -	 *	clock to save power.
> -	 *	* 1'b0: 480-MHz Internal PLL clock
> -	 *	* 1'b1: 48-MHz External Clock
> -	 *	In 480 MHz mode, the UTMI interface operates at either 60 or
> -	 *	30-MHz, depending upon whether 8- or 16-bit data width is
> -	 *	selected. In 48-MHz mode, the UTMI interface operates at 48
> -	 *	MHz in FS mode and at either 48 or 6 MHz in LS mode
> -	 *	(depending on the PHY vendor).
> -	 *	This bit drives the utmi_fsls_low_power core output signal, and
> -	 *	is valid only for UTMI+ PHYs.
> -	 * @usbtrdtim: USB Turnaround Time (USBTrdTim)
> -	 *	Sets the turnaround time in PHY clocks.
> -	 *	Specifies the response time for a MAC request to the Packet
> -	 *	FIFO Controller (PFC) to fetch data from the DFIFO (SPRAM).
> -	 *	This must be programmed to 0x5.
> -	 * @hnpcap: HNP-Capable (HNPCap)
> -	 *	This bit is always 0x0.
> -	 * @srpcap: SRP-Capable (SRPCap)
> -	 *	This bit is always 0x0.
> -	 * @ddrsel: ULPI DDR Select (DDRSel)
> -	 *	Software should set this bit to 0x0.
> -	 * @physel: USB 2.0 High-Speed PHY or USB 1.1 Full-Speed Serial
> -	 *	Software should set this bit to 0x0.
> -	 * @fsintf: Full-Speed Serial Interface Select (FSIntf)
> -	 *	Software should set this bit to 0x0.
> -	 * @ulpi_utmi_sel: ULPI or UTMI+ Select (ULPI_UTMI_Sel)
> -	 *	This bit is always 0x0.
> -	 * @phyif: PHY Interface (PHYIf)
> -	 *	This bit is always 0x1.
> -	 * @toutcal: HS/FS Timeout Calibration (TOutCal)
> -	 *	The number of PHY clocks that the application programs in this
> -	 *	field is added to the high-speed/full-speed interpacket timeout
> -	 *	duration in the core to account for any additional delays
> -	 *	introduced by the PHY. This may be required, since the delay
> -	 *	introduced by the PHY in generating the linestate condition may
> -	 *	vary from one PHY to another.
> -	 *	The USB standard timeout value for high-speed operation is
> -	 *	736 to 816 (inclusive) bit times. The USB standard timeout
> -	 *	value for full-speed operation is 16 to 18 (inclusive) bit
> -	 *	times. The application must program this field based on the
> -	 *	speed of enumeration. The number of bit times added per PHY
> -	 *	clock are:
> -	 *	High-speed operation:
> -	 *	* One 30-MHz PHY clock = 16 bit times
> -	 *	* One 60-MHz PHY clock = 8 bit times
> -	 *	Full-speed operation:
> -	 *	* One 30-MHz PHY clock = 0.4 bit times
> -	 *	* One 60-MHz PHY clock = 0.2 bit times
> -	 *	* One 48-MHz PHY clock = 0.25 bit times
> -	 */
> -	struct cvmx_usbcx_gusbcfg_s {
> -		__BITFIELD_FIELD(u32 reserved_17_31	: 15,
> -		__BITFIELD_FIELD(u32 otgi2csel		: 1,
> -		__BITFIELD_FIELD(u32 phylpwrclksel	: 1,
> -		__BITFIELD_FIELD(u32 reserved_14_14	: 1,
> -		__BITFIELD_FIELD(u32 usbtrdtim		: 4,
> -		__BITFIELD_FIELD(u32 hnpcap		: 1,
> -		__BITFIELD_FIELD(u32 srpcap		: 1,
> -		__BITFIELD_FIELD(u32 ddrsel		: 1,
> -		__BITFIELD_FIELD(u32 physel		: 1,
> -		__BITFIELD_FIELD(u32 fsintf		: 1,
> -		__BITFIELD_FIELD(u32 ulpi_utmi_sel	: 1,
> -		__BITFIELD_FIELD(u32 phyif		: 1,
> -		__BITFIELD_FIELD(u32 toutcal		: 3,
> -		;)))))))))))))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_haint
> - *
> - * Host All Channels Interrupt Register (HAINT)
> - *
> - * When a significant event occurs on a channel, the Host All Channels Interrupt
> - * register interrupts the application using the Host Channels Interrupt bit of
> - * the Core Interrupt register (GINTSTS.HChInt). This is shown in Interrupt.
> - * There is one interrupt bit per channel, up to a maximum of 16 bits. Bits in
> - * this register are set and cleared when the application sets and clears bits
> - * in the corresponding Host Channel-n Interrupt register.
> - */
> -union cvmx_usbcx_haint {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_haint_s
> -	 * @haint: Channel Interrupts (HAINT)
> -	 *	One bit per channel: Bit 0 for Channel 0, bit 15 for Channel 15
> -	 */
> -	struct cvmx_usbcx_haint_s {
> -		__BITFIELD_FIELD(u32 reserved_16_31	: 16,
> -		__BITFIELD_FIELD(u32 haint		: 16,
> -		;))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_haintmsk
> - *
> - * Host All Channels Interrupt Mask Register (HAINTMSK)
> - *
> - * The Host All Channel Interrupt Mask register works with the Host All Channel
> - * Interrupt register to interrupt the application when an event occurs on a
> - * channel. There is one interrupt mask bit per channel, up to a maximum of 16
> - * bits.
> - * Mask interrupt: 1'b0 Unmask interrupt: 1'b1
> - */
> -union cvmx_usbcx_haintmsk {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_haintmsk_s
> -	 * @haintmsk: Channel Interrupt Mask (HAINTMsk)
> -	 *	One bit per channel: Bit 0 for channel 0, bit 15 for channel 15
> -	 */
> -	struct cvmx_usbcx_haintmsk_s {
> -		__BITFIELD_FIELD(u32 reserved_16_31	: 16,
> -		__BITFIELD_FIELD(u32 haintmsk		: 16,
> -		;))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_hcchar#
> - *
> - * Host Channel-n Characteristics Register (HCCHAR)
> - *
> - */
> -union cvmx_usbcx_hccharx {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_hccharx_s
> -	 * @chena: Channel Enable (ChEna)
> -	 *	This field is set by the application and cleared by the OTG
> -	 *	host.
> -	 *	* 1'b0: Channel disabled
> -	 *	* 1'b1: Channel enabled
> -	 * @chdis: Channel Disable (ChDis)
> -	 *	The application sets this bit to stop transmitting/receiving
> -	 *	data on a channel, even before the transfer for that channel is
> -	 *	complete. The application must wait for the Channel Disabled
> -	 *	interrupt before treating the channel as disabled.
> -	 * @oddfrm: Odd Frame (OddFrm)
> -	 *	This field is set (reset) by the application to indicate that
> -	 *	the OTG host must perform a transfer in an odd (micro)frame.
> -	 *	This field is applicable for only periodic (isochronous and
> -	 *	interrupt) transactions.
> -	 *	* 1'b0: Even (micro)frame
> -	 *	* 1'b1: Odd (micro)frame
> -	 * @devaddr: Device Address (DevAddr)
> -	 *	This field selects the specific device serving as the data
> -	 *	source or sink.
> -	 * @ec: Multi Count (MC) / Error Count (EC)
> -	 *	When the Split Enable bit of the Host Channel-n Split Control
> -	 *	register (HCSPLTn.SpltEna) is reset (1'b0), this field indicates
> -	 *	to the host the number of transactions that should be executed
> -	 *	per microframe for this endpoint.
> -	 *	* 2'b00: Reserved. This field yields undefined results.
> -	 *	* 2'b01: 1 transaction
> -	 *	* 2'b10: 2 transactions to be issued for this endpoint per
> -	 *	microframe
> -	 *	* 2'b11: 3 transactions to be issued for this endpoint per
> -	 *	microframe
> -	 *	When HCSPLTn.SpltEna is set (1'b1), this field indicates the
> -	 *	number of immediate retries to be performed for a periodic split
> -	 *	transactions on transaction errors. This field must be set to at
> -	 *	least 2'b01.
> -	 * @eptype: Endpoint Type (EPType)
> -	 *	Indicates the transfer type selected.
> -	 *	* 2'b00: Control
> -	 *	* 2'b01: Isochronous
> -	 *	* 2'b10: Bulk
> -	 *	* 2'b11: Interrupt
> -	 * @lspddev: Low-Speed Device (LSpdDev)
> -	 *	This field is set by the application to indicate that this
> -	 *	channel is communicating to a low-speed device.
> -	 * @epdir: Endpoint Direction (EPDir)
> -	 *	Indicates whether the transaction is IN or OUT.
> -	 *	* 1'b0: OUT
> -	 *	* 1'b1: IN
> -	 * @epnum: Endpoint Number (EPNum)
> -	 *	Indicates the endpoint number on the device serving as the
> -	 *	data source or sink.
> -	 * @mps: Maximum Packet Size (MPS)
> -	 *	Indicates the maximum packet size of the associated endpoint.
> -	 */
> -	struct cvmx_usbcx_hccharx_s {
> -		__BITFIELD_FIELD(u32 chena		: 1,
> -		__BITFIELD_FIELD(u32 chdis		: 1,
> -		__BITFIELD_FIELD(u32 oddfrm		: 1,
> -		__BITFIELD_FIELD(u32 devaddr		: 7,
> -		__BITFIELD_FIELD(u32 ec			: 2,
> -		__BITFIELD_FIELD(u32 eptype		: 2,
> -		__BITFIELD_FIELD(u32 lspddev		: 1,
> -		__BITFIELD_FIELD(u32 reserved_16_16	: 1,
> -		__BITFIELD_FIELD(u32 epdir		: 1,
> -		__BITFIELD_FIELD(u32 epnum		: 4,
> -		__BITFIELD_FIELD(u32 mps		: 11,
> -		;)))))))))))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_hcfg
> - *
> - * Host Configuration Register (HCFG)
> - *
> - * This register configures the core after power-on. Do not make changes to this
> - * register after initializing the host.
> - */
> -union cvmx_usbcx_hcfg {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_hcfg_s
> -	 * @fslssupp: FS- and LS-Only Support (FSLSSupp)
> -	 *	The application uses this bit to control the core's enumeration
> -	 *	speed. Using this bit, the application can make the core
> -	 *	enumerate as a FS host, even if the connected device supports
> -	 *	HS traffic. Do not make changes to this field after initial
> -	 *	programming.
> -	 *	* 1'b0: HS/FS/LS, based on the maximum speed supported by
> -	 *	the connected device
> -	 *	* 1'b1: FS/LS-only, even if the connected device can support HS
> -	 * @fslspclksel: FS/LS PHY Clock Select (FSLSPclkSel)
> -	 *	When the core is in FS Host mode
> -	 *	* 2'b00: PHY clock is running at 30/60 MHz
> -	 *	* 2'b01: PHY clock is running at 48 MHz
> -	 *	* Others: Reserved
> -	 *	When the core is in LS Host mode
> -	 *	* 2'b00: PHY clock is running at 30/60 MHz. When the
> -	 *	UTMI+/ULPI PHY Low Power mode is not selected, use
> -	 *	30/60 MHz.
> -	 *	* 2'b01: PHY clock is running at 48 MHz. When the UTMI+
> -	 *	PHY Low Power mode is selected, use 48MHz if the PHY
> -	 *	supplies a 48 MHz clock during LS mode.
> -	 *	* 2'b10: PHY clock is running at 6 MHz. In USB 1.1 FS mode,
> -	 *	use 6 MHz when the UTMI+ PHY Low Power mode is
> -	 *	selected and the PHY supplies a 6 MHz clock during LS
> -	 *	mode. If you select a 6 MHz clock during LS mode, you must
> -	 *	do a soft reset.
> -	 *	* 2'b11: Reserved
> -	 */
> -	struct cvmx_usbcx_hcfg_s {
> -		__BITFIELD_FIELD(u32 reserved_3_31	: 29,
> -		__BITFIELD_FIELD(u32 fslssupp		: 1,
> -		__BITFIELD_FIELD(u32 fslspclksel	: 2,
> -		;)))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_hcint#
> - *
> - * Host Channel-n Interrupt Register (HCINT)
> - *
> - * This register indicates the status of a channel with respect to USB- and
> - * AHB-related events. The application must read this register when the Host
> - * Channels Interrupt bit of the Core Interrupt register (GINTSTS.HChInt) is
> - * set. Before the application can read this register, it must first read
> - * the Host All Channels Interrupt (HAINT) register to get the exact channel
> - * number for the Host Channel-n Interrupt register. The application must clear
> - * the appropriate bit in this register to clear the corresponding bits in the
> - * HAINT and GINTSTS registers.
> - */
> -union cvmx_usbcx_hcintx {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_hcintx_s
> -	 * @datatglerr: Data Toggle Error (DataTglErr)
> -	 * @frmovrun: Frame Overrun (FrmOvrun)
> -	 * @bblerr: Babble Error (BblErr)
> -	 * @xacterr: Transaction Error (XactErr)
> -	 * @nyet: NYET Response Received Interrupt (NYET)
> -	 * @ack: ACK Response Received Interrupt (ACK)
> -	 * @nak: NAK Response Received Interrupt (NAK)
> -	 * @stall: STALL Response Received Interrupt (STALL)
> -	 * @ahberr: This bit is always 0x0.
> -	 * @chhltd: Channel Halted (ChHltd)
> -	 *	Indicates the transfer completed abnormally either because of
> -	 *	any USB transaction error or in response to disable request by
> -	 *	the application.
> -	 * @xfercompl: Transfer Completed (XferCompl)
> -	 *	Transfer completed normally without any errors.
> -	 */
> -	struct cvmx_usbcx_hcintx_s {
> -		__BITFIELD_FIELD(u32 reserved_11_31	: 21,
> -		__BITFIELD_FIELD(u32 datatglerr		: 1,
> -		__BITFIELD_FIELD(u32 frmovrun		: 1,
> -		__BITFIELD_FIELD(u32 bblerr		: 1,
> -		__BITFIELD_FIELD(u32 xacterr		: 1,
> -		__BITFIELD_FIELD(u32 nyet		: 1,
> -		__BITFIELD_FIELD(u32 ack		: 1,
> -		__BITFIELD_FIELD(u32 nak		: 1,
> -		__BITFIELD_FIELD(u32 stall		: 1,
> -		__BITFIELD_FIELD(u32 ahberr		: 1,
> -		__BITFIELD_FIELD(u32 chhltd		: 1,
> -		__BITFIELD_FIELD(u32 xfercompl		: 1,
> -		;))))))))))))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_hcintmsk#
> - *
> - * Host Channel-n Interrupt Mask Register (HCINTMSKn)
> - *
> - * This register reflects the mask for each channel status described in the
> - * previous section.
> - * Mask interrupt: 1'b0 Unmask interrupt: 1'b1
> - */
> -union cvmx_usbcx_hcintmskx {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_hcintmskx_s
> -	 * @datatglerrmsk: Data Toggle Error Mask (DataTglErrMsk)
> -	 * @frmovrunmsk: Frame Overrun Mask (FrmOvrunMsk)
> -	 * @bblerrmsk: Babble Error Mask (BblErrMsk)
> -	 * @xacterrmsk: Transaction Error Mask (XactErrMsk)
> -	 * @nyetmsk: NYET Response Received Interrupt Mask (NyetMsk)
> -	 * @ackmsk: ACK Response Received Interrupt Mask (AckMsk)
> -	 * @nakmsk: NAK Response Received Interrupt Mask (NakMsk)
> -	 * @stallmsk: STALL Response Received Interrupt Mask (StallMsk)
> -	 * @ahberrmsk: AHB Error Mask (AHBErrMsk)
> -	 * @chhltdmsk: Channel Halted Mask (ChHltdMsk)
> -	 * @xfercomplmsk: Transfer Completed Mask (XferComplMsk)
> -	 */
> -	struct cvmx_usbcx_hcintmskx_s {
> -		__BITFIELD_FIELD(u32 reserved_11_31		: 21,
> -		__BITFIELD_FIELD(u32 datatglerrmsk		: 1,
> -		__BITFIELD_FIELD(u32 frmovrunmsk		: 1,
> -		__BITFIELD_FIELD(u32 bblerrmsk			: 1,
> -		__BITFIELD_FIELD(u32 xacterrmsk			: 1,
> -		__BITFIELD_FIELD(u32 nyetmsk			: 1,
> -		__BITFIELD_FIELD(u32 ackmsk			: 1,
> -		__BITFIELD_FIELD(u32 nakmsk			: 1,
> -		__BITFIELD_FIELD(u32 stallmsk			: 1,
> -		__BITFIELD_FIELD(u32 ahberrmsk			: 1,
> -		__BITFIELD_FIELD(u32 chhltdmsk			: 1,
> -		__BITFIELD_FIELD(u32 xfercomplmsk		: 1,
> -		;))))))))))))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_hcsplt#
> - *
> - * Host Channel-n Split Control Register (HCSPLT)
> - *
> - */
> -union cvmx_usbcx_hcspltx {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_hcspltx_s
> -	 * @spltena: Split Enable (SpltEna)
> -	 *	The application sets this field to indicate that this channel is
> -	 *	enabled to perform split transactions.
> -	 * @compsplt: Do Complete Split (CompSplt)
> -	 *	The application sets this field to request the OTG host to
> -	 *	perform a complete split transaction.
> -	 * @xactpos: Transaction Position (XactPos)
> -	 *	This field is used to determine whether to send all, first,
> -	 *	middle, or last payloads with each OUT transaction.
> -	 *	* 2'b11: All. This is the entire data payload is of this
> -	 *	transaction (which is less than or equal to 188 bytes).
> -	 *	* 2'b10: Begin. This is the first data payload of this
> -	 *	transaction (which is larger than 188 bytes).
> -	 *	* 2'b00: Mid. This is the middle payload of this transaction
> -	 *	(which is larger than 188 bytes).
> -	 *	* 2'b01: End. This is the last payload of this transaction
> -	 *	(which is larger than 188 bytes).
> -	 * @hubaddr: Hub Address (HubAddr)
> -	 *	This field holds the device address of the transaction
> -	 *	translator's hub.
> -	 * @prtaddr: Port Address (PrtAddr)
> -	 *	This field is the port number of the recipient transaction
> -	 *	translator.
> -	 */
> -	struct cvmx_usbcx_hcspltx_s {
> -		__BITFIELD_FIELD(u32 spltena			: 1,
> -		__BITFIELD_FIELD(u32 reserved_17_30		: 14,
> -		__BITFIELD_FIELD(u32 compsplt			: 1,
> -		__BITFIELD_FIELD(u32 xactpos			: 2,
> -		__BITFIELD_FIELD(u32 hubaddr			: 7,
> -		__BITFIELD_FIELD(u32 prtaddr			: 7,
> -		;))))))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_hctsiz#
> - *
> - * Host Channel-n Transfer Size Register (HCTSIZ)
> - *
> - */
> -union cvmx_usbcx_hctsizx {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_hctsizx_s
> -	 * @dopng: Do Ping (DoPng)
> -	 *	Setting this field to 1 directs the host to do PING protocol.
> -	 * @pid: PID (Pid)
> -	 *	The application programs this field with the type of PID to use
> -	 *	for the initial transaction. The host will maintain this field
> -	 *	for the rest of the transfer.
> -	 *	* 2'b00: DATA0
> -	 *	* 2'b01: DATA2
> -	 *	* 2'b10: DATA1
> -	 *	* 2'b11: MDATA (non-control)/SETUP (control)
> -	 * @pktcnt: Packet Count (PktCnt)
> -	 *	This field is programmed by the application with the expected
> -	 *	number of packets to be transmitted (OUT) or received (IN).
> -	 *	The host decrements this count on every successful
> -	 *	transmission or reception of an OUT/IN packet. Once this count
> -	 *	reaches zero, the application is interrupted to indicate normal
> -	 *	completion.
> -	 * @xfersize: Transfer Size (XferSize)
> -	 *	For an OUT, this field is the number of data bytes the host will
> -	 *	send during the transfer.
> -	 *	For an IN, this field is the buffer size that the application
> -	 *	has reserved for the transfer. The application is expected to
> -	 *	program this field as an integer multiple of the maximum packet
> -	 *	size for IN transactions (periodic and non-periodic).
> -	 */
> -	struct cvmx_usbcx_hctsizx_s {
> -		__BITFIELD_FIELD(u32 dopng		: 1,
> -		__BITFIELD_FIELD(u32 pid		: 2,
> -		__BITFIELD_FIELD(u32 pktcnt		: 10,
> -		__BITFIELD_FIELD(u32 xfersize		: 19,
> -		;))))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_hfir
> - *
> - * Host Frame Interval Register (HFIR)
> - *
> - * This register stores the frame interval information for the current speed to
> - * which the O2P USB core has enumerated.
> - */
> -union cvmx_usbcx_hfir {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_hfir_s
> -	 * @frint: Frame Interval (FrInt)
> -	 *	The value that the application programs to this field specifies
> -	 *	the interval between two consecutive SOFs (FS) or micro-
> -	 *	SOFs (HS) or Keep-Alive tokens (HS). This field contains the
> -	 *	number of PHY clocks that constitute the required frame
> -	 *	interval. The default value set in this field for a FS operation
> -	 *	when the PHY clock frequency is 60 MHz. The application can
> -	 *	write a value to this register only after the Port Enable bit of
> -	 *	the Host Port Control and Status register (HPRT.PrtEnaPort)
> -	 *	has been set. If no value is programmed, the core calculates
> -	 *	the value based on the PHY clock specified in the FS/LS PHY
> -	 *	Clock Select field of the Host Configuration register
> -	 *	(HCFG.FSLSPclkSel). Do not change the value of this field
> -	 *	after the initial configuration.
> -	 *	* 125 us (PHY clock frequency for HS)
> -	 *	* 1 ms (PHY clock frequency for FS/LS)
> -	 */
> -	struct cvmx_usbcx_hfir_s {
> -		__BITFIELD_FIELD(u32 reserved_16_31		: 16,
> -		__BITFIELD_FIELD(u32 frint			: 16,
> -		;))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_hfnum
> - *
> - * Host Frame Number/Frame Time Remaining Register (HFNUM)
> - *
> - * This register indicates the current frame number.
> - * It also indicates the time remaining (in terms of the number of PHY clocks)
> - * in the current (micro)frame.
> - */
> -union cvmx_usbcx_hfnum {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_hfnum_s
> -	 * @frrem: Frame Time Remaining (FrRem)
> -	 *	Indicates the amount of time remaining in the current
> -	 *	microframe (HS) or frame (FS/LS), in terms of PHY clocks.
> -	 *	This field decrements on each PHY clock. When it reaches
> -	 *	zero, this field is reloaded with the value in the Frame
> -	 *	Interval register and a new SOF is transmitted on the USB.
> -	 * @frnum: Frame Number (FrNum)
> -	 *	This field increments when a new SOF is transmitted on the
> -	 *	USB, and is reset to 0 when it reaches 16'h3FFF.
> -	 */
> -	struct cvmx_usbcx_hfnum_s {
> -		__BITFIELD_FIELD(u32 frrem		: 16,
> -		__BITFIELD_FIELD(u32 frnum		: 16,
> -		;))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_hprt
> - *
> - * Host Port Control and Status Register (HPRT)
> - *
> - * This register is available in both Host and Device modes.
> - * Currently, the OTG Host supports only one port.
> - * A single register holds USB port-related information such as USB reset,
> - * enable, suspend, resume, connect status, and test mode for each port. The
> - * R_SS_WC bits in this register can trigger an interrupt to the application
> - * through the Host Port Interrupt bit of the Core Interrupt register
> - * (GINTSTS.PrtInt). On a Port Interrupt, the application must read this
> - * register and clear the bit that caused the interrupt. For the R_SS_WC bits,
> - * the application must write a 1 to the bit to clear the interrupt.
> - */
> -union cvmx_usbcx_hprt {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_hprt_s
> -	 * @prtspd: Port Speed (PrtSpd)
> -	 *	Indicates the speed of the device attached to this port.
> -	 *	* 2'b00: High speed
> -	 *	* 2'b01: Full speed
> -	 *	* 2'b10: Low speed
> -	 *	* 2'b11: Reserved
> -	 * @prttstctl: Port Test Control (PrtTstCtl)
> -	 *	The application writes a nonzero value to this field to put
> -	 *	the port into a Test mode, and the corresponding pattern is
> -	 *	signaled on the port.
> -	 *	* 4'b0000: Test mode disabled
> -	 *	* 4'b0001: Test_J mode
> -	 *	* 4'b0010: Test_K mode
> -	 *	* 4'b0011: Test_SE0_NAK mode
> -	 *	* 4'b0100: Test_Packet mode
> -	 *	* 4'b0101: Test_Force_Enable
> -	 *	* Others: Reserved
> -	 *	PrtSpd must be zero (i.e. the interface must be in high-speed
> -	 *	mode) to use the PrtTstCtl test modes.
> -	 * @prtpwr: Port Power (PrtPwr)
> -	 *	The application uses this field to control power to this port,
> -	 *	and the core clears this bit on an overcurrent condition.
> -	 *	* 1'b0: Power off
> -	 *	* 1'b1: Power on
> -	 * @prtlnsts: Port Line Status (PrtLnSts)
> -	 *	Indicates the current logic level USB data lines
> -	 *	* Bit [10]: Logic level of D-
> -	 *	* Bit [11]: Logic level of D+
> -	 * @prtrst: Port Reset (PrtRst)
> -	 *	When the application sets this bit, a reset sequence is
> -	 *	started on this port. The application must time the reset
> -	 *	period and clear this bit after the reset sequence is
> -	 *	complete.
> -	 *	* 1'b0: Port not in reset
> -	 *	* 1'b1: Port in reset
> -	 *	The application must leave this bit set for at least a
> -	 *	minimum duration mentioned below to start a reset on the
> -	 *	port. The application can leave it set for another 10 ms in
> -	 *	addition to the required minimum duration, before clearing
> -	 *	the bit, even though there is no maximum limit set by the
> -	 *	USB standard.
> -	 *	* High speed: 50 ms
> -	 *	* Full speed/Low speed: 10 ms
> -	 * @prtsusp: Port Suspend (PrtSusp)
> -	 *	The application sets this bit to put this port in Suspend
> -	 *	mode. The core only stops sending SOFs when this is set.
> -	 *	To stop the PHY clock, the application must set the Port
> -	 *	Clock Stop bit, which will assert the suspend input pin of
> -	 *	the PHY.
> -	 *	The read value of this bit reflects the current suspend
> -	 *	status of the port. This bit is cleared by the core after a
> -	 *	remote wakeup signal is detected or the application sets
> -	 *	the Port Reset bit or Port Resume bit in this register or the
> -	 *	Resume/Remote Wakeup Detected Interrupt bit or
> -	 *	Disconnect Detected Interrupt bit in the Core Interrupt
> -	 *	register (GINTSTS.WkUpInt or GINTSTS.DisconnInt,
> -	 *	respectively).
> -	 *	* 1'b0: Port not in Suspend mode
> -	 *	* 1'b1: Port in Suspend mode
> -	 * @prtres: Port Resume (PrtRes)
> -	 *	The application sets this bit to drive resume signaling on
> -	 *	the port. The core continues to drive the resume signal
> -	 *	until the application clears this bit.
> -	 *	If the core detects a USB remote wakeup sequence, as
> -	 *	indicated by the Port Resume/Remote Wakeup Detected
> -	 *	Interrupt bit of the Core Interrupt register
> -	 *	(GINTSTS.WkUpInt), the core starts driving resume
> -	 *	signaling without application intervention and clears this bit
> -	 *	when it detects a disconnect condition. The read value of
> -	 *	this bit indicates whether the core is currently driving
> -	 *	resume signaling.
> -	 *	* 1'b0: No resume driven
> -	 *	* 1'b1: Resume driven
> -	 * @prtovrcurrchng: Port Overcurrent Change (PrtOvrCurrChng)
> -	 *	The core sets this bit when the status of the Port
> -	 *	Overcurrent Active bit (bit 4) in this register changes.
> -	 * @prtovrcurract: Port Overcurrent Active (PrtOvrCurrAct)
> -	 *	Indicates the overcurrent condition of the port.
> -	 *	* 1'b0: No overcurrent condition
> -	 *	* 1'b1: Overcurrent condition
> -	 * @prtenchng: Port Enable/Disable Change (PrtEnChng)
> -	 *	The core sets this bit when the status of the Port Enable bit
> -	 *	[2] of this register changes.
> -	 * @prtena: Port Enable (PrtEna)
> -	 *	A port is enabled only by the core after a reset sequence,
> -	 *	and is disabled by an overcurrent condition, a disconnect
> -	 *	condition, or by the application clearing this bit. The
> -	 *	application cannot set this bit by a register write. It can only
> -	 *	clear it to disable the port. This bit does not trigger any
> -	 *	interrupt to the application.
> -	 *	* 1'b0: Port disabled
> -	 *	* 1'b1: Port enabled
> -	 * @prtconndet: Port Connect Detected (PrtConnDet)
> -	 *	The core sets this bit when a device connection is detected
> -	 *	to trigger an interrupt to the application using the Host Port
> -	 *	Interrupt bit of the Core Interrupt register (GINTSTS.PrtInt).
> -	 *	The application must write a 1 to this bit to clear the
> -	 *	interrupt.
> -	 * @prtconnsts: Port Connect Status (PrtConnSts)
> -	 *	* 0: No device is attached to the port.
> -	 *	* 1: A device is attached to the port.
> -	 */
> -	struct cvmx_usbcx_hprt_s {
> -		__BITFIELD_FIELD(u32 reserved_19_31	: 13,
> -		__BITFIELD_FIELD(u32 prtspd		: 2,
> -		__BITFIELD_FIELD(u32 prttstctl		: 4,
> -		__BITFIELD_FIELD(u32 prtpwr		: 1,
> -		__BITFIELD_FIELD(u32 prtlnsts		: 2,
> -		__BITFIELD_FIELD(u32 reserved_9_9	: 1,
> -		__BITFIELD_FIELD(u32 prtrst		: 1,
> -		__BITFIELD_FIELD(u32 prtsusp		: 1,
> -		__BITFIELD_FIELD(u32 prtres		: 1,
> -		__BITFIELD_FIELD(u32 prtovrcurrchng	: 1,
> -		__BITFIELD_FIELD(u32 prtovrcurract	: 1,
> -		__BITFIELD_FIELD(u32 prtenchng		: 1,
> -		__BITFIELD_FIELD(u32 prtena		: 1,
> -		__BITFIELD_FIELD(u32 prtconndet		: 1,
> -		__BITFIELD_FIELD(u32 prtconnsts		: 1,
> -		;)))))))))))))))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_hptxfsiz
> - *
> - * Host Periodic Transmit FIFO Size Register (HPTXFSIZ)
> - *
> - * This register holds the size and the memory start address of the Periodic
> - * TxFIFO, as shown in Figures 310 and 311.
> - */
> -union cvmx_usbcx_hptxfsiz {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_hptxfsiz_s
> -	 * @ptxfsize: Host Periodic TxFIFO Depth (PTxFSize)
> -	 *	This value is in terms of 32-bit words.
> -	 *	* Minimum value is 16
> -	 *	* Maximum value is 32768
> -	 * @ptxfstaddr: Host Periodic TxFIFO Start Address (PTxFStAddr)
> -	 */
> -	struct cvmx_usbcx_hptxfsiz_s {
> -		__BITFIELD_FIELD(u32 ptxfsize	: 16,
> -		__BITFIELD_FIELD(u32 ptxfstaddr	: 16,
> -		;))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbc#_hptxsts
> - *
> - * Host Periodic Transmit FIFO/Queue Status Register (HPTXSTS)
> - *
> - * This read-only register contains the free space information for the Periodic
> - * TxFIFO and the Periodic Transmit Request Queue
> - */
> -union cvmx_usbcx_hptxsts {
> -	u32 u32;
> -	/**
> -	 * struct cvmx_usbcx_hptxsts_s
> -	 * @ptxqtop: Top of the Periodic Transmit Request Queue (PTxQTop)
> -	 *	This indicates the entry in the Periodic Tx Request Queue that
> -	 *	is currently being processes by the MAC.
> -	 *	This register is used for debugging.
> -	 *	* Bit [31]: Odd/Even (micro)frame
> -	 *	- 1'b0: send in even (micro)frame
> -	 *	- 1'b1: send in odd (micro)frame
> -	 *	* Bits [30:27]: Channel/endpoint number
> -	 *	* Bits [26:25]: Type
> -	 *	- 2'b00: IN/OUT
> -	 *	- 2'b01: Zero-length packet
> -	 *	- 2'b10: CSPLIT
> -	 *	- 2'b11: Disable channel command
> -	 *	* Bit [24]: Terminate (last entry for the selected
> -	 *	channel/endpoint)
> -	 * @ptxqspcavail: Periodic Transmit Request Queue Space Available
> -	 *	(PTxQSpcAvail)
> -	 *	Indicates the number of free locations available to be written
> -	 *	in the Periodic Transmit Request Queue. This queue holds both
> -	 *	IN and OUT requests.
> -	 *	* 8'h0: Periodic Transmit Request Queue is full
> -	 *	* 8'h1: 1 location available
> -	 *	* 8'h2: 2 locations available
> -	 *	* n: n locations available (0..8)
> -	 *	* Others: Reserved
> -	 * @ptxfspcavail: Periodic Transmit Data FIFO Space Available
> -	 *		  (PTxFSpcAvail)
> -	 *	Indicates the number of free locations available to be written
> -	 *	to in the Periodic TxFIFO.
> -	 *	Values are in terms of 32-bit words
> -	 *	* 16'h0: Periodic TxFIFO is full
> -	 *	* 16'h1: 1 word available
> -	 *	* 16'h2: 2 words available
> -	 *	* 16'hn: n words available (where 0..32768)
> -	 *	* 16'h8000: 32768 words available
> -	 *	* Others: Reserved
> -	 */
> -	struct cvmx_usbcx_hptxsts_s {
> -		__BITFIELD_FIELD(u32 ptxqtop		: 8,
> -		__BITFIELD_FIELD(u32 ptxqspcavail	: 8,
> -		__BITFIELD_FIELD(u32 ptxfspcavail	: 16,
> -		;)))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbn#_clk_ctl
> - *
> - * USBN_CLK_CTL = USBN's Clock Control
> - *
> - * This register is used to control the frequency of the hclk and the
> - * hreset and phy_rst signals.
> - */
> -union cvmx_usbnx_clk_ctl {
> -	u64 u64;
> -	/**
> -	 * struct cvmx_usbnx_clk_ctl_s
> -	 * @divide2: The 'hclk' used by the USB subsystem is derived
> -	 *	from the eclk.
> -	 *	Also see the field DIVIDE. DIVIDE2<1> must currently
> -	 *	be zero because it is not implemented, so the maximum
> -	 *	ratio of eclk/hclk is currently 16.
> -	 *	The actual divide number for hclk is:
> -	 *	(DIVIDE2 + 1) * (DIVIDE + 1)
> -	 * @hclk_rst: When this field is '0' the HCLK-DIVIDER used to
> -	 *	generate the hclk in the USB Subsystem is held
> -	 *	in reset. This bit must be set to '0' before
> -	 *	changing the value os DIVIDE in this register.
> -	 *	The reset to the HCLK_DIVIDERis also asserted
> -	 *	when core reset is asserted.
> -	 * @p_x_on: Force USB-PHY on during suspend.
> -	 *	'1' USB-PHY XO block is powered-down during
> -	 *	suspend.
> -	 *	'0' USB-PHY XO block is powered-up during
> -	 *	suspend.
> -	 *	The value of this field must be set while POR is
> -	 *	active.
> -	 * @p_rtype: PHY reference clock type
> -	 *	On CN50XX/CN52XX/CN56XX the values are:
> -	 *		'0' The USB-PHY uses a 12MHz crystal as a clock source
> -	 *		    at the USB_XO and USB_XI pins.
> -	 *		'1' Reserved.
> -	 *		'2' The USB_PHY uses 12/24/48MHz 2.5V board clock at the
> -	 *		    USB_XO pin. USB_XI should be tied to ground in this
> -	 *		    case.
> -	 *		'3' Reserved.
> -	 *	On CN3xxx bits 14 and 15 are p_xenbn and p_rclk and values are:
> -	 *		'0' Reserved.
> -	 *		'1' Reserved.
> -	 *		'2' The PHY PLL uses the XO block output as a reference.
> -	 *		    The XO block uses an external clock supplied on the
> -	 *		    XO pin. USB_XI should be tied to ground for this
> -	 *		    usage.
> -	 *		'3' The XO block uses the clock from a crystal.
> -	 * @p_com_on: '0' Force USB-PHY XO Bias, Bandgap and PLL to
> -	 *	remain powered in Suspend Mode.
> -	 *	'1' The USB-PHY XO Bias, Bandgap and PLL are
> -	 *	powered down in suspend mode.
> -	 *	The value of this field must be set while POR is
> -	 *	active.
> -	 * @p_c_sel: Phy clock speed select.
> -	 *	Selects the reference clock / crystal frequency.
> -	 *	'11': Reserved
> -	 *	'10': 48 MHz (reserved when a crystal is used)
> -	 *	'01': 24 MHz (reserved when a crystal is used)
> -	 *	'00': 12 MHz
> -	 *	The value of this field must be set while POR is
> -	 *	active.
> -	 *	NOTE: if a crystal is used as a reference clock,
> -	 *	this field must be set to 12 MHz.
> -	 * @cdiv_byp: Used to enable the bypass input to the USB_CLK_DIV.
> -	 * @sd_mode: Scaledown mode for the USBC. Control timing events
> -	 *	in the USBC, for normal operation this must be '0'.
> -	 * @s_bist: Starts bist on the hclk memories, during the '0'
> -	 *	to '1' transition.
> -	 * @por: Power On Reset for the PHY.
> -	 *	Resets all the PHYS registers and state machines.
> -	 * @enable: When '1' allows the generation of the hclk. When
> -	 *	'0' the hclk will not be generated. SEE DIVIDE
> -	 *	field of this register.
> -	 * @prst: When this field is '0' the reset associated with
> -	 *	the phy_clk functionality in the USB Subsystem is
> -	 *	help in reset. This bit should not be set to '1'
> -	 *	until the time it takes 6 clocks (hclk or phy_clk,
> -	 *	whichever is slower) has passed. Under normal
> -	 *	operation once this bit is set to '1' it should not
> -	 *	be set to '0'.
> -	 * @hrst: When this field is '0' the reset associated with
> -	 *	the hclk functioanlity in the USB Subsystem is
> -	 *	held in reset.This bit should not be set to '1'
> -	 *	until 12ms after phy_clk is stable. Under normal
> -	 *	operation, once this bit is set to '1' it should
> -	 *	not be set to '0'.
> -	 * @divide: The frequency of 'hclk' used by the USB subsystem
> -	 *	is the eclk frequency divided by the value of
> -	 *	(DIVIDE2 + 1) * (DIVIDE + 1), also see the field
> -	 *	DIVIDE2 of this register.
> -	 *	The hclk frequency should be less than 125Mhz.
> -	 *	After writing a value to this field the SW should
> -	 *	read the field for the value written.
> -	 *	The ENABLE field of this register should not be set
> -	 *	until AFTER this field is set and then read.
> -	 */
> -	struct cvmx_usbnx_clk_ctl_s {
> -		__BITFIELD_FIELD(u64 reserved_20_63	: 44,
> -		__BITFIELD_FIELD(u64 divide2		: 2,
> -		__BITFIELD_FIELD(u64 hclk_rst		: 1,
> -		__BITFIELD_FIELD(u64 p_x_on		: 1,
> -		__BITFIELD_FIELD(u64 p_rtype		: 2,
> -		__BITFIELD_FIELD(u64 p_com_on		: 1,
> -		__BITFIELD_FIELD(u64 p_c_sel		: 2,
> -		__BITFIELD_FIELD(u64 cdiv_byp		: 1,
> -		__BITFIELD_FIELD(u64 sd_mode		: 2,
> -		__BITFIELD_FIELD(u64 s_bist		: 1,
> -		__BITFIELD_FIELD(u64 por		: 1,
> -		__BITFIELD_FIELD(u64 enable		: 1,
> -		__BITFIELD_FIELD(u64 prst		: 1,
> -		__BITFIELD_FIELD(u64 hrst		: 1,
> -		__BITFIELD_FIELD(u64 divide		: 3,
> -		;)))))))))))))))
> -	} s;
> -};
> -
> -/**
> - * cvmx_usbn#_usbp_ctl_status
> - *
> - * USBN_USBP_CTL_STATUS = USBP Control And Status Register
> - *
> - * Contains general control and status information for the USBN block.
> - */
> -union cvmx_usbnx_usbp_ctl_status {
> -	u64 u64;
> -	/**
> -	 * struct cvmx_usbnx_usbp_ctl_status_s
> -	 * @txrisetune: HS Transmitter Rise/Fall Time Adjustment
> -	 * @txvreftune: HS DC Voltage Level Adjustment
> -	 * @txfslstune: FS/LS Source Impedance Adjustment
> -	 * @txhsxvtune: Transmitter High-Speed Crossover Adjustment
> -	 * @sqrxtune: Squelch Threshold Adjustment
> -	 * @compdistune: Disconnect Threshold Adjustment
> -	 * @otgtune: VBUS Valid Threshold Adjustment
> -	 * @otgdisable: OTG Block Disable
> -	 * @portreset: Per_Port Reset
> -	 * @drvvbus: Drive VBUS
> -	 * @lsbist: Low-Speed BIST Enable.
> -	 * @fsbist: Full-Speed BIST Enable.
> -	 * @hsbist: High-Speed BIST Enable.
> -	 * @bist_done: PHY Bist Done.
> -	 *	Asserted at the end of the PHY BIST sequence.
> -	 * @bist_err: PHY Bist Error.
> -	 *	Indicates an internal error was detected during
> -	 *	the BIST sequence.
> -	 * @tdata_out: PHY Test Data Out.
> -	 *	Presents either internally generated signals or
> -	 *	test register contents, based upon the value of
> -	 *	test_data_out_sel.
> -	 * @siddq: Drives the USBP (USB-PHY) SIDDQ input.
> -	 *	Normally should be set to zero.
> -	 *	When customers have no intent to use USB PHY
> -	 *	interface, they should:
> -	 *	- still provide 3.3V to USB_VDD33, and
> -	 *	- tie USB_REXT to 3.3V supply, and
> -	 *	- set USBN*_USBP_CTL_STATUS[SIDDQ]=1
> -	 * @txpreemphasistune: HS Transmitter Pre-Emphasis Enable
> -	 * @dma_bmode: When set to 1 the L2C DMA address will be updated
> -	 *	with byte-counts between packets. When set to 0
> -	 *	the L2C DMA address is incremented to the next
> -	 *	4-byte aligned address after adding byte-count.
> -	 * @usbc_end: Bigendian input to the USB Core. This should be
> -	 *	set to '0' for operation.
> -	 * @usbp_bist: PHY, This is cleared '0' to run BIST on the USBP.
> -	 * @tclk: PHY Test Clock, used to load TDATA_IN to the USBP.
> -	 * @dp_pulld: PHY DP_PULLDOWN input to the USB-PHY.
> -	 *	This signal enables the pull-down resistance on
> -	 *	the D+ line. '1' pull down-resistance is connected
> -	 *	to D+/ '0' pull down resistance is not connected
> -	 *	to D+. When an A/B device is acting as a host
> -	 *	(downstream-facing port), dp_pulldown and
> -	 *	dm_pulldown are enabled. This must not toggle
> -	 *	during normal operation.
> -	 * @dm_pulld: PHY DM_PULLDOWN input to the USB-PHY.
> -	 *	This signal enables the pull-down resistance on
> -	 *	the D- line. '1' pull down-resistance is connected
> -	 *	to D-. '0' pull down resistance is not connected
> -	 *	to D-. When an A/B device is acting as a host
> -	 *	(downstream-facing port), dp_pulldown and
> -	 *	dm_pulldown are enabled. This must not toggle
> -	 *	during normal operation.
> -	 * @hst_mode: When '0' the USB is acting as HOST, when '1'
> -	 *	USB is acting as device. This field needs to be
> -	 *	set while the USB is in reset.
> -	 * @tuning: Transmitter Tuning for High-Speed Operation.
> -	 *	Tunes the current supply and rise/fall output
> -	 *	times for high-speed operation.
> -	 *	[20:19] == 11: Current supply increased
> -	 *	approximately 9%
> -	 *	[20:19] == 10: Current supply increased
> -	 *	approximately 4.5%
> -	 *	[20:19] == 01: Design default.
> -	 *	[20:19] == 00: Current supply decreased
> -	 *	approximately 4.5%
> -	 *	[22:21] == 11: Rise and fall times are increased.
> -	 *	[22:21] == 10: Design default.
> -	 *	[22:21] == 01: Rise and fall times are decreased.
> -	 *	[22:21] == 00: Rise and fall times are decreased
> -	 *	further as compared to the 01 setting.
> -	 * @tx_bs_enh: Transmit Bit Stuffing on [15:8].
> -	 *	Enables or disables bit stuffing on data[15:8]
> -	 *	when bit-stuffing is enabled.
> -	 * @tx_bs_en: Transmit Bit Stuffing on [7:0].
> -	 *	Enables or disables bit stuffing on data[7:0]
> -	 *	when bit-stuffing is enabled.
> -	 * @loop_enb: PHY Loopback Test Enable.
> -	 *	'1': During data transmission the receive is
> -	 *	enabled.
> -	 *	'0': During data transmission the receive is
> -	 *	disabled.
> -	 *	Must be '0' for normal operation.
> -	 * @vtest_enb: Analog Test Pin Enable.
> -	 *	'1' The PHY's analog_test pin is enabled for the
> -	 *	input and output of applicable analog test signals.
> -	 *	'0' THe analog_test pin is disabled.
> -	 * @bist_enb: Built-In Self Test Enable.
> -	 *	Used to activate BIST in the PHY.
> -	 * @tdata_sel: Test Data Out Select.
> -	 *	'1' test_data_out[3:0] (PHY) register contents
> -	 *	are output. '0' internally generated signals are
> -	 *	output.
> -	 * @taddr_in: Mode Address for Test Interface.
> -	 *	Specifies the register address for writing to or
> -	 *	reading from the PHY test interface register.
> -	 * @tdata_in: Internal Testing Register Input Data and Select
> -	 *	This is a test bus. Data is present on [3:0],
> -	 *	and its corresponding select (enable) is present
> -	 *	on bits [7:4].
> -	 * @ate_reset: Reset input from automatic test equipment.
> -	 *	This is a test signal. When the USB Core is
> -	 *	powered up (not in Susned Mode), an automatic
> -	 *	tester can use this to disable phy_clock and
> -	 *	free_clk, then re-enable them with an aligned
> -	 *	phase.
> -	 *	'1': The phy_clk and free_clk outputs are
> -	 *	disabled. "0": The phy_clock and free_clk outputs
> -	 *	are available within a specific period after the
> -	 *	de-assertion.
> -	 */
> -	struct cvmx_usbnx_usbp_ctl_status_s {
> -		__BITFIELD_FIELD(u64 txrisetune		: 1,
> -		__BITFIELD_FIELD(u64 txvreftune		: 4,
> -		__BITFIELD_FIELD(u64 txfslstune		: 4,
> -		__BITFIELD_FIELD(u64 txhsxvtune		: 2,
> -		__BITFIELD_FIELD(u64 sqrxtune		: 3,
> -		__BITFIELD_FIELD(u64 compdistune	: 3,
> -		__BITFIELD_FIELD(u64 otgtune		: 3,
> -		__BITFIELD_FIELD(u64 otgdisable		: 1,
> -		__BITFIELD_FIELD(u64 portreset		: 1,
> -		__BITFIELD_FIELD(u64 drvvbus		: 1,
> -		__BITFIELD_FIELD(u64 lsbist		: 1,
> -		__BITFIELD_FIELD(u64 fsbist		: 1,
> -		__BITFIELD_FIELD(u64 hsbist		: 1,
> -		__BITFIELD_FIELD(u64 bist_done		: 1,
> -		__BITFIELD_FIELD(u64 bist_err		: 1,
> -		__BITFIELD_FIELD(u64 tdata_out		: 4,
> -		__BITFIELD_FIELD(u64 siddq		: 1,
> -		__BITFIELD_FIELD(u64 txpreemphasistune	: 1,
> -		__BITFIELD_FIELD(u64 dma_bmode		: 1,
> -		__BITFIELD_FIELD(u64 usbc_end		: 1,
> -		__BITFIELD_FIELD(u64 usbp_bist		: 1,
> -		__BITFIELD_FIELD(u64 tclk		: 1,
> -		__BITFIELD_FIELD(u64 dp_pulld		: 1,
> -		__BITFIELD_FIELD(u64 dm_pulld		: 1,
> -		__BITFIELD_FIELD(u64 hst_mode		: 1,
> -		__BITFIELD_FIELD(u64 tuning		: 4,
> -		__BITFIELD_FIELD(u64 tx_bs_enh		: 1,
> -		__BITFIELD_FIELD(u64 tx_bs_en		: 1,
> -		__BITFIELD_FIELD(u64 loop_enb		: 1,
> -		__BITFIELD_FIELD(u64 vtest_enb		: 1,
> -		__BITFIELD_FIELD(u64 bist_enb		: 1,
> -		__BITFIELD_FIELD(u64 tdata_sel		: 1,
> -		__BITFIELD_FIELD(u64 taddr_in		: 4,
> -		__BITFIELD_FIELD(u64 tdata_in		: 8,
> -		__BITFIELD_FIELD(u64 ate_reset		: 1,
> -		;)))))))))))))))))))))))))))))))))))
> -	} s;
> -};
> -
> -#endif /* __OCTEON_HCD_H__ */
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 1/2] staging: octeon: delete driver
  2020-02-04  4:02     ` Chris Packham
@ 2020-02-04  7:09       ` gregkh
  -1 siblings, 0 replies; 59+ messages in thread
From: gregkh @ 2020-02-04  7:09 UTC (permalink / raw)
  To: Chris Packham
  Cc: linux, devel, brandonbonaby94, julia.lawall, paulburton,
	aaro.koskinen, yuehaibing, fw, linux-kernel, willy, ddaney,
	bobdc9664, sandro, geert, ivalery111, ynezz, davem,
	dan.carpenter, wambui.karugax

On Tue, Feb 04, 2020 at 04:02:15AM +0000, Chris Packham wrote:
> I'll pipe up on this thread too
> 
> On Tue, 2019-12-10 at 02:42 -0800, Guenter Roeck wrote:
> > On 12/10/19 1:15 AM, Greg Kroah-Hartman wrote:
> > > This driver has been in the tree since 2009 with no real movement to get
> > > it out.  Now it is starting to cause build issues and other problems for
> > > people who want to fix coding style problems, but can not actually build
> > > it.
> > > 
> > > As nothing is happening here, just delete the module entirely.
> > > 
> > > Reported-by: Guenter Roeck <linux@roeck-us.net>
> > > Cc: David Daney <ddaney@caviumnetworks.com>
> > > Cc: "David S. Miller" <davem@davemloft.net>
> > > Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
> > > Cc: Guenter Roeck <linux@roeck-us.net>
> > > Cc: YueHaibing <yuehaibing@huawei.com>
> > > Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
> > > Cc: Wambui Karuga <wambui.karugax@gmail.com>
> > > Cc: Julia Lawall <julia.lawall@lip6.fr>
> > > Cc: Florian Westphal <fw@strlen.de>
> > > Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> > > Cc: Branden Bonaby <brandonbonaby94@gmail.com>
> > > Cc: "Petr Štetiar" <ynezz@true.cz>
> > > Cc: Sandro Volery <sandro@volery.com>
> > > Cc: Paul Burton <paulburton@kernel.org>
> > > Cc: Dan Carpenter <dan.carpenter@oracle.com>
> > > Cc: Giovanni Gherdovich <bobdc9664@seznam.cz>
> > > Cc: Valery Ivanov <ivalery111@gmail.com>
> > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > 
> > Acked-by: Guenter Roeck <linux@roeck-us.net>
> 
> Please can we keep this driver. We do have platforms using it and we
> would like it to stay around.
> 
> Clearly we'll need to sort things out to a point where they build
> successfully. We've been hoping to see this move out of staging ever
> since we selected Cavium as a vendor.

Great, can you send me a patchset that reverts this and fixes the build
issues and accept maintainership of the code?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 1/2] staging: octeon: delete driver
@ 2020-02-04  7:09       ` gregkh
  0 siblings, 0 replies; 59+ messages in thread
From: gregkh @ 2020-02-04  7:09 UTC (permalink / raw)
  To: Chris Packham
  Cc: devel, brandonbonaby94, bobdc9664, paulburton, aaro.koskinen, fw,
	yuehaibing, linux-kernel, willy, ddaney, julia.lawall, sandro,
	geert, dan.carpenter, ivalery111, ynezz, davem, linux,
	wambui.karugax

On Tue, Feb 04, 2020 at 04:02:15AM +0000, Chris Packham wrote:
> I'll pipe up on this thread too
> 
> On Tue, 2019-12-10 at 02:42 -0800, Guenter Roeck wrote:
> > On 12/10/19 1:15 AM, Greg Kroah-Hartman wrote:
> > > This driver has been in the tree since 2009 with no real movement to get
> > > it out.  Now it is starting to cause build issues and other problems for
> > > people who want to fix coding style problems, but can not actually build
> > > it.
> > > 
> > > As nothing is happening here, just delete the module entirely.
> > > 
> > > Reported-by: Guenter Roeck <linux@roeck-us.net>
> > > Cc: David Daney <ddaney@caviumnetworks.com>
> > > Cc: "David S. Miller" <davem@davemloft.net>
> > > Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
> > > Cc: Guenter Roeck <linux@roeck-us.net>
> > > Cc: YueHaibing <yuehaibing@huawei.com>
> > > Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
> > > Cc: Wambui Karuga <wambui.karugax@gmail.com>
> > > Cc: Julia Lawall <julia.lawall@lip6.fr>
> > > Cc: Florian Westphal <fw@strlen.de>
> > > Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> > > Cc: Branden Bonaby <brandonbonaby94@gmail.com>
> > > Cc: "Petr Štetiar" <ynezz@true.cz>
> > > Cc: Sandro Volery <sandro@volery.com>
> > > Cc: Paul Burton <paulburton@kernel.org>
> > > Cc: Dan Carpenter <dan.carpenter@oracle.com>
> > > Cc: Giovanni Gherdovich <bobdc9664@seznam.cz>
> > > Cc: Valery Ivanov <ivalery111@gmail.com>
> > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > 
> > Acked-by: Guenter Roeck <linux@roeck-us.net>
> 
> Please can we keep this driver. We do have platforms using it and we
> would like it to stay around.
> 
> Clearly we'll need to sort things out to a point where they build
> successfully. We've been hoping to see this move out of staging ever
> since we selected Cavium as a vendor.

Great, can you send me a patchset that reverts this and fixes the build
issues and accept maintainership of the code?

thanks,

greg k-h
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 2/2] staging: octeon-usb: delete the octeon usb host controller driver
  2020-02-04  4:06     ` Chris Packham
@ 2020-02-04  7:15       ` gregkh
  -1 siblings, 0 replies; 59+ messages in thread
From: gregkh @ 2020-02-04  7:15 UTC (permalink / raw)
  To: Chris Packham
  Cc: devel, ddaney.cavm, pundirsumit11, aaro.koskinen, linux-kernel,
	nishkadg.linux, frank, laura.lazzati.15

On Tue, Feb 04, 2020 at 04:06:51AM +0000, Chris Packham wrote:
> On Tue, 2019-12-10 at 10:15 +0100, Greg Kroah-Hartman wrote:
> > This driver was merged back in 2013 and shows no progress toward every
> > being merged into the "correct" part of the kernel.  The code doesn't
> > even build for anyone unless you have the specific hardware platform
> > selected, so odds are it doesn't even work anymore.
> > 
> > Remove it for now and is someone comes along that has the hardware and
> > is willing to fix it up, it can be reverted.
> > 
> > Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
> > Cc: David Daney <ddaney.cavm@gmail.com>
> > Cc: Nishka Dasgupta <nishkadg.linux@gmail.com>
> > Cc: Himadri Pandya <himadri18.07@gmail.com>
> > Cc: "Frank A. Cancio Bello" <frank@generalsoftwareinc.com>
> > Cc: Sumit Pundir <pundirsumit11@gmail.com>
> > Cc: Laura Lazzati <laura.lazzati.15@gmail.com>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > ---
> 
> Similarly we'd really like to keep this too.

Great, same thing here!

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 2/2] staging: octeon-usb: delete the octeon usb host controller driver
@ 2020-02-04  7:15       ` gregkh
  0 siblings, 0 replies; 59+ messages in thread
From: gregkh @ 2020-02-04  7:15 UTC (permalink / raw)
  To: Chris Packham
  Cc: devel, ddaney.cavm, pundirsumit11, aaro.koskinen, linux-kernel,
	nishkadg.linux, frank, laura.lazzati.15

On Tue, Feb 04, 2020 at 04:06:51AM +0000, Chris Packham wrote:
> On Tue, 2019-12-10 at 10:15 +0100, Greg Kroah-Hartman wrote:
> > This driver was merged back in 2013 and shows no progress toward every
> > being merged into the "correct" part of the kernel.  The code doesn't
> > even build for anyone unless you have the specific hardware platform
> > selected, so odds are it doesn't even work anymore.
> > 
> > Remove it for now and is someone comes along that has the hardware and
> > is willing to fix it up, it can be reverted.
> > 
> > Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
> > Cc: David Daney <ddaney.cavm@gmail.com>
> > Cc: Nishka Dasgupta <nishkadg.linux@gmail.com>
> > Cc: Himadri Pandya <himadri18.07@gmail.com>
> > Cc: "Frank A. Cancio Bello" <frank@generalsoftwareinc.com>
> > Cc: Sumit Pundir <pundirsumit11@gmail.com>
> > Cc: Laura Lazzati <laura.lazzati.15@gmail.com>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > ---
> 
> Similarly we'd really like to keep this too.

Great, same thing here!

thanks,

greg k-h
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 2/2] staging: octeon-usb: delete the octeon usb host controller driver
  2020-02-04  7:15       ` gregkh
@ 2020-02-04  7:21         ` Dan Carpenter
  -1 siblings, 0 replies; 59+ messages in thread
From: Dan Carpenter @ 2020-02-04  7:21 UTC (permalink / raw)
  To: gregkh
  Cc: Chris Packham, devel, ddaney.cavm, pundirsumit11, aaro.koskinen,
	linux-kernel, nishkadg.linux, frank, laura.lazzati.15

My advice is to delete all the COMPILE_TEST code.  That stuff was a
constant source of confusion and headaches.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 2/2] staging: octeon-usb: delete the octeon usb host controller driver
@ 2020-02-04  7:21         ` Dan Carpenter
  0 siblings, 0 replies; 59+ messages in thread
From: Dan Carpenter @ 2020-02-04  7:21 UTC (permalink / raw)
  To: gregkh
  Cc: devel, ddaney.cavm, aaro.koskinen, linux-kernel, Chris Packham,
	pundirsumit11, nishkadg.linux, frank, laura.lazzati.15

My advice is to delete all the COMPILE_TEST code.  That stuff was a
constant source of confusion and headaches.

regards,
dan carpenter

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 1/2] staging: octeon: delete driver
  2020-02-04  7:09       ` gregkh
@ 2020-02-04 20:06         ` Chris Packham
  -1 siblings, 0 replies; 59+ messages in thread
From: Chris Packham @ 2020-02-04 20:06 UTC (permalink / raw)
  To: gregkh
  Cc: linux-kernel, wambui.karugax, dan.carpenter, fw, bobdc9664,
	aaro.koskinen, willy, yuehaibing, linux, devel, brandonbonaby94,
	sandro, paulburton, ddaney, ynezz, julia.lawall, ivalery111,
	davem, geert

On Tue, 2020-02-04 at 07:09 +0000, gregkh@linuxfoundation.org wrote:
> On Tue, Feb 04, 2020 at 04:02:15AM +0000, Chris Packham wrote:
> > I'll pipe up on this thread too
> > 
> > On Tue, 2019-12-10 at 02:42 -0800, Guenter Roeck wrote:
> > > On 12/10/19 1:15 AM, Greg Kroah-Hartman wrote:
> > > > This driver has been in the tree since 2009 with no real movement to get
> > > > it out.  Now it is starting to cause build issues and other problems for
> > > > people who want to fix coding style problems, but can not actually build
> > > > it.
> > > > 
> > > > As nothing is happening here, just delete the module entirely.
> > > > 
> > > > Reported-by: Guenter Roeck <linux@roeck-us.net>
> > > > Cc: David Daney <ddaney@caviumnetworks.com>
> > > > Cc: "David S. Miller" <davem@davemloft.net>
> > > > Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
> > > > Cc: Guenter Roeck <linux@roeck-us.net>
> > > > Cc: YueHaibing <yuehaibing@huawei.com>
> > > > Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
> > > > Cc: Wambui Karuga <wambui.karugax@gmail.com>
> > > > Cc: Julia Lawall <julia.lawall@lip6.fr>
> > > > Cc: Florian Westphal <fw@strlen.de>
> > > > Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> > > > Cc: Branden Bonaby <brandonbonaby94@gmail.com>
> > > > Cc: "Petr Štetiar" <ynezz@true.cz>
> > > > Cc: Sandro Volery <sandro@volery.com>
> > > > Cc: Paul Burton <paulburton@kernel.org>
> > > > Cc: Dan Carpenter <dan.carpenter@oracle.com>
> > > > Cc: Giovanni Gherdovich <bobdc9664@seznam.cz>
> > > > Cc: Valery Ivanov <ivalery111@gmail.com>
> > > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > 
> > > Acked-by: Guenter Roeck <linux@roeck-us.net>
> > 
> > Please can we keep this driver. We do have platforms using it and we
> > would like it to stay around.
> > 
> > Clearly we'll need to sort things out to a point where they build
> > successfully. We've been hoping to see this move out of staging ever
> > since we selected Cavium as a vendor.
> 
> Great, can you send me a patchset that reverts this and fixes the build
> issues and accept maintainership of the code?
> 

Yep will do.

On Tue, 2020-02-04 at 10:21 +0300, Dan Carpenter wrote:
> My advice is to delete all the COMPILE_TEST code.  That stuff was a
> constant source of confusion and headaches.

I was also going to suggest this. Since the COMPILE_TEST has been a
source of trouble I was going to propose dropping the || COMPILE_TEST
from the Kconfig for the octeon drivers.

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 1/2] staging: octeon: delete driver
@ 2020-02-04 20:06         ` Chris Packham
  0 siblings, 0 replies; 59+ messages in thread
From: Chris Packham @ 2020-02-04 20:06 UTC (permalink / raw)
  To: gregkh
  Cc: devel, brandonbonaby94, julia.lawall, paulburton, aaro.koskinen,
	yuehaibing, fw, linux-kernel, willy, ddaney, bobdc9664, sandro,
	geert, linux, ivalery111, ynezz, davem, dan.carpenter,
	wambui.karugax

On Tue, 2020-02-04 at 07:09 +0000, gregkh@linuxfoundation.org wrote:
> On Tue, Feb 04, 2020 at 04:02:15AM +0000, Chris Packham wrote:
> > I'll pipe up on this thread too
> > 
> > On Tue, 2019-12-10 at 02:42 -0800, Guenter Roeck wrote:
> > > On 12/10/19 1:15 AM, Greg Kroah-Hartman wrote:
> > > > This driver has been in the tree since 2009 with no real movement to get
> > > > it out.  Now it is starting to cause build issues and other problems for
> > > > people who want to fix coding style problems, but can not actually build
> > > > it.
> > > > 
> > > > As nothing is happening here, just delete the module entirely.
> > > > 
> > > > Reported-by: Guenter Roeck <linux@roeck-us.net>
> > > > Cc: David Daney <ddaney@caviumnetworks.com>
> > > > Cc: "David S. Miller" <davem@davemloft.net>
> > > > Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
> > > > Cc: Guenter Roeck <linux@roeck-us.net>
> > > > Cc: YueHaibing <yuehaibing@huawei.com>
> > > > Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
> > > > Cc: Wambui Karuga <wambui.karugax@gmail.com>
> > > > Cc: Julia Lawall <julia.lawall@lip6.fr>
> > > > Cc: Florian Westphal <fw@strlen.de>
> > > > Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> > > > Cc: Branden Bonaby <brandonbonaby94@gmail.com>
> > > > Cc: "Petr Štetiar" <ynezz@true.cz>
> > > > Cc: Sandro Volery <sandro@volery.com>
> > > > Cc: Paul Burton <paulburton@kernel.org>
> > > > Cc: Dan Carpenter <dan.carpenter@oracle.com>
> > > > Cc: Giovanni Gherdovich <bobdc9664@seznam.cz>
> > > > Cc: Valery Ivanov <ivalery111@gmail.com>
> > > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > 
> > > Acked-by: Guenter Roeck <linux@roeck-us.net>
> > 
> > Please can we keep this driver. We do have platforms using it and we
> > would like it to stay around.
> > 
> > Clearly we'll need to sort things out to a point where they build
> > successfully. We've been hoping to see this move out of staging ever
> > since we selected Cavium as a vendor.
> 
> Great, can you send me a patchset that reverts this and fixes the build
> issues and accept maintainership of the code?
> 

Yep will do.

On Tue, 2020-02-04 at 10:21 +0300, Dan Carpenter wrote:
> My advice is to delete all the COMPILE_TEST code.  That stuff was a
> constant source of confusion and headaches.

I was also going to suggest this. Since the COMPILE_TEST has been a
source of trouble I was going to propose dropping the || COMPILE_TEST
from the Kconfig for the octeon drivers.
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 1/2] staging: octeon: delete driver
  2020-02-04 20:06         ` Chris Packham
@ 2020-02-04 20:31           ` Matthew Wilcox
  -1 siblings, 0 replies; 59+ messages in thread
From: Matthew Wilcox @ 2020-02-04 20:31 UTC (permalink / raw)
  To: Chris Packham
  Cc: gregkh, linux-kernel, wambui.karugax, dan.carpenter, fw,
	bobdc9664, aaro.koskinen, yuehaibing, linux, devel,
	brandonbonaby94, sandro, paulburton, ddaney, ynezz, julia.lawall,
	ivalery111, davem, geert

On Tue, Feb 04, 2020 at 08:06:14PM +0000, Chris Packham wrote:
> On Tue, 2020-02-04 at 07:09 +0000, gregkh@linuxfoundation.org wrote:
> > On Tue, Feb 04, 2020 at 04:02:15AM +0000, Chris Packham wrote:
> > > I'll pipe up on this thread too
> > > 
> > > On Tue, 2019-12-10 at 02:42 -0800, Guenter Roeck wrote:
> > > > On 12/10/19 1:15 AM, Greg Kroah-Hartman wrote:
> > > > > This driver has been in the tree since 2009 with no real movement to get
> > > > > it out.  Now it is starting to cause build issues and other problems for
> > > > > people who want to fix coding style problems, but can not actually build
> > > > > it.
> > > > > 
> > > > > As nothing is happening here, just delete the module entirely.
> > > > > 
> > > > > Reported-by: Guenter Roeck <linux@roeck-us.net>
> > > > > Cc: David Daney <ddaney@caviumnetworks.com>
> > > > > Cc: "David S. Miller" <davem@davemloft.net>
> > > > > Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
> > > > > Cc: Guenter Roeck <linux@roeck-us.net>
> > > > > Cc: YueHaibing <yuehaibing@huawei.com>
> > > > > Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
> > > > > Cc: Wambui Karuga <wambui.karugax@gmail.com>
> > > > > Cc: Julia Lawall <julia.lawall@lip6.fr>
> > > > > Cc: Florian Westphal <fw@strlen.de>
> > > > > Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> > > > > Cc: Branden Bonaby <brandonbonaby94@gmail.com>
> > > > > Cc: "Petr Štetiar" <ynezz@true.cz>
> > > > > Cc: Sandro Volery <sandro@volery.com>
> > > > > Cc: Paul Burton <paulburton@kernel.org>
> > > > > Cc: Dan Carpenter <dan.carpenter@oracle.com>
> > > > > Cc: Giovanni Gherdovich <bobdc9664@seznam.cz>
> > > > > Cc: Valery Ivanov <ivalery111@gmail.com>
> > > > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > > 
> > > > Acked-by: Guenter Roeck <linux@roeck-us.net>
> > > 
> > > Please can we keep this driver. We do have platforms using it and we
> > > would like it to stay around.
> > > 
> > > Clearly we'll need to sort things out to a point where they build
> > > successfully. We've been hoping to see this move out of staging ever
> > > since we selected Cavium as a vendor.
> > 
> > Great, can you send me a patchset that reverts this and fixes the build
> > issues and accept maintainership of the code?
> > 
> 
> Yep will do.
> 
> On Tue, 2020-02-04 at 10:21 +0300, Dan Carpenter wrote:
> > My advice is to delete all the COMPILE_TEST code.  That stuff was a
> > constant source of confusion and headaches.
> 
> I was also going to suggest this. Since the COMPILE_TEST has been a
> source of trouble I was going to propose dropping the || COMPILE_TEST
> from the Kconfig for the octeon drivers.

Not having it also causes problems.  I didn't originally add it for
shits and giggles.


^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 1/2] staging: octeon: delete driver
@ 2020-02-04 20:31           ` Matthew Wilcox
  0 siblings, 0 replies; 59+ messages in thread
From: Matthew Wilcox @ 2020-02-04 20:31 UTC (permalink / raw)
  To: Chris Packham
  Cc: devel, brandonbonaby94, julia.lawall, yuehaibing, paulburton,
	aaro.koskinen, gregkh, fw, linux-kernel, ddaney, bobdc9664,
	sandro, geert, linux, ivalery111, ynezz, davem, dan.carpenter,
	wambui.karugax

On Tue, Feb 04, 2020 at 08:06:14PM +0000, Chris Packham wrote:
> On Tue, 2020-02-04 at 07:09 +0000, gregkh@linuxfoundation.org wrote:
> > On Tue, Feb 04, 2020 at 04:02:15AM +0000, Chris Packham wrote:
> > > I'll pipe up on this thread too
> > > 
> > > On Tue, 2019-12-10 at 02:42 -0800, Guenter Roeck wrote:
> > > > On 12/10/19 1:15 AM, Greg Kroah-Hartman wrote:
> > > > > This driver has been in the tree since 2009 with no real movement to get
> > > > > it out.  Now it is starting to cause build issues and other problems for
> > > > > people who want to fix coding style problems, but can not actually build
> > > > > it.
> > > > > 
> > > > > As nothing is happening here, just delete the module entirely.
> > > > > 
> > > > > Reported-by: Guenter Roeck <linux@roeck-us.net>
> > > > > Cc: David Daney <ddaney@caviumnetworks.com>
> > > > > Cc: "David S. Miller" <davem@davemloft.net>
> > > > > Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
> > > > > Cc: Guenter Roeck <linux@roeck-us.net>
> > > > > Cc: YueHaibing <yuehaibing@huawei.com>
> > > > > Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
> > > > > Cc: Wambui Karuga <wambui.karugax@gmail.com>
> > > > > Cc: Julia Lawall <julia.lawall@lip6.fr>
> > > > > Cc: Florian Westphal <fw@strlen.de>
> > > > > Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> > > > > Cc: Branden Bonaby <brandonbonaby94@gmail.com>
> > > > > Cc: "Petr Štetiar" <ynezz@true.cz>
> > > > > Cc: Sandro Volery <sandro@volery.com>
> > > > > Cc: Paul Burton <paulburton@kernel.org>
> > > > > Cc: Dan Carpenter <dan.carpenter@oracle.com>
> > > > > Cc: Giovanni Gherdovich <bobdc9664@seznam.cz>
> > > > > Cc: Valery Ivanov <ivalery111@gmail.com>
> > > > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > > 
> > > > Acked-by: Guenter Roeck <linux@roeck-us.net>
> > > 
> > > Please can we keep this driver. We do have platforms using it and we
> > > would like it to stay around.
> > > 
> > > Clearly we'll need to sort things out to a point where they build
> > > successfully. We've been hoping to see this move out of staging ever
> > > since we selected Cavium as a vendor.
> > 
> > Great, can you send me a patchset that reverts this and fixes the build
> > issues and accept maintainership of the code?
> > 
> 
> Yep will do.
> 
> On Tue, 2020-02-04 at 10:21 +0300, Dan Carpenter wrote:
> > My advice is to delete all the COMPILE_TEST code.  That stuff was a
> > constant source of confusion and headaches.
> 
> I was also going to suggest this. Since the COMPILE_TEST has been a
> source of trouble I was going to propose dropping the || COMPILE_TEST
> from the Kconfig for the octeon drivers.

Not having it also causes problems.  I didn't originally add it for
shits and giggles.

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [SPAM] Re: [PATCH 1/2] staging: octeon: delete driver
  2020-02-04 20:06         ` Chris Packham
  (?)
  (?)
@ 2020-02-04 20:57         ` Guenter Roeck
  -1 siblings, 0 replies; 59+ messages in thread
From: Guenter Roeck @ 2020-02-04 20:57 UTC (permalink / raw)
  To: Chris Packham
  Cc: devel, brandonbonaby94, julia.lawall, yuehaibing, paulburton,
	aaro.koskinen, gregkh, fw, linux-kernel, willy, ddaney,
	bobdc9664, sandro, geert, ivalery111, ynezz, davem,
	dan.carpenter, wambui.karugax

On Tue, Feb 04, 2020 at 08:06:14PM +0000, Chris Packham wrote:
> On Tue, 2020-02-04 at 07:09 +0000, gregkh@linuxfoundation.org wrote:
> > On Tue, Feb 04, 2020 at 04:02:15AM +0000, Chris Packham wrote:
> > > I'll pipe up on this thread too
> > > 
> > > On Tue, 2019-12-10 at 02:42 -0800, Guenter Roeck wrote:
> > > > On 12/10/19 1:15 AM, Greg Kroah-Hartman wrote:
> > > > > This driver has been in the tree since 2009 with no real movement to get
> > > > > it out.  Now it is starting to cause build issues and other problems for
> > > > > people who want to fix coding style problems, but can not actually build
> > > > > it.
> > > > > 
> > > > > As nothing is happening here, just delete the module entirely.
> > > > > 
> > > > > Reported-by: Guenter Roeck <linux@roeck-us.net>
> > > > > Cc: David Daney <ddaney@caviumnetworks.com>
> > > > > Cc: "David S. Miller" <davem@davemloft.net>
> > > > > Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
> > > > > Cc: Guenter Roeck <linux@roeck-us.net>
> > > > > Cc: YueHaibing <yuehaibing@huawei.com>
> > > > > Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
> > > > > Cc: Wambui Karuga <wambui.karugax@gmail.com>
> > > > > Cc: Julia Lawall <julia.lawall@lip6.fr>
> > > > > Cc: Florian Westphal <fw@strlen.de>
> > > > > Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> > > > > Cc: Branden Bonaby <brandonbonaby94@gmail.com>
> > > > > Cc: "Petr Štetiar" <ynezz@true.cz>
> > > > > Cc: Sandro Volery <sandro@volery.com>
> > > > > Cc: Paul Burton <paulburton@kernel.org>
> > > > > Cc: Dan Carpenter <dan.carpenter@oracle.com>
> > > > > Cc: Giovanni Gherdovich <bobdc9664@seznam.cz>
> > > > > Cc: Valery Ivanov <ivalery111@gmail.com>
> > > > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > > 
> > > > Acked-by: Guenter Roeck <linux@roeck-us.net>
> > > 
> > > Please can we keep this driver. We do have platforms using it and we
> > > would like it to stay around.
> > > 
> > > Clearly we'll need to sort things out to a point where they build
> > > successfully. We've been hoping to see this move out of staging ever
> > > since we selected Cavium as a vendor.
> > 
> > Great, can you send me a patchset that reverts this and fixes the build
> > issues and accept maintainership of the code?
> > 
> 
> Yep will do.
> 
> On Tue, 2020-02-04 at 10:21 +0300, Dan Carpenter wrote:
> > My advice is to delete all the COMPILE_TEST code.  That stuff was a
> > constant source of confusion and headaches.
> 
> I was also going to suggest this. Since the COMPILE_TEST has been a
> source of trouble I was going to propose dropping the || COMPILE_TEST
> from the Kconfig for the octeon drivers.

It isn't just the Kconfig file, there is also a lot of actual _code_
that depends on COMPILE_TEST.

Guenter
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 1/2] staging: octeon: delete driver
  2020-02-04 20:31           ` Matthew Wilcox
@ 2020-02-04 22:53             ` gregkh
  -1 siblings, 0 replies; 59+ messages in thread
From: gregkh @ 2020-02-04 22:53 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: Chris Packham, devel, brandonbonaby94, julia.lawall, yuehaibing,
	paulburton, aaro.koskinen, fw, linux-kernel, ddaney, bobdc9664,
	sandro, geert, linux, ivalery111, ynezz, davem, dan.carpenter,
	wambui.karugax

On Tue, Feb 04, 2020 at 12:31:16PM -0800, Matthew Wilcox wrote:
> On Tue, Feb 04, 2020 at 08:06:14PM +0000, Chris Packham wrote:
> > On Tue, 2020-02-04 at 07:09 +0000, gregkh@linuxfoundation.org wrote:
> > > On Tue, Feb 04, 2020 at 04:02:15AM +0000, Chris Packham wrote:
> > > > I'll pipe up on this thread too
> > > > 
> > > > On Tue, 2019-12-10 at 02:42 -0800, Guenter Roeck wrote:
> > > > > On 12/10/19 1:15 AM, Greg Kroah-Hartman wrote:
> > > > > > This driver has been in the tree since 2009 with no real movement to get
> > > > > > it out.  Now it is starting to cause build issues and other problems for
> > > > > > people who want to fix coding style problems, but can not actually build
> > > > > > it.
> > > > > > 
> > > > > > As nothing is happening here, just delete the module entirely.
> > > > > > 
> > > > > > Reported-by: Guenter Roeck <linux@roeck-us.net>
> > > > > > Cc: David Daney <ddaney@caviumnetworks.com>
> > > > > > Cc: "David S. Miller" <davem@davemloft.net>
> > > > > > Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
> > > > > > Cc: Guenter Roeck <linux@roeck-us.net>
> > > > > > Cc: YueHaibing <yuehaibing@huawei.com>
> > > > > > Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
> > > > > > Cc: Wambui Karuga <wambui.karugax@gmail.com>
> > > > > > Cc: Julia Lawall <julia.lawall@lip6.fr>
> > > > > > Cc: Florian Westphal <fw@strlen.de>
> > > > > > Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> > > > > > Cc: Branden Bonaby <brandonbonaby94@gmail.com>
> > > > > > Cc: "Petr Štetiar" <ynezz@true.cz>
> > > > > > Cc: Sandro Volery <sandro@volery.com>
> > > > > > Cc: Paul Burton <paulburton@kernel.org>
> > > > > > Cc: Dan Carpenter <dan.carpenter@oracle.com>
> > > > > > Cc: Giovanni Gherdovich <bobdc9664@seznam.cz>
> > > > > > Cc: Valery Ivanov <ivalery111@gmail.com>
> > > > > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > > > 
> > > > > Acked-by: Guenter Roeck <linux@roeck-us.net>
> > > > 
> > > > Please can we keep this driver. We do have platforms using it and we
> > > > would like it to stay around.
> > > > 
> > > > Clearly we'll need to sort things out to a point where they build
> > > > successfully. We've been hoping to see this move out of staging ever
> > > > since we selected Cavium as a vendor.
> > > 
> > > Great, can you send me a patchset that reverts this and fixes the build
> > > issues and accept maintainership of the code?
> > > 
> > 
> > Yep will do.
> > 
> > On Tue, 2020-02-04 at 10:21 +0300, Dan Carpenter wrote:
> > > My advice is to delete all the COMPILE_TEST code.  That stuff was a
> > > constant source of confusion and headaches.
> > 
> > I was also going to suggest this. Since the COMPILE_TEST has been a
> > source of trouble I was going to propose dropping the || COMPILE_TEST
> > from the Kconfig for the octeon drivers.
> 
> Not having it also causes problems.  I didn't originally add it for
> shits and giggles.

Yes, without this option, the code bit-rotted horribly.  It needs to be
able to be built otherwise people will change the code and it will break
and no one will notice except Guenter's build bots and then no one will
fix it :(

i.e. exactly what was happening before...

So this needs to all be fixed up properly, and really, should be merged
to the "real" part of the kernel...

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 1/2] staging: octeon: delete driver
@ 2020-02-04 22:53             ` gregkh
  0 siblings, 0 replies; 59+ messages in thread
From: gregkh @ 2020-02-04 22:53 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: devel, brandonbonaby94, bobdc9664, paulburton, aaro.koskinen, fw,
	yuehaibing, linux-kernel, ddaney, julia.lawall, sandro,
	Chris Packham, geert, dan.carpenter, ivalery111, ynezz, davem,
	linux, wambui.karugax

On Tue, Feb 04, 2020 at 12:31:16PM -0800, Matthew Wilcox wrote:
> On Tue, Feb 04, 2020 at 08:06:14PM +0000, Chris Packham wrote:
> > On Tue, 2020-02-04 at 07:09 +0000, gregkh@linuxfoundation.org wrote:
> > > On Tue, Feb 04, 2020 at 04:02:15AM +0000, Chris Packham wrote:
> > > > I'll pipe up on this thread too
> > > > 
> > > > On Tue, 2019-12-10 at 02:42 -0800, Guenter Roeck wrote:
> > > > > On 12/10/19 1:15 AM, Greg Kroah-Hartman wrote:
> > > > > > This driver has been in the tree since 2009 with no real movement to get
> > > > > > it out.  Now it is starting to cause build issues and other problems for
> > > > > > people who want to fix coding style problems, but can not actually build
> > > > > > it.
> > > > > > 
> > > > > > As nothing is happening here, just delete the module entirely.
> > > > > > 
> > > > > > Reported-by: Guenter Roeck <linux@roeck-us.net>
> > > > > > Cc: David Daney <ddaney@caviumnetworks.com>
> > > > > > Cc: "David S. Miller" <davem@davemloft.net>
> > > > > > Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
> > > > > > Cc: Guenter Roeck <linux@roeck-us.net>
> > > > > > Cc: YueHaibing <yuehaibing@huawei.com>
> > > > > > Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
> > > > > > Cc: Wambui Karuga <wambui.karugax@gmail.com>
> > > > > > Cc: Julia Lawall <julia.lawall@lip6.fr>
> > > > > > Cc: Florian Westphal <fw@strlen.de>
> > > > > > Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> > > > > > Cc: Branden Bonaby <brandonbonaby94@gmail.com>
> > > > > > Cc: "Petr Štetiar" <ynezz@true.cz>
> > > > > > Cc: Sandro Volery <sandro@volery.com>
> > > > > > Cc: Paul Burton <paulburton@kernel.org>
> > > > > > Cc: Dan Carpenter <dan.carpenter@oracle.com>
> > > > > > Cc: Giovanni Gherdovich <bobdc9664@seznam.cz>
> > > > > > Cc: Valery Ivanov <ivalery111@gmail.com>
> > > > > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > > > 
> > > > > Acked-by: Guenter Roeck <linux@roeck-us.net>
> > > > 
> > > > Please can we keep this driver. We do have platforms using it and we
> > > > would like it to stay around.
> > > > 
> > > > Clearly we'll need to sort things out to a point where they build
> > > > successfully. We've been hoping to see this move out of staging ever
> > > > since we selected Cavium as a vendor.
> > > 
> > > Great, can you send me a patchset that reverts this and fixes the build
> > > issues and accept maintainership of the code?
> > > 
> > 
> > Yep will do.
> > 
> > On Tue, 2020-02-04 at 10:21 +0300, Dan Carpenter wrote:
> > > My advice is to delete all the COMPILE_TEST code.  That stuff was a
> > > constant source of confusion and headaches.
> > 
> > I was also going to suggest this. Since the COMPILE_TEST has been a
> > source of trouble I was going to propose dropping the || COMPILE_TEST
> > from the Kconfig for the octeon drivers.
> 
> Not having it also causes problems.  I didn't originally add it for
> shits and giggles.

Yes, without this option, the code bit-rotted horribly.  It needs to be
able to be built otherwise people will change the code and it will break
and no one will notice except Guenter's build bots and then no one will
fix it :(

i.e. exactly what was happening before...

So this needs to all be fixed up properly, and really, should be merged
to the "real" part of the kernel...

thanks,

greg k-h
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 1/2] staging: octeon: delete driver
  2020-02-04 20:31           ` Matthew Wilcox
@ 2020-02-05  3:34             ` Dan Carpenter
  -1 siblings, 0 replies; 59+ messages in thread
From: Dan Carpenter @ 2020-02-05  3:34 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: Chris Packham, devel, brandonbonaby94, julia.lawall, yuehaibing,
	paulburton, aaro.koskinen, gregkh, fw, linux-kernel, ddaney,
	bobdc9664, sandro, geert, linux, ivalery111, ynezz, davem,
	wambui.karugax

On Tue, Feb 04, 2020 at 12:31:16PM -0800, Matthew Wilcox wrote:
> On Tue, Feb 04, 2020 at 08:06:14PM +0000, Chris Packham wrote:
> > On Tue, 2020-02-04 at 07:09 +0000, gregkh@linuxfoundation.org wrote:
> > > On Tue, Feb 04, 2020 at 04:02:15AM +0000, Chris Packham wrote:
> > On Tue, 2020-02-04 at 10:21 +0300, Dan Carpenter wrote:
> > > My advice is to delete all the COMPILE_TEST code.  That stuff was a
> > > constant source of confusion and headaches.
> > 
> > I was also going to suggest this. Since the COMPILE_TEST has been a
> > source of trouble I was going to propose dropping the || COMPILE_TEST
> > from the Kconfig for the octeon drivers.
> 
> Not having it also causes problems.  I didn't originally add it for
> shits and giggles.

I wonder if the kbuild bot does enough cross compile build testing these
days to detect compile problems.  It might have improved to the point
where COMPILE_TEST isn't required.

One of the things about having a bunch of dummy functions for
COMPILE_TEST is that they introduce a lot of static checker warnings.
The real function is supposed to initialize stuff but the dummy function
just returns so now we get uninitialized variable warnings etc.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 1/2] staging: octeon: delete driver
@ 2020-02-05  3:34             ` Dan Carpenter
  0 siblings, 0 replies; 59+ messages in thread
From: Dan Carpenter @ 2020-02-05  3:34 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: devel, brandonbonaby94, bobdc9664, fw, paulburton, aaro.koskinen,
	gregkh, yuehaibing, linux-kernel, ddaney, julia.lawall, sandro,
	Chris Packham, geert, ivalery111, ynezz, davem, linux,
	wambui.karugax

On Tue, Feb 04, 2020 at 12:31:16PM -0800, Matthew Wilcox wrote:
> On Tue, Feb 04, 2020 at 08:06:14PM +0000, Chris Packham wrote:
> > On Tue, 2020-02-04 at 07:09 +0000, gregkh@linuxfoundation.org wrote:
> > > On Tue, Feb 04, 2020 at 04:02:15AM +0000, Chris Packham wrote:
> > On Tue, 2020-02-04 at 10:21 +0300, Dan Carpenter wrote:
> > > My advice is to delete all the COMPILE_TEST code.  That stuff was a
> > > constant source of confusion and headaches.
> > 
> > I was also going to suggest this. Since the COMPILE_TEST has been a
> > source of trouble I was going to propose dropping the || COMPILE_TEST
> > from the Kconfig for the octeon drivers.
> 
> Not having it also causes problems.  I didn't originally add it for
> shits and giggles.

I wonder if the kbuild bot does enough cross compile build testing these
days to detect compile problems.  It might have improved to the point
where COMPILE_TEST isn't required.

One of the things about having a bunch of dummy functions for
COMPILE_TEST is that they introduce a lot of static checker warnings.
The real function is supposed to initialize stuff but the dummy function
just returns so now we get uninitialized variable warnings etc.

regards,
dan carpenter
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 1/2] staging: octeon: delete driver
  2020-02-05  3:34             ` Dan Carpenter
@ 2020-02-05  3:44               ` Matthew Wilcox
  -1 siblings, 0 replies; 59+ messages in thread
From: Matthew Wilcox @ 2020-02-05  3:44 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Chris Packham, devel, brandonbonaby94, julia.lawall, yuehaibing,
	paulburton, aaro.koskinen, gregkh, fw, linux-kernel, ddaney,
	bobdc9664, sandro, geert, linux, ivalery111, ynezz, davem,
	wambui.karugax

On Wed, Feb 05, 2020 at 06:34:16AM +0300, Dan Carpenter wrote:
> On Tue, Feb 04, 2020 at 12:31:16PM -0800, Matthew Wilcox wrote:
> > On Tue, Feb 04, 2020 at 08:06:14PM +0000, Chris Packham wrote:
> > > On Tue, 2020-02-04 at 07:09 +0000, gregkh@linuxfoundation.org wrote:
> > > > On Tue, Feb 04, 2020 at 04:02:15AM +0000, Chris Packham wrote:
> > > On Tue, 2020-02-04 at 10:21 +0300, Dan Carpenter wrote:
> > > > My advice is to delete all the COMPILE_TEST code.  That stuff was a
> > > > constant source of confusion and headaches.
> > > 
> > > I was also going to suggest this. Since the COMPILE_TEST has been a
> > > source of trouble I was going to propose dropping the || COMPILE_TEST
> > > from the Kconfig for the octeon drivers.
> > 
> > Not having it also causes problems.  I didn't originally add it for
> > shits and giggles.
> 
> I wonder if the kbuild bot does enough cross compile build testing these
> days to detect compile problems.  It might have improved to the point
> where COMPILE_TEST isn't required.

Well, that was the problem.  I posted the patch and Dave Miller merged it
before the build bot had the chance to point out that I'd missed it.
So relying on the build bot is not sufficient.

> One of the things about having a bunch of dummy functions for
> COMPILE_TEST is that they introduce a lot of static checker warnings.
> The real function is supposed to initialize stuff but the dummy function
> just returns so now we get uninitialized variable warnings etc.

Perhaps we need a better solution for the dummy functions than just
returning.  We can initialise the variables / structs to 0, for example.
I fully accept that I did a poor job of writing the dummy functions.

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 1/2] staging: octeon: delete driver
@ 2020-02-05  3:44               ` Matthew Wilcox
  0 siblings, 0 replies; 59+ messages in thread
From: Matthew Wilcox @ 2020-02-05  3:44 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: devel, brandonbonaby94, bobdc9664, fw, paulburton, aaro.koskinen,
	gregkh, yuehaibing, linux-kernel, ddaney, julia.lawall, sandro,
	Chris Packham, geert, ivalery111, ynezz, davem, linux,
	wambui.karugax

On Wed, Feb 05, 2020 at 06:34:16AM +0300, Dan Carpenter wrote:
> On Tue, Feb 04, 2020 at 12:31:16PM -0800, Matthew Wilcox wrote:
> > On Tue, Feb 04, 2020 at 08:06:14PM +0000, Chris Packham wrote:
> > > On Tue, 2020-02-04 at 07:09 +0000, gregkh@linuxfoundation.org wrote:
> > > > On Tue, Feb 04, 2020 at 04:02:15AM +0000, Chris Packham wrote:
> > > On Tue, 2020-02-04 at 10:21 +0300, Dan Carpenter wrote:
> > > > My advice is to delete all the COMPILE_TEST code.  That stuff was a
> > > > constant source of confusion and headaches.
> > > 
> > > I was also going to suggest this. Since the COMPILE_TEST has been a
> > > source of trouble I was going to propose dropping the || COMPILE_TEST
> > > from the Kconfig for the octeon drivers.
> > 
> > Not having it also causes problems.  I didn't originally add it for
> > shits and giggles.
> 
> I wonder if the kbuild bot does enough cross compile build testing these
> days to detect compile problems.  It might have improved to the point
> where COMPILE_TEST isn't required.

Well, that was the problem.  I posted the patch and Dave Miller merged it
before the build bot had the chance to point out that I'd missed it.
So relying on the build bot is not sufficient.

> One of the things about having a bunch of dummy functions for
> COMPILE_TEST is that they introduce a lot of static checker warnings.
> The real function is supposed to initialize stuff but the dummy function
> just returns so now we get uninitialized variable warnings etc.

Perhaps we need a better solution for the dummy functions than just
returning.  We can initialise the variables / structs to 0, for example.
I fully accept that I did a poor job of writing the dummy functions.
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 1/2] staging: octeon: delete driver
  2020-02-05  3:34             ` Dan Carpenter
@ 2020-02-05  3:56               ` Guenter Roeck
  -1 siblings, 0 replies; 59+ messages in thread
From: Guenter Roeck @ 2020-02-05  3:56 UTC (permalink / raw)
  To: Dan Carpenter, Matthew Wilcox
  Cc: Chris Packham, devel, brandonbonaby94, julia.lawall, yuehaibing,
	paulburton, aaro.koskinen, gregkh, fw, linux-kernel, ddaney,
	bobdc9664, sandro, geert, ivalery111, ynezz, davem,
	wambui.karugax

On 2/4/20 7:34 PM, Dan Carpenter wrote:
> On Tue, Feb 04, 2020 at 12:31:16PM -0800, Matthew Wilcox wrote:
>> On Tue, Feb 04, 2020 at 08:06:14PM +0000, Chris Packham wrote:
>>> On Tue, 2020-02-04 at 07:09 +0000, gregkh@linuxfoundation.org wrote:
>>>> On Tue, Feb 04, 2020 at 04:02:15AM +0000, Chris Packham wrote:
>>> On Tue, 2020-02-04 at 10:21 +0300, Dan Carpenter wrote:
>>>> My advice is to delete all the COMPILE_TEST code.  That stuff was a
>>>> constant source of confusion and headaches.
>>>
>>> I was also going to suggest this. Since the COMPILE_TEST has been a
>>> source of trouble I was going to propose dropping the || COMPILE_TEST
>>> from the Kconfig for the octeon drivers.
>>
>> Not having it also causes problems.  I didn't originally add it for
>> shits and giggles.
> 
> I wonder if the kbuild bot does enough cross compile build testing these
> days to detect compile problems.  It might have improved to the point
> where COMPILE_TEST isn't required.
> 

Not really. Looking at the build failures in the mainline kernel right now:

Failed builds:
	alpha:allmodconfig
	arm:allmodconfig
	i386:allyesconfig
	i386:allmodconfig
	m68k:allmodconfig
	microblaze:mmu_defconfig
	mips:allmodconfig
	parisc:allmodconfig
	powerpc:allmodconfig
	s390:allmodconfig
	sparc64:allmodconfig

Many of those don't even _have_ specific configurations causing the build failures.

Guenter

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 1/2] staging: octeon: delete driver
@ 2020-02-05  3:56               ` Guenter Roeck
  0 siblings, 0 replies; 59+ messages in thread
From: Guenter Roeck @ 2020-02-05  3:56 UTC (permalink / raw)
  To: Dan Carpenter, Matthew Wilcox
  Cc: devel, brandonbonaby94, bobdc9664, fw, paulburton, aaro.koskinen,
	gregkh, yuehaibing, linux-kernel, ddaney, julia.lawall, sandro,
	Chris Packham, geert, ivalery111, ynezz, davem, wambui.karugax

On 2/4/20 7:34 PM, Dan Carpenter wrote:
> On Tue, Feb 04, 2020 at 12:31:16PM -0800, Matthew Wilcox wrote:
>> On Tue, Feb 04, 2020 at 08:06:14PM +0000, Chris Packham wrote:
>>> On Tue, 2020-02-04 at 07:09 +0000, gregkh@linuxfoundation.org wrote:
>>>> On Tue, Feb 04, 2020 at 04:02:15AM +0000, Chris Packham wrote:
>>> On Tue, 2020-02-04 at 10:21 +0300, Dan Carpenter wrote:
>>>> My advice is to delete all the COMPILE_TEST code.  That stuff was a
>>>> constant source of confusion and headaches.
>>>
>>> I was also going to suggest this. Since the COMPILE_TEST has been a
>>> source of trouble I was going to propose dropping the || COMPILE_TEST
>>> from the Kconfig for the octeon drivers.
>>
>> Not having it also causes problems.  I didn't originally add it for
>> shits and giggles.
> 
> I wonder if the kbuild bot does enough cross compile build testing these
> days to detect compile problems.  It might have improved to the point
> where COMPILE_TEST isn't required.
> 

Not really. Looking at the build failures in the mainline kernel right now:

Failed builds:
	alpha:allmodconfig
	arm:allmodconfig
	i386:allyesconfig
	i386:allmodconfig
	m68k:allmodconfig
	microblaze:mmu_defconfig
	mips:allmodconfig
	parisc:allmodconfig
	powerpc:allmodconfig
	s390:allmodconfig
	sparc64:allmodconfig

Many of those don't even _have_ specific configurations causing the build failures.

Guenter
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 1/2] staging: octeon: delete driver
  2020-02-05  3:56               ` Guenter Roeck
@ 2020-02-05  9:03                 ` Geert Uytterhoeven
  -1 siblings, 0 replies; 59+ messages in thread
From: Geert Uytterhoeven @ 2020-02-05  9:03 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Dan Carpenter, Matthew Wilcox, Chris Packham, devel,
	brandonbonaby94, julia.lawall, yuehaibing, paulburton,
	aaro.koskinen, gregkh, fw, linux-kernel, ddaney, bobdc9664,
	sandro, ivalery111, ynezz, davem, wambui.karugax

On Wed, Feb 5, 2020 at 4:57 AM Guenter Roeck <linux@roeck-us.net> wrote:
> On 2/4/20 7:34 PM, Dan Carpenter wrote:
> > On Tue, Feb 04, 2020 at 12:31:16PM -0800, Matthew Wilcox wrote:
> >> On Tue, Feb 04, 2020 at 08:06:14PM +0000, Chris Packham wrote:
> >>> On Tue, 2020-02-04 at 07:09 +0000, gregkh@linuxfoundation.org wrote:
> >>>> On Tue, Feb 04, 2020 at 04:02:15AM +0000, Chris Packham wrote:
> >>> On Tue, 2020-02-04 at 10:21 +0300, Dan Carpenter wrote:
> >>>> My advice is to delete all the COMPILE_TEST code.  That stuff was a
> >>>> constant source of confusion and headaches.
> >>>
> >>> I was also going to suggest this. Since the COMPILE_TEST has been a
> >>> source of trouble I was going to propose dropping the || COMPILE_TEST
> >>> from the Kconfig for the octeon drivers.
> >>
> >> Not having it also causes problems.  I didn't originally add it for
> >> shits and giggles.
> >
> > I wonder if the kbuild bot does enough cross compile build testing these
> > days to detect compile problems.  It might have improved to the point
> > where COMPILE_TEST isn't required.

It depends...

> Not really. Looking at the build failures in the mainline kernel right now:
>
> Failed builds:
>         alpha:allmodconfig
>         arm:allmodconfig
>         i386:allyesconfig
>         i386:allmodconfig
>         m68k:allmodconfig
>         microblaze:mmu_defconfig
>         mips:allmodconfig
>         parisc:allmodconfig
>         powerpc:allmodconfig
>         s390:allmodconfig
>         sparc64:allmodconfig

I did receive a report from noreply@ellerman.id.au for the m68k build
failure. But that was sent to me only, not to the offender, and I do my
own builds anyway.

More interesting, that report happened after the offending commit landed
upstream, while it had been in next for 4 weeks.

> Many of those don't even _have_ specific configurations causing the build failures.

Exactly. These are the "easy" ones, as the all*config builds enable as
much infrastructure as possible.  It's much harder if some common
dependency is not fulfilled in some specific config.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 1/2] staging: octeon: delete driver
@ 2020-02-05  9:03                 ` Geert Uytterhoeven
  0 siblings, 0 replies; 59+ messages in thread
From: Geert Uytterhoeven @ 2020-02-05  9:03 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: devel, brandonbonaby94, bobdc9664, fw, paulburton, aaro.koskinen,
	gregkh, yuehaibing, linux-kernel, Matthew Wilcox, ddaney,
	julia.lawall, sandro, Chris Packham, ivalery111, ynezz, davem,
	Dan Carpenter, wambui.karugax

On Wed, Feb 5, 2020 at 4:57 AM Guenter Roeck <linux@roeck-us.net> wrote:
> On 2/4/20 7:34 PM, Dan Carpenter wrote:
> > On Tue, Feb 04, 2020 at 12:31:16PM -0800, Matthew Wilcox wrote:
> >> On Tue, Feb 04, 2020 at 08:06:14PM +0000, Chris Packham wrote:
> >>> On Tue, 2020-02-04 at 07:09 +0000, gregkh@linuxfoundation.org wrote:
> >>>> On Tue, Feb 04, 2020 at 04:02:15AM +0000, Chris Packham wrote:
> >>> On Tue, 2020-02-04 at 10:21 +0300, Dan Carpenter wrote:
> >>>> My advice is to delete all the COMPILE_TEST code.  That stuff was a
> >>>> constant source of confusion and headaches.
> >>>
> >>> I was also going to suggest this. Since the COMPILE_TEST has been a
> >>> source of trouble I was going to propose dropping the || COMPILE_TEST
> >>> from the Kconfig for the octeon drivers.
> >>
> >> Not having it also causes problems.  I didn't originally add it for
> >> shits and giggles.
> >
> > I wonder if the kbuild bot does enough cross compile build testing these
> > days to detect compile problems.  It might have improved to the point
> > where COMPILE_TEST isn't required.

It depends...

> Not really. Looking at the build failures in the mainline kernel right now:
>
> Failed builds:
>         alpha:allmodconfig
>         arm:allmodconfig
>         i386:allyesconfig
>         i386:allmodconfig
>         m68k:allmodconfig
>         microblaze:mmu_defconfig
>         mips:allmodconfig
>         parisc:allmodconfig
>         powerpc:allmodconfig
>         s390:allmodconfig
>         sparc64:allmodconfig

I did receive a report from noreply@ellerman.id.au for the m68k build
failure. But that was sent to me only, not to the offender, and I do my
own builds anyway.

More interesting, that report happened after the offending commit landed
upstream, while it had been in next for 4 weeks.

> Many of those don't even _have_ specific configurations causing the build failures.

Exactly. These are the "easy" ones, as the all*config builds enable as
much infrastructure as possible.  It's much harder if some common
dependency is not fulfilled in some specific config.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 1/2] staging: octeon: delete driver
  2020-02-05  9:03                 ` Geert Uytterhoeven
@ 2020-02-05 13:52                   ` Guenter Roeck
  -1 siblings, 0 replies; 59+ messages in thread
From: Guenter Roeck @ 2020-02-05 13:52 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Dan Carpenter, Matthew Wilcox, Chris Packham, devel,
	brandonbonaby94, julia.lawall, yuehaibing, paulburton,
	aaro.koskinen, gregkh, fw, linux-kernel, ddaney, bobdc9664,
	sandro, ivalery111, ynezz, davem, wambui.karugax

On 2/5/20 1:03 AM, Geert Uytterhoeven wrote:
> On Wed, Feb 5, 2020 at 4:57 AM Guenter Roeck <linux@roeck-us.net> wrote:
>> On 2/4/20 7:34 PM, Dan Carpenter wrote:
>>> On Tue, Feb 04, 2020 at 12:31:16PM -0800, Matthew Wilcox wrote:
>>>> On Tue, Feb 04, 2020 at 08:06:14PM +0000, Chris Packham wrote:
>>>>> On Tue, 2020-02-04 at 07:09 +0000, gregkh@linuxfoundation.org wrote:
>>>>>> On Tue, Feb 04, 2020 at 04:02:15AM +0000, Chris Packham wrote:
>>>>> On Tue, 2020-02-04 at 10:21 +0300, Dan Carpenter wrote:
>>>>>> My advice is to delete all the COMPILE_TEST code.  That stuff was a
>>>>>> constant source of confusion and headaches.
>>>>>
>>>>> I was also going to suggest this. Since the COMPILE_TEST has been a
>>>>> source of trouble I was going to propose dropping the || COMPILE_TEST
>>>>> from the Kconfig for the octeon drivers.
>>>>
>>>> Not having it also causes problems.  I didn't originally add it for
>>>> shits and giggles.
>>>
>>> I wonder if the kbuild bot does enough cross compile build testing these
>>> days to detect compile problems.  It might have improved to the point
>>> where COMPILE_TEST isn't required.
> 
> It depends...
> 
>> Not really. Looking at the build failures in the mainline kernel right now:
>>
>> Failed builds:
>>          alpha:allmodconfig
>>          arm:allmodconfig
>>          i386:allyesconfig
>>          i386:allmodconfig
>>          m68k:allmodconfig
>>          microblaze:mmu_defconfig
>>          mips:allmodconfig
>>          parisc:allmodconfig
>>          powerpc:allmodconfig
>>          s390:allmodconfig
>>          sparc64:allmodconfig
> 
> I did receive a report from noreply@ellerman.id.au for the m68k build
> failure. But that was sent to me only, not to the offender, and I do my
> own builds anyway.
> 
> More interesting, that report happened after the offending commit landed
> upstream, while it had been in next for 4 weeks.
> 

m68k in -next builds fine for me, and did for a while. I have not seen a build
failure there. There must be a context commit causing this failure, or what
is (or was) in -next differs from what is in mainline.

>> Many of those don't even _have_ specific configurations causing the build failures.
> 
> Exactly. These are the "easy" ones, as the all*config builds enable as
> much infrastructure as possible.  It's much harder if some common
> dependency is not fulfilled in some specific config.
> 

Yes, that is correct. But that doesn't mean that it would be a good idea
to retire COMPILE_TEST.

Guenter

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 1/2] staging: octeon: delete driver
@ 2020-02-05 13:52                   ` Guenter Roeck
  0 siblings, 0 replies; 59+ messages in thread
From: Guenter Roeck @ 2020-02-05 13:52 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: devel, brandonbonaby94, bobdc9664, fw, paulburton, aaro.koskinen,
	gregkh, yuehaibing, linux-kernel, Matthew Wilcox, ddaney,
	julia.lawall, sandro, Chris Packham, ivalery111, ynezz, davem,
	Dan Carpenter, wambui.karugax

On 2/5/20 1:03 AM, Geert Uytterhoeven wrote:
> On Wed, Feb 5, 2020 at 4:57 AM Guenter Roeck <linux@roeck-us.net> wrote:
>> On 2/4/20 7:34 PM, Dan Carpenter wrote:
>>> On Tue, Feb 04, 2020 at 12:31:16PM -0800, Matthew Wilcox wrote:
>>>> On Tue, Feb 04, 2020 at 08:06:14PM +0000, Chris Packham wrote:
>>>>> On Tue, 2020-02-04 at 07:09 +0000, gregkh@linuxfoundation.org wrote:
>>>>>> On Tue, Feb 04, 2020 at 04:02:15AM +0000, Chris Packham wrote:
>>>>> On Tue, 2020-02-04 at 10:21 +0300, Dan Carpenter wrote:
>>>>>> My advice is to delete all the COMPILE_TEST code.  That stuff was a
>>>>>> constant source of confusion and headaches.
>>>>>
>>>>> I was also going to suggest this. Since the COMPILE_TEST has been a
>>>>> source of trouble I was going to propose dropping the || COMPILE_TEST
>>>>> from the Kconfig for the octeon drivers.
>>>>
>>>> Not having it also causes problems.  I didn't originally add it for
>>>> shits and giggles.
>>>
>>> I wonder if the kbuild bot does enough cross compile build testing these
>>> days to detect compile problems.  It might have improved to the point
>>> where COMPILE_TEST isn't required.
> 
> It depends...
> 
>> Not really. Looking at the build failures in the mainline kernel right now:
>>
>> Failed builds:
>>          alpha:allmodconfig
>>          arm:allmodconfig
>>          i386:allyesconfig
>>          i386:allmodconfig
>>          m68k:allmodconfig
>>          microblaze:mmu_defconfig
>>          mips:allmodconfig
>>          parisc:allmodconfig
>>          powerpc:allmodconfig
>>          s390:allmodconfig
>>          sparc64:allmodconfig
> 
> I did receive a report from noreply@ellerman.id.au for the m68k build
> failure. But that was sent to me only, not to the offender, and I do my
> own builds anyway.
> 
> More interesting, that report happened after the offending commit landed
> upstream, while it had been in next for 4 weeks.
> 

m68k in -next builds fine for me, and did for a while. I have not seen a build
failure there. There must be a context commit causing this failure, or what
is (or was) in -next differs from what is in mainline.

>> Many of those don't even _have_ specific configurations causing the build failures.
> 
> Exactly. These are the "easy" ones, as the all*config builds enable as
> much infrastructure as possible.  It's much harder if some common
> dependency is not fulfilled in some specific config.
> 

Yes, that is correct. But that doesn't mean that it would be a good idea
to retire COMPILE_TEST.

Guenter
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 1/2] staging: octeon: delete driver
  2020-02-05 13:52                   ` Guenter Roeck
@ 2020-02-06  8:18                     ` Geert Uytterhoeven
  -1 siblings, 0 replies; 59+ messages in thread
From: Geert Uytterhoeven @ 2020-02-06  8:18 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Dan Carpenter, Matthew Wilcox, Chris Packham, devel,
	brandonbonaby94, julia.lawall, yuehaibing, paulburton,
	aaro.koskinen, gregkh, fw, linux-kernel, ddaney, bobdc9664,
	sandro, ivalery111, ynezz, davem, wambui.karugax

Hi Günter,

On Wed, Feb 5, 2020 at 2:52 PM Guenter Roeck <linux@roeck-us.net> wrote:
> On 2/5/20 1:03 AM, Geert Uytterhoeven wrote:
> > On Wed, Feb 5, 2020 at 4:57 AM Guenter Roeck <linux@roeck-us.net> wrote:
> >> On 2/4/20 7:34 PM, Dan Carpenter wrote:
> >>> On Tue, Feb 04, 2020 at 12:31:16PM -0800, Matthew Wilcox wrote:
> >>>> On Tue, Feb 04, 2020 at 08:06:14PM +0000, Chris Packham wrote:
> >>>>> On Tue, 2020-02-04 at 07:09 +0000, gregkh@linuxfoundation.org wrote:
> >>>>>> On Tue, Feb 04, 2020 at 04:02:15AM +0000, Chris Packham wrote:
> >>>>> On Tue, 2020-02-04 at 10:21 +0300, Dan Carpenter wrote:
> >>>>>> My advice is to delete all the COMPILE_TEST code.  That stuff was a
> >>>>>> constant source of confusion and headaches.
> >>>>>
> >>>>> I was also going to suggest this. Since the COMPILE_TEST has been a
> >>>>> source of trouble I was going to propose dropping the || COMPILE_TEST
> >>>>> from the Kconfig for the octeon drivers.
> >>>>
> >>>> Not having it also causes problems.  I didn't originally add it for
> >>>> shits and giggles.
> >>>
> >>> I wonder if the kbuild bot does enough cross compile build testing these
> >>> days to detect compile problems.  It might have improved to the point
> >>> where COMPILE_TEST isn't required.
> >
> > It depends...
> >
> >> Not really. Looking at the build failures in the mainline kernel right now:
> >>
> >> Failed builds:
> >>          alpha:allmodconfig
> >>          arm:allmodconfig
> >>          i386:allyesconfig
> >>          i386:allmodconfig
> >>          m68k:allmodconfig
> >>          microblaze:mmu_defconfig
> >>          mips:allmodconfig
> >>          parisc:allmodconfig
> >>          powerpc:allmodconfig
> >>          s390:allmodconfig
> >>          sparc64:allmodconfig
> >
> > I did receive a report from noreply@ellerman.id.au for the m68k build
> > failure. But that was sent to me only, not to the offender, and I do my
> > own builds anyway.
> >
> > More interesting, that report happened after the offending commit landed
> > upstream, while it had been in next for 4 weeks.
>
> m68k in -next builds fine for me, and did for a while. I have not seen a build
> failure there. There must be a context commit causing this failure, or what
> is (or was) in -next differs from what is in mainline.

Indeed. The offending symbol depended on another symbol, which never
made it to next before it hit mainline, thus hiding the issue.

> >> Many of those don't even _have_ specific configurations causing the build failures.
> >
> > Exactly. These are the "easy" ones, as the all*config builds enable as
> > much infrastructure as possible.  It's much harder if some common
> > dependency is not fulfilled in some specific config.
>
> Yes, that is correct. But that doesn't mean that it would be a good idea
> to retire COMPILE_TEST.

I agree.

Retiring COMPILE_TEST could have a positive side-effect, though: it
would reduce the compile time for all*config, which might give the
overloaded build bots spare cycles to cover other configs.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 59+ messages in thread

* Re: [PATCH 1/2] staging: octeon: delete driver
@ 2020-02-06  8:18                     ` Geert Uytterhoeven
  0 siblings, 0 replies; 59+ messages in thread
From: Geert Uytterhoeven @ 2020-02-06  8:18 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: devel, brandonbonaby94, bobdc9664, fw, paulburton, aaro.koskinen,
	gregkh, yuehaibing, linux-kernel, Matthew Wilcox, ddaney,
	julia.lawall, sandro, Chris Packham, ivalery111, ynezz, davem,
	Dan Carpenter, wambui.karugax

Hi Günter,

On Wed, Feb 5, 2020 at 2:52 PM Guenter Roeck <linux@roeck-us.net> wrote:
> On 2/5/20 1:03 AM, Geert Uytterhoeven wrote:
> > On Wed, Feb 5, 2020 at 4:57 AM Guenter Roeck <linux@roeck-us.net> wrote:
> >> On 2/4/20 7:34 PM, Dan Carpenter wrote:
> >>> On Tue, Feb 04, 2020 at 12:31:16PM -0800, Matthew Wilcox wrote:
> >>>> On Tue, Feb 04, 2020 at 08:06:14PM +0000, Chris Packham wrote:
> >>>>> On Tue, 2020-02-04 at 07:09 +0000, gregkh@linuxfoundation.org wrote:
> >>>>>> On Tue, Feb 04, 2020 at 04:02:15AM +0000, Chris Packham wrote:
> >>>>> On Tue, 2020-02-04 at 10:21 +0300, Dan Carpenter wrote:
> >>>>>> My advice is to delete all the COMPILE_TEST code.  That stuff was a
> >>>>>> constant source of confusion and headaches.
> >>>>>
> >>>>> I was also going to suggest this. Since the COMPILE_TEST has been a
> >>>>> source of trouble I was going to propose dropping the || COMPILE_TEST
> >>>>> from the Kconfig for the octeon drivers.
> >>>>
> >>>> Not having it also causes problems.  I didn't originally add it for
> >>>> shits and giggles.
> >>>
> >>> I wonder if the kbuild bot does enough cross compile build testing these
> >>> days to detect compile problems.  It might have improved to the point
> >>> where COMPILE_TEST isn't required.
> >
> > It depends...
> >
> >> Not really. Looking at the build failures in the mainline kernel right now:
> >>
> >> Failed builds:
> >>          alpha:allmodconfig
> >>          arm:allmodconfig
> >>          i386:allyesconfig
> >>          i386:allmodconfig
> >>          m68k:allmodconfig
> >>          microblaze:mmu_defconfig
> >>          mips:allmodconfig
> >>          parisc:allmodconfig
> >>          powerpc:allmodconfig
> >>          s390:allmodconfig
> >>          sparc64:allmodconfig
> >
> > I did receive a report from noreply@ellerman.id.au for the m68k build
> > failure. But that was sent to me only, not to the offender, and I do my
> > own builds anyway.
> >
> > More interesting, that report happened after the offending commit landed
> > upstream, while it had been in next for 4 weeks.
>
> m68k in -next builds fine for me, and did for a while. I have not seen a build
> failure there. There must be a context commit causing this failure, or what
> is (or was) in -next differs from what is in mainline.

Indeed. The offending symbol depended on another symbol, which never
made it to next before it hit mainline, thus hiding the issue.

> >> Many of those don't even _have_ specific configurations causing the build failures.
> >
> > Exactly. These are the "easy" ones, as the all*config builds enable as
> > much infrastructure as possible.  It's much harder if some common
> > dependency is not fulfilled in some specific config.
>
> Yes, that is correct. But that doesn't mean that it would be a good idea
> to retire COMPILE_TEST.

I agree.

Retiring COMPILE_TEST could have a positive side-effect, though: it
would reduce the compile time for all*config, which might give the
overloaded build bots spare cycles to cover other configs.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 59+ messages in thread

end of thread, other threads:[~2020-02-06  8:19 UTC | newest]

Thread overview: 59+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-10  9:15 [PATCH 1/2] staging: octeon: delete driver Greg Kroah-Hartman
2019-12-10  9:15 ` Greg Kroah-Hartman
2019-12-10  9:15 ` [PATCH 2/2] staging: octeon-usb: delete the octeon usb host controller driver Greg Kroah-Hartman
2019-12-10  9:15   ` Greg Kroah-Hartman
2019-12-10 19:31   ` Aaro Koskinen
2019-12-10 19:31     ` Aaro Koskinen
2019-12-10 20:19     ` Greg Kroah-Hartman
2019-12-10 20:19       ` Greg Kroah-Hartman
2019-12-10 21:27       ` Aaro Koskinen
2019-12-10 21:27         ` Aaro Koskinen
2019-12-11  7:42         ` Greg Kroah-Hartman
2019-12-11  7:42           ` Greg Kroah-Hartman
2020-02-04  4:06   ` Chris Packham
2020-02-04  4:06     ` Chris Packham
2020-02-04  7:15     ` gregkh
2020-02-04  7:15       ` gregkh
2020-02-04  7:21       ` Dan Carpenter
2020-02-04  7:21         ` Dan Carpenter
2019-12-10 10:42 ` [PATCH 1/2] staging: octeon: delete driver Guenter Roeck
2019-12-10 10:42   ` Guenter Roeck
2020-02-04  4:02   ` Chris Packham
2020-02-04  4:02     ` Chris Packham
2020-02-04  7:09     ` gregkh
2020-02-04  7:09       ` gregkh
2020-02-04 20:06       ` Chris Packham
2020-02-04 20:06         ` Chris Packham
2020-02-04 20:31         ` Matthew Wilcox
2020-02-04 20:31           ` Matthew Wilcox
2020-02-04 22:53           ` gregkh
2020-02-04 22:53             ` gregkh
2020-02-05  3:34           ` Dan Carpenter
2020-02-05  3:34             ` Dan Carpenter
2020-02-05  3:44             ` Matthew Wilcox
2020-02-05  3:44               ` Matthew Wilcox
2020-02-05  3:56             ` Guenter Roeck
2020-02-05  3:56               ` Guenter Roeck
2020-02-05  9:03               ` Geert Uytterhoeven
2020-02-05  9:03                 ` Geert Uytterhoeven
2020-02-05 13:52                 ` Guenter Roeck
2020-02-05 13:52                   ` Guenter Roeck
2020-02-06  8:18                   ` Geert Uytterhoeven
2020-02-06  8:18                     ` Geert Uytterhoeven
2020-02-04 20:57         ` [SPAM] " Guenter Roeck
2019-12-10 11:40 ` Sandro Volery
2019-12-10 11:40   ` Sandro Volery
2019-12-10 12:01   ` Greg Kroah-Hartman
2019-12-10 12:01     ` Greg Kroah-Hartman
2019-12-10 12:54     ` Sandro Volery
2019-12-10 12:54       ` Sandro Volery
2019-12-10 19:46     ` Aaro Koskinen
2019-12-10 19:46       ` Aaro Koskinen
2019-12-10 20:15       ` Guenter Roeck
2019-12-10 20:15         ` Guenter Roeck
2019-12-10 21:48         ` Aaro Koskinen
2019-12-10 21:48           ` Aaro Koskinen
2019-12-10 22:48           ` Guenter Roeck
2019-12-10 22:48             ` Guenter Roeck
2019-12-11  7:22           ` Dan Carpenter
2019-12-11  7:22             ` Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.