RE: [PATCH v3 6/9] bus: fsl-mc: dpio: add QBMan portal APIs for DPAA2
> -Original Message- > From: Laurentiu Tudor > Sent: Friday, December 02, 2016 6:40 AM > To: Stuart Yoder <stuart.yo...@nxp.com>; gre...@linuxfoundation.org > Cc: de...@driverdev.osuosl.org; linux-kernel@vger.kernel.org; ag...@suse.de; > a...@arndb.de; Leo Li > <leoyang...@nxp.com>; Ioana Ciornei <ioana.cior...@nxp.com>; Catalin Horghidan > <catalin.horghi...@nxp.com>; Ruxandra Ioana Radulescu > <ruxandra.radule...@nxp.com>; Roy Pledge > <roy.ple...@nxp.com>; Haiying Wang <haiying.w...@nxp.com> > Subject: Re: [PATCH v3 6/9] bus: fsl-mc: dpio: add QBMan portal APIs for DPAA2 > > On 12/02/2016 12:41 AM, Stuart Yoder wrote: > > From: Roy Pledge <roy.ple...@nxp.com> > > > > Add QBman APIs for frame queue and buffer pool operations. > > > > Signed-off-by: Roy Pledge <roy.ple...@nxp.com> > > Signed-off-by: Haiying Wang <haiying.w...@nxp.com> > > Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com> > > --- > > > > Notes: > > -v3 > >-replace hardcoded dequeue token with a #define and check that > > token when checking for a new result (bug fix suggested by > > Ioana Radulescu) > > -v2 > >-fix bug in buffer release command, by setting bpid field > >-handle error (NULL) return value from qbman_swp_mc_complete() > >-error message cleanup > >-fix bug in sending management commands where the verb was > > properly initialized > > > > drivers/bus/fsl-mc/dpio/Makefile |2 +- > > drivers/bus/fsl-mc/dpio/qbman-portal.c | 1028 > > > > drivers/bus/fsl-mc/dpio/qbman-portal.h | 464 ++ > > 3 files changed, 1493 insertions(+), 1 deletion(-) > > create mode 100644 drivers/bus/fsl-mc/dpio/qbman-portal.c > > create mode 100644 drivers/bus/fsl-mc/dpio/qbman-portal.h > > > > diff --git a/drivers/bus/fsl-mc/dpio/Makefile > > b/drivers/bus/fsl-mc/dpio/Makefile > > index 128befc..6588498 100644 > > --- a/drivers/bus/fsl-mc/dpio/Makefile > > +++ b/drivers/bus/fsl-mc/dpio/Makefile > > @@ -6,4 +6,4 @@ subdir-ccflags-y := -Werror > > > > obj-$(CONFIG_FSL_MC_DPIO) += fsl-mc-dpio.o > > > > -fsl-mc-dpio-objs := dpio.o > > +fsl-mc-dpio-objs := dpio.o qbman-portal.o > > diff --git a/drivers/bus/fsl-mc/dpio/qbman-portal.c > > b/drivers/bus/fsl-mc/dpio/qbman-portal.c > > new file mode 100644 > > index 000..bbc032c > > --- /dev/null > > +++ b/drivers/bus/fsl-mc/dpio/qbman-portal.c > > @@ -0,0 +1,1028 @@ > > +/* > > + * Copyright (C) 2014 Freescale Semiconductor, Inc. > > In previous patches the copyright years are 2014 - 2016. Maybe we should > do the same here too. > > > + * > > + * Redistribution and use in source and binary forms, with or without > > + * modification, are permitted provided that the following conditions are > > met: > > + * * Redistributions of source code must retain the above copyright > > + * notice, this list of conditions and the following disclaimer. > > + * * Redistributions in binary form must reproduce the above copyright > > + * notice, this list of conditions and the following disclaimer in > > the > > + * documentation and/or other materials provided with the > > distribution. > > + * * Neither the name of Freescale Semiconductor nor the > > + * names of its contributors may be used to endorse or promote > > products > > + * derived from this software without specific prior written > > permission. > > + * > > + * ALTERNATIVELY, this software may be distributed under the terms of the > > + * GNU General Public License ("GPL") as published by the Free Software > > + * Foundation, either version 2 of that License or (at your option) any > > + * later version. > > + * > > + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY > > + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > > IMPLIED > > + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE > > + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY > > + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > > DAMAGES > > + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR > > SERVICES; > > + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED > > AND > > + * ON ANY THEORY OF LIABILITY, WHETHER IN
RE: [PATCH v3 6/9] bus: fsl-mc: dpio: add QBMan portal APIs for DPAA2
> -Original Message- > From: Laurentiu Tudor > Sent: Friday, December 02, 2016 6:40 AM > To: Stuart Yoder ; gre...@linuxfoundation.org > Cc: de...@driverdev.osuosl.org; linux-kernel@vger.kernel.org; ag...@suse.de; > a...@arndb.de; Leo Li > ; Ioana Ciornei ; Catalin Horghidan > ; Ruxandra Ioana Radulescu > ; Roy Pledge > ; Haiying Wang > Subject: Re: [PATCH v3 6/9] bus: fsl-mc: dpio: add QBMan portal APIs for DPAA2 > > On 12/02/2016 12:41 AM, Stuart Yoder wrote: > > From: Roy Pledge > > > > Add QBman APIs for frame queue and buffer pool operations. > > > > Signed-off-by: Roy Pledge > > Signed-off-by: Haiying Wang > > Signed-off-by: Stuart Yoder > > --- > > > > Notes: > > -v3 > >-replace hardcoded dequeue token with a #define and check that > > token when checking for a new result (bug fix suggested by > > Ioana Radulescu) > > -v2 > >-fix bug in buffer release command, by setting bpid field > >-handle error (NULL) return value from qbman_swp_mc_complete() > >-error message cleanup > >-fix bug in sending management commands where the verb was > > properly initialized > > > > drivers/bus/fsl-mc/dpio/Makefile |2 +- > > drivers/bus/fsl-mc/dpio/qbman-portal.c | 1028 > > > > drivers/bus/fsl-mc/dpio/qbman-portal.h | 464 ++ > > 3 files changed, 1493 insertions(+), 1 deletion(-) > > create mode 100644 drivers/bus/fsl-mc/dpio/qbman-portal.c > > create mode 100644 drivers/bus/fsl-mc/dpio/qbman-portal.h > > > > diff --git a/drivers/bus/fsl-mc/dpio/Makefile > > b/drivers/bus/fsl-mc/dpio/Makefile > > index 128befc..6588498 100644 > > --- a/drivers/bus/fsl-mc/dpio/Makefile > > +++ b/drivers/bus/fsl-mc/dpio/Makefile > > @@ -6,4 +6,4 @@ subdir-ccflags-y := -Werror > > > > obj-$(CONFIG_FSL_MC_DPIO) += fsl-mc-dpio.o > > > > -fsl-mc-dpio-objs := dpio.o > > +fsl-mc-dpio-objs := dpio.o qbman-portal.o > > diff --git a/drivers/bus/fsl-mc/dpio/qbman-portal.c > > b/drivers/bus/fsl-mc/dpio/qbman-portal.c > > new file mode 100644 > > index 000..bbc032c > > --- /dev/null > > +++ b/drivers/bus/fsl-mc/dpio/qbman-portal.c > > @@ -0,0 +1,1028 @@ > > +/* > > + * Copyright (C) 2014 Freescale Semiconductor, Inc. > > In previous patches the copyright years are 2014 - 2016. Maybe we should > do the same here too. > > > + * > > + * Redistribution and use in source and binary forms, with or without > > + * modification, are permitted provided that the following conditions are > > met: > > + * * Redistributions of source code must retain the above copyright > > + * notice, this list of conditions and the following disclaimer. > > + * * Redistributions in binary form must reproduce the above copyright > > + * notice, this list of conditions and the following disclaimer in > > the > > + * documentation and/or other materials provided with the > > distribution. > > + * * Neither the name of Freescale Semiconductor nor the > > + * names of its contributors may be used to endorse or promote > > products > > + * derived from this software without specific prior written > > permission. > > + * > > + * ALTERNATIVELY, this software may be distributed under the terms of the > > + * GNU General Public License ("GPL") as published by the Free Software > > + * Foundation, either version 2 of that License or (at your option) any > > + * later version. > > + * > > + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY > > + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > > IMPLIED > > + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE > > + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY > > + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > > DAMAGES > > + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR > > SERVICES; > > + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED > > AND > > + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR > > TORT > > + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE > > OF THIS > > + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > > + */ > > +#include > > +#include > > +#include > >
Re: [PATCH v3 6/9] bus: fsl-mc: dpio: add QBMan portal APIs for DPAA2
On 12/02/2016 12:41 AM, Stuart Yoder wrote: > From: Roy Pledge> > Add QBman APIs for frame queue and buffer pool operations. > > Signed-off-by: Roy Pledge > Signed-off-by: Haiying Wang > Signed-off-by: Stuart Yoder > --- > > Notes: > -v3 >-replace hardcoded dequeue token with a #define and check that > token when checking for a new result (bug fix suggested by > Ioana Radulescu) > -v2 >-fix bug in buffer release command, by setting bpid field >-handle error (NULL) return value from qbman_swp_mc_complete() >-error message cleanup >-fix bug in sending management commands where the verb was > properly initialized > > drivers/bus/fsl-mc/dpio/Makefile |2 +- > drivers/bus/fsl-mc/dpio/qbman-portal.c | 1028 > > drivers/bus/fsl-mc/dpio/qbman-portal.h | 464 ++ > 3 files changed, 1493 insertions(+), 1 deletion(-) > create mode 100644 drivers/bus/fsl-mc/dpio/qbman-portal.c > create mode 100644 drivers/bus/fsl-mc/dpio/qbman-portal.h > > diff --git a/drivers/bus/fsl-mc/dpio/Makefile > b/drivers/bus/fsl-mc/dpio/Makefile > index 128befc..6588498 100644 > --- a/drivers/bus/fsl-mc/dpio/Makefile > +++ b/drivers/bus/fsl-mc/dpio/Makefile > @@ -6,4 +6,4 @@ subdir-ccflags-y := -Werror > > obj-$(CONFIG_FSL_MC_DPIO) += fsl-mc-dpio.o > > -fsl-mc-dpio-objs := dpio.o > +fsl-mc-dpio-objs := dpio.o qbman-portal.o > diff --git a/drivers/bus/fsl-mc/dpio/qbman-portal.c > b/drivers/bus/fsl-mc/dpio/qbman-portal.c > new file mode 100644 > index 000..bbc032c > --- /dev/null > +++ b/drivers/bus/fsl-mc/dpio/qbman-portal.c > @@ -0,0 +1,1028 @@ > +/* > + * Copyright (C) 2014 Freescale Semiconductor, Inc. In previous patches the copyright years are 2014 - 2016. Maybe we should do the same here too. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions are > met: > + * * Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * * Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in the > + * documentation and/or other materials provided with the distribution. > + * * Neither the name of Freescale Semiconductor nor the > + * names of its contributors may be used to endorse or promote products > + * derived from this software without specific prior written > permission. > + * > + * ALTERNATIVELY, this software may be distributed under the terms of the > + * GNU General Public License ("GPL") as published by the Free Software > + * Foundation, either version 2 of that License or (at your option) any > + * later version. > + * > + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY > + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED > + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE > + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY > + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES > + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR > SERVICES; > + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED > AND > + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT > + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF > THIS > + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > + */ > +#include > +#include > +#include > +#include > + > +#include "qbman-portal.h" > + > +#define QMAN_REV_4000 0x0400 > +#define QMAN_REV_4100 0x0401 > +#define QMAN_REV_4101 0x04010001 > + > +/* All QBMan command and result structures use this "valid bit" encoding */ > +#define QB_VALID_BIT ((u32)0x80) > + > +/* QBMan portal management command codes */ > +#define QBMAN_MC_ACQUIRE 0x30 > +#define QBMAN_WQCHAN_CONFIGURE 0x46 > + > +/* CINH register offsets */ > +#define QBMAN_CINH_SWP_EQAR0x8c0 > +#define QBMAN_CINH_SWP_DQPI0xa00 > +#define QBMAN_CINH_SWP_DCAP0xac0 > +#define QBMAN_CINH_SWP_SDQCR 0xb00 > +#define QBMAN_CINH_SWP_RAR 0xcc0 > +#define QBMAN_CINH_SWP_ISR 0xe00 > +#define QBMAN_CINH_SWP_IER 0xe40 > +#define QBMAN_CINH_SWP_ISDR0xe80 > +#define QBMAN_CINH_SWP_IIR 0xec0 > + > +/* CENA register offsets */ > +#define QBMAN_CENA_SWP_EQCR(n) (0x000 + ((u32)(n) << 6)) > +#define QBMAN_CENA_SWP_DQRR(n) (0x200 + ((u32)(n) << 6)) > +#define QBMAN_CENA_SWP_RCR(n) (0x400 + ((u32)(n) << 6)) > +#define QBMAN_CENA_SWP_CR 0x600 > +#define QBMAN_CENA_SWP_RR(vb) (0x700 + ((u32)(vb) >> 1)) > +#define QBMAN_CENA_SWP_VDQCR 0x780 > + > +/* Reverse
Re: [PATCH v3 6/9] bus: fsl-mc: dpio: add QBMan portal APIs for DPAA2
On 12/02/2016 12:41 AM, Stuart Yoder wrote: > From: Roy Pledge > > Add QBman APIs for frame queue and buffer pool operations. > > Signed-off-by: Roy Pledge > Signed-off-by: Haiying Wang > Signed-off-by: Stuart Yoder > --- > > Notes: > -v3 >-replace hardcoded dequeue token with a #define and check that > token when checking for a new result (bug fix suggested by > Ioana Radulescu) > -v2 >-fix bug in buffer release command, by setting bpid field >-handle error (NULL) return value from qbman_swp_mc_complete() >-error message cleanup >-fix bug in sending management commands where the verb was > properly initialized > > drivers/bus/fsl-mc/dpio/Makefile |2 +- > drivers/bus/fsl-mc/dpio/qbman-portal.c | 1028 > > drivers/bus/fsl-mc/dpio/qbman-portal.h | 464 ++ > 3 files changed, 1493 insertions(+), 1 deletion(-) > create mode 100644 drivers/bus/fsl-mc/dpio/qbman-portal.c > create mode 100644 drivers/bus/fsl-mc/dpio/qbman-portal.h > > diff --git a/drivers/bus/fsl-mc/dpio/Makefile > b/drivers/bus/fsl-mc/dpio/Makefile > index 128befc..6588498 100644 > --- a/drivers/bus/fsl-mc/dpio/Makefile > +++ b/drivers/bus/fsl-mc/dpio/Makefile > @@ -6,4 +6,4 @@ subdir-ccflags-y := -Werror > > obj-$(CONFIG_FSL_MC_DPIO) += fsl-mc-dpio.o > > -fsl-mc-dpio-objs := dpio.o > +fsl-mc-dpio-objs := dpio.o qbman-portal.o > diff --git a/drivers/bus/fsl-mc/dpio/qbman-portal.c > b/drivers/bus/fsl-mc/dpio/qbman-portal.c > new file mode 100644 > index 000..bbc032c > --- /dev/null > +++ b/drivers/bus/fsl-mc/dpio/qbman-portal.c > @@ -0,0 +1,1028 @@ > +/* > + * Copyright (C) 2014 Freescale Semiconductor, Inc. In previous patches the copyright years are 2014 - 2016. Maybe we should do the same here too. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions are > met: > + * * Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * * Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in the > + * documentation and/or other materials provided with the distribution. > + * * Neither the name of Freescale Semiconductor nor the > + * names of its contributors may be used to endorse or promote products > + * derived from this software without specific prior written > permission. > + * > + * ALTERNATIVELY, this software may be distributed under the terms of the > + * GNU General Public License ("GPL") as published by the Free Software > + * Foundation, either version 2 of that License or (at your option) any > + * later version. > + * > + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY > + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED > + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE > + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY > + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES > + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR > SERVICES; > + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED > AND > + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT > + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF > THIS > + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > + */ > +#include > +#include > +#include > +#include > + > +#include "qbman-portal.h" > + > +#define QMAN_REV_4000 0x0400 > +#define QMAN_REV_4100 0x0401 > +#define QMAN_REV_4101 0x04010001 > + > +/* All QBMan command and result structures use this "valid bit" encoding */ > +#define QB_VALID_BIT ((u32)0x80) > + > +/* QBMan portal management command codes */ > +#define QBMAN_MC_ACQUIRE 0x30 > +#define QBMAN_WQCHAN_CONFIGURE 0x46 > + > +/* CINH register offsets */ > +#define QBMAN_CINH_SWP_EQAR0x8c0 > +#define QBMAN_CINH_SWP_DQPI0xa00 > +#define QBMAN_CINH_SWP_DCAP0xac0 > +#define QBMAN_CINH_SWP_SDQCR 0xb00 > +#define QBMAN_CINH_SWP_RAR 0xcc0 > +#define QBMAN_CINH_SWP_ISR 0xe00 > +#define QBMAN_CINH_SWP_IER 0xe40 > +#define QBMAN_CINH_SWP_ISDR0xe80 > +#define QBMAN_CINH_SWP_IIR 0xec0 > + > +/* CENA register offsets */ > +#define QBMAN_CENA_SWP_EQCR(n) (0x000 + ((u32)(n) << 6)) > +#define QBMAN_CENA_SWP_DQRR(n) (0x200 + ((u32)(n) << 6)) > +#define QBMAN_CENA_SWP_RCR(n) (0x400 + ((u32)(n) << 6)) > +#define QBMAN_CENA_SWP_CR 0x600 > +#define QBMAN_CENA_SWP_RR(vb) (0x700 + ((u32)(vb) >> 1)) > +#define QBMAN_CENA_SWP_VDQCR 0x780 > + > +/* Reverse mapping of QBMAN_CENA_SWP_DQRR() */ > +#define QBMAN_IDX_FROM_DQRR(p) (((unsigned
[PATCH v3 6/9] bus: fsl-mc: dpio: add QBMan portal APIs for DPAA2
From: Roy PledgeAdd QBman APIs for frame queue and buffer pool operations. Signed-off-by: Roy Pledge Signed-off-by: Haiying Wang Signed-off-by: Stuart Yoder --- Notes: -v3 -replace hardcoded dequeue token with a #define and check that token when checking for a new result (bug fix suggested by Ioana Radulescu) -v2 -fix bug in buffer release command, by setting bpid field -handle error (NULL) return value from qbman_swp_mc_complete() -error message cleanup -fix bug in sending management commands where the verb was properly initialized drivers/bus/fsl-mc/dpio/Makefile |2 +- drivers/bus/fsl-mc/dpio/qbman-portal.c | 1028 drivers/bus/fsl-mc/dpio/qbman-portal.h | 464 ++ 3 files changed, 1493 insertions(+), 1 deletion(-) create mode 100644 drivers/bus/fsl-mc/dpio/qbman-portal.c create mode 100644 drivers/bus/fsl-mc/dpio/qbman-portal.h diff --git a/drivers/bus/fsl-mc/dpio/Makefile b/drivers/bus/fsl-mc/dpio/Makefile index 128befc..6588498 100644 --- a/drivers/bus/fsl-mc/dpio/Makefile +++ b/drivers/bus/fsl-mc/dpio/Makefile @@ -6,4 +6,4 @@ subdir-ccflags-y := -Werror obj-$(CONFIG_FSL_MC_DPIO) += fsl-mc-dpio.o -fsl-mc-dpio-objs := dpio.o +fsl-mc-dpio-objs := dpio.o qbman-portal.o diff --git a/drivers/bus/fsl-mc/dpio/qbman-portal.c b/drivers/bus/fsl-mc/dpio/qbman-portal.c new file mode 100644 index 000..bbc032c --- /dev/null +++ b/drivers/bus/fsl-mc/dpio/qbman-portal.c @@ -0,0 +1,1028 @@ +/* + * Copyright (C) 2014 Freescale Semiconductor, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License ("GPL") as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include + +#include "qbman-portal.h" + +#define QMAN_REV_4000 0x0400 +#define QMAN_REV_4100 0x0401 +#define QMAN_REV_4101 0x04010001 + +/* All QBMan command and result structures use this "valid bit" encoding */ +#define QB_VALID_BIT ((u32)0x80) + +/* QBMan portal management command codes */ +#define QBMAN_MC_ACQUIRE 0x30 +#define QBMAN_WQCHAN_CONFIGURE 0x46 + +/* CINH register offsets */ +#define QBMAN_CINH_SWP_EQAR0x8c0 +#define QBMAN_CINH_SWP_DQPI0xa00 +#define QBMAN_CINH_SWP_DCAP0xac0 +#define QBMAN_CINH_SWP_SDQCR 0xb00 +#define QBMAN_CINH_SWP_RAR 0xcc0 +#define QBMAN_CINH_SWP_ISR 0xe00 +#define QBMAN_CINH_SWP_IER 0xe40 +#define QBMAN_CINH_SWP_ISDR0xe80 +#define QBMAN_CINH_SWP_IIR 0xec0 + +/* CENA register offsets */ +#define QBMAN_CENA_SWP_EQCR(n) (0x000 + ((u32)(n) << 6)) +#define QBMAN_CENA_SWP_DQRR(n) (0x200 + ((u32)(n) << 6)) +#define QBMAN_CENA_SWP_RCR(n) (0x400 + ((u32)(n) << 6)) +#define QBMAN_CENA_SWP_CR 0x600 +#define QBMAN_CENA_SWP_RR(vb) (0x700 + ((u32)(vb) >> 1)) +#define QBMAN_CENA_SWP_VDQCR 0x780 + +/* Reverse mapping of QBMAN_CENA_SWP_DQRR() */ +#define QBMAN_IDX_FROM_DQRR(p) (((unsigned long)p & 0x1ff) >> 6) + +/* Define token used to determine if response written to memory is valid */ +#define QMAN_DQ_TOKEN_VALID 1 + +/* SDQCR attribute codes */ +#define QB_SDQCR_FC_SHIFT 29 +#define QB_SDQCR_FC_MASK0x1 +#define QB_SDQCR_DCT_SHIFT 24 +#define QB_SDQCR_DCT_MASK 0x3 +#define
[PATCH v3 6/9] bus: fsl-mc: dpio: add QBMan portal APIs for DPAA2
From: Roy Pledge Add QBman APIs for frame queue and buffer pool operations. Signed-off-by: Roy Pledge Signed-off-by: Haiying Wang Signed-off-by: Stuart Yoder --- Notes: -v3 -replace hardcoded dequeue token with a #define and check that token when checking for a new result (bug fix suggested by Ioana Radulescu) -v2 -fix bug in buffer release command, by setting bpid field -handle error (NULL) return value from qbman_swp_mc_complete() -error message cleanup -fix bug in sending management commands where the verb was properly initialized drivers/bus/fsl-mc/dpio/Makefile |2 +- drivers/bus/fsl-mc/dpio/qbman-portal.c | 1028 drivers/bus/fsl-mc/dpio/qbman-portal.h | 464 ++ 3 files changed, 1493 insertions(+), 1 deletion(-) create mode 100644 drivers/bus/fsl-mc/dpio/qbman-portal.c create mode 100644 drivers/bus/fsl-mc/dpio/qbman-portal.h diff --git a/drivers/bus/fsl-mc/dpio/Makefile b/drivers/bus/fsl-mc/dpio/Makefile index 128befc..6588498 100644 --- a/drivers/bus/fsl-mc/dpio/Makefile +++ b/drivers/bus/fsl-mc/dpio/Makefile @@ -6,4 +6,4 @@ subdir-ccflags-y := -Werror obj-$(CONFIG_FSL_MC_DPIO) += fsl-mc-dpio.o -fsl-mc-dpio-objs := dpio.o +fsl-mc-dpio-objs := dpio.o qbman-portal.o diff --git a/drivers/bus/fsl-mc/dpio/qbman-portal.c b/drivers/bus/fsl-mc/dpio/qbman-portal.c new file mode 100644 index 000..bbc032c --- /dev/null +++ b/drivers/bus/fsl-mc/dpio/qbman-portal.c @@ -0,0 +1,1028 @@ +/* + * Copyright (C) 2014 Freescale Semiconductor, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License ("GPL") as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include + +#include "qbman-portal.h" + +#define QMAN_REV_4000 0x0400 +#define QMAN_REV_4100 0x0401 +#define QMAN_REV_4101 0x04010001 + +/* All QBMan command and result structures use this "valid bit" encoding */ +#define QB_VALID_BIT ((u32)0x80) + +/* QBMan portal management command codes */ +#define QBMAN_MC_ACQUIRE 0x30 +#define QBMAN_WQCHAN_CONFIGURE 0x46 + +/* CINH register offsets */ +#define QBMAN_CINH_SWP_EQAR0x8c0 +#define QBMAN_CINH_SWP_DQPI0xa00 +#define QBMAN_CINH_SWP_DCAP0xac0 +#define QBMAN_CINH_SWP_SDQCR 0xb00 +#define QBMAN_CINH_SWP_RAR 0xcc0 +#define QBMAN_CINH_SWP_ISR 0xe00 +#define QBMAN_CINH_SWP_IER 0xe40 +#define QBMAN_CINH_SWP_ISDR0xe80 +#define QBMAN_CINH_SWP_IIR 0xec0 + +/* CENA register offsets */ +#define QBMAN_CENA_SWP_EQCR(n) (0x000 + ((u32)(n) << 6)) +#define QBMAN_CENA_SWP_DQRR(n) (0x200 + ((u32)(n) << 6)) +#define QBMAN_CENA_SWP_RCR(n) (0x400 + ((u32)(n) << 6)) +#define QBMAN_CENA_SWP_CR 0x600 +#define QBMAN_CENA_SWP_RR(vb) (0x700 + ((u32)(vb) >> 1)) +#define QBMAN_CENA_SWP_VDQCR 0x780 + +/* Reverse mapping of QBMAN_CENA_SWP_DQRR() */ +#define QBMAN_IDX_FROM_DQRR(p) (((unsigned long)p & 0x1ff) >> 6) + +/* Define token used to determine if response written to memory is valid */ +#define QMAN_DQ_TOKEN_VALID 1 + +/* SDQCR attribute codes */ +#define QB_SDQCR_FC_SHIFT 29 +#define QB_SDQCR_FC_MASK0x1 +#define QB_SDQCR_DCT_SHIFT 24 +#define QB_SDQCR_DCT_MASK 0x3 +#define QB_SDQCR_SRC_SHIFT 0 +#define QB_SDQCR_SRC_MASK 0xff + +enum qbman_sdqcr_dct { +