versatile_common.c revision 295509
1244197Sgonzo/*-
2244197Sgonzo * Copyright (C) 2008-2011 MARVELL INTERNATIONAL LTD.
3244197Sgonzo * All rights reserved.
4244197Sgonzo *
5244197Sgonzo * Developed by Semihalf.
6244197Sgonzo *
7244197Sgonzo * Redistribution and use in source and binary forms, with or without
8244197Sgonzo * modification, are permitted provided that the following conditions
9244197Sgonzo * are met:
10244197Sgonzo * 1. Redistributions of source code must retain the above copyright
11244197Sgonzo *    notice, this list of conditions and the following disclaimer.
12244197Sgonzo * 2. Redistributions in binary form must reproduce the above copyright
13244197Sgonzo *    notice, this list of conditions and the following disclaimer in the
14244197Sgonzo *    documentation and/or other materials provided with the distribution.
15244197Sgonzo * 3. Neither the name of MARVELL nor the names of contributors
16244197Sgonzo *    may be used to endorse or promote products derived from this software
17244197Sgonzo *    without specific prior written permission.
18244197Sgonzo *
19244197Sgonzo * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20244197Sgonzo * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21244197Sgonzo * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22244197Sgonzo * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
23244197Sgonzo * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24244197Sgonzo * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25244197Sgonzo * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26244197Sgonzo * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27244197Sgonzo * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28244197Sgonzo * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29244197Sgonzo * SUCH DAMAGE.
30244197Sgonzo */
31244197Sgonzo
32244197Sgonzo#include <sys/cdefs.h>
33244197Sgonzo__FBSDID("$FreeBSD: head/sys/arm/versatile/versatile_common.c 295509 2016-02-11 11:49:27Z andrew $");
34244197Sgonzo
35244197Sgonzo#include <sys/param.h>
36244197Sgonzo#include <sys/systm.h>
37244197Sgonzo#include <sys/bus.h>
38244197Sgonzo#include <sys/kernel.h>
39244197Sgonzo#include <sys/malloc.h>
40244197Sgonzo#include <sys/kdb.h>
41244197Sgonzo#include <sys/reboot.h>
42244197Sgonzo
43244197Sgonzo#include <dev/fdt/fdt_common.h>
44244197Sgonzo#include <dev/ofw/openfirm.h>
45244197Sgonzo
46244197Sgonzo#include <machine/bus.h>
47244197Sgonzo#include <machine/vmparam.h>
48244197Sgonzo
49244197Sgonzostruct fdt_fixup_entry fdt_fixup_table[] = {
50244197Sgonzo	{ NULL, NULL }
51244197Sgonzo};
52244197Sgonzo
53295509Sandrew#ifndef ARM_INTRNG
54244197Sgonzostatic int
55244197Sgonzofdt_intc_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig,
56244197Sgonzo    int *pol)
57244197Sgonzo{
58244197Sgonzo
59244197Sgonzo	if (!fdt_is_compatible(node, "arm,versatile-vic"))
60244197Sgonzo		return (ENXIO);
61244197Sgonzo
62244197Sgonzo	*interrupt = fdt32_to_cpu(intr[0]);
63244197Sgonzo	*trig = INTR_TRIGGER_CONFORM;
64244197Sgonzo	*pol = INTR_POLARITY_CONFORM;
65244197Sgonzo
66244197Sgonzo	return (0);
67244197Sgonzo}
68244197Sgonzo
69244197Sgonzo
70244197Sgonzofdt_pic_decode_t fdt_pic_table[] = {
71244197Sgonzo	&fdt_intc_decode_ic,
72244197Sgonzo	NULL
73244197Sgonzo};
74295509Sandrew#endif
75