4 * Copyright (C) 2011 Renesas Solutions Corp.
5 * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 #ifndef RENESAS_USB_MOD_H
18 #define RENESAS_USB_MOD_H
20 #include <linux/spinlock.h>
21 #include <linux/usb/renesas_usbhs.h>
27 struct usbhs_irq_state
{
40 * entry point from common.c
42 int (*start
)(struct usbhs_priv
*priv
);
43 int (*stop
)(struct usbhs_priv
*priv
);
45 /* INTSTS0 :: DVST (DVSQ) */
46 int (*irq_dev_state
)(struct usbhs_priv
*priv
,
47 struct usbhs_irq_state
*irq_state
);
49 /* INTSTS0 :: CTRT (CTSQ) */
50 int (*irq_ctrl_stage
)(struct usbhs_priv
*priv
,
51 struct usbhs_irq_state
*irq_state
);
55 int (*irq_empty
)(struct usbhs_priv
*priv
,
56 struct usbhs_irq_state
*irq_state
);
61 int (*irq_ready
)(struct usbhs_priv
*priv
,
62 struct usbhs_irq_state
*irq_state
);
65 struct usbhs_priv
*priv
;
68 struct usbhs_mod_info
{
69 struct usbhs_mod
*mod
[USBHS_MAX
];
70 struct usbhs_mod
*curt
; /* current mod */
74 * for host/gadget module
76 struct usbhs_mod
*usbhs_mod_get(struct usbhs_priv
*priv
, int id
);
77 struct usbhs_mod
*usbhs_mod_get_current(struct usbhs_priv
*priv
);
78 void usbhs_mod_register(struct usbhs_priv
*priv
, struct usbhs_mod
*usb
, int id
);
79 int usbhs_mod_is_host(struct usbhs_priv
*priv
, struct usbhs_mod
*mod
);
80 int usbhs_mod_change(struct usbhs_priv
*priv
, int id
);
81 int usbhs_mod_probe(struct usbhs_priv
*priv
);
82 void usbhs_mod_remove(struct usbhs_priv
*priv
);
87 int usbhs_status_get_usb_speed(struct usbhs_irq_state
*irq_state
);
88 int usbhs_status_get_device_state(struct usbhs_irq_state
*irq_state
);
89 int usbhs_status_get_ctrl_stage(struct usbhs_irq_state
*irq_state
);
94 void usbhs_irq_callback_update(struct usbhs_priv
*priv
, struct usbhs_mod
*mod
);
97 #define usbhs_mod_call(priv, func, param...) \
99 struct usbhs_mod *mod; \
100 mod = usbhs_mod_get_current(priv); \
109 #ifdef CONFIG_USB_RENESAS_USBHS_UDC
110 extern int __devinit
usbhs_mod_gadget_probe(struct usbhs_priv
*priv
);
111 extern void __devexit
usbhs_mod_gadget_remove(struct usbhs_priv
*priv
);
113 static inline int usbhs_mod_gadget_probe(struct usbhs_priv
*priv
)
117 static inline void usbhs_mod_gadget_remove(struct usbhs_priv
*priv
)
122 #endif /* RENESAS_USB_MOD_H */