[PATCH 0/3] usb: common: otg-fsm: add HNP polling support for otg fsm
From: Li Jun b47...@freescale.com Hi Felipe, This patchset adds otg HNP polling common part for otg fsm. Li Jun (3): usb: common: otg-fsm: start HNP polling timer in host state usb: common: otg-fsm: add HNP polling request sending funciton usb: common: otg-fsm: add host_request_flag in usb_gadget drivers/usb/common/usb-otg-fsm.c | 53 ++ include/linux/usb/gadget.h |1 + include/linux/usb/otg-fsm.h | 10 +++ 3 files changed, 64 insertions(+) -- 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 3/3] usb: common: otg-fsm: add host_request_flag in usb_gadget
From: Li Jun b47...@freescale.com This patch adds host_request_flag in usb_gadget to store host request from application, clear the flag when otg leaves host state. Signed-off-by: Li Jun b47...@freescale.com --- drivers/usb/common/usb-otg-fsm.c |4 include/linux/usb/gadget.h |1 + 2 files changed, 5 insertions(+) diff --git a/drivers/usb/common/usb-otg-fsm.c b/drivers/usb/common/usb-otg-fsm.c index 1c56739..4d35631 100644 --- a/drivers/usb/common/usb-otg-fsm.c +++ b/drivers/usb/common/usb-otg-fsm.c @@ -84,6 +84,8 @@ static void otg_leave_state(struct otg_fsm *fsm, enum usb_otg_state old_state) fsm-b_ase0_brst_tmout = 0; break; case OTG_STATE_B_HOST: + if (fsm-otg-gadget) + fsm-otg-gadget-host_request_flag = 0; break; case OTG_STATE_A_IDLE: fsm-adp_prb = 0; @@ -98,6 +100,8 @@ static void otg_leave_state(struct otg_fsm *fsm, enum usb_otg_state old_state) break; case OTG_STATE_A_HOST: otg_del_timer(fsm, A_WAIT_ENUM); + if (fsm-otg-gadget) + fsm-otg-gadget-host_request_flag = 0; break; case OTG_STATE_A_SUSPEND: otg_del_timer(fsm, A_AIDL_BDIS); diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index c3a6185..3b17e99 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -562,6 +562,7 @@ struct usb_gadget { unsignedb_hnp_enable:1; unsigneda_hnp_support:1; unsigneda_alt_hnp_support:1; + unsignedhost_request_flag:1; unsignedquirk_ep_out_aligned_size:1; }; #define work_to_gadget(w) (container_of((w), struct usb_gadget, work)) -- 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: common: otg-fsm: start HNP polling timer in host state
From: Li Jun b47...@freescale.com This patch starts HNP polling timer when otg is set to be a_host or b_host. Signed-off-by: Li Jun b47...@freescale.com --- drivers/usb/common/usb-otg-fsm.c |2 ++ include/linux/usb/otg-fsm.h |1 + 2 files changed, 3 insertions(+) diff --git a/drivers/usb/common/usb-otg-fsm.c b/drivers/usb/common/usb-otg-fsm.c index a62d8c8..141c8d7 100644 --- a/drivers/usb/common/usb-otg-fsm.c +++ b/drivers/usb/common/usb-otg-fsm.c @@ -169,6 +169,7 @@ static int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state) otg_set_protocol(fsm, PROTO_HOST); usb_bus_start_enum(fsm-otg-host, fsm-otg-host-otg_port); + otg_add_timer(fsm, HNP_POLLING); break; case OTG_STATE_A_IDLE: otg_drv_vbus(fsm, 0); @@ -203,6 +204,7 @@ static int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state) */ if (!fsm-a_bus_req || fsm-a_suspend_req_inf) otg_add_timer(fsm, A_WAIT_ENUM); + otg_add_timer(fsm, HNP_POLLING); break; case OTG_STATE_A_SUSPEND: otg_drv_vbus(fsm, 1); diff --git a/include/linux/usb/otg-fsm.h b/include/linux/usb/otg-fsm.h index b6ba1bf..c1da7c5 100644 --- a/include/linux/usb/otg-fsm.h +++ b/include/linux/usb/otg-fsm.h @@ -53,6 +53,7 @@ enum otg_fsm_timer { B_SE0_SRP, B_SRP_FAIL, A_WAIT_ENUM, + HNP_POLLING, NUM_OTG_FSM_TIMERS, }; -- 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: common: otg-fsm: add HNP polling request sending funciton
From: Li Jun b47...@freescale.com This patch adds OTG status selector request sending function, can be called by HNP polling timer function after OTG port is in host state. Signed-off-by: Li Jun b47...@freescale.com --- drivers/usb/common/usb-otg-fsm.c | 47 ++ include/linux/usb/otg-fsm.h |9 2 files changed, 56 insertions(+) diff --git a/drivers/usb/common/usb-otg-fsm.c b/drivers/usb/common/usb-otg-fsm.c index 141c8d7..1c56739 100644 --- a/drivers/usb/common/usb-otg-fsm.c +++ b/drivers/usb/common/usb-otg-fsm.c @@ -366,3 +366,50 @@ int otg_statemachine(struct otg_fsm *fsm) return state_changed; } EXPORT_SYMBOL_GPL(otg_statemachine); + +/* + * Called by HNP polling timer function to send HNP polling request + * return host request flag if success, otherwise error code. + */ +int otg_hnp_polling(struct otg_fsm *fsm) +{ + struct usb_device *udev; + u16 host_req_flag; + int retval; + enum usb_otg_state state = fsm-otg-phy-state; + + if (state != OTG_STATE_A_HOST state != OTG_STATE_B_HOST) + return -EINVAL; + + udev = usb_hub_find_child(fsm-otg-host-root_hub, 1); + if (!udev) { + dev_err(fsm-otg-host-controller, + no usb dev connected, can't start HNP polling\n); + return -ENODEV; + } + + /* Get host request flag from connected USB device */ + retval = usb_get_status(udev, USB_RECIP_DEVICE, OTG_STS_SELECTOR, + host_req_flag); + if (retval) { + dev_err(udev-dev, + ERR in HNP polling = %d, stop HNP polling\n, retval); + return retval; + } + + if ((host_req_flag 0xff) == HOST_REQUEST_FLAG) { + if (state == OTG_STATE_A_HOST) + fsm-a_bus_req = 0; + else if (state == OTG_STATE_B_HOST) + fsm-b_bus_req = 0; + retval = HOST_REQUEST_FLAG; + } else if ((host_req_flag 0xff) == 0) { + /* Continue polling */ + otg_add_timer(fsm, HNP_POLLING); + } else { + dev_err(udev-dev, host request flag is invalid\n); + retval = -EINVAL; + } + return retval; +} +EXPORT_SYMBOL_GPL(otg_hnp_polling); diff --git a/include/linux/usb/otg-fsm.h b/include/linux/usb/otg-fsm.h index c1da7c5..6d3514f 100644 --- a/include/linux/usb/otg-fsm.h +++ b/include/linux/usb/otg-fsm.h @@ -40,6 +40,14 @@ #define PROTO_HOST (1) #define PROTO_GADGET (2) +#define OTG_STS_SELECTOR 0xF000 /* OTG status selector, according to +* OTG and EH 2.0 Charpter 6.2.3 +* Table:6-4 +*/ +#define HOST_REQUEST_FLAG 1 /* Host request flag, according to +* OTG and EH 2.0 Charpter 6.2.3 +* Table:6-5 +*/ enum otg_fsm_timer { /* Standard OTG timers */ A_WAIT_VRISE, @@ -240,6 +248,7 @@ static inline int otg_start_gadget(struct otg_fsm *fsm, int on) return fsm-ops-start_gadget(fsm, on); } +int otg_hnp_polling(struct otg_fsm *fsm); int otg_statemachine(struct otg_fsm *fsm); #endif /* __LINUX_USB_OTG_FSM_H */ -- 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: udc: add OTG status request handling.
Peripheral answers OTG status selector request from host according to host request flag of gadget, this flag may be set by application via kernel interface. Signed-off-by: Li Jun b47...@freescale.com --- drivers/usb/chipidea/udc.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index d683968..b4ee07f 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -823,8 +823,16 @@ __acquires(hwep-lock) } if ((setup-bRequestType USB_RECIP_MASK) == USB_RECIP_DEVICE) { - /* Assume that device is bus powered for now. */ - *(u16 *)req-buf = ci-remote_wakeup 1; + if ((setup-wIndex == OTG_STS_SELECTOR) + (gadget_is_otg(ci-gadget))) { + if (ci-gadget.host_request_flag) + *(u16 *)req-buf = HOST_REQUEST_FLAG; + else + *(u16 *)req-buf = 0; + } else { + /* Assume that device is bus powered for now. */ + *(u16 *)req-buf = ci-remote_wakeup 1; + } retval = 0; } else if ((setup-bRequestType USB_RECIP_MASK) \ == USB_RECIP_ENDPOINT) { -- 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 0/3] usb: chipidea: otg_fsm: add otg HNP polling support
From: Li Jun b47...@freescale.com Hi Peter, This patchset adds chipidea driver part of otg HNP polling support. Li Jun (3): usb: chipidea: udc: add OTG status request handling. usb: chipidea: otg_fsm: add HNP polling support usb: chipidea: set host request flag via sys input drivers/usb/chipidea/ci.h |2 ++ drivers/usb/chipidea/otg_fsm.c | 45 +--- drivers/usb/chipidea/otg_fsm.h |2 ++ drivers/usb/chipidea/udc.c | 12 +-- 4 files changed, 56 insertions(+), 5 deletions(-) -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/3] usb: chipidea: set host request flag via sys input
From: Li Jun b47...@freescale.com This patch sets host request flag in sys input when a A device set a_bus_req or a B device set b_bus_req in peripheral role. Signed-off-by: Li Jun b47...@freescale.com --- drivers/usb/chipidea/otg_fsm.c | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c index 923b789..41faffa 100644 --- a/drivers/usb/chipidea/otg_fsm.c +++ b/drivers/usb/chipidea/otg_fsm.c @@ -82,6 +82,11 @@ set_a_bus_req(struct device *dev, struct device_attribute *attr, return count; } ci-fsm.a_bus_req = 1; + if (ci-transceiver-state == OTG_STATE_A_PERIPHERAL) { + ci-gadget.host_request_flag = 1; + mutex_unlock(ci-fsm.lock); + return count; + } } disable_irq_nosync(ci-irq); @@ -162,8 +167,14 @@ set_b_bus_req(struct device *dev, struct device_attribute *attr, mutex_lock(ci-fsm.lock); if (buf[0] == '0') ci-fsm.b_bus_req = 0; - else if (buf[0] == '1') + else if (buf[0] == '1') { ci-fsm.b_bus_req = 1; + if (ci-transceiver-state == OTG_STATE_B_PERIPHERAL) { + ci-gadget.host_request_flag = 1; + mutex_unlock(ci-fsm.lock); + return count; + } + } disable_irq_nosync(ci-irq); queue_work(ci-wq, ci-work); -- 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: otg_fsm: add HNP polling support
From: Li Jun b47...@freescale.com This patch adds HNP polling support for chipidea otg fsm driver, which adds a SW timer to send HNP polling request. Signed-off-by: Li Jun b47...@freescale.com --- drivers/usb/chipidea/ci.h |2 ++ drivers/usb/chipidea/otg_fsm.c | 32 ++-- drivers/usb/chipidea/otg_fsm.h |2 ++ 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h index 9563cb5..9a7f1fd 100644 --- a/drivers/usb/chipidea/ci.h +++ b/drivers/usb/chipidea/ci.h @@ -179,6 +179,8 @@ struct ci_hdrc { boolis_otg; struct otg_fsm fsm; struct ci_otg_fsm_timer_list*fsm_timer; + struct timer_list hnp_polling_timer; + boolhnp_polling_req; 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 8d4c33d..923b789 100644 --- a/drivers/usb/chipidea/otg_fsm.c +++ b/drivers/usb/chipidea/otg_fsm.c @@ -369,6 +369,15 @@ static void b_data_pulse_end(void *ptr, unsigned long indicator) queue_work(ci-wq, ci-work); } +static void hnp_polling_timer_work(unsigned long arg) +{ + struct ci_hdrc *ci = (struct ci_hdrc *)arg; + + ci-hnp_polling_req = true; + disable_irq_nosync(ci-irq); + queue_work(ci-wq, ci-work); +} + /* Initialize timers */ static int ci_otg_init_timers(struct ci_hdrc *ci) { @@ -439,9 +448,17 @@ static int ci_otg_init_timers(struct ci_hdrc *ci) if (ci-fsm_timer-timer_list[B_SESS_VLD] == NULL) return -ENOMEM; + setup_timer(ci-hnp_polling_timer, hnp_polling_timer_work, + (unsigned long)ci); return 0; } +static void ci_otg_add_hnp_polling_timer(struct ci_hdrc *ci) +{ + mod_timer(ci-hnp_polling_timer, + jiffies + msecs_to_jiffies(T_HOST_REQ_POLL)); +} + /* -*/ /* Operations that will be called from OTG Finite State Machine */ /* -*/ @@ -449,8 +466,12 @@ static void ci_otg_fsm_add_timer(struct otg_fsm *fsm, enum otg_fsm_timer t) { struct ci_hdrc *ci = container_of(fsm, struct ci_hdrc, fsm); - if (t NUM_OTG_FSM_TIMERS) - ci_otg_add_timer(ci, t); + if (t NUM_OTG_FSM_TIMERS) { + if (t == HNP_POLLING) + ci_otg_add_hnp_polling_timer(ci); + else + ci_otg_add_timer(ci, t); + } return; } @@ -596,6 +617,12 @@ int ci_otg_fsm_work(struct ci_hdrc *ci) ci-transceiver-state OTG_STATE_A_IDLE) return 0; + if (ci-hnp_polling_req) { + ci-hnp_polling_req = false; + if (otg_hnp_polling(ci-fsm) != HOST_REQUEST_FLAG) + return 0; + } + if (otg_statemachine(ci-fsm)) { if (ci-transceiver-state == OTG_STATE_A_IDLE) { /* @@ -862,4 +889,5 @@ int ci_hdrc_otg_fsm_init(struct ci_hdrc *ci) void ci_hdrc_otg_fsm_remove(struct ci_hdrc *ci) { sysfs_remove_group(ci-dev-kobj, inputs_attr_group); + del_timer_sync(ci-hnp_polling_timer); } diff --git a/drivers/usb/chipidea/otg_fsm.h b/drivers/usb/chipidea/otg_fsm.h index 94c085f..b33d8fe 100644 --- a/drivers/usb/chipidea/otg_fsm.h +++ b/drivers/usb/chipidea/otg_fsm.h @@ -64,6 +64,8 @@ #define TB_SESS_VLD (1000) +#define T_HOST_REQ_POLL (1500) /* HNP polling interval 1s~2s */ + enum ci_otg_fsm_timer_index { /* * CI specific timers, start from the end -- 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 net-next] net: cdc_ncm: fix 64bit division build error
The upper timer_interval limit is arbitrary and much higher than anything usable in the real world. Reducing it from 15s to ~4s to make the timer_interval fit in an u32 does not make much difference. The limit is still outside the practical bounds. This eliminates the need for a 64bit timer_interval, fixing a build error related to 64bit division: drivers/built-in.o: In function `cdc_ncm_get_coalesce': ak8975.c:(.text+0x1ac994): undefined reference to `__aeabi_uldivmod' Reported-by: Stephen Rothwell s...@canb.auug.org.au Signed-off-by: Bjørn Mork bj...@mork.no --- Thanks a lot for reporting this! I believe it makes more sense to change to a u32 than using do_div here. Bjørn drivers/net/usb/cdc_ncm.c | 4 ++-- include/linux/usb/cdc_ncm.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c index 2d0caf1eea25..ad2a386a6e92 100644 --- a/drivers/net/usb/cdc_ncm.c +++ b/drivers/net/usb/cdc_ncm.c @@ -138,7 +138,7 @@ static int cdc_ncm_get_coalesce(struct net_device *netdev, ec-tx_max_coalesced_frames = ctx-tx_max / ctx-max_datagram_size; /* the timer will fire CDC_NCM_TIMER_PENDING_CNT times in a row */ - ec-tx_coalesce_usecs = (ctx-timer_interval * CDC_NCM_TIMER_PENDING_CNT) / NSEC_PER_USEC; + ec-tx_coalesce_usecs = ctx-timer_interval / (NSEC_PER_USEC / CDC_NCM_TIMER_PENDING_CNT); return 0; } @@ -164,7 +164,7 @@ static int cdc_ncm_set_coalesce(struct net_device *netdev, return -EINVAL; spin_lock_bh(ctx-mtx); - ctx-timer_interval = ec-tx_coalesce_usecs * NSEC_PER_USEC / CDC_NCM_TIMER_PENDING_CNT; + ctx-timer_interval = ec-tx_coalesce_usecs * (NSEC_PER_USEC / CDC_NCM_TIMER_PENDING_CNT); if (!ctx-timer_interval) ctx-tx_timer_pending = 0; spin_unlock_bh(ctx-mtx); diff --git a/include/linux/usb/cdc_ncm.h b/include/linux/usb/cdc_ncm.h index 8c5e38819828..7c9b484735c5 100644 --- a/include/linux/usb/cdc_ncm.h +++ b/include/linux/usb/cdc_ncm.h @@ -78,7 +78,7 @@ #defineCDC_NCM_TIMER_PENDING_CNT 2 #define CDC_NCM_TIMER_INTERVAL_USEC400UL #define CDC_NCM_TIMER_INTERVAL_MIN 5UL -#define CDC_NCM_TIMER_INTERVAL_MAX (15UL * USEC_PER_SEC) +#define CDC_NCM_TIMER_INTERVAL_MAX (U32_MAX / NSEC_PER_USEC) #define cdc_ncm_comm_intf_is_mbim(x) ((x)-desc.bInterfaceSubClass == USB_CDC_SUBCLASS_MBIM \ (x)-desc.bInterfaceProtocol == USB_CDC_PROTO_NONE) @@ -104,7 +104,7 @@ struct cdc_ncm_ctx { spinlock_t mtx; atomic_t stop; - u64 timer_interval; + u32 timer_interval; u32 max_ndp_size; u32 tx_timer_pending; -- 2.0.0.rc2 -- 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: otg_fsm: add HNP polling support
From: Li Jun b47...@freescale.com This patch adds HNP polling support for chipidea otg fsm driver, which adds a SW timer to send HNP polling request. Signed-off-by: Li Jun b47...@freescale.com --- drivers/usb/chipidea/ci.h |2 ++ drivers/usb/chipidea/otg_fsm.c | 32 ++-- drivers/usb/chipidea/otg_fsm.h |2 ++ 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h index 9563cb5..9a7f1fd 100644 --- a/drivers/usb/chipidea/ci.h +++ b/drivers/usb/chipidea/ci.h @@ -179,6 +179,8 @@ struct ci_hdrc { boolis_otg; struct otg_fsm fsm; struct ci_otg_fsm_timer_list*fsm_timer; + struct timer_list hnp_polling_timer; + boolhnp_polling_req; 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 8d4c33d..923b789 100644 --- a/drivers/usb/chipidea/otg_fsm.c +++ b/drivers/usb/chipidea/otg_fsm.c @@ -369,6 +369,15 @@ static void b_data_pulse_end(void *ptr, unsigned long indicator) queue_work(ci-wq, ci-work); } +static void hnp_polling_timer_work(unsigned long arg) +{ + struct ci_hdrc *ci = (struct ci_hdrc *)arg; + + ci-hnp_polling_req = true; + disable_irq_nosync(ci-irq); + queue_work(ci-wq, ci-work); +} + /* Initialize timers */ static int ci_otg_init_timers(struct ci_hdrc *ci) { @@ -439,9 +448,17 @@ static int ci_otg_init_timers(struct ci_hdrc *ci) if (ci-fsm_timer-timer_list[B_SESS_VLD] == NULL) return -ENOMEM; + setup_timer(ci-hnp_polling_timer, hnp_polling_timer_work, + (unsigned long)ci); return 0; } +static void ci_otg_add_hnp_polling_timer(struct ci_hdrc *ci) +{ + mod_timer(ci-hnp_polling_timer, + jiffies + msecs_to_jiffies(T_HOST_REQ_POLL)); +} + /* -*/ /* Operations that will be called from OTG Finite State Machine */ /* -*/ @@ -449,8 +466,12 @@ static void ci_otg_fsm_add_timer(struct otg_fsm *fsm, enum otg_fsm_timer t) { struct ci_hdrc *ci = container_of(fsm, struct ci_hdrc, fsm); - if (t NUM_OTG_FSM_TIMERS) - ci_otg_add_timer(ci, t); + if (t NUM_OTG_FSM_TIMERS) { + if (t == HNP_POLLING) + ci_otg_add_hnp_polling_timer(ci); + else + ci_otg_add_timer(ci, t); + } return; } @@ -596,6 +617,12 @@ int ci_otg_fsm_work(struct ci_hdrc *ci) ci-transceiver-state OTG_STATE_A_IDLE) return 0; + if (ci-hnp_polling_req) { + ci-hnp_polling_req = false; + if (otg_hnp_polling(ci-fsm) != HOST_REQUEST_FLAG) + return 0; + } + if (otg_statemachine(ci-fsm)) { if (ci-transceiver-state == OTG_STATE_A_IDLE) { /* @@ -862,4 +889,5 @@ int ci_hdrc_otg_fsm_init(struct ci_hdrc *ci) void ci_hdrc_otg_fsm_remove(struct ci_hdrc *ci) { sysfs_remove_group(ci-dev-kobj, inputs_attr_group); + del_timer_sync(ci-hnp_polling_timer); } diff --git a/drivers/usb/chipidea/otg_fsm.h b/drivers/usb/chipidea/otg_fsm.h index 94c085f..b33d8fe 100644 --- a/drivers/usb/chipidea/otg_fsm.h +++ b/drivers/usb/chipidea/otg_fsm.h @@ -64,6 +64,8 @@ #define TB_SESS_VLD (1000) +#define T_HOST_REQ_POLL (1500) /* HNP polling interval 1s~2s */ + enum ci_otg_fsm_timer_index { /* * CI specific timers, start from the end -- 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 v2] usb: chipidea: udc: add OTG status request handling.
Change for v2: - Replace gadget_is_otg() with ci_otg_is_fsm_mode() as condition when handling OTG status selector request. Peripheral answers OTG status selector request from host according to host request flag of gadget, this flag may be set by application via kernel interface. Signed-off-by: Li Jun b47...@freescale.com --- drivers/usb/chipidea/udc.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index d683968..4564936 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -823,8 +823,16 @@ __acquires(hwep-lock) } if ((setup-bRequestType USB_RECIP_MASK) == USB_RECIP_DEVICE) { - /* Assume that device is bus powered for now. */ - *(u16 *)req-buf = ci-remote_wakeup 1; + if ((setup-wIndex == OTG_STS_SELECTOR) + ci_otg_is_fsm_mode(ci)) { + if (ci-gadget.host_request_flag) + *(u16 *)req-buf = HOST_REQUEST_FLAG; + else + *(u16 *)req-buf = 0; + } else { + /* Assume that device is bus powered for now. */ + *(u16 *)req-buf = ci-remote_wakeup 1; + } retval = 0; } else if ((setup-bRequestType USB_RECIP_MASK) \ == USB_RECIP_ENDPOINT) { -- 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 3/3] usb: chipidea: set host request flag via sys input
From: Li Jun b47...@freescale.com This patch sets host request flag in sys input when a A device set a_bus_req or a B device set b_bus_req in peripheral role. Signed-off-by: Li Jun b47...@freescale.com --- drivers/usb/chipidea/otg_fsm.c | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c index 923b789..41faffa 100644 --- a/drivers/usb/chipidea/otg_fsm.c +++ b/drivers/usb/chipidea/otg_fsm.c @@ -82,6 +82,11 @@ set_a_bus_req(struct device *dev, struct device_attribute *attr, return count; } ci-fsm.a_bus_req = 1; + if (ci-transceiver-state == OTG_STATE_A_PERIPHERAL) { + ci-gadget.host_request_flag = 1; + mutex_unlock(ci-fsm.lock); + return count; + } } disable_irq_nosync(ci-irq); @@ -162,8 +167,14 @@ set_b_bus_req(struct device *dev, struct device_attribute *attr, mutex_lock(ci-fsm.lock); if (buf[0] == '0') ci-fsm.b_bus_req = 0; - else if (buf[0] == '1') + else if (buf[0] == '1') { ci-fsm.b_bus_req = 1; + if (ci-transceiver-state == OTG_STATE_B_PERIPHERAL) { + ci-gadget.host_request_flag = 1; + mutex_unlock(ci-fsm.lock); + return count; + } + } disable_irq_nosync(ci-irq); queue_work(ci-wq, ci-work); -- 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 net-next v2 00/12] cdc_ncm: add buffer tuning and stats using ethtool
Lars Melin lars...@gmail.com writes: Your target audience is embedded systems with limited cpu power and buffer memory, right? If so, then you can't expect them to have ethtool included and their developers are not likely to be happy over having to waste another 100KB in order to tune a 20KB driver. My vote goes for sysfs. That's of course a very good point. I will argue that you often need ethtool anyway for basic stuff like forcing duplex/speed, enabling debug messages, turning on/off pause frames etc. But I don't doubt you know what you are talking about here :-) So I guess many small embedded devices don't include an ethtool binary by default. I do wonder how much we should adapt to that though? I understand that you don't see it this way, but others might actually see it as an advantage if we're forcing ethtool onto these devices... Anyway, I'll start looking at an alternative sysfs implementation so we can discuss this in terms of actual code. But I will definitely leave the statistics in any case, so if you want that then you will need ethtool. 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
[PATCH 0/3] usb: chipidea: otg_fsm: add otg HNP polling support
From: Li Jun b47...@freescale.com Hi Peter, This patchset adds chipidea driver part of otg HNP polling support. Li Jun (3): usb: chipidea: udc: add OTG status request handling. usb: chipidea: otg_fsm: add HNP polling support usb: chipidea: set host request flag via sys input drivers/usb/chipidea/ci.h |2 ++ drivers/usb/chipidea/otg_fsm.c | 45 +--- drivers/usb/chipidea/otg_fsm.h |2 ++ drivers/usb/chipidea/udc.c | 12 +-- 4 files changed, 56 insertions(+), 5 deletions(-) -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] usb: ehci: Enable support for 64bit EHCI host controllers in arm64
On Fri, 2014-05-16 at 18:40 +0100, Catalin Marinas wrote: On Fri, May 16, 2014 at 06:08:45PM +0100, Jon Medhurst (Tixy) wrote: On Fri, 2014-05-16 at 13:55 +0100, Catalin Marinas wrote: [...] It could if arm64 would restrict the DMA addresses to 32-bit, but it doesn't and I end up on my platform with USB DMA buffers allocated 4GB address. dma_alloc_coherent() on arm64 should return 32-bit addresses if the coherent_dma_mask is set to 32-bit. Not if you have CONFIG_DMA_CMA. Unless I have misread the code, enabling CMA means memory comes from a common pool carved out at boot with no way for drivers to specify it's restrictions [1]. It's what I've spent most of the week trying to work around in a clean way, and have finally given up. The easiest hack would be to pass a limit dma_contiguous_reserve() in arm64_memblock_init(), something like this: That is by far the easiest but I dismissed it because it affects all platforms built from that source tree; and if the hack were extended to include a kernel config option, that still may not work on a single kernel binary expected to work on multiple platforms. Basically, I've tried various was to do it 'properly' and after failing am resorting to truly hideous hacks to the (out-of-tree driver) code - so at least other platforms won't be impacted. -- Tixy diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index 51d5352e6ad5..558434c69612 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -162,7 +162,7 @@ void __init arm64_memblock_init(void) } early_init_fdt_scan_reserved_mem(); - dma_contiguous_reserve(0); + dma_contiguous_reserve(dma_to_phys(NULL, DMA_BIT_MASK(32)) + 1); memblock_allow_resize(); memblock_dump_all(); probably with a check for IS_ENABLED(CONFIG_ZONE_DMA) (we do this for swiotlb initialisation). At some point, if we have some system topology description we could decide whether we need to limit the above based on the dma coherent masks. -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] usb: ehci: Enable support for 64bit EHCI host controllers in arm64
On Friday 16 May 2014 13:55:01 Catalin Marinas wrote: On Thu, May 15, 2014 at 05:53:53PM +0100, Liviu Dudau wrote: On Thu, May 15, 2014 at 04:36:25PM +0100, Alan Stern wrote: On Thu, 15 May 2014, Liviu Dudau wrote: On Thu, May 15, 2014 at 03:11:48PM +0100, Alan Stern wrote: On Wed, 14 May 2014, Mark Brown wrote: arm64 architecture handles correctly 64bit DMAs and can enable support for 64bit EHCI host controllers. Did you folks tested this for all sorts of host controllers? I have no way to verify that it works, and last I heard, many (or even most) controllers don't work right with 64-bit DMA. I have tested it with a host controller that is capable of 64-bit DMA and without this change it doesn't work. What do you mean it doesn't work? Can't the host controller use 32-bit DMA? It could if arm64 would restrict the DMA addresses to 32-bit, but it doesn't and I end up on my platform with USB DMA buffers allocated 4GB address. dma_alloc_coherent() on arm64 should return 32-bit addresses if the coherent_dma_mask is set to 32-bit. Which kernel version is this? The more important question is what happens to high buffers allocated elsewhere that get passed into dma_map_sg by a device driver. Depending on the DT properties of the device and its parents, this needs to do one of three things: a) translate the 64-bit virtual address into a 64-bit bus address b) create an IOMMU entry for the 64-bit address and pass the 32-bit IOMMU address to the driver c) use the swiotlb code to create a bounce buffer at a 32-bit DMA address and copy the data around It's definitely wrong to just hardcode a DMA mask in the driver because that code doesn't know which of the three cases is being used. Moreover, you can't do it using an #ifdef CONFIG_ARM64, because it's completely independent of the architecture, and we need to do the exact same logic on ARM32 and any other architecture. Arnd -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 6/6] usb: dwc3: dwc3-omap: Disable/Enable only wrapper interrupts in prepare/complete
The dwc3 wrapper driver should not be fiddling with the core interrupts. Disabling the core interrupts in prepare stops xhci from proper operation. So remove disable/enable of core interrupts from prepare/complete. Signed-off-by: George Cherian george.cher...@ti.com --- drivers/usb/dwc3/dwc3-omap.c | 15 +-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c index e4f681a..3f86f29 100644 --- a/drivers/usb/dwc3/dwc3-omap.c +++ b/drivers/usb/dwc3/dwc3-omap.c @@ -596,7 +596,7 @@ static int dwc3_omap_prepare(struct device *dev) { struct dwc3_omap*omap = dev_get_drvdata(dev); - dwc3_omap_disable_irqs(omap); + dwc3_omap_write_irqmisc_set(omap, 0x00); return 0; } @@ -604,8 +604,19 @@ static int dwc3_omap_prepare(struct device *dev) static void dwc3_omap_complete(struct device *dev) { struct dwc3_omap*omap = dev_get_drvdata(dev); + u32 reg; - dwc3_omap_enable_irqs(omap); + reg = (USBOTGSS_IRQMISC_OEVT | + USBOTGSS_IRQMISC_DRVVBUS_RISE | + USBOTGSS_IRQMISC_CHRGVBUS_RISE | + USBOTGSS_IRQMISC_DISCHRGVBUS_RISE | + USBOTGSS_IRQMISC_IDPULLUP_RISE | + USBOTGSS_IRQMISC_DRVVBUS_FALL | + USBOTGSS_IRQMISC_CHRGVBUS_FALL | + USBOTGSS_IRQMISC_DISCHRGVBUS_FALL | + USBOTGSS_IRQMISC_IDPULLUP_FALL); + + dwc3_omap_write_irqmisc_set(omap, reg); } static int dwc3_omap_suspend(struct device *dev) -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 4/6] usb: dwc3: dwc3-omap: Add dwc3_omap_extcon_register function
Move the extcon related code to its own function. Improve code readability, decrease the dwc3_probe() size. Signed-off-by: George Cherian george.cher...@ti.com --- drivers/usb/dwc3/dwc3-omap.c | 65 ++-- 1 file changed, 39 insertions(+), 26 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c index 2223ab8..131d75a 100644 --- a/drivers/usb/dwc3/dwc3-omap.c +++ b/drivers/usb/dwc3/dwc3-omap.c @@ -420,6 +420,42 @@ static void dwc3_omap_set_utmi_mode(struct dwc3_omap *omap) dwc3_omap_write_utmi_status(omap, reg); } +static int dwc3_omap_extcon_register(struct dwc3_omap *omap) +{ + u32 ret; + struct device_node *node = omap-dev-of_node; + struct extcon_dev *edev; + + if (of_property_read_bool(node, extcon)) { + edev = extcon_get_edev_by_phandle(omap-dev, 0); + if (IS_ERR(edev)) { + dev_vdbg(omap-dev, couldn't get extcon device\n); + return -EPROBE_DEFER; + } + + omap-vbus_nb.notifier_call = dwc3_omap_vbus_notifier; + ret = extcon_register_interest(omap-extcon_vbus_dev, + edev-name, USB, + omap-vbus_nb); + if (ret 0) + dev_vdbg(omap-dev, failed to register notifier for USB\n); + + omap-id_nb.notifier_call = dwc3_omap_id_notifier; + ret = extcon_register_interest(omap-extcon_id_dev, + edev-name, USB-HOST, + omap-id_nb); + if (ret 0) + dev_vdbg(omap-dev, failed to register notifier for USB-HOST\n); + + if (extcon_get_cable_state(edev, USB) == true) + dwc3_omap_set_mailbox(omap, OMAP_DWC3_VBUS_VALID); + if (extcon_get_cable_state(edev, USB-HOST) == true) + dwc3_omap_set_mailbox(omap, OMAP_DWC3_ID_GROUND); + } + + return 0; +} + static int dwc3_omap_probe(struct platform_device *pdev) { struct device_node *node = pdev-dev.of_node; @@ -427,7 +463,6 @@ static int dwc3_omap_probe(struct platform_device *pdev) struct dwc3_omap*omap; struct resource *res; struct device *dev = pdev-dev; - struct extcon_dev *edev; struct regulator*vbus_reg = NULL; int ret = -ENOMEM; @@ -499,31 +534,9 @@ static int dwc3_omap_probe(struct platform_device *pdev) dwc3_omap_enable_irqs(omap); - if (of_property_read_bool(node, extcon)) { - edev = extcon_get_edev_by_phandle(dev, 0); - if (IS_ERR(edev)) { - dev_vdbg(dev, couldn't get extcon device\n); - ret = -EPROBE_DEFER; - goto err2; - } - - omap-vbus_nb.notifier_call = dwc3_omap_vbus_notifier; - ret = extcon_register_interest(omap-extcon_vbus_dev, - edev-name, USB, omap-vbus_nb); - if (ret 0) - dev_vdbg(dev, failed to register notifier for USB\n); - omap-id_nb.notifier_call = dwc3_omap_id_notifier; - ret = extcon_register_interest(omap-extcon_id_dev, edev-name, -USB-HOST, omap-id_nb); - if (ret 0) - dev_vdbg(dev, - failed to register notifier for USB-HOST\n); - - if (extcon_get_cable_state(edev, USB) == true) - dwc3_omap_set_mailbox(omap, OMAP_DWC3_VBUS_VALID); - if (extcon_get_cable_state(edev, USB-HOST) == true) - dwc3_omap_set_mailbox(omap, OMAP_DWC3_ID_GROUND); - } + ret = dwc3_omap_extcon_register(omap); + if (ret 0) + goto err2; ret = of_platform_populate(node, NULL, NULL, dev); if (ret) { -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 5/6] usb: dwc3: dwc3-omap: Fix the crash on module removal
Following crash is seen on dwc3_omap removal Unable to handle kernel NULL pointer dereference at virtual address 0018 pgd = ec098000 [0018] *pgd=ad1f9831, *pte=, *ppte= Internal error: Oops: 17 [#1] SMP ARM Modules linked in: usb_f_ss_lb g_zero usb_f_acm u_serial usb_f_ecm u_ether libcomposite configfs snd_usb_audio snd_usbmidi_lib snd_rawmidi snd_hwdep snd_soc_omap snd_pcm_dmaengine snd_soc_core snd_compress snd_pcm snd_tim] CPU: 0 PID: 1296 Comm: rmmod Tainted: GW 3.15.0-rc4-02716-g95c4e18-dirty #10 task: ed05a080 ti: ec368000 task.ti: ec368000 PC is at release_resource+0x14/0x7c LR is at release_resource+0x10/0x7c pc : [c0044724]lr : [c0044720]psr: 6013 sp : ec369ec0 ip : 6013 fp : 00021008 r10: r9 : ec368000 r8 : c000e7a4 r7 : 0081 r6 : bf0062c0 r5 : ed7cd000 r4 : ed7d85c0 r3 : r2 : r1 : 0011 r0 : c086d08c Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user Control: 10c5387d Table: ac098059 DAC: 0015 Process rmmod (pid: 1296, stack limit = 0xec368248) Stack: (0xec369ec0 to 0xec36a000) 9ec0: 0001 ed7cd000 c034de94 ed7cd010 ed7cd000 c034e194 9ee0: bf0062cc ed7cd010 c03490b0 ed154cc0 ed4c2570 ed2b8410 ed156810 ed156810 bf006d24 c034db9c c034db84 c034c518 9f20: bf006d24 ed156810 bf006d24 c034cd2c bf006d24 bf006d68 0800 c034c340 9f40: c00a9e5c 0020 bf006d68 0800 ec369f4c 33637764 9f60: 616d6f5f 0070 0001 ec368000 ed05a080 c000e670 0001 c0084010 9f80: 00021088 0800 00021088 0081 8010 e6f4 00021088 0800 9fa0: 00021088 c000e5e0 00021088 0800 000210b8 0800 e04f6d00 e04f6d00 9fc0: 00021088 0800 00021088 0081 0001 be91de08 00021008 9fe0: 4d768880 be91dbb4 b6fc5984 4d76888c 8010 000210b8 [c0044724] (release_resource) from [c034de94] (platform_device_del+0x6c/0x9c) [c034de94] (platform_device_del) from [c034e194] (platform_device_unregister+0xc/0x18) [c034e194] (platform_device_unregister) from [bf0062cc] (dwc3_omap_remove_core+0xc/0x14 [dwc3_omap]) [bf0062cc] (dwc3_omap_remove_core [dwc3_omap]) from [c03490b0] (device_for_each_child+0x34/0x74) [c03490b0] (device_for_each_child) from [bf0062b4] (dwc3_omap_remove+0x6c/0x78 [dwc3_omap]) [bf0062b4] (dwc3_omap_remove [dwc3_omap]) from [c034db9c] (platform_drv_remove+0x18/0x1c) [c034db9c] (platform_drv_remove) from [c034c518] (__device_release_driver+0x70/0xc8) [c034c518] (__device_release_driver) from [c034cd2c] (driver_detach+0xb4/0xb8) [c034cd2c] (driver_detach) from [c034c340] (bus_remove_driver+0x4c/0x90) [c034c340] (bus_remove_driver) from [c00a9e5c] (SyS_delete_module+0x10c/0x198) [c00a9e5c] (SyS_delete_module) from [c000e5e0] (ret_fast_syscall+0x0/0x48) Code: e1a04000 e59f0068 eb14505e e5943010 (e5932018) ---[ end trace 7e2a8746ff4fc811 ]--- Segmentation fault Signed-off-by: George Cherian george.cher...@ti.com --- drivers/usb/dwc3/dwc3-omap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c index 131d75a..e4f681a 100644 --- a/drivers/usb/dwc3/dwc3-omap.c +++ b/drivers/usb/dwc3/dwc3-omap.c @@ -317,7 +317,7 @@ static int dwc3_omap_remove_core(struct device *dev, void *c) { struct platform_device *pdev = to_platform_device(dev); - platform_device_unregister(pdev); + of_device_unregister(pdev); return 0; } -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 2/6] usb: dwc3: dwc3-omap: Add dwc3_omap_map_offset() function
Move map offset to its own seperate function. Improve code readability, decrease the dwc3_probe() size. Signed-off-by: George Cherian george.cher...@ti.com --- drivers/usb/dwc3/dwc3-omap.c | 31 +++ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c index 53f6490..0df8adf 100644 --- a/drivers/usb/dwc3/dwc3-omap.c +++ b/drivers/usb/dwc3/dwc3-omap.c @@ -378,6 +378,24 @@ static int dwc3_omap_vbus_notifier(struct notifier_block *nb, return NOTIFY_DONE; } +static void dwc3_omap_map_offset(struct dwc3_omap *omap) +{ + struct device_node *node = omap-dev-of_node; + + /* Differentiate between OMAP5 and AM437x +* For OMAP5(ES2.0) and AM437x x_major is 2 even though there are +* changes in wrapper registers, Using dt compatible for AM437x +*/ + + if (of_device_is_compatible(node, ti,am437x-dwc3)) { + omap-irq_eoi_offset = USBOTGSS_EOI_OFFSET; + omap-irq0_offset = USBOTGSS_IRQ0_OFFSET; + omap-irqmisc_offset = USBOTGSS_IRQMISC_OFFSET; + omap-utmi_otg_offset = USBOTGSS_UTMI_OTG_OFFSET; + omap-debug_offset = USBOTGSS_DEBUG_OFFSET; + } +} + static int dwc3_omap_probe(struct platform_device *pdev) { struct device_node *node = pdev-dev.of_node; @@ -442,18 +460,7 @@ static int dwc3_omap_probe(struct platform_device *pdev) goto err0; } - /* Differentiate between OMAP5 and AM437x -* For OMAP5(ES2.0) and AM437x x_major is 2 even though there are -* changes in wrapper registers, Using dt compatible for AM437x -*/ - - if (of_device_is_compatible(node, ti,am437x-dwc3)) { - omap-irq_eoi_offset = USBOTGSS_EOI_OFFSET; - omap-irq0_offset = USBOTGSS_IRQ0_OFFSET; - omap-irqmisc_offset = USBOTGSS_IRQMISC_OFFSET; - omap-utmi_otg_offset = USBOTGSS_UTMI_OTG_OFFSET; - omap-debug_offset = USBOTGSS_DEBUG_OFFSET; - } + dwc3_omap_map_offset(omap); reg = dwc3_omap_read_utmi_status(omap); -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 3/6] usb: dwc3: dwc3-omap: Add dwc3_omap_set_utmi_mode() function
Move find and set the utmi mode to its own seperate function. Improve code readability, decrease the dwc3_probe() size. Signed-off-by: George Cherian george.cher...@ti.com --- drivers/usb/dwc3/dwc3-omap.c | 44 +--- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c index 0df8adf..2223ab8 100644 --- a/drivers/usb/dwc3/dwc3-omap.c +++ b/drivers/usb/dwc3/dwc3-omap.c @@ -396,6 +396,30 @@ static void dwc3_omap_map_offset(struct dwc3_omap *omap) } } +static void dwc3_omap_set_utmi_mode(struct dwc3_omap *omap) +{ + u32 reg; + struct device_node *node = omap-dev-of_node; + int utmi_mode = 0; + + reg = dwc3_omap_read_utmi_status(omap); + + of_property_read_u32(node, utmi-mode, utmi_mode); + + switch (utmi_mode) { + case DWC3_OMAP_UTMI_MODE_SW: + reg |= USBOTGSS_UTMI_OTG_STATUS_SW_MODE; + break; + case DWC3_OMAP_UTMI_MODE_HW: + reg = ~USBOTGSS_UTMI_OTG_STATUS_SW_MODE; + break; + default: + dev_dbg(omap-dev, UNKNOWN utmi mode %d\n, utmi_mode); + } + + dwc3_omap_write_utmi_status(omap, reg); +} + static int dwc3_omap_probe(struct platform_device *pdev) { struct device_node *node = pdev-dev.of_node; @@ -409,8 +433,6 @@ static int dwc3_omap_probe(struct platform_device *pdev) int ret = -ENOMEM; int irq; - int utmi_mode = 0; - u32 reg; void __iomem*base; @@ -461,23 +483,7 @@ static int dwc3_omap_probe(struct platform_device *pdev) } dwc3_omap_map_offset(omap); - - reg = dwc3_omap_read_utmi_status(omap); - - of_property_read_u32(node, utmi-mode, utmi_mode); - - switch (utmi_mode) { - case DWC3_OMAP_UTMI_MODE_SW: - reg |= USBOTGSS_UTMI_OTG_STATUS_SW_MODE; - break; - case DWC3_OMAP_UTMI_MODE_HW: - reg = ~USBOTGSS_UTMI_OTG_STATUS_SW_MODE; - break; - default: - dev_dbg(dev, UNKNOWN utmi mode %d\n, utmi_mode); - } - - dwc3_omap_write_utmi_status(omap, reg); + dwc3_omap_set_utmi_mode(omap); /* check the DMA Status */ reg = dwc3_omap_readl(omap-base, USBOTGSS_SYSCONFIG); -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: bugzilla.kernel.org/show_bug.cgi?id=76291: system doesn't power off, just reboots
additional information: I build a customized Kernel 3.14.4 based on Arch Stock kernel; with only ONE change: I deleted line 138 (NOT line 121) xhci-quirks |= XHCI_SPURIOUS_REBOOT; in drivers/usb/host/xhci-pci.c. and issue disappears - everything works fine now BIOS Information Vendor: American Megatrends Inc. Version: P2.00 Release Date: 12/06/2013 Address: 0xF Runtime Size: 64 kB ROM Size: 8192 kB Characteristics: PCI is supported BIOS is upgradeable BIOS shadowing is allowed Boot from CD is supported Selectable boot is supported BIOS ROM is socketed EDD is supported 5.25/1.2 MB floppy services are supported (int 13h) 3.5/720 kB floppy services are supported (int 13h) 3.5/2.88 MB floppy services are supported (int 13h) Print screen service is supported (int 5h) 8042 keyboard services are supported (int 9h) Serial services are supported (int 14h) Printer services are supported (int 17h) ACPI is supported USB legacy is supported BIOS boot specification is supported Targeted content distribution is supported UEFI is supported BIOS Revision: 4.6 lshw: dixi-arch description: Desktop Computer product: To Be Filled By O.E.M. (To Be Filled By O.E.M.) vendor: To Be Filled By O.E.M. version: To Be Filled By O.E.M. serial: To Be Filled By O.E.M. width: 64 bits capabilities: smbios-2.7 dmi-2.7 vsyscall32 configuration: administrator_password=disabled boot=normal chassis=desktop family=To Be Filled By O.E.M. frontpanel_password=disabled keyboard_password=disabled power-on_password=disabled sku=To Be Filled By O.E.M. uuid=00020003-0004-0005-0006-000700080009 *-core description: Motherboard product: H87M Pro4 vendor: ASRock physical id: 0 serial: M80-39019500250 *-firmware description: BIOS vendor: American Megatrends Inc. physical id: 0 version: P2.00 date: 12/06/2013 size: 64KiB capacity: 8128KiB capabilities: pci upgrade shadowing cdboot bootselect socketedrom edd int13floppy1200 int13floppy720 int13floppy2880 int5printscreen int9keyboard int14serial int17printer acpi usb 2014-05-17 21:38 GMT+02:00 Wulf Richartz wulf.richa...@gmail.com: Hi, I was asked to send this to you. Nice weekend kind regards Wulf Bug 76291 Summary: system doesn't power off, just reboots Product: Drivers Reporter: Wulf wulf.richartz Component: USB Assignee: Greg Kroah-Hartman greg Status: NEW --- Severity: normal CC: Priority: P1 Version: 2.5 Hardware: x86-64 OS: Linux Kernel Version: since 3.14.3 Tree: Mainline Regression: No Attachments: system-info-files Description Wulf 2014-05-15 17:09:44 UTC Created attachment 136231 [details] system-info-files issue appers since Kernel 3.14.3, also with Kernel 3.14.4, issue doesn't appear with Kernel 3.14.2 maybe similar to Bug 66171 issue doesn't appear with disabled USB3.0 in Bios Mainboard ASRock H87M Pro 4, UEFI-Mode, Arch Linux x84_64 lspci -vvv: 00:14.0 USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB xHCI (rev 05) (prog-if 30 [XHCI]) Subsystem: ASRock Incorporation Device 8c31 Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+ Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium TAbort- TAbort- MAbort- SERR- PERR- INTx- Latency: 0 Interrupt: pin A routed to IRQ 42 Region 0: Memory at f052 (64-bit, non-prefetchable) [size=64K] Capabilities: [70] Power Management version 2 Flags: PMEClk- DSI- D1- D2- AuxCurrent=375mA PME(D0-,D1-,D2-,D3hot+,D3cold+) Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME- Capabilities: [80] MSI: Enable+ Count=1/8 Maskable- 64bit+ Address: fee00298 Data: Kernel driver in use: xhci_hcd Kernel modules: xhci_hcd some system information files attached unloading module xhci_hcd before shut down doesn't fix the problem Comment 1 Wulf 2014-05-16 22:46:01 UTC issue appears also with Kernel 3.15.0rc5 :-( Comment 2 Wulf 2014-05-17 18:50:43 UTC Arch devs (https://bugs.archlinux.org/task/40382) asked me to bisect kernel, but I'm very unfamiliar with kernel, hardware, Compiling, ... and I didn't know which repository exactly to clone. Thus I used: git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-stable git bisect bad v3.14.3 git bisect good v3.14.2 My result: Before last step: [root@dixi-arch linux-stable]# git bisect bad Bisecting: 0 revisions left to test after this (roughly 0 steps) [e7573909b5b8df35591a66146d8629f7aa41675e] xhci: Prevent runtime pm from autosuspending during initialization After last step: [root@dixi-arch linux-stable]# git bisect good
[PATCH v2 1/6] usb: dwc3: dwc3-omap: Remove x_major calculation from revision register
Remove the x_major calculation logic from the wrapper revision register to differentiate between OMAP5 and AM437x. This was done to find the register offsets of wrapper register. Now that We do it using dt compatible, remove the whole logic. Signed-off-by: George Cherian george.cher...@ti.com --- drivers/usb/dwc3/dwc3-omap.c | 35 +++ 1 file changed, 3 insertions(+), 32 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c index 1160ff4..53f6490 100644 --- a/drivers/usb/dwc3/dwc3-omap.c +++ b/drivers/usb/dwc3/dwc3-omap.c @@ -77,10 +77,6 @@ #define USBOTGSS_DEV_EBC_EN0x0110 #define USBOTGSS_DEBUG_OFFSET 0x0600 -/* REVISION REGISTER */ -#define USBOTGSS_REVISION_XMAJOR(reg) ((reg 8) 0x7) -#define USBOTGSS_REVISION_XMAJOR1 1 -#define USBOTGSS_REVISION_XMAJOR2 2 /* SYSCONFIG REGISTER */ #define USBOTGSS_SYSCONFIG_DMADISABLE (1 16) @@ -129,7 +125,6 @@ struct dwc3_omap { u32 irq_eoi_offset; u32 debug_offset; u32 irq0_offset; - u32 revision; u32 dma_status:1; @@ -397,7 +392,6 @@ static int dwc3_omap_probe(struct platform_device *pdev) int irq; int utmi_mode = 0; - int x_major; u32 reg; @@ -448,32 +442,9 @@ static int dwc3_omap_probe(struct platform_device *pdev) goto err0; } - reg = dwc3_omap_readl(omap-base, USBOTGSS_REVISION); - omap-revision = reg; - x_major = USBOTGSS_REVISION_XMAJOR(reg); - - /* Differentiate between OMAP5 and AM437x */ - switch (x_major) { - case USBOTGSS_REVISION_XMAJOR1: - case USBOTGSS_REVISION_XMAJOR2: - omap-irq_eoi_offset = 0; - omap-irq0_offset = 0; - omap-irqmisc_offset = 0; - omap-utmi_otg_offset = 0; - omap-debug_offset = 0; - break; - default: - /* Default to the latest revision */ - omap-irq_eoi_offset = USBOTGSS_EOI_OFFSET; - omap-irq0_offset = USBOTGSS_IRQ0_OFFSET; - omap-irqmisc_offset = USBOTGSS_IRQMISC_OFFSET; - omap-utmi_otg_offset = USBOTGSS_UTMI_OTG_OFFSET; - omap-debug_offset = USBOTGSS_DEBUG_OFFSET; - break; - } - - /* For OMAP5(ES2.0) and AM437x x_major is 2 even though there are -* changes in wrapper registers, Using dt compatible for aegis + /* Differentiate between OMAP5 and AM437x +* For OMAP5(ES2.0) and AM437x x_major is 2 even though there are +* changes in wrapper registers, Using dt compatible for AM437x */ if (of_device_is_compatible(node, ti,am437x-dwc3)) { -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 0/6] Cleanup and fixes for dwc3-omap
The series does some refactoring on dwc3_probe() Patch 1 - Now that we use driver compatible for revision check, remove the unnecessary logic. Patch 2-4 - reduce the size of dwc3_probe() Patch 5 - Fix the crash on dwc3_omap removal Patch 6 - Addresses the issue of xhci hang while resuming from system sleep. George Cherian (6): usb: dwc3: dwc3-omap: Remove x_major calculation from revision register usb: dwc3: dwc3-omap: Add dwc3_omap_map_offset() function usb: dwc3: dwc3-omap: Add dwc3_omap_set_utmi_mode() function usb: dwc3: dwc3-omap: Add dwc3_omap_extcon_register function usb: dwc3: dwc3-omap: Fix the crash on module removal usb: dwc3: dwc3-omap: Disable/Enable only wrapper interrupts in prepare/complete drivers/usb/dwc3/dwc3-omap.c | 186 ++- 1 file changed, 97 insertions(+), 89 deletions(-) -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 0/5] Add support for SW babble Control
Hi Bin, On 5/15/2014 8:49 PM, Bin Liu wrote: George, On Thu, May 15, 2014 at 1:28 AM, George Cherian george.cher...@ti.com wrote: Hi Bin, On 5/14/2014 10:13 PM, Bin Liu wrote: George, On Wed, May 14, 2014 at 9:34 AM, Bin Liu binml...@gmail.com wrote: George, On Wed, May 14, 2014 at 12:37 AM, George Cherian george.cher...@ti.com wrote: On 5/14/2014 12:07 AM, Bin Liu wrote: Hi, On Tue, May 13, 2014 at 8:24 AM, George Cherian george.cher...@ti.com wrote: Hi Daniel, On 5/13/2014 6:44 PM, Daniel Mack wrote: Hi George, On 05/13/2014 02:57 PM, George Cherian wrote: I never enabled the MUSB_BABBLE_SW_SESSION_CTRL in the MUSB_BABBLE_CTL reg. can you try with the following patch. diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index 1ae6681..1160cd1 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c @@ -477,8 +477,11 @@ static int dsps_musb_init(struct musb *musb) * logic enabled. */ val = dsps_readb(musb-mregs, MUSB_BABBLE_CTL); - if (val == MUSB_BABBLE_RCV_DISABLE) + if (val == MUSB_BABBLE_RCV_DISABLE) { glue-sw_babble_enabled = true; + val |= MUSB_BABBLE_SW_SESSION_CTRL; + dsps_writeb(musb-mregs, MUSB_BABBLE_CTL, val); + } ret = dsps_musb_dbg_init(musb, glue); if (ret) MUSB_BABBLE_STUCK_J still remains unset, so I get the same result as without the patch: a full glue reset is conducted. Do I get you right that you expect MUSB_BABBLE_STUCK_J to be set in babble conditions when MUSB_BABBLE_SW_SESSION_CTRL is set? Basically, there are 2 types of babble conditions. 1) Transient babble condition - which could be recovered from without an IP reset . 2) Babble condition - which could be recovered from only by doing an IP reset. Looks like you are always hitting case 2 (Most times am also hitting the same). Case 1 is really hard to reproduce. I don't have a reliable method as of now to reproduce this case consistently. [ 19.672373] CAUTION: musb: Babble Interrupt Occurred [ 19.66] musb_stage0_irq 789: unhandled DISCONNECT transition (a_wait_bcon) [ 19.685815] usb 1-1: USB disconnect, device number 3 [ 19.769720] musb-hdrc musb-hdrc.0.auto: babble: MUSB_BABBLE_CTL value 44 [ 19.776765] musb-hdrc musb-hdrc.0.auto: STUCK_J is reset I don't quite follow, especially as I lack documentation of the IP core. How do you test babble errors, is there any way to force them to happen reliably? There is no 100% reliable method to force it to happen. Following is I have a way to force babble happen reliably - shorting DP or DM to VBUS. I opened the far-end plug of the USB cable, so I can easily short DP or DM to VBUS. Good to know that you have a reliable way to test babble condition. Can you please do a quick test on 3.15.0-rc4 with the series applied? In case of any assistance please do let me know. Sure, but could you please re-send those patches to my corporate email so that I can apply them from Thunderbird? You don't have to resend the patches. Nishanth Menon showed me a way to extract the patch from Gmail - Thanks Nishanth. But which repo do you want to me test with? The first patch ([PATCH v2 1/5] usb: musb: core: Convert babble recover work to delayed work) does not apply to v3.15-rc4 tag. the current musb_core.c does not have the recovery work for musb. Please let me know what I missed. Oops I missed to mention the same. Please try on git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git master The test is done. The babble always causes STUCK_J is reset, MUSB_BABBLE_CTL is 0x44 or 0x4. MUSB reset happens. Thankyou Bin for the help. Can I get a Tested-by from you? Do you think when re-start happens the driver should print a message on console saying re-start due to babble? It would help debug the babble problems while the dynamic debug is off. It prints out a message saying babble condition occured. More over, it re-enumerates all the devices connected as part of Musb re-start. Don't you think that is sufficient enough ? Thanks, -Bin. Thanks, -Bin. I read these linux-usb emails in Gmail, and am not aware of any easy way to extract patches from Gmail. BTY, I tested with TI 3.12.10 kernel, in which I guess the babble handling is similar to this patch set. With TI3.12.10, MISC is always 0x64, so MUSB never restarts. Thanks, -Bin. But the interesting thing is that with TI 3.2 kernel, shorting DP or DM to VBUS causes MISC register to be 0x4, but the result is completely opposite in TI 3.12.10 kernel, which cause MISC to be 0x64. So in the 3.2 kernel, the babble handing resets the controller, but the 3.12.10 does not. Regards, -Bin. my setup , I have a HUB with 4 devices connected , which gives me a Babble interrupt on both connects and disconnects ( Not always though). Anyway, the full glue layer solves this rare condition quite well for me. Is there any downside of this?
Re: [PATCH] usb: ehci: Enable support for 64bit EHCI host controllers in arm64
On Mon, May 19, 2014 at 09:32:43AM +0100, Arnd Bergmann wrote: On Friday 16 May 2014 13:55:01 Catalin Marinas wrote: On Thu, May 15, 2014 at 05:53:53PM +0100, Liviu Dudau wrote: On Thu, May 15, 2014 at 04:36:25PM +0100, Alan Stern wrote: On Thu, 15 May 2014, Liviu Dudau wrote: On Thu, May 15, 2014 at 03:11:48PM +0100, Alan Stern wrote: On Wed, 14 May 2014, Mark Brown wrote: arm64 architecture handles correctly 64bit DMAs and can enable support for 64bit EHCI host controllers. Did you folks tested this for all sorts of host controllers? I have no way to verify that it works, and last I heard, many (or even most) controllers don't work right with 64-bit DMA. I have tested it with a host controller that is capable of 64-bit DMA and without this change it doesn't work. What do you mean it doesn't work? Can't the host controller use 32-bit DMA? It could if arm64 would restrict the DMA addresses to 32-bit, but it doesn't and I end up on my platform with USB DMA buffers allocated 4GB address. dma_alloc_coherent() on arm64 should return 32-bit addresses if the coherent_dma_mask is set to 32-bit. Which kernel version is this? The more important question is what happens to high buffers allocated elsewhere that get passed into dma_map_sg by a device driver. Depending on the DT properties of the device and its parents, this needs to do one of three things: a) translate the 64-bit virtual address into a 64-bit bus address b) create an IOMMU entry for the 64-bit address and pass the 32-bit IOMMU address to the driver c) use the swiotlb code to create a bounce buffer at a 32-bit DMA address and copy the data around It's definitely wrong to just hardcode a DMA mask in the driver because that code doesn't know which of the three cases is being used. Moreover, you can't do it using an #ifdef CONFIG_ARM64, because it's completely independent of the architecture, and we need to do the exact same logic on ARM32 and any other architecture. I agree. The problem we currently have is system topology description to pass the DMA mask and in a hierarchical way. I can see Santosh's patches introducing dma-ranges but the coherent dma mask still set as 32-bit. We can use the dma-ranges to infer a mask but that's only specific to the device and the driver doesn't know whether it goes through an iommu or not. -- Catalin -- 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: xhci dmesg flood on short packet
From: Of Parag Warudkar I see a continuous flood of below messages on plugging in/using my USB token. (The comp code wasn't in the original message - I added it.) From what I can tell the device continues to work as expected. Should the warning be disabled for COMP_SHORT_TX like it is for COMP_STOP and COMP_STOP_INVAL? Parag [104692.771649] xhci_hcd :00:14.0: WARN Event TRB comp code 13 for slot 2 ep 10 with no TDs queued? A completion event with nothing queued looks like something horrid. I'd do some further analysis to find which TRB have been queued and the completion (or other) events that removed them. IIRC the COMP_SHORT_TX completion usually means that the received USB packet is shorter than the buffer (it is really a short RX!). This is completely normal for many devices. There is a slight fubar with some host controllers that fail to report it exactly as per the standard - but that gives a different message. David [104692.777279] xhci_hcd :00:14.0: WARN Event TRB comp code 13 for slot 2 ep 10 with no TDs queued? [104692.793894] xhci_hcd :00:14.0: WARN Event TRB comp code 13 for slot 2 ep 10 with no TDs queued? [104692.813033] xhci_hcd :00:14.0: WARN Event TRB comp code 13 for slot 2 ep 10 with no TDs queued? [104692.823476] xhci_hcd :00:14.0: WARN Event TRB comp code 13 for slot 2 ep 10 with no TDs queued? -- 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
Re: [patch v2] usb: phy: msm: change devm_ioremap() to devm_ioremap_resource()
On Wed, 2014-05-14 at 16:54 +0300, Dan Carpenter wrote: There are several issues here: 1) platform_get_resource() can return NULL and that wasn't handled. 2) We should request the memory before we remap it, and devm_ioremap_resource() does that. 3) devm_ioremap() returns a NULL but we were checking for IS_ERR(). Fixes: 6b99c68ec1f9 ('usb: phy: msm: Migrate to Managed Device Resource allocation') Signed-off-by: Dan Carpenter dan.carpen...@oracle.com --- v2: the first version just swapped the IS_ERR() check for a NULL check Thanks everyone for the review. In the end, it was still a one line fix so I forgive you Ivan. diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c index c522c4f..4f88174 100644 --- a/drivers/usb/phy/phy-msm-usb.c +++ b/drivers/usb/phy/phy-msm-usb.c @@ -1586,7 +1586,7 @@ static int msm_otg_probe(struct platform_device *pdev) np ? alt_core : usb_hs_core_clk); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - motg-regs = devm_ioremap(pdev-dev, res-start, resource_size(res)); + motg-regs = devm_ioremap_resource(pdev-dev, res); Thank you Dan, but this will not going to work. Address space is shared between this PHY driver and CI device controller driver. First version plus adding required check for 'res' as suggested by Sergei will fix this. Regards, Ivan -- 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 v9 1/4] ARM: dts: Add sysreg sytem controller node to exynos5250 and exynos5420
Vivek Gautam wrote: This patch adds sysreg-syscon node to exynos5250 and exynos5420 device tree, to access System Register's registers using syscon driver. Signed-off-by: Kamil Debski k.deb...@samsung.com [gautam.vi...@samsung.com: Split this syreg-syscon dts entry from dts: Add usb2phy to Exynos 5250 patch] [gautam.vi...@samsung.com: added similar syscon entry for exynos5420] Signed-off-by: Vivek Gautam gautam.vi...@samsung.com --- Vivek, See my comment below. And please don't version each patch in series...it's really not a good way. It cause very big confusing... Changes since v7: None arch/arm/boot/dts/exynos5250.dtsi |5 + arch/arm/boot/dts/exynos5420.dtsi |5 + 2 files changed, 10 insertions(+) diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi index 3742331..70f0cd5 100644 --- a/arch/arm/boot/dts/exynos5250.dtsi +++ b/arch/arm/boot/dts/exynos5250.dtsi @@ -175,6 +175,11 @@ reg = 0x1004 0x5000; }; + sysreg_system_controller: syscon@1005 { + compatible = samsung,exynos5250-sys, syscon; Maybe exynos5250-sysreg? And need to add/modify binding doc? - Kukjin + reg = 0x1005 0x5000; + }; + watchdog@101D { compatible = samsung,exynos5250-wdt; reg = 0x101D 0x100; diff --git a/arch/arm/boot/dts/exynos5420.dtsi b/arch/arm/boot/dts/exynos5420.dtsi index a802f74..5d5d6e3 100644 --- a/arch/arm/boot/dts/exynos5420.dtsi +++ b/arch/arm/boot/dts/exynos5420.dtsi @@ -682,6 +682,11 @@ reg = 0x1004 0x5000; }; + sysreg_system_controller: syscon@1005 { + compatible = samsung,exynos5420-sys, syscon; + reg = 0x1005 0x5000; + }; + tmu_cpu0: tmu@1006 { compatible = samsung,exynos5420-tmu; reg = 0x1006 0x100; -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Announce libusb-1.0.19-rc1
Hi All, I'm happy to announce the libusb-1.0.19-rc1 release. The big feature of this release is support for bulk-streams on Mac OS X and Linux (using the new usbfs API for this from 3.15). Changelog: * Add support for USB bulk streams on Linux and Mac OS X (#11) * Windows: Add AMD and Intel USB-3.0 root hub support * Windows: Fix USB 3.0 speed detection on Windows 8 or later (#10) * Added Russian translation for libusb_strerror strings * All: Various small fixes and cleanups The (#xx) numbers are libusb issue numbers, see ie: https://github.com/libusb/libusb/issues/11 Please test and let us know if you find any issues, we plan to release a final version of 1.0.19 in 1-2 weeks. Enjoy, Hans -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [patch v2] usb: phy: msm: change devm_ioremap() to devm_ioremap_resource()
On Mon, May 19, 2014 at 12:19:10PM +0300, Ivan T. Ivanov wrote: On Wed, 2014-05-14 at 16:54 +0300, Dan Carpenter wrote: There are several issues here: 1) platform_get_resource() can return NULL and that wasn't handled. 2) We should request the memory before we remap it, and devm_ioremap_resource() does that. 3) devm_ioremap() returns a NULL but we were checking for IS_ERR(). Fixes: 6b99c68ec1f9 ('usb: phy: msm: Migrate to Managed Device Resource allocation') Signed-off-by: Dan Carpenter dan.carpen...@oracle.com --- v2: the first version just swapped the IS_ERR() check for a NULL check Thanks everyone for the review. In the end, it was still a one line fix so I forgive you Ivan. diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c index c522c4f..4f88174 100644 --- a/drivers/usb/phy/phy-msm-usb.c +++ b/drivers/usb/phy/phy-msm-usb.c @@ -1586,7 +1586,7 @@ static int msm_otg_probe(struct platform_device *pdev) np ? alt_core : usb_hs_core_clk); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - motg-regs = devm_ioremap(pdev-dev, res-start, resource_size(res)); + motg-regs = devm_ioremap_resource(pdev-dev, res); Thank you Dan, but this will not going to work. Address space is shared between this PHY driver and CI device controller driver. First version plus adding required check for 'res' as suggested by Sergei will fix this. People, I'm really sorry about this. I knew there was a risk when I sent the patch. I don't have a way to test this and my changelog was too confident, more than it should have been. This was my fault. I will send a patch to fix it. regards, dan carpenter -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] usb: ehci: Enable support for 64bit EHCI host controllers in arm64
On Monday 19 May 2014 10:03:40 Catalin Marinas wrote: On Mon, May 19, 2014 at 09:32:43AM +0100, Arnd Bergmann wrote: On Friday 16 May 2014 13:55:01 Catalin Marinas wrote: On Thu, May 15, 2014 at 05:53:53PM +0100, Liviu Dudau wrote: On Thu, May 15, 2014 at 04:36:25PM +0100, Alan Stern wrote: On Thu, 15 May 2014, Liviu Dudau wrote: On Thu, May 15, 2014 at 03:11:48PM +0100, Alan Stern wrote: On Wed, 14 May 2014, Mark Brown wrote: arm64 architecture handles correctly 64bit DMAs and can enable support for 64bit EHCI host controllers. Did you folks tested this for all sorts of host controllers? I have no way to verify that it works, and last I heard, many (or even most) controllers don't work right with 64-bit DMA. I have tested it with a host controller that is capable of 64-bit DMA and without this change it doesn't work. What do you mean it doesn't work? Can't the host controller use 32-bit DMA? It could if arm64 would restrict the DMA addresses to 32-bit, but it doesn't and I end up on my platform with USB DMA buffers allocated 4GB address. dma_alloc_coherent() on arm64 should return 32-bit addresses if the coherent_dma_mask is set to 32-bit. Which kernel version is this? The more important question is what happens to high buffers allocated elsewhere that get passed into dma_map_sg by a device driver. Depending on the DT properties of the device and its parents, this needs to do one of three things: a) translate the 64-bit virtual address into a 64-bit bus address b) create an IOMMU entry for the 64-bit address and pass the 32-bit IOMMU address to the driver c) use the swiotlb code to create a bounce buffer at a 32-bit DMA address and copy the data around It's definitely wrong to just hardcode a DMA mask in the driver because that code doesn't know which of the three cases is being used. Moreover, you can't do it using an #ifdef CONFIG_ARM64, because it's completely independent of the architecture, and we need to do the exact same logic on ARM32 and any other architecture. I agree. The problem we currently have is system topology description to pass the DMA mask and in a hierarchical way. I can see Santosh's patches introducing dma-ranges but the coherent dma mask still set as 32-bit. We can use the dma-ranges to infer a mask but that's only specific to the device and the driver doesn't know whether it goes through an iommu or not. We definitely have to fix this very quickly, before people start building real arm64 systems and shipping them. We should not merge any hacks that attempt to work around the problem, but try to come to a conclusion how to handle them properly. My hope was that we could just always set the dma mask to whatever the DT says it should be to keep the burden from device drivers, unless they want to restrict it further (e.g. when the specific peripheral hardware has a bug that prevents us from using high addresses, even though the SoC in theory supports it everywhere). Rob Herring argued that we should always mimic PCI and call dma_set_mask() in drivers but default to a 32-bit mask otherwise, independent of whether the hardware can do more or less than that, IIRC. While we currently don't have a set of swiotlb DMA ops on ARM32, we do have it on ARM64, and I think we should be using them properly. It should really not be hard to implement a proper dma_set_mask() function for ARM64 that gets is able to set up the swiotlb based on the dma-ranges properties and always returns success but leaves the mask unchanged. Arnd -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/3] usb: host: xhci-plat: add xhci_plat_start()
Some platforms (such as the Renesas R-Car) need to initialize some specific registers after xhci driver calls usb_add_hcd() and before the driver calls xhci_run(). So, this patch adds the xhci_plat_start() function. Signed-off-by: Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com --- drivers/usb/host/xhci-plat.c |7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 0f5f4c8..561d07e 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -37,6 +37,11 @@ static int xhci_plat_setup(struct usb_hcd *hcd) return xhci_gen_setup(hcd, xhci_plat_quirks); } +static int xhci_plat_start(struct usb_hcd *hcd) +{ + return xhci_run(hcd); +} + static const struct hc_driver xhci_plat_xhci_driver = { .description = xhci-hcd, .product_desc = xHCI Host Controller, @@ -52,7 +57,7 @@ static const struct hc_driver xhci_plat_xhci_driver = { * basic lifecycle operations */ .reset =xhci_plat_setup, - .start =xhci_run, + .start =xhci_plat_start, .stop = xhci_stop, .shutdown = xhci_shutdown, -- 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 0/3] add support for the R-Car H2 and M2 xHCI controllers
This patch set adds the USB xHCI support for the R-Car H2 and M2 SoCs. These SoCs use an xHCI but still need specific initialization, mainly to setup the firmware downloading and the specific registers. This patch set depends on the following patches: http://marc.info/?l=linux-usbm=140014937401793w=2 http://marc.info/?l=linux-usbm=140014935801786w=2 http://marc.info/?l=linux-usbm=140014933101775w=2 http://marc.info/?l=linux-usbm=140014932301770w=2 However, this patch set doesn't depend on the following patch because this patch set uses the USB phy, not phy: http://marc.info/?l=linux-usbm=140025742005303w=2 Yoshihiro Shimoda (3): usb: host: xhci-plat: add xhci_plat_start() usb: host: xhci-plat: add support for the R-Car H2 and M2 xHCI controllers Documentation: dt-bindings: update xhci-platform DT binding for R-Car Gen2 Documentation/devicetree/bindings/usb/usb-xhci.txt |3 +- drivers/usb/host/Kconfig |8 + drivers/usb/host/Makefile |3 + drivers/usb/host/xhci-plat.c | 25 ++- drivers/usb/host/xhci-rcar.c | 187 drivers/usb/host/xhci-rcar.h | 37 6 files changed, 261 insertions(+), 2 deletions(-) create mode 100644 drivers/usb/host/xhci-rcar.c create mode 100644 drivers/usb/host/xhci-rcar.h -- 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: host: xhci-plat: add support for the R-Car H2 and M2 xHCI controllers
The R-Car H2 and M2 SoCs come with an xHCI controller that requires some specific initilization related to the firmware downloading and some specific registers. This patch adds the support for this special configuration as an xHCI quirk executed during probe and start. Signed-off-by: Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com --- drivers/usb/host/Kconfig |8 ++ drivers/usb/host/Makefile|3 + drivers/usb/host/xhci-plat.c | 18 + drivers/usb/host/xhci-rcar.c | 182 ++ drivers/usb/host/xhci-rcar.h | 28 +++ 5 files changed, 239 insertions(+) create mode 100644 drivers/usb/host/xhci-rcar.c create mode 100644 drivers/usb/host/xhci-rcar.h diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 9247ad2..229e968 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -37,6 +37,14 @@ config USB_XHCI_MVEBU Say 'Y' to enable the support for the xHCI host controller found in Marvell Armada 375/38x ARM SOCs. +config USB_XHCI_RCAR + tristate xHCI support for Renesas R-Car SoCs + select USB_XHCI_PLATFORM + depends on ARCH_SHMOBILE || COMPILE_TEST + ---help--- + Say 'Y' to enable the support for the xHCI host controller + found in Renesas R-Car ARM SoCs. + endif # USB_XHCI_HCD config USB_EHCI_HCD diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile index 7c0886a..b59ca3c 100644 --- a/drivers/usb/host/Makefile +++ b/drivers/usb/host/Makefile @@ -22,6 +22,9 @@ ifneq ($(CONFIG_USB_XHCI_PLATFORM), ) ifneq ($(CONFIG_USB_XHCI_MVEBU), ) xhci-hcd-y += xhci-mvebu.o endif +ifneq ($(CONFIG_USB_XHCI_RCAR), ) + xhci-hcd-y += xhci-rcar.o +endif endif obj-$(CONFIG_USB_WHCI_HCD) += whci/ diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 561d07e..3a2da1f 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -20,6 +20,7 @@ #include xhci.h #include xhci-mvebu.h +#include xhci-rcar.h static void xhci_plat_quirks(struct device *dev, struct xhci_hcd *xhci) { @@ -39,6 +40,12 @@ static int xhci_plat_setup(struct usb_hcd *hcd) static int xhci_plat_start(struct usb_hcd *hcd) { + struct device_node *of_node = hcd-self.controller-of_node; + + if (of_device_is_compatible(of_node, renesas,r8a7790-xhci) || + of_device_is_compatible(of_node, renesas,r8a7790-xhci)) + xhci_rcar_start(hcd); + return xhci_run(hcd); } @@ -165,6 +172,15 @@ static int xhci_plat_probe(struct platform_device *pdev) goto unmap_registers; } + if (of_device_is_compatible(pdev-dev.of_node, + renesas,r8a7790-xhci) || + of_device_is_compatible(pdev-dev.of_node, + renesas,r8a7791-xhci)) { + ret = xhci_rcar_init_quirk(pdev); + if (ret) + goto disable_clk; + } + ret = usb_add_hcd(hcd, irq, IRQF_SHARED); if (ret) goto disable_clk; @@ -270,6 +286,8 @@ static const struct of_device_id usb_xhci_of_match[] = { { .compatible = xhci-platform }, { .compatible = marvell,armada-375-xhci}, { .compatible = marvell,armada-380-xhci}, + { .compatible = renesas,r8a7790-xhci}, + { .compatible = renesas,r8a7791-xhci}, { }, }; MODULE_DEVICE_TABLE(of, usb_xhci_of_match); diff --git a/drivers/usb/host/xhci-rcar.c b/drivers/usb/host/xhci-rcar.c new file mode 100644 index 000..3c0bfae --- /dev/null +++ b/drivers/usb/host/xhci-rcar.c @@ -0,0 +1,182 @@ +/* + * xHCI host controller driver for R-Car SoCs + * + * Copyright (C) 2014 Renesas Electronics Corporation + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + */ + +#include linux/firmware.h +#include linux/module.h +#include linux/platform_device.h +#include linux/usb/phy.h + +#include xhci.h +#include xhci-rcar.h + +#define FIRMWARE_NAME r8a779x_usb3_v1.dlmem + +/*** Register Offset ***/ +#define RCAR_USB3_INT_ENA 0x224 /* Interrupt Enable */ +#define RCAR_USB3_DL_CTRL 0x250 /* FW Download Control Status */ +#define RCAR_USB3_FW_DATA0 0x258 /* FW Data0 */ + +#define RCAR_USB3_LCLK 0xa44 /* LCLK Select */ +#define RCAR_USB3_CONF10xa48 /* USB3.0 Configuration1 */ +#define RCAR_USB3_CONF20xa5c /* USB3.0 Configuration2 */ +#define RCAR_USB3_CONF30xaa8 /* USB3.0 Configuration3 */ +#define RCAR_USB3_RX_POL 0xab0 /* USB3.0 RX Polarity */ +#define RCAR_USB3_TX_POL 0xab8 /* USB3.0 TX Polarity */ + +/*** Register Settings ***/ +/* Interrupt Enable */ +#define RCAR_USB3_INT_XHC_ENA 0x0001 +#define RCAR_USB3_INT_PME_ENA
[PATCH 3/3] Documentation: dt-bindings: update xhci-platform DT binding for R-Car H2 and M2
This commit extends the compatible string list of the xhci-platform binding with the new renesas,r8a7790-xhci and renesas,r8a7791-xhci compatible strings. It is used to describe the xHCI controller which is available in the R-Car H2 and M2 SoCs. Signed-off-by: Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com --- Documentation/devicetree/bindings/usb/usb-xhci.txt |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/usb/usb-xhci.txt b/Documentation/devicetree/bindings/usb/usb-xhci.txt index 999be5c..e3107bb 100644 --- a/Documentation/devicetree/bindings/usb/usb-xhci.txt +++ b/Documentation/devicetree/bindings/usb/usb-xhci.txt @@ -2,7 +2,8 @@ USB xHCI controllers Required properties: - compatible: should be one of generic-xhci, -marvell,armada-375-xhci, marvell,armada-380-xhci (deprecated: +marvell,armada-375-xhci, marvell,armada-380-xhci, +renesas,r8a7790-xhci, renesas,r8a7791-xhci (deprecated: xhci-platform). - reg: should contain address and length of the standard XHCI register set for the device. -- 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 5/5] usb: gadget: net2280: Use module_pci_driver macro
Signed-off-by: Ricardo Ribalda Delgado ricardo.riba...@gmail.com --- drivers/usb/gadget/net2280.c | 19 +-- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c index b43725a..bd851de 100644 --- a/drivers/usb/gadget/net2280.c +++ b/drivers/usb/gadget/net2280.c @@ -3588,6 +3588,9 @@ static int net2280_probe (struct pci_dev *pdev, const struct pci_device_id *id) void__iomem *base = NULL; int retval, i; + if (!use_dma) + use_dma_chaining = 0; + /* alloc, and start init */ dev = kzalloc (sizeof *dev, GFP_KERNEL); if (dev == NULL){ @@ -3833,20 +3836,8 @@ static struct pci_driver net2280_pci_driver = { /* FIXME add power management support */ }; +module_pci_driver(net2280_pci_driver); + MODULE_DESCRIPTION (DRIVER_DESC); MODULE_AUTHOR (David Brownell); MODULE_LICENSE (GPL); - -static int __init init (void) -{ - if (!use_dma) - use_dma_chaining = 0; - return pci_register_driver (net2280_pci_driver); -} -module_init (init); - -static void __exit cleanup (void) -{ - pci_unregister_driver (net2280_pci_driver); -} -module_exit (cleanup); -- 2.0.0.rc0 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/5] usb: gadget: net2280: Use true/false instead of 1/0
For bool variables Signed-off-by: Ricardo Ribalda Delgado ricardo.riba...@gmail.com --- drivers/usb/gadget/net2280.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c index 5b9368d..b43725a 100644 --- a/drivers/usb/gadget/net2280.c +++ b/drivers/usb/gadget/net2280.c @@ -95,9 +95,9 @@ static const char *const ep_name [] = { * Some gadget drivers work better with the dma support here than others. * These two parameters let you use PIO or more aggressive DMA. */ -static bool use_dma = 1; -static bool use_dma_chaining = 0; -static bool use_msi = 1; +static bool use_dma = true; +static bool use_dma_chaining; +static bool use_msi = true; /* modprobe net2280 use_dma=n etc */ module_param (use_dma, bool, S_IRUGO); @@ -118,7 +118,7 @@ module_param (fifo_mode, ushort, 0644); * USB suspend requests will be ignored. This is acceptable for * self-powered devices */ -static bool enable_suspend = 0; +static bool enable_suspend; /* modprobe net2280 enable_suspend=1 etc */ module_param (enable_suspend, bool, S_IRUGO); -- 2.0.0.rc0 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/5] usb: gadget: net2280: Use BIT() macro
Improves readability of the code Signed-off-by: Ricardo Ribalda Delgado ricardo.riba...@gmail.com --- drivers/usb/gadget/net2280.c | 572 +-- drivers/usb/gadget/net2280.h | 65 ++--- 2 files changed, 318 insertions(+), 319 deletions(-) diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c index ba1fdd8..5b9368d 100644 --- a/drivers/usb/gadget/net2280.c +++ b/drivers/usb/gadget/net2280.c @@ -144,8 +144,8 @@ static char *type_string (u8 bmAttributes) #include net2280.h -#define valid_bit cpu_to_le32 (1 VALID_BIT) -#define dma_done_iecpu_to_le32 (1 DMA_DONE_INTERRUPT_ENABLE) +#define valid_bit cpu_to_le32(BIT(VALID_BIT)) +#define dma_done_iecpu_to_le32(BIT(DMA_DONE_INTERRUPT_ENABLE)) /*-*/ static inline void enable_pciirqenb(struct net2280_ep *ep) @@ -153,9 +153,9 @@ static inline void enable_pciirqenb(struct net2280_ep *ep) u32 tmp = readl(ep-dev-regs-pciirqenb0); if (ep-dev-pdev-vendor == PCI_VENDOR_ID_PLX_LEGACY) - tmp |= 1 ep-num; + tmp |= BIT(ep-num); else - tmp |= 1 ep_bit[ep-num]; + tmp |= BIT(ep_bit[ep-num]); writel(tmp, ep-dev-regs-pciirqenb0); return; @@ -218,14 +218,14 @@ net2280_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) } /* set type, direction, address; reset fifo counters */ - writel ((1 FIFO_FLUSH), ep-regs-ep_stat); + writel(BIT(FIFO_FLUSH), ep-regs-ep_stat); tmp = (desc-bmAttributes USB_ENDPOINT_XFERTYPE_MASK); if (tmp == USB_ENDPOINT_XFER_INT) { /* erratum 0105 workaround prevents hs NYET */ if (dev-chiprev == 0100 dev-gadget.speed == USB_SPEED_HIGH !(desc-bEndpointAddress USB_DIR_IN)) - writel ((1 CLEAR_NAK_OUT_PACKETS_MODE), + writel(BIT(CLEAR_NAK_OUT_PACKETS_MODE), ep-regs-ep_rsp); } else if (tmp == USB_ENDPOINT_XFER_BULK) { /* catch some particularly blatant driver bugs */ @@ -243,18 +243,18 @@ net2280_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) tmp |= desc-bEndpointAddress; /* default full fifo lines */ tmp |= (4 ENDPOINT_BYTE_COUNT); - tmp |= 1 ENDPOINT_ENABLE; + tmp |= BIT(ENDPOINT_ENABLE); ep-is_in = (tmp USB_DIR_IN) != 0; } else { /* In Legacy mode, only OUT endpoints are used */ if (dev-enhanced_mode ep-is_in) { tmp = IN_ENDPOINT_TYPE; - tmp |= (1 IN_ENDPOINT_ENABLE); + tmp |= BIT(IN_ENDPOINT_ENABLE); /* Not applicable to Legacy */ - tmp |= (1 ENDPOINT_DIRECTION); + tmp |= BIT(ENDPOINT_DIRECTION); } else { tmp = OUT_ENDPOINT_TYPE; - tmp |= (1 OUT_ENDPOINT_ENABLE); + tmp |= BIT(OUT_ENDPOINT_ENABLE); tmp |= (ep-is_in ENDPOINT_DIRECTION); } @@ -267,13 +267,13 @@ net2280_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) /* for OUT transfers, block the rx fifo until a read is posted */ if (!ep-is_in) - writel ((1 SET_NAK_OUT_PACKETS), ep-regs-ep_rsp); + writel(BIT(SET_NAK_OUT_PACKETS), ep-regs-ep_rsp); else if (dev-pdev-device != 0x2280) { /* Added for 2282, Don't use nak packets on an in endpoint, * this was ignored on 2280 */ - writel ((1 CLEAR_NAK_OUT_PACKETS) - | (1 CLEAR_NAK_OUT_PACKETS_MODE), ep-regs-ep_rsp); + writel(BIT(CLEAR_NAK_OUT_PACKETS) | + BIT(CLEAR_NAK_OUT_PACKETS_MODE), ep-regs-ep_rsp); } writel(tmp, ep-cfg-ep_cfg); @@ -282,13 +282,13 @@ net2280_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) if (!ep-dma) { /* pio, per-packet */ enable_pciirqenb(ep); - tmp = (1 DATA_PACKET_RECEIVED_INTERRUPT_ENABLE) - | (1 DATA_PACKET_TRANSMITTED_INTERRUPT_ENABLE); + tmp = BIT(DATA_PACKET_RECEIVED_INTERRUPT_ENABLE) | + BIT(DATA_PACKET_TRANSMITTED_INTERRUPT_ENABLE); if (dev-pdev-device == 0x2280) tmp |= readl (ep-regs-ep_irqenb); writel (tmp, ep-regs-ep_irqenb); } else {/* dma, per-request */ - tmp = (1 (8 + ep-num)); /* completion */ + tmp
[PATCH 2/5] usb: gadget: net2280: Dont use magic numbers
Instead of using magic numbers use #defines Signed-off-by: Ricardo Ribalda Delgado ricardo.riba...@gmail.com --- drivers/usb/gadget/net2280.c | 68 +++- drivers/usb/gadget/net2280.h | 1 + 2 files changed, 36 insertions(+), 33 deletions(-) diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c index 8112d91..ba1fdd8 100644 --- a/drivers/usb/gadget/net2280.c +++ b/drivers/usb/gadget/net2280.c @@ -152,7 +152,7 @@ static inline void enable_pciirqenb(struct net2280_ep *ep) { u32 tmp = readl(ep-dev-regs-pciirqenb0); - if (ep-dev-pdev-vendor == 0x17cc) + if (ep-dev-pdev-vendor == PCI_VENDOR_ID_PLX_LEGACY) tmp |= 1 ep-num; else tmp |= 1 ep_bit[ep-num]; @@ -182,7 +182,7 @@ net2280_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) if ((desc-bEndpointAddress 0x0f) == EP_DONTUSE) return -EDOM; - if (dev-pdev-vendor == 0x10b5) { + if (dev-pdev-vendor == PCI_VENDOR_ID_PLX) { if ((desc-bEndpointAddress 0x0f) = 0x0c) return -EDOM; ep-is_in = !!usb_endpoint_dir_in(desc); @@ -192,7 +192,8 @@ net2280_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) /* sanity check ep-e/ep-f since their fifos are small */ max = usb_endpoint_maxp (desc) 0x1fff; - if (ep-num 4 max 64 (dev-pdev-vendor == 0x17cc)) + if (ep-num 4 max 64 + (dev-pdev-vendor == PCI_VENDOR_ID_PLX_LEGACY)) return -ERANGE; spin_lock_irqsave (dev-lock, flags); @@ -237,7 +238,7 @@ net2280_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) } ep-is_iso = (tmp == USB_ENDPOINT_XFER_ISOC) ? 1 : 0; /* Enable this endpoint */ - if (dev-pdev-vendor == 0x17cc) { + if (dev-pdev-vendor == PCI_VENDOR_ID_PLX_LEGACY) { tmp = ENDPOINT_TYPE; tmp |= desc-bEndpointAddress; /* default full fifo lines */ @@ -472,7 +473,7 @@ static int net2280_disable (struct usb_ep *_ep) spin_lock_irqsave (ep-dev-lock, flags); nuke (ep); - if (ep-dev-pdev-vendor == 0x10b5) + if (ep-dev-pdev-vendor == PCI_VENDOR_ID_PLX) ep_reset_338x(ep-dev-regs, ep); else ep_reset_228x(ep-dev-regs, ep); @@ -799,7 +800,7 @@ static void start_queue (struct net2280_ep *ep, u32 dmactl, u32 td_dma) writel (readl (dma-dmastat), dma-dmastat); writel (td_dma, dma-dmadesc); - if (ep-dev-pdev-vendor == 0x10b5) + if (ep-dev-pdev-vendor == PCI_VENDOR_ID_PLX) dmactl |= (0x01 DMA_REQUEST_OUTSTANDING); writel (dmactl, dma-dmactl); @@ -995,7 +996,7 @@ net2280_queue (struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) /* DMA request while EP halted */ if (ep-dma (readl(ep-regs-ep_rsp) (1 CLEAR_ENDPOINT_HALT)) - (dev-pdev-vendor == 0x10b5)) { + (dev-pdev-vendor == PCI_VENDOR_ID_PLX)) { int valid = 1; if (ep-is_in) { int expect; @@ -1126,7 +1127,7 @@ static void scan_dma_completions (struct net2280_ep *ep) } else if (!ep-is_in (req-req.length % ep-ep.maxpacket) != 0) { tmp = readl (ep-regs-ep_stat); - if (ep-dev-pdev-vendor == 0x10b5) + if (ep-dev-pdev-vendor == PCI_VENDOR_ID_PLX) return dma_done(ep, req, tmp, 0); /* AVOID TROUBLE HERE by not issuing short reads from @@ -1234,7 +1235,7 @@ static void abort_dma_338x(struct net2280_ep *ep) static void abort_dma(struct net2280_ep *ep) { - if (ep-dev-pdev-vendor == 0x17cc) + if (ep-dev-pdev-vendor == PCI_VENDOR_ID_PLX_LEGACY) return abort_dma_228x(ep); return abort_dma_338x(ep); } @@ -1392,7 +1393,7 @@ net2280_set_halt_and_wedge(struct usb_ep *_ep, int value, int wedged) ep-wedged = 1; } else { clear_halt (ep); - if (ep-dev-pdev-vendor == 0x10b5 + if (ep-dev-pdev-vendor == PCI_VENDOR_ID_PLX !list_empty(ep-queue) ep-td_dma) restart_dma(ep); ep-wedged = 0; @@ -2104,7 +2105,7 @@ static void usb_reset_338x(struct net2280 *dev) static void usb_reset(struct net2280 *dev) { - if (dev-pdev-vendor == 0x17cc) + if (dev-pdev-vendor == PCI_VENDOR_ID_PLX_LEGACY) return usb_reset_228x(dev); return usb_reset_338x(dev); } @@ -2260,7 +2261,7 @@ static void usb_reinit_338x(struct
RE: [PATCH 3/5] usb: gadget: net2280: Use BIT() macro
From: Ricardo Ribalda Delgado Improves readability of the code Personally I don't find macros like BIT() improve the readability at all. What next? Maybe: #define ADD(a, b) ((a) + (b)) 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: [PATCH 2/3] usb: host: xhci-plat: add support for the R-Car H2 and M2 xHCI controllers
Hi Shimoda-san, Thanks for your patches, I did however find one typo below: On Mon, May 19, 2014 at 7:08 PM, Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com wrote: The R-Car H2 and M2 SoCs come with an xHCI controller that requires some specific initilization related to the firmware downloading and some specific registers. This patch adds the support for this special configuration as an xHCI quirk executed during probe and start. Signed-off-by: Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com --- drivers/usb/host/Kconfig |8 ++ drivers/usb/host/Makefile|3 + drivers/usb/host/xhci-plat.c | 18 + drivers/usb/host/xhci-rcar.c | 182 ++ drivers/usb/host/xhci-rcar.h | 28 +++ 5 files changed, 239 insertions(+) create mode 100644 drivers/usb/host/xhci-rcar.c create mode 100644 drivers/usb/host/xhci-rcar.h diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 9247ad2..229e968 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -37,6 +37,14 @@ config USB_XHCI_MVEBU Say 'Y' to enable the support for the xHCI host controller found in Marvell Armada 375/38x ARM SOCs. +config USB_XHCI_RCAR + tristate xHCI support for Renesas R-Car SoCs + select USB_XHCI_PLATFORM + depends on ARCH_SHMOBILE || COMPILE_TEST + ---help--- + Say 'Y' to enable the support for the xHCI host controller + found in Renesas R-Car ARM SoCs. + endif # USB_XHCI_HCD config USB_EHCI_HCD diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile index 7c0886a..b59ca3c 100644 --- a/drivers/usb/host/Makefile +++ b/drivers/usb/host/Makefile @@ -22,6 +22,9 @@ ifneq ($(CONFIG_USB_XHCI_PLATFORM), ) ifneq ($(CONFIG_USB_XHCI_MVEBU), ) xhci-hcd-y += xhci-mvebu.o endif +ifneq ($(CONFIG_USB_XHCI_RCAR), ) + xhci-hcd-y += xhci-rcar.o +endif endif obj-$(CONFIG_USB_WHCI_HCD) += whci/ diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 561d07e..3a2da1f 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -20,6 +20,7 @@ #include xhci.h #include xhci-mvebu.h +#include xhci-rcar.h static void xhci_plat_quirks(struct device *dev, struct xhci_hcd *xhci) { @@ -39,6 +40,12 @@ static int xhci_plat_setup(struct usb_hcd *hcd) static int xhci_plat_start(struct usb_hcd *hcd) { + struct device_node *of_node = hcd-self.controller-of_node; + + if (of_device_is_compatible(of_node, renesas,r8a7790-xhci) || + of_device_is_compatible(of_node, renesas,r8a7790-xhci)) + xhci_rcar_start(hcd); + This is most likely a typo - I believe this is supposed to be r8a7790 and r8a7791? Cheers, / magnus -- 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: [PROBLEM] USB problem causes the HW hang
On 05/19/2014 08:46 AM, lin du wrote: Add linux-usb in loop. Hello, When reload the xhci_hcd.ko continuously as following, we will see many error messages, even HW hang! (almost 300 times; if no sleep between rmmod and modprobe driver, the value should be smaller). Hi And thanks for this info I'm Interested in those error messages you got. I'd like to know what the underlying real problem is that gets fixed by adding a delay. Can you send the error messages you get with a new kernel (3.14 or the 3.15-rc2 you mentioned output) -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
Re: [PATCH 3/5] usb: gadget: net2280: Use BIT() macro
Hello David I dont want to start a flame war here :) but In the particular case of hardware registers I believe it does. This patch has been posted because on a previous patch to support the usb3380, one of the requested changes was to use this macro. In order to have consistent code in the file I have posted this patch. BTW, I havent defined the bit macro, just used it :P Cheers! On Mon, May 19, 2014 at 12:18 PM, David Laight david.lai...@aculab.com wrote: From: Ricardo Ribalda Delgado Improves readability of the code Personally I don't find macros like BIT() improve the readability at all. What next? Maybe: #define ADD(a, b) ((a) + (b)) David -- Ricardo Ribalda -- 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: set host request flag via sys input
Hello. On 19-05-2014 10:18, Li Jun wrote: From: Li Jun b47...@freescale.com This patch sets host request flag in sys input when a A device set a_bus_req or a B device set b_bus_req in peripheral role. Signed-off-by: Li Jun b47...@freescale.com --- drivers/usb/chipidea/otg_fsm.c | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c index 923b789..41faffa 100644 --- a/drivers/usb/chipidea/otg_fsm.c +++ b/drivers/usb/chipidea/otg_fsm.c [...] @@ -162,8 +167,14 @@ set_b_bus_req(struct device *dev, struct device_attribute *attr, mutex_lock(ci-fsm.lock); if (buf[0] == '0') ci-fsm.b_bus_req = 0; - else if (buf[0] == '1') + else if (buf[0] == '1') { {} should be used on both arms of the *if* statement since it's used on one arm, according to Documentation/CodingStyle. Though actually, a *switch* statement is asking to be here... ci-fsm.b_bus_req = 1; + if (ci-transceiver-state == OTG_STATE_B_PERIPHERAL) { + ci-gadget.host_request_flag = 1; + mutex_unlock(ci-fsm.lock); + return count; + } + } WBR, Sergei -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 1/6] usb: dwc3: dwc3-omap: Remove x_major calculation from revision register
Hello. On 19-05-2014 12:32, George Cherian wrote: Remove the x_major calculation logic from the wrapper revision register to differentiate between OMAP5 and AM437x. This was done to find the register offsets of wrapper register. Now that We do it using dt compatible, remove the whole logic. Signed-off-by: George Cherian george.cher...@ti.com --- drivers/usb/dwc3/dwc3-omap.c | 35 +++ 1 file changed, 3 insertions(+), 32 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c index 1160ff4..53f6490 100644 --- a/drivers/usb/dwc3/dwc3-omap.c +++ b/drivers/usb/dwc3/dwc3-omap.c [...] @@ -448,32 +442,9 @@ static int dwc3_omap_probe(struct platform_device *pdev) [...] - /* For OMAP5(ES2.0) and AM437x x_major is 2 even though there are -* changes in wrapper registers, Using dt compatible for aegis + /* Differentiate between OMAP5 and AM437x +* For OMAP5(ES2.0) and AM437x x_major is 2 even though there are +* changes in wrapper registers, Using dt compatible for AM437x This sentence doesn't look complete... */ if (of_device_is_compatible(node, ti,am437x-dwc3)) { WBR, Sergei -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v6 10/17] ARM: mvebu: add USB3 support for Armada 38x
On Fri, 2014-05-16 at 15:07 -0400, Jason Cooper wrote: On Thu, May 15, 2014 at 12:17:35PM +0200, Gregory CLEMENT wrote: This patch adds the selection of the config symbol needed to build the USB3 support for Armada 38x into mvebu_v7_defconfig. Signed-off-by: Gregory CLEMENT gregory.clem...@free-electrons.com Signed-off-by: Thomas Petazzoni thomas.petazz...@free-electrons.com --- arch/arm/mach-mvebu/Kconfig | 1 + 1 file changed, 1 insertion(+) Patches 10 and 11 applied to mvebu/soc These two just hit linux-next (in next-20140519). They're pointless, as config USB_ARCH_HAS_XHCI was dropped in commit b797b76fb464 (usb: host: remove USB_ARCH_HAS_?HCI). Paul Bolle -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH V3 0/4] dts: Add usb2phy to Exynos 5250/5420
Based on 'for-next' branch of Kgene's linux-samsung tree. These patches are as per discussions on the driver side patches which have already been acked. [1] Changes from v2: - Addressed kukjin's comments to update DT binding documentation for sysreg. - removed the version for each patch. Made all patches version as same. Changes from v1: - Rebase on 'for-next' branch. - Removed 'phy-names' property as per discuusion in the driver patches. [1] V1 of this series was the next version for earlier patch-series: [PATCH v7 0/2] dts: Add usb2phy to Exynos 5250 [2] Changes from v7 series: - Added patches to enable usb 2.0 support on exynos5420; which include dt nodes for usb2phy as well as ehci and ohci controllers. Changes from v6: - Splitted the patch into two: adding syscon nodes to Exynos5250 and Exynos5420 in first; and phy entry change in the second. - Changed the name of phandle for usb2phy from 'usb2_phy_new' to 'usb2_phy_gen' indicating generic phy. - Using clock macros in dt entries. [1] http://www.spinics.net/lists/linux-usb/msg106908.html http://www.spinics.net/lists/linux-usb/msg106837.html [2] http://www.spinics.net/lists/linux-usb/msg106427.html Kamil Debski (1): ARM: dts: Add usb2phy to Exynos 5250 Vivek Gautam (3): ARM: dts: Add sysreg sytem controller node to exynos5250 and exynos5420 ARM: dts: Add usb2phy support on exynos5420 ARM: dts: Add usb 2.0 support on exynos5420 .../devicetree/bindings/arm/samsung/sysreg.txt | 11 - arch/arm/boot/dts/exynos5250.dtsi | 27 arch/arm/boot/dts/exynos5420.dtsi | 45 3 files changed, 81 insertions(+), 2 deletions(-) -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH V3 1/4] ARM: dts: Add sysreg sytem controller node to exynos5250 and exynos5420
From: Vivek Gautam gautam.vi...@samsung.com This patch adds sysreg-syscon node to exynos5250 and exynos5420 device tree, to access System Register's registers using syscon driver. Signed-off-by: Kamil Debski k.deb...@samsung.com [gautam.vi...@samsung.com: Split this syreg-syscon dts entry from dts: Add usb2phy to Exynos 5250 patch] [gautam.vi...@samsung.com: added similar syscon entry for exynos5420] Signed-off-by: Vivek Gautam gautam.vi...@samsung.com [vikas.saj...@samsung.com: updated the binding document] Signed-off-by: Vikas Sajjan vikas.saj...@samsung.com --- .../devicetree/bindings/arm/samsung/sysreg.txt | 11 +-- arch/arm/boot/dts/exynos5250.dtsi |5 + arch/arm/boot/dts/exynos5420.dtsi |5 + 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/arm/samsung/sysreg.txt b/Documentation/devicetree/bindings/arm/samsung/sysreg.txt index 0ab3251..4fced6e 100644 --- a/Documentation/devicetree/bindings/arm/samsung/sysreg.txt +++ b/Documentation/devicetree/bindings/arm/samsung/sysreg.txt @@ -1,8 +1,10 @@ SAMSUNG S5P/Exynos SoC series System Registers (SYSREG) Properties: - - compatible : should contain samsung,chip name-sysreg, syscon; - For Exynos4 SoC series it should be samsung,exynos4-sysreg, syscon; + - compatible : should contain two values. First value must be one from following list: + - samsung,exynos4-sysreg - for Exynos4 based SoCs, + - samsung,exynos5-sysreg - for Exynos5 based SoCs. + second value must be always syscon. - reg : offset and length of the register set. Example: @@ -10,3 +12,8 @@ Example: compatible = samsung,exynos4-sysreg, syscon; reg = 0x1001 0x400; }; + + syscon@1005 { + compatible = samsung,exynos5-sysreg, syscon; + reg = 0x1005 0x5000; + }; diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi index 68a3e6f..8e9b9a3 100644 --- a/arch/arm/boot/dts/exynos5250.dtsi +++ b/arch/arm/boot/dts/exynos5250.dtsi @@ -193,6 +193,11 @@ reg = 0x1004 0x5000; }; + sysreg_system_controller: syscon@1005 { + compatible = samsung,exynos5-sysreg, syscon; + reg = 0x1005 0x5000; + }; + watchdog@101D { compatible = samsung,exynos5250-wdt; reg = 0x101D 0x100; diff --git a/arch/arm/boot/dts/exynos5420.dtsi b/arch/arm/boot/dts/exynos5420.dtsi index 13a083e..f9b051b 100644 --- a/arch/arm/boot/dts/exynos5420.dtsi +++ b/arch/arm/boot/dts/exynos5420.dtsi @@ -725,6 +725,11 @@ reg = 0x1004 0x5000; }; + sysreg_system_controller: syscon@1005 { + compatible = samsung,exynos5-sysreg, syscon; + reg = 0x1005 0x5000; + }; + tmu_cpu0: tmu@1006 { compatible = samsung,exynos5420-tmu; reg = 0x1006 0x100; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH V3 3/4] ARM: dts: Add usb2phy support on exynos5420
From: Vivek Gautam gautam.vi...@samsung.com Add required device node for usb2phy to let enable USB 2.0 support. Signed-off-by: Vivek Gautam gautam.vi...@samsung.com --- arch/arm/boot/dts/exynos5420.dtsi | 10 ++ 1 file changed, 10 insertions(+) diff --git a/arch/arm/boot/dts/exynos5420.dtsi b/arch/arm/boot/dts/exynos5420.dtsi index f9b051b..2eb00cb 100644 --- a/arch/arm/boot/dts/exynos5420.dtsi +++ b/arch/arm/boot/dts/exynos5420.dtsi @@ -838,4 +838,14 @@ samsung,pmu-syscon = pmu_system_controller; #phy-cells = 1; }; + + usb2_phy: phy@1213 { + compatible = samsung,exynos5250-usb2-phy; + reg = 0x1213 0x100; + clocks = clock CLK_USBH20, clock CLK_SCLK_USBPHY300; + clock-names = phy, ref; + #phy-cells = 1; + samsung,sysreg-phandle = sysreg_system_controller; + samsung,pmureg-phandle = pmu_system_controller; + }; }; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH V3 4/4] ARM: dts: Add usb 2.0 support on exynos5420
From: Vivek Gautam gautam.vi...@samsung.com Add required device node for ehci and ohci controllers to enable USB 2.0 support. Signed-off-by: Vivek Gautam gautam.vi...@samsung.com --- arch/arm/boot/dts/exynos5420.dtsi | 30 ++ 1 file changed, 30 insertions(+) diff --git a/arch/arm/boot/dts/exynos5420.dtsi b/arch/arm/boot/dts/exynos5420.dtsi index 2eb00cb..921885a 100644 --- a/arch/arm/boot/dts/exynos5420.dtsi +++ b/arch/arm/boot/dts/exynos5420.dtsi @@ -839,6 +839,36 @@ #phy-cells = 1; }; + usbhost2: usb@1211 { + compatible = samsung,exynos4210-ehci; + reg = 0x1211 0x100; + interrupts = 0 71 0; + + clocks = clock CLK_USBH20; + clock-names = usbhost; + #address-cells = 1; + #size-cells = 0; + port@0 { + reg = 0; + phys = usb2_phy 1; + }; + }; + + usbhost1: usb@1212 { + compatible = samsung,exynos4210-ohci; + reg = 0x1212 0x100; + interrupts = 0 71 0; + + clocks = clock CLK_USBH20; + clock-names = usbhost; + #address-cells = 1; + #size-cells = 0; + port@0 { + reg = 0; + phys = usb2_phy 1; + }; + }; + usb2_phy: phy@1213 { compatible = samsung,exynos5250-usb2-phy; reg = 0x1213 0x100; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH V3 2/4] ARM: dts: Add usb2phy to Exynos 5250
From: Kamil Debski k.deb...@samsung.com Add support to PHY of USB2 of the Exynos 5250 SoC. Signed-off-by: Kamil Debski k.deb...@samsung.com [gautam.vi...@samsung.com: Split the usb phy entries from syscon entries from earlier patch: dts: Add usb2phy to Exynos 5250] [gautam.vi...@samsung.com: Added phy entry for OHCI also along with EHCI] Signed-off-by: Vivek Gautam gautam.vi...@samsung.com --- arch/arm/boot/dts/exynos5250.dtsi | 22 ++ 1 file changed, 22 insertions(+) diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi index 8e9b9a3..cb29642 100644 --- a/arch/arm/boot/dts/exynos5250.dtsi +++ b/arch/arm/boot/dts/exynos5250.dtsi @@ -577,6 +577,12 @@ clocks = clock CLK_USB2; clock-names = usbhost; + #address-cells = 1; + #size-cells = 0; + port@0 { + reg = 0; + phys = usb2_phy_gen 1; + }; }; usb@1212 { @@ -586,6 +592,12 @@ clocks = clock CLK_USB2; clock-names = usbhost; + #address-cells = 1; + #size-cells = 0; + port@0 { + reg = 0; + phys = usb2_phy_gen 1; + }; }; usb2_phy: usbphy@1213 { @@ -603,6 +615,16 @@ }; }; + usb2_phy_gen: phy@1213 { + compatible = samsung,exynos5250-usb2-phy; + reg = 0x1213 0x100; + clocks = clock CLK_USB2, clock CLK_FIN_PLL; + clock-names = phy, ref; + #phy-cells = 1; + samsung,sysreg-phandle = sysreg_system_controller; + samsung,pmureg-phandle = pmu_system_controller; + }; + pwm: pwm@12dd { compatible = samsung,exynos4210-pwm; reg = 0x12dd 0x100; -- 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 v6 5/8] ARM: dts: exynos5250-snow: Add Vbus regulator for USB 3.0
Vivek Gautam wrote: Add required fixed-regulator for VBUS supply for USB 3.0 controller phy. Signed-off-by: Vivek Gautam gautam.vi...@samsung.com --- arch/arm/boot/dts/exynos5250-snow.dts | 22 ++ 1 file changed, 22 insertions(+) diff --git a/arch/arm/boot/dts/exynos5250-snow.dts b/arch/arm/boot/dts/exynos5250-snow.dts index 1ce1088..fd9b3b3 100644 --- a/arch/arm/boot/dts/exynos5250-snow.dts +++ b/arch/arm/boot/dts/exynos5250-snow.dts @@ -37,6 +37,13 @@ sd3_bus4: sd3-bus-width4 { samsung,pin-drv = 0; }; + + usb3_vbus_en: usb3-vbus-en { + samsung,pins = gpx2-7; + samsung,pin-function = 1; + samsung,pin-pud = 0; + samsung,pin-drv = 0; + }; }; gpio-keys { @@ -196,6 +203,21 @@ }; }; + usb3_vbus_reg: regulator-usb3 { + compatible = regulator-fixed; + regulator-name = P5.0V_USB3CON; + regulator-min-microvolt = 500; + regulator-max-microvolt = 500; + gpio = gpx2 7 0; + pinctrl-names = default; + pinctrl-0 = usb3_vbus_en; + enable-active-high; + }; + + phy@1210 { + vbus-supply = usb3_vbus_reg; + }; + usb@1211 { samsung,vbus-gpio = gpx1 1 0; }; -- 1.7.10.4 Looks OK to me and applied 5 to 8 as well. Thanks, Kukjin -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] usb: dwc3: gadget: check link trb after free_slot is increased
On Fri, May 16, 2014 at 10:47:18PM +0800, Zhuang Jin Can wrote: Hi, On Fri, May 16, 2014 at 07:41:06AM -0500, Felipe Balbi wrote: On Fri, May 16, 2014 at 11:50:13PM +0800, Zhuang Jin Can wrote: On Fri, May 16, 2014 at 05:57:57AM +0800, Zhuang Jin Can wrote: In ISOC transfers, when free_slot points to the last TRB (i.e. Link TRB), and all queued requests meet Missed Interval Isoc error, busy_slot points to trb0. busy_slot-trb0 trb1 ... free_slot-trb31(Link TRB) After end transfer and receiving the XferNotReady event, trb_left is caculated as 1 which is wrong, and no TRB will be primed to the endpoint. The root cause is free_slot is not increased the same way as busy_slot. When busy_slot is increased by one, it checks if points to a link TRB after increasement, but free_slot checks it before increasement. free_slot should behave the same as busy_slot to make the trb_left caculation correct. Reviewing the code it seems that observation of Zhuang Jin Can is correct. Year back I did lot of testing with isoc and even with missed path, but may be I could not get this issue because I would not have landed into a situation where last missed TRB is 31st. Infact, you could be able to see that bug even in other case, like submit 31 back to back ep_queue request from gadget and then wait as if no application data is available. They all have been transmitted to host and callback has been called for all of them. After some time application is ready with new data. So when gadget does ep_queue of this new data you should be able to see this issue. Reviewed-by: Pratyush Anand pratyush.an...@st.com Regards Pratyush been Signed-off-by: Zhuang Jin Can jin.can.zhu...@intel.com Signed-off-by: Jiebing Li jiebing...@intel.com --- drivers/usb/dwc3/gadget.c |8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 54da8c8..2ebe82b 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -828,10 +828,6 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep, length, last ? last : , chain ? chain : ); - /* Skip the LINK-TRB on ISOC */ - if (((dep-free_slot DWC3_TRB_MASK) == DWC3_TRB_NUM - 1) - usb_endpoint_xfer_isoc(dep-endpoint.desc)) - dep-free_slot++; trb = dep-trb_pool[dep-free_slot DWC3_TRB_MASK]; I have a feeling this has a negative side effect of letting us use the link TRB for data transfer... I mean, if we don't increment free_slot before accessing our trb_pool, we have no way to skip link trb on this access here. After every free_slot++ Link TRB is checked and increased if appropriate, this guarantees you next time access free_slot, it can't be a Link TRB. right, next access will be fine, but you're forgetting about current access. The current access is the next access relative to last access. So if the first access is fine, succeeding accesses should be fine. And the first access happens on when the free_slot points to slot 1 which is not a link trb. How did you find the bug ? do you have good instructions on how to reproduce it ? How did you test the patch and for how long ? The bug is reproduced on Android with f_audio_source.c enabled, which has an isoc-in endpoint keeps sending audio data to host in an interval of 1 ms. Normally, you need to run for 12+ hours to hit the issue. So I think you can just run some isoc transfers for a long time to reproduce it. To accelarte the reproducing, you can run some concurrent data transfer as well, so the possibility to meet missed interval error is larger. The patch is tested for basic functionality like enumeration, data transfers. For this bug, it was tested for 20+ hours. thanks, g_audio loop should be fine. np. Regards Jincan -- 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] udl: proper error reporting
From: Oliver Neukum oneu...@suse.de Parsing device descriptors can fail due to a failed memory allocation. The error needs to be properly propagated to the upper layers. Signed-off-by: Oliver Neukum oneu...@suse.de --- drivers/gpu/drm/udl/udl_main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/udl/udl_main.c b/drivers/gpu/drm/udl/udl_main.c index f5ae574..afdf383 100644 --- a/drivers/gpu/drm/udl/udl_main.c +++ b/drivers/gpu/drm/udl/udl_main.c @@ -283,7 +283,7 @@ int udl_submit_urb(struct drm_device *dev, struct urb *urb, size_t len) int udl_driver_load(struct drm_device *dev, unsigned long flags) { struct udl_device *udl; - int ret; + int ret = -ENOMEM; DRM_DEBUG(\n); udl = kzalloc(sizeof(struct udl_device), GFP_KERNEL); @@ -299,7 +299,6 @@ int udl_driver_load(struct drm_device *dev, unsigned long flags) } if (!udl_alloc_urb_list(dev, WRITES_IN_FLIGHT, MAX_TRANSFER)) { - ret = -ENOMEM; DRM_ERROR(udl_alloc_urb_list failed\n); goto err; } -- 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
[PATCH] yurex: fix race between probe() and read()
From: Oliver Neukum oneu...@suse.de There's a window during which read() would return 0 instead of a correct error for no data yet. Reorder initialization to fix the race. Signed-off-by: Oliver Neukum oneu...@suse.de --- drivers/usb/misc/yurex.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c index 2427820..1472805 100644 --- a/drivers/usb/misc/yurex.c +++ b/drivers/usb/misc/yurex.c @@ -296,6 +296,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_ /* save our data pointer in this interface device */ usb_set_intfdata(interface, dev); + dev-bbu = -1; /* we can register the device now, as it is ready */ retval = usb_register_dev(interface, yurex_class); @@ -306,8 +307,6 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_ goto error; } - dev-bbu = -1; - dev_info(interface-dev, USB YUREX device now attached to Yurex #%d\n, interface-minor); -- 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
[PATCH] appledisplay: fix race between reading and writing from the device
From: Oliver Neukum oneu...@suse.de The workqueue handler may call appledisplay_bl_get_brightness() while user space calls appledisplay_bl_update_status(). As they share a buffer that must not happen. Use a mutex for mutual exclusion. Signed-off-by: Oliver Neukum oneu...@suse.de --- drivers/usb/misc/appledisplay.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/usb/misc/appledisplay.c b/drivers/usb/misc/appledisplay.c index ba6a5d6..55acd44 100644 --- a/drivers/usb/misc/appledisplay.c +++ b/drivers/usb/misc/appledisplay.c @@ -81,6 +81,7 @@ struct appledisplay { struct delayed_work work; int button_pressed; spinlock_t lock; + struct mutex sysfslock; /* concurrent read and write */ }; static atomic_t count_displays = ATOMIC_INIT(0); @@ -144,6 +145,7 @@ static int appledisplay_bl_update_status(struct backlight_device *bd) struct appledisplay *pdata = bl_get_data(bd); int retval; + mutex_lock(pdata-sysfslock); pdata-msgdata[0] = 0x10; pdata-msgdata[1] = bd-props.brightness; @@ -156,15 +158,17 @@ static int appledisplay_bl_update_status(struct backlight_device *bd) 0, pdata-msgdata, 2, ACD_USB_TIMEOUT); - + mutex_unlock(pdata-sysfslock); + return retval; } static int appledisplay_bl_get_brightness(struct backlight_device *bd) { struct appledisplay *pdata = bl_get_data(bd); - int retval; + int retval, brightness; + mutex_lock(pdata-sysfslock); retval = usb_control_msg( pdata-udev, usb_rcvctrlpipe(pdata-udev, 0), @@ -174,11 +178,13 @@ static int appledisplay_bl_get_brightness(struct backlight_device *bd) 0, pdata-msgdata, 2, ACD_USB_TIMEOUT); + brightness = pdata-msgdata[1]; + mutex_unlock(pdata-sysfslock); if (retval 0) return retval; else - return pdata-msgdata[1]; + return brightness; } static const struct backlight_ops appledisplay_bl_data = { @@ -241,6 +247,7 @@ static int appledisplay_probe(struct usb_interface *iface, spin_lock_init(pdata-lock); INIT_DELAYED_WORK(pdata-work, appledisplay_work); + mutex_init(pdata-sysfslock); /* Allocate buffer for control messages */ pdata-msgdata = kmalloc(ACD_MSG_BUFFER_LEN, GFP_KERNEL); -- 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
[PATCH] usbtmc: fix DMA on stack
From: Oliver Neukum oneu...@suse.de send_request_dev_dep_msg_in() use a buffer allocated on the stack. Fix by kmalloc()ing the buffer. Signed-off-by: Oliver Neukum oneu...@suse.de --- drivers/usb/class/usbtmc.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c index cfbec9c..103a6e9 100644 --- a/drivers/usb/class/usbtmc.c +++ b/drivers/usb/class/usbtmc.c @@ -383,9 +383,12 @@ exit: static int send_request_dev_dep_msg_in(struct usbtmc_device_data *data, size_t transfer_size) { int retval; - u8 buffer[USBTMC_HEADER_SIZE]; + u8 *buffer; int actual; + buffer = kmalloc(USBTMC_HEADER_SIZE, GFP_KERNEL); + if (!buffer) + return -ENOMEM; /* Setup IO buffer for REQUEST_DEV_DEP_MSG_IN message * Refer to class specs for details */ @@ -417,6 +420,7 @@ static int send_request_dev_dep_msg_in(struct usbtmc_device_data *data, size_t t if (!data-bTag) data-bTag++; + kfree(buffer); if (retval 0) { dev_err(data-intf-dev, usb_bulk_msg in send_request_dev_dep_msg_in() returned %d\n, retval); return retval; -- 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
[PATCH] cdc-acm: use BIT macro
From: Oliver Neukum oneu...@suse.de Converting the header to BIT for readability. No functional change. Signed-off-by: Oliver Neukum oneu...@suse.de --- drivers/usb/class/cdc-acm.h | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/usb/class/cdc-acm.h b/drivers/usb/class/cdc-acm.h index e38dc78..5deee54 100644 --- a/drivers/usb/class/cdc-acm.h +++ b/drivers/usb/class/cdc-acm.h @@ -126,9 +126,9 @@ struct acm { #define CDC_DATA_INTERFACE_TYPE0x0a /* constants describing various quirks and errors */ -#define NO_UNION_NORMAL1 -#define SINGLE_RX_URB 2 -#define NO_CAP_LINE4 -#define NOT_A_MODEM8 -#define NO_DATA_INTERFACE 16 -#define IGNORE_DEVICE 32 +#define NO_UNION_NORMALBIT(0) +#define SINGLE_RX_URB BIT(1) +#define NO_CAP_LINEBIT(2) +#define NOT_A_MODEMBIT(3) +#define NO_DATA_INTERFACE BIT(4) +#define IGNORE_DEVICE BIT(5) -- 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 2/3] usb: host: xhci-plat: add support for the R-Car H2 and M2 xHCI controllers
Hi Shimoda-san, On Mon, May 19, 2014 at 12:08 PM, Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com wrote: The R-Car H2 and M2 SoCs come with an xHCI controller that requires some specific initilization related to the firmware downloading and some specific registers. This patch adds the support for this special configuration as an xHCI quirk executed during probe and start. Thanks for your patch! diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 9247ad2..229e968 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -37,6 +37,14 @@ config USB_XHCI_MVEBU Say 'Y' to enable the support for the xHCI host controller found in Marvell Armada 375/38x ARM SOCs. +config USB_XHCI_RCAR + tristate xHCI support for Renesas R-Car SoCs + select USB_XHCI_PLATFORM + depends on ARCH_SHMOBILE || COMPILE_TEST + ---help--- + Say 'Y' to enable the support for the xHCI host controller + found in Renesas R-Car ARM SoCs. Does R-Car Gen1 also have xHCI, and is it compatible? If not, you may want to call this driver USB_XHCI_RCAR2. diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 561d07e..3a2da1f 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -39,6 +40,12 @@ static int xhci_plat_setup(struct usb_hcd *hcd) static int xhci_plat_start(struct usb_hcd *hcd) { + struct device_node *of_node = hcd-self.controller-of_node; + + if (of_device_is_compatible(of_node, renesas,r8a7790-xhci) || + of_device_is_compatible(of_node, renesas,r8a7790-xhci)) r8a7791, as Magnus already pointed out. + xhci_rcar_start(hcd); If CONFIG_USB_XHCI_RCAR is not defined, xhci_rcar_start() is a dummy function, but the of_device_is_compatible() checks will still be compiled in. Hence perhaps an #ifdef CONFIG_USB_XHCI_RCAR is warranted here, possibly combined with inclusion of a C-source file, like is done in drivers/usb/host/ohci-hcd.c? It's up to the USB maintainer to decide this, though. + return xhci_run(hcd); } @@ -165,6 +172,15 @@ static int xhci_plat_probe(struct platform_device *pdev) goto unmap_registers; } + if (of_device_is_compatible(pdev-dev.of_node, + renesas,r8a7790-xhci) || + of_device_is_compatible(pdev-dev.of_node, + renesas,r8a7791-xhci)) { + ret = xhci_rcar_init_quirk(pdev); Same here. + if (ret) + goto disable_clk; + } + ret = usb_add_hcd(hcd, irq, IRQF_SHARED); if (ret) goto disable_clk; --- /dev/null +++ b/drivers/usb/host/xhci-rcar.c +/* USB3.0 Configuraion */ Configuration +static int xhci_rcar_download_firmware(struct device *dev, void __iomem *regs) +{ + const struct firmware *fw; + int retval, index, j, time; + int timeout = 1; + u32 data, val, temp; + + /* request R-Car USB3.0 firmware */ + retval = request_firmware(fw, FIRMWARE_NAME, dev); + if (retval) + return retval; + + /* download R-Car USB3.0 firmware */ + temp = readl(regs + RCAR_USB3_DL_CTRL); + temp |= RCAR_USB3_DL_CTRL_ENABLE; + writel(temp, regs + RCAR_USB3_DL_CTRL); + + for (index = 0; index fw-size; index += 4) { + for (data = 0, j = 3; j = 0; j--) { + if ((j + index) = fw-size) + continue; + data |= fw-data[index + j] (8 * j); + } This is your custom get_unaligned_le32(), to avoid reading beyond the end of the buffer if its size is not a multiple of 4 bytes? Is there some way to just use get_unaligned_le32()? If you want to keep it, I would rewrite it as for (data = 0, j = 3; j = 0; j--) { if ((j + index) fw-size) data |= fw-data[index + j] (8 * j); } Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say programmer or something like that. -- Linus Torval -- 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] Documentation: dt-bindings: update xhci-platform DT binding for R-Car H2 and M2
On Mon, May 19, 2014 at 12:08 PM, Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com wrote: This commit extends the compatible string list of the xhci-platform binding with the new renesas,r8a7790-xhci and renesas,r8a7791-xhci compatible strings. It is used to describe the xHCI controller which is available in the R-Car H2 and M2 SoCs. Signed-off-by: Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com Acked-by: Geert Uytterhoeven ge...@linux-m68k.org Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say programmer or something like that. -- Linus Torvalds -- 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: host: xhci-plat: add xhci_plat_start()
On Mon, May 19, 2014 at 12:07 PM, Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com wrote: Some platforms (such as the Renesas R-Car) need to initialize some specific registers after xhci driver calls usb_add_hcd() and before the driver calls xhci_run(). So, this patch adds the xhci_plat_start() function. Signed-off-by: Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com Acked-by: Geert Uytterhoeven ge...@linux-m68k.org Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say programmer or something like that. -- Linus Torvalds -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/3] usb: host: xhci-plat: add support for the R-Car H2 and M2 xHCI controllers
Hello. On 19-05-2014 14:08, Yoshihiro Shimoda wrote: The R-Car H2 and M2 SoCs come with an xHCI controller that requires some specific initilization related to the firmware downloading and some specific registers. This patch adds the support for this special configuration as an xHCI quirk executed during probe and start. Signed-off-by: Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com [...] diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 561d07e..3a2da1f 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -20,6 +20,7 @@ #include xhci.h #include xhci-mvebu.h +#include xhci-rcar.h static void xhci_plat_quirks(struct device *dev, struct xhci_hcd *xhci) { @@ -39,6 +40,12 @@ static int xhci_plat_setup(struct usb_hcd *hcd) static int xhci_plat_start(struct usb_hcd *hcd) { + struct device_node *of_node = hcd-self.controller-of_node; + + if (of_device_is_compatible(of_node, renesas,r8a7790-xhci) || + of_device_is_compatible(of_node, renesas,r8a7790-xhci)) Perhaps renesas,r8a7791-xhci? + xhci_rcar_start(hcd); + return xhci_run(hcd); } [...] diff --git a/drivers/usb/host/xhci-rcar.c b/drivers/usb/host/xhci-rcar.c new file mode 100644 index 000..3c0bfae --- /dev/null +++ b/drivers/usb/host/xhci-rcar.c @@ -0,0 +1,182 @@ +/* + * xHCI host controller driver for R-Car SoCs + * + * Copyright (C) 2014 Renesas Electronics Corporation + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + */ + +#include linux/firmware.h +#include linux/module.h +#include linux/platform_device.h +#include linux/usb/phy.h + +#include xhci.h +#include xhci-rcar.h + +#define FIRMWARE_NAME r8a779x_usb3_v1.dlmem + +/*** Register Offset ***/ +#define RCAR_USB3_INT_ENA 0x224 /* Interrupt Enable */ +#define RCAR_USB3_DL_CTRL 0x250 /* FW Download Control Status */ +#define RCAR_USB3_FW_DATA0 0x258 /* FW Data0 */ + +#define RCAR_USB3_LCLK 0xa44 /* LCLK Select */ +#define RCAR_USB3_CONF10xa48 /* USB3.0 Configuration1 */ +#define RCAR_USB3_CONF20xa5c /* USB3.0 Configuration2 */ +#define RCAR_USB3_CONF30xaa8 /* USB3.0 Configuration3 */ +#define RCAR_USB3_RX_POL 0xab0 /* USB3.0 RX Polarity */ +#define RCAR_USB3_TX_POL 0xab8 /* USB3.0 TX Polarity */ + +/*** Register Settings ***/ +/* Interrupt Enable */ +#define RCAR_USB3_INT_XHC_ENA 0x0001 +#define RCAR_USB3_INT_PME_ENA 0x0002 +#define RCAR_USB3_INT_HSE_ENA 0x0004 +#define RCAR_USB3_INT_ENA_VAL (RCAR_USB3_INT_XHC_ENA | \ + RCAR_USB3_INT_PME_ENA | RCAR_USB3_INT_HSE_ENA) + +/* FW Download Control Status */ +#define RCAR_USB3_DL_CTRL 0x250 Already #define'd. +/* USB3.0 Configuraion */ Configuration. +int xhci_rcar_start(struct usb_hcd *hcd) +{ + if (hcd-regs != NULL) { + u32 temp; Need empty line here... and should perhaps return error if hcd-regs NULL? + /* Interrupt Enable */ + temp = readl(hcd-regs + RCAR_USB3_INT_ENA); + temp |= RCAR_USB3_INT_ENA_VAL; + writel(temp, hcd-regs + RCAR_USB3_INT_ENA); + /* LCLK Select */ + writel(RCAR_USB3_LCLK_ENA_VAL, hcd-regs + RCAR_USB3_LCLK); + /* USB3.0 Configuration */ + writel(RCAR_USB3_CONF1_VAL, hcd-regs + RCAR_USB3_CONF1); + writel(RCAR_USB3_CONF2_VAL, hcd-regs + RCAR_USB3_CONF2); + writel(RCAR_USB3_CONF3_VAL, hcd-regs + RCAR_USB3_CONF3); + /* USB3.0 Polariy */ + writel(RCAR_USB3_RX_POL_VAL, hcd-regs + RCAR_USB3_RX_POL); + writel(RCAR_USB3_TX_POL_VAL, hcd-regs + RCAR_USB3_TX_POL); + } + + return 0; +} [...] 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: Longcheer SU9800 usb 3g modem 1c9e:9800
On Sat, 2014-05-17 at 05:08 +0700, Alif Mubarak Ahmad wrote: This device vendor and product id is 1c9e:9800 It is working as serial interface with generic usbserial driver. I thought it is more suitable to use usbserial option driver, which has better capability distinguishing between modem serial interface and micro sd storage interface. Hi, does this solve the problem? Regards Oliver From a086773ae5dd1c417264937d049b93f45bac3991 Mon Sep 17 00:00:00 2001 From: Oliver Neukum oneu...@suse.de Date: Mon, 19 May 2014 14:13:51 +0200 Subject: [PATCH] option: add device ID Reported by Alif Mubarak Ahmad: This device vendor and product id is 1c9e:9800 It is working as serial interface with generic usbserial driver. I thought it is more suitable to use usbserial option driver, which has better capability distinguishing between modem serial interface and micro sd storage interface. Signed-off-by: Oliver Neukum oneu...@suse.de --- drivers/usb/serial/option.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index f213ee9..5853fdf 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c @@ -351,6 +351,9 @@ static void option_instat_callback(struct urb *urb); /* Zoom */ #define ZOOM_PRODUCT_4597 0x9607 +/* SU9800 usb 3g modem*/ +#define SU9800_PRODUCT 0x9800 + /* Haier products */ #define HAIER_VENDOR_ID0x201e #define HAIER_PRODUCT_CE1000x2009 @@ -1575,6 +1578,7 @@ static const struct usb_device_id option_ids[] = { { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14), .driver_info = (kernel_ulong_t)four_g_w14_blacklist }, + { USB_DEVICE_INTERFACE_CLASS(LONGCHEER_VENDOR_ID, SU9800_PRODUCT, 0xff) }, { USB_DEVICE(LONGCHEER_VENDOR_ID, ZOOM_PRODUCT_4597) }, { USB_DEVICE(LONGCHEER_VENDOR_ID, IBALL_3_5G_CONNECT) }, { USB_DEVICE(HAIER_VENDOR_ID, HAIER_PRODUCT_CE100) }, -- 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
[PATCH v4 6/6] usb: musb: dsps: Enable sw babble control for newer silicon
Find whether we are running on newer silicon. The babble control register reads 0x4 by default in newer silicon as opposed to 0 in old versions of AM335x. Based on this enable the sw babble control logic. Signed-off-by: George Cherian george.cher...@ti.com --- drivers/usb/musb/musb_dsps.c | 37 +++-- 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index eb1985a..8daccb2 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c @@ -136,6 +136,7 @@ struct dsps_glue { const struct dsps_musb_wrapper *wrp; /* wrapper register offsets */ struct timer_list timer;/* otg_workaround timer */ unsigned long last_timer;/* last timer data for each instance */ + bool sw_babble_enabled; struct dsps_context context; struct debugfs_regset32 regset; @@ -469,6 +470,19 @@ static int dsps_musb_init(struct musb *musb) val = ~(1 wrp-otg_disable); dsps_writel(musb-ctrl_base, wrp-phy_utmi, val); + /* +* Check whether the dsps version has babble control enabled. +* In latest silicon revision the babble control logic is enabled. +* If MUSB_BABBLE_CTL returns 0x4 then we have the babble control +* logic enabled. +*/ + val = dsps_readb(musb-mregs, MUSB_BABBLE_CTL); + if (val == MUSB_BABBLE_RCV_DISABLE) { + glue-sw_babble_enabled = true; + val |= MUSB_BABBLE_SW_SESSION_CTRL; + dsps_writeb(musb-mregs, MUSB_BABBLE_CTL, val); + } + ret = dsps_musb_dbg_init(musb, glue); if (ret) return ret; @@ -591,14 +605,25 @@ static int dsps_musb_reset(struct musb *musb) struct device *dev = musb-controller; struct dsps_glue *glue = dev_get_drvdata(dev-parent); const struct dsps_musb_wrapper *wrp = glue-wrp; + int session_restart = 0; - dsps_writel(musb-ctrl_base, wrp-control, (1 wrp-reset)); - usleep_range(100, 200); - usb_phy_shutdown(musb-xceiv); - usleep_range(100, 200); - usb_phy_init(musb-xceiv); + if (glue-sw_babble_enabled) + session_restart = sw_babble_control(musb); + /* +* In case of new silicon version babble condition can be recovered +* without resetting the MUSB. But for older silicon versions, MUSB +* reset is needed +*/ + if (session_restart || !glue-sw_babble_enabled) { + dsps_writel(musb-ctrl_base, wrp-control, (1 wrp-reset)); + usleep_range(100, 200); + usb_phy_shutdown(musb-xceiv); + usleep_range(100, 200); + usb_phy_init(musb-xceiv); + session_restart = 1; + } - return 0; + return !session_restart; } static struct musb_platform_ops dsps_ops = { -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 3/6] usb: musb: dsps: Call usb_phy(_shutdown/_init) during musb_platform_reset()
For DSPS platform usb_phy_vbus(_off/_on) are NOPs. So during musb_platform_reset() call usb_phy(_shutdown/_init) Signed-off-by: George Cherian george.cher...@ti.com --- drivers/usb/musb/musb_dsps.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index 51beb13..74c4193 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c @@ -543,7 +543,11 @@ static void dsps_musb_reset(struct musb *musb) const struct dsps_musb_wrapper *wrp = glue-wrp; dsps_writel(musb-ctrl_base, wrp-control, (1 wrp-reset)); - udelay(100); + usleep_range(100, 200); + usb_phy_shutdown(musb-xceiv); + usleep_range(100, 200); + usb_phy_init(musb-xceiv); + } static struct musb_platform_ops dsps_ops = { -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 5/6] usb: musb: dsps: Add the sw_babble_control()
Add sw_babble_control() logic to differentiate between transient babble and real babble condition. Also add the SW babble control register definitions. Babble control register logic is implemented in the latest revision of AM335x. Signed-off-by: George Cherian george.cher...@ti.com --- drivers/usb/musb/musb_dsps.c | 50 drivers/usb/musb/musb_regs.h | 7 +++ 2 files changed, 57 insertions(+) diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index f6f3087..eb1985a 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c @@ -536,6 +536,56 @@ static int dsps_musb_set_mode(struct musb *musb, u8 mode) return 0; } +static int sw_babble_control(struct musb *musb) +{ + int timeout = 10; + u8 babble_ctl, session_restart = 0; + + babble_ctl = dsps_readb(musb-mregs, MUSB_BABBLE_CTL); + dev_dbg(musb-controller, babble: MUSB_BABBLE_CTL value %x\n, + babble_ctl); + /* +* check line monitor flag to check whether babble is +* due to noise +*/ + dev_dbg(musb-controller, STUCK_J is %s\n, + babble_ctl MUSB_BABBLE_STUCK_J ? set : reset); + + if (babble_ctl MUSB_BABBLE_STUCK_J) { + /* +* babble is due to noise, then set transmit idle (d7 bit) +* to resume normal operation +*/ + babble_ctl = musb_readb(musb-mregs, MUSB_BABBLE_CTL); + babble_ctl |= MUSB_BABBLE_FORCE_TXIDLE; + dsps_writeb(musb-mregs, MUSB_BABBLE_CTL, babble_ctl); + + /* wait till line monitor flag cleared */ + dev_dbg(musb-controller, Set TXIDLE, wait J to clear\n); + do { + babble_ctl = dsps_readb(musb-mregs, MUSB_BABBLE_CTL); + udelay(1); + } while ((babble_ctl MUSB_BABBLE_STUCK_J) timeout--); + + /* check whether stuck_at_j bit cleared */ + if (babble_ctl MUSB_BABBLE_STUCK_J) { + /* +* real babble condition is occured +* restart the controller to start the +* session again +*/ + dev_dbg(musb-controller, J not cleared, misc (%x)\n, + babble_ctl); + session_restart = 1; + } + + } else { + session_restart = 1; + } + + return session_restart; +} + static int dsps_musb_reset(struct musb *musb) { struct device *dev = musb-controller; diff --git a/drivers/usb/musb/musb_regs.h b/drivers/usb/musb/musb_regs.h index 03f2655..b9bcda5 100644 --- a/drivers/usb/musb/musb_regs.h +++ b/drivers/usb/musb/musb_regs.h @@ -72,6 +72,12 @@ #define MUSB_DEVCTL_HR 0x02 #define MUSB_DEVCTL_SESSION0x01 +/* BABBLE_CTL */ +#define MUSB_BABBLE_FORCE_TXIDLE 0x80 +#define MUSB_BABBLE_SW_SESSION_CTRL0x40 +#define MUSB_BABBLE_STUCK_J0x20 +#define MUSB_BABBLE_RCV_DISABLE0x04 + /* MUSB ULPI VBUSCONTROL */ #define MUSB_ULPI_USE_EXTVBUS 0x01 #define MUSB_ULPI_USE_EXTVBUSIND 0x02 @@ -246,6 +252,7 @@ */ #define MUSB_DEVCTL0x60/* 8 bit */ +#define MUSB_BABBLE_CTL0x61/* 8 bit */ /* These are always controlled through the INDEX register */ #define MUSB_TXFIFOSZ 0x62/* 8-bit (see masks) */ -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 0/6] Add support for SW babble Control
Subject: [PATCH v3 0/5] Add support for SW babble Control Series add support for SW babble control logic found in new silicon versions of AM335x. Runtime differentiation of silicon version is done by checking the BABBLE_CTL register. For newer silicon the register default value read is 0x4 and for older versions its 0x0. Patch 1 - Handle Babble only if MUSB is in HOST mode Patch 2 - Convert recover work to delayed work. Patch 3 - usb_phy_vbus_(off/_on) are NOPs for am335x PHY so use usb_phy(_shutdown/_init) in musb_platform_reset() Patch 4 - Add return value for musb_platform_reset() in prepration to support SW babble_ctrl Patch 5 - Add the sw_babble_control() Patch 6 - Enable sw babble control for newer silicon v3 - v4 : Fixes an issue in gagdet mode - BUS RESET should not be handled as a BABBLE. Added a check for the same.(Patch #1) Enable sw babble control properly (Patch #6) v2 - v3 : Modify musb_platform_reset() to return zero on success. George Cherian (6): usb: musb: core: Handle Babble condition only in HOST mode usb: musb: core: Convert babble recover work to delayed work usb: musb: dsps: Call usb_phy(_shutdown/_init) during musb_platform_reset() usb: musb: core: Convert the musb_platform_reset to have a return value. usb: musb: dsps: Add the sw_babble_control() usb: musb: dsps: Enable sw babble control for newer silicon drivers/usb/musb/musb_core.c | 51 ++ drivers/usb/musb/musb_core.h | 12 --- drivers/usb/musb/musb_dsps.c | 86 ++-- drivers/usb/musb/musb_regs.h | 7 4 files changed, 125 insertions(+), 31 deletions(-) -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 2/6] usb: musb: core: Convert babble recover work to delayed work
During babble condition both first disconnect of devices are initiated. Make sure MUSB controller is reset and re-initialized after all disconnects. To acheive this schedule a delayed work for babble rrecovery. While at that convert udelay to usleep_range. Refer Documentation/timers/timers-howto.txt Signed-off-by: George Cherian george.cher...@ti.com --- drivers/usb/musb/musb_core.c | 15 --- drivers/usb/musb/musb_core.h | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index eff3c5c..8920b80 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -850,7 +850,8 @@ b_host: /* handle babble condition */ if (int_usb MUSB_INTR_BABBLE is_host_active(musb)) - schedule_work(musb-recover_work); + schedule_delayed_work(musb-recover_work, + msecs_to_jiffies(100)); #if 0 /* REVISIT ... this would be for multiplexing periodic endpoints, or @@ -1753,16 +1754,16 @@ static void musb_irq_work(struct work_struct *data) /* Recover from babble interrupt conditions */ static void musb_recover_work(struct work_struct *data) { - struct musb *musb = container_of(data, struct musb, recover_work); + struct musb *musb = container_of(data, struct musb, recover_work.work); int status; musb_platform_reset(musb); usb_phy_vbus_off(musb-xceiv); - udelay(100); + usleep_range(100, 200); usb_phy_vbus_on(musb-xceiv); - udelay(100); + usleep_range(100, 200); /* * When a babble condition occurs, the musb controller removes the @@ -1945,7 +1946,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) /* Init IRQ workqueue before request_irq */ INIT_WORK(musb-irq_work, musb_irq_work); - INIT_WORK(musb-recover_work, musb_recover_work); + INIT_DELAYED_WORK(musb-recover_work, musb_recover_work); INIT_DELAYED_WORK(musb-deassert_reset_work, musb_deassert_reset); INIT_DELAYED_WORK(musb-finish_resume_work, musb_host_finish_resume); @@ -2041,7 +2042,7 @@ fail4: fail3: cancel_work_sync(musb-irq_work); - cancel_work_sync(musb-recover_work); + cancel_delayed_work_sync(musb-recover_work); cancel_delayed_work_sync(musb-finish_resume_work); cancel_delayed_work_sync(musb-deassert_reset_work); if (musb-dma_controller) @@ -2107,7 +2108,7 @@ static int musb_remove(struct platform_device *pdev) dma_controller_destroy(musb-dma_controller); cancel_work_sync(musb-irq_work); - cancel_work_sync(musb-recover_work); + cancel_delayed_work_sync(musb-recover_work); cancel_delayed_work_sync(musb-finish_resume_work); cancel_delayed_work_sync(musb-deassert_reset_work); musb_free(musb); diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index 47e8874..423cd00 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h @@ -297,7 +297,7 @@ struct musb { irqreturn_t (*isr)(int, void *); struct work_struct irq_work; - struct work_struct recover_work; + struct delayed_work recover_work; struct delayed_work deassert_reset_work; struct delayed_work finish_resume_work; u16 hwvers; -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 4/6] usb: musb: core: Convert the musb_platform_reset to have a return value.
Currently musb_platform_reset() is only used by dsps. In case of BABBLE interrupt for other platforms the musb_platform_reset() is a NOP. In such situations no need to re-initialize the endpoints. Also in the latest silicon revision of AM335x, we do have a babble recovery mechanism without resetting the IP block. In preperation to add that support its better to have a rest_done return for musb_platform_reset(). Signed-off-by: George Cherian george.cher...@ti.com --- drivers/usb/musb/musb_core.c | 38 +- drivers/usb/musb/musb_core.h | 10 ++ drivers/usb/musb/musb_dsps.c | 3 ++- 3 files changed, 29 insertions(+), 22 deletions(-) diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 8920b80..1b0b85d 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -1755,28 +1755,32 @@ static void musb_irq_work(struct work_struct *data) static void musb_recover_work(struct work_struct *data) { struct musb *musb = container_of(data, struct musb, recover_work.work); - int status; + int status, ret; - musb_platform_reset(musb); + ret = musb_platform_reset(musb); + if (ret 0) + return; - usb_phy_vbus_off(musb-xceiv); - usleep_range(100, 200); + if (!ret) { + usb_phy_vbus_off(musb-xceiv); + usleep_range(100, 200); - usb_phy_vbus_on(musb-xceiv); - usleep_range(100, 200); + usb_phy_vbus_on(musb-xceiv); + usleep_range(100, 200); - /* -* When a babble condition occurs, the musb controller removes the -* session bit and the endpoint config is lost. -*/ - if (musb-dyn_fifo) - status = ep_config_from_table(musb); - else - status = ep_config_from_hw(musb); + /* +* When a babble condition occurs, the musb controller +* removes the session bit and the endpoint config is lost. +*/ + if (musb-dyn_fifo) + status = ep_config_from_table(musb); + else + status = ep_config_from_hw(musb); - /* start the session again */ - if (status == 0) - musb_start(musb); + /* start the session again */ + if (status == 0) + musb_start(musb); + } } /* -- diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index 423cd00..3ccb428 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h @@ -192,7 +192,7 @@ struct musb_platform_ops { int (*set_mode)(struct musb *musb, u8 mode); void(*try_idle)(struct musb *musb, unsigned long timeout); - void(*reset)(struct musb *musb); + int (*reset)(struct musb *musb); int (*vbus_status)(struct musb *musb); void(*set_vbus)(struct musb *musb, int on); @@ -554,10 +554,12 @@ static inline void musb_platform_try_idle(struct musb *musb, musb-ops-try_idle(musb, timeout); } -static inline void musb_platform_reset(struct musb *musb) +static inline int musb_platform_reset(struct musb *musb) { - if (musb-ops-reset) - musb-ops-reset(musb); + if (!musb-ops-reset) + return -EINVAL; + + return musb-ops-reset(musb); } static inline int musb_platform_get_vbus_status(struct musb *musb) diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index 74c4193..f6f3087 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c @@ -536,7 +536,7 @@ static int dsps_musb_set_mode(struct musb *musb, u8 mode) return 0; } -static void dsps_musb_reset(struct musb *musb) +static int dsps_musb_reset(struct musb *musb) { struct device *dev = musb-controller; struct dsps_glue *glue = dev_get_drvdata(dev-parent); @@ -548,6 +548,7 @@ static void dsps_musb_reset(struct musb *musb) usleep_range(100, 200); usb_phy_init(musb-xceiv); + return 0; } static struct musb_platform_ops dsps_ops = { -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v4 1/6] usb: musb: core: Handle Babble condition only in HOST mode
BABBLE and RESET share the same interrupt. The interrupt is considered to be RESET if MUSB is in peripheral mode and as a BABBLE if MUSB is in HOST mode. Handle babble condition iff MUSB is in HOST mode. Signed-off-by: George Cherian george.cher...@ti.com --- drivers/usb/musb/musb_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 61da471..eff3c5c 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -849,7 +849,7 @@ b_host: } /* handle babble condition */ - if (int_usb MUSB_INTR_BABBLE) + if (int_usb MUSB_INTR_BABBLE is_host_active(musb)) schedule_work(musb-recover_work); #if 0 -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 0/5] Add support for SW babble Control
Hi George, On Mon, May 19, 2014 at 3:40 AM, George Cherian george.cher...@ti.com wrote: Hi Bin, On 5/15/2014 8:49 PM, Bin Liu wrote: George, On Thu, May 15, 2014 at 1:28 AM, George Cherian george.cher...@ti.com wrote: Hi Bin, On 5/14/2014 10:13 PM, Bin Liu wrote: George, On Wed, May 14, 2014 at 9:34 AM, Bin Liu binml...@gmail.com wrote: George, On Wed, May 14, 2014 at 12:37 AM, George Cherian george.cher...@ti.com wrote: On 5/14/2014 12:07 AM, Bin Liu wrote: Hi, On Tue, May 13, 2014 at 8:24 AM, George Cherian george.cher...@ti.com wrote: Hi Daniel, On 5/13/2014 6:44 PM, Daniel Mack wrote: Hi George, On 05/13/2014 02:57 PM, George Cherian wrote: I never enabled the MUSB_BABBLE_SW_SESSION_CTRL in the MUSB_BABBLE_CTL reg. can you try with the following patch. diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index 1ae6681..1160cd1 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c @@ -477,8 +477,11 @@ static int dsps_musb_init(struct musb *musb) * logic enabled. */ val = dsps_readb(musb-mregs, MUSB_BABBLE_CTL); - if (val == MUSB_BABBLE_RCV_DISABLE) + if (val == MUSB_BABBLE_RCV_DISABLE) { glue-sw_babble_enabled = true; + val |= MUSB_BABBLE_SW_SESSION_CTRL; + dsps_writeb(musb-mregs, MUSB_BABBLE_CTL, val); + } ret = dsps_musb_dbg_init(musb, glue); if (ret) MUSB_BABBLE_STUCK_J still remains unset, so I get the same result as without the patch: a full glue reset is conducted. Do I get you right that you expect MUSB_BABBLE_STUCK_J to be set in babble conditions when MUSB_BABBLE_SW_SESSION_CTRL is set? Basically, there are 2 types of babble conditions. 1) Transient babble condition - which could be recovered from without an IP reset . 2) Babble condition - which could be recovered from only by doing an IP reset. Looks like you are always hitting case 2 (Most times am also hitting the same). Case 1 is really hard to reproduce. I don't have a reliable method as of now to reproduce this case consistently. [ 19.672373] CAUTION: musb: Babble Interrupt Occurred [ 19.66] musb_stage0_irq 789: unhandled DISCONNECT transition (a_wait_bcon) [ 19.685815] usb 1-1: USB disconnect, device number 3 [ 19.769720] musb-hdrc musb-hdrc.0.auto: babble: MUSB_BABBLE_CTL value 44 [ 19.776765] musb-hdrc musb-hdrc.0.auto: STUCK_J is reset I don't quite follow, especially as I lack documentation of the IP core. How do you test babble errors, is there any way to force them to happen reliably? There is no 100% reliable method to force it to happen. Following is I have a way to force babble happen reliably - shorting DP or DM to VBUS. I opened the far-end plug of the USB cable, so I can easily short DP or DM to VBUS. Good to know that you have a reliable way to test babble condition. Can you please do a quick test on 3.15.0-rc4 with the series applied? In case of any assistance please do let me know. Sure, but could you please re-send those patches to my corporate email so that I can apply them from Thunderbird? You don't have to resend the patches. Nishanth Menon showed me a way to extract the patch from Gmail - Thanks Nishanth. But which repo do you want to me test with? The first patch ([PATCH v2 1/5] usb: musb: core: Convert babble recover work to delayed work) does not apply to v3.15-rc4 tag. the current musb_core.c does not have the recovery work for musb. Please let me know what I missed. Oops I missed to mention the same. Please try on git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git master The test is done. The babble always causes STUCK_J is reset, MUSB_BABBLE_CTL is 0x44 or 0x4. MUSB reset happens. Thankyou Bin for the help. Can I get a Tested-by from you? Yes, sure. Do you think when re-start happens the driver should print a message on console saying re-start due to babble? It would help debug the babble problems while the dynamic debug is off. It prints out a message saying babble condition occured. That is good, but I think we also want to know the babble type - the controller is reset or not. More over, it re-enumerates all the devices connected as part of Musb re-start. Sometimes the custom board has hw or sw issue, for example USB basically does not functional, maybe after babble there is no re-enumeration, then we cannot tell if controller reset happened or not from the log. I think a specific message telling that will helpful. Regards, -Bin. Don't you think that is sufficient enough ? Thanks, -Bin. Thanks, -Bin. I read these linux-usb emails in Gmail, and am not aware of any easy way to extract patches from Gmail. BTY, I tested with TI 3.12.10 kernel, in which I guess the babble handling is similar to this patch set. With TI3.12.10, MISC is always 0x64, so MUSB
Re: [PATCH] usb: ehci: Enable support for 64bit EHCI host controllers in arm64
On Mon, 19 May 2014, Arnd Bergmann wrote: dma_alloc_coherent() on arm64 should return 32-bit addresses if the coherent_dma_mask is set to 32-bit. Which kernel version is this? The more important question is what happens to high buffers allocated elsewhere that get passed into dma_map_sg by a device driver. I disagree. That is, the question about dma_map_sg is not more important (for ehci-hcd) than the question about dma_alloc_coherent. In this case it is particularly tricky. The driver calls dma_pool_create() several times in addition to calling dma_alloc_coherent(), and the hardware requires that all of those pools plus the coherent buffer have DMA addresses with the same upper 32 bits. As far as I know, the only way to enforce that is by requiring all those items either to be allocated in or to be mapped to the first 4 GB of memory. 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 0/4] Add Gadget Bus
Hi Peter, W dniu 16.05.2014 11:00, Peter Chen pisze: Hi Felipe Alan, To continue with topic discussed at http://www.spinics.net/lists/linux-usb/msg105279.html, I implement the gadget bus to bind udc to gadget driver follow most ideas from your two. While the idea is interesting I think some aspects of the implementation must be thought over. With the series applied g_ether fails. The offending commit is: 4c3efd6b1e227831c919bc2059d0aa080692f257 is the first bad commit commit 4c3efd6b1e227831c919bc2059d0aa080692f257 Author: Peter Chen peter.c...@freescale.com Date: Fri May 16 17:00:20 2014 +0800 usb: gadget: core: add implementation of gadget bus What happens is this: $ modprobe g_ether [ 315.671192] using random self ethernet address [ 315.674393] using random host ethernet address [ 315.682421] usb0: HOST MAC 82:2a:41:f3:c0:12 [ 315.687382] usb0: MAC d2:64:6a:c1:bc:6f [ 315.689788] using random self ethernet address [ 315.701331] using random host ethernet address [ 315.707344] g_ether gadget: Ethernet Gadget, version: Memorial Day 2008 [ 315.716012] g_ether gadget: g_ether ready [ 315.730432] s3c-hsotg s3c-hsotg: bound driver g_ether [ 315.748347] Unable to handle kernel NULL pointer dereference at virtual address [ 315.755008] s3c-hsotg s3c-hsotg: GINTSTS_USBSusp [ 315.770636] pgd = e750c000 [ 315.771873] [] *pgd= [ 315.777413] Internal error: Oops: 5 [#1] PREEMPT ARM [ 315.781040] Modules linked in: usb_f_eem g_ether(+) usb_f_rndis u_ether libcomposite [ 315.788758] CPU: 0 PID: 2727 Comm: modprobe Not tainted 3.15.0-rc4+ #371 [ 315.795426] task: e77b5680 ti: e748a000 task.ti: e748a000 [ 315.800809] PC is at module_add_driver+0x48/0xd0 [ 315.805394] LR is at sysfs_do_create_link_sd+0x78/0xc8 [ 315.810505] pc : [c02a6780]lr : [c0152ca0]psr: 8013 [ 315.810505] sp : e748bd58 ip : e748bd20 fp : e748bd74 [ 315.821941] r10: r9 : bf0264f4 r8 : bf003290 [ 315.827140] r7 : r6 : c05cd6e0 r5 : bf006d78 r4 : bf024510 [ 315.833640] r3 : bf024344 r2 : r1 : c04b732c r0 : 00d0 [ 315.840141] Flags: Nzcv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user [ 315.847246] Control: 10c5387d Table: 5750c019 DAC: 0015 [ 315.852964] Process modprobe (pid: 2727, stack limit = 0xe748a238) [ 315.859117] Stack: (0xe748bd58 to 0xe748c000) [ 315.863452] bd40: bf024510 [ 315.871601] bd60: e75d6780 c05cd6e0 e748bd9c e748bd78 c0297608 c02a6744 bf024344 e748bd88 [ 315.879746] bd80: bf024510 bf0015a8 bf001f04 bf003270 e748bdb4 e748bda0 c0298b08 c0297508 [ 315.887892] bda0: bf0244c8 bf0015a8 e748bdc4 e748bdb8 c02ca358 c0298a8c e748bdec e748bdc8 [ 315.896037] bdc0: bf0013a8 c02ca320 e748bf48 0001 bf024558 e6a4bfc0 e748a000 [ 315.904183] bde0: e748bdfc e748bdf0 bf026508 bf001308 e748be7c e748be00 c000891c bf026500 [ 315.912329] be00: e748be2c e748be10 c0058a04 c03b8ec0 c05b41bc bf02454c [ 315.920475] be20: e748be3c e748be30 c0056bd4 c00589b4 e748be64 e748be40 c0047828 c0056bc8 [ 315.928620] be40: e748be50 e748bf48 0001 bf024558 e748bf48 0001 bf024558 [ 315.936766] be60: e6a4bfc0 0001 bf02454c c0077af8 e748bf3c e748be80 c007a560 c0008854 [ 315.944912] be80: bf024558 7fff c0077e94 e748bebc eaa34000 0001 bf024558 [ 315.953057] bea0: e748bed4 bf02454c bf024594 e748a000 bf0246ac e748bf04 [ 315.961203] bec0: e748bfa4 e748bed0 c0013d28 c0092660 eaa5b000 [ 315.969348] bee0: [ 315.977494] bf00: 2013 00028318 b6dc9000 b6f68114 [ 315.985640] bf20: 0080 c000f948 e748a000 e748bfa4 e748bf40 c007ae34 c0078da0 [ 315.993786] bf40: c0108f00 eaa34000 00028318 eaa52228 eaa52071 eaa5bc08 06f8 [ 316.001931] bf60: 0ab8 002b 002c 0015 [ 316.010077] bf80: 000f b6fc0bf8 0004 b6fc0cf8 e748bfa8 [ 316.018224] bfa0: c000f6a0 c007ad8c b6fc0bf8 0004 b6dc9000 00028318 b6f68114 b6dc9000 [ 316.026369] bfc0: b6fc0bf8 0004 b6fc0cf8 0080 b6fbe1e8 00028318 b6f68114 [ 316.034515] bfe0: b6f72134 be955948 b6f5f190 b6ec1db0 6010 b6dc9000 00040040 [ 316.042675] [c02a6780] (module_add_driver) from [c0297608] (bus_add_driver+0x10c/0x214) [ 316.050985] [c0297608] (bus_add_driver) from [c0298b08] (driver_register+0x88/0x104) [ 316.059049] [c0298b08] (driver_register) from [c02ca358] (usb_gadget_probe_driver+0x44/0x54) [ 316.067826] [c02ca358] (usb_gadget_probe_driver) from [bf0013a8] (usb_composite_probe+0xac/0xd8 [libcomposite]) [ 316.078216] [bf0013a8] (usb_composite_probe [libcomposite]) from [bf026508] (init+0x14/0x1c [g_ether]) [ 316.087819] [bf026508] (init
Re: [PATCH 0/4] Add Gadget Bus
On Mon, May 19, 2014 at 05:40:29PM +0200, Andrzej Pietrasiewicz wrote: Hi Peter, W dniu 16.05.2014 11:00, Peter Chen pisze: Hi Felipe Alan, To continue with topic discussed at http://www.spinics.net/lists/linux-usb/msg105279.html, I implement the gadget bus to bind udc to gadget driver follow most ideas from your two. While the idea is interesting I think some aspects of the implementation must be thought over. definitely. For example we don't want automatic binding, basically we might want to have g_mass_storage running on both ports and this series would prevent it. I feel this won't be ready until 3.18 or so. -- balbi signature.asc Description: Digital signature
Re: [PATCH v4 1/6] usb: musb: core: Handle Babble condition only in HOST mode
Hi, On Mon, May 19, 2014 at 8:39 AM, George Cherian george.cher...@ti.com wrote: BABBLE and RESET share the same interrupt. The interrupt is considered to be RESET if MUSB is in peripheral mode and as a BABBLE if MUSB is in HOST mode. Handle babble condition iff MUSB is in HOST mode. Signed-off-by: George Cherian george.cher...@ti.com --- drivers/usb/musb/musb_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 61da471..eff3c5c 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -849,7 +849,7 @@ b_host: } /* handle babble condition */ - if (int_usb MUSB_INTR_BABBLE) + if (int_usb MUSB_INTR_BABBLE is_host_active(musb)) schedule_work(musb-recover_work); I guess my following comments are for Daniel's patch as while which initially added the babble work. Should this if statement be merged into the previous 'if(int_usb MUSB_INTR_RESET)' one, which handles the same interrupt and already handles host and device mode respectively. Regards, -Bin. #if 0 -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] usb: ehci: Enable support for 64bit EHCI host controllers in arm64
On Mon, May 19, 2014 at 10:44:51AM +0100, Arnd Bergmann wrote: On Monday 19 May 2014 10:03:40 Catalin Marinas wrote: On Mon, May 19, 2014 at 09:32:43AM +0100, Arnd Bergmann wrote: The more important question is what happens to high buffers allocated elsewhere that get passed into dma_map_sg by a device driver. Depending on the DT properties of the device and its parents, this needs to do one of three things: a) translate the 64-bit virtual address into a 64-bit bus address b) create an IOMMU entry for the 64-bit address and pass the 32-bit IOMMU address to the driver c) use the swiotlb code to create a bounce buffer at a 32-bit DMA address and copy the data around It's definitely wrong to just hardcode a DMA mask in the driver because that code doesn't know which of the three cases is being used. Moreover, you can't do it using an #ifdef CONFIG_ARM64, because it's completely independent of the architecture, and we need to do the exact same logic on ARM32 and any other architecture. I agree. The problem we currently have is system topology description to pass the DMA mask and in a hierarchical way. I can see Santosh's patches introducing dma-ranges but the coherent dma mask still set as 32-bit. We can use the dma-ranges to infer a mask but that's only specific to the device and the driver doesn't know whether it goes through an iommu or not. We definitely have to fix this very quickly, before people start building real arm64 systems and shipping them. We should not merge any hacks that attempt to work around the problem, but try to come to a conclusion how to handle them properly. My hope was that we could just always set the dma mask to whatever the DT says it should be to keep the burden from device drivers, unless they want to restrict it further (e.g. when the specific peripheral hardware has a bug that prevents us from using high addresses, even though the SoC in theory supports it everywhere). I agree. Rob Herring argued that we should always mimic PCI and call dma_set_mask() in drivers but default to a 32-bit mask otherwise, independent of whether the hardware can do more or less than that, IIRC. Can we not default to something built up from dma-ranges? Or 32-bit if dma-ranges property is missing? While we currently don't have a set of swiotlb DMA ops on ARM32, we do have it on ARM64, and I think we should be using them properly. It should really not be hard to implement a proper dma_set_mask() function for ARM64 that gets is able to set up the swiotlb based on the dma-ranges properties and always returns success but leaves the mask unchanged. The swiotlb bounce buffer needs to be pre-allocated at boot, otherwise we don't have any guarantees. Since we can't honour random masks anyway, we stick to ZONE_DMA which is currently in the 4G limit. But the driver calls dma_set_mask() too late for any further swiotlb setup. With IOMMU we can be more flexible around dma_set_mask(), can be done at run-time. -- Catalin -- 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 0/4] Add Gadget Bus
On Mon, 19 May 2014, Felipe Balbi wrote: On Mon, May 19, 2014 at 05:40:29PM +0200, Andrzej Pietrasiewicz wrote: Hi Peter, W dniu 16.05.2014 11:00, Peter Chen pisze: Hi Felipe Alan, To continue with topic discussed at http://www.spinics.net/lists/linux-usb/msg105279.html, I implement the gadget bus to bind udc to gadget driver follow most ideas from your two. While the idea is interesting I think some aspects of the implementation must be thought over. definitely. For example we don't want automatic binding, basically we might want to have g_mass_storage running on both ports and this series would prevent it. Peter's suggestion was just for default bindings. If the default gives you something you don't like, you can always change the bindings through sysfs. I feel this won't be ready until 3.18 or so. What Peter wants is relatively simple: When a gadget driver registers with the composite core, if there is an unbound UDC, bind the two of them. When a UDC is registered with the composite core, if there is a gadget driver with no bindings, bind the two of them. I think that will be sufficient. Shouldn't it be possible to accomplish this without interfering with the configfs mechanism? And without going so far as to add an entire gadget bus? 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 v4 4/6] usb: musb: core: Convert the musb_platform_reset to have a return value.
Hi, On Mon, May 19, 2014 at 8:39 AM, George Cherian george.cher...@ti.com wrote: Currently musb_platform_reset() is only used by dsps. In case of BABBLE interrupt for other platforms the musb_platform_reset() is a NOP. In such situations no need to re-initialize the endpoints. Also in the latest silicon revision of AM335x, we do have a babble recovery mechanism without resetting the IP block. In preperation to add that support its better to have a rest_done return for musb_platform_reset(). Signed-off-by: George Cherian george.cher...@ti.com --- drivers/usb/musb/musb_core.c | 38 +- drivers/usb/musb/musb_core.h | 10 ++ drivers/usb/musb/musb_dsps.c | 3 ++- 3 files changed, 29 insertions(+), 22 deletions(-) diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 8920b80..1b0b85d 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -1755,28 +1755,32 @@ static void musb_irq_work(struct work_struct *data) static void musb_recover_work(struct work_struct *data) { struct musb *musb = container_of(data, struct musb, recover_work.work); - int status; + int status, ret; - musb_platform_reset(musb); + ret = musb_platform_reset(musb); + if (ret 0) If change it to ' if (ret)' here, you don't have to indent the reset of the code. Regards, -Bin. + return; - usb_phy_vbus_off(musb-xceiv); - usleep_range(100, 200); + if (!ret) { + usb_phy_vbus_off(musb-xceiv); + usleep_range(100, 200); - usb_phy_vbus_on(musb-xceiv); - usleep_range(100, 200); + usb_phy_vbus_on(musb-xceiv); + usleep_range(100, 200); - /* -* When a babble condition occurs, the musb controller removes the -* session bit and the endpoint config is lost. -*/ - if (musb-dyn_fifo) - status = ep_config_from_table(musb); - else - status = ep_config_from_hw(musb); + /* +* When a babble condition occurs, the musb controller +* removes the session bit and the endpoint config is lost. +*/ + if (musb-dyn_fifo) + status = ep_config_from_table(musb); + else + status = ep_config_from_hw(musb); - /* start the session again */ - if (status == 0) - musb_start(musb); + /* start the session again */ + if (status == 0) + musb_start(musb); + } } /* -- diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index 423cd00..3ccb428 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h @@ -192,7 +192,7 @@ struct musb_platform_ops { int (*set_mode)(struct musb *musb, u8 mode); void(*try_idle)(struct musb *musb, unsigned long timeout); - void(*reset)(struct musb *musb); + int (*reset)(struct musb *musb); int (*vbus_status)(struct musb *musb); void(*set_vbus)(struct musb *musb, int on); @@ -554,10 +554,12 @@ static inline void musb_platform_try_idle(struct musb *musb, musb-ops-try_idle(musb, timeout); } -static inline void musb_platform_reset(struct musb *musb) +static inline int musb_platform_reset(struct musb *musb) { - if (musb-ops-reset) - musb-ops-reset(musb); + if (!musb-ops-reset) + return -EINVAL; + + return musb-ops-reset(musb); } static inline int musb_platform_get_vbus_status(struct musb *musb) diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index 74c4193..f6f3087 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c @@ -536,7 +536,7 @@ static int dsps_musb_set_mode(struct musb *musb, u8 mode) return 0; } -static void dsps_musb_reset(struct musb *musb) +static int dsps_musb_reset(struct musb *musb) { struct device *dev = musb-controller; struct dsps_glue *glue = dev_get_drvdata(dev-parent); @@ -548,6 +548,7 @@ static void dsps_musb_reset(struct musb *musb) usleep_range(100, 200); usb_phy_init(musb-xceiv); + return 0; } static struct musb_platform_ops dsps_ops = { -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] usb: ehci: Enable support for 64bit EHCI host controllers in arm64
On Monday 19 May 2014 10:16:57 Alan Stern wrote: On Mon, 19 May 2014, Arnd Bergmann wrote: dma_alloc_coherent() on arm64 should return 32-bit addresses if the coherent_dma_mask is set to 32-bit. Which kernel version is this? The more important question is what happens to high buffers allocated elsewhere that get passed into dma_map_sg by a device driver. I disagree. That is, the question about dma_map_sg is not more important (for ehci-hcd) than the question about dma_alloc_coherent. In this case it is particularly tricky. The driver calls dma_pool_create() several times in addition to calling dma_alloc_coherent(), and the hardware requires that all of those pools plus the coherent buffer have DMA addresses with the same upper 32 bits. As far as I know, the only way to enforce that is by requiring all those items either to be allocated in or to be mapped to the first 4 GB of memory. But that part is easy to enforce by using a 32-bit dma mask. For dma_map_*, the problem is that we can't possibly enforce the location of the buffer, you have to go back to swiotlb bounce buffers for those. In a lot of cases, tests don't even run into the problem because the block layer and the network layer both have their own way to deal with bounce buffers, at least on 32-bit systems, but you still run into the issue with less common drivers. Arnd -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] usb: ehci: Enable support for 64bit EHCI host controllers in arm64
On Monday 19 May 2014 16:56:08 Catalin Marinas wrote: On Mon, May 19, 2014 at 10:44:51AM +0100, Arnd Bergmann wrote: On Monday 19 May 2014 10:03:40 Catalin Marinas wrote: On Mon, May 19, 2014 at 09:32:43AM +0100, Arnd Bergmann wrote: The more important question is what happens to high buffers allocated elsewhere that get passed into dma_map_sg by a device driver. Depending on the DT properties of the device and its parents, this needs to do one of three things: a) translate the 64-bit virtual address into a 64-bit bus address b) create an IOMMU entry for the 64-bit address and pass the 32-bit IOMMU address to the driver c) use the swiotlb code to create a bounce buffer at a 32-bit DMA address and copy the data around It's definitely wrong to just hardcode a DMA mask in the driver because that code doesn't know which of the three cases is being used. Moreover, you can't do it using an #ifdef CONFIG_ARM64, because it's completely independent of the architecture, and we need to do the exact same logic on ARM32 and any other architecture. I agree. The problem we currently have is system topology description to pass the DMA mask and in a hierarchical way. I can see Santosh's patches introducing dma-ranges but the coherent dma mask still set as 32-bit. We can use the dma-ranges to infer a mask but that's only specific to the device and the driver doesn't know whether it goes through an iommu or not. We definitely have to fix this very quickly, before people start building real arm64 systems and shipping them. We should not merge any hacks that attempt to work around the problem, but try to come to a conclusion how to handle them properly. My hope was that we could just always set the dma mask to whatever the DT says it should be to keep the burden from device drivers, unless they want to restrict it further (e.g. when the specific peripheral hardware has a bug that prevents us from using high addresses, even though the SoC in theory supports it everywhere). I agree. Rob Herring argued that we should always mimic PCI and call dma_set_mask() in drivers but default to a 32-bit mask otherwise, independent of whether the hardware can do more or less than that, IIRC. Can we not default to something built up from dma-ranges? Or 32-bit if dma-ranges property is missing? We probably want to default to 32-bit for arm32 in the absence of dma-ranges. For arm64, I'd prefer if we could always mandate dma-ranges to be present for each bus, just like we mandate ranges to be present. I hope it's not too late for that. dma_set_mask should definitely look at the dma-ranges properties, and the helper that Santosh just introduced should give us all the information we need. We just need to decide on the correct behavior. While we currently don't have a set of swiotlb DMA ops on ARM32, we do have it on ARM64, and I think we should be using them properly. It should really not be hard to implement a proper dma_set_mask() function for ARM64 that gets is able to set up the swiotlb based on the dma-ranges properties and always returns success but leaves the mask unchanged. The swiotlb bounce buffer needs to be pre-allocated at boot, otherwise we don't have any guarantees. Since we can't honour random masks anyway, we stick to ZONE_DMA which is currently in the 4G limit. But the driver calls dma_set_mask() too late for any further swiotlb setup. With IOMMU we can be more flexible around dma_set_mask(), can be done at run-time. What we can do with swiotlb is to check if the mask is smaller than ZONE_DMA. If it ever is, we have to fail dma_set_mask and hope the driver can fall back to PIO mode or it will have to fail its probe() function. For dma_set_coherent_mask(), we also have to fail any call that tries to set a mask larger than what the device hardware can do. Unlike that, dma_set_mask() can succeed with any mask, we just have to enable swiotlb if the mask that the driver wants is larger than what the hardware can do. Arnd -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2] separate usb_address0 mutexes for each bus
On Sat, May 17, 2014 at 10:43:14AM -0400, Alan Stern wrote: On Fri, 16 May 2014, Todd E Brandt wrote: This patch creates a separate instance of the usb_address0 mutex for each USB bus, and attaches it to the usb_bus device struct. This allows devices on separate buses to be enumerated in parallel; saving time. In the current code, there is a single, global instance of the usb_address0 mutex which is used for all devices on all buses. This isn't completely necessary, as this mutex is only needed to prevent address0 collisions for devices on the *same* bus (usb 2.0 spec, sec 4.6.1). This superfluous coverage can cause additional delay in system resume on systems with multiple hosts (up to several seconds depending on what devices are attached). v2: May 16, 2014 [in response to Greg KH] - removed kmalloc failure debug prints [in response to Alan Stern] - moved the usb_address0_mutex to the usb_bus struct instead of usb_hcd - no longer mallocing the mutex, it's just statically defined now These update descriptions really belong below the --- tear line. Having them in the final git commit doesn't do any good. Yea I've already been told that, sorry. I'll do a v3 release with the proper format changes. Signed-off-by: Todd Brandt todd.e.bra...@linux.intel.com Acked-by: Alan Stern st...@rowland.harvard.edu -- 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] USB: separate usb_address0 mutexes for each bus
This patch creates a separate instance of the usb_address0 mutex for each USB bus, and attaches it to the usb_bus device struct. This allows devices on separate buses to be enumerated in parallel; saving time. In the current code, there is a single, global instance of the usb_address0 mutex which is used for all devices on all buses. This isn't completely necessary, as this mutex is only needed to prevent address0 collisions for devices on the *same* bus (usb 2.0 spec, sec 4.6.1). This superfluous coverage can cause additional delay in system resume on systems with multiple hosts (up to several seconds depending on what devices are attached). Signed-off-by: Todd Brandt todd.e.bra...@linux.intel.com Acked-by: Alan Stern st...@rowland.harvard.edu --- drivers/usb/core/hcd.c | 1 + drivers/usb/core/hub.c | 6 ++ include/linux/usb.h| 2 ++ 3 files changed, 5 insertions(+), 4 deletions(-) v3: May 19, 2014 - just format corrections to the patch submission v2: May 16, 2014 [in response to Greg KH] - removed kmalloc failure debug prints [in response to Alan Stern] - moved the usb_address0_mutex to the usb_bus struct instead of usb_hcd - no longer mallocing the mutex, it's just statically defined now diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 9c4e292..87194e1 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -918,6 +918,7 @@ static void usb_bus_init (struct usb_bus *bus) bus-bandwidth_allocated = 0; bus-bandwidth_int_reqs = 0; bus-bandwidth_isoc_reqs = 0; + mutex_init(bus-usb_address0_mutex); INIT_LIST_HEAD (bus-bus_list); } diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 090469e..726fa07 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -4016,8 +4016,6 @@ static int hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1, int retry_counter) { - static DEFINE_MUTEX(usb_address0_mutex); - struct usb_device *hdev = hub-hdev; struct usb_hcd *hcd = bus_to_hcd(hdev-bus); int i, j, retval; @@ -4040,7 +4038,7 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1, if (oldspeed == USB_SPEED_LOW) delay = HUB_LONG_RESET_TIME; - mutex_lock(usb_address0_mutex); + mutex_lock(hdev-bus-usb_address0_mutex); /* Reset the device; full speed may morph to high speed */ /* FIXME a USB 2.0 device may morph into SuperSpeed on reset. */ @@ -4317,7 +4315,7 @@ fail: hub_port_disable(hub, port1, 0); update_devnum(udev, devnum);/* for disconnect processing */ } - mutex_unlock(usb_address0_mutex); + mutex_unlock(hdev-bus-usb_address0_mutex); return retval; } diff --git a/include/linux/usb.h b/include/linux/usb.h index 6b7ec37..d2465bc 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -352,6 +352,8 @@ struct usb_bus { struct usb_bus *hs_companion; /* Companion EHCI bus, if any */ struct list_head bus_list; /* list of busses */ + struct mutex usb_address0_mutex; /* unaddressed device mutex */ + int bandwidth_allocated;/* on this bus: how much of the time * reserved for periodic (intr/iso) * requests is used, on average? -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/5] usb: gadget: net2280: Code Cleanup
Move logical continuations to end of line Signed-off-by: Ricardo Ribalda Delgado ricardo.riba...@gmail.com --- drivers/usb/gadget/net2280.c | 145 +-- drivers/usb/gadget/net2280.h | 4 +- 2 files changed, 73 insertions(+), 76 deletions(-) diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c index 35527d0..e67ae96 100644 --- a/drivers/usb/gadget/net2280.c +++ b/drivers/usb/gadget/net2280.c @@ -169,8 +169,8 @@ static int net2280_enable(struct usb_ep *_ep, static const u32 ep_key[9] = { 1, 0, 1, 0, 1, 1, 0, 1, 0 }; ep = container_of(_ep, struct net2280_ep, ep); - if (!_ep || !desc || ep-desc || _ep-name == ep0name - || desc-bDescriptorType != USB_DT_ENDPOINT) + if (!_ep || !desc || ep-desc || _ep-name == ep0name || + desc-bDescriptorType != USB_DT_ENDPOINT) return -EINVAL; dev = ep-dev; if (!dev-driver || dev-gadget.speed == USB_SPEED_UNKNOWN) @@ -220,9 +220,9 @@ static int net2280_enable(struct usb_ep *_ep, tmp = (desc-bmAttributes USB_ENDPOINT_XFERTYPE_MASK); if (tmp == USB_ENDPOINT_XFER_INT) { /* erratum 0105 workaround prevents hs NYET */ - if (dev-chiprev == 0100 -dev-gadget.speed == USB_SPEED_HIGH -!(desc-bEndpointAddress USB_DIR_IN)) + if (dev-chiprev == 0100 + dev-gadget.speed == USB_SPEED_HIGH + !(desc-bEndpointAddress USB_DIR_IN)) writel(BIT(CLEAR_NAK_OUT_PACKETS_MODE), ep-regs-ep_rsp); } else if (tmp == USB_ENDPOINT_XFER_BULK) { @@ -402,8 +402,8 @@ static void ep_reset_228x(struct net2280_regs __iomem *regs, BIT(DATA_PACKET_RECEIVED_INTERRUPT) | BIT(DATA_PACKET_TRANSMITTED_INTERRUPT) | BIT(DATA_OUT_PING_TOKEN_INTERRUPT) | - BIT(DATA_IN_TOKEN_INTERRUPT) - , ep-regs-ep_stat); + BIT(DATA_IN_TOKEN_INTERRUPT), + ep-regs-ep_stat); /* fifo size is handled separately */ } @@ -425,9 +425,9 @@ static void ep_reset_338x(struct net2280_regs __iomem *regs, writel(BIT(DMA_ABORT_DONE_INTERRUPT) | BIT(DMA_PAUSE_DONE_INTERRUPT) | BIT(DMA_SCATTER_GATHER_DONE_INTERRUPT) | - BIT(DMA_TRANSACTION_DONE_INTERRUPT) - /* | BIT(DMA_ABORT) */ - , ep-dma-dmastat); + BIT(DMA_TRANSACTION_DONE_INTERRUPT), + /* | BIT(DMA_ABORT), */ + ep-dma-dmastat); dmastat = readl(ep-dma-dmastat); if (dmastat == 0x5002) { @@ -618,15 +618,15 @@ static void out_flush(struct net2280_ep *ep) statp = ep-regs-ep_stat; writel(BIT(DATA_OUT_PING_TOKEN_INTERRUPT) | - BIT(DATA_PACKET_RECEIVED_INTERRUPT) - , statp); + BIT(DATA_PACKET_RECEIVED_INTERRUPT), + statp); writel(BIT(FIFO_FLUSH), statp); /* Make sure stap is written before readded back */ mb(); tmp = readl(statp); - if (tmp BIT(DATA_OUT_PING_TOKEN_INTERRUPT) + if (tmp BIT(DATA_OUT_PING_TOKEN_INTERRUPT) /* high speed did bulk NYET; fifo isn't filling */ -ep-dev-gadget.speed == USB_SPEED_FULL) { + ep-dev-gadget.speed == USB_SPEED_FULL) { unsignedusec; usec = 50; /* 64 byte bulk/interrupt */ @@ -653,8 +653,8 @@ static int read_fifo(struct net2280_ep *ep, struct net2280_request *req) /* erratum 0106 ... packets coming in during fifo reads might * be incompletely rejected. not all cases have workarounds. */ - if (ep-dev-chiprev == 0x0100 -ep-dev-gadget.speed == USB_SPEED_FULL) { + if (ep-dev-chiprev == 0x0100 + ep-dev-gadget.speed == USB_SPEED_FULL) { udelay(1); tmp = readl(ep-regs-ep_stat); if ((tmp BIT(NAK_OUT_PACKETS))) @@ -726,8 +726,8 @@ static int read_fifo(struct net2280_ep *ep, struct net2280_request *req) (void) readl(ep-regs-ep_rsp); } - return is_short || ((req-req.actual == req-req.length) -!req-req.zero); + return is_short || ((req-req.actual == req-req.length) + !req-req.zero); } /* fill out dma descriptor to match a given request */ @@ -744,8 +744,8 @@ static void fill_dma_desc(struct net2280_ep *ep, */ if (ep-is_in) dmacount |= BIT(DMA_DIRECTION); - if ((!ep-is_in (dmacount % ep-ep.maxpacket) != 0) -
[PATCH 1/5] usb: gadget: net2280: Refactor queues_show
Replace a long and ugly expresion with an already available function. Signed-off-by: Ricardo Ribalda Delgado ricardo.riba...@gmail.com --- drivers/usb/gadget/net2280.c | 10 +- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c index bd851de..c3205ec 100644 --- a/drivers/usb/gadget/net2280.c +++ b/drivers/usb/gadget/net2280.c @@ -1777,15 +1777,7 @@ static ssize_t queues_show(struct device *_dev, struct device_attribute *attr, \n%s (ep%d%s-%s) max %04x %s fifo %d\n, ep-ep.name, t USB_ENDPOINT_NUMBER_MASK, (t USB_DIR_IN) ? in : out, - ({ char *val; -switch (d-bmAttributes 0x03) { -case USB_ENDPOINT_XFER_BULK: - val = bulk; break; -case USB_ENDPOINT_XFER_INT: - val = intr; break; -default: - val = iso; break; -} val; }), + type_string(d-bmAttributes), usb_endpoint_maxp (d) 0x1fff, ep-dma ? dma : pio, ep-fifo_size ); -- 2.0.0.rc2 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 5/5] usb: gadget: net2280: Use pr_* function
Driver was using custom functions WARNING, ERROR, DEBUG, instead of pr_err, pr_dgb... VDEBUG has also been replaced by DEBUG because the same functionality (or even better) can be achieved with dynamic printk. Signed-off-by: Ricardo Ribalda Delgado ricardo.riba...@gmail.com --- drivers/usb/gadget/net2280.c | 130 +++ drivers/usb/gadget/net2280.h | 31 +-- 2 files changed, 71 insertions(+), 90 deletions(-) diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c index e67ae96..11800bb 100644 --- a/drivers/usb/gadget/net2280.c +++ b/drivers/usb/gadget/net2280.c @@ -210,7 +210,7 @@ static int net2280_enable(struct usb_ep *_ep, * use it instead of troublesome (non-bulk) multi-packet DMA. */ if (ep-dma (max % 4) != 0 use_dma_chaining) { - DEBUG(ep-dev, %s, no dma for maxpacket %d\n, + dev_dbg(GETDEV(ep-dev), %s, no dma for maxpacket %d\n, ep-ep.name, ep-ep.maxpacket); ep-dma = NULL; } @@ -303,7 +303,7 @@ static int net2280_enable(struct usb_ep *_ep, } tmp = desc-bEndpointAddress; - DEBUG(dev, enabled %s (ep%d%s-%s) %s max %04x\n, + dev_dbg(GETDEV(dev), enabled %s (ep%d%s-%s) %s max %04x\n, _ep-name, tmp 0x0f, DIR_STRING(tmp), type_string(desc-bmAttributes), ep-dma ? dma : pio, max); @@ -431,7 +431,7 @@ static void ep_reset_338x(struct net2280_regs __iomem *regs, dmastat = readl(ep-dma-dmastat); if (dmastat == 0x5002) { - WARNING(ep-dev, The dmastat return = %x!!\n, + dev_warn(GETDEV(ep-dev), The dmastat return = %x!!\n, dmastat); writel(0x5a, ep-dma-dmastat); } @@ -476,7 +476,7 @@ static int net2280_disable(struct usb_ep *_ep) else ep_reset_228x(ep-dev-regs, ep); - VDEBUG(ep-dev, disabled %s %s\n, + dev_dbg(GETDEV(ep-dev), disabled %s %s\n, ep-dma ? dma : pio, _ep-name); /* synch memory views with the device */ @@ -572,7 +572,7 @@ static void write_fifo(struct net2280_ep *ep, struct usb_request *req) if (count total) /* min() cannot be used on a bitfield */ count = total; - VDEBUG(ep-dev, write %s fifo (IN) %d bytes%s req %p\n, + dev_dbg(GETDEV(ep-dev), write %s fifo (IN) %d bytes%s req %p\n, ep-ep.name, count, (count != ep-ep.maxpacket) ? (short) : , req); @@ -684,7 +684,7 @@ static int read_fifo(struct net2280_ep *ep, struct net2280_request *req) if (count tmp) { /* as with DMA, data overflow gets flushed */ if ((tmp % ep-ep.maxpacket) != 0) { - ERROR(ep-dev, + dev_err(GETDEV(ep-dev), %s out fifo %d bytes, expected %d\n, ep-ep.name, count, tmp); req-req.status = -EOVERFLOW; @@ -699,7 +699,7 @@ static int read_fifo(struct net2280_ep *ep, struct net2280_request *req) is_short = (count == 0) || ((count % ep-ep.maxpacket) != 0); - VDEBUG(ep-dev, read %s fifo (OUT) %d bytes%s%s%s req %p %d/%d\n, + dev_dbg(GETDEV(ep-dev), read %s fifo (OUT) %d bytes%s%s%s req %p %d/%d\n, ep-ep.name, count, is_short ? (short) : , cleanup ? flush : , prevent ? nak : , req, req-req.actual, req-req.length); @@ -925,7 +925,7 @@ static void done(struct net2280_ep *ep, usb_gadget_unmap_request(dev-gadget, req-req, ep-is_in); if (status status != -ESHUTDOWN) - VDEBUG(dev, complete %s req %p stat %d len %u/%u\n, + dev_dbg(GETDEV(dev), complete %s req %p stat %d len %u/%u\n, ep-ep.name, req-req, status, req-req.actual, req-req.length); @@ -978,7 +978,7 @@ static int net2280_queue(struct usb_ep *_ep, } #if 0 - VDEBUG(dev, %s queue req %p, len %d buf %p\n, + dev_dbg(GETDEV(dev), %s queue req %p, len %d buf %p\n, _ep-name, _req, _req-length, _req-buf); #endif @@ -1012,7 +1012,8 @@ static int net2280_queue(struct usb_ep *_ep, if (ep-num == 0 _req-length == 0) { allow_status(ep); done(ep, req, 0); - VDEBUG(dev, %s status ack\n, ep-ep.name); + dev_dbg(GETDEV(dev), + %s status ack\n, ep-ep.name); goto done; } @@ -1130,7 +1131,7 @@ static void scan_dma_completions(struct net2280_ep *ep)
[PATCH 0/5] usb: gadget: net2280: Code cleanout
net2280 was developed before the CodeStyle was enforced. This set of patches intend to improve the readability of the code. This set of patches should be applied after: [PATCH 5/5] usb: gadget: net2280: Use module_pci_driver macro In order to avoid mail list spamming I have not resubmitted the 10 patches, only the new ones. Ricardo Ribalda Delgado (5): usb: gadget: net2280: Refactor queues_show usb: gadget: net2280: Use S_I macros usb: gadget: net2280: Pass checkpacth.pl test usb: gadget: net2280: Code Cleanup usb: gadget: net2280: Use pr_* function drivers/usb/gadget/net2280.c | 1329 +- drivers/usb/gadget/net2280.h | 97 ++- 2 files changed, 695 insertions(+), 731 deletions(-) -- 2.0.0.rc2 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/5] usb: gadget: net2280: Use S_I macros
Instead of octal notation, to be consistent around the file. Signed-off-by: Ricardo Ribalda Delgado ricardo.riba...@gmail.com --- drivers/usb/gadget/net2280.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c index c3205ec..5b2ab68 100644 --- a/drivers/usb/gadget/net2280.c +++ b/drivers/usb/gadget/net2280.c @@ -111,7 +111,7 @@ module_param(use_msi, bool, S_IRUGO); static ushort fifo_mode = 0; /* modprobe net2280 fifo_mode=1 etc */ -module_param (fifo_mode, ushort, 0644); +module_param(fifo_mode, ushort, S_IRUGO | S_IWUSR); /* enable_suspend -- When enabled, the driver will respond to * USB suspend requests by powering down the NET2280. Otherwise, @@ -125,7 +125,7 @@ module_param (enable_suspend, bool, S_IRUGO); /* force full-speed operation */ static bool full_speed; -module_param(full_speed, bool, 0444); +module_param(full_speed, bool, S_IRUGO); MODULE_PARM_DESC(full_speed, force full-speed mode -- for testing only!); #defineDIR_STRING(bAddress) (((bAddress) USB_DIR_IN) ? in : out) -- 2.0.0.rc2 -- 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 5/5] usb: gadget: net2280: Use pr_* function
On Mon, 2014-05-19 at 21:11 +0200, Ricardo Ribalda Delgado wrote: VDEBUG has also been replaced by DEBUG because the same functionality (or even better) can be achieved with dynamic printk. dev_vdbg exists for that purpose. -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/5] usb: gadget: net2280: Use S_I macros
On Mon, 19 May 2014, Ricardo Ribalda Delgado wrote: Instead of octal notation, to be consistent around the file. Signed-off-by: Ricardo Ribalda Delgado ricardo.riba...@gmail.com --- drivers/usb/gadget/net2280.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c index c3205ec..5b2ab68 100644 --- a/drivers/usb/gadget/net2280.c +++ b/drivers/usb/gadget/net2280.c @@ -111,7 +111,7 @@ module_param(use_msi, bool, S_IRUGO); static ushort fifo_mode = 0; /* modprobe net2280 fifo_mode=1 etc */ -module_param (fifo_mode, ushort, 0644); +module_param(fifo_mode, ushort, S_IRUGO | S_IWUSR); I don't think this is necessary, in and of itself. In my opinion, the macros are a lot harder to figure out than the octal values. Don't bother making this change. It's useless churn. 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 5/5] usb: gadget: net2280: Use pr_* function
Hello Joe I think dev_vdg cannot be controlled with DYNAMIC_DEBUG, therefore I replaced it with dev_dbg. But if you prefer to use dev_dbg, I will modify it to use dev_dbg Thanks! On Mon, May 19, 2014 at 9:16 PM, Joe Perches j...@perches.com wrote: On Mon, 2014-05-19 at 21:11 +0200, Ricardo Ribalda Delgado wrote: VDEBUG has also been replaced by DEBUG because the same functionality (or even better) can be achieved with dynamic printk. dev_vdbg exists for that purpose. -- Ricardo Ribalda -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/5] usb: gadget: net2280: Use S_I macros
Hello Alan What about using octal notation in all the file and merge the patch with the other big patch of the series? I am trying to have some consistency in the file :) Thanks! On Mon, May 19, 2014 at 9:30 PM, Alan Stern st...@rowland.harvard.edu wrote: On Mon, 19 May 2014, Ricardo Ribalda Delgado wrote: Instead of octal notation, to be consistent around the file. Signed-off-by: Ricardo Ribalda Delgado ricardo.riba...@gmail.com --- drivers/usb/gadget/net2280.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c index c3205ec..5b2ab68 100644 --- a/drivers/usb/gadget/net2280.c +++ b/drivers/usb/gadget/net2280.c @@ -111,7 +111,7 @@ module_param(use_msi, bool, S_IRUGO); static ushort fifo_mode = 0; /* modprobe net2280 fifo_mode=1 etc */ -module_param (fifo_mode, ushort, 0644); +module_param(fifo_mode, ushort, S_IRUGO | S_IWUSR); I don't think this is necessary, in and of itself. In my opinion, the macros are a lot harder to figure out than the octal values. Don't bother making this change. It's useless churn. Alan Stern -- Ricardo Ribalda -- 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/5] usb: gadget: net2280: Pass checkpacth.pl test
On Mon, 19 May 2014, Ricardo Ribalda Delgado wrote: Fix Code Style using checkpatch.pl criteria Signed-off-by: Ricardo Ribalda Delgado ricardo.riba...@gmail.com Not really necessary, although this doesn't hurt. It's notable that scattered in amongst all the checkpatch-related changes are a few things that actually alter the meaning of the code. Mixing things up like that isn't a good idea. Also, there seem to be several questionable changes: @@ -236,7 +234,7 @@ net2280_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) return -ERANGE; } } - ep-is_iso = (tmp == USB_ENDPOINT_XFER_ISOC) ? 1 : 0; + ep-is_iso = !!(tmp == USB_ENDPOINT_XFER_ISOC); Getting rid of the ? 1 : 0 part is fine, but why introduce the !!? Don't you realize that the equality test will always produce a 0 or 1 result? /*-*/ -static struct usb_request * -net2280_alloc_request (struct usb_ep *_ep, gfp_t gfp_flags) +static struct usb_request *net2280_alloc_request(struct usb_ep *_ep, + gfp_t gfp_flags) What's with the extreme indentation on the continuation line? The style used here is for continuation lines to be indented by two stops relative to the first line. @@ -613,20 +609,21 @@ write_fifo (struct net2280_ep *ep, struct usb_request *req) * NOTE: also used in cases where that erratum doesn't apply: * where the host wrote too much data to us. */ -static void out_flush (struct net2280_ep *ep) +static void out_flush(struct net2280_ep *ep) { u32 __iomem *statp; u32 tmp; - ASSERT_OUT_NAKING (ep); + ASSERT_OUT_NAKING(ep); statp = ep-regs-ep_stat; writel(BIT(DATA_OUT_PING_TOKEN_INTERRUPT) | BIT(DATA_PACKET_RECEIVED_INTERRUPT) , statp); writel(BIT(FIFO_FLUSH), statp); - mb (); - tmp = readl (statp); + /* Make sure stap is written before readded back */ If you're going to add a comment, add least use correct spelling and grammar. 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 5/5] usb: gadget: net2280: Use pr_* function
On Mon, 2014-05-19 at 21:33 +0200, Ricardo Ribalda Delgado wrote: I think dev_vdg cannot be controlled with DYNAMIC_DEBUG, therefore I replaced it with dev_dbg. But if you prefer to use dev_dbg, I will modify it to use dev_dbg s/VDEBUG/dev_vdbg/ dev_vdbg can be controlled by DYNAMIC_DEBUG. dev_vdbg is dev_dbg when VERBOSE_DEBUG is set. include/linux/device.h-#ifdef VERBOSE_DEBUG include/linux/device.h:#define dev_vdbg dev_dbg include/linux/device.h-#else include/linux/device.h:#define dev_vdbg(dev, format, arg...) \ include/linux/device.h-({ \ include/linux/device.h- if (0) \ include/linux/device.h- dev_printk(KERN_DEBUG, dev, format, ##arg); \ include/linux/device.h- 0; \ include/linux/device.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: [PATCH 4/5] usb: gadget: net2280: Code Cleanup
On Mon, 19 May 2014, Ricardo Ribalda Delgado wrote: Move logical continuations to end of line This is almost totally unnecessary. Some people prefer the operators at the end of the first line, other people prefer them at the start of the next line. It's just a matter of taste and it doesn't matter. @@ -402,8 +402,8 @@ static void ep_reset_228x(struct net2280_regs __iomem *regs, BIT(DATA_PACKET_RECEIVED_INTERRUPT) | BIT(DATA_PACKET_TRANSMITTED_INTERRUPT) | BIT(DATA_OUT_PING_TOKEN_INTERRUPT) | - BIT(DATA_IN_TOKEN_INTERRUPT) - , ep-regs-ep_stat); + BIT(DATA_IN_TOKEN_INTERRUPT), + ep-regs-ep_stat); This is an example of the one type of change that does make sense. Nobody should start lines with a ','. 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 5/5] usb: gadget: net2280: Use pr_* function
Hello Joe OK, then I will use dev_vdbg. Thanks! On Mon, May 19, 2014 at 9:42 PM, Joe Perches j...@perches.com wrote: On Mon, 2014-05-19 at 21:33 +0200, Ricardo Ribalda Delgado wrote: I think dev_vdg cannot be controlled with DYNAMIC_DEBUG, therefore I replaced it with dev_dbg. But if you prefer to use dev_dbg, I will modify it to use dev_dbg s/VDEBUG/dev_vdbg/ dev_vdbg can be controlled by DYNAMIC_DEBUG. dev_vdbg is dev_dbg when VERBOSE_DEBUG is set. include/linux/device.h-#ifdef VERBOSE_DEBUG include/linux/device.h:#define dev_vdbg dev_dbg include/linux/device.h-#else include/linux/device.h:#define dev_vdbg(dev, format, arg...) \ include/linux/device.h-({ \ include/linux/device.h- if (0) \ include/linux/device.h- dev_printk(KERN_DEBUG, dev, format, ##arg); \ include/linux/device.h- 0; \ include/linux/device.h-}) -- Ricardo Ribalda -- 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 5/5] usb: gadget: net2280: Use pr_* function
On Mon, 19 May 2014, Ricardo Ribalda Delgado wrote: Driver was using custom functions WARNING, ERROR, DEBUG, instead of pr_err, pr_dgb... What's wrong with that, and why bother to change it? diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c index e67ae96..11800bb 100644 --- a/drivers/usb/gadget/net2280.c +++ b/drivers/usb/gadget/net2280.c @@ -210,7 +210,7 @@ static int net2280_enable(struct usb_ep *_ep, * use it instead of troublesome (non-bulk) multi-packet DMA. */ if (ep-dma (max % 4) != 0 use_dma_chaining) { - DEBUG(ep-dev, %s, no dma for maxpacket %d\n, + dev_dbg(GETDEV(ep-dev), %s, no dma for maxpacket %d\n, Don't you think that the new code is harder to read than the original? Why go to a lot of trouble just to make things worse? 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 4/5] usb: gadget: net2280: Code Cleanup
Hello Alan I am trying to be consistent around the file. On a previous patch I was asked to move the operators at the end. I did so, and now I am modifying the file to look alike. On Mon, May 19, 2014 at 9:43 PM, Alan Stern st...@rowland.harvard.edu wrote: On Mon, 19 May 2014, Ricardo Ribalda Delgado wrote: Move logical continuations to end of line This is almost totally unnecessary. Some people prefer the operators at the end of the first line, other people prefer them at the start of the next line. It's just a matter of taste and it doesn't matter. @@ -402,8 +402,8 @@ static void ep_reset_228x(struct net2280_regs __iomem *regs, BIT(DATA_PACKET_RECEIVED_INTERRUPT) | BIT(DATA_PACKET_TRANSMITTED_INTERRUPT) | BIT(DATA_OUT_PING_TOKEN_INTERRUPT) | - BIT(DATA_IN_TOKEN_INTERRUPT) - , ep-regs-ep_stat); + BIT(DATA_IN_TOKEN_INTERRUPT), + ep-regs-ep_stat); This is an example of the one type of change that does make sense. Nobody should start lines with a ','. Alan Stern -- Ricardo Ribalda -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/5] usb: gadget: net2280: Code Cleanup
On Mon, 19 May 2014, Ricardo Ribalda Delgado wrote: Hello Alan I am trying to be consistent around the file. On a previous patch I was asked to move the operators at the end. I did so, and now I am modifying the file to look alike. Changing other people's code to be more consistent is usually a waste of time. 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 5/5] usb: gadget: net2280: Use pr_* function
Hello Alan I really think that setting/unsetting DEBUG and VERBOSE is not a good idea, and the generic functions are there to be used. What do you think that makes it more difficult to read? The GETDEV macro? Cheers On Mon, May 19, 2014 at 9:44 PM, Alan Stern st...@rowland.harvard.edu wrote: On Mon, 19 May 2014, Ricardo Ribalda Delgado wrote: Driver was using custom functions WARNING, ERROR, DEBUG, instead of pr_err, pr_dgb... What's wrong with that, and why bother to change it? diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c index e67ae96..11800bb 100644 --- a/drivers/usb/gadget/net2280.c +++ b/drivers/usb/gadget/net2280.c @@ -210,7 +210,7 @@ static int net2280_enable(struct usb_ep *_ep, * use it instead of troublesome (non-bulk) multi-packet DMA. */ if (ep-dma (max % 4) != 0 use_dma_chaining) { - DEBUG(ep-dev, %s, no dma for maxpacket %d\n, + dev_dbg(GETDEV(ep-dev), %s, no dma for maxpacket %d\n, Don't you think that the new code is harder to read than the original? Why go to a lot of trouble just to make things worse? Alan Stern -- Ricardo Ribalda -- 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