Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'usb-ci-v4.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb into usb-next

Hi Greg, below are changes for chipidea and OTG FSM, no major changes.
Some for documentation, some for tiny changes, thanks.

+96 -22
+8 -5
Documentation/usb/chipidea.txt
··· 3 3 To show how to demo OTG HNP and SRP functions via sys input files 4 4 with 2 Freescale i.MX6Q sabre SD boards. 5 5 6 - 1.1 How to enable OTG FSM in menuconfig 6 + 1.1 How to enable OTG FSM 7 7 --------------------------------------- 8 - Select CONFIG_USB_OTG_FSM, rebuild kernel Image and modules. 9 - If you want to check some internal variables for otg fsm, 10 - mount debugfs, there are 2 files which can show otg fsm 11 - variables and some controller registers value: 8 + 1.1.1 Select CONFIG_USB_OTG_FSM in menuconfig, rebuild kernel 9 + Image and modules. If you want to check some internal 10 + variables for otg fsm, mount debugfs, there are 2 files 11 + which can show otg fsm variables and some controller registers value: 12 12 cat /sys/kernel/debug/ci_hdrc.0/otg 13 13 cat /sys/kernel/debug/ci_hdrc.0/registers 14 + 1.1.2 Add below entries in your dts file for your controller node 15 + otg-rev = <0x0200>; 16 + adp-disable; 14 17 15 18 1.2 Test operations 16 19 -------------------
-4
drivers/usb/chipidea/ci_hdrc_imx.c
··· 292 292 if (pdata.flags & CI_HDRC_SUPPORTS_RUNTIME_PM) 293 293 data->supports_runtime_pm = true; 294 294 295 - ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); 296 - if (ret) 297 - goto err_clk; 298 - 299 295 ret = imx_usbmisc_init(data->usbmisc_data); 300 296 if (ret) { 301 297 dev_err(&pdev->dev, "usbmisc init failed, ret=%d\n", ret);
+4 -6
drivers/usb/common/usb-otg-fsm.c
··· 61 61 return 0; 62 62 } 63 63 64 - static int state_changed; 65 - 66 64 /* Called when leaving a state. Do state clean up jobs here */ 67 65 static void otg_leave_state(struct otg_fsm *fsm, enum usb_otg_state old_state) 68 66 { ··· 206 208 /* Called when entering a state */ 207 209 static int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state) 208 210 { 209 - state_changed = 1; 210 211 if (fsm->otg->state == new_state) 211 212 return 0; 212 213 VDBG("Set state: %s\n", usb_otg_state_string(new_state)); ··· 321 324 } 322 325 323 326 fsm->otg->state = new_state; 327 + fsm->state_changed = 1; 324 328 return 0; 325 329 } 326 330 ··· 333 335 mutex_lock(&fsm->lock); 334 336 335 337 state = fsm->otg->state; 336 - state_changed = 0; 338 + fsm->state_changed = 0; 337 339 /* State machine state change judgement */ 338 340 339 341 switch (state) { ··· 446 448 } 447 449 mutex_unlock(&fsm->lock); 448 450 449 - VDBG("quit statemachine, changed = %d\n", state_changed); 450 - return state_changed; 451 + VDBG("quit statemachine, changed = %d\n", fsm->state_changed); 452 + return fsm->state_changed; 451 453 } 452 454 EXPORT_SYMBOL_GPL(otg_statemachine);
+84 -7
include/linux/usb/otg-fsm.h
··· 72 72 NUM_OTG_FSM_TIMERS, 73 73 }; 74 74 75 - /* OTG state machine according to the OTG spec */ 75 + /** 76 + * struct otg_fsm - OTG state machine according to the OTG spec 77 + * 78 + * OTG hardware Inputs 79 + * 80 + * Common inputs for A and B device 81 + * @id: TRUE for B-device, FALSE for A-device. 82 + * @adp_change: TRUE when current ADP measurement (n) value, compared to the 83 + * ADP measurement taken at n-2, differs by more than CADP_THR 84 + * @power_up: TRUE when the OTG device first powers up its USB system and 85 + * ADP measurement taken if ADP capable 86 + * 87 + * A-Device state inputs 88 + * @a_srp_det: TRUE if the A-device detects SRP 89 + * @a_vbus_vld: TRUE when VBUS voltage is in regulation 90 + * @b_conn: TRUE if the A-device detects connection from the B-device 91 + * @a_bus_resume: TRUE when the B-device detects that the A-device is signaling 92 + * a resume (K state) 93 + * B-Device state inputs 94 + * @a_bus_suspend: TRUE when the B-device detects that the A-device has put the 95 + * bus into suspend 96 + * @a_conn: TRUE if the B-device detects a connection from the A-device 97 + * @b_se0_srp: TRUE when the line has been at SE0 for more than the minimum 98 + * time before generating SRP 99 + * @b_ssend_srp: TRUE when the VBUS has been below VOTG_SESS_VLD for more than 100 + * the minimum time before generating SRP 101 + * @b_sess_vld: TRUE when the B-device detects that the voltage on VBUS is 102 + * above VOTG_SESS_VLD 103 + * @test_device: TRUE when the B-device switches to B-Host and detects an OTG 104 + * test device. This must be set by host/hub driver 105 + * 106 + * Application inputs (A-Device) 107 + * @a_bus_drop: TRUE when A-device application needs to power down the bus 108 + * @a_bus_req: TRUE when A-device application wants to use the bus. 109 + * FALSE to suspend the bus 110 + * 111 + * Application inputs (B-Device) 112 + * @b_bus_req: TRUE during the time that the Application running on the 113 + * B-device wants to use the bus 114 + * 115 + * Auxilary inputs (OTG v1.3 only. Obsolete now.) 116 + * @a_sess_vld: TRUE if the A-device detects that VBUS is above VA_SESS_VLD 117 + * @b_bus_suspend: TRUE when the A-device detects that the B-device has put 118 + * the bus into suspend 119 + * @b_bus_resume: TRUE when the A-device detects that the B-device is signaling 120 + * resume on the bus 121 + * 122 + * OTG Output status. Read only for users. Updated by OTG FSM helpers defined 123 + * in this file 124 + * 125 + * Outputs for Both A and B device 126 + * @drv_vbus: TRUE when A-device is driving VBUS 127 + * @loc_conn: TRUE when the local device has signaled that it is connected 128 + * to the bus 129 + * @loc_sof: TRUE when the local device is generating activity on the bus 130 + * @adp_prb: TRUE when the local device is in the process of doing 131 + * ADP probing 132 + * 133 + * Outputs for B-device state 134 + * @adp_sns: TRUE when the B-device is in the process of carrying out 135 + * ADP sensing 136 + * @data_pulse: TRUE when the B-device is performing data line pulsing 137 + * 138 + * Internal Variables 139 + * 140 + * a_set_b_hnp_en: TRUE when the A-device has successfully set the 141 + * b_hnp_enable bit in the B-device. 142 + * Unused as OTG fsm uses otg->host->b_hnp_enable instead 143 + * b_srp_done: TRUE when the B-device has completed initiating SRP 144 + * b_hnp_enable: TRUE when the B-device has accepted the 145 + * SetFeature(b_hnp_enable) B-device. 146 + * Unused as OTG fsm uses otg->gadget->b_hnp_enable instead 147 + * a_clr_err: Asserted (by application ?) to clear a_vbus_err due to an 148 + * overcurrent condition and causes the A-device to transition 149 + * to a_wait_vfall 150 + */ 76 151 struct otg_fsm { 77 152 /* Input */ 78 153 int id; 79 154 int adp_change; 80 155 int power_up; 81 - int test_device; 82 - int a_bus_drop; 83 - int a_bus_req; 84 156 int a_srp_det; 85 157 int a_vbus_vld; 86 158 int b_conn; 87 159 int a_bus_resume; 88 160 int a_bus_suspend; 89 161 int a_conn; 90 - int b_bus_req; 91 162 int b_se0_srp; 92 163 int b_ssend_srp; 93 164 int b_sess_vld; 165 + int test_device; 166 + int a_bus_drop; 167 + int a_bus_req; 168 + int b_bus_req; 169 + 94 170 /* Auxilary inputs */ 95 171 int a_sess_vld; 96 172 int b_bus_resume; 97 173 int b_bus_suspend; 98 174 99 175 /* Output */ 100 - int data_pulse; 101 176 int drv_vbus; 102 177 int loc_conn; 103 178 int loc_sof; 104 179 int adp_prb; 105 180 int adp_sns; 181 + int data_pulse; 106 182 107 183 /* Internal variables */ 108 184 int a_set_b_hnp_en; ··· 186 110 int b_hnp_enable; 187 111 int a_clr_err; 188 112 189 - /* Informative variables */ 113 + /* Informative variables. All unused as of now */ 190 114 int a_bus_drop_inf; 191 115 int a_bus_req_inf; 192 116 int a_clr_err_inf; ··· 210 134 struct mutex lock; 211 135 u8 *host_req_flag; 212 136 struct delayed_work hnp_polling_work; 137 + bool state_changed; 213 138 }; 214 139 215 140 struct otg_fsm_ops {