1bd69e3adSIan Lepore /*- 2bd69e3adSIan Lepore * Copyright 2015 Michal Meloun 3bd69e3adSIan Lepore * All rights reserved. 4bd69e3adSIan Lepore * 5bd69e3adSIan Lepore * Redistribution and use in source and binary forms, with or without 6bd69e3adSIan Lepore * modification, are permitted provided that the following conditions 7bd69e3adSIan Lepore * are met: 8bd69e3adSIan Lepore * 1. Redistributions of source code must retain the above copyright 9bd69e3adSIan Lepore * notice, this list of conditions and the following disclaimer. 10bd69e3adSIan Lepore * 2. Redistributions in binary form must reproduce the above copyright 11bd69e3adSIan Lepore * notice, this list of conditions and the following disclaimer in the 12bd69e3adSIan Lepore * documentation and/or other materials provided with the distribution. 13bd69e3adSIan Lepore * 14bd69e3adSIan Lepore * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15bd69e3adSIan Lepore * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16bd69e3adSIan Lepore * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17bd69e3adSIan Lepore * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18bd69e3adSIan Lepore * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19bd69e3adSIan Lepore * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20bd69e3adSIan Lepore * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21bd69e3adSIan Lepore * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22bd69e3adSIan Lepore * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23bd69e3adSIan Lepore * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24bd69e3adSIan Lepore * SUCH DAMAGE. 25bd69e3adSIan Lepore */ 26bd69e3adSIan Lepore 27bd69e3adSIan Lepore #ifndef _DEV_UART_CPU_FDT_H_ 28bd69e3adSIan Lepore #define _DEV_UART_CPU_FDT_H_ 29bd69e3adSIan Lepore 30bd69e3adSIan Lepore #include <sys/linker_set.h> 31bd69e3adSIan Lepore 32bd69e3adSIan Lepore #include <dev/ofw/ofw_bus_subr.h> 33bd69e3adSIan Lepore 34bd69e3adSIan Lepore /* 35bd69e3adSIan Lepore * If your UART driver implements only uart_class and uses uart_cpu_fdt.c 36bd69e3adSIan Lepore * for device instantiation, then use UART_FDT_CLASS_AND_DEVICE for its 37bd69e3adSIan Lepore * declaration 38bd69e3adSIan Lepore */ 39bd69e3adSIan Lepore SET_DECLARE(uart_fdt_class_and_device_set, struct ofw_compat_data ); 40bd69e3adSIan Lepore #define UART_FDT_CLASS_AND_DEVICE(data) \ 41bd69e3adSIan Lepore DATA_SET(uart_fdt_class_and_device_set, data) 42bd69e3adSIan Lepore 43bd69e3adSIan Lepore /* 44bd69e3adSIan Lepore * If your UART driver implements uart_class and custom device layer, 45bd69e3adSIan Lepore * then use UART_FDT_CLASS for its declaration 46bd69e3adSIan Lepore */ 47bd69e3adSIan Lepore SET_DECLARE(uart_fdt_class_set, struct ofw_compat_data ); 48bd69e3adSIan Lepore #define UART_FDT_CLASS(data) \ 49bd69e3adSIan Lepore DATA_SET(uart_fdt_class_set, data) 50bd69e3adSIan Lepore 51d4c89391SAndrew Turner int uart_cpu_fdt_probe(struct uart_class **, bus_space_tag_t *, 52*1c5d066aSMitchell Horne bus_space_handle_t *, int *, u_int *, u_int *, u_int *, const int); 5306d8b1edSAndrew Turner int uart_fdt_get_clock(phandle_t node, pcell_t *cell); 5406d8b1edSAndrew Turner int uart_fdt_get_shift(phandle_t node, pcell_t *cell); 55c214a270SRuslan Bukin int uart_fdt_get_io_width(phandle_t node, pcell_t *cell); 56bd69e3adSIan Lepore 57bd69e3adSIan Lepore #endif /* _DEV_UART_CPU_FDT_H_ */ 58