1244197Sgonzo/*- 2330897Seadler * SPDX-License-Identifier: BSD-3-Clause 3330897Seadler * 4244197Sgonzo * Copyright (C) 2008-2011 MARVELL INTERNATIONAL LTD. 5244197Sgonzo * All rights reserved. 6244197Sgonzo * 7244197Sgonzo * Developed by Semihalf. 8244197Sgonzo * 9244197Sgonzo * Redistribution and use in source and binary forms, with or without 10244197Sgonzo * modification, are permitted provided that the following conditions 11244197Sgonzo * are met: 12244197Sgonzo * 1. Redistributions of source code must retain the above copyright 13244197Sgonzo * notice, this list of conditions and the following disclaimer. 14244197Sgonzo * 2. Redistributions in binary form must reproduce the above copyright 15244197Sgonzo * notice, this list of conditions and the following disclaimer in the 16244197Sgonzo * documentation and/or other materials provided with the distribution. 17244197Sgonzo * 3. Neither the name of MARVELL nor the names of contributors 18244197Sgonzo * may be used to endorse or promote products derived from this software 19244197Sgonzo * without specific prior written permission. 20244197Sgonzo * 21244197Sgonzo * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND 22244197Sgonzo * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23244197Sgonzo * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24244197Sgonzo * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE 25244197Sgonzo * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26244197Sgonzo * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27244197Sgonzo * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28244197Sgonzo * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29244197Sgonzo * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30244197Sgonzo * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31244197Sgonzo * SUCH DAMAGE. 32244197Sgonzo */ 33244197Sgonzo 34244197Sgonzo#include <sys/cdefs.h> 35244197Sgonzo__FBSDID("$FreeBSD: stable/11/sys/arm/versatile/versatile_common.c 330897 2018-03-14 03:19:51Z eadler $"); 36244197Sgonzo 37244197Sgonzo#include <sys/param.h> 38244197Sgonzo#include <sys/systm.h> 39244197Sgonzo#include <sys/bus.h> 40244197Sgonzo#include <sys/kernel.h> 41244197Sgonzo#include <sys/malloc.h> 42244197Sgonzo#include <sys/kdb.h> 43244197Sgonzo#include <sys/reboot.h> 44244197Sgonzo 45244197Sgonzo#include <dev/fdt/fdt_common.h> 46244197Sgonzo#include <dev/ofw/openfirm.h> 47244197Sgonzo 48244197Sgonzo#include <machine/bus.h> 49244197Sgonzo#include <machine/vmparam.h> 50244197Sgonzo 51298068Sandrew#ifndef INTRNG 52244197Sgonzostatic int 53244197Sgonzofdt_intc_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig, 54244197Sgonzo int *pol) 55244197Sgonzo{ 56244197Sgonzo 57244197Sgonzo if (!fdt_is_compatible(node, "arm,versatile-vic")) 58244197Sgonzo return (ENXIO); 59244197Sgonzo 60244197Sgonzo *interrupt = fdt32_to_cpu(intr[0]); 61244197Sgonzo *trig = INTR_TRIGGER_CONFORM; 62244197Sgonzo *pol = INTR_POLARITY_CONFORM; 63244197Sgonzo 64244197Sgonzo return (0); 65244197Sgonzo} 66244197Sgonzo 67244197Sgonzo 68244197Sgonzofdt_pic_decode_t fdt_pic_table[] = { 69244197Sgonzo &fdt_intc_decode_ic, 70244197Sgonzo NULL 71244197Sgonzo}; 72295509Sandrew#endif 73