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 <sys/cdefs.h> 33239922Sgonzo__FBSDID("$FreeBSD: stable/11/sys/arm/broadcom/bcm2835/bcm2835_common.c 314506 2017-03-01 19:55:04Z ian $"); 34239922Sgonzo 35239922Sgonzo#include <sys/param.h> 36239922Sgonzo#include <sys/systm.h> 37239922Sgonzo#include <sys/bus.h> 38239922Sgonzo#include <sys/kernel.h> 39239922Sgonzo#include <sys/malloc.h> 40239922Sgonzo#include <sys/kdb.h> 41239922Sgonzo#include <sys/reboot.h> 42239922Sgonzo 43239922Sgonzo#include <dev/fdt/fdt_common.h> 44239922Sgonzo#include <dev/ofw/openfirm.h> 45239922Sgonzo 46239922Sgonzo#include <machine/bus.h> 47239922Sgonzo#include <machine/vmparam.h> 48239922Sgonzo 49298068Sandrew#ifndef INTRNG 50239922Sgonzostatic int 51239922Sgonzofdt_intc_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig, 52239922Sgonzo int *pol) 53239922Sgonzo{ 54239922Sgonzo 55307575Sgonzo if (fdt_is_compatible(node, "broadcom,bcm2835-armctrl-ic") || 56307575Sgonzo fdt_is_compatible(node, "brcm,bcm2836-armctrl-ic")) { 57297545Sskra *interrupt = fdt32_to_cpu(intr[0]); 58297545Sskra *trig = INTR_TRIGGER_CONFORM; 59297545Sskra *pol = INTR_POLARITY_CONFORM; 60297545Sskra return (0); 61297545Sskra } 62297545Sskra#ifdef SOC_BCM2836 63297545Sskra if (fdt_is_compatible(node, "brcm,bcm2836-l1-intc")) { 64297545Sskra *interrupt = fdt32_to_cpu(intr[0]) + 72; 65297545Sskra *trig = INTR_TRIGGER_CONFORM; 66297545Sskra *pol = INTR_POLARITY_CONFORM; 67297545Sskra return (0); 68297545Sskra } 69297545Sskra#endif 70297545Sskra return (ENXIO); 71239922Sgonzo} 72239922Sgonzo 73239922Sgonzo 74239922Sgonzofdt_pic_decode_t fdt_pic_table[] = { 75239922Sgonzo &fdt_intc_decode_ic, 76239922Sgonzo NULL 77239922Sgonzo}; 78298068Sandrew#endif /* INTRNG */ 79