1239281Sgonzo/*- 2239281Sgonzo * Copyright (C) 2008-2011 MARVELL INTERNATIONAL LTD. 3239281Sgonzo * All rights reserved. 4239281Sgonzo * 5239281Sgonzo * Developed by Semihalf. 6239281Sgonzo * 7239281Sgonzo * Redistribution and use in source and binary forms, with or without 8239281Sgonzo * modification, are permitted provided that the following conditions 9239281Sgonzo * are met: 10239281Sgonzo * 1. Redistributions of source code must retain the above copyright 11239281Sgonzo * notice, this list of conditions and the following disclaimer. 12239281Sgonzo * 2. Redistributions in binary form must reproduce the above copyright 13239281Sgonzo * notice, this list of conditions and the following disclaimer in the 14239281Sgonzo * documentation and/or other materials provided with the distribution. 15239281Sgonzo * 3. Neither the name of MARVELL nor the names of contributors 16239281Sgonzo * may be used to endorse or promote products derived from this software 17239281Sgonzo * without specific prior written permission. 18239281Sgonzo * 19239281Sgonzo * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND 20239281Sgonzo * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21239281Sgonzo * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22239281Sgonzo * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE 23239281Sgonzo * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24239281Sgonzo * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25239281Sgonzo * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26239281Sgonzo * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27239281Sgonzo * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28239281Sgonzo * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29239281Sgonzo * SUCH DAMAGE. 30239281Sgonzo */ 31239281Sgonzo 32239281Sgonzo#include "opt_global.h" 33239281Sgonzo 34239281Sgonzo#include <sys/cdefs.h> 35239281Sgonzo__FBSDID("$FreeBSD$"); 36239281Sgonzo 37239281Sgonzo#include <sys/param.h> 38239281Sgonzo#include <sys/systm.h> 39239281Sgonzo#include <sys/bus.h> 40239281Sgonzo#include <sys/kernel.h> 41239281Sgonzo#include <sys/malloc.h> 42239281Sgonzo#include <sys/kdb.h> 43239281Sgonzo#include <sys/reboot.h> 44239281Sgonzo 45239281Sgonzo#include <dev/fdt/fdt_common.h> 46239281Sgonzo#include <dev/ofw/openfirm.h> 47239281Sgonzo 48239281Sgonzo#include <machine/bus.h> 49239281Sgonzo#include <machine/fdt.h> 50239281Sgonzo#include <machine/vmparam.h> 51239281Sgonzo 52239281Sgonzostruct fdt_fixup_entry fdt_fixup_table[] = { 53239281Sgonzo { NULL, NULL } 54239281Sgonzo}; 55239281Sgonzo 56239281Sgonzo#ifdef SOC_OMAP4 57239281Sgonzostatic int 58239281Sgonzofdt_gic_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig, 59239281Sgonzo int *pol) 60239281Sgonzo{ 61239281Sgonzo 62239281Sgonzo if (!fdt_is_compatible(node, "arm,gic")) 63239281Sgonzo return (ENXIO); 64239281Sgonzo 65239281Sgonzo *interrupt = fdt32_to_cpu(intr[0]); 66239281Sgonzo *trig = INTR_TRIGGER_CONFORM; 67239281Sgonzo *pol = INTR_POLARITY_CONFORM; 68239281Sgonzo 69239281Sgonzo return (0); 70239281Sgonzo} 71239281Sgonzo#endif 72239281Sgonzo 73239281Sgonzo#ifdef SOC_TI_AM335X 74239281Sgonzostatic int 75239281Sgonzofdt_aintc_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig, 76239281Sgonzo int *pol) 77239281Sgonzo{ 78239281Sgonzo 79239281Sgonzo if (!fdt_is_compatible(node, "ti,aintc")) 80239281Sgonzo return (ENXIO); 81239281Sgonzo 82239281Sgonzo *interrupt = fdt32_to_cpu(intr[0]); 83239281Sgonzo *trig = INTR_TRIGGER_CONFORM; 84239281Sgonzo *pol = INTR_POLARITY_CONFORM; 85239281Sgonzo 86239281Sgonzo return (0); 87239281Sgonzo} 88239281Sgonzo#endif 89239281Sgonzo 90239281Sgonzofdt_pic_decode_t fdt_pic_table[] = { 91239281Sgonzo#ifdef SOC_OMAP4 92239281Sgonzo &fdt_gic_decode_ic, 93239281Sgonzo#endif 94239281Sgonzo#ifdef SOC_TI_AM335X 95239281Sgonzo &fdt_aintc_decode_ic, 96239281Sgonzo#endif 97239281Sgonzo NULL 98239281Sgonzo}; 99