2017-11-03 17:28:30 +07:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
usb: Introduce DesignWare USB3 DRD Driver
The DesignWare USB3 is a highly
configurable IP Core which can be
instantiated as Dual-Role Device (DRD),
Peripheral Only and Host Only (XHCI)
configurations.
Several other parameters can be configured
like amount of FIFO space, amount of TX and
RX endpoints, amount of Host Interrupters,
etc.
The current driver has been validated with
a virtual model of version 1.73a of that core
and with an FPGA burned with version 1.83a
of the DRD core. We have support for PCIe
bus, which is used on FPGA prototyping, and
for the OMAP5, more adaptation (or glue)
layers can be easily added and the driver
is half prepared to handle any possible
configuration the HW engineer has chosen
considering we have the information on
one of the GHWPARAMS registers to do
runtime checking of certain features.
More runtime checks can, and should, be added
in order to make this driver even more flexible
with regards to number of endpoints, FIFO sizes,
transfer types, etc.
While this supports only the device side, for
now, we will add support for Host side (xHCI -
see the updated series Sebastian has sent [1])
and OTG after we have it all stabilized.
[1] http://marc.info/?l=linux-usb&m=131341992020339&w=2
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-19 22:10:58 +07:00
|
|
|
/**
|
|
|
|
* io.h - DesignWare USB3 DRD IO Header
|
|
|
|
*
|
|
|
|
* Copyright (C) 2010-2011 Texas Instruments Incorporated - http://www.ti.com
|
|
|
|
*
|
|
|
|
* Authors: Felipe Balbi <balbi@ti.com>,
|
|
|
|
* Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __DRIVERS_USB_DWC3_IO_H
|
|
|
|
#define __DRIVERS_USB_DWC3_IO_H
|
|
|
|
|
2011-11-04 17:32:47 +07:00
|
|
|
#include <linux/io.h>
|
2014-05-01 05:45:10 +07:00
|
|
|
#include "trace.h"
|
|
|
|
#include "debug.h"
|
2012-04-24 18:18:39 +07:00
|
|
|
#include "core.h"
|
|
|
|
|
usb: Introduce DesignWare USB3 DRD Driver
The DesignWare USB3 is a highly
configurable IP Core which can be
instantiated as Dual-Role Device (DRD),
Peripheral Only and Host Only (XHCI)
configurations.
Several other parameters can be configured
like amount of FIFO space, amount of TX and
RX endpoints, amount of Host Interrupters,
etc.
The current driver has been validated with
a virtual model of version 1.73a of that core
and with an FPGA burned with version 1.83a
of the DRD core. We have support for PCIe
bus, which is used on FPGA prototyping, and
for the OMAP5, more adaptation (or glue)
layers can be easily added and the driver
is half prepared to handle any possible
configuration the HW engineer has chosen
considering we have the information on
one of the GHWPARAMS registers to do
runtime checking of certain features.
More runtime checks can, and should, be added
in order to make this driver even more flexible
with regards to number of endpoints, FIFO sizes,
transfer types, etc.
While this supports only the device side, for
now, we will add support for Host side (xHCI -
see the updated series Sebastian has sent [1])
and OTG after we have it all stabilized.
[1] http://marc.info/?l=linux-usb&m=131341992020339&w=2
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-19 22:10:58 +07:00
|
|
|
static inline u32 dwc3_readl(void __iomem *base, u32 offset)
|
|
|
|
{
|
2014-05-01 05:45:10 +07:00
|
|
|
u32 value;
|
|
|
|
|
2012-04-24 18:18:39 +07:00
|
|
|
/*
|
|
|
|
* We requested the mem region starting from the Globals address
|
|
|
|
* space, see dwc3_probe in core.c.
|
|
|
|
* However, the offsets are given starting from xHCI address space.
|
|
|
|
*/
|
2016-04-12 20:53:39 +07:00
|
|
|
value = readl(base + offset - DWC3_GLOBALS_REGS_START);
|
2014-05-01 05:45:10 +07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* When tracing we want to make it easy to find the correct address on
|
|
|
|
* documentation, so we revert it back to the proper addresses, the
|
|
|
|
* same way they are described on SNPS documentation
|
|
|
|
*/
|
2016-09-30 19:52:19 +07:00
|
|
|
trace_dwc3_readl(base - DWC3_GLOBALS_REGS_START, offset, value);
|
2014-05-01 05:45:10 +07:00
|
|
|
|
|
|
|
return value;
|
usb: Introduce DesignWare USB3 DRD Driver
The DesignWare USB3 is a highly
configurable IP Core which can be
instantiated as Dual-Role Device (DRD),
Peripheral Only and Host Only (XHCI)
configurations.
Several other parameters can be configured
like amount of FIFO space, amount of TX and
RX endpoints, amount of Host Interrupters,
etc.
The current driver has been validated with
a virtual model of version 1.73a of that core
and with an FPGA burned with version 1.83a
of the DRD core. We have support for PCIe
bus, which is used on FPGA prototyping, and
for the OMAP5, more adaptation (or glue)
layers can be easily added and the driver
is half prepared to handle any possible
configuration the HW engineer has chosen
considering we have the information on
one of the GHWPARAMS registers to do
runtime checking of certain features.
More runtime checks can, and should, be added
in order to make this driver even more flexible
with regards to number of endpoints, FIFO sizes,
transfer types, etc.
While this supports only the device side, for
now, we will add support for Host side (xHCI -
see the updated series Sebastian has sent [1])
and OTG after we have it all stabilized.
[1] http://marc.info/?l=linux-usb&m=131341992020339&w=2
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-19 22:10:58 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void dwc3_writel(void __iomem *base, u32 offset, u32 value)
|
|
|
|
{
|
2012-04-24 18:18:39 +07:00
|
|
|
/*
|
|
|
|
* We requested the mem region starting from the Globals address
|
|
|
|
* space, see dwc3_probe in core.c.
|
|
|
|
* However, the offsets are given starting from xHCI address space.
|
|
|
|
*/
|
2016-04-12 20:53:39 +07:00
|
|
|
writel(value, base + offset - DWC3_GLOBALS_REGS_START);
|
2014-05-01 05:45:10 +07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* When tracing we want to make it easy to find the correct address on
|
|
|
|
* documentation, so we revert it back to the proper addresses, the
|
|
|
|
* same way they are described on SNPS documentation
|
|
|
|
*/
|
2016-09-30 19:52:19 +07:00
|
|
|
trace_dwc3_writel(base - DWC3_GLOBALS_REGS_START, offset, value);
|
usb: Introduce DesignWare USB3 DRD Driver
The DesignWare USB3 is a highly
configurable IP Core which can be
instantiated as Dual-Role Device (DRD),
Peripheral Only and Host Only (XHCI)
configurations.
Several other parameters can be configured
like amount of FIFO space, amount of TX and
RX endpoints, amount of Host Interrupters,
etc.
The current driver has been validated with
a virtual model of version 1.73a of that core
and with an FPGA burned with version 1.83a
of the DRD core. We have support for PCIe
bus, which is used on FPGA prototyping, and
for the OMAP5, more adaptation (or glue)
layers can be easily added and the driver
is half prepared to handle any possible
configuration the HW engineer has chosen
considering we have the information on
one of the GHWPARAMS registers to do
runtime checking of certain features.
More runtime checks can, and should, be added
in order to make this driver even more flexible
with regards to number of endpoints, FIFO sizes,
transfer types, etc.
While this supports only the device side, for
now, we will add support for Host side (xHCI -
see the updated series Sebastian has sent [1])
and OTG after we have it all stabilized.
[1] http://marc.info/?l=linux-usb&m=131341992020339&w=2
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-19 22:10:58 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* __DRIVERS_USB_DWC3_IO_H */
|