1 /*        $NetBSD: ulpireg.h,v 1.1 2010/11/27 13:41:49 bsh Exp $      */
2 /*
3  * Copyright (c) 2009, 2010  Genetec Corporation.  All rights reserved.
4  * Written by Hashimoto Kenichi for Genetec Corporation.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``AS IS'' AND
16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL GENETEC CORPORATION
19  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25  * POSSIBILITY OF SUCH DAMAGE.
26  */
27 #ifndef _DEV_USB_ULPI_ULPIREG_H
28 #define   _DEV_USB_ULPI_ULPIREG_H
29 
30 /* commands */
31 #define   ULPI_CMD_SPECIAL    (0x0 << 6)
32 #define   ULPI_CMD_NOOP       (ULPI_CMD_SPECIAL | 0x00)
33 #define   ULPI_CMD_TRANSMIT   (0x1 << 6)
34 #define   ULPI_CMD_PID(n)     (ULPI_CMD_TRANSMIT | (n))
35 #define   ULPI_CMD_REGWRITE   (0x2 << 6)
36 #define   ULPI_CMD_EXTW       (ULPI_CMD_REGWRITE | 0x2f)
37 #define   ULPI_CMD_REGREAD    (0x3 << 6)
38 #define   ULPI_CMD_EXTR       (ULPI_CMD_REGREAD | 0x2f)
39 
40 /* registers */
41 #define   ULPI_VENDOR_ID_LOW            0x00
42 #define   ULPI_VENDOR_ID_HIGH                     0x01
43 #define   ULPI_PRODUCT_ID_LOW                     0x02
44 #define   ULPI_PRODUCT_ID_HIGH          0x03
45 #define   ULPI_FUNCTION_CONTROL         0x04
46 #define    FUNCTION_CONTROL_XCVRSELECT  __BITS(0,1)
47 #define    XCVRSELECT_HS                          0x0
48 #define    XCVRSELECT_FS                          0x1
49 #define    XCVRSELECT_LS                          0x2
50 #define    XCVRSELECT_FSLS              0x3  /* FS Xceiver for LS packets */
51 #define    FUNCTION_CONTROL_TERMSELECT  __BIT(2)
52 #define    FUNCTION_CONTROL_OPMODE      __BITS(3,4)
53 #define    FUNCTION_CONTROL_RESET       __BIT(5)
54 #define    FUNCTION_CONTROL_SUSPENDM    __BIT(6)
55 #define   ULPI_INTERFACE_CONTROL        0x07
56 #define   ULPI_OTG_CONTROL              0x0a
57 #define    OTG_CONTROL_IDPULLUP                   __BIT(0)  /* ID pull up */
58 #define    OTG_CONTROL_DPPULLDOWN       __BIT(1)  /* D+ pull down */
59 #define    OTG_CONTROL_DMPULLDOWN       __BIT(2)  /* D- pull down */
60 #define    OTG_CONTROL_DISCHRGVBUS      __BIT(3)  /* discharge Vbus */
61 #define    OTG_CONTROL_CHRGVBUS         __BIT(4)  /* charge Vbus */
62 #define    OTG_CONTROL_DRVVBUS          __BIT(5)  /* drive 5V on Vbus */
63 #define    OTG_CONTROL_DRVVBUSEXT       __BIT(6)  /* drive Vbus external */
64 #define    OTG_CONTROL_USEEXTVBUSIND    __BIT(7)  /* use external Vbus over-current
65                                                                          indecator */
66 #define   ULPI_USB_INT_RISING_EDGE      0x0d
67 #define   ULPI_USB_INT_FALLING_EDGE     0x10
68 #define   ULPI_USB_INT_STATUS                     0x13
69 #define   ULPI_USB_INTERRUPT_LATCH      0x14
70 #define   ULPI_DEBUG                              0x15
71 #define   ULPI_SCRATCH                            0x16
72 #define   ULPI_CARKIT_CONTROL           0x19
73 #define   ULPI_CARKIT_INTERRUPT_DELAY   0x1c
74 #define   ULPI_CARKIT_INTERRUPT_ENABLE  0x1d
75 #define   ULPI_CARKIT_INTERRUPT_STATUS  0x20
76 #define   ULPI_CARKIT_INTERRUPT_LATCH   0x21
77 #define   ULPI_CARKIT_PULSE_CONTROL     0x22
78 #define   ULPI_TRANSMIT_POSITIVE_WIDTH  0x25
79 #define   ULPI_TRANSMIT_NEGATIVE_WIDTH  0x26
80 #define   ULPI_RECEIVE_POLARITY_RECOVERY          0x27
81 
82 #define   ULPI_VENDOR_SPECIFIC                    0x30
83 
84 #define   ULPI_REG_WRITE      0
85 #define   ULPI_REG_SET                  1
86 #define   ULPI_REG_CLEAR                2
87 
88 #endif    /* _DEV_USB_ULPI_ULPIREG_H */
89