#include <linux/bitfield.h>
#include <linux/bits.h>
#include <linux/device.h>
#include <linux/delay.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#define USBDRD_UCTL_CTL …
#define USBDRD_UCTL_CTL_CLEAR_BIST …
#define USBDRD_UCTL_CTL_START_BIST …
#define USBDRD_UCTL_CTL_REF_CLK_SEL …
#define USBDRD_UCTL_CTL_SSC_EN …
#define USBDRD_UCTL_CTL_SSC_RANGE …
#define USBDRD_UCTL_CTL_SSC_REF_CLK_SEL …
#define USBDRD_UCTL_CTL_MPLL_MULTIPLIER …
#define USBDRD_UCTL_CTL_REF_SSP_EN …
#define USBDRD_UCTL_CTL_REF_CLK_DIV2 …
#define USBDRD_UCTL_CTL_REF_CLK_FSEL …
#define USBDRD_UCTL_CTL_H_CLK_EN …
#define USBDRD_UCTL_CTL_H_CLK_BYP_SEL …
#define USBDRD_UCTL_CTL_H_CLKDIV_RST …
#define USBDRD_UCTL_CTL_H_CLKDIV_SEL …
#define USBDRD_UCTL_CTL_USB3_PORT_PERM_ATTACH …
#define USBDRD_UCTL_CTL_USB2_PORT_PERM_ATTACH …
#define USBDRD_UCTL_CTL_USB3_PORT_DISABLE …
#define USBDRD_UCTL_CTL_USB2_PORT_DISABLE …
#define USBDRD_UCTL_CTL_SS_POWER_EN …
#define USBDRD_UCTL_CTL_HS_POWER_EN …
#define USBDRD_UCTL_CTL_CSCLK_EN …
#define USBDRD_UCTL_CTL_DRD_MODE …
#define USBDRD_UCTL_CTL_UPHY_RST …
#define USBDRD_UCTL_CTL_UAHC_RST …
#define USBDRD_UCTL_CTL_UCTL_RST …
#define USBDRD_UCTL_BIST_STATUS …
#define USBDRD_UCTL_SPARE0 …
#define USBDRD_UCTL_INTSTAT …
#define USBDRD_UCTL_PORT_CFG_HS(port) …
#define USBDRD_UCTL_PORT_CFG_SS(port) …
#define USBDRD_UCTL_PORT_CR_DBG_CFG(port) …
#define USBDRD_UCTL_PORT_CR_DBG_STATUS(port) …
#define USBDRD_UCTL_HOST_CFG …
#define USBDRD_UCTL_HOST_CFG_HOST_CURRENT_BELT …
#define USBDRD_UCTL_HOST_CFG_FLA …
#define USBDRD_UCTL_HOST_CFG_BME …
#define USBDRD_UCTL_HOST_OCI_EN …
#define USBDRD_UCTL_HOST_OCI_ACTIVE_HIGH_EN …
#define USBDRD_UCTL_HOST_PPC_EN …
#define USBDRD_UCTL_HOST_PPC_ACTIVE_HIGH_EN …
#define USBDRD_UCTL_SHIM_CFG …
#define USBDRD_UCTL_SHIM_CFG_XS_NCB_OOB_WRN …
#define USBDRD_UCTL_SHIM_CFG_XS_NCB_OOB_OSRC …
#define USBDRD_UCTL_SHIM_CFG_XM_BAD_DMA_WRN …
#define USBDRD_UCTL_SHIM_CFG_XM_BAD_DMA_TYPE …
#define USBDRD_UCTL_SHIM_CFG_DMA_READ_CMD …
#define USBDRD_UCTL_SHIM_CFG_DMA_ENDIAN_MODE …
#define USBDRD_UCTL_SHIM_CFG_CSR_ENDIAN_MODE …
#define USBDRD_UCTL_ECC …
#define USBDRD_UCTL_SPARE1 …
struct dwc3_octeon { … };
#define DWC3_GPIO_POWER_NONE …
#ifdef CONFIG_CAVIUM_OCTEON_SOC
#include <asm/octeon/octeon.h>
static inline uint64_t dwc3_octeon_readq(void __iomem *addr)
{
return cvmx_readq_csr(addr);
}
static inline void dwc3_octeon_writeq(void __iomem *base, uint64_t val)
{
cvmx_writeq_csr(base, val);
}
static void dwc3_octeon_config_gpio(int index, int gpio)
{
union cvmx_gpio_bit_cfgx gpio_bit;
if ((OCTEON_IS_MODEL(OCTEON_CN73XX) ||
OCTEON_IS_MODEL(OCTEON_CNF75XX))
&& gpio <= 31) {
gpio_bit.u64 = cvmx_read_csr(CVMX_GPIO_BIT_CFGX(gpio));
gpio_bit.s.tx_oe = 1;
gpio_bit.s.output_sel = (index == 0 ? 0x14 : 0x15);
cvmx_write_csr(CVMX_GPIO_BIT_CFGX(gpio), gpio_bit.u64);
} else if (gpio <= 15) {
gpio_bit.u64 = cvmx_read_csr(CVMX_GPIO_BIT_CFGX(gpio));
gpio_bit.s.tx_oe = 1;
gpio_bit.s.output_sel = (index == 0 ? 0x14 : 0x19);
cvmx_write_csr(CVMX_GPIO_BIT_CFGX(gpio), gpio_bit.u64);
} else {
gpio_bit.u64 = cvmx_read_csr(CVMX_GPIO_XBIT_CFGX(gpio));
gpio_bit.s.tx_oe = 1;
gpio_bit.s.output_sel = (index == 0 ? 0x14 : 0x19);
cvmx_write_csr(CVMX_GPIO_XBIT_CFGX(gpio), gpio_bit.u64);
}
}
#else
static inline uint64_t dwc3_octeon_readq(void __iomem *addr)
{ … }
static inline void dwc3_octeon_writeq(void __iomem *base, uint64_t val) { … }
static inline void dwc3_octeon_config_gpio(int index, int gpio) { … }
static uint64_t octeon_get_io_clock_rate(void)
{ … }
#endif
static int dwc3_octeon_get_divider(void)
{ … }
static int dwc3_octeon_setup(struct dwc3_octeon *octeon,
int ref_clk_sel, int ref_clk_fsel, int mpll_mul,
int power_gpio, int power_active_low)
{ … }
static void dwc3_octeon_set_endian_mode(struct dwc3_octeon *octeon)
{ … }
static void dwc3_octeon_phy_reset(struct dwc3_octeon *octeon)
{ … }
static int dwc3_octeon_probe(struct platform_device *pdev)
{ … }
static void dwc3_octeon_remove(struct platform_device *pdev)
{ … }
static const struct of_device_id dwc3_octeon_of_match[] = …;
MODULE_DEVICE_TABLE(of, dwc3_octeon_of_match);
static struct platform_driver dwc3_octeon_driver = …;
module_platform_driver(…) …;
MODULE_ALIAS(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;
MODULE_DESCRIPTION(…) …;