imxusbvar.h revision 1.6
1/* $NetBSD: imxusbvar.h,v 1.6 2019/07/24 11:20:55 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 41 bus_space_tag_t sc_iot; 42 bus_space_handle_t sc_ioh; 43 bus_space_handle_t sc_ioh_usbnc; 44 45 struct clk *sc_clk; 46 47 /* filled in by platform dependent param & routine */ 48 bus_addr_t sc_ehci_offset; 49 bus_size_t sc_ehci_size; 50 51 void (* sc_init_md_hook)(struct imxehci_softc *); 52 void *(* sc_intr_establish_md_hook)(struct imxehci_softc *); 53 void (* sc_setup_md_hook)(struct imxehci_softc *, enum imx_usb_role); 54}; 55 56struct imxusbc_attach_args { 57 bus_space_tag_t aa_iot; 58 bus_space_handle_t aa_ioh; 59 bus_dma_tag_t aa_dmat; 60 int aa_unit; /* 0: OTG, 1: HOST1, 2: HOST2 ... */ 61 int aa_irq; 62}; 63 64enum imx_usb_if { 65 IMXUSBC_IF_UTMI, 66 IMXUSBC_IF_PHILIPS, 67 IMXUSBC_IF_ULPI, 68 IMXUSBC_IF_SERIAL, 69 IMXUSBC_IF_UTMI_WIDE, 70 IMXUSBC_IF_HSIC 71}; 72 73struct imxehci_softc { 74 ehci_softc_t sc_hsc; 75 76 device_t sc_dev; 77 bus_space_tag_t sc_iot; 78 bus_space_handle_t sc_ioh; 79 void *sc_ih; 80 81 struct imxusbc_softc *sc_usbc; 82 83 uint sc_unit; 84 enum imx_usb_if sc_iftype; 85}; 86 87int imxusbc_attach_common(device_t, device_t, bus_space_tag_t, bus_addr_t, bus_size_t); 88void imxehci_reset(struct imxehci_softc *); 89 90#endif /* _ARM_IMX_IMXUSBVAR_H */ 91