10aeed3e9SJustin Hibbits /*- 20aeed3e9SJustin Hibbits * Copyright (c) 2011-2012 Semihalf. 30aeed3e9SJustin Hibbits * All rights reserved. 40aeed3e9SJustin Hibbits * 50aeed3e9SJustin Hibbits * Redistribution and use in source and binary forms, with or without 60aeed3e9SJustin Hibbits * modification, are permitted provided that the following conditions 70aeed3e9SJustin Hibbits * are met: 80aeed3e9SJustin Hibbits * 1. Redistributions of source code must retain the above copyright 90aeed3e9SJustin Hibbits * notice, this list of conditions and the following disclaimer. 100aeed3e9SJustin Hibbits * 2. Redistributions in binary form must reproduce the above copyright 110aeed3e9SJustin Hibbits * notice, this list of conditions and the following disclaimer in the 120aeed3e9SJustin Hibbits * documentation and/or other materials provided with the distribution. 130aeed3e9SJustin Hibbits * 140aeed3e9SJustin Hibbits * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 150aeed3e9SJustin Hibbits * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 160aeed3e9SJustin Hibbits * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 170aeed3e9SJustin Hibbits * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 180aeed3e9SJustin Hibbits * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 190aeed3e9SJustin Hibbits * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 200aeed3e9SJustin Hibbits * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 210aeed3e9SJustin Hibbits * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 220aeed3e9SJustin Hibbits * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 230aeed3e9SJustin Hibbits * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 240aeed3e9SJustin Hibbits * SUCH DAMAGE. 250aeed3e9SJustin Hibbits */ 260aeed3e9SJustin Hibbits 270aeed3e9SJustin Hibbits #ifndef FMAN_H_ 280aeed3e9SJustin Hibbits #define FMAN_H_ 290aeed3e9SJustin Hibbits 3047cabd04SJustin Hibbits #include <dev/fdt/simplebus.h> 3147cabd04SJustin Hibbits 320aeed3e9SJustin Hibbits /** 330aeed3e9SJustin Hibbits * FMan driver instance data. 340aeed3e9SJustin Hibbits */ 350aeed3e9SJustin Hibbits struct fman_softc { 3647cabd04SJustin Hibbits struct simplebus_softc sc_base; 370aeed3e9SJustin Hibbits struct resource *mem_res; 380aeed3e9SJustin Hibbits struct resource *irq_res; 390aeed3e9SJustin Hibbits struct resource *err_irq_res; 40a32b5435SJustin Hibbits struct rman rman; 410aeed3e9SJustin Hibbits int mem_rid; 420aeed3e9SJustin Hibbits int irq_rid; 430aeed3e9SJustin Hibbits int err_irq_rid; 443e7ddf02SJustin Hibbits int qman_chan_base; 453e7ddf02SJustin Hibbits int qman_chan_count; 460aeed3e9SJustin Hibbits 470aeed3e9SJustin Hibbits t_Handle fm_handle; 480aeed3e9SJustin Hibbits t_Handle muram_handle; 490aeed3e9SJustin Hibbits }; 500aeed3e9SJustin Hibbits 510aeed3e9SJustin Hibbits 520aeed3e9SJustin Hibbits /** 530aeed3e9SJustin Hibbits * @group QMan bus interface. 540aeed3e9SJustin Hibbits * @{ 550aeed3e9SJustin Hibbits */ 56a32b5435SJustin Hibbits struct resource * fman_alloc_resource(device_t bus, device_t child, int type, 57a32b5435SJustin Hibbits int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags); 58a32b5435SJustin Hibbits int fman_activate_resource(device_t bus, device_t child, 592baed46eSJohn Baldwin struct resource *res); 60*9dbf5b0eSJohn Baldwin int fman_release_resource(device_t bus, device_t child, struct resource *res); 610aeed3e9SJustin Hibbits int fman_attach(device_t dev); 620aeed3e9SJustin Hibbits int fman_detach(device_t dev); 630aeed3e9SJustin Hibbits int fman_suspend(device_t dev); 64852ba100SJustin Hibbits int fman_resume_dev(device_t dev); 650aeed3e9SJustin Hibbits int fman_shutdown(device_t dev); 660aeed3e9SJustin Hibbits int fman_read_ivar(device_t dev, device_t child, int index, 670aeed3e9SJustin Hibbits uintptr_t *result); 683e7ddf02SJustin Hibbits int fman_qman_channel_id(device_t, int); 690aeed3e9SJustin Hibbits /** @} */ 700aeed3e9SJustin Hibbits 710aeed3e9SJustin Hibbits uint32_t fman_get_clock(struct fman_softc *sc); 721c41f28fSJustin Hibbits int fman_get_handle(device_t dev, t_Handle *fmh); 731c41f28fSJustin Hibbits int fman_get_muram_handle(device_t dev, t_Handle *muramh); 741c41f28fSJustin Hibbits int fman_get_bushandle(device_t dev, vm_offset_t *fm_base); 750aeed3e9SJustin Hibbits 760aeed3e9SJustin Hibbits #endif /* FMAN_H_ */ 77