xref: /freebsd/sys/dev/dwc/if_dwc_if.m (revision 3494f7c0)
1#-
2# Copyright (c) 2015 Luiz Otavio O Souza <loos@FreeBSD.org>
3# Copyright (c) 2014 Ruslan Bukin <br@bsdpad.com>
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions
7# are met:
8# 1. Redistributions of source code must retain the above copyright
9#    notice, this list of conditions and the following disclaimer.
10# 2. Redistributions in binary form must reproduce the above copyright
11#    notice, this list of conditions and the following disclaimer in the
12#    documentation and/or other materials provided with the distribution.
13#
14# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24# SUCH DAMAGE.
25#
26#
27
28INTERFACE if_dwc;
29
30#include <dev/dwc/dwc1000_reg.h>
31
32CODE {
33	static int
34	if_dwc_default_init(device_t dev)
35	{
36		return (0);
37	}
38
39	static int
40	if_dwc_default_mii_clk(device_t dev)
41	{
42		return (GMAC_MII_CLK_25_35M_DIV16);
43	}
44
45	static int
46	if_dwc_default_set_speed(device_t dev, int speed)
47	{
48		return (0);
49	}
50};
51
52HEADER {
53};
54
55#
56# Initialize the SoC specific registers.
57#
58METHOD int init {
59	device_t dev;
60} DEFAULT if_dwc_default_init;
61
62#
63# Return the DWC MII clock for a specific hardware.
64#
65METHOD int mii_clk {
66	device_t dev;
67} DEFAULT if_dwc_default_mii_clk;
68
69#
70# Signal media change to a specific hardware
71#
72METHOD int set_speed {
73	device_t dev;
74	int speed;
75} DEFAULT if_dwc_default_set_speed;
76