Re: [PATCH v3 08/13] usb: chipidea: OTG fsm timers initialization.
On Thu, Mar 06, 2014 at 12:30:40PM +0800, Peter Chen wrote: On Thu, Feb 27, 2014 at 07:38:26AM +0800, Li Jun wrote: This patch adds OTG fsm timers initialization, which use controller's 1ms interrupt as timeout counter, also adds some local timers which are not in otg_fsm_timer list. Signed-off-by: Li Jun b47...@freescale.com --- drivers/usb/chipidea/bits.h|1 + drivers/usb/chipidea/otg_fsm.c | 190 drivers/usb/chipidea/otg_fsm.h | 65 ++ 3 files changed, 256 insertions(+) diff --git a/drivers/usb/chipidea/bits.h b/drivers/usb/chipidea/bits.h index c42eb35..302cde7 100644 --- a/drivers/usb/chipidea/bits.h +++ b/drivers/usb/chipidea/bits.h @@ -83,6 +83,7 @@ #define OTGSC_VC BIT(1) #define OTGSC_IDPU BIT(5) #define OTGSC_HADP BIT(6) +#define OTGSC_HABA BIT(7) #define OTGSC_ID BIT(8) #define OTGSC_AVVBIT(9) #define OTGSC_ASVBIT(10) diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c index aa24466..f9e536b 100644 --- a/drivers/usb/chipidea/otg_fsm.c +++ b/drivers/usb/chipidea/otg_fsm.c @@ -25,6 +25,22 @@ #include otg.h #include otg_fsm.h +static struct ci_otg_fsm_timer *otg_timer_initializer +(struct ci_hdrc *ci, void (*function)(void *, unsigned long), + unsigned long expires, unsigned long data) +{ + struct ci_otg_fsm_timer *timer; + + timer = devm_kzalloc(ci-dev, sizeof(struct ci_otg_fsm_timer), + GFP_KERNEL); + if (!timer) + return NULL; + timer-function = function; + timer-expires = expires; + timer-data = data; + return timer; +} + /* Add timer to active timer list */ static void ci_otg_add_timer(struct ci_hdrc *ci, enum ci_otg_fsm_timer_index t) { @@ -75,6 +91,163 @@ static void ci_otg_del_timer(struct ci_hdrc *ci, enum ci_otg_fsm_timer_index t) ci_disable_otg_interrupt(ci, OTGSC_1MSIE); } +/* + * Reduce timer count by 1, and find timeout conditions. + * Called by otg 1ms timer interrupt + */ +static int ci_otg_tick_timer(struct ci_hdrc *ci) +{ + struct ci_otg_fsm_timer *tmp_timer, *del_tmp; + struct list_head *active_timers = ci-fsm_timer-active_timers; + int expired = 0; + + list_for_each_entry_safe(tmp_timer, del_tmp, active_timers, list) { + tmp_timer-count--; + /* check if timer expires */ + if (!tmp_timer-count) { + list_del(tmp_timer-list); + tmp_timer-function(ci, tmp_timer-data); + expired = 1; + } + } + + /* disable 1ms irq if there is no any timer active */ + if ((expired == 1) list_empty(active_timers)) + ci_disable_otg_interrupt(ci, OTGSC_1MSIE); + + return expired; +} The above function is much like ci_otg_del_timer at your 7th patch, is it possible to use the same API? + +/* The timeout callback function to set time out bit */ +static void set_tmout(void *ptr, unsigned long indicator) +{ + *(int *)indicator = 1; +} + +static void set_tmout_and_fsm(void *ptr, unsigned long indicator) +{ + struct ci_hdrc *ci = (struct ci_hdrc *)ptr; + + set_tmout(ci, indicator); + + /* trans from a_wait_bcon to a_wait_vfall */ + disable_irq_nosync(ci-irq); + queue_work(ci-wq, ci-work); +} + +static void b_ssend_srp_tmout_func(void *ptr, unsigned long indicator) +{ + struct ci_hdrc *ci = (struct ci_hdrc *)ptr; + set_tmout(ci, indicator); + + /* only vbus fall below B_sess_vld in b_idle state */ + if (ci-transceiver-state == OTG_STATE_B_IDLE) { + disable_irq_nosync(ci-irq); + queue_work(ci-wq, ci-work); + } +} + +static void b_sess_vld_tmout_func(void *ptr, unsigned long indicator) +{ + struct ci_hdrc *ci = (struct ci_hdrc *)ptr; + + /* Check if A detached */ + if (!(hw_read(ci, OP_OTGSC, OTGSC_BSV))) { + ci-fsm-b_sess_vld = 0; + ci_otg_add_timer(ci, B_SSEND_SRP); + disable_irq_nosync(ci-irq); + queue_work(ci-wq, ci-work); + } +} + +static void b_data_pulse_end(void *ptr, unsigned long indicator) +{ + struct ci_hdrc *ci = (struct ci_hdrc *)ptr; + + ci-fsm-b_srp_done = 1; + ci-fsm-b_bus_req = 0; + if (ci-fsm-power_up) + ci-fsm-power_up = 0; + + hw_write(ci, OP_OTGSC, OTGSC_INT_STATUS_BITS | OTGSC_HABA, 0); + + disable_irq_nosync(ci-irq); + queue_work(ci-wq, ci-work); +} + +/* Initialize timers */ +static int ci_otg_init_timers(struct ci_hdrc *ci) +{ + struct otg_fsm *fsm = ci-fsm; + + /* FSM used timers */ + ci-fsm_timer-timer_list[A_WAIT_VRISE] = + otg_timer_initializer(ci, set_tmout,
Re: [PATCH v2][ 3/8] usb: chipidea: usbmisc: Add USB Host support for i.MX25/i.MX35 CPUs
On Tue, Mar 11, 2014 at 11:54:59AM +0100, Denis Carikli wrote: Signed-off-by: Denis Carikli de...@eukrea.com --- Add something at commit log please. Changelog v1-v2: - converted two remaining defines to BIT() - Removed a variable declaration that was not used in usbmisc_imx25_init --- drivers/usb/chipidea/usbmisc_imx.c | 58 1 file changed, 58 insertions(+) diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c index cd061ab..3523c09 100644 --- a/drivers/usb/chipidea/usbmisc_imx.c +++ b/drivers/usb/chipidea/usbmisc_imx.c @@ -21,6 +21,26 @@ #define MX25_USB_PHY_CTRL_OFFSET 0x08 #define MX25_BM_EXTERNAL_VBUS_DIVIDERBIT(23) +#define MXC_EHCI_INTERFACE_SINGLE_UNI(2 0) +#define MXC_EHCI_INTERFACE_DIFF_UNI (0 0) +#define MXC_EHCI_INTERFACE_MASK (0xf) + Which SoCs will use above Macros? If only imx25 and imx35, using prefix MX25 please. Otherwise, adding prefix IMX_ for above Macros and the comment for which SoC needs them. +#define MX25_OTG_SIC_SHIFT 29 +#define MX25_OTG_SIC_MASK(0x3 MX25_OTG_SIC_SHIFT) +#define MX25_OTG_PM_BIT BIT(24) +#define MX25_OTG_PP_BIT BIT(11) +#define MX25_OTG_OCPOL_BIT BIT(3) + +#define MX25_H1_SIC_SHIFT21 +#define MX25_H1_SIC_MASK (0x3 MX25_H1_SIC_SHIFT) +#define MX25_H1_PP_BIT BIT(18) +#define MX25_H1_PM_BIT BIT(16) +#define MX25_H1_IPPUE_UP_BIT BIT(7) +#define MX25_H1_IPPUE_DOWN_BIT BIT(6) +#define MX25_H1_TLL_BIT BIT(5) +#define MX25_H1_USBTE_BITBIT(4) +#define MX25_H1_OCPOL_BITBIT(2) + #define MX27_H1_PM_BIT BIT(8) #define MX27_H2_PM_BIT BIT(16) #define MX27_OTG_PM_BIT BIT(24) @@ -50,6 +70,39 @@ struct imx_usbmisc { static struct imx_usbmisc *usbmisc; +static int usbmisc_imx25_init(struct imx_usbmisc_data *data) +{ + unsigned long flags; + u32 val = 0; + + if (data-index 1) + return -EINVAL; + + spin_lock_irqsave(usbmisc-lock, flags); + switch (data-index) { + case 0: + val = readl(usbmisc-base); + val = ~(MX25_OTG_SIC_MASK | MX25_OTG_PP_BIT); + val |= (MXC_EHCI_INTERFACE_DIFF_UNI MXC_EHCI_INTERFACE_MASK) MX25_OTG_SIC_SHIFT; + val |= (MX25_OTG_PM_BIT | MX25_OTG_OCPOL_BIT); + writel(val, usbmisc-base); + break; + case 1: + val = readl(usbmisc-base); + val = ~(MX25_H1_SIC_MASK | MX25_H1_PP_BIT | MX25_H1_IPPUE_UP_BIT); + val |= (MXC_EHCI_INTERFACE_SINGLE_UNI MXC_EHCI_INTERFACE_MASK) MX25_H1_SIC_SHIFT; + val |= (MX25_H1_PM_BIT | MX25_H1_OCPOL_BIT | MX25_H1_TLL_BIT | + MX25_H1_USBTE_BIT | MX25_H1_IPPUE_DOWN_BIT); + + writel(val, usbmisc-base); + + break; + } + spin_unlock_irqrestore(usbmisc-lock, flags); + + return 0; +} + static int usbmisc_imx25_post(struct imx_usbmisc_data *data) { void __iomem *reg; @@ -159,6 +212,7 @@ static int usbmisc_imx6q_init(struct imx_usbmisc_data *data) } static const struct usbmisc_ops imx25_usbmisc_ops = { + .init = usbmisc_imx25_init, .post = usbmisc_imx25_post, }; @@ -200,6 +254,10 @@ static const struct of_device_id usbmisc_imx_dt_ids[] = { .data = imx25_usbmisc_ops, }, { + .compatible = fsl,imx35-usbmisc, + .data = imx25_usbmisc_ops, + }, + { .compatible = fsl,imx27-usbmisc, .data = imx27_usbmisc_ops, }, -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- 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
Re: [PATCH] xhci: extend quirk for Renesas cards
On Tue, 2014-03-11 at 18:50 +0200, Mathias Nyman wrote: On 03/11/2014 04:54 PM, Anatoly C.K. wrote: Igor do not have this card. [root@fedora-20 ~]# lspci -vmnnd 1912: Device: 03:00.0 Class: USB controller [0c03] Vendor: Renesas Technology Corp. [1912] Device: uPD720202 USB 3.0 Host Controller [0015] SVendor:Renesas Technology Corp. [1912] SDevice:uPD720202 USB 3.0 Host Controller [0015] Rev:02 ProgIf: 30 Thanks, I think that as the host chip and add-on card are both made by Renesas we can assume this quirk is needed for all renesas uPD720202 hosts. If this is ok with Sarah I think we can apply the patch as is. Thank you. I'll resend patch in 1-2m with updated description, fixed reporter Last Name and added signed-off for you. -Mathias -- 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 -- -Igor Gnatenko -- 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 v2] xhci: extend quirk for Renesas cards
After suspend another Renesas PCI-X USB 3.0 card doesn't work. [root@fedora-20 ~]# lspci -vmnnd 1912: Device: 03:00.0 Class: USB controller [0c03] Vendor: Renesas Technology Corp. [1912] Device: uPD720202 USB 3.0 Host Controller [0015] SVendor:Renesas Technology Corp. [1912] SDevice:uPD720202 USB 3.0 Host Controller [0015] Rev:02 ProgIf: 30 Reported-and-tested-by: Anatoly Kharchenko rfr-b...@yandex.ru Reference: http://redmine.russianfedora.pro/issues/1315 Signed-off-by: Igor Gnatenko i.gnatenko.br...@gmail.com Signed-off-by: Mathias Nyman mathias.ny...@linux.intel.com --- drivers/usb/host/xhci-pci.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index 04f986d..13d4add 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c @@ -143,9 +143,7 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) xhci-quirks |= XHCI_TRUST_TX_LENGTH; } if (pdev-vendor == PCI_VENDOR_ID_RENESAS - pdev-device == 0x0015 - pdev-subsystem_vendor == PCI_VENDOR_ID_SAMSUNG - pdev-subsystem_device == 0xc0cd) + pdev-device == 0x0015) xhci-quirks |= XHCI_RESET_ON_RESUME; if (pdev-vendor == PCI_VENDOR_ID_VIA) xhci-quirks |= XHCI_RESET_ON_RESUME; -- 1.9.0 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/3] usb: chipidea: debug: add debug file for controller registers dump.
This patch adds below registers dump for debug: - USBINTR - USBSTS - USBMODE - USBCMD - PORTSC - OTGSC Signed-off-by: Li Jun b47...@freescale.com --- drivers/usb/chipidea/debug.c | 49 ++ 1 file changed, 49 insertions(+) diff --git a/drivers/usb/chipidea/debug.c b/drivers/usb/chipidea/debug.c index 96d899a..34f0677 100644 --- a/drivers/usb/chipidea/debug.c +++ b/drivers/usb/chipidea/debug.c @@ -12,6 +12,7 @@ #include udc.h #include bits.h #include debug.h +#include otg.h /** * ci_device_show: prints information about device capabilities and status @@ -253,6 +254,48 @@ static const struct file_operations ci_role_fops = { .release= single_release, }; +int ci_registers_show(struct seq_file *s, void *unused) +{ + struct ci_hdrc *ci = s-private; + u32 tmp_reg; + + if (!ci) + return 0; + + /* -- Registers - */ + tmp_reg = hw_read_intr_enable(ci); + seq_printf(s, USBINTR reg: %08x\n, tmp_reg); + + tmp_reg = hw_read_intr_status(ci); + seq_printf(s, USBSTS reg: %08x\n, tmp_reg); + + tmp_reg = hw_read(ci, OP_USBMODE, ~0); + seq_printf(s, USBMODE reg: %08x\n, tmp_reg); + + tmp_reg = hw_read(ci, OP_USBCMD, ~0); + seq_printf(s, USBCMD reg: %08x\n, tmp_reg); + + tmp_reg = hw_read(ci, OP_PORTSC, ~0); + seq_printf(s, PORTSC reg: %08x\n, tmp_reg); + + tmp_reg = hw_read_otgsc(ci); + seq_printf(s, OTGSC reg: %08x\n, tmp_reg); + + return 0; +} + +static int ci_registers_open(struct inode *inode, struct file *file) +{ + return single_open(file, ci_registers_show, inode-i_private); +} + +static const struct file_operations ci_registers_fops = { + .open = ci_registers_open, + .read = seq_read, + .llseek = seq_lseek, + .release= single_release, +}; + /** * dbg_create_files: initializes the attribute interface * @ci: device @@ -289,6 +332,12 @@ int dbg_create_files(struct ci_hdrc *ci) dent = debugfs_create_file(role, S_IRUGO | S_IWUSR, ci-debugfs, ci, ci_role_fops); + if (!dent) + goto err; + + dent = debugfs_create_file(registers, S_IRUGO, ci-debugfs, ci, + ci_registers_fops); + if (dent) return 0; err: -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/3] usb: chipidea: export interrupt enable and status register read functions.
This patch moves usb interrupt enable and status register read functions from udc driver to core driver to use them in all ci drivers. Signed-off-by: Li Jun b47...@freescale.com --- drivers/usb/chipidea/ci.h |4 drivers/usb/chipidea/core.c | 20 drivers/usb/chipidea/udc.c | 20 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h index e206406..7ae8cb6 100644 --- a/drivers/usb/chipidea/ci.h +++ b/drivers/usb/chipidea/ci.h @@ -319,6 +319,10 @@ static inline u32 hw_test_and_write(struct ci_hdrc *ci, enum ci_hw_regs reg, return (val mask) __ffs(mask); } +u32 hw_read_intr_enable(struct ci_hdrc *ci); + +u32 hw_read_intr_status(struct ci_hdrc *ci); + int hw_device_reset(struct ci_hdrc *ci, u32 mode); int hw_port_test_set(struct ci_hdrc *ci, u8 mode); diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 20be020..db1a6d6 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -140,6 +140,26 @@ static int hw_alloc_regmap(struct ci_hdrc *ci, bool is_lpm) } /** + * hw_read_intr_enable: returns interrupt enable register + * + * This function returns register data + */ +u32 hw_read_intr_enable(struct ci_hdrc *ci) +{ + return hw_read(ci, OP_USBINTR, ~0); +} + +/** + * hw_read_intr_status: returns interrupt status register + * + * This function returns register data + */ +u32 hw_read_intr_status(struct ci_hdrc *ci) +{ + return hw_read(ci, OP_USBSTS, ~0); +} + +/** * hw_port_test_set: writes port test mode (execute without interruption) * @mode: new value * diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 6a847c2..007d0a4 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -242,26 +242,6 @@ static int hw_port_is_high_speed(struct ci_hdrc *ci) } /** - * hw_read_intr_enable: returns interrupt enable register - * - * This function returns register data - */ -static u32 hw_read_intr_enable(struct ci_hdrc *ci) -{ - return hw_read(ci, OP_USBINTR, ~0); -} - -/** - * hw_read_intr_status: returns interrupt status register - * - * This function returns register data - */ -static u32 hw_read_intr_status(struct ci_hdrc *ci) -{ - return hw_read(ci, OP_USBSTS, ~0); -} - -/** * hw_test_and_clear_complete: test clear complete status (execute without * interruption) * @n: endpoint number -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/3] usb: chipidea: operate on otgsc register in a general way
From: Li Jun b47...@freescale.com Use a more general way to read and write otgsc register. Signed-off-by: Li Jun b47...@freescale.com --- drivers/usb/chipidea/core.c | 19 + drivers/usb/chipidea/otg.c | 48 +++ drivers/usb/chipidea/otg.h | 19 +++-- drivers/usb/chipidea/udc.c | 11 ++ 4 files changed, 65 insertions(+), 32 deletions(-) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index ca6831c..20be020 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -359,16 +359,15 @@ static irqreturn_t ci_irq(int irq, void *data) irqreturn_t ret = IRQ_NONE; u32 otgsc = 0; - if (ci-is_otg) - otgsc = hw_read(ci, OP_OTGSC, ~0); - + otgsc = hw_read_otgsc(ci); /* * Handle id change interrupt, it indicates device/host function * switch. */ if (ci-is_otg (otgsc OTGSC_IDIE) (otgsc OTGSC_IDIS)) { ci-id_event = true; - ci_clear_otg_interrupt(ci, OTGSC_IDIS); + /* Clear ID change irq status */ + hw_set_otgsc_bits(ci, OTGSC_IDIS); disable_irq_nosync(ci-irq); queue_work(ci-wq, ci-work); return IRQ_HANDLED; @@ -380,7 +379,8 @@ static irqreturn_t ci_irq(int irq, void *data) */ if (ci-is_otg (otgsc OTGSC_BSVIE) (otgsc OTGSC_BSVIS)) { ci-b_sess_valid_event = true; - ci_clear_otg_interrupt(ci, OTGSC_BSVIS); + /* Clear BSV irq */ + hw_set_otgsc_bits(ci, OTGSC_BSVIS); disable_irq_nosync(ci-irq); queue_work(ci-wq, ci-work); return IRQ_HANDLED; @@ -502,8 +502,10 @@ static void ci_get_otg_capable(struct ci_hdrc *ci) == (DCCPARAMS_DC | DCCPARAMS_HC)); if (ci-is_otg) { dev_dbg(ci-dev, It is OTG capable controller\n); - ci_disable_otg_interrupt(ci, OTGSC_INT_EN_BITS); - ci_clear_otg_interrupt(ci, OTGSC_INT_STATUS_BITS); + /* Disable all OTG irq */ + hw_clear_otgsc_bits(ci, OTGSC_INT_EN_BITS); + /* Clear all OTG irq status */ + hw_set_otgsc_bits(ci, OTGSC_INT_STATUS_BITS); } } @@ -617,7 +619,8 @@ static int ci_hdrc_probe(struct platform_device *pdev) */ mdelay(2); ci-role = ci_otg_role(ci); - ci_enable_otg_interrupt(ci, OTGSC_IDIE); + /* Enable ID change irq */ + hw_set_otgsc_bits(ci, OTGSC_IDIE); } else { /* * If the controller is not OTG capable, but support diff --git a/drivers/usb/chipidea/otg.c b/drivers/usb/chipidea/otg.c index 39bd7ec..f214ade 100644 --- a/drivers/usb/chipidea/otg.c +++ b/drivers/usb/chipidea/otg.c @@ -24,12 +24,50 @@ #include otg.h /** + * hw_read_otgsc: returns otgsc register + * + * This function returns register data + */ +u32 hw_read_otgsc(struct ci_hdrc *ci) +{ + if (ci-is_otg) + return hw_read(ci, OP_OTGSC, ~0); + else + return -ENOTSUPP; +} + +/** + * hw_set_otgsc_bits + * + * This function sets target bits of OTGSC register, + * any bits within OTGSC_INT_STATUS_BITS will be cleared, + * so use this func to clear irq status instead of hw_clear_otgsc_bits. + */ +void hw_set_otgsc_bits(struct ci_hdrc *ci, u32 bits) +{ + if (ci-is_otg) + hw_write(ci, OP_OTGSC, bits | OTGSC_INT_STATUS_BITS, bits); +} + +/** + * hw_clear_otgsc_bits + * + * This function clear target bits of OTGSC register, + * Note:any bits within OTGSC_INT_STATUS_BITS will not be cleared. + */ +void hw_clear_otgsc_bits(struct ci_hdrc *ci, u32 bits) +{ + if (ci-is_otg) + hw_write(ci, OP_OTGSC, bits | OTGSC_INT_STATUS_BITS, 0); +} + +/** * ci_otg_role - pick role based on ID pin state * @ci: the controller */ enum ci_role ci_otg_role(struct ci_hdrc *ci) { - u32 sts = hw_read(ci, OP_OTGSC, ~0); + u32 sts = hw_read_otgsc(ci); enum ci_role role = sts OTGSC_ID ? CI_ROLE_GADGET : CI_ROLE_HOST; @@ -44,7 +82,7 @@ void ci_handle_vbus_change(struct ci_hdrc *ci) if (!ci-is_otg) return; - otgsc = hw_read(ci, OP_OTGSC, ~0); + otgsc = hw_read_otgsc(ci); if (otgsc OTGSC_BSV) usb_gadget_vbus_connect(ci-gadget); @@ -115,6 +153,8 @@ void ci_hdrc_otg_destroy(struct ci_hdrc *ci) flush_workqueue(ci-wq); destroy_workqueue(ci-wq); } - ci_disable_otg_interrupt(ci, OTGSC_INT_EN_BITS); - ci_clear_otg_interrupt(ci, OTGSC_INT_STATUS_BITS); + /* Disable all OTG irq */ + hw_clear_otgsc_bits(ci,
Re: [PATCH v3 05/13] usb: chipidea: udc: driver update for OTG HNP.
On Thu, Feb 27, 2014 at 07:38:23AM +0800, Li Jun wrote: Add b_hnp_enable request handling and enable gadget-is_otg Signed-off-by: Li Jun b47...@freescale.com --- drivers/usb/chipidea/udc.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index fe30dcc..602bbf3 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -20,6 +20,7 @@ #include linux/pm_runtime.h #include linux/usb/ch9.h #include linux/usb/gadget.h +#include linux/usb/otg-fsm.h #include linux/usb/chipidea.h #include ci.h @@ -1098,6 +1099,14 @@ __acquires(ci-lock) default: break; } + break; This break is needed? + case USB_DEVICE_B_HNP_ENABLE: + if (gadget_is_otg(ci-gadget)) { + ci-gadget.b_hnp_enable = 1; + err = isr_setup_status_phase( + ci); + } + break; default: goto delegate; } @@ -1765,7 +1774,7 @@ static int udc_start(struct ci_hdrc *ci) ci-gadget.ops = usb_gadget_ops; ci-gadget.speed= USB_SPEED_UNKNOWN; ci-gadget.max_speed= USB_SPEED_HIGH; - ci-gadget.is_otg = 0; + ci-gadget.is_otg = ci-is_otg ? 1 : 0; ci-gadget.name = ci-platdata-name; INIT_LIST_HEAD(ci-gadget.ep_list); -- 1.7.9.5 -- 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
Re: [PATCH v3 05/13] usb: chipidea: udc: driver update for OTG HNP.
On Wed, Mar 12, 2014 at 03:01:15PM +0800, Peter Chen wrote: On Thu, Feb 27, 2014 at 07:38:23AM +0800, Li Jun wrote: Add b_hnp_enable request handling and enable gadget-is_otg Signed-off-by: Li Jun b47...@freescale.com --- drivers/usb/chipidea/udc.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index fe30dcc..602bbf3 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -20,6 +20,7 @@ #include linux/pm_runtime.h #include linux/usb/ch9.h #include linux/usb/gadget.h +#include linux/usb/otg-fsm.h #include linux/usb/chipidea.h #include ci.h @@ -1098,6 +1099,14 @@ __acquires(ci-lock) default: break; } + break; This break is needed? Yes, needed. + case USB_DEVICE_B_HNP_ENABLE: + if (gadget_is_otg(ci-gadget)) { + ci-gadget.b_hnp_enable = 1; + err = isr_setup_status_phase( + ci); + } + break; default: goto delegate; } @@ -1765,7 +1774,7 @@ static int udc_start(struct ci_hdrc *ci) ci-gadget.ops = usb_gadget_ops; ci-gadget.speed= USB_SPEED_UNKNOWN; ci-gadget.max_speed= USB_SPEED_HIGH; - ci-gadget.is_otg = 0; + ci-gadget.is_otg = ci-is_otg ? 1 : 0; ci-gadget.name = ci-platdata-name; INIT_LIST_HEAD(ci-gadget.ep_list); -- 1.7.9.5 -- 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
Re: [PATCH v3 10/13] usb: chipidea: add sys inputs for OTG fsm input.
On Thu, Mar 06, 2014 at 12:44:16PM +0800, Peter Chen wrote: On Thu, Feb 27, 2014 at 07:38:28AM +0800, Li Jun wrote: This patch adds sys input to control and show OTG fsm inputs by application, user can do host and preipheral role switch by change these inputs. Signed-off-by: Li Jun b47...@freescale.com --- drivers/usb/chipidea/otg.c |1 + drivers/usb/chipidea/otg_fsm.c | 192 drivers/usb/chipidea/otg_fsm.h |6 ++ 3 files changed, 199 insertions(+) diff --git a/drivers/usb/chipidea/otg.c b/drivers/usb/chipidea/otg.c index 4fb33a2..6c10b91 100644 --- a/drivers/usb/chipidea/otg.c +++ b/drivers/usb/chipidea/otg.c @@ -129,4 +129,5 @@ void ci_hdrc_otg_destroy(struct ci_hdrc *ci) } ci_disable_otg_interrupt(ci, OTGSC_INT_EN_BITS); ci_clear_otg_interrupt(ci, OTGSC_INT_STATUS_BITS); + ci_hdrc_otg_fsm_remove(ci); } diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c index 0601058..0e980f1 100644 --- a/drivers/usb/chipidea/otg_fsm.c +++ b/drivers/usb/chipidea/otg_fsm.c @@ -41,6 +41,185 @@ static struct ci_otg_fsm_timer *otg_timer_initializer return timer; } +/* Add for otg: interact with user space app */ +static ssize_t +get_a_bus_req(struct device *dev, struct device_attribute *attr, char *buf) +{ + char*next; + unsignedsize, t; + struct ci_hdrc *ci = dev_get_drvdata(dev); + + next = buf; + size = PAGE_SIZE; + + if (ci-transceiver ci-transceiver-otg ci-fsm) { + t = scnprintf(next, size, %d\n, ci-fsm-a_bus_req); + size -= t; + next += t; + } else + dev_err(ci-dev, error: otg setup is not completed!\n); + + return PAGE_SIZE - size; +} + +static ssize_t +set_a_bus_req(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct ci_hdrc *ci = dev_get_drvdata(dev); + + if (count 2) + return -1; + + mutex_lock(ci-fsm-lock); + if (ci-transceiver ci-transceiver-otg ci-fsm) { + if (buf[0] == '0') { + ci-fsm-a_bus_req = 0; + } else if (buf[0] == '1') { + /* If a_bus_drop is TRUE, a_bus_req can't be set */ + if (ci-fsm-a_bus_drop) + goto end; + ci-fsm-a_bus_req = 1; + } + + disable_irq_nosync(ci-irq); + queue_work(ci-wq, ci-work); + } else + dev_err(ci-dev, error: otg setup is not completed!\n); +end: + mutex_unlock(ci-fsm-lock); + + return count; +} +static DEVICE_ATTR(a_bus_req, S_IRUGO | S_IWUSR, get_a_bus_req, set_a_bus_req); + +static ssize_t +get_a_bus_drop(struct device *dev, struct device_attribute *attr, char *buf) +{ + char*next; + unsignedsize, t; + struct ci_hdrc *ci = dev_get_drvdata(dev); + + next = buf; + size = PAGE_SIZE; + if (ci-transceiver ci-transceiver-otg ci-fsm) { + t = scnprintf(next, size, %d\n, ci-fsm-a_bus_drop); + size -= t; + next += t; + } else + dev_err(ci-dev, error: otg setup is not completed!\n); + + return PAGE_SIZE - size; +} + +static ssize_t +set_a_bus_drop(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct ci_hdrc *ci = dev_get_drvdata(dev); + + if (count 2) + return -1; + + mutex_lock(ci-fsm-lock); + if (ci-transceiver ci-transceiver-otg ci-fsm) { + if (buf[0] == '0') { + ci-fsm-a_bus_drop = 0; + } else if (buf[0] == '1') { + ci-fsm-a_bus_drop = 1; + ci-fsm-a_bus_req = 0; + } + + disable_irq_nosync(ci-irq); + queue_work(ci-wq, ci-work); + } + mutex_unlock(ci-fsm-lock); + + return count; +} +static DEVICE_ATTR(a_bus_drop, S_IRUGO | S_IWUSR, get_a_bus_drop, + set_a_bus_drop); + +static ssize_t +get_b_bus_req(struct device *dev, struct device_attribute *attr, char *buf) +{ + char*next; + unsignedsize, t; + struct ci_hdrc *ci = dev_get_drvdata(dev); + + next = buf; + size = PAGE_SIZE; + + if (ci-transceiver ci-transceiver-otg ci-fsm) { + t = scnprintf(next, size, %d\n, ci-fsm-b_bus_req); + size -= t; + next += t; + } + + return PAGE_SIZE - size; +} + +static ssize_t +set_b_bus_req(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct ci_hdrc *ci = dev_get_drvdata(dev); + + if
Re: [PATCH 1/3] usb: chipidea: operate on otgsc register in a general way
On Wed, Mar 12, 2014 at 02:32:39PM +0800, Li Jun wrote: From: Li Jun b47...@freescale.com Use a more general way to read and write otgsc register. Signed-off-by: Li Jun b47...@freescale.com --- drivers/usb/chipidea/core.c | 19 + drivers/usb/chipidea/otg.c | 48 +++ drivers/usb/chipidea/otg.h | 19 +++-- drivers/usb/chipidea/udc.c | 11 ++ 4 files changed, 65 insertions(+), 32 deletions(-) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index ca6831c..20be020 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -359,16 +359,15 @@ static irqreturn_t ci_irq(int irq, void *data) irqreturn_t ret = IRQ_NONE; u32 otgsc = 0; - if (ci-is_otg) - otgsc = hw_read(ci, OP_OTGSC, ~0); - + otgsc = hw_read_otgsc(ci); /* * Handle id change interrupt, it indicates device/host function * switch. */ if (ci-is_otg (otgsc OTGSC_IDIE) (otgsc OTGSC_IDIS)) { ci-id_event = true; - ci_clear_otg_interrupt(ci, OTGSC_IDIS); + /* Clear ID change irq status */ + hw_set_otgsc_bits(ci, OTGSC_IDIS); disable_irq_nosync(ci-irq); queue_work(ci-wq, ci-work); return IRQ_HANDLED; @@ -380,7 +379,8 @@ static irqreturn_t ci_irq(int irq, void *data) */ if (ci-is_otg (otgsc OTGSC_BSVIE) (otgsc OTGSC_BSVIS)) { ci-b_sess_valid_event = true; - ci_clear_otg_interrupt(ci, OTGSC_BSVIS); + /* Clear BSV irq */ + hw_set_otgsc_bits(ci, OTGSC_BSVIS); disable_irq_nosync(ci-irq); queue_work(ci-wq, ci-work); return IRQ_HANDLED; @@ -502,8 +502,10 @@ static void ci_get_otg_capable(struct ci_hdrc *ci) == (DCCPARAMS_DC | DCCPARAMS_HC)); if (ci-is_otg) { dev_dbg(ci-dev, It is OTG capable controller\n); - ci_disable_otg_interrupt(ci, OTGSC_INT_EN_BITS); - ci_clear_otg_interrupt(ci, OTGSC_INT_STATUS_BITS); + /* Disable all OTG irq */ + hw_clear_otgsc_bits(ci, OTGSC_INT_EN_BITS); + /* Clear all OTG irq status */ + hw_set_otgsc_bits(ci, OTGSC_INT_STATUS_BITS); } } @@ -617,7 +619,8 @@ static int ci_hdrc_probe(struct platform_device *pdev) */ mdelay(2); ci-role = ci_otg_role(ci); - ci_enable_otg_interrupt(ci, OTGSC_IDIE); + /* Enable ID change irq */ + hw_set_otgsc_bits(ci, OTGSC_IDIE); } else { /* * If the controller is not OTG capable, but support diff --git a/drivers/usb/chipidea/otg.c b/drivers/usb/chipidea/otg.c index 39bd7ec..f214ade 100644 --- a/drivers/usb/chipidea/otg.c +++ b/drivers/usb/chipidea/otg.c @@ -24,12 +24,50 @@ #include otg.h /** + * hw_read_otgsc: returns otgsc register + * + * This function returns register data + */ register contents, I copied from drivers/usb/chipidea/ci.h :). +u32 hw_read_otgsc(struct ci_hdrc *ci) +{ + if (ci-is_otg) + return hw_read(ci, OP_OTGSC, ~0); + else + return -ENOTSUPP; +} + +/** + * hw_set_otgsc_bits + * + * This function sets target bits of OTGSC register, + * any bits within OTGSC_INT_STATUS_BITS will be cleared, + * so use this func to clear irq status instead of hw_clear_otgsc_bits. + */ +void hw_set_otgsc_bits(struct ci_hdrc *ci, u32 bits) +{ + if (ci-is_otg) + hw_write(ci, OP_OTGSC, bits | OTGSC_INT_STATUS_BITS, bits); +} + +/** + * hw_clear_otgsc_bits + * + * This function clear target bits of OTGSC register, + * Note:any bits within OTGSC_INT_STATUS_BITS will not be cleared. + */ +void hw_clear_otgsc_bits(struct ci_hdrc *ci, u32 bits) +{ + if (ci-is_otg) + hw_write(ci, OP_OTGSC, bits | OTGSC_INT_STATUS_BITS, 0); +} + - The caller should make sure the otgsc access under the condition of ci-is_otg so do not need to add ci-is_otg at your APIs. - It may confuse the user that there are two APIs for writing otgsc, and he must use hw_set_otg_bits to clear interrupt, how about using below two APIs, it more likes current register usage. u32 hw_read_otgsc(struct ci_hdrc *ci, u32 mask) { return hw_read(ci, OP_OTGSC, mask); } void hw_write_otgsc(struct ci_hdrc *ci, u32 mask, u32 bits) { hw_write(ci, OP_OTGSC, mask | OTGSC_INT_STATUS_BITS, bits); } +/** * ci_otg_role - pick role based on ID pin state * @ci: the controller */ enum ci_role ci_otg_role(struct ci_hdrc *ci) { - u32 sts = hw_read(ci, OP_OTGSC, ~0); + u32 sts = hw_read_otgsc(ci); enum ci_role role = sts OTGSC_ID
Re: [PATCH 2/3] usb: chipidea: export interrupt enable and status register read functions.
On Wed, Mar 12, 2014 at 02:32:40PM +0800, Li Jun wrote: This patch moves usb interrupt enable and status register read functions from udc driver to core driver to use them in all ci drivers. Signed-off-by: Li Jun b47...@freescale.com --- drivers/usb/chipidea/ci.h |4 drivers/usb/chipidea/core.c | 20 drivers/usb/chipidea/udc.c | 20 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h index e206406..7ae8cb6 100644 --- a/drivers/usb/chipidea/ci.h +++ b/drivers/usb/chipidea/ci.h @@ -319,6 +319,10 @@ static inline u32 hw_test_and_write(struct ci_hdrc *ci, enum ci_hw_regs reg, return (val mask) __ffs(mask); } +u32 hw_read_intr_enable(struct ci_hdrc *ci); + +u32 hw_read_intr_status(struct ci_hdrc *ci); + int hw_device_reset(struct ci_hdrc *ci, u32 mode); int hw_port_test_set(struct ci_hdrc *ci, u8 mode); diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 20be020..db1a6d6 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -140,6 +140,26 @@ static int hw_alloc_regmap(struct ci_hdrc *ci, bool is_lpm) } /** + * hw_read_intr_enable: returns interrupt enable register + * + * This function returns register data + */ +u32 hw_read_intr_enable(struct ci_hdrc *ci) +{ + return hw_read(ci, OP_USBINTR, ~0); +} + +/** + * hw_read_intr_status: returns interrupt status register + * + * This function returns register data + */ +u32 hw_read_intr_status(struct ci_hdrc *ci) +{ + return hw_read(ci, OP_USBSTS, ~0); +} + +/** * hw_port_test_set: writes port test mode (execute without interruption) * @mode: new value * diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 6a847c2..007d0a4 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -242,26 +242,6 @@ static int hw_port_is_high_speed(struct ci_hdrc *ci) } /** - * hw_read_intr_enable: returns interrupt enable register - * - * This function returns register data - */ -static u32 hw_read_intr_enable(struct ci_hdrc *ci) -{ - return hw_read(ci, OP_USBINTR, ~0); -} - -/** - * hw_read_intr_status: returns interrupt status register - * - * This function returns register data - */ -static u32 hw_read_intr_status(struct ci_hdrc *ci) -{ - return hw_read(ci, OP_USBSTS, ~0); -} - -/** * hw_test_and_clear_complete: test clear complete status (execute without * interruption) * @n: endpoint number -- 1.7.9.5 Acked-by: Peter Chen peter.c...@freescale.com -- 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
Re: [PATCH 3/3] usb: chipidea: debug: add debug file for controller registers dump.
On Wed, Mar 12, 2014 at 02:32:41PM +0800, Li Jun wrote: This patch adds below registers dump for debug: - USBINTR - USBSTS - USBMODE - USBCMD - PORTSC - OTGSC Signed-off-by: Li Jun b47...@freescale.com --- drivers/usb/chipidea/debug.c | 49 ++ 1 file changed, 49 insertions(+) diff --git a/drivers/usb/chipidea/debug.c b/drivers/usb/chipidea/debug.c index 96d899a..34f0677 100644 --- a/drivers/usb/chipidea/debug.c +++ b/drivers/usb/chipidea/debug.c @@ -12,6 +12,7 @@ #include udc.h #include bits.h #include debug.h +#include otg.h /** * ci_device_show: prints information about device capabilities and status @@ -253,6 +254,48 @@ static const struct file_operations ci_role_fops = { .release= single_release, }; +int ci_registers_show(struct seq_file *s, void *unused) +{ + struct ci_hdrc *ci = s-private; + u32 tmp_reg; + + if (!ci) + return 0; + + /* -- Registers - */ + tmp_reg = hw_read_intr_enable(ci); + seq_printf(s, USBINTR reg: %08x\n, tmp_reg); + + tmp_reg = hw_read_intr_status(ci); + seq_printf(s, USBSTS reg: %08x\n, tmp_reg); + + tmp_reg = hw_read(ci, OP_USBMODE, ~0); + seq_printf(s, USBMODE reg: %08x\n, tmp_reg); + + tmp_reg = hw_read(ci, OP_USBCMD, ~0); + seq_printf(s, USBCMD reg: %08x\n, tmp_reg); + + tmp_reg = hw_read(ci, OP_PORTSC, ~0); + seq_printf(s, PORTSC reg: %08x\n, tmp_reg); + + tmp_reg = hw_read_otgsc(ci); + seq_printf(s, OTGSC reg: %08x\n, tmp_reg); + Just like I mentioned at patch 1, the caller should make sure ci-is_otg condition, for non-otg platform, it will output messy value. + return 0; +} + +static int ci_registers_open(struct inode *inode, struct file *file) +{ + return single_open(file, ci_registers_show, inode-i_private); +} + +static const struct file_operations ci_registers_fops = { + .open = ci_registers_open, + .read = seq_read, + .llseek = seq_lseek, + .release= single_release, +}; + /** * dbg_create_files: initializes the attribute interface * @ci: device @@ -289,6 +332,12 @@ int dbg_create_files(struct ci_hdrc *ci) dent = debugfs_create_file(role, S_IRUGO | S_IWUSR, ci-debugfs, ci, ci_role_fops); + if (!dent) + goto err; + + dent = debugfs_create_file(registers, S_IRUGO, ci-debugfs, ci, + ci_registers_fops); + if (dent) return 0; err: -- 1.7.9.5 -- 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
Re: [PATCH v3 05/13] usb: chipidea: udc: driver update for OTG HNP.
On Wed, Mar 12, 2014 at 03:12:48PM +0800, Li Jun wrote: On Wed, Mar 12, 2014 at 03:01:15PM +0800, Peter Chen wrote: On Thu, Feb 27, 2014 at 07:38:23AM +0800, Li Jun wrote: Add b_hnp_enable request handling and enable gadget-is_otg Signed-off-by: Li Jun b47...@freescale.com --- drivers/usb/chipidea/udc.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index fe30dcc..602bbf3 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -20,6 +20,7 @@ #include linux/pm_runtime.h #include linux/usb/ch9.h #include linux/usb/gadget.h +#include linux/usb/otg-fsm.h #include linux/usb/chipidea.h #include ci.h @@ -1098,6 +1099,14 @@ __acquires(ci-lock) default: break; } + break; This break is needed? Yes, needed. Why, the case USB_DEVICE_TEST_MODE should alway break, isn't it? + case USB_DEVICE_B_HNP_ENABLE: + if (gadget_is_otg(ci-gadget)) { + ci-gadget.b_hnp_enable = 1; + err = isr_setup_status_phase( + ci); + } + break; default: goto delegate; } @@ -1765,7 +1774,7 @@ static int udc_start(struct ci_hdrc *ci) ci-gadget.ops = usb_gadget_ops; ci-gadget.speed= USB_SPEED_UNKNOWN; ci-gadget.max_speed= USB_SPEED_HIGH; - ci-gadget.is_otg = 0; + ci-gadget.is_otg = ci-is_otg ? 1 : 0; ci-gadget.name = ci-platdata-name; INIT_LIST_HEAD(ci-gadget.ep_list); -- 1.7.9.5 -- Best Regards, Peter Chen -- 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
Re: [PATCH v3 10/13] usb: chipidea: add sys inputs for OTG fsm input.
On Wed, Mar 12, 2014 at 04:03:34PM +0800, Li Jun wrote: On Thu, Mar 06, 2014 at 12:44:16PM +0800, Peter Chen wrote: On Thu, Feb 27, 2014 at 07:38:28AM +0800, Li Jun wrote: This patch adds sys input to control and show OTG fsm inputs by application, user can do host and preipheral role switch by change these inputs. Signed-off-by: Li Jun b47...@freescale.com --- drivers/usb/chipidea/otg.c |1 + drivers/usb/chipidea/otg_fsm.c | 192 drivers/usb/chipidea/otg_fsm.h |6 ++ 3 files changed, 199 insertions(+) diff --git a/drivers/usb/chipidea/otg.c b/drivers/usb/chipidea/otg.c index 4fb33a2..6c10b91 100644 --- a/drivers/usb/chipidea/otg.c +++ b/drivers/usb/chipidea/otg.c @@ -129,4 +129,5 @@ void ci_hdrc_otg_destroy(struct ci_hdrc *ci) } ci_disable_otg_interrupt(ci, OTGSC_INT_EN_BITS); ci_clear_otg_interrupt(ci, OTGSC_INT_STATUS_BITS); + ci_hdrc_otg_fsm_remove(ci); } diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c index 0601058..0e980f1 100644 --- a/drivers/usb/chipidea/otg_fsm.c +++ b/drivers/usb/chipidea/otg_fsm.c @@ -41,6 +41,185 @@ static struct ci_otg_fsm_timer *otg_timer_initializer return timer; } +/* Add for otg: interact with user space app */ +static ssize_t +get_a_bus_req(struct device *dev, struct device_attribute *attr, char *buf) +{ + char*next; + unsignedsize, t; + struct ci_hdrc *ci = dev_get_drvdata(dev); + + next = buf; + size = PAGE_SIZE; + + if (ci-transceiver ci-transceiver-otg ci-fsm) { + t = scnprintf(next, size, %d\n, ci-fsm-a_bus_req); + size -= t; + next += t; + } else + dev_err(ci-dev, error: otg setup is not completed!\n); + + return PAGE_SIZE - size; +} + +static ssize_t +set_a_bus_req(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct ci_hdrc *ci = dev_get_drvdata(dev); + + if (count 2) + return -1; + + mutex_lock(ci-fsm-lock); + if (ci-transceiver ci-transceiver-otg ci-fsm) { + if (buf[0] == '0') { + ci-fsm-a_bus_req = 0; + } else if (buf[0] == '1') { + /* If a_bus_drop is TRUE, a_bus_req can't be set */ + if (ci-fsm-a_bus_drop) + goto end; + ci-fsm-a_bus_req = 1; + } + + disable_irq_nosync(ci-irq); + queue_work(ci-wq, ci-work); + } else + dev_err(ci-dev, error: otg setup is not completed!\n); +end: + mutex_unlock(ci-fsm-lock); + + return count; +} +static DEVICE_ATTR(a_bus_req, S_IRUGO | S_IWUSR, get_a_bus_req, set_a_bus_req); + +static ssize_t +get_a_bus_drop(struct device *dev, struct device_attribute *attr, char *buf) +{ + char*next; + unsignedsize, t; + struct ci_hdrc *ci = dev_get_drvdata(dev); + + next = buf; + size = PAGE_SIZE; + if (ci-transceiver ci-transceiver-otg ci-fsm) { + t = scnprintf(next, size, %d\n, ci-fsm-a_bus_drop); + size -= t; + next += t; + } else + dev_err(ci-dev, error: otg setup is not completed!\n); + + return PAGE_SIZE - size; +} + +static ssize_t +set_a_bus_drop(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct ci_hdrc *ci = dev_get_drvdata(dev); + + if (count 2) + return -1; + + mutex_lock(ci-fsm-lock); + if (ci-transceiver ci-transceiver-otg ci-fsm) { + if (buf[0] == '0') { + ci-fsm-a_bus_drop = 0; + } else if (buf[0] == '1') { + ci-fsm-a_bus_drop = 1; + ci-fsm-a_bus_req = 0; + } + + disable_irq_nosync(ci-irq); + queue_work(ci-wq, ci-work); + } + mutex_unlock(ci-fsm-lock); + + return count; +} +static DEVICE_ATTR(a_bus_drop, S_IRUGO | S_IWUSR, get_a_bus_drop, + set_a_bus_drop); + +static ssize_t +get_b_bus_req(struct device *dev, struct device_attribute *attr, char *buf) +{ + char*next; + unsignedsize, t; + struct ci_hdrc *ci = dev_get_drvdata(dev); + + next = buf; + size = PAGE_SIZE; + + if (ci-transceiver ci-transceiver-otg ci-fsm) { + t = scnprintf(next, size, %d\n, ci-fsm-b_bus_req); + size -= t; + next += t; + } + + return PAGE_SIZE - size; +} + +static ssize_t +set_b_bus_req(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count)
[PATCH 0/3] Some update for USB OTG
Hi Felipe, The two for fsm, the other one is delete CONFIG_USB_OTG_FSM since it is duplicated with CONFIG_USB_OTG, thanks. Li Jun (1): usb: phy-fsm: update OTG HNP state transition Peter Chen (2): usb: phy: delete CONFIG_USB_OTG_FSM usb: phy-fsm: change | to || for condition OTG_STATE_A_WAIT_BCON at statemachine drivers/usb/phy/Kconfig | 11 +-- drivers/usb/phy/Makefile |2 +- drivers/usb/phy/phy-fsm-usb.c |8 +--- 3 files changed, 7 insertions(+), 14 deletions(-) -- 1.7.8 -- 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] usb: phy-fsm: change | to || for condition OTG_STATE_A_WAIT_BCON at statemachine
It is should be condition or not bit or. Signed-off-by: Peter Chen peter.c...@freescale.com --- drivers/usb/phy/phy-fsm-usb.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/usb/phy/phy-fsm-usb.c b/drivers/usb/phy/phy-fsm-usb.c index 0021839..bf5c32f 100644 --- a/drivers/usb/phy/phy-fsm-usb.c +++ b/drivers/usb/phy/phy-fsm-usb.c @@ -315,7 +315,7 @@ int otg_statemachine(struct otg_fsm *fsm) otg_set_state(fsm, OTG_STATE_A_VBUS_ERR); else if (fsm-b_conn) otg_set_state(fsm, OTG_STATE_A_HOST); - else if (fsm-id | fsm-a_bus_drop | fsm-a_wait_bcon_tmout) + else if (fsm-id || fsm-a_bus_drop || fsm-a_wait_bcon_tmout) otg_set_state(fsm, OTG_STATE_A_WAIT_VFALL); break; case OTG_STATE_A_HOST: -- 1.7.8 -- 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] usb: phy-fsm: update OTG HNP state transition
From: Li Jun b47...@freescale.com According to:On-The-Go and Embedded Host Supplement to the USB Revision 2.0 Specification July 27, 2012 Revision 2.0 version 1.1a - add a_wait_vrise to a_wait_vfall - update condition from a_wait_vrise to a_wait_bcon Signed-off-by: Li Jun b47...@freescale.com --- drivers/usb/phy/phy-fsm-usb.c |6 -- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/usb/phy/phy-fsm-usb.c b/drivers/usb/phy/phy-fsm-usb.c index c47e5a6..0021839 100644 --- a/drivers/usb/phy/phy-fsm-usb.c +++ b/drivers/usb/phy/phy-fsm-usb.c @@ -303,9 +303,11 @@ int otg_statemachine(struct otg_fsm *fsm) otg_set_state(fsm, OTG_STATE_A_WAIT_VRISE); break; case OTG_STATE_A_WAIT_VRISE: - if (fsm-id || fsm-a_bus_drop || fsm-a_vbus_vld || - fsm-a_wait_vrise_tmout) { + if (fsm-a_vbus_vld) { otg_set_state(fsm, OTG_STATE_A_WAIT_BCON); + } else if (fsm-id || fsm-a_bus_drop || + fsm-a_wait_vrise_tmout) { + otg_set_state(fsm, OTG_STATE_A_WAIT_VFALL); } break; case OTG_STATE_A_WAIT_BCON: -- 1.7.8 -- 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] usb: phy: delete CONFIG_USB_OTG_FSM
We already have CONFIG_USB_OTG which can cover all CONFIG_USB_OTG_FSM does. Cc: Jun Li b47...@freescale.com Cc: Anton Tikhomirov av.tikhomi...@samsung.com Signed-off-by: Peter Chen peter.c...@freescale.com --- drivers/usb/phy/Kconfig | 11 +-- drivers/usb/phy/Makefile |2 +- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig index 416e0c8..1ef5ef8 100644 --- a/drivers/usb/phy/Kconfig +++ b/drivers/usb/phy/Kconfig @@ -6,15 +6,6 @@ menu USB Physical Layer drivers config USB_PHY def_bool n -config USB_OTG_FSM - tristate USB 2.0 OTG FSM implementation - depends on USB - select USB_OTG - select USB_PHY - help - Implements OTG Final State Machine as specified in On-The-Go - and Embedded Host Supplement to the USB Revision 2.0 Specification. - # # USB Transceiver Drivers # @@ -29,7 +20,7 @@ config AB8500_USB config FSL_USB2_OTG bool Freescale USB OTG Transceiver Driver - depends on USB_EHCI_FSL USB_FSL_USB2 USB_OTG_FSM PM_RUNTIME + depends on USB_EHCI_FSL USB_FSL_USB2 PM_RUNTIME select USB_OTG select USB_PHY help diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile index f8fa719..1fd4c38 100644 --- a/drivers/usb/phy/Makefile +++ b/drivers/usb/phy/Makefile @@ -3,7 +3,7 @@ # obj-$(CONFIG_USB_PHY) += phy.o obj-$(CONFIG_OF) += of.o -obj-$(CONFIG_USB_OTG_FSM) += phy-fsm-usb.o +obj-$(CONFIG_USB_OTG) += phy-fsm-usb.o # transceiver drivers, keep the list sorted -- 1.7.8 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3][ 1/9] ARM: dts: mx25: USB block requires only one clock
From: Fabio Estevam fabio.este...@freescale.com Like other imx SoCs only one USB clock is needed on mx25. Signed-off-by: Fabio Estevam fabio.este...@freescale.com --- arch/arm/boot/dts/imx25.dtsi |6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/arm/boot/dts/imx25.dtsi b/arch/arm/boot/dts/imx25.dtsi index 77bb743..829791e 100644 --- a/arch/arm/boot/dts/imx25.dtsi +++ b/arch/arm/boot/dts/imx25.dtsi @@ -496,8 +496,7 @@ compatible = fsl,imx25-usb, fsl,imx27-usb; reg = 0x53ff4000 0x0200; interrupts = 37; - clocks = clks 9, clks 70, clks 8; - clock-names = ipg, ahb, per; + clocks = clks 70; fsl,usbmisc = usbmisc 0; status = disabled; }; @@ -506,8 +505,7 @@ compatible = fsl,imx25-usb, fsl,imx27-usb; reg = 0x53ff4400 0x0200; interrupts = 35; - clocks = clks 9, clks 70, clks 8; - clock-names = ipg, ahb, per; + clocks = clks 70; fsl,usbmisc = usbmisc 1; status = disabled; }; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3][ 3/9] usb: chipidea: Use standard usb-phy property.
This converts the Chipidea usbmisc driver to use the standard usb-phy property. It also adapt the dts that uses it. Signed-off-by: Denis Carikli de...@eukrea.com --- arch/arm/boot/dts/imx23.dtsi |2 +- arch/arm/boot/dts/imx27.dtsi |4 ++-- arch/arm/boot/dts/imx28.dtsi |4 ++-- arch/arm/boot/dts/imx51.dtsi |2 +- arch/arm/boot/dts/imx53.dtsi |4 ++-- arch/arm/boot/dts/imx6qdl.dtsi |4 ++-- arch/arm/boot/dts/imx6sl.dtsi |4 ++-- drivers/usb/chipidea/ci_hdrc_imx.c |2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/arch/arm/boot/dts/imx23.dtsi b/arch/arm/boot/dts/imx23.dtsi index bbcfb5a..e3c9924 100644 --- a/arch/arm/boot/dts/imx23.dtsi +++ b/arch/arm/boot/dts/imx23.dtsi @@ -522,7 +522,7 @@ compatible = fsl,imx23-usb, fsl,imx27-usb; reg = 0x8008 0x4; interrupts = 11; - fsl,usbphy = usbphy0; + usb-phy = usbphy0; clocks = clks 40; status = disabled; }; diff --git a/arch/arm/boot/dts/imx27.dtsi b/arch/arm/boot/dts/imx27.dtsi index 83a8247..94bcf1a 100644 --- a/arch/arm/boot/dts/imx27.dtsi +++ b/arch/arm/boot/dts/imx27.dtsi @@ -466,7 +466,7 @@ interrupts = 56; clocks = clks 15; fsl,usbmisc = usbmisc 0; - fsl,usbphy = usbphy0; + usb-phy = usbphy0; status = disabled; }; @@ -485,7 +485,7 @@ interrupts = 55; clocks = clks 15; fsl,usbmisc = usbmisc 2; - fsl,usbphy = usbphy2; + usb-phy = usbphy2; status = disabled; }; diff --git a/arch/arm/boot/dts/imx28.dtsi b/arch/arm/boot/dts/imx28.dtsi index 90a5795..52ad72f 100644 --- a/arch/arm/boot/dts/imx28.dtsi +++ b/arch/arm/boot/dts/imx28.dtsi @@ -1143,7 +1143,7 @@ reg = 0x8008 0x1; interrupts = 93; clocks = clks 60; - fsl,usbphy = usbphy0; + usb-phy = usbphy0; status = disabled; }; @@ -1152,7 +1152,7 @@ reg = 0x8009 0x1; interrupts = 92; clocks = clks 61; - fsl,usbphy = usbphy1; + usb-phy = usbphy1; status = disabled; }; diff --git a/arch/arm/boot/dts/imx51.dtsi b/arch/arm/boot/dts/imx51.dtsi index cb3204a..b290947 100644 --- a/arch/arm/boot/dts/imx51.dtsi +++ b/arch/arm/boot/dts/imx51.dtsi @@ -249,7 +249,7 @@ interrupts = 18; clocks = clks IMX5_CLK_USBOH3_GATE; fsl,usbmisc = usbmisc 0; - fsl,usbphy = usbphy0; + usb-phy = usbphy0; status = disabled; }; diff --git a/arch/arm/boot/dts/imx53.dtsi b/arch/arm/boot/dts/imx53.dtsi index f0962e5..b10a3de 100644 --- a/arch/arm/boot/dts/imx53.dtsi +++ b/arch/arm/boot/dts/imx53.dtsi @@ -276,7 +276,7 @@ interrupts = 18; clocks = clks IMX5_CLK_USBOH3_GATE; fsl,usbmisc = usbmisc 0; - fsl,usbphy = usbphy0; + usb-phy = usbphy0; status = disabled; }; @@ -286,7 +286,7 @@ interrupts = 14; clocks = clks IMX5_CLK_USBOH3_GATE; fsl,usbmisc = usbmisc 1; - fsl,usbphy = usbphy1; + usb-phy = usbphy1; status = disabled; }; diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi index cfc85be..d2f0087 100644 --- a/arch/arm/boot/dts/imx6qdl.dtsi +++ b/arch/arm/boot/dts/imx6qdl.dtsi @@ -789,7 +789,7 @@ reg = 0x02184000 0x200; interrupts = 0 43 IRQ_TYPE_LEVEL_HIGH; clocks = clks 162; - fsl,usbphy = usbphy1; + usb-phy = usbphy1; fsl,usbmisc = usbmisc 0; status = disabled; }; @@ -799,7 +799,7 @@ reg = 0x02184200
[PATCH v3][ 6/9] ARM: dts: mbimxsd25 baseboard: Add USB support
Signed-off-by: Denis Carikli de...@eukrea.com --- Changelog v1-v2: - With the clock fix patches, the usb gadget also work. So I've set the otg port to otg instead of host. --- .../boot/dts/imx25-eukrea-mbimxsd25-baseboard.dts | 13 + 1 file changed, 13 insertions(+) diff --git a/arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard.dts b/arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard.dts index 62fb3da..ad12da3 100644 --- a/arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard.dts +++ b/arch/arm/boot/dts/imx25-eukrea-mbimxsd25-baseboard.dts @@ -172,3 +172,16 @@ fsl,uart-has-rtscts; status = okay; }; + +usbhost1 { + phy_type = serial; + dr_mode = host; + status = okay; +}; + +usbotg { + phy_type = utmi; + dr_mode = otg; + external-vbus-divider; + status = okay; +}; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3][ 4/9] usb: chipidea: usbmisc: Add USB Host support for i.MX25/i.MX35 CPUs
This adds the i.MX25 and the i.MX35 support in the ChipIdea usbmisc driver. The i.MX25 and i.MX35 usb controllers are similar enough to be able to use the same code. Signed-off-by: Denis Carikli de...@eukrea.com --- Changelog v2-v3: - Add a commit log Changelog v1-v2: - converted two remaining defines to BIT() - Removed a variable declaration that was not used in usbmisc_imx25_init --- drivers/usb/chipidea/usbmisc_imx.c | 58 1 file changed, 58 insertions(+) diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c index cd061ab..3523c09 100644 --- a/drivers/usb/chipidea/usbmisc_imx.c +++ b/drivers/usb/chipidea/usbmisc_imx.c @@ -21,6 +21,26 @@ #define MX25_USB_PHY_CTRL_OFFSET 0x08 #define MX25_BM_EXTERNAL_VBUS_DIVIDER BIT(23) +#define MXC_EHCI_INTERFACE_SINGLE_UNI (2 0) +#define MXC_EHCI_INTERFACE_DIFF_UNI(0 0) +#define MXC_EHCI_INTERFACE_MASK(0xf) + +#define MX25_OTG_SIC_SHIFT 29 +#define MX25_OTG_SIC_MASK (0x3 MX25_OTG_SIC_SHIFT) +#define MX25_OTG_PM_BITBIT(24) +#define MX25_OTG_PP_BITBIT(11) +#define MX25_OTG_OCPOL_BIT BIT(3) + +#define MX25_H1_SIC_SHIFT 21 +#define MX25_H1_SIC_MASK (0x3 MX25_H1_SIC_SHIFT) +#define MX25_H1_PP_BIT BIT(18) +#define MX25_H1_PM_BIT BIT(16) +#define MX25_H1_IPPUE_UP_BIT BIT(7) +#define MX25_H1_IPPUE_DOWN_BIT BIT(6) +#define MX25_H1_TLL_BITBIT(5) +#define MX25_H1_USBTE_BIT BIT(4) +#define MX25_H1_OCPOL_BIT BIT(2) + #define MX27_H1_PM_BIT BIT(8) #define MX27_H2_PM_BIT BIT(16) #define MX27_OTG_PM_BITBIT(24) @@ -50,6 +70,39 @@ struct imx_usbmisc { static struct imx_usbmisc *usbmisc; +static int usbmisc_imx25_init(struct imx_usbmisc_data *data) +{ + unsigned long flags; + u32 val = 0; + + if (data-index 1) + return -EINVAL; + + spin_lock_irqsave(usbmisc-lock, flags); + switch (data-index) { + case 0: + val = readl(usbmisc-base); + val = ~(MX25_OTG_SIC_MASK | MX25_OTG_PP_BIT); + val |= (MXC_EHCI_INTERFACE_DIFF_UNI MXC_EHCI_INTERFACE_MASK) MX25_OTG_SIC_SHIFT; + val |= (MX25_OTG_PM_BIT | MX25_OTG_OCPOL_BIT); + writel(val, usbmisc-base); + break; + case 1: + val = readl(usbmisc-base); + val = ~(MX25_H1_SIC_MASK | MX25_H1_PP_BIT | MX25_H1_IPPUE_UP_BIT); + val |= (MXC_EHCI_INTERFACE_SINGLE_UNI MXC_EHCI_INTERFACE_MASK) MX25_H1_SIC_SHIFT; + val |= (MX25_H1_PM_BIT | MX25_H1_OCPOL_BIT | MX25_H1_TLL_BIT | + MX25_H1_USBTE_BIT | MX25_H1_IPPUE_DOWN_BIT); + + writel(val, usbmisc-base); + + break; + } + spin_unlock_irqrestore(usbmisc-lock, flags); + + return 0; +} + static int usbmisc_imx25_post(struct imx_usbmisc_data *data) { void __iomem *reg; @@ -159,6 +212,7 @@ static int usbmisc_imx6q_init(struct imx_usbmisc_data *data) } static const struct usbmisc_ops imx25_usbmisc_ops = { + .init = usbmisc_imx25_init, .post = usbmisc_imx25_post, }; @@ -200,6 +254,10 @@ static const struct of_device_id usbmisc_imx_dt_ids[] = { .data = imx25_usbmisc_ops, }, { + .compatible = fsl,imx35-usbmisc, + .data = imx25_usbmisc_ops, + }, + { .compatible = fsl,imx27-usbmisc, .data = imx27_usbmisc_ops, }, -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3][ 5/9] ARM: dts: imx25.dtsi: Fix USB support.
From: Fabio Estevam fabio.este...@freescale.com This patch was adapted from the thread named USB Host support for mx25 on linux-usb@vger.kernel.org Signed-off-by: Denis Carikli de...@eukrea.com --- Changelog v2-v3: - rebased on top of the usb: chipidea: Use standard usb-phy property. patch. - Fixed the usbphy nodes index and added and added a reg property. Changelog v1-v2: - The usbphy nodes were made to look like the ones in imx53.dtsi - The patch was rebased on top of the clock fixes commits. --- arch/arm/boot/dts/imx25.dtsi | 29 ++--- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/arch/arm/boot/dts/imx25.dtsi b/arch/arm/boot/dts/imx25.dtsi index 829791e..02697b2 100644 --- a/arch/arm/boot/dts/imx25.dtsi +++ b/arch/arm/boot/dts/imx25.dtsi @@ -482,22 +482,13 @@ clocks = clks 99; }; - usbphy1: usbphy@1 { - compatible = nop-usbphy; - status = disabled; - }; - - usbphy2: usbphy@2 { - compatible = nop-usbphy; - status = disabled; - }; - usbotg: usb@53ff4000 { compatible = fsl,imx25-usb, fsl,imx27-usb; reg = 0x53ff4000 0x0200; interrupts = 37; clocks = clks 70; fsl,usbmisc = usbmisc 0; + usb-phy = usbphy0; status = disabled; }; @@ -507,6 +498,7 @@ interrupts = 35; clocks = clks 70; fsl,usbmisc = usbmisc 1; + usb-phy = usbphy1; status = disabled; }; @@ -516,7 +508,6 @@ clocks = clks 9, clks 70, clks 8; clock-names = ipg, ahb, per; reg = 0x53ff4600 0x00f; - status = disabled; }; dryice@53ffc000 { @@ -548,4 +539,20 @@ }; }; }; + + usbphy { + #address-cells = 1; + #size-cells = 0; + compatible = simple-bus; + + usbphy0: usbphy@0 { + reg = 0; + compatible = usb-nop-xceiv; + }; + + usbphy1: usbphy@1 { + reg = 1; + compatible = usb-nop-xceiv; + }; + }; }; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3][ 2/9] ARM: dts: mx35: USB block requires only one clock
From: Fabio Estevam fabio.este...@freescale.com Like other imx SoCs only one USB clock is needed on mx35. Signed-off-by: Fabio Estevam fabio.este...@freescale.com --- arch/arm/boot/dts/imx35.dtsi |6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/arm/boot/dts/imx35.dtsi b/arch/arm/boot/dts/imx35.dtsi index e59ccb4..474a73d 100644 --- a/arch/arm/boot/dts/imx35.dtsi +++ b/arch/arm/boot/dts/imx35.dtsi @@ -296,8 +296,7 @@ compatible = fsl,imx35-usb, fsl,imx27-usb; reg = 0x53ff4000 0x0200; interrupts = 37; - clocks = clks 9, clks 73, clks 28; - clock-names = ipg, ahb, per; + clocks = clks 73; fsl,usbmisc = usbmisc 0; status = disabled; }; @@ -306,8 +305,7 @@ compatible = fsl,imx35-usb, fsl,imx27-usb; reg = 0x53ff4400 0x0200; interrupts = 35; - clocks = clks 9, clks 73, clks 28; - clock-names = ipg, ahb, per; + clocks = clks 73; fsl,usbmisc = usbmisc 1; status = disabled; }; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3][ 7/9] ARM: dts: i.MX35: Add USB support.
Signed-off-by: Denis Carikli de...@eukrea.com --- Changelog v2-v3: - rebased on top of the usb: chipidea: Use standard usb-phy property. patch. - Fixed the usbphy nodes index and added and added a reg property. Changelog v1-v2: - The usbphy nodes were made to look like the ones in imx53.dtsi - The patch was rebased on top of the clock fixes commits. --- arch/arm/boot/dts/imx35.dtsi | 18 ++ 1 file changed, 18 insertions(+) diff --git a/arch/arm/boot/dts/imx35.dtsi b/arch/arm/boot/dts/imx35.dtsi index 474a73d..66bed6d 100644 --- a/arch/arm/boot/dts/imx35.dtsi +++ b/arch/arm/boot/dts/imx35.dtsi @@ -298,6 +298,7 @@ interrupts = 37; clocks = clks 73; fsl,usbmisc = usbmisc 0; + usb-phy = usbphy0; status = disabled; }; @@ -307,6 +308,7 @@ interrupts = 35; clocks = clks 73; fsl,usbmisc = usbmisc 1; + usb-phy = usbphy1; status = disabled; }; @@ -355,4 +357,20 @@ }; }; }; + + usbphy { + #address-cells = 1; + #size-cells = 0; + compatible = simple-bus; + + usbphy0: usbphy@0 { + reg = 0; + compatible = usb-nop-xceiv; + }; + + usbphy1: usbphy@1 { + reg = 1; + compatible = usb-nop-xceiv; + }; + }; }; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3][ 9/9] ARM: imx_v4_v5_defconfig: Enable drivers for i.MX25/i.MX35 USB support.
Signed-off-by: Denis Carikli de...@eukrea.com --- Changelog v2-v3: - Extra gadget drivers additions were removed from this patch. Changelog v1-v2: - With the clock fix patches, the usb gadget also work. So I've addeed it to this patch too. - CONFIG_USB_OTG_FSM=y was not needed, so it was removed. --- arch/arm/configs/imx_v4_v5_defconfig |6 ++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/configs/imx_v4_v5_defconfig b/arch/arm/configs/imx_v4_v5_defconfig index f1aeb7d..ec9b365 100644 --- a/arch/arm/configs/imx_v4_v5_defconfig +++ b/arch/arm/configs/imx_v4_v5_defconfig @@ -80,6 +80,7 @@ CONFIG_MTD_UBI=y CONFIG_EEPROM_AT24=y CONFIG_EEPROM_AT25=y CONFIG_ATA=y +CONFIG_BLK_DEV_SD=y CONFIG_PATA_IMX=y CONFIG_NETDEVICES=y CONFIG_CS89x0=y @@ -153,6 +154,11 @@ CONFIG_USB_HID=m CONFIG_USB=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_MXC=y +CONFIG_USB_STORAGE=y +CONFIG_USB_CHIPIDEA=y +CONFIG_USB_CHIPIDEA_UDC=y +CONFIG_USB_CHIPIDEA_HOST=y +CONFIG_NOP_USB_XCEIV=y CONFIG_MMC=y CONFIG_MMC_UNSAFE_RESUME=y CONFIG_MMC_SDHCI=y -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3][ 8/9] ARM: dts: mbimxsd35 baseboard: Add USB support.
Signed-off-by: Denis Carikli de...@eukrea.com --- Changelog v1-v2: - With the clock fix patches, the usb gadget also work. So I've set the otg port to otg instead of host. - Before I forgott to set dr_mode to host in the usbhost port. That is now fixed. --- .../boot/dts/imx35-eukrea-mbimxsd35-baseboard.dts | 13 + 1 file changed, 13 insertions(+) diff --git a/arch/arm/boot/dts/imx35-eukrea-mbimxsd35-baseboard.dts b/arch/arm/boot/dts/imx35-eukrea-mbimxsd35-baseboard.dts index 71197b9..f04ae91 100644 --- a/arch/arm/boot/dts/imx35-eukrea-mbimxsd35-baseboard.dts +++ b/arch/arm/boot/dts/imx35-eukrea-mbimxsd35-baseboard.dts @@ -150,3 +150,16 @@ fsl,uart-has-rtscts; status = okay; }; + +usbhost1 { + phy_type = serial; + dr_mode = host; + status = okay; +}; + +usbotg { + phy_type = utmi; + dr_mode = otg; + external-vbus-divider; + status = okay; +}; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3][ 3/9] usb: chipidea: Use standard usb-phy property.
Hi, Denis Carikli wrote: This converts the Chipidea usbmisc driver to use the standard usb-phy property. [...] diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c index c00f772..9a74100 100644 --- a/drivers/usb/chipidea/ci_hdrc_imx.c +++ b/drivers/usb/chipidea/ci_hdrc_imx.c @@ -130,7 +130,7 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) return ret; } - data-phy = devm_usb_get_phy_by_phandle(pdev-dev, fsl,usbphy, 0); + data-phy = devm_usb_get_phy_by_phandle(pdev-dev, usb-phy, 0); if (IS_ERR(data-phy)) { ret = PTR_ERR(data-phy); goto err_clk; How about accepting the old property too and print a warning, that it is deprecated, rather than breaking all existing DT blobs? Lothar Waßmann -- ___ Ka-Ro electronics GmbH | Pascalstraße 22 | D - 52076 Aachen Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10 Geschäftsführer: Matthias Kaussen Handelsregistereintrag: Amtsgericht Aachen, HRB 4996 www.karo-electronics.de | i...@karo-electronics.de ___ -- 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 3/3] usb: phy-fsm: change | to || for condition OTG_STATE_A_WAIT_BCON at statemachine
From: Peter Chen It is should be condition or not bit or. Signed-off-by: Peter Chen peter.c...@freescale.com --- drivers/usb/phy/phy-fsm-usb.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/usb/phy/phy-fsm-usb.c b/drivers/usb/phy/phy-fsm-usb.c index 0021839..bf5c32f 100644 --- a/drivers/usb/phy/phy-fsm-usb.c +++ b/drivers/usb/phy/phy-fsm-usb.c @@ -315,7 +315,7 @@ int otg_statemachine(struct otg_fsm *fsm) otg_set_state(fsm, OTG_STATE_A_VBUS_ERR); else if (fsm-b_conn) otg_set_state(fsm, OTG_STATE_A_HOST); - else if (fsm-id | fsm-a_bus_drop | fsm-a_wait_bcon_tmout) + else if (fsm-id || fsm-a_bus_drop || fsm-a_wait_bcon_tmout) otg_set_state(fsm, OTG_STATE_A_WAIT_VFALL); break; case OTG_STATE_A_HOST: That rather depends. It might be an optimisation (avoiding branch instructions) if it is normal that all three values will be zero. David -- 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: [PATCHv2] rebind: Add rebind mechanism for runtime-resume
Hello Alan, I applied your patch, then reworked mine in order to use usb_unbind_and_rebind_marked_interfaces. It works great with the combination of this two fixes. I even reproduced the btusb runtime-resume hardware issue which is now handled correctly, interfaces are unbind/rebind. I can provide a new patchset rebased on yours or maybe I should wait for your definitive patch? Thanks Regards, Loic Poulain - Intel Corporation SAS (French simplified joint stock company) Registered headquarters: Les Montalets- 2, rue de Paris, 92196 Meudon Cedex, France Registration Number: 302 456 199 R.C.S. NANTERRE Capital: 4,572,000 Euros This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. -- 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 v3][ 3/9] usb: chipidea: Use standard usb-phy property.
Среда, 12 марта 2014, 11:19 +01:00 от Lothar Waßmann l...@karo-electronics.de: Hi, Denis Carikli wrote: This converts the Chipidea usbmisc driver to use the standard usb-phy property. [...] diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c index c00f772..9a74100 100644 --- a/drivers/usb/chipidea/ci_hdrc_imx.c +++ b/drivers/usb/chipidea/ci_hdrc_imx.c @@ -130,7 +130,7 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) return ret; } - data-phy = devm_usb_get_phy_by_phandle(pdev-dev, fsl,usbphy, 0); + data-phy = devm_usb_get_phy_by_phandle(pdev-dev, usb-phy, 0); if (IS_ERR(data-phy)) { ret = PTR_ERR(data-phy); goto err_clk; How about accepting the old property too and print a warning, that it is deprecated, rather than breaking all existing DT blobs? And this change should be reflected in the bindings documentation. ---
reset_resume() for btusb
Hi, I still think it makes little sense to support reset_resume() in btusb, but if you really want to, you can try this patch. HTH Oliver From 3776765dbd08701c30f45c1849691a16c1077cc3 Mon Sep 17 00:00:00 2001 From: Oliver Neukum oneu...@suse.de Date: Wed, 12 Mar 2014 12:01:13 +0100 Subject: [PATCH] btusb: implement reset_resume() This implements reset_resume() to the extent that this is possible for btusb. It can be done if the HCI is down. In the other cases the host would be thrown out of the network. Signed-off-by: Oliver Neukum oneu...@suse.de --- drivers/bluetooth/btusb.c | 20 1 file changed, 20 insertions(+) diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index baeaaed..e56fa2a 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -1670,6 +1670,25 @@ done: return err; } + +static int btusb_reset_resume(struct usb_interface *intf) +{ + struct btusb_data *data = usb_get_intfdata(intf); + struct hci_dev *hdev = data-hdev; + + /* +* the interface can be recovered only if the HCI +* is not part of a network because the synchronization +* is lost as the device is reset +*/ + if (test_bit(HCI_RUNNING, hdev-flags)) + return -EIO; + + if (hdev-setup) + return (hdev-setup)(hdev); + else + return 0; +} #endif static struct usb_driver btusb_driver = { @@ -1679,6 +1698,7 @@ static struct usb_driver btusb_driver = { #ifdef CONFIG_PM .suspend= btusb_suspend, .resume = btusb_resume, + .reset_resume = btusb_reset_resume, #endif .id_table = btusb_table, .supports_autosuspend = 1, -- 1.8.4.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3][ 5/9] ARM: dts: imx25.dtsi: Fix USB support.
Hi Denis, On Wed, Mar 12, 2014 at 7:01 AM, Denis Carikli de...@eukrea.com wrote: From: Fabio Estevam fabio.este...@freescale.com This patch was adapted from the thread named USB Host support for mx25 on linux-usb@vger.kernel.org As you add me in the From field, you also need to add: Signed-off-by: Fabio Estevam fabio.este...@freescale.com above your Signed-off-by line. Signed-off-by: Denis Carikli de...@eukrea.com + + usbphy { + #address-cells = 1; + #size-cells = 0; + compatible = simple-bus; I made this comment earlier: why do we place usbphy0/1 under simple-bus? This is not documented in the the bindings. + + usbphy0: usbphy@0 { + reg = 0; + compatible = usb-nop-xceiv; + }; + + usbphy1: usbphy@1 { + reg = 1; + compatible = usb-nop-xceiv; + }; + }; Regards, Fabio Estevam -- 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: musb - high CPU load in DMA mode and dropouts during audio playback
On 3/12/2014 5:53 AM, Michal Šmucr wrote: Hi George, I did few more tests and have further details for you. This time i modified my build procedure and according to Felipe's hint, I used ti-linux-3.12.y branch from TI repository and also clean 3.14-rc6 kernel, where i subsequently tried additional unmerged patches. With ti-linux-3.12.y I didn't notice any of CPU usage or stability, 80-90%, dropouts. Latest kernel behaved differently, CPU usage is low and audio after DAC is total rubbish (constant level noise). After playing with additional patches, i've found, that modifications in your third patch for different isochronous packet handling https://lkml.org/lkml/2014/1/24/187 causes high load. So it looks like, without this patch, hrtimer trick for compensation of early interrupt doesn't work and samples gets garbled during transfers (albeit i don't have HW USB analyzer to prove it). Alternative with fifo checking and workqueue, unfortunately hogs CPU. The basic issue is we get the DMA interrupt very early that it takes some time for the packet to flow out from the TX Fifo. In some cases we end up re-scheduling the workqueue multiple times since the TX FIFO is NYET empty. Alternatively do you have any reason not to try out the PIO mode? Thanks, Michal On 27.2.2014 12:18, Michal Šmucr wrote: Hi George, On 27.2.2014 5:15, George Cherian wrote: I too see the backtraces will send a patch soon to fix the same. Thanks, i applied it and most of backtraces was suppressed. Several times i was able to invocate it again, but this time, it was before complete stuck of playback application (kill -9 was only way to end it). From that moment, no other audio playback can be initiated until next reboot. If i tried to remedy situation by replugging of USB interface, it leaded to nice Oops (snippet from serial console is attached). During my testing am not seeing the CPU usage as you mention. That is interesting, i was able to reproduce it whenever i tried that, maybe it could be also some config issue. Just for more complete info, i'm using build scripts by Robert C. Nelson and there are couple other patches applied to kernel before build (now including your previous ISOCH. handling ones) - https://github.com/RobertCNelson/linux-dev/tree/am33x-v3.14/patches , but it doesn't seems related to issue. Could you please share you .config. You'll find it attached. I used aplay for testing playback and arecord for recording using USB headsets. I tried mpd as player, but i'm able to reproduce kworker load also with aplay or alsa built-in speaker-test (eg. speaker-test -c 2 -D plughw:0,0). Regarding hardware i tried few XMOS based UAC2 interfaces and recently also interface with TI PCM2904 USB codec, which could be very close to headset, you tried. It doesn't matter according to my tests. Thanks, Michal -- -George -- 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 v3 13/13] Documentation: ABI: usb: chipidea USB OTG HNP sysfs interface description.
On Thu, Mar 06, 2014 at 12:54:28PM +0800, Peter Chen wrote: On Thu, Feb 27, 2014 at 07:38:31AM +0800, Li Jun wrote: This patch adds sysfs interface description for chipidea USB OTG role switch in HNP. Signed-off-by: Li Jun b47...@freescale.com --- .../ABI/testing/sysfs-platform-chipidea-usb-otg| 55 1 file changed, 55 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-platform-chipidea-usb-otg b/Documentation/ABI/testing/sysfs-platform-chipidea-usb-otg new file mode 100644 index 000..a05414c --- /dev/null +++ b/Documentation/ABI/testing/sysfs-platform-chipidea-usb-otg @@ -0,0 +1,55 @@ +What: /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_req +Date: Feb 2014 +Contact: Li Jun b47...@freescale.com +Description: + Can be set and read. + Set a_bus_req(A-device bus request) input to be 1 if + the Application running on the A-device wants to use the bus, + and to be 0 when the Application no longer wants to use + the bus(or wants to work as peripheral). a_bus_req can also + be set to 1 by kernel in response to remote wakeup signaling + from the B-device, the A-device should decide to resume the bus. + + Valid values are 1 and 0. + + Reading: returns if the Application running on the A-device + is using the bus as host role. return what if the Application? Besides, if there is no special meaning, we'd better use lower-case for Application. I will add more detailed description, which return value for when, thanks! + +What: /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_drop +Date: Feb 2014 +Contact: Li Jun b47...@freescale.com +Description: + Can be set and read + The a_bus_drop(A-device bus drop) input is 1 when the + Application running on the A-device wants to power down + the bus, and is 0 otherwise, When a_bus_drop is 1, then + the a_bus_req shall be 0. + + Valid values are 1 and 0. + + Reading: returns if the bus is off(vbus is turned off). The same question like above. Same update in next version. + +What: /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_drop +Date: Feb 2014 +Contact: Li Jun b47...@freescale.com +Description: + Can be set and read. + The b_bus_req(B-device bus request) input is 1 during the time + that the Application running on the B-device wants to use the + bus as host, and is 0 when the Application no longer wants to + work as host and decides to switch back to be peripheral. + + Valid values are 1 and 0. + + Reading: returns if the Application running on the B device + is using the bus as host role. + +What: /sys/bus/platform/devices/ci_hdrc.0/inputs/a_clr_err +Date: Feb 2014 +Contact: Li Jun b47...@freescale.com +Description: + Only can be set. + The a_clr_err(A-device Vbus error clear) input is used to clear + vbus error, then A device will power down the bus. + + Valid value is 1 -- The same question like above. This is a write only variable, not the same as above. -- 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
Re: MAX3421E: device giving NAKs forever?
David Mosberger wrote: I couldn't figure out how to force UHCI onto an EHCI chip I suggested removing the ehci_hcd driver. Did that work? but I did find I had some old IOGEAR USB 1.1 extenders (USB-over-CAT5 cable) and with those, the device does switch into full-speed mode on my computer: It might not be comparable. [ 886.371122] usb 1-1.3.1.1.4.2: USB disconnect, device number 15 [ 950.960459] usb 1-1.2: new full-speed USB device number 16 using ehci-pci Looks like it's still using the ehci driver. You could use an FX2 data logger like the Logic or any of the 15 USD boards off eBay (the Logic does nothing more than they do) together with http://sigrok.org/ and the libsigrokdecode USB protocol decoder for protocol analysis. It's obviously not a Beagle 480 but could be more than sufficient for full speed. //Peter -- 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 net-next 0/2] parameter modification
Add opportunity to change the default setting and reduce the tx/rx buffers. Hayes Wang (2): r8152: add CONFIG_RTL8152_EARLY_AGG_SUPER r8152: reduce the numbers of the bulks drivers/net/usb/Kconfig | 11 +++ drivers/net/usb/r8152.c | 8 2 files changed, 15 insertions(+), 4 deletions(-) -- 1.8.4.2 -- 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 net-next 2/2] r8152: reduce the numbers of the bulks
It is not necessary to have many transfer buffers. Reduce the number from 10 to 4. Signed-off-by: Hayes Wang hayesw...@realtek.com --- drivers/net/usb/r8152.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 0c43b28..9ff7501 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -419,8 +419,8 @@ enum rtl_register_content { FULL_DUP= 0x01, }; -#define RTL8152_MAX_TX 10 -#define RTL8152_MAX_RX 10 +#define RTL8152_MAX_TX 4 +#define RTL8152_MAX_RX 4 #define INTBUFSIZE 2 #define CRC_SIZE 4 #define TX_ALIGN 4 -- 1.8.4.2 -- 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 net-next 1/2] r8152: add CONFIG_RTL8152_EARLY_AGG_SUPER
For slow CPU, the frequent bulk transfer would cause poor throughput. One solution is to increase the timeout of the aggregation. It let the hw could complete the bulk transfer later and fill more packets into the buffer. Besides, it could reduce the frequency of the bulk transfer efficiently and improve the performance. However, the optimization value of the timeout depends on the capability of the hardware, especially the CPU. For example, according to the experiment, the value 0x0e835000 is better than the default value for the chromebook with the ARM CPU. Now add CONFIG_RTL8152_EARLY_AGG_SUPER to let someone could choose desired timeout value if he wants to get the best performance. Signed-off-by: Hayes Wang hayesw...@realtek.com --- drivers/net/usb/Kconfig | 11 +++ drivers/net/usb/r8152.c | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig index 7e7269f..be6e21d 100644 --- a/drivers/net/usb/Kconfig +++ b/drivers/net/usb/Kconfig @@ -102,6 +102,17 @@ config USB_RTL8152 To compile this driver as a module, choose M here: the module will be called r8152. + menu Aggregation Settings + depends on USB_RTL8152 + + config RTL8152_EARLY_AGG_SUPER + hex rx early agg parameter for super speed + default 0x0e832981 + help + This is the rx early agg parameter for USB super speed. + + endmenu + config USB_USBNET tristate Multi-purpose USB Networking Framework select MII diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index aa1d5b2..0c43b28 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -316,7 +316,7 @@ #define PCUT_STATUS0x0001 /* USB_RX_EARLY_AGG */ -#define EARLY_AGG_SUPPER 0x0e832981 +/* CONFIG_RTL8152_EARLY_AGG_SUPER default is 0x0e832981 */ #define EARLY_AGG_HIGH 0x0e837a12 #define EARLY_AGG_SLOW 0x0e83 @@ -1978,7 +1978,7 @@ static void r8153_set_rx_agg(struct r8152 *tp) ocp_write_dword(tp, MCU_TYPE_USB, USB_RX_BUF_TH, RX_THR_SUPPER); ocp_write_dword(tp, MCU_TYPE_USB, USB_RX_EARLY_AGG, - EARLY_AGG_SUPPER); + CONFIG_RTL8152_EARLY_AGG_SUPER); } else { ocp_write_dword(tp, MCU_TYPE_USB, USB_RX_BUF_TH, RX_THR_HIGH); -- 1.8.4.2 -- 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/3] usb: chipidea: operate on otgsc register in a general way
On Wed, Mar 12, 2014 at 04:14:31PM +0800, Peter Chen wrote: On Wed, Mar 12, 2014 at 02:32:39PM +0800, Li Jun wrote: From: Li Jun b47...@freescale.com Use a more general way to read and write otgsc register. Signed-off-by: Li Jun b47...@freescale.com --- drivers/usb/chipidea/core.c | 19 + drivers/usb/chipidea/otg.c | 48 +++ drivers/usb/chipidea/otg.h | 19 +++-- drivers/usb/chipidea/udc.c | 11 ++ 4 files changed, 65 insertions(+), 32 deletions(-) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index ca6831c..20be020 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -359,16 +359,15 @@ static irqreturn_t ci_irq(int irq, void *data) irqreturn_t ret = IRQ_NONE; u32 otgsc = 0; - if (ci-is_otg) - otgsc = hw_read(ci, OP_OTGSC, ~0); - + otgsc = hw_read_otgsc(ci); /* * Handle id change interrupt, it indicates device/host function * switch. */ if (ci-is_otg (otgsc OTGSC_IDIE) (otgsc OTGSC_IDIS)) { ci-id_event = true; - ci_clear_otg_interrupt(ci, OTGSC_IDIS); + /* Clear ID change irq status */ + hw_set_otgsc_bits(ci, OTGSC_IDIS); disable_irq_nosync(ci-irq); queue_work(ci-wq, ci-work); return IRQ_HANDLED; @@ -380,7 +379,8 @@ static irqreturn_t ci_irq(int irq, void *data) */ if (ci-is_otg (otgsc OTGSC_BSVIE) (otgsc OTGSC_BSVIS)) { ci-b_sess_valid_event = true; - ci_clear_otg_interrupt(ci, OTGSC_BSVIS); + /* Clear BSV irq */ + hw_set_otgsc_bits(ci, OTGSC_BSVIS); disable_irq_nosync(ci-irq); queue_work(ci-wq, ci-work); return IRQ_HANDLED; @@ -502,8 +502,10 @@ static void ci_get_otg_capable(struct ci_hdrc *ci) == (DCCPARAMS_DC | DCCPARAMS_HC)); if (ci-is_otg) { dev_dbg(ci-dev, It is OTG capable controller\n); - ci_disable_otg_interrupt(ci, OTGSC_INT_EN_BITS); - ci_clear_otg_interrupt(ci, OTGSC_INT_STATUS_BITS); + /* Disable all OTG irq */ + hw_clear_otgsc_bits(ci, OTGSC_INT_EN_BITS); + /* Clear all OTG irq status */ + hw_set_otgsc_bits(ci, OTGSC_INT_STATUS_BITS); } } @@ -617,7 +619,8 @@ static int ci_hdrc_probe(struct platform_device *pdev) */ mdelay(2); ci-role = ci_otg_role(ci); - ci_enable_otg_interrupt(ci, OTGSC_IDIE); + /* Enable ID change irq */ + hw_set_otgsc_bits(ci, OTGSC_IDIE); } else { /* * If the controller is not OTG capable, but support diff --git a/drivers/usb/chipidea/otg.c b/drivers/usb/chipidea/otg.c index 39bd7ec..f214ade 100644 --- a/drivers/usb/chipidea/otg.c +++ b/drivers/usb/chipidea/otg.c @@ -24,12 +24,50 @@ #include otg.h /** + * hw_read_otgsc: returns otgsc register + * + * This function returns register data + */ register contents, I copied from drivers/usb/chipidea/ci.h :). will update. +u32 hw_read_otgsc(struct ci_hdrc *ci) +{ + if (ci-is_otg) + return hw_read(ci, OP_OTGSC, ~0); + else + return -ENOTSUPP; +} + +/** + * hw_set_otgsc_bits + * + * This function sets target bits of OTGSC register, + * any bits within OTGSC_INT_STATUS_BITS will be cleared, + * so use this func to clear irq status instead of hw_clear_otgsc_bits. + */ +void hw_set_otgsc_bits(struct ci_hdrc *ci, u32 bits) +{ + if (ci-is_otg) + hw_write(ci, OP_OTGSC, bits | OTGSC_INT_STATUS_BITS, bits); +} + +/** + * hw_clear_otgsc_bits + * + * This function clear target bits of OTGSC register, + * Note:any bits within OTGSC_INT_STATUS_BITS will not be cleared. + */ +void hw_clear_otgsc_bits(struct ci_hdrc *ci, u32 bits) +{ + if (ci-is_otg) + hw_write(ci, OP_OTGSC, bits | OTGSC_INT_STATUS_BITS, 0); +} + - The caller should make sure the otgsc access under the condition of ci-is_otg so do not need to add ci-is_otg at your APIs. In that way, have to add if(ci-is_otg) everywhere access to otgsc register, I should remove all if(ci-is_otg) at calling place in current driver with this patch. Which way you prefer, move out to this API like I do or keep them? Li Jun - It may confuse the user that there are two APIs for writing otgsc, and he must use hw_set_otg_bits to clear interrupt, how about using below two APIs, it more likes current register usage. u32 hw_read_otgsc(struct ci_hdrc *ci, u32 mask) { return hw_read(ci, OP_OTGSC, mask); } For read, I will add mask. void
Re: musb - high CPU load in DMA mode and dropouts during audio playback
Hi George, On 12.3.2014 12:15, George Cherian wrote: So it looks like, without this patch, hrtimer trick for compensation of early interrupt doesn't work and samples gets garbled during transfers (albeit i don't have HW USB analyzer to prove it). Alternative with fifo checking and workqueue, unfortunately hogs CPU. The basic issue is we get the DMA interrupt very early that it takes some time for the packet to flow out from the TX Fifo. In some cases we end up re-scheduling the workqueue multiple times since the TX FIFO is NYET empty. It seems, that rescheduling definitely helped to avoid data corruption. Alternatively do you have any reason not to try out the PIO mode? I already tried that at the beginning of my test as first workaround to remedy audio interface issues. It is best, what i achieved with Sitara SoC, but it is not stable when system is loaded with other things. Practically that means, audio is playing, but when there is for instance song database update from player app, which involves additional network transfers and reading of song tags, it starts to stutter badly. This get worse, when playing high resolution audio (eg. 192k/24bit). So to sum it up, it is not really usable from my tests. Best regards, Michal -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH net-next 1/2] r8152: add CONFIG_RTL8152_EARLY_AGG_SUPER
Hayes Wang hayesw...@realtek.com writes: + config RTL8152_EARLY_AGG_SUPER + hex rx early agg parameter for super speed + default 0x0e832981 + help + This is the rx early agg parameter for USB super speed. + + endmenu How do I as an end user know how to adjust this magic(?) value? Having a config setting like this without further documentation seems completely pointless. Anyone with enough knowledge about the driver and devices will be perfectly capable of editing the driver source anyway. Bjørn -- 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 v3 07/13] usb: chipidea: add OTG fsm operation functions implemenation.
On Thu, Mar 06, 2014 at 04:13:10PM +0800, Peter Chen wrote: On Thu, Mar 06, 2014 at 02:52:17PM +0800, Li Jun wrote: On Wed, Mar 05, 2014 at 04:28:14PM +0800, Peter Chen wrote: On Thu, Feb 27, 2014 at 07:38:25AM +0800, Li Jun wrote: Add OTG HNP and SRP operation functions implementation: - charge vbus - drive vbus - connection signaling - drive sof - start data pulse - add fsm timer - delete fsm timer - start host - start gadget Signed-off-by: Li Jun b47...@freescale.com --- drivers/usb/chipidea/bits.h| 11 ++ drivers/usb/chipidea/ci.h |1 + drivers/usb/chipidea/otg_fsm.c | 231 drivers/usb/chipidea/otg_fsm.h | 23 4 files changed, 266 insertions(+) diff --git a/drivers/usb/chipidea/bits.h b/drivers/usb/chipidea/bits.h index 83d06c1..c42eb35 100644 --- a/drivers/usb/chipidea/bits.h +++ b/drivers/usb/chipidea/bits.h @@ -44,9 +44,14 @@ #define DEVICEADDR_USBADR (0x7FUL 25) /* PORTSC */ +#define PORTSC_CCSBIT(0) +#define PORTSC_CSCBIT(1) +#define PORTSC_PECBIT(3) +#define PORTSC_OCCBIT(5) #define PORTSC_FPRBIT(6) #define PORTSC_SUSP BIT(7) #define PORTSC_HSPBIT(9) +#define PORTSC_PP BIT(12) #define PORTSC_PTC(0x0FUL 16) #define PORTSC_PHCD(d) ((d) ? BIT(22) : BIT(23)) /* PTS and PTW for non lpm version only */ @@ -56,6 +61,9 @@ #define PORTSC_PTWBIT(28) #define PORTSC_STSBIT(29) +#define PORTSC_W1C_BITS \ + (PORTSC_CSC | PORTSC_PEC | PORTSC_OCC) + /* DEVLC */ #define DEVLC_PFSCBIT(23) #define DEVLC_PSPD(0x03UL 25) @@ -71,7 +79,10 @@ #define PTS_HSIC 4 /* OTGSC */ +#define OTGSC_VD BIT(0) +#define OTGSC_VC BIT(1) #define OTGSC_IDPU BIT(5) +#define OTGSC_HADP BIT(6) #define OTGSC_ID BIT(8) #define OTGSC_AVVBIT(9) #define OTGSC_ASVBIT(10) diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h index db6bf30..171b1d2 100644 --- a/drivers/usb/chipidea/ci.h +++ b/drivers/usb/chipidea/ci.h @@ -175,6 +175,7 @@ struct ci_hdrc { enum ci_rolerole; boolis_otg; struct otg_fsm *fsm; + struct ci_otg_fsm_timer_list*fsm_timer; struct work_struct work; struct workqueue_struct *wq; diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c index 904381e..aa24466 100644 --- a/drivers/usb/chipidea/otg_fsm.c +++ b/drivers/usb/chipidea/otg_fsm.c @@ -18,12 +18,242 @@ #include linux/usb/otg.h #include linux/usb/gadget.h #include linux/usb/chipidea.h +#include linux/regulator/consumer.h #include ci.h #include bits.h #include otg.h #include otg_fsm.h +/* Add timer to active timer list */ +static void ci_otg_add_timer(struct ci_hdrc *ci, enum ci_otg_fsm_timer_index t) +{ + struct ci_otg_fsm_timer *tmp_timer; + struct ci_otg_fsm_timer *timer = ci-fsm_timer-timer_list[t]; + struct list_head *active_timers = ci-fsm_timer-active_timers; + + if (t = NUM_CI_OTG_FSM_TIMERS) + return; + + /* +* Check if the timer is already in the active list, +* if so update timer count +*/ + list_for_each_entry(tmp_timer, active_timers, list) + if (tmp_timer == timer) { + timer-count = timer-expires; + return; + } + + timer-count = timer-expires; + list_add_tail(timer-list, active_timers); + + /* Enable 1ms irq */ + if (!(hw_read(ci, OP_OTGSC, OTGSC_1MSIE))) + ci_enable_otg_interrupt(ci, OTGSC_1MSIE); +} + +/* Remove timer from active timer list */ +static void ci_otg_del_timer(struct ci_hdrc *ci, enum ci_otg_fsm_timer_index t) +{ + struct ci_otg_fsm_timer *tmp_timer, *del_tmp; + struct ci_otg_fsm_timer *timer = ci-fsm_timer-timer_list[t]; + struct list_head *active_timers = ci-fsm_timer-active_timers; + int flag = 0; + + if (t = NUM_CI_OTG_FSM_TIMERS) + return; + + list_for_each_entry_safe(tmp_timer, del_tmp, active_timers, list) + if (tmp_timer == timer) { + list_del(timer-list);
Re: [PATCH v3 00/13] Add USB OTG HNP and SRP support on Chipidea usb driver
On Fri, Mar 07, 2014 at 10:32:30AM +0800, Peter Chen wrote: On Thu, Feb 27, 2014 at 07:38:18AM +0800, Li Jun wrote: From: b47624 b47624@ubuntu64bit1204.(none) This patchset adds USB OTG HNP and SRP support on chipidea usb driver, existing OTG port role swtich function by ID pin status kept unchanged, based on that, if select CONFIG_USB_OTG_FSM, OTG HNP and SRP will be supported. The CONFIG_USB_OTG should also be needed? CONFIG_USB_OTG_FSM is selecting CONFIG_USB_OTG. Reference to: On-The-Go and Embedded Host Supplement to the USB Revision 2.0 Specification July 27, 2012 Revision 2.0 version 1.1a Jun, at next time, you can have a patch at Documentation/ to introduce how to do it. It also can be in Documentation/ABI/testing/sysfs-platform-chipidea-usb-otg? How to test HNPSRP with 2 Freescale i.MX6Q sabre SD boards: 1. Power up 2 Freescale i.MX6Q sabre SD boards with gadget class driver loaded (e.g. g_mass_storage). 2. Connect 2 boards with usb cable with one end is micro A plug, the other end is micro B plug. 3. The A device with micro A plug inserted should enumrate B device. If I swap step 1 and step 2, it can't enumerate. Plug out and plug in again can work. Have a check please. That's the required sequence by design, A-device should not release bus before B-device request it. 4. Role switch. On B device: echo 1 /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req if HNP polling patchset is not applied, also need: You can say if HNP polling is not supported OK, will update. On A device: echo 0 /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_req B device should take host role and enumrate A device(peripheral). It works. 5. A device switch back to host. On B device: echo 0 /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req A device should switch back to host and enumrate B device. works. 6. Remove B device and insert again in 10 seconds, A device should enumrate B device again. 7. Remove B device and insert again after 10 seconds, A device should NOT enumrate B device. if A device wants to use bus: On A device: echo 1 /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_req if B device wants to use bus: On B device: echo 1 /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req Works. What does A(B) device wants to use bus? The vbus should always from A device, correct? That means A(B) want to initiate the communication with B(A), yes, vbus always from A-device. 8. A device power down the bus. On A device: echo 1 /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_drop 9. B device do data pulse for SRP. On B device: echo 1 /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req A device usb bus should be resumed and enumrate B device. Works. Peter Changes since v2: - Add ABI document for sysfs input files description: Documentation/ABI/testing/sysfs-platform-chipidea-usb-otg - Add a debug file for show some USB registers value. - Split host driver change to be 2 patches, one for otg_port number init; the other one for vbus control change. - Export interrupt enable and status read functions from udc driver. - Only enable AVV irq in otg fsm init. - Remove duplicated USBSTS bits definitions. - typo correction. - Add HowTo demo role switch with 2 Freescale i.MX6Q sabre SD boards in cover letter. Changes since v1: - Move out HNP polling patch from this series, which will be a seperated patchset followed this one - Change fsm timers global variables to be a structure embeded in ci_hdrc, to make multiple OTG instances can exist in one system - Change some otg fsm functions to be static - Re-split timer init patch to avoid a later patch changing a previous one in the same series - Change timer structure memory allocation to be devm_kzalloc - Update some format alignment and spelling errors Li Jun (13): usb: phy-fsm: update OTG HNP state transition conditions according to OTG and EH 2.0 spec. usb: chipidea: usb OTG fsm initialization. usb: chipidea: host: vbus control change for OTG HNP. usb: chipidea: host: init otg port number. usb: chipidea: udc: driver update for OTG HNP. usb: chipidea: export interrupt enable and status register read functions. usb: chipidea: add OTG fsm operation functions implemenation. usb: chipidea: OTG fsm timers initialization. usb: chipidea: OTG HNP and SRP fsm implementation. usb: chipidea: add sys inputs for OTG fsm input. usb: chipidea: debug: add debug file for OTG variables show. usb: chipidea: debug: add debug file for controller registers dump. Documentation: ABI: usb: chipidea USB OTG HNP sysfs interface description.
Re: [PATCH v3 09/13] usb: chipidea: OTG HNP and SRP fsm implementation.
On Thu, Mar 06, 2014 at 12:36:45PM +0800, Peter Chen wrote: On Thu, Feb 27, 2014 at 07:38:27AM +0800, Li Jun wrote: USB OTG interrupt handling and fsm transition according to USB OTG and EH 2.0, update otg timer timeout handlers. Signed-off-by: Li Jun b47...@freescale.com --- drivers/usb/chipidea/core.c| 10 ++- drivers/usb/chipidea/otg.c |9 +- drivers/usb/chipidea/otg_fsm.c | 191 drivers/usb/chipidea/otg_fsm.h | 18 4 files changed, 225 insertions(+), 3 deletions(-) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index b2e01a2..cbc46c8 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -74,6 +74,7 @@ #include host.h #include debug.h #include otg.h +#include otg_fsm.h /* Controller register map */ static const u8 ci_regs_nolpm[] = { @@ -379,8 +380,12 @@ static irqreturn_t ci_irq(int irq, void *data) irqreturn_t ret = IRQ_NONE; u32 otgsc = 0; - if (ci-is_otg) + if (ci-is_otg) { otgsc = hw_read(ci, OP_OTGSC, ~0); + ret = ci_otg_fsm_irq(ci); + if (ret == IRQ_HANDLED) + return ret; + } /* * Handle id change interrupt, it indicates device/host function @@ -668,6 +673,9 @@ static int ci_hdrc_probe(struct platform_device *pdev) if (ret) goto stop; + if (ci-is_otg) + ci_hdrc_otg_fsm_start(ci); + ret = dbg_create_files(ci); if (!ret) return 0; diff --git a/drivers/usb/chipidea/otg.c b/drivers/usb/chipidea/otg.c index cbf0167..4fb33a2 100644 --- a/drivers/usb/chipidea/otg.c +++ b/drivers/usb/chipidea/otg.c @@ -11,8 +11,8 @@ */ /* - * This file mainly handles otgsc register, it may include OTG operation - * in the future. + * This file mainly handles otgsc register, OTG fsm operations for HNP and SRP + * are also included. */ #include linux/usb/otg.h @@ -77,6 +77,11 @@ static void ci_otg_work(struct work_struct *work) { struct ci_hdrc *ci = container_of(work, struct ci_hdrc, work); + if (!ci_otg_fsm_work(ci)) { + enable_irq(ci-irq); + return; + } + if (ci-id_event) { ci-id_event = false; ci_handle_id_switch(ci); diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c index f9e536b..0601058 100644 --- a/drivers/usb/chipidea/otg_fsm.c +++ b/drivers/usb/chipidea/otg_fsm.c @@ -427,6 +427,197 @@ static struct otg_fsm_ops ci_otg_ops = { .start_gadget = ci_otg_start_gadget, }; +int ci_otg_fsm_work(struct ci_hdrc *ci) +{ + if (!ci-transceiver-otg || !ci-fsm) + return -ENODEV; + + if (otg_statemachine(ci-fsm)) { + if (ci-transceiver-state == OTG_STATE_A_IDLE) { + if (ci-fsm-id) + /* A idle to B idle */ + otg_statemachine(ci-fsm); + else if ((ci-id_event) || (ci-fsm-power_up)) { + ci-id_event = false; + /* A idle to A wait vrise */ + otg_statemachine(ci-fsm); + ci-fsm-power_up = false; + } + } + } + return 0; +} + +static void ci_otg_fsm_event(struct ci_hdrc *ci, struct otg_fsm *fsm) +{ + u32 intr_sts, otg_bsess_vld, port_conn; + + if ((ci == NULL) || (fsm == NULL)) + return; + + intr_sts = hw_read_intr_status(ci); + otg_bsess_vld = hw_read(ci, OP_OTGSC, OTGSC_BSV); + port_conn = hw_read(ci, OP_PORTSC, PORTSC_CCS); + + switch (ci-transceiver-state) { + case OTG_STATE_A_WAIT_BCON: + if (port_conn) { + fsm-b_conn = 1; + fsm-a_bus_req = 1; + disable_irq_nosync(ci-irq); + queue_work(ci-wq, ci-work); + } + break; + case OTG_STATE_B_IDLE: + if (otg_bsess_vld (intr_sts USBi_PCI) port_conn) { + fsm-b_sess_vld = 1; + disable_irq_nosync(ci-irq); + queue_work(ci-wq, ci-work); + } + break; + case OTG_STATE_B_PERIPHERAL: + if ((intr_sts USBi_SLI) port_conn otg_bsess_vld) { + fsm-a_bus_suspend = 1; + disable_irq_nosync(ci-irq); + queue_work(ci-wq, ci-work); + } else if (intr_sts USBi_PCI) { + if (fsm-a_bus_suspend == 1) + fsm-a_bus_suspend = 0; + } + break; + case OTG_STATE_B_HOST: + if ((intr_sts USBi_PCI) !port_conn) { + fsm-a_conn = 0; + fsm-b_bus_req = 0; +
Re: [PATCH 2/3] usb: phy-fsm: update OTG HNP state transition
Hello. On 12-03-2014 12:56, Peter Chen wrote: From: Li Jun b47...@freescale.com According to:On-The-Go and Embedded Host Supplement to the USB Revision 2.0 Specification July 27, 2012 Revision 2.0 version 1.1a - add a_wait_vrise to a_wait_vfall - update condition from a_wait_vrise to a_wait_bcon Signed-off-by: Li Jun b47...@freescale.com --- drivers/usb/phy/phy-fsm-usb.c |6 -- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/usb/phy/phy-fsm-usb.c b/drivers/usb/phy/phy-fsm-usb.c index c47e5a6..0021839 100644 --- a/drivers/usb/phy/phy-fsm-usb.c +++ b/drivers/usb/phy/phy-fsm-usb.c @@ -303,9 +303,11 @@ int otg_statemachine(struct otg_fsm *fsm) otg_set_state(fsm, OTG_STATE_A_WAIT_VRISE); break; case OTG_STATE_A_WAIT_VRISE: - if (fsm-id || fsm-a_bus_drop || fsm-a_vbus_vld || - fsm-a_wait_vrise_tmout) { + if (fsm-a_vbus_vld) { otg_set_state(fsm, OTG_STATE_A_WAIT_BCON); + } else if (fsm-id || fsm-a_bus_drop || + fsm-a_wait_vrise_tmout) { + otg_set_state(fsm, OTG_STATE_A_WAIT_VFALL); } {} not needed in either arm of the *if* statement. See Documentation/CodingStyle. checkpatch.pl used to complain about this. WBR, Sergei -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCHv2] rebind: Add rebind mechanism for runtime-resume
On Wed, 12 Mar 2014, Poulain, Loic wrote: Hello Alan, I applied your patch, then reworked mine in order to use usb_unbind_and_rebind_marked_interfaces. It works great with the combination of this two fixes. I even reproduced the btusb runtime-resume hardware issue which is now handled correctly, interfaces are unbind/rebind. I can provide a new patchset rebased on yours or maybe I should wait for your definitive patch? I will submit my patch, and then you can submit yours to go on top of it. Alan Stern Thanks Regards, Loic Poulain - Intel Corporation SAS (French simplified joint stock company) Registered headquarters: Les Montalets- 2, rue de Paris, 92196 Meudon Cedex, France Registration Number: 302 456 199 R.C.S. NANTERRE Capital: 4,572,000 Euros This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. PS: When you submit your patch, the email message should not contain this warning. -- 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
[PATCHv3] rebind: Add rebind mechanism for runtime-resume
Despite the needs_binding flag, the interface rebind was never done for the PM runtime resume. This patch fixes this issue by triggering the rebind in usb runtime resume. The rebind procedure needs to be called with the device lock. However, depending the call path (remote wakeup, local resume), the device lock may or may not already be held in usb runtime resume. So, use a work queue to take the lock unconditionally. Signed-off-by: Loic Poulain loic.poul...@intel.com --- drivers/usb/core/driver.c | 12 drivers/usb/core/usb.c| 14 ++ include/linux/usb.h | 2 ++ 3 files changed, 28 insertions(+) diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index a9f636e..5d5df85 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c @@ -1773,11 +1773,23 @@ int usb_runtime_resume(struct device *dev) { struct usb_device *udev = to_usb_device(dev); int status; + struct usb_interface*intf; + int i; /* Runtime resume for a USB device means resuming both the device * and all its interfaces. */ status = usb_resume_both(udev, PMSG_AUTO_RESUME); + + /* Schedule a safe device locked rebind if necessary */ + for (i = 0; i udev-actconfig-desc.bNumInterfaces; i++) { + intf = udev-actconfig-interface[i]; + if (intf-needs_binding) { + schedule_work(udev-rebind_ws); + break; + } + } + return status; } diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 4d11449..a807e51 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c @@ -265,6 +265,7 @@ static void usb_release_dev(struct device *dev) udev = to_usb_device(dev); hcd = bus_to_hcd(udev-bus); + cancel_work_sync(udev-rebind_ws); usb_destroy_configuration(udev); usb_release_bos_descriptor(udev); usb_put_hcd(hcd); @@ -386,6 +387,17 @@ static unsigned usb_bus_is_wusb(struct usb_bus *bus) return hcd-wireless; } +/* Internal function to queue device's interfaces rebind */ +static void usb_queue_rebind_interfaces(struct work_struct *ws) +{ + int rc; + struct usb_device *udev = + container_of(ws, struct usb_device, rebind_ws); + + usb_lock_device(udev); + usb_unbind_and_rebind_marked_interfaces(udev); + usb_unlock_device(udev); +} /** * usb_alloc_dev - usb device constructor (usbcore-internal) @@ -487,6 +499,8 @@ struct usb_device *usb_alloc_dev(struct usb_device *parent, dev-parent = parent; INIT_LIST_HEAD(dev-filelist); + INIT_WORK(dev-rebind_ws, usb_queue_rebind_interfaces); + #ifdef CONFIG_PM pm_runtime_set_autosuspend_delay(dev-dev, usb_autosuspend_delay * 1000); diff --git a/include/linux/usb.h b/include/linux/usb.h index 512ab16..1ee363c 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -502,6 +502,7 @@ struct usb3_lpm_parameters { * to keep track of the number of functions that require USB 3.0 Link Power * Management to be disabled for this usb_device. This count should only * be manipulated by those functions, with the bandwidth_mutex is held. + * @rebind_ws: used for scheduling interface rebind with device lock * * Notes: * Usbcore drivers should not set usbdev-state directly. Instead use @@ -581,6 +582,7 @@ struct usb_device { struct usb3_lpm_parameters u1_params; struct usb3_lpm_parameters u2_params; unsigned lpm_disable_count; + struct work_struct rebind_ws; }; #defineto_usb_device(d) container_of(d, struct usb_device, dev) -- 1.8.3.2 - Intel Corporation SAS (French simplified joint stock company) Registered headquarters: Les Montalets- 2, rue de Paris, 92196 Meudon Cedex, France Registration Number: 302 456 199 R.C.S. NANTERRE Capital: 4,572,000 Euros This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. -- 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: MAX3421E: device giving NAKs forever?
On Wed, Mar 12, 2014 at 6:21 AM, Peter Stuge pe...@stuge.se wrote: David Mosberger wrote: I couldn't figure out how to force UHCI onto an EHCI chip I suggested removing the ehci_hcd driver. Did that work? Nope. UHCI was loaded but it didn't recognize any UHCI-compatible chips so I was left without any USB devices (not even keyboard). but I did find I had some old IOGEAR USB 1.1 extenders (USB-over-CAT5 cable) and with those, the device does switch into full-speed mode on my computer: It might not be comparable. I just need proof that the devices can be operated properly with full-speed transactions only. As long as it does that, I should be fine. --david [ 886.371122] usb 1-1.3.1.1.4.2: USB disconnect, device number 15 [ 950.960459] usb 1-1.2: new full-speed USB device number 16 using ehci-pci Looks like it's still using the ehci driver. You could use an FX2 data logger like the Logic or any of the 15 USD boards off eBay (the Logic does nothing more than they do) together with http://sigrok.org/ and the libsigrokdecode USB protocol decoder for protocol analysis. It's obviously not a Beagle 480 but could be more than sufficient for full speed. //Peter -- eGauge Systems LLC, http://egauge.net/, 1.877-EGAUGE1, fax 720.545.9768 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH RESEND] usb: at91-udc: fix irq and iomem resource retrieval
On 12/02/2014 14:03, Nicolas Ferre : From: Jean-Jacques Hiblot jjhib...@traphandler.com When using dt resources retrieval (interrupts and reg properties) there is no predefined order for these resources in the platform dev resource table. Also don't expect the number of resource to be always 2. Signed-off-by: Jean-Jacques Hiblot jjhib...@traphandler.com Acked-by: Boris BREZILLON b.brezil...@overkiz.com Acked-by: Nicolas Ferre nicolas.fe...@atmel.com Cc: stable sta...@vger.kernel.org # 3.4 Gentle ping, after having resent the patch itself. --- drivers/usb/gadget/at91_udc.c | 10 -- 1 file changed, 10 deletions(-) diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c index cea8c20a1425..1926925a52a9 100644 --- a/drivers/usb/gadget/at91_udc.c +++ b/drivers/usb/gadget/at91_udc.c @@ -1709,16 +1709,6 @@ static int at91udc_probe(struct platform_device *pdev) return -ENODEV; } - if (pdev-num_resources != 2) { - DBG(invalid num_resources\n); - return -ENODEV; - } - if ((pdev-resource[0].flags != IORESOURCE_MEM) - || (pdev-resource[1].flags != IORESOURCE_IRQ)) { - DBG(invalid resource type\n); - return -ENODEV; - } - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) return -ENXIO; -- Nicolas Ferre -- 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: reset_resume() for btusb
My thought was to fix the usbcore rebind issue (with pm_runtime) to let the core unbind and rebind the device's interfaces for drivers with no reset_resume callback (not only btusb). Implementing the btusb reset_resume seems risky, a patch implementing this callback has been previously reverted due to HID dual mode device regression. (cf https://lkml.org/lkml/2013/11/26/347) Regards, Loic Poulain From: Oliver Neukum [oneu...@suse.de] Sent: Wednesday, March 12, 2014 12:03 PM To: Poulain, Loic Cc: linux-usb@vger.kernel.org Subject: reset_resume() for btusb Hi, I still think it makes little sense to support reset_resume() in btusb, but if you really want to, you can try this patch. HTH Oliver From 3776765dbd08701c30f45c1849691a16c1077cc3 Mon Sep 17 00:00:00 2001 From: Oliver Neukum oneu...@suse.de Date: Wed, 12 Mar 2014 12:01:13 +0100 Subject: [PATCH] btusb: implement reset_resume() This implements reset_resume() to the extent that this is possible for btusb. It can be done if the HCI is down. In the other cases the host would be thrown out of the network. Signed-off-by: Oliver Neukum oneu...@suse.de --- drivers/bluetooth/btusb.c | 20 1 file changed, 20 insertions(+) diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index baeaaed..e56fa2a 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -1670,6 +1670,25 @@ done: return err; } + +static int btusb_reset_resume(struct usb_interface *intf) +{ + struct btusb_data *data = usb_get_intfdata(intf); + struct hci_dev *hdev = data-hdev; + + /* +* the interface can be recovered only if the HCI +* is not part of a network because the synchronization +* is lost as the device is reset +*/ + if (test_bit(HCI_RUNNING, hdev-flags)) + return -EIO; + + if (hdev-setup) + return (hdev-setup)(hdev); + else + return 0; +} #endif static struct usb_driver btusb_driver = { @@ -1679,6 +1698,7 @@ static struct usb_driver btusb_driver = { #ifdef CONFIG_PM .suspend= btusb_suspend, .resume = btusb_resume, + .reset_resume = btusb_reset_resume, #endif .id_table = btusb_table, .supports_autosuspend = 1, -- 1.8.4.5 - Intel Corporation SAS (French simplified joint stock company) Registered headquarters: Les Montalets- 2, rue de Paris, 92196 Meudon Cedex, France Registration Number: 302 456 199 R.C.S. NANTERRE Capital: 4,572,000 Euros This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] USB: unbind all interfaces before rebinding any
When a driver doesn't have pre_reset, post_reset, or reset_resume methods, the USB core unbinds that driver when its device undergoes a reset or a reset-resume, and then rebinds it afterward. The existing straightforward implementation can lead to problems, because each interface gets unbound and rebound before the next interface is handled. If a driver claims additional interfaces, the claim may fail because the old binding instance may still own the additional interface when the new instance tries to claim it. This patch fixes the problem by first unbinding all the interfaces that are marked (i.e., their needs_binding flag is set) and then rebinding all of them. The patch also makes the helper functions in driver.c a little more uniform and adjusts some out-of-date comments. Signed-off-by: Alan Stern st...@rowland.harvard.edu Reported-and-tested-by: Poulain, Loic loic.poul...@intel.com CC: sta...@vger.kernel.org --- [as1742] drivers/usb/core/driver.c | 94 +++--- drivers/usb/core/hub.c|5 +- drivers/usb/core/usb.h|2 3 files changed, 60 insertions(+), 41 deletions(-) Index: usb-3.14/drivers/usb/core/usb.h === --- usb-3.14.orig/drivers/usb/core/usb.h +++ usb-3.14/drivers/usb/core/usb.h @@ -56,7 +56,7 @@ extern int usb_match_one_id_intf(struct extern int usb_match_device(struct usb_device *dev, const struct usb_device_id *id); extern void usb_forced_unbind_intf(struct usb_interface *intf); -extern void usb_rebind_intf(struct usb_interface *intf); +extern void usb_unbind_and_rebind_marked_interfaces(struct usb_device *udev); extern int usb_hub_claim_port(struct usb_device *hdev, unsigned port, struct dev_state *owner); Index: usb-3.14/drivers/usb/core/hub.c === --- usb-3.14.orig/drivers/usb/core/hub.c +++ usb-3.14/drivers/usb/core/hub.c @@ -5345,10 +5345,11 @@ int usb_reset_device(struct usb_device * else if (cintf-condition == USB_INTERFACE_BOUND) rebind = 1; + if (rebind) + cintf-needs_binding = 1; } - if (ret == 0 rebind) - usb_rebind_intf(cintf); } + usb_unbind_and_rebind_marked_interfaces(udev); } usb_autosuspend_device(udev); Index: usb-3.14/drivers/usb/core/driver.c === --- usb-3.14.orig/drivers/usb/core/driver.c +++ usb-3.14/drivers/usb/core/driver.c @@ -980,8 +980,7 @@ EXPORT_SYMBOL_GPL(usb_deregister); * it doesn't support pre_reset/post_reset/reset_resume or * because it doesn't support suspend/resume. * - * The caller must hold @intf's device's lock, but not its pm_mutex - * and not @intf-dev.sem. + * The caller must hold @intf's device's lock, but not @intf's lock. */ void usb_forced_unbind_intf(struct usb_interface *intf) { @@ -994,16 +993,37 @@ void usb_forced_unbind_intf(struct usb_i intf-needs_binding = 1; } +/* + * Unbind drivers for @udev's marked interfaces. These interfaces have + * the needs_binding flag set, for example by usb_resume_interface(). + * + * The caller must hold @udev's device lock. + */ +static void unbind_marked_interfaces(struct usb_device *udev) +{ + struct usb_host_config *config; + int i; + struct usb_interface*intf; + + config = udev-actconfig; + if (config) { + for (i = 0; i config-desc.bNumInterfaces; ++i) { + intf = config-interface[i]; + if (intf-dev.driver intf-needs_binding) + usb_forced_unbind_intf(intf); + } + } +} + /* Delayed forced unbinding of a USB interface driver and scan * for rebinding. * - * The caller must hold @intf's device's lock, but not its pm_mutex - * and not @intf-dev.sem. + * The caller must hold @intf's device's lock, but not @intf's lock. * * Note: Rebinds will be skipped if a system sleep transition is in * progress and the PM complete callback hasn't occurred yet. */ -void usb_rebind_intf(struct usb_interface *intf) +static void usb_rebind_intf(struct usb_interface *intf) { int rc; @@ -1020,68 +1040,66 @@ void usb_rebind_intf(struct usb_interfac } } -#ifdef CONFIG_PM - -/* Unbind drivers for @udev's interfaces that don't support suspend/resume - * There is no check for reset_resume here because it can be determined - * only during resume whether reset_resume is needed. +/* + * Rebind drivers to @udev's marked interfaces. These interfaces have + * the needs_binding flag set. * * The caller must
Re: [PATCH RESEND] usb: at91-udc: fix irq and iomem resource retrieval
On Wed, Mar 12, 2014 at 03:57:48PM +0100, Nicolas Ferre wrote: On 12/02/2014 14:03, Nicolas Ferre : From: Jean-Jacques Hiblot jjhib...@traphandler.com When using dt resources retrieval (interrupts and reg properties) there is no predefined order for these resources in the platform dev resource table. Also don't expect the number of resource to be always 2. Signed-off-by: Jean-Jacques Hiblot jjhib...@traphandler.com Acked-by: Boris BREZILLON b.brezil...@overkiz.com Acked-by: Nicolas Ferre nicolas.fe...@atmel.com Cc: stable sta...@vger.kernel.org # 3.4 Gentle ping, after having resent the patch itself. It helps if you send it to the correct maintainer, remember, scripts/get_maintainer.pl is your friend... -- 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: MAX3421E: device giving NAKs forever?
David Mosberger wrote: I couldn't figure out how to force UHCI onto an EHCI chip I suggested removing the ehci_hcd driver. Did that work? Nope. UHCI was loaded but it didn't recognize any UHCI-compatible chips so I was left without any USB devices (not even keyboard). Hmmm. Did you unload ehci_hcd after it had been loaded once, or boot a kernel which didn't include ehci_hcd in the first place? You might need to do the latter. lspci should show the UHCI companion controllers on the PCI bus. (OHCI is also allowed by the EHCI spec, so maybe this is it? Check lspci. Then include ohci_hcd instead.) but I did find I had some old IOGEAR USB 1.1 extenders (USB-over-CAT5 cable) and with those, the device does switch into full-speed mode on my computer: It might not be comparable. I just need proof that the devices can be operated properly with full-speed transactions only. As long as it does that, I should be fine. I'm afraid that it will be more complicated than that. I would make sure to try many different full-speed host controllers. Connecting to the root port of an EHCI controller connects directly to the companion controller for that port, when no ehci_hcd was present in the system since boot. //Peter -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH RESEND] usb: at91-udc: fix irq and iomem resource retrieval
On 12/03/2014 16:31, Greg Kroah-Hartman : On Wed, Mar 12, 2014 at 03:57:48PM +0100, Nicolas Ferre wrote: On 12/02/2014 14:03, Nicolas Ferre : From: Jean-Jacques Hiblot jjhib...@traphandler.com When using dt resources retrieval (interrupts and reg properties) there is no predefined order for these resources in the platform dev resource table. Also don't expect the number of resource to be always 2. Signed-off-by: Jean-Jacques Hiblot jjhib...@traphandler.com Acked-by: Boris BREZILLON b.brezil...@overkiz.com Acked-by: Nicolas Ferre nicolas.fe...@atmel.com Cc: stable sta...@vger.kernel.org # 3.4 Gentle ping, after having resent the patch itself. It helps if you send it to the correct maintainer, remember, scripts/get_maintainer.pl is your friend... Indeed. I add Felipe to my next attempt: sorry for the (repeated) noise. Bye, -- Nicolas Ferre -- 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 RESEND] usb: at91-udc: fix irq and iomem resource retrieval
From: Jean-Jacques Hiblot jjhib...@traphandler.com When using dt resources retrieval (interrupts and reg properties) there is no predefined order for these resources in the platform dev resource table. Also don't expect the number of resource to be always 2. Signed-off-by: Jean-Jacques Hiblot jjhib...@traphandler.com Acked-by: Boris BREZILLON b.brezil...@overkiz.com Acked-by: Nicolas Ferre nicolas.fe...@atmel.com Cc: stable sta...@vger.kernel.org # 3.4 --- drivers/usb/gadget/at91_udc.c | 10 -- 1 file changed, 10 deletions(-) diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c index cea8c20a1425..1926925a52a9 100644 --- a/drivers/usb/gadget/at91_udc.c +++ b/drivers/usb/gadget/at91_udc.c @@ -1709,16 +1709,6 @@ static int at91udc_probe(struct platform_device *pdev) return -ENODEV; } - if (pdev-num_resources != 2) { - DBG(invalid num_resources\n); - return -ENODEV; - } - if ((pdev-resource[0].flags != IORESOURCE_MEM) - || (pdev-resource[1].flags != IORESOURCE_IRQ)) { - DBG(invalid resource type\n); - return -ENODEV; - } - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) return -ENXIO; -- 1.8.2.2 -- 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: MAX3421E: device giving NAKs forever?
On Wed, 12 Mar 2014, Peter Stuge wrote: David Mosberger wrote: I couldn't figure out how to force UHCI onto an EHCI chip I suggested removing the ehci_hcd driver. Did that work? Nope. UHCI was loaded but it didn't recognize any UHCI-compatible chips so I was left without any USB devices (not even keyboard). Hmmm. Did you unload ehci_hcd after it had been loaded once, or boot a kernel which didn't include ehci_hcd in the first place? You might need to do the latter. lspci should show the UHCI companion controllers on the PCI bus. (OHCI is also allowed by the EHCI spec, so maybe this is it? Check lspci. Then include ohci_hcd instead.) Peter, David's computer doesn't have any UHCI controllers. Everything is handled by EHCI, through a hub on the motherboard. This is the standard design for current Intel systems. but I did find I had some old IOGEAR USB 1.1 extenders (USB-over-CAT5 cable) and with those, the device does switch into full-speed mode on my computer: It might not be comparable. I just need proof that the devices can be operated properly with full-speed transactions only. As long as it does that, I should be fine. I'm afraid that it will be more complicated than that. I would make sure to try many different full-speed host controllers. Connecting to the root port of an EHCI controller connects directly to the companion controller for that port, when no ehci_hcd was present in the system since boot. David's computer has no companion controller. 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: [PATCH] xhci: extend quirk for Renesas cards
On Mon, Mar 10, 2014 at 01:09:04PM +, David Laight wrote: From: Mathias Nyman On 03/09/2014 04:20 PM, Igor Gnatenko wrote: After suspend another Renesas PCI-X USB 3.0 card doesn't work. 03:00.0 USB controller [0c03]: Renesas Technology Corp. uPD720202 USB 3.0 Host Controller [1912:0015] (rev 02) (prog-if 30 [XHCI]) ... diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index 04f986d..13d4add 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c @@ -143,9 +143,7 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) xhci-quirks |= XHCI_TRUST_TX_LENGTH; } if (pdev-vendor == PCI_VENDOR_ID_RENESAS - pdev-device == 0x0015 - pdev-subsystem_vendor == PCI_VENDOR_ID_SAMSUNG - pdev-subsystem_device == 0xc0cd) + pdev-device == 0x0015) xhci-quirks |= XHCI_RESET_ON_RESUME; if (pdev-vendor == PCI_VENDOR_ID_VIA) xhci-quirks |= XHCI_RESET_ON_RESUME; This will set the resume quirk for all devices with a Renesas uPD720202 host. Do they all need this quirk, or should just this card manufacturer be added to the quirk? (subsystem vendor/device) Given the number of systems that seem to need this quirk, it is almost worth reversing the quick? No, we should avoid applying this quirk to all systems. ISTR there was a system where it caused grief? The behavior of the quirk itself causes users grief. When the host is reset on resume from suspend, we tell the USB core the host lost power. The core will then disconnect all USB devices and re-enumerate them. If we apply this quirk broadly, we increase the time to bring up USB devices on resume (which is critical for mobile systems), and USB storage devices will be re-enumerated. Without this quirk, I can start watching a movie stored on a USB hard drive device, suspend the laptop, resume it, and the movie will continue playing. With this quirk, the storage device will re-enumerated as a new block device, and the movie will stop playing on resume. So, I would like to limit the impact of this quirk as much as possible. I wish I had limited it further to specific Etron and VIA versions; maybe we can dig that information out of the original bug reports and limit it to only impacted revisions. Although it might be that some delays have been added that fix that. I think you're remembering a different quirk? 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: MAX3421E: device giving NAKs forever?
Alan Stern wrote: lspci should show the UHCI companion controllers on the PCI bus. Peter, David's computer doesn't have any UHCI controllers. Everything is handled by EHCI, through a hub on the motherboard. This is the standard design for current Intel systems. Thanks, I understand. I wouldn't use a system like that for this test, just to be sure. //Peter -- 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 net-next 8/9] lg-vl600: Convert uses of __constant_foo to foo
The use of __constant_foo has been unnecessary for quite awhile now. Make these uses consistent with the rest of the kernel. Signed-off-by: Joe Perches j...@perches.com --- drivers/net/usb/lg-vl600.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/usb/lg-vl600.c b/drivers/net/usb/lg-vl600.c index acfcc32..8f37efd 100644 --- a/drivers/net/usb/lg-vl600.c +++ b/drivers/net/usb/lg-vl600.c @@ -210,7 +210,7 @@ static int vl600_rx_fixup(struct usbnet *dev, struct sk_buff *skb) * (0x86dd) so Linux can understand it. */ if ((buf-data[sizeof(*ethhdr)] 0xf0) == 0x60) - ethhdr-h_proto = __constant_htons(ETH_P_IPV6); + ethhdr-h_proto = htons(ETH_P_IPV6); } if (count) { -- 1.8.1.2.459.gbcd45b4.dirty -- 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 net-next 0/9] drivers/net: Convert uses of __constant_foo to foo
Joe Perches (9): brocade: Convert uses of __constant_foo to foo e100: Convert uses of __constant_foo to foo igb: Convert uses of __constant_foo to foo igbvf: Convert uses of __constant_foo to foo ixgbe: Convert uses of __constant_foo to foo ixgbevf: Convert uses of __constant_foo to foo xilinx: Convert uses of __constant_foo to foo lg-vl600: Convert uses of __constant_foo to foo ath9k: Convert uses of __constant_foo to foo drivers/net/ethernet/brocade/bna/bnad.c | 16 +--- drivers/net/ethernet/intel/e100.c | 4 +-- drivers/net/ethernet/intel/igb/igb_main.c | 12 - drivers/net/ethernet/intel/igbvf/netdev.c | 4 +-- drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c | 8 +++--- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 30 +++ drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 4 +-- drivers/net/ethernet/xilinx/ll_temac_main.c | 4 +-- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 2 +- drivers/net/usb/lg-vl600.c| 2 +- drivers/net/wireless/ath/ath9k/ar9003_eeprom.c| 4 +-- 11 files changed, 43 insertions(+), 47 deletions(-) -- 1.8.1.2.459.gbcd45b4.dirty -- 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 v3 5/8] ARM: OMAP5: hwmod: Add ocp2scp3 and sata hwmods
* Roger Quadros rog...@ti.com [140307 02:18]: From: Keshava Munegowda keshava_mgo...@ti.com Create hwmods for ocp2scp3 and sata modules. Paul, does this look OK to you? Regards, Tony [Roger Q] Clean up. CC: Benoit Cousson bcous...@baylibre.com CC: Paul Walmsley p...@pwsan.com CC: Tony Lindgren t...@atomide.com Signed-off-by: Balaji T K balaj...@ti.com Signed-off-by: Roger Quadros rog...@ti.com --- arch/arm/mach-omap2/omap_hwmod_54xx_data.c | 73 ++ 1 file changed, 73 insertions(+) diff --git a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c index e297d62..227a69f 100644 --- a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c @@ -1726,6 +1726,77 @@ static struct omap_hwmod omap54xx_wd_timer2_hwmod = { }, }; +/* + * 'ocp2scp' class + * bridge to transform ocp interface protocol to scp (serial control port) + * protocol + */ +/* ocp2scp3 */ +static struct omap_hwmod omap54xx_ocp2scp3_hwmod; +/* l4_cfg - ocp2scp3 */ +static struct omap_hwmod_ocp_if omap54xx_l4_cfg__ocp2scp3 = { + .master = omap54xx_l4_cfg_hwmod, + .slave = omap54xx_ocp2scp3_hwmod, + .clk= l4_root_clk_div, + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +static struct omap_hwmod omap54xx_ocp2scp3_hwmod = { + .name = ocp2scp3, + .class = omap54xx_ocp2scp_hwmod_class, + .clkdm_name = l3init_clkdm, + .prcm = { + .omap4 = { + .clkctrl_offs = OMAP54XX_CM_L3INIT_OCP2SCP3_CLKCTRL_OFFSET, + .context_offs = OMAP54XX_RM_L3INIT_OCP2SCP3_CONTEXT_OFFSET, + .modulemode = MODULEMODE_HWCTRL, + }, + }, +}; + +/* + * 'sata' class + * sata: serial ata interface gen2 compliant ( 1 rx/ 1 tx) + */ + +static struct omap_hwmod_class_sysconfig omap54xx_sata_sysc = { + .sysc_offs = 0x, + .sysc_flags = (SYSC_HAS_MIDLEMODE | SYSC_HAS_SIDLEMODE), + .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | +SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO | +MSTANDBY_SMART | MSTANDBY_SMART_WKUP), + .sysc_fields= omap_hwmod_sysc_type2, +}; + +static struct omap_hwmod_class omap54xx_sata_hwmod_class = { + .name = sata, + .sysc = omap54xx_sata_sysc, +}; + +/* sata */ +static struct omap_hwmod omap54xx_sata_hwmod = { + .name = sata, + .class = omap54xx_sata_hwmod_class, + .clkdm_name = l3init_clkdm, + .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY, + .main_clk = func_48m_fclk, + .mpu_rt_idx = 1, + .prcm = { + .omap4 = { + .clkctrl_offs = OMAP54XX_CM_L3INIT_SATA_CLKCTRL_OFFSET, + .context_offs = OMAP54XX_RM_L3INIT_SATA_CONTEXT_OFFSET, + .modulemode = MODULEMODE_SWCTRL, + }, + }, +}; + +/* l4_cfg - sata */ +static struct omap_hwmod_ocp_if omap54xx_l4_cfg__sata = { + .master = omap54xx_l4_cfg_hwmod, + .slave = omap54xx_sata_hwmod, + .clk= l3_iclk_div, + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; /* * Interfaces @@ -2399,6 +2470,8 @@ static struct omap_hwmod_ocp_if *omap54xx_hwmod_ocp_ifs[] __initdata = { omap54xx_l4_cfg__usb_tll_hs, omap54xx_l4_cfg__usb_otg_ss, omap54xx_l4_wkup__wd_timer2, + omap54xx_l4_cfg__ocp2scp3, + omap54xx_l4_cfg__sata, NULL, }; -- 1.8.3.2 -- 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 v2] xhci: extend quirk for Renesas cards
Mathias, this is fine to apply as-is. Since it's after -rc6, Greg's tree is probably now frozen. Stick this patch in your queue for usb-linus, mark it for stable, and send it off once 3.15-rc1 is out. Igor, please do not add Signed-off-by lines unless the developer explicitly types those words. Same with Acked-by lines. Sarah Sharp On Wed, Mar 12, 2014 at 11:16:24AM +0400, Igor Gnatenko wrote: After suspend another Renesas PCI-X USB 3.0 card doesn't work. [root@fedora-20 ~]# lspci -vmnnd 1912: Device: 03:00.0 Class:USB controller [0c03] Vendor: Renesas Technology Corp. [1912] Device: uPD720202 USB 3.0 Host Controller [0015] SVendor: Renesas Technology Corp. [1912] SDevice: uPD720202 USB 3.0 Host Controller [0015] Rev: 02 ProgIf: 30 Reported-and-tested-by: Anatoly Kharchenko rfr-b...@yandex.ru Reference: http://redmine.russianfedora.pro/issues/1315 Signed-off-by: Igor Gnatenko i.gnatenko.br...@gmail.com Signed-off-by: Mathias Nyman mathias.ny...@linux.intel.com --- drivers/usb/host/xhci-pci.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index 04f986d..13d4add 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c @@ -143,9 +143,7 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) xhci-quirks |= XHCI_TRUST_TX_LENGTH; } if (pdev-vendor == PCI_VENDOR_ID_RENESAS - pdev-device == 0x0015 - pdev-subsystem_vendor == PCI_VENDOR_ID_SAMSUNG - pdev-subsystem_device == 0xc0cd) + pdev-device == 0x0015) xhci-quirks |= XHCI_RESET_ON_RESUME; if (pdev-vendor == PCI_VENDOR_ID_VIA) xhci-quirks |= XHCI_RESET_ON_RESUME; -- 1.9.0 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- 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/7] USB: serial: continue to write on errors
Do not discard buffered data and make sure to try to resubmit the write urbs on errors. Currently a recoverable error would lead to more data than necessary being dropped. Also upgrade error messages from debug to error log level. Signed-off-by: Johan Hovold jhov...@gmail.com --- drivers/usb/serial/generic.c | 29 +++-- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index d7f39ea7d6ac..33d7f4092308 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c @@ -397,7 +397,6 @@ void usb_serial_generic_write_bulk_callback(struct urb *urb) { unsigned long flags; struct usb_serial_port *port = urb-context; - int status = urb-status; int i; for (i = 0; i ARRAY_SIZE(port-write_urbs); ++i) @@ -409,17 +408,27 @@ void usb_serial_generic_write_bulk_callback(struct urb *urb) set_bit(i, port-write_urbs_free); spin_unlock_irqrestore(port-lock, flags); - if (status) { - dev_dbg(port-dev, %s - non-zero urb status: %d\n, - __func__, status); - - spin_lock_irqsave(port-lock, flags); - kfifo_reset_out(port-write_fifo); - spin_unlock_irqrestore(port-lock, flags); - } else { - usb_serial_generic_write_start(port, GFP_ATOMIC); + switch (urb-status) { + case 0: + break; + case -ENOENT: + case -ECONNRESET: + case -ESHUTDOWN: + dev_dbg(port-dev, %s - urb stopped: %d\n, + __func__, urb-status); + return; + case -EPIPE: + dev_err_console(port, %s - urb stopped: %d\n, + __func__, urb-status); + return; + default: + dev_err_console(port, %s - nonzero urb status: %d\n, + __func__, urb-status); + goto resubmit; } +resubmit: + usb_serial_generic_write_start(port, GFP_ATOMIC); usb_serial_port_softint(port); } EXPORT_SYMBOL_GPL(usb_serial_generic_write_bulk_callback); -- 1.8.3.2 -- 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/7] USB: cypress_m8: fix potential scheduling while atomic
Remove erroneous call to usb_clear_halt which is blocking and cannot be used in interrupt context. This code has possibly never been executed as it would cause an oops if it was. Simply treat a stalled-endpoint error as any other error condition. Cc: stable sta...@vger.kernel.org Signed-off-by: Johan Hovold jhov...@gmail.com --- drivers/usb/serial/cypress_m8.c | 19 +++ 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index bccb1223143a..634f0d6605ed 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c @@ -1224,7 +1224,6 @@ static void cypress_write_int_callback(struct urb *urb) struct usb_serial_port *port = urb-context; struct cypress_private *priv = usb_get_serial_port_data(port); struct device *dev = urb-dev-dev; - int result; int status = urb-status; switch (status) { @@ -1239,21 +1238,9 @@ static void cypress_write_int_callback(struct urb *urb) __func__, status); priv-write_urb_in_use = 0; return; - case -EPIPE: /* no break needed; clear halt and resubmit */ - if (!priv-comm_is_ok) - break; - usb_clear_halt(port-serial-dev, 0x02); - /* error in the urb, so we have to resubmit it */ - dev_dbg(dev, %s - nonzero write bulk status received: %d\n, - __func__, status); - port-interrupt_out_urb-transfer_buffer_length = 1; - result = usb_submit_urb(port-interrupt_out_urb, GFP_ATOMIC); - if (!result) - return; - dev_err(dev, %s - failed resubmitting write urb, error %d\n, - __func__, result); - cypress_set_dead(port); - break; + case -EPIPE: + /* Cannot call usb_clear_halt while in_interrupt */ + /* FALLTHROUGH */ default: dev_err(dev, %s - unexpected nonzero write status received: %d\n, __func__, status); -- 1.8.3.2 -- 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/7] USB: serial: make bulk_out_size a lower limit
Drivers are allowed to override the default bulk-out buffer size (endpoint maximum packet size) in order to increase throughput, but it does not make much sense to allow buffers smaller than the default. Note that this is already how bulk_in_size is defined. Signed-off-by: Johan Hovold jhov...@gmail.com --- drivers/usb/serial/usb-serial.c | 5 ++--- include/linux/usb/serial.h | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 7c9dc28640bb..c68fc9fb7598 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c @@ -923,9 +923,8 @@ static int usb_serial_probe(struct usb_interface *interface, port = serial-port[i]; if (kfifo_alloc(port-write_fifo, PAGE_SIZE, GFP_KERNEL)) goto probe_error; - buffer_size = serial-type-bulk_out_size; - if (!buffer_size) - buffer_size = usb_endpoint_maxp(endpoint); + buffer_size = max_t(int, serial-type-bulk_out_size, + usb_endpoint_maxp(endpoint)); port-bulk_out_size = buffer_size; port-bulk_out_endpointAddress = endpoint-bEndpointAddress; diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index 704a1ab8240c..9bb547c7bce7 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h @@ -190,7 +190,8 @@ static inline void usb_set_serial_data(struct usb_serial *serial, void *data) * @num_ports: the number of different ports this device will have. * @bulk_in_size: minimum number of bytes to allocate for bulk-in buffer * (0 = end-point size) - * @bulk_out_size: bytes to allocate for bulk-out buffer (0 = end-point size) + * @bulk_out_size: minimum number of bytes to allocate for bulk-out buffer + * (0 = end-point size) * @calc_num_ports: pointer to a function to determine how many ports this * device has dynamically. It will be called after the probe() * callback is called, but before attach() -- 1.8.3.2 -- 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 6/7] USB: serial: add missing newlines to dev_level messages.
Add missing newlines to dev_level messages. Also make some messages less verbose where appropriate. Signed-off-by: Johan Hovold jhov...@gmail.com --- drivers/usb/serial/ch341.c| 6 +++--- drivers/usb/serial/cyberjack.c| 2 +- drivers/usb/serial/cypress_m8.c | 2 +- drivers/usb/serial/iuu_phoenix.c | 2 +- drivers/usb/serial/keyspan_pda.c | 2 +- drivers/usb/serial/kl5kusb105.c | 4 ++-- drivers/usb/serial/kobil_sct.c| 3 ++- drivers/usb/serial/mos7720.c | 12 ++-- drivers/usb/serial/mos7840.c | 4 ++-- drivers/usb/serial/quatech2.c | 2 +- drivers/usb/serial/spcp8x5.c | 7 +++ drivers/usb/serial/symbolserial.c | 4 +--- drivers/usb/serial/ti_usb_3410_5052.c | 4 ++-- drivers/usb/serial/usb-serial.c | 4 ++-- 14 files changed, 28 insertions(+), 30 deletions(-) diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c index 82371f61f23d..2d72aa3564a3 100644 --- a/drivers/usb/serial/ch341.c +++ b/drivers/usb/serial/ch341.c @@ -323,11 +323,11 @@ static int ch341_open(struct tty_struct *tty, struct usb_serial_port *port) if (r) goto out; - dev_dbg(port-dev, %s - submitting interrupt urb, __func__); + dev_dbg(port-dev, %s - submitting interrupt urb\n, __func__); r = usb_submit_urb(port-interrupt_in_urb, GFP_KERNEL); if (r) { - dev_err(port-dev, %s - failed submitting interrupt urb, -error %d\n, __func__, r); + dev_err(port-dev, %s - failed to submit interrupt urb: %d\n, + __func__, r); ch341_close(port); goto out; } diff --git a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c index 0ac3b3b3236c..2916dea3ede8 100644 --- a/drivers/usb/serial/cyberjack.c +++ b/drivers/usb/serial/cyberjack.c @@ -220,7 +220,7 @@ static int cyberjack_write(struct tty_struct *tty, result = usb_submit_urb(port-write_urb, GFP_ATOMIC); if (result) { dev_err(port-dev, - %s - failed submitting write urb, error %d, + %s - failed submitting write urb, error %d\n, __func__, result); /* Throw away data. No better idea what to do with it. */ priv-wrfilled = 0; diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index 634f0d6605ed..01bf53392819 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c @@ -279,7 +279,7 @@ static int analyze_baud_rate(struct usb_serial_port *port, speed_t new_rate) * the generic firmware, but are not used with * NMEA and SiRF protocols */ dev_dbg(port-dev, - %s - failed setting baud rate, unsupported speed of %d on Earthmate GPS, + %s - failed setting baud rate, unsupported speed of %d on Earthmate GPS\n, __func__, new_rate); return -1; } diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c index d00dae17d520..5ad4a0fb4b26 100644 --- a/drivers/usb/serial/iuu_phoenix.c +++ b/drivers/usb/serial/iuu_phoenix.c @@ -1151,7 +1151,7 @@ static ssize_t vcc_mode_store(struct device *dev, goto fail_store_vcc_mode; } - dev_dbg(dev, %s: setting vcc_mode = %ld, __func__, v); + dev_dbg(dev, %s: setting vcc_mode = %ld\n, __func__, v); if ((v != 3) (v != 5)) { dev_err(dev, %s - vcc_mode %ld is invalid\n, __func__, v); diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c index e972412b614b..742d827f876c 100644 --- a/drivers/usb/serial/keyspan_pda.c +++ b/drivers/usb/serial/keyspan_pda.c @@ -189,7 +189,7 @@ exit: retval = usb_submit_urb(urb, GFP_ATOMIC); if (retval) dev_err(port-dev, - %s - usb_submit_urb failed with result %d, + %s - usb_submit_urb failed with result %d\n, __func__, retval); } diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c index c88cc4966b23..d7440b7557af 100644 --- a/drivers/usb/serial/kl5kusb105.c +++ b/drivers/usb/serial/kl5kusb105.c @@ -201,7 +201,7 @@ static int klsi_105_get_line_state(struct usb_serial_port *port, else { status = get_unaligned_le16(status_buf); - dev_info(port-serial-dev-dev, read status %x %x, + dev_info(port-serial-dev-dev, read status %x %x\n, status_buf[0], status_buf[1]); *line_state_p = klsi_105_status2linestate(status); @@ -464,7 +464,7 @@ static void
[PATCH 3/7] USB: serial: continue to read on errors
Make sure to try to resubmit the read urb on errors. Currently a recoverable error would lead to reduced throughput as only one urb will be used until the port is closed and reopened (or resumed or unthrottled). Also upgrade error messages from debug to error log level. Signed-off-by: Johan Hovold jhov...@gmail.com --- drivers/usb/serial/generic.c | 21 + 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index b63ce023f96f..d7f39ea7d6ac 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c @@ -359,16 +359,29 @@ void usb_serial_generic_read_bulk_callback(struct urb *urb) dev_dbg(port-dev, %s - urb %d, len %d\n, __func__, i, urb-actual_length); - - if (urb-status) { - dev_dbg(port-dev, %s - non-zero urb status: %d\n, - __func__, urb-status); + switch (urb-status) { + case 0: + break; + case -ENOENT: + case -ECONNRESET: + case -ESHUTDOWN: + dev_dbg(port-dev, %s - urb stopped: %d\n, + __func__, urb-status); + return; + case -EPIPE: + dev_err(port-dev, %s - urb stopped: %d\n, + __func__, urb-status); return; + default: + dev_err(port-dev, %s - nonzero urb status: %d\n, + __func__, urb-status); + goto resubmit; } usb_serial_debug_data(port-dev, __func__, urb-actual_length, data); port-serial-type-process_read_urb(urb); +resubmit: /* Throttle the device if requested by tty */ spin_lock_irqsave(port-lock, flags); port-throttled = port-throttle_req; -- 1.8.3.2 -- 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/7] USB: serial: patches for v3.15
Hi Greg, Here are a few usb-serial patches for v3.15: one bug fix, improved read/write error handling, and some minor fixes and cleanups. Thanks, Johan Johan Hovold (7): USB: cypress_m8: fix potential scheduling while atomic USB: serial: make bulk_out_size a lower limit USB: serial: continue to read on errors USB: serial: continue to write on errors USB: serial: add missing braces USB: serial: add missing newlines to dev_level messages. USB: keyspan: remove dead debugging code drivers/usb/serial/ch341.c| 6 ++-- drivers/usb/serial/cyberjack.c| 2 +- drivers/usb/serial/cypress_m8.c | 21 +++- drivers/usb/serial/generic.c | 61 --- drivers/usb/serial/iuu_phoenix.c | 2 +- drivers/usb/serial/keyspan.c | 30 - drivers/usb/serial/keyspan_pda.c | 2 +- drivers/usb/serial/kl5kusb105.c | 4 +-- drivers/usb/serial/kobil_sct.c| 3 +- drivers/usb/serial/mos7720.c | 12 +++ drivers/usb/serial/mos7840.c | 4 +-- drivers/usb/serial/quatech2.c | 2 +- drivers/usb/serial/spcp8x5.c | 7 ++-- drivers/usb/serial/symbolserial.c | 4 +-- drivers/usb/serial/ti_usb_3410_5052.c | 4 +-- drivers/usb/serial/usb-serial.c | 17 +- include/linux/usb/serial.h| 3 +- 17 files changed, 81 insertions(+), 103 deletions(-) -- 1.8.3.2 -- 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/7] USB: serial: add missing braces
Add missing braces to conditional branches and one loop in usb-serial core and generic implementation. Signed-off-by: Johan Hovold jhov...@gmail.com --- drivers/usb/serial/generic.c| 11 ++- drivers/usb/serial/usb-serial.c | 8 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index 33d7f4092308..1bd192290b08 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c @@ -332,9 +332,9 @@ void usb_serial_generic_process_read_urb(struct urb *urb) * stuff like 3G modems, so shortcircuit it in the 99.999% of * cases where the USB serial is not a console anyway. */ - if (!port-port.console || !port-sysrq) + if (!port-port.console || !port-sysrq) { tty_insert_flip_string(port-port, ch, urb-actual_length); - else { + } else { for (i = 0; i urb-actual_length; i++, ch++) { if (!usb_serial_handle_sysrq_char(port, *ch)) tty_insert_flip_char(port-port, *ch, TTY_NORMAL); @@ -388,8 +388,9 @@ resubmit: if (!port-throttled) { spin_unlock_irqrestore(port-lock, flags); usb_serial_generic_submit_read_urb(port, i, GFP_ATOMIC); - } else + } else { spin_unlock_irqrestore(port-lock, flags); + } } EXPORT_SYMBOL_GPL(usb_serial_generic_read_bulk_callback); @@ -399,10 +400,10 @@ void usb_serial_generic_write_bulk_callback(struct urb *urb) struct usb_serial_port *port = urb-context; int i; - for (i = 0; i ARRAY_SIZE(port-write_urbs); ++i) + for (i = 0; i ARRAY_SIZE(port-write_urbs); ++i) { if (port-write_urbs[i] == urb) break; - + } spin_lock_irqsave(port-lock, flags); port-tx_bytes -= urb-transfer_buffer_length; set_bit(i, port-write_urbs_free); diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index c68fc9fb7598..4c3aeaf56dc1 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c @@ -1160,9 +1160,9 @@ static int usb_serial_reset_resume(struct usb_interface *intf) usb_serial_unpoison_port_urbs(serial); serial-suspending = 0; - if (serial-type-reset_resume) + if (serial-type-reset_resume) { rv = serial-type-reset_resume(serial); - else { + } else { rv = -EOPNOTSUPP; intf-needs_binding = 1; } @@ -1337,9 +1337,9 @@ static int usb_serial_register(struct usb_serial_driver *driver) if (retval) { pr_err(problem %d when registering driver %s\n, retval, driver-description); list_del(driver-driver_list); - } else + } else { pr_info(USB Serial support registered for %s\n, driver-description); - + } mutex_unlock(table_lock); return retval; } -- 1.8.3.2 -- 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 7/7] USB: keyspan: remove dead debugging code
Remove out-commented and ifdeffed debugging code. Signed-off-by: Johan Hovold jhov...@gmail.com --- drivers/usb/serial/keyspan.c | 30 -- 1 file changed, 30 deletions(-) diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c index 265c6776b081..d3acaead5a81 100644 --- a/drivers/usb/serial/keyspan.c +++ b/drivers/usb/serial/keyspan.c @@ -397,17 +397,6 @@ static voidusa26_instat_callback(struct urb *urb) msg = (struct keyspan_usa26_portStatusMessage *)data; -#if 0 - dev_dbg(urb-dev-dev, - %s - port status: port %d cts %d dcd %d dsr %d ri %d toff %d txoff %d rxen %d cr %d, - __func__, msg-port, msg-hskia_cts, msg-gpia_dcd, msg-dsr, - msg-ri, msg-_txOff, msg-_txXoff, msg-rxEnabled, - msg-controlResponse); -#endif - - /* Now do something useful with the data */ - - /* Check port number from message and retrieve private data */ if (msg-port = serial-num_ports) { dev_dbg(urb-dev-dev, %s - Unexpected port number %d\n, __func__, msg-port); @@ -523,9 +512,6 @@ static void usa28_instat_callback(struct urb *urb) goto exit; } - /*dev_dbg(urb-dev-dev, %s %12ph, __func__, data);*/ - - /* Now do something useful with the data */ msg = (struct keyspan_usa28_portStatusMessage *)data; /* Check port number from message and retrieve private data */ @@ -605,9 +591,6 @@ static void usa49_instat_callback(struct urb *urb) goto exit; } - /*dev_dbg(urb-dev-dev, %s: %11ph, __func__, data);*/ - - /* Now do something useful with the data */ msg = (struct keyspan_usa49_portStatusMessage *)data; /* Check port number from message and retrieve private data */ @@ -1793,12 +1776,6 @@ static int keyspan_usa28_send_setup(struct usb_serial *serial, err = usb_submit_urb(this_urb, GFP_ATOMIC); if (err != 0) dev_dbg(port-dev, %s - usb_submit_urb(setup) failed\n, __func__); -#if 0 - else { - dev_dbg(port-dev, %s - usb_submit_urb(setup) OK %d bytes\n, __func__, - this_urb-transfer_buffer_length); - } -#endif return 0; } @@ -1976,13 +1953,6 @@ static int keyspan_usa49_send_setup(struct usb_serial *serial, err = usb_submit_urb(this_urb, GFP_ATOMIC); if (err != 0) dev_dbg(port-dev, %s - usb_submit_urb(setup) failed (%d)\n, __func__, err); -#if 0 - else { - dev_dbg(port-dev, %s - usb_submit_urb(%d) OK %d bytes (end %d)\n, __func__, - outcont_urb, this_urb-transfer_buffer_length, - usb_pipeendpoint(this_urb-pipe)); - } -#endif return 0; } -- 1.8.3.2 -- 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: usb/serial/io_ti.c broken on BE systems
On Wed, Feb 26, 2014 at 05:01:10PM +0100, Johan Hovold wrote: On Tue, Feb 25, 2014 at 03:55:07PM +, Ludovic wrote: At 1st the driver detected the USB key and set-up the serial ports. But when trying to write I got a kernel panic on the router. Are you able to get a stack trace? I finally found that it seems to work properly with 'debug=0', and I also added the patch below. Hmm. The patch below is not correct, though (more below). I assume you're still using an old kernel as the debug module parameter doesn't exist anymore. Can you reproduce this on a recent kernel? So I need: 1- to find what cause the panic on my router with debug=1 2- to test the patch on a LE system. Thanks for you time, You're welcome. Ludovic. --- io_ti.c.ok2002 2014-02-24 21:54:46.0 +0100 +++ io_ti.c 2014-02-24 21:56:33.0 +0100 @@ -2408,8 +2408,8 @@ dbg(bUartMode: %d, config-bUartMode); /* move the word values into big endian mode */ - cpu_to_be16s(config-wFlags); - cpu_to_be16s(config-wBaudRate); + swab16s(config-wFlags); + swab16s(config-wBaudRate); This isn't right. The config buffer is transferred as data and only needs to be byte-swapped on LE-systems (i.e. cpu_to_be16s is correct). Could you verify that my patch works without those two additional changes (with debug=0)? status = send_cmd(edge_port-port-serial-dev, UMPC_SET_CONFIG, (__u8)(UMPM_UART1_PORT + port_number), Did you get a chance to verify my (unmodified) patch (on BE and LE)? Are you able to test it against a recent kernel on your router or are you stuck with an old kernel? Thanks, Johan -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: usbserial_generic, idVendor=1a28, idProduct=6010
On Mon, Feb 24, 2014 at 11:43:35AM +0100, Emanuel Koczwara wrote: W dniu 24.02.2014 11:25, Johan Hovold pisze: This is likely an ftdi-device. Care to try the patch below? Thanks, I'll try. Have you tested the patch I sent? How did it go? As a quick test (which does not require rebuilding your kernel) you can just use sysfs to add the VID/PID to the ftdi_sio driver on a running system: echo 1a28 6010 /sys/bus/usb-serial/drivers/ftdi_sio/new_id Thanks, Johan -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2] xhci: extend quirk for Renesas cards
On Wed, 2014-03-12 at 10:59 -0700, Sarah Sharp wrote: Mathias, this is fine to apply as-is. Since it's after -rc6, Greg's tree is probably now frozen. Stick this patch in your queue for usb-linus, mark it for stable, and send it off once 3.15-rc1 is out. Igor, please do not add Signed-off-by lines unless the developer explicitly types those words. Same with Acked-by lines. Ok. sorry about this. Sarah Sharp On Wed, Mar 12, 2014 at 11:16:24AM +0400, Igor Gnatenko wrote: After suspend another Renesas PCI-X USB 3.0 card doesn't work. [root@fedora-20 ~]# lspci -vmnnd 1912: Device: 03:00.0 Class: USB controller [0c03] Vendor: Renesas Technology Corp. [1912] Device: uPD720202 USB 3.0 Host Controller [0015] SVendor:Renesas Technology Corp. [1912] SDevice:uPD720202 USB 3.0 Host Controller [0015] Rev:02 ProgIf: 30 Reported-and-tested-by: Anatoly Kharchenko rfr-b...@yandex.ru Reference: http://redmine.russianfedora.pro/issues/1315 Signed-off-by: Igor Gnatenko i.gnatenko.br...@gmail.com Signed-off-by: Mathias Nyman mathias.ny...@linux.intel.com --- drivers/usb/host/xhci-pci.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index 04f986d..13d4add 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c @@ -143,9 +143,7 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) xhci-quirks |= XHCI_TRUST_TX_LENGTH; } if (pdev-vendor == PCI_VENDOR_ID_RENESAS - pdev-device == 0x0015 - pdev-subsystem_vendor == PCI_VENDOR_ID_SAMSUNG - pdev-subsystem_device == 0xc0cd) + pdev-device == 0x0015) xhci-quirks |= XHCI_RESET_ON_RESUME; if (pdev-vendor == PCI_VENDOR_ID_VIA) xhci-quirks |= XHCI_RESET_ON_RESUME; -- 1.9.0 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- -Igor Gnatenko -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH net-next 8/9] lg-vl600: Convert uses of __constant_foo to foo
From: Joe Perches j...@perches.com Date: Wed, 12 Mar 2014 10:22:37 -0700 The use of __constant_foo has been unnecessary for quite awhile now. Make these uses consistent with the rest of the kernel. Signed-off-by: Joe Perches j...@perches.com Applied. -- 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/7] USB: cypress_m8: fix potential scheduling while atomic
On Wed, Mar 12, 2014 at 07:09:37PM +0100, Johan Hovold wrote: Remove erroneous call to usb_clear_halt which is blocking and cannot be used in interrupt context. This code has possibly never been executed as it would cause an oops if it was. Simply treat a stalled-endpoint error as any other error condition. Cc: stable sta...@vger.kernel.org Signed-off-by: Johan Hovold jhov...@gmail.com If no one has ever hit this, then it shouldn't need to go to stable, so I'll remove that line from this patch. 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: MAX3421E: device giving NAKs forever?
So, quick question to the collective linux-usb wisdom: when I collect a USB trace on my work-computer while running the command: dd if=/dev/zero of=/dev/sdX1 I see the same WRITE_10 commands of 122,880 bytes (240 sectors), but the glaring difference is that each such WRITE_10 command seems to be followed by ~ 27 READ_10 commands reading 1KB (2 sectors), whereas with the MAX3421 driver, I see consecutive WRITE_10 commands. Anybody know where those READ_10 commands are coming from? Is it a cheap way to poll the device if it's ready for the next block without having to use expensive OUT transactions that get NAK'd? I'll obviously investigate some more, but that's the first obvious difference I have noticed. --david On Tue, Mar 11, 2014 at 7:10 PM, David Mosberger dav...@egauge.net wrote: I couldn't figure out how to force UHCI onto an EHCI chip but I did find I had some old IOGEAR USB 1.1 extenders (USB-over-CAT5 cable) and with those, the device does switch into full-speed mode on my computer: [ 886.371122] usb 1-1.3.1.1.4.2: USB disconnect, device number 15 [ 950.960459] usb 1-1.2: new full-speed USB device number 16 using ehci-pci [ 951.055170] usb 1-1.2: not running at top speed; connect to a high speed hub [ 951.061791] usb 1-1.2: New USB device found, idVendor=058f, idProduct=6387 [ 951.061797] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 951.061802] usb 1-1.2: Product: Mass Storage [ 951.061805] usb 1-1.2: Manufacturer: Generic [ 951.061809] usb 1-1.2: SerialNumber: BCABB02D [ 951.062390] scsi5 : usb-storage 1-1.2:1.0 [ 952.060285] scsi 5:0:0:0: Direct-Access Generic Flash Disk 8.07 PQ: 0 ANSI: 4 [ 952.061585] sd 5:0:0:0: Attached scsi generic sg3 type 0 [ 952.064648] sd 5:0:0:0: [sdc] 1968128 512-byte logical blocks: (1.00 GB/961 MiB) [ 952.065793] sd 5:0:0:0: [sdc] Write Protect is off [ 952.065801] sd 5:0:0:0: [sdc] Mode Sense: 23 00 00 00 [ 952.067012] sd 5:0:0:0: [sdc] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA [ 952.076695] sdc: sdc1 [ 952.080629] sd 5:0:0:0: [sdc] Attached SCSI removable disk With this setup, I can write to the device just fine: dd if=/dev/zero of=/dev/sdc1 count=1 1+0 records in 1+0 records out 512 bytes (5.1 MB) copied, 15.1192 s, 339 kB/s No infinite NAK issue. Still scratching my head... --david On Tue, Mar 11, 2014 at 1:00 PM, Alan Stern st...@rowland.harvard.edu wrote: On Tue, 11 Mar 2014, David Mosberger wrote: It looks like the host controller is behaving correctly, which means the fault is in the device. Have you tried plugging this device into a regular Linux PC and running the same test? Yup, works fine at least at least at hispeed. I suppose I should try the enable UHCI only trick to see if I can test the device at full-speed on my computer. Yes, definitely, so that you are testing under the same conditions. Alan Stern -- eGauge Systems LLC, http://egauge.net/, 1.877-EGAUGE1, fax 720.545.9768 -- eGauge Systems LLC, http://egauge.net/, 1.877-EGAUGE1, fax 720.545.9768 -- 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: MAX3421E: device giving NAKs forever?
On Wed, 12 Mar 2014, David Mosberger wrote: So, quick question to the collective linux-usb wisdom: when I collect a USB trace on my work-computer while running the command: dd if=/dev/zero of=/dev/sdX1 I see the same WRITE_10 commands of 122,880 bytes (240 sectors), but the glaring difference is that each such WRITE_10 command seems to be followed by ~ 27 READ_10 commands reading 1KB (2 sectors), whereas with the MAX3421 driver, I see consecutive WRITE_10 commands. Anybody know where those READ_10 commands are coming from? I'd guess it's some sort of readahead. Not that it makes much sense to read sectors that are about to be overwritten. Did those READ commands occur before you started running dd? Is it a cheap way to poll the device if it's ready for the next block without having to use expensive OUT transactions that get NAK'd? Definitely not. 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: MAX3421E: device giving NAKs forever?
On Wed, Mar 12, 2014 at 2:53 PM, Alan Stern st...@rowland.harvard.edu wrote: On Wed, 12 Mar 2014, David Mosberger wrote: I see the same WRITE_10 commands of 122,880 bytes (240 sectors), but the glaring difference is that each such WRITE_10 command seems to be followed by ~ 27 READ_10 commands reading 1KB (2 sectors), whereas with the MAX3421 driver, I see consecutive WRITE_10 commands. Anybody know where those READ_10 commands are coming from? I'd guess it's some sort of readahead. Not that it makes much sense to read sectors that are about to be overwritten. Did those READ commands occur before you started running dd? Definitely not. I attached a log of a good (working) dd, showing only the USBC transactions. The '\n ( commands are READ_10, the \n * commands are WRITE_10. --david -- eGauge Systems LLC, http://egauge.net/, 1.877-EGAUGE1, fax 720.545.9768 0.1075367,DATA1U S B C '28' } '0' '0' '0' '4' '0' '0' '128' '0' \n ( '0' '0' '0' '164' '134' '0' '0' '2' '0' '0' '0' '0' '0' '0' '0','11620' 0.11749112500,DATA0U S B C '29' } '0' '0' '0' '4' '0' '0' '128' '0' \n ( '0' '0' '0' '164' '136' '0' '0' '2' '0' '0' '0' '0' '0' '0' '0','18350' 0.12037962500,DATA1U S B C '30' } '0' '0' '0' '4' '0' '0' '128' '0' \n ( '0' '0' '0' '164' '138' '0' '0' '2' '0' '0' '0' '0' '0' '0' '0','14500' 0.12338658333,DATA0U S B C '31' } '0' '0' '0' '4' '0' '0' '128' '0' \n ( '0' '0' '0' '164' '140' '0' '0' '2' '0' '0' '0' '0' '0' '0' '0','12868' 0.13044325000,DATA0U S B C ! } '0' '0' '0' '4' '0' '0' '128' '0' \n ( '0' '0' '0' '164' '144' '0' '0' '2' '0' '0' '0' '0' '0' '0' '0','35792' 0.13647270833,DATA0U S B C # } '0' '0' '0' '4' '0' '0' '128' '0' \n ( '0' '0' '0' '164' '148' '0' '0' '2' '0' '0' '0' '0' '0' '0' '0','65082' 0.1395163,DATA1U S B C $ } '0' '0' '0' '4' '0' '0' '128' '0' \n ( '0' '0' '0' '164' '150' '0' '0' '2' '0' '0' '0' '0' '0' '0' '0','2766' 0.14351329167,DATA0U S B C % } '0' '0' '0' '4' '0' '0' '128' '0' \n ( '0' '0' '0' '164' '152' '0' '0' '2' '0' '0' '0' '0' '0' '0' '0','24580' 0.1493710,DATA0U S B C ' } '0' '0' '0' '4' '0' '0' '128' '0' \n ( '0' '0' '0' '164' '156' '0' '0' '2' '0' '0' '0' '0' '0' '0' '0','5614' 0.15239312500,DATA1U S B C ( } '0' '0' '0' '4' '0' '0' '128' '0' \n ( '0' '0' '0' '164' '158' '0' '0' '2' '0' '0' '0' '0' '0' '0' '0','46821' 0.15538312500,DATA0U S B C ) } '0' '0' '0' '4' '0' '0' '128' '0' \n ( '0' '0' '0' '164' '160' '0' '0' '2' '0' '0' '0' '0' '0' '0' '0','56528' 0.15837558333,DATA1U S B C * } '0' '0' '0' '4' '0' '0' '128' '0' \n ( '0' '0' '0' '164' '162' '0' '0' '2' '0' '0' '0' '0' '0' '0' '0','41946' 0.16438162500,DATA1U S B C COMMA } '0' '0' '0' '4' '0' '0' '128' '0' \n ( '0' '0' '0' '164' '166' '0' '0' '2' '0' '0' '0' '0' '0' '0' '0','24014' 0.17036941667,DATA1U S B C . } '0' '0' '0' '4' '0' '0' '128' '0' \n ( '0' '0' '0' '164' '170' '0' '0' '2' '0' '0' '0' '0' '0' '0' '0','18446' 0.17337262500,DATA0U S B C / } '0' '0' '0' '4' '0' '0' '128' '0' \n ( '0' '0' '0' '164' '172' '0' '0' '2' '0' '0' '0' '0' '0' '0' '0','17134' 0.17638162500,DATA1U S B C 0 } '0' '0' '0' '4' '0' '0' '128' '0' \n ( '0' '0' '0' '164' '174' '0' '0' '2' '0' '0' '0' '0' '0' '0' '0','19995' 0.1793798,DATA0U S B C 1 } '0' '0' '0' '4' '0' '0' '128' '0' \n ( '0' '0' '0' '164' '176' '0' '0' '2' '0' '0' '0' '0' '0' '0' '0','58501' 0.18537245833,DATA0U S B C 3 } '0' '0' '0' '4' '0' '0' '128' '0' \n ( '0' '0' '0' '164' '180' '0' '0' '2' '0' '0' '0' '0' '0' '0' '0','37231' 0.1913778,DATA0U S B C 5 } '0' '0' '0' '4' '0' '0' '128' '0' \n ( '0' '0' '0' '164' '184' '0' '0' '2' '0' '0' '0' '0' '0' '0' '0','3921' 0.19437162500,DATA1U S B C 6 } '0' '0' '0' '4' '0' '0' '128' '0' \n ( '0' '0' '0' '164' '186' '0' '0' '2' '0' '0' '0' '0' '0' '0' '0','28763' 0.19737454167,DATA0U S B C 7 } '0' '0' '0' '4' '0' '0' '128' '0' \n ( '0' '0' '0' '164' '188' '0' '0' '2' '0' '0' '0' '0' '0' '0' '0','31419' 0.20038425000,DATA1U S B C 8 } '0' '0' '0' '4' '0' '0' '128' '0' \n ( '0' '0' '0' '164' '190' '0' '0' '2' '0' '0' '0' '0' '0' '0' '0','55728' 0.20637004167,DATA1U S B C : } '0' '0' '0' '4' '0' '0' '128' '0' \n ( '0' '0' '0' '164' '194' '0' '0' '2' '0' '0' '0' '0' '0' '0' '0','3546' 0.21338287500,DATA1U S B C } '0' '0' '0' '4' '0' '0' '128' '0' \n ( '0' '0' '0' '164' '198' '0' '0' '2' '0' '0' '0' '0' '0' '0' '0','62414' 0.21635858333,DATA0U S B C = } '0' '0' '0' '224' '1' '0' '0' '0' \n * '0' '0' '0' '146' '30' '0' '0' '240' '0' '0' '0' '0' '0' '0' '0','56423' 0.37253541667,DATA1U S B C } '0' '0' '0' '4' '0' '0' '128' '0' \n ( '0' '0' '0' '164' '200' '0' '0' '2' '0' '0' '0' '0' '0' '0' '0','24069' 0.3775197,DATA0U S B C ? } '0' '0' '0' '4' '0' '0' '128' '0' \n ( '0' '0' '0' '164' '202' '0' '0' '2' '0' '0' '0' '0' '0' '0' '0','25840'
Re: usbserial_generic, idVendor=1a28, idProduct=6010
Hi, Dnia 2014-03-12, śro o godzinie 19:50 +0100, Johan Hovold pisze: On Mon, Feb 24, 2014 at 11:43:35AM +0100, Emanuel Koczwara wrote: W dniu 24.02.2014 11:25, Johan Hovold pisze: This is likely an ftdi-device. Care to try the patch below? Thanks, I'll try. Have you tested the patch I sent? How did it go? As a quick test (which does not require rebuilding your kernel) you can just use sysfs to add the VID/PID to the ftdi_sio driver on a running system: echo 1a28 6010 /sys/bus/usb-serial/drivers/ftdi_sio/new_id Thanks, Johan Yes, it works. The device is recognized. I'm waiting for detailed informations and logs, I'll post them here (I don't have the device anymore). Thank you for your interest. Regards, Emanuel -- 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 3/3] usb: phy-fsm: change | to || for condition OTG_STATE_A_WAIT_BCON at statemachine
From: Peter Chen It is should be condition or not bit or. Signed-off-by: Peter Chen peter.c...@freescale.com --- drivers/usb/phy/phy-fsm-usb.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/usb/phy/phy-fsm-usb.c b/drivers/usb/phy/phy-fsm-usb.c index 0021839..bf5c32f 100644 --- a/drivers/usb/phy/phy-fsm-usb.c +++ b/drivers/usb/phy/phy-fsm-usb.c @@ -315,7 +315,7 @@ int otg_statemachine(struct otg_fsm *fsm) otg_set_state(fsm, OTG_STATE_A_VBUS_ERR); else if (fsm-b_conn) otg_set_state(fsm, OTG_STATE_A_HOST); - else if (fsm-id | fsm-a_bus_drop | fsm-a_wait_bcon_tmout) + else if (fsm-id || fsm-a_bus_drop || fsm-a_wait_bcon_tmout) otg_set_state(fsm, OTG_STATE_A_WAIT_VFALL); break; case OTG_STATE_A_HOST: That rather depends. It might be an optimisation (avoiding branch instructions) if it is normal that all three values will be zero. Then, why other state machine transfer uses || for their condition judgment? Peter -- 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/3] usb: chipidea: operate on otgsc register in a general way
On Wed, Mar 12, 2014 at 07:49:52PM +0800, Li Jun wrote: On Wed, Mar 12, 2014 at 04:14:31PM +0800, Peter Chen wrote: On Wed, Mar 12, 2014 at 02:32:39PM +0800, Li Jun wrote: From: Li Jun b47...@freescale.com Use a more general way to read and write otgsc register. Signed-off-by: Li Jun b47...@freescale.com --- drivers/usb/chipidea/core.c | 19 + drivers/usb/chipidea/otg.c | 48 +++ drivers/usb/chipidea/otg.h | 19 +++-- drivers/usb/chipidea/udc.c | 11 ++ 4 files changed, 65 insertions(+), 32 deletions(-) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index ca6831c..20be020 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -359,16 +359,15 @@ static irqreturn_t ci_irq(int irq, void *data) irqreturn_t ret = IRQ_NONE; u32 otgsc = 0; - if (ci-is_otg) - otgsc = hw_read(ci, OP_OTGSC, ~0); - + otgsc = hw_read_otgsc(ci); /* * Handle id change interrupt, it indicates device/host function * switch. */ if (ci-is_otg (otgsc OTGSC_IDIE) (otgsc OTGSC_IDIS)) { ci-id_event = true; - ci_clear_otg_interrupt(ci, OTGSC_IDIS); + /* Clear ID change irq status */ + hw_set_otgsc_bits(ci, OTGSC_IDIS); disable_irq_nosync(ci-irq); queue_work(ci-wq, ci-work); return IRQ_HANDLED; @@ -380,7 +379,8 @@ static irqreturn_t ci_irq(int irq, void *data) */ if (ci-is_otg (otgsc OTGSC_BSVIE) (otgsc OTGSC_BSVIS)) { ci-b_sess_valid_event = true; - ci_clear_otg_interrupt(ci, OTGSC_BSVIS); + /* Clear BSV irq */ + hw_set_otgsc_bits(ci, OTGSC_BSVIS); disable_irq_nosync(ci-irq); queue_work(ci-wq, ci-work); return IRQ_HANDLED; @@ -502,8 +502,10 @@ static void ci_get_otg_capable(struct ci_hdrc *ci) == (DCCPARAMS_DC | DCCPARAMS_HC)); if (ci-is_otg) { dev_dbg(ci-dev, It is OTG capable controller\n); - ci_disable_otg_interrupt(ci, OTGSC_INT_EN_BITS); - ci_clear_otg_interrupt(ci, OTGSC_INT_STATUS_BITS); + /* Disable all OTG irq */ + hw_clear_otgsc_bits(ci, OTGSC_INT_EN_BITS); + /* Clear all OTG irq status */ + hw_set_otgsc_bits(ci, OTGSC_INT_STATUS_BITS); } } @@ -617,7 +619,8 @@ static int ci_hdrc_probe(struct platform_device *pdev) */ mdelay(2); ci-role = ci_otg_role(ci); - ci_enable_otg_interrupt(ci, OTGSC_IDIE); + /* Enable ID change irq */ + hw_set_otgsc_bits(ci, OTGSC_IDIE); } else { /* * If the controller is not OTG capable, but support diff --git a/drivers/usb/chipidea/otg.c b/drivers/usb/chipidea/otg.c index 39bd7ec..f214ade 100644 --- a/drivers/usb/chipidea/otg.c +++ b/drivers/usb/chipidea/otg.c @@ -24,12 +24,50 @@ #include otg.h /** + * hw_read_otgsc: returns otgsc register + * + * This function returns register data + */ register contents, I copied from drivers/usb/chipidea/ci.h :). will update. +u32 hw_read_otgsc(struct ci_hdrc *ci) +{ + if (ci-is_otg) + return hw_read(ci, OP_OTGSC, ~0); + else + return -ENOTSUPP; +} + +/** + * hw_set_otgsc_bits + * + * This function sets target bits of OTGSC register, + * any bits within OTGSC_INT_STATUS_BITS will be cleared, + * so use this func to clear irq status instead of hw_clear_otgsc_bits. + */ +void hw_set_otgsc_bits(struct ci_hdrc *ci, u32 bits) +{ + if (ci-is_otg) + hw_write(ci, OP_OTGSC, bits | OTGSC_INT_STATUS_BITS, bits); +} + +/** + * hw_clear_otgsc_bits + * + * This function clear target bits of OTGSC register, + * Note:any bits within OTGSC_INT_STATUS_BITS will not be cleared. + */ +void hw_clear_otgsc_bits(struct ci_hdrc *ci, u32 bits) +{ + if (ci-is_otg) + hw_write(ci, OP_OTGSC, bits | OTGSC_INT_STATUS_BITS, 0); +} + - The caller should make sure the otgsc access under the condition of ci-is_otg so do not need to add ci-is_otg at your APIs. In that way, have to add if(ci-is_otg) everywhere access to otgsc register, I should remove all if(ci-is_otg) at calling place in current driver with this patch. Which way you prefer, move out to this API like I do or keep them? Since we still have other places to use ci-is_otg to stand for the controller is otg capable, not only access register. I prefer keep the current way. Li Jun - It may confuse the user that there are two APIs for writing otgsc, and he must use hw_set_otg_bits to clear
RE: [PATCH v3][ 4/9] usb: chipidea: usbmisc: Add USB Host support for i.MX25/i.MX35 CPUs
This adds the i.MX25 and the i.MX35 support in the ChipIdea usbmisc driver. The i.MX25 and i.MX35 usb controllers are similar enough to be able to use the same code. Signed-off-by: Denis Carikli de...@eukrea.com --- Changelog v2-v3: - Add a commit log Changelog v1-v2: - converted two remaining defines to BIT() - Removed a variable declaration that was not used in usbmisc_imx25_init --- drivers/usb/chipidea/usbmisc_imx.c | 58 1 file changed, 58 insertions(+) diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c index cd061ab..3523c09 100644 --- a/drivers/usb/chipidea/usbmisc_imx.c +++ b/drivers/usb/chipidea/usbmisc_imx.c @@ -21,6 +21,26 @@ #define MX25_USB_PHY_CTRL_OFFSET 0x08 #define MX25_BM_EXTERNAL_VBUS_DIVIDERBIT(23) +#define MXC_EHCI_INTERFACE_SINGLE_UNI(2 0) +#define MXC_EHCI_INTERFACE_DIFF_UNI (0 0) +#define MXC_EHCI_INTERFACE_MASK (0xf) + Have a check for my comment for above Macros please. Peter +#define MX25_OTG_SIC_SHIFT 29 +#define MX25_OTG_SIC_MASK(0x3 MX25_OTG_SIC_SHIFT) +#define MX25_OTG_PM_BIT BIT(24) +#define MX25_OTG_PP_BIT BIT(11) +#define MX25_OTG_OCPOL_BIT BIT(3) + +#define MX25_H1_SIC_SHIFT21 +#define MX25_H1_SIC_MASK (0x3 MX25_H1_SIC_SHIFT) +#define MX25_H1_PP_BIT BIT(18) +#define MX25_H1_PM_BIT BIT(16) +#define MX25_H1_IPPUE_UP_BIT BIT(7) +#define MX25_H1_IPPUE_DOWN_BIT BIT(6) +#define MX25_H1_TLL_BIT BIT(5) +#define MX25_H1_USBTE_BITBIT(4) +#define MX25_H1_OCPOL_BITBIT(2) + #define MX27_H1_PM_BIT BIT(8) #define MX27_H2_PM_BIT BIT(16) #define MX27_OTG_PM_BIT BIT(24) @@ -50,6 +70,39 @@ struct imx_usbmisc { static struct imx_usbmisc *usbmisc; +static int usbmisc_imx25_init(struct imx_usbmisc_data *data) { + unsigned long flags; + u32 val = 0; + + if (data-index 1) + return -EINVAL; + + spin_lock_irqsave(usbmisc-lock, flags); + switch (data-index) { + case 0: + val = readl(usbmisc-base); + val = ~(MX25_OTG_SIC_MASK | MX25_OTG_PP_BIT); + val |= (MXC_EHCI_INTERFACE_DIFF_UNI MXC_EHCI_INTERFACE_MASK) MX25_OTG_SIC_SHIFT; + val |= (MX25_OTG_PM_BIT | MX25_OTG_OCPOL_BIT); + writel(val, usbmisc-base); + break; + case 1: + val = readl(usbmisc-base); + val = ~(MX25_H1_SIC_MASK | MX25_H1_PP_BIT | MX25_H1_IPPUE_UP_BIT); + val |= (MXC_EHCI_INTERFACE_SINGLE_UNI MXC_EHCI_INTERFACE_MASK) MX25_H1_SIC_SHIFT; + val |= (MX25_H1_PM_BIT | MX25_H1_OCPOL_BIT | MX25_H1_TLL_BIT | + MX25_H1_USBTE_BIT | MX25_H1_IPPUE_DOWN_BIT); + + writel(val, usbmisc-base); + + break; + } + spin_unlock_irqrestore(usbmisc-lock, flags); + + return 0; +} + static int usbmisc_imx25_post(struct imx_usbmisc_data *data) { void __iomem *reg; @@ -159,6 +212,7 @@ static int usbmisc_imx6q_init(struct imx_usbmisc_data *data) } static const struct usbmisc_ops imx25_usbmisc_ops = { + .init = usbmisc_imx25_init, .post = usbmisc_imx25_post, }; @@ -200,6 +254,10 @@ static const struct of_device_id usbmisc_imx_dt_ids[] = { .data = imx25_usbmisc_ops, }, { + .compatible = fsl,imx35-usbmisc, + .data = imx25_usbmisc_ops, + }, + { .compatible = fsl,imx27-usbmisc, .data = imx27_usbmisc_ops, }, -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH v3][ 3/9] usb: chipidea: Use standard usb-phy property.
It also adapt the dts that uses it. Signed-off-by: Denis Carikli de...@eukrea.com --- arch/arm/boot/dts/imx23.dtsi |2 +- arch/arm/boot/dts/imx27.dtsi |4 ++-- arch/arm/boot/dts/imx28.dtsi |4 ++-- arch/arm/boot/dts/imx51.dtsi |2 +- arch/arm/boot/dts/imx53.dtsi |4 ++-- arch/arm/boot/dts/imx6qdl.dtsi |4 ++-- arch/arm/boot/dts/imx6sl.dtsi |4 ++-- drivers/usb/chipidea/ci_hdrc_imx.c |2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/arch/arm/boot/dts/imx23.dtsi b/arch/arm/boot/dts/imx23.dtsi index bbcfb5a..e3c9924 100644 --- a/arch/arm/boot/dts/imx23.dtsi +++ b/arch/arm/boot/dts/imx23.dtsi @@ -522,7 +522,7 @@ compatible = fsl,imx23-usb, fsl,imx27-usb; reg = 0x8008 0x4; interrupts = 11; - fsl,usbphy = usbphy0; + usb-phy = usbphy0; clocks = clks 40; status = disabled; }; diff --git a/arch/arm/boot/dts/imx27.dtsi b/arch/arm/boot/dts/imx27.dtsi index 83a8247..94bcf1a 100644 --- a/arch/arm/boot/dts/imx27.dtsi +++ b/arch/arm/boot/dts/imx27.dtsi @@ -466,7 +466,7 @@ interrupts = 56; clocks = clks 15; fsl,usbmisc = usbmisc 0; - fsl,usbphy = usbphy0; + usb-phy = usbphy0; status = disabled; }; @@ -485,7 +485,7 @@ interrupts = 55; clocks = clks 15; fsl,usbmisc = usbmisc 2; - fsl,usbphy = usbphy2; + usb-phy = usbphy2; status = disabled; }; diff --git a/arch/arm/boot/dts/imx28.dtsi b/arch/arm/boot/dts/imx28.dtsi index 90a5795..52ad72f 100644 --- a/arch/arm/boot/dts/imx28.dtsi +++ b/arch/arm/boot/dts/imx28.dtsi @@ -1143,7 +1143,7 @@ reg = 0x8008 0x1; interrupts = 93; clocks = clks 60; - fsl,usbphy = usbphy0; + usb-phy = usbphy0; status = disabled; }; @@ -1152,7 +1152,7 @@ reg = 0x8009 0x1; interrupts = 92; clocks = clks 61; - fsl,usbphy = usbphy1; + usb-phy = usbphy1; status = disabled; }; diff --git a/arch/arm/boot/dts/imx51.dtsi b/arch/arm/boot/dts/imx51.dtsi index cb3204a..b290947 100644 --- a/arch/arm/boot/dts/imx51.dtsi +++ b/arch/arm/boot/dts/imx51.dtsi @@ -249,7 +249,7 @@ interrupts = 18; clocks = clks IMX5_CLK_USBOH3_GATE; fsl,usbmisc = usbmisc 0; - fsl,usbphy = usbphy0; + usb-phy = usbphy0; status = disabled; }; diff --git a/arch/arm/boot/dts/imx53.dtsi b/arch/arm/boot/dts/imx53.dtsi index f0962e5..b10a3de 100644 --- a/arch/arm/boot/dts/imx53.dtsi +++ b/arch/arm/boot/dts/imx53.dtsi @@ -276,7 +276,7 @@ interrupts = 18; clocks = clks IMX5_CLK_USBOH3_GATE; fsl,usbmisc = usbmisc 0; - fsl,usbphy = usbphy0; + usb-phy = usbphy0; status = disabled; }; @@ -286,7 +286,7 @@ interrupts = 14; clocks = clks IMX5_CLK_USBOH3_GATE; fsl,usbmisc = usbmisc 1; - fsl,usbphy = usbphy1; + usb-phy = usbphy1; status = disabled; }; diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi index cfc85be..d2f0087 100644 --- a/arch/arm/boot/dts/imx6qdl.dtsi +++ b/arch/arm/boot/dts/imx6qdl.dtsi @@ -789,7 +789,7 @@ reg = 0x02184000 0x200; interrupts = 0 43 IRQ_TYPE_LEVEL_HIGH; clocks = clks 162; - fsl,usbphy = usbphy1; + usb-phy = usbphy1; fsl,usbmisc = usbmisc 0; status = disabled; }; @@ -799,7 +799,7 @@ reg = 0x02184200 0x200; interrupts = 0 40 IRQ_TYPE_LEVEL_HIGH;
[PATCH net-next v2 0/2] parameter modification
Add opportunity to change the default setting and reduce the tx/rx buffers. v2: modify the patch #1 to let the value readable. Hayes Wang (2): r8152: add RTL8152_EARLY_AGG_TIMEOUT_SUPER r8152: reduce the numbers of the bulks drivers/net/usb/Kconfig | 11 +++ drivers/net/usb/r8152.c | 10 ++ 2 files changed, 17 insertions(+), 4 deletions(-) -- 1.8.4.2 -- 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 net-next v2 1/2] r8152: add RTL8152_EARLY_AGG_TIMEOUT_SUPER
For slow CPU, the frequent bulk transfer would cause poor throughput. One solution is to increase the timeout of the aggregation. It let the hw could complete the bulk transfer later and fill more packets into the buffer. Besides, it could reduce the frequency of the bulk transfer efficiently and improve the performance. However, the optimization value of the timeout depends on the capability of the hardware, especially the CPU. For example, according to the experiment, the timeout 164 us is better than the default value for the chromebook with the ARM CPU. Now add RTL8152_EARLY_AGG_TIMEOUT_SUPER to let someone could choose desired timeout value if he wants to get the best performance. Signed-off-by: Hayes Wang hayesw...@realtek.com --- drivers/net/usb/Kconfig | 12 drivers/net/usb/r8152.c | 7 +-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig index 7e7269f..a8639b8 100644 --- a/drivers/net/usb/Kconfig +++ b/drivers/net/usb/Kconfig @@ -102,6 +102,18 @@ config USB_RTL8152 To compile this driver as a module, choose M here: the module will be called r8152. + menu Aggregation Settings + depends on USB_RTL8152 + + config RTL8152_EARLY_AGG_TIMEOUT_SUPER + int rx early agg timeout for super speed (unit: us) + default 85 + help + This is the rx early agg timeout for USB super speed. + The vaild value is 1 ~ 525 us. + + endmenu + config USB_USBNET tristate Multi-purpose USB Networking Framework select MII diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index aa1d5b2..293b4d8 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -316,7 +316,10 @@ #define PCUT_STATUS0x0001 /* USB_RX_EARLY_AGG */ -#define EARLY_AGG_SUPPER 0x0e832981 +#define EARLY_AGG_SUPERrx_buf_sz - 1522) / 4) 16) | \ + (u32)(CONFIG_RTL8152_EARLY_AGG_TIMEOUT_SUPER = 0 ? 0x2981 : \ + ((CONFIG_RTL8152_EARLY_AGG_TIMEOUT_SUPER * 125) 0x ? \ + CONFIG_RTL8152_EARLY_AGG_TIMEOUT_SUPER * 125 : 0x))) #define EARLY_AGG_HIGH 0x0e837a12 #define EARLY_AGG_SLOW 0x0e83 @@ -1978,7 +1981,7 @@ static void r8153_set_rx_agg(struct r8152 *tp) ocp_write_dword(tp, MCU_TYPE_USB, USB_RX_BUF_TH, RX_THR_SUPPER); ocp_write_dword(tp, MCU_TYPE_USB, USB_RX_EARLY_AGG, - EARLY_AGG_SUPPER); + EARLY_AGG_SUPER); } else { ocp_write_dword(tp, MCU_TYPE_USB, USB_RX_BUF_TH, RX_THR_HIGH); -- 1.8.4.2 -- 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 net-next v2 2/2] r8152: reduce the numbers of the bulks
It is not necessary to have many transfer buffers. Reduce the number from 10 to 4. Signed-off-by: Hayes Wang hayesw...@realtek.com --- drivers/net/usb/r8152.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 293b4d8..1826fcf 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -422,8 +422,8 @@ enum rtl_register_content { FULL_DUP= 0x01, }; -#define RTL8152_MAX_TX 10 -#define RTL8152_MAX_RX 10 +#define RTL8152_MAX_TX 4 +#define RTL8152_MAX_RX 4 #define INTBUFSIZE 2 #define CRC_SIZE 4 #define TX_ALIGN 4 -- 1.8.4.2 -- 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 v3 07/13] usb: chipidea: add OTG fsm operation functions implemenation.
Yes, gadget is not linked to OTG fsm, I did not find a better way to get ci here, actually this patchset is adding a otg_fsm *pointer* instead of struct otg_fsm into struct ci_hdrc, directly embed otg_fsm is a big cost since it's also a some big structure. I think keep the code easy to read and maintain are important just waste tens of bytes for some controllers. I prefer to use struct than pointer for otg_fsm at struct ci_hdrc. OK, I will directly embed it. I checked struct otg_fsm, lots of entries are defined with int, in fact, it doesn't necessary, defined as unsigned xxx:1 is enough. That's true, I will create a separated patch for it. But it needs to change otg_timer_initializer, it can't get bit address. Peter -- 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 v3 00/13] Add USB OTG HNP and SRP support on Chipidea usb driver
On Fri, Mar 07, 2014 at 10:32:30AM +0800, Peter Chen wrote: On Thu, Feb 27, 2014 at 07:38:18AM +0800, Li Jun wrote: From: b47624 b47624@ubuntu64bit1204.(none) This patchset adds USB OTG HNP and SRP support on chipidea usb driver, existing OTG port role swtich function by ID pin status kept unchanged, based on that, if select CONFIG_USB_OTG_FSM, OTG HNP and SRP will be supported. The CONFIG_USB_OTG should also be needed? CONFIG_USB_OTG_FSM is selecting CONFIG_USB_OTG. Yes. Reference to: On-The-Go and Embedded Host Supplement to the USB Revision 2.0 Specification July 27, 2012 Revision 2.0 version 1.1a Jun, at next time, you can have a patch at Documentation/ to introduce how to do it. It also can be in Documentation/ABI/testing/sysfs-platform-chipidea-usb- otg? Documentation/usb/ Peter -- 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