Merge tag 'usb-for-v3.20' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next
Felipe writes: usb: patches for v3.20 merge window Here's the big pull request for Gadgets and PHYs. It's a total of 217 non-merge commits with pretty much everything being touched. The most important bits are a ton of new documentation for almost all usb gadget functions, a new isp1760 UDC driver, several improvements to the old net2280 UDC driver, and some minor tracepoint improvements to dwc3. Other than that, a big list of minor cleanups, smaller bugfixes and new features all over the place. Signed-off-by: Felipe Balbi <balbi@ti.com>
Tento commit je obsažen v:
@@ -23,7 +23,7 @@ choice
|
||||
|
||||
config USB_DWC2_HOST
|
||||
bool "Host only mode"
|
||||
depends on USB
|
||||
depends on USB=y || (USB_DWC2=m && USB)
|
||||
help
|
||||
The Designware USB2.0 high-speed host controller
|
||||
integrated into many SoCs. Select this option if you want the
|
||||
@@ -42,7 +42,7 @@ config USB_DWC2_PERIPHERAL
|
||||
|
||||
config USB_DWC2_DUAL_ROLE
|
||||
bool "Dual Role mode"
|
||||
depends on (USB=y || USB=USB_DWC2) && (USB_GADGET=y || USB_GADGET=USB_DWC2)
|
||||
depends on (USB=y && USB_GADGET=y) || (USB_DWC2=m && USB && USB_GADGET)
|
||||
help
|
||||
Select this option if you want the driver to work in a dual-role
|
||||
mode. In this mode both host and gadget features are enabled, and
|
||||
|
@@ -462,7 +462,7 @@ int dwc2_core_init(struct dwc2_hsotg *hsotg, bool select_phy, int irq)
|
||||
dwc2_enable_common_interrupts(hsotg);
|
||||
|
||||
/*
|
||||
* Do device or host intialization based on mode during PCD and
|
||||
* Do device or host initialization based on mode during PCD and
|
||||
* HCD initialization
|
||||
*/
|
||||
if (dwc2_is_host_mode(hsotg)) {
|
||||
|
@@ -108,7 +108,7 @@ struct s3c_hsotg_req;
|
||||
* @halted: Set if the endpoint has been halted.
|
||||
* @periodic: Set if this is a periodic ep, such as Interrupt
|
||||
* @isochronous: Set if this is a isochronous ep
|
||||
* @sent_zlp: Set if we've sent a zero-length packet.
|
||||
* @send_zlp: Set if we need to send a zero-length packet.
|
||||
* @total_data: The total number of data bytes done.
|
||||
* @fifo_size: The size of the FIFO (for periodic IN endpoints)
|
||||
* @fifo_load: The amount of data loaded into the FIFO (periodic IN)
|
||||
@@ -149,7 +149,7 @@ struct s3c_hsotg_ep {
|
||||
unsigned int halted:1;
|
||||
unsigned int periodic:1;
|
||||
unsigned int isochronous:1;
|
||||
unsigned int sent_zlp:1;
|
||||
unsigned int send_zlp:1;
|
||||
|
||||
char name[10];
|
||||
};
|
||||
@@ -158,14 +158,12 @@ struct s3c_hsotg_ep {
|
||||
* struct s3c_hsotg_req - data transfer request
|
||||
* @req: The USB gadget request
|
||||
* @queue: The list of requests for the endpoint this is queued for.
|
||||
* @in_progress: Has already had size/packets written to core
|
||||
* @mapped: DMA buffer for this request has been mapped via dma_map_single().
|
||||
* @saved_req_buf: variable to save req.buf when bounce buffers are used.
|
||||
*/
|
||||
struct s3c_hsotg_req {
|
||||
struct usb_request req;
|
||||
struct list_head queue;
|
||||
unsigned char in_progress;
|
||||
unsigned char mapped;
|
||||
void *saved_req_buf;
|
||||
};
|
||||
|
||||
#if IS_ENABLED(CONFIG_USB_DWC2_PERIPHERAL) || IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE)
|
||||
@@ -193,6 +191,22 @@ enum dwc2_lx_state {
|
||||
DWC2_L3, /* Off state */
|
||||
};
|
||||
|
||||
/*
|
||||
* Gadget periodic tx fifo sizes as used by legacy driver
|
||||
* EP0 is not included
|
||||
*/
|
||||
#define DWC2_G_P_LEGACY_TX_FIFO_SIZE {256, 256, 256, 256, 768, 768, 768, \
|
||||
768, 0, 0, 0, 0, 0, 0, 0}
|
||||
|
||||
/* Gadget ep0 states */
|
||||
enum dwc2_ep0_state {
|
||||
DWC2_EP0_SETUP,
|
||||
DWC2_EP0_DATA_IN,
|
||||
DWC2_EP0_DATA_OUT,
|
||||
DWC2_EP0_STATUS_IN,
|
||||
DWC2_EP0_STATUS_OUT,
|
||||
};
|
||||
|
||||
/**
|
||||
* struct dwc2_core_params - Parameters for configuring the core
|
||||
*
|
||||
@@ -381,7 +395,7 @@ struct dwc2_core_params {
|
||||
* @power_optimized Are power optimizations enabled?
|
||||
* @num_dev_ep Number of device endpoints available
|
||||
* @num_dev_perio_in_ep Number of device periodic IN endpoints
|
||||
* avaialable
|
||||
* available
|
||||
* @dev_token_q_depth Device Mode IN Token Sequence Learning Queue
|
||||
* Depth
|
||||
* 0 to 30
|
||||
@@ -434,6 +448,9 @@ struct dwc2_hw_params {
|
||||
u32 snpsid;
|
||||
};
|
||||
|
||||
/* Size of control and EP0 buffers */
|
||||
#define DWC2_CTRL_BUFF_SIZE 8
|
||||
|
||||
/**
|
||||
* struct dwc2_hsotg - Holds the state of the driver, including the non-periodic
|
||||
* and periodic schedules
|
||||
@@ -552,14 +569,20 @@ struct dwc2_hw_params {
|
||||
* @num_of_eps: Number of available EPs (excluding EP0)
|
||||
* @debug_root: Root directrory for debugfs.
|
||||
* @debug_file: Main status file for debugfs.
|
||||
* @debug_testmode: Testmode status file for debugfs.
|
||||
* @debug_fifo: FIFO status file for debugfs.
|
||||
* @ep0_reply: Request used for ep0 reply.
|
||||
* @ep0_buff: Buffer for EP0 reply data, if needed.
|
||||
* @ctrl_buff: Buffer for EP0 control requests.
|
||||
* @ctrl_req: Request for EP0 control packets.
|
||||
* @setup: NAK management for EP0 SETUP
|
||||
* @ep0_state: EP0 control transfers state
|
||||
* @test_mode: USB test mode requested by the host
|
||||
* @last_rst: Time of last reset
|
||||
* @eps: The endpoints being supplied to the gadget framework
|
||||
* @g_using_dma: Indicate if dma usage is enabled
|
||||
* @g_rx_fifo_sz: Contains rx fifo size value
|
||||
* @g_np_g_tx_fifo_sz: Contains Non-Periodic tx fifo size value
|
||||
* @g_tx_fifo_sz: Contains tx fifo size value per endpoints
|
||||
*/
|
||||
struct dwc2_hsotg {
|
||||
struct device *dev;
|
||||
@@ -591,6 +614,7 @@ struct dwc2_hsotg {
|
||||
|
||||
struct dentry *debug_root;
|
||||
struct dentry *debug_file;
|
||||
struct dentry *debug_testmode;
|
||||
struct dentry *debug_fifo;
|
||||
|
||||
/* DWC OTG HW Release versions */
|
||||
@@ -684,15 +708,21 @@ struct dwc2_hsotg {
|
||||
|
||||
struct usb_request *ep0_reply;
|
||||
struct usb_request *ctrl_req;
|
||||
u8 ep0_buff[8];
|
||||
u8 ctrl_buff[8];
|
||||
void *ep0_buff;
|
||||
void *ctrl_buff;
|
||||
enum dwc2_ep0_state ep0_state;
|
||||
u8 test_mode;
|
||||
|
||||
struct usb_gadget gadget;
|
||||
unsigned int enabled:1;
|
||||
unsigned int connected:1;
|
||||
unsigned int setup:1;
|
||||
unsigned long last_rst;
|
||||
struct s3c_hsotg_ep *eps;
|
||||
struct s3c_hsotg_ep *eps_in[MAX_EPS_CHANNELS];
|
||||
struct s3c_hsotg_ep *eps_out[MAX_EPS_CHANNELS];
|
||||
u32 g_using_dma;
|
||||
u32 g_rx_fifo_sz;
|
||||
u32 g_np_g_tx_fifo_sz;
|
||||
u32 g_tx_fifo_sz[MAX_EPS_CHANNELS];
|
||||
#endif /* CONFIG_USB_DWC2_PERIPHERAL || CONFIG_USB_DWC2_DUAL_ROLE */
|
||||
};
|
||||
|
||||
@@ -969,7 +999,8 @@ extern int s3c_hsotg_remove(struct dwc2_hsotg *hsotg);
|
||||
extern int s3c_hsotg_suspend(struct dwc2_hsotg *dwc2);
|
||||
extern int s3c_hsotg_resume(struct dwc2_hsotg *dwc2);
|
||||
extern int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq);
|
||||
extern void s3c_hsotg_core_init_disconnected(struct dwc2_hsotg *dwc2);
|
||||
extern void s3c_hsotg_core_init_disconnected(struct dwc2_hsotg *dwc2,
|
||||
bool reset);
|
||||
extern void s3c_hsotg_core_connect(struct dwc2_hsotg *hsotg);
|
||||
extern void s3c_hsotg_disconnect(struct dwc2_hsotg *dwc2);
|
||||
#else
|
||||
@@ -981,7 +1012,8 @@ static inline int s3c_hsotg_resume(struct dwc2_hsotg *dwc2)
|
||||
{ return 0; }
|
||||
static inline int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq)
|
||||
{ return 0; }
|
||||
static inline void s3c_hsotg_core_init_disconnected(struct dwc2_hsotg *dwc2) {}
|
||||
static inline void s3c_hsotg_core_init_disconnected(struct dwc2_hsotg *dwc2,
|
||||
bool reset) {}
|
||||
static inline void s3c_hsotg_core_connect(struct dwc2_hsotg *hsotg) {}
|
||||
static inline void s3c_hsotg_disconnect(struct dwc2_hsotg *dwc2) {}
|
||||
#endif
|
||||
|
Rozdílový obsah nebyl zobrazen, protože je příliš veliký
Načíst rozdílové porovnání
@@ -316,10 +316,12 @@ void dwc2_hcd_disconnect(struct dwc2_hsotg *hsotg)
|
||||
*/
|
||||
static void dwc2_hcd_rem_wakeup(struct dwc2_hsotg *hsotg)
|
||||
{
|
||||
if (hsotg->lx_state == DWC2_L2)
|
||||
if (hsotg->lx_state == DWC2_L2) {
|
||||
hsotg->flags.b.port_suspend_change = 1;
|
||||
else
|
||||
usb_hcd_resume_root_hub(hsotg->priv);
|
||||
} else {
|
||||
hsotg->flags.b.port_l1_change = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1371,7 +1373,7 @@ static void dwc2_conn_id_status_change(struct work_struct *work)
|
||||
hsotg->op_state = OTG_STATE_B_PERIPHERAL;
|
||||
dwc2_core_init(hsotg, false, -1);
|
||||
dwc2_enable_global_interrupts(hsotg);
|
||||
s3c_hsotg_core_init_disconnected(hsotg);
|
||||
s3c_hsotg_core_init_disconnected(hsotg, false);
|
||||
s3c_hsotg_core_connect(hsotg);
|
||||
} else {
|
||||
/* A-Device connector (Host Mode) */
|
||||
@@ -1473,30 +1475,6 @@ static void dwc2_port_suspend(struct dwc2_hsotg *hsotg, u16 windex)
|
||||
}
|
||||
}
|
||||
|
||||
static void dwc2_port_resume(struct dwc2_hsotg *hsotg)
|
||||
{
|
||||
u32 hprt0;
|
||||
|
||||
/* After clear the Stop PHY clock bit, we should wait for a moment
|
||||
* for PLL work stable with clock output.
|
||||
*/
|
||||
writel(0, hsotg->regs + PCGCTL);
|
||||
usleep_range(2000, 4000);
|
||||
|
||||
hprt0 = dwc2_read_hprt0(hsotg);
|
||||
hprt0 |= HPRT0_RES;
|
||||
writel(hprt0, hsotg->regs + HPRT0);
|
||||
hprt0 &= ~HPRT0_SUSP;
|
||||
/* according to USB2.0 Spec 7.1.7.7, the host must send the resume
|
||||
* signal for at least 20ms
|
||||
*/
|
||||
usleep_range(20000, 25000);
|
||||
|
||||
hprt0 &= ~HPRT0_RES;
|
||||
writel(hprt0, hsotg->regs + HPRT0);
|
||||
hsotg->lx_state = DWC2_L0;
|
||||
}
|
||||
|
||||
/* Handles hub class-specific requests */
|
||||
static int dwc2_hcd_hub_control(struct dwc2_hsotg *hsotg, u16 typereq,
|
||||
u16 wvalue, u16 windex, char *buf, u16 wlength)
|
||||
@@ -1542,7 +1520,17 @@ static int dwc2_hcd_hub_control(struct dwc2_hsotg *hsotg, u16 typereq,
|
||||
case USB_PORT_FEAT_SUSPEND:
|
||||
dev_dbg(hsotg->dev,
|
||||
"ClearPortFeature USB_PORT_FEAT_SUSPEND\n");
|
||||
dwc2_port_resume(hsotg);
|
||||
writel(0, hsotg->regs + PCGCTL);
|
||||
usleep_range(20000, 40000);
|
||||
|
||||
hprt0 = dwc2_read_hprt0(hsotg);
|
||||
hprt0 |= HPRT0_RES;
|
||||
writel(hprt0, hsotg->regs + HPRT0);
|
||||
hprt0 &= ~HPRT0_SUSP;
|
||||
usleep_range(100000, 150000);
|
||||
|
||||
hprt0 &= ~HPRT0_RES;
|
||||
writel(hprt0, hsotg->regs + HPRT0);
|
||||
break;
|
||||
|
||||
case USB_PORT_FEAT_POWER:
|
||||
@@ -2317,55 +2305,6 @@ static void _dwc2_hcd_stop(struct usb_hcd *hcd)
|
||||
usleep_range(1000, 3000);
|
||||
}
|
||||
|
||||
static int _dwc2_hcd_suspend(struct usb_hcd *hcd)
|
||||
{
|
||||
struct dwc2_hsotg *hsotg = dwc2_hcd_to_hsotg(hcd);
|
||||
u32 hprt0;
|
||||
|
||||
if (!((hsotg->op_state == OTG_STATE_B_HOST) ||
|
||||
(hsotg->op_state == OTG_STATE_A_HOST)))
|
||||
return 0;
|
||||
|
||||
/* TODO: We get into suspend from 'on' state, maybe we need to do
|
||||
* something if we get here from DWC2_L1(LPM sleep) state one day.
|
||||
*/
|
||||
if (hsotg->lx_state != DWC2_L0)
|
||||
return 0;
|
||||
|
||||
hprt0 = dwc2_read_hprt0(hsotg);
|
||||
if (hprt0 & HPRT0_CONNSTS) {
|
||||
dwc2_port_suspend(hsotg, 1);
|
||||
} else {
|
||||
u32 pcgctl = readl(hsotg->regs + PCGCTL);
|
||||
|
||||
pcgctl |= PCGCTL_STOPPCLK;
|
||||
writel(pcgctl, hsotg->regs + PCGCTL);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int _dwc2_hcd_resume(struct usb_hcd *hcd)
|
||||
{
|
||||
struct dwc2_hsotg *hsotg = dwc2_hcd_to_hsotg(hcd);
|
||||
u32 hprt0;
|
||||
|
||||
if (!((hsotg->op_state == OTG_STATE_B_HOST) ||
|
||||
(hsotg->op_state == OTG_STATE_A_HOST)))
|
||||
return 0;
|
||||
|
||||
if (hsotg->lx_state != DWC2_L2)
|
||||
return 0;
|
||||
|
||||
hprt0 = dwc2_read_hprt0(hsotg);
|
||||
if ((hprt0 & HPRT0_CONNSTS) && (hprt0 & HPRT0_SUSP))
|
||||
dwc2_port_resume(hsotg);
|
||||
else
|
||||
writel(0, hsotg->regs + PCGCTL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Returns the current frame number */
|
||||
static int _dwc2_hcd_get_frame_number(struct usb_hcd *hcd)
|
||||
{
|
||||
@@ -2736,9 +2675,6 @@ static struct hc_driver dwc2_hc_driver = {
|
||||
.hub_status_data = _dwc2_hcd_hub_status_data,
|
||||
.hub_control = _dwc2_hcd_hub_control,
|
||||
.clear_tt_buffer_complete = _dwc2_hcd_clear_tt_buffer_complete,
|
||||
|
||||
.bus_suspend = _dwc2_hcd_suspend,
|
||||
.bus_resume = _dwc2_hcd_resume,
|
||||
};
|
||||
|
||||
/*
|
||||
|
@@ -294,6 +294,7 @@
|
||||
#define GHWCFG4_NUM_IN_EPS_MASK (0xf << 26)
|
||||
#define GHWCFG4_NUM_IN_EPS_SHIFT 26
|
||||
#define GHWCFG4_DED_FIFO_EN (1 << 25)
|
||||
#define GHWCFG4_DED_FIFO_SHIFT 25
|
||||
#define GHWCFG4_SESSION_END_FILT_EN (1 << 24)
|
||||
#define GHWCFG4_B_VALID_FILT_EN (1 << 23)
|
||||
#define GHWCFG4_A_VALID_FILT_EN (1 << 22)
|
||||
@@ -541,6 +542,7 @@
|
||||
|
||||
#define DIEPINT(_a) HSOTG_REG(0x908 + ((_a) * 0x20))
|
||||
#define DOEPINT(_a) HSOTG_REG(0xB08 + ((_a) * 0x20))
|
||||
#define DXEPINT_SETUP_RCVD (1 << 15)
|
||||
#define DXEPINT_INEPNAKEFF (1 << 6)
|
||||
#define DXEPINT_BACK2BACKSETUP (1 << 6)
|
||||
#define DXEPINT_INTKNEPMIS (1 << 5)
|
||||
|
@@ -155,6 +155,8 @@ static int dwc2_driver_probe(struct platform_device *dev)
|
||||
struct dwc2_core_params defparams;
|
||||
struct dwc2_hsotg *hsotg;
|
||||
struct resource *res;
|
||||
struct phy *phy;
|
||||
struct usb_phy *uphy;
|
||||
int retval;
|
||||
int irq;
|
||||
|
||||
@@ -212,6 +214,24 @@ static int dwc2_driver_probe(struct platform_device *dev)
|
||||
|
||||
hsotg->dr_mode = of_usb_get_dr_mode(dev->dev.of_node);
|
||||
|
||||
/*
|
||||
* Attempt to find a generic PHY, then look for an old style
|
||||
* USB PHY
|
||||
*/
|
||||
phy = devm_phy_get(&dev->dev, "usb2-phy");
|
||||
if (IS_ERR(phy)) {
|
||||
hsotg->phy = NULL;
|
||||
uphy = devm_usb_get_phy(&dev->dev, USB_PHY_TYPE_USB2);
|
||||
if (IS_ERR(uphy))
|
||||
hsotg->uphy = NULL;
|
||||
else
|
||||
hsotg->uphy = uphy;
|
||||
} else {
|
||||
hsotg->phy = phy;
|
||||
phy_power_on(hsotg->phy);
|
||||
phy_init(hsotg->phy);
|
||||
}
|
||||
|
||||
spin_lock_init(&hsotg->lock);
|
||||
mutex_init(&hsotg->init_mutex);
|
||||
retval = dwc2_gadget_init(hsotg, irq);
|
||||
@@ -231,8 +251,15 @@ static int __maybe_unused dwc2_suspend(struct device *dev)
|
||||
struct dwc2_hsotg *dwc2 = dev_get_drvdata(dev);
|
||||
int ret = 0;
|
||||
|
||||
if (dwc2_is_device_mode(dwc2))
|
||||
if (dwc2_is_device_mode(dwc2)) {
|
||||
ret = s3c_hsotg_suspend(dwc2);
|
||||
} else {
|
||||
if (dwc2->lx_state == DWC2_L0)
|
||||
return 0;
|
||||
phy_exit(dwc2->phy);
|
||||
phy_power_off(dwc2->phy);
|
||||
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -241,8 +268,13 @@ static int __maybe_unused dwc2_resume(struct device *dev)
|
||||
struct dwc2_hsotg *dwc2 = dev_get_drvdata(dev);
|
||||
int ret = 0;
|
||||
|
||||
if (dwc2_is_device_mode(dwc2))
|
||||
if (dwc2_is_device_mode(dwc2)) {
|
||||
ret = s3c_hsotg_resume(dwc2);
|
||||
} else {
|
||||
phy_power_on(dwc2->phy);
|
||||
phy_init(dwc2->phy);
|
||||
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Odkázat v novém úkolu
Zablokovat Uživatele