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 * $FreeBSD$ 270aeed3e9SJustin Hibbits */ 280aeed3e9SJustin Hibbits 290aeed3e9SJustin Hibbits #ifndef FMAN_H_ 300aeed3e9SJustin Hibbits #define FMAN_H_ 310aeed3e9SJustin Hibbits 3247cabd04SJustin Hibbits #include <dev/fdt/simplebus.h> 3347cabd04SJustin Hibbits 340aeed3e9SJustin Hibbits /** 350aeed3e9SJustin Hibbits * FMan driver instance data. 360aeed3e9SJustin Hibbits */ 370aeed3e9SJustin Hibbits struct fman_softc { 3847cabd04SJustin Hibbits struct simplebus_softc sc_base; 390aeed3e9SJustin Hibbits struct resource *mem_res; 400aeed3e9SJustin Hibbits struct resource *irq_res; 410aeed3e9SJustin Hibbits struct resource *err_irq_res; 42a32b5435SJustin Hibbits struct rman rman; 430aeed3e9SJustin Hibbits int mem_rid; 440aeed3e9SJustin Hibbits int irq_rid; 450aeed3e9SJustin Hibbits int err_irq_rid; 463e7ddf02SJustin Hibbits int qman_chan_base; 473e7ddf02SJustin Hibbits int qman_chan_count; 480aeed3e9SJustin Hibbits 490aeed3e9SJustin Hibbits t_Handle fm_handle; 500aeed3e9SJustin Hibbits t_Handle muram_handle; 510aeed3e9SJustin Hibbits }; 520aeed3e9SJustin Hibbits 530aeed3e9SJustin Hibbits 540aeed3e9SJustin Hibbits /** 550aeed3e9SJustin Hibbits * @group QMan bus interface. 560aeed3e9SJustin Hibbits * @{ 570aeed3e9SJustin Hibbits */ 58a32b5435SJustin Hibbits struct resource * fman_alloc_resource(device_t bus, device_t child, int type, 59a32b5435SJustin Hibbits int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags); 60a32b5435SJustin Hibbits int fman_activate_resource(device_t bus, device_t child, 61a32b5435SJustin Hibbits int type, int rid, struct resource *res); 62a32b5435SJustin Hibbits int fman_release_resource(device_t bus, device_t child, int type, int rid, 63a32b5435SJustin Hibbits struct resource *res); 640aeed3e9SJustin Hibbits int fman_attach(device_t dev); 650aeed3e9SJustin Hibbits int fman_detach(device_t dev); 660aeed3e9SJustin Hibbits int fman_suspend(device_t dev); 67852ba100SJustin Hibbits int fman_resume_dev(device_t dev); 680aeed3e9SJustin Hibbits int fman_shutdown(device_t dev); 690aeed3e9SJustin Hibbits int fman_read_ivar(device_t dev, device_t child, int index, 700aeed3e9SJustin Hibbits uintptr_t *result); 713e7ddf02SJustin Hibbits int fman_qman_channel_id(device_t, int); 720aeed3e9SJustin Hibbits /** @} */ 730aeed3e9SJustin Hibbits 740aeed3e9SJustin Hibbits uint32_t fman_get_clock(struct fman_softc *sc); 75*1c41f28fSJustin Hibbits int fman_get_handle(device_t dev, t_Handle *fmh); 76*1c41f28fSJustin Hibbits int fman_get_muram_handle(device_t dev, t_Handle *muramh); 77*1c41f28fSJustin Hibbits int fman_get_bushandle(device_t dev, vm_offset_t *fm_base); 780aeed3e9SJustin Hibbits 790aeed3e9SJustin Hibbits #endif /* FMAN_H_ */ 80