uart_cpu_fdt.h revision 340145
1/*-
2 * Copyright 2015 Michal Meloun
3 * All rights reserved.
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 * $FreeBSD: stable/11/sys/dev/uart/uart_cpu_fdt.h 340145 2018-11-04 23:28:56Z mmacy $
27 */
28
29#ifndef _DEV_UART_CPU_FDT_H_
30#define _DEV_UART_CPU_FDT_H_
31
32#include <sys/linker_set.h>
33
34#include <dev/ofw/ofw_bus_subr.h>
35
36/*
37 * If your UART driver implements only uart_class and uses uart_cpu_fdt.c
38 * for device instantiation, then use UART_FDT_CLASS_AND_DEVICE for its
39 * declaration
40 */
41SET_DECLARE(uart_fdt_class_and_device_set, struct ofw_compat_data );
42#define UART_FDT_CLASS_AND_DEVICE(data)				\
43	DATA_SET(uart_fdt_class_and_device_set, data)
44
45/*
46 * If your UART driver implements uart_class and custom device layer,
47 * then use UART_FDT_CLASS for its declaration
48 */
49SET_DECLARE(uart_fdt_class_set, struct ofw_compat_data );
50#define UART_FDT_CLASS(data)				\
51	DATA_SET(uart_fdt_class_set, data)
52
53int uart_cpu_fdt_probe(struct uart_class **, bus_space_tag_t *,
54    bus_space_handle_t *, int *, u_int *, u_int *);
55int uart_fdt_get_clock(phandle_t node, pcell_t *cell);
56int uart_fdt_get_shift(phandle_t node, pcell_t *cell);
57int uart_fdt_get_io_width(phandle_t node, pcell_t *cell);
58
59#endif /* _DEV_UART_CPU_FDT_H_ */
60