imxusbvar.h revision 1.7 1 1.7 bouyer /* $NetBSD: imxusbvar.h,v 1.7 2023/05/04 17:09:44 bouyer Exp $ */
2 1.5 hkenken /*
3 1.5 hkenken * Copyright (c) 2019 Genetec Corporation. All rights reserved.
4 1.5 hkenken * Written by Hashimoto Kenichi for Genetec Corporation.
5 1.5 hkenken *
6 1.5 hkenken * Redistribution and use in source and binary forms, with or without
7 1.5 hkenken * modification, are permitted provided that the following conditions
8 1.5 hkenken * are met:
9 1.5 hkenken * 1. Redistributions of source code must retain the above copyright
10 1.5 hkenken * notice, this list of conditions and the following disclaimer.
11 1.5 hkenken * 2. Redistributions in binary form must reproduce the above copyright
12 1.5 hkenken * notice, this list of conditions and the following disclaimer in the
13 1.5 hkenken * documentation and/or other materials provided with the distribution.
14 1.5 hkenken *
15 1.5 hkenken * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``AS IS'' AND
16 1.5 hkenken * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17 1.5 hkenken * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 1.5 hkenken * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GENETEC CORPORATION
19 1.5 hkenken * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 1.5 hkenken * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 1.5 hkenken * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 1.5 hkenken * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 1.5 hkenken * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 1.5 hkenken * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 1.5 hkenken * POSSIBILITY OF SUCH DAMAGE.
26 1.5 hkenken */
27 1.5 hkenken
28 1.1 bsh #ifndef _ARM_IMX_IMXUSBVAR_H
29 1.1 bsh #define _ARM_IMX_IMXUSBVAR_H
30 1.1 bsh
31 1.1 bsh struct imxehci_softc;
32 1.1 bsh
33 1.1 bsh enum imx_usb_role {
34 1.1 bsh IMXUSB_HOST,
35 1.1 bsh IMXUSB_DEVICE
36 1.1 bsh };
37 1.1 bsh
38 1.1 bsh struct imxusbc_softc {
39 1.1 bsh device_t sc_dev;
40 1.6 hkenken
41 1.1 bsh bus_space_tag_t sc_iot;
42 1.1 bsh bus_space_handle_t sc_ioh;
43 1.6 hkenken bus_space_handle_t sc_ioh_usbnc;
44 1.1 bsh
45 1.5 hkenken struct clk *sc_clk;
46 1.5 hkenken
47 1.4 ryo /* filled in by platform dependent param & routine */
48 1.6 hkenken bus_addr_t sc_ehci_offset;
49 1.4 ryo bus_size_t sc_ehci_size;
50 1.6 hkenken
51 1.7 bouyer void (* sc_init_md_hook)(struct imxehci_softc *, uintptr_t);
52 1.7 bouyer void *(* sc_intr_establish_md_hook)(struct imxehci_softc *, uintptr_t);
53 1.7 bouyer void (* sc_setup_md_hook)(struct imxehci_softc *, enum imx_usb_role,
54 1.7 bouyer uintptr_t);
55 1.7 bouyer uintptr_t sc_md_hook_data;
56 1.1 bsh };
57 1.1 bsh
58 1.1 bsh struct imxusbc_attach_args {
59 1.1 bsh bus_space_tag_t aa_iot;
60 1.1 bsh bus_space_handle_t aa_ioh;
61 1.1 bsh bus_dma_tag_t aa_dmat;
62 1.1 bsh int aa_unit; /* 0: OTG, 1: HOST1, 2: HOST2 ... */
63 1.1 bsh int aa_irq;
64 1.1 bsh };
65 1.1 bsh
66 1.1 bsh enum imx_usb_if {
67 1.1 bsh IMXUSBC_IF_UTMI,
68 1.1 bsh IMXUSBC_IF_PHILIPS,
69 1.1 bsh IMXUSBC_IF_ULPI,
70 1.2 hkenken IMXUSBC_IF_SERIAL,
71 1.4 ryo IMXUSBC_IF_UTMI_WIDE,
72 1.4 ryo IMXUSBC_IF_HSIC
73 1.1 bsh };
74 1.1 bsh
75 1.1 bsh struct imxehci_softc {
76 1.1 bsh ehci_softc_t sc_hsc;
77 1.1 bsh
78 1.6 hkenken device_t sc_dev;
79 1.1 bsh bus_space_tag_t sc_iot;
80 1.1 bsh bus_space_handle_t sc_ioh;
81 1.6 hkenken void *sc_ih;
82 1.6 hkenken
83 1.1 bsh struct imxusbc_softc *sc_usbc;
84 1.6 hkenken
85 1.1 bsh uint sc_unit;
86 1.1 bsh enum imx_usb_if sc_iftype;
87 1.1 bsh };
88 1.1 bsh
89 1.6 hkenken int imxusbc_attach_common(device_t, device_t, bus_space_tag_t, bus_addr_t, bus_size_t);
90 1.1 bsh void imxehci_reset(struct imxehci_softc *);
91 1.1 bsh
92 1.1 bsh #endif /* _ARM_IMX_IMXUSBVAR_H */
93