blob: 449bee07f4fe00a9e9f4f0e2f8b297f1d1518090 [file] [log] [blame]
Peter Chenc10b4f02013-08-14 12:44:06 +03001/*
Peter Chen5332ff12014-01-10 13:51:31 +08002 * Copyright (C) 2013-2014 Freescale Semiconductor, Inc.
Peter Chenc10b4f02013-08-14 12:44:06 +03003 *
4 * Author: Peter Chen
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __DRIVERS_USB_CHIPIDEA_OTG_H
12#define __DRIVERS_USB_CHIPIDEA_OTG_H
13
14static inline void ci_clear_otg_interrupt(struct ci_hdrc *ci, u32 bits)
15{
16 /* Only clear request bits */
17 hw_write(ci, OP_OTGSC, OTGSC_INT_STATUS_BITS, bits);
18}
19
20static inline void ci_enable_otg_interrupt(struct ci_hdrc *ci, u32 bits)
21{
Peter Chen5332ff12014-01-10 13:51:31 +080022 hw_write(ci, OP_OTGSC, bits | OTGSC_INT_STATUS_BITS, bits);
Peter Chenc10b4f02013-08-14 12:44:06 +030023}
24
25static inline void ci_disable_otg_interrupt(struct ci_hdrc *ci, u32 bits)
26{
Peter Chen5332ff12014-01-10 13:51:31 +080027 hw_write(ci, OP_OTGSC, bits | OTGSC_INT_STATUS_BITS, 0);
Peter Chenc10b4f02013-08-14 12:44:06 +030028}
29
30int ci_hdrc_otg_init(struct ci_hdrc *ci);
Peter Chencbec6bd2013-08-14 12:44:10 +030031void ci_hdrc_otg_destroy(struct ci_hdrc *ci);
32enum ci_role ci_otg_role(struct ci_hdrc *ci);
Peter Chena107f8c2013-08-14 12:44:11 +030033void ci_handle_vbus_change(struct ci_hdrc *ci);
Peter Chenc10b4f02013-08-14 12:44:06 +030034
35#endif /* __DRIVERS_USB_CHIPIDEA_OTG_H */