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 32290465Scognet#include "opt_platform.h" 33290465Scognet 34239281Sgonzo#include <sys/cdefs.h> 35239281Sgonzo__FBSDID("$FreeBSD: stable/11/sys/arm/ti/ti_common.c 314506 2017-03-01 19:55:04Z ian $"); 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> 49283276Sgonzo#include <machine/intr.h> 50239281Sgonzo#include <machine/vmparam.h> 51239281Sgonzo 52298068Sandrew#ifndef INTRNG 53239281Sgonzo#ifdef SOC_TI_AM335X 54239281Sgonzostatic int 55239281Sgonzofdt_aintc_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig, 56239281Sgonzo int *pol) 57239281Sgonzo{ 58239281Sgonzo 59283276Sgonzo if (!fdt_is_compatible(node, "ti,aintc") && 60283276Sgonzo !fdt_is_compatible(node, "ti,am33xx-intc")) 61239281Sgonzo return (ENXIO); 62239281Sgonzo 63239281Sgonzo *interrupt = fdt32_to_cpu(intr[0]); 64239281Sgonzo *trig = INTR_TRIGGER_CONFORM; 65239281Sgonzo *pol = INTR_POLARITY_CONFORM; 66239281Sgonzo 67239281Sgonzo return (0); 68239281Sgonzo} 69239281Sgonzo#endif 70239281Sgonzo 71239281Sgonzofdt_pic_decode_t fdt_pic_table[] = { 72294561Sandrew#if defined(SOC_OMAP4) 73283276Sgonzo &gic_decode_fdt, 74239281Sgonzo#endif 75239281Sgonzo#ifdef SOC_TI_AM335X 76239281Sgonzo &fdt_aintc_decode_ic, 77239281Sgonzo#endif 78239281Sgonzo NULL 79239281Sgonzo}; 80298068Sandrew#endif /* !INTRNG */ 81