Lines Matching +full:ulpi +full:- +full:0

1 /* SPDX-License-Identifier: GPL-2.0 */
3 * ci.h - common structures, functions, and macros of the ChipIdea driver
5 * Copyright (C) 2008 Chipidea - MIPS Technologies, Inc. All rights reserved.
17 #include <linux/usb/otg-fsm.h>
20 #include <linux/ulpi/interface.h>
35 #define ID_ID 0x0
36 #define ID_HWGENERAL 0x4
37 #define ID_HWHOST 0x8
38 #define ID_HWDEVICE 0xc
39 #define ID_HWTXBUF 0x10
40 #define ID_HWRXBUF 0x14
41 #define ID_SBUSCFG 0x90
77 * struct ci_hw_ep - endpoint representation
110 CI_ROLE_HOST = 0,
128 * struct ci_role_driver - host/gadget role driver
146 * struct hw_bank - hardware register mapping representation
166 * struct ci_hdrc - chipidea device representation
173 * @is_otg: if the device is otg-capable
195 * @remote_wakeup: host-enabled remote wakeup
200 * @ulpi: pointer to ULPI device, if any
201 * @ulpi_ops: ULPI read/write ops for this device
254 struct ulpi *ulpi; member
274 BUG_ON(ci->role >= CI_ROLE_END || !ci->roles[ci->role]); in ci_role()
275 return ci->roles[ci->role]; in ci_role()
283 return -EINVAL; in ci_role_start()
285 if (!ci->roles[role]) in ci_role_start()
286 return -ENXIO; in ci_role_start()
288 ret = ci->roles[role]->start(ci); in ci_role_start()
292 ci->role = role; in ci_role_start()
294 if (ci->usb_phy) { in ci_role_start()
296 usb_phy_set_event(ci->usb_phy, USB_EVENT_ID); in ci_role_start()
299 usb_phy_set_event(ci->usb_phy, USB_EVENT_NONE); in ci_role_start()
307 enum ci_role role = ci->role; in ci_role_stop()
312 ci->role = CI_ROLE_END; in ci_role_stop()
314 ci->roles[role]->stop(ci); in ci_role_stop()
316 if (ci->usb_phy) in ci_role_stop()
317 usb_phy_set_event(ci->usb_phy, USB_EVENT_NONE); in ci_role_stop()
322 if (ci->role == CI_ROLE_HOST) in ci_role_to_usb_role()
324 else if (ci->role == CI_ROLE_GADGET && ci->vbus_active) in ci_role_to_usb_role()
350 return ioread32(ci->hw_bank.abs + offset) & mask; in hw_read_id_reg()
364 data = (ioread32(ci->hw_bank.abs + offset) & ~mask) in hw_write_id_reg()
367 iowrite32(data, ci->hw_bank.abs + offset); in hw_write_id_reg()
380 return ioread32(ci->hw_bank.regmap[reg]) & mask; in hw_read()
386 __asm__ ("swp %0, %0, [%1]" : : "r"(val), "r"(addr)); in imx28_ci_writel()
397 if (ci->imx28_write_fix) in __hw_write()
414 data = (ioread32(ci->hw_bank.regmap[reg]) & ~mask) in hw_write()
417 __hw_write(ci, data, ci->hw_bank.regmap[reg]); in hw_write()
431 u32 val = ioread32(ci->hw_bank.regmap[reg]) & mask; in hw_test_and_clear()
433 __hw_write(ci, val, ci->hw_bank.regmap[reg]); in hw_test_and_clear()
449 u32 val = hw_read(ci, reg, ~0); in hw_test_and_write()
464 struct usb_otg_caps *otg_caps = &ci->platdata->ci_otg_caps; in ci_otg_is_fsm_mode()
466 return ci->is_otg && ci->roles[CI_ROLE_HOST] && in ci_otg_is_fsm_mode()
467 ci->roles[CI_ROLE_GADGET] && (otg_caps->srp_support || in ci_otg_is_fsm_mode()
468 otg_caps->hnp_support || otg_caps->adp_support); in ci_otg_is_fsm_mode()