11fc1a228SAndrew Turner /*- 2*4d846d26SWarner Losh * SPDX-License-Identifier: BSD-2-Clause 31fc1a228SAndrew Turner * 41fc1a228SAndrew Turner * Copyright (c) 2020 Amazon.com, Inc. or its affiliates. 51fc1a228SAndrew Turner * All rights reserved. 61fc1a228SAndrew Turner * 71fc1a228SAndrew Turner * Redistribution and use in source and binary forms, with or without 81fc1a228SAndrew Turner * modification, are permitted provided that the following conditions 91fc1a228SAndrew Turner * are met: 101fc1a228SAndrew Turner * 1. Redistributions of source code must retain the above copyright 111fc1a228SAndrew Turner * notice, this list of conditions and the following disclaimer. 121fc1a228SAndrew Turner * 2. Redistributions in binary form must reproduce the above copyright 131fc1a228SAndrew Turner * notice, this list of conditions and the following disclaimer in the 141fc1a228SAndrew Turner * documentation and/or other materials provided with the distribution. 151fc1a228SAndrew Turner * 161fc1a228SAndrew Turner * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 171fc1a228SAndrew Turner * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 181fc1a228SAndrew Turner * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 191fc1a228SAndrew Turner * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 201fc1a228SAndrew Turner * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 211fc1a228SAndrew Turner * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 221fc1a228SAndrew Turner * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 231fc1a228SAndrew Turner * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 241fc1a228SAndrew Turner * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 251fc1a228SAndrew Turner * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 261fc1a228SAndrew Turner * SUCH DAMAGE. 271fc1a228SAndrew Turner */ 281fc1a228SAndrew Turner 291fc1a228SAndrew Turner #ifndef __DEV_PL061_H__ 301fc1a228SAndrew Turner #define __DEV_PL061_H__ 311fc1a228SAndrew Turner 321fc1a228SAndrew Turner DECLARE_CLASS(pl061_driver); 331fc1a228SAndrew Turner 341fc1a228SAndrew Turner #define PL061_NUM_GPIO 8 351fc1a228SAndrew Turner 361fc1a228SAndrew Turner struct pl061_pin_irqsrc { 371fc1a228SAndrew Turner struct intr_irqsrc isrc; 381fc1a228SAndrew Turner uint32_t irq; 391fc1a228SAndrew Turner uint32_t mode; 401fc1a228SAndrew Turner }; 411fc1a228SAndrew Turner 421fc1a228SAndrew Turner struct pl061_softc { 431fc1a228SAndrew Turner device_t sc_dev; 441fc1a228SAndrew Turner device_t sc_busdev; 451fc1a228SAndrew Turner struct mtx sc_mtx; 461fc1a228SAndrew Turner struct resource *sc_mem_res; 471fc1a228SAndrew Turner struct resource *sc_irq_res; 481fc1a228SAndrew Turner void *sc_irq_hdlr; 491fc1a228SAndrew Turner int sc_mem_rid; 501fc1a228SAndrew Turner int sc_irq_rid; 511fc1a228SAndrew Turner struct pl061_pin_irqsrc sc_isrcs[PL061_NUM_GPIO]; 521fc1a228SAndrew Turner }; 531fc1a228SAndrew Turner 541fc1a228SAndrew Turner int pl061_attach(device_t); 551fc1a228SAndrew Turner int pl061_detach(device_t); 561fc1a228SAndrew Turner 571fc1a228SAndrew Turner #endif /* __DEV_PL061_H__ */ 58