blob: 7344d9e591cce044f3281723f16cb30977722160 [file] [log] [blame]
Chris Rorvickb9ec1c92014-11-04 19:18:45 -06001/*
2 * Standalone EHCI usb debug driver
3 *
4 * Originally written by:
5 * Eric W. Biederman" <ebiederm@xmission.com> and
6 * Yinghai Lu <yhlu.kernel@gmail.com>
7 *
8 * Changes for early/late printk and HW errata:
9 * Jason Wessel <jason.wessel@windriver.com>
10 * Copyright (C) 2009 Wind River Systems, Inc.
11 *
12 */
13
14#ifndef __LINUX_USB_EHCI_DBGP_H
15#define __LINUX_USB_EHCI_DBGP_H
16
17#include <linux/console.h>
18#include <linux/types.h>
19
20/* Appendix C, Debug port ... intended for use with special "debug devices"
21 * that can help if there's no serial console. (nonstandard enumeration.)
22 */
23struct ehci_dbg_port {
24 u32 control;
25#define DBGP_OWNER (1<<30)
26#define DBGP_ENABLED (1<<28)
27#define DBGP_DONE (1<<16)
28#define DBGP_INUSE (1<<10)
29#define DBGP_ERRCODE(x) (((x)>>7)&0x07)
30# define DBGP_ERR_BAD 1
31# define DBGP_ERR_SIGNAL 2
32#define DBGP_ERROR (1<<6)
33#define DBGP_GO (1<<5)
34#define DBGP_OUT (1<<4)
35#define DBGP_LEN(x) (((x)>>0)&0x0f)
36 u32 pids;
37#define DBGP_PID_GET(x) (((x)>>16)&0xff)
38#define DBGP_PID_SET(data, tok) (((data)<<8)|(tok))
39 u32 data03;
40 u32 data47;
41 u32 address;
42#define DBGP_EPADDR(dev, ep) (((dev)<<8)|(ep))
43};
44
45#ifdef CONFIG_EARLY_PRINTK_DBGP
Chris Rorvick35a27ea2014-11-04 19:18:54 -060046extern int early_dbgp_init(char *s);
Chris Rorvickb9ec1c92014-11-04 19:18:45 -060047extern struct console early_dbgp_console;
48#endif /* CONFIG_EARLY_PRINTK_DBGP */
49
50struct usb_hcd;
51
52#ifdef CONFIG_XEN_DOM0
53extern int xen_dbgp_reset_prep(struct usb_hcd *);
54extern int xen_dbgp_external_startup(struct usb_hcd *);
55#else
56static inline int xen_dbgp_reset_prep(struct usb_hcd *hcd)
57{
58 return 1; /* Shouldn't this be 0? */
59}
60
61static inline int xen_dbgp_external_startup(struct usb_hcd *hcd)
62{
63 return -1;
64}
65#endif
66
67#ifdef CONFIG_EARLY_PRINTK_DBGP
68/* Call backs from ehci host driver to ehci debug driver */
69extern int dbgp_external_startup(struct usb_hcd *);
70extern int dbgp_reset_prep(struct usb_hcd *);
71#else
72static inline int dbgp_reset_prep(struct usb_hcd *hcd)
73{
74 return xen_dbgp_reset_prep(hcd);
75}
76
77static inline int dbgp_external_startup(struct usb_hcd *hcd)
78{
79 return xen_dbgp_external_startup(hcd);
80}
81#endif
82
83#endif /* __LINUX_USB_EHCI_DBGP_H */