> -Original Message-
> From: Stuart Yoder
> Sent: Thursday, November 03, 2016 4:38 PM
> To: Ruxandra Ioana Radulescu
> Subject: FW: [PATCH 8/9] bus: fsl-mc: dpio: add the DPAA2 DPIO object
> driver
>
>
>
> -Original Message-
> From: Stuart Yoder [mailto:stuart.yo...@nxp.com]
> Sent: Friday, October 21, 2016 9:02 AM
> To: gre...@linuxfoundation.org
> Cc: German Rivera ; de...@driverdev.osuosl.org;
> linux-ker...@vger.kernel.org; ag...@suse.de; a...@arndb.de; Leo Li
> ; Roy Pledge ; Haiying Wang
> ; Stuart Yoder
> Subject: [PATCH 8/9] bus: fsl-mc: dpio: add the DPAA2 DPIO object driver
>
> From: Roy Pledge
>
> The DPIO driver registers with the fsl-mc bus to handle bus-related
> events for DPIO objects. Key responsibility is mapping I/O
> regions, setting up interrupt handlers, and calling the DPIO
> service initialization during probe.
>
> Signed-off-by: Roy Pledge
> Signed-off-by: Haiying Wang
> Signed-off-by: Stuart Yoder
> ---
> drivers/bus/fsl-mc/dpio/Makefile | 2 +-
> drivers/bus/fsl-mc/dpio/dpio-driver.c | 289
> ++
> 2 files changed, 290 insertions(+), 1 deletion(-)
> create mode 100644 drivers/bus/fsl-mc/dpio/dpio-driver.c
>
> diff --git a/drivers/bus/fsl-mc/dpio/Makefile b/drivers/bus/fsl-
> mc/dpio/Makefile
> index 0778da7..837d330 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 qbman-portal.o dpio-service.o
> +fsl-mc-dpio-objs := dpio.o qbman-portal.o dpio-service.o dpio-driver.o
> diff --git a/drivers/bus/fsl-mc/dpio/dpio-driver.c b/drivers/bus/fsl-
> mc/dpio/dpio-driver.c
> new file mode 100644
> index 000..ad04a2c
> --- /dev/null
> +++ b/drivers/bus/fsl-mc/dpio/dpio-driver.c
> @@ -0,0 +1,289 @@
> +/*
> + * Copyright 2014-2016 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
> +#include
> +#include
> +#include
> +
> +#include
> +#include
> +
> +#include "qbman-portal.h"
> +#include "dpio.h"
> +#include "dpio-cmd.h"
> +
> +MODULE_LICENSE("Dual BSD/GPL");
> +MODULE_AUTHOR("Freescale Semiconductor, Inc");
> +MODULE_DESCRIPTION("DPIO Driver");
> +
> +struct dpio_priv {
> + struct dpaa2_io *io;
> +};
> +
> +static irqreturn_t dpio_irq_handler(int irq_num, void *arg)
> +{
> + struct device *dev = (struct device *)arg;
> + struct dpio_priv *priv = dev_get_drvdata(dev);
> +
> + return dpaa2_io_irq(priv->io);
> +}
> +
> +static void unregister_dpio_irq_handlers(struct fsl_mc_device *dpio_dev)
> +{
> + struct fsl_mc_device_irq *irq;
> +
> + irq = dpio_dev->irqs[0];
> +
> + /* clear the affinity hint */
> + irq_set_affinity_hint(irq->msi_desc->irq, NULL);
> +}
> +
> +static int register_dpio_irq_handlers(struct fsl_mc_device *dpio_dev, int
> cpu)
> +{
> + struct dpio_priv *priv;
> + int error;
> + struct fsl_mc_device_irq *irq;
> + cpumask_t mask;
> +
> + priv = dev_get_drvdata(&dpio_dev->dev);
> +
> + irq = dpio_dev->irqs[0];
> + error = devm_req