Back to home page

OSCL-LXR

 
 

    


0001 /* Copyright 2008 - 2016 Freescale Semiconductor, Inc.
0002  *
0003  * Redistribution and use in source and binary forms, with or without
0004  * modification, are permitted provided that the following conditions are met:
0005  *     * Redistributions of source code must retain the above copyright
0006  *   notice, this list of conditions and the following disclaimer.
0007  *     * Redistributions in binary form must reproduce the above copyright
0008  *   notice, this list of conditions and the following disclaimer in the
0009  *   documentation and/or other materials provided with the distribution.
0010  *     * Neither the name of Freescale Semiconductor nor the
0011  *   names of its contributors may be used to endorse or promote products
0012  *   derived from this software without specific prior written permission.
0013  *
0014  * ALTERNATIVELY, this software may be distributed under the terms of the
0015  * GNU General Public License ("GPL") as published by the Free Software
0016  * Foundation, either version 2 of that License or (at your option) any
0017  * later version.
0018  *
0019  * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
0020  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
0021  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
0022  * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
0023  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
0024  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
0025  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
0026  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0027  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
0028  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0029  */
0030 
0031 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
0032 
0033 #include "dpaa_sys.h"
0034 
0035 #include <soc/fsl/bman.h>
0036 
0037 /* Portal processing (interrupt) sources */
0038 #define BM_PIRQ_RCRI    0x00000002  /* RCR Ring (below threshold) */
0039 
0040 /* Revision info (for errata and feature handling) */
0041 #define BMAN_REV10 0x0100
0042 #define BMAN_REV20 0x0200
0043 #define BMAN_REV21 0x0201
0044 extern u16 bman_ip_rev; /* 0 if uninitialised, otherwise BMAN_REVx */
0045 
0046 extern struct gen_pool *bm_bpalloc;
0047 
0048 struct bm_portal_config {
0049     /* Portal addresses */
0050     void  *addr_virt_ce;
0051     void __iomem *addr_virt_ci;
0052     /* Allow these to be joined in lists */
0053     struct list_head list;
0054     struct device *dev;
0055     /* User-visible portal configuration settings */
0056     /* portal is affined to this cpu */
0057     int cpu;
0058     /* portal interrupt line */
0059     int irq;
0060 };
0061 
0062 struct bman_portal *bman_create_affine_portal(
0063             const struct bm_portal_config *config);
0064 /*
0065  * The below bman_p_***() variant might be called in a situation that the cpu
0066  * which the portal affine to is not online yet.
0067  * @bman_portal specifies which portal the API will use.
0068  */
0069 int bman_p_irqsource_add(struct bman_portal *p, u32 bits);
0070 
0071 /*
0072  * Used by all portal interrupt registers except 'inhibit'
0073  * This mask contains all the "irqsource" bits visible to API users
0074  */
0075 #define BM_PIRQ_VISIBLE BM_PIRQ_RCRI
0076 
0077 const struct bm_portal_config *
0078 bman_get_bm_portal_config(const struct bman_portal *portal);
0079 
0080 int bman_requires_cleanup(void);
0081 void bman_done_cleanup(void);
0082 
0083 int bm_shutdown_pool(u32 bpid);