1256949Sganbold/*-
2263711Sganbold * Copyright (c) 2013 Ganbold Tsagaankhuu <ganbold@freebsd.org>
3256949Sganbold * All rights reserved.
4256949Sganbold *
5256949Sganbold * Redistribution and use in source and binary forms, with or without
6256949Sganbold * modification, are permitted provided that the following conditions
7256949Sganbold * are met:
8256949Sganbold * 1. Redistributions of source code must retain the above copyright
9256949Sganbold *    notice, this list of conditions and the following disclaimer.
10256949Sganbold * 2. Redistributions in binary form must reproduce the above copyright
11256949Sganbold *    notice, this list of conditions and the following disclaimer in the
12256949Sganbold *    documentation and/or other materials provided with the distribution.
13256949Sganbold *
14256949Sganbold * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15256949Sganbold * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16256949Sganbold * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17256949Sganbold * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18256949Sganbold * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19256949Sganbold * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20256949Sganbold * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21256949Sganbold * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22256949Sganbold * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23256949Sganbold * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24256949Sganbold * SUCH DAMAGE.
25256949Sganbold */
26256949Sganbold
27256949Sganbold#include <sys/cdefs.h>
28256949Sganbold__FBSDID("$FreeBSD: stable/11/sys/arm/rockchip/rk30xx_common.c 314506 2017-03-01 19:55:04Z ian $");
29256949Sganbold
30256949Sganbold#include <sys/param.h>
31256949Sganbold#include <sys/systm.h>
32256949Sganbold#include <sys/bus.h>
33256949Sganbold#include <sys/kernel.h>
34256949Sganbold
35256949Sganbold#include <dev/fdt/fdt_common.h>
36256949Sganbold#include <dev/ofw/openfirm.h>
37256949Sganbold
38256949Sganbold#include <machine/bus.h>
39256949Sganbold#include <machine/vmparam.h>
40256949Sganbold
41298068Sandrew#ifndef INTRNG
42256949Sganboldstatic int
43256949Sganboldfdt_aintc_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig,
44256949Sganbold    int *pol)
45256949Sganbold{
46256949Sganbold
47256949Sganbold	if (!fdt_is_compatible(node, "arm,gic"))
48256949Sganbold		return (ENXIO);
49256949Sganbold
50256949Sganbold	*interrupt = fdt32_to_cpu(intr[0]);
51256949Sganbold	*trig = INTR_TRIGGER_CONFORM;
52256949Sganbold	*pol = INTR_POLARITY_CONFORM;
53256949Sganbold
54256949Sganbold	return (0);
55256949Sganbold}
56256949Sganbold
57256949Sganboldfdt_pic_decode_t fdt_pic_table[] = {
58256949Sganbold	&fdt_aintc_decode_ic,
59256949Sganbold	NULL
60256949Sganbold};
61295509Sandrew#endif
62