rk30xx_common.c revision 298068
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: head/sys/arm/rockchip/rk30xx_common.c 298068 2016-04-15 16:05:41Z andrew $");
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
41256949Sganboldstruct fdt_fixup_entry fdt_fixup_table[] = {
42256949Sganbold	{ NULL, NULL }
43256949Sganbold};
44256949Sganbold
45298068Sandrew#ifndef INTRNG
46256949Sganboldstatic int
47256949Sganboldfdt_aintc_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig,
48256949Sganbold    int *pol)
49256949Sganbold{
50256949Sganbold
51256949Sganbold	if (!fdt_is_compatible(node, "arm,gic"))
52256949Sganbold		return (ENXIO);
53256949Sganbold
54256949Sganbold	*interrupt = fdt32_to_cpu(intr[0]);
55256949Sganbold	*trig = INTR_TRIGGER_CONFORM;
56256949Sganbold	*pol = INTR_POLARITY_CONFORM;
57256949Sganbold
58256949Sganbold	return (0);
59256949Sganbold}
60256949Sganbold
61256949Sganboldfdt_pic_decode_t fdt_pic_table[] = {
62256949Sganbold	&fdt_aintc_decode_ic,
63256949Sganbold	NULL
64256949Sganbold};
65295509Sandrew#endif
66