summaryrefslogtreecommitdiff
path: root/include/linux/fsl_usdpaa.h
diff options
context:
space:
mode:
authorGeoff Thorpe <Geoff.Thorpe@freescale.com>2013-03-13 09:08:11 (GMT)
committerEmil Medve <Emilian.Medve@Freescale.com>2013-04-02 09:42:37 (GMT)
commit482a4d07104c4bfabef653eb623aa4c7c307459a (patch)
treec476478533031a47286aba44740b463e33dd1c8c /include/linux/fsl_usdpaa.h
parentd93266bf318e2effc39ac6cd786731bede5ef931 (diff)
downloadlinux-fsl-qoriq-482a4d07104c4bfabef653eb623aa4c7c307459a.tar.xz
fsl_qbman: Add drivers for the Freescale DPAA Q/BMan
Signed-off-by: Geoff Thorpe <Geoff.Thorpe@freescale.com> Signed-off-by: Bharat Bhushan <Bharat.Bhushan@freescale.com> Signed-off-by: Bogdan Hamciuc <bogdan.hamciuc@freescale.com> Signed-off-by: Hai-Ying Wang <Haiying.Wang@freescale.com> Signed-off-by: Jeffrey Ladouceur <jeffrey.ladouceur@freescale.com> Signed-off-by: Jia-Fei Pan <Jiafei.Pan@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org> Signed-off-by: Priyanka Jain <Priyanka.Jain@freescale.com> Signed-off-by: Vakul Garg <vakul@freescale.com> Signed-off-by: Emil Medve <Emilian.Medve@Freescale.com>
Diffstat (limited to 'include/linux/fsl_usdpaa.h')
-rw-r--r--include/linux/fsl_usdpaa.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/include/linux/fsl_usdpaa.h b/include/linux/fsl_usdpaa.h
new file mode 100644
index 0000000..0d2ed54
--- /dev/null
+++ b/include/linux/fsl_usdpaa.h
@@ -0,0 +1,53 @@
+/* Copyright 2011-2012 Freescale Semiconductor, Inc.
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2. This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+#ifndef FSL_USDPAA_H
+#define FSL_USDPAA_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __KERNEL__
+/* This interface is needed in a few places and though it's not specific to
+ * USDPAA as such, creating a new header for it doesn't make any sense. The
+ * qbman kernel driver implements this interface and uses it as the backend for
+ * both the FQID and BPID allocators.
+ */
+struct dpa_alloc {
+ struct list_head list;
+ spinlock_t lock;
+};
+#define DECLARE_DPA_ALLOC(name) \
+ struct dpa_alloc name = { \
+ .list = { \
+ .prev = &name.list, \
+ .next = &name.list \
+ }, \
+ .lock = __SPIN_LOCK_UNLOCKED(name.lock) \
+ }
+static inline void dpa_alloc_init(struct dpa_alloc *alloc)
+{
+ INIT_LIST_HEAD(&alloc->list);
+ spin_lock_init(&alloc->lock);
+}
+int dpa_alloc_new(struct dpa_alloc *alloc, u32 *result, u32 count, u32 align,
+ int partial);
+void dpa_alloc_free(struct dpa_alloc *alloc, u32 base_id, u32 count);
+/* Like 'new' but specifies the desired range, returns -ENOMEM if the entire
+ * desired range is not available, or 0 for success. */
+int dpa_alloc_reserve(struct dpa_alloc *alloc, u32 base_id, u32 count);
+/* Pops and returns contiguous ranges from the allocator. Returns -ENOMEM when
+ * 'alloc' is empty. */
+int dpa_alloc_pop(struct dpa_alloc *alloc, u32 *result, u32 *count);
+#endif /* __KERNEL__ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* FSL_USDPAA_H */