1239922Sgonzo/*-
2239922Sgonzo * Copyright (C) 2008-2011 MARVELL INTERNATIONAL LTD.
3239922Sgonzo * All rights reserved.
4239922Sgonzo *
5239922Sgonzo * Developed by Semihalf.
6239922Sgonzo *
7239922Sgonzo * Redistribution and use in source and binary forms, with or without
8239922Sgonzo * modification, are permitted provided that the following conditions
9239922Sgonzo * are met:
10239922Sgonzo * 1. Redistributions of source code must retain the above copyright
11239922Sgonzo *    notice, this list of conditions and the following disclaimer.
12239922Sgonzo * 2. Redistributions in binary form must reproduce the above copyright
13239922Sgonzo *    notice, this list of conditions and the following disclaimer in the
14239922Sgonzo *    documentation and/or other materials provided with the distribution.
15239922Sgonzo * 3. Neither the name of MARVELL nor the names of contributors
16239922Sgonzo *    may be used to endorse or promote products derived from this software
17239922Sgonzo *    without specific prior written permission.
18239922Sgonzo *
19239922Sgonzo * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20239922Sgonzo * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21239922Sgonzo * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22239922Sgonzo * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
23239922Sgonzo * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24239922Sgonzo * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25239922Sgonzo * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26239922Sgonzo * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27239922Sgonzo * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28239922Sgonzo * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29239922Sgonzo * SUCH DAMAGE.
30239922Sgonzo */
31239922Sgonzo
32239922Sgonzo#include "opt_global.h"
33239922Sgonzo
34239922Sgonzo#include <sys/cdefs.h>
35239922Sgonzo__FBSDID("$FreeBSD$");
36239922Sgonzo
37239922Sgonzo#include <sys/param.h>
38239922Sgonzo#include <sys/systm.h>
39239922Sgonzo#include <sys/bus.h>
40239922Sgonzo#include <sys/kernel.h>
41239922Sgonzo#include <sys/malloc.h>
42239922Sgonzo#include <sys/kdb.h>
43239922Sgonzo#include <sys/reboot.h>
44239922Sgonzo
45239922Sgonzo#include <dev/fdt/fdt_common.h>
46239922Sgonzo#include <dev/ofw/openfirm.h>
47239922Sgonzo
48239922Sgonzo#include <machine/bus.h>
49239922Sgonzo#include <machine/fdt.h>
50239922Sgonzo#include <machine/vmparam.h>
51239922Sgonzo
52239922Sgonzostruct fdt_fixup_entry fdt_fixup_table[] = {
53239922Sgonzo	{ NULL, NULL }
54239922Sgonzo};
55239922Sgonzo
56239922Sgonzostatic int
57239922Sgonzofdt_intc_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig,
58239922Sgonzo    int *pol)
59239922Sgonzo{
60239922Sgonzo
61239922Sgonzo	if (!fdt_is_compatible(node, "broadcom,bcm2835-armctrl-ic"))
62239922Sgonzo		return (ENXIO);
63239922Sgonzo
64239922Sgonzo	*interrupt = fdt32_to_cpu(intr[0]);
65239922Sgonzo	*trig = INTR_TRIGGER_CONFORM;
66239922Sgonzo	*pol = INTR_POLARITY_CONFORM;
67239922Sgonzo
68239922Sgonzo	return (0);
69239922Sgonzo}
70239922Sgonzo
71239922Sgonzo
72239922Sgonzofdt_pic_decode_t fdt_pic_table[] = {
73239922Sgonzo	&fdt_intc_decode_ic,
74239922Sgonzo	NULL
75239922Sgonzo};
76