1193323Sed/*-
2193323Sed * Copyright (C) 2008-2011 MARVELL INTERNATIONAL LTD.
3193323Sed * All rights reserved.
4193323Sed *
5193323Sed * Developed by Semihalf.
6193323Sed *
7193323Sed * Redistribution and use in source and binary forms, with or without
8193323Sed * modification, are permitted provided that the following conditions
9193323Sed * are met:
10193323Sed * 1. Redistributions of source code must retain the above copyright
11193323Sed *    notice, this list of conditions and the following disclaimer.
12193323Sed * 2. Redistributions in binary form must reproduce the above copyright
13193323Sed *    notice, this list of conditions and the following disclaimer in the
14193323Sed *    documentation and/or other materials provided with the distribution.
15193323Sed * 3. Neither the name of MARVELL nor the names of contributors
16193323Sed *    may be used to endorse or promote products derived from this software
17193323Sed *    without specific prior written permission.
18193323Sed *
19193323Sed * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20205218Srdivacky * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21202375Srdivacky * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22198090Srdivacky * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
23198090Srdivacky * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24193323Sed * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25193323Sed * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26193323Sed * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27193323Sed * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28198892Srdivacky * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29193323Sed * SUCH DAMAGE.
30198090Srdivacky */
31193323Sed
32193323Sed#include "opt_global.h"
33212904Sdim
34212904Sdim#include <sys/cdefs.h>
35198090Srdivacky__FBSDID("$FreeBSD$");
36193323Sed
37193323Sed#include <sys/param.h>
38193323Sed#include <sys/systm.h>
39193323Sed#include <sys/bus.h>
40193323Sed#include <sys/kernel.h>
41193323Sed#include <sys/malloc.h>
42193323Sed#include <sys/kdb.h>
43198892Srdivacky#include <sys/reboot.h>
44193323Sed
45193323Sed#include <dev/fdt/fdt_common.h>
46193323Sed#include <dev/ofw/openfirm.h>
47193323Sed
48193323Sed#include <machine/bus.h>
49193323Sed#include <machine/fdt.h>
50193323Sed#include <machine/vmparam.h>
51193323Sed
52193323Sedstruct fdt_fixup_entry fdt_fixup_table[] = {
53193323Sed	{ NULL, NULL }
54193323Sed};
55193323Sed
56193323Sedstatic int
57193323Sedfdt_intc_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig,
58212904Sdim    int *pol)
59212904Sdim{
60193323Sed
61193323Sed	if (!fdt_is_compatible(node, "arm,versatile-vic"))
62193323Sed		return (ENXIO);
63193323Sed
64193323Sed	*interrupt = fdt32_to_cpu(intr[0]);
65193323Sed	*trig = INTR_TRIGGER_CONFORM;
66193323Sed	*pol = INTR_POLARITY_CONFORM;
67193323Sed
68193323Sed	return (0);
69193323Sed}
70193323Sed
71193323Sed
72193323Sedfdt_pic_decode_t fdt_pic_table[] = {
73212904Sdim	&fdt_intc_decode_ic,
74193323Sed	NULL
75193323Sed};
76193323Sed