bcmgenetvar.h revision 1.1.6.2 1 1.1.6.2 martin /* $NetBSD: bcmgenetvar.h,v 1.1.6.2 2020/04/08 14:08:06 martin Exp $ */
2 1.1.6.2 martin
3 1.1.6.2 martin /*-
4 1.1.6.2 martin * Copyright (c) 2020 Jared McNeill <jmcneill (at) invisible.ca>
5 1.1.6.2 martin * All rights reserved.
6 1.1.6.2 martin *
7 1.1.6.2 martin * Redistribution and use in source and binary forms, with or without
8 1.1.6.2 martin * modification, are permitted provided that the following conditions
9 1.1.6.2 martin * are met:
10 1.1.6.2 martin * 1. Redistributions of source code must retain the above copyright
11 1.1.6.2 martin * notice, this list of conditions and the following disclaimer.
12 1.1.6.2 martin * 2. Redistributions in binary form must reproduce the above copyright
13 1.1.6.2 martin * notice, this list of conditions and the following disclaimer in the
14 1.1.6.2 martin * documentation and/or other materials provided with the distribution.
15 1.1.6.2 martin *
16 1.1.6.2 martin * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 1.1.6.2 martin * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 1.1.6.2 martin * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 1.1.6.2 martin * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 1.1.6.2 martin * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 1.1.6.2 martin * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 1.1.6.2 martin * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 1.1.6.2 martin * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 1.1.6.2 martin * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 1.1.6.2 martin * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 1.1.6.2 martin * SUCH DAMAGE.
27 1.1.6.2 martin */
28 1.1.6.2 martin
29 1.1.6.2 martin /*
30 1.1.6.2 martin * Broadcom GENETv5
31 1.1.6.2 martin */
32 1.1.6.2 martin
33 1.1.6.2 martin #ifndef _BCMGENETVAR_H
34 1.1.6.2 martin #define _BCMGENETVAR_H
35 1.1.6.2 martin
36 1.1.6.2 martin #include <dev/ic/bcmgenetreg.h>
37 1.1.6.2 martin
38 1.1.6.2 martin enum genet_phy_mode {
39 1.1.6.2 martin GENET_PHY_MODE_RGMII,
40 1.1.6.2 martin GENET_PHY_MODE_RGMII_TXID,
41 1.1.6.2 martin GENET_PHY_MODE_RGMII_RXID,
42 1.1.6.2 martin };
43 1.1.6.2 martin
44 1.1.6.2 martin struct genet_bufmap {
45 1.1.6.2 martin bus_dmamap_t map;
46 1.1.6.2 martin struct mbuf *mbuf;
47 1.1.6.2 martin };
48 1.1.6.2 martin
49 1.1.6.2 martin struct genet_ring {
50 1.1.6.2 martin bus_dma_tag_t buf_tag;
51 1.1.6.2 martin struct genet_bufmap buf_map[GENET_DMA_DESC_COUNT];
52 1.1.6.2 martin u_int next, queued;
53 1.1.6.2 martin uint32_t cidx, pidx;
54 1.1.6.2 martin };
55 1.1.6.2 martin
56 1.1.6.2 martin struct genet_softc {
57 1.1.6.2 martin device_t sc_dev;
58 1.1.6.2 martin bus_space_tag_t sc_bst;
59 1.1.6.2 martin bus_space_handle_t sc_bsh;
60 1.1.6.2 martin bus_dma_tag_t sc_dmat;
61 1.1.6.2 martin int sc_phy_id;
62 1.1.6.2 martin enum genet_phy_mode sc_phy_mode;
63 1.1.6.2 martin
64 1.1.6.2 martin struct ethercom sc_ec;
65 1.1.6.2 martin struct mii_data sc_mii;
66 1.1.6.2 martin callout_t sc_stat_ch;
67 1.1.6.2 martin kmutex_t sc_lock;
68 1.1.6.2 martin
69 1.1.6.2 martin struct genet_ring sc_tx;
70 1.1.6.2 martin struct genet_ring sc_rx;
71 1.1.6.2 martin };
72 1.1.6.2 martin
73 1.1.6.2 martin int genet_attach(struct genet_softc *);
74 1.1.6.2 martin int genet_intr(void *);
75 1.1.6.2 martin
76 1.1.6.2 martin #endif /* !_BCMGENETVAR_H */
77