Re: current version of http://www.linux-usb.org/usbtest/ testusb.c
On Mon, Sep 09, 2013 at 02:08:02AM +0800, joe M wrote: Hello, Just wanted to check if there is a version of http://www.linux-usb.org/usbtest/ testusb.c or test.sh scrpts that work with the current kernel. The files seem to be using usbfs, which is deprecated. ./testusb -a usbfs files are missing Any thoughts, please? mount -t usbfs usbfs /proc/bus/usb Thanks Joe -- 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 -- 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/5] usb: chipidea: imx: Add usb_phy_shutdown at probe's error path
If not, the PHY will be active even the controller is not in use. We find this issue due to the PHY's clock refcount is not correct due to -EPROBE_DEFER return after phy's init. Signed-off-by: Peter Chen peter.c...@freescale.com --- drivers/usb/chipidea/ci_hdrc_imx.c |7 +-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c index 302eaaf..0b38697 100644 --- a/drivers/usb/chipidea/ci_hdrc_imx.c +++ b/drivers/usb/chipidea/ci_hdrc_imx.c @@ -131,7 +131,7 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) if (ret) { dev_err(pdev-dev, usbmisc init failed, ret=%d\n, ret); - goto err_clk; + goto err_phy; } } @@ -143,7 +143,7 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) dev_err(pdev-dev, Can't register ci_hdrc platform device, err=%d\n, ret); - goto err_clk; + goto err_phy; } if (data-usbmisc_data) { @@ -164,6 +164,9 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) disable_device: ci_hdrc_remove_device(data-ci_pdev); +err_phy: + if (data-phy) + usb_phy_shutdown(data-phy); err_clk: clk_disable_unprepare(data-clk); return ret; -- 1.7.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 2/2] usb: phy-mxs: Add auto clock and power setting
With the auto setting, the PHY's clock and power can be recovered correctly from low power mode, it is ganranteed by IC logic. Besides, we enable the IC fixes for this PHY at mx6 platform. Signed-off-by: Peter Chen peter.c...@freescale.com --- drivers/usb/phy/phy-mxs-usb.c | 30 ++ 1 files changed, 26 insertions(+), 4 deletions(-) diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index f80e2e6..868c445 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c @@ -1,5 +1,5 @@ /* - * Copyright 2012 Freescale Semiconductor, Inc. + * Copyright 2012-2013 Freescale Semiconductor, Inc. * Copyright (C) 2012 Marek Vasut ma...@denx.de * on behalf of DENX Software Engineering GmbH * @@ -29,8 +29,17 @@ #define HW_USBPHY_CTRL_SET 0x34 #define HW_USBPHY_CTRL_CLR 0x38 +#define HW_USBPHY_IP 0x90 +#define HW_USBPHY_IP_SET 0x94 +#define HW_USBPHY_IP_CLR 0x98 + #define BM_USBPHY_CTRL_SFTRST BIT(31) #define BM_USBPHY_CTRL_CLKGATE BIT(30) +#define BM_USBPHY_CTRL_ENAUTOSET_USBCLKS BIT(26) +#define BM_USBPHY_CTRL_ENAUTOCLR_USBCLKGATEBIT(25) +#define BM_USBPHY_CTRL_ENAUTOCLR_PHY_PWD BIT(20) +#define BM_USBPHY_CTRL_ENAUTOCLR_CLKGATE BIT(19) +#define BM_USBPHY_CTRL_ENAUTO_PWRON_PLLBIT(18) #define BM_USBPHY_CTRL_ENUTMILEVEL3BIT(15) #define BM_USBPHY_CTRL_ENUTMILEVEL2BIT(14) #define BM_USBPHY_CTRL_ENHOSTDISCONDETECT BIT(1) @@ -100,11 +109,24 @@ static int mxs_phy_hw_init(struct mxs_phy *mxs_phy) /* Power up the PHY */ writel(0, base + HW_USBPHY_PWD); - /* enable FS/LS device */ - writel(BM_USBPHY_CTRL_ENUTMILEVEL2 | - BM_USBPHY_CTRL_ENUTMILEVEL3, + /* +* USB PHY Ctrl Setting +* - Auto clock/power on +* - Enable full/low speed support +*/ + writel(BM_USBPHY_CTRL_ENAUTOSET_USBCLKS | + BM_USBPHY_CTRL_ENAUTOCLR_USBCLKGATE | + BM_USBPHY_CTRL_ENAUTOCLR_PHY_PWD | + BM_USBPHY_CTRL_ENAUTOCLR_CLKGATE | + BM_USBPHY_CTRL_ENAUTO_PWRON_PLL | + BM_USBPHY_CTRL_ENUTMILEVEL2 | + BM_USBPHY_CTRL_ENUTMILEVEL3, base + HW_USBPHY_CTRL_SET); + /* Enable IC solution */ + if (is_mx6q_phy(mxs_phy) || is_mx6sl_phy(mxs_phy)) + writel(BM_USBPHY_IP_FIX, base + HW_USBPHY_IP_SET); + return 0; } -- 1.7.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 1/2] usb: mxs-phy: Add platform judgement code
The mxs-phy has three versions, each version has some differences among PHY operation. the 1st version is for mx23/mx28 SoC, The 2nd version is for mx6q and mx6dl, the 3rd version is for mx6sl and later mx6 platform. Signed-off-by: Peter Chen peter.c...@freescale.com --- drivers/usb/phy/phy-mxs-usb.c | 64 1 files changed, 57 insertions(+), 7 deletions(-) diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index fdd33b4..f80e2e6 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c @@ -20,6 +20,7 @@ #include linux/delay.h #include linux/err.h #include linux/io.h +#include linux/of_device.h #define DRIVER_NAME mxs_phy @@ -34,12 +35,58 @@ #define BM_USBPHY_CTRL_ENUTMILEVEL2BIT(14) #define BM_USBPHY_CTRL_ENHOSTDISCONDETECT BIT(1) +#define BM_USBPHY_IP_FIX (BIT(17) | BIT(18)) + +#define to_mxs_phy(p) container_of((p), struct mxs_phy, phy) +enum imx_phy_type { + IMX6Q_USB_PHY, + IMX6SL_USB_PHY, + IMX23_USB_PHY, +}; + struct mxs_phy { struct usb_phy phy; struct clk *clk; + enum imx_phy_type devtype; }; -#define to_mxs_phy(p) container_of((p), struct mxs_phy, phy) +static inline int is_mx6q_phy(struct mxs_phy *data) +{ + return data-devtype == IMX6Q_USB_PHY; +} + +static inline int is_mx6sl_phy(struct mxs_phy *data) +{ + return data-devtype == IMX6SL_USB_PHY; +} + +static inline int is_mx23_phy(struct mxs_phy *data) +{ + return data-devtype == IMX23_USB_PHY; +} + +static struct platform_device_id imx_phy_devtype[] = { + { + .name = usb-phy-imx6q, + .driver_data = IMX6Q_USB_PHY, + }, { + .name = usb-phy-imx6sl, + .driver_data = IMX6SL_USB_PHY, + }, { + .name = usb-phy-imx23, + .driver_data = IMX23_USB_PHY, + }, { + /* sentinel */ + } +}; + +static const struct of_device_id mxs_phy_dt_ids[] = { + { .compatible = fsl,imx6q-usbphy, .data = imx_phy_devtype[IMX6Q_USB_PHY], }, + { .compatible = fsl,imx6sl-usbphy, .data = imx_phy_devtype[IMX6SL_USB_PHY], }, + { .compatible = fsl,imx23-usbphy, .data = imx_phy_devtype[IMX23_USB_PHY], }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, mxs_phy_dt_ids); static int mxs_phy_hw_init(struct mxs_phy *mxs_phy) { @@ -131,6 +178,14 @@ static int mxs_phy_probe(struct platform_device *pdev) struct clk *clk; struct mxs_phy *mxs_phy; int ret; + const struct of_device_id *of_id = + of_match_device(mxs_phy_dt_ids, pdev-dev); + + /* This driver is DT-only version now */ + if (!of_id) + return -ENXIO; + + pdev-id_entry = of_id-data; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); base = devm_ioremap_resource(pdev-dev, res); @@ -163,6 +218,7 @@ static int mxs_phy_probe(struct platform_device *pdev) ATOMIC_INIT_NOTIFIER_HEAD(mxs_phy-phy.notifier); mxs_phy-clk = clk; + mxs_phy-devtype = pdev-id_entry-driver_data; platform_set_drvdata(pdev, mxs_phy-phy); @@ -182,12 +238,6 @@ static int mxs_phy_remove(struct platform_device *pdev) return 0; } -static const struct of_device_id mxs_phy_dt_ids[] = { - { .compatible = fsl,imx23-usbphy, }, - { /* sentinel */ } -}; -MODULE_DEVICE_TABLE(of, mxs_phy_dt_ids); - static struct platform_driver mxs_phy_driver = { .probe = mxs_phy_probe, .remove = mxs_phy_remove, -- 1.7.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
[RESEND PATCH v2 1/1] usb: gadget: zero: Add flexible auto remote wakeup test method
In order to increase test coverage, we can change the interval between two remote wakeups every time, and the interval can be any user defined value. This change will no affect current behavior if the user does not use two introduced module paramters. Signed-off-by: Peter Chen peter.c...@freescale.com --- Changes for v2: - Change some typo and description drivers/usb/gadget/zero.c | 25 +++-- 1 files changed, 23 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c index 0deb9d6..21da094 100644 --- a/drivers/usb/gadget/zero.c +++ b/drivers/usb/gadget/zero.c @@ -95,6 +95,18 @@ unsigned autoresume = DEFAULT_AUTORESUME; module_param(autoresume, uint, S_IRUGO); MODULE_PARM_DESC(autoresume, zero, or seconds before remote wakeup); +/* Maximum Autoresume time */ +unsigned max_autoresume; +module_param(max_autoresume, uint, S_IRUGO); +MODULE_PARM_DESC(max_autoresume, maximum seconds before remote wakeup); + +/* Interval between two remote wakeups */ +unsigned autoresume_interval_ms; +module_param(autoresume_interval_ms, uint, S_IRUGO); +MODULE_PARM_DESC(autoresume_interval_ms, + milliseconds to increase successive wakup delays); + +static unsigned autoresume_step_ms; /*-*/ static struct usb_device_descriptor device_desc = { @@ -183,8 +195,16 @@ static void zero_suspend(struct usb_composite_dev *cdev) return; if (autoresume) { - mod_timer(autoresume_timer, jiffies + (HZ * autoresume)); - DBG(cdev, suspend, wakeup in %d seconds\n, autoresume); + if (max_autoresume + (autoresume_step_ms max_autoresume * 1000)) + autoresume_step_ms = autoresume * 1000; + + mod_timer(autoresume_timer, jiffies + + msecs_to_jiffies(autoresume_step_ms)); + DBG(cdev, suspend, wakeup in %d milliseconds\n, + autoresume_step_ms); + + autoresume_step_ms += autoresume_interval_ms; } else DBG(cdev, %s\n, __func__); } @@ -316,6 +336,7 @@ static int __init zero_bind(struct usb_composite_dev *cdev) if (autoresume) { sourcesink_driver.bmAttributes |= USB_CONFIG_ATT_WAKEUP; loopback_driver.bmAttributes |= USB_CONFIG_ATT_WAKEUP; + autoresume_step_ms = autoresume * 1000; } /* support OTG systems */ -- 1.7.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
Re: [RFC v4 06/19] xhci: use completion event's slot id rather than dig it out of command
On 09/04/2013 08:39 AM, Xenia Ragiadakou wrote: Since the slot id retrieved from the command TRB matches the one in Slot ID field of the command completion event, which is available, there is no need to determine it again. This patch removes the uneccessary reassignment to slot id and adds a WARN_ON in case the two Slot ID fields differ. Signed-off-by: Xenia Ragiadakou burzalod...@gmail.com --- Differences from v3: -the above change is performed now in a separate patch -a warning is triggered in case the slot id reported in event trb is different from the slot id renoted in command trb drivers/usb/host/xhci-ring.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index f00d9ef..f68a1f0 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -1444,6 +1444,9 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, } } + WARN_ON(slot_id != TRB_TO_SLOT_ID( + le32_to_cpu(xhci-cmd_ring-dequeue-generic.field[3]))); + switch (le32_to_cpu(xhci-cmd_ring-dequeue-generic.field[3]) TRB_TYPE_BITMASK) { case TRB_TYPE(TRB_ENABLE_SLOT): @@ -1528,8 +1531,6 @@ bandwidth_change: break; case TRB_TYPE(TRB_RESET_DEV): xhci_dbg(xhci, Completed reset device command.\n); - slot_id = TRB_TO_SLOT_ID( - le32_to_cpu(xhci-cmd_ring-dequeue-generic.field[3])); virt_dev = xhci-devs[slot_id]; if (virt_dev) handle_cmd_in_cmd_wait_list(xhci, virt_dev, event); In this patch i did the stupid thing to place the WARN_ON() in the wrong place, since the Slot ID field of the Command TRB and the Slot ID field of the Command Completion Event TRB may differ for other commands. So, I will fix this and I will resend the patchset. ksenia -- 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] hid-elo: some systems cannot stomach work around
From: Oliver Neukum oneu...@suse.de Some systems although they have firmware class 'M', which usually needs a work around to not crash, must not be subjected to the work around because the work around crashes them. They cannot be told apart by their own device descriptor, but as they are part of compound devices can be identified by looking at their siblings. Signed-off-by: Oliver Neukum oneu...@suse.de --- drivers/hid/hid-elo.c | 35 ++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/drivers/hid/hid-elo.c b/drivers/hid/hid-elo.c index f042a6c..64ac53e 100644 --- a/drivers/hid/hid-elo.c +++ b/drivers/hid/hid-elo.c @@ -181,7 +181,40 @@ fail: */ static bool elo_broken_firmware(struct usb_device *dev) { - return use_fw_quirk le16_to_cpu(dev-descriptor.bcdDevice) == 0x10d; + struct usb_device *hub = dev-parent; + struct usb_device *child = NULL; + u16 fw_lvl = le16_to_cpu(dev-descriptor.bcdDevice); + u16 child_vid, child_pid; + int i; + + if (!use_fw_quirk) + return false; + if (fw_lvl != 0x10d) + return false; + + /*iterate sibling devices of the touch controller*/ + usb_hub_for_each_child(hub, i, child) { + child_vid = le16_to_cpu(child-descriptor.idVendor); + child_pid = le16_to_cpu(child-descriptor.idProduct); + + /* +* If one of the devices below is present attached as a sibling of +* the touch controller then this is a newer IBM 4820 monitor that +* does not need the IBM-requested workaround if fw level is +* 0x010d - aka 'M'. +* No other HW can have this combination. + */ + if (child_vid==0x04b3) { + switch (child_pid) { + case 0x4676: /*4820 21x Video*/ + case 0x4677: /*4820 51x Video*/ + case 0x4678: /*4820 2Lx Video*/ + case 0x4679: /*4820 5Lx Video*/ + return false; + } + } + } + return true; } static int elo_probe(struct hid_device *hdev, const struct hid_device_id *id) -- 1.8.3.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
[RFC v5 02/19] xhci: rename existing Command Completion Event handlers
This patch renames the function handlers of a triggered Command Completion Event that correspond to each command type into 'xhci_handle_cmd_type'. That is done to give a consistent naming space to all the functions that handle Command Completion Events and that will permit the code reader to reference to them more easily. Signed-off-by: Xenia Ragiadakou burzalod...@gmail.com Acked-by: Sarah Sharp sarah.a.sh...@linux.intel.com --- drivers/usb/host/xhci-ring.c | 18 -- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index ddbda35..ffd224c 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -755,7 +755,7 @@ static void xhci_giveback_urb_in_irq(struct xhci_hcd *xhci, * 2. Otherwise, we turn all the TRBs in the TD into No-op TRBs (with the chain * bit cleared) so that the HW will skip over them. */ -static void handle_stopped_endpoint(struct xhci_hcd *xhci, +static void xhci_handle_cmd_stop_ep(struct xhci_hcd *xhci, union xhci_trb *trb, struct xhci_event_cmd *event) { unsigned int slot_id; @@ -1063,9 +1063,8 @@ static void update_ring_for_set_deq_completion(struct xhci_hcd *xhci, * endpoint doorbell to restart the ring, but only if there aren't more * cancellations pending. */ -static void handle_set_deq_completion(struct xhci_hcd *xhci, - struct xhci_event_cmd *event, - union xhci_trb *trb) +static void xhci_handle_cmd_set_deq(struct xhci_hcd *xhci, + struct xhci_event_cmd *event, union xhci_trb *trb) { unsigned int slot_id; unsigned int ep_index; @@ -1157,9 +1156,8 @@ static void handle_set_deq_completion(struct xhci_hcd *xhci, ring_doorbell_for_active_rings(xhci, slot_id, ep_index); } -static void handle_reset_ep_completion(struct xhci_hcd *xhci, - struct xhci_event_cmd *event, - union xhci_trb *trb) +static void xhci_handle_cmd_reset_ep(struct xhci_hcd *xhci, + struct xhci_event_cmd *event, union xhci_trb *trb) { int slot_id; unsigned int ep_index; @@ -1497,15 +1495,15 @@ bandwidth_change: complete(xhci-addr_dev); break; case TRB_TYPE(TRB_STOP_RING): - handle_stopped_endpoint(xhci, xhci-cmd_ring-dequeue, event); + xhci_handle_cmd_stop_ep(xhci, xhci-cmd_ring-dequeue, event); break; case TRB_TYPE(TRB_SET_DEQ): - handle_set_deq_completion(xhci, event, xhci-cmd_ring-dequeue); + xhci_handle_cmd_set_deq(xhci, event, xhci-cmd_ring-dequeue); break; case TRB_TYPE(TRB_CMD_NOOP): break; case TRB_TYPE(TRB_RESET_EP): - handle_reset_ep_completion(xhci, event, xhci-cmd_ring-dequeue); + xhci_handle_cmd_reset_ep(xhci, event, xhci-cmd_ring-dequeue); break; case TRB_TYPE(TRB_RESET_DEV): xhci_dbg(xhci, Completed reset device command.\n); -- 1.8.3.4 -- 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
[RFC v5 13/19] xhci: add variable 'cmd_trb' in handle_cmd_completion()
This patch adds a new variable 'cmd_trb' to hold the address of the command TRB, that is associated with the command completion event, and to replace repetitions of xhci-cmd_ring-dequeue into the code. Signed-off-by: Xenia Ragiadakou burzalod...@gmail.com Acked-by: Sarah Sharp sarah.a.sh...@linux.intel.com --- drivers/usb/host/xhci-ring.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index dbf2051..1df73c9 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -1506,10 +1506,12 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, u64 cmd_dma; dma_addr_t cmd_dequeue_dma; u32 cmd_comp_code; + union xhci_trb *cmd_trb; cmd_dma = le64_to_cpu(event-cmd_trb); + cmd_trb = xhci-cmd_ring-dequeue; cmd_dequeue_dma = xhci_trb_virt_to_dma(xhci-cmd_ring-deq_seg, - xhci-cmd_ring-dequeue); + cmd_trb); /* Is the command ring deq ptr out of sync with the deq seg ptr? */ if (cmd_dequeue_dma == 0) { xhci-error_bitmask |= 1 4; @@ -1521,8 +1523,7 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, return; } - trace_xhci_cmd_completion(xhci-cmd_ring-dequeue-generic, - (struct xhci_generic_trb *) event); + trace_xhci_cmd_completion(cmd_trb, (struct xhci_generic_trb *) event); cmd_comp_code = GET_COMP_CODE(le32_to_cpu(event-status)); if (cmd_comp_code == COMP_CMD_ABORT || cmd_comp_code == COMP_CMD_STOP) { @@ -1538,7 +1539,7 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, } } - switch (le32_to_cpu(xhci-cmd_ring-dequeue-generic.field[3]) + switch (le32_to_cpu(cmd_trb-generic.field[3]) TRB_TYPE_BITMASK) { case TRB_TYPE(TRB_ENABLE_SLOT): xhci_handle_cmd_enable_slot(xhci, slot_id, cmd_comp_code); @@ -1556,19 +1557,19 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, xhci_handle_cmd_addr_dev(xhci, slot_id, cmd_comp_code); break; case TRB_TYPE(TRB_STOP_RING): - xhci_handle_cmd_stop_ep(xhci, xhci-cmd_ring-dequeue, event); + xhci_handle_cmd_stop_ep(xhci, cmd_trb, event); break; case TRB_TYPE(TRB_SET_DEQ): - xhci_handle_cmd_set_deq(xhci, event, xhci-cmd_ring-dequeue); + xhci_handle_cmd_set_deq(xhci, event, cmd_trb); break; case TRB_TYPE(TRB_CMD_NOOP): break; case TRB_TYPE(TRB_RESET_EP): - xhci_handle_cmd_reset_ep(xhci, event, xhci-cmd_ring-dequeue); + xhci_handle_cmd_reset_ep(xhci, event, cmd_trb); break; case TRB_TYPE(TRB_RESET_DEV): WARN_ON(slot_id != TRB_TO_SLOT_ID( - le32_to_cpu(xhci-cmd_ring-dequeue-generic.field[3]))); + le32_to_cpu(cmd_trb-generic.field[3]))); xhci_handle_cmd_reset_dev(xhci, slot_id, event); break; case TRB_TYPE(TRB_NEC_GET_FW): -- 1.8.3.4 -- 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
[RFC v5 10/19] xhci: remove unused 'ep_ring' variable in handle_cmd_completion()
This patch removes the variable 'ep_ring' that is assigned in TRB_CONFIG_EP switch case but never used. Signed-off-by: Xenia Ragiadakou burzalod...@gmail.com --- drivers/usb/host/xhci-ring.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 08ed322..195c6e7 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -1448,7 +1448,6 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, struct xhci_input_control_ctx *ctrl_ctx; struct xhci_virt_device *virt_dev; unsigned int ep_index; - struct xhci_ring *ep_ring; unsigned int ep_state; cmd_dma = le64_to_cpu(event-cmd_trb); @@ -1522,7 +1521,6 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, ep_index != (unsigned int) -1 le32_to_cpu(ctrl_ctx-add_flags) - SLOT_FLAG == le32_to_cpu(ctrl_ctx-drop_flags)) { - ep_ring = xhci-devs[slot_id]-eps[ep_index].ring; ep_state = xhci-devs[slot_id]-eps[ep_index].ep_state; if (!(ep_state EP_HALTED)) goto bandwidth_change; -- 1.8.3.4 -- 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
[RFC v5 07/19] xhci: refactor TRB_RESET_DEV case into function
The function that handles xHCI command completion is much too long and there is need to be broken up into individual functions for each command completion to improve code readablity. This patch refactors the code in TRB_RESET_DEV switch case in handle_cmd_completion() into a fuction named xhci_handle_cmd_reset_dev(). Signed-off-by: Xenia Ragiadakou burzalod...@gmail.com --- Differences from v3: add reason for new function creation in change log drivers/usb/host/xhci-ring.c | 22 +++--- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 8a74002..829ede8 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -1400,6 +1400,20 @@ static void xhci_handle_cmd_addr_dev(struct xhci_hcd *xhci, int slot_id, complete(xhci-addr_dev); } +static void xhci_handle_cmd_reset_dev(struct xhci_hcd *xhci, int slot_id, + struct xhci_event_cmd *event) +{ + struct xhci_virt_device *virt_dev; + + xhci_dbg(xhci, Completed reset device command.\n); + virt_dev = xhci-devs[slot_id]; + if (virt_dev) + handle_cmd_in_cmd_wait_list(xhci, virt_dev, event); + else + xhci_warn(xhci, Reset device command completion + for disabled slot %u\n, slot_id); +} + static void handle_cmd_completion(struct xhci_hcd *xhci, struct xhci_event_cmd *event) { @@ -1529,13 +1543,7 @@ bandwidth_change: case TRB_TYPE(TRB_RESET_DEV): WARN_ON(slot_id != TRB_TO_SLOT_ID( le32_to_cpu(xhci-cmd_ring-dequeue-generic.field[3]))); - xhci_dbg(xhci, Completed reset device command.\n); - virt_dev = xhci-devs[slot_id]; - if (virt_dev) - handle_cmd_in_cmd_wait_list(xhci, virt_dev, event); - else - xhci_warn(xhci, Reset device command completion - for disabled slot %u\n, slot_id); + xhci_handle_cmd_reset_dev(xhci, slot_id, event); break; case TRB_TYPE(TRB_NEC_GET_FW): if (!(xhci-quirks XHCI_NEC_HOST)) { -- 1.8.3.4 -- 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
[RFC v5 19/19] xhci: add trace for missed periodic transfers
There are situations under which xHC is unable to service an isochronous endpoint within its service interval. For an IN isoc endpoint, this is the case when its ring is full, while for an OUT isoc endpoint when its ring is empty. This patch adds a trace event to the class 'xhci_log_msg', called 'xhci_dbg_missed_periodic_tx', to trace the debug statements related to missed periodic transfers. Signed-off-by: Xenia Ragiadakou burzalod...@gmail.com --- Differences from v3: -make changelog more clear -add two additional tracepoints drivers/usb/host/xhci-ring.c | 26 -- drivers/usb/host/xhci-trace.h | 5 + 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 8eb3118..af9bbac 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -2493,18 +2493,22 @@ static int handle_tx_event(struct xhci_hcd *xhci, * a Ring Overrun Event for IN Isoch endpoint or Ring * Underrun Event for OUT Isoch endpoint. */ - xhci_dbg(xhci, underrun event on endpoint\n); + xhci_dbg_trace(xhci, trace_xhci_dbg_missed_periodic_tx, + underrun event on endpoint); if (!list_empty(ep_ring-td_list)) - xhci_dbg(xhci, Underrun Event for slot %d ep %d - still with TDs queued?\n, + xhci_dbg_trace(xhci, trace_xhci_dbg_missed_periodic_tx, + Underrun Event for slot %d ep %d + still with TDs queued?, TRB_TO_SLOT_ID(le32_to_cpu(event-flags)), ep_index); goto cleanup; case COMP_OVERRUN: - xhci_dbg(xhci, overrun event on endpoint\n); + xhci_dbg_trace(xhci, trace_xhci_dbg_missed_periodic_tx, + overrun event on endpoint); if (!list_empty(ep_ring-td_list)) - xhci_dbg(xhci, Overrun Event for slot %d ep %d - still with TDs queued?\n, + xhci_dbg_trace(xhci, trace_xhci_dbg_missed_periodic_tx, + Overrun Event for slot %d ep %d + still with TDs queued?, TRB_TO_SLOT_ID(le32_to_cpu(event-flags)), ep_index); goto cleanup; @@ -2520,7 +2524,8 @@ static int handle_tx_event(struct xhci_hcd *xhci, * short transfer when process the ep_ring next time. */ ep-skip = true; - xhci_dbg(xhci, Miss service interval error, set skip flag\n); + xhci_dbg_trace(xhci, trace_xhci_dbg_missed_periodic_tx, + Miss service interval error, set skip flag); goto cleanup; default: if (xhci_is_vendor_info_code(xhci, trb_comp_code)) { @@ -2564,8 +2569,8 @@ static int handle_tx_event(struct xhci_hcd *xhci, /* We've skipped all the TDs on the ep ring when ep-skip set */ if (ep-skip td_num == 0) { ep-skip = false; - xhci_dbg(xhci, All tds on the ep_ring skipped. - Clear skip flag.\n); + xhci_dbg_trace(xhci, trace_xhci_dbg_missed_periodic_tx, + All tds on ep_ring skipped. Clear skip flag.); ret = 0; goto cleanup; } @@ -2620,7 +2625,8 @@ static int handle_tx_event(struct xhci_hcd *xhci, ep_ring-last_td_was_short = false; if (ep-skip) { - xhci_dbg(xhci, Found td. Clear skip flag.\n); + xhci_dbg_trace(xhci, trace_xhci_dbg_missed_periodic_tx, + Found td. Clear skip flag.); ep-skip = false; } diff --git a/drivers/usb/host/xhci-trace.h b/drivers/usb/host/xhci-trace.h index 20364cc..c156685 100644 --- a/drivers/usb/host/xhci-trace.h +++ b/drivers/usb/host/xhci-trace.h @@ -67,6 +67,11 @@ DEFINE_EVENT(xhci_log_msg, xhci_dbg_ring_expansion, TP_ARGS(vaf) ); +DEFINE_EVENT(xhci_log_msg, xhci_dbg_missed_periodic_tx, + TP_PROTO(struct va_format *vaf), + TP_ARGS(vaf) +); + DECLARE_EVENT_CLASS(xhci_log_ctx, TP_PROTO(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx, unsigned int ep_num), -- 1.8.3.4 -- 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
[RFC v5 12/19] xhci: add variable 'cmd_comp_code' in handle_cmd_completion()
This patch adds a new variable 'cmd_comp_code' to hold the command completion status code aiming to reduce code duplication and to improve code readability. Signed-off-by: Xenia Ragiadakou burzalod...@gmail.com Acked-by: Sarah Sharp sarah.a.sh...@linux.intel.com --- drivers/usb/host/xhci-ring.c | 20 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 6dc582e..dbf2051 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -1505,6 +1505,7 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, int slot_id = TRB_TO_SLOT_ID(le32_to_cpu(event-flags)); u64 cmd_dma; dma_addr_t cmd_dequeue_dma; + u32 cmd_comp_code; cmd_dma = le64_to_cpu(event-cmd_trb); cmd_dequeue_dma = xhci_trb_virt_to_dma(xhci-cmd_ring-deq_seg, @@ -1523,16 +1524,15 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, trace_xhci_cmd_completion(xhci-cmd_ring-dequeue-generic, (struct xhci_generic_trb *) event); - if ((GET_COMP_CODE(le32_to_cpu(event-status)) == COMP_CMD_ABORT) || - (GET_COMP_CODE(le32_to_cpu(event-status)) == COMP_CMD_STOP)) { + cmd_comp_code = GET_COMP_CODE(le32_to_cpu(event-status)); + if (cmd_comp_code == COMP_CMD_ABORT || cmd_comp_code == COMP_CMD_STOP) { /* If the return value is 0, we think the trb pointed by * command ring dequeue pointer is a good trb. The good * trb means we don't want to cancel the trb, but it have * been stopped by host. So we should handle it normally. * Otherwise, driver should invoke inc_deq() and return. */ - if (handle_stopped_cmd_ring(xhci, - GET_COMP_CODE(le32_to_cpu(event-status { + if (handle_stopped_cmd_ring(xhci, cmd_comp_code)) { inc_deq(xhci, xhci-cmd_ring); return; } @@ -1541,23 +1541,19 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, switch (le32_to_cpu(xhci-cmd_ring-dequeue-generic.field[3]) TRB_TYPE_BITMASK) { case TRB_TYPE(TRB_ENABLE_SLOT): - xhci_handle_cmd_enable_slot(xhci, slot_id, - GET_COMP_CODE(le32_to_cpu(event-status))); + xhci_handle_cmd_enable_slot(xhci, slot_id, cmd_comp_code); break; case TRB_TYPE(TRB_DISABLE_SLOT): xhci_handle_cmd_disable_slot(xhci, slot_id); break; case TRB_TYPE(TRB_CONFIG_EP): - xhci_handle_cmd_config_ep(xhci, slot_id, event, - GET_COMP_CODE(le32_to_cpu(event-status))); + xhci_handle_cmd_config_ep(xhci, slot_id, event, cmd_comp_code); break; case TRB_TYPE(TRB_EVAL_CONTEXT): - xhci_handle_cmd_eval_ctx(xhci, slot_id, event, - GET_COMP_CODE(le32_to_cpu(event-status))); + xhci_handle_cmd_eval_ctx(xhci, slot_id, event, cmd_comp_code); break; case TRB_TYPE(TRB_ADDR_DEV): - xhci_handle_cmd_addr_dev(xhci, slot_id, - GET_COMP_CODE(le32_to_cpu(event-status))); + xhci_handle_cmd_addr_dev(xhci, slot_id, cmd_comp_code); break; case TRB_TYPE(TRB_STOP_RING): xhci_handle_cmd_stop_ep(xhci, xhci-cmd_ring-dequeue, event); -- 1.8.3.4 -- 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
[RFC v5 04/19] xhci: refactor TRB_DISABLE_SLOT case into function
The function that handles xHCI command completion is much too long and there is need to be broken up into individual functions for each command completion to improve code readablity. This patch refactors the code in TRB_DISABLE_SLOT switch case in handle_cmd_completion() into a fuction named xhci_handle_cmd_disable_slot(). Signed-off-by: Xenia Ragiadakou burzalod...@gmail.com --- Differences from v3: add reason for new function creation in change log drivers/usb/host/xhci-ring.c | 21 ++--- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 0abf88c..f9c380e 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -1380,6 +1380,19 @@ static void xhci_handle_cmd_enable_slot(struct xhci_hcd *xhci, int slot_id, complete(xhci-addr_dev); } +static void xhci_handle_cmd_disable_slot(struct xhci_hcd *xhci, int slot_id) +{ + struct xhci_virt_device *virt_dev; + + virt_dev = xhci-devs[slot_id]; + if (!virt_dev) + return; + if (xhci-quirks XHCI_EP_LIMIT_QUIRK) + /* Delete default control endpoint resources */ + xhci_free_device_endpoint_resources(xhci, virt_dev, true); + xhci_free_virt_device(xhci, slot_id); +} + static void handle_cmd_completion(struct xhci_hcd *xhci, struct xhci_event_cmd *event) { @@ -1431,13 +1444,7 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, GET_COMP_CODE(le32_to_cpu(event-status))); break; case TRB_TYPE(TRB_DISABLE_SLOT): - if (xhci-devs[slot_id]) { - if (xhci-quirks XHCI_EP_LIMIT_QUIRK) - /* Delete default control endpoint resources */ - xhci_free_device_endpoint_resources(xhci, - xhci-devs[slot_id], true); - xhci_free_virt_device(xhci, slot_id); - } + xhci_handle_cmd_disable_slot(xhci, slot_id); break; case TRB_TYPE(TRB_CONFIG_EP): virt_dev = xhci-devs[slot_id]; -- 1.8.3.4 -- 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
[RFC v5 16/19] xhci: add argument 'slot_id' in stop_ep, set_deq and reset_ep cmd handlers
Since the Slot ID field in the command completion event matches the Slot ID field in the associated command TRB for the Stop Endpoint, Set Dequeue Pointer and Reset Endpoint commands, this patch adds in the handlers of their completion events a 'slot_id' argument and removes the slot id calculation in each of them. Also, a WARN_ON() was added in case the slot ids reported by command TRB and event TRB differ (although according to xhci spec rev1.0 that should not happen) Signed-off-by: Xenia Ragiadakou burzalod...@gmail.com --- Differences from v4: -add a WARN_ON() in case the two slot id fields differ drivers/usb/host/xhci-ring.c | 25 - 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index ece06b2..46652da 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -755,10 +755,9 @@ static void xhci_giveback_urb_in_irq(struct xhci_hcd *xhci, * 2. Otherwise, we turn all the TRBs in the TD into No-op TRBs (with the chain * bit cleared) so that the HW will skip over them. */ -static void xhci_handle_cmd_stop_ep(struct xhci_hcd *xhci, +static void xhci_handle_cmd_stop_ep(struct xhci_hcd *xhci, int slot_id, union xhci_trb *trb, struct xhci_event_cmd *event) { - unsigned int slot_id; unsigned int ep_index; struct xhci_virt_device *virt_dev; struct xhci_ring *ep_ring; @@ -770,7 +769,6 @@ static void xhci_handle_cmd_stop_ep(struct xhci_hcd *xhci, struct xhci_dequeue_state deq_state; if (unlikely(TRB_TO_SUSPEND_PORT(le32_to_cpu(trb-generic.field[3] { - slot_id = TRB_TO_SLOT_ID(le32_to_cpu(trb-generic.field[3])); virt_dev = xhci-devs[slot_id]; if (virt_dev) handle_cmd_in_cmd_wait_list(xhci, virt_dev, @@ -783,7 +781,6 @@ static void xhci_handle_cmd_stop_ep(struct xhci_hcd *xhci, } memset(deq_state, 0, sizeof(deq_state)); - slot_id = TRB_TO_SLOT_ID(le32_to_cpu(trb-generic.field[3])); ep_index = TRB_TO_EP_INDEX(le32_to_cpu(trb-generic.field[3])); ep = xhci-devs[slot_id]-eps[ep_index]; @@ -1061,10 +1058,9 @@ static void update_ring_for_set_deq_completion(struct xhci_hcd *xhci, * endpoint doorbell to restart the ring, but only if there aren't more * cancellations pending. */ -static void xhci_handle_cmd_set_deq(struct xhci_hcd *xhci, +static void xhci_handle_cmd_set_deq(struct xhci_hcd *xhci, int slot_id, struct xhci_event_cmd *event, union xhci_trb *trb) { - unsigned int slot_id; unsigned int ep_index; unsigned int stream_id; struct xhci_ring *ep_ring; @@ -1072,7 +1068,6 @@ static void xhci_handle_cmd_set_deq(struct xhci_hcd *xhci, struct xhci_ep_ctx *ep_ctx; struct xhci_slot_ctx *slot_ctx; - slot_id = TRB_TO_SLOT_ID(le32_to_cpu(trb-generic.field[3])); ep_index = TRB_TO_EP_INDEX(le32_to_cpu(trb-generic.field[3])); stream_id = TRB_TO_STREAM_ID(le32_to_cpu(trb-generic.field[2])); dev = xhci-devs[slot_id]; @@ -1154,13 +1149,11 @@ static void xhci_handle_cmd_set_deq(struct xhci_hcd *xhci, ring_doorbell_for_active_rings(xhci, slot_id, ep_index); } -static void xhci_handle_cmd_reset_ep(struct xhci_hcd *xhci, +static void xhci_handle_cmd_reset_ep(struct xhci_hcd *xhci, int slot_id, struct xhci_event_cmd *event, union xhci_trb *trb) { - int slot_id; unsigned int ep_index; - slot_id = TRB_TO_SLOT_ID(le32_to_cpu(trb-generic.field[3])); ep_index = TRB_TO_EP_INDEX(le32_to_cpu(trb-generic.field[3])); /* This command will only fail if the endpoint wasn't halted, * but we don't care. @@ -1556,15 +1549,21 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, xhci_handle_cmd_addr_dev(xhci, slot_id, cmd_comp_code); break; case TRB_STOP_RING: - xhci_handle_cmd_stop_ep(xhci, cmd_trb, event); + WARN_ON(slot_id != TRB_TO_SLOT_ID( + le32_to_cpu(cmd_trb-generic.field[3]))); + xhci_handle_cmd_stop_ep(xhci, slot_id, cmd_trb, event); break; case TRB_SET_DEQ: - xhci_handle_cmd_set_deq(xhci, event, cmd_trb); + WARN_ON(slot_id != TRB_TO_SLOT_ID( + le32_to_cpu(cmd_trb-generic.field[3]))); + xhci_handle_cmd_set_deq(xhci, slot_id, event, cmd_trb); break; case TRB_CMD_NOOP: break; case TRB_RESET_EP: - xhci_handle_cmd_reset_ep(xhci, event, cmd_trb); + WARN_ON(slot_id != TRB_TO_SLOT_ID( + le32_to_cpu(cmd_trb-generic.field[3]))); + xhci_handle_cmd_reset_ep(xhci, slot_id, event, cmd_trb); break; case TRB_RESET_DEV:
[RFC v5 06/19] xhci: use completion event's slot id rather than dig it out of command
Since the slot id retrieved from the Reset Device TRB matches the slot id in the command completion event, which is available, there is no need to determine it again. This patch removes the uneccessary reassignment to slot id and adds a WARN_ON in case the two Slot ID fields differ (although according xhci spec rev1.0 they should not differ). Signed-off-by: Xenia Ragiadakou burzalod...@gmail.com --- Differences from v3: -the above change is performed now in a separate patch -a warning is triggered in case the slot id reported in event trb is different from the slot id renoted in command trb Differences from v4: -the warning was placed inside the TRB_RESET_DEV case statement, since for other type of commands, the slot id values may differ. The line overflow introduced by the change will be corrected by a follow on patch of this patchset drivers/usb/host/xhci-ring.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index f00d9ef..8a74002 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -1527,9 +1527,9 @@ bandwidth_change: xhci_handle_cmd_reset_ep(xhci, event, xhci-cmd_ring-dequeue); break; case TRB_TYPE(TRB_RESET_DEV): + WARN_ON(slot_id != TRB_TO_SLOT_ID( + le32_to_cpu(xhci-cmd_ring-dequeue-generic.field[3]))); xhci_dbg(xhci, Completed reset device command.\n); - slot_id = TRB_TO_SLOT_ID( - le32_to_cpu(xhci-cmd_ring-dequeue-generic.field[3])); virt_dev = xhci-devs[slot_id]; if (virt_dev) handle_cmd_in_cmd_wait_list(xhci, virt_dev, event); -- 1.8.3.4 -- 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
[RFC v5 05/19] xhci: refactor TRB_ADDR_DEV case into function
The function that handles xHCI command completion is much too long and there is need to be broken up into individual functions for each command completion to improve code readablity. This patch refactors the code in TRB_ADDR_DEV switch case in handle_cmd_completion() into a fuction named xhci_handle_cmd_addr_dev(). Signed-off-by: Xenia Ragiadakou burzalod...@gmail.com --- Differences from v3: add reason for new function creation in change log drivers/usb/host/xhci-ring.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index f9c380e..f00d9ef 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -1393,6 +1393,13 @@ static void xhci_handle_cmd_disable_slot(struct xhci_hcd *xhci, int slot_id) xhci_free_virt_device(xhci, slot_id); } +static void xhci_handle_cmd_addr_dev(struct xhci_hcd *xhci, int slot_id, + u32 cmd_comp_code) +{ + xhci-devs[slot_id]-cmd_status = cmd_comp_code; + complete(xhci-addr_dev); +} + static void handle_cmd_completion(struct xhci_hcd *xhci, struct xhci_event_cmd *event) { @@ -1505,8 +1512,8 @@ bandwidth_change: complete(xhci-devs[slot_id]-cmd_completion); break; case TRB_TYPE(TRB_ADDR_DEV): - xhci-devs[slot_id]-cmd_status = GET_COMP_CODE(le32_to_cpu(event-status)); - complete(xhci-addr_dev); + xhci_handle_cmd_addr_dev(xhci, slot_id, + GET_COMP_CODE(le32_to_cpu(event-status))); break; case TRB_TYPE(TRB_STOP_RING): xhci_handle_cmd_stop_ep(xhci, xhci-cmd_ring-dequeue, event); -- 1.8.3.4 -- 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
[RFC v5 14/19] xhci: add variable 'cmd_type' in handle_cmd_completion()
This patch adds a new variable 'cmd_type' to hold the command type so that switch cases can be simplified by removing TRB_TYPE() macro improving code readability. Signed-off-by: Xenia Ragiadakou burzalod...@gmail.com --- Differences from v3: update changelog to report the reason for such change drivers/usb/host/xhci-ring.c | 27 ++- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 1df73c9..605c327 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -1507,6 +1507,7 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, dma_addr_t cmd_dequeue_dma; u32 cmd_comp_code; union xhci_trb *cmd_trb; + u32 cmd_type; cmd_dma = le64_to_cpu(event-cmd_trb); cmd_trb = xhci-cmd_ring-dequeue; @@ -1539,40 +1540,40 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, } } - switch (le32_to_cpu(cmd_trb-generic.field[3]) -TRB_TYPE_BITMASK) { - case TRB_TYPE(TRB_ENABLE_SLOT): + cmd_type = TRB_FIELD_TO_TYPE(le32_to_cpu(cmd_trb-generic.field[3])); + switch (cmd_type) { + case TRB_ENABLE_SLOT: xhci_handle_cmd_enable_slot(xhci, slot_id, cmd_comp_code); break; - case TRB_TYPE(TRB_DISABLE_SLOT): + case TRB_DISABLE_SLOT: xhci_handle_cmd_disable_slot(xhci, slot_id); break; - case TRB_TYPE(TRB_CONFIG_EP): + case TRB_CONFIG_EP: xhci_handle_cmd_config_ep(xhci, slot_id, event, cmd_comp_code); break; - case TRB_TYPE(TRB_EVAL_CONTEXT): + case TRB_EVAL_CONTEXT: xhci_handle_cmd_eval_ctx(xhci, slot_id, event, cmd_comp_code); break; - case TRB_TYPE(TRB_ADDR_DEV): + case TRB_ADDR_DEV: xhci_handle_cmd_addr_dev(xhci, slot_id, cmd_comp_code); break; - case TRB_TYPE(TRB_STOP_RING): + case TRB_STOP_RING: xhci_handle_cmd_stop_ep(xhci, cmd_trb, event); break; - case TRB_TYPE(TRB_SET_DEQ): + case TRB_SET_DEQ: xhci_handle_cmd_set_deq(xhci, event, cmd_trb); break; - case TRB_TYPE(TRB_CMD_NOOP): + case TRB_CMD_NOOP: break; - case TRB_TYPE(TRB_RESET_EP): + case TRB_RESET_EP: xhci_handle_cmd_reset_ep(xhci, event, cmd_trb); break; - case TRB_TYPE(TRB_RESET_DEV): + case TRB_RESET_DEV: WARN_ON(slot_id != TRB_TO_SLOT_ID( le32_to_cpu(cmd_trb-generic.field[3]))); xhci_handle_cmd_reset_dev(xhci, slot_id, event); break; - case TRB_TYPE(TRB_NEC_GET_FW): + case TRB_NEC_GET_FW: xhci_handle_cmd_nec_get_fw(xhci, event); break; default: -- 1.8.3.4 -- 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
[RFC v5 09/19] xhci: refactor TRB_EVAL_CONTEXT case into function
The function that handles xHCI command completion is much too long and there is need to be broken up into individual functions for each command completion to improve code readablity. This patch refactors the code in TRB_EVAL_CONTEXT switch case in handle_cmd_completion() into a fuction named xhci_handle_cmd_eval_ctx(). Signed-off-by: Xenia Ragiadakou burzalod...@gmail.com --- Differences from v3: add reason for new function creation in change log drivers/usb/host/xhci-ring.c | 19 ++- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index b8b63f8..08ed322 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -1393,6 +1393,18 @@ static void xhci_handle_cmd_disable_slot(struct xhci_hcd *xhci, int slot_id) xhci_free_virt_device(xhci, slot_id); } +static void xhci_handle_cmd_eval_ctx(struct xhci_hcd *xhci, int slot_id, + struct xhci_event_cmd *event, u32 cmd_comp_code) +{ + struct xhci_virt_device *virt_dev; + + virt_dev = xhci-devs[slot_id]; + if (handle_cmd_in_cmd_wait_list(xhci, virt_dev, event)) + return; + virt_dev-cmd_status = cmd_comp_code; + complete(virt_dev-cmd_completion); +} + static void xhci_handle_cmd_addr_dev(struct xhci_hcd *xhci, int slot_id, u32 cmd_comp_code) { @@ -1532,11 +1544,8 @@ bandwidth_change: complete(xhci-devs[slot_id]-cmd_completion); break; case TRB_TYPE(TRB_EVAL_CONTEXT): - virt_dev = xhci-devs[slot_id]; - if (handle_cmd_in_cmd_wait_list(xhci, virt_dev, event)) - break; - xhci-devs[slot_id]-cmd_status = GET_COMP_CODE(le32_to_cpu(event-status)); - complete(xhci-devs[slot_id]-cmd_completion); + xhci_handle_cmd_eval_ctx(xhci, slot_id, event, + GET_COMP_CODE(le32_to_cpu(event-status))); break; case TRB_TYPE(TRB_ADDR_DEV): xhci_handle_cmd_addr_dev(xhci, slot_id, -- 1.8.3.4 -- 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
[RFC v5 15/19] xhci: replace 'xhci-cmd_ring-dequeue' with 'trb' in stop_ep cmd handler
This patch replaces 'xhci-cmd_ring-dequeue' with 'trb', the address of the command TRB, since it is available to reduce line length. Signed-off-by: Xenia Ragiadakou burzalod...@gmail.com Acked-by: Sarah Sharp sarah.a.sh...@linux.intel.com --- drivers/usb/host/xhci-ring.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 605c327..ece06b2 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -769,10 +769,8 @@ static void xhci_handle_cmd_stop_ep(struct xhci_hcd *xhci, struct xhci_dequeue_state deq_state; - if (unlikely(TRB_TO_SUSPEND_PORT( - le32_to_cpu(xhci-cmd_ring-dequeue-generic.field[3] { - slot_id = TRB_TO_SLOT_ID( - le32_to_cpu(xhci-cmd_ring-dequeue-generic.field[3])); + if (unlikely(TRB_TO_SUSPEND_PORT(le32_to_cpu(trb-generic.field[3] { + slot_id = TRB_TO_SLOT_ID(le32_to_cpu(trb-generic.field[3])); virt_dev = xhci-devs[slot_id]; if (virt_dev) handle_cmd_in_cmd_wait_list(xhci, virt_dev, -- 1.8.3.4 -- 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
[RFC v5 11/19] xhci: refactor TRB_CONFIG_EP case into function
The function that handles xHCI command completion is much too long and there is need to be broken up into individual functions for each command completion to improve code readablity. This patch refactors the code in TRB_CONFIG_EP switch case, in handle_cmd_completion(), into a fuction named xhci_handle_cmd_config_ep(). There were added two additional variables, 'add_flags' and 'drop_flags', to reduce line length below 80 chars and improve code readability. Signed-off-by: Xenia Ragiadakou burzalod...@gmail.com --- Differences from v3: -add reason for new function creation in change log -add a couple of newlines for clarity drivers/usb/host/xhci-ring.c | 114 +++ 1 file changed, 62 insertions(+), 52 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 195c6e7..6dc582e 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -1393,6 +1393,66 @@ static void xhci_handle_cmd_disable_slot(struct xhci_hcd *xhci, int slot_id) xhci_free_virt_device(xhci, slot_id); } +static void xhci_handle_cmd_config_ep(struct xhci_hcd *xhci, int slot_id, + struct xhci_event_cmd *event, u32 cmd_comp_code) +{ + struct xhci_virt_device *virt_dev; + struct xhci_input_control_ctx *ctrl_ctx; + unsigned int ep_index; + unsigned int ep_state; + u32 add_flags, drop_flags; + + virt_dev = xhci-devs[slot_id]; + if (handle_cmd_in_cmd_wait_list(xhci, virt_dev, event)) + return; + /* +* Configure endpoint commands can come from the USB core +* configuration or alt setting changes, or because the HW +* needed an extra configure endpoint command after a reset +* endpoint command or streams were being configured. +* If the command was for a halted endpoint, the xHCI driver +* is not waiting on the configure endpoint command. +*/ + ctrl_ctx = xhci_get_input_control_ctx(xhci, virt_dev-in_ctx); + if (!ctrl_ctx) { + xhci_warn(xhci, Could not get input context, bad type.\n); + return; + } + + add_flags = le32_to_cpu(ctrl_ctx-add_flags); + drop_flags = le32_to_cpu(ctrl_ctx-drop_flags); + /* Input ctx add_flags are the endpoint index plus one */ + ep_index = xhci_last_valid_endpoint(add_flags) - 1; + + /* A usb_set_interface() call directly after clearing a halted +* condition may race on this quirky hardware. Not worth +* worrying about, since this is prototype hardware. Not sure +* if this will work for streams, but streams support was +* untested on this prototype. +*/ + if (xhci-quirks XHCI_RESET_EP_QUIRK + ep_index != (unsigned int) -1 + add_flags - SLOT_FLAG == drop_flags) { + ep_state = virt_dev-eps[ep_index].ep_state; + if (!(ep_state EP_HALTED)) + goto bandwidth_change; + xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, + Completed config ep cmd - + last ep index = %d, state = %d, + ep_index, ep_state); + /* Clear internal halted state and restart ring(s) */ + virt_dev-eps[ep_index].ep_state = ~EP_HALTED; + ring_doorbell_for_active_rings(xhci, slot_id, ep_index); + return; + } +bandwidth_change: + xhci_dbg_trace(xhci, trace_xhci_dbg_context_change, + Completed config ep cmd); + virt_dev-cmd_status = cmd_comp_code; + complete(virt_dev-cmd_completion); + return; +} + static void xhci_handle_cmd_eval_ctx(struct xhci_hcd *xhci, int slot_id, struct xhci_event_cmd *event, u32 cmd_comp_code) { @@ -1445,10 +1505,6 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, int slot_id = TRB_TO_SLOT_ID(le32_to_cpu(event-flags)); u64 cmd_dma; dma_addr_t cmd_dequeue_dma; - struct xhci_input_control_ctx *ctrl_ctx; - struct xhci_virt_device *virt_dev; - unsigned int ep_index; - unsigned int ep_state; cmd_dma = le64_to_cpu(event-cmd_trb); cmd_dequeue_dma = xhci_trb_virt_to_dma(xhci-cmd_ring-deq_seg, @@ -1492,54 +1548,8 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, xhci_handle_cmd_disable_slot(xhci, slot_id); break; case TRB_TYPE(TRB_CONFIG_EP): - virt_dev = xhci-devs[slot_id]; - if (handle_cmd_in_cmd_wait_list(xhci, virt_dev, event)) - break; - /* -* Configure endpoint commands can come from the USB core -* configuration or alt setting changes, or because the HW -* needed an extra configure endpoint command after a reset -*
[RFC v5 03/19] xhci: refactor TRB_ENABLE_SLOT case into function
The function that handles xHCI command completion is much too long and there is need to be broken up into individual functions for each command completion to improve code readablity. This patch refactors the code in TRB_ENABLE_SLOT switch case in handle_cmd_completion() into a fuction named xhci_handle_cmd_enable_slot(). Signed-off-by: Xenia Ragiadakou burzalod...@gmail.com --- Differences from v3: add reason for new function creation in change log drivers/usb/host/xhci-ring.c | 17 - 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index ffd224c..0abf88c 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -1370,6 +1370,16 @@ static int handle_stopped_cmd_ring(struct xhci_hcd *xhci, return cur_trb_is_good; } +static void xhci_handle_cmd_enable_slot(struct xhci_hcd *xhci, int slot_id, + u32 cmd_comp_code) +{ + if (cmd_comp_code == COMP_SUCCESS) + xhci-slot_id = slot_id; + else + xhci-slot_id = 0; + complete(xhci-addr_dev); +} + static void handle_cmd_completion(struct xhci_hcd *xhci, struct xhci_event_cmd *event) { @@ -1417,11 +1427,8 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, switch (le32_to_cpu(xhci-cmd_ring-dequeue-generic.field[3]) TRB_TYPE_BITMASK) { case TRB_TYPE(TRB_ENABLE_SLOT): - if (GET_COMP_CODE(le32_to_cpu(event-status)) == COMP_SUCCESS) - xhci-slot_id = slot_id; - else - xhci-slot_id = 0; - complete(xhci-addr_dev); + xhci_handle_cmd_enable_slot(xhci, slot_id, + GET_COMP_CODE(le32_to_cpu(event-status))); break; case TRB_TYPE(TRB_DISABLE_SLOT): if (xhci-devs[slot_id]) { -- 1.8.3.4 -- 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
[RFC v5 18/19] xhci: add label 'update_ring' in handle_cmd_completion()
This patch adds the label 'update_ring' for the common code path: inc_deq(xhci, xhci-cmd_ring); return; Signed-off-by: Xenia Ragiadakou burzalod...@gmail.com --- Differences from v3: -remove return statement drivers/usb/host/xhci-ring.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 57769c5..8eb3118 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -1524,10 +1524,8 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, * been stopped by host. So we should handle it normally. * Otherwise, driver should invoke inc_deq() and return. */ - if (handle_stopped_cmd_ring(xhci, cmd_comp_code)) { - inc_deq(xhci, xhci-cmd_ring); - return; - } + if (handle_stopped_cmd_ring(xhci, cmd_comp_code)) + goto update_ring; } cmd_type = TRB_FIELD_TO_TYPE(le32_to_cpu(cmd_trb-generic.field[3])); @@ -1577,6 +1575,7 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, xhci-error_bitmask |= 1 6; break; } +update_ring: inc_deq(xhci, xhci-cmd_ring); } -- 1.8.3.4 -- 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
[RFC v5 17/19] xhci: replace 'event' with 'cmd_comp_code' in set_deq and reset_ep handlers
This patch replaces the 'event' argument of xhci_handle_cmd_set_deq() and xhci_handle_cmd_reset_ep(), which is used to retrieve the command completion status code, with the cmd_comp_code directly, since it is available. Signed-off-by: Xenia Ragiadakou burzalod...@gmail.com Acked-by: Sarah Sharp sarah.a.sh...@linux.intel.com --- drivers/usb/host/xhci-ring.c | 17 - 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 46652da..57769c5 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -1059,7 +1059,7 @@ static void update_ring_for_set_deq_completion(struct xhci_hcd *xhci, * cancellations pending. */ static void xhci_handle_cmd_set_deq(struct xhci_hcd *xhci, int slot_id, - struct xhci_event_cmd *event, union xhci_trb *trb) + union xhci_trb *trb, u32 cmd_comp_code) { unsigned int ep_index; unsigned int stream_id; @@ -1085,11 +1085,11 @@ static void xhci_handle_cmd_set_deq(struct xhci_hcd *xhci, int slot_id, ep_ctx = xhci_get_ep_ctx(xhci, dev-out_ctx, ep_index); slot_ctx = xhci_get_slot_ctx(xhci, dev-out_ctx); - if (GET_COMP_CODE(le32_to_cpu(event-status)) != COMP_SUCCESS) { + if (cmd_comp_code != COMP_SUCCESS) { unsigned int ep_state; unsigned int slot_state; - switch (GET_COMP_CODE(le32_to_cpu(event-status))) { + switch (cmd_comp_code) { case COMP_TRB_ERR: xhci_warn(xhci, WARN Set TR Deq Ptr cmd invalid because of stream ID configuration\n); @@ -1112,7 +1112,7 @@ static void xhci_handle_cmd_set_deq(struct xhci_hcd *xhci, int slot_id, default: xhci_warn(xhci, WARN Set TR Deq Ptr cmd with unknown completion code of %u.\n, - GET_COMP_CODE(le32_to_cpu(event-status))); + cmd_comp_code); break; } /* OK what do we do now? The endpoint state is hosed, and we @@ -1150,7 +1150,7 @@ static void xhci_handle_cmd_set_deq(struct xhci_hcd *xhci, int slot_id, } static void xhci_handle_cmd_reset_ep(struct xhci_hcd *xhci, int slot_id, - struct xhci_event_cmd *event, union xhci_trb *trb) + union xhci_trb *trb, u32 cmd_comp_code) { unsigned int ep_index; @@ -1159,8 +1159,7 @@ static void xhci_handle_cmd_reset_ep(struct xhci_hcd *xhci, int slot_id, * but we don't care. */ xhci_dbg_trace(xhci, trace_xhci_dbg_reset_ep, - Ignoring reset ep completion code of %u, -GET_COMP_CODE(le32_to_cpu(event-status))); + Ignoring reset ep completion code of %u, cmd_comp_code); /* HW with the reset endpoint quirk needs to have a configure endpoint * command complete before the endpoint can be used. Queue that here @@ -1556,14 +1555,14 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, case TRB_SET_DEQ: WARN_ON(slot_id != TRB_TO_SLOT_ID( le32_to_cpu(cmd_trb-generic.field[3]))); - xhci_handle_cmd_set_deq(xhci, slot_id, event, cmd_trb); + xhci_handle_cmd_set_deq(xhci, slot_id, cmd_trb, cmd_comp_code); break; case TRB_CMD_NOOP: break; case TRB_RESET_EP: WARN_ON(slot_id != TRB_TO_SLOT_ID( le32_to_cpu(cmd_trb-generic.field[3]))); - xhci_handle_cmd_reset_ep(xhci, slot_id, event, cmd_trb); + xhci_handle_cmd_reset_ep(xhci, slot_id, cmd_trb, cmd_comp_code); break; case TRB_RESET_DEV: WARN_ON(slot_id != TRB_TO_SLOT_ID( -- 1.8.3.4 -- 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: Virtual Interrupts -- Need help please
On Sun, Sep 08, 2013 at 05:35:56PM -0700, Guenter Roeck wrote: Please fix your mailer to word wrap within paragraphs, not doing this makes your mail very hard to read. It looks like your mailer has also reflowed Daniel's mail. On 09/08/2013 04:50 PM, Daniel Santos wrote: Even better, thank you very much!! If this thing had more EEPROM storage I would consider using the OF format for it's settings, but I only have 256 bytes to play with so I'm using a custom compression/encoding. You should really use devicetree anyway. How you get it loaded on demand is another question. Lack of storage is not a reason. Custom data will likely not be accepted upstream, if you had that in mind. If it's embedded into the device that shouldn't be such a problem - especially for something on a pluggable bus that could be used with any architecture device tree is pretty much a secondary concern. Device tree is far from universal and the main concern where it is used is with avoiding static board files. signature.asc Description: Digital signature
Re: Virtual Interrupts -- Need help please
On Sat, Sep 07, 2013 at 07:19:06PM -0500, Daniel Santos wrote: So do i create an IRQ domain and then call generic_handle_irq() from my URB complete() function? If so, which type of IRQ Domain is appropriate for this? Unlike typical platform devices, these are dynamically added and removed throughout the life of the kernel, adding to the challenge. So, if I understand correctly, my base IRQ number needs to be dynamically generated. How should I manage this? Unless you have a particular reason for using something else you should be using a linear domain - that's the default, it's very simple to work with. I have some secondary (and less important) questions about how to integrate this with device drivers that want a DT / open firmware config (which I know almost nothing about at this time), but that can wait. Could you be more specific about what you mean by integrate here? signature.asc Description: Digital signature
Re: Virtual Interrupts -- Need help please
Am 09.09.2013 13:02, schrieb Mark Brown: On Sun, Sep 08, 2013 at 05:35:56PM -0700, Guenter Roeck wrote: Please fix your mailer to word wrap within paragraphs, not doing this makes your mail very hard to read. It looks like your mailer has also reflowed Daniel's mail. That's just wrong. Mail readers should wrap lines, not senders. And readers can do this since some decades. The reason is obvious: No sender knows the line width the receiver can display. So, for example, if the sender hard breaks lines every 80 chars, a reader with a device which just displays 60 characters at max. will see every second line with at most 20 characters. I assume you can guess how such does look like. Furthermore there are still a lot of people which do like to read mails with line length as long their display is possible to show, and hard breaking lines on the receiver side does make such impossible. So the correct behaviour is to not hard break lines on the sender side and leave that to the reader on the receiving side, as only the receiving side knows the line width. Alexander Holler -- 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: Virtual Interrupts -- Need help please
On 09/09/2013 04:18 AM, Alexander Holler wrote: Am 09.09.2013 13:02, schrieb Mark Brown: On Sun, Sep 08, 2013 at 05:35:56PM -0700, Guenter Roeck wrote: Please fix your mailer to word wrap within paragraphs, not doing this makes your mail very hard to read. It looks like your mailer has also reflowed Daniel's mail. That's just wrong. Mail readers should wrap lines, not senders. And readers can do this since some decades. The reason is obvious: No sender knows the line width the receiver can display. So, for example, if the sender hard breaks lines every 80 chars, a reader with a device which just displays 60 characters at max. will see every second line with at most 20 characters. I assume you can guess how such does look like. Furthermore there are still a lot of people which do like to read mails with line length as long their display is possible to show, and hard breaking lines on the receiver side does make such impossible. So the correct behaviour is to not hard break lines on the sender side and leave that to the reader on the receiving side, as only the receiving side knows the line width. I am using thunderbird and/or mutt. I don't think they reflow anything, or at least the logged mail doesn't seem to have been reflowed (nor does the text above). As for what I write myself, I prefer to wrap manually, meaning automatic insertion of newlines is turned off. Guess I can not do it right for everyone. Guenter -- 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: Virtual Interrupts -- Need help please
Am 09.09.2013 13:45, schrieb Guenter Roeck: On 09/09/2013 04:18 AM, Alexander Holler wrote: Am 09.09.2013 13:02, schrieb Mark Brown: On Sun, Sep 08, 2013 at 05:35:56PM -0700, Guenter Roeck wrote: Please fix your mailer to word wrap within paragraphs, not doing this makes your mail very hard to read. It looks like your mailer has also reflowed Daniel's mail. That's just wrong. Mail readers should wrap lines, not senders. And readers can do this since some decades. The reason is obvious: No sender knows the line width the receiver can display. So, for example, if the sender hard breaks lines every 80 chars, a reader with a device which just displays 60 characters at max. will see every second line with at most 20 characters. I assume you can guess how such does look like. Furthermore there are still a lot of people which do like to read mails with line length as long their display is possible to show, and hard breaking lines on the receiver side does make such impossible. Uups, sorry, I meant on the sender side here. ;) So the correct behaviour is to not hard break lines on the sender side and leave that to the reader on the receiving side, as only the receiving side knows the line width. I am using thunderbird and/or mutt. I don't think they reflow anything, or at least the logged mail doesn't seem to have been reflowed (nor does the text above). As for what I write myself, I prefer to wrap manually, meaning automatic insertion of newlines is turned off. Guess I can not do it right for That just the right thing to do. everyone. Regards, Alexander Holler -- 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: [Bug] 0ac8:0321 Vimicro generic vc0321 Camera is not working and causes crashes since 3.2
Hi, On 09/08/2013 01:37 PM, Frank Dierich wrote: Hi, I have an ASUS A8JP Notebook with Ubuntu 12.04 with the following build in webcam Bus 001 Device 004: ID 0ac8:0321 Z-Star Microelectronics Corp. Vimicro generic vc0321 Camera The camera is working nice with Cheese and kernels before 3.2. I have tested the following once 2.6.32.61, 2.6.33.20, 2.6.34.11, 2.6.35.14, 2.6.36.4, 2.6.37.6, 2.6.38.8, 2.6.39.4, 3.0.94, 3.1.10. In all later kernels I have tested (3.2.50, 3.4.60, 3.10.10, 3.11.0) Cheese shows for some seconds a green and noisy image and crashes then with a segmentation fault. On the web I found some bug reports very similar to my problem but no one of these leads to a solution. http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=677533 https://bugs.launchpad.net/ubuntu/+source/linux/+bug/990749 In the following i give some informations about my system which hopefully helps to find the problem. Thanks for the bug report, looking at the bug reports, they all report an error of -71 which is EPROTO, which typically means something is wrong at the USB level. And nothing has changed for the driver in question between 3.1 and 3.2 , so I believe this regression is caused by changes to the usb sub-system, likely changes to the EHCI driver. The best way forward with this is probably to bisect the problem, and then send a mail to linux-usb@vger.kernel.org about this. Please CC me on this mail. Regards, Hans -- 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] Fix IPv6 support in usbipd
getaddrinfo() leaves the order of the returned addrinfo structs unspecified. On systems with bindv6only disabled (this is the default), PF_INET6 sockets bind to IPv4, too. Thus, IPv6 support in usbipd was broken when getaddrinfo returned first IPv4 and then IPv6 addrinfos, as the IPv6 bind failed with EADDRINUSE. This patch uses seperate sockets for IPv4 and IPv6 and sets IPV6_V6ONLY on all IPv6 sockets. Two command line arguments, -4 and -6 were added to manually select the socket family. Signed-off-by: Tobias Polzer tobias.pol...@fau.de Signed-off-by: Dominik Paulus dominik.pau...@fau.de --- .../staging/usbip/userspace/src/usbip_network.c| 12 .../staging/usbip/userspace/src/usbip_network.h| 1 + drivers/staging/usbip/userspace/src/usbipd.c | 68 -- 3 files changed, 63 insertions(+), 18 deletions(-) diff --git a/drivers/staging/usbip/userspace/src/usbip_network.c b/drivers/staging/usbip/userspace/src/usbip_network.c index c39a07f..e78279c 100644 --- a/drivers/staging/usbip/userspace/src/usbip_network.c +++ b/drivers/staging/usbip/userspace/src/usbip_network.c @@ -239,6 +239,18 @@ int usbip_net_set_keepalive(int sockfd) return ret; } +int usbip_net_set_v6only(int sockfd) +{ + const int val = 1; + int ret; + + ret = setsockopt(sockfd, IPPROTO_IPV6, IPV6_V6ONLY, val, sizeof(val)); + if (ret 0) + dbg(setsockopt: IPV6_V6ONLY); + + return ret; +} + /* * IPv6 Ready */ diff --git a/drivers/staging/usbip/userspace/src/usbip_network.h b/drivers/staging/usbip/userspace/src/usbip_network.h index 2d0e427..f19ae19 100644 --- a/drivers/staging/usbip/userspace/src/usbip_network.h +++ b/drivers/staging/usbip/userspace/src/usbip_network.h @@ -180,6 +180,7 @@ int usbip_net_recv_op_common(int sockfd, uint16_t *code); int usbip_net_set_reuseaddr(int sockfd); int usbip_net_set_nodelay(int sockfd); int usbip_net_set_keepalive(int sockfd); +int usbip_net_set_v6only(int sockfd); int usbip_net_tcp_connect(char *hostname, char *port); #endif /* __USBIP_NETWORK_H */ diff --git a/drivers/staging/usbip/userspace/src/usbipd.c b/drivers/staging/usbip/userspace/src/usbipd.c index 1c76cfd..d48eea8 100644 --- a/drivers/staging/usbip/userspace/src/usbipd.c +++ b/drivers/staging/usbip/userspace/src/usbipd.c @@ -56,6 +56,13 @@ static const char usbip_version_string[] = PACKAGE_STRING; static const char usbipd_help_string[] = usage: usbipd [options]\n + \n + -4, --ipv4\n + Bind to IPv4. Default is both.\n + \n + -6, --ipv6\n + Bind to IPv6. Default is both.\n + \n -D, --daemon\n Run as a daemon process.\n \n @@ -354,14 +361,15 @@ static void addrinfo_to_text(struct addrinfo *ai, char buf[], snprintf(buf, buf_size, %s:%s, hbuf, sbuf); } -static int listen_all_addrinfo(struct addrinfo *ai_head, int sockfdlist[]) +static int listen_all_addrinfo(struct addrinfo *ai_head, int sockfdlist[], +int maxsockfd) { struct addrinfo *ai; int ret, nsockfd = 0; const size_t ai_buf_size = NI_MAXHOST + NI_MAXSERV + 2; char ai_buf[ai_buf_size]; - for (ai = ai_head; ai nsockfd MAXSOCKFD; ai = ai-ai_next) { + for (ai = ai_head; ai nsockfd maxsockfd; ai = ai-ai_next) { int sock; addrinfo_to_text(ai, ai_buf, ai_buf_size); dbg(opening %s, ai_buf); @@ -374,6 +382,9 @@ static int listen_all_addrinfo(struct addrinfo *ai_head, int sockfdlist[]) usbip_net_set_reuseaddr(sock); usbip_net_set_nodelay(sock); + /* We use seperate sockets for IPv4 and IPv6 +* (see do_standalone_mode()) */ + usbip_net_set_v6only(sock); if (sock = FD_SETSIZE) { err(FD_SETSIZE: %s: sock=%d, max=%d, @@ -402,11 +413,6 @@ static int listen_all_addrinfo(struct addrinfo *ai_head, int sockfdlist[]) sockfdlist[nsockfd++] = sock; } - if (nsockfd == 0) - return -1; - - dbg(listening on %d address%s, nsockfd, (nsockfd == 1) ? : es); - return nsockfd; } @@ -473,11 +479,11 @@ static void remove_pid_file() } } -static int do_standalone_mode(int daemonize) +static int do_standalone_mode(int daemonize, int ipv4, int ipv6) { struct addrinfo *ai_head; int sockfdlist[MAXSOCKFD]; - int nsockfd; + int nsockfd, family; int i, terminate; struct pollfd *fds; struct timespec timeout; @@ -501,21 +507,35 @@ static int do_standalone_mode(int daemonize) set_signal(); write_pid_file(); - ai_head = do_getaddrinfo(NULL, PF_UNSPEC); + info(starting PROGNAME (%s), usbip_version_string); + + /* +* To suppress warnings on systems with bindv6only
Re: [alsa-devel] question about webcam audio capture
vichy wrote: I try to do webcam audio capture on my arm platform. when I execute audio capture I got below message retire_capture_urb: 108 callbacks suppressed This means that the retire_capture_urb() function printed lots of messages, and that 108 of them were thrown away because they were identical. You have to look at the previous line to get the actual message. 2. from usb mon log, it seems HW keep Active status high even until ehci_io_watchdog happen, because the ep status is -EXDEV. How are you trying to capture data? Regards, Clemens -- 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: Virtual Interrupts -- Need help please
On Mon, Sep 09, 2013 at 01:18:01PM +0200, Alexander Holler wrote: Am 09.09.2013 13:02, schrieb Mark Brown: makes your mail very hard to read. It looks like your mailer has also reflowed Daniel's mail. That's just wrong. Mail readers should wrap lines, not senders. And readers can do this since some decades. There's a specific way for senders to request that if it's desired, set format=flowed in the MIME type to tell the recipient that the formatting isn't important. The reason is obvious: No sender knows the line width the receiver can display. So, for example, if the sender hard breaks lines every 80 chars, a reader with a device which just displays 60 characters at max. will see every second line with at most 20 characters. I assume you can guess how such does look like. Furthermore there are still a lot of people which do like to read mails with line length as long their display is possible to show, and hard breaking lines on the receiver side does make such impossible. So the correct behaviour is to not hard break lines on the sender side and leave that to the reader on the receiving side, as only the receiving side knows the line width. This doesn't work well with lots of content (like patches) commonly handled in technical contexts - the line breaks actually mean something and it's hard fo the mail client to figure out what is going on unless someone tells it. signature.asc Description: Digital signature
Re: [PATCH 4/4] RX-51: Add platform function and data for bq24150a charger
Hi Pali, On Sun, Sep 08, 2013 at 10:50:39AM +0200, Pali Rohár wrote: This patch will register bq24150a charger in RX-51 board data. Patch also adding platform function between isp1704 and bq2415x drivers for detecting charger type. So finally charging battery on Nokia N900 (RX-51) working automatically without any proprietary Nokia bits in userspace. cool :) index 9c2dd10..a993ffe 100644 --- a/arch/arm/mach-omap2/board-rx51-peripherals.c +++ b/arch/arm/mach-omap2/board-rx51-peripherals.c AFAIK platform code for omap3 based boards is supposed to be removed in the near future [0]. Device Tree does not support the glue layer, so probably a small rx51 specific driver is needed. [0] https://lkml.org/lkml/2013/8/12/70 -- Sebastian signature.asc Description: Digital signature
Re: current version of http://www.linux-usb.org/usbtest/ testusb.c
On Mon, Sep 09, 2013 at 11:33:01AM +0530, Pratyush Anand wrote: On Mon, Sep 09, 2013 at 02:08:02AM +0800, joe M wrote: Hello, Just wanted to check if there is a version of http://www.linux-usb.org/usbtest/ testusb.c or test.sh scrpts that work with the current kernel. The files seem to be using usbfs, which is deprecated. ./testusb -a usbfs files are missing Any thoughts, please? mount -t usbfs usbfs /proc/bus/usb You are using too old of a kernel, that will not work anymore :) -- 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] Fix man-pages for usbip userspace utilities
The usbip userspace utilities contained some half-documented (only in --help, not in man) options. They were added to the man-pages of usbip and usbipd. Also a typo in the usbip headline was fixed. Signed-off-by: Tobias Polzer tobias.pol...@fau.de Signed-off-by: Dominik Paulus dominik.pau...@fau.de --- drivers/staging/usbip/userspace/doc/usbip.8 | 8 +++- drivers/staging/usbip/userspace/doc/usbipd.8 | 27 ++- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/drivers/staging/usbip/userspace/doc/usbip.8 b/drivers/staging/usbip/userspace/doc/usbip.8 index ccdadc8..a6097be 100644 --- a/drivers/staging/usbip/userspace/doc/usbip.8 +++ b/drivers/staging/usbip/userspace/doc/usbip.8 @@ -3,7 +3,7 @@ usbip \- manage USB/IP devices .SH SYNOPSIS .B usbip -[\foptions\R] \fIcommand\fR \fIargs\fR +[\fIoptions\fR] \fIcommand\fR \fIargs\fR .SH DESCRIPTION On a USB/IP server, devices can be listed, bound, and unbound using @@ -23,6 +23,12 @@ Print debugging information. Log to syslog. .PP +.HP +\fB\-\-tcp-port PORT\fR +.IP +Connect to PORT on remote host (used for attach and list --remote). +.PP + .SH COMMANDS .HP \fBversion\fR diff --git a/drivers/staging/usbip/userspace/doc/usbipd.8 b/drivers/staging/usbip/userspace/doc/usbipd.8 index d896936..ac4635d 100644 --- a/drivers/staging/usbip/userspace/doc/usbipd.8 +++ b/drivers/staging/usbip/userspace/doc/usbipd.8 @@ -14,10 +14,22 @@ Devices have to explicitly be exported using before usbipd makes them available to other hosts. The daemon accepts connections from USB/IP clients -on TCP port 3240. +on TCP port 3240 by default. .SH OPTIONS .HP +\fB\-4\fR, \fB\-\-ipv4\fR +.IP +Bind to IPv4. Default is both. +.PP + +.HP +\fB\-6\fR, \fB\-\-ipv6\fR +.IP +Bind to IPv6. Default is both. +.PP + +.HP \fB\-D\fR, \fB\-\-daemon\fR .IP Run as a daemon process. @@ -29,6 +41,19 @@ Run as a daemon process. Print debugging information. .PP +.HP +\fB\-PFILE\fR, \fB\-\-pid FILE\fR +.IP +Write process id to FILE. +.br +If no FILE specified, use /var/run/usbipd.pid +.PP + +\fB\-tPORT\fR, \fB\-\-tcp\-port PORT\fR +.IP +Listen on TCP/IP port PORT. +.PP + \fB\-h\fR, \fB\-\-help\fR .IP Print the program help message and exit. -- 1.8.4.rc3 -- 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: [alsa-devel] Buffer size for ALSA USB PCM audio
On 28.08.2013 20:46, Alan Stern wrote: On Wed, 28 Aug 2013, Clemens Ladisch wrote: Sorry, what I said applies more to explicit sync endpoints. When using implicit sync, a playback URB is submitted for each completed capture URB, with the number of samples per packet identical to the corresponding capture packet, so the parameters must be identical. Got it. Below is an updated patch. James, the problem you encountered was most likely a result of the faulty treatment of capture endpoints that Clemens pointed out. It was quite obvious in the usbmon traces that the unpatched driver used 8 packets per URB whereas the patched driver used 22. This updated patch should fix that problem. I gave this patch a try and I can confirm that it results in a sigificant improvement for small sample buffers. So feel free to add my Tested-by: Daniel Mack zon...@gmail.com Thanks, Daniel Index: usb-3.11/sound/usb/usbaudio.h === --- usb-3.11.orig/sound/usb/usbaudio.h +++ usb-3.11/sound/usb/usbaudio.h @@ -55,7 +55,6 @@ struct snd_usb_audio { struct list_head mixer_list;/* list of mixer interfaces */ int setup; /* from the 'device_setup' module param */ - int nrpacks;/* from the 'nrpacks' module param */ bool autoclock; /* from the 'autoclock' module param */ struct usb_host_interface *ctrl_intf; /* the audio control interface */ Index: usb-3.11/sound/usb/card.c === --- usb-3.11.orig/sound/usb/card.c +++ usb-3.11/sound/usb/card.c @@ -79,7 +79,6 @@ static bool enable[SNDRV_CARDS] = SNDRV_ /* Vendor/product IDs for this card */ static int vid[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = -1 }; static int pid[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = -1 }; -static int nrpacks = 8; /* max. number of packets per urb */ static int device_setup[SNDRV_CARDS]; /* device parameter for this card */ static bool ignore_ctl_error; static bool autoclock = true; @@ -94,8 +93,6 @@ module_param_array(vid, int, NULL, 0444) MODULE_PARM_DESC(vid, Vendor ID for the USB audio device.); module_param_array(pid, int, NULL, 0444); MODULE_PARM_DESC(pid, Product ID for the USB audio device.); -module_param(nrpacks, int, 0644); -MODULE_PARM_DESC(nrpacks, Max. number of packets per URB.); module_param_array(device_setup, int, NULL, 0444); MODULE_PARM_DESC(device_setup, Specific device setup (if needed).); module_param(ignore_ctl_error, bool, 0444); @@ -374,7 +371,6 @@ static int snd_usb_audio_create(struct u chip-dev = dev; chip-card = card; chip-setup = device_setup[idx]; - chip-nrpacks = nrpacks; chip-autoclock = autoclock; chip-probing = 1; @@ -756,10 +752,6 @@ static struct usb_driver usb_audio_drive static int __init snd_usb_audio_init(void) { - if (nrpacks 1 || nrpacks MAX_PACKS) { - printk(KERN_WARNING invalid nrpacks value.\n); - return -EINVAL; - } return usb_register(usb_audio_driver); } Index: usb-3.11/sound/usb/endpoint.h === --- usb-3.11.orig/sound/usb/endpoint.h +++ usb-3.11/sound/usb/endpoint.h @@ -12,6 +12,8 @@ int snd_usb_endpoint_set_params(struct s snd_pcm_format_t pcm_format, unsigned int channels, unsigned int period_bytes, + unsigned int period_frames, + unsigned int buffer_periods, unsigned int rate, struct audioformat *fmt, struct snd_usb_endpoint *sync_ep); Index: usb-3.11/sound/usb/card.h === --- usb-3.11.orig/sound/usb/card.h +++ usb-3.11/sound/usb/card.h @@ -2,11 +2,11 @@ #define __USBAUDIO_CARD_H #define MAX_NR_RATES 1024 -#define MAX_PACKS20 +#define MAX_PACKS6 /* per URB */ #define MAX_PACKS_HS (MAX_PACKS * 8) /* in high speed mode */ -#define MAX_URBS 8 +#define MAX_URBS 12 #define SYNC_URBS4 /* always four urbs for sync */ -#define MAX_QUEUE24 /* try not to exceed this queue length, in ms */ +#define MAX_QUEUE18 /* try not to exceed this queue length, in ms */ struct audioformat { struct list_head list; @@ -87,6 +87,7 @@ struct snd_usb_endpoint { unsigned int phase; /* phase accumulator */ unsigned int maxpacksize; /* max packet size in bytes */ unsigned int maxframesize; /* max packet size in frames */ + unsigned int max_urb_frames;/* max URB size in frames */ unsigned int curpacksize; /*
Re: Virtual Interrupts -- Need help please
Am 09.09.2013 15:45, schrieb Mark Brown: On Mon, Sep 09, 2013 at 01:18:01PM +0200, Alexander Holler wrote: Am 09.09.2013 13:02, schrieb Mark Brown: makes your mail very hard to read. It looks like your mailer has also reflowed Daniel's mail. That's just wrong. Mail readers should wrap lines, not senders. And readers can do this since some decades. There's a specific way for senders to request that if it's desired, set format=flowed in the MIME type to tell the recipient that the formatting isn't important. The reason is obvious: No sender knows the line width the receiver can display. So, for example, if the sender hard breaks lines every 80 chars, a reader with a device which just displays 60 characters at max. will see every second line with at most 20 characters. I assume you can guess how such does look like. Furthermore there are still a lot of people which do like to read mails with line length as long their display is possible to show, and hard breaking lines on the receiver side does make such impossible. So the correct behaviour is to not hard break lines on the sender side and leave that to the reader on the receiving side, as only the receiving side knows the line width. This doesn't work well with lots of content (like patches) commonly handled in technical contexts - the line breaks actually mean something and it's hard fo the mail client to figure out what is going on unless someone tells it. I wonder what all the hard line breaks you added to your mail do mean? Hard line breaks in paragraphs, as you've requested, doesn't mean anything. They just make eamils extremly ugly, e.g. your one is displayed here with a whole lot of unused white space because I'm not using a CGA screen. And people who do read your mail on a phone with less than 80 or 75 chars will see it as even more ugly. And imho it just works if hard line breaks are used where they belong too, the code or to end paragraphs or otherwise where they have a meaning, but not just always after 75 or 80 chars. Regards, Alexander Holler -- 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: current version of http://www.linux-usb.org/usbtest/ testusb.c
Hello Pratyush, If I remember well it was working till 3.5 only Does it not work for USB Ch.9 tests? I am trying to test the control transactions of a HID device with testusb and I get the Inappropriate ioctl for device. I am not sure if it is something wrong with my environment/setup or if testusb does not work anymore. my uname -a is: Linux master 3.11.0-06855-g4de9ad9-dirty #32 SMP PREEMPT Sun Sep 8 22:13:51 CDT 2013 x86_64 Intel(R) Pentium(R) CPU G620 @ 2.60GHz GenuineIntel GNU/Linux Any thoughts, please? Thanks Joe -- 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: phy-mxs: Add auto clock and power setting
Dear Peter Chen, With the auto setting, the PHY's clock and power can be recovered correctly from low power mode, it is ganranteed by IC logic. Besides, we enable the IC fixes for this PHY at mx6 platform. Signed-off-by: Peter Chen peter.c...@freescale.com --- drivers/usb/phy/phy-mxs-usb.c | 30 ++ 1 files changed, 26 insertions(+), 4 deletions(-) diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index f80e2e6..868c445 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c @@ -1,5 +1,5 @@ /* - * Copyright 2012 Freescale Semiconductor, Inc. + * Copyright 2012-2013 Freescale Semiconductor, Inc. * Copyright (C) 2012 Marek Vasut ma...@denx.de * on behalf of DENX Software Engineering GmbH * @@ -29,8 +29,17 @@ #define HW_USBPHY_CTRL_SET 0x34 #define HW_USBPHY_CTRL_CLR 0x38 +#define HW_USBPHY_IP 0x90 +#define HW_USBPHY_IP_SET 0x94 +#define HW_USBPHY_IP_CLR 0x98 + #define BM_USBPHY_CTRL_SFTRSTBIT(31) #define BM_USBPHY_CTRL_CLKGATE BIT(30) +#define BM_USBPHY_CTRL_ENAUTOSET_USBCLKS BIT(26) +#define BM_USBPHY_CTRL_ENAUTOCLR_USBCLKGATE BIT(25) +#define BM_USBPHY_CTRL_ENAUTOCLR_PHY_PWD BIT(20) +#define BM_USBPHY_CTRL_ENAUTOCLR_CLKGATE BIT(19) +#define BM_USBPHY_CTRL_ENAUTO_PWRON_PLL BIT(18) #define BM_USBPHY_CTRL_ENUTMILEVEL3 BIT(15) #define BM_USBPHY_CTRL_ENUTMILEVEL2 BIT(14) #define BM_USBPHY_CTRL_ENHOSTDISCONDETECTBIT(1) @@ -100,11 +109,24 @@ static int mxs_phy_hw_init(struct mxs_phy *mxs_phy) /* Power up the PHY */ writel(0, base + HW_USBPHY_PWD); - /* enable FS/LS device */ - writel(BM_USBPHY_CTRL_ENUTMILEVEL2 | -BM_USBPHY_CTRL_ENUTMILEVEL3, + /* + * USB PHY Ctrl Setting + * - Auto clock/power on + * - Enable full/low speed support + */ + writel(BM_USBPHY_CTRL_ENAUTOSET_USBCLKS | + BM_USBPHY_CTRL_ENAUTOCLR_USBCLKGATE | + BM_USBPHY_CTRL_ENAUTOCLR_PHY_PWD | + BM_USBPHY_CTRL_ENAUTOCLR_CLKGATE | + BM_USBPHY_CTRL_ENAUTO_PWRON_PLL | + BM_USBPHY_CTRL_ENUTMILEVEL2 | + BM_USBPHY_CTRL_ENUTMILEVEL3, base + HW_USBPHY_CTRL_SET); + /* Enable IC solution */ + if (is_mx6q_phy(mxs_phy) || is_mx6sl_phy(mxs_phy)) + writel(BM_USBPHY_IP_FIX, base + HW_USBPHY_IP_SET); So why not just add fsl,imx6-phy instead of adding three phy types ? Best regards, Marek Vasut -- 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: [alsa-devel] question about webcam audio capture
hi Clemens: 2013/9/9 Clemens Ladisch clem...@ladisch.de: vichy wrote: I try to do webcam audio capture on my arm platform. when I execute audio capture I got below message retire_capture_urb: 108 callbacks suppressed This means that the retire_capture_urb() function printed lots of messages, and that 108 of them were thrown away because they were identical. Does that mean: 1. 108 of messages are the same and through away 2. alsa get data from uac device through Host controller driver 108 times and find they are the same and through away You have to look at the previous line to get the actual message. I try to grep -rwn 'retire_capture_urb.*' sound/usb/*, but get nothing. Would you please tell me what the previous line to get the actual message you mean? 2. from usb mon log, it seems HW keep Active status high even until ehci_io_watchdog happen, because the ep status is -EXDEV. How are you trying to capture data? I use the capture function in tinyalsa. BTW, If I want to use number of urbs I expected and only send/complete only 1 round, where I can find the source code to modify? Thanks for your great help, -- 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: gadget: Add UDC driver for Aeroflex Gaisler GRUSBDC
On Mon, Sep 09, 2013 at 07:33:31AM +0200, Andreas Larsson wrote: On 2013-08-28 11:02, Andreas Larsson wrote: On 2013-08-12 16:05, Andreas Larsson wrote: This adds an UDC driver for GRUSBDC USB Device Controller cores available in the GRLIB VHDL IP core library. The driver only supports DMA mode. Any comments? It would be great to get feedback soon in case some things need to be changed for this driver to be accepted. Thanks! Anyone? Is there anything holding it back from being accepted into mainline? This is the middle of the merge window, nothing can be accepted at the moment, please wait until 3.12-rc1 comes out and our trees open up again to expect a response. 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
Re: testusb on a HID device
On Sun, 8 Sep 2013, joe M wrote: Hello, I do not want to rmmod the hid module as I think it will affect my being-used usb keyboard and mouse too. I just want to rmmod the hid module for the device being tested. I got this http://unix.stackexchange.com/questions/12005/how-to-use-linux-kernel-driver-bind-unbind-interface-for-usb-hid-devices which talks about unbinding a device. I did the below: echo -n 0003:03EB:204D.0008 | sudo tee /sys/bus/hid/drivers/hid-generic/unbind This is the wrong driver. You need to unbind usbhid, not hid-generic. Like at the files under /sys/bus/usb/drivers/usbhid/. Alan Stern -- 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: [alsa-devel] Buffer size for ALSA USB PCM audio
On Mon, 9 Sep 2013, Daniel Mack wrote: I gave this patch a try and I can confirm that it results in a sigificant improvement for small sample buffers. So feel free to add my Tested-by: Daniel Mack zon...@gmail.com Thanks; I'll include this when the patch is submitted. Alan Stern -- 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: testusb on a HID device
Hello, This is the wrong driver. You need to unbind usbhid, not hid-generic. Like at the files under /sys/bus/usb/drivers/usbhid/. That worked like a charm. Thanks a lot. Joe -- 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: current version of http://www.linux-usb.org/usbtest/ testusb.c
Hello Pratyush, Does it not work for USB Ch.9 tests? I am trying to test the control transactions of a HID device with testusb and I get the Inappropriate ioctl for device. I am not sure if it is something wrong with my environment/setup or if testusb does not work anymore. my uname -a is: Linux master 3.11.0-06855-g4de9ad9-dirty #32 SMP PREEMPT Sun Sep 8 22:13:51 CDT 2013 x86_64 Intel(R) Pentium(R) CPU G620 @ 2.60GHz GenuineIntel GNU/Linux It is working now. I was unbinding the hid-generic driver and not the usbhid driver. Sorry for the bother, Joe -- 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: [alsa-devel] question about webcam audio capture
hi Clemens: 2013/9/9 vichy vichy@gmail.com: hi Clemens: 2013/9/9 Clemens Ladisch clem...@ladisch.de: vichy wrote: I try to do webcam audio capture on my arm platform. when I execute audio capture I got below message retire_capture_urb: 108 callbacks suppressed This means that the retire_capture_urb() function printed lots of messages, and that 108 of them were thrown away because they were identical. Does that mean: 1. 108 of messages are the same and through away 2. alsa get data from uac device through Host controller driver 108 times and find they are the same and through away You have to look at the previous line to get the actual message. I try to grep -rwn 'retire_capture_urb.*' sound/usb/*, but get nothing. Would you please tell me what the previous line to get the actual message you mean? 2. from usb mon log, it seems HW keep Active status high even until ehci_io_watchdog happen, because the ep status is -EXDEV. How are you trying to capture data? I use the capture function in tinyalsa. forget to say, the command I execute is tinycap record.wav -D 0 -d 0 -c 2 -r 32000 BTW, If I want to use number of urbs I expected and only send/complete only 1 round, where I can find the source code to modify? it seems ep-nurbs in snd_usb_endpoint_start is what I expected, right? Thanks for your great help, -- 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:Very Urgent!!!
Greetings from BURKINA FASO: Let me start by introduce myself,I am Mrs Doris Omar, BILL AND EXCHANGE MANAGER (Bank of Africa) Ouagadougou, Burkina Faso.I am writting you this letter based on the latest development at our bank which I will like to bring to your personal edification. $12,250million transfer claims. this is a legitimate transaction and I agreed to offer you 40% of this money as my foreign partner after confirmation of the fund in your bank account,If you are interested, please get back to me for more clarification. Yours faithful, Mrs Doris Omar. -- 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
FROM Mr USMAN ABU
FROM Mr USMAN ABU BILLS AND EXCHANGE MANAGER, BANK OF AFRICA (B.O.A) OUAGADOUGOU BURKINA FASO. IN WEST AFRICA For your kind attention, i will be very glad if you do assist me to relocate a sum of (US18.5 Million) to your personal bank account for the benefit of both of us. This is a genuine business transaction, only that i cannot operate it alone without using a Foreigner as required in my bank law, therefore i am contacting you to stand before my bank as the beneficiary next of kin of this fund, that is my reason of contacting you in this manner to assist me actualise this better opportunity, also to share the benefit together with me Insha' Allah. You will be entitled to have 30% of this fund as a foreign partner, since you will provide a bank account where this money will be transferred to, while 70% will be for me, by indicating your interest on assurance of trust, i will send you the full details and how this business will be executed. Please keep this proposal as a top secret between both of us because the secret of this transaction is as well as the success of it, and if you are really sure of your integrity, trustworthy and confidentiality reply back to me immediately to prove your integrity, And if you are not interested about this business delete it immediately in your email box. I will be looking forward for your urgent response, If you are interested,get back to me with your following details below. Name Country.. Phone number Fax.. Your Age. Occupation... Address.. Bank Name Bank Address. Account number... Account name. Bank swift code.. As soon as I receive these data's, I will forward to you the application form which you will send to the bank. Best Regard Mr USMAN ABU -- 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/5] USB : serial : invoke dcd_change ldisc's handler.
In order to have the PPS line discipline to work with usb devices. Signed-off-by: Paul Chavent paul.chav...@onera.fr --- drivers/usb/serial/generic.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index 91f0592..a18a086 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c @@ -567,6 +567,13 @@ void usb_serial_handle_dcd_change(struct usb_serial_port *usb_port, { struct tty_port *port = usb_port-port; struct tty_struct *tty = tty_port_tty_get(port); + struct tty_ldisc *ld = tty ? tty_ldisc_ref(tty) : NULL; + + if (ld) { + if (ld-ops-dcd_change) + ld-ops-dcd_change(tty, status); + tty_ldisc_deref(ld); + } dev_dbg(usb_port-dev, %s - status %d\n, __func__, status); -- 1.7.12.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 2/5] USB : serial : get protected tty in handle_dcd_change.
This patch depends on 72df17e... (PATCH 1). It restores the retreiving of a protected instance of tty. As opposed to the serialcore.c dcd_change implementation, the callers of dcd_change used to get protected tty instance. Signed-off-by: Paul Chavent paul.chav...@onera.fr --- drivers/usb/serial/generic.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index 33f1df1..91f0592 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c @@ -566,7 +566,7 @@ void usb_serial_handle_dcd_change(struct usb_serial_port *usb_port, unsigned int status) { struct tty_port *port = usb_port-port; - struct tty_struct *tty = port-tty; + struct tty_struct *tty = tty_port_tty_get(port); dev_dbg(usb_port-dev, %s - status %d\n, __func__, status); @@ -574,6 +574,8 @@ void usb_serial_handle_dcd_change(struct usb_serial_port *usb_port, wake_up_interruptible(port-open_wait); else if (tty !C_CLOCAL(tty)) tty_hangup(tty); + + tty_kref_put(tty); } EXPORT_SYMBOL_GPL(usb_serial_handle_dcd_change); -- 1.7.12.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 3/5] USB : serial : call handle_dcd_change in ftdi driver.
Signed-off-by: Paul Chavent paul.chav...@onera.fr --- drivers/usb/serial/ftdi_sio.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index c45f9c0..2d3d3a0 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c @@ -1966,8 +1966,11 @@ static int ftdi_process_packet(struct usb_serial_port *port, port-icount.dsr++; if (diff_status FTDI_RS0_RI) port-icount.rng++; - if (diff_status FTDI_RS0_RLSD) + if (diff_status FTDI_RS0_RLSD) { port-icount.dcd++; + usb_serial_handle_dcd_change(port, + status FTDI_RS0_RLSD); + } wake_up_interruptible(port-port.delta_msr_wait); priv-prev_status = status; -- 1.7.12.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 1/5] USB : serial : remove tty arg of handle_dcd_change.
Do the same way as in serialcore.c for uart_handle_dcd_change. It removes duplicated code around the usb_serial_handle_dcd_change calls. Signed-off-by: Paul Chavent paul.chav...@onera.fr --- drivers/usb/serial/ch341.c | 7 ++- drivers/usb/serial/generic.c | 4 ++-- drivers/usb/serial/pl2303.c | 7 +-- include/linux/usb/serial.h | 1 - 4 files changed, 5 insertions(+), 14 deletions(-) diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c index c2a4171..51c3d3a 100644 --- a/drivers/usb/serial/ch341.c +++ b/drivers/usb/serial/ch341.c @@ -481,11 +481,8 @@ static void ch341_read_int_callback(struct urb *urb) spin_unlock_irqrestore(priv-lock, flags); if ((priv-line_status ^ prev_line_status) CH341_BIT_DCD) { - struct tty_struct *tty = tty_port_tty_get(port-port); - if (tty) - usb_serial_handle_dcd_change(port, tty, - priv-line_status CH341_BIT_DCD); - tty_kref_put(tty); + usb_serial_handle_dcd_change(port, + priv-line_status CH341_BIT_DCD); } wake_up_interruptible(port-port.delta_msr_wait); diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index 1f31e6b..33f1df1 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c @@ -560,13 +560,13 @@ EXPORT_SYMBOL_GPL(usb_serial_handle_break); /** * usb_serial_handle_dcd_change - handle a change of carrier detect state * @port: usb_serial_port structure for the open port - * @tty: tty_struct structure for the port * @status: new carrier detect status, nonzero if active */ void usb_serial_handle_dcd_change(struct usb_serial_port *usb_port, - struct tty_struct *tty, unsigned int status) + unsigned int status) { struct tty_port *port = usb_port-port; + struct tty_struct *tty = port-tty; dev_dbg(usb_port-dev, %s - status %d\n, __func__, status); diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index e7a84f0..3299f3a 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c @@ -823,7 +823,6 @@ static void pl2303_update_line_status(struct usb_serial_port *port, { struct pl2303_private *priv = usb_get_serial_port_data(port); - struct tty_struct *tty; unsigned long flags; u8 status_idx = UART_STATE; u8 length = UART_STATE + 1; @@ -856,13 +855,9 @@ static void pl2303_update_line_status(struct usb_serial_port *port, usb_serial_handle_break(port); wake_up_interruptible(port-port.delta_msr_wait); - tty = tty_port_tty_get(port-port); - if (!tty) - return; if ((priv-line_status ^ prev_line_status) UART_DCD) - usb_serial_handle_dcd_change(port, tty, + usb_serial_handle_dcd_change(port, priv-line_status UART_DCD); - tty_kref_put(tty); } static void pl2303_read_int_callback(struct urb *urb) diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index d528b80..facec97 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h @@ -347,7 +347,6 @@ extern int usb_serial_handle_sysrq_char(struct usb_serial_port *port, unsigned int ch); extern int usb_serial_handle_break(struct usb_serial_port *port); extern void usb_serial_handle_dcd_change(struct usb_serial_port *usb_port, -struct tty_struct *tty, unsigned int status); -- 1.7.12.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 5/5] USB : serial : pl2303 wake up after dcd status check.
Seems to be done this way in other drivers (ch341, 8250, ...). Signed-off-by: Paul Chavent paul.chav...@onera.fr --- drivers/usb/serial/pl2303.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 3299f3a..6bb405b 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c @@ -853,11 +853,11 @@ static void pl2303_update_line_status(struct usb_serial_port *port, spin_unlock_irqrestore(priv-lock, flags); if (priv-line_status UART_BREAK_ERROR) usb_serial_handle_break(port); - wake_up_interruptible(port-port.delta_msr_wait); - if ((priv-line_status ^ prev_line_status) UART_DCD) usb_serial_handle_dcd_change(port, priv-line_status UART_DCD); + + wake_up_interruptible(port-port.delta_msr_wait); } static void pl2303_read_int_callback(struct urb *urb) -- 1.7.12.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 0/5] Enable PPS reporting for USB serial devices
Hi. This series enable the PPS reporting for USB serial devices. Patch 01 : change the interface of handle_dcd_change for usb serial in order to avoid duplicating code when calling this function and to be closer of the uart handle_dcd_change interface. Patch 02 : this patch depends on the previous one. It is optional. It restores the way the tty is retreived : the serial drivers used to call tty_port_tty_get as opposed to the uart handle_dcd_change implementation that simply get port-tty. As i don't know wich way you prefer... Patch 03 : this patch add the handling of dcd_change in the ftdi driver. Patch 04 : this patch add the callback to the line discipline dcd_change handler. Patch 05 : this patch is optional. While reading the code i've found that wake_up_interruptible was often called after status processing (ch341, 8250, ...). So i suggest to move this one. This patchset have been tested with a pl2303 device and ftdi device. These devices coupled to the usb serial stack introduce latencies. I think that the jitter may depend on devices, and I'm not even sure it is constant. But the PPS reporting works and allows to play with it. Thank for your comments. Cheers. Paul. Paul Chavent (5): USB : serial : remove tty arg of handle_dcd_change. USB : serial : get protected tty in handle_dcd_change. USB : serial : call handle_dcd_change in ftdi driver. USB : serial : invoke dcd_change ldisc's handler. USB : serial : pl2303 wake up after dcd status check. drivers/usb/serial/ch341.c| 7 ++- drivers/usb/serial/ftdi_sio.c | 5 - drivers/usb/serial/generic.c | 13 +++-- drivers/usb/serial/pl2303.c | 11 +++ include/linux/usb/serial.h| 1 - 5 files changed, 20 insertions(+), 17 deletions(-) -- 1.7.12.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
Re: [PATCH 4/5] USB : serial : invoke dcd_change ldisc's handler.
On Mon, Sep 09, 2013 at 06:01:19PM +0200, Paul Chavent wrote: In order to have the PPS line discipline to work with usb devices. Signed-off-by: Paul Chavent paul.chav...@onera.fr --- drivers/usb/serial/generic.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index 91f0592..a18a086 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c @@ -567,6 +567,13 @@ void usb_serial_handle_dcd_change(struct usb_serial_port *usb_port, { struct tty_port *port = usb_port-port; struct tty_struct *tty = tty_port_tty_get(port); + struct tty_ldisc *ld = tty ? tty_ldisc_ref(tty) : NULL; + + if (ld) { Minor nit, I hate the ? : mode of C, and as you are doing another if statement right after it, it's pretty redundant here. So can you just merge them together into one if chain? 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
[RFC 07/21] xhci: fix sparse warning in xhci-trace.h
This patch fixes the following sparse warnings: drivers/usb/host/./xhci-trace.h:116:1: warning: cast to restricted __le32 drivers/usb/host/./xhci-trace.h:116:1: warning: cast to restricted __le32 drivers/usb/host/./xhci-trace.h:116:1: warning: restricted __le32 degrades to integer drivers/usb/host/./xhci-trace.h:116:1: warning: restricted __le32 degrades to integer by converting the field 'trb' of the trace buffer entry structure from array with elements of type __le32 to an array with elements of type u8. Into the trb array are copied the contents of the TRB that generated the event. The trace-cmd tool with the help of plugin_xhci.py will use this field to parse the TRB contents in a human readable way. Signed-off-by: Xenia Ragiadakou burzalod...@gmail.com --- drivers/usb/host/xhci-trace.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci-trace.h b/drivers/usb/host/xhci-trace.h index 59a0b03..132abda 100644 --- a/drivers/usb/host/xhci-trace.h +++ b/drivers/usb/host/xhci-trace.h @@ -121,7 +121,7 @@ DECLARE_EVENT_CLASS(xhci_log_event, __field(u64, dma) __field(u32, status) __field(u32, flags) - __dynamic_array(__le32, trb, 4) + __dynamic_array(u8, trb, sizeof(struct xhci_generic_trb)) ), TP_fast_assign( __entry-va = trb_va; -- 1.8.3.4 -- 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
[RFC 03/21] xhci: fix incorrect type in assignment in xhci_address_device()
The field 'dev_info' in struct xhci_slot_ctx has type __le32 and it needs to be converted to CPU byteorder for the correct retrieval of its subfield 'Context Entries'. This field is used by the trace event 'xhci_address_ctx' to trace only the contexts of valid endpoints. This bug was found using sparse. Signed-off-by: Xenia Ragiadakou burzalod...@gmail.com --- drivers/usb/host/xhci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index bda0cdf..9f22ddf 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -3762,7 +3762,7 @@ int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev) xhci_dbg(xhci, Slot ID %d Input Context:\n, udev-slot_id); xhci_dbg_ctx(xhci, virt_dev-in_ctx, 2); trace_xhci_address_ctx(xhci, virt_dev-in_ctx, - slot_ctx-dev_info 27); + le32_to_cpu(slot_ctx-dev_info) 27); spin_lock_irqsave(xhci-lock, flags); cmd_trb = xhci-cmd_ring-dequeue; @@ -3841,7 +3841,7 @@ int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev) xhci_dbg(xhci, Slot ID %d Input Context:\n, udev-slot_id); xhci_dbg_ctx(xhci, virt_dev-in_ctx, 2); trace_xhci_address_ctx(xhci, virt_dev-in_ctx, - slot_ctx-dev_info 27); + le32_to_cpu(slot_ctx-dev_info) 27); xhci_dbg(xhci, Slot ID %d Output Context:\n, udev-slot_id); xhci_dbg_ctx(xhci, virt_dev-out_ctx, 2); /* @@ -3850,7 +3850,7 @@ int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev) */ slot_ctx = xhci_get_slot_ctx(xhci, virt_dev-out_ctx); trace_xhci_address_ctx(xhci, virt_dev-out_ctx, - slot_ctx-dev_info 27); + le32_to_cpu(slot_ctx-dev_info) 27); /* Use kernel assigned address for devices; store xHC assigned * address locally. */ virt_dev-address = (le32_to_cpu(slot_ctx-dev_state) DEV_ADDR_MASK) -- 1.8.3.4 -- 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
[RFC 15/21] xhci: replace xhci_writel() with writel() in xhci.c
Function xhci_writel() is used to write a 32bit value in xHC registers residing in MMIO address space. It takes as first argument a pointer to the xhci_hcd although it does not use it because internally it simply calls writel(). This creates an illusion that xhci_writel() is an xhci specific function that has to be called in a context where a pointer to xhci_hcd is available. This patch replaces calls to xhci_writel() with calls to writel() in xhci.c. This is done so that xhci_writel() can be removed completely and code can become more straight-forward. Signed-off-by: Xenia Ragiadakou burzalod...@gmail.com --- drivers/usb/host/xhci.c | 53 +++-- 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 6f47c2b..63ccb21 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -88,7 +88,7 @@ void xhci_quiesce(struct xhci_hcd *xhci) cmd = readl(xhci-op_regs-command); cmd = mask; - xhci_writel(xhci, cmd, xhci-op_regs-command); + writel(cmd, xhci-op_regs-command); } /* @@ -128,7 +128,7 @@ static int xhci_start(struct xhci_hcd *xhci) temp |= (CMD_RUN); xhci_dbg_trace(xhci, trace_xhci_dbg_init, // Turn on HC, cmd = 0x%x., temp); - xhci_writel(xhci, temp, xhci-op_regs-command); + writel(temp, xhci-op_regs-command); /* * Wait for the HCHalted Status bit to be 0 to indicate the host is @@ -167,7 +167,7 @@ int xhci_reset(struct xhci_hcd *xhci) xhci_dbg_trace(xhci, trace_xhci_dbg_init, // Reset the HC); command = readl(xhci-op_regs-command); command |= CMD_RESET; - xhci_writel(xhci, command, xhci-op_regs-command); + writel(command, xhci-op_regs-command); ret = xhci_handshake(xhci, xhci-op_regs-command, CMD_RESET, 0, 10 * 1000 * 1000); @@ -614,21 +614,20 @@ int xhci_run(struct usb_hcd *hcd) temp = readl(xhci-ir_set-irq_control); temp = ~ER_IRQ_INTERVAL_MASK; temp |= (u32) 160; - xhci_writel(xhci, temp, xhci-ir_set-irq_control); + writel(temp, xhci-ir_set-irq_control); /* Set the HCD state before we enable the irqs */ temp = readl(xhci-op_regs-command); temp |= (CMD_EIE); xhci_dbg_trace(xhci, trace_xhci_dbg_init, // Enable interrupts, cmd = 0x%x., temp); - xhci_writel(xhci, temp, xhci-op_regs-command); + writel(temp, xhci-op_regs-command); temp = readl(xhci-ir_set-irq_pending); xhci_dbg_trace(xhci, trace_xhci_dbg_init, // Enabling event ring interrupter %p by writing 0x%x to irq_pending, xhci-ir_set, (unsigned int) ER_IRQ_ENABLE(temp)); - xhci_writel(xhci, ER_IRQ_ENABLE(temp), - xhci-ir_set-irq_pending); + writel(ER_IRQ_ENABLE(temp), xhci-ir_set-irq_pending); xhci_print_ir_set(xhci, 0); if (xhci-quirks XHCI_NEC_HOST) @@ -699,10 +698,9 @@ void xhci_stop(struct usb_hcd *hcd) xhci_dbg_trace(xhci, trace_xhci_dbg_init, // Disabling event ring interrupts); temp = readl(xhci-op_regs-status); - xhci_writel(xhci, temp ~STS_EINT, xhci-op_regs-status); + writel(temp ~STS_EINT, xhci-op_regs-status); temp = readl(xhci-ir_set-irq_pending); - xhci_writel(xhci, ER_IRQ_DISABLE(temp), - xhci-ir_set-irq_pending); + writel(ER_IRQ_DISABLE(temp), xhci-ir_set-irq_pending); xhci_print_ir_set(xhci, 0); xhci_dbg_trace(xhci, trace_xhci_dbg_init, cleaning up memory); @@ -755,15 +753,15 @@ static void xhci_save_registers(struct xhci_hcd *xhci) static void xhci_restore_registers(struct xhci_hcd *xhci) { - xhci_writel(xhci, xhci-s3.command, xhci-op_regs-command); - xhci_writel(xhci, xhci-s3.dev_nt, xhci-op_regs-dev_notification); + writel(xhci-s3.command, xhci-op_regs-command); + writel(xhci-s3.dev_nt, xhci-op_regs-dev_notification); xhci_write_64(xhci, xhci-s3.dcbaa_ptr, xhci-op_regs-dcbaa_ptr); - xhci_writel(xhci, xhci-s3.config_reg, xhci-op_regs-config_reg); - xhci_writel(xhci, xhci-s3.erst_size, xhci-ir_set-erst_size); + writel(xhci-s3.config_reg, xhci-op_regs-config_reg); + writel(xhci-s3.erst_size, xhci-ir_set-erst_size); xhci_write_64(xhci, xhci-s3.erst_base, xhci-ir_set-erst_base); xhci_write_64(xhci, xhci-s3.erst_dequeue, xhci-ir_set-erst_dequeue); - xhci_writel(xhci, xhci-s3.irq_pending, xhci-ir_set-irq_pending); - xhci_writel(xhci, xhci-s3.irq_control, xhci-ir_set-irq_control); + writel(xhci-s3.irq_pending, xhci-ir_set-irq_pending); + writel(xhci-s3.irq_control, xhci-ir_set-irq_control); } static void xhci_set_cmd_ring_deq(struct xhci_hcd *xhci) @@ -860,7 +858,7 @@ int xhci_suspend(struct xhci_hcd *xhci)
[RFC 06/21] xhci: fix derivation of TRB's DMA address in xhci_log_event Trace Event Class
This patch fixes the retrieval of the DMA address of the TRB that generated the event by converting the field[0] (low address bits) and field[1] (high address bits) to CPU byteorder and then typecasting field[1] to u64 so that the bitshift will not lead to overflow. In the original code, the typecasting of le32 to u64 was incorrect and the subsequent conversion to le64 reverts the low and high address parts. This bug was found using sparse. Signed-off-by: Xenia Ragiadakou burzalod...@gmail.com --- drivers/usb/host/xhci-trace.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/host/xhci-trace.h b/drivers/usb/host/xhci-trace.h index c156685..59a0b03 100644 --- a/drivers/usb/host/xhci-trace.h +++ b/drivers/usb/host/xhci-trace.h @@ -125,8 +125,8 @@ DECLARE_EVENT_CLASS(xhci_log_event, ), TP_fast_assign( __entry-va = trb_va; - __entry-dma = le64_to_cpu(((u64)ev-field[1]) 32 | - ev-field[0]); + __entry-dma = ((u64)le32_to_cpu(ev-field[1])) 32 | + le32_to_cpu(ev-field[0]); __entry-status = le32_to_cpu(ev-field[2]); __entry-flags = le32_to_cpu(ev-field[3]); memcpy(__get_dynamic_array(trb), trb_va, -- 1.8.3.4 -- 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
[RFC 18/21] xhci: replace xhci_writel() with writel() in xhci-ring.c
Function xhci_writel() is used to write a 32bit value in xHC registers residing in MMIO address space. It takes as first argument a pointer to the xhci_hcd although it does not use it because internally it simply calls writel(). This creates an illusion that xhci_writel() is an xhci specific function that has to be called in a context where a pointer to xhci_hcd is available. This patch replaces calls to xhci_writel() with calls to writel() in xhci-ring.c. This is done so that xhci_writel() can be removed completely and code can become more straight-forward. Signed-off-by: Xenia Ragiadakou burzalod...@gmail.com --- drivers/usb/host/xhci-ring.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 5c36c5b..9b50a54 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -285,7 +285,7 @@ void xhci_ring_cmd_db(struct xhci_hcd *xhci) return; xhci_dbg(xhci, // Ding dong!\n); - xhci_writel(xhci, DB_VALUE_HOST, xhci-dba-doorbell[0]); + writel(DB_VALUE_HOST, xhci-dba-doorbell[0]); /* Flush PCI posted writes */ readl(xhci-dba-doorbell[0]); } @@ -417,7 +417,7 @@ void xhci_ring_ep_doorbell(struct xhci_hcd *xhci, if ((ep_state EP_HALT_PENDING) || (ep_state SET_DEQ_PENDING) || (ep_state EP_HALTED)) return; - xhci_writel(xhci, DB_VALUE(ep_index, stream_id), db_addr); + writel(DB_VALUE(ep_index, stream_id), db_addr); /* The CPU has better things to do at this point than wait for a * write-posting flush. It'll get there soon enough. */ @@ -2825,7 +2825,7 @@ hw_died: * Write 1 to clear the interrupt status. */ status |= STS_EINT; - xhci_writel(xhci, status, xhci-op_regs-status); + writel(status, xhci-op_regs-status); /* FIXME when MSI-X is supported and there are multiple vectors */ /* Clear the MSI-X event interrupt status */ @@ -2834,7 +2834,7 @@ hw_died: /* Acknowledge the PCI interrupt */ irq_pending = readl(xhci-ir_set-irq_pending); irq_pending |= IMAN_IP; - xhci_writel(xhci, irq_pending, xhci-ir_set-irq_pending); + writel(irq_pending, xhci-ir_set-irq_pending); } if (xhci-xhc_state XHCI_STATE_DYING) { -- 1.8.3.4 -- 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
[RFC 14/21] xhci: remove xhci_readl()
This patch removes xhci_readl() because it has been replaced with readl() and it is not used anymore. Signed-off-by: Xenia Ragiadakou burzalod...@gmail.com --- drivers/usb/host/xhci.h | 5 - 1 file changed, 5 deletions(-) diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 9575088..6349044 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -1586,11 +1586,6 @@ static inline struct usb_hcd *xhci_to_hcd(struct xhci_hcd *xhci) /* TODO: copied from ehci.h - can be refactored? */ /* xHCI spec says all registers are little endian */ -static inline unsigned int xhci_readl(const struct xhci_hcd *xhci, - __le32 __iomem *regs) -{ - return readl(regs); -} static inline void xhci_writel(struct xhci_hcd *xhci, const unsigned int val, __le32 __iomem *regs) { -- 1.8.3.4 -- 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
[RFC 04/21] xhci: convert TRB_CYCLE to le32 before using it to set Link TRB's cycle bit
This patch converts TRB_CYCLE to le32 to update correctly the Cycle Bit in 'control' field of the link TRB. This bug was found using sparse. Signed-off-by: Xenia Ragiadakou burzalod...@gmail.com --- drivers/usb/host/xhci-mem.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index f201990..37ae98f 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c @@ -57,7 +57,7 @@ static struct xhci_segment *xhci_segment_alloc(struct xhci_hcd *xhci, /* If the cycle state is 0, set the cycle bit to 1 for all the TRBs */ if (cycle_state == 0) { for (i = 0; i TRBS_PER_SEGMENT; i++) - seg-trbs[i].link.control |= TRB_CYCLE; + seg-trbs[i].link.control |= cpu_to_le32(TRB_CYCLE); } seg-dma = dma; seg-next = NULL; @@ -308,7 +308,8 @@ static void xhci_reinit_cached_ring(struct xhci_hcd *xhci, sizeof(union xhci_trb)*TRBS_PER_SEGMENT); if (cycle_state == 0) { for (i = 0; i TRBS_PER_SEGMENT; i++) - seg-trbs[i].link.control |= TRB_CYCLE; + seg-trbs[i].link.control |= + cpu_to_le32(TRB_CYCLE); } /* All endpoint rings have link TRBs */ xhci_link_segments(xhci, seg, seg-next, type); -- 1.8.3.4 -- 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
[RFC 16/21] xhci: replace xhci_writel() with writel() in xhci-hub.c
Function xhci_writel() is used to write a 32bit value in xHC registers residing in MMIO address space. It takes as first argument a pointer to the xhci_hcd although it does not use it because internally it simply calls writel(). This creates an illusion that xhci_writel() is an xhci specific function that has to be called in a context where a pointer to xhci_hcd is available. This patch replaces calls to xhci_writel() with calls to writel() in xhci-hub.c. This is done so that xhci_writel() can be removed completely and code can become more straight-forward. Signed-off-by: Xenia Ragiadakou burzalod...@gmail.com --- drivers/usb/host/xhci-hub.c | 39 ++- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index e1896ac..e31ea6a 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c @@ -342,7 +342,7 @@ static void xhci_disable_port(struct usb_hcd *hcd, struct xhci_hcd *xhci, } /* Write 1 to disable the port */ - xhci_writel(xhci, port_status | PORT_PE, addr); + writel(port_status | PORT_PE, addr); port_status = readl(addr); xhci_dbg(xhci, disable port, actual port %d status = 0x%x\n, wIndex, port_status); @@ -388,7 +388,7 @@ static void xhci_clear_port_change_bit(struct xhci_hcd *xhci, u16 wValue, return; } /* Change bits are all write 1 to clear */ - xhci_writel(xhci, port_status | status, addr); + writel(port_status | status, addr); port_status = readl(addr); xhci_dbg(xhci, clear port %s change, actual port %d status = 0x%x\n, port_change_bit, wIndex, port_status); @@ -419,7 +419,7 @@ void xhci_set_link_state(struct xhci_hcd *xhci, __le32 __iomem **port_array, temp = xhci_port_state_to_neutral(temp); temp = ~PORT_PLS_MASK; temp |= PORT_LINK_STROBE | link_state; - xhci_writel(xhci, temp, port_array[port_id]); + writel(temp, port_array[port_id]); } static void xhci_set_remote_wake_mask(struct xhci_hcd *xhci, @@ -445,7 +445,7 @@ static void xhci_set_remote_wake_mask(struct xhci_hcd *xhci, else temp = ~PORT_WKOC_E; - xhci_writel(xhci, temp, port_array[port_id]); + writel(temp, port_array[port_id]); } /* Test and clear port RWC bit */ @@ -458,7 +458,7 @@ void xhci_test_and_clear_bit(struct xhci_hcd *xhci, __le32 __iomem **port_array, if (temp port_bit) { temp = xhci_port_state_to_neutral(temp); temp |= port_bit; - xhci_writel(xhci, temp, port_array[port_id]); + writel(temp, port_array[port_id]); } } @@ -813,8 +813,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, temp |= PORT_CSC | PORT_PEC | PORT_WRC | PORT_OCC | PORT_RC | PORT_PLC | PORT_CEC; - xhci_writel(xhci, temp | PORT_PE, - port_array[wIndex]); + writel(temp | PORT_PE, port_array[wIndex]); temp = readl(port_array[wIndex]); break; } @@ -869,8 +868,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, * However, khubd will ignore the roothub events until * the roothub is registered. */ - xhci_writel(xhci, temp | PORT_POWER, - port_array[wIndex]); + writel(temp | PORT_POWER, port_array[wIndex]); temp = readl(port_array[wIndex]); xhci_dbg(xhci, set port power, actual port %d status = 0x%x\n, wIndex, temp); @@ -885,7 +883,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, break; case USB_PORT_FEAT_RESET: temp = (temp | PORT_RESET); - xhci_writel(xhci, temp, port_array[wIndex]); + writel(temp, port_array[wIndex]); temp = readl(port_array[wIndex]); xhci_dbg(xhci, set port reset, actual port %d status = 0x%x\n, wIndex, temp); @@ -900,7 +898,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, break; case USB_PORT_FEAT_BH_PORT_RESET: temp |= PORT_WR; - xhci_writel(xhci, temp, port_array[wIndex]); + writel(temp, port_array[wIndex]); temp = readl(port_array[wIndex]); break; @@ -910,7 +908,7 @@ int xhci_hub_control(struct usb_hcd
[RFC 11/21] xhci: replace xhci_readl() with readl() in xhci-hub.c
Function xhci_readl() is used to read 32bit xHC registers residing in MMIO address space. It takes as first argument a pointer to the xhci_hcd although it does not use it because internally it simply calls readl. This creates an illusion that xhci_readl() is an xhci specific function that has to be called in a context where a pointer to xhci_hcd is available. This patch replaces calls to xhci_readl() with calls to readl() in xhci-hub.c. This is done so that xhci_readl() can be removed completely and code can become more straightforward. Signed-off-by: Xenia Ragiadakou burzalod...@gmail.com --- drivers/usb/host/xhci-hub.c | 72 ++--- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index fae697e..e1896ac 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c @@ -94,7 +94,7 @@ static void xhci_usb2_hub_descriptor(struct usb_hcd *hcd, struct xhci_hcd *xhci, */ memset(port_removable, 0, sizeof(port_removable)); for (i = 0; i ports; i++) { - portsc = xhci_readl(xhci, xhci-usb2_ports[i]); + portsc = readl(xhci-usb2_ports[i]); /* If a device is removable, PORTSC reports a 0, same as in the * hub descriptor DeviceRemovable bits. */ @@ -148,7 +148,7 @@ static void xhci_usb3_hub_descriptor(struct usb_hcd *hcd, struct xhci_hcd *xhci, port_removable = 0; /* bit 0 is reserved, bit 1 is for port 1, etc. */ for (i = 0; i ports; i++) { - portsc = xhci_readl(xhci, xhci-usb3_ports[i]); + portsc = readl(xhci-usb3_ports[i]); if (portsc PORT_DEV_REMOVE) port_removable |= 1 (i + 1); } @@ -343,7 +343,7 @@ static void xhci_disable_port(struct usb_hcd *hcd, struct xhci_hcd *xhci, /* Write 1 to disable the port */ xhci_writel(xhci, port_status | PORT_PE, addr); - port_status = xhci_readl(xhci, addr); + port_status = readl(addr); xhci_dbg(xhci, disable port, actual port %d status = 0x%x\n, wIndex, port_status); } @@ -389,7 +389,7 @@ static void xhci_clear_port_change_bit(struct xhci_hcd *xhci, u16 wValue, } /* Change bits are all write 1 to clear */ xhci_writel(xhci, port_status | status, addr); - port_status = xhci_readl(xhci, addr); + port_status = readl(addr); xhci_dbg(xhci, clear port %s change, actual port %d status = 0x%x\n, port_change_bit, wIndex, port_status); } @@ -415,7 +415,7 @@ void xhci_set_link_state(struct xhci_hcd *xhci, __le32 __iomem **port_array, { u32 temp; - temp = xhci_readl(xhci, port_array[port_id]); + temp = readl(port_array[port_id]); temp = xhci_port_state_to_neutral(temp); temp = ~PORT_PLS_MASK; temp |= PORT_LINK_STROBE | link_state; @@ -427,7 +427,7 @@ static void xhci_set_remote_wake_mask(struct xhci_hcd *xhci, { u32 temp; - temp = xhci_readl(xhci, port_array[port_id]); + temp = readl(port_array[port_id]); temp = xhci_port_state_to_neutral(temp); if (wake_mask USB_PORT_FEAT_REMOTE_WAKE_CONNECT) @@ -454,7 +454,7 @@ void xhci_test_and_clear_bit(struct xhci_hcd *xhci, __le32 __iomem **port_array, { u32 temp; - temp = xhci_readl(xhci, port_array[port_id]); + temp = readl(port_array[port_id]); if (temp port_bit) { temp = xhci_port_state_to_neutral(temp); temp |= port_bit; @@ -707,12 +707,12 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, /* Set the U1 and U2 exit latencies. */ memcpy(buf, usb_bos_descriptor, USB_DT_BOS_SIZE + USB_DT_USB_SS_CAP_SIZE); - temp = xhci_readl(xhci, xhci-cap_regs-hcs_params3); + temp = readl(xhci-cap_regs-hcs_params3); buf[12] = HCS_U1_LATENCY(temp); put_unaligned_le16(HCS_U2_LATENCY(temp), buf[13]); /* Indicate whether the host has LTM support. */ - temp = xhci_readl(xhci, xhci-cap_regs-hcc_params); + temp = readl(xhci-cap_regs-hcc_params); if (HCC_LTC(temp)) buf[8] |= USB_LTM_SUPPORT; @@ -722,7 +722,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, if (!wIndex || wIndex max_ports) goto error; wIndex--; - temp = xhci_readl(xhci, port_array[wIndex]); + temp = readl(port_array[wIndex]); if (temp == 0x) { retval = -ENODEV; break; @@ -749,7 +749,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, if (!wIndex ||
[RFC 12/21] xhci: replace xhci_readl() with readl() in xhci-mem.c
Function xhci_readl() is used to read 32bit xHC registers residing in MMIO address space. It takes as first argument a pointer to the xhci_hcd although it does not use it because internally it simply calls readl. This creates an illusion that xhci_readl() is an xhci specific function that has to be called in a context where a pointer to xhci_hcd is available. This patch replaces calls to xhci_readl() with calls to readl() in xhci-mem.c. This is done so that xhci_readl() can be removed completely and code can become more straightforward. Signed-off-by: Xenia Ragiadakou burzalod...@gmail.com --- drivers/usb/host/xhci-mem.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index e1c4b79..af6576c 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c @@ -1996,7 +1996,7 @@ static void xhci_add_in_port(struct xhci_hcd *xhci, unsigned int num_ports, } /* Port offset and count in the third dword, see section 7.2 */ - temp = xhci_readl(xhci, addr + 2); + temp = readl(addr + 2); port_offset = XHCI_EXT_PORT_OFF(temp); port_count = XHCI_EXT_PORT_COUNT(temp); xhci_dbg_trace(xhci, trace_xhci_dbg_init, @@ -2079,7 +2079,7 @@ static int xhci_setup_port_arrays(struct xhci_hcd *xhci, gfp_t flags) int cap_count = 0; addr = xhci-cap_regs-hcc_params; - offset = XHCI_HCC_EXT_CAPS(xhci_readl(xhci, addr)); + offset = XHCI_HCC_EXT_CAPS(readl(addr)); if (offset == 0) { xhci_err(xhci, No Extended Capability registers, unable to set up roothub.\n); @@ -2116,7 +2116,7 @@ static int xhci_setup_port_arrays(struct xhci_hcd *xhci, gfp_t flags) /* count extended protocol capability entries for later caching */ do { u32 cap_id; - cap_id = xhci_readl(xhci, tmp_addr); + cap_id = readl(tmp_addr); if (XHCI_EXT_CAPS_ID(cap_id) == XHCI_EXT_CAPS_PROTOCOL) cap_count++; tmp_offset = XHCI_EXT_CAPS_NEXT(cap_id); @@ -2130,7 +2130,7 @@ static int xhci_setup_port_arrays(struct xhci_hcd *xhci, gfp_t flags) while (1) { u32 cap_id; - cap_id = xhci_readl(xhci, addr); + cap_id = readl(addr); if (XHCI_EXT_CAPS_ID(cap_id) == XHCI_EXT_CAPS_PROTOCOL) xhci_add_in_port(xhci, num_ports, addr, (u8) XHCI_EXT_PORT_MAJOR(cap_id), @@ -2235,7 +2235,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) INIT_LIST_HEAD(xhci-lpm_failed_devs); INIT_LIST_HEAD(xhci-cancel_cmd_list); - page_size = xhci_readl(xhci, xhci-op_regs-page_size); + page_size = readl(xhci-op_regs-page_size); xhci_dbg_trace(xhci, trace_xhci_dbg_init, Supported page size register = 0x%x, page_size); i = ffs(page_size 0x) - 1; @@ -2254,10 +2254,10 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) * Program the Number of Device Slots Enabled field in the CONFIG * register with the max value of slots the HC can handle. */ - val = HCS_MAX_SLOTS(xhci_readl(xhci, xhci-cap_regs-hcs_params1)); + val = HCS_MAX_SLOTS(readl(xhci-cap_regs-hcs_params1)); xhci_dbg_trace(xhci, trace_xhci_dbg_init, // xHC can handle at most %d device slots., val); - val2 = xhci_readl(xhci, xhci-op_regs-config_reg); + val2 = readl(xhci-op_regs-config_reg); val |= (val2 ~HCS_SLOTS_MASK); xhci_dbg_trace(xhci, trace_xhci_dbg_init, // Setting Max device slots reg = 0x%x., val); @@ -2338,7 +2338,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) */ xhci-cmd_ring_reserved_trbs++; - val = xhci_readl(xhci, xhci-cap_regs-db_off); + val = readl(xhci-cap_regs-db_off); val = DBOFF_MASK; xhci_dbg_trace(xhci, trace_xhci_dbg_init, // Doorbell array is located at offset 0x%x @@ -2389,7 +2389,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) } /* set ERST count with the number of entries in the segment table */ - val = xhci_readl(xhci, xhci-ir_set-erst_size); + val = readl(xhci-ir_set-erst_size); val = ERST_SIZE_MASK; val |= ERST_NUM_SEGS; xhci_dbg_trace(xhci, trace_xhci_dbg_init, @@ -2436,7 +2436,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) * is necessary for allowing USB 3.0 devices to do remote wakeup from * U3 (device suspend). */ - temp = xhci_readl(xhci, xhci-op_regs-dev_notification); + temp = readl(xhci-op_regs-dev_notification); temp = ~DEV_NOTE_MASK; temp |= DEV_NOTE_FWAKE; xhci_writel(xhci, temp,
Re: [PATCH 1/5] USB : serial : remove tty arg of handle_dcd_change.
On Mon, Sep 09, 2013 at 06:01:16PM +0200, Paul Chavent wrote: Do the same way as in serialcore.c for uart_handle_dcd_change. It removes duplicated code around the usb_serial_handle_dcd_change calls. Signed-off-by: Paul Chavent paul.chav...@onera.fr --- drivers/usb/serial/ch341.c | 7 ++- drivers/usb/serial/generic.c | 4 ++-- drivers/usb/serial/pl2303.c | 7 +-- include/linux/usb/serial.h | 1 - 4 files changed, 5 insertions(+), 14 deletions(-) diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c index c2a4171..51c3d3a 100644 --- a/drivers/usb/serial/ch341.c +++ b/drivers/usb/serial/ch341.c @@ -481,11 +481,8 @@ static void ch341_read_int_callback(struct urb *urb) spin_unlock_irqrestore(priv-lock, flags); if ((priv-line_status ^ prev_line_status) CH341_BIT_DCD) { - struct tty_struct *tty = tty_port_tty_get(port-port); - if (tty) - usb_serial_handle_dcd_change(port, tty, - priv-line_status CH341_BIT_DCD); - tty_kref_put(tty); + usb_serial_handle_dcd_change(port, + priv-line_status CH341_BIT_DCD); } wake_up_interruptible(port-port.delta_msr_wait); diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index 1f31e6b..33f1df1 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c @@ -560,13 +560,13 @@ EXPORT_SYMBOL_GPL(usb_serial_handle_break); /** * usb_serial_handle_dcd_change - handle a change of carrier detect state * @port: usb_serial_port structure for the open port - * @tty: tty_struct structure for the port * @status: new carrier detect status, nonzero if active */ void usb_serial_handle_dcd_change(struct usb_serial_port *usb_port, - struct tty_struct *tty, unsigned int status) + unsigned int status) { struct tty_port *port = usb_port-port; + struct tty_struct *tty = port-tty; No, this is not right. There's a reason tty_port_tty_get was used. You cannot simply remove it (even if your next patch adds it back, but without the NULL check). I'm actually preparing a series of changes to the MSR handling and considered doing something like this, but came to the conclusion that keeping the current interface was preferred (e.g. the same reference could be used to add handle CTS changes as well). I'm refactoring at a different level instead. I suggest keeping the current interface for a while still, and that you add the tty_port_tty_get to your ftdi patch instead. 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
[RFC 01/21] xhci: fix incorrect type in assignment in xhci_count_num_new_endpoints()
The fields 'add_flags' and 'drop_flags' in struct xhci_input_control_ctx have type __le32 and need to be converted to CPU byteorder before being used to derive the number of added endpoints. This bug was found using sparse. Signed-off-by: Xenia Ragiadakou burzalod...@gmail.com --- drivers/usb/host/xhci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 787076e..617d568 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -1880,8 +1880,8 @@ static u32 xhci_count_num_new_endpoints(struct xhci_hcd *xhci, * (bit 1). The default control endpoint is added during the Address * Device command and is never removed until the slot is disabled. */ - valid_add_flags = ctrl_ctx-add_flags 2; - valid_drop_flags = ctrl_ctx-drop_flags 2; + valid_add_flags = le32_to_cpu(ctrl_ctx-add_flags) 2; + valid_drop_flags = le32_to_cpu(ctrl_ctx-drop_flags) 2; /* Use hweight32 to count the number of ones in the add flags, or * number of endpoints added. Don't count endpoints that are changed -- 1.8.3.4 -- 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
[RFC 08/21] xhci: use ffs() for page size's calculation in xhci_mem_init()
The first 16 bits of Page Size Register report the page size supported by xHC. If bit i is set, then xHC supports a page size of 2^(i+12). This patch replaces the code that does the lookup for the first set bit with a call to ffs() because using ffs() the code can benefit from architecture specific instructions that implement this computation more efficiently. Signed-off-by: Xenia Ragiadakou burzalod...@gmail.com --- drivers/usb/host/xhci-mem.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index 37ae98f..e1c4b79 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c @@ -25,6 +25,7 @@ #include linux/slab.h #include linux/dmapool.h #include linux/dma-mapping.h +#include linux/bitops.h #include xhci.h #include xhci-trace.h @@ -2237,12 +2238,8 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) page_size = xhci_readl(xhci, xhci-op_regs-page_size); xhci_dbg_trace(xhci, trace_xhci_dbg_init, Supported page size register = 0x%x, page_size); - for (i = 0; i 16; i++) { - if ((0x1 page_size) != 0) - break; - page_size = page_size 1; - } - if (i 16) + i = ffs(page_size 0x) - 1; + if (i -1) xhci_dbg_trace(xhci, trace_xhci_dbg_init, Supported page size of %iK, (1 (i+12)) / 1024); else -- 1.8.3.4 -- 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/5] USB : serial : remove tty arg of handle_dcd_change.
On Mon, Sep 09, 2013 at 07:45:23PM +0200, Johan Hovold wrote: On Mon, Sep 09, 2013 at 06:01:16PM +0200, Paul Chavent wrote: Do the same way as in serialcore.c for uart_handle_dcd_change. It removes duplicated code around the usb_serial_handle_dcd_change calls. Signed-off-by: Paul Chavent paul.chav...@onera.fr --- drivers/usb/serial/ch341.c | 7 ++- drivers/usb/serial/generic.c | 4 ++-- drivers/usb/serial/pl2303.c | 7 +-- include/linux/usb/serial.h | 1 - 4 files changed, 5 insertions(+), 14 deletions(-) diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c index c2a4171..51c3d3a 100644 --- a/drivers/usb/serial/ch341.c +++ b/drivers/usb/serial/ch341.c @@ -481,11 +481,8 @@ static void ch341_read_int_callback(struct urb *urb) spin_unlock_irqrestore(priv-lock, flags); if ((priv-line_status ^ prev_line_status) CH341_BIT_DCD) { - struct tty_struct *tty = tty_port_tty_get(port-port); - if (tty) - usb_serial_handle_dcd_change(port, tty, - priv-line_status CH341_BIT_DCD); - tty_kref_put(tty); + usb_serial_handle_dcd_change(port, + priv-line_status CH341_BIT_DCD); } wake_up_interruptible(port-port.delta_msr_wait); diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index 1f31e6b..33f1df1 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c @@ -560,13 +560,13 @@ EXPORT_SYMBOL_GPL(usb_serial_handle_break); /** * usb_serial_handle_dcd_change - handle a change of carrier detect state * @port: usb_serial_port structure for the open port - * @tty: tty_struct structure for the port * @status: new carrier detect status, nonzero if active */ void usb_serial_handle_dcd_change(struct usb_serial_port *usb_port, - struct tty_struct *tty, unsigned int status) + unsigned int status) { struct tty_port *port = usb_port-port; + struct tty_struct *tty = port-tty; No, this is not right. There's a reason tty_port_tty_get was used. You cannot simply remove it (even if your next patch adds it back, but without the NULL check). My bad, the NULL check was already there. But this still would have to be done as one patch, although I prefer keeping the current interface for now. 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
[RFC 10/21] xhci: replace xhci_readl() with readl() in xhci-dbg.c
Function xhci_readl() is used to read 32bit xHC registers residing in MMIO address space. It takes as first argument a pointer to the xhci_hcd although it does not use it because internally it simply calls readl. This creates an illusion that xhci_readl() is an xhci specific function that has to be called in a context where a pointer to xhci_hcd is available. This patch replaces calls to xhci_readl() with calls to readl() in xhci-dbg.c. This is done so that xhci_readl() can be removed completely and code can become more straight-forward. Signed-off-by: Xenia Ragiadakou burzalod...@gmail.com --- drivers/usb/host/xhci-dbg.c | 36 ++-- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/usb/host/xhci-dbg.c b/drivers/usb/host/xhci-dbg.c index 73503a8..eb009a4 100644 --- a/drivers/usb/host/xhci-dbg.c +++ b/drivers/usb/host/xhci-dbg.c @@ -32,7 +32,7 @@ void xhci_dbg_regs(struct xhci_hcd *xhci) xhci_dbg(xhci, // xHCI capability registers at %p:\n, xhci-cap_regs); - temp = xhci_readl(xhci, xhci-cap_regs-hc_capbase); + temp = readl(xhci-cap_regs-hc_capbase); xhci_dbg(xhci, // @%p = 0x%x (CAPLENGTH AND HCIVERSION)\n, xhci-cap_regs-hc_capbase, temp); xhci_dbg(xhci, // CAPLENGTH: 0x%x\n, @@ -44,13 +44,13 @@ void xhci_dbg_regs(struct xhci_hcd *xhci) xhci_dbg(xhci, // xHCI operational registers at %p:\n, xhci-op_regs); - temp = xhci_readl(xhci, xhci-cap_regs-run_regs_off); + temp = readl(xhci-cap_regs-run_regs_off); xhci_dbg(xhci, // @%p = 0x%x RTSOFF\n, xhci-cap_regs-run_regs_off, (unsigned int) temp RTSOFF_MASK); xhci_dbg(xhci, // xHCI runtime registers at %p:\n, xhci-run_regs); - temp = xhci_readl(xhci, xhci-cap_regs-db_off); + temp = readl(xhci-cap_regs-db_off); xhci_dbg(xhci, // @%p = 0x%x DBOFF\n, xhci-cap_regs-db_off, temp); xhci_dbg(xhci, // Doorbell array at %p:\n, xhci-dba); } @@ -61,7 +61,7 @@ static void xhci_print_cap_regs(struct xhci_hcd *xhci) xhci_dbg(xhci, xHCI capability registers at %p:\n, xhci-cap_regs); - temp = xhci_readl(xhci, xhci-cap_regs-hc_capbase); + temp = readl(xhci-cap_regs-hc_capbase); xhci_dbg(xhci, CAPLENGTH AND HCIVERSION 0x%x:\n, (unsigned int) temp); xhci_dbg(xhci, CAPLENGTH: 0x%x\n, @@ -69,7 +69,7 @@ static void xhci_print_cap_regs(struct xhci_hcd *xhci) xhci_dbg(xhci, HCIVERSION: 0x%x\n, (unsigned int) HC_VERSION(temp)); - temp = xhci_readl(xhci, xhci-cap_regs-hcs_params1); + temp = readl(xhci-cap_regs-hcs_params1); xhci_dbg(xhci, HCSPARAMS 1: 0x%x\n, (unsigned int) temp); xhci_dbg(xhci, Max device slots: %u\n, @@ -79,7 +79,7 @@ static void xhci_print_cap_regs(struct xhci_hcd *xhci) xhci_dbg(xhci, Max ports: %u\n, (unsigned int) HCS_MAX_PORTS(temp)); - temp = xhci_readl(xhci, xhci-cap_regs-hcs_params2); + temp = readl(xhci-cap_regs-hcs_params2); xhci_dbg(xhci, HCSPARAMS 2: 0x%x\n, (unsigned int) temp); xhci_dbg(xhci, Isoc scheduling threshold: %u\n, @@ -87,7 +87,7 @@ static void xhci_print_cap_regs(struct xhci_hcd *xhci) xhci_dbg(xhci, Maximum allowed segments in event ring: %u\n, (unsigned int) HCS_ERST_MAX(temp)); - temp = xhci_readl(xhci, xhci-cap_regs-hcs_params3); + temp = readl(xhci-cap_regs-hcs_params3); xhci_dbg(xhci, HCSPARAMS 3 0x%x:\n, (unsigned int) temp); xhci_dbg(xhci, Worst case U1 device exit latency: %u\n, @@ -95,14 +95,14 @@ static void xhci_print_cap_regs(struct xhci_hcd *xhci) xhci_dbg(xhci, Worst case U2 device exit latency: %u\n, (unsigned int) HCS_U2_LATENCY(temp)); - temp = xhci_readl(xhci, xhci-cap_regs-hcc_params); + temp = readl(xhci-cap_regs-hcc_params); xhci_dbg(xhci, HCC PARAMS 0x%x:\n, (unsigned int) temp); xhci_dbg(xhci, HC generates %s bit addresses\n, HCC_64BIT_ADDR(temp) ? 64 : 32); /* FIXME */ xhci_dbg(xhci, FIXME: more HCCPARAMS debugging\n); - temp = xhci_readl(xhci, xhci-cap_regs-run_regs_off); + temp = readl(xhci-cap_regs-run_regs_off); xhci_dbg(xhci, RTSOFF 0x%x:\n, temp RTSOFF_MASK); } @@ -110,7 +110,7 @@ static void xhci_print_command_reg(struct xhci_hcd *xhci) { u32 temp; - temp = xhci_readl(xhci, xhci-op_regs-command); + temp = readl(xhci-op_regs-command); xhci_dbg(xhci, USBCMD 0x%x:\n, temp); xhci_dbg(xhci, HC is %s\n, (temp CMD_RUN) ? running : being stopped); @@ -128,7 +128,7 @@ static void xhci_print_status(struct xhci_hcd *xhci) { u32 temp; -
[RFC 09/21] xhci: replace xhci_readl() with readl() in xhci.c
Function xhci_readl() is used to read 32bit xHC registers residing in MMIO address space. It takes as first argument a pointer to the xhci_hcd although it does not use it because internally it simply calls readl. This creates an illusion that xhci_readl() is an xhci specific function that has to be called in a context where a pointer to xhci_hcd is available. This patch replaces calls to xhci_readl() with calls to readl() in xhci.c. This is done so that xhci_readl() can be removed completely and code can become more straightforward. Signed-off-by: Xenia Ragiadakou burzalod...@gmail.com --- drivers/usb/host/xhci.c | 92 - 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 9f22ddf..6f47c2b 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -60,7 +60,7 @@ int xhci_handshake(struct xhci_hcd *xhci, void __iomem *ptr, u32 result; do { - result = xhci_readl(xhci, ptr); + result = readl(ptr); if (result == ~(u32)0) /* card removed */ return -ENODEV; result = mask; @@ -82,11 +82,11 @@ void xhci_quiesce(struct xhci_hcd *xhci) u32 mask; mask = ~(XHCI_IRQS); - halted = xhci_readl(xhci, xhci-op_regs-status) STS_HALT; + halted = readl(xhci-op_regs-status) STS_HALT; if (!halted) mask = ~CMD_RUN; - cmd = xhci_readl(xhci, xhci-op_regs-command); + cmd = readl(xhci-op_regs-command); cmd = mask; xhci_writel(xhci, cmd, xhci-op_regs-command); } @@ -124,7 +124,7 @@ static int xhci_start(struct xhci_hcd *xhci) u32 temp; int ret; - temp = xhci_readl(xhci, xhci-op_regs-command); + temp = readl(xhci-op_regs-command); temp |= (CMD_RUN); xhci_dbg_trace(xhci, trace_xhci_dbg_init, // Turn on HC, cmd = 0x%x., temp); @@ -158,14 +158,14 @@ int xhci_reset(struct xhci_hcd *xhci) u32 state; int ret, i; - state = xhci_readl(xhci, xhci-op_regs-status); + state = readl(xhci-op_regs-status); if ((state STS_HALT) == 0) { xhci_warn(xhci, Host controller not halted, aborting reset.\n); return 0; } xhci_dbg_trace(xhci, trace_xhci_dbg_init, // Reset the HC); - command = xhci_readl(xhci, xhci-op_regs-command); + command = readl(xhci-op_regs-command); command |= CMD_RESET; xhci_writel(xhci, command, xhci-op_regs-command); @@ -422,7 +422,7 @@ static void compliance_mode_recovery(unsigned long arg) xhci = (struct xhci_hcd *)arg; for (i = 0; i xhci-num_usb3_ports; i++) { - temp = xhci_readl(xhci, xhci-usb3_ports[i]); + temp = readl(xhci-usb3_ports[i]); if ((temp PORT_PLS_MASK) == USB_SS_PORT_LS_COMP_MOD) { /* * Compliance Mode Detected. Letting USB Core @@ -611,19 +611,19 @@ int xhci_run(struct usb_hcd *hcd) xhci_dbg_trace(xhci, trace_xhci_dbg_init, // Set the interrupt modulation register); - temp = xhci_readl(xhci, xhci-ir_set-irq_control); + temp = readl(xhci-ir_set-irq_control); temp = ~ER_IRQ_INTERVAL_MASK; temp |= (u32) 160; xhci_writel(xhci, temp, xhci-ir_set-irq_control); /* Set the HCD state before we enable the irqs */ - temp = xhci_readl(xhci, xhci-op_regs-command); + temp = readl(xhci-op_regs-command); temp |= (CMD_EIE); xhci_dbg_trace(xhci, trace_xhci_dbg_init, // Enable interrupts, cmd = 0x%x., temp); xhci_writel(xhci, temp, xhci-op_regs-command); - temp = xhci_readl(xhci, xhci-ir_set-irq_pending); + temp = readl(xhci-ir_set-irq_pending); xhci_dbg_trace(xhci, trace_xhci_dbg_init, // Enabling event ring interrupter %p by writing 0x%x to irq_pending, xhci-ir_set, (unsigned int) ER_IRQ_ENABLE(temp)); @@ -698,9 +698,9 @@ void xhci_stop(struct usb_hcd *hcd) xhci_dbg_trace(xhci, trace_xhci_dbg_init, // Disabling event ring interrupts); - temp = xhci_readl(xhci, xhci-op_regs-status); + temp = readl(xhci-op_regs-status); xhci_writel(xhci, temp ~STS_EINT, xhci-op_regs-status); - temp = xhci_readl(xhci, xhci-ir_set-irq_pending); + temp = readl(xhci-ir_set-irq_pending); xhci_writel(xhci, ER_IRQ_DISABLE(temp), xhci-ir_set-irq_pending); xhci_print_ir_set(xhci, 0); @@ -709,7 +709,7 @@ void xhci_stop(struct usb_hcd *hcd) xhci_mem_cleanup(xhci); xhci_dbg_trace(xhci, trace_xhci_dbg_init, xhci_stop completed - status = %x, - xhci_readl(xhci,
[RFC 17/21] xhci: replace xhci_writel() with writel() in xhci-mem.c
Function xhci_writel() is used to write a 32bit value in xHC registers residing in MMIO address space. It takes as first argument a pointer to the xhci_hcd although it does not use it because internally it simply calls writel(). This creates an illusion that xhci_writel() is an xhci specific function that has to be called in a context where a pointer to xhci_hcd is available. This patch replaces calls to xhci_writel() with calls to writel() in xhci-mem.c. This is done so that xhci_writel() can be removed completely and code can become more straight-forward. Signed-off-by: Xenia Ragiadakou burzalod...@gmail.com --- drivers/usb/host/xhci-mem.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index af6576c..f9873fa 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c @@ -2261,7 +2261,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) val |= (val2 ~HCS_SLOTS_MASK); xhci_dbg_trace(xhci, trace_xhci_dbg_init, // Setting Max device slots reg = 0x%x., val); - xhci_writel(xhci, val, xhci-op_regs-config_reg); + writel(val, xhci-op_regs-config_reg); /* * Section 5.4.8 - doorbell array must be @@ -2395,7 +2395,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) xhci_dbg_trace(xhci, trace_xhci_dbg_init, // Write ERST size = %i to ir_set 0 (some bits preserved), val); - xhci_writel(xhci, val, xhci-ir_set-erst_size); + writel(val, xhci-ir_set-erst_size); xhci_dbg_trace(xhci, trace_xhci_dbg_init, // Set ERST entries to point to event ring.); @@ -2439,7 +2439,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) temp = readl(xhci-op_regs-dev_notification); temp = ~DEV_NOTE_MASK; temp |= DEV_NOTE_FWAKE; - xhci_writel(xhci, temp, xhci-op_regs-dev_notification); + writel(temp, xhci-op_regs-dev_notification); return 0; -- 1.8.3.4 -- 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
[RFC 13/21] xhci: replace xhci_readl() with readl() in xhci-ring.c
Function xhci_readl() is used to read 32bit xHC registers residing in MMIO address space. It takes as first argument a pointer to the xhci_hcd although it does not use it because internally it simply calls readl. This creates an illusion that xhci_readl() is an xhci specific function that has to be called in a context where a pointer to xhci_hcd is available. This patch replaces calls to xhci_readl() with calls to readl() in xhci-ring.c. This is done so that xhci_readl() can be removed completely and code can become more straight-forward. Signed-off-by: Xenia Ragiadakou burzalod...@gmail.com --- drivers/usb/host/xhci-ring.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index faff6fc..5c36c5b 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -287,7 +287,7 @@ void xhci_ring_cmd_db(struct xhci_hcd *xhci) xhci_dbg(xhci, // Ding dong!\n); xhci_writel(xhci, DB_VALUE_HOST, xhci-dba-doorbell[0]); /* Flush PCI posted writes */ - xhci_readl(xhci, xhci-dba-doorbell[0]); + readl(xhci-dba-doorbell[0]); } static int xhci_abort_cmd_ring(struct xhci_hcd *xhci) @@ -1718,7 +1718,7 @@ static void handle_port_status(struct xhci_hcd *xhci, faked_port_index = find_faked_portnum_from_hw_portnum(hcd, xhci, port_id); - temp = xhci_readl(xhci, port_array[faked_port_index]); + temp = readl(port_array[faked_port_index]); if (hcd-state == HC_STATE_SUSPENDED) { xhci_dbg(xhci, resume root hub\n); usb_hcd_resume_root_hub(hcd); @@ -1727,7 +1727,7 @@ static void handle_port_status(struct xhci_hcd *xhci, if ((temp PORT_PLC) (temp PORT_PLS_MASK) == XDEV_RESUME) { xhci_dbg(xhci, port resume event for port %d\n, port_id); - temp1 = xhci_readl(xhci, xhci-op_regs-command); + temp1 = readl(xhci-op_regs-command); if (!(temp1 CMD_RUN)) { xhci_warn(xhci, xHC is not running.\n); goto cleanup; @@ -2803,7 +2803,7 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd) spin_lock(xhci-lock); /* Check if the xHC generated the interrupt, or the irq is shared */ - status = xhci_readl(xhci, xhci-op_regs-status); + status = readl(xhci-op_regs-status); if (status == 0x) goto hw_died; @@ -2832,7 +2832,7 @@ hw_died: if (hcd-irq) { u32 irq_pending; /* Acknowledge the PCI interrupt */ - irq_pending = xhci_readl(xhci, xhci-ir_set-irq_pending); + irq_pending = readl(xhci-ir_set-irq_pending); irq_pending |= IMAN_IP; xhci_writel(xhci, irq_pending, xhci-ir_set-irq_pending); } @@ -3907,7 +3907,7 @@ int xhci_queue_isoc_tx_prepare(struct xhci_hcd *xhci, gfp_t mem_flags, if (ret) return ret; - start_frame = xhci_readl(xhci, xhci-run_regs-microframe_index); + start_frame = readl(xhci-run_regs-microframe_index); start_frame = 0x3fff; urb-start_frame = start_frame; -- 1.8.3.4 -- 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
[RFC 05/21] xhci: fix incorrect type in assignment in handle_device_notification()
This patch converts Event TRB's 3rd field, which has type le32, to CPU byteorder before using it to retrieve the Slot ID with TRB_TO_SLOT_ID macro. This bug was found using sparse. Signed-off-by: Xenia Ragiadakou burzalod...@gmail.com --- drivers/usb/host/xhci-ring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index af9bbac..faff6fc 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -1634,7 +1634,7 @@ static void handle_device_notification(struct xhci_hcd *xhci, u32 slot_id; struct usb_device *udev; - slot_id = TRB_TO_SLOT_ID(event-generic.field[3]); + slot_id = TRB_TO_SLOT_ID(le32_to_cpu(event-generic.field[3])); if (!xhci-devs[slot_id]) { xhci_warn(xhci, Device Notification event for unused slot %u\n, slot_id); -- 1.8.3.4 -- 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
[RFC 02/21] xhci: fix incorrect type in assignment in xhci_count_num_dropped_endpoints()
The fields 'add_flags' and 'drop_flags' in struct xhci_input_control_ctx have type __le32 and need to be converted to CPU byteorder before being used to derive the number of dropped endpoints. This bug was found using sparse. Signed-off-by: Xenia Ragiadakou burzalod...@gmail.com --- drivers/usb/host/xhci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 617d568..bda0cdf 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -1897,8 +1897,8 @@ static unsigned int xhci_count_num_dropped_endpoints(struct xhci_hcd *xhci, u32 valid_add_flags; u32 valid_drop_flags; - valid_add_flags = ctrl_ctx-add_flags 2; - valid_drop_flags = ctrl_ctx-drop_flags 2; + valid_add_flags = le32_to_cpu(ctrl_ctx-add_flags) 2; + valid_drop_flags = le32_to_cpu(ctrl_ctx-drop_flags) 2; return hweight32(valid_drop_flags) - hweight32(valid_add_flags valid_drop_flags); -- 1.8.3.4 -- 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/5] USB : serial : get protected tty in handle_dcd_change.
Hello. On 09/09/2013 08:01 PM, Paul Chavent wrote: This patch depends on 72df17e... (PATCH 1). You don't need to say that when you publish the patches as a series. It's assumed. It restores the retreiving of a protected instance of tty. As opposed to the serialcore.c dcd_change implementation, the callers of dcd_change used to get protected tty instance. Signed-off-by: Paul Chavent paul.chav...@onera.fr 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
[RFC 19/21] xhci: remove xhci_writel()
This patch removes xhci_writel() since its calls has been replaced with writel() and it is not used anymore. Signed-off-by: Xenia Ragiadakou burzalod...@gmail.com --- drivers/usb/host/xhci.h | 8 1 file changed, 8 deletions(-) diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 6349044..2a2ab62 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -1584,14 +1584,6 @@ static inline struct usb_hcd *xhci_to_hcd(struct xhci_hcd *xhci) #define xhci_warn_ratelimited(xhci, fmt, args...) \ dev_warn_ratelimited(xhci_to_hcd(xhci)-self.controller , fmt , ## args) -/* TODO: copied from ehci.h - can be refactored? */ -/* xHCI spec says all registers are little endian */ -static inline void xhci_writel(struct xhci_hcd *xhci, - const unsigned int val, __le32 __iomem *regs) -{ - writel(val, regs); -} - /* * Registers should always be accessed with double word or quad word accesses. * -- 1.8.3.4 -- 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
[RFC 21/21] xhci: replace xhci_write_64() with writeq() and remove xhci_write_64()
Function xhci_write_64() is used to write an 64bit value in xHC registers, residing in MMIO. On 32bit systems, xHC registers should be read/written with 32bit accesses by reading/writing the low 32bits first and then the high 32bits second. Since asm-generic/io-64-nonatomic-lo-hi.h header file was included in xhci.h with the previous patch, if the system is not 64bit, writeq() will write 64bit registers in low-high order. This patch replaces all calls to xhci_write_64() with calls to writeq() and removes xhci_write_64(). This is done to reduce code duplication since 64bit register write operation is already implemented. Signed-off-by: Xenia Ragiadakou burzalod...@gmail.com --- drivers/usb/host/xhci-mem.c | 8 drivers/usb/host/xhci-ring.c | 8 +++- drivers/usb/host/xhci.c | 8 drivers/usb/host/xhci.h | 30 ++ 4 files changed, 21 insertions(+), 33 deletions(-) diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index dae8a39..54faa1f 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c @@ -1977,7 +1977,7 @@ static void xhci_set_hc_event_deq(struct xhci_hcd *xhci) xhci_dbg_trace(xhci, trace_xhci_dbg_init, // Write event ring dequeue pointer, preserving EHB bit); - xhci_write_64(xhci, ((u64) deq (u64) ~ERST_PTR_MASK) | temp, + writeq(((u64) deq (u64) ~ERST_PTR_MASK) | temp, xhci-ir_set-erst_dequeue); } @@ -2276,7 +2276,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) xhci_dbg_trace(xhci, trace_xhci_dbg_init, // Device context base array address = 0x%llx (DMA), %p (virt), (unsigned long long)xhci-dcbaa-dma, xhci-dcbaa); - xhci_write_64(xhci, dma, xhci-op_regs-dcbaa_ptr); + writeq(dma, xhci-op_regs-dcbaa_ptr); /* * Initialize the ring segment pool. The ring must be a contiguous @@ -2325,7 +2325,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) xhci-cmd_ring-cycle_state; xhci_dbg_trace(xhci, trace_xhci_dbg_init, // Setting command ring address to 0x%x, val); - xhci_write_64(xhci, val_64, xhci-op_regs-cmd_ring); + writeq(val_64, xhci-op_regs-cmd_ring); xhci_dbg_cmd_ptrs(xhci); xhci-lpm_command = xhci_alloc_command(xhci, true, true, flags); @@ -2406,7 +2406,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) val_64 = readq(xhci-ir_set-erst_base); val_64 = ERST_PTR_MASK; val_64 |= (xhci-erst.erst_dma_addr (u64) ~ERST_PTR_MASK); - xhci_write_64(xhci, val_64, xhci-ir_set-erst_base); + writeq(val_64, xhci-ir_set-erst_base); /* Set the event ring dequeue address */ xhci_set_hc_event_deq(xhci); diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 5192170..7e26c0e 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -309,8 +309,7 @@ static int xhci_abort_cmd_ring(struct xhci_hcd *xhci) return 0; } xhci-cmd_ring_state = CMD_RING_STATE_ABORTED; - xhci_write_64(xhci, temp_64 | CMD_RING_ABORT, - xhci-op_regs-cmd_ring); + writeq(temp_64 | CMD_RING_ABORT, xhci-op_regs-cmd_ring); /* Section 4.6.1.2 of xHCI 1.0 spec says software should * time the completion od all xHCI commands, including @@ -2844,8 +2843,7 @@ hw_died: * the event ring should be empty. */ temp_64 = readq(xhci-ir_set-erst_dequeue); - xhci_write_64(xhci, temp_64 | ERST_EHB, - xhci-ir_set-erst_dequeue); + writeq(temp_64 | ERST_EHB, xhci-ir_set-erst_dequeue); spin_unlock(xhci-lock); return IRQ_HANDLED; @@ -2872,7 +2870,7 @@ hw_died: /* Clear the event handler busy flag (RW1C); event ring is empty. */ temp_64 |= ERST_EHB; - xhci_write_64(xhci, temp_64, xhci-ir_set-erst_dequeue); + writeq(temp_64, xhci-ir_set-erst_dequeue); spin_unlock(xhci-lock); diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index c56cf1f..af08443 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -755,11 +755,11 @@ static void xhci_restore_registers(struct xhci_hcd *xhci) { writel(xhci-s3.command, xhci-op_regs-command); writel(xhci-s3.dev_nt, xhci-op_regs-dev_notification); - xhci_write_64(xhci, xhci-s3.dcbaa_ptr, xhci-op_regs-dcbaa_ptr); + writeq(xhci-s3.dcbaa_ptr, xhci-op_regs-dcbaa_ptr); writel(xhci-s3.config_reg, xhci-op_regs-config_reg); writel(xhci-s3.erst_size, xhci-ir_set-erst_size); - xhci_write_64(xhci, xhci-s3.erst_base, xhci-ir_set-erst_base); - xhci_write_64(xhci, xhci-s3.erst_dequeue, xhci-ir_set-erst_dequeue); +
[RFC 20/21] xhci: replace xhci_read_64() with readq() and remove xhci_read_64()
Function xhci_read_64() is used to read 64bit xHC registers residing in MMIO. On 32bit systems, registers should be read/written with 32bit accesses by reading/writing the low 32bits first and then the high 32bits second. This patch adds asm-generic/io-64-nonatomic-lo-hi.h header file in xhci.h so that if the system is not 64bit, readq() will read registers in low-high order. Also, it replaces all calls to xhci_read_64() with calls to readq() and removes xhci_read_64(). This is done to reduce code duplication since 64bit register read operation is already implemented. Signed-off-by: Xenia Ragiadakou burzalod...@gmail.com --- drivers/usb/host/xhci-dbg.c | 6 +++--- drivers/usb/host/xhci-mem.c | 6 +++--- drivers/usb/host/xhci-ring.c | 6 +++--- drivers/usb/host/xhci.c | 12 ++-- drivers/usb/host/xhci.h | 9 + 5 files changed, 16 insertions(+), 23 deletions(-) diff --git a/drivers/usb/host/xhci-dbg.c b/drivers/usb/host/xhci-dbg.c index eb009a4..b016d38 100644 --- a/drivers/usb/host/xhci-dbg.c +++ b/drivers/usb/host/xhci-dbg.c @@ -203,12 +203,12 @@ void xhci_print_ir_set(struct xhci_hcd *xhci, int set_num) addr, (unsigned int)temp); addr = ir_set-erst_base; - temp_64 = xhci_read_64(xhci, addr); + temp_64 = readq(addr); xhci_dbg(xhci, %p: ir_set.erst_base = @%08llx\n, addr, temp_64); addr = ir_set-erst_dequeue; - temp_64 = xhci_read_64(xhci, addr); + temp_64 = readq(addr); xhci_dbg(xhci, %p: ir_set.erst_dequeue = @%08llx\n, addr, temp_64); } @@ -412,7 +412,7 @@ void xhci_dbg_cmd_ptrs(struct xhci_hcd *xhci) { u64 val; - val = xhci_read_64(xhci, xhci-op_regs-cmd_ring); + val = readq(xhci-op_regs-cmd_ring); xhci_dbg(xhci, // xHC command ring deq ptr low bits + flags = @%08x\n, lower_32_bits(val)); xhci_dbg(xhci, // xHC command ring deq ptr high bits = @%08x\n, diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index f9873fa..dae8a39 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c @@ -1968,7 +1968,7 @@ static void xhci_set_hc_event_deq(struct xhci_hcd *xhci) xhci_warn(xhci, WARN something wrong with SW event ring dequeue ptr.\n); /* Update HC event ring dequeue pointer */ - temp = xhci_read_64(xhci, xhci-ir_set-erst_dequeue); + temp = readq(xhci-ir_set-erst_dequeue); temp = ERST_PTR_MASK; /* Don't clear the EHB bit (which is RW1C) because * there might be more events to service. @@ -2319,7 +2319,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) (unsigned long long)xhci-cmd_ring-first_seg-dma); /* Set the address in the Command Ring Control register */ - val_64 = xhci_read_64(xhci, xhci-op_regs-cmd_ring); + val_64 = readq(xhci-op_regs-cmd_ring); val_64 = (val_64 (u64) CMD_RING_RSVD_BITS) | (xhci-cmd_ring-first_seg-dma (u64) ~CMD_RING_RSVD_BITS) | xhci-cmd_ring-cycle_state; @@ -2403,7 +2403,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) xhci_dbg_trace(xhci, trace_xhci_dbg_init, // Set ERST base address for ir_set 0 = 0x%llx, (unsigned long long)xhci-erst.erst_dma_addr); - val_64 = xhci_read_64(xhci, xhci-ir_set-erst_base); + val_64 = readq(xhci-ir_set-erst_base); val_64 = ERST_PTR_MASK; val_64 |= (xhci-erst.erst_dma_addr (u64) ~ERST_PTR_MASK); xhci_write_64(xhci, val_64, xhci-ir_set-erst_base); diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 9b50a54..5192170 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -303,7 +303,7 @@ static int xhci_abort_cmd_ring(struct xhci_hcd *xhci) return 0; } - temp_64 = xhci_read_64(xhci, xhci-op_regs-cmd_ring); + temp_64 = readq(xhci-op_regs-cmd_ring); if (!(temp_64 CMD_RING_RUNNING)) { xhci_dbg(xhci, Command ring had been stopped\n); return 0; @@ -2843,7 +2843,7 @@ hw_died: /* Clear the event handler busy flag (RW1C); * the event ring should be empty. */ - temp_64 = xhci_read_64(xhci, xhci-ir_set-erst_dequeue); + temp_64 = readq(xhci-ir_set-erst_dequeue); xhci_write_64(xhci, temp_64 | ERST_EHB, xhci-ir_set-erst_dequeue); spin_unlock(xhci-lock); @@ -2857,7 +2857,7 @@ hw_died: */ while (xhci_handle_event(xhci) 0) {} - temp_64 = xhci_read_64(xhci, xhci-ir_set-erst_dequeue); + temp_64 = readq(xhci-ir_set-erst_dequeue); /* If necessary, update the HW's version of the event ring deq ptr. */
Re: setup msi-x vectors in xhci-hcd
On Mon, Sep 02, 2013 at 04:43:01PM +0300, Xenia Ragiadakou wrote: Hi Sarah and Alan, I am writing a patch for allocating as many msi-x vectors as the number of event rings because now the msi-x vectors allocated are more than are actually used, since currently xhci-hcd implements only one event ring. xhci_setup_msix() limits the number of supported msi-x vectors based on the number of cpus in the host system, and that confuses me: xhci-msix_count = min(num_online_cpus() + 1, HCS_MAX_INTRS(xhci-hcs_params1)); Can you explain me why it does so? I'm not the original author of that patch, so I'm not sure why they did that. I asked them to explain why in a comment above the code: http://marc.info/?l=linux-usbm=127351043723713w=2 The comment that they placed above the line didn't explain *why* they needed they wanted to allocate an MSI-X vector per CPU, just what they were doing: http://marc.info/?l=linux-usbm=127365906500373w=2 (And now you understand why kernel developers ask for a lot of documentation and comments. People disappear after submitting their code all the time.) I suspect the original author assumed that only one MSI-X vector could be tied to a CPU? If that's the case, I don't know why they allocated an extra vector. If you're going to allocate more MSI-X vectors than you have CPUs available, it probably makes sense to allocate as many vectors as you have event rings. Also, another thing that bothers me is that, in case pci_enable_msix() returns a positive number which indicates the number of msi-x vectors supported based on the MSI-X Capability structure of the PCI Configuration Address Space (this value is returned when the requested number of msi-x vectors are greater than the supported number), shall i free the msix_entries and reallocate them for the new number or reimplement this check before pci_enable_msix() is called and take it into account when allocate msix_entries for first time? I think you should re-implement the check, so that you allocate the minimum of: - the number of MSI-X vectors the PCI device will support, - the number of interrupters the xHCI host will support, and - the number of event rings as the driver has allocated. Sarah Sharp -- 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: [alsa-devel] question about webcam audio capture
vichy wrote: 2013/9/9 Clemens Ladisch clem...@ladisch.de: vichy wrote: I try to do webcam audio capture on my arm platform. when I execute audio capture I got below message retire_capture_urb: 108 callbacks suppressed This means that the retire_capture_urb() function printed lots of messages, and that 108 of them were thrown away because they were identical. Does that mean: 1. 108 of messages are the same and through away No, that at least 109 are the same. You have to look at the previous line to get the actual message. Would you please tell me what the previous line to get the actual message you mean? The previous line in the message log. tinycap record.wav -D 0 -d 0 -c 2 -r 32000 Try increasng -n or -p. Does recoding on a PC with the same parameters work? Regards, Clemens -- 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: Virtual Interrupts -- Need help please
On 09/09/2013 06:06 AM, Mark Brown wrote: On Sat, Sep 07, 2013 at 07:19:06PM -0500, Daniel Santos wrote: So do i create an IRQ domain and then call generic_handle_irq() from my URB complete() function? If so, which type of IRQ Domain is appropriate for this? Unlike typical platform devices, these are dynamically added and removed throughout the life of the kernel, adding to the challenge. So, if I understand correctly, my base IRQ number needs to be dynamically generated. How should I manage this? Unless you have a particular reason for using something else you should be using a linear domain - that's the default, it's very simple to work with. Cool, thank you. I have some secondary (and less important) questions about how to integrate this with device drivers that want a DT / open firmware config (which I know almost nothing about at this time), but that can wait. Could you be more specific about what you mean by integrate here? Hmm. Well one shortcoming of my driver has been lacking a way to tell the spi protocol driver which IRQ to use for interrupts. Yet another oversight on my behalf, as struct spi_device contains an int irq field just for this purpose. *sigh* Well, at least that's one problem put to rest, but I should probably elaborate further on this. Sorry in advance for the long response. One of my original requirements for this driver is that it is reusable for different devices that use the MCP2210, not just my own hardware. There are a number of ways to accomplish this, but I'm still new to Linux device drivers, so I don't know how an abstract driver would work other than just making it a library that doesn't register its self as a driver. The theory is that you should be able to specify your own USB vid/pid and have your driver probe on that, then feed the generic MCP2210 driver/library your board wiring information and any parameters your other drivers need (spi or gpio-driven peripherals on the board) and let the MCP2210 driver/library do potentially everything else for you, unless your device has some needs that aren't covered. Another requirement is for my specific device to vary its hardware somewhat, but (possibly) use the same vid/pid for these. Maybe this is some cardinal sin and a unique pid and model number for each variant is called for (like I said, I'm still new to this stuff). None the less, I've dealt with these two problems by creating an encoding scheme (which I've dubbed Creek, since I figured I was up one if it didn't work) that compresses the data so that it will fit easily in the 256 bytes of user-EEPROM on the chip. At the time I wrote this, I knew very little about the device tree and nothing about this Open Firmware format, so now I want to make sure I'm not re-inventing some wheel or circumventing a standard unnecessarily. Then, as I was working on figuring out how to propagate IRQs, I noticed that the irq_domain_add_linear() accepted a pointer to struct device_node and didn't not accept NULL. This made me think that I was missing something. So basically, it's a can of worms. :) I wanted to get the interrupts working first so I could confront this once I had a fully working driver, but I suppose there's no time like the present. So more specifically, on the EEPROM, I'm now storing the following (basically, everything in my struct board_config: https://github.com/daniel-santos/mcp2210-linux/blob/master/mcp2210.h#L483): * an optional name for the device or pin (for GPIOs, this is the name they get exported with) * an optional modalias for spi devices (defaults to spidev) -- which of course I know mixes OS with hardware, but should be easily translatable for drivers for lessor operating systems. * for spi devices, mode, min max bitrate and timing requirements (various delay values) * for gpios and the MCP2210's dedicated interrupt counter pin, an optional interrupt offset for producing IRQs * for gpios, the interrupt edge type (the dedicated interrupt counter manages this elsewhere) * how often it wants to have it's gpios and the interrupt counter polled (if applicable) * and soon to be added: an interrupt offset for SPI devices that want to consume IRQs (but only those generated by this MCP2210 device) So in summary, I need to make sure that what I'm doing 1.) makes sense, 2.) adheres to standards (unless the standard fails to fulfill the real-world requirements) and 3.) doesn't unnecessarily introduce a new way to do something that's already done better elsewhere. Thanks, Daniel -- 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: phy-mxs: Add auto clock and power setting
On Mon, Sep 09, 2013 at 04:41:15PM +0200, Marek Vasut wrote: Dear Peter Chen, With the auto setting, the PHY's clock and power can be recovered correctly from low power mode, it is ganranteed by IC logic. Besides, we enable the IC fixes for this PHY at mx6 platform. Signed-off-by: Peter Chen peter.c...@freescale.com --- drivers/usb/phy/phy-mxs-usb.c | 30 ++ 1 files changed, 26 insertions(+), 4 deletions(-) diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index f80e2e6..868c445 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c @@ -1,5 +1,5 @@ /* - * Copyright 2012 Freescale Semiconductor, Inc. + * Copyright 2012-2013 Freescale Semiconductor, Inc. * Copyright (C) 2012 Marek Vasut ma...@denx.de * on behalf of DENX Software Engineering GmbH * @@ -29,8 +29,17 @@ #define HW_USBPHY_CTRL_SET 0x34 #define HW_USBPHY_CTRL_CLR 0x38 +#define HW_USBPHY_IP 0x90 +#define HW_USBPHY_IP_SET 0x94 +#define HW_USBPHY_IP_CLR 0x98 + #define BM_USBPHY_CTRL_SFTRST BIT(31) #define BM_USBPHY_CTRL_CLKGATE BIT(30) +#define BM_USBPHY_CTRL_ENAUTOSET_USBCLKS BIT(26) +#define BM_USBPHY_CTRL_ENAUTOCLR_USBCLKGATEBIT(25) +#define BM_USBPHY_CTRL_ENAUTOCLR_PHY_PWD BIT(20) +#define BM_USBPHY_CTRL_ENAUTOCLR_CLKGATE BIT(19) +#define BM_USBPHY_CTRL_ENAUTO_PWRON_PLLBIT(18) #define BM_USBPHY_CTRL_ENUTMILEVEL3BIT(15) #define BM_USBPHY_CTRL_ENUTMILEVEL2BIT(14) #define BM_USBPHY_CTRL_ENHOSTDISCONDETECT BIT(1) @@ -100,11 +109,24 @@ static int mxs_phy_hw_init(struct mxs_phy *mxs_phy) /* Power up the PHY */ writel(0, base + HW_USBPHY_PWD); - /* enable FS/LS device */ - writel(BM_USBPHY_CTRL_ENUTMILEVEL2 | - BM_USBPHY_CTRL_ENUTMILEVEL3, + /* +* USB PHY Ctrl Setting +* - Auto clock/power on +* - Enable full/low speed support +*/ + writel(BM_USBPHY_CTRL_ENAUTOSET_USBCLKS | + BM_USBPHY_CTRL_ENAUTOCLR_USBCLKGATE | + BM_USBPHY_CTRL_ENAUTOCLR_PHY_PWD | + BM_USBPHY_CTRL_ENAUTOCLR_CLKGATE | + BM_USBPHY_CTRL_ENAUTO_PWRON_PLL | + BM_USBPHY_CTRL_ENUTMILEVEL2 | + BM_USBPHY_CTRL_ENUTMILEVEL3, base + HW_USBPHY_CTRL_SET); + /* Enable IC solution */ + if (is_mx6q_phy(mxs_phy) || is_mx6sl_phy(mxs_phy)) + writel(BM_USBPHY_IP_FIX, base + HW_USBPHY_IP_SET); So why not just add fsl,imx6-phy instead of adding three phy types ? Please see my commit log, the mx6sl-phy has some improvements compared to mx6q-phy. -- Best Regards, Peter Chen -- 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/3] staging: usbip: vhci_hcd: remove check for dma
vhci_hcd is a virtual usb host controller, so no need to check for dma. Signed-off-by: navin patidar nav...@cdac.in --- drivers/staging/usbip/vhci_hcd.c |6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/staging/usbip/vhci_hcd.c b/drivers/staging/usbip/vhci_hcd.c index b3c9217..e810ad5 100644 --- a/drivers/staging/usbip/vhci_hcd.c +++ b/drivers/staging/usbip/vhci_hcd.c @@ -999,12 +999,6 @@ static int vhci_hcd_probe(struct platform_device *pdev) usbip_dbg_vhci_hc(name %s id %d\n, pdev-name, pdev-id); - /* will be removed */ - if (pdev-dev.dma_mask) { - dev_info(pdev-dev, vhci_hcd DMA not supported\n); - return -EINVAL; - } - /* * Allocate and initialize hcd. * Our private data is also allocated automatically. -- 1.7.10.4 -- 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/3] staging: usbip: vhci_hcd: correctly handle return value
ret == 0 means success, anything else is failure. Signed-off-by: navin patidar nav...@cdac.in --- drivers/staging/usbip/vhci_hcd.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/usbip/vhci_hcd.c b/drivers/staging/usbip/vhci_hcd.c index d7974cb..b3c9217 100644 --- a/drivers/staging/usbip/vhci_hcd.c +++ b/drivers/staging/usbip/vhci_hcd.c @@ -1146,11 +1146,11 @@ static int __init vhci_hcd_init(void) return -ENODEV; ret = platform_driver_register(vhci_driver); - if (ret 0) + if (ret) goto err_driver_register; ret = platform_device_register(the_pdev); - if (ret 0) + if (ret) goto err_platform_device_register; pr_info(DRIVER_DESC v USBIP_VERSION \n); -- 1.7.10.4 -- 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/3] staging: usbip: stub_main: correctly handle return value
ret == 0 means success, anything else is failure. Signed-off-by: navin patidar nav...@cdac.in --- drivers/staging/usbip/stub_main.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/usbip/stub_main.c b/drivers/staging/usbip/stub_main.c index 33027cc..baf857f 100644 --- a/drivers/staging/usbip/stub_main.c +++ b/drivers/staging/usbip/stub_main.c @@ -255,14 +255,14 @@ static int __init usbip_host_init(void) } ret = usb_register(stub_driver); - if (ret 0) { + if (ret) { pr_err(usb_register failed %d\n, ret); goto err_usb_register; } ret = driver_create_file(stub_driver.drvwrap.driver, driver_attr_match_busid); - if (ret 0) { + if (ret) { pr_err(driver_create_file failed\n); goto err_create_file; } -- 1.7.10.4 -- 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