imxusbvar.h revision 1.5
1/*	$NetBSD: imxusbvar.h,v 1.5 2019/06/20 08:16:19 hkenken Exp $	*/
2/*
3 * Copyright (c) 2019  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
28#ifndef _ARM_IMX_IMXUSBVAR_H
29#define _ARM_IMX_IMXUSBVAR_H
30
31struct imxehci_softc;
32
33enum imx_usb_role {
34	IMXUSB_HOST,
35	IMXUSB_DEVICE
36};
37
38struct imxusbc_softc {
39	device_t sc_dev;
40	bus_space_tag_t sc_iot;
41	bus_space_handle_t sc_ioh;
42
43	struct clk *sc_clk;
44
45	/* filled in by platform dependent param & routine */
46	bus_size_t sc_ehci_size;
47	void (* sc_init_md_hook)(struct imxehci_softc *);
48	void (* sc_setup_md_hook)(struct imxehci_softc *, enum imx_usb_role);
49};
50
51struct imxusbc_attach_args {
52	bus_space_tag_t aa_iot;
53	bus_space_handle_t aa_ioh;
54	bus_dma_tag_t aa_dmat;
55	int aa_unit;	/* 0: OTG, 1: HOST1, 2: HOST2 ... */
56	int aa_irq;
57};
58
59enum imx_usb_if {
60	IMXUSBC_IF_UTMI,
61	IMXUSBC_IF_PHILIPS,
62	IMXUSBC_IF_ULPI,
63	IMXUSBC_IF_SERIAL,
64	IMXUSBC_IF_UTMI_WIDE,
65	IMXUSBC_IF_HSIC
66};
67
68struct imxehci_softc {
69	ehci_softc_t sc_hsc;
70
71	bus_space_tag_t sc_iot;
72	bus_space_handle_t sc_ioh;
73	struct imxusbc_softc *sc_usbc;
74	uint sc_unit;
75	enum imx_usb_if sc_iftype;
76};
77
78int imxusbc_attach_common(device_t, device_t, bus_space_tag_t);
79void imxehci_reset(struct imxehci_softc *);
80
81#endif	/* _ARM_IMX_IMXUSBVAR_H */
82