• Home
  • Raw
  • Download

Lines Matching refs:ci

31 u32 hw_read_otgsc(struct ci_hdrc *ci, u32 mask)  in hw_read_otgsc()  argument
33 return hw_read(ci, OP_OTGSC, mask); in hw_read_otgsc()
41 void hw_write_otgsc(struct ci_hdrc *ci, u32 mask, u32 data) in hw_write_otgsc() argument
43 hw_write(ci, OP_OTGSC, mask | OTGSC_INT_STATUS_BITS, data); in hw_write_otgsc()
50 enum ci_role ci_otg_role(struct ci_hdrc *ci) in ci_otg_role() argument
52 enum ci_role role = hw_read_otgsc(ci, OTGSC_ID) in ci_otg_role()
59 void ci_handle_vbus_change(struct ci_hdrc *ci) in ci_handle_vbus_change() argument
61 if (!ci->is_otg) in ci_handle_vbus_change()
64 if (hw_read_otgsc(ci, OTGSC_BSV)) in ci_handle_vbus_change()
65 usb_gadget_vbus_connect(&ci->gadget); in ci_handle_vbus_change()
67 usb_gadget_vbus_disconnect(&ci->gadget); in ci_handle_vbus_change()
71 static void ci_handle_id_switch(struct ci_hdrc *ci) in ci_handle_id_switch() argument
73 enum ci_role role = ci_otg_role(ci); in ci_handle_id_switch()
75 if (role != ci->role) { in ci_handle_id_switch()
76 dev_dbg(ci->dev, "switching from %s to %s\n", in ci_handle_id_switch()
77 ci_role(ci)->name, ci->roles[role]->name); in ci_handle_id_switch()
79 ci_role_stop(ci); in ci_handle_id_switch()
81 hw_wait_reg(ci, OP_OTGSC, OTGSC_BSV, 0, in ci_handle_id_switch()
83 ci_role_start(ci, role); in ci_handle_id_switch()
92 struct ci_hdrc *ci = container_of(work, struct ci_hdrc, work); in ci_otg_work() local
94 if (ci_otg_is_fsm_mode(ci) && !ci_otg_fsm_work(ci)) { in ci_otg_work()
95 enable_irq(ci->irq); in ci_otg_work()
99 if (ci->id_event) { in ci_otg_work()
100 ci->id_event = false; in ci_otg_work()
101 ci_handle_id_switch(ci); in ci_otg_work()
102 } else if (ci->b_sess_valid_event) { in ci_otg_work()
103 ci->b_sess_valid_event = false; in ci_otg_work()
104 ci_handle_vbus_change(ci); in ci_otg_work()
106 dev_err(ci->dev, "unexpected event occurs at %s\n", __func__); in ci_otg_work()
108 enable_irq(ci->irq); in ci_otg_work()
116 int ci_hdrc_otg_init(struct ci_hdrc *ci) in ci_hdrc_otg_init() argument
118 INIT_WORK(&ci->work, ci_otg_work); in ci_hdrc_otg_init()
119 ci->wq = create_freezable_workqueue("ci_otg"); in ci_hdrc_otg_init()
120 if (!ci->wq) { in ci_hdrc_otg_init()
121 dev_err(ci->dev, "can't create workqueue\n"); in ci_hdrc_otg_init()
125 if (ci_otg_is_fsm_mode(ci)) in ci_hdrc_otg_init()
126 return ci_hdrc_otg_fsm_init(ci); in ci_hdrc_otg_init()
135 void ci_hdrc_otg_destroy(struct ci_hdrc *ci) in ci_hdrc_otg_destroy() argument
137 if (ci->wq) { in ci_hdrc_otg_destroy()
138 flush_workqueue(ci->wq); in ci_hdrc_otg_destroy()
139 destroy_workqueue(ci->wq); in ci_hdrc_otg_destroy()
142 hw_write_otgsc(ci, OTGSC_INT_EN_BITS | OTGSC_INT_STATUS_BITS, in ci_hdrc_otg_destroy()
144 if (ci_otg_is_fsm_mode(ci)) in ci_hdrc_otg_destroy()
145 ci_hdrc_otg_fsm_remove(ci); in ci_hdrc_otg_destroy()