1279723Sian/*-
2279723Sian * Copyright 2015 Michal Meloun
3279723Sian * All rights reserved.
4279723Sian *
5279723Sian * Redistribution and use in source and binary forms, with or without
6279723Sian * modification, are permitted provided that the following conditions
7279723Sian * are met:
8279723Sian * 1. Redistributions of source code must retain the above copyright
9279723Sian *    notice, this list of conditions and the following disclaimer.
10279723Sian * 2. Redistributions in binary form must reproduce the above copyright
11279723Sian *    notice, this list of conditions and the following disclaimer in the
12279723Sian *    documentation and/or other materials provided with the distribution.
13279723Sian *
14279723Sian * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15279723Sian * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16279723Sian * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17279723Sian * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18279723Sian * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19279723Sian * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20279723Sian * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21279723Sian * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22279723Sian * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23279723Sian * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24279723Sian * SUCH DAMAGE.
25279723Sian *
26279723Sian * $FreeBSD$
27279723Sian */
28279723Sian
29279723Sian#ifndef _DEV_UART_CPU_FDT_H_
30279723Sian#define _DEV_UART_CPU_FDT_H_
31279723Sian
32279723Sian#include <sys/linker_set.h>
33279723Sian
34279723Sian#include <dev/ofw/ofw_bus_subr.h>
35279723Sian
36279723Sian/*
37279723Sian * If your UART driver implements only uart_class and uses uart_cpu_fdt.c
38279723Sian * for device instantiation, then use UART_FDT_CLASS_AND_DEVICE for its
39279723Sian * declaration
40279723Sian */
41279723SianSET_DECLARE(uart_fdt_class_and_device_set, struct ofw_compat_data );
42279723Sian#define UART_FDT_CLASS_AND_DEVICE(data)				\
43279723Sian	DATA_SET(uart_fdt_class_and_device_set, data)
44279723Sian
45279723Sian/*
46279723Sian * If your UART driver implements uart_class and custom device layer,
47279723Sian * then use UART_FDT_CLASS for its declaration
48279723Sian */
49279723SianSET_DECLARE(uart_fdt_class_set, struct ofw_compat_data );
50279723Sian#define UART_FDT_CLASS(data)				\
51279723Sian	DATA_SET(uart_fdt_class_set, data)
52279723Sian
53283481Sianint uart_fdt_get_clock(phandle_t node, pcell_t *cell);
54283481Sianint uart_fdt_get_shift(phandle_t node, pcell_t *cell);
55279723Sian
56279723Sian#endif /* _DEV_UART_CPU_FDT_H_ */
57