[PATCH v4 02/20] usb: dwc3: add a flag to check if it is FPGA board
Some chip vendor is on pre-silicon phase, which needs to use the simulation board. It should have the same product and vendor id with the true SoC, but might have some minor different configurations. Below thread discussion proposes to find a method to distinguish between simulation board and SoC. http://marc.info/?l=linux-usb&m=141194772206369&w=2 In Advanced Configuration of coreConsultant, there is the parameter of DWC_USB_EN_FPGA. This bit has the function we need. And it would response as 7 bit of GHWPARAMS6 register. So it's able to check this functional bit to confirm if works on FPGA board. Reported-by: Felipe Balbi Signed-off-by: Huang Rui Signed-off-by: Felipe Balbi --- drivers/usb/dwc3/core.c | 6 ++ drivers/usb/dwc3/core.h | 5 + 2 files changed, 11 insertions(+) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 5a47482..c8ae098 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -460,6 +460,12 @@ static int dwc3_core_init(struct dwc3 *dwc) dev_dbg(dwc->dev, "No power optimization available\n"); } + /* check if current dwc3 is on simulation board */ + if (dwc->hwparams.hwparams6 & DWC3_GHWPARAMS6_EN_FPGA) { + dev_dbg(dwc->dev, "it is on FPGA board\n"); + dwc->is_fpga = true; + } + /* * WORKAROUND: DWC3 revisions <1.90a have a bug * where the device can fail to connect at SuperSpeed diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index a715ee1..f6ee623 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -210,6 +210,9 @@ #define DWC3_GHWPARAMS4_HIBER_SCRATCHBUFS(n) (((n) & (0x0f << 13)) >> 13) #define DWC3_MAX_HIBER_SCRATCHBUFS 15 +/* Global HWPARAMS6 Register */ +#define DWC3_GHWPARAMS6_EN_FPGA(1 << 7) + /* Device Configuration Register */ #define DWC3_DCFG_DEVADDR(addr)((addr) << 3) #define DWC3_DCFG_DEVADDR_MASK DWC3_DCFG_DEVADDR(0x7f) @@ -662,6 +665,7 @@ struct dwc3_scratchpad_array { * @ep0_expect_in: true when we expect a DATA IN transfer * @has_hibernation: true when dwc3 was configured with Hibernation * @is_selfpowered: true when we are selfpowered + * @is_fpga: true when we are using the FPGA board * @needs_fifo_resize: not all users might want fifo resizing, flag it * @pullups_connected: true when Run/Stop bit is set * @resize_fifos: tells us it's ok to reconfigure our TxFIFO sizes. @@ -765,6 +769,7 @@ struct dwc3 { unsignedep0_expect_in:1; unsignedhas_hibernation:1; unsignedis_selfpowered:1; + unsignedis_fpga:1; unsignedneeds_fifo_resize:1; unsignedpullups_connected:1; unsignedresize_fifos:1; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 0/4] usb: renesas_usbhs: fixes this driver in gadget mode (part2)
If we tested this driver as gadget, some issues below happened: - Oops happened if g_audio. - A usb enumeration may fail if we do insmod during connected the usb cable. - A transaction will not finish if g_zero. - A usb enumeration may fail after we re-connected the usb cable. This patch serias fixes them. This patch serias is based on Felipe's usb.git / testing/fixes branch. (commit id: 9f2104db129512fd2ee086c8a616d296d1afbb75) Changes from v2: - Use USBHSG_STATUS_ instead of a new variable in patch 2. Changes from v1: - Rebase this patch serias for the latest testing/fixes branch. - Add "From:" in patch 1 and 2. - Add "Cc: " in patch 1. *** BLURB HERE *** Yoshihiro Shimoda (4): usb: renesas_usbhs: gadget: fix NULL pointer dereference in ep_disable() usb: renesas_usbhs: gadget: fix the behavior of pullup usb: renesas_usbhs: fix the timing of dcp_control_transfer_done usb: renesas_usbhs: fix usbhs_pipe_clear() for DCP PIPE drivers/usb/renesas_usbhs/common.c |6 +++-- drivers/usb/renesas_usbhs/fifo.c | 34 ++-- drivers/usb/renesas_usbhs/fifo.h |1 + drivers/usb/renesas_usbhs/mod_gadget.c | 38 ++-- drivers/usb/renesas_usbhs/mod_host.c |2 +- drivers/usb/renesas_usbhs/pipe.c |8 +-- 6 files changed, 66 insertions(+), 23 deletions(-) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 2/4] usb: renesas_usbhs: gadget: fix the behavior of pullup
From: Takeshi Kihara This patch fixes an issue that this driver always enable the D+ pullup after it detected the VBUS connection even though this usb controller can control the D+ pullup timing by software. So, this driver should enable the D+ pullup after a gadget driver called usb_gadget_connect(). Signed-off-by: Takeshi Kihara Signed-off-by: Kazuya Mizuguchi Signed-off-by: Yoshihiro Shimoda --- drivers/usb/renesas_usbhs/common.c |6 -- drivers/usb/renesas_usbhs/mod_gadget.c | 30 +- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c index b3b6813..7099f17 100644 --- a/drivers/usb/renesas_usbhs/common.c +++ b/drivers/usb/renesas_usbhs/common.c @@ -126,13 +126,15 @@ void usbhs_sys_host_ctrl(struct usbhs_priv *priv, int enable) void usbhs_sys_function_ctrl(struct usbhs_priv *priv, int enable) { u16 mask = DCFM | DRPD | DPRPU | HSE | USBE; - u16 val = DPRPU | HSE | USBE; + u16 val = HSE | USBE; /* * if enable * * - select Function mode -* - D+ Line Pull-up +* - D+ Line Pull-up is disabled +* When D+ Line Pull-up is enabled, +* calling usbhs_sys_function_pullup(,1) */ usbhs_bset(priv, SYSCFG, mask, enable ? val : 0); } diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c index 2d0903f..daecf74 100644 --- a/drivers/usb/renesas_usbhs/mod_gadget.c +++ b/drivers/usb/renesas_usbhs/mod_gadget.c @@ -56,6 +56,7 @@ struct usbhsg_gpriv { #define USBHSG_STATUS_REGISTERD(1 << 1) #define USBHSG_STATUS_WEDGE(1 << 2) #define USBHSG_STATUS_SELF_POWERED (1 << 3) +#define USBHSG_STATUS_SOFT_CONNECT (1 << 4) }; struct usbhsg_recip_handle { @@ -726,6 +727,25 @@ static struct usb_ep_ops usbhsg_ep_ops = { }; /* + * pullup control + */ +static int usbhsg_can_pullup(struct usbhs_priv *priv) +{ + struct usbhsg_gpriv *gpriv = usbhsg_priv_to_gpriv(priv); + + return gpriv->driver && + usbhsg_status_has(gpriv, USBHSG_STATUS_SOFT_CONNECT); +} + +static void usbhsg_update_pullup(struct usbhs_priv *priv) +{ + if (usbhsg_can_pullup(priv)) + usbhs_sys_function_pullup(priv, 1); + else + usbhs_sys_function_pullup(priv, 0); +} + +/* * usb module start/end */ static int usbhsg_try_start(struct usbhs_priv *priv, u32 status) @@ -775,6 +795,7 @@ static int usbhsg_try_start(struct usbhs_priv *priv, u32 status) * - usb module */ usbhs_sys_function_ctrl(priv, 1); + usbhsg_update_pullup(priv); /* * enable irq callback @@ -881,8 +902,15 @@ static int usbhsg_pullup(struct usb_gadget *gadget, int is_on) { struct usbhsg_gpriv *gpriv = usbhsg_gadget_to_gpriv(gadget); struct usbhs_priv *priv = usbhsg_gpriv_to_priv(gpriv); + unsigned long flags; - usbhs_sys_function_pullup(priv, is_on); + usbhs_lock(priv, flags); + if (is_on) + usbhsg_status_set(gpriv, USBHSG_STATUS_SOFT_CONNECT); + else + usbhsg_status_clr(gpriv, USBHSG_STATUS_SOFT_CONNECT); + usbhsg_update_pullup(priv); + usbhs_unlock(priv, flags); return 0; } -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 1/4] usb: renesas_usbhs: gadget: fix NULL pointer dereference in ep_disable()
From: Kazuya Mizuguchi This patch fixes an issue that the NULL pointer dereference happens when we uses g_audio driver. Since the g_audio driver will call usb_ep_disable() in afunc_set_alt() before it calls usb_ep_enable(), the uep->pipe of renesas usbhs driver will be NULL. So, this patch adds a condition to avoid the oops. Signed-off-by: Kazuya Mizuguchi Signed-off-by: Takeshi Kihara Signed-off-by: Yoshihiro Shimoda Cc: --- drivers/usb/renesas_usbhs/mod_gadget.c |3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c index 2d17c10..2d0903f 100644 --- a/drivers/usb/renesas_usbhs/mod_gadget.c +++ b/drivers/usb/renesas_usbhs/mod_gadget.c @@ -602,6 +602,9 @@ static int usbhsg_ep_disable(struct usb_ep *ep) struct usbhsg_uep *uep = usbhsg_ep_to_uep(ep); struct usbhs_pipe *pipe = usbhsg_uep_to_pipe(uep); + if (!uep || !uep->pipe) + return -EINVAL; + usbhsg_pipe_disable(uep); usbhs_pipe_free(pipe); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 3/4] usb: renesas_usbhs: fix the timing of dcp_control_transfer_done
According to the datasheet, this driver should clear the INTSTS0.CTRT bit before this controller detects the next stage transition. Otherwise, the driver may not be able to clear the bit after the controller went to the next stage transition. After that, the driver will not be able to clear the INTSTS0.VALID, and a usb control transfer will not finish finally. If we use the testusb tool, it is easy to reproduce this issue: # testusb -a -t 10 Since the previous code handled a data stage and a status stage in the usbhsf_pio_try_push(), it may not clear the INTSTS0.CTRT at the right timing. So, this patch change the timing of usbhs_dcp_control_transfer_done() to the usbhsg_irq_ctrl_stage(). Signed-off-by: Yoshihiro Shimoda --- drivers/usb/renesas_usbhs/fifo.c | 16 drivers/usb/renesas_usbhs/mod_gadget.c |3 +++ 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c index b0c97a3..0e07925 100644 --- a/drivers/usb/renesas_usbhs/fifo.c +++ b/drivers/usb/renesas_usbhs/fifo.c @@ -577,14 +577,6 @@ static int usbhsf_pio_try_push(struct usbhs_pkt *pkt, int *is_done) usbhs_pipe_number(pipe), pkt->length, pkt->actual, *is_done, pkt->zero); - /* -* Transmission end -*/ - if (*is_done) { - if (usbhs_pipe_is_dcp(pipe)) - usbhs_dcp_control_transfer_done(pipe); - } - usbhsf_fifo_unselect(pipe, fifo); return 0; @@ -722,14 +714,6 @@ usbhs_fifo_read_end: usbhs_pipe_number(pipe), pkt->length, pkt->actual, *is_done, pkt->zero); - /* -* Transmission end -*/ - if (*is_done) { - if (usbhs_pipe_is_dcp(pipe)) - usbhs_dcp_control_transfer_done(pipe); - } - usbhs_fifo_read_busy: usbhsf_fifo_unselect(pipe, fifo); diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c index daecf74..c46641a 100644 --- a/drivers/usb/renesas_usbhs/mod_gadget.c +++ b/drivers/usb/renesas_usbhs/mod_gadget.c @@ -485,6 +485,9 @@ static int usbhsg_irq_ctrl_stage(struct usbhs_priv *priv, case NODATA_STATUS_STAGE: pipe->handler = &usbhs_ctrl_stage_end_handler; break; + case READ_STATUS_STAGE: + case WRITE_STATUS_STAGE: + usbhs_dcp_control_transfer_done(pipe); default: return ret; } -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 4/4] usb: renesas_usbhs: fix usbhs_pipe_clear() for DCP PIPE
Since the DCPCTR doesn't have the ACLRM bit, the usbus_pipe_clear() should not call the usbhsp_pipectrl_set() with ACLRM. So, this patch fixes this issue to add the usbhs_fifo_clear_dcp() in fifo.c because the controller needs the CFIFO to clear the the DCP PIPE. Signed-off-by: Yoshihiro Shimoda --- drivers/usb/renesas_usbhs/fifo.c | 18 ++ drivers/usb/renesas_usbhs/fifo.h |1 + drivers/usb/renesas_usbhs/mod_gadget.c |2 +- drivers/usb/renesas_usbhs/mod_host.c |2 +- drivers/usb/renesas_usbhs/pipe.c |8 ++-- 5 files changed, 27 insertions(+), 4 deletions(-) diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c index 0e07925..9b48384 100644 --- a/drivers/usb/renesas_usbhs/fifo.c +++ b/drivers/usb/renesas_usbhs/fifo.c @@ -1160,6 +1160,24 @@ static void usbhsf_dma_complete(void *arg) usbhs_pipe_number(pipe), ret); } +void usbhs_fifo_clear_dcp(struct usbhs_pipe *pipe) +{ + struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe); + struct usbhs_fifo *fifo = usbhsf_get_cfifo(priv); /* CFIFO */ + + /* clear DCP FIFO of transmission */ + if (usbhsf_fifo_select(pipe, fifo, 1) < 0) + return; + usbhsf_fifo_clear(pipe, fifo); + usbhsf_fifo_unselect(pipe, fifo); + + /* clear DCP FIFO of reception */ + if (usbhsf_fifo_select(pipe, fifo, 0) < 0) + return; + usbhsf_fifo_clear(pipe, fifo); + usbhsf_fifo_unselect(pipe, fifo); +} + /* * fifo init */ diff --git a/drivers/usb/renesas_usbhs/fifo.h b/drivers/usb/renesas_usbhs/fifo.h index a168a17..79ad5f9 100644 --- a/drivers/usb/renesas_usbhs/fifo.h +++ b/drivers/usb/renesas_usbhs/fifo.h @@ -74,6 +74,7 @@ int usbhs_fifo_probe(struct usbhs_priv *priv); void usbhs_fifo_remove(struct usbhs_priv *priv); void usbhs_fifo_init(struct usbhs_priv *priv); void usbhs_fifo_quit(struct usbhs_priv *priv); +void usbhs_fifo_clear_dcp(struct usbhs_pipe *pipe); /* * packet info diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c index c46641a..878334d 100644 --- a/drivers/usb/renesas_usbhs/mod_gadget.c +++ b/drivers/usb/renesas_usbhs/mod_gadget.c @@ -782,9 +782,9 @@ static int usbhsg_try_start(struct usbhs_priv *priv, u32 status) /* * pipe initialize and enable DCP */ + usbhs_fifo_init(priv); usbhs_pipe_init(priv, usbhsg_dma_map_ctrl); - usbhs_fifo_init(priv); /* dcp init instead of usbhsg_ep_enable() */ dcp->pipe = usbhs_dcp_malloc(priv); diff --git a/drivers/usb/renesas_usbhs/mod_host.c b/drivers/usb/renesas_usbhs/mod_host.c index 10e1ded..f0d3231 100644 --- a/drivers/usb/renesas_usbhs/mod_host.c +++ b/drivers/usb/renesas_usbhs/mod_host.c @@ -1474,9 +1474,9 @@ static int usbhsh_start(struct usbhs_priv *priv) /* * pipe initialize and enable DCP */ + usbhs_fifo_init(priv); usbhs_pipe_init(priv, usbhsh_dma_map_ctrl); - usbhs_fifo_init(priv); usbhsh_pipe_init_for_host(priv); /* diff --git a/drivers/usb/renesas_usbhs/pipe.c b/drivers/usb/renesas_usbhs/pipe.c index 040bcef..007f45a 100644 --- a/drivers/usb/renesas_usbhs/pipe.c +++ b/drivers/usb/renesas_usbhs/pipe.c @@ -618,8 +618,12 @@ void usbhs_pipe_data_sequence(struct usbhs_pipe *pipe, int sequence) void usbhs_pipe_clear(struct usbhs_pipe *pipe) { - usbhsp_pipectrl_set(pipe, ACLRM, ACLRM); - usbhsp_pipectrl_set(pipe, ACLRM, 0); + if (usbhs_pipe_is_dcp(pipe)) { + usbhs_fifo_clear_dcp(pipe); + } else { + usbhsp_pipectrl_set(pipe, ACLRM, ACLRM); + usbhsp_pipectrl_set(pipe, ACLRM, 0); + } } static struct usbhs_pipe *usbhsp_get_pipe(struct usbhs_priv *priv, u32 type) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 01/20] usb: dwc3: enable hibernation if to be supported
On Thursday 30 October 2014 18:08:26 Huang Rui wrote: > It enables hibernation if the function is set in coreConsultant. > > Suggested-by: Felipe Balbi > Signed-off-by: Huang Rui > Signed-off-by: Felipe Balbi > Something went wrong with the Signed-off-by lines here. You should never add someone else's Signed-off-by below yours. I took a brief look at the entire series and the patches all look good to me, but you have made the same mistake with the Signed-off-by multiple times. Arnd -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/6] usb: chipidea: setup ci_hdrc_platform_data in core driver
Hello, This series introduce the ci_hdrc_get_platdata function to help setting up the ChipIdea internal ci_hdrc_platform_data structure. This helps avoiding duplicating code. This series comes from a duscission on Berlin's USB pacthes where it was asked to move the PHY phandle handling in the ChipIdea core[1]. With the introduction of the ci_hdrc_get_platdata function, the old ci_get_platdata function is removed. Changes in ChipIdea drivers have also been made. This series is needed for the Berlin USB support and has been tested with an updated version of the USB Berlin driver (not in mainline yet). Thanks, Antoine [1] http://lists.infradead.org/pipermail/linux-arm-kernel/2014-October/292383.html Antoine Tenart (6): usb: chipidea: add a core function to setup ci_hdrc_platform_data usb: chipidea: use ci_hdrc_get_platdata in ci_hdrc_imx usb: chipidea: use ci_hdrc_get_platdata in ci_hdrc_msm usb: chipidea: use ci_hdrc_get_platdata in ci_hdrc_pci usb: chipidea: use ci_hdrc_get_platdata in ci_hdrc_zevio usb: chipidea: remove obsolete ci_get_platdata function drivers/usb/chipidea/ci_hdrc_imx.c | 14 ++-- drivers/usb/chipidea/ci_hdrc_msm.c | 10 ++- drivers/usb/chipidea/ci_hdrc_pci.c | 12 ++- drivers/usb/chipidea/ci_hdrc_zevio.c | 8 +- drivers/usb/chipidea/core.c | 146 --- include/linux/usb/chipidea.h | 2 + 6 files changed, 150 insertions(+), 42 deletions(-) -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 5/6] usb: chipidea: use ci_hdrc_get_platdata in ci_hdrc_zevio
Use the newly introduced ci_hdrc_get_platdata function to help setup the chipidea internal ci_hdrc_platform_data structure. Signed-off-by: Antoine Tenart --- drivers/usb/chipidea/ci_hdrc_zevio.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/usb/chipidea/ci_hdrc_zevio.c b/drivers/usb/chipidea/ci_hdrc_zevio.c index 3bf6489ef5ec..d50a6d9038bd 100644 --- a/drivers/usb/chipidea/ci_hdrc_zevio.c +++ b/drivers/usb/chipidea/ci_hdrc_zevio.c @@ -25,12 +25,16 @@ static struct ci_hdrc_platform_data ci_hdrc_zevio_platdata = { static int ci_hdrc_zevio_probe(struct platform_device *pdev) { struct platform_device *ci_pdev; + struct ci_hdrc_platform_data *ci_pdata; dev_dbg(&pdev->dev, "ci_hdrc_zevio_probe\n"); + ci_pdata = ci_hdrc_get_platdata(&pdev->dev, &ci_hdrc_zevio_platdata); + if (IS_ERR(ci_pdata)) + return PTR_ERR(ci_pdata); + ci_pdev = ci_hdrc_add_device(&pdev->dev, - pdev->resource, pdev->num_resources, - &ci_hdrc_zevio_platdata); + pdev->resource, pdev->num_resources, ci_pdata); if (IS_ERR(ci_pdev)) { dev_err(&pdev->dev, "ci_hdrc_add_device failed!\n"); -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/6] usb: chipidea: use ci_hdrc_get_platdata in ci_hdrc_pci
Use the newly introduced ci_hdrc_get_platdata function to help setup the chipidea internal ci_hdrc_platform_data structure. Signed-off-by: Antoine Tenart --- drivers/usb/chipidea/ci_hdrc_pci.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/usb/chipidea/ci_hdrc_pci.c b/drivers/usb/chipidea/ci_hdrc_pci.c index 241ae3444fde..d2ffc651b650 100644 --- a/drivers/usb/chipidea/ci_hdrc_pci.c +++ b/drivers/usb/chipidea/ci_hdrc_pci.c @@ -51,16 +51,22 @@ static struct ci_hdrc_platform_data penwell_pci_platdata = { static int ci_hdrc_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) { - struct ci_hdrc_platform_data *platdata = (void *)id->driver_data; + struct ci_hdrc_platform_data *ci_pdata_default = + (void *)id->driver_data; + struct ci_hdrc_platform_data *ci_pdata; struct platform_device *plat_ci; struct resource res[3]; int retval = 0, nres = 2; - if (!platdata) { + if (!ci_pdata_default) { dev_err(&pdev->dev, "device doesn't provide driver data\n"); return -ENODEV; } + ci_pdata = ci_hdrc_get_platdata(&pdev->dev, ci_pdata_default); + if (IS_ERR(ci_pdata)) + return PTR_ERR(ci_pdata); + retval = pcim_enable_device(pdev); if (retval) return retval; @@ -80,7 +86,7 @@ static int ci_hdrc_pci_probe(struct pci_dev *pdev, res[1].start= pdev->irq; res[1].flags= IORESOURCE_IRQ; - plat_ci = ci_hdrc_add_device(&pdev->dev, res, nres, platdata); + plat_ci = ci_hdrc_add_device(&pdev->dev, res, nres, ci_pdata); if (IS_ERR(plat_ci)) { dev_err(&pdev->dev, "ci_hdrc_add_device failed!\n"); return PTR_ERR(plat_ci); -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/6] usb: chipidea: add a core function to setup ci_hdrc_platform_data
Add a function into the chipidea core to help drivers setup the internal ci_hdrc_platform_data structure. This helps not duplicating common code. The ci_hdrc_get_platdata function only setup non filled members of the structure so that is is possible to give an already filled one. This is what the ci_pdata_default parameter is for. Signed-off-by: Antoine Tenart --- drivers/usb/chipidea/core.c | 129 +++ include/linux/usb/chipidea.h | 2 + 2 files changed, 131 insertions(+) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index ba0ac2723098..0ad55c10a903 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -535,6 +535,135 @@ static int ci_get_platdata(struct device *dev, return 0; } +/* + * Getting a PHY or an USB PHY is optional: + * If no PHY or USB PHY is found, or if their subsystems aren't enabled, + * PHY and/or USB PHY will be set to NULL. Otherwise returns an error. + */ +static int ci_hdrc_get_phy(struct device *dev, + struct ci_hdrc_platform_data *ci_pdata) +{ + ci_pdata->phy = devm_phy_get(dev, "usb"); + ci_pdata->usb_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); + + if (PTR_ERR(ci_pdata->phy) == -EPROBE_DEFER || + PTR_ERR(ci_pdata->usb_phy) == -EPROBE_DEFER) + return -EPROBE_DEFER; + + if (IS_ERR(ci_pdata->phy)) { + if (PTR_ERR(ci_pdata->phy) == -ENOSYS || + PTR_ERR(ci_pdata->phy) == -ENODEV) { + ci_pdata->phy = NULL; + } else { + dev_err(dev, "Could not get PHY: %ld\n", + PTR_ERR(ci_pdata->phy)); + return PTR_ERR(ci_pdata->phy); + } + } + + if (IS_ERR(ci_pdata->usb_phy)) { + if (PTR_ERR(ci_pdata->usb_phy) == -ENXIO || + PTR_ERR(ci_pdata->usb_phy) == -ENODEV) { + ci_pdata->usb_phy = NULL; + } else { + dev_err(dev, "Could not get USB PHY: %ld\n", + PTR_ERR(ci_pdata->usb_phy)); + return PTR_ERR(ci_pdata->usb_phy); + } + } + + return 0; +} + +static int ci_hdrc_get_usb_phy_mode(struct device *dev, + struct ci_hdrc_platform_data *ci_pdata) +{ + if (!ci_pdata->phy_mode) + ci_pdata->phy_mode = of_usb_get_phy_mode(dev->of_node); + + if (!ci_pdata->dr_mode) + ci_pdata->dr_mode = of_usb_get_dr_mode(dev->of_node); + + if (of_usb_get_maximum_speed(dev->of_node) == USB_SPEED_FULL) + ci_pdata->flags |= CI_HDRC_FORCE_FULLSPEED; + + return 0; +} + +/* + * Getting a regulator is optional: + * If no regulator is found, or if the regulator subsystem isn't enabled, + * the regulator will be set to NULL. Otherwise returns an error. + */ +static int ci_hdrc_get_regulator(struct device *dev, +struct ci_hdrc_platform_data *ci_pdata) +{ + ci_pdata->reg_vbus = devm_regulator_get(dev, "vbus"); + + if (IS_ERR(ci_pdata->reg_vbus)) { + if (PTR_ERR(ci_pdata->reg_vbus) == -EPROBE_DEFER) + return -EPROBE_DEFER; + + if (PTR_ERR(ci_pdata->reg_vbus) == -ENODEV) { + ci_pdata->reg_vbus = NULL; + } else { + dev_err(dev, "Could not get regulator for vbus: %ld\n", + PTR_ERR(ci_pdata->reg_vbus)); + return PTR_ERR(ci_pdata->reg_vbus); + } + } + + return 0; +} + +struct ci_hdrc_platform_data *ci_hdrc_get_platdata(struct device *dev, + struct ci_hdrc_platform_data *ci_pdata_default) +{ + struct ci_hdrc_platform_data *ci_pdata; + int ret; + + if (!ci_pdata_default) { + ci_pdata = devm_kzalloc(dev, sizeof(*ci_pdata), GFP_KERNEL); + if (!ci_pdata) + return ERR_PTR(-ENOMEM); + } else { + ci_pdata = ci_pdata_default; + } + + if (!ci_pdata->name) + ci_pdata->name = dev_name(dev); + + if (!ci_pdata->phy && !ci_pdata->usb_phy) { + ret = ci_hdrc_get_phy(dev, ci_pdata); + if (ret) + return ERR_PTR(ret); + } + + if (ci_pdata->usb_phy) { + ret = ci_hdrc_get_usb_phy_mode(dev, ci_pdata); + if (ret) + return ERR_PTR(ret); + } + + if (ci_pdata->dr_mode == USB_DR_MODE_UNKNOWN) + ci_pdata->dr_mode = USB_DR_MODE_OTG; + + if (ci_pdata->dr_mode != USB_DR_MODE_PERIPHERAL) { + if (!ci_pdata->reg_vbus) { + ret = ci_hdrc_get_regulator(dev, ci_pdata); +
[PATCH 6/6] usb: chipidea: remove obsolete ci_get_platdata function
The addition of the ci_hdrc_get_platdata function makes the use of ci_get_platdata obsolete. Remove it. Signed-off-by: Antoine Tenart --- drivers/usb/chipidea/core.c | 41 - 1 file changed, 41 deletions(-) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 0ad55c10a903..8562a9c6154d 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -498,43 +498,6 @@ static irqreturn_t ci_irq(int irq, void *data) return ret; } -static int ci_get_platdata(struct device *dev, - struct ci_hdrc_platform_data *platdata) -{ - if (!platdata->phy_mode) - platdata->phy_mode = of_usb_get_phy_mode(dev->of_node); - - if (!platdata->dr_mode) - platdata->dr_mode = of_usb_get_dr_mode(dev->of_node); - - if (platdata->dr_mode == USB_DR_MODE_UNKNOWN) - platdata->dr_mode = USB_DR_MODE_OTG; - - if (platdata->dr_mode != USB_DR_MODE_PERIPHERAL) { - /* Get the vbus regulator */ - platdata->reg_vbus = devm_regulator_get(dev, "vbus"); - if (PTR_ERR(platdata->reg_vbus) == -EPROBE_DEFER) { - return -EPROBE_DEFER; - } else if (PTR_ERR(platdata->reg_vbus) == -ENODEV) { - /* no vbus regualator is needed */ - platdata->reg_vbus = NULL; - } else if (IS_ERR(platdata->reg_vbus)) { - dev_err(dev, "Getting regulator error: %ld\n", - PTR_ERR(platdata->reg_vbus)); - return PTR_ERR(platdata->reg_vbus); - } - /* Get TPL support */ - if (!platdata->tpl_support) - platdata->tpl_support = - of_usb_host_tpl_support(dev->of_node); - } - - if (of_usb_get_maximum_speed(dev->of_node) == USB_SPEED_FULL) - platdata->flags |= CI_HDRC_FORCE_FULLSPEED; - - return 0; -} - /* * Getting a PHY or an USB PHY is optional: * If no PHY or USB PHY is found, or if their subsystems aren't enabled, @@ -673,10 +636,6 @@ struct platform_device *ci_hdrc_add_device(struct device *dev, struct platform_device *pdev; int id, ret; - ret = ci_get_platdata(dev, platdata); - if (ret) - return ERR_PTR(ret); - id = ida_simple_get(&ci_ida, 0, 0, GFP_KERNEL); if (id < 0) return ERR_PTR(id); -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/6] usb: chipidea: use ci_hdrc_get_platdata in ci_hdrc_imx
Use the newly introduced ci_hdrc_get_platdata function to help setup the chipidea internal ci_hdrc_platform_data structure. Signed-off-by: Antoine Tenart --- drivers/usb/chipidea/ci_hdrc_imx.c | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c index 6f8b1b1045b5..25f3b465cb73 100644 --- a/drivers/usb/chipidea/ci_hdrc_imx.c +++ b/drivers/usb/chipidea/ci_hdrc_imx.c @@ -103,7 +103,8 @@ static struct imx_usbmisc_data *usbmisc_get_init_data(struct device *dev) static int ci_hdrc_imx_probe(struct platform_device *pdev) { struct ci_hdrc_imx_data *data; - struct ci_hdrc_platform_data pdata = { + struct ci_hdrc_platform_data *ci_pdata; + struct ci_hdrc_platform_data ci_pdata_default = { .name = dev_name(&pdev->dev), .capoffset = DEF_CAPOFFSET, .flags = CI_HDRC_REQUIRE_TRANSCEIVER | @@ -114,6 +115,10 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) of_match_device(ci_hdrc_imx_dt_ids, &pdev->dev); const struct ci_hdrc_imx_platform_flag *imx_platform_flag = of_id->data; + ci_pdata = ci_hdrc_get_platdata(&pdev->dev, &ci_pdata_default); + if (IS_ERR(ci_pdata)) + return PTR_ERR(ci_pdata); + data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); if (!data) { dev_err(&pdev->dev, "Failed to allocate ci_hdrc-imx data!\n"); @@ -147,10 +152,10 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) goto err_clk; } - pdata.usb_phy = data->phy; + ci_pdata->usb_phy = data->phy; if (imx_platform_flag->flags & CI_HDRC_IMX_IMX28_WRITE_FIX) - pdata.flags |= CI_HDRC_IMX28_WRITE_FIX; + ci_pdata->flags |= CI_HDRC_IMX28_WRITE_FIX; ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); if (ret) @@ -166,8 +171,7 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) } data->ci_pdev = ci_hdrc_add_device(&pdev->dev, - pdev->resource, pdev->num_resources, - &pdata); + pdev->resource, pdev->num_resources, ci_pdata); if (IS_ERR(data->ci_pdev)) { ret = PTR_ERR(data->ci_pdev); dev_err(&pdev->dev, -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/6] usb: chipidea: use ci_hdrc_get_platdata in ci_hdrc_msm
Use the newly introduced ci_hdrc_get_platdata function to help setup the chipidea internal ci_hdrc_platform_data structure. Signed-off-by: Antoine Tenart --- drivers/usb/chipidea/ci_hdrc_msm.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/usb/chipidea/ci_hdrc_msm.c b/drivers/usb/chipidea/ci_hdrc_msm.c index 3edf969ed797..32eeab404911 100644 --- a/drivers/usb/chipidea/ci_hdrc_msm.c +++ b/drivers/usb/chipidea/ci_hdrc_msm.c @@ -55,10 +55,15 @@ static struct ci_hdrc_platform_data ci_hdrc_msm_platdata = { static int ci_hdrc_msm_probe(struct platform_device *pdev) { struct platform_device *plat_ci; + struct ci_hdrc_platform_data *ci_pdata; struct usb_phy *phy; dev_dbg(&pdev->dev, "ci_hdrc_msm_probe\n"); + ci_pdata = ci_hdrc_get_platdata(&pdev->dev, &ci_hdrc_msm_platdata); + if (IS_ERR(ci_pdata)) + return PTR_ERR(ci_pdata); + /* * OTG(PHY) driver takes care of PHY initialization, clock management, * powering up VBUS, mapping of registers address space and power @@ -68,11 +73,10 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev) if (IS_ERR(phy)) return PTR_ERR(phy); - ci_hdrc_msm_platdata.usb_phy = phy; + ci_pdata->usb_phy = phy; plat_ci = ci_hdrc_add_device(&pdev->dev, - pdev->resource, pdev->num_resources, - &ci_hdrc_msm_platdata); + pdev->resource, pdev->num_resources, ci_pdata); if (IS_ERR(plat_ci)) { dev_err(&pdev->dev, "ci_hdrc_add_device failed!\n"); return PTR_ERR(plat_ci); -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 01/20] usb: dwc3: enable hibernation if to be supported
On Thu, Oct 30, 2014 at 12:35:56PM +0100, Arnd Bergmann wrote: > On Thursday 30 October 2014 18:08:26 Huang Rui wrote: > > It enables hibernation if the function is set in coreConsultant. > > > > Suggested-by: Felipe Balbi > > Signed-off-by: Huang Rui > > Signed-off-by: Felipe Balbi > > > > Something went wrong with the Signed-off-by lines here. > You should never add someone else's Signed-off-by below yours. > > I took a brief look at the entire series and the patches all look good > to me, but you have made the same mistake with the Signed-off-by > multiple times. > Actually, this patch is applied at testing branch, so Felipe added his Signed-off-by. Please see: http://git.kernel.org/cgit/linux/kernel/git/balbi/usb.git/commit/?h=testing/next&id=5c9669f92c9441d134f7776274e9afb71c246acc I just update some comment description in V4. Thanks, Rui -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/6] usb: chipidea: setup ci_hdrc_platform_data in core driver
On Thu, Oct 30, 2014 at 12:36:41PM +0100, Antoine Tenart wrote: > Hello, > > This series introduce the ci_hdrc_get_platdata function to help setting up the > ChipIdea internal ci_hdrc_platform_data structure. This helps avoiding > duplicating code. > > This series comes from a duscission on Berlin's USB pacthes where it was asked > to move the PHY phandle handling in the ChipIdea core[1]. > > With the introduction of the ci_hdrc_get_platdata function, the old > ci_get_platdata function is removed. Changes in ChipIdea drivers have also > been > made. > > This series is needed for the Berlin USB support and has been tested with an > updated version of the USB Berlin driver (not in mainline yet). > > Thanks, > > Antoine > > [1] > http://lists.infradead.org/pipermail/linux-arm-kernel/2014-October/292383.html > Of course, this is the cover letter so it should be [PATCH 0/6]. This series depends on the generic PHY framework support in USB and CI: https://lkml.org/lkml/2014/10/28/807 Antoine -- Antoine Ténart, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] USB: kobil_sct: Remove unused transfer buffer allocs
Hi Peter, Forgot to reply to this one. On Wed, Oct 22, 2014 at 07:40:20AM -0400, Peter Hurley wrote: > On 10/19/2014 01:12 PM, Johan Hovold wrote: > > [ +CC: Jiri, Alan, linux-serial ] > > > > On Thu, Oct 16, 2014 at 02:09:29PM -0400, Peter Hurley wrote: > >> On 10/16/2014 01:59 PM, Peter Hurley wrote: > >>> @@ -541,10 +531,6 @@ static int kobil_ioctl(struct tty_struct *tty, > >>> > >>> switch (cmd) { > >>> case TCFLSH: > >>> - transfer_buffer = kmalloc(transfer_buffer_length, GFP_KERNEL); > >>> - if (!transfer_buffer) > >>> - return -ENOBUFS; > >>> - > >>> result = usb_control_msg(port->serial->dev, > >>> usb_sndctrlpipe(port->serial->dev, 0), > >>> SUSBCRequest_Misc, > >>> @@ -559,7 +545,6 @@ static int kobil_ioctl(struct tty_struct *tty, > >>> dev_dbg(&port->dev, > >>> "%s - Send reset_all_queues (FLUSH) URB returns: %i\n", > >>> __func__, result); > >>> - kfree(transfer_buffer); > >>> return (result < 0) ? -EIO: 0; > >>^^^ > >> Returning 0 is almost certainly wrong; no further processing for > >> TCFLSH is performed. > > > > Indeed. > > > >> Only this driver returns 0 (of all the tty drivers in mainline). > >> > >> Returning -ENOIOCTLCMD allows further processing to continue; > >> especially the line discipline's input flushing, if TCIFLUSH/TCIOFLUSH. > > > > That doesn't seem like a very good idea, and only two *staging* drivers > > try to play such games (i.e. pretending not to implement the ioctl) as > > far as I can see. > > Well, returning EIONOCTLCMD is the standard method of ioctl passthrough > from driver to line discipline. I disagree with you there. AFAICS only these two staging drivers are abusing the meaning of EIONOCTLCMD (unrecognised ioctl) to have the line discipline also act on the ioctl. > Since driver 'input buffer' flushing is not currently supported by the > core, this seems the only available workaround. That is true. But I doubt we should use these two staging drivers as a model for how this should be handled, if it's at all needed. > > The only non-staging tty driver which appears to implement TCFLSH, > > ipwireless, calls tty_perform_flush directly to flush the ldisc buffers. > > That doesn't seem right either. > > I'm not sure why ipwireless does this; I can only guess that it's a > workaround for some line discipline that doesn't use n_tty_ioctl_helper(). > > > Shouldn't this be fixed by removing TCFLSH from these tty drivers' > > ioctl callbacks and implementing flush_buffer()? > > > > The staging drivers also flush a device input buffer, which could be > > done in a new callback if at all needed. > > Yeah, that's why the Digi staging drivers are trapping TCFLSH; so they > can clear input buffers on TCIFLUSH/TCIOFLUSH. > > I'd like to better understand the hardware and driver before extending > the core interface; this driver may not even run. Agreed. > For example, this driver clears its 'input buffer' for > tcsetattr(TCSADRAIN or TCSAFLUSH). But that doesn't make sense considering > that the flip buffers could have data in them that isn't flushed; the tty > core doesn't dump the flip buffers because 'input processing' has not > happened on that data. > > I think when/if these drivers are promoted is when/if the core interface > should address this. Just my opinion, though :) I agree. Johan -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] USB: kobil_sct: Remove unused transfer buffer allocs
On 10/30/2014 08:08 AM, Johan Hovold wrote: > Hi Peter, > > Forgot to reply to this one. > > On Wed, Oct 22, 2014 at 07:40:20AM -0400, Peter Hurley wrote: >> On 10/19/2014 01:12 PM, Johan Hovold wrote: >>> [ +CC: Jiri, Alan, linux-serial ] >>> >>> On Thu, Oct 16, 2014 at 02:09:29PM -0400, Peter Hurley wrote: On 10/16/2014 01:59 PM, Peter Hurley wrote: > > @@ -541,10 +531,6 @@ static int kobil_ioctl(struct tty_struct *tty, > > switch (cmd) { > case TCFLSH: > - transfer_buffer = kmalloc(transfer_buffer_length, GFP_KERNEL); > - if (!transfer_buffer) > - return -ENOBUFS; > - > result = usb_control_msg(port->serial->dev, > usb_sndctrlpipe(port->serial->dev, 0), > SUSBCRequest_Misc, > @@ -559,7 +545,6 @@ static int kobil_ioctl(struct tty_struct *tty, > dev_dbg(&port->dev, > "%s - Send reset_all_queues (FLUSH) URB returns: %i\n", > __func__, result); > - kfree(transfer_buffer); > return (result < 0) ? -EIO: 0; ^^^ Returning 0 is almost certainly wrong; no further processing for TCFLSH is performed. >>> >>> Indeed. >>> Only this driver returns 0 (of all the tty drivers in mainline). Returning -ENOIOCTLCMD allows further processing to continue; especially the line discipline's input flushing, if TCIFLUSH/TCIOFLUSH. >>> >>> That doesn't seem like a very good idea, and only two *staging* drivers >>> try to play such games (i.e. pretending not to implement the ioctl) as >>> far as I can see. >> >> Well, returning EIONOCTLCMD is the standard method of ioctl passthrough >> from driver to line discipline. > > I disagree with you there. AFAICS only these two staging drivers are > abusing the meaning of EIONOCTLCMD (unrecognised ioctl) to have the > line discipline also act on the ioctl. Sorry, I wasn't as clear as I should have been here. My point was that every driver gets ioctl(TCFLSH) and returns ENOIOCTLCMD so that the line discipline will handle it. You're absolutely correct, in that, only these drivers (and ipwireless) doing anything with TCFLSH >> Since driver 'input buffer' flushing is not currently supported by the >> core, this seems the only available workaround. > > That is true. But I doubt we should use these two staging drivers as a > model for how this should be handled, if it's at all needed. Right. My comments implied approval of the design, which I don't. The main problem with the existing design is that it allows for a significant variation in how ioctl(WHATEVER) is handled by various driver/ldisc combinations. That's a bad thing because it makes audit/review really time-consuming and makes changes prone to userspace regressions. Regards, Peter Hurley -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH RESEND V4 2/9] mailbox: Add NVIDIA Tegra XUSB mailbox driver
On Wed, Oct 29, 2014 at 11:02:36AM -0700, Andrew Bresticker wrote: [...] > > Maybe something like this patch would be more correct in handling > > this: > > > > diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c > > index afcb430508ec..85691a7d8ca6 100644 > > --- a/drivers/mailbox/mailbox.c > > +++ b/drivers/mailbox/mailbox.c > > @@ -117,10 +117,11 @@ static void poll_txdone(unsigned long data) > > struct mbox_chan *chan = &mbox->chans[i]; > > > > if (chan->active_req && chan->cl) { > > - resched = true; > > txdone = chan->mbox->ops->last_tx_done(chan); > > if (txdone) > > tx_tick(chan, 0); > > + else > > + resched = true; > > } > > } > > ... but we still need to re-arm the timer if tx_tick() submits another > message. Perhaps the better thing to do is to have msg_submit() arm > the timer. I think we need both. If the last transmission isn't done yet we still want to keep polling. And we also want to poll if a new message is sent subsequently. Perhaps it would be as easy as moving the poll handling code from mbox_send_message() (if (chan->txdone_method == TXDONE_BY_POLL)) into msg_submit()? That has the additional advantage of being able to omit the polling when an error happens during the mbox' .send_data(). > >> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > >> + if (!res) > >> + return -ENODEV; > >> + mbox->regs = devm_ioremap(&pdev->dev, res->start, > >> resource_size(res)); > >> + if (!mbox->regs) > >> + return -ENOMEM; > > > > This doesn't look right. Upon closer inspection, the reason why you > > don't use devm_request_resource() is because these registers are shared > > with the XHCI controller. > > > > Perhaps a better design would be for the XHCI driver to expose the > > mailbox rather than split it off into a separate driver. > > Well that's what I had originally, but then it was suggested I make it > a separate driver. > > Stephen also brought this up during review and suggested that some > sort of MFD would be the best way to structure this, but was fine with > the way I have it now. I can move this driver around (again) if you > feel that strongly about it... We've had this discussion only recently about the memory controller driver. It used to be that there were separate drivers for the memory controller part and the IOMMU part. But that resulted in hilarious DT bindings. Granted, most of the issues had to do with unfortunate inter- leaving of register regions, but generally I think there's nothing wrong with exposing multiple interfaces from a single driver. The downside of course is that you have to choose which subsystem is the primary one and then get it merged via that tree. There's also a problem in that the driver is now in a different directory than the others, so a subsystem-wide change may not notice the "out-of-place" driver. But I think we have pretty good tools to help with this type of thing. Also, managing all the resources (regulators, clocks, resets, ...) that a hardware block requires is much easier to do in a single driver than spread over several. MFD could be an option somewhere halfway between the two but also has some downsides. Most importantly it isn't going to scale in the long run. > >> diff --git a/include/soc/tegra/xusb.h b/include/soc/tegra/xusb.h > >> new file mode 100644 > >> index 000..cfe211d > >> --- /dev/null > >> +++ b/include/soc/tegra/xusb.h > > > > Perhaps this should really be named xusb-mbox.h? > > I'd prefer to leave it as xusb.h so that any other XUSB-related > definitions can be left here. Okay, that makes sense given that the mbox really is part of the larger XUSB block. Thierry pgpLWf84m7vJo.pgp Description: PGP signature
Re: [PATCH usb 00/32] cleanup on resource check
On Thu, Oct 30, 2014 at 09:08:45AM +0530, Varka Bhadram wrote: > On 10/30/2014 09:05 AM, Varka Bhadram wrote: > >Hi Balbi, > > > >On 10/30/2014 08:13 AM, Felipe Balbi wrote: > > > >>Hi, > >> > >>On Thu, Oct 30, 2014 at 06:42:08AM +0530, Varka Bhadram wrote: > >>>On Thursday 30 October 2014 02:43 AM, Alan Stern wrote: > On Wed, 29 Oct 2014, Varka Bhadram wrote: > > >This series removes the duplication of sanity check for > >platform_get_resource() return resource. It will be checked > >with devm_ioremap_resource() > > > >This series based on usb/master. > > > >Varka Bhadram (32): > > host: ehci-atmel: remove duplicate check on resource > > host: ehci-exynos: remove duplicate check on resource > > host: ehci-fsl: remove duplicate check on resource > > dwc3: core: remove duplicate check on resource > > dwc3: dwc3-keystone: remove duplicate check on resource > > renesas_usbhs: common: remove duplicate check on resource > > phy: phy-rcar-usb: remove duplicate check on resource > > musb: musb_dsps: remove duplicate check on resource > > musb: musb_core: remove duplicate check on resource > > host: xhci-plat: remove duplicate check on resource > > host: uhci-platform: remove duplicate check on resource > > host: ohci-st: remove duplicate check on resource > > host: ohci-spear: remove duplicate check on resource > > host: ehci-sh: remove duplicate check on resource > > host: ohci-pxa27x: remove duplicate check on resource > > host: ohci-platform: remove duplicate check on resource > > host: ohci-octeon: remove duplicate check on resource > > host: ohci-jz4740: remove duplicate check on resource > > host: ohci-exynos: remove duplicate check on resource > > host: ohci-da8xx: remove duplicate check on resource > > host: ohci-at91: remove duplicate check on resource > > host: ehci-w90x900: remove duplicate check on resource > > host: ehci-tegra: remove duplicate check on resource > > host: ehci-st: remove duplicate check on resource > > host: ehci-spear: remove duplicate check on resource > > host: ehci-sead3: remove duplicate check on resource > > host: ehci-platform: remove duplicate check on resource > > host: ehci-orion: remove duplicate check on resource > > host: ehci-octeon: remove duplicate check on resource > > host: ehci-mxc: remove duplicate check on resource > > host: ehci-mv: remove duplicate check on resource > > host: ehci-msm: remove duplicate check on resource > For all the ehci, ohci, and uhci changes: > > Acked-by: Alan Stern > >>>Thanx for your ACK. > >>> > I didn't look carefully at the others, but the dwc3-core patch (4/32) > definitely seemed wrong. > > >>>I don't find any wrong in the code. > >>Really ? Look more carefuly > >> > >>>static int dwc3_probe(struct platform_device *pdev) > >>>{ > >>>struct device*dev = &pdev->dev; > >>>struct dwc3_platform_data *pdata = dev_get_platdata(dev); > >>>struct device_node*node = dev->of_node; > >>>struct resource*res; > >>>struct dwc3*dwc; > >>> > >>>intret; > >>> > >>>void __iomem*regs; > >>>void*mem; > >>> > >>>mem = devm_kzalloc(dev, sizeof(*dwc) + DWC3_ALIGN_MASK, > >>>GFP_KERNEL); > >>>if (!mem) > >>>return -ENOMEM; > >>> > >>>dwc = PTR_ALIGN(mem, DWC3_ALIGN_MASK + 1); > >>>dwc->mem = mem; > >>>dwc->dev = dev; > >>> > >>>res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); > >>>if (!res) { > >>>dev_err(dev, "missing IRQ\n"); > >>>return -ENODEV; > >>>} > >>>dwc->xhci_resources[1].start = res->start; > >>>dwc->xhci_resources[1].end = res->end; > >>>dwc->xhci_resources[1].flags = res->flags; > >>>dwc->xhci_resources[1].name = res->name; > >>> > >>>res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > >>>/* > >>> * Request memory region but exclude xHCI regs, > >>> * since it will be requested by the xhci-plat driver. > >>> */ > >>>regs = devm_ioremap_resource(dev, res); > >>because you moved this call here... > >> > >>>if (IS_ERR(regs)) > >>>return PTR_ERR(regs); > >>> > >>>dwc->xhci_resources[0].start = res->start; > >>>dwc->xhci_resources[0].end = dwc->xhci_resources[0].start + > >>>DWC3_XHCI_REGS_END; > >>>dwc->xhci_resources[0].flags = res->flags; > >>>dwc->xhci_resources[0].name = res->name; > >>> > >>>res->start += DWC3_GLOBALS_REGS_START; > >>... before doing this, you're now ioremapping the entire space > >>*INCLUDING* the XHCI address space, which means that you have just > >>broken every single platform using this driver in host mode. > >> > >In that case, i will drop this patch. > > > >Is other patches are fine except #04/32 patch..? > > > Can i add yo
Re: [PATCH RESEND V4 4/9] pinctrl: tegra-xusb: Add USB PHY support
On Wed, Oct 29, 2014 at 12:43:36PM -0700, Andrew Bresticker wrote: > >> diff --git a/drivers/pinctrl/pinctrl-tegra-xusb.c > >> b/drivers/pinctrl/pinctrl-tegra-xusb.c [...] > >> + > >> + for (i = 0; i < TEGRA_XUSB_USB3_PHYS; i++) { > >> + if (phy == padctl->phys[TEGRA_XUSB_PADCTL_USB3_P0 + i]) > >> + break; > > > > You could simply return i here and then BUG_ON unconditionally. > > > >> + } > >> + BUG_ON(i == TEGRA_XUSB_USB3_PHYS); > >> + > >> + return i; > >> +} > > > > Actually, thinking about it some more, perhaps making this a WARN_ON() > > and returning an error so that we can continue and propagate the error > > would be more useful. BUG_ON() will completely hang the kernel with no > > way out but rebooting. WARN_ON() will give a hint about something being > > wrong and returning an error will allow the kernel to continue to run, > > which might be the only way to diagnose and fix the problem, even if it > > means that USB 3.0 support will be disabled. > > I felt like BUG_ON is more appropriate here. Hitting this case means > there's a bug in the PHY core or a driver has passed a bogus pointer > and the stack dump produced by the BUG_ON should make it obvious as to > what the issue is. I don't feel too strongly about it though. The problem with BUG_ON() is that you won't be able to go any further. So if this were to happen on a device with no serial you might not even get to a point where you actually see an error message. Handling this more gracefully by propagating the error code and failing .probe() does not seem overly complicated and the WARN_ON() output will hopefully still be noticed (it probably will be after the user can't get USB to work). Consider for example the case where a user has only one device to test and report bugs on. If we crash the device using BUG_ON() they may not be able to report a bug at all (or recover by reverting to some known good kernel version). A WARN_ON() will hopefully be enough to get noticed and unless users rely on XUSB for the root filesystem they'd still be able to open up a web browser and file a bug report with the oops attached. > >> + u32 value, offset; > >> + > >> + padctl->usb3_ports[port].context_saved = true; > > > > What's the purpose of saving the context here? This seems to be > > triggered by a request from XUSB, but it's then restored when the PHY is > > powered on. How does that even happen? Won't the PHY stay powered all > > the time? Or shouldn't the context be saved when powering off the PHY? > > Right, context is saved when requested by the XUSB controller and > restored on power on. This is used during runtime power-gating or LP0 > where the PHYs are powered off and on and this context is lost. > Neither of these are currently implemented by the host driver, > however. > > As far as why the context is saved upon request and not at power off, > I'm not sure. I've observed that these messages come in when a USB3.0 > device is enumerated. Perhaps the XUSB controller is doing some sort > of tuning. I see. Perhaps these values are calibrated by the firmware? In that case I guess it could redo the calibration. I'll see if I can find out why it is necessary to store this. > > >> @@ -936,6 +2098,18 @@ static int tegra_xusb_padctl_probe(struct > >> platform_device *pdev) > >> goto unregister; > >> } > >> > >> + INIT_WORK(&padctl->mbox_req_work, tegra_xusb_phy_mbox_work); > >> + padctl->mbox_client.dev = &pdev->dev; > >> + padctl->mbox_client.tx_block = true; > >> + padctl->mbox_client.tx_tout = 0; > >> + padctl->mbox_client.rx_callback = tegra_xusb_phy_mbox_rx; > >> + padctl->mbox_chan = mbox_request_channel(&padctl->mbox_client, 0); > >> + if (IS_ERR(padctl->mbox_chan)) { > >> + err = PTR_ERR(padctl->mbox_chan); > >> + dev_err(&pdev->dev, "failed to request mailbox: %d\n", err); > >> + goto unregister; > >> + } > > > > I think this should be done before the registering the PHY provider so > > that we don't expose one (even for only a very short time) before we > > haven't made sure that it can be used. > > > > Also, this effectively makes the mailbox mandatory, which means that the > > above code is going to break on older DTBs. So I think we have no choice > > but to make mailbox (and hence XUSB) support optional. > > I understand the need for binding stability, but it's not like these > bindings have been around for very long (a release or two?) and this > series has existed for almost the same amount of time. Are there > really any DTBs out there that are going to break because of this? Every DTB created from a kernel version that has the original binding but not the one modified as part of this series is going to break. Last time I checked there weren't any exceptions to this rule. Note, though, that the rule is that existing functionality must not break. That is, SATA and PCIe should
Re: [PATCH RESEND V4 5/9] of: Add NVIDIA Tegra xHCI controller binding
On Wed, Oct 29, 2014 at 09:37:14AM -0700, Andrew Bresticker wrote: > On Wed, Oct 29, 2014 at 2:43 AM, Thierry Reding > wrote: > > On Tue, Oct 28, 2014 at 03:27:50PM -0700, Andrew Bresticker wrote: > > [...] > >> diff --git > >> a/Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-xusb-padctl.txt > >> > >> b/Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-xusb-padctl.txt > > [...] > >> +Optional properties: > >> +--- > >> +- vbus-{0,1,2}-supply: VBUS regulator for the corresponding UTMI pad. > >> +- vddio-hsic-supply: VDDIO regulator for the HSIC pads. > >> +- nvidia,usb3-port-{0,1}-lane: PCIe/SATA lane to which the corresponding > >> USB3 > >> + port is mapped. See for the > >> list > >> + of valid values. > > > > I dislike how we now need to provide a list of all pins in the header > > file, where previously we used strings for this. This could become very > > ugly if the set of pins changes in future generations of this IP block. > > > > Could we instead derive this from the pinmux nodes? For example you have > > this in the example below: > > > > usb3p0 { > > nvidia,lanes = "pcie-0"; > > ... > > }; > > > > Perhaps what we need is to either key off the node name or add another > > property, such as: > > > > nvidia,usb3-port = <0>; > > > > This would match the nvidia,usb2-port property that you've added below. > > That is actually how I described the USB3 port to SS lane mapping > originally, but in review of an earlier version of this series, > Stephen suggested that I make it a separate, not pinconfig property > since it wasn't a value written directly to the hardware. I'm fine > with changing it back as the pinconfig property makes more sense to me > as well. Hmm... I had considered it a mux option of the specific lane. If the function is usb3, it'd still need to be muxed to one of the ports. So it's additional information associated with the usb3 function. I did look through the driver changes and can't really make out which part of the code actually performs this assignment. Can you point me to it? Thierry pgpaADdjFNOFz.pgp Description: PGP signature
Re: [PATCHv6 1/8] usb: dwc2: Update the gadget driver to use common dwc2_hsotg structure
On Tue, Oct 28, 2014 at 06:25:42PM -0500, dingu...@opensource.altera.com wrote: > From: Dinh Nguyen > > Adds the gadget data structure and appropriate data structure pointers > to the common dwc2_hsotg data structure. To keep the driver data > dereference code looking clean, the gadget variable declares are only > available > for peripheral and dual-role mode. This is needed so that the dwc2_hsotg data > structure can be used by the hcd and gadget drivers. > > Updates gadget.c to use the dwc2_hsotg data structure and gadget pointers > that have been moved into the common dwc2_hsotg structure. > > Signed-off-by: Dinh Nguyen > Signed-off-by: Paul Zimmerman > --- > v5: Keep the changes to mininum and maintain hcd and gadget driver to build > and work separately. Use IS_ENABLED() instead of #if defined > v3: Updated with paulz's suggestion to avoid double pointers. > v2: Left the function parameter name as 'hsotg' and just changed its type. > --- > drivers/usb/dwc2/core.h | 156 > -- > drivers/usb/dwc2/gadget.c | 145 +- > 2 files changed, 154 insertions(+), 147 deletions(-) > > diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h > index 55c90c5..96c283d 100644 > --- a/drivers/usb/dwc2/core.h > +++ b/drivers/usb/dwc2/core.h > @@ -84,7 +84,7 @@ static const char * const s3c_hsotg_supply_names[] = { > */ > #define EP0_MPS_LIMIT 64 > > -struct s3c_hsotg; > +struct dwc2_hsotg; > struct s3c_hsotg_req; > > /** > @@ -130,7 +130,7 @@ struct s3c_hsotg_req; > struct s3c_hsotg_ep { > struct usb_ep ep; > struct list_headqueue; > - struct s3c_hsotg*parent; > + struct dwc2_hsotg *parent; > struct s3c_hsotg_req*req; > struct dentry *debugfs; > > @@ -155,67 +155,6 @@ struct s3c_hsotg_ep { > }; > > /** > - * struct s3c_hsotg - driver state. > - * @dev: The parent device supplied to the probe function > - * @driver: USB gadget driver > - * @phy: The otg phy transceiver structure for phy control. > - * @uphy: The otg phy transceiver structure for old USB phy control. > - * @plat: The platform specific configuration data. This can be removed once > - * all SoCs support usb transceiver. > - * @regs: The memory area mapped for accessing registers. > - * @irq: The IRQ number we are using > - * @supplies: Definition of USB power supplies > - * @phyif: PHY interface width > - * @dedicated_fifos: Set if the hardware has dedicated IN-EP fifos. > - * @num_of_eps: Number of available EPs (excluding EP0) > - * @debug_root: root directrory for debugfs. > - * @debug_file: main 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 > - * @last_rst: Time of last reset > - * @eps: The endpoints being supplied to the gadget framework > - */ > -struct s3c_hsotg { > - struct device*dev; > - struct usb_gadget_driver *driver; > - struct phy *phy; > - struct usb_phy *uphy; > - struct s3c_hsotg_plat*plat; > - > - spinlock_t lock; > - > - void __iomem*regs; > - int irq; > - struct clk *clk; > - > - struct regulator_bulk_data supplies[ARRAY_SIZE(s3c_hsotg_supply_names)]; > - > - u32 phyif; > - int fifo_mem; > - unsigned intdedicated_fifos:1; > - unsigned char num_of_eps; > - u32 fifo_map; > - > - struct dentry *debug_root; > - struct dentry *debug_file; > - struct dentry *debug_fifo; > - > - struct usb_request *ep0_reply; > - struct usb_request *ctrl_req; > - u8 ep0_buff[8]; > - u8 ctrl_buff[8]; > - > - struct usb_gadget gadget; > - unsigned intsetup; > - unsigned long last_rst; > - struct s3c_hsotg_ep *eps; > -}; > - > -/** > * struct s3c_hsotg_req - data transfer request > * @req: The USB gadget request > * @queue: The list of requests for the endpoint this is queued for. > @@ -229,6 +168,7 @@ struct s3c_hsotg_req { > unsigned char mapped; > }; > > +#if IS_ENABLED(CONFIG_USB_DWC2_PERIPHERAL) || > IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE) > #define call_gadget(_hs, _entry) \ > do { \ > if ((_hs)->gadget.speed != USB_SPEED_UNKNOWN && \ > @@ -238,6 +178,9 @@ do { \ > spin_lock(&_hs->lock); \ > } \ > } while (0) > +#else > +#define call_gadget(_hs, _entry) do {} while (0) > +#endif > > struct dwc2_hsotg; > struct dwc2_host_chan; > @@ -495,11 +43
Re: [PATCHv6 2/8] usb: dwc2: Move gadget probe function into platform code
On Tue, Oct 28, 2014 at 06:25:43PM -0500, dingu...@opensource.altera.com wrote: > From: Dinh Nguyen > > This patch will aggregate the probing of gadget/hcd driver into platform.c. > The gadget probe funtion is converted into gadget_init that is now only > responsible for gadget only initialization. All the gadget resources is now s/resources is/resources are > handled by platform.c > > Since the host workqueue will not get initialized if the driver is configured > for peripheral mode only. Thus we need to check for wq_otg before calling > queue_work(). this period character in the middle of the sentence doesn't make sense, perhaps a comma is what you want ? The sentence can be improved too: "Since the host workqueue will not get initialized if the drier is configured for peripheral mode only, we add a check for wq_otg before calling queue_work()." > Also, we move spin_lock_init to common location for both host and gadget that > is either in platform.c or pci.c. > > We also ove suspend/resume code to common platform code, and update it to use > the new PM API (struct dev_pm_ops). updating to dev_pm_ops should really be a separate patch. -- balbi signature.asc Description: Digital signature
Re: [PATCHv6 4/8] usb: dwc2: Update common interrupt handler to call gadget interrupt handler
Hi, On Tue, Oct 28, 2014 at 06:25:45PM -0500, dingu...@opensource.altera.com wrote: > From: Dinh Nguyen > > Make dwc2_handle_common_intr call the gadget interrupt function when operating > in peripheral mode. Remove the spinlock functions in s3c_hsotg_irq as > dwc2_handle_common_intr() already has the spinlocks. > > Move the registeration of the IRQ to common code for platform and PCI. > > Remove duplicate interrupt conditions that was in gadget, as those are handled > by dwc2 common interrupt handler. > > Signed-off-by: Dinh Nguyen > Acked-by: Paul Zimmerman > --- > v5: remove individual devm_request_irq from gadget and hcd, and place a > single devm_request_irq in platform and pci. > v2: Keep interrupt handler for host and peripheral modes separate > --- > drivers/usb/dwc2/core.c | 10 > drivers/usb/dwc2/core.h | 3 +++ > drivers/usb/dwc2/core_intr.c | 3 +++ > drivers/usb/dwc2/gadget.c| 57 > ++-- > drivers/usb/dwc2/pci.c | 6 + > drivers/usb/dwc2/platform.c | 9 +++ > 6 files changed, 23 insertions(+), 65 deletions(-) > > diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c > index d926945..7605850b 100644 > --- a/drivers/usb/dwc2/core.c > +++ b/drivers/usb/dwc2/core.c > @@ -458,16 +458,6 @@ int dwc2_core_init(struct dwc2_hsotg *hsotg, bool > select_phy, int irq) > /* Clear the SRP success bit for FS-I2c */ > hsotg->srp_success = 0; > > - if (irq >= 0) { > - dev_dbg(hsotg->dev, "registering common handler for irq%d\n", > - irq); > - retval = devm_request_irq(hsotg->dev, irq, > - dwc2_handle_common_intr, IRQF_SHARED, > - dev_name(hsotg->dev), hsotg); > - if (retval) > - return retval; > - } > - > /* Enable common interrupts */ > dwc2_enable_common_interrupts(hsotg); > > diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h > index 80d29c7..ec70862 100644 > --- a/drivers/usb/dwc2/core.h > +++ b/drivers/usb/dwc2/core.h > @@ -967,6 +967,7 @@ 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(struct dwc2_hsotg *dwc2); > +irqreturn_t s3c_hsotg_irq(int irq, void *pw); > #else > static inline int s3c_hsotg_remove(struct dwc2_hsotg *dwc2) > { return 0; } > @@ -977,6 +978,8 @@ static inline int s3c_hsotg_resume(struct dwc2_hsotg > *dwc2) > static inline int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq) > { return 0; } > static inline void s3c_hsotg_core_init(struct dwc2_hsotg *dwc2) {} > +static inline irqreturn_t s3c_hsotg_irq(int irq, void *pw) > +{ return IRQ_HANDLED; } > #endif > > #if IS_ENABLED(CONFIG_USB_DWC2_HOST) || IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE) > diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c > index b176c2f..b0c14e0 100644 > --- a/drivers/usb/dwc2/core_intr.c > +++ b/drivers/usb/dwc2/core_intr.c > @@ -474,6 +474,9 @@ irqreturn_t dwc2_handle_common_intr(int irq, void *dev) > > spin_lock(&hsotg->lock); > > + if (dwc2_is_device_mode(hsotg)) > + retval = s3c_hsotg_irq(irq, dev); > + > gintsts = dwc2_read_common_intr(hsotg); > if (gintsts & ~GINTSTS_PRTINT) > retval = IRQ_HANDLED; > diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c > index 19d1b03..202f8cc 100644 > --- a/drivers/usb/dwc2/gadget.c > +++ b/drivers/usb/dwc2/gadget.c > @@ -2257,14 +2257,13 @@ void s3c_hsotg_core_init(struct dwc2_hsotg *hsotg) > * @irq: The IRQ number triggered > * @pw: The pw value when registered the handler. > */ > -static irqreturn_t s3c_hsotg_irq(int irq, void *pw) > +irqreturn_t s3c_hsotg_irq(int irq, void *pw) why ? It would've been a lot easier to just make the IRQ line shared. -- balbi signature.asc Description: Digital signature
Re: [PATCHv6 5/8] usb: dwc2: Add call_gadget functions for perpheral mode interrupts
On Tue, Oct 28, 2014 at 06:25:46PM -0500, dingu...@opensource.altera.com wrote: > From: Dinh Nguyen > > Update the dwc2 wakeup and suspend interrupt functions to use call_gadget > when the IP is in peripheral mode. it seems like you're actually fixing a bug here. Those calls weren't there before. -- balbi signature.asc Description: Digital signature
Re: [PATCHv6 6/8] usb: dwc2: gadget: Do not fail probe if there isn't a clock node
Hi, On Tue, Oct 28, 2014 at 06:25:47PM -0500, dingu...@opensource.altera.com wrote: > From: Dinh Nguyen > > Since the dwc2 hcd driver is currently not looking for a clock node during > init, we should not completely fail if there isn't a clock provided. > For dual-role mode, we will only fail init for a non-clock node error. We > then update the HCD to only call gadget funtions if there is a proper clock > node. > > Signed-off-by: Dinh Nguyen > --- > v5: reworked to not access gadget functions from the hcd. > --- > drivers/usb/dwc2/core.h | 3 +-- > drivers/usb/dwc2/core_intr.c | 9 ++--- > drivers/usb/dwc2/hcd.c | 3 ++- > drivers/usb/dwc2/platform.c | 19 +++ > 4 files changed, 24 insertions(+), 10 deletions(-) > > diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h > index ec70862..48120c8 100644 > --- a/drivers/usb/dwc2/core.h > +++ b/drivers/usb/dwc2/core.h > @@ -660,6 +660,7 @@ struct dwc2_hsotg { > #endif > #endif /* CONFIG_USB_DWC2_HOST || CONFIG_USB_DWC2_DUAL_ROLE */ > > + struct clk *clk; > #if IS_ENABLED(CONFIG_USB_DWC2_PERIPHERAL) || > IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE) > /* Gadget structures */ > struct usb_gadget_driver *driver; > @@ -667,8 +668,6 @@ struct dwc2_hsotg { > struct usb_phy *uphy; > struct s3c_hsotg_plat *plat; > > - struct clk *clk; > - > struct regulator_bulk_data supplies[ARRAY_SIZE(s3c_hsotg_supply_names)]; > > u32 phyif; > diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c > index 1240875..1608037 100644 > --- a/drivers/usb/dwc2/core_intr.c > +++ b/drivers/usb/dwc2/core_intr.c > @@ -339,7 +339,8 @@ static void dwc2_handle_wakeup_detected_intr(struct > dwc2_hsotg *hsotg) > } > /* Change to L0 state */ > hsotg->lx_state = DWC2_L0; > - call_gadget(hsotg, resume); > + if (!IS_ERR(hsotg->clk)) > + call_gadget(hsotg, resume); instead of exposing the clock detail to the entire driver, add IS_ERR() checks to resume and suspend instead. In fact, NULL is a valid clock, so you might as well: clk = clk_get(foo, bar); if (IS_ERR(clk)) dwc->clk = NULL; else dwc->clk = clk; Then you don't need any IS_ERR() checks sprinkled around the driver. > @@ -400,7 +401,8 @@ static void dwc2_handle_usb_suspend_intr(struct > dwc2_hsotg *hsotg) > "DSTS.Suspend Status=%d HWCFG4.Power Optimize=%d\n", > !!(dsts & DSTS_SUSPSTS), > hsotg->hw_params.power_optimized); > - call_gadget(hsotg, suspend); > + if (!IS_ERR(hsotg->clk)) > + call_gadget(hsotg, suspend); > } else { > if (hsotg->op_state == OTG_STATE_A_PERIPHERAL) { > dev_dbg(hsotg->dev, "a_peripheral->a_host\n"); > @@ -477,7 +479,8 @@ irqreturn_t dwc2_handle_common_intr(int irq, void *dev) > spin_lock(&hsotg->lock); > > if (dwc2_is_device_mode(hsotg)) > - retval = s3c_hsotg_irq(irq, dev); > + if (!IS_ERR(hsotg->clk)) > + retval = s3c_hsotg_irq(irq, dev); wait a minute, if there is no clock we don't call the gadget interrupt handler ? Why ? Who will disable the IRQ line ? > diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c > index 44c609f..fa49c72 100644 > --- a/drivers/usb/dwc2/hcd.c > +++ b/drivers/usb/dwc2/hcd.c > @@ -1371,7 +1371,8 @@ 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(hsotg); > + if (!IS_ERR(hsotg->clk)) > + s3c_hsotg_core_init(hsotg); > } else { > /* A-Device connector (Host Mode) */ > dev_dbg(hsotg->dev, "connId A\n"); > diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c > index 72f32f7..77c8417 100644 > --- a/drivers/usb/dwc2/platform.c > +++ b/drivers/usb/dwc2/platform.c > @@ -217,8 +217,17 @@ static int dwc2_driver_probe(struct platform_device *dev) > > spin_lock_init(&hsotg->lock); > retval = dwc2_gadget_init(hsotg, irq); > - if (retval) > - return retval; > + if (retval) { > + /* > + * We will not fail the driver initialization for dual-role > + * if no clock node is supplied. However, all gadget > + * functionality will be disabled if a clock node is not > + * provided. Host functionality will continue. > + * TO-DO: make clock node a requirement for the HCD. > + */ > + if (!IS_ERR(hsotg->clk)) > + return retval; > + } no here... this should have been taken care by dwc2_gadget_ini
Re: [PATCH v4 01/20] usb: dwc3: enable hibernation if to be supported
On Thu, Oct 30, 2014 at 12:35:56PM +0100, Arnd Bergmann wrote: > On Thursday 30 October 2014 18:08:26 Huang Rui wrote: > > It enables hibernation if the function is set in coreConsultant. > > > > Suggested-by: Felipe Balbi > > Signed-off-by: Huang Rui > > Signed-off-by: Felipe Balbi > > > > Something went wrong with the Signed-off-by lines here. > You should never add someone else's Signed-off-by below yours. > > I took a brief look at the entire series and the patches all look good > to me, but you have made the same mistake with the Signed-off-by > multiple times. there are no mistakes, I just asked Huang to resend what I had on my testing/next because it had not been sent to devicetree mailing list. -- balbi signature.asc Description: Digital signature
Re: [PATCH v3 1/4] usb: renesas_usbhs: gadget: fix NULL pointer dereference in ep_disable()
On Thu, Oct 30, 2014 at 07:30:16PM +0900, Yoshihiro Shimoda wrote: > From: Kazuya Mizuguchi > > This patch fixes an issue that the NULL pointer dereference happens > when we uses g_audio driver. Since the g_audio driver will call > usb_ep_disable() in afunc_set_alt() before it calls usb_ep_enable(), > the uep->pipe of renesas usbhs driver will be NULL. So, this patch > adds a condition to avoid the oops. > > Signed-off-by: Kazuya Mizuguchi > Signed-off-by: Takeshi Kihara > Signed-off-by: Yoshihiro Shimoda > Cc: > --- > drivers/usb/renesas_usbhs/mod_gadget.c |3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c > b/drivers/usb/renesas_usbhs/mod_gadget.c > index 2d17c10..2d0903f 100644 > --- a/drivers/usb/renesas_usbhs/mod_gadget.c > +++ b/drivers/usb/renesas_usbhs/mod_gadget.c > @@ -602,6 +602,9 @@ static int usbhsg_ep_disable(struct usb_ep *ep) > struct usbhsg_uep *uep = usbhsg_ep_to_uep(ep); > struct usbhs_pipe *pipe = usbhsg_uep_to_pipe(uep); > > + if (!uep || !uep->pipe) how can uep ever be NULL ? Look at the definition of usbhsg_ep_to_uep(): #define usbhsg_ep_to_uep(e) container_of(e, struct usbhsg_uep, ep) how can a container_of() ever return NULL ? What you should check if "ep" (the argument to this function) being NULL. -- balbi signature.asc Description: Digital signature
Re: [PATCHv6 8/8] usb: dwc2: move usb_disabled() call to host driver only
On Wed, Oct 29, 2014 at 08:35:24AM -0500, Dinh Nguyen wrote: > > > On 10/28/14, 8:26 PM, Paul Zimmerman wrote: > >> From: dingu...@opensource.altera.com > >> [mailto:dingu...@opensource.altera.com] > >> Sent: Tuesday, October 28, 2014 4:26 PM > >> > >> Now that platform.c will get built for both Host and Gadget, if we leave > >> the > >> usb_disabled() call in platform.c, it results in the following build error > >> when (!USB && USB_GADGET) condition is met. > >> > >> ERROR: "usb_disabled" [drivers/usb/dwc2/dwc2_platform.ko] undefined! > >> > >> Since usb_disabled() is mostly used to disable USB host functionality, move > >> the call the host portion for the DWC2 driver. > >> > >> Signed-off-by: Dinh Nguyen > >> --- > >> drivers/usb/dwc2/hcd.c | 3 +++ > >> drivers/usb/dwc2/platform.c | 3 --- > >> 2 files changed, 3 insertions(+), 3 deletions(-) > >> > >> diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c > >> index fa49c72..b741997 100644 > >> --- a/drivers/usb/dwc2/hcd.c > >> +++ b/drivers/usb/dwc2/hcd.c > >> @@ -2780,6 +2780,9 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq, > >>int i, num_channels; > >>int retval; > >> > >> + if (usb_disabled()) > >> + return -ENODEV; > >> + > >>dev_dbg(hsotg->dev, "DWC OTG HCD INIT\n"); > >> > >>/* Detect config values from hardware */ > >> diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c > >> index 77c8417..123cf54 100644 > >> --- a/drivers/usb/dwc2/platform.c > >> +++ b/drivers/usb/dwc2/platform.c > >> @@ -157,9 +157,6 @@ static int dwc2_driver_probe(struct platform_device > >> *dev) > >>int retval; > >>int irq; > >> > >> - if (usb_disabled()) > >> - return -ENODEV; > >> - > >>match = of_match_device(dwc2_of_match_table, &dev->dev); > >>if (match && match->data) { > >>params = match->data; > > > > I'm confused. You are saying the build is broken until patch 8/8 is > > applied? As always, that is not acceptable. You need to fix the > > breakage at the point where it was introduced, not leave it broken > > until the last patch in the series. > > > > The build gets broken when patch 7/8 of is applied. That is the patch > that finally allows platform.c to get built for host and gadget. I can > fold this patch into patch 7/8. then you invert things, make $subject patch 7 (or even patch 1) and patch 7 becomes patch 8. -- balbi signature.asc Description: Digital signature
Re: [PATCH v4 01/20] usb: dwc3: enable hibernation if to be supported
On Thursday 30 October 2014 09:08:32 Felipe Balbi wrote: > On Thu, Oct 30, 2014 at 12:35:56PM +0100, Arnd Bergmann wrote: > > On Thursday 30 October 2014 18:08:26 Huang Rui wrote: > > > It enables hibernation if the function is set in coreConsultant. > > > > > > Suggested-by: Felipe Balbi > > > Signed-off-by: Huang Rui > > > Signed-off-by: Felipe Balbi > > > > > > > Something went wrong with the Signed-off-by lines here. > > You should never add someone else's Signed-off-by below yours. > > > > I took a brief look at the entire series and the patches all look good > > to me, but you have made the same mistake with the Signed-off-by > > multiple times. > > there are no mistakes, I just asked Huang to resend what I had on my > testing/next because it had not been sent to devicetree mailing list. > It's definitely a tricky question what the right Signed-off-by chain is in this case, I guess strictly speaking it could have been Suggested-by: Felipe Balbi Signed-off-by: Huang Rui Signed-off-by: Felipe Balbi Signed-off-by: Huang Rui which could correctly track where the patches went, but it's also somewhat silly. I would probably just have dropped the second Signed-off-by, so that the last S-o-b in the patch matches the "From", as we expect. It's definitely good to know that Huang Rui was not faking your Signed-off-by but that you had actually provided it yourself. Arnd -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 01/20] usb: dwc3: enable hibernation if to be supported
On Thu, Oct 30, 2014 at 03:14:17PM +0100, Arnd Bergmann wrote: > On Thursday 30 October 2014 09:08:32 Felipe Balbi wrote: > > On Thu, Oct 30, 2014 at 12:35:56PM +0100, Arnd Bergmann wrote: > > > On Thursday 30 October 2014 18:08:26 Huang Rui wrote: > > > > It enables hibernation if the function is set in coreConsultant. > > > > > > > > Suggested-by: Felipe Balbi > > > > Signed-off-by: Huang Rui > > > > Signed-off-by: Felipe Balbi > > > > > > > > > > Something went wrong with the Signed-off-by lines here. > > > You should never add someone else's Signed-off-by below yours. > > > > > > I took a brief look at the entire series and the patches all look good > > > to me, but you have made the same mistake with the Signed-off-by > > > multiple times. > > > > there are no mistakes, I just asked Huang to resend what I had on my > > testing/next because it had not been sent to devicetree mailing list. > > > > It's definitely a tricky question what the right Signed-off-by > chain is in this case, I guess strictly speaking it could have > been > > Suggested-by: Felipe Balbi > Signed-off-by: Huang Rui > Signed-off-by: Felipe Balbi > Signed-off-by: Huang Rui > > which could correctly track where the patches went, but it's also > somewhat silly. somewhat ? You don't need to be so black and white. -- balbi signature.asc Description: Digital signature
Re: [PATCH] USB: simple: add Google simple serial SubClass support
On Wed, Oct 29, 2014 at 02:21:56PM -0700, Anton Staaf wrote: > Add support for Google devices that export simple serial > interfaces using the vendor specific SubClass/Protocol pair > 0x50/0x01. > > Signed-off-by: Anton Staaf > > --- > drivers/usb/serial/usb-serial-simple.c | 11 +++ > 1 file changed, 11 insertions(+) > > diff --git a/drivers/usb/serial/usb-serial-simple.c > b/drivers/usb/serial/usb-serial-simple.c > index fb79775..85bb973 100644 > --- a/drivers/usb/serial/usb-serial-simple.c > +++ b/drivers/usb/serial/usb-serial-simple.c > @@ -8,6 +8,7 @@ > * Copyright (C) 2010 Zilogic Systems > * Copyright (C) 2013 Wei Shuai > * Copyright (C) 2013 Linux Foundation > + * Copyright (C) 2014 Google, Inc. > * > * This program is free software; you can redistribute it and/or > * modify it under the terms of the GNU General Public License version Based on advice from my lawyer, a change this size does not warrent a copyright notice at the top of a file. If your lawyers feel otherwise, please let me know and I will be glad to discuss it with them. So, care to resend this without this change to the file? thanks, greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4] cdc-acm: ensure that termios get set when the port is activated
The driver wasn't properly configuring the hardware for the current termios settings under all conditions. Ensure that termios are written to the device when the port is activated. Signed-off-by: Jim Paris --- Moved prototype. Thanks, Jim --- drivers/usb/class/cdc-acm.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index e934e19f49f5..d2cd1b6d02a7 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c @@ -58,6 +58,9 @@ static struct usb_driver acm_driver; static struct tty_driver *acm_tty_driver; static struct acm *acm_table[ACM_TTY_MINORS]; +static void acm_tty_set_termios(struct tty_struct *tty, + struct ktermios *termios_old); + static DEFINE_MUTEX(acm_table_lock); /* @@ -554,6 +557,8 @@ static int acm_port_activate(struct tty_port *port, struct tty_struct *tty) goto error_submit_urb; } + acm_tty_set_termios(tty, NULL); + /* * Unthrottle device in case the TTY was closed while throttled. */ -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4] cdc-acm: ensure that termios get set when the port is activated
On Thu, Oct 30, 2014 at 10:45:38AM -0400, Jim Paris wrote: > The driver wasn't properly configuring the hardware for the current > termios settings under all conditions. Ensure that termios are > written to the device when the port is activated. > > Signed-off-by: Jim Paris > --- > > Moved prototype. You seem to have posted the old version again. > --- > drivers/usb/class/cdc-acm.c | 5 + > 1 file changed, 5 insertions(+) > > diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c > index e934e19f49f5..d2cd1b6d02a7 100644 > --- a/drivers/usb/class/cdc-acm.c > +++ b/drivers/usb/class/cdc-acm.c > @@ -58,6 +58,9 @@ static struct usb_driver acm_driver; > static struct tty_driver *acm_tty_driver; > static struct acm *acm_table[ACM_TTY_MINORS]; > > +static void acm_tty_set_termios(struct tty_struct *tty, > + struct ktermios *termios_old); > + > static DEFINE_MUTEX(acm_table_lock); Johan -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4-real] cdc-acm: ensure that termios get set when the port is activated
The driver wasn't properly configuring the hardware for the current termios settings under all conditions. Ensure that termios are written to the device when the port is activated. Signed-off-by: Jim Paris --- Johan Hovold wrote: > On Thu, Oct 30, 2014 at 10:45:38AM -0400, Jim Paris wrote: > > Moved prototype. > > You seem to have posted the old version again. Doh. Fixed. Jim --- drivers/usb/class/cdc-acm.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index e934e19f49f5..6c358c5e05ab 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c @@ -60,6 +60,9 @@ static struct acm *acm_table[ACM_TTY_MINORS]; static DEFINE_MUTEX(acm_table_lock); +static void acm_tty_set_termios(struct tty_struct *tty, + struct ktermios *termios_old); + /* * acm_table accessors */ @@ -554,6 +557,8 @@ static int acm_port_activate(struct tty_port *port, struct tty_struct *tty) goto error_submit_urb; } + acm_tty_set_termios(tty, NULL); + /* * Unthrottle device in case the TTY was closed while throttled. */ -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Question r/e zero byte bulk transfer on musb gadget (causes kernel panic)
Hi All, I want to ask what the correct USB behavior should be for a gadget attempting to perform a zero byte transfer (note transfer, not transaction) on a bulk-in endpoint should be: Background: * Basically I've got a hacked up kernel; hardware is TI omap dm3730 (an overo gumstix board). * I use gadget fs (for which I've done major work to fix both gadgetfs and musb). * I connect the overo board to a windows/linux/osx pc via its OTG port. I discovered that by writing a zero length packet to a bulk in endpoint I can cause a kernel panic in musb - basically I think it is trying to setup a DMA transaction with a "valid" pointer of zero bytes and blowing up. I encountered this by writing a crappy user-land program (by accident). Now I don't believe I should be able to panic the kernel from my stupid user program; so I could easily short-cut this so that gadgetfs disallows zero byte writes. I could also pursue this lower so that musb does not allow 0 length transactions - however, my question is more basic than that: Are zero length transfers from a device to the PC on a bulk endpoint sensible? I can see a case where a zero length transfer would cause a read thread in the host to be interrupted. Does musb/gadgetfs need to correctly support zero byte transfers, or is this a non-sensible suggestion? Cheers, -Brett -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 01/29] host: ehci-atmel: remove duplicate check on resource
From: Varka Bhadram Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram Acked-by: Alan Stern --- drivers/usb/host/ehci-atmel.c | 13 +++-- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/usb/host/ehci-atmel.c b/drivers/usb/host/ehci-atmel.c index ec9f7b7..56a8850 100644 --- a/drivers/usb/host/ehci-atmel.c +++ b/drivers/usb/host/ehci-atmel.c @@ -107,22 +107,15 @@ static int ehci_atmel_drv_probe(struct platform_device *pdev) } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(&pdev->dev, - "Found HC with no register addr. Check %s setup!\n", - dev_name(&pdev->dev)); - retval = -ENODEV; - goto fail_request_resource; - } - hcd->rsrc_start = res->start; - hcd->rsrc_len = resource_size(res); - hcd->regs = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(hcd->regs)) { retval = PTR_ERR(hcd->regs); goto fail_request_resource; } + hcd->rsrc_start = res->start; + hcd->rsrc_len = resource_size(res); + iclk = devm_clk_get(&pdev->dev, "ehci_clk"); if (IS_ERR(iclk)) { dev_err(&pdev->dev, "Error getting interface clock\n"); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 02/29] host: ohci-da8xx: remove duplicate check on resource
From: Varka Bhadram Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram Acked-by: Alan Stern --- drivers/usb/host/ohci-da8xx.c |7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c index df06be6..1c76999 100644 --- a/drivers/usb/host/ohci-da8xx.c +++ b/drivers/usb/host/ohci-da8xx.c @@ -313,16 +313,13 @@ static int usb_hcd_da8xx_probe(const struct hc_driver *driver, return -ENOMEM; mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!mem) - return -ENODEV; - hcd->rsrc_start = mem->start; - hcd->rsrc_len = resource_size(mem); - hcd->regs = devm_ioremap_resource(&pdev->dev, mem); if (IS_ERR(hcd->regs)) { error = PTR_ERR(hcd->regs); goto err; } + hcd->rsrc_start = mem->start; + hcd->rsrc_len = resource_size(mem); ohci_hcd_init(hcd_to_ohci(hcd)); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 00/29] cleanup on resource check
From: Varka Bhadram This series removes the duplication of sanity check for platform_get_resource() return resource. It will be checked with devm_ioremap_resource() This entire series rebased on testing/fixes of [1]. [1]: http://git.kernel.org/cgit/linux/kernel/git/balbi/usb.git changes since v1: - removed broken patches - added Ack of Alan Stern for all the ehci, ohci, and uhci changes. Varka Bhadram (29): host: ehci-atmel: remove duplicate check on resource host: ohci-da8xx: remove duplicate check on resource host: ehci-tegra: remove duplicate check on resource host: ehci-w90x900: remove duplicate check on resource host: ohci-at91: remove duplicate check on resource host: ohci-exynos: remove duplicate check on resource host: ohci-jz4740: remove duplicate check on resource host: ohci-octeon: remove duplicate check on resource host: ohci-platform: remove duplicate check on resource host: ohci-pxa27x: remove duplicate check on resource host: ehci-sh: remove duplicate check on resource host: ohci-spear: remove duplicate check on resource host: ehci-msm: remove duplicate check on resource host: ehci-mv: remove duplicate check on resource host: ehci-mxc: remove duplicate check on resource host: ehci-octeon: remove duplicate check on resource host: ehci-orion: remove duplicate check on resource host: ehci-platform: remove duplicate check on resource host: ehci-sead3: remove duplicate check on resource host: ehci-spear: remove duplicate check on resource host: uhci-platform: remove duplicate check on resource host: xhci-plat: remove duplicate check on resource musb: musb_core: remove duplicate check on resource musb: musb_dsps: remove duplicate check on resource phy: phy-rcar-usb: remove duplicate check on resource renesas_usbhs: common: remove duplicate check on resource dwc3: dwc3-keystone: remove duplicate check on resource host: ehci-fsl: remove duplicate check on resource host: ehci-exynos: remove duplicate check on resource drivers/usb/dwc3/dwc3-keystone.c |5 - drivers/usb/host/ehci-atmel.c | 13 +++-- drivers/usb/host/ehci-exynos.c | 11 +++ drivers/usb/host/ehci-fsl.c| 12 +++- drivers/usb/host/ehci-msm.c| 10 ++ drivers/usb/host/ehci-mv.c | 12 drivers/usb/host/ehci-mxc.c| 11 ++- drivers/usb/host/ehci-octeon.c | 12 +++- drivers/usb/host/ehci-orion.c | 10 +- drivers/usb/host/ehci-platform.c | 12 drivers/usb/host/ehci-sead3.c |5 ++--- drivers/usb/host/ehci-sh.c | 15 +++ drivers/usb/host/ehci-spear.c |9 ++--- drivers/usb/host/ehci-tegra.c | 10 +++--- drivers/usb/host/ehci-w90x900.c| 13 +++-- drivers/usb/host/ohci-at91.c | 11 +++ drivers/usb/host/ohci-da8xx.c |7 ++- drivers/usb/host/ohci-exynos.c | 10 ++ drivers/usb/host/ohci-jz4740.c | 13 +++-- drivers/usb/host/ohci-octeon.c | 12 +++- drivers/usb/host/ohci-platform.c | 13 - drivers/usb/host/ohci-pxa27x.c | 11 ++- drivers/usb/host/ohci-spear.c | 11 +++ drivers/usb/host/uhci-platform.c |7 --- drivers/usb/host/xhci-plat.c | 10 -- drivers/usb/musb/musb_core.c |4 ++-- drivers/usb/musb/musb_dsps.c |3 --- drivers/usb/phy/phy-rcar-usb.c |8 +++- drivers/usb/renesas_usbhs/common.c |3 ++- 29 files changed, 71 insertions(+), 212 deletions(-) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 04/29] host: ehci-w90x900: remove duplicate check on resource
From: Varka Bhadram Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram Acked-by: Alan Stern --- drivers/usb/host/ehci-w90x900.c | 13 +++-- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/usb/host/ehci-w90x900.c b/drivers/usb/host/ehci-w90x900.c index a9303af..4717bf2 100644 --- a/drivers/usb/host/ehci-w90x900.c +++ b/drivers/usb/host/ehci-w90x900.c @@ -42,27 +42,20 @@ static int usb_w90x900_probe(const struct hc_driver *driver, int retval = 0, irq; unsigned long val; - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - retval = -ENXIO; - goto err1; - } - hcd = usb_create_hcd(driver, &pdev->dev, "w90x900 EHCI"); if (!hcd) { retval = -ENOMEM; goto err1; } - hcd->rsrc_start = res->start; - hcd->rsrc_len = resource_size(res); - + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); hcd->regs = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(hcd->regs)) { retval = PTR_ERR(hcd->regs); goto err2; } + hcd->rsrc_start = res->start; + hcd->rsrc_len = resource_size(res); ehci = hcd_to_ehci(hcd); ehci->caps = hcd->regs; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 05/29] host: ohci-at91: remove duplicate check on resource
From: Varka Bhadram Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram Acked-by: Alan Stern --- drivers/usb/host/ohci-at91.c | 11 +++ 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index e49eb4f..90666ea 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c @@ -137,12 +137,6 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver, struct resource *res; int irq; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_dbg(dev, "hcd probe: missing memory resource\n"); - return -ENXIO; - } - irq = platform_get_irq(pdev, 0); if (irq < 0) { dev_dbg(dev, "hcd probe: missing irq resource\n"); @@ -152,14 +146,15 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver, hcd = usb_create_hcd(driver, dev, "at91"); if (!hcd) return -ENOMEM; - hcd->rsrc_start = res->start; - hcd->rsrc_len = resource_size(res); + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); hcd->regs = devm_ioremap_resource(dev, res); if (IS_ERR(hcd->regs)) { retval = PTR_ERR(hcd->regs); goto err; } + hcd->rsrc_start = res->start; + hcd->rsrc_len = resource_size(res); iclk = devm_clk_get(dev, "ohci_clk"); if (IS_ERR(iclk)) { -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 03/29] host: ehci-tegra: remove duplicate check on resource
From: Varka Bhadram Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram Acked-by: Alan Stern --- drivers/usb/host/ehci-tegra.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c index aaa0197..eb36b7a 100644 --- a/drivers/usb/host/ehci-tegra.c +++ b/drivers/usb/host/ehci-tegra.c @@ -460,18 +460,14 @@ static int tegra_ehci_probe(struct platform_device *pdev) "nvidia,needs-double-reset"); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(&pdev->dev, "Failed to get I/O memory\n"); - err = -ENXIO; - goto cleanup_clk_en; - } - hcd->rsrc_start = res->start; - hcd->rsrc_len = resource_size(res); hcd->regs = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(hcd->regs)) { err = PTR_ERR(hcd->regs); goto cleanup_clk_en; } + hcd->rsrc_start = res->start; + hcd->rsrc_len = resource_size(res); + ehci->caps = hcd->regs + 0x100; ehci->has_hostpc = soc_config->has_hostpc; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 08/29] host: ohci-octeon: remove duplicate check on resource
From: Varka Bhadram Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram Acked-by: Alan Stern --- drivers/usb/host/ohci-octeon.c | 12 +++- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/usb/host/ohci-octeon.c b/drivers/usb/host/ohci-octeon.c index 15af895..20d861b 100644 --- a/drivers/usb/host/ohci-octeon.c +++ b/drivers/usb/host/ohci-octeon.c @@ -120,12 +120,6 @@ static int ohci_octeon_drv_probe(struct platform_device *pdev) return -ENODEV; } - res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (res_mem == NULL) { - dev_err(&pdev->dev, "No register space assigned\n"); - return -ENODEV; - } - /* Ohci is a 32-bit device. */ ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); if (ret) @@ -135,14 +129,14 @@ static int ohci_octeon_drv_probe(struct platform_device *pdev) if (!hcd) return -ENOMEM; - hcd->rsrc_start = res_mem->start; - hcd->rsrc_len = resource_size(res_mem); - + res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); reg_base = devm_ioremap_resource(&pdev->dev, res_mem); if (IS_ERR(reg_base)) { ret = PTR_ERR(reg_base); goto err1; } + hcd->rsrc_start = res_mem->start; + hcd->rsrc_len = resource_size(res_mem); ohci_octeon_hw_start(); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 06/29] host: ohci-exynos: remove duplicate check on resource
From: Varka Bhadram Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram Acked-by: Alan Stern --- drivers/usb/host/ohci-exynos.c | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c index d28b658..f601952 100644 --- a/drivers/usb/host/ohci-exynos.c +++ b/drivers/usb/host/ohci-exynos.c @@ -156,19 +156,13 @@ skip_phy: goto fail_clk; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(&pdev->dev, "Failed to get I/O memory\n"); - err = -ENXIO; - goto fail_io; - } - - hcd->rsrc_start = res->start; - hcd->rsrc_len = resource_size(res); hcd->regs = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(hcd->regs)) { err = PTR_ERR(hcd->regs); goto fail_io; } + hcd->rsrc_start = res->start; + hcd->rsrc_len = resource_size(res); irq = platform_get_irq(pdev, 0); if (!irq) { -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 09/29] host: ohci-platform: remove duplicate check on resource
From: Varka Bhadram Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram Acked-by: Alan Stern --- drivers/usb/host/ohci-platform.c | 13 - 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c index 4369299..6c7f74b 100644 --- a/drivers/usb/host/ohci-platform.c +++ b/drivers/usb/host/ohci-platform.c @@ -149,12 +149,6 @@ static int ohci_platform_probe(struct platform_device *dev) return irq; } - res_mem = platform_get_resource(dev, IORESOURCE_MEM, 0); - if (!res_mem) { - dev_err(&dev->dev, "no memory resource provided"); - return -ENXIO; - } - hcd = usb_create_hcd(&ohci_platform_hc_driver, &dev->dev, dev_name(&dev->dev)); if (!hcd) @@ -236,14 +230,15 @@ static int ohci_platform_probe(struct platform_device *dev) goto err_reset; } - hcd->rsrc_start = res_mem->start; - hcd->rsrc_len = resource_size(res_mem); - + res_mem = platform_get_resource(dev, IORESOURCE_MEM, 0); hcd->regs = devm_ioremap_resource(&dev->dev, res_mem); if (IS_ERR(hcd->regs)) { err = PTR_ERR(hcd->regs); goto err_power; } + hcd->rsrc_start = res_mem->start; + hcd->rsrc_len = resource_size(res_mem); + err = usb_add_hcd(hcd, irq, IRQF_SHARED); if (err) goto err_power; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 07/29] host: ohci-jz4740: remove duplicate check on resource
From: Varka Bhadram Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram Acked-by: Alan Stern --- drivers/usb/host/ohci-jz4740.c | 13 +++-- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/usb/host/ohci-jz4740.c b/drivers/usb/host/ohci-jz4740.c index c2c221a..8ddd8f5 100644 --- a/drivers/usb/host/ohci-jz4740.c +++ b/drivers/usb/host/ohci-jz4740.c @@ -153,13 +153,6 @@ static int jz4740_ohci_probe(struct platform_device *pdev) struct resource *res; int irq; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - - if (!res) { - dev_err(&pdev->dev, "Failed to get platform resource\n"); - return -ENOENT; - } - irq = platform_get_irq(pdev, 0); if (irq < 0) { dev_err(&pdev->dev, "Failed to get platform irq\n"); @@ -174,14 +167,14 @@ static int jz4740_ohci_probe(struct platform_device *pdev) jz4740_ohci = hcd_to_jz4740_hcd(hcd); - hcd->rsrc_start = res->start; - hcd->rsrc_len = resource_size(res); - + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); hcd->regs = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(hcd->regs)) { ret = PTR_ERR(hcd->regs); goto err_free; } + hcd->rsrc_start = res->start; + hcd->rsrc_len = resource_size(res); jz4740_ohci->clk = devm_clk_get(&pdev->dev, "uhc"); if (IS_ERR(jz4740_ohci->clk)) { -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 11/29] host: ehci-sh: remove duplicate check on resource
From: Varka Bhadram Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram Acked-by: Alan Stern --- drivers/usb/host/ehci-sh.c | 15 +++ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/usb/host/ehci-sh.c b/drivers/usb/host/ehci-sh.c index 9b9b9f5..4b2c3a7 100644 --- a/drivers/usb/host/ehci-sh.c +++ b/drivers/usb/host/ehci-sh.c @@ -86,15 +86,6 @@ static int ehci_hcd_sh_probe(struct platform_device *pdev) if (usb_disabled()) return -ENODEV; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(&pdev->dev, - "Found HC with no register addr. Check %s setup!\n", - dev_name(&pdev->dev)); - ret = -ENODEV; - goto fail_create_hcd; - } - irq = platform_get_irq(pdev, 0); if (irq <= 0) { dev_err(&pdev->dev, @@ -114,14 +105,14 @@ static int ehci_hcd_sh_probe(struct platform_device *pdev) goto fail_create_hcd; } - hcd->rsrc_start = res->start; - hcd->rsrc_len = resource_size(res); - + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); hcd->regs = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(hcd->regs)) { ret = PTR_ERR(hcd->regs); goto fail_request_resource; } + hcd->rsrc_start = res->start; + hcd->rsrc_len = resource_size(res); priv = devm_kzalloc(&pdev->dev, sizeof(struct ehci_sh_priv), GFP_KERNEL); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 12/29] host: ohci-spear: remove duplicate check on resource
From: Varka Bhadram Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram Acked-by: Alan Stern --- drivers/usb/host/ohci-spear.c | 11 +++ 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/usb/host/ohci-spear.c b/drivers/usb/host/ohci-spear.c index 8d58766..4a54f9d 100644 --- a/drivers/usb/host/ohci-spear.c +++ b/drivers/usb/host/ohci-spear.c @@ -74,20 +74,15 @@ static int spear_ohci_hcd_drv_probe(struct platform_device *pdev) } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - retval = -ENODEV; - goto err_put_hcd; - } - - hcd->rsrc_start = pdev->resource[0].start; - hcd->rsrc_len = resource_size(res); - hcd->regs = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(hcd->regs)) { retval = PTR_ERR(hcd->regs); goto err_put_hcd; } + hcd->rsrc_start = pdev->resource[0].start; + hcd->rsrc_len = resource_size(res); + sohci_p = to_spear_ohci(hcd); sohci_p->clk = usbh_clk; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 13/29] host: ehci-msm: remove duplicate check on resource
From: Varka Bhadram Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram Acked-by: Alan Stern --- drivers/usb/host/ehci-msm.c | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/usb/host/ehci-msm.c b/drivers/usb/host/ehci-msm.c index 9dc2118..9db74ca 100644 --- a/drivers/usb/host/ehci-msm.c +++ b/drivers/usb/host/ehci-msm.c @@ -88,19 +88,13 @@ static int ehci_msm_probe(struct platform_device *pdev) } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(&pdev->dev, "Unable to get memory resource\n"); - ret = -ENODEV; - goto put_hcd; - } - - hcd->rsrc_start = res->start; - hcd->rsrc_len = resource_size(res); hcd->regs = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(hcd->regs)) { ret = PTR_ERR(hcd->regs); goto put_hcd; } + hcd->rsrc_start = res->start; + hcd->rsrc_len = resource_size(res); /* * OTG driver takes care of PHY initialization, clock management, -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 10/29] host: ohci-pxa27x: remove duplicate check on resource
From: Varka Bhadram Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram Acked-by: Alan Stern --- drivers/usb/host/ohci-pxa27x.c | 11 ++- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index e68f3d0..1339981 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c @@ -447,20 +447,13 @@ int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device return -ENOMEM; r = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!r) { - pr_err("no resource of IORESOURCE_MEM"); - retval = -ENXIO; - goto err; - } - - hcd->rsrc_start = r->start; - hcd->rsrc_len = resource_size(r); - hcd->regs = devm_ioremap_resource(&pdev->dev, r); if (IS_ERR(hcd->regs)) { retval = PTR_ERR(hcd->regs); goto err; } + hcd->rsrc_start = r->start; + hcd->rsrc_len = resource_size(r); /* initialize "struct pxa27x_ohci" */ pxa_ohci = to_pxa27x_ohci(hcd); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 16/29] host: ehci-octeon: remove duplicate check on resource
From: Varka Bhadram Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram Acked-by: Alan Stern --- drivers/usb/host/ehci-octeon.c | 12 +++- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/usb/host/ehci-octeon.c b/drivers/usb/host/ehci-octeon.c index 9051439..2d0c4bc 100644 --- a/drivers/usb/host/ehci-octeon.c +++ b/drivers/usb/host/ehci-octeon.c @@ -106,12 +106,6 @@ static int ehci_octeon_drv_probe(struct platform_device *pdev) return -ENODEV; } - res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (res_mem == NULL) { - dev_err(&pdev->dev, "No register space assigned\n"); - return -ENODEV; - } - /* * We can DMA from anywhere. But the descriptors must be in * the lower 4GB. @@ -125,14 +119,14 @@ static int ehci_octeon_drv_probe(struct platform_device *pdev) if (!hcd) return -ENOMEM; - hcd->rsrc_start = res_mem->start; - hcd->rsrc_len = resource_size(res_mem); - + res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); hcd->regs = devm_ioremap_resource(&pdev->dev, res_mem); if (IS_ERR(hcd->regs)) { ret = PTR_ERR(hcd->regs); goto err1; } + hcd->rsrc_start = res_mem->start; + hcd->rsrc_len = resource_size(res_mem); ehci_octeon_start(); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 19/29] host: ehci-sead3: remove duplicate check on resource
From: Varka Bhadram Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram Acked-by: Alan Stern --- drivers/usb/host/ehci-sead3.c |5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/usb/host/ehci-sead3.c b/drivers/usb/host/ehci-sead3.c index cf12676..9b6e8d0 100644 --- a/drivers/usb/host/ehci-sead3.c +++ b/drivers/usb/host/ehci-sead3.c @@ -110,14 +110,13 @@ static int ehci_hcd_sead3_drv_probe(struct platform_device *pdev) return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - hcd->rsrc_start = res->start; - hcd->rsrc_len = resource_size(res); - hcd->regs = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(hcd->regs)) { ret = PTR_ERR(hcd->regs); goto err1; } + hcd->rsrc_start = res->start; + hcd->rsrc_len = resource_size(res); /* Root hub has integrated TT. */ hcd->has_tt = 1; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 25/29] phy: phy-rcar-usb: remove duplicate check on resource
From: Varka Bhadram Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram --- drivers/usb/phy/phy-rcar-usb.c |8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/usb/phy/phy-rcar-usb.c b/drivers/usb/phy/phy-rcar-usb.c index 33265a5..e9f3a93 100644 --- a/drivers/usb/phy/phy-rcar-usb.c +++ b/drivers/usb/phy/phy-rcar-usb.c @@ -195,11 +195,9 @@ static int rcar_usb_phy_probe(struct platform_device *pdev) return PTR_ERR(reg0); res1 = platform_get_resource(pdev, IORESOURCE_MEM, 1); - if (res1) { - reg1 = devm_ioremap_resource(dev, res1); - if (IS_ERR(reg1)) - return PTR_ERR(reg1); - } + reg1 = devm_ioremap_resource(dev, res1); + if (IS_ERR(reg1)) + return PTR_ERR(reg1); priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) { -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 14/29] host: ehci-mv: remove duplicate check on resource
From: Varka Bhadram Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram Acked-by: Alan Stern --- drivers/usb/host/ehci-mv.c | 12 1 file changed, 12 deletions(-) diff --git a/drivers/usb/host/ehci-mv.c b/drivers/usb/host/ehci-mv.c index 08147c3..62797eb 100644 --- a/drivers/usb/host/ehci-mv.c +++ b/drivers/usb/host/ehci-mv.c @@ -170,12 +170,6 @@ static int mv_ehci_probe(struct platform_device *pdev) } r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "phyregs"); - if (r == NULL) { - dev_err(&pdev->dev, "no phy I/O memory resource defined\n"); - retval = -ENODEV; - goto err_put_hcd; - } - ehci_mv->phy_regs = devm_ioremap_resource(&pdev->dev, r); if (IS_ERR(ehci_mv->phy_regs)) { retval = PTR_ERR(ehci_mv->phy_regs); @@ -183,12 +177,6 @@ static int mv_ehci_probe(struct platform_device *pdev) } r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "capregs"); - if (!r) { - dev_err(&pdev->dev, "no I/O memory resource defined\n"); - retval = -ENODEV; - goto err_put_hcd; - } - ehci_mv->cap_regs = devm_ioremap_resource(&pdev->dev, r); if (IS_ERR(ehci_mv->cap_regs)) { retval = PTR_ERR(ehci_mv->cap_regs); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 22/29] host: xhci-plat: remove duplicate check on resource
From: Varka Bhadram Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram Acked-by: Alan Stern --- drivers/usb/host/xhci-plat.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 3d78b0c..e68b4ec 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -83,9 +83,6 @@ static int xhci_plat_probe(struct platform_device *pdev) if (irq < 0) return -ENODEV; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) - return -ENODEV; if (of_device_is_compatible(pdev->dev.of_node, "marvell,armada-375-xhci") || @@ -109,15 +106,16 @@ static int xhci_plat_probe(struct platform_device *pdev) if (!hcd) return -ENOMEM; - hcd->rsrc_start = res->start; - hcd->rsrc_len = resource_size(res); - + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); hcd->regs = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(hcd->regs)) { ret = PTR_ERR(hcd->regs); goto put_hcd; } + hcd->rsrc_start = res->start; + hcd->rsrc_len = resource_size(res); + /* * Not all platforms have a clk so it is not an error if the * clock does not exists. -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 17/29] host: ehci-orion: remove duplicate check on resource
From: Varka Bhadram Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram Acked-by: Alan Stern --- drivers/usb/host/ehci-orion.c | 10 +- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c index 22e15ca..36b4657 100644 --- a/drivers/usb/host/ehci-orion.c +++ b/drivers/usb/host/ehci-orion.c @@ -175,15 +175,6 @@ static int ehci_orion_drv_probe(struct platform_device *pdev) goto err; } - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(&pdev->dev, - "Found HC with no register addr. Check %s setup!\n", - dev_name(&pdev->dev)); - err = -ENODEV; - goto err; - } - /* * Right now device-tree probed devices don't get dma_mask * set. Since shared usb code relies on it, set it here for @@ -193,6 +184,7 @@ static int ehci_orion_drv_probe(struct platform_device *pdev) if (err) goto err; + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); regs = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(regs)) { err = PTR_ERR(regs); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 23/29] musb: musb_core: remove duplicate check on resource
From: Varka Bhadram Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram --- drivers/usb/musb/musb_core.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index b841ee0..55ebd4b 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -2080,10 +2080,10 @@ static int musb_probe(struct platform_device *pdev) struct resource *iomem; void __iomem*base; - iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!iomem || irq <= 0) + if (irq <= 0) return -ENODEV; + iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); base = devm_ioremap_resource(dev, iomem); if (IS_ERR(base)) return PTR_ERR(base); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 21/29] host: uhci-platform: remove duplicate check on resource
From: Varka Bhadram Sanity check on resource happening with devm_ioremap_resource(). Also fix in accessing NULL if resource didn't get. Signed-off-by: Varka Bhadram Acked-by: Alan Stern --- drivers/usb/host/uhci-platform.c |7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/usb/host/uhci-platform.c b/drivers/usb/host/uhci-platform.c index b987f1d..081330c 100644 --- a/drivers/usb/host/uhci-platform.c +++ b/drivers/usb/host/uhci-platform.c @@ -86,14 +86,15 @@ static int uhci_hcd_platform_probe(struct platform_device *pdev) return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - hcd->rsrc_start = res->start; - hcd->rsrc_len = resource_size(res); - hcd->regs = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(hcd->regs)) { ret = PTR_ERR(hcd->regs); goto err_rmr; } + + hcd->rsrc_start = res->start; + hcd->rsrc_len = resource_size(res); + uhci = hcd_to_uhci(hcd); uhci->regs = hcd->regs; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 27/29] dwc3: dwc3-keystone: remove duplicate check on resource
From: Varka Bhadram Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram --- drivers/usb/dwc3/dwc3-keystone.c |5 - 1 file changed, 5 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-keystone.c b/drivers/usb/dwc3/dwc3-keystone.c index 7ec8495..dd8d2df 100644 --- a/drivers/usb/dwc3/dwc3-keystone.c +++ b/drivers/usb/dwc3/dwc3-keystone.c @@ -104,11 +104,6 @@ static int kdwc3_probe(struct platform_device *pdev) kdwc->dev = dev; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(dev, "missing usbss resource\n"); - return -EINVAL; - } - kdwc->usbss = devm_ioremap_resource(dev, res); if (IS_ERR(kdwc->usbss)) return PTR_ERR(kdwc->usbss); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 18/29] host: ehci-platform: remove duplicate check on resource
From: Varka Bhadram Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram Acked-by: Alan Stern --- drivers/usb/host/ehci-platform.c | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c index 2f5b9ce..d6cbd61 100644 --- a/drivers/usb/host/ehci-platform.c +++ b/drivers/usb/host/ehci-platform.c @@ -164,11 +164,6 @@ static int ehci_platform_probe(struct platform_device *dev) dev_err(&dev->dev, "no irq provided"); return irq; } - res_mem = platform_get_resource(dev, IORESOURCE_MEM, 0); - if (!res_mem) { - dev_err(&dev->dev, "no memory resource provided"); - return -ENXIO; - } hcd = usb_create_hcd(&ehci_platform_hc_driver, &dev->dev, dev_name(&dev->dev)); @@ -250,14 +245,15 @@ static int ehci_platform_probe(struct platform_device *dev) goto err_reset; } - hcd->rsrc_start = res_mem->start; - hcd->rsrc_len = resource_size(res_mem); - + res_mem = platform_get_resource(dev, IORESOURCE_MEM, 0); hcd->regs = devm_ioremap_resource(&dev->dev, res_mem); if (IS_ERR(hcd->regs)) { err = PTR_ERR(hcd->regs); goto err_power; } + hcd->rsrc_start = res_mem->start; + hcd->rsrc_len = resource_size(res_mem); + err = usb_add_hcd(hcd, irq, IRQF_SHARED); if (err) goto err_power; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 15/29] host: ehci-mxc: remove duplicate check on resource
From: Varka Bhadram Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram Acked-by: Alan Stern --- drivers/usb/host/ehci-mxc.c | 11 ++- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c index dbe5e4e..c7a9b31 100644 --- a/drivers/usb/host/ehci-mxc.c +++ b/drivers/usb/host/ehci-mxc.c @@ -69,20 +69,13 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(dev, "Found HC with no register addr. Check setup!\n"); - ret = -ENODEV; - goto err_alloc; - } - - hcd->rsrc_start = res->start; - hcd->rsrc_len = resource_size(res); - hcd->regs = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(hcd->regs)) { ret = PTR_ERR(hcd->regs); goto err_alloc; } + hcd->rsrc_start = res->start; + hcd->rsrc_len = resource_size(res); hcd->has_tt = 1; ehci = hcd_to_ehci(hcd); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 29/29] host: ehci-exynos: remove duplicate check on resource
From: Varka Bhadram Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram Acked-by: Alan Stern --- drivers/usb/host/ehci-exynos.c | 11 +++ 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c index 7189f2e..c2777d2 100644 --- a/drivers/usb/host/ehci-exynos.c +++ b/drivers/usb/host/ehci-exynos.c @@ -188,20 +188,15 @@ skip_phy: goto fail_clk; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(&pdev->dev, "Failed to get I/O memory\n"); - err = -ENXIO; - goto fail_io; - } - - hcd->rsrc_start = res->start; - hcd->rsrc_len = resource_size(res); hcd->regs = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(hcd->regs)) { err = PTR_ERR(hcd->regs); goto fail_io; } + hcd->rsrc_start = res->start; + hcd->rsrc_len = resource_size(res); + irq = platform_get_irq(pdev, 0); if (!irq) { dev_err(&pdev->dev, "Failed to get IRQ\n"); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 28/29] host: ehci-fsl: remove duplicate check on resource
From: Varka Bhadram Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram Acked-by: Alan Stern --- drivers/usb/host/ehci-fsl.c | 12 +++- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index 2d2ae8d..fb7bd0c 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c @@ -93,21 +93,15 @@ static int usb_hcd_fsl_probe(const struct hc_driver *driver, } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(&pdev->dev, - "Found HC with no register addr. Check %s setup!\n", - dev_name(&pdev->dev)); - retval = -ENODEV; - goto err2; - } - hcd->rsrc_start = res->start; - hcd->rsrc_len = resource_size(res); hcd->regs = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(hcd->regs)) { retval = PTR_ERR(hcd->regs); goto err2; } + hcd->rsrc_start = res->start; + hcd->rsrc_len = resource_size(res); + pdata->regs = hcd->regs; if (pdata->power_budget) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 24/29] musb: musb_dsps: remove duplicate check on resource
From: Varka Bhadram Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram --- drivers/usb/musb/musb_dsps.c |3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index 48bc09e..965c552 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c @@ -447,9 +447,6 @@ static int dsps_musb_init(struct musb *musb) int ret; r = platform_get_resource_byname(parent, IORESOURCE_MEM, "control"); - if (!r) - return -EINVAL; - reg_base = devm_ioremap_resource(dev, r); if (IS_ERR(reg_base)) return PTR_ERR(reg_base); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 26/29] renesas_usbhs: common: remove duplicate check on resource
From: Varka Bhadram Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram --- drivers/usb/renesas_usbhs/common.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c index b3b6813..3ffd552 100644 --- a/drivers/usb/renesas_usbhs/common.c +++ b/drivers/usb/renesas_usbhs/common.c @@ -497,8 +497,9 @@ static int usbhs_probe(struct platform_device *pdev) /* platform data */ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); - if (!res || !irq_res) { + if (!irq_res) { dev_err(&pdev->dev, "Not enough Renesas USB platform resources.\n"); return -ENODEV; } -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH usb v2 20/29] host: ehci-spear: remove duplicate check on resource
From: Varka Bhadram Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram Acked-by: Alan Stern --- drivers/usb/host/ehci-spear.c |9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/usb/host/ehci-spear.c b/drivers/usb/host/ehci-spear.c index 1355ff0..34e1474 100644 --- a/drivers/usb/host/ehci-spear.c +++ b/drivers/usb/host/ehci-spear.c @@ -99,18 +99,13 @@ static int spear_ehci_hcd_drv_probe(struct platform_device *pdev) } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - retval = -ENODEV; - goto err_put_hcd; - } - - hcd->rsrc_start = res->start; - hcd->rsrc_len = resource_size(res); hcd->regs = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(hcd->regs)) { retval = PTR_ERR(hcd->regs); goto err_put_hcd; } + hcd->rsrc_start = res->start; + hcd->rsrc_len = resource_size(res); sehci = to_spear_ehci(hcd); sehci->clk = usbh_clk; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v7 1/7] usb: move the OTG state from the USB PHY to the OTG structure
On Tue, Oct 28, 2014 at 05:35:35PM +0100, Antoine Tenart wrote: > Before using the PHY framework instead of the USB PHY one, we need to > move the OTG state into another place, since it won't be available when > USB PHY isn't used. This patch moves the OTG state into the OTG > structure, and makes all the needed modifications in the drivers > using the OTG state. > > Signed-off-by: Antoine Tenart > Acked-by: Peter Chen Acked-by: Felipe Balbi > --- > drivers/phy/phy-omap-usb2.c | 8 +--- > drivers/usb/chipidea/debug.c| 2 +- > drivers/usb/chipidea/otg_fsm.c | 12 ++--- > drivers/usb/common/usb-otg-fsm.c| 8 ++-- > drivers/usb/host/ohci-omap.c| 2 +- > drivers/usb/musb/am35x.c| 28 +-- > drivers/usb/musb/blackfin.c | 18 +++ > drivers/usb/musb/da8xx.c| 28 +-- > drivers/usb/musb/davinci.c | 18 +++ > drivers/usb/musb/musb_core.c| 94 > ++--- > drivers/usb/musb/musb_dsps.c| 26 +- > drivers/usb/musb/musb_gadget.c | 36 +++--- > drivers/usb/musb/musb_host.c| 8 ++-- > drivers/usb/musb/musb_virthub.c | 22 - > drivers/usb/musb/omap2430.c | 30 ++-- > drivers/usb/musb/tusb6010.c | 40 > drivers/usb/musb/ux500.c| 10 ++-- > drivers/usb/phy/phy-ab8500-usb.c| 10 ++-- > drivers/usb/phy/phy-fsl-usb.c | 10 ++-- > drivers/usb/phy/phy-generic.c | 4 +- > drivers/usb/phy/phy-gpio-vbus-usb.c | 10 ++-- > drivers/usb/phy/phy-msm-usb.c | 34 +++--- > drivers/usb/phy/phy-mv-usb.c| 46 +- > include/linux/usb/otg.h | 2 + > include/linux/usb/phy.h | 1 - > 25 files changed, 252 insertions(+), 255 deletions(-) > > diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c > index 8c842980834a..9f4093590f4c 100644 > --- a/drivers/phy/phy-omap-usb2.c > +++ b/drivers/phy/phy-omap-usb2.c > @@ -80,11 +80,9 @@ static int omap_usb_start_srp(struct usb_otg *otg) > > static int omap_usb_set_host(struct usb_otg *otg, struct usb_bus *host) > { > - struct usb_phy *phy = otg->phy; > - > otg->host = host; > if (!host) > - phy->state = OTG_STATE_UNDEFINED; > + otg->state = OTG_STATE_UNDEFINED; > > return 0; > } > @@ -92,11 +90,9 @@ static int omap_usb_set_host(struct usb_otg *otg, struct > usb_bus *host) > static int omap_usb_set_peripheral(struct usb_otg *otg, > struct usb_gadget *gadget) > { > - struct usb_phy *phy = otg->phy; > - > otg->gadget = gadget; > if (!gadget) > - phy->state = OTG_STATE_UNDEFINED; > + otg->state = OTG_STATE_UNDEFINED; > > return 0; > } > diff --git a/drivers/usb/chipidea/debug.c b/drivers/usb/chipidea/debug.c > index 795d6538d630..8878eea38d44 100644 > --- a/drivers/usb/chipidea/debug.c > +++ b/drivers/usb/chipidea/debug.c > @@ -220,7 +220,7 @@ static int ci_otg_show(struct seq_file *s, void *unused) > > /* -- State - */ > seq_printf(s, "OTG state: %s\n\n", > - usb_otg_state_string(ci->transceiver->state)); > + usb_otg_state_string(ci->transceiver->otg.state)); > > /* -- State Machine Variables - */ > seq_printf(s, "a_bus_drop: %d\n", fsm->a_bus_drop); > diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c > index caaabc58021e..8cb2508a6b71 100644 > --- a/drivers/usb/chipidea/otg_fsm.c > +++ b/drivers/usb/chipidea/otg_fsm.c > @@ -328,7 +328,7 @@ static void b_ssend_srp_tmout_func(void *ptr, unsigned > long indicator) > set_tmout(ci, indicator); > > /* only vbus fall below B_sess_vld in b_idle state */ > - if (ci->transceiver->state == OTG_STATE_B_IDLE) > + if (ci->fsm.otg->state == OTG_STATE_B_IDLE) > ci_otg_queue_work(ci); > } > > @@ -582,11 +582,11 @@ int ci_otg_fsm_work(struct ci_hdrc *ci) >* when there is no gadget class driver >*/ > if (ci->fsm.id && !(ci->driver) && > - ci->transceiver->state < OTG_STATE_A_IDLE) > + ci->fsm.otg->state < OTG_STATE_A_IDLE) > return 0; > > if (otg_statemachine(&ci->fsm)) { > - if (ci->transceiver->state == OTG_STATE_A_IDLE) { > + if (ci->fsm.otg->state == OTG_STATE_A_IDLE) { > /* >* Further state change for cases: >* a_idle to b_idle; or > @@ -600,7 +600,7 @@ int ci_otg_fsm_work(struct ci_hdrc *ci) > ci_otg_queue_work(ci); > if (ci->id_event) > ci->id_event = false; > - } else if (ci->transceiver->state == OTG_STATE_B_IDLE) { > + } else if (ci->fsm.otg->state == OTG_STATE_B_IDLE) { > if (ci->fsm.b_sess_v
Re: [PATCH v7 2/7] usb: rename phy to usb_phy in OTG
On Tue, Oct 28, 2014 at 05:35:36PM +0100, Antoine Tenart wrote: > This patch prepares the introduction of the generic PHY support in the > USB OTG common functions. The USB PHY member of the OTG structure is > renamed to 'usb_phy' and modifications are done in all drivers accessing > it. Renaming this pointer will allow to keep the compatibility for USB > PHY drivers. > > Signed-off-by: Antoine Tenart Acked-by: Felipe Balbi > --- > drivers/phy/phy-omap-usb2.c | 6 ++-- > drivers/usb/chipidea/otg_fsm.c | 2 +- > drivers/usb/phy/phy-ab8500-usb.c| 6 ++-- > drivers/usb/phy/phy-fsl-usb.c | 13 > drivers/usb/phy/phy-generic.c | 2 +- > drivers/usb/phy/phy-gpio-vbus-usb.c | 4 +-- > drivers/usb/phy/phy-isp1301-omap.c | 10 +++--- > drivers/usb/phy/phy-msm-usb.c | 61 > +++-- > drivers/usb/phy/phy-mv-usb.c| 4 +-- > drivers/usb/phy/phy-tahvo.c | 8 +++-- > drivers/usb/phy/phy-ulpi.c | 6 ++-- > include/linux/usb/otg.h | 2 +- > 12 files changed, 65 insertions(+), 59 deletions(-) > > diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c > index 9f4093590f4c..32c3e86b4935 100644 > --- a/drivers/phy/phy-omap-usb2.c > +++ b/drivers/phy/phy-omap-usb2.c > @@ -60,7 +60,7 @@ EXPORT_SYMBOL_GPL(omap_usb2_set_comparator); > > static int omap_usb_set_vbus(struct usb_otg *otg, bool enabled) > { > - struct omap_usb *phy = phy_to_omapusb(otg->phy); > + struct omap_usb *phy = phy_to_omapusb(otg->usb_phy); > > if (!phy->comparator) > return -ENODEV; > @@ -70,7 +70,7 @@ static int omap_usb_set_vbus(struct usb_otg *otg, bool > enabled) > > static int omap_usb_start_srp(struct usb_otg *otg) > { > - struct omap_usb *phy = phy_to_omapusb(otg->phy); > + struct omap_usb *phy = phy_to_omapusb(otg->usb_phy); > > if (!phy->comparator) > return -ENODEV; > @@ -251,7 +251,7 @@ static int omap_usb2_probe(struct platform_device *pdev) > otg->set_vbus = omap_usb_set_vbus; > if (phy_data->flags & OMAP_USB2_HAS_START_SRP) > otg->start_srp = omap_usb_start_srp; > - otg->phy= &phy->phy; > + otg->usb_phy= &phy->phy; > > platform_set_drvdata(pdev, phy); > > diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c > index 8cb2508a6b71..d8490e758a74 100644 > --- a/drivers/usb/chipidea/otg_fsm.c > +++ b/drivers/usb/chipidea/otg_fsm.c > @@ -788,7 +788,7 @@ int ci_hdrc_otg_fsm_init(struct ci_hdrc *ci) > return -ENOMEM; > } > > - otg->phy = ci->transceiver; > + otg->usb_phy = ci->transceiver; > otg->gadget = &ci->gadget; > ci->fsm.otg = otg; > ci->transceiver->otg = ci->fsm.otg; > diff --git a/drivers/usb/phy/phy-ab8500-usb.c > b/drivers/usb/phy/phy-ab8500-usb.c > index 2d5250143ce1..3a802fa7dae2 100644 > --- a/drivers/usb/phy/phy-ab8500-usb.c > +++ b/drivers/usb/phy/phy-ab8500-usb.c > @@ -1056,7 +1056,7 @@ static int ab8500_usb_set_peripheral(struct usb_otg > *otg, > if (!otg) > return -ENODEV; > > - ab = phy_to_ab(otg->phy); > + ab = phy_to_ab(otg->usb_phy); > > ab->phy.otg->gadget = gadget; > > @@ -1080,7 +1080,7 @@ static int ab8500_usb_set_host(struct usb_otg *otg, > struct usb_bus *host) > if (!otg) > return -ENODEV; > > - ab = phy_to_ab(otg->phy); > + ab = phy_to_ab(otg->usb_phy); > > ab->phy.otg->host = host; > > @@ -1382,7 +1382,7 @@ static int ab8500_usb_probe(struct platform_device > *pdev) > ab->phy.set_power = ab8500_usb_set_power; > ab->phy.otg->state = OTG_STATE_UNDEFINED; > > - otg->phy= &ab->phy; > + otg->usb_phy= &ab->phy; > otg->set_host = ab8500_usb_set_host; > otg->set_peripheral = ab8500_usb_set_peripheral; > > diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c > index 15d7a81eece5..b7f36b212422 100644 > --- a/drivers/usb/phy/phy-fsl-usb.c > +++ b/drivers/usb/phy/phy-fsl-usb.c > @@ -499,7 +499,8 @@ int fsl_otg_start_host(struct otg_fsm *fsm, int on) > { > struct usb_otg *otg = fsm->otg; > struct device *dev; > - struct fsl_otg *otg_dev = container_of(otg->phy, struct fsl_otg, phy); > + struct fsl_otg *otg_dev = > + container_of(otg->usb_phy, struct fsl_otg, phy); > u32 retval = 0; > > if (!otg->host) > @@ -594,7 +595,7 @@ static int fsl_otg_set_host(struct usb_otg *otg, struct > usb_bus *host) > if (!otg) > return -ENODEV; > > - otg_dev = container_of(otg->phy, struct fsl_otg, phy); > + otg_dev = container_of(otg->usb_phy, struct fsl_otg, phy); > if (otg_dev != fsl_otg_dev) > return -ENODEV; > > @@ -644,7 +645,7 @@ static int fsl_otg_set_peripheral(struct usb_otg *otg
Re: [PATCH v7 0/7] usb: add support for the generic PHY framework
Hi, On Tue, Oct 28, 2014 at 05:35:34PM +0100, Antoine Tenart wrote: > The series can be found at: > git://git.free-electrons.com:users/antoine-tenart/linux.git usb-phy > > Changes since v6: > - rebased on top of v3.18-rc2 > > Changes since v5: > - rebased on the latest version of Sergei's series[1] > - fixed one modifiaction made in the wrong patch > > Changes since v4: > - reworked the PHY handling in ci_hdrc_probe() > - fixed a rebase error > > Changes since v3: > - moved phy_exit() after phy_power_on() > - fixed the PHY handling in ci_hdrc_probe() > - some little fixes > > Changes since v2: > - rebased the series on top of v3.17-rc1 > - switched to devm_phy_get() to handle non DT cases > - moved usb_otg into the ci_hdrc structure > > Changes since v1: > - rebased the series on top of [2] (generic PHY support for HCD) > - split s/phy/usb_phy/ renaming and generic PHY support in separate > patches > > [1] https://www.mail-archive.com/linux-usb%40vger.kernel.org/msg48068.html > > Antoine Tenart (7): > usb: move the OTG state from the USB PHY to the OTG structure > usb: rename phy to usb_phy in OTG > usb: add support to the generic PHY framework in OTG > usb: allow to supply the PHY in the drivers when using HCD > usb: rename transceiver and phy to usb_phy in ChipIdea > usb: chipidea: move usb_otg into struct ci_hdrc > usb: chipidea: add support to the generic PHY framework in ChipIdea quick question, who do you guys want this patchset to go through ? If it's me, I can take them no problem. -- balbi signature.asc Description: Digital signature
Re: [PATCH v7 1/7] usb: move the OTG state from the USB PHY to the OTG structure
On Thu, Oct 30, 2014 at 11:31:48AM -0500, Felipe Balbi wrote: > On Tue, Oct 28, 2014 at 05:35:35PM +0100, Antoine Tenart wrote: > > Before using the PHY framework instead of the USB PHY one, we need to > > move the OTG state into another place, since it won't be available when > > USB PHY isn't used. This patch moves the OTG state into the OTG > > structure, and makes all the needed modifications in the drivers > > using the OTG state. > > > > Signed-off-by: Antoine Tenart > > Acked-by: Peter Chen > > Acked-by: Felipe Balbi fails to apply: $ patch -p1 --dry-run < patch.diff checking file drivers/phy/phy-omap-usb2.c checking file drivers/usb/chipidea/debug.c checking file drivers/usb/chipidea/otg_fsm.c checking file drivers/usb/common/usb-otg-fsm.c checking file drivers/usb/host/ohci-omap.c checking file drivers/usb/musb/am35x.c checking file drivers/usb/musb/blackfin.c checking file drivers/usb/musb/da8xx.c checking file drivers/usb/musb/davinci.c checking file drivers/usb/musb/musb_core.c checking file drivers/usb/musb/musb_dsps.c checking file drivers/usb/musb/musb_gadget.c Hunk #3 succeeded at 1791 (offset -1 lines). Hunk #4 succeeded at 1857 (offset -3 lines). Hunk #5 FAILED at 1945. Hunk #6 succeeded at 1968 (offset -7 lines). Hunk #7 succeeded at 1982 (offset -7 lines). Hunk #8 succeeded at 1994 (offset -7 lines). Hunk #9 succeeded at 2012 (offset -7 lines). Hunk #10 succeeded at 2043 (offset -7 lines). Hunk #11 succeeded at 2118 (offset -7 lines). 1 out of 11 hunks FAILED checking file drivers/usb/musb/musb_host.c checking file drivers/usb/musb/musb_virthub.c checking file drivers/usb/musb/omap2430.c Hunk #6 succeeded at 180 (offset 1 line). Hunk #7 succeeded at 192 (offset 1 line). Hunk #8 succeeded at 201 (offset 1 line). Hunk #9 succeeded at 266 (offset 1 line). Hunk #10 succeeded at 280 (offset 1 line). checking file drivers/usb/musb/tusb6010.c checking file drivers/usb/musb/ux500.c checking file drivers/usb/phy/phy-ab8500-usb.c checking file drivers/usb/phy/phy-fsl-usb.c checking file drivers/usb/phy/phy-generic.c checking file drivers/usb/phy/phy-gpio-vbus-usb.c checking file drivers/usb/phy/phy-msm-usb.c Hunk #13 succeeded at 1769 (offset -6 lines). checking file drivers/usb/phy/phy-mv-usb.c Hunk #5 succeeded at 715 (offset -2 lines). checking file include/linux/usb/otg.h checking file include/linux/usb/phy.h Please rebase on my testing/next and I'll take the series. When rebasing, then add Peter's Tested-by/Acked-by where they're missing. cheers -- balbi signature.asc Description: Digital signature
Re: [PATCH v4 20/20] usb: dwc3: make HIRD threshold configurable
On Thu, Oct 30, 2014 at 06:08:45PM +0800, Huang Rui wrote: > HIRD threshold should be configurable by different platforms. > > From DesignWare databook: > When HIRD_Threshold[4] is set to 1b1 and HIRD value is greater than or > equal to the value in HIRD_Threshold[3:0], dwc3 asserts output signals > utmi_l1_suspend_n to put PHY into Deep Low-Power mode in L1. > > When HIRD_Threshold[4] is set to 1b0 or the HIRD value is less than > HIRD_Threshold[3:0], dwc3 asserts output signals utmi_sleep_n on L1. > > Signed-off-by: Huang Rui > --- > Documentation/devicetree/bindings/usb/dwc3.txt | 3 +++ > drivers/usb/dwc3/core.c| 17 + > drivers/usb/dwc3/core.h| 6 ++ > drivers/usb/dwc3/gadget.c | 6 +- > drivers/usb/dwc3/platform_data.h | 3 +++ > 5 files changed, 30 insertions(+), 5 deletions(-) > > diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt > b/Documentation/devicetree/bindings/usb/dwc3.txt > index feaf2c8..5b99755 100644 > --- a/Documentation/devicetree/bindings/usb/dwc3.txt > +++ b/Documentation/devicetree/bindings/usb/dwc3.txt > @@ -34,6 +34,9 @@ Optional properties: > LTSSM during USB3 Compliance mode. > - snps,dis_u3_susphy_quirk: when set core will disable USB3 suspend phy. > - snps,dis_u2_susphy_quirk: when set core will disable USB2 suspend phy. > + - snps,is-utmi-l1-suspend: true when DWC3 asserts output signal > + utmi_l1_suspend_n, false when asserts utmi_sleep_n > + - snps,hird-threshold: HIRD threshold > > This is usually a subnode to DWC3 glue to which it is connected. > > diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c > index a28ed1c..f4172ab 100644 > --- a/drivers/usb/dwc3/core.c > +++ b/drivers/usb/dwc3/core.c > @@ -729,6 +729,7 @@ static int dwc3_probe(struct platform_device *pdev) > struct dwc3 *dwc; > u8 lpm_nyet_threshold; > u8 tx_de_emphasis; > + u8 hird_threshold; > > int ret; > > @@ -790,12 +791,22 @@ static int dwc3_probe(struct platform_device *pdev) > /* default to -3.5dB de-emphasis */ > tx_de_emphasis = 1; > > + /* > + * defalut to assert utmi_sleep_n and use maximum allowed HIRD default -- balbi signature.asc Description: Digital signature
Re: [PATCH v4 19/20] usb: dwc3: add support for AMD Nolan platform
On Thu, Oct 30, 2014 at 06:08:44PM +0800, Huang Rui wrote: > This patch adds support for AMD Nolan (NL) FPGA and SoC platform. > > Cc: Jason Chang > Signed-off-by: Huang Rui > --- > drivers/usb/dwc3/dwc3-pci.c | 23 +++ > 1 file changed, 23 insertions(+) > > diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c > index ada975f..257fb3f9e 100644 > --- a/drivers/usb/dwc3/dwc3-pci.c > +++ b/drivers/usb/dwc3/dwc3-pci.c > @@ -145,6 +145,28 @@ static int dwc3_pci_probe(struct pci_dev *pci, > res[1].name = "dwc_usb3"; > res[1].flags= IORESOURCE_IRQ; > > + if (pci->vendor == PCI_VENDOR_ID_AMD && > + pci->device == PCI_DEVICE_ID_AMD_NL_USB) { > + dwc3_pdata.has_lpm_erratum = true; > + dwc3_pdata.lpm_nyet_threshold = 0xf; > + > + dwc3_pdata.u2exit_lfps_quirk = true; > + dwc3_pdata.u2ss_inp3_quirk = true; > + dwc3_pdata.req_p1p2p3_quirk = true; > + dwc3_pdata.del_p1p2p3_quirk = true; > + dwc3_pdata.del_phy_power_chg_quirk = true; > + dwc3_pdata.lfps_filter_quirk = true; > + dwc3_pdata.rx_detect_poll_quirk = true; > + > + dwc3_pdata.tx_de_emphasis_quirk = true; > + dwc3_pdata.tx_de_emphasis = 1; > + > + /* FIXME these quirks should move when AMD NL taps out */ do you mean ? /* * FIXME these quirks should be removed when AMD NL * tapes out */ -- balbi signature.asc Description: Digital signature
Re: [PATCH v4 16/20] usb: dwc3: add disable usb2 suspend phy quirk
On Thu, Oct 30, 2014 at 06:08:41PM +0800, Huang Rui wrote: > This patch adds disable usb2 suspend phy quirk, and some special platforms > can configure that if it is needed. > > Signed-off-by: Huang Rui > --- > Documentation/devicetree/bindings/usb/dwc3.txt | 1 + > drivers/usb/dwc3/core.c| 7 +++ > drivers/usb/dwc3/core.h| 2 ++ > drivers/usb/dwc3/platform_data.h | 1 + > 4 files changed, 11 insertions(+) > > diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt > b/Documentation/devicetree/bindings/usb/dwc3.txt > index 3720fca..feaf2c8 100644 > --- a/Documentation/devicetree/bindings/usb/dwc3.txt > +++ b/Documentation/devicetree/bindings/usb/dwc3.txt > @@ -33,6 +33,7 @@ Optional properties: > - snps,tx_de_emphasis: the value driven to the PHY is controlled by the > LTSSM during USB3 Compliance mode. > - snps,dis_u3_susphy_quirk: when set core will disable USB3 suspend phy. > + - snps,dis_u2_susphy_quirk: when set core will disable USB2 suspend phy. > > This is usually a subnode to DWC3 glue to which it is connected. > > diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c > index fdc715a..a28ed1c 100644 > --- a/drivers/usb/dwc3/core.c > +++ b/drivers/usb/dwc3/core.c > @@ -423,6 +423,10 @@ static void dwc3_phy_setup(struct dwc3 *dwc) > if (dwc->revision > DWC3_REVISION_194A) > reg |= DWC3_GUSB2PHYCFG_SUSPHY; > > + /* FIXME will move FPGA flag when AMD NL taps out */ no need to mention AMD NL here. We still want to have is_fpga flag, just dwc3-pci will be patches once AMD NL tapes out. -- balbi signature.asc Description: Digital signature
Re: [PATCH v4 14/20] usb: dwc3: add Tx de-emphasis quirk
On Thu, Oct 30, 2014 at 06:08:39PM +0800, Huang Rui wrote: > This patch adds Tx de-emphasis quirk, and the Tx de-emphasis value is > configurable according to PIPE3 specification. > > Value Description > 0 -6dB de-emphasis > 1 -3.5dB de-emphasis > 2 No de-emphasis > 3 Reserved > > It can be configured on DT or platform data. > > Signed-off-by: Huang Rui doesn't apply: checking file Documentation/devicetree/bindings/usb/dwc3.txt checking file drivers/usb/dwc3/core.c Hunk #2 succeeded at 718 (offset -2 lines). Hunk #3 succeeded at 777 (offset -2 lines). Hunk #4 succeeded at 807 (offset -2 lines). Hunk #5 succeeded at 829 (offset -2 lines). Hunk #6 succeeded at 840 (offset -2 lines). checking file drivers/usb/dwc3/core.h Hunk #2 FAILED at 697. 1 out of 3 hunks FAILED checking file drivers/usb/dwc3/platform_data.h please rebase on testing/next -- balbi signature.asc Description: Digital signature
Re: [PATCH RESEND V4 2/9] mailbox: Add NVIDIA Tegra XUSB mailbox driver
On Thu, Oct 30, 2014 at 6:22 AM, Thierry Reding wrote: > On Wed, Oct 29, 2014 at 11:02:36AM -0700, Andrew Bresticker wrote: > [...] >> > Maybe something like this patch would be more correct in handling >> > this: >> > >> > diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c >> > index afcb430508ec..85691a7d8ca6 100644 >> > --- a/drivers/mailbox/mailbox.c >> > +++ b/drivers/mailbox/mailbox.c >> > @@ -117,10 +117,11 @@ static void poll_txdone(unsigned long data) >> > struct mbox_chan *chan = &mbox->chans[i]; >> > >> > if (chan->active_req && chan->cl) { >> > - resched = true; >> > txdone = chan->mbox->ops->last_tx_done(chan); >> > if (txdone) >> > tx_tick(chan, 0); >> > + else >> > + resched = true; >> > } >> > } >> >> ... but we still need to re-arm the timer if tx_tick() submits another >> message. Perhaps the better thing to do is to have msg_submit() arm >> the timer. > > I think we need both. If the last transmission isn't done yet we still > want to keep polling. And we also want to poll if a new message is sent > subsequently. > > Perhaps it would be as easy as moving the poll handling code from > mbox_send_message() (if (chan->txdone_method == TXDONE_BY_POLL)) into > msg_submit()? That has the additional advantage of being able to omit > the polling when an error happens during the mbox' .send_data(). Yes, this is exactly what I've done :). -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH usb v2 19/29] host: ehci-sead3: remove duplicate check on resource
Hello. On 10/30/2014 06:52 PM, varkabhad...@gmail.com wrote: From: Varka Bhadram Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram Acked-by: Alan Stern --- drivers/usb/host/ehci-sead3.c |5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/usb/host/ehci-sead3.c b/drivers/usb/host/ehci-sead3.c index cf12676..9b6e8d0 100644 --- a/drivers/usb/host/ehci-sead3.c +++ b/drivers/usb/host/ehci-sead3.c @@ -110,14 +110,13 @@ static int ehci_hcd_sead3_drv_probe(struct platform_device *pdev) return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - hcd->rsrc_start = res->start; - hcd->rsrc_len = resource_size(res); Oops, this would blow up if 'res' is NULL. - hcd->regs = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(hcd->regs)) { ret = PTR_ERR(hcd->regs); goto err1; } + hcd->rsrc_start = res->start; + hcd->rsrc_len = resource_size(res); So this is actually a fix, not a cleanup. WBR, Sergei -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH usb v2 19/29] host: ehci-sead3: remove duplicate check on resource
On 10/30/2014 08:08 PM, Sergei Shtylyov wrote: From: Varka Bhadram Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram Acked-by: Alan Stern --- drivers/usb/host/ehci-sead3.c |5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/usb/host/ehci-sead3.c b/drivers/usb/host/ehci-sead3.c index cf12676..9b6e8d0 100644 --- a/drivers/usb/host/ehci-sead3.c +++ b/drivers/usb/host/ehci-sead3.c @@ -110,14 +110,13 @@ static int ehci_hcd_sead3_drv_probe(struct platform_device *pdev) return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -hcd->rsrc_start = res->start; -hcd->rsrc_len = resource_size(res); Oops, this would blow up if 'res' is NULL. - hcd->regs = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(hcd->regs)) { ret = PTR_ERR(hcd->regs); goto err1; } +hcd->rsrc_start = res->start; +hcd->rsrc_len = resource_size(res); So this is actually a fix, not a cleanup. And the subject doesn't correctly describe what the patch does too... WBR, Sergei -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH RESEND V4 4/9] pinctrl: tegra-xusb: Add USB PHY support
On Thu, Oct 30, 2014 at 6:45 AM, Thierry Reding wrote: > On Wed, Oct 29, 2014 at 12:43:36PM -0700, Andrew Bresticker wrote: >> >> diff --git a/drivers/pinctrl/pinctrl-tegra-xusb.c >> >> b/drivers/pinctrl/pinctrl-tegra-xusb.c > [...] >> >> + >> >> + for (i = 0; i < TEGRA_XUSB_USB3_PHYS; i++) { >> >> + if (phy == padctl->phys[TEGRA_XUSB_PADCTL_USB3_P0 + i]) >> >> + break; >> > >> > You could simply return i here and then BUG_ON unconditionally. >> > >> >> + } >> >> + BUG_ON(i == TEGRA_XUSB_USB3_PHYS); >> >> + >> >> + return i; >> >> +} >> > >> > Actually, thinking about it some more, perhaps making this a WARN_ON() >> > and returning an error so that we can continue and propagate the error >> > would be more useful. BUG_ON() will completely hang the kernel with no >> > way out but rebooting. WARN_ON() will give a hint about something being >> > wrong and returning an error will allow the kernel to continue to run, >> > which might be the only way to diagnose and fix the problem, even if it >> > means that USB 3.0 support will be disabled. >> >> I felt like BUG_ON is more appropriate here. Hitting this case means >> there's a bug in the PHY core or a driver has passed a bogus pointer >> and the stack dump produced by the BUG_ON should make it obvious as to >> what the issue is. I don't feel too strongly about it though. > > The problem with BUG_ON() is that you won't be able to go any further. > So if this were to happen on a device with no serial you might not even > get to a point where you actually see an error message. Handling this > more gracefully by propagating the error code and failing .probe() does > not seem overly complicated and the WARN_ON() output will hopefully > still be noticed (it probably will be after the user can't get USB to > work). Ok. >> >> @@ -936,6 +2098,18 @@ static int tegra_xusb_padctl_probe(struct >> >> platform_device *pdev) >> >> goto unregister; >> >> } >> >> >> >> + INIT_WORK(&padctl->mbox_req_work, tegra_xusb_phy_mbox_work); >> >> + padctl->mbox_client.dev = &pdev->dev; >> >> + padctl->mbox_client.tx_block = true; >> >> + padctl->mbox_client.tx_tout = 0; >> >> + padctl->mbox_client.rx_callback = tegra_xusb_phy_mbox_rx; >> >> + padctl->mbox_chan = mbox_request_channel(&padctl->mbox_client, 0); >> >> + if (IS_ERR(padctl->mbox_chan)) { >> >> + err = PTR_ERR(padctl->mbox_chan); >> >> + dev_err(&pdev->dev, "failed to request mailbox: %d\n", err); >> >> + goto unregister; >> >> + } >> > >> > I think this should be done before the registering the PHY provider so >> > that we don't expose one (even for only a very short time) before we >> > haven't made sure that it can be used. >> > >> > Also, this effectively makes the mailbox mandatory, which means that the >> > above code is going to break on older DTBs. So I think we have no choice >> > but to make mailbox (and hence XUSB) support optional. >> >> I understand the need for binding stability, but it's not like these >> bindings have been around for very long (a release or two?) and this >> series has existed for almost the same amount of time. Are there >> really any DTBs out there that are going to break because of this? > > Every DTB created from a kernel version that has the original binding > but not the one modified as part of this series is going to break. Last > time I checked there weren't any exceptions to this rule. Note, though, > that the rule is that existing functionality must not break. That is, > SATA and PCIe should remain functional, so it should be fine if you just > don't register any of the USB PHYs when the request for a mailbox > channel fails. Something along these lines should do it: > > padctl->mbox_chan = mbox_request_channel(...); > if (!IS_ERR(padctl->mbox_chan)) { > err = tegra_xusb_padctl_setup_usb(...); > ... > } Ok. >> >> diff --git a/include/soc/tegra/xusb.h b/include/soc/tegra/xusb.h >> >> index cfe211d..149434f 100644 >> >> --- a/include/soc/tegra/xusb.h >> >> +++ b/include/soc/tegra/xusb.h >> >> @@ -10,6 +10,13 @@ >> >> #ifndef __SOC_TEGRA_XUSB_H__ >> >> #define __SOC_TEGRA_XUSB_H__ >> >> >> >> +#define TEGRA_XUSB_USB3_PHYS 2 >> >> +#define TEGRA_XUSB_UTMI_PHYS 3 >> >> +#define TEGRA_XUSB_HSIC_PHYS 2 >> >> +#define TEGRA_XUSB_NUM_USB_PHYS (TEGRA_XUSB_USB3_PHYS + >> >> TEGRA_XUSB_UTMI_PHYS + \ >> >> + TEGRA_XUSB_HSIC_PHYS) >> >> +#define TEGRA_XUSB_NUM_PHYS (TEGRA_XUSB_NUM_USB_PHYS + 2) /* + SATA & >> >> PCIe */ >> > >> > These are really XUSB pad controller specific defines, why does anyone >> > else need to know this? >> >> They're not pad controller specific. They're also used in the xHCI host >> driver. > > I keep thinking that there should be a way around this. Of course if > both the XHCI and mailbox drivers were merged, then there'd be no need > to exp
Re: [PATCH usb v2 21/29] host: uhci-platform: remove duplicate check on resource
On 10/30/2014 06:53 PM, varkabhad...@gmail.com wrote: From: Varka Bhadram Sanity check on resource happening with devm_ioremap_resource(). Also fix in accessing NULL if resource didn't get. Yes, this is a fix as well, and the subject doesn't match what the patch does. Signed-off-by: Varka Bhadram Acked-by: Alan Stern --- drivers/usb/host/uhci-platform.c |7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/usb/host/uhci-platform.c b/drivers/usb/host/uhci-platform.c index b987f1d..081330c 100644 --- a/drivers/usb/host/uhci-platform.c +++ b/drivers/usb/host/uhci-platform.c @@ -86,14 +86,15 @@ static int uhci_hcd_platform_probe(struct platform_device *pdev) return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - hcd->rsrc_start = res->start; - hcd->rsrc_len = resource_size(res); - hcd->regs = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(hcd->regs)) { ret = PTR_ERR(hcd->regs); goto err_rmr; } + + hcd->rsrc_start = res->start; + hcd->rsrc_len = resource_size(res); + WBR, Sergei -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH usb v2 26/29] renesas_usbhs: common: remove duplicate check on resource
On 10/30/2014 06:53 PM, varkabhad...@gmail.com wrote: From: Varka Bhadram Sanity check on resource happening with devm_ioremap_resource(). Signed-off-by: Varka Bhadram --- drivers/usb/renesas_usbhs/common.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c index b3b6813..3ffd552 100644 --- a/drivers/usb/renesas_usbhs/common.c +++ b/drivers/usb/renesas_usbhs/common.c @@ -497,8 +497,9 @@ static int usbhs_probe(struct platform_device *pdev) /* platform data */ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); - if (!res || !irq_res) { + if (!irq_res) { dev_err(&pdev->dev, "Not enough Renesas USB platform resources.\n"); return -ENODEV; } You promised to change this patch but haven't. Why? WBR, Sergei -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH RESEND V4 5/9] of: Add NVIDIA Tegra xHCI controller binding
On Thu, Oct 30, 2014 at 6:55 AM, Thierry Reding wrote: > On Wed, Oct 29, 2014 at 09:37:14AM -0700, Andrew Bresticker wrote: >> On Wed, Oct 29, 2014 at 2:43 AM, Thierry Reding >> wrote: >> > On Tue, Oct 28, 2014 at 03:27:50PM -0700, Andrew Bresticker wrote: >> > [...] >> >> diff --git >> >> a/Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-xusb-padctl.txt >> >> >> >> b/Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-xusb-padctl.txt >> > [...] >> >> +Optional properties: >> >> +--- >> >> +- vbus-{0,1,2}-supply: VBUS regulator for the corresponding UTMI pad. >> >> +- vddio-hsic-supply: VDDIO regulator for the HSIC pads. >> >> +- nvidia,usb3-port-{0,1}-lane: PCIe/SATA lane to which the corresponding >> >> USB3 >> >> + port is mapped. See for >> >> the list >> >> + of valid values. >> > >> > I dislike how we now need to provide a list of all pins in the header >> > file, where previously we used strings for this. This could become very >> > ugly if the set of pins changes in future generations of this IP block. >> > >> > Could we instead derive this from the pinmux nodes? For example you have >> > this in the example below: >> > >> > usb3p0 { >> > nvidia,lanes = "pcie-0"; >> > ... >> > }; >> > >> > Perhaps what we need is to either key off the node name or add another >> > property, such as: >> > >> > nvidia,usb3-port = <0>; >> > >> > This would match the nvidia,usb2-port property that you've added below. >> >> That is actually how I described the USB3 port to SS lane mapping >> originally, but in review of an earlier version of this series, >> Stephen suggested that I make it a separate, not pinconfig property >> since it wasn't a value written directly to the hardware. I'm fine >> with changing it back as the pinconfig property makes more sense to me >> as well. > > Hmm... I had considered it a mux option of the specific lane. If the > function is usb3, it'd still need to be muxed to one of the ports. So > it's additional information associated with the usb3 function. > > I did look through the driver changes and can't really make out which > part of the code actually performs this assignment. Can you point me to > it? There's not really an assignment. The property is used to map between a lane (e.g. PCIe-0 or SATA) and the USB3.0 port it's mapped to. For an example of where it's used, take a look at usb3_phy_power_on(). There are certain per-lane registers which need to be programmed in addition to the per-USB3.0 port pad registers. This mapping is used to determine which lane needs to be programmed. -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH RESEND V4 5/9] of: Add NVIDIA Tegra xHCI controller binding
On Thu, Oct 30, 2014 at 10:19:21AM -0700, Andrew Bresticker wrote: > On Thu, Oct 30, 2014 at 6:55 AM, Thierry Reding > wrote: > > On Wed, Oct 29, 2014 at 09:37:14AM -0700, Andrew Bresticker wrote: > >> On Wed, Oct 29, 2014 at 2:43 AM, Thierry Reding > >> wrote: > >> > On Tue, Oct 28, 2014 at 03:27:50PM -0700, Andrew Bresticker wrote: > >> > [...] > >> >> diff --git > >> >> a/Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-xusb-padctl.txt > >> >> > >> >> b/Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-xusb-padctl.txt > >> > [...] > >> >> +Optional properties: > >> >> +--- > >> >> +- vbus-{0,1,2}-supply: VBUS regulator for the corresponding UTMI pad. > >> >> +- vddio-hsic-supply: VDDIO regulator for the HSIC pads. > >> >> +- nvidia,usb3-port-{0,1}-lane: PCIe/SATA lane to which the > >> >> corresponding USB3 > >> >> + port is mapped. See for > >> >> the list > >> >> + of valid values. > >> > > >> > I dislike how we now need to provide a list of all pins in the header > >> > file, where previously we used strings for this. This could become very > >> > ugly if the set of pins changes in future generations of this IP block. > >> > > >> > Could we instead derive this from the pinmux nodes? For example you have > >> > this in the example below: > >> > > >> > usb3p0 { > >> > nvidia,lanes = "pcie-0"; > >> > ... > >> > }; > >> > > >> > Perhaps what we need is to either key off the node name or add another > >> > property, such as: > >> > > >> > nvidia,usb3-port = <0>; > >> > > >> > This would match the nvidia,usb2-port property that you've added below. > >> > >> That is actually how I described the USB3 port to SS lane mapping > >> originally, but in review of an earlier version of this series, > >> Stephen suggested that I make it a separate, not pinconfig property > >> since it wasn't a value written directly to the hardware. I'm fine > >> with changing it back as the pinconfig property makes more sense to me > >> as well. > > > > Hmm... I had considered it a mux option of the specific lane. If the > > function is usb3, it'd still need to be muxed to one of the ports. So > > it's additional information associated with the usb3 function. > > > > I did look through the driver changes and can't really make out which > > part of the code actually performs this assignment. Can you point me to > > it? > > There's not really an assignment. The property is used to map between > a lane (e.g. PCIe-0 or SATA) and the USB3.0 port it's mapped to. For > an example of where it's used, take a look at usb3_phy_power_on(). > There are certain per-lane registers which need to be programmed in > addition to the per-USB3.0 port pad registers. This mapping is used > to determine which lane needs to be programmed. Are you saying the mapping of lane to USB port is fixed? That is, PCIe-0 lane is always used for USB port X and SATA always for USB port Y? If so I'd argue that we don't need this property in DT at all. Thierry pgperXNswbFZB.pgp Description: PGP signature
Re: [PATCH RESEND V4 5/9] of: Add NVIDIA Tegra xHCI controller binding
On Thu, Oct 30, 2014 at 10:24 AM, Thierry Reding wrote: > On Thu, Oct 30, 2014 at 10:19:21AM -0700, Andrew Bresticker wrote: >> On Thu, Oct 30, 2014 at 6:55 AM, Thierry Reding >> wrote: >> > On Wed, Oct 29, 2014 at 09:37:14AM -0700, Andrew Bresticker wrote: >> >> On Wed, Oct 29, 2014 at 2:43 AM, Thierry Reding >> >> wrote: >> >> > On Tue, Oct 28, 2014 at 03:27:50PM -0700, Andrew Bresticker wrote: >> >> > [...] >> >> >> diff --git >> >> >> a/Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-xusb-padctl.txt >> >> >> >> >> >> b/Documentation/devicetree/bindings/pinctrl/nvidia,tegra124-xusb-padctl.txt >> >> > [...] >> >> >> +Optional properties: >> >> >> +--- >> >> >> +- vbus-{0,1,2}-supply: VBUS regulator for the corresponding UTMI pad. >> >> >> +- vddio-hsic-supply: VDDIO regulator for the HSIC pads. >> >> >> +- nvidia,usb3-port-{0,1}-lane: PCIe/SATA lane to which the >> >> >> corresponding USB3 >> >> >> + port is mapped. See for >> >> >> the list >> >> >> + of valid values. >> >> > >> >> > I dislike how we now need to provide a list of all pins in the header >> >> > file, where previously we used strings for this. This could become very >> >> > ugly if the set of pins changes in future generations of this IP block. >> >> > >> >> > Could we instead derive this from the pinmux nodes? For example you have >> >> > this in the example below: >> >> > >> >> > usb3p0 { >> >> > nvidia,lanes = "pcie-0"; >> >> > ... >> >> > }; >> >> > >> >> > Perhaps what we need is to either key off the node name or add another >> >> > property, such as: >> >> > >> >> > nvidia,usb3-port = <0>; >> >> > >> >> > This would match the nvidia,usb2-port property that you've added below. >> >> >> >> That is actually how I described the USB3 port to SS lane mapping >> >> originally, but in review of an earlier version of this series, >> >> Stephen suggested that I make it a separate, not pinconfig property >> >> since it wasn't a value written directly to the hardware. I'm fine >> >> with changing it back as the pinconfig property makes more sense to me >> >> as well. >> > >> > Hmm... I had considered it a mux option of the specific lane. If the >> > function is usb3, it'd still need to be muxed to one of the ports. So >> > it's additional information associated with the usb3 function. >> > >> > I did look through the driver changes and can't really make out which >> > part of the code actually performs this assignment. Can you point me to >> > it? >> >> There's not really an assignment. The property is used to map between >> a lane (e.g. PCIe-0 or SATA) and the USB3.0 port it's mapped to. For >> an example of where it's used, take a look at usb3_phy_power_on(). >> There are certain per-lane registers which need to be programmed in >> addition to the per-USB3.0 port pad registers. This mapping is used >> to determine which lane needs to be programmed. > > Are you saying the mapping of lane to USB port is fixed? That is, PCIe-0 > lane is always used for USB port X and SATA always for USB port Y? No, sorry if that was unclear, it's not fixed - it's a board specific property. -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v8 7/7] usb: chipidea: add support to the generic PHY framework
This patch adds support of the PHY framework for ChipIdea drivers. Changes are done in both the ChipIdea common code and in the drivers accessing the PHY. This is done by adding a new PHY member in ChipIdea's structures and by taking care of it in the code. Signed-off-by: Antoine Tenart Acked-by: Peter Chen --- drivers/usb/chipidea/ci.h | 5 ++- drivers/usb/chipidea/core.c| 83 +- drivers/usb/chipidea/host.c| 5 ++- drivers/usb/chipidea/otg_fsm.c | 6 ++- include/linux/usb/chipidea.h | 2 + 5 files changed, 80 insertions(+), 21 deletions(-) diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h index 9015139a8027..5bbfcc73cf70 100644 --- a/drivers/usb/chipidea/ci.h +++ b/drivers/usb/chipidea/ci.h @@ -161,7 +161,8 @@ struct hw_bank { * @test_mode: the selected test mode * @platdata: platform specific information supplied by parent device * @vbus_active: is VBUS active - * @usb_phy: pointer to USB PHY, if any + * @phy: pointer to PHY, if any + * @usb_phy: pointer to USB PHY, if any and if using the USB PHY framework * @hcd: pointer to usb_hcd for ehci host driver * @debugfs: root dentry for this controller in debugfs * @id_event: indicates there is an id event, and handled at ci_otg_work @@ -202,6 +203,8 @@ struct ci_hdrc { struct ci_hdrc_platform_data*platdata; int vbus_active; + struct phy *phy; + /* old usb_phy interface */ struct usb_phy *usb_phy; struct usb_hcd *hcd; struct dentry *debugfs; diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index b7b01694d52e..ba0ac2723098 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -299,6 +300,49 @@ static void hw_phymode_configure(struct ci_hdrc *ci) } /** + * _ci_usb_phy_init: initialize phy taking in account both phy and usb_phy + * interfaces + * @ci: the controller + * + * This function returns an error code if the phy failed to init + */ +static int _ci_usb_phy_init(struct ci_hdrc *ci) +{ + int ret; + + if (ci->phy) { + ret = phy_init(ci->phy); + if (ret) + return ret; + + ret = phy_power_on(ci->phy); + if (ret) { + phy_exit(ci->phy); + return ret; + } + } else { + ret = usb_phy_init(ci->usb_phy); + } + + return ret; +} + +/** + * _ci_usb_phy_exit: deinitialize phy taking in account both phy and usb_phy + * interfaces + * @ci: the controller + */ +static void ci_usb_phy_exit(struct ci_hdrc *ci) +{ + if (ci->phy) { + phy_power_off(ci->phy); + phy_exit(ci->phy); + } else { + usb_phy_shutdown(ci->usb_phy); + } +} + +/** * ci_usb_phy_init: initialize phy according to different phy type * @ci: the controller * @@ -312,7 +356,7 @@ static int ci_usb_phy_init(struct ci_hdrc *ci) case USBPHY_INTERFACE_MODE_UTMI: case USBPHY_INTERFACE_MODE_UTMIW: case USBPHY_INTERFACE_MODE_HSIC: - ret = usb_phy_init(ci->usb_phy); + ret = _ci_usb_phy_init(ci); if (ret) return ret; hw_phymode_configure(ci); @@ -320,12 +364,12 @@ static int ci_usb_phy_init(struct ci_hdrc *ci) case USBPHY_INTERFACE_MODE_ULPI: case USBPHY_INTERFACE_MODE_SERIAL: hw_phymode_configure(ci); - ret = usb_phy_init(ci->usb_phy); + ret = _ci_usb_phy_init(ci); if (ret) return ret; break; default: - ret = usb_phy_init(ci->usb_phy); + ret = _ci_usb_phy_init(ci); } return ret; @@ -605,23 +649,26 @@ static int ci_hdrc_probe(struct platform_device *pdev) return -ENODEV; } - if (ci->platdata->usb_phy) + if (ci->platdata->phy) { + ci->phy = ci->platdata->phy; + } else if (ci->platdata->usb_phy) { ci->usb_phy = ci->platdata->usb_phy; - else + } else { + ci->phy = devm_phy_get(dev, "usb-phy"); ci->usb_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); - if (IS_ERR(ci->usb_phy)) { - ret = PTR_ERR(ci->usb_phy); - /* -* if -ENXIO is returned, it means PHY layer wasn't -* enabled, so it makes no sense to return -EPROBE_DEFER -* in that case, since no PHY driver will ever probe. -*/ - if (ret == -ENXIO) - return ret; + /* if both generic PHY and USB PHY layers aren't ena
Re: [PATCH v7 1/7] usb: move the OTG state from the USB PHY to the OTG structure
Hi Felipe, On Thu, Oct 30, 2014 at 11:35:13AM -0500, Felipe Balbi wrote: > On Thu, Oct 30, 2014 at 11:31:48AM -0500, Felipe Balbi wrote: > > On Tue, Oct 28, 2014 at 05:35:35PM +0100, Antoine Tenart wrote: > > > Before using the PHY framework instead of the USB PHY one, we need to > > > move the OTG state into another place, since it won't be available when > > > USB PHY isn't used. This patch moves the OTG state into the OTG > > > structure, and makes all the needed modifications in the drivers > > > using the OTG state. > > > > > > Signed-off-by: Antoine Tenart > > > Acked-by: Peter Chen > > > > Acked-by: Felipe Balbi > > Please rebase on my testing/next and I'll take the series. When > rebasing, then add Peter's Tested-by/Acked-by where they're missing. I just re-sent the series, rebased on your testing/next branch. Antoine -- Antoine Ténart, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v8 0/7] usb: add support for the generic PHY framework
The series can be found at: git://git.free-electrons.com:users/antoine-tenart/linux.git usb-phy Changes since v7: - rebased on top of Felipe's testing/next branch Changes since v6: - rebased on top of v3.18-rc2 Changes since v5: - rebased on the latest version of Sergei's series[1] - fixed one modifiaction made in the wrong patch Changes since v4: - reworked the PHY handling in ci_hdrc_probe() - fixed a rebase error Changes since v3: - moved phy_exit() after phy_power_on() - fixed the PHY handling in ci_hdrc_probe() - some little fixes Changes since v2: - rebased the series on top of v3.17-rc1 - switched to devm_phy_get() to handle non DT cases - moved usb_otg into the ci_hdrc structure Changes since v1: - rebased the series on top of [2] (generic PHY support for HCD) - split s/phy/usb_phy/ renaming and generic PHY support in separate patches [1] https://www.mail-archive.com/linux-usb%40vger.kernel.org/msg48068.html Antoine Tenart (7): usb: move the OTG state from the USB PHY to the OTG structure usb: rename phy to usb_phy in OTG usb: add support to the generic PHY framework in OTG usb: allow to supply the PHY in the drivers when using HCD usb: chipidea: rename transceiver and phy to usb_phy usb: chipidea: move usb_otg into struct ci_hdrc usb: chipidea: add support to the generic PHY framework drivers/phy/phy-omap-usb2.c | 14 ++ drivers/usb/chipidea/ci.h | 8 +++- drivers/usb/chipidea/ci_hdrc_imx.c | 2 +- drivers/usb/chipidea/ci_hdrc_msm.c | 8 ++-- drivers/usb/chipidea/core.c | 89 ++ drivers/usb/chipidea/debug.c| 2 +- drivers/usb/chipidea/host.c | 10 ++-- drivers/usb/chipidea/otg_fsm.c | 30 +--- drivers/usb/chipidea/udc.c | 4 +- drivers/usb/common/usb-otg-fsm.c| 8 ++-- drivers/usb/core/hcd.c | 7 +-- drivers/usb/host/ohci-omap.c| 2 +- drivers/usb/musb/am35x.c| 28 +-- drivers/usb/musb/blackfin.c | 18 +++ drivers/usb/musb/da8xx.c| 28 +-- drivers/usb/musb/davinci.c | 18 +++ drivers/usb/musb/musb_core.c| 94 ++-- drivers/usb/musb/musb_dsps.c| 26 +- drivers/usb/musb/musb_gadget.c | 36 +++--- drivers/usb/musb/musb_host.c| 8 ++-- drivers/usb/musb/musb_virthub.c | 22 - drivers/usb/musb/omap2430.c | 30 ++-- drivers/usb/musb/tusb6010.c | 40 drivers/usb/musb/ux500.c| 10 ++-- drivers/usb/phy/phy-ab8500-usb.c| 16 +++ drivers/usb/phy/phy-fsl-usb.c | 23 - drivers/usb/phy/phy-generic.c | 6 +-- drivers/usb/phy/phy-gpio-vbus-usb.c | 14 +++--- drivers/usb/phy/phy-isp1301-omap.c | 10 ++-- drivers/usb/phy/phy-msm-usb.c | 95 +++-- drivers/usb/phy/phy-mv-usb.c| 50 +-- drivers/usb/phy/phy-tahvo.c | 8 ++-- drivers/usb/phy/phy-ulpi.c | 6 +-- include/linux/usb/chipidea.h| 4 +- include/linux/usb/otg.h | 7 ++- include/linux/usb/phy.h | 1 - 36 files changed, 420 insertions(+), 362 deletions(-) -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v8 2/7] usb: rename phy to usb_phy in OTG
This patch prepares the introduction of the generic PHY support in the USB OTG common functions. The USB PHY member of the OTG structure is renamed to 'usb_phy' and modifications are done in all drivers accessing it. Renaming this pointer will allow to keep the compatibility for USB PHY drivers. Signed-off-by: Antoine Tenart --- drivers/phy/phy-omap-usb2.c | 6 ++-- drivers/usb/chipidea/otg_fsm.c | 2 +- drivers/usb/phy/phy-ab8500-usb.c| 6 ++-- drivers/usb/phy/phy-fsl-usb.c | 13 drivers/usb/phy/phy-generic.c | 2 +- drivers/usb/phy/phy-gpio-vbus-usb.c | 4 +-- drivers/usb/phy/phy-isp1301-omap.c | 10 +++--- drivers/usb/phy/phy-msm-usb.c | 61 +++-- drivers/usb/phy/phy-mv-usb.c| 4 +-- drivers/usb/phy/phy-tahvo.c | 8 +++-- drivers/usb/phy/phy-ulpi.c | 6 ++-- include/linux/usb/otg.h | 2 +- 12 files changed, 65 insertions(+), 59 deletions(-) diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c index 9f4093590f4c..32c3e86b4935 100644 --- a/drivers/phy/phy-omap-usb2.c +++ b/drivers/phy/phy-omap-usb2.c @@ -60,7 +60,7 @@ EXPORT_SYMBOL_GPL(omap_usb2_set_comparator); static int omap_usb_set_vbus(struct usb_otg *otg, bool enabled) { - struct omap_usb *phy = phy_to_omapusb(otg->phy); + struct omap_usb *phy = phy_to_omapusb(otg->usb_phy); if (!phy->comparator) return -ENODEV; @@ -70,7 +70,7 @@ static int omap_usb_set_vbus(struct usb_otg *otg, bool enabled) static int omap_usb_start_srp(struct usb_otg *otg) { - struct omap_usb *phy = phy_to_omapusb(otg->phy); + struct omap_usb *phy = phy_to_omapusb(otg->usb_phy); if (!phy->comparator) return -ENODEV; @@ -251,7 +251,7 @@ static int omap_usb2_probe(struct platform_device *pdev) otg->set_vbus = omap_usb_set_vbus; if (phy_data->flags & OMAP_USB2_HAS_START_SRP) otg->start_srp = omap_usb_start_srp; - otg->phy= &phy->phy; + otg->usb_phy= &phy->phy; platform_set_drvdata(pdev, phy); diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c index 8cb2508a6b71..d8490e758a74 100644 --- a/drivers/usb/chipidea/otg_fsm.c +++ b/drivers/usb/chipidea/otg_fsm.c @@ -788,7 +788,7 @@ int ci_hdrc_otg_fsm_init(struct ci_hdrc *ci) return -ENOMEM; } - otg->phy = ci->transceiver; + otg->usb_phy = ci->transceiver; otg->gadget = &ci->gadget; ci->fsm.otg = otg; ci->transceiver->otg = ci->fsm.otg; diff --git a/drivers/usb/phy/phy-ab8500-usb.c b/drivers/usb/phy/phy-ab8500-usb.c index 2d5250143ce1..3a802fa7dae2 100644 --- a/drivers/usb/phy/phy-ab8500-usb.c +++ b/drivers/usb/phy/phy-ab8500-usb.c @@ -1056,7 +1056,7 @@ static int ab8500_usb_set_peripheral(struct usb_otg *otg, if (!otg) return -ENODEV; - ab = phy_to_ab(otg->phy); + ab = phy_to_ab(otg->usb_phy); ab->phy.otg->gadget = gadget; @@ -1080,7 +1080,7 @@ static int ab8500_usb_set_host(struct usb_otg *otg, struct usb_bus *host) if (!otg) return -ENODEV; - ab = phy_to_ab(otg->phy); + ab = phy_to_ab(otg->usb_phy); ab->phy.otg->host = host; @@ -1382,7 +1382,7 @@ static int ab8500_usb_probe(struct platform_device *pdev) ab->phy.set_power = ab8500_usb_set_power; ab->phy.otg->state = OTG_STATE_UNDEFINED; - otg->phy= &ab->phy; + otg->usb_phy= &ab->phy; otg->set_host = ab8500_usb_set_host; otg->set_peripheral = ab8500_usb_set_peripheral; diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c index 15d7a81eece5..b7f36b212422 100644 --- a/drivers/usb/phy/phy-fsl-usb.c +++ b/drivers/usb/phy/phy-fsl-usb.c @@ -499,7 +499,8 @@ int fsl_otg_start_host(struct otg_fsm *fsm, int on) { struct usb_otg *otg = fsm->otg; struct device *dev; - struct fsl_otg *otg_dev = container_of(otg->phy, struct fsl_otg, phy); + struct fsl_otg *otg_dev = + container_of(otg->usb_phy, struct fsl_otg, phy); u32 retval = 0; if (!otg->host) @@ -594,7 +595,7 @@ static int fsl_otg_set_host(struct usb_otg *otg, struct usb_bus *host) if (!otg) return -ENODEV; - otg_dev = container_of(otg->phy, struct fsl_otg, phy); + otg_dev = container_of(otg->usb_phy, struct fsl_otg, phy); if (otg_dev != fsl_otg_dev) return -ENODEV; @@ -644,7 +645,7 @@ static int fsl_otg_set_peripheral(struct usb_otg *otg, if (!otg) return -ENODEV; - otg_dev = container_of(otg->phy, struct fsl_otg, phy); + otg_dev = container_of(otg->usb_phy, struct fsl_otg, phy); VDBG("otg_dev 0x%x\n", (int)otg_dev); VDBG("fsl_ot
[PATCH v8 3/7] usb: add support to the generic PHY framework in OTG
This patch adds support of the PHY framework in OTG and keeps the USB PHY compatibility. Here the only modification is to add PHY member in the OTG structure, along with the USB PHY one. Signed-off-by: Antoine Tenart --- include/linux/usb/otg.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h index 978fbbb0e266..52661c5da690 100644 --- a/include/linux/usb/otg.h +++ b/include/linux/usb/otg.h @@ -9,11 +9,14 @@ #ifndef __LINUX_USB_OTG_H #define __LINUX_USB_OTG_H +#include #include struct usb_otg { u8 default_a; + struct phy *phy; + /* old usb_phy interface */ struct usb_phy *usb_phy; struct usb_bus *host; struct usb_gadget *gadget; -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v8 1/7] usb: move the OTG state from the USB PHY to the OTG structure
Before using the PHY framework instead of the USB PHY one, we need to move the OTG state into another place, since it won't be available when USB PHY isn't used. This patch moves the OTG state into the OTG structure, and makes all the needed modifications in the drivers using the OTG state. Signed-off-by: Antoine Tenart Acked-by: Peter Chen --- drivers/phy/phy-omap-usb2.c | 8 +--- drivers/usb/chipidea/debug.c| 2 +- drivers/usb/chipidea/otg_fsm.c | 12 ++--- drivers/usb/common/usb-otg-fsm.c| 8 ++-- drivers/usb/host/ohci-omap.c| 2 +- drivers/usb/musb/am35x.c| 28 +-- drivers/usb/musb/blackfin.c | 18 +++ drivers/usb/musb/da8xx.c| 28 +-- drivers/usb/musb/davinci.c | 18 +++ drivers/usb/musb/musb_core.c| 94 ++--- drivers/usb/musb/musb_dsps.c| 26 +- drivers/usb/musb/musb_gadget.c | 36 +++--- drivers/usb/musb/musb_host.c| 8 ++-- drivers/usb/musb/musb_virthub.c | 22 - drivers/usb/musb/omap2430.c | 30 ++-- drivers/usb/musb/tusb6010.c | 40 drivers/usb/musb/ux500.c| 10 ++-- drivers/usb/phy/phy-ab8500-usb.c| 10 ++-- drivers/usb/phy/phy-fsl-usb.c | 10 ++-- drivers/usb/phy/phy-generic.c | 4 +- drivers/usb/phy/phy-gpio-vbus-usb.c | 10 ++-- drivers/usb/phy/phy-msm-usb.c | 34 +++--- drivers/usb/phy/phy-mv-usb.c| 46 +- include/linux/usb/otg.h | 2 + include/linux/usb/phy.h | 1 - 25 files changed, 252 insertions(+), 255 deletions(-) diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c index 8c842980834a..9f4093590f4c 100644 --- a/drivers/phy/phy-omap-usb2.c +++ b/drivers/phy/phy-omap-usb2.c @@ -80,11 +80,9 @@ static int omap_usb_start_srp(struct usb_otg *otg) static int omap_usb_set_host(struct usb_otg *otg, struct usb_bus *host) { - struct usb_phy *phy = otg->phy; - otg->host = host; if (!host) - phy->state = OTG_STATE_UNDEFINED; + otg->state = OTG_STATE_UNDEFINED; return 0; } @@ -92,11 +90,9 @@ static int omap_usb_set_host(struct usb_otg *otg, struct usb_bus *host) static int omap_usb_set_peripheral(struct usb_otg *otg, struct usb_gadget *gadget) { - struct usb_phy *phy = otg->phy; - otg->gadget = gadget; if (!gadget) - phy->state = OTG_STATE_UNDEFINED; + otg->state = OTG_STATE_UNDEFINED; return 0; } diff --git a/drivers/usb/chipidea/debug.c b/drivers/usb/chipidea/debug.c index 795d6538d630..8878eea38d44 100644 --- a/drivers/usb/chipidea/debug.c +++ b/drivers/usb/chipidea/debug.c @@ -220,7 +220,7 @@ static int ci_otg_show(struct seq_file *s, void *unused) /* -- State - */ seq_printf(s, "OTG state: %s\n\n", - usb_otg_state_string(ci->transceiver->state)); + usb_otg_state_string(ci->transceiver->otg.state)); /* -- State Machine Variables - */ seq_printf(s, "a_bus_drop: %d\n", fsm->a_bus_drop); diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c index caaabc58021e..8cb2508a6b71 100644 --- a/drivers/usb/chipidea/otg_fsm.c +++ b/drivers/usb/chipidea/otg_fsm.c @@ -328,7 +328,7 @@ static void b_ssend_srp_tmout_func(void *ptr, unsigned long indicator) set_tmout(ci, indicator); /* only vbus fall below B_sess_vld in b_idle state */ - if (ci->transceiver->state == OTG_STATE_B_IDLE) + if (ci->fsm.otg->state == OTG_STATE_B_IDLE) ci_otg_queue_work(ci); } @@ -582,11 +582,11 @@ int ci_otg_fsm_work(struct ci_hdrc *ci) * when there is no gadget class driver */ if (ci->fsm.id && !(ci->driver) && - ci->transceiver->state < OTG_STATE_A_IDLE) + ci->fsm.otg->state < OTG_STATE_A_IDLE) return 0; if (otg_statemachine(&ci->fsm)) { - if (ci->transceiver->state == OTG_STATE_A_IDLE) { + if (ci->fsm.otg->state == OTG_STATE_A_IDLE) { /* * Further state change for cases: * a_idle to b_idle; or @@ -600,7 +600,7 @@ int ci_otg_fsm_work(struct ci_hdrc *ci) ci_otg_queue_work(ci); if (ci->id_event) ci->id_event = false; - } else if (ci->transceiver->state == OTG_STATE_B_IDLE) { + } else if (ci->fsm.otg->state == OTG_STATE_B_IDLE) { if (ci->fsm.b_sess_vld) { ci->fsm.power_up = 0; /* @@ -627,7 +627,7 @@ static void ci_otg_fsm_event(struct ci_hdrc *ci) otg_bsess_vld = hw_read_otgsc(ci, OTGSC_BSV); port_conn = h
[PATCH v8 4/7] usb: allow to supply the PHY in the drivers when using HCD
This patch modify the generic code handling PHYs to allow them to be supplied from the drivers. This adds checks to ensure no PHY was already there when looking for one in the generic code. This also makes sure we do not modify its state in the generic HCD functions, it was provided by the driver. Signed-off-by: Antoine Tenart Acked-by: Alan Stern --- drivers/usb/core/hcd.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index b84fb141e122..6a2a2fd990ab 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -2648,7 +2648,7 @@ int usb_add_hcd(struct usb_hcd *hcd, } } - if (IS_ENABLED(CONFIG_GENERIC_PHY)) { + if (IS_ENABLED(CONFIG_GENERIC_PHY) && !hcd->phy) { struct phy *phy = phy_get(hcd->self.controller, "usb"); if (IS_ERR(phy)) { @@ -2668,6 +2668,7 @@ int usb_add_hcd(struct usb_hcd *hcd, goto err_phy; } hcd->phy = phy; + hcd->remove_phy = 1; } } @@ -2814,7 +2815,7 @@ err_allocate_root_hub: err_register_bus: hcd_buffer_destroy(hcd); err_create_buf: - if (IS_ENABLED(CONFIG_GENERIC_PHY) && hcd->phy) { + if (IS_ENABLED(CONFIG_GENERIC_PHY) && hcd->remove_phy && hcd->phy) { phy_power_off(hcd->phy); phy_exit(hcd->phy); phy_put(hcd->phy); @@ -2898,7 +2899,7 @@ void usb_remove_hcd(struct usb_hcd *hcd) usb_deregister_bus(&hcd->self); hcd_buffer_destroy(hcd); - if (IS_ENABLED(CONFIG_GENERIC_PHY) && hcd->phy) { + if (IS_ENABLED(CONFIG_GENERIC_PHY) && hcd->remove_phy && hcd->phy) { phy_power_off(hcd->phy); phy_exit(hcd->phy); phy_put(hcd->phy); -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v8 5/7] usb: chipidea: rename transceiver and phy to usb_phy
This patch prepares the introduction of the generic PHY support in the USB ChipIdea common functions. The USB PHY member of the ChipIdea structure ('transceiver') is renamed to 'usb_phy', the 'phy' member of the ChipIdea pdata structure is renamed to 'usb_phy' and modifications are done in all drivers accessing it. Renaming this pointer will allow to keep the compatibility for USB PHY drivers. Signed-off-by: Antoine Tenart Acked-by: Peter Chen --- drivers/usb/chipidea/ci.h | 4 ++-- drivers/usb/chipidea/ci_hdrc_imx.c | 2 +- drivers/usb/chipidea/ci_hdrc_msm.c | 8 drivers/usb/chipidea/core.c| 20 ++-- drivers/usb/chipidea/debug.c | 2 +- drivers/usb/chipidea/host.c| 4 ++-- drivers/usb/chipidea/otg_fsm.c | 4 ++-- drivers/usb/chipidea/udc.c | 4 ++-- include/linux/usb/chipidea.h | 2 +- 9 files changed, 25 insertions(+), 25 deletions(-) diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h index ea40626e0246..b7f589b348e6 100644 --- a/drivers/usb/chipidea/ci.h +++ b/drivers/usb/chipidea/ci.h @@ -161,7 +161,7 @@ struct hw_bank { * @test_mode: the selected test mode * @platdata: platform specific information supplied by parent device * @vbus_active: is VBUS active - * @transceiver: pointer to USB PHY, if any + * @usb_phy: pointer to USB PHY, if any * @hcd: pointer to usb_hcd for ehci host driver * @debugfs: root dentry for this controller in debugfs * @id_event: indicates there is an id event, and handled at ci_otg_work @@ -201,7 +201,7 @@ struct ci_hdrc { struct ci_hdrc_platform_data*platdata; int vbus_active; - struct usb_phy *transceiver; + struct usb_phy *usb_phy; struct usb_hcd *hcd; struct dentry *debugfs; boolid_event; diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c index a7ab0f15926e..6f8b1b1045b5 100644 --- a/drivers/usb/chipidea/ci_hdrc_imx.c +++ b/drivers/usb/chipidea/ci_hdrc_imx.c @@ -147,7 +147,7 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) goto err_clk; } - pdata.phy = data->phy; + pdata.usb_phy = data->phy; if (imx_platform_flag->flags & CI_HDRC_IMX_IMX28_WRITE_FIX) pdata.flags |= CI_HDRC_IMX28_WRITE_FIX; diff --git a/drivers/usb/chipidea/ci_hdrc_msm.c b/drivers/usb/chipidea/ci_hdrc_msm.c index 4935ac38fd00..3edf969ed797 100644 --- a/drivers/usb/chipidea/ci_hdrc_msm.c +++ b/drivers/usb/chipidea/ci_hdrc_msm.c @@ -26,15 +26,15 @@ static void ci_hdrc_msm_notify_event(struct ci_hdrc *ci, unsigned event) dev_dbg(dev, "CI_HDRC_CONTROLLER_RESET_EVENT received\n"); writel(0, USB_AHBBURST); writel(0, USB_AHBMODE); - usb_phy_init(ci->transceiver); + usb_phy_init(ci->usb_phy); break; case CI_HDRC_CONTROLLER_STOPPED_EVENT: dev_dbg(dev, "CI_HDRC_CONTROLLER_STOPPED_EVENT received\n"); /* -* Put the transceiver in non-driving mode. Otherwise host +* Put the phy in non-driving mode. Otherwise host * may not detect soft-disconnection. */ - usb_phy_notify_disconnect(ci->transceiver, USB_SPEED_UNKNOWN); + usb_phy_notify_disconnect(ci->usb_phy, USB_SPEED_UNKNOWN); break; default: dev_dbg(dev, "unknown ci_hdrc event\n"); @@ -68,7 +68,7 @@ static int ci_hdrc_msm_probe(struct platform_device *pdev) if (IS_ERR(phy)) return PTR_ERR(phy); - ci_hdrc_msm_platdata.phy = phy; + ci_hdrc_msm_platdata.usb_phy = phy; plat_ci = ci_hdrc_add_device(&pdev->dev, pdev->resource, pdev->num_resources, diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 3df5005c554d..b7b01694d52e 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -312,7 +312,7 @@ static int ci_usb_phy_init(struct ci_hdrc *ci) case USBPHY_INTERFACE_MODE_UTMI: case USBPHY_INTERFACE_MODE_UTMIW: case USBPHY_INTERFACE_MODE_HSIC: - ret = usb_phy_init(ci->transceiver); + ret = usb_phy_init(ci->usb_phy); if (ret) return ret; hw_phymode_configure(ci); @@ -320,12 +320,12 @@ static int ci_usb_phy_init(struct ci_hdrc *ci) case USBPHY_INTERFACE_MODE_ULPI: case USBPHY_INTERFACE_MODE_SERIAL: hw_phymode_configure(ci); - ret = usb_phy_init(ci->transceiver); + ret = usb_phy_init(ci->usb_phy); if (ret) return ret; break; default: - ret = usb_phy_in
[PATCH v8 6/7] usb: chipidea: move usb_otg into struct ci_hdrc
Move the usb_otg member from struct usb_phy to struct ci_hdrc. Rework its initialization taking in account this modification. Signed-off-by: Antoine Tenart Acked-by: Peter Chen --- drivers/usb/chipidea/ci.h | 1 + drivers/usb/chipidea/debug.c | 2 +- drivers/usb/chipidea/host.c| 5 +++-- drivers/usb/chipidea/otg_fsm.c | 16 +++- 4 files changed, 8 insertions(+), 16 deletions(-) diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h index b7f589b348e6..9015139a8027 100644 --- a/drivers/usb/chipidea/ci.h +++ b/drivers/usb/chipidea/ci.h @@ -177,6 +177,7 @@ struct ci_hdrc { struct ci_role_driver *roles[CI_ROLE_END]; enum ci_rolerole; boolis_otg; + struct usb_otg otg; struct otg_fsm fsm; struct ci_otg_fsm_timer_list*fsm_timer; struct work_struct work; diff --git a/drivers/usb/chipidea/debug.c b/drivers/usb/chipidea/debug.c index 8f437e1512fa..999e9d683d7a 100644 --- a/drivers/usb/chipidea/debug.c +++ b/drivers/usb/chipidea/debug.c @@ -220,7 +220,7 @@ static int ci_otg_show(struct seq_file *s, void *unused) /* -- State - */ seq_printf(s, "OTG state: %s\n\n", - usb_otg_state_string(ci->usb_phy->otg.state)); + usb_otg_state_string(ci->otg.state)); /* -- State Machine Variables - */ seq_printf(s, "a_bus_drop: %d\n", fsm->a_bus_drop); diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c index 51b086d3bb11..789809f680aa 100644 --- a/drivers/usb/chipidea/host.c +++ b/drivers/usb/chipidea/host.c @@ -86,10 +86,11 @@ static int host_start(struct ci_hdrc *ci) if (ret) { goto disable_reg; } else { - struct usb_otg *otg = ci->usb_phy->otg; + struct usb_otg *otg = &ci->otg; ci->hcd = hcd; - if (otg) { + + if (ci_otg_is_fsm_mode(ci)) { otg->host = &hcd->self; hcd->self.otg_port = 1; } diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c index 8a64ce87364e..862d7cb01b92 100644 --- a/drivers/usb/chipidea/otg_fsm.c +++ b/drivers/usb/chipidea/otg_fsm.c @@ -778,20 +778,10 @@ void ci_hdrc_otg_fsm_start(struct ci_hdrc *ci) int ci_hdrc_otg_fsm_init(struct ci_hdrc *ci) { int retval = 0; - struct usb_otg *otg; - otg = devm_kzalloc(ci->dev, - sizeof(struct usb_otg), GFP_KERNEL); - if (!otg) { - dev_err(ci->dev, - "Failed to allocate usb_otg structure for ci hdrc otg!\n"); - return -ENOMEM; - } - - otg->usb_phy = ci->usb_phy; - otg->gadget = &ci->gadget; - ci->fsm.otg = otg; - ci->usb_phy->otg = ci->fsm.otg; + ci->otg.usb_phy = ci->usb_phy; + ci->otg.gadget = &ci->gadget; + ci->fsm.otg = &ci->otg; ci->fsm.power_up = 1; ci->fsm.id = hw_read_otgsc(ci, OTGSC_ID) ? 1 : 0; ci->fsm.otg->state = OTG_STATE_UNDEFINED; -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v7 1/7] usb: move the OTG state from the USB PHY to the OTG structure
On Thu, Oct 30, 2014 at 06:42:54PM +0100, Antoine Tenart wrote: > Hi Felipe, > > On Thu, Oct 30, 2014 at 11:35:13AM -0500, Felipe Balbi wrote: > > On Thu, Oct 30, 2014 at 11:31:48AM -0500, Felipe Balbi wrote: > > > On Tue, Oct 28, 2014 at 05:35:35PM +0100, Antoine Tenart wrote: > > > > Before using the PHY framework instead of the USB PHY one, we need to > > > > move the OTG state into another place, since it won't be available when > > > > USB PHY isn't used. This patch moves the OTG state into the OTG > > > > structure, and makes all the needed modifications in the drivers > > > > using the OTG state. > > > > > > > > Signed-off-by: Antoine Tenart > > > > Acked-by: Peter Chen > > > > > > Acked-by: Felipe Balbi > > > > Please rebase on my testing/next and I'll take the series. When > > rebasing, then add Peter's Tested-by/Acked-by where they're missing. > > I just re-sent the series, rebased on your testing/next branch. Thanks, I put them on my testing/next and I'm running build tests. -- balbi signature.asc Description: Digital signature
[usb] add support for APM X-Gene to xhci-platform
Applied Micro's X-Gene platform uses ARM64 processors and a standard, XHCI compatible piece of silicon for USB connectivity. It only supports 64 bit DMA. Modify the xhci platform driver to use either 32 bit or 64 bit DMA, as appropriate, and then modify the platform driver to recognize the ACPI signature of the silicon. -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/2] [usb] add support for APM X-Gene to xhci-platform
Applied Micro's X-Gene platform uses the xhci-platform for USB. Add the glue to decode it from ACPI and change the Kconfig files so the xhci-plat.o file gets built. Signed-off-by: Mark Langsdorf --- arch/arm64/Kconfig | 1 + drivers/usb/host/Kconfig | 8 drivers/usb/host/xhci-plat.c | 11 +++ 3 files changed, 20 insertions(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 042f785..07549ec 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -149,6 +149,7 @@ config ARCH_XGENE bool "AppliedMicro X-Gene SOC Family" select MFD_SYSCON select POWER_RESET_SYSCON + select USB_XHCI_XGENE help This enables support for AppliedMicro X-Gene SOC Family diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 82800a7..9fd52db 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -45,6 +45,14 @@ config USB_XHCI_RCAR Say 'Y' to enable the support for the xHCI host controller found in Renesas R-Car ARM SoCs. +config USB_XHCI_XGENE + tristate "xHCI support for Applied Micro X-Gene SoCs" + select USB_XHCI_PLATFORM + depends on ARCH_XGENE || COMPILE_TEST + ---help--- + Say 'Y' to enable the support for the xHCI host controller + found in Applied Micro X-Gene ARM SoCs. + endif # USB_XHCI_HCD config USB_EHCI_HCD diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 3045e77..5012c68 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -18,6 +18,7 @@ #include #include #include +#include #include "xhci.h" #include "xhci-mvebu.h" @@ -290,6 +291,15 @@ static const struct of_device_id usb_xhci_of_match[] = { MODULE_DEVICE_TABLE(of, usb_xhci_of_match); #endif +#ifdef CONFIG_ACPI +static const struct acpi_device_id usb_xhci_acpi_match[] = { + /* APM X-Gene USB Controller */ + { "PNP0D10", }, + { } +}; +MODULE_DEVICE_TABLE(acpi, usb_xhci_acpi_match); +#endif + static struct platform_driver usb_xhci_driver = { .probe = xhci_plat_probe, .remove = xhci_plat_remove, @@ -297,6 +307,7 @@ static struct platform_driver usb_xhci_driver = { .name = "xhci-hcd", .pm = DEV_PM_OPS, .of_match_table = of_match_ptr(usb_xhci_of_match), + .acpi_match_table = ACPI_PTR(usb_xhci_acpi_match), }, }; MODULE_ALIAS("platform:xhci-hcd"); -- 1.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2] [usb] make xhci platform driver use 64 bit or 32 bit DMA
The xhci platform driver needs to work on systems that either only support 64-bit DMA or only support 32-bit DMA. Attempt to set a coherent dma mask for 64-bit DMA, and attempt again with 32-bit DMA if that fails. Signed-off-by: Mark Langsdorf --- drivers/usb/host/xhci-plat.c | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 1a0cf9f..3045e77 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -147,14 +147,17 @@ static int xhci_plat_probe(struct platform_device *pdev) return ret; } - /* Initialize dma_mask and coherent_dma_mask to 32-bits */ - ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); - if (ret) - return ret; + /* Try setting the coherent_dma_mask to 64 bits, then try 32 bits */ + if (sizeof(dma_addr_t) < 8 || + dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64))) { + ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); + if (ret) + return ret; + } if (!pdev->dev.dma_mask) pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; else - dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); + dma_set_mask(&pdev->dev, pdev->dev.coherent_dma_mask); hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev)); if (!hcd) -- 1.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] [usb] make xhci platform driver use 64 bit or 32 bit DMA
On Thursday 30 October 2014 13:16:28 Mark Langsdorf wrote: > - /* Initialize dma_mask and coherent_dma_mask to 32-bits */ > - ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); > - if (ret) > - return ret; > + /* Try setting the coherent_dma_mask to 64 bits, then try 32 bits */ > + if (sizeof(dma_addr_t) < 8 || > + dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64))) { > + ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); > + if (ret) > + return ret; > + } > if (!pdev->dev.dma_mask) > pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; > else > - dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); > + dma_set_mask(&pdev->dev, pdev->dev.coherent_dma_mask); > > hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev)); > if (!hcd) > The logic here seems wrong: if dma_set_mask is successful, you can rely on on dma_set_coherent_mask suceeding as well, but not the other way round. Also, we should no longer need to worry about the case where pdev->dev.dma_mask is NULL, as this now gets initialized from the DT setup. Arnd -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/2] [usb] add support for APM X-Gene to xhci-platform
On Thursday 30 October 2014 13:16:29 Mark Langsdorf wrote: > Applied Micro's X-Gene platform uses the xhci-platform for USB. > Add the glue to decode it from ACPI and change the Kconfig files > so the xhci-plat.o file gets built. > > Signed-off-by: Mark Langsdorf I don't see anything x-gene specific in this patch, the PNP0D10 ID should work on any platform. > diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig > index 042f785..07549ec 100644 > --- a/arch/arm64/Kconfig > +++ b/arch/arm64/Kconfig > @@ -149,6 +149,7 @@ config ARCH_XGENE > bool "AppliedMicro X-Gene SOC Family" > select MFD_SYSCON > select POWER_RESET_SYSCON > + select USB_XHCI_XGENE > help > This enables support for AppliedMicro X-Gene SOC Family > > diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig > index 82800a7..9fd52db 100644 > --- a/drivers/usb/host/Kconfig > +++ b/drivers/usb/host/Kconfig > @@ -45,6 +45,14 @@ config USB_XHCI_RCAR > Say 'Y' to enable the support for the xHCI host controller > found in Renesas R-Car ARM SoCs. > > +config USB_XHCI_XGENE > + tristate "xHCI support for Applied Micro X-Gene SoCs" > + select USB_XHCI_PLATFORM > + depends on ARCH_XGENE || COMPILE_TEST > + ---help--- > + Say 'Y' to enable the support for the xHCI host controller > +found in Applied Micro X-Gene ARM SoCs. > + So just remove this symbol and let the user select USB_XHCI_PLATFORM > @@ -290,6 +291,15 @@ static const struct of_device_id usb_xhci_of_match[] = { > MODULE_DEVICE_TABLE(of, usb_xhci_of_match); > #endif > > +#ifdef CONFIG_ACPI > +static const struct acpi_device_id usb_xhci_acpi_match[] = { > + /* APM X-Gene USB Controller */ > + { "PNP0D10", }, > + { } > +}; > +MODULE_DEVICE_TABLE(acpi, usb_xhci_acpi_match); > +#endif > + > static struct platform_driver usb_xhci_driver = { > .probe = xhci_plat_probe, > .remove = xhci_plat_remove, > @@ -297,6 +307,7 @@ static struct platform_driver usb_xhci_driver = { > .name = "xhci-hcd", > .pm = DEV_PM_OPS, > .of_match_table = of_match_ptr(usb_xhci_of_match), > + .acpi_match_table = ACPI_PTR(usb_xhci_acpi_match), > }, > }; > MODULE_ALIAS("platform:xhci-hcd"); This change looks good, just the comment is a bit misleading. Arnd -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH net 0/3] r8152: patches for autosuspend
From: Hayes Wang Date: Wed, 29 Oct 2014 11:12:14 +0800 > There are unexpected processes when enabling autosuspend. > These patches are used to fix them. Series applied, thank you. -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html