Re: [PATCH 3/3][v4] staging: fsl-mc: move bus driver out of staging

2017-05-19 Thread Stuart Yoder
On Fri, May 19, 2017 at 8:41 AM, Matthias Brugger
<matthias@gmail.com> wrote:
>
>
> On 19/05/17 15:13, laurentiu.tu...@nxp.com wrote:
>>
>> From: Stuart Yoder <stuart.yo...@nxp.com>
>>
>> Move the source files out of staging into their final locations:
>>-include files in drivers/staging/fsl-mc/include go to
>> include/linux/fsl
>>-irq-gic-v3-its-fsl-mc-msi.c goes to drivers/irqchip
>
>
> This driver has as compatible "arm,gic-v3-its". I wonder if this is correct
> and if it should be moved like this out of staging.

Matthias, can you be more specific as to what your concern is?

The fsl-mc bus needs to implement bus specific gic-v3 MSI support just
like the other
bus types.  See:
   drivers/irqchip/irq-gic-v3-its-pci-msi.c
   drivers/irqchip/irq-gic-v3-its-platform-msi.c

You will see that the PCI and platform bus types also find the gic-v3 node by
compatible string.

The bus specific gic-v3 support for fsl-mc is implemented in a
completely standard way.

Thanks,
Stuart
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: fsl-mc/dpio: add cpu <--> LE conversion for dpaa2_fd

2017-04-29 Thread Stuart Yoder
On Fri, Apr 28, 2017 at 9:38 AM, Horia Geantă  wrote:
>
> While dpaa2_fd.simple structure fields are marked __leXX,
> corresponding cpu_to_leXX / leXX_to_cpu conversions are missing.
>
> While here, fix dpaa2_fd_{get,set}_bpid such that BMT, IVP bits
> sharing the 16-bit field with BPID are not affected.

Please split this into 2 separate patches.  Don't fix other misc things "while
you are at it" in the same patch.

Thanks,
Stuart
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] bus: fsl-mc: dpio: fix alter FQ state command

2017-04-21 Thread Stuart Yoder
On Fri, Apr 21, 2017 at 7:00 AM, Horia Geantă  wrote:
>
> When checking the response verb, the valid bit should be masked out,
> since its value flips depending on what Response Register
> (RR0 /RR1) it's been read from.
>
> Fixes: 321eecb06bfb ("bus: fsl-mc: dpio: add QBMan portal APIs for DPAA2")
> Signed-off-by: Horia Geantă 
> ---
>  drivers/staging/fsl-mc/bus/dpio/qbman-portal.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/fsl-mc/bus/dpio/qbman-portal.c 
> b/drivers/staging/fsl-mc/bus/dpio/qbman-portal.c
> index 2a3ea29d9b43..5d020fb98c66 100644
> --- a/drivers/staging/fsl-mc/bus/dpio/qbman-portal.c
> +++ b/drivers/staging/fsl-mc/bus/dpio/qbman-portal.c
> @@ -963,7 +963,7 @@ int qbman_swp_alt_fq_state(struct qbman_swp *s, u32 fqid,
> }
>
> /* Decode the outcome */
> -   WARN_ON(r->verb != alt_fq_verb);
> +   WARN_ON((r->verb & 0x7f) != alt_fq_verb);

Don't use magic constants like that.  Create a #define for the valid bit.

Thanks,
Stuart
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 8/9] staging: fsl-dpaa2/eth: Add TODO file

2017-04-18 Thread Stuart Yoder
On Wed, Apr 12, 2017 at 11:25 AM, Ioana Radulescu
 wrote:
> Add a list of TODO items for the Ethernet driver
>
> Signed-off-by: Ioana Radulescu 
> ---
> v2: Add note
>
>  drivers/staging/fsl-dpaa2/ethernet/TODO | 14 ++
>  1 file changed, 14 insertions(+)
>  create mode 100644 drivers/staging/fsl-dpaa2/ethernet/TODO
>
> diff --git a/drivers/staging/fsl-dpaa2/ethernet/TODO 
> b/drivers/staging/fsl-dpaa2/ethernet/TODO
> new file mode 100644
> index ..110e66d44b42
> --- /dev/null
> +++ b/drivers/staging/fsl-dpaa2/ethernet/TODO
> @@ -0,0 +1,14 @@
> +* Add a DPAA2 MAC kernel driver in order to allow PHY management; currently
> +  the DPMAC objects and their link to DPNIs are handled by MC internally
> +  and all PHYs are seen as fixed-link
> +* add more debug support: decide how to expose detailed debug statistics,
> +  add ingress error queue support
> +* MC firmware uprev; the DPAA2 objects used by the Ethernet driver need to
> +  be kept in sync with binary interface changes in MC
> +* refine README file
> +* cleanup
> +
> +NOTE: None of the above is must-have before getting the DPAA2 Ethernet driver
> +out of staging. The main requirement for that is to have the drivers it
> +depends on, fsl-mc bus and DPIO driver, moved to drivers/bus and drivers/soc
> +respectively.

The TODO file should have contact info (I think)...look at other
drivers/staging TODO
for examples.

Stuart
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [v6 0/8] staging: fsl-mc: add dpio driver

2017-03-13 Thread Stuart Yoder
>
> This patch series adds the driver for the DPIO object which is a step
> to addressing the final item in the staging TODO list-- adding a
> functional driver on top of the bus driver.  The DPIO driver is a
> dependency for other functional drivers such as Ethernet.
>
> An overview of the DPIO object and driver components are in patch 1.
> Patches 2-6 are internal components of the DPIO driver-- bit twiddling
> of hardware registers, DPAA2 data structures, and the queuing APIs
> exposed to other drivers.
>
> Patch 7 adds the fsl-mc driver for the DPIO object.  It provides the
> probe/remove functions, demonstrating a working example of how fsl-mc
> drivers initialize, interact with the management complex hardware, map
> their mappable MMIO regions, initialize interrupts, register an ISR,
> etc.  All other DPAA2 drivers will follow a similar initialization
> pattern.
>
> version 6 changes
>-fixed error in size of SG_SHORT_LEN_MASK
>-removed improper padding in DPIO command responses
>-fixed some minor checkpatch warnings

Roy, when you re-spin this series please add information below the "---"
on each patch that changed identifying what changed in the patch.   For
example, be specific about which patches were affected by checkpatch and
what fixes you made.  Right now I can't tell.
For an example, of what I'm talking about look at previous versions of
this patch series.

Thanks,
Stuart
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: fsl-mc: update MAINTAINERS

2017-02-09 Thread Stuart Yoder
Add Laurentiu Tudor as a second maintainer and update Stuart Yoder's
email address.

Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
---
 MAINTAINERS | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index c2395ea..6050912 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10177,7 +10177,8 @@ F:  include/uapi/linux/qnx4_fs.h
 F: include/uapi/linux/qnxtypes.h
 
 QORIQ DPAA2 FSL-MC BUS DRIVER
-M: Stuart Yoder <stuart.yo...@nxp.com>
+M: Stuart Yoder <stuyo...@gmail.com>
+M: Laurentiu Tudor <laurentiu.tu...@nxp.com>
 L: linux-ker...@vger.kernel.org
 S: Maintained
 F: drivers/staging/fsl-mc/
-- 
1.9.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH v3 00/10] staging: fsl-mc: fixes and cleanups

2017-02-08 Thread Stuart Yoder


> -Original Message-
> From: laurentiu.tu...@nxp.com [mailto:laurentiu.tu...@nxp.com]
> Sent: Tuesday, February 07, 2017 9:44 AM
> To: gre...@linuxfoundation.org
> Cc: de...@driverdev.osuosl.org; linux-ker...@vger.kernel.org; ag...@suse.de; 
> a...@arndb.de; Ioana
> Ciornei <ioana.cior...@nxp.com>; Ruxandra Ioana Radulescu 
> <ruxandra.radule...@nxp.com>; Bharat Bhushan
> <bharat.bhus...@nxp.com>; Stuart Yoder <stuart.yo...@nxp.com>; Catalin 
> Horghidan
> <catalin.horghi...@nxp.com>; Leo Li <leoyang...@nxp.com>; Roy Pledge 
> <roy.ple...@nxp.com>; linux-arm-
> ker...@lists.infradead.org; Laurentiu Tudor <laurentiu.tu...@nxp.com>
> Subject: [PATCH v3 00/10] staging: fsl-mc: fixes and cleanups
> 
> From: Laurentiu Tudor <laurentiu.tu...@nxp.com>
> 
> First 4 patches fix several driver model related
> issues and drop an useless atomic global.
> The rest of the patches are cleanups mostly
> consisting in removing dead code.
> 
> Only patch 3, 4, 5 and 10 changed. See individual patch notes for
> details.
> 
> Laurentiu Tudor (10):
>   staging: fsl-mc: drop root dprc counting
>   staging: fsl-mc: fix device ref counting
>   staging: fsl-mc: add device release callback
>   staging: fsl-mc: don't use devres api for refcounted objects
>   staging: fsl-mc: remove slab cache for mc devices
>   staging: fsl-mc: dpmcp: drop unused APIs
>   staging: fsl-mc: dpmng: drop unused prototype
>   staging: fsl-mc: dpbp: drop unused APIs
>   staging: fsl-mc: dpbp: add a few missing EXPORT_SYMBOL()s
>   staging: fsl-mc: dprc: drop unused APIs

For the series:

Acked-by: Stuart Yoder <stuart.yo...@nxp.com>


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH 00/10][v2] staging: fsl-mc: fixes and cleanups

2017-02-07 Thread Stuart Yoder


> -Original Message-
> From: laurentiu.tu...@nxp.com [mailto:laurentiu.tu...@nxp.com]
> Sent: Tuesday, February 07, 2017 8:15 AM
> To: gre...@linuxfoundation.org
> Cc: de...@driverdev.osuosl.org; linux-ker...@vger.kernel.org; ag...@suse.de; 
> a...@arndb.de; Ioana
> Ciornei <ioana.cior...@nxp.com>; Ruxandra Ioana Radulescu 
> <ruxandra.radule...@nxp.com>; Bharat Bhushan
> <bharat.bhus...@nxp.com>; Stuart Yoder <stuart.yo...@nxp.com>; Catalin 
> Horghidan
> <catalin.horghi...@nxp.com>; Leo Li <leoyang...@nxp.com>; Roy Pledge 
> <roy.ple...@nxp.com>; linux-arm-
> ker...@lists.infradead.org; Laurentiu Tudor <laurentiu.tu...@nxp.com>
> Subject: [PATCH 00/10][v2] staging: fsl-mc: fixes and cleanups
> 
> From: Laurentiu Tudor <laurentiu.tu...@nxp.com>
> 
> First 4 patches fix several driver model related
> issues and drop an useless atomic global.
> The rest of the patches are cleanups mostly
> consisting in removing dead code.
> 
> v2:
>  - split slab cache removal in distinct patch
>  - redundant deallocation dropped in patch that adds release callback

Laurentiu,

A few nits about this submission:

-every patch in the series should have had "v2" in the patch
 subject.  In your submission only the cover letter had it.
 Without that it's harder to keep track of which version of
 patch I'm looking at.  Just use this when formatting your
 patches:
 --patch-subject="PATCH v2"

-for each patch, you should note below the "---" what changed in the
 patch, and if there were no changes you put "no changes".  For
 an example see:
 https://patchwork.kernel.org/patch/9478093/

 (You can use "git notes" to manage the below the "---" comments
  if it helps)

Can you reformat this series with "v3" and add the the comments
to note what did not change and what did change?

Thanks,
Stuart

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH 9/9] staging: fsl-mc: dprc: drop unused APIs

2017-02-02 Thread Stuart Yoder
> --- a/drivers/staging/fsl-mc/include/dprc.h
> +++ b/drivers/staging/fsl-mc/include/dprc.h
> @@ -42,20 +42,6 @@
> 
>  struct fsl_mc_io;
> 
> -/**
> - * Set this value as the icid value in dprc_cfg structure when creating a
> - * container, in case the ICID is not selected by the user and should be
> - * allocated by the DPRC from the pool of ICIDs.
> - */
> -#define DPRC_GET_ICID_FROM_POOL  (u16)(~(0))
> -
> -/**
> - * Set this value as the portal_id value in dprc_cfg structure when creating 
> a
> - * container, in case the portal ID is not specifically selected by the
> - * user and should be allocated by the DPRC from the pool of portal ids.
> - */
> -#define DPRC_GET_PORTAL_ID_FROM_POOL (int)(~(0))
> -
>  int dprc_open(struct fsl_mc_io *mc_io,
> u32 cmd_flags,
> int container_id,
> @@ -65,79 +51,6 @@ int dprc_close(struct fsl_mc_io *mc_io,
>  u32 cmd_flags,
>  u16 token);
> 
> -/**
> - * Container general options
> - *
> - * These options may be selected at container creation by the container 
> creator
> - * and can be retrieved using dprc_get_attributes()
> - */
> -
> -/*
> - * Spawn Policy Option allowed - Indicates that the new container is allowed
> - * to spawn and have its own child containers.
> - */
> -#define DPRC_CFG_OPT_SPAWN_ALLOWED   0x0001
> -
> -/*
> - * General Container allocation policy - Indicates that the new container is
> - * allowed to allocate requested resources from its parent container; if not
> - * set, the container is only allowed to use resources in its own pools; Note
> - * that this is a container's global policy, but the parent container may
> - * override it and set specific quota per resource type.
> - */
> -#define DPRC_CFG_OPT_ALLOC_ALLOWED   0x0002
> -
> -/*
> - * Object initialization allowed - software context associated with this
> - * container is allowed to invoke object initialization operations.
> - */
> -#define DPRC_CFG_OPT_OBJ_CREATE_ALLOWED  0x0004
> -
> -/*
> - * Topology change allowed - software context associated with this
> - * container is allowed to invoke topology operations, such as attach/detach
> - * of network objects.
> - */
> -#define DPRC_CFG_OPT_TOPOLOGY_CHANGES_ALLOWED0x0008
> -
> -/* AIOP - Indicates that container belongs to AIOP.  */
> -#define DPRC_CFG_OPT_AIOP0x0020
> -
> -/* IRQ Config - Indicates that the container allowed to configure its IRQs.  
> */
> -#define DPRC_CFG_OPT_IRQ_CFG_ALLOWED 0x0040
> -
> -/**
> - * struct dprc_cfg - Container configuration options
> - * @icid: Container's ICID; if set to 'DPRC_GET_ICID_FROM_POOL', a free
> - *   ICID value is allocated by the DPRC
> - * @portal_id: Portal ID; if set to 'DPRC_GET_PORTAL_ID_FROM_POOL', a free
> - *   portal ID is allocated by the DPRC
> - * @options: Combination of 'DPRC_CFG_OPT_' options
> - * @label: Object's label
> - */
> -struct dprc_cfg {
> - u16 icid;
> - int portal_id;
> - u64 options;
> - char label[16];
> -};
> -
> -int dprc_create_container(struct fsl_mc_io *mc_io,
> -   u32 cmd_flags,
> -   u16 token,
> -   struct dprc_cfg *cfg,
> -   int *child_container_id,
> -   u64 *child_portal_offset);
> -
> -int dprc_destroy_container(struct fsl_mc_io *mc_io,
> -u32 cmd_flags,
> -u16 token,
> -int child_container_id);
> -
> -int dprc_reset_container(struct fsl_mc_io *mc_io,
> -  u32 cmd_flags,
> -  u16 token,
> -  int child_container_id);
> 
>  /* IRQ */
> 
> @@ -233,6 +146,7 @@ int dprc_clear_irq_status(struct fsl_mc_io *mc_io,
> u8 irq_index,
> u32 status);
> 
> +

Extra, uneeded newline added above.

Stuart
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH 4/9] staging: fsl-mc: don't use devres api for refcounted objects

2017-02-02 Thread Stuart Yoder


> -Original Message-
> From: laurentiu.tu...@nxp.com [mailto:laurentiu.tu...@nxp.com]
> Sent: Wednesday, February 01, 2017 5:43 AM
> To: gre...@linuxfoundation.org
> Cc: de...@driverdev.osuosl.org; linux-ker...@vger.kernel.org; ag...@suse.de; 
> a...@arndb.de; Ioana
> Ciornei <ioana.cior...@nxp.com>; Ruxandra Ioana Radulescu 
> <ruxandra.radule...@nxp.com>; Bharat Bhushan
> <bharat.bhus...@nxp.com>; Stuart Yoder <stuart.yo...@nxp.com>; Catalin 
> Horghidan
> <catalin.horghi...@nxp.com>; Leo Li <leoyang...@nxp.com>; Roy Pledge 
> <roy.ple...@nxp.com>; Laurentiu
> Tudor <laurentiu.tu...@nxp.com>
> Subject: [PATCH 4/9] staging: fsl-mc: don't use devres api for refcounted 
> objects
> 
> From: Laurentiu Tudor <laurentiu.tu...@nxp.com>
> 
> Mixing two memory management systems, in this case
> managed device resource api and refcounted objects
> is a bad idea. Lifetime of an object is controlled
> by its refcount so allocating it with other apis
> that have their own lifetime control is not ok.
> Drop devm_*() apis in favor of plain allocations.
> 
> While at it, let's drop the slab cache for objects
> until we actually have proof that it improves
> performance. This allows for some code cleanup.

Those 2 changes (dropping devm_* apis and slab cache
changes) are 2 orthogonal things, right?  It would
be better to split those into separate patches.  Mixing
them makes it harder to review.

> Signed-off-by: Laurentiu Tudor <laurentiu.tu...@nxp.com>
> ---
>  drivers/staging/fsl-mc/bus/fsl-mc-bus.c | 43 
> +
>  1 file changed, 6 insertions(+), 37 deletions(-)
> 
> diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c 
> b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
> index 6601bde..c493427 100644
> --- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
> +++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
> @@ -27,8 +27,6 @@
>  #include "fsl-mc-private.h"
>  #include "dprc-cmd.h"
> 
> -static struct kmem_cache *mc_dev_cache;
> -
>  /**
>   * Default DMA mask for devices on a fsl-mc bus
>   */
> @@ -422,17 +420,12 @@ bool fsl_mc_is_root_dprc(struct device *dev)
>  static void fsl_mc_device_release(struct device *dev)
>  {
>   struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev);
> - struct fsl_mc_bus *mc_bus = NULL;
> 
>   kfree(mc_dev->regions);
> -
> - if (strcmp(mc_dev->obj_desc.type, "dprc") == 0)
> - mc_bus = to_fsl_mc_bus(mc_dev);
> -
> - if (mc_bus)
> - devm_kfree(mc_dev->dev.parent, mc_bus);
> + if (!strcmp(mc_dev->obj_desc.type, "dprc"))
> + kfree(to_fsl_mc_bus(mc_dev));
>   else
> - kmem_cache_free(mc_dev_cache, mc_dev);
> + kfree(mc_dev);
>  }
> 
>  /**
> @@ -457,7 +450,7 @@ int fsl_mc_device_add(struct dprc_obj_desc *obj_desc,
>   /*
>* Allocate an MC bus device object:
>*/
> - mc_bus = devm_kzalloc(parent_dev, sizeof(*mc_bus), GFP_KERNEL);
> + mc_bus = kzalloc(sizeof(*mc_bus), GFP_KERNEL);
>   if (!mc_bus)
>   return -ENOMEM;
> 
> @@ -466,7 +459,7 @@ int fsl_mc_device_add(struct dprc_obj_desc *obj_desc,
>   /*
>* Allocate a regular fsl_mc_device object:
>*/
> - mc_dev = kmem_cache_zalloc(mc_dev_cache, GFP_KERNEL);
> + mc_dev = kzalloc(sizeof(*mc_dev), GFP_KERNEL);
>   if (!mc_dev)
>   return -ENOMEM;
>   }
> @@ -561,10 +554,7 @@ int fsl_mc_device_add(struct dprc_obj_desc *obj_desc,
> 
>  error_cleanup_dev:
>   kfree(mc_dev->regions);
> - if (mc_bus)
> - devm_kfree(parent_dev, mc_bus);
> - else
> - kmem_cache_free(mc_dev_cache, mc_dev);
> + kfree(mc_bus ? (void *)mc_bus : (void *)mc_dev);
> 
>   return error;
>  }
> @@ -578,23 +568,11 @@ int fsl_mc_device_add(struct dprc_obj_desc *obj_desc,
>   */
>  void fsl_mc_device_remove(struct fsl_mc_device *mc_dev)
>  {
> - struct fsl_mc_bus *mc_bus = NULL;
> -
> - kfree(mc_dev->regions);
> -
>   /*
>* The device-specific remove callback will get invoked by device_del()
>*/
>   device_del(_dev->dev);
>   put_device(_dev->dev);
> -
> - if (strcmp(mc_dev->obj_desc.type, "dprc") == 0)
> - mc_bus = to_fsl_mc_bus(mc_dev);
> -
> - if (mc_bus)
> - devm_kfree(mc_dev->dev.parent, mc_bus);
> - else
> - kmem_cache_free(mc_dev_cache, mc_dev);
>  }

The above changes in fsl_mc_device_remove(), I think 
actually belong in patch #3 of this series.

Stuart
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH 3/9] staging: fsl-mc: add device release callback

2017-02-02 Thread Stuart Yoder

> -Original Message-
> From: upstream-release-boun...@linux.freescale.net [mailto:upstream-release-
> boun...@linux.freescale.net] On Behalf Of laurentiu.tu...@nxp.com
> Sent: Wednesday, February 01, 2017 5:43 AM
> To: gre...@linuxfoundation.org
> Cc: de...@driverdev.osuosl.org; a...@arndb.de; Ruxandra Ioana Radulescu 
> <ruxandra.radule...@nxp.com>;
> Roy Pledge <roy.ple...@nxp.com>; linux-ker...@vger.kernel.org; ag...@suse.de; 
> Catalin Horghidan
> <catalin.horghi...@nxp.com>; Leo Li <leoyang...@nxp.com>; Stuart Yoder 
> <stuart.yo...@nxp.com>;
> Laurentiu Tudor <laurentiu.tu...@nxp.com>
> Subject: [upstream-release] [PATCH 3/9] staging: fsl-mc: add device release 
> callback
> 
> From: Laurentiu Tudor <laurentiu.tu...@nxp.com>
> 
> When hot unplugging a mc-bus device the kernel displays
> this pertinent message, followed by a stack dump:
> "Device 'foo.N' does not have a release() function,
>  it is broken and must be fixed."
> Add the required callback to fix.
> 
> Signed-off-by: Laurentiu Tudor <laurentiu.tu...@nxp.com>
> ---
>  drivers/staging/fsl-mc/bus/fsl-mc-bus.c | 17 +
>  1 file changed, 17 insertions(+)
> 
> diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c 
> b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
> index 7c6a43b..6601bde 100644
> --- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
> +++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
> @@ -419,6 +419,22 @@ bool fsl_mc_is_root_dprc(struct device *dev)
>   return dev == root_dprc_dev;
>  }
> 
> +static void fsl_mc_device_release(struct device *dev)
> +{
> + struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev);
> + struct fsl_mc_bus *mc_bus = NULL;
> +
> + kfree(mc_dev->regions);
> +
> + if (strcmp(mc_dev->obj_desc.type, "dprc") == 0)
> + mc_bus = to_fsl_mc_bus(mc_dev);
> +
> + if (mc_bus)
> + devm_kfree(mc_dev->dev.parent, mc_bus);
> + else
> + kmem_cache_free(mc_dev_cache, mc_dev);
> +}
> +
>  /**
>   * Add a newly discovered fsl-mc device to be visible in Linux
>   */
> @@ -460,6 +476,7 @@ int fsl_mc_device_add(struct dprc_obj_desc *obj_desc,
>   device_initialize(_dev->dev);
>   mc_dev->dev.parent = parent_dev;
>   mc_dev->dev.bus = _mc_bus_type;
> + mc_dev->dev.release = fsl_mc_device_release;
>   dev_set_name(_dev->dev, "%s.%d", obj_desc->type, obj_desc->id);
> 
>   if (strcmp(obj_desc->type, "dprc") == 0) {
> --

With this patch applied, you still have this:

void fsl_mc_device_remove(struct fsl_mc_device *mc_dev)
{
struct fsl_mc_bus *mc_bus = NULL;

kfree(mc_dev->regions);

/*
 * The device-specific remove callback will get invoked by device_del()
 */
device_del(_dev->dev);
put_device(_dev->dev);

if (strcmp(mc_dev->obj_desc.type, "dprc") == 0)
mc_bus = to_fsl_mc_bus(mc_dev);

if (mc_bus)
devm_kfree(mc_dev->dev.parent, mc_bus);
else
kmem_cache_free(mc_dev_cache, mc_dev);
}

...i.e. you are doing the same thing in 2 places.  You
need to remove the kfree/devm_kfree/ kmem_cache_free,
here, no?

Stuart
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH 7/8] staging: fsl-dpaa2/eth: Add TODO file

2017-01-03 Thread Stuart Yoder

> -Original Message-
> From: Greg KH [mailto:gre...@linuxfoundation.org]
> Sent: Tuesday, January 03, 2017 10:48 AM
> To: Stuart Yoder <stuart.yo...@nxp.com>
> Cc: de...@driverdev.osuosl.org; a...@arndb.de; Roy Pledge 
> <roy.ple...@nxp.com>; Alexandru Marginean
> <alexandru.margin...@nxp.com>; linux-ker...@vger.kernel.org; ag...@suse.de; 
> Bogdan Hamciuc
> <bogdan.hamc...@nxp.com>; Laurentiu Tudor <laurentiu.tu...@nxp.com>
> Subject: Re: [PATCH 7/8] staging: fsl-dpaa2/eth: Add TODO file
> 
> On Tue, Dec 06, 2016 at 06:10:38PM +, Stuart Yoder wrote:
> >
> >
> > > -Original Message-
> > > From: Greg KH [mailto:gre...@linuxfoundation.org]
> > > Sent: Tuesday, December 06, 2016 11:56 AM
> > > To: Stuart Yoder <stuart.yo...@nxp.com>
> > > Cc: Ruxandra Ioana Radulescu <ruxandra.radule...@nxp.com>; 
> > > de...@driverdev.osuosl.org; linux-
> > > ker...@vger.kernel.org; ag...@suse.de; a...@arndb.de; Alexandru Marginean
> <alexandru.margin...@nxp.com>;
> > > Bogdan Hamciuc <bogdan.hamc...@nxp.com>; Roy Pledge <roy.ple...@nxp.com>; 
> > > Laurentiu Tudor
> > > <laurentiu.tu...@nxp.com>
> > > Subject: Re: [PATCH 7/8] staging: fsl-dpaa2/eth: Add TODO file
> > >
> > > On Tue, Dec 06, 2016 at 12:59:59PM +, Stuart Yoder wrote:
> > > >
> > > >
> > > > > -Original Message-
> > > > > From: Greg KH [mailto:gre...@linuxfoundation.org]
> > > > > Sent: Tuesday, December 06, 2016 4:20 AM
> > > > > To: Ruxandra Ioana Radulescu <ruxandra.radule...@nxp.com>
> > > > > Cc: de...@driverdev.osuosl.org; linux-ker...@vger.kernel.org; 
> > > > > ag...@suse.de; a...@arndb.de;
> > > Alexandru
> > > > > Marginean <alexandru.margin...@nxp.com>; Bogdan Hamciuc 
> > > > > <bogdan.hamc...@nxp.com>; Stuart Yoder
> > > > > <stuart.yo...@nxp.com>; Roy Pledge <roy.ple...@nxp.com>; Laurentiu 
> > > > > Tudor
> <laurentiu.tu...@nxp.com>
> > > > > Subject: Re: [PATCH 7/8] staging: fsl-dpaa2/eth: Add TODO file
> > > > >
> > > > > On Tue, Dec 06, 2016 at 10:06:25AM +, Ruxandra Ioana Radulescu 
> > > > > wrote:
> > > > > > > -Original Message-
> > > > > > > From: Greg KH [mailto:gre...@linuxfoundation.org]
> > > > > > > Sent: Tuesday, December 06, 2016 11:58 AM
> > > > > > > To: Ruxandra Ioana Radulescu <ruxandra.radule...@nxp.com>
> > > > > > > Cc: de...@driverdev.osuosl.org; linux-ker...@vger.kernel.org;
> > > > > > > ag...@suse.de; a...@arndb.de; Alexandru Marginean
> > > > > > > <alexandru.margin...@nxp.com>; Bogdan Hamciuc
> > > > > > > <bogdan.hamc...@nxp.com>; Stuart Yoder <stuart.yo...@nxp.com>; Roy
> > > > > > > Pledge <roy.ple...@nxp.com>; Laurentiu Tudor
> > > > > > > <laurentiu.tu...@nxp.com>
> > > > > > > Subject: Re: [PATCH 7/8] staging: fsl-dpaa2/eth: Add TODO file
> > > > > > >
> > > > > > > On Tue, Dec 06, 2016 at 03:34:41AM -0600, Ioana Radulescu wrote:
> > > > > > > > Add a list of TODO items for the Ethernet driver
> > > > > > > >
> > > > > > > > Signed-off-by: Ioana Radulescu <ruxandra.radule...@nxp.com>
> > > > > > > > ---
> > > > > > > >  drivers/staging/fsl-dpaa2/ethernet/TODO |9 +
> > > > > > > >  1 files changed, 9 insertions(+), 0 deletions(-)
> > > > > > > >  create mode 100644 drivers/staging/fsl-dpaa2/ethernet/TODO
> > > > > > > >
> > > > > > > > diff --git a/drivers/staging/fsl-dpaa2/ethernet/TODO 
> > > > > > > > b/drivers/staging/fsl-
> > > > > > > dpaa2/ethernet/TODO
> > > > > > > > new file mode 100644
> > > > > > > > index 000..833265b
> > > > > > > > --- /dev/null
> > > > > > > > +++ b/drivers/staging/fsl-dpaa2/ethernet/TODO
> > > > > > > > @@ -0,0 +1,9 @@
> > > > > > > > +* Add a DPAA2 MAC kernel driver in order to allow PHY 
> > > > > > > > management;
> > > > > > > currently
> > > >

[PATCH v5 0/8] staging: fsl-mc: add dpio driver

2016-12-16 Thread Stuart Yoder
This patch series adds the driver for the DPIO object which is a 
step to addressing the final item in the staging TODO list-- adding
a functional driver on top of the bus driver.  The DPIO driver is a
dependency for other functional drivers such as Ethernet.

An overview of the DPIO object and driver components are in patch 1.
Patches 2-6 are internal components of the DPIO driver-- bit twiddling
of hardware registers, DPAA2 data structures, and the queuing APIs exposed
to other drivers.

Patch 7 adds the fsl-mc driver for the DPIO object.  It provides
the probe/remove functions, demonstrating a working example of
how fsl-mc drivers initialize, interact with the management
complex hardware, map their mappable MMIO regions, initialize
interrupts, register an ISR, etc.  All other DPAA2 drivers will
follow a similar initialization pattern.

version 5 changes
   -fixed typo in patch 5 that caused compile issue

version 4 changes
   -removed the patch moving the bus driver out of staging, updated
all paths referenced in dpio (e.g. includes) to be drivers/staging
   -defined macros for constants where needed
   -copyright updates
   -cleanup: fixed whitespace, alignment issues, typos, removed unneeded
comments
   -fixed bug in SDQCR #define
   -adding missing free in an error path

version 3 changes
   -zero memory allocated for a dpio store
   -replace hardcoded dequeue token with a #define and look for
that token when checking for a new result

version 2 changes (mostly feedback from Ioana Radulescu)
   -removed unused structs and defines in dpio command definitions
   -added setter/getter for the FD ctrl field
   -corrected comment for SG format_offset field description
   -added support for short length field in FD
   -fix bug in buffer release command, by setting bpid field
   -handle error (NULL) return value from qbman_swp_mc_complete()
   -fix bug in sending management commands where the verb was
properly initialized
   -use service_select_by_cpu() for re-arming DPIO interrupts
   -replace use of NR_CPUS with num_possible_cpus()
   -handle error case where number of DPIOs exceeds number of possible
CPUs
   -error message cleanup
   -updated MAINTAINERS file with proper location for both fsl-mc bus
driver and dpio driver


Ioana Radulescu (1):
  bus: fsl-mc: dpio: add APIs for DPIO objects

Roy Pledge (6):
  bus: fsl-mc: dpio: add frame descriptor and scatter/gather APIs
  bus: fsl-mc: dpio: add global dpaa2 definitions
  bus: fsl-mc: dpio: add QBMan portal APIs for DPAA2
  bus: fsl-mc: dpio: add the DPAA2 DPIO service interface
  bus: fsl-mc: dpio: add the DPAA2 DPIO object driver
  bus: fsl-mc: dpio: add maintainer for DPIO

Stuart Yoder (1):
  bus: fsl-mc: dpio: add DPIO driver overview document

 MAINTAINERS |6 +
 drivers/staging/fsl-mc/bus/Kconfig  |   10 +
 drivers/staging/fsl-mc/bus/Makefile |3 +
 drivers/staging/fsl-mc/bus/dpio/Makefile|9 +
 drivers/staging/fsl-mc/bus/dpio/dpio-cmd.h  |   76 ++
 drivers/staging/fsl-mc/bus/dpio/dpio-driver.c   |  296 +++
 drivers/staging/fsl-mc/bus/dpio/dpio-driver.txt |  135 +++
 drivers/staging/fsl-mc/bus/dpio/dpio-service.c  |  616 ++
 drivers/staging/fsl-mc/bus/dpio/dpio.c  |  224 +
 drivers/staging/fsl-mc/bus/dpio/dpio.h  |  109 +++
 drivers/staging/fsl-mc/bus/dpio/qbman-portal.c  | 1033 +++
 drivers/staging/fsl-mc/bus/dpio/qbman-portal.h  |  469 ++
 drivers/staging/fsl-mc/include/dpaa2-fd.h   |  448 ++
 drivers/staging/fsl-mc/include/dpaa2-global.h   |  202 +
 drivers/staging/fsl-mc/include/dpaa2-io.h   |  139 +++
 15 files changed, 3775 insertions(+)
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/Makefile
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/dpio-cmd.h
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/dpio-driver.c
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/dpio-driver.txt
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/dpio-service.c
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/dpio.c
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/dpio.h
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/qbman-portal.c
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/qbman-portal.h
 create mode 100644 drivers/staging/fsl-mc/include/dpaa2-fd.h
 create mode 100644 drivers/staging/fsl-mc/include/dpaa2-global.h
 create mode 100644 drivers/staging/fsl-mc/include/dpaa2-io.h

-- 
1.9.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v5 2/8] bus: fsl-mc: dpio: add APIs for DPIO objects

2016-12-16 Thread Stuart Yoder
From: Ioana Radulescu <ruxandra.radule...@nxp.com>

Add the command build/parse APIs for operating on DPIO objects through
the DPAA2 Management Complex.

Signed-off-by: Ioana Radulescu <ruxandra.radule...@nxp.com>
Signed-off-by: Roy Pledge <roy.ple...@nxp.com>
Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
---

Notes:
-v4
  -adjust file location to be in drivers/staging
  -remove unneeded comments
  -updated copyright
-v3
  -no changes
-v2
  -removed unused structs and defines

 drivers/staging/fsl-mc/bus/Kconfig |  10 ++
 drivers/staging/fsl-mc/bus/Makefile|   3 +
 drivers/staging/fsl-mc/bus/dpio/Makefile   |   9 ++
 drivers/staging/fsl-mc/bus/dpio/dpio-cmd.h |  76 ++
 drivers/staging/fsl-mc/bus/dpio/dpio.c | 224 +
 drivers/staging/fsl-mc/bus/dpio/dpio.h | 109 ++
 6 files changed, 431 insertions(+)
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/Makefile
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/dpio-cmd.h
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/dpio.c
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/dpio.h

diff --git a/drivers/staging/fsl-mc/bus/Kconfig 
b/drivers/staging/fsl-mc/bus/Kconfig
index 5c009ab..a10aaf0 100644
--- a/drivers/staging/fsl-mc/bus/Kconfig
+++ b/drivers/staging/fsl-mc/bus/Kconfig
@@ -15,3 +15,13 @@ config FSL_MC_BUS
  architecture.  The fsl-mc bus driver handles discovery of
  DPAA2 objects (which are represented as Linux devices) and
  binding objects to drivers.
+
+config FSL_MC_DPIO
+tristate "QorIQ DPAA2 DPIO driver"
+depends on FSL_MC_BUS
+help
+ Driver for the DPAA2 DPIO object.  A DPIO provides queue and
+ buffer management facilities for software to interact with
+ other DPAA2 objects. This driver does not expose the DPIO
+ objects individually, but groups them under a service layer
+ API.
diff --git a/drivers/staging/fsl-mc/bus/Makefile 
b/drivers/staging/fsl-mc/bus/Makefile
index 38716fd..577e9fa 100644
--- a/drivers/staging/fsl-mc/bus/Makefile
+++ b/drivers/staging/fsl-mc/bus/Makefile
@@ -18,3 +18,6 @@ mc-bus-driver-objs := fsl-mc-bus.o \
  irq-gic-v3-its-fsl-mc-msi.o \
  dpmcp.o \
  dpbp.o
+
+# MC DPIO driver
+obj-$(CONFIG_FSL_MC_DPIO) += dpio/
diff --git a/drivers/staging/fsl-mc/bus/dpio/Makefile 
b/drivers/staging/fsl-mc/bus/dpio/Makefile
new file mode 100644
index 000..128befc
--- /dev/null
+++ b/drivers/staging/fsl-mc/bus/dpio/Makefile
@@ -0,0 +1,9 @@
+#
+# QorIQ DPAA2 DPIO driver
+#
+
+subdir-ccflags-y := -Werror
+
+obj-$(CONFIG_FSL_MC_DPIO) += fsl-mc-dpio.o
+
+fsl-mc-dpio-objs := dpio.o
diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio-cmd.h 
b/drivers/staging/fsl-mc/bus/dpio/dpio-cmd.h
new file mode 100644
index 000..c237d5f
--- /dev/null
+++ b/drivers/staging/fsl-mc/bus/dpio/dpio-cmd.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2013-2016 Freescale Semiconductor Inc.
+ * Copyright 2016 NXP
+ *
+ * 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 the above-listed copyright holders nor the
+ * names of any 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDERS OR CONTRIBUTORS 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.
+ */
+#ifndef _FSL_DPIO_CMD_H
+#define _FSL_DPIO_CMD_H
+
+/* DPIO Version */
+#define DP

[PATCH v5 5/8] bus: fsl-mc: dpio: add QBMan portal APIs for DPAA2

2016-12-16 Thread Stuart Yoder
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:
-v5
   -fixed typo that caused a compile error
-v4
   -adjust file location to be in drivers/staging
   -updated copyright
   -added definition for static dequeue token value
   -fixed bug in SDQCR #define
   -added missing #include guard in qbman-portal.h
   -added #define for QMAN_REV_MASK
   -whitespace, alignment cleanup
-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/staging/fsl-mc/bus/dpio/Makefile   |2 +-
 drivers/staging/fsl-mc/bus/dpio/qbman-portal.c | 1033 
 drivers/staging/fsl-mc/bus/dpio/qbman-portal.h |  469 +++
 3 files changed, 1503 insertions(+), 1 deletion(-)
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/qbman-portal.c
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/qbman-portal.h

diff --git a/drivers/staging/fsl-mc/bus/dpio/Makefile 
b/drivers/staging/fsl-mc/bus/dpio/Makefile
index 128befc..6588498 100644
--- a/drivers/staging/fsl-mc/bus/dpio/Makefile
+++ b/drivers/staging/fsl-mc/bus/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/staging/fsl-mc/bus/dpio/qbman-portal.c 
b/drivers/staging/fsl-mc/bus/dpio/qbman-portal.c
new file mode 100644
index 000..4949102
--- /dev/null
+++ b/drivers/staging/fsl-mc/bus/dpio/qbman-portal.c
@@ -0,0 +1,1033 @@
+/*
+ * Copyright (C) 2014-2016 Freescale Semiconductor, Inc.
+ * Copyright 2016 NXP
+ *
+ * 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/dpaa2-global.h"
+
+#include "qbman-portal.h"
+
+#define QMAN_REV_4000   0x0400
+#define QMAN_REV_4100   0x0401
+#define QMAN_REV_4101   0x04010001
+#define QMAN_REV_MASK   0x
+
+/* 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) (0

[PATCH v5 7/8] bus: fsl-mc: dpio: add the DPAA2 DPIO object driver

2016-12-16 Thread Stuart Yoder
From: Roy Pledge <roy.ple...@nxp.com>

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 <roy.ple...@nxp.com>
Signed-off-by: Haiying Wang <haiying.w...@nxp.com>
Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
---

Notes:
-v4
   -updated copyright
   -adjust file location to be in drivers/staging
   -whitespace alignment cleanup
-v3
   -no changes
-v2
   -handle error case where number of DPIOs > NR_CPUs

 drivers/staging/fsl-mc/bus/dpio/Makefile  |   2 +-
 drivers/staging/fsl-mc/bus/dpio/dpio-driver.c | 296 ++
 2 files changed, 297 insertions(+), 1 deletion(-)
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/dpio-driver.c

diff --git a/drivers/staging/fsl-mc/bus/dpio/Makefile 
b/drivers/staging/fsl-mc/bus/dpio/Makefile
index 0778da7..837d330 100644
--- a/drivers/staging/fsl-mc/bus/dpio/Makefile
+++ b/drivers/staging/fsl-mc/bus/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/staging/fsl-mc/bus/dpio/dpio-driver.c 
b/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c
new file mode 100644
index 000..e36da20
--- /dev/null
+++ b/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c
@@ -0,0 +1,296 @@
+/*
+ * Copyright 2014-2016 Freescale Semiconductor Inc.
+ * Copyright NXP 2016
+ *
+ * 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/mc.h"
+#include "../../include/dpaa2-io.h"
+
+#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(_dev->dev);
+
+   irq = dpio_dev->irqs[0];
+   error = devm_request_irq(_dev->dev,
+irq->msi_desc->irq,
+dpio_irq_handler,
+0,
+dev_name(_dev->dev),
+ 

[PATCH v5 8/8] bus: fsl-mc: dpio: add maintainer for DPIO

2016-12-16 Thread Stuart Yoder
From: Roy Pledge <roy.ple...@nxp.com>

add Roy Pledge as maintainer of DPIO

Signed-off-by: Roy Pledge <roy.ple...@nxp.com>
Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
---

Notes:
-v4
   -adjust file location to be in drivers/staging
-v3
   -no changes
-v2
   -corrected location of maintainer entry

 MAINTAINERS | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 8695516..add3de4 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3980,6 +3980,12 @@ S:   Maintained
 F: drivers/char/dtlk.c
 F: include/linux/dtlk.h
 
+DPAA2 DATAPATH I/O (DPIO) DRIVER
+M: Roy Pledge <roy.ple...@nxp.com>
+L: linux-ker...@vger.kernel.org
+S: Maintained
+F: drivers/staging/fsl-mc/bus/dpio
+
 DPT_I2O SCSI RAID DRIVER
 M: Adaptec OEM Raid Solutions <aacr...@adaptec.com>
 L: linux-s...@vger.kernel.org
-- 
1.9.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v5 6/8] bus: fsl-mc: dpio: add the DPAA2 DPIO service interface

2016-12-16 Thread Stuart Yoder
From: Roy Pledge <roy.ple...@nxp.com>

The DPIO service interface handles initialization of DPIO objects
and exports APIs to be used by other DPAA2 object drivers to perform
queuing and buffer management related operations.  The service allows
registration of callbacks when frames or notifications are received.

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:
-v4
   -updated copyright
   -adjust file location to be in drivers/staging
   -updated copyright
   -added missing free on error path
   -fixed typo in comment
   -whitespace and alignment cleanup
-v3
   -zero memory allocated for a dpio store (bug fix suggested
by Ioana Radulescu)
-v2
   -use service_select_by_cpu() for re-arming DPIO interrupts
   -replace use of NR_CPUS with num_possible_cpus()

 drivers/staging/fsl-mc/bus/dpio/Makefile   |   2 +-
 drivers/staging/fsl-mc/bus/dpio/dpio-service.c | 616 +
 drivers/staging/fsl-mc/include/dpaa2-io.h  | 139 ++
 3 files changed, 756 insertions(+), 1 deletion(-)
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/dpio-service.c
 create mode 100644 drivers/staging/fsl-mc/include/dpaa2-io.h

diff --git a/drivers/staging/fsl-mc/bus/dpio/Makefile 
b/drivers/staging/fsl-mc/bus/dpio/Makefile
index 6588498..0778da7 100644
--- a/drivers/staging/fsl-mc/bus/dpio/Makefile
+++ b/drivers/staging/fsl-mc/bus/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
+fsl-mc-dpio-objs := dpio.o qbman-portal.o dpio-service.o
diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio-service.c 
b/drivers/staging/fsl-mc/bus/dpio/dpio-service.c
new file mode 100644
index 000..394727b
--- /dev/null
+++ b/drivers/staging/fsl-mc/bus/dpio/dpio-service.c
@@ -0,0 +1,616 @@
+/*
+ * Copyright 2014-2016 Freescale Semiconductor Inc.
+ * Copyright 2016 NXP
+ *
+ * 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/mc.h"
+#include "../../include/dpaa2-io.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "dpio.h"
+#include "qbman-portal.h"
+
+struct dpaa2_io {
+   atomic_t refs;
+   struct dpaa2_io_desc dpio_desc;
+   struct qbman_swp_desc swp_desc;
+   struct qbman_swp *swp;
+   struct list_head node;
+   spinlock_t lock_mgmt_cmd;
+   spinlock_t lock_notifications;
+   struct list_head notifications;
+};
+
+struct dpaa2_io_store {
+   unsigned int max;
+   dma_addr_t paddr;
+   struct dpaa2_dq *vaddr;
+   void *alloced_addr;/* unaligned value from kmalloc() */
+   unsigned int idx;  /* position of the next-to-be-returned entry */
+   struct qbman_swp *swp; /* portal used to issue VDQCR */
+   struct device *dev;/* device used for DMA mapping */
+};
+
+/* keep a per cpu array of DPIOs for fast access */
+static struct dpaa2_io *dpio_by_cpu[NR_CPUS];
+static struct list_head dpio_list = LIST_HEAD_INIT(dpio_list);
+static DEFINE_SPINLOCK(dpio_list_lock);

[PATCH v5 3/8] bus: fsl-mc: dpio: add frame descriptor and scatter/gather APIs

2016-12-16 Thread Stuart Yoder
From: Roy Pledge <roy.ple...@nxp.com>

Add global definitions for DPAA2 frame descriptors and scatter
gather entries.

Signed-off-by: Roy Pledge <roy.ple...@nxp.com>
Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
---

Notes:
-v4
   -updated copyright
   -adjust file location to be in drivers/staging
   -address cleanup comments-- whitespace cleanup, use !! consistently
to convert expression to bool, remove unneeded parenthesis
-v3
   -no changes
-v2
   -added setter/getter for the FD ctrl field
   -corrected comment for SG format_offset field description
   -added support for short length field in FD

 drivers/staging/fsl-mc/include/dpaa2-fd.h | 448 ++
 1 file changed, 448 insertions(+)
 create mode 100644 drivers/staging/fsl-mc/include/dpaa2-fd.h

diff --git a/drivers/staging/fsl-mc/include/dpaa2-fd.h 
b/drivers/staging/fsl-mc/include/dpaa2-fd.h
new file mode 100644
index 000..21102e6
--- /dev/null
+++ b/drivers/staging/fsl-mc/include/dpaa2-fd.h
@@ -0,0 +1,448 @@
+/*
+ * Copyright 2014-2016 Freescale Semiconductor Inc.
+ * Copyright 2016 NXP
+ *
+ * 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.
+ */
+#ifndef __FSL_DPAA2_FD_H
+#define __FSL_DPAA2_FD_H
+
+#include 
+
+/**
+ * DOC: DPAA2 FD - Frame Descriptor APIs for DPAA2
+ *
+ * Frame Descriptors (FDs) are used to describe frame data in the DPAA2.
+ * Frames can be enqueued and dequeued to Frame Queues (FQs) which are consumed
+ * by the various DPAA accelerators (WRIOP, SEC, PME, DCE)
+ *
+ * There are three types of frames: single, scatter gather, and frame lists.
+ *
+ * The set of APIs in this file must be used to create, manipulate and
+ * query Frame Descriptors.
+ */
+
+/**
+ * struct dpaa2_fd - Struct describing FDs
+ * @words: for easier/faster copying the whole FD structure
+ * @addr:  address in the FD
+ * @len:   length in the FD
+ * @bpid:  buffer pool ID
+ * @format_offset: format, offset, and short-length fields
+ * @frc:   frame context
+ * @ctrl:  control bits...including dd, sc, va, err, etc
+ * @flc:   flow context address
+ *
+ * This structure represents the basic Frame Descriptor used in the system.
+ */
+struct dpaa2_fd {
+   union {
+   u32 words[8];
+   struct dpaa2_fd_simple {
+   __le64 addr;
+   __le32 len;
+   __le16 bpid;
+   __le16 format_offset;
+   __le32 frc;
+   __le32 ctrl;
+   __le64 flc;
+   } simple;
+   };
+};
+
+#define FD_SHORT_LEN_FLAG_MASK 0x1
+#define FD_SHORT_LEN_FLAG_SHIFT14
+#define FD_SHORT_LEN_MASK  0x1
+#define FD_OFFSET_MASK 0x0FFF
+#define FD_FORMAT_MASK 0x3
+#define FD_FORMAT_SHIFT12
+#define SG_SHORT_LEN_FLAG_MASK 0x1
+#define SG_SHORT_LEN_FLAG_SHIFT14
+#define SG_SHORT_LEN_MASK  0x1
+#define SG_OFFSET_MASK 0x0FFF
+#define SG_FORMAT_MASK 0x3
+#define SG_FORMAT_SHIFT12
+#define SG_BPID_MASK   0x3FFF
+#define SG_FINAL_FLAG_MASK 0x1
+#define SG_FINAL_FLAG_SHIFT  

[PATCH v5 4/8] bus: fsl-mc: dpio: add global dpaa2 definitions

2016-12-16 Thread Stuart Yoder
From: Roy Pledge <roy.ple...@nxp.com>

Create header for global dpaa2 definitions.  Add definitions
for dequeue results.

Signed-off-by: Roy Pledge <roy.ple...@nxp.com>
Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
---

Notes:
-v4
   -adjust file location to be in drivers/staging
   -whitespace/alignment cleanup, make dpaa2_dq_is_pull_complete()
return bool, fix spelling typo
   -updated copyright

 drivers/staging/fsl-mc/include/dpaa2-global.h | 202 ++
 1 file changed, 202 insertions(+)
 create mode 100644 drivers/staging/fsl-mc/include/dpaa2-global.h

diff --git a/drivers/staging/fsl-mc/include/dpaa2-global.h 
b/drivers/staging/fsl-mc/include/dpaa2-global.h
new file mode 100644
index 000..0326447
--- /dev/null
+++ b/drivers/staging/fsl-mc/include/dpaa2-global.h
@@ -0,0 +1,202 @@
+/*
+ * Copyright 2014-2016 Freescale Semiconductor Inc.
+ * Copyright 2016 NXP
+ *
+ * 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.
+ */
+#ifndef __FSL_DPAA2_GLOBAL_H
+#define __FSL_DPAA2_GLOBAL_H
+
+#include 
+#include 
+#include "dpaa2-fd.h"
+
+struct dpaa2_dq {
+   union {
+   struct common {
+   u8 verb;
+   u8 reserved[63];
+   } common;
+   struct dq {
+   u8 verb;
+   u8 stat;
+   __le16 seqnum;
+   __le16 oprid;
+   u8 reserved;
+   u8 tok;
+   __le32 fqid;
+   u32 reserved2;
+   __le32 fq_byte_cnt;
+   __le32 fq_frm_cnt;
+   __le64 fqd_ctx;
+   u8 fd[32];
+   } dq;
+   struct scn {
+   u8 verb;
+   u8 stat;
+   u8 state;
+   u8 reserved;
+   __le32 rid_tok;
+   __le64 ctx;
+   } scn;
+   };
+};
+
+/* Parsing frame dequeue results */
+/* FQ empty */
+#define DPAA2_DQ_STAT_FQEMPTY   0x80
+/* FQ held active */
+#define DPAA2_DQ_STAT_HELDACTIVE0x40
+/* FQ force eligible */
+#define DPAA2_DQ_STAT_FORCEELIGIBLE 0x20
+/* valid frame */
+#define DPAA2_DQ_STAT_VALIDFRAME0x10
+/* FQ ODP enable */
+#define DPAA2_DQ_STAT_ODPVALID  0x04
+/* volatile dequeue */
+#define DPAA2_DQ_STAT_VOLATILE  0x02
+/* volatile dequeue command is expired */
+#define DPAA2_DQ_STAT_EXPIRED   0x01
+
+#define DQ_FQID_MASK   0x00FF
+#define DQ_FRAME_COUNT_MASK0x00FF
+
+/**
+ * dpaa2_dq_flags() - Get the stat field of dequeue response
+ * @dq: the dequeue result.
+ */
+static inline u32 dpaa2_dq_flags(const struct dpaa2_dq *dq)
+{
+   return dq->dq.stat;
+}
+
+/**
+ * dpaa2_dq_is_pull() - Check whether the dq response is from a pull
+ *  command.
+ * @dq: the dequeue result
+ *
+ * Return 1 for volatile(pull) dequeue, 0 for static dequeue.
+ */
+static inline int dpaa2_dq_is_pull(const struct dpaa2_dq *dq)
+{
+   return (int)(dpaa2_dq_flags(dq) & DPAA2_DQ_STAT_VOLATILE);
+}
+
+/**
+ * dpaa2_dq_is_pull_complete() - Check w

[PATCH v5 1/8] bus: fsl-mc: dpio: add DPIO driver overview document

2016-12-16 Thread Stuart Yoder
add document describing the dpio driver and it's role, components
and major interfaces

Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
---

Notes:
-v4
   -updated copyright

 drivers/staging/fsl-mc/bus/dpio/dpio-driver.txt | 135 
 1 file changed, 135 insertions(+)
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/dpio-driver.txt

diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio-driver.txt 
b/drivers/staging/fsl-mc/bus/dpio/dpio-driver.txt
new file mode 100644
index 000..0ba6771
--- /dev/null
+++ b/drivers/staging/fsl-mc/bus/dpio/dpio-driver.txt
@@ -0,0 +1,135 @@
+Copyright 2016 NXP
+
+Introduction
+
+
+A DPAA2 DPIO (Data Path I/O) is a hardware object that provides
+interfaces to enqueue and dequeue frames to/from network interfaces
+and other accelerators.  A DPIO also provides hardware buffer
+pool management for network interfaces.
+
+This document provides an overview the Linux DPIO driver, its
+subcomponents, and its APIs.
+
+See Documentation/dpaa2/overview.txt for a general overview of DPAA2
+and the general DPAA2 driver architecture in Linux.
+
+Driver Overview
+---
+
+The DPIO driver is bound to DPIO objects discovered on the fsl-mc bus and
+provides services that:
+  A) allow other drivers, such as the Ethernet driver, to enqueue and dequeue
+ frames for their respective objects
+  B) allow drivers to register callbacks for data availability notifications
+ when data becomes available on a queue or channel
+  C) allow drivers to manage hardware buffer pools
+
+The Linux DPIO driver consists of 3 primary components--
+   DPIO object driver-- fsl-mc driver that manages the DPIO object
+   DPIO service-- provides APIs to other Linux drivers for services
+   QBman portal interface-- sends portal commands, gets responses
+
+  fsl-mc  other
+   bus   drivers
+|   |
++---++   +--+-+
+|DPIO obj|   |DPIO service|
+| driver |---|  (DPIO)|
+++   +--+-+
+|
+ +--+-+
+ |QBman   |
+ | portal i/f |
+ ++
+|
+ hardware
+
+The diagram below shows how the DPIO driver components fit with the other
+DPAA2 Linux driver components:
+   ++
+   | OS Network |
+   |   Stack|
+ ++++
+ | Allocator  |. . . . . . .   |  Ethernet  |
+ |(DPMCP,DPBP)||   (DPNI)   |
+ +-.--++---+---++
+  .  . ^   |
+ ..|   | dequeue>
++-+ .  |   |
+| DPRC driver |  .++ ++
+|   (DPRC)|   . . |DPIO obj| |DPIO service|
++--+--+   | driver |-|  (DPIO)|
+   |  ++ +--+-+
+   | +--|-+
+   | |   QBman|
+  ++--+  | portal i/f |
+  |   MC-bus driver   |  ++
+  |   | |
+  | /soc/fsl-mc   | |
+  +---+ |
+|
+ =|=|
++-+--DPIO---|---+
+|   |   |
+|QBman Portal   |
++---+
+
+ 
+
+
+DPIO Object Driver (dpio-driver.c)
+--
+
+   The dpio-driver component registers with the fsl-mc bus to handle objects of
+   type "dpio".  The implementation of probe() handles basic initialization
+   of the DPIO including mapping of the DPIO regions (the QBman SW portal)
+   and initializing interrupts and registering irq handlers.  The dpio-driver
+   registers the probed DPIO with dpio-service.
+
+DPIO service  (dpio-service.c, dpaa2-io.h)
+--
+
+   The dpio service component provides queuing, notification, and buffers
+   management services to DPAA2 drivers, such as the Ethernet driver.  A system
+   will typically allocate 1 DPIO object per C

RE: [PATCH v4 5/8] bus: fsl-mc: dpio: add QBMan portal APIs for DPAA2

2016-12-16 Thread Stuart Yoder


> -Original Message-
> From: kbuild test robot [mailto:l...@intel.com]
> Sent: Friday, December 16, 2016 1:57 AM
> To: Stuart Yoder <stuart.yo...@nxp.com>
> Cc: kbuild-...@01.org; gre...@linuxfoundation.org; 
> de...@driverdev.osuosl.org; ag...@suse.de;
> a...@arndb.de; Haiying Wang <haiying.w...@nxp.com>; Roy Pledge 
> <roy.ple...@nxp.com>; linux-
> ker...@vger.kernel.org; Leo Li <leoyang...@nxp.com>; Catalin Horghidan 
> <catalin.horghi...@nxp.com>;
> Ioana Ciornei <ioana.cior...@nxp.com>; Stuart Yoder <stuart.yo...@nxp.com>; 
> Laurentiu Tudor
> <laurentiu.tu...@nxp.com>
> Subject: Re: [PATCH v4 5/8] bus: fsl-mc: dpio: add QBMan portal APIs for DPAA2
> 
> Hi Roy,
> 
> [auto build test ERROR on staging/staging-testing]
> [also build test ERROR on next-20161215]
> [cannot apply to v4.9]
> [if your patch is applied to the wrong git tree, please drop us a note to 
> help improve the system]
> 
> url:
> https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0day-
> ci%2Flinux%2Fcommits%2FStuart-Yoder%2Fstaging-fsl-mc-add-dpio-driver%2F20161216-
> 114620=01%7C01%7Cstuart.yoder%40nxp.com%7C0eec622fda6c4ba7b20808d425893386%7C686ea1d3bc2b4c6fa92cd9
> 9c5c301635%7C0=3DcsmOyC%2FMv%2B8A1n%2Fzq%2FWIxSsP3EjA%2F2XLyKTkvbRSA%3D=0
> config: arm64-allmodconfig (attached as .config)
> compiler: aarch64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
> reproduce:
> wget
> https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.kernel.org%2Fcgit%2Flinux%2Fkerne
> l%2Fgit%2Fwfg%2Flkp-
> tests.git%2Fplain%2Fsbin%2Fmake.cross=01%7C01%7Cstuart.yoder%40nxp.com%7C0eec622fda6c4ba7b20808d425
> 893386%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0=tKbhJjq7jjDBYPLhMB%2FfnR1t%2BKEffwh8mZb7leKtxF4%3D
> eserved=0 -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # save the attached .config to linux build tree
> make.cross ARCH=arm64
> 
> All errors (new ones prefixed by >>):
> 
> >> drivers/staging/fsl-mc/bus/dpio/qbman-portal.c:996:10: error: expected 
> >> declaration specifiers or
> '...' before numeric constant
>  64 ctx)
>  ^~
> 
> vim +996 drivers/staging/fsl-mc/bus/dpio/qbman-portal.c
> 
>990u16 ch;
>991u8 reserved[60];
>992};
>993
>994int qbman_swp_CDAN_set(struct qbman_swp *s, u16 channelid,
>995   u8 we_mask, u8 cdan_en,
>  > 996   64 ctx)
>997{
>998struct qbman_cdan_ctrl_desc *p = NULL;
>999struct qbman_cdan_ctrl_rslt *r = NULL;

Ugh...made a last minute fix to the alignment and made a typo, and
while I could have sworn I recompiled everything I obviously didn't.
Will respin.

Stuart
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 4/8] bus: fsl-mc: dpio: add global dpaa2 definitions

2016-12-15 Thread Stuart Yoder
From: Roy Pledge <roy.ple...@nxp.com>

Create header for global dpaa2 definitions.  Add definitions
for dequeue results.

Signed-off-by: Roy Pledge <roy.ple...@nxp.com>
Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
---

Notes:
-v4
   -adjust file location to be in drivers/staging
   -whitespace/alignment cleanup, make dpaa2_dq_is_pull_complete()
return bool, fix spelling typo
   -updated copyright

 drivers/staging/fsl-mc/include/dpaa2-global.h | 202 ++
 1 file changed, 202 insertions(+)
 create mode 100644 drivers/staging/fsl-mc/include/dpaa2-global.h

diff --git a/drivers/staging/fsl-mc/include/dpaa2-global.h 
b/drivers/staging/fsl-mc/include/dpaa2-global.h
new file mode 100644
index 000..0326447
--- /dev/null
+++ b/drivers/staging/fsl-mc/include/dpaa2-global.h
@@ -0,0 +1,202 @@
+/*
+ * Copyright 2014-2016 Freescale Semiconductor Inc.
+ * Copyright 2016 NXP
+ *
+ * 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.
+ */
+#ifndef __FSL_DPAA2_GLOBAL_H
+#define __FSL_DPAA2_GLOBAL_H
+
+#include 
+#include 
+#include "dpaa2-fd.h"
+
+struct dpaa2_dq {
+   union {
+   struct common {
+   u8 verb;
+   u8 reserved[63];
+   } common;
+   struct dq {
+   u8 verb;
+   u8 stat;
+   __le16 seqnum;
+   __le16 oprid;
+   u8 reserved;
+   u8 tok;
+   __le32 fqid;
+   u32 reserved2;
+   __le32 fq_byte_cnt;
+   __le32 fq_frm_cnt;
+   __le64 fqd_ctx;
+   u8 fd[32];
+   } dq;
+   struct scn {
+   u8 verb;
+   u8 stat;
+   u8 state;
+   u8 reserved;
+   __le32 rid_tok;
+   __le64 ctx;
+   } scn;
+   };
+};
+
+/* Parsing frame dequeue results */
+/* FQ empty */
+#define DPAA2_DQ_STAT_FQEMPTY   0x80
+/* FQ held active */
+#define DPAA2_DQ_STAT_HELDACTIVE0x40
+/* FQ force eligible */
+#define DPAA2_DQ_STAT_FORCEELIGIBLE 0x20
+/* valid frame */
+#define DPAA2_DQ_STAT_VALIDFRAME0x10
+/* FQ ODP enable */
+#define DPAA2_DQ_STAT_ODPVALID  0x04
+/* volatile dequeue */
+#define DPAA2_DQ_STAT_VOLATILE  0x02
+/* volatile dequeue command is expired */
+#define DPAA2_DQ_STAT_EXPIRED   0x01
+
+#define DQ_FQID_MASK   0x00FF
+#define DQ_FRAME_COUNT_MASK0x00FF
+
+/**
+ * dpaa2_dq_flags() - Get the stat field of dequeue response
+ * @dq: the dequeue result.
+ */
+static inline u32 dpaa2_dq_flags(const struct dpaa2_dq *dq)
+{
+   return dq->dq.stat;
+}
+
+/**
+ * dpaa2_dq_is_pull() - Check whether the dq response is from a pull
+ *  command.
+ * @dq: the dequeue result
+ *
+ * Return 1 for volatile(pull) dequeue, 0 for static dequeue.
+ */
+static inline int dpaa2_dq_is_pull(const struct dpaa2_dq *dq)
+{
+   return (int)(dpaa2_dq_flags(dq) & DPAA2_DQ_STAT_VOLATILE);
+}
+
+/**
+ * dpaa2_dq_is_pull_complete() - Check w

[PATCH v4 5/8] bus: fsl-mc: dpio: add QBMan portal APIs for DPAA2

2016-12-15 Thread Stuart Yoder
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:
-v4
   -adjust file location to be in drivers/staging
   -updated copyright
   -added definition for static dequeue token value
   -fixed bug in SDQCR #define
   -added missing #include guard in qbman-portal.h
   -added #define for QMAN_REV_MASK
   -whitespace, alignment cleanup
-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/staging/fsl-mc/bus/dpio/Makefile   |2 +-
 drivers/staging/fsl-mc/bus/dpio/qbman-portal.c | 1033 
 drivers/staging/fsl-mc/bus/dpio/qbman-portal.h |  469 +++
 3 files changed, 1503 insertions(+), 1 deletion(-)
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/qbman-portal.c
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/qbman-portal.h

diff --git a/drivers/staging/fsl-mc/bus/dpio/Makefile 
b/drivers/staging/fsl-mc/bus/dpio/Makefile
index 128befc..6588498 100644
--- a/drivers/staging/fsl-mc/bus/dpio/Makefile
+++ b/drivers/staging/fsl-mc/bus/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/staging/fsl-mc/bus/dpio/qbman-portal.c 
b/drivers/staging/fsl-mc/bus/dpio/qbman-portal.c
new file mode 100644
index 000..a5b5d2b
--- /dev/null
+++ b/drivers/staging/fsl-mc/bus/dpio/qbman-portal.c
@@ -0,0 +1,1033 @@
+/*
+ * Copyright (C) 2014-2016 Freescale Semiconductor, Inc.
+ * Copyright 2016 NXP
+ *
+ * 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/dpaa2-global.h"
+
+#include "qbman-portal.h"
+
+#define QMAN_REV_4000   0x0400
+#define QMAN_REV_4100   0x0401
+#define QMAN_REV_4101   0x04010001
+#define QMAN_REV_MASK   0x
+
+/* 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

[PATCH v4 6/8] bus: fsl-mc: dpio: add the DPAA2 DPIO service interface

2016-12-15 Thread Stuart Yoder
From: Roy Pledge <roy.ple...@nxp.com>

The DPIO service interface handles initialization of DPIO objects
and exports APIs to be used by other DPAA2 object drivers to perform
queuing and buffer management related operations.  The service allows
registration of callbacks when frames or notifications are received.

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:
-v4
   -updated copyright
   -adjust file location to be in drivers/staging
   -updated copyright
   -added missing free on error path
   -fixed typo in comment
   -whitespace and alignment cleanup
-v3
   -zero memory allocated for a dpio store (bug fix suggested
by Ioana Radulescu)
-v2
   -use service_select_by_cpu() for re-arming DPIO interrupts
   -replace use of NR_CPUS with num_possible_cpus()

 drivers/staging/fsl-mc/bus/dpio/Makefile   |   2 +-
 drivers/staging/fsl-mc/bus/dpio/dpio-service.c | 616 +
 drivers/staging/fsl-mc/include/dpaa2-io.h  | 139 ++
 3 files changed, 756 insertions(+), 1 deletion(-)
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/dpio-service.c
 create mode 100644 drivers/staging/fsl-mc/include/dpaa2-io.h

diff --git a/drivers/staging/fsl-mc/bus/dpio/Makefile 
b/drivers/staging/fsl-mc/bus/dpio/Makefile
index 6588498..0778da7 100644
--- a/drivers/staging/fsl-mc/bus/dpio/Makefile
+++ b/drivers/staging/fsl-mc/bus/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
+fsl-mc-dpio-objs := dpio.o qbman-portal.o dpio-service.o
diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio-service.c 
b/drivers/staging/fsl-mc/bus/dpio/dpio-service.c
new file mode 100644
index 000..394727b
--- /dev/null
+++ b/drivers/staging/fsl-mc/bus/dpio/dpio-service.c
@@ -0,0 +1,616 @@
+/*
+ * Copyright 2014-2016 Freescale Semiconductor Inc.
+ * Copyright 2016 NXP
+ *
+ * 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/mc.h"
+#include "../../include/dpaa2-io.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "dpio.h"
+#include "qbman-portal.h"
+
+struct dpaa2_io {
+   atomic_t refs;
+   struct dpaa2_io_desc dpio_desc;
+   struct qbman_swp_desc swp_desc;
+   struct qbman_swp *swp;
+   struct list_head node;
+   spinlock_t lock_mgmt_cmd;
+   spinlock_t lock_notifications;
+   struct list_head notifications;
+};
+
+struct dpaa2_io_store {
+   unsigned int max;
+   dma_addr_t paddr;
+   struct dpaa2_dq *vaddr;
+   void *alloced_addr;/* unaligned value from kmalloc() */
+   unsigned int idx;  /* position of the next-to-be-returned entry */
+   struct qbman_swp *swp; /* portal used to issue VDQCR */
+   struct device *dev;/* device used for DMA mapping */
+};
+
+/* keep a per cpu array of DPIOs for fast access */
+static struct dpaa2_io *dpio_by_cpu[NR_CPUS];
+static struct list_head dpio_list = LIST_HEAD_INIT(dpio_list);
+static DEFINE_SPINLOCK(dpio_list_lock);

[PATCH v4 3/8] bus: fsl-mc: dpio: add frame descriptor and scatter/gather APIs

2016-12-15 Thread Stuart Yoder
From: Roy Pledge <roy.ple...@nxp.com>

Add global definitions for DPAA2 frame descriptors and scatter
gather entries.

Signed-off-by: Roy Pledge <roy.ple...@nxp.com>
Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
---

Notes:
-v4
   -updated copyright
   -adjust file location to be in drivers/staging
   -address cleanup comments-- whitespace cleanup, use !! consistently
to convert expression to bool, remove unneeded parenthesis
-v3
   -no changes
-v2
   -added setter/getter for the FD ctrl field
   -corrected comment for SG format_offset field description
   -added support for short length field in FD

 drivers/staging/fsl-mc/include/dpaa2-fd.h | 448 ++
 1 file changed, 448 insertions(+)
 create mode 100644 drivers/staging/fsl-mc/include/dpaa2-fd.h

diff --git a/drivers/staging/fsl-mc/include/dpaa2-fd.h 
b/drivers/staging/fsl-mc/include/dpaa2-fd.h
new file mode 100644
index 000..21102e6
--- /dev/null
+++ b/drivers/staging/fsl-mc/include/dpaa2-fd.h
@@ -0,0 +1,448 @@
+/*
+ * Copyright 2014-2016 Freescale Semiconductor Inc.
+ * Copyright 2016 NXP
+ *
+ * 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.
+ */
+#ifndef __FSL_DPAA2_FD_H
+#define __FSL_DPAA2_FD_H
+
+#include 
+
+/**
+ * DOC: DPAA2 FD - Frame Descriptor APIs for DPAA2
+ *
+ * Frame Descriptors (FDs) are used to describe frame data in the DPAA2.
+ * Frames can be enqueued and dequeued to Frame Queues (FQs) which are consumed
+ * by the various DPAA accelerators (WRIOP, SEC, PME, DCE)
+ *
+ * There are three types of frames: single, scatter gather, and frame lists.
+ *
+ * The set of APIs in this file must be used to create, manipulate and
+ * query Frame Descriptors.
+ */
+
+/**
+ * struct dpaa2_fd - Struct describing FDs
+ * @words: for easier/faster copying the whole FD structure
+ * @addr:  address in the FD
+ * @len:   length in the FD
+ * @bpid:  buffer pool ID
+ * @format_offset: format, offset, and short-length fields
+ * @frc:   frame context
+ * @ctrl:  control bits...including dd, sc, va, err, etc
+ * @flc:   flow context address
+ *
+ * This structure represents the basic Frame Descriptor used in the system.
+ */
+struct dpaa2_fd {
+   union {
+   u32 words[8];
+   struct dpaa2_fd_simple {
+   __le64 addr;
+   __le32 len;
+   __le16 bpid;
+   __le16 format_offset;
+   __le32 frc;
+   __le32 ctrl;
+   __le64 flc;
+   } simple;
+   };
+};
+
+#define FD_SHORT_LEN_FLAG_MASK 0x1
+#define FD_SHORT_LEN_FLAG_SHIFT14
+#define FD_SHORT_LEN_MASK  0x1
+#define FD_OFFSET_MASK 0x0FFF
+#define FD_FORMAT_MASK 0x3
+#define FD_FORMAT_SHIFT12
+#define SG_SHORT_LEN_FLAG_MASK 0x1
+#define SG_SHORT_LEN_FLAG_SHIFT14
+#define SG_SHORT_LEN_MASK  0x1
+#define SG_OFFSET_MASK 0x0FFF
+#define SG_FORMAT_MASK 0x3
+#define SG_FORMAT_SHIFT12
+#define SG_BPID_MASK   0x3FFF
+#define SG_FINAL_FLAG_MASK 0x1
+#define SG_FINAL_FLAG_SHIFT  

[PATCH v4 8/8] bus: fsl-mc: dpio: add maintainer for DPIO

2016-12-15 Thread Stuart Yoder
From: Roy Pledge <roy.ple...@nxp.com>

add Roy Pledge as maintainer of DPIO

Signed-off-by: Roy Pledge <roy.ple...@nxp.com>
Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
---

Notes:
-v4
   -adjust file location to be in drivers/staging
-v3
   -no changes
-v2
   -corrected location of maintainer entry

 MAINTAINERS | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 8695516..add3de4 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3980,6 +3980,12 @@ S:   Maintained
 F: drivers/char/dtlk.c
 F: include/linux/dtlk.h
 
+DPAA2 DATAPATH I/O (DPIO) DRIVER
+M: Roy Pledge <roy.ple...@nxp.com>
+L: linux-ker...@vger.kernel.org
+S: Maintained
+F: drivers/staging/fsl-mc/bus/dpio
+
 DPT_I2O SCSI RAID DRIVER
 M: Adaptec OEM Raid Solutions <aacr...@adaptec.com>
 L: linux-s...@vger.kernel.org
-- 
1.9.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 2/8] bus: fsl-mc: dpio: add APIs for DPIO objects

2016-12-15 Thread Stuart Yoder
From: Ioana Radulescu <ruxandra.radule...@nxp.com>

Add the command build/parse APIs for operating on DPIO objects through
the DPAA2 Management Complex.

Signed-off-by: Ioana Radulescu <ruxandra.radule...@nxp.com>
Signed-off-by: Roy Pledge <roy.ple...@nxp.com>
Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
---

Notes:
-v4
  -adjust file location to be in drivers/staging
  -remove unneeded comments
  -updated copyright
-v3
  -no changes
-v2
  -removed unused structs and defines

 drivers/staging/fsl-mc/bus/Kconfig |  10 ++
 drivers/staging/fsl-mc/bus/Makefile|   3 +
 drivers/staging/fsl-mc/bus/dpio/Makefile   |   9 ++
 drivers/staging/fsl-mc/bus/dpio/dpio-cmd.h |  76 ++
 drivers/staging/fsl-mc/bus/dpio/dpio.c | 224 +
 drivers/staging/fsl-mc/bus/dpio/dpio.h | 109 ++
 6 files changed, 431 insertions(+)
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/Makefile
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/dpio-cmd.h
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/dpio.c
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/dpio.h

diff --git a/drivers/staging/fsl-mc/bus/Kconfig 
b/drivers/staging/fsl-mc/bus/Kconfig
index 5c009ab..a10aaf0 100644
--- a/drivers/staging/fsl-mc/bus/Kconfig
+++ b/drivers/staging/fsl-mc/bus/Kconfig
@@ -15,3 +15,13 @@ config FSL_MC_BUS
  architecture.  The fsl-mc bus driver handles discovery of
  DPAA2 objects (which are represented as Linux devices) and
  binding objects to drivers.
+
+config FSL_MC_DPIO
+tristate "QorIQ DPAA2 DPIO driver"
+depends on FSL_MC_BUS
+help
+ Driver for the DPAA2 DPIO object.  A DPIO provides queue and
+ buffer management facilities for software to interact with
+ other DPAA2 objects. This driver does not expose the DPIO
+ objects individually, but groups them under a service layer
+ API.
diff --git a/drivers/staging/fsl-mc/bus/Makefile 
b/drivers/staging/fsl-mc/bus/Makefile
index 38716fd..577e9fa 100644
--- a/drivers/staging/fsl-mc/bus/Makefile
+++ b/drivers/staging/fsl-mc/bus/Makefile
@@ -18,3 +18,6 @@ mc-bus-driver-objs := fsl-mc-bus.o \
  irq-gic-v3-its-fsl-mc-msi.o \
  dpmcp.o \
  dpbp.o
+
+# MC DPIO driver
+obj-$(CONFIG_FSL_MC_DPIO) += dpio/
diff --git a/drivers/staging/fsl-mc/bus/dpio/Makefile 
b/drivers/staging/fsl-mc/bus/dpio/Makefile
new file mode 100644
index 000..128befc
--- /dev/null
+++ b/drivers/staging/fsl-mc/bus/dpio/Makefile
@@ -0,0 +1,9 @@
+#
+# QorIQ DPAA2 DPIO driver
+#
+
+subdir-ccflags-y := -Werror
+
+obj-$(CONFIG_FSL_MC_DPIO) += fsl-mc-dpio.o
+
+fsl-mc-dpio-objs := dpio.o
diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio-cmd.h 
b/drivers/staging/fsl-mc/bus/dpio/dpio-cmd.h
new file mode 100644
index 000..c237d5f
--- /dev/null
+++ b/drivers/staging/fsl-mc/bus/dpio/dpio-cmd.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2013-2016 Freescale Semiconductor Inc.
+ * Copyright 2016 NXP
+ *
+ * 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 the above-listed copyright holders nor the
+ * names of any 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDERS OR CONTRIBUTORS 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.
+ */
+#ifndef _FSL_DPIO_CMD_H
+#define _FSL_DPIO_CMD_H
+
+/* DPIO Version */
+#define DP

[PATCH v4 0/8] staging: fsl-mc: add dpio driver

2016-12-15 Thread Stuart Yoder
This patch series adds the driver for the DPIO object which is a 
step to addressing the final item in the staging TODO list-- adding
a functional driver on top of the bus driver.  The DPIO driver is a
dependency for other functional drivers such as Ethernet.

An overview of the DPIO object and driver components are in patch 1.
Patches 2-6 are internal components of the DPIO driver-- bit twiddling
of hardware registers, DPAA2 data structures, and the queuing APIs exposed
to other drivers.

Patch 7 adds the fsl-mc driver for the DPIO object.  It provides
the probe/remove functions, demonstrating a working example of
how fsl-mc drivers initialize, interact with the management
complex hardware, map their mappable MMIO regions, initialize
interrupts, register an ISR, etc.  All other DPAA2 drivers will
follow a similar initialization pattern.

version 4 changes
   -removed the patch moving the bus driver out of staging, updated
all paths referenced in dpio (e.g. includes) to be drivers/staging
   -defined macros for constants where needed
   -copyright updates
   -cleanup: fixed whitespace, alignment issues, typos, removed unneeded
comments
   -fixed bug in SDQCR #define
   -adding missing free in an error path

version 3 changes
   -zero memory allocated for a dpio store
   -replace hardcoded dequeue token with a #define and look for
that token when checking for a new result

version 2 changes (mostly feedback from Ioana Radulescu)
   -removed unused structs and defines in dpio command definitions
   -added setter/getter for the FD ctrl field
   -corrected comment for SG format_offset field description
   -added support for short length field in FD
   -fix bug in buffer release command, by setting bpid field
   -handle error (NULL) return value from qbman_swp_mc_complete()
   -fix bug in sending management commands where the verb was
properly initialized
   -use service_select_by_cpu() for re-arming DPIO interrupts
   -replace use of NR_CPUS with num_possible_cpus()
   -handle error case where number of DPIOs exceeds number of possible
CPUs
   -error message cleanup
   -updated MAINTAINERS file with proper location for both fsl-mc bus
driver and dpio driver


Ioana Radulescu (1):
  bus: fsl-mc: dpio: add APIs for DPIO objects

Roy Pledge (6):
  bus: fsl-mc: dpio: add frame descriptor and scatter/gather APIs
  bus: fsl-mc: dpio: add global dpaa2 definitions
  bus: fsl-mc: dpio: add QBMan portal APIs for DPAA2
  bus: fsl-mc: dpio: add the DPAA2 DPIO service interface
  bus: fsl-mc: dpio: add the DPAA2 DPIO object driver
  bus: fsl-mc: dpio: add maintainer for DPIO

Stuart Yoder (1):
  bus: fsl-mc: dpio: add DPIO driver overview document

 MAINTAINERS |6 +
 drivers/staging/fsl-mc/bus/Kconfig  |   10 +
 drivers/staging/fsl-mc/bus/Makefile |3 +
 drivers/staging/fsl-mc/bus/dpio/Makefile|9 +
 drivers/staging/fsl-mc/bus/dpio/dpio-cmd.h  |   76 ++
 drivers/staging/fsl-mc/bus/dpio/dpio-driver.c   |  296 +++
 drivers/staging/fsl-mc/bus/dpio/dpio-driver.txt |  135 +++
 drivers/staging/fsl-mc/bus/dpio/dpio-service.c  |  616 ++
 drivers/staging/fsl-mc/bus/dpio/dpio.c  |  224 +
 drivers/staging/fsl-mc/bus/dpio/dpio.h  |  109 +++
 drivers/staging/fsl-mc/bus/dpio/qbman-portal.c  | 1033 +++
 drivers/staging/fsl-mc/bus/dpio/qbman-portal.h  |  469 ++
 drivers/staging/fsl-mc/include/dpaa2-fd.h   |  448 ++
 drivers/staging/fsl-mc/include/dpaa2-global.h   |  202 +
 drivers/staging/fsl-mc/include/dpaa2-io.h   |  139 +++
 15 files changed, 3775 insertions(+)
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/Makefile
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/dpio-cmd.h
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/dpio-driver.c
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/dpio-driver.txt
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/dpio-service.c
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/dpio.c
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/dpio.h
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/qbman-portal.c
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/qbman-portal.h
 create mode 100644 drivers/staging/fsl-mc/include/dpaa2-fd.h
 create mode 100644 drivers/staging/fsl-mc/include/dpaa2-global.h
 create mode 100644 drivers/staging/fsl-mc/include/dpaa2-io.h

-- 
1.9.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 7/8] bus: fsl-mc: dpio: add the DPAA2 DPIO object driver

2016-12-15 Thread Stuart Yoder
From: Roy Pledge <roy.ple...@nxp.com>

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 <roy.ple...@nxp.com>
Signed-off-by: Haiying Wang <haiying.w...@nxp.com>
Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
---

Notes:
-v4
   -updated copyright
   -adjust file location to be in drivers/staging
   -whitespace alignment cleanup
-v3
   -no changes
-v2
   -handle error case where number of DPIOs > NR_CPUs

 drivers/staging/fsl-mc/bus/dpio/Makefile  |   2 +-
 drivers/staging/fsl-mc/bus/dpio/dpio-driver.c | 296 ++
 2 files changed, 297 insertions(+), 1 deletion(-)
 create mode 100644 drivers/staging/fsl-mc/bus/dpio/dpio-driver.c

diff --git a/drivers/staging/fsl-mc/bus/dpio/Makefile 
b/drivers/staging/fsl-mc/bus/dpio/Makefile
index 0778da7..837d330 100644
--- a/drivers/staging/fsl-mc/bus/dpio/Makefile
+++ b/drivers/staging/fsl-mc/bus/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/staging/fsl-mc/bus/dpio/dpio-driver.c 
b/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c
new file mode 100644
index 000..e36da20
--- /dev/null
+++ b/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c
@@ -0,0 +1,296 @@
+/*
+ * Copyright 2014-2016 Freescale Semiconductor Inc.
+ * Copyright NXP 2016
+ *
+ * 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/mc.h"
+#include "../../include/dpaa2-io.h"
+
+#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(_dev->dev);
+
+   irq = dpio_dev->irqs[0];
+   error = devm_request_irq(_dev->dev,
+irq->msi_desc->irq,
+dpio_irq_handler,
+0,
+dev_name(_dev->dev),
+ 

RE: [PATCH v3 7/9] bus: fsl-mc: dpio: add the DPAA2 DPIO service interface

2016-12-15 Thread Stuart Yoder
> > +struct dpaa2_io *dpaa2_io_create(const struct dpaa2_io_desc *desc)
> > +{
> > +   struct dpaa2_io *obj = kmalloc(sizeof(*obj), GFP_KERNEL);
> > +
> > +   if (!obj)
> > +   return NULL;
> > +
> > +   /* check if CPU is out of range (-1 means any cpu) */
> > +   if (desc->cpu >= num_possible_cpus())
> 
> We leak 'obj' on this error path.

Will fix.

> > +
> > +/**
> > + * dpaa2_io_service_rearm() - Rearm the notification for the given DPIO 
> > service.
> > + * @service: the given DPIO service.
> 
> s/@service/@d/

Will fix.

> > +/**
> > + * dpaa2_io_store_next() - Determine when the next dequeue result is 
> > available.
> > + * @s: the dpaa2_io_store object.
> > + * @is_last: indicate whether this is the last frame in the pull command.
> > + *
> > + * When an object driver performs dequeues to a dpaa2_io_store, this 
> > function
> > + * can be used to determine when the next frame result is available. Once
> > + * this function returns non-NULL, a subsequent call to it will try to find
> > + * the next dequeue result.
> > + *
> > + * Note that if a pull-dequeue has a NULL result because the target 
> > FQ/channel
> > + * was empty, then this function will also return NULL (rather than 
> > expecting
> > + * the caller to always check for this. As such, "is_last" can be used to
> > + * differentiate between "end-of-empty-dequeue" and "still-waiting".
> > + *
> > + * Return dequeue result for a valid dequeue result, or NULL for empty 
> > dequeue.
> > + */
> > +struct dpaa2_dq *dpaa2_io_store_next(struct dpaa2_io_store *s, int 
> > *is_last)
> 
> "bool *is_last"?

Same comment here as on the other patch...let's get Roy's input on this
and make it a TODO if deemed a good idea.

Thanks,
Stuartt

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH v3 5/9] bus: fsl-mc: dpio: add global dpaa2 definitions

2016-12-15 Thread Stuart Yoder


> -Original Message-
> From: Laurentiu Tudor
> Sent: Friday, December 02, 2016 6:19 AM
> To: Stuart Yoder <stuart.yo...@nxp.com>; gre...@linuxfoundation.org
> Cc: de...@driverdev.osuosl.org; linux-ker...@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>
> Subject: Re: [PATCH v3 5/9] bus: fsl-mc: dpio: add global dpaa2 definitions
> 
> On 12/02/2016 12:41 AM, Stuart Yoder wrote:
> > From: Roy Pledge <roy.ple...@nxp.com>
> >
> > Create header for global dpaa2 definitions.  Add definitions
> > for dequeue results.
> >
> > Signed-off-by: Roy Pledge <roy.ple...@nxp.com>
> > Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
> > ---
> >  include/linux/fsl/dpaa2-global.h | 203 
> > +++
> >  1 file changed, 203 insertions(+)
> >  create mode 100644 include/linux/fsl/dpaa2-global.h
> >
> > diff --git a/include/linux/fsl/dpaa2-global.h 
> > b/include/linux/fsl/dpaa2-global.h
> > new file mode 100644
> > index 000..3ee3f29
> > --- /dev/null
> > +++ b/include/linux/fsl/dpaa2-global.h
> > @@ -0,0 +1,203 @@
> > +/*
> > + * 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.
> > + */
> > +#ifndef __FSL_DPAA2_GLOBAL_H
> > +#define __FSL_DPAA2_GLOBAL_H
> > +
> > +#include 
> > +#include 
> > +#include 
> > +
> > +struct dpaa2_dq {
> > +   union {
> > +   struct common {
> > +   u8 verb;
> > +   u8 reserved[63];
> > +   } common;
> > +   struct dq {
> > +   u8 verb;
> > +   u8 stat;
> > +   __le16 seqnum;
> > +   __le16 oprid;
> > +   u8 reserved;
> > +   u8 tok;
> > +   __le32 fqid;
> > +   u32 reserved2;
> > +   __le32 fq_byte_cnt;
> > +   __le32 fq_frm_cnt;
> > +   __le64 fqd_ctx;
> > +   u8 fd[32];
> > +   } dq;
> > +   struct scn {
> > +   u8 verb;
> > +   u8 stat;
> > +   u8 state;
> > +   u8 reserved;
> > +   __le32 rid_tok;
> > +   __le64 ctx;

RE: [PATCH v3 4/9] bus: fsl-mc: dpio: add frame descriptor and scatter/gather APIs

2016-12-15 Thread Stuart Yoder


> -Original Message-
> From: Laurentiu Tudor
> Sent: Friday, December 02, 2016 6:12 AM
> To: Stuart Yoder <stuart.yo...@nxp.com>; gre...@linuxfoundation.org
> Cc: de...@driverdev.osuosl.org; linux-ker...@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>
> Subject: Re: [PATCH v3 4/9] bus: fsl-mc: dpio: add frame descriptor and 
> scatter/gather APIs
> 
> 
> Some more bits and pieces inside.
> 
> ---
> Best Regards, Laurentiu
> 
> On 12/02/2016 12:41 AM, Stuart Yoder wrote:
> > From: Roy Pledge <roy.ple...@nxp.com>
> >
> > Add global definitions for DPAA2 frame descriptors and scatter
> > gather entries.
> >
> > Signed-off-by: Roy Pledge <roy.ple...@nxp.com>
> > Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
> > ---
> >
> > Notes:
> > -v3
> >-no changes
> > -v2
> >-added setter/getter for the FD ctrl field
> >-corrected comment for SG format_offset field description
> >-added support for short length field in FD
> >
> >  include/linux/fsl/dpaa2-fd.h | 448 
> > +++
> >  1 file changed, 448 insertions(+)
> >  create mode 100644 include/linux/fsl/dpaa2-fd.h
> >
> > diff --git a/include/linux/fsl/dpaa2-fd.h b/include/linux/fsl/dpaa2-fd.h
> > new file mode 100644
> > index 000..182c8f4
> > --- /dev/null
> > +++ b/include/linux/fsl/dpaa2-fd.h
> > @@ -0,0 +1,448 @@
> > +/*
> > + * 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.
> > + */
> > +#ifndef __FSL_DPAA2_FD_H
> > +#define __FSL_DPAA2_FD_H
> > +
> > +#include 
> > +
> > +/**
> > + * DOC: DPAA2 FD - Frame Descriptor APIs for DPAA2
> > + *
> > + * Frame Descriptors (FDs) are used to describe frame data in the DPAA2.
> > + * Frames can be enqueued and dequeued to Frame Queues (FQs) which are 
> > consumed
> > + * by the various DPAA accelerators (WRIOP, SEC, PME, DCE)
> > + *
> > + * There are three types of frames: single, scatter gather, and frame 
> > lists.
> > + *
> > + * The set of APIs in this file must be used to create, manipulate and
> > + * query Frame Descriptors.
> > + */
> > +
> > +/**
> > + * struct dpaa2_fd - Struct describing FDs
> > + * @words: for easier/faster copyi

RE: [PATCH v3 3/9] bus: fsl-mc: dpio: add APIs for DPIO objects

2016-12-15 Thread Stuart Yoder
> > +#define DPIO_CMD(id)   ((id << DPIO_CMD_ID_OFFSET) | 
> > DPIO_CMD_BASE_VERSION)
> 
> Paranthesis around 'id'?

In all cases these are opcode values and will never be an expression.  If
we really need to future proof these definitions, we should do it for all
objects not just DPIO.  I'd like to see consistency across objects and don't
want to see DPIO gratuitously diverge.  So, my suggestion is to have an
offline discussion and if we think the change is needed, submit a patch for
all objects currently supported.

> > +   /* prepare command */
> > +   cmd.header = mc_encode_cmd_header(DPIO_CMDID_OPEN,
> > + cmd_flags,
> > + 0);
> > +   dpio_cmd = (struct dpio_cmd_open *)cmd.params;
> > +   dpio_cmd->dpio_id = cpu_to_le32(dpio_id);
> > +
> > +   /* send command to mc*/
> > +   err = mc_send_command(mc_io, );
> > +   if (err)
> > +   return err;
> > +
> > +   /* retrieve response parameters */
> > +   *token = mc_cmd_hdr_read_token();
> 
> Nit: maybe we should drop these repetitive "prepare / send / retrieve" 
> comments
> as the code is pretty self explanatory.

The 'send' comment certainly isn't needed given that the function
is 'mc_send_command()'.  For the others, I think having some comment
is helpful, even though a bit repetitive.

Stuart
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH v3 1/9] staging: fsl-mc: move bus driver out of staging

2016-12-09 Thread Stuart Yoder
> > > Where is the device freed?  I see you trying to do some "odd" stuff in
> > > fsl_mc_device_remove() by deleting and then putting a device structure.
> > > I can't find a "release()" callback anywhere for your bus, where is it?
> > >
> > > What happens when the reference count falls to 0 for your struct device?
> >
> > Hrm...something seems wrong in free path, and I think this needs to
> > be refactored.
> >
> > IIRC, when German (former maintainer) wrote that code he loosely based
> > it on the register/unregister platform bus code:
> >
> > int platform_device_register(struct platform_device *pdev)
> > {
> > device_initialize(>dev);
> > arch_setup_pdev_archdata(pdev);
> > return platform_device_add(pdev);
> > }
> > void platform_device_unregister(struct platform_device *pdev)
> > {
> > platform_device_del(pdev);
> > platform_device_put(pdev);
> > }
> >
> > ...I'm puzzling over how that code handles a refcount of zero
> > as I see no 'release' callback anywhere, but I must be missing
> > something.
> >
> > In any case, we'll get this refactored.
> 
> Have you tried removing a device?  The kernel should complain loudly
> about there not being a release function for your device.

Yes, device removal has been working from day 1.  A brief look
seems to indicate that the ref count never goes to zero, which
needs to be debugged.

Thanks,
Stuart
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH v3 1/9] staging: fsl-mc: move bus driver out of staging

2016-12-08 Thread Stuart Yoder
> -Original Message-
> From: Greg KH [mailto:gre...@linuxfoundation.org]
> Sent: Thursday, December 08, 2016 10:05 AM
> To: Stuart Yoder <stuart.yo...@nxp.com>
> Cc: de...@driverdev.osuosl.org; ag...@suse.de; a...@arndb.de; 
> linux-ker...@vger.kernel.org; Leo Li
> <leoyang...@nxp.com>; Catalin Horghidan <catalin.horghi...@nxp.com>; Ioana 
> Ciornei
> <ioana.cior...@nxp.com>; Laurentiu Tudor <laurentiu.tu...@nxp.com>
> Subject: Re: [PATCH v3 1/9] staging: fsl-mc: move bus driver out of staging
> 
> On Wed, Dec 07, 2016 at 08:19:20PM +, Stuart Yoder wrote:
> > > -Original Message-
> > > From: Greg KH [mailto:gre...@linuxfoundation.org]
> > > Sent: Wednesday, December 07, 2016 9:53 AM
> > > To: Stuart Yoder <stuart.yo...@nxp.com>
> > > Cc: de...@driverdev.osuosl.org; linux-ker...@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>; Laurentiu Tudor <laurentiu.tu...@nxp.com>; 
> > > Ruxandra Ioana Radulescu
> > > <ruxandra.radule...@nxp.com>
> > > Subject: Re: [PATCH v3 1/9] staging: fsl-mc: move bus driver out of 
> > > staging
> > >
> > > On Thu, Dec 01, 2016 at 04:41:26PM -0600, Stuart Yoder wrote:
> > > > Move the source files out of staging into their final locations:
> > > >   -include files in drivers/staging/fsl-mc/include go to 
> > > > include/linux/fsl
> > > >   -irq-gic-v3-its-fsl-mc-msi.c goes to drivers/irqchip
> > > >   -source in drivers/staging/fsl-mc/bus goes to drivers/bus/fsl-mc
> > > >   -README.txt, providing and overview of DPAA goes to
> > > >Documentation/dpaa2/overview.txt
> > > >   -update MAINTAINERS with new location
> > > >
> > > > Delete other remaining staging files-- Makefile, Kconfig, TODO
> > >
> > > Ok, given that I haven't ever reviewed this code, I had a few questions
> > > that I couldn't easily figure out by looking at your code:
> > >   - what is the lifecycle of your 'struct device' usage?  Who
> > > creates it, who frees it, and who accesses it?
> >
> > We embed a 'struct device' inside our bus specific device struct
> > 'struct fsl_mc_device'.  So, when a new fsl-mc object is discovered
> > on the bus during initial enumeration or hotplug we create a new
> > 'struct fsl_mc_device' and do a device_initialize()/device_add().
> > (see fsl_mc_device_add() for where this is done)
> >
> > 'struct device' is freed when a device is removed-- the reverse
> > of the above.
> 
> Where is the device freed?  I see you trying to do some "odd" stuff in
> fsl_mc_device_remove() by deleting and then putting a device structure.
> I can't find a "release()" callback anywhere for your bus, where is it?
> 
> What happens when the reference count falls to 0 for your struct device?

Hrm...something seems wrong in free path, and I think this needs to
be refactored.

IIRC, when German (former maintainer) wrote that code he loosely based
it on the register/unregister platform bus code:

int platform_device_register(struct platform_device *pdev)
{
device_initialize(>dev);
arch_setup_pdev_archdata(pdev);
return platform_device_add(pdev);
}
void platform_device_unregister(struct platform_device *pdev)
{
platform_device_del(pdev);
platform_device_put(pdev);
}

...I'm puzzling over how that code handles a refcount of zero
as I see no 'release' callback anywhere, but I must be missing
something.

In any case, we'll get this refactored.

> > >   - root_dprc_count, why are you using an atomic variable for
> > > this?  What is it for other than "look, I'm running!"?
> >
> > There can be multiple root buses, and this variable simply tracks the count
> > of them.
> 
> Why does it matter?
> 
> > It's is atomic there might be a theoretical race condition where 2
> > buses might be added at the same time.  The root buses are found in
> > the device tree and so if there is no chance that device tree
> > processing happens in parallel on multiple cores then we could remove
> > the atomic.
> 
> Why not just use a lock, or better yet, not care about a "count" at all?
> I don't see you doing anything with the count, other than emitting a
> WARN() if it drops down below 0 for some reason, or when you call
> fsl_mc_bus_exists() which for some reason is exported yet no one uses
> it...

We can drop this c

[PATCH] staging: fsl-mc: remove unnecessary info prints from bus driver

2016-12-07 Thread Stuart Yoder
remove pr_info/dev_info prints that add unnecessary verbosity

Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
---
 drivers/staging/fsl-mc/bus/fsl-mc-bus.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c 
b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
index f9fed63..5ac373c 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
@@ -231,7 +231,6 @@ int __fsl_mc_driver_register(struct fsl_mc_driver 
*mc_driver,
return error;
}
 
-   pr_info("driver %s registered\n", mc_driver->driver.name);
return 0;
 }
 EXPORT_SYMBOL_GPL(__fsl_mc_driver_register);
@@ -731,8 +730,6 @@ static int fsl_mc_bus_probe(struct platform_device *pdev)
struct mc_version mc_version;
struct resource res;
 
-   dev_info(>dev, "root DPRC probed");
-
mc = devm_kzalloc(>dev, sizeof(*mc), GFP_KERNEL);
if (!mc)
return -ENOMEM;
@@ -822,7 +819,6 @@ static int fsl_mc_bus_remove(struct platform_device *pdev)
fsl_destroy_mc_io(mc->root_mc_bus_dev->mc_io);
mc->root_mc_bus_dev->mc_io = NULL;
 
-   dev_info(>dev, "root DPRC removed");
return 0;
 }
 
@@ -861,8 +857,6 @@ static int __init fsl_mc_bus_driver_init(void)
goto error_cleanup_cache;
}
 
-   pr_info("bus type registered\n");
-
error = platform_driver_register(_mc_bus_driver);
if (error < 0) {
pr_err("platform_driver_register() failed: %d\n", error);
-- 
1.9.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: fsl-mc: add sysfs ABI doc

2016-12-07 Thread Stuart Yoder
define the bind/unbind sysfs interfaces for the fsl-mc bus

Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
---
 Documentation/ABI/testing/sysfs-bus-fsl-mc | 21 +
 1 file changed, 21 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-fsl-mc

diff --git a/Documentation/ABI/testing/sysfs-bus-fsl-mc 
b/Documentation/ABI/testing/sysfs-bus-fsl-mc
new file mode 100644
index 000..80256b8
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-bus-fsl-mc
@@ -0,0 +1,21 @@
+What:  /sys/bus/fsl-mc/drivers/.../bind
+Date:  December 2016
+Contact:   stuart.yo...@nxp.com
+Description:
+   Writing a device location to this file will cause
+   the driver to attempt to bind to the device found at
+   this location. The format for the location is Object.Id
+   and is the same as found in /sys/bus/fsl-mc/devices/.
+For example:
+   # echo dpni.2 > /sys/bus/fsl-mc/drivers/fsl_dpaa2_eth/bind
+
+What:  /sys/bus/fsl-mc/drivers/.../unbind
+Date:  December 2016
+Contact:   stuart.yo...@nxp.com
+Description:
+   Writing a device location to this file will cause the
+   driver to attempt to unbind from the device found at
+   this location. The format for the location is Object.Id
+   and is the same as found in /sys/bus/fsl-mc/devices/.
+For example:
+   # echo dpni.2 > /sys/bus/fsl-mc/drivers/fsl_dpaa2_eth/unbind
-- 
1.9.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH v3 1/9] staging: fsl-mc: move bus driver out of staging

2016-12-07 Thread Stuart Yoder
> -Original Message-
> From: Greg KH [mailto:gre...@linuxfoundation.org]
> Sent: Wednesday, December 07, 2016 9:53 AM
> To: Stuart Yoder <stuart.yo...@nxp.com>
> Cc: de...@driverdev.osuosl.org; linux-ker...@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>; Laurentiu Tudor <laurentiu.tu...@nxp.com>; 
> Ruxandra Ioana Radulescu
> <ruxandra.radule...@nxp.com>
> Subject: Re: [PATCH v3 1/9] staging: fsl-mc: move bus driver out of staging
> 
> On Thu, Dec 01, 2016 at 04:41:26PM -0600, Stuart Yoder wrote:
> > Move the source files out of staging into their final locations:
> >   -include files in drivers/staging/fsl-mc/include go to include/linux/fsl
> >   -irq-gic-v3-its-fsl-mc-msi.c goes to drivers/irqchip
> >   -source in drivers/staging/fsl-mc/bus goes to drivers/bus/fsl-mc
> >   -README.txt, providing and overview of DPAA goes to
> >Documentation/dpaa2/overview.txt
> >   -update MAINTAINERS with new location
> >
> > Delete other remaining staging files-- Makefile, Kconfig, TODO
> 
> Ok, given that I haven't ever reviewed this code, I had a few questions
> that I couldn't easily figure out by looking at your code:
>   - what is the lifecycle of your 'struct device' usage?  Who
> creates it, who frees it, and who accesses it?

We embed a 'struct device' inside our bus specific device struct
'struct fsl_mc_device'.  So, when a new fsl-mc object is discovered
on the bus during initial enumeration or hotplug we create a new
'struct fsl_mc_device' and do a device_initialize()/device_add().
(see fsl_mc_device_add() for where this is done)

'struct device' is freed when a device is removed-- the reverse
of the above.

As far as who accesses it... fsl-mc device drivers will reference
the 'struct device' when registering interrupts, when calling
functions like devm*, dev_err(), and for maintaining driver
private data in 'driver_data'.

Example of registering an irq where you can see the embedded
struct dev (dpio_dev->dev) referenced:

error = devm_request_irq(_dev->dev,
 irq->msi_desc->irq,
 dpio_irq_handler,
 0,
 dev_name(_dev->dev),
 _dev->dev);

>   - do you have any Documentation/ABI entries?

Not currently, but it looks like we need ones for bind/unbind.
I will submit a patch to document these.

>   - root_dprc_count, why are you using an atomic variable for
> this?  What is it for other than "look, I'm running!"?

There can be multiple root buses, and this variable simply tracks the count
of them.  It's is atomic there might be a theoretical race condition where
2 buses might be added at the same time.  The root buses are found in the
device tree and so if there is no chance that device tree processing happens
in parallel on multiple cores then we could remove the atomic.

>   - don't call pr_info() in fsl_mc_bus_driver_init(), no need to
> say anything if all goes well.  Same goes with random
> dev_info() calls, please remove.

Ok, will do.

Thanks,
Stuart
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH 7/8] staging: fsl-dpaa2/eth: Add TODO file

2016-12-06 Thread Stuart Yoder


> -Original Message-
> From: Greg KH [mailto:gre...@linuxfoundation.org]
> Sent: Tuesday, December 06, 2016 11:56 AM
> To: Stuart Yoder <stuart.yo...@nxp.com>
> Cc: Ruxandra Ioana Radulescu <ruxandra.radule...@nxp.com>; 
> de...@driverdev.osuosl.org; linux-
> ker...@vger.kernel.org; ag...@suse.de; a...@arndb.de; Alexandru Marginean 
> <alexandru.margin...@nxp.com>;
> Bogdan Hamciuc <bogdan.hamc...@nxp.com>; Roy Pledge <roy.ple...@nxp.com>; 
> Laurentiu Tudor
> <laurentiu.tu...@nxp.com>
> Subject: Re: [PATCH 7/8] staging: fsl-dpaa2/eth: Add TODO file
> 
> On Tue, Dec 06, 2016 at 12:59:59PM +, Stuart Yoder wrote:
> >
> >
> > > -Original Message-
> > > From: Greg KH [mailto:gre...@linuxfoundation.org]
> > > Sent: Tuesday, December 06, 2016 4:20 AM
> > > To: Ruxandra Ioana Radulescu <ruxandra.radule...@nxp.com>
> > > Cc: de...@driverdev.osuosl.org; linux-ker...@vger.kernel.org; 
> > > ag...@suse.de; a...@arndb.de;
> Alexandru
> > > Marginean <alexandru.margin...@nxp.com>; Bogdan Hamciuc 
> > > <bogdan.hamc...@nxp.com>; Stuart Yoder
> > > <stuart.yo...@nxp.com>; Roy Pledge <roy.ple...@nxp.com>; Laurentiu Tudor 
> > > <laurentiu.tu...@nxp.com>
> > > Subject: Re: [PATCH 7/8] staging: fsl-dpaa2/eth: Add TODO file
> > >
> > > On Tue, Dec 06, 2016 at 10:06:25AM +, Ruxandra Ioana Radulescu wrote:
> > > > > -Original Message-
> > > > > From: Greg KH [mailto:gre...@linuxfoundation.org]
> > > > > Sent: Tuesday, December 06, 2016 11:58 AM
> > > > > To: Ruxandra Ioana Radulescu <ruxandra.radule...@nxp.com>
> > > > > Cc: de...@driverdev.osuosl.org; linux-ker...@vger.kernel.org;
> > > > > ag...@suse.de; a...@arndb.de; Alexandru Marginean
> > > > > <alexandru.margin...@nxp.com>; Bogdan Hamciuc
> > > > > <bogdan.hamc...@nxp.com>; Stuart Yoder <stuart.yo...@nxp.com>; Roy
> > > > > Pledge <roy.ple...@nxp.com>; Laurentiu Tudor
> > > > > <laurentiu.tu...@nxp.com>
> > > > > Subject: Re: [PATCH 7/8] staging: fsl-dpaa2/eth: Add TODO file
> > > > >
> > > > > On Tue, Dec 06, 2016 at 03:34:41AM -0600, Ioana Radulescu wrote:
> > > > > > Add a list of TODO items for the Ethernet driver
> > > > > >
> > > > > > Signed-off-by: Ioana Radulescu <ruxandra.radule...@nxp.com>
> > > > > > ---
> > > > > >  drivers/staging/fsl-dpaa2/ethernet/TODO |9 +
> > > > > >  1 files changed, 9 insertions(+), 0 deletions(-)
> > > > > >  create mode 100644 drivers/staging/fsl-dpaa2/ethernet/TODO
> > > > > >
> > > > > > diff --git a/drivers/staging/fsl-dpaa2/ethernet/TODO 
> > > > > > b/drivers/staging/fsl-
> > > > > dpaa2/ethernet/TODO
> > > > > > new file mode 100644
> > > > > > index 000..833265b
> > > > > > --- /dev/null
> > > > > > +++ b/drivers/staging/fsl-dpaa2/ethernet/TODO
> > > > > > @@ -0,0 +1,9 @@
> > > > > > +* Add a DPAA2 MAC kernel driver in order to allow PHY management;
> > > > > currently
> > > > > > +  the DPMAC objects and their link to DPNIs are handled by MC 
> > > > > > internally
> > > > > > +  and all PHYs are seen as fixed-link
> > > > > > +* add more debug support: decide how to expose detailed debug
> > > > > statistics,
> > > > > > +  add ingress error queue support
> > > > > > +* MC firmware uprev; the DPAA2 objects used by the Ethernet driver
> > > > > need to
> > > > > > +  be kept in sync with binary interface changes in MC
> > > > > > +* refine README file
> > > > > > +* cleanup
> > > > >
> > > > > These seem like very minor things, why not just spend a week and do 
> > > > > this
> > > > > work and get it merged to the "correct" portion of the kernel tree?  
> > > > > Why
> > > > > does this have to go into staging?
> > > >
> > > > Actually the first bullet is not minor at all and requires some design
> > > > choices that we aren't yet completely clear with, and which in turn may
> > > > affect parts of the Ethernet driver. We figured it would be best to try

RE: [PATCH 7/8] staging: fsl-dpaa2/eth: Add TODO file

2016-12-06 Thread Stuart Yoder


> -Original Message-
> From: Greg KH [mailto:gre...@linuxfoundation.org]
> Sent: Tuesday, December 06, 2016 4:20 AM
> To: Ruxandra Ioana Radulescu <ruxandra.radule...@nxp.com>
> Cc: de...@driverdev.osuosl.org; linux-ker...@vger.kernel.org; ag...@suse.de; 
> a...@arndb.de; Alexandru
> Marginean <alexandru.margin...@nxp.com>; Bogdan Hamciuc 
> <bogdan.hamc...@nxp.com>; Stuart Yoder
> <stuart.yo...@nxp.com>; Roy Pledge <roy.ple...@nxp.com>; Laurentiu Tudor 
> <laurentiu.tu...@nxp.com>
> Subject: Re: [PATCH 7/8] staging: fsl-dpaa2/eth: Add TODO file
> 
> On Tue, Dec 06, 2016 at 10:06:25AM +, Ruxandra Ioana Radulescu wrote:
> > > -Original Message-
> > > From: Greg KH [mailto:gre...@linuxfoundation.org]
> > > Sent: Tuesday, December 06, 2016 11:58 AM
> > > To: Ruxandra Ioana Radulescu <ruxandra.radule...@nxp.com>
> > > Cc: de...@driverdev.osuosl.org; linux-ker...@vger.kernel.org;
> > > ag...@suse.de; a...@arndb.de; Alexandru Marginean
> > > <alexandru.margin...@nxp.com>; Bogdan Hamciuc
> > > <bogdan.hamc...@nxp.com>; Stuart Yoder <stuart.yo...@nxp.com>; Roy
> > > Pledge <roy.ple...@nxp.com>; Laurentiu Tudor
> > > <laurentiu.tu...@nxp.com>
> > > Subject: Re: [PATCH 7/8] staging: fsl-dpaa2/eth: Add TODO file
> > >
> > > On Tue, Dec 06, 2016 at 03:34:41AM -0600, Ioana Radulescu wrote:
> > > > Add a list of TODO items for the Ethernet driver
> > > >
> > > > Signed-off-by: Ioana Radulescu <ruxandra.radule...@nxp.com>
> > > > ---
> > > >  drivers/staging/fsl-dpaa2/ethernet/TODO |9 +
> > > >  1 files changed, 9 insertions(+), 0 deletions(-)
> > > >  create mode 100644 drivers/staging/fsl-dpaa2/ethernet/TODO
> > > >
> > > > diff --git a/drivers/staging/fsl-dpaa2/ethernet/TODO 
> > > > b/drivers/staging/fsl-
> > > dpaa2/ethernet/TODO
> > > > new file mode 100644
> > > > index 000..833265b
> > > > --- /dev/null
> > > > +++ b/drivers/staging/fsl-dpaa2/ethernet/TODO
> > > > @@ -0,0 +1,9 @@
> > > > +* Add a DPAA2 MAC kernel driver in order to allow PHY management;
> > > currently
> > > > +  the DPMAC objects and their link to DPNIs are handled by MC 
> > > > internally
> > > > +  and all PHYs are seen as fixed-link
> > > > +* add more debug support: decide how to expose detailed debug
> > > statistics,
> > > > +  add ingress error queue support
> > > > +* MC firmware uprev; the DPAA2 objects used by the Ethernet driver
> > > need to
> > > > +  be kept in sync with binary interface changes in MC
> > > > +* refine README file
> > > > +* cleanup
> > >
> > > These seem like very minor things, why not just spend a week and do this
> > > work and get it merged to the "correct" portion of the kernel tree?  Why
> > > does this have to go into staging?
> >
> > Actually the first bullet is not minor at all and requires some design
> > choices that we aren't yet completely clear with, and which in turn may
> > affect parts of the Ethernet driver. We figured it would be best to try
> > adding this in staging first (and also provide this way an example of using
> > the fsl-mc bus and dpio driver) than wait until all MAC development
> > questions are ironed-out.
> 
> Ok, that makes sense.
> 
> > I can remove the other bullets from the TODO list if you think they're
> > not worth mentioning.
> 
> No, they should be mentioned, I just didn't think they are all that much
> work, and if you didn't have major things needed to get done, you could
> just knock it all out in a week of local development.
> 
> I'll look into taking this into the tree later today...

Note, as mentioned in the cover letter, in it's current form this patch
series is based on the series:
[PATCH v3 0/9] staging: fsl-mc: move bus driver out of staging, add dpio

...which means that it won't build or run without that series being
applied first, due to header file dependencies.  It also functionally
depends on the DPIO driver.  So we need the dpio driver merged first.

Is moving the fsl-mc bus driver out of staging a possibility now?

Seems like there are several options--
A.  Keep bus driver in drivers/staging for now, create new series to
add dpio driver into staging, add fsl-dpaa2/eth into staging and
refactor it to assume include dependencies in staging directories.
B.  Apply the series:
[PATCH v3 0/9] staging: fsl-mc: move bus driver out of staging, add dpio
...in something close to it's current form.  There is some minor 
feedback on the dpio driver that will require a v4, which I can
send in the next day or so.

The fsl-mc bus driver to do list is complete, with the exception
of demonstrating a functional driver on top of the bus driver,
and as described in the cover letter of the "move bus driver out
of staging" series the dpio driver demonstrates what an fsl-mc
device driver looks like.

Thanks,
Stuart



___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 1/9] staging: fsl-mc: move bus driver out of staging

2016-12-01 Thread Stuart Yoder
Move the source files out of staging into their final locations:
  -include files in drivers/staging/fsl-mc/include go to include/linux/fsl
  -irq-gic-v3-its-fsl-mc-msi.c goes to drivers/irqchip
  -source in drivers/staging/fsl-mc/bus goes to drivers/bus/fsl-mc
  -README.txt, providing and overview of DPAA goes to
   Documentation/dpaa2/overview.txt
  -update MAINTAINERS with new location

Delete other remaining staging files-- Makefile, Kconfig, TODO

Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
---

Notes:
-v3
  -no changes
-v2
  -updated MAINTAINERS with new location

 .../README.txt => Documentation/dpaa2/overview.txt |  0
 MAINTAINERS|  2 +-
 drivers/bus/Kconfig|  3 +++
 drivers/bus/Makefile   |  3 +++
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/Kconfig |  0
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/Makefile|  1 -
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp-cmd.h  |  0
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp.c  |  6 +++---
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpcon-cmd.h |  0
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp-cmd.h |  0
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp.c |  5 +++--
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp.h |  0
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmng-cmd.h |  0
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmng.c |  6 +++---
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc-cmd.h  |  0
 .../{staging/fsl-mc/bus => bus/fsl-mc}/dprc-driver.c   |  4 ++--
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc.c  |  6 +++---
 .../fsl-mc/bus => bus/fsl-mc}/fsl-mc-allocator.c   |  4 ++--
 .../{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-bus.c|  6 +++---
 .../{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-msi.c|  2 +-
 .../fsl-mc/bus => bus/fsl-mc}/fsl-mc-private.h |  4 ++--
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-io.c |  4 ++--
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-sys.c|  6 +++---
 drivers/irqchip/Makefile   |  1 +
 .../fsl-mc/bus => irqchip}/irq-gic-v3-its-fsl-mc-msi.c |  2 +-
 drivers/staging/Kconfig|  2 --
 drivers/staging/Makefile   |  1 -
 drivers/staging/fsl-mc/Kconfig |  1 -
 drivers/staging/fsl-mc/Makefile|  2 --
 drivers/staging/fsl-mc/TODO| 18 --
 .../fsl-mc/include => include/linux/fsl}/dpbp.h|  0
 .../fsl-mc/include => include/linux/fsl}/dpmng.h   |  0
 .../fsl-mc/include => include/linux/fsl}/dprc.h|  0
 .../fsl-mc/include => include/linux/fsl}/mc-bus.h  |  2 +-
 .../fsl-mc/include => include/linux/fsl}/mc-cmd.h  |  0
 .../fsl-mc/include => include/linux/fsl}/mc-sys.h  |  0
 .../staging/fsl-mc/include => include/linux/fsl}/mc.h  |  2 +-
 37 files changed, 38 insertions(+), 55 deletions(-)
 rename drivers/staging/fsl-mc/README.txt => Documentation/dpaa2/overview.txt 
(100%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/Kconfig (100%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/Makefile (91%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp-cmd.h (100%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpcon-cmd.h (100%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp-cmd.h (100%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp.h (100%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmng-cmd.h (100%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmng.c (96%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc-cmd.h (100%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc-driver.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-allocator.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-bus.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-msi.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-private.h (96%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-io.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-sys.c (99%)
 rename drivers/{staging/fsl-mc/bus => irqchip}/irq-gic-v3-its-fsl-mc-msi.c 
(99%)
 delete mode 100644 drivers/staging/fsl-mc/Kconfig
 delete mode 100644 drivers/staging/fsl-mc/Makefile
 delete mode 100644 drivers/staging/fsl-mc/TODO
 rename {drivers/staging/fsl-mc/include => include/linux/fsl}/dpbp.h (100%)
 rename {drivers/staging/fsl-mc/include => include/linux/fsl}/dpmng.h (100%)
 rename {drivers/staging/fsl-mc/i

[PATCH v3 2/9] bus: fsl-mc: dpio: add DPIO driver overview document

2016-12-01 Thread Stuart Yoder
add document describing the dpio driver and it's role, components
and major interfaces

Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
---
 Documentation/dpaa2/dpio-driver.txt | 135 
 1 file changed, 135 insertions(+)
 create mode 100644 Documentation/dpaa2/dpio-driver.txt

diff --git a/Documentation/dpaa2/dpio-driver.txt 
b/Documentation/dpaa2/dpio-driver.txt
new file mode 100644
index 000..5c192b3
--- /dev/null
+++ b/Documentation/dpaa2/dpio-driver.txt
@@ -0,0 +1,135 @@
+Copyright (C) 2016 Freescale Semiconductor Inc.
+
+Introduction
+
+
+A DPAA2 DPIO (Data Path I/O) is a hardware object that provides
+interfaces to enqueue and dequeue frames to/from network interfaces
+and other accelerators.  A DPIO also provides hardware buffer
+pool management for network interfaces.
+
+This document provides an overview the Linux DPIO driver, its
+subcomponents, and its APIs.
+
+See Documentation/dpaa2/overview.txt for a general overview of DPAA2
+and the general DPAA2 driver architecture in Linux.
+
+Driver Overview
+---
+
+The DPIO driver is bound to DPIO objects discovered on the fsl-mc bus and
+provides services that:
+  A) allow other drivers, such as the Ethernet driver, to enqueue and dequeue
+ frames for their respective objects
+  B) allow drivers to register callbacks for data availability notifications
+ when data becomes available on a queue or channel
+  C) allow drivers to manage hardware buffer pools
+
+The Linux DPIO driver consists of 3 primary components--
+   DPIO object driver-- fsl-mc driver that manages the DPIO object
+   DPIO service-- provides APIs to other Linux drivers for services
+   QBman portal interface-- sends portal commands, gets responses
+
+  fsl-mc  other
+   bus   drivers
+|   |
++---++   +--+-+
+|DPIO obj|   |DPIO service|
+| driver |---|  (DPIO)|
+++   +--+-+
+|
+ +--+-+
+ |QBman   |
+ | portal i/f |
+ ++
+|
+ hardware
+
+The diagram below shows how the DPIO driver components fit with the other
+DPAA2 Linux driver components:
+   ++
+   | OS Network |
+   |   Stack|
+ ++++
+ | Allocator  |. . . . . . .   |  Ethernet  |
+ |(DPMCP,DPBP)||   (DPNI)   |
+ +-.--++---+---++
+  .  . ^   |
+ ..|   | dequeue>
++-+ .  |   |
+| DPRC driver |  .++ ++
+|   (DPRC)|   . . |DPIO obj| |DPIO service|
++--+--+   | driver |-|  (DPIO)|
+   |  ++ +--+-+
+   | +--|-+
+   | |   QBman|
+  ++--+  | portal i/f |
+  |   MC-bus driver   |  ++
+  |   | |
+  | /soc/fsl-mc   | |
+  +---+ |
+|
+ =|=|
++-+--DPIO---|---+
+|   |   |
+|QBman Portal   |
++---+
+
+ 
+
+
+DPIO Object Driver (dpio-driver.c)
+--
+
+   The dpio-driver component registers with the fsl-mc bus to handle objects of
+   type "dpio".  The implementation of probe() handles basic initialization
+   of the DPIO including mapping of the DPIO regions (the QBman SW portal)
+   and initializing interrupts and registering irq handlers.  The dpio-driver
+   registers the probed DPIO with dpio-service.
+
+DPIO service  (dpio-service.c, dpaa2-io.h)
+--
+
+   The dpio service component provides queuing, notification, and buffers
+   management services to DPAA2 drivers, such as the Ethernet driver.  A system
+   will typically allocate 1 DPIO object per CPU to allow queuing operations
+   to happen simultaneou

[PATCH v3 3/9] bus: fsl-mc: dpio: add APIs for DPIO objects

2016-12-01 Thread Stuart Yoder
From: Ioana Radulescu <ruxandra.radule...@nxp.com>

Add the command build/parse APIs for operating on DPIO objects through
the DPAA2 Management Complex.

Signed-off-by: Ioana Radulescu <ruxandra.radule...@nxp.com>
Signed-off-by: Roy Pledge <roy.ple...@nxp.com>
Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
---

Notes:
-v3
  -no changes
-v2
  -removed unused structs and defines

 drivers/bus/fsl-mc/Kconfig |  10 ++
 drivers/bus/fsl-mc/Makefile|   3 +
 drivers/bus/fsl-mc/dpio/Makefile   |   9 ++
 drivers/bus/fsl-mc/dpio/dpio-cmd.h |  75 
 drivers/bus/fsl-mc/dpio/dpio.c | 229 +
 drivers/bus/fsl-mc/dpio/dpio.h | 108 +
 6 files changed, 434 insertions(+)
 create mode 100644 drivers/bus/fsl-mc/dpio/Makefile
 create mode 100644 drivers/bus/fsl-mc/dpio/dpio-cmd.h
 create mode 100644 drivers/bus/fsl-mc/dpio/dpio.c
 create mode 100644 drivers/bus/fsl-mc/dpio/dpio.h

diff --git a/drivers/bus/fsl-mc/Kconfig b/drivers/bus/fsl-mc/Kconfig
index 5c009ab..a10aaf0 100644
--- a/drivers/bus/fsl-mc/Kconfig
+++ b/drivers/bus/fsl-mc/Kconfig
@@ -15,3 +15,13 @@ config FSL_MC_BUS
  architecture.  The fsl-mc bus driver handles discovery of
  DPAA2 objects (which are represented as Linux devices) and
  binding objects to drivers.
+
+config FSL_MC_DPIO
+tristate "QorIQ DPAA2 DPIO driver"
+depends on FSL_MC_BUS
+help
+ Driver for the DPAA2 DPIO object.  A DPIO provides queue and
+ buffer management facilities for software to interact with
+ other DPAA2 objects. This driver does not expose the DPIO
+ objects individually, but groups them under a service layer
+ API.
diff --git a/drivers/bus/fsl-mc/Makefile b/drivers/bus/fsl-mc/Makefile
index d56afee..d18df72 100644
--- a/drivers/bus/fsl-mc/Makefile
+++ b/drivers/bus/fsl-mc/Makefile
@@ -17,3 +17,6 @@ mc-bus-driver-objs := fsl-mc-bus.o \
  fsl-mc-msi.o \
  dpmcp.o \
  dpbp.o
+
+# MC DPIO driver
+obj-$(CONFIG_FSL_MC_DPIO) += dpio/
diff --git a/drivers/bus/fsl-mc/dpio/Makefile b/drivers/bus/fsl-mc/dpio/Makefile
new file mode 100644
index 000..128befc
--- /dev/null
+++ b/drivers/bus/fsl-mc/dpio/Makefile
@@ -0,0 +1,9 @@
+#
+# QorIQ DPAA2 DPIO driver
+#
+
+subdir-ccflags-y := -Werror
+
+obj-$(CONFIG_FSL_MC_DPIO) += fsl-mc-dpio.o
+
+fsl-mc-dpio-objs := dpio.o
diff --git a/drivers/bus/fsl-mc/dpio/dpio-cmd.h 
b/drivers/bus/fsl-mc/dpio/dpio-cmd.h
new file mode 100644
index 000..3464ed9
--- /dev/null
+++ b/drivers/bus/fsl-mc/dpio/dpio-cmd.h
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2013-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 the above-listed copyright holders nor the
+ * names of any 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDERS OR CONTRIBUTORS 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.
+ */
+#ifndef _FSL_DPIO_CMD_H
+#define _FSL_DPIO_CMD_H
+
+/* DPIO Version */
+#define DPIO_VER_MAJOR 4
+#define DPIO_VER_MINOR 2
+
+/* Command Versioning */
+
+#define DPIO_CMD_ID_OFFSET 4
+#define DPIO_CMD_BASE_VERSION  1
+
+#define DPIO_CMD(id)   ((id << DPIO_CMD_ID_OFFSET) | DPIO_CMD_BASE_VERSION)
+
+/* Command IDs */
+#define DPIO_CMDID_CLOSE   

[PATCH v3 6/9] bus: fsl-mc: dpio: add QBMan portal APIs for DPAA2

2016-12-01 Thread Stuart Yoder
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.
+ *
+ * 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_

[PATCH v3 7/9] bus: fsl-mc: dpio: add the DPAA2 DPIO service interface

2016-12-01 Thread Stuart Yoder
From: Roy Pledge <roy.ple...@nxp.com>

The DPIO service interface handles initialization of DPIO objects
and exports APIs to be used by other DPAA2 object drivers to perform
queuing and buffer management related operations.  The service allows
registration of callbacks when frames or notifications are received.

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
   -zero memory allocated for a dpio store (bug fix suggested
by Ioana Radulescu)
-v2
   -use service_select_by_cpu() for re-arming DPIO interrupts
   -replace use of NR_CPUS with num_possible_cpus()

 drivers/bus/fsl-mc/dpio/Makefile   |   2 +-
 drivers/bus/fsl-mc/dpio/dpio-service.c | 614 +
 include/linux/fsl/dpaa2-io.h   | 138 
 3 files changed, 753 insertions(+), 1 deletion(-)
 create mode 100644 drivers/bus/fsl-mc/dpio/dpio-service.c
 create mode 100644 include/linux/fsl/dpaa2-io.h

diff --git a/drivers/bus/fsl-mc/dpio/Makefile b/drivers/bus/fsl-mc/dpio/Makefile
index 6588498..0778da7 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
+fsl-mc-dpio-objs := dpio.o qbman-portal.o dpio-service.o
diff --git a/drivers/bus/fsl-mc/dpio/dpio-service.c 
b/drivers/bus/fsl-mc/dpio/dpio-service.c
new file mode 100644
index 000..01f0293
--- /dev/null
+++ b/drivers/bus/fsl-mc/dpio/dpio-service.c
@@ -0,0 +1,614 @@
+/*
+ * 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 "dpio.h"
+#include "qbman-portal.h"
+
+struct dpaa2_io {
+   atomic_t refs;
+   struct dpaa2_io_desc dpio_desc;
+   struct qbman_swp_desc swp_desc;
+   struct qbman_swp *swp;
+   struct list_head node;
+   spinlock_t lock_mgmt_cmd;
+   spinlock_t lock_notifications;
+   struct list_head notifications;
+};
+
+struct dpaa2_io_store {
+   unsigned int max;
+   dma_addr_t paddr;
+   struct dpaa2_dq *vaddr;
+   void *alloced_addr;/* unaligned value from kmalloc() */
+   unsigned int idx;  /* position of the next-to-be-returned entry */
+   struct qbman_swp *swp; /* portal used to issue VDQCR */
+   struct device *dev;/* device used for DMA mapping */
+};
+
+/* keep a per cpu array of DPIOs for fast access */
+static struct dpaa2_io *dpio_by_cpu[NR_CPUS];
+static struct list_head dpio_list = LIST_HEAD_INIT(dpio_list);
+static DEFINE_SPINLOCK(dpio_list_lock);
+
+static inline struct dpaa2_io *service_select_by_cpu(struct dpaa2_io *d,
+int cpu)
+{
+   if (d)
+   return d;
+
+   if (unlikely(cpu >= num_possible_cpus()))
+   return NULL;
+
+   /*
+* If cpu == -1, choose the current cpu, with no guarantees about
+* potentially being migrated away.
+

[PATCH v3 9/9] bus: fsl-mc: dpio: add maintainer for DPIO

2016-12-01 Thread Stuart Yoder
From: Roy Pledge <roy.ple...@nxp.com>

add Roy Pledge as maintainer of DPIO

Signed-off-by: Roy Pledge <roy.ple...@nxp.com>
Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
---

Notes:
-v3
   -no changes
-v2
   -corrected location of maintainer entry

 MAINTAINERS | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 63b45f4..312c582 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3980,6 +3980,12 @@ S:   Maintained
 F: drivers/char/dtlk.c
 F: include/linux/dtlk.h
 
+DPAA2 DATAPATH I/O (DPIO) DRIVER
+M: Roy Pledge <roy.ple...@nxp.com>
+L: linux-ker...@vger.kernel.org
+S: Maintained
+F: drivers/bus/fsl-mc/dpio
+
 DPT_I2O SCSI RAID DRIVER
 M: Adaptec OEM Raid Solutions <aacr...@adaptec.com>
 L: linux-s...@vger.kernel.org
-- 
1.9.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 4/9] bus: fsl-mc: dpio: add frame descriptor and scatter/gather APIs

2016-12-01 Thread Stuart Yoder
From: Roy Pledge <roy.ple...@nxp.com>

Add global definitions for DPAA2 frame descriptors and scatter
gather entries.

Signed-off-by: Roy Pledge <roy.ple...@nxp.com>
Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
---

Notes:
-v3
   -no changes
-v2
   -added setter/getter for the FD ctrl field
   -corrected comment for SG format_offset field description
   -added support for short length field in FD

 include/linux/fsl/dpaa2-fd.h | 448 +++
 1 file changed, 448 insertions(+)
 create mode 100644 include/linux/fsl/dpaa2-fd.h

diff --git a/include/linux/fsl/dpaa2-fd.h b/include/linux/fsl/dpaa2-fd.h
new file mode 100644
index 000..182c8f4
--- /dev/null
+++ b/include/linux/fsl/dpaa2-fd.h
@@ -0,0 +1,448 @@
+/*
+ * 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.
+ */
+#ifndef __FSL_DPAA2_FD_H
+#define __FSL_DPAA2_FD_H
+
+#include 
+
+/**
+ * DOC: DPAA2 FD - Frame Descriptor APIs for DPAA2
+ *
+ * Frame Descriptors (FDs) are used to describe frame data in the DPAA2.
+ * Frames can be enqueued and dequeued to Frame Queues (FQs) which are consumed
+ * by the various DPAA accelerators (WRIOP, SEC, PME, DCE)
+ *
+ * There are three types of frames: single, scatter gather, and frame lists.
+ *
+ * The set of APIs in this file must be used to create, manipulate and
+ * query Frame Descriptors.
+ */
+
+/**
+ * struct dpaa2_fd - Struct describing FDs
+ * @words: for easier/faster copying the whole FD structure
+ * @addr:  address in the FD
+ * @len:   length in the FD
+ * @bpid:  buffer pool ID
+ * @format_offset: format, offset, and short-length fields
+ * @frc:   frame context
+ * @ctrl:  control bits...including dd, sc, va, err, etc
+ * @flc:   flow context address
+ *
+ * This structure represents the basic Frame Descriptor used in the system.
+ */
+struct dpaa2_fd {
+   union {
+   u32 words[8];
+   struct dpaa2_fd_simple {
+   __le64 addr;
+   __le32 len;
+   __le16 bpid;
+   __le16 format_offset;
+   __le32 frc;
+   __le32 ctrl;
+   __le64 flc;
+   } simple;
+   };
+};
+
+#define FD_SHORT_LEN_FLAG_MASK 0x1
+#define FD_SHORT_LEN_FLAG_SHIFT 14
+#define FD_SHORT_LEN_MASK 0x1
+#define FD_OFFSET_MASK 0x0FFF
+#define FD_FORMAT_MASK 0x3
+#define FD_FORMAT_SHIFT 12
+#define SG_SHORT_LEN_FLAG_MASK 0x1
+#define SG_SHORT_LEN_FLAG_SHIFT 14
+#define SG_SHORT_LEN_MASK 0x1
+#define SG_OFFSET_MASK 0x0FFF
+#define SG_FORMAT_MASK 0x3
+#define SG_FORMAT_SHIFT 12
+#define SG_BPID_MASK 0x3FFF
+#define SG_FINAL_FLAG_MASK 0x1
+#define SG_FINAL_FLAG_SHIFT 15
+
+enum dpaa2_fd_format {
+   dpaa2_fd_single = 0,
+   dpaa2_fd_list,
+   dpaa2_fd_sg
+};
+
+/**
+ * dpaa2_fd_get_addr() - get the addr field of frame descriptor
+ * @fd: the given frame descriptor
+ *
+ * Return the address in the frame descriptor.
+ */
+static inline dma_addr_t dpaa2_fd_get_addr(const struct dpaa2_fd *fd)
+{
+
+   return (dma_addr_t)fd->simple.addr;
+}
+
+/**
+ * dpa

[PATCH v3 8/9] bus: fsl-mc: dpio: add the DPAA2 DPIO object driver

2016-12-01 Thread Stuart Yoder
From: Roy Pledge <roy.ple...@nxp.com>

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 <roy.ple...@nxp.com>
Signed-off-by: Haiying Wang <haiying.w...@nxp.com>
Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
---

Notes:
-v3
   -no changes
-v2
   -handle error case where number of DPIOs > NR_CPUs

 drivers/bus/fsl-mc/dpio/Makefile  |   2 +-
 drivers/bus/fsl-mc/dpio/dpio-driver.c | 295 ++
 2 files changed, 296 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..76261d2
--- /dev/null
+++ b/drivers/bus/fsl-mc/dpio/dpio-driver.c
@@ -0,0 +1,295 @@
+/*
+ * 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(_dev->dev);
+
+   irq = dpio_dev->irqs[0];
+   error = devm_request_irq(_dev->dev,
+irq->msi_desc->irq,
+dpio_irq_handler,
+0,
+dev_name(_dev->dev),
+_dev->dev);
+   if (error < 0) {
+   dev_err(_dev->dev,
+   "devm_request_irq() failed: %d\n",
+   error);
+   return error;
+   }
+
+   /* set the affinity hint */
+

[PATCH v3 0/9] staging: fsl-mc: move bus driver out of staging, add dpio

2016-12-01 Thread Stuart Yoder
This patch series: A) addresses the final item in the staging
TODO list for the fsl-mc bus driver-- adding a functional driver
on top of the bus driver, and B) requests that the fsl-mc bus driver
be moved out of staging.

The proposed destination for the bus driver is drivers/bus.
Proposed location for global header files for fsl-mc and dpaa2
is include/linux/fsl.

The functional driver added is for the DPIO object which provides
queuing services for other DPAA2 drivers.  An overview of the
DPIO object and driver components are in patch 2.  Patches 3-7 are
internal components of the DPIO driver-- bit twiddling of hardware
registers, DPAA2 data structures, and the queuing APIs exposed
to other drivers.

Patch 8 adds the fsl-mc driver for the DPIO object.  It provides
the probe/remove functions, demonstrating a working example of
how fsl-mc drivers initialize, interact with the management
complex hardware, map their mappable MMIO regions, initialize
interrupts, register an ISR, etc.  All other DPAA2 drivers will
follow a similar initialization pattern.

The dpio driver is added under drivers/bus/fsl-mc/dpio.  This
driver provides queueing related services and there is no other
obvious place it would go.  Like the bus driver, it is part of
the DPAA2 infrastucture and putting it under the fsl-mc bus
driver seems like a logical place.

version 3 changes
   -zero memory allocated for a dpio store
   -replace hardcoded dequeue token with a #define and look for
that token when checking for a new result

version 2 changes (mostly feedback from Ioana Radulescu)
   -removed unused structs and defines in dpio command definitions
   -added setter/getter for the FD ctrl field
   -corrected comment for SG format_offset field description
   -added support for short length field in FD
   -fix bug in buffer release command, by setting bpid field
   -handle error (NULL) return value from qbman_swp_mc_complete()
   -fix bug in sending management commands where the verb was
properly initialized
   -use service_select_by_cpu() for re-arming DPIO interrupts
   -replace use of NR_CPUS with num_possible_cpus()
   -handle error case where number of DPIOs exceeds number of possible
CPUs
   -error message cleanup
   -updated MAINTAINERS file with proper location for both fsl-mc bus
driver and dpio driver

Ioana Radulescu (1):
  bus: fsl-mc: dpio: add APIs for DPIO objects

Roy Pledge (6):
  bus: fsl-mc: dpio: add frame descriptor and scatter/gather APIs
  bus: fsl-mc: dpio: add global dpaa2 definitions
  bus: fsl-mc: dpio: add QBMan portal APIs for DPAA2
  bus: fsl-mc: dpio: add the DPAA2 DPIO service interface
  bus: fsl-mc: dpio: add the DPAA2 DPIO object driver
  bus: fsl-mc: dpio: add maintainer for DPIO

Stuart Yoder (2):
  staging: fsl-mc: move bus driver out of staging
  bus: fsl-mc: dpio: add DPIO driver overview document

 Documentation/dpaa2/dpio-driver.txt|  135 +++
 .../README.txt => Documentation/dpaa2/overview.txt |0
 MAINTAINERS|8 +-
 drivers/bus/Kconfig|3 +
 drivers/bus/Makefile   |3 +
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/Kconfig |   10 +
 .../{staging/fsl-mc/bus => bus/fsl-mc}/Makefile|4 +-
 .../{staging/fsl-mc/bus => bus/fsl-mc}/dpbp-cmd.h  |0
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp.c  |6 +-
 .../{staging/fsl-mc/bus => bus/fsl-mc}/dpcon-cmd.h |0
 drivers/bus/fsl-mc/dpio/Makefile   |9 +
 drivers/bus/fsl-mc/dpio/dpio-cmd.h |   75 ++
 drivers/bus/fsl-mc/dpio/dpio-driver.c  |  295 ++
 drivers/bus/fsl-mc/dpio/dpio-service.c |  614 
 drivers/bus/fsl-mc/dpio/dpio.c |  229 +
 drivers/bus/fsl-mc/dpio/dpio.h |  108 ++
 drivers/bus/fsl-mc/dpio/qbman-portal.c | 1028 
 drivers/bus/fsl-mc/dpio/qbman-portal.h |  464 +
 .../{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp-cmd.h |0
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp.c |5 +-
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp.h |0
 .../{staging/fsl-mc/bus => bus/fsl-mc}/dpmng-cmd.h |0
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmng.c |6 +-
 .../{staging/fsl-mc/bus => bus/fsl-mc}/dprc-cmd.h  |0
 .../fsl-mc/bus => bus/fsl-mc}/dprc-driver.c|4 +-
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc.c  |6 +-
 .../fsl-mc/bus => bus/fsl-mc}/fsl-mc-allocator.c   |4 +-
 .../fsl-mc/bus => bus/fsl-mc}/fsl-mc-bus.c |6 +-
 .../fsl-mc/bus => bus/fsl-mc}/fsl-mc-msi.c |2 +-
 .../fsl-mc/bus => bus/fsl-mc}/fsl-mc-private.h |4 +-
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-io.c |4 +-
 .../{staging/fsl-mc/bus => bus/fsl-mc}/mc-sys.c|6 +-
 drivers/irqchip/Makefile   |1 

[PATCH v3 5/9] bus: fsl-mc: dpio: add global dpaa2 definitions

2016-12-01 Thread Stuart Yoder
From: Roy Pledge <roy.ple...@nxp.com>

Create header for global dpaa2 definitions.  Add definitions
for dequeue results.

Signed-off-by: Roy Pledge <roy.ple...@nxp.com>
Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
---
 include/linux/fsl/dpaa2-global.h | 203 +++
 1 file changed, 203 insertions(+)
 create mode 100644 include/linux/fsl/dpaa2-global.h

diff --git a/include/linux/fsl/dpaa2-global.h b/include/linux/fsl/dpaa2-global.h
new file mode 100644
index 000..3ee3f29
--- /dev/null
+++ b/include/linux/fsl/dpaa2-global.h
@@ -0,0 +1,203 @@
+/*
+ * 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.
+ */
+#ifndef __FSL_DPAA2_GLOBAL_H
+#define __FSL_DPAA2_GLOBAL_H
+
+#include 
+#include 
+#include 
+
+struct dpaa2_dq {
+   union {
+   struct common {
+   u8 verb;
+   u8 reserved[63];
+   } common;
+   struct dq {
+   u8 verb;
+   u8 stat;
+   __le16 seqnum;
+   __le16 oprid;
+   u8 reserved;
+   u8 tok;
+   __le32 fqid;
+   u32 reserved2;
+   __le32 fq_byte_cnt;
+   __le32 fq_frm_cnt;
+   __le64 fqd_ctx;
+   u8 fd[32];
+   } dq;
+   struct scn {
+   u8 verb;
+   u8 stat;
+   u8 state;
+   u8 reserved;
+   __le32 rid_tok;
+   __le64 ctx;
+   } scn;
+   };
+};
+
+
+/* Parsing frame dequeue results */
+/* FQ empty */
+#define DPAA2_DQ_STAT_FQEMPTY   0x80
+/* FQ held active */
+#define DPAA2_DQ_STAT_HELDACTIVE0x40
+/* FQ force eligible */
+#define DPAA2_DQ_STAT_FORCEELIGIBLE 0x20
+/* valid frame */
+#define DPAA2_DQ_STAT_VALIDFRAME0x10
+/* FQ ODP enable */
+#define DPAA2_DQ_STAT_ODPVALID  0x04
+/* volatile dequeue */
+#define DPAA2_DQ_STAT_VOLATILE  0x02
+/* volatile dequeue command is expired */
+#define DPAA2_DQ_STAT_EXPIRED   0x01
+
+#define DQ_FQID_MASK 0x00FF
+#define DQ_FRAME_COUNT_MASK 0x00FF
+
+/**
+ * dpaa2_dq_flags() - Get the stat field of dequeue response
+ * @dq: the dequeue result.
+ */
+static inline u32 dpaa2_dq_flags(const struct dpaa2_dq *dq)
+{
+   return dq->dq.stat;
+}
+
+/**
+ * dpaa2_dq_is_pull() - Check whether the dq response is from a pull
+ *  command.
+ * @dq: the dequeue result
+ *
+ * Return 1 for volatile(pull) dequeue, 0 for static dequeue.
+ */
+static inline int dpaa2_dq_is_pull(const struct dpaa2_dq *dq)
+{
+   return (int)(dpaa2_dq_flags(dq) & DPAA2_DQ_STAT_VOLATILE);
+}
+
+/**
+ * dpaa2_dq_is_pull_complete() - Check whether the pull command is completed.
+ * @dq: the dequeue result
+ *
+ * Return boolean.
+ */
+static inline int dpaa2_dq_is_pull_complete(
+   const struct dpaa2_dq *dq)
+{
+   return (int)(dpaa2_dq_flags(dq) & DPAA2_DQ_STAT_EXPIRED);
+}
+
+/**
+ * dpaa2_dq_seqnum() - G

RE: [PATCH 6/9] bus: fsl-mc: dpio: add QBMan portal APIs for DPAA2

2016-11-29 Thread Stuart Yoder


> -Original Message-
> From: Ruxandra Ioana Radulescu
> Sent: Monday, November 28, 2016 12:10 PM
> To: Stuart Yoder <stuart.yo...@nxp.com>; gre...@linuxfoundation.org
> Cc: German Rivera <german.riv...@nxp.com>; de...@driverdev.osuosl.org; 
> linux-ker...@vger.kernel.org;
> ag...@suse.de; a...@arndb.de; Leo Li <leoyang...@nxp.com>; Roy Pledge 
> <roy.ple...@nxp.com>; Haiying Wang
> <haiying.w...@nxp.com>
> Subject: RE: [PATCH 6/9] bus: fsl-mc: dpio: add QBMan portal APIs for DPAA2
> 
> > -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 <german.riv...@nxp.com>; de...@driverdev.osuosl.org;
> > linux-ker...@vger.kernel.org; ag...@suse.de; a...@arndb.de; Leo Li
> > <leoyang...@nxp.com>; Roy Pledge <roy.ple...@nxp.com>; Roy Pledge
> > <roy.ple...@nxp.com>; Haiying Wang <haiying.w...@nxp.com>; Stuart
> > Yoder <stuart.yo...@nxp.com>
> > Subject: [PATCH 6/9] bus: fsl-mc: dpio: add QBMan portal APIs for DPAA2
> >
> > 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>
> > ---
> >  drivers/bus/fsl-mc/dpio/Makefile   |2 +-
> >  drivers/bus/fsl-mc/dpio/qbman-portal.c | 1009
> > 
> >  drivers/bus/fsl-mc/dpio/qbman-portal.h |  464 +++
> >  3 files changed, 1474 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..1eb3dd9
> > --- /dev/null
> > +++ b/drivers/bus/fsl-mc/dpio/qbman-portal.c
> 
> [...]
> 
> > +/**
> > + * qbman_swp_pull() - Issue the pull dequeue command
> > + * @s: the software portal object
> > + * @d: the software portal descriptor which has been configured with
> > + * the set of qbman_pull_desc_set_*() calls
> > + *
> > + * Return 0 for success, and -EBUSY if the software portal is not ready
> > + * to do pull dequeue.
> > + */
> > +int qbman_swp_pull(struct qbman_swp *s, struct qbman_pull_desc *d)
> > +{
> > +   struct qbman_pull_desc *p;
> > +
> > +   if (!atomic_dec_and_test(>vdq.available)) {
> > +   atomic_inc(>vdq.available);
> > +   return -EBUSY;
> > +   }
> > +   s->vdq.storage = (void *)d->rsp_addr_virt;
> > +   d->tok = 1;
> > +   p = qbman_get_cmd(s, QBMAN_CENA_SWP_VDQCR);
> > +   *p = *d;
> > +   dma_wmb();
> > +
> > +   /* Set the verb byte, have to substitute in the valid-bit */
> > +   p->verb |= s->vdq.valid_bit;
> > +   s->vdq.valid_bit ^= QB_VALID_BIT;
> > +
> > +   return 0;
> > +}
> > +
> [...]
> > +
> > +/**
> > + * qbman_result_has_new_result() - Check and get the dequeue response
> > from the
> > + * dq storage memory set in pull dequeue 
> > command
> > + * @s: the software portal object
> > + * @dq: the dequeue result read from the memory
> > + *
> > + * Return 1 for getting a valid dequeue result, or 0 for not getting a 
> > valid
> > + * dequeue result.
> > + *
> > + * Only used for user-provided storage of dequeue results, not DQRR. For
> > + * efficiency purposes, the driver will perform any required endianness
> > + * conversion to ensure that the user's dequeue result storage is in host-
> > endian
> > + * format. As such, once the user has called
> > qbman_result_has_new_result() and
> > + * been returned a valid dequeue result, they should not call it again on
> > + * the same memory location (except of course if another dequeue
> > command has
> > + * be

[PATCH v2 8/9] bus: fsl-mc: dpio: add the DPAA2 DPIO object driver

2016-11-16 Thread Stuart Yoder
From: Roy Pledge <roy.ple...@nxp.com>

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 <roy.ple...@nxp.com>
Signed-off-by: Haiying Wang <haiying.w...@nxp.com>
Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
Cc: Laurentiu Tudor <laurentiu.tu...@nxp.com>
Cc: Ioana Radulescu <ruxandra.radule...@nxp.com>
---
-v2
   -handle error case where number of DPIOs > NR_CPUs

 drivers/bus/fsl-mc/dpio/Makefile  |   2 +-
 drivers/bus/fsl-mc/dpio/dpio-driver.c | 295 ++
 2 files changed, 296 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..76261d2
--- /dev/null
+++ b/drivers/bus/fsl-mc/dpio/dpio-driver.c
@@ -0,0 +1,295 @@
+/*
+ * 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(_dev->dev);
+
+   irq = dpio_dev->irqs[0];
+   error = devm_request_irq(_dev->dev,
+irq->msi_desc->irq,
+dpio_irq_handler,
+0,
+dev_name(_dev->dev),
+_dev->dev);
+   if (error < 0) {
+   dev_err(_dev->dev,
+   "devm_request_irq() failed: %d\n",
+   error);
+   return error;

[PATCH v2 2/9] bus: fsl-mc: dpio: add DPIO driver overview document

2016-11-16 Thread Stuart Yoder
add document describing the dpio driver and it's role, components
and major interfaces

Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
Cc: Laurentiu Tudor <laurentiu.tu...@nxp.com>
Cc: Roy Pledge <roy.ple...@nxp.com>
Cc: Ioana Radulescu <ruxandra.radule...@nxp.com>
---
-v2
  -no changes

 Documentation/dpaa2/dpio-driver.txt | 135 
 1 file changed, 135 insertions(+)
 create mode 100644 Documentation/dpaa2/dpio-driver.txt

diff --git a/Documentation/dpaa2/dpio-driver.txt 
b/Documentation/dpaa2/dpio-driver.txt
new file mode 100644
index 000..5c192b3
--- /dev/null
+++ b/Documentation/dpaa2/dpio-driver.txt
@@ -0,0 +1,135 @@
+Copyright (C) 2016 Freescale Semiconductor Inc.
+
+Introduction
+
+
+A DPAA2 DPIO (Data Path I/O) is a hardware object that provides
+interfaces to enqueue and dequeue frames to/from network interfaces
+and other accelerators.  A DPIO also provides hardware buffer
+pool management for network interfaces.
+
+This document provides an overview the Linux DPIO driver, its
+subcomponents, and its APIs.
+
+See Documentation/dpaa2/overview.txt for a general overview of DPAA2
+and the general DPAA2 driver architecture in Linux.
+
+Driver Overview
+---
+
+The DPIO driver is bound to DPIO objects discovered on the fsl-mc bus and
+provides services that:
+  A) allow other drivers, such as the Ethernet driver, to enqueue and dequeue
+ frames for their respective objects
+  B) allow drivers to register callbacks for data availability notifications
+ when data becomes available on a queue or channel
+  C) allow drivers to manage hardware buffer pools
+
+The Linux DPIO driver consists of 3 primary components--
+   DPIO object driver-- fsl-mc driver that manages the DPIO object
+   DPIO service-- provides APIs to other Linux drivers for services
+   QBman portal interface-- sends portal commands, gets responses
+
+  fsl-mc  other
+   bus   drivers
+|   |
++---++   +--+-+
+|DPIO obj|   |DPIO service|
+| driver |---|  (DPIO)|
+++   +--+-+
+|
+ +--+-+
+ |QBman   |
+ | portal i/f |
+ ++
+|
+ hardware
+
+The diagram below shows how the DPIO driver components fit with the other
+DPAA2 Linux driver components:
+   ++
+   | OS Network |
+   |   Stack|
+ ++++
+ | Allocator  |. . . . . . .   |  Ethernet  |
+ |(DPMCP,DPBP)||   (DPNI)   |
+ +-.--++---+---++
+  .  . ^   |
+ ..|   | dequeue>
++-+ .  |   |
+| DPRC driver |  .++ ++
+|   (DPRC)|   . . |DPIO obj| |DPIO service|
++--+--+   | driver |-|  (DPIO)|
+   |  ++ +--+-+
+   | +--|-+
+   | |   QBman|
+  ++--+  | portal i/f |
+  |   MC-bus driver   |  ++
+  |   | |
+  | /soc/fsl-mc   | |
+  +---+ |
+|
+ =|=|
++-+--DPIO---|---+
+|   |   |
+|QBman Portal   |
++---+
+
+ 
+
+
+DPIO Object Driver (dpio-driver.c)
+--
+
+   The dpio-driver component registers with the fsl-mc bus to handle objects of
+   type "dpio".  The implementation of probe() handles basic initialization
+   of the DPIO including mapping of the DPIO regions (the QBman SW portal)
+   and initializing interrupts and registering irq handlers.  The dpio-driver
+   registers the probed DPIO with dpio-service.
+
+DPIO service  (dpio-service.c, dpaa2-io.h)
+--
+
+   The dpio service component provides queuing, notification, and buffers
+   management services t

[PATCH v2 1/9] staging: fsl-mc: move bus driver out of staging

2016-11-16 Thread Stuart Yoder
Move the source files out of staging into their final locations:
  -include files in drivers/staging/fsl-mc/include go to include/linux/fsl
  -irq-gic-v3-its-fsl-mc-msi.c goes to drivers/irqchip
  -source in drivers/staging/fsl-mc/bus goes to drivers/bus/fsl-mc
  -README.txt, providing and overview of DPAA goes to
   Documentation/dpaa2/overview.txt
  -update MAINTAINERS with new location

Delete other remaining staging files-- Makefile, Kconfig, TODO

Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
Cc: Laurentiu Tudor <laurentiu.tu...@nxp.com>
---
-v2
  -updated MAINTAINERS file with proper location

 .../README.txt => Documentation/dpaa2/overview.txt |  0
 MAINTAINERS|  2 +-
 drivers/bus/Kconfig|  3 +++
 drivers/bus/Makefile   |  3 +++
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/Kconfig |  0
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/Makefile|  1 -
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp-cmd.h  |  0
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp.c  |  6 +++---
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpcon-cmd.h |  0
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp-cmd.h |  0
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp.c |  5 +++--
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp.h |  0
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmng-cmd.h |  0
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmng.c |  6 +++---
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc-cmd.h  |  0
 .../{staging/fsl-mc/bus => bus/fsl-mc}/dprc-driver.c   |  4 ++--
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc.c  |  6 +++---
 .../fsl-mc/bus => bus/fsl-mc}/fsl-mc-allocator.c   |  4 ++--
 .../{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-bus.c|  6 +++---
 .../{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-msi.c|  2 +-
 .../fsl-mc/bus => bus/fsl-mc}/fsl-mc-private.h |  4 ++--
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-io.c |  4 ++--
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-sys.c|  6 +++---
 drivers/irqchip/Makefile   |  1 +
 .../fsl-mc/bus => irqchip}/irq-gic-v3-its-fsl-mc-msi.c |  2 +-
 drivers/staging/Kconfig|  2 --
 drivers/staging/Makefile   |  1 -
 drivers/staging/fsl-mc/Kconfig |  1 -
 drivers/staging/fsl-mc/Makefile|  2 --
 drivers/staging/fsl-mc/TODO| 18 --
 .../fsl-mc/include => include/linux/fsl}/dpbp.h|  0
 .../fsl-mc/include => include/linux/fsl}/dpmng.h   |  0
 .../fsl-mc/include => include/linux/fsl}/dprc.h|  0
 .../fsl-mc/include => include/linux/fsl}/mc-bus.h  |  2 +-
 .../fsl-mc/include => include/linux/fsl}/mc-cmd.h  |  0
 .../fsl-mc/include => include/linux/fsl}/mc-sys.h  |  0
 .../staging/fsl-mc/include => include/linux/fsl}/mc.h  |  2 +-
 37 files changed, 38 insertions(+), 55 deletions(-)
 rename drivers/staging/fsl-mc/README.txt => Documentation/dpaa2/overview.txt 
(100%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/Kconfig (100%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/Makefile (91%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp-cmd.h (100%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpcon-cmd.h (100%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp-cmd.h (100%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp.h (100%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmng-cmd.h (100%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmng.c (96%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc-cmd.h (100%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc-driver.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-allocator.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-bus.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-msi.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-private.h (96%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-io.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-sys.c (99%)
 rename drivers/{staging/fsl-mc/bus => irqchip}/irq-gic-v3-its-fsl-mc-msi.c 
(99%)
 delete mode 100644 drivers/staging/fsl-mc/Kconfig
 delete mode 100644 drivers/staging/fsl-mc/Makefile
 delete mode 100644 drivers/staging/fsl-mc/TODO
 rename {drivers/staging/fsl-mc/include => include/linux/fsl}/dpbp.h (100%)
 rename {drivers/staging/fsl-mc/include => include/linux/fsl}/dpmng.h (100%)
 rename {drivers/st

[PATCH v2 7/9] bus: fsl-mc: dpio: add the DPAA2 DPIO service interface

2016-11-16 Thread Stuart Yoder
From: Roy Pledge <roy.ple...@nxp.com>

The DPIO service interface handles initialization of DPIO objects
and exports APIs to be used by other DPAA2 object drivers to perform
queuing and buffer management related operations.  The service allows
registration of callbacks when frames or notifications are received.

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>
Cc: Laurentiu Tudor <laurentiu.tu...@nxp.com>
Cc: Ioana Radulescu <ruxandra.radule...@nxp.com>
---
-v2
   -use service_select_by_cpu() for re-arming DPIO interrupts
   -replace use of NR_CPUS with num_possible_cpus()

 drivers/bus/fsl-mc/dpio/Makefile   |   2 +-
 drivers/bus/fsl-mc/dpio/dpio-service.c | 614 +
 include/linux/fsl/dpaa2-io.h   | 138 
 3 files changed, 753 insertions(+), 1 deletion(-)
 create mode 100644 drivers/bus/fsl-mc/dpio/dpio-service.c
 create mode 100644 include/linux/fsl/dpaa2-io.h

diff --git a/drivers/bus/fsl-mc/dpio/Makefile b/drivers/bus/fsl-mc/dpio/Makefile
index 6588498..0778da7 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
+fsl-mc-dpio-objs := dpio.o qbman-portal.o dpio-service.o
diff --git a/drivers/bus/fsl-mc/dpio/dpio-service.c 
b/drivers/bus/fsl-mc/dpio/dpio-service.c
new file mode 100644
index 000..953bd7a
--- /dev/null
+++ b/drivers/bus/fsl-mc/dpio/dpio-service.c
@@ -0,0 +1,614 @@
+/*
+ * 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 "dpio.h"
+#include "qbman-portal.h"
+
+struct dpaa2_io {
+   atomic_t refs;
+   struct dpaa2_io_desc dpio_desc;
+   struct qbman_swp_desc swp_desc;
+   struct qbman_swp *swp;
+   struct list_head node;
+   spinlock_t lock_mgmt_cmd;
+   spinlock_t lock_notifications;
+   struct list_head notifications;
+};
+
+struct dpaa2_io_store {
+   unsigned int max;
+   dma_addr_t paddr;
+   struct dpaa2_dq *vaddr;
+   void *alloced_addr;/* unaligned value from kmalloc() */
+   unsigned int idx;  /* position of the next-to-be-returned entry */
+   struct qbman_swp *swp; /* portal used to issue VDQCR */
+   struct device *dev;/* device used for DMA mapping */
+};
+
+/* keep a per cpu array of DPIOs for fast access */
+static struct dpaa2_io *dpio_by_cpu[NR_CPUS];
+static struct list_head dpio_list = LIST_HEAD_INIT(dpio_list);
+static DEFINE_SPINLOCK(dpio_list_lock);
+
+static inline struct dpaa2_io *service_select_by_cpu(struct dpaa2_io *d,
+int cpu)
+{
+   if (d)
+   return d;
+
+   if (unlikely(cpu >= num_possible_cpus()))
+   return NULL;
+
+   /*
+* If cpu == -1, choose the current cpu, with no guarantees about
+* potentially being migrated away.
+*/

[PATCH v2 9/9] bus: fsl-mc: dpio: add maintainer for DPIO

2016-11-16 Thread Stuart Yoder
From: Roy Pledge <roy.ple...@nxp.com>

add Roy Pledge as maintainer of DPIO

Signed-off-by: Roy Pledge <roy.ple...@nxp.com>
Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
Cc: Laurentiu Tudor <laurentiu.tu...@nxp.com>
Cc: Ioana Radulescu <ruxandra.radule...@nxp.com>
---
-v2
   -corrected location of maintainer entry

 MAINTAINERS | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 63b45f4..312c582 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3980,6 +3980,12 @@ S:   Maintained
 F: drivers/char/dtlk.c
 F: include/linux/dtlk.h
 
+DPAA2 DATAPATH I/O (DPIO) DRIVER
+M: Roy Pledge <roy.ple...@nxp.com>
+L: linux-ker...@vger.kernel.org
+S: Maintained
+F: drivers/bus/fsl-mc/dpio
+
 DPT_I2O SCSI RAID DRIVER
 M: Adaptec OEM Raid Solutions <aacr...@adaptec.com>
 L: linux-s...@vger.kernel.org
-- 
1.9.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 5/9] bus: fsl-mc: dpio: add global dpaa2 definitions

2016-11-16 Thread Stuart Yoder
From: Roy Pledge <roy.ple...@nxp.com>

Create header for global dpaa2 definitions.  Add definitions
for dequeue results.

Signed-off-by: Roy Pledge <roy.ple...@nxp.com>
Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
Cc: Laurentiu Tudor <laurentiu.tu...@nxp.com>
Cc: Ioana Radulescu <ruxandra.radule...@nxp.com>
---
-v2
   -no changes

 include/linux/fsl/dpaa2-global.h | 203 +++
 1 file changed, 203 insertions(+)
 create mode 100644 include/linux/fsl/dpaa2-global.h

diff --git a/include/linux/fsl/dpaa2-global.h b/include/linux/fsl/dpaa2-global.h
new file mode 100644
index 000..3ee3f29
--- /dev/null
+++ b/include/linux/fsl/dpaa2-global.h
@@ -0,0 +1,203 @@
+/*
+ * 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.
+ */
+#ifndef __FSL_DPAA2_GLOBAL_H
+#define __FSL_DPAA2_GLOBAL_H
+
+#include 
+#include 
+#include 
+
+struct dpaa2_dq {
+   union {
+   struct common {
+   u8 verb;
+   u8 reserved[63];
+   } common;
+   struct dq {
+   u8 verb;
+   u8 stat;
+   __le16 seqnum;
+   __le16 oprid;
+   u8 reserved;
+   u8 tok;
+   __le32 fqid;
+   u32 reserved2;
+   __le32 fq_byte_cnt;
+   __le32 fq_frm_cnt;
+   __le64 fqd_ctx;
+   u8 fd[32];
+   } dq;
+   struct scn {
+   u8 verb;
+   u8 stat;
+   u8 state;
+   u8 reserved;
+   __le32 rid_tok;
+   __le64 ctx;
+   } scn;
+   };
+};
+
+
+/* Parsing frame dequeue results */
+/* FQ empty */
+#define DPAA2_DQ_STAT_FQEMPTY   0x80
+/* FQ held active */
+#define DPAA2_DQ_STAT_HELDACTIVE0x40
+/* FQ force eligible */
+#define DPAA2_DQ_STAT_FORCEELIGIBLE 0x20
+/* valid frame */
+#define DPAA2_DQ_STAT_VALIDFRAME0x10
+/* FQ ODP enable */
+#define DPAA2_DQ_STAT_ODPVALID  0x04
+/* volatile dequeue */
+#define DPAA2_DQ_STAT_VOLATILE  0x02
+/* volatile dequeue command is expired */
+#define DPAA2_DQ_STAT_EXPIRED   0x01
+
+#define DQ_FQID_MASK 0x00FF
+#define DQ_FRAME_COUNT_MASK 0x00FF
+
+/**
+ * dpaa2_dq_flags() - Get the stat field of dequeue response
+ * @dq: the dequeue result.
+ */
+static inline u32 dpaa2_dq_flags(const struct dpaa2_dq *dq)
+{
+   return dq->dq.stat;
+}
+
+/**
+ * dpaa2_dq_is_pull() - Check whether the dq response is from a pull
+ *  command.
+ * @dq: the dequeue result
+ *
+ * Return 1 for volatile(pull) dequeue, 0 for static dequeue.
+ */
+static inline int dpaa2_dq_is_pull(const struct dpaa2_dq *dq)
+{
+   return (int)(dpaa2_dq_flags(dq) & DPAA2_DQ_STAT_VOLATILE);
+}
+
+/**
+ * dpaa2_dq_is_pull_complete() - Check whether the pull command is completed.
+ * @dq: the dequeue result
+ *
+ * Return boolean.
+ */
+static inline int dpaa2_dq_is_pull_complete(
+   co

[PATCH v2 3/9] bus: fsl-mc: dpio: add APIs for DPIO objects

2016-11-16 Thread Stuart Yoder
From: Ioana Radulescu <ruxandra.radule...@nxp.com>

Add the command build/parse APIs for operating on DPIO objects through
the DPAA2 Management Complex.

Signed-off-by: Ioana Radulescu <ruxandra.radule...@nxp.com>
Signed-off-by: Roy Pledge <roy.ple...@nxp.com>
Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
Cc: Laurentiu Tudor <laurentiu.tu...@nxp.com>
---
-v2
  -removed unused structs and defines as suggested by Ioana Radulescu

 drivers/bus/fsl-mc/Kconfig |  10 ++
 drivers/bus/fsl-mc/Makefile|   3 +
 drivers/bus/fsl-mc/dpio/Makefile   |   9 ++
 drivers/bus/fsl-mc/dpio/dpio-cmd.h |  75 
 drivers/bus/fsl-mc/dpio/dpio.c | 229 +
 drivers/bus/fsl-mc/dpio/dpio.h | 108 +
 6 files changed, 434 insertions(+)
 create mode 100644 drivers/bus/fsl-mc/dpio/Makefile
 create mode 100644 drivers/bus/fsl-mc/dpio/dpio-cmd.h
 create mode 100644 drivers/bus/fsl-mc/dpio/dpio.c
 create mode 100644 drivers/bus/fsl-mc/dpio/dpio.h

diff --git a/drivers/bus/fsl-mc/Kconfig b/drivers/bus/fsl-mc/Kconfig
index 5c009ab..a10aaf0 100644
--- a/drivers/bus/fsl-mc/Kconfig
+++ b/drivers/bus/fsl-mc/Kconfig
@@ -15,3 +15,13 @@ config FSL_MC_BUS
  architecture.  The fsl-mc bus driver handles discovery of
  DPAA2 objects (which are represented as Linux devices) and
  binding objects to drivers.
+
+config FSL_MC_DPIO
+tristate "QorIQ DPAA2 DPIO driver"
+depends on FSL_MC_BUS
+help
+ Driver for the DPAA2 DPIO object.  A DPIO provides queue and
+ buffer management facilities for software to interact with
+ other DPAA2 objects. This driver does not expose the DPIO
+ objects individually, but groups them under a service layer
+ API.
diff --git a/drivers/bus/fsl-mc/Makefile b/drivers/bus/fsl-mc/Makefile
index d56afee..d18df72 100644
--- a/drivers/bus/fsl-mc/Makefile
+++ b/drivers/bus/fsl-mc/Makefile
@@ -17,3 +17,6 @@ mc-bus-driver-objs := fsl-mc-bus.o \
  fsl-mc-msi.o \
  dpmcp.o \
  dpbp.o
+
+# MC DPIO driver
+obj-$(CONFIG_FSL_MC_DPIO) += dpio/
diff --git a/drivers/bus/fsl-mc/dpio/Makefile b/drivers/bus/fsl-mc/dpio/Makefile
new file mode 100644
index 000..128befc
--- /dev/null
+++ b/drivers/bus/fsl-mc/dpio/Makefile
@@ -0,0 +1,9 @@
+#
+# QorIQ DPAA2 DPIO driver
+#
+
+subdir-ccflags-y := -Werror
+
+obj-$(CONFIG_FSL_MC_DPIO) += fsl-mc-dpio.o
+
+fsl-mc-dpio-objs := dpio.o
diff --git a/drivers/bus/fsl-mc/dpio/dpio-cmd.h 
b/drivers/bus/fsl-mc/dpio/dpio-cmd.h
new file mode 100644
index 000..3464ed9
--- /dev/null
+++ b/drivers/bus/fsl-mc/dpio/dpio-cmd.h
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2013-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 the above-listed copyright holders nor the
+ * names of any 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDERS OR CONTRIBUTORS 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.
+ */
+#ifndef _FSL_DPIO_CMD_H
+#define _FSL_DPIO_CMD_H
+
+/* DPIO Version */
+#define DPIO_VER_MAJOR 4
+#define DPIO_VER_MINOR 2
+
+/* Command Versioning */
+
+#define DPIO_CMD_ID_OFFSET 4
+#define DPIO_CMD_BASE_VERSION  1
+
+#define DPIO_CMD(id)   ((id << DPIO_CMD_ID_OFFSET) | DPIO_CMD_BASE_VERSION)
+
+/* Command IDs */
+#define DPIO_

[PATCH v2 0/9] staging: fsl-mc: move bus driver out of staging, add dpio

2016-11-16 Thread Stuart Yoder
This patch series: A) addresses the final item in the staging
TODO list for the fsl-mc bus driver-- adding a functional driver
on top of the bus driver, and B) requests that the fsl-mc bus driver
be moved out of staging.

The proposed destination for the bus driver is drivers/bus.
Proposed location for global header files for fsl-mc and dpaa2
is include/linux/fsl.

The functional driver added is for the DPIO object which provides
queuing services for other DPAA2 drivers.  An overview of the
DPIO object and driver components are in patch 2.  Patches 3-7 are
internal components of the DPIO driver-- bit twiddling of hardware
registers, DPAA2 data structures, and the queuing APIs exposed
to other drivers.

Patch 8 adds the fsl-mc driver for the DPIO object.  It provides
the probe/remove functions, demonstrating a working example of
how fsl-mc drivers initialize, interact with the management
complex hardware, map their mappable MMIO regions, initialize
interrupts, register an ISR, etc.  All other DPAA2 drivers will
follow a similar initialization pattern.

The dpio driver is added under drivers/bus/fsl-mc/dpio.  This
driver provides queueing related services and there is no other
obvious place it would go.  Like the bus driver, it is part of
the DPAA2 infrastucture and putting it under the fsl-mc bus
driver seems like a logical place.

version 2 changes (mostly feedback from Ioana Radulescu)
   -removed unused structs and defines in dpio command definitions
   -added setter/getter for the FD ctrl field
   -corrected comment for SG format_offset field description
   -added support for short length field in FD
   -fix bug in buffer release command, by setting bpid field
   -handle error (NULL) return value from qbman_swp_mc_complete()
   -fix bug in sending management commands where the verb was
properly initialized
   -use service_select_by_cpu() for re-arming DPIO interrupts
   -replace use of NR_CPUS with num_possible_cpus()
   -handle error case where number of DPIOs exceeds number of possible
CPUs
   -error message cleanup
   -updated MAINTAINERS file with proper location for both fsl-mc bus
driver and dpio driver

Ioana Radulescu (1):
  bus: fsl-mc: dpio: add APIs for DPIO objects

Roy Pledge (6):
  bus: fsl-mc: dpio: add frame descriptor and scatter/gather APIs
  bus: fsl-mc: dpio: add global dpaa2 definitions
  bus: fsl-mc: dpio: add QBMan portal APIs for DPAA2
  bus: fsl-mc: dpio: add the DPAA2 DPIO service interface
  bus: fsl-mc: dpio: add the DPAA2 DPIO object driver
  bus: fsl-mc: dpio: add maintainer for DPIO

Stuart Yoder (2):
  staging: fsl-mc: move bus driver out of staging
  bus: fsl-mc: dpio: add DPIO driver overview document

 Documentation/dpaa2/dpio-driver.txt|  135 +++
 .../README.txt => Documentation/dpaa2/overview.txt |0
 MAINTAINERS|8 +-
 drivers/bus/Kconfig|3 +
 drivers/bus/Makefile   |3 +
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/Kconfig |   10 +
 .../{staging/fsl-mc/bus => bus/fsl-mc}/Makefile|4 +-
 .../{staging/fsl-mc/bus => bus/fsl-mc}/dpbp-cmd.h  |0
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp.c  |6 +-
 .../{staging/fsl-mc/bus => bus/fsl-mc}/dpcon-cmd.h |0
 drivers/bus/fsl-mc/dpio/Makefile   |9 +
 drivers/bus/fsl-mc/dpio/dpio-cmd.h |   75 ++
 drivers/bus/fsl-mc/dpio/dpio-driver.c  |  295 ++
 drivers/bus/fsl-mc/dpio/dpio-service.c |  614 
 drivers/bus/fsl-mc/dpio/dpio.c |  229 +
 drivers/bus/fsl-mc/dpio/dpio.h |  108 +++
 drivers/bus/fsl-mc/dpio/qbman-portal.c | 1025 
 drivers/bus/fsl-mc/dpio/qbman-portal.h |  464 +
 .../{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp-cmd.h |0
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp.c |5 +-
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp.h |0
 .../{staging/fsl-mc/bus => bus/fsl-mc}/dpmng-cmd.h |0
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmng.c |6 +-
 .../{staging/fsl-mc/bus => bus/fsl-mc}/dprc-cmd.h  |0
 .../fsl-mc/bus => bus/fsl-mc}/dprc-driver.c|4 +-
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc.c  |6 +-
 .../fsl-mc/bus => bus/fsl-mc}/fsl-mc-allocator.c   |4 +-
 .../fsl-mc/bus => bus/fsl-mc}/fsl-mc-bus.c |6 +-
 .../fsl-mc/bus => bus/fsl-mc}/fsl-mc-msi.c |2 +-
 .../fsl-mc/bus => bus/fsl-mc}/fsl-mc-private.h |4 +-
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-io.c |4 +-
 .../{staging/fsl-mc/bus => bus/fsl-mc}/mc-sys.c|6 +-
 drivers/irqchip/Makefile   |1 +
 .../bus => irqchip}/irq-gic-v3-its-fsl-mc-msi.c|2 +-
 drivers/staging/Kconfig|2 -
 drivers/staging/Makefile

[PATCH v2 4/9] bus: fsl-mc: dpio: add frame descriptor and scatter/gather APIs

2016-11-16 Thread Stuart Yoder
From: Roy Pledge <roy.ple...@nxp.com>

Add global definitions for DPAA2 frame descriptors and scatter
gather entries.

Signed-off-by: Roy Pledge <roy.ple...@nxp.com>
Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
Cc: Laurentiu Tudor <laurentiu.tu...@nxp.com>
Cc: Ioana Radulescu <ruxandra.radule...@nxp.com>
---
-v2
   -added setter/getter for the FD ctrl field
   -corrected comment for SG format_offset field description
   -added support for short length field in FD

 include/linux/fsl/dpaa2-fd.h | 448 +++
 1 file changed, 448 insertions(+)
 create mode 100644 include/linux/fsl/dpaa2-fd.h

diff --git a/include/linux/fsl/dpaa2-fd.h b/include/linux/fsl/dpaa2-fd.h
new file mode 100644
index 000..182c8f4
--- /dev/null
+++ b/include/linux/fsl/dpaa2-fd.h
@@ -0,0 +1,448 @@
+/*
+ * 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.
+ */
+#ifndef __FSL_DPAA2_FD_H
+#define __FSL_DPAA2_FD_H
+
+#include 
+
+/**
+ * DOC: DPAA2 FD - Frame Descriptor APIs for DPAA2
+ *
+ * Frame Descriptors (FDs) are used to describe frame data in the DPAA2.
+ * Frames can be enqueued and dequeued to Frame Queues (FQs) which are consumed
+ * by the various DPAA accelerators (WRIOP, SEC, PME, DCE)
+ *
+ * There are three types of frames: single, scatter gather, and frame lists.
+ *
+ * The set of APIs in this file must be used to create, manipulate and
+ * query Frame Descriptors.
+ */
+
+/**
+ * struct dpaa2_fd - Struct describing FDs
+ * @words: for easier/faster copying the whole FD structure
+ * @addr:  address in the FD
+ * @len:   length in the FD
+ * @bpid:  buffer pool ID
+ * @format_offset: format, offset, and short-length fields
+ * @frc:   frame context
+ * @ctrl:  control bits...including dd, sc, va, err, etc
+ * @flc:   flow context address
+ *
+ * This structure represents the basic Frame Descriptor used in the system.
+ */
+struct dpaa2_fd {
+   union {
+   u32 words[8];
+   struct dpaa2_fd_simple {
+   __le64 addr;
+   __le32 len;
+   __le16 bpid;
+   __le16 format_offset;
+   __le32 frc;
+   __le32 ctrl;
+   __le64 flc;
+   } simple;
+   };
+};
+
+#define FD_SHORT_LEN_FLAG_MASK 0x1
+#define FD_SHORT_LEN_FLAG_SHIFT 14
+#define FD_SHORT_LEN_MASK 0x1
+#define FD_OFFSET_MASK 0x0FFF
+#define FD_FORMAT_MASK 0x3
+#define FD_FORMAT_SHIFT 12
+#define SG_SHORT_LEN_FLAG_MASK 0x1
+#define SG_SHORT_LEN_FLAG_SHIFT 14
+#define SG_SHORT_LEN_MASK 0x1
+#define SG_OFFSET_MASK 0x0FFF
+#define SG_FORMAT_MASK 0x3
+#define SG_FORMAT_SHIFT 12
+#define SG_BPID_MASK 0x3FFF
+#define SG_FINAL_FLAG_MASK 0x1
+#define SG_FINAL_FLAG_SHIFT 15
+
+enum dpaa2_fd_format {
+   dpaa2_fd_single = 0,
+   dpaa2_fd_list,
+   dpaa2_fd_sg
+};
+
+/**
+ * dpaa2_fd_get_addr() - get the addr field of frame descriptor
+ * @fd: the given frame descriptor
+ *
+ * Return the address in the frame descriptor.
+ */
+static inline dma_addr_t dpaa2_fd_get_addr(const struct dpaa2_fd *fd)
+{
+
+ 

RE: [PATCH 1/2] Staging: fsl-mc: include: mc: Kernel type 's16' preferred over 'int16_t'

2016-11-14 Thread Stuart Yoder


> -Original Message-
> From: Dan Carpenter [mailto:dan.carpen...@oracle.com]
> Sent: Monday, November 14, 2016 4:06 AM
> To: Stuart Yoder <stuart.yo...@nxp.com>
> Cc: Shiva Kerdel <sh...@exdev.nl>; de...@driverdev.osuosl.org; 
> gre...@linuxfoundation.org; linux-
> ker...@vger.kernel.org; Nipun Gupta <nipun.gu...@nxp.com>; 
> tred...@nvidia.com; Laurentiu Tudor
> <laurentiu.tu...@nxp.com>
> Subject: Re: [PATCH 1/2] Staging: fsl-mc: include: mc: Kernel type 's16' 
> preferred over 'int16_t'
> 
> On Fri, Nov 11, 2016 at 02:52:31PM +, Stuart Yoder wrote:
> > > > diff --git a/drivers/staging/fsl-mc/include/mc-bus.h 
> > > > b/drivers/staging/fsl-mc/include/mc-bus.h
> > > > index e915574..c7cad87 100644
> > > > --- a/drivers/staging/fsl-mc/include/mc-bus.h
> > > > +++ b/drivers/staging/fsl-mc/include/mc-bus.h
> > > > @@ -42,8 +42,8 @@ struct msi_domain_info;
> > > >   */
> > > >  struct fsl_mc_resource_pool {
> > > > enum fsl_mc_pool_type type;
> > > > -   int16_t max_count;
> > > > -   int16_t free_count;
> > > > +   s16 max_count;
> > >
> > > My understanding is that this has to be signed because the design of
> > > this driver is that we keep adding devices until the the counter
> > > overflows.  After that there are a couple tests for
> > > "if (WARN_ON(res_pool->max_count < 0)) " which prevent the driver from
> > > working again.
> > >
> > > This all seems pretty horrible.
> >
> > Can you elaborate?
> >
> > The resource pools managed by this driver are populated by hardware objects
> > discovered when the fsl-mc bus probes a DPRC/container.
> >
> > The number of potential objects discovered of a given type is in the 
> > hundreds,
> > so a signed 16-bit number is order of magnitudes larger than anything we 
> > will
> > ever encounter.
> >
> > Would you feel better about this if max_count was an int?
> 
> Yeah.
> 
> >
> > The max_count reflects the total number of objects discovered.  If that is
> > exceeded we display a warning, because something is horribly wrong.  Nothing
> > stops working, the allocator simply refuses to add anything else to the
> > free list.
> 
> I didn't look at this carefully...  Anyway we can't remove devices
> either.  If we just had an upper bound instead of overflowing the s16
> then we could still remove devices.
> 
> >
> > The only reason max_count is there at all is as an internal check against
> > bugs and resource leaks.  If the driver is being removed and a resource
> > pool is being freed, max_count must be zero...i.e. all objects should have
> > been removed.  If not, there is a leak somewhere.  So, it's a sanity check.
> >
> 
> Just use a normal upper bound with a #define instead of an magic number
> hidden and then disguised as an integer overflow.

Ok, agree that it would be clearer like that.

Shiva, can you respin this patch and just make both max_count and free_count
to be of type "int".

I will get Dan's suggestion sent as a separate patch...to #define the upper 
bound
instead of relying on integer overflow.

Thanks,
Stuart


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH 7/9] bus: fsl-mc: dpio: add the DPAA2 DPIO service interface

2016-11-11 Thread Stuart Yoder
> > +/**
> > + * dpaa2_io_service_rearm() - Rearm the notification for the given DPIO
> > service.
> > + * @service: the given DPIO service.
> > + * @ctx: the notification context.
> > + *
> > + * Once a FQDAN/CDAN has been produced, the corresponding FQ/channel
> > is
> > + * considered "disarmed". Ie. the user can issue pull dequeue operations on
> > that
> > + * traffic source for as long as it likes. Eventually it may wish to 
> > "rearm"
> > + * that source to allow it to produce another FQDAN/CDAN, that's what this
> > + * function achieves.
> > + *
> > + * Return 0 for success.
> > + */
> > +int dpaa2_io_service_rearm(struct dpaa2_io *d,
> > +  struct dpaa2_io_notification_ctx *ctx)
> > +{
> > +   unsigned long irqflags;
> > +   int err;
> > +
> > +   d = service_select(d);
> 
> Why not select the DPIO based on ctx->desired_cpu, like in the initial
> notification register?

Sounds like a reasonable idea, I am going to confirm with Roy.

Stuart
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH 1/2] Staging: fsl-mc: include: mc: Kernel type 's16' preferred over 'int16_t'

2016-11-11 Thread Stuart Yoder


> -Original Message-
> From: Dan Carpenter [mailto:dan.carpen...@oracle.com]
> Sent: Friday, November 11, 2016 5:23 AM
> To: Shiva Kerdel <sh...@exdev.nl>
> Cc: Stuart Yoder <stuart.yo...@nxp.com>; de...@driverdev.osuosl.org; 
> german.riv...@freescale.com;
> gre...@linuxfoundation.org; Nipun Gupta <nipun.gu...@nxp.com>; 
> linux-ker...@vger.kernel.org; German
> Rivera <german.riv...@nxp.com>; tred...@nvidia.com; itai.k...@nxp.com
> Subject: Re: [PATCH 1/2] Staging: fsl-mc: include: mc: Kernel type 's16' 
> preferred over 'int16_t'
> 
> On Fri, Nov 11, 2016 at 12:07:39PM +0100, Shiva Kerdel wrote:
> > Follow the kernel type preferrences of using 's16' over 'int16_t'.
> >
> > Signed-off-by: Shiva Kerdel <sh...@exdev.nl>
> > Acked-by: Stuart Yoder <stuart.yo...@nxp.com>
> > ---
> > Changes for v2:
> > - corrected an error in the log message, wrote 's32' instead of 's16'.
> > Changes for v3:
> > - added the missing annotates.
> > Changes for v4:
> > - corrected patch subject to version 4.
> >
> >  drivers/staging/fsl-mc/include/mc-bus.h | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/staging/fsl-mc/include/mc-bus.h 
> > b/drivers/staging/fsl-mc/include/mc-bus.h
> > index e915574..c7cad87 100644
> > --- a/drivers/staging/fsl-mc/include/mc-bus.h
> > +++ b/drivers/staging/fsl-mc/include/mc-bus.h
> > @@ -42,8 +42,8 @@ struct msi_domain_info;
> >   */
> >  struct fsl_mc_resource_pool {
> > enum fsl_mc_pool_type type;
> > -   int16_t max_count;
> > -   int16_t free_count;
> > +   s16 max_count;
> 
> My understanding is that this has to be signed because the design of
> this driver is that we keep adding devices until the the counter
> overflows.  After that there are a couple tests for
> "if (WARN_ON(res_pool->max_count < 0)) " which prevent the driver from
> working again.
>
> This all seems pretty horrible.

Can you elaborate?

The resource pools managed by this driver are populated by hardware objects
discovered when the fsl-mc bus probes a DPRC/container.

The number of potential objects discovered of a given type is in the hundreds,
so a signed 16-bit number is order of magnitudes larger than anything we will
ever encounter.

Would you feel better about this if max_count was an int?

The max_count reflects the total number of objects discovered.  If that is
exceeded we display a warning, because something is horribly wrong.  Nothing
stops working, the allocator simply refuses to add anything else to the
free list.

The only reason max_count is there at all is as an internal check against
bugs and resource leaks.  If the driver is being removed and a resource
pool is being freed, max_count must be zero...i.e. all objects should have
been removed.  If not, there is a leak somewhere.  So, it's a sanity check.

Thanks,
Stuart




___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH 6/9] bus: fsl-mc: dpio: add QBMan portal APIs for DPAA2

2016-11-10 Thread Stuart Yoder


> -Original Message-
> From: Ruxandra Ioana Radulescu
> Sent: Thursday, November 10, 2016 9:04 AM
> To: Stuart Yoder <stuart.yo...@nxp.com>; gre...@linuxfoundation.org
> Cc: German Rivera <german.riv...@nxp.com>; de...@driverdev.osuosl.org; 
> linux-ker...@vger.kernel.org;
> ag...@suse.de; a...@arndb.de; Leo Li <leoyang...@nxp.com>; Roy Pledge 
> <roy.ple...@nxp.com>; Haiying Wang
> <haiying.w...@nxp.com>; Stuart Yoder <stuart.yo...@nxp.com>
> Subject: RE: [PATCH 6/9] bus: fsl-mc: dpio: add QBMan portal APIs for DPAA2
> 
> 
> > -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 <german.riv...@nxp.com>; de...@driverdev.osuosl.org;
> > linux-ker...@vger.kernel.org; ag...@suse.de; a...@arndb.de; Leo Li
> > <leoyang...@nxp.com>; Roy Pledge <roy.ple...@nxp.com>; Roy Pledge
> > <roy.ple...@nxp.com>; Haiying Wang <haiying.w...@nxp.com>; Stuart
> > Yoder <stuart.yo...@nxp.com>
> > Subject: [PATCH 6/9] bus: fsl-mc: dpio: add QBMan portal APIs for DPAA2
> >
> > 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>
> > ---
> >  drivers/bus/fsl-mc/dpio/Makefile   |2 +-
> >  drivers/bus/fsl-mc/dpio/qbman-portal.c | 1009
> > 
> >  drivers/bus/fsl-mc/dpio/qbman-portal.h |  464 +++
> >  3 files changed, 1474 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..1eb3dd9
> > --- /dev/null
> > +++ b/drivers/bus/fsl-mc/dpio/qbman-portal.c
> > @@ -0,0 +1,1009 @@
> 
> [...]
> 
> > +/**
> > + * qbman_swp_release() - Issue a buffer release command
> > + * @s:   the software portal object
> > + * @d:   the release descriptor
> > + * @buffers: a pointer pointing to the buffer address to be released
> > + * @num_buffers: number of buffers to be released,  must be less than 8
> > + *
> > + * Return 0 for success, -EBUSY if the release command ring is not ready.
> > + */
> > +int qbman_swp_release(struct qbman_swp *s, const struct
> > qbman_release_desc *d,
> > + const u64 *buffers, unsigned int num_buffers)
> > +{
> > +   int i;
> > +   struct qbman_release_desc *p;
> > +   u32 rar;
> > +
> > +   if (!num_buffers || (num_buffers > 7))
> > +   return -EINVAL;
> > +
> > +   rar = qbman_read_register(s, QBMAN_CINH_SWP_RAR);
> > +   if (!RAR_SUCCESS(rar))
> > +   return -EBUSY;
> > +
> > +   /* Start the release command */
> > +   p = qbman_get_cmd(s, QBMAN_CENA_SWP_RCR(RAR_IDX(rar)));
> > +   /* Copy the caller's buffer pointers to the command */
> > +   for (i = 0; i < num_buffers; i++)
> > +   p->buf[i] = cpu_to_le64(buffers[i]);
> > +
> 
> Hi Stuart,
> We also need to set BPID field in the buffer release command, something like:
> +   p->bpid = d->bpid;
> Without this all buffers will be released to buffer pool id 0, which is 
> incorrect.

Will fix on next respin.

> > +   /*
> > +* Set the verb byte, have to substitute in the valid-bit and the
> > number
> > +* of buffers.
> > +*/
> > +   dma_wmb();
> > +   p->verb = d->verb | RAR_VB(rar) | num_buffers;
> > +
> > +   return 0;
> > +}
> > +
> > +struct qbman_acquire_desc {
> > +   u8 verb;
> > +   u8 reserved;
> > +   u16 bpid;
> > +   u8 num;
> > +   u8 reserved2[59];
> > +};
> > +
> > +struct qbman_acquire_rslt {
> > +   u8 v

RE: [PATCH 8/9] bus: fsl-mc: dpio: add the DPAA2 DPIO object driver

2016-11-09 Thread Stuart Yoder


> -Original Message-
> From: Ruxandra Ioana Radulescu
> Sent: Friday, November 04, 2016 10:11 AM
> To: Stuart Yoder <stuart.yo...@nxp.com>; gre...@linuxfoundation.org
> Cc: German Rivera <german.riv...@nxp.com>; de...@driverdev.osuosl.org; 
> linux-ker...@vger.kernel.org;
> ag...@suse.de; a...@arndb.de; Leo Li <leoyang...@nxp.com>; Roy Pledge 
> <roy.ple...@nxp.com>; Haiying Wang
> <haiying.w...@nxp.com>; Stuart Yoder <stuart.yo...@nxp.com>
> Subject: RE: [PATCH 8/9] bus: fsl-mc: dpio: add the DPAA2 DPIO object driver
> 
> > -Original Message-
> > From: Stuart Yoder
> > Sent: Thursday, November 03, 2016 4:38 PM
> > To: Ruxandra Ioana Radulescu <ruxandra.radule...@nxp.com>
> > 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 <german.riv...@nxp.com>; de...@driverdev.osuosl.org;
> > linux-ker...@vger.kernel.org; ag...@suse.de; a...@arndb.de; Leo Li
> > <leoyang...@nxp.com>; Roy Pledge <roy.ple...@nxp.com>; Haiying Wang
> > <haiying.w...@nxp.com>; Stuart Yoder <stuart.yo...@nxp.com>
> > Subject: [PATCH 8/9] bus: fsl-mc: dpio: add the DPAA2 DPIO object driver
> >
> > From: Roy Pledge <roy.ple...@nxp.com>
> >
> > 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 <roy.ple...@nxp.com>
> > Signed-off-by: Haiying Wang <haiying.w...@nxp.com>
> > Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
> > ---
> >  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 

RE: [PATCH v2 2/2] Staging: fsl-mc: include: mc: Kernel type 's32' preferred over 'int32_t'

2016-11-08 Thread Stuart Yoder


> -Original Message-
> From: Shiva Kerdel [mailto:sh...@exdev.nl]
> Sent: Tuesday, November 08, 2016 9:42 AM
> To: Stuart Yoder <stuart.yo...@nxp.com>
> Cc: gre...@linuxfoundation.org; german.riv...@freescale.com; German Rivera 
> <german.riv...@nxp.com>;
> tred...@nvidia.com; itai.k...@nxp.com; Nipun Gupta <nipun.gu...@nxp.com>; 
> linux-ker...@vger.kernel.org;
> de...@driverdev.osuosl.org; Shiva Kerdel <sh...@exdev.nl>
> Subject: [PATCH v2 2/2] Staging: fsl-mc: include: mc: Kernel type 's32' 
> preferred over 'int32_t'
> 
> Follow the kernel type preferrences of using 's32' over 'int32_t'.
> 
> Signed-off-by: Shiva Kerdel <sh...@exdev.nl>
> ---
>  drivers/staging/fsl-mc/include/mc.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/fsl-mc/include/mc.h 
> b/drivers/staging/fsl-mc/include/mc.h
> index a781a36..1c46c0c 100644
> --- a/drivers/staging/fsl-mc/include/mc.h
> +++ b/drivers/staging/fsl-mc/include/mc.h
> @@ -81,7 +81,7 @@ enum fsl_mc_pool_type {
>   */
>  struct fsl_mc_resource {
>   enum fsl_mc_pool_type type;
> - int32_t id;
> + s32 id;
>   void *data;
>   struct fsl_mc_resource_pool *parent_pool;
>   struct list_head node;

Acked-by: Stuart Yoder <stuart.yo...@nxp.com>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH v2 1/2] Staging: fsl-mc: include: mc-bus: Kernel type 's16' preferred over 'int16_t'

2016-11-08 Thread Stuart Yoder


> -Original Message-
> From: Shiva Kerdel [mailto:sh...@exdev.nl]
> Sent: Tuesday, November 08, 2016 9:42 AM
> To: Stuart Yoder <stuart.yo...@nxp.com>
> Cc: gre...@linuxfoundation.org; german.riv...@freescale.com; German Rivera 
> <german.riv...@nxp.com>;
> tred...@nvidia.com; itai.k...@nxp.com; Nipun Gupta <nipun.gu...@nxp.com>; 
> linux-ker...@vger.kernel.org;
> de...@driverdev.osuosl.org; Shiva Kerdel <sh...@exdev.nl>
> Subject: [PATCH v2 1/2] Staging: fsl-mc: include: mc-bus: Kernel type 's16' 
> preferred over 'int16_t'
> 
> Follow the kernel type preferrences of using 's16' over 'int16_t'.
> 
> Signed-off-by: Shiva Kerdel <sh...@exdev.nl>
> ---
>  drivers/staging/fsl-mc/include/mc-bus.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/fsl-mc/include/mc-bus.h 
> b/drivers/staging/fsl-mc/include/mc-bus.h
> index e915574..c7cad87 100644
> --- a/drivers/staging/fsl-mc/include/mc-bus.h
> +++ b/drivers/staging/fsl-mc/include/mc-bus.h
> @@ -42,8 +42,8 @@ struct msi_domain_info;
>   */
>  struct fsl_mc_resource_pool {
>   enum fsl_mc_pool_type type;
> - int16_t max_count;
> - int16_t free_count;
> + s16 max_count;
> + s16 free_count;
>   struct mutex mutex;     /* serializes access to free_list */
>   struct list_head free_list;
>   struct fsl_mc_bus *mc_bus;

Acked-by: Stuart Yoder <stuart.yo...@nxp.com>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH 1/6] Staging: fsl-mc: bus: dpmcp: Kernel type 'u32' preferred over 'uint32_t'

2016-11-07 Thread Stuart Yoder

> -Original Message-
> From: Shiva Kerdel [mailto:sh...@exdev.nl]
> Sent: Monday, November 07, 2016 6:01 AM
> To: german.riv...@freescale.com
> Cc: Stuart Yoder <stuart.yo...@nxp.com>; gre...@linuxfoundation.org; German 
> Rivera
> <german.riv...@nxp.com>; itai.k...@nxp.com; tred...@nvidia.com; Bharat 
> Bhushan <bharat.bhus...@nxp.com>;
> Nipun Gupta <nipun.gu...@nxp.com>; linux-ker...@vger.kernel.org; 
> de...@driverdev.osuosl.org; Shiva
> Kerdel <sh...@exdev.nl>
> Subject: [PATCH 1/6] Staging: fsl-mc: bus: dpmcp: Kernel type 'u32' preferred 
> over 'uint32_t'
> 
> Follow the kernel type preferrences of using 'u32' over 'uint32_t'.
> 
> Signed-off-by: Shiva Kerdel <sh...@exdev.nl>
> ---
>  drivers/staging/fsl-mc/bus/dpmcp.h | 34 +-
>  1 file changed, 17 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/staging/fsl-mc/bus/dpmcp.h 
> b/drivers/staging/fsl-mc/bus/dpmcp.h
> index fe79d4d..ad41428 100644
> --- a/drivers/staging/fsl-mc/bus/dpmcp.h
> +++ b/drivers/staging/fsl-mc/bus/dpmcp.h
> @@ -39,7 +39,7 @@
>  struct fsl_mc_io;
> 
>  int dpmcp_open(struct fsl_mc_io *mc_io,
> -uint32_t cmd_flags,
> +u32 cmd_flags,
>  int dpmcp_id,
>  uint16_t *token);
> 
> @@ -47,7 +47,7 @@ int dpmcp_open(struct fsl_mc_io *mc_io,
>  #define DPMCP_GET_PORTAL_ID_FROM_POOL (-1)
> 
>  int dpmcp_close(struct fsl_mc_io *mc_io,
> - uint32_t cmd_flags,
> + u32 cmd_flags,
>   uint16_t token);
> 
>  /**
> @@ -60,16 +60,16 @@ struct dpmcp_cfg {
>  };
> 
>  int dpmcp_create(struct fsl_mc_io*mc_io,
> -  uint32_t   cmd_flags,
> +  u32cmd_flags,
>const struct dpmcp_cfg *cfg,
>   uint16_t*token);
> 
>  int dpmcp_destroy(struct fsl_mc_io *mc_io,
> -   uint32_t cmd_flags,
> +   u32 cmd_flags,
> uint16_t token);
> 
>  int dpmcp_reset(struct fsl_mc_io *mc_io,
> - uint32_t cmd_flags,
> + u32 cmd_flags,
>   uint16_t token);
> 
>  /* IRQ */
> @@ -86,52 +86,52 @@ int dpmcp_reset(struct fsl_mc_io *mc_io,
>   */
>  struct dpmcp_irq_cfg {
>uint64_t   paddr;
> -  uint32_t   val;
> +  u32val;
>intirq_num;
>  };
> 
>  int dpmcp_set_irq(struct fsl_mc_io   *mc_io,
> -   uint32_t  cmd_flags,
> +   u32   cmd_flags,
> uint16_t  token,
>uint8_tirq_index,
> struct dpmcp_irq_cfg  *irq_cfg);
> 
>  int dpmcp_get_irq(struct fsl_mc_io   *mc_io,
> -   uint32_t  cmd_flags,
> +   u32   cmd_flags,
> uint16_t  token,
>uint8_tirq_index,
>int*type,
>struct dpmcp_irq_cfg   *irq_cfg);
> 
>  int dpmcp_set_irq_enable(struct fsl_mc_io*mc_io,
> -  uint32_t   cmd_flags,
> +  u32cmd_flags,
>uint16_t   token,
>   uint8_t irq_index,
>   uint8_t en);
> 
>  int dpmcp_get_irq_enable(struct fsl_mc_io*mc_io,
> -  uint32_t   cmd_flags,
> +  u32cmd_flags,
>uint16_t   token,
>   uint8_t irq_index,
>   uint8_t *en);
> 
>  int dpmcp_set_irq_mask(struct fsl_mc_io  *mc_io,
> -uint32_t cmd_flags,
> +u32  cmd_flags,
>  uint16_t token,
> uint8_t   irq_index,
> -   uint32_t  mask);
> +   u32   mask);
> 
>  int dpmcp_get_irq_mask(struct fsl_mc_io  *mc_io,
> -uint32_t cmd_flags,
> +u32  cmd_flags,
>  uint16_t token,
> uint8_t   irq_index,
> -   uint32_t  *mask);
> +   u32   *mask);
> 
>  int dpmcp_get_irq_status(struct fsl_mc_io*mc_io,
> -  uint32_t   cmd_flags,
> +  u32cmd_flags,
&g

RE: [PATCH 4/9] bus: fsl-mc: dpio: add frame descriptor and scatter/gather APIs

2016-11-07 Thread Stuart Yoder


> -Original Message-
> From: Ruxandra Ioana Radulescu
> Sent: Friday, November 04, 2016 10:04 AM
> To: Stuart Yoder <stuart.yo...@nxp.com>; gre...@linuxfoundation.org
> Cc: German Rivera <german.riv...@nxp.com>; de...@driverdev.osuosl.org; 
> linux-ker...@vger.kernel.org;
> ag...@suse.de; a...@arndb.de; Leo Li <leoyang...@nxp.com>; Roy Pledge 
> <roy.ple...@nxp.com>
> Subject: RE: [PATCH 4/9] bus: fsl-mc: dpio: add frame descriptor and 
> scatter/gather APIs
> 
> > -Original Message-
> > From: Stuart Yoder
> > Sent: Friday, November 04, 2016 4:32 PM
> > To: Ruxandra Ioana Radulescu <ruxandra.radule...@nxp.com>;
> > gre...@linuxfoundation.org
> > Cc: German Rivera <german.riv...@nxp.com>; de...@driverdev.osuosl.org;
> > linux-ker...@vger.kernel.org; ag...@suse.de; a...@arndb.de; Leo Li
> > <leoyang...@nxp.com>; Roy Pledge <roy.ple...@nxp.com>
> > Subject: RE: [PATCH 4/9] bus: fsl-mc: dpio: add frame descriptor and
> > scatter/gather APIs
> >
> >  > +/**
> > > > + * dpaa2_fd_set_bpid() - Set the bpid field of frame descriptor
> > > > + * @fd: the given frame descriptor
> > > > + * @bpid: buffer pool id to be set
> > > > + */
> > > > +static inline void dpaa2_fd_set_bpid(struct dpaa2_fd *fd, uint16_t 
> > > > bpid)
> > > > +{
> > > > +   fd->simple.bpid = bpid;
> > > > +}
> > >
> > > The setter/getter functions for fd.ctrl are missing.
> >
> > Ok, will add those.  Does the ethernet driver use that field?
> 
> Yes.
> 
> >
> > > > +
> > > > +/**
> > > > + * struct dpaa2_sg_entry - the scatter-gathering structure
> > > > + * @addr: address of the sg entry
> > > > + * @len: length in this sg entry
> > > > + * @bpid: buffer pool id
> > > > + * @format_offset: offset in the MS 16 bits, BPID in the LS 16 bits
> > >
> > > Description of the format_offset field is incorrect, it shouldn't
> > > contain the reference to BPID.
> >
> > Thanks, will fix.
> >
> > > > +/**
> > > > + * dpaa2_sg_get_len() - Get the length in SG entry
> > > > + * @sg: the given scatter-gathering object
> > > > + *
> > > > + * Return the length.
> > > > + */
> > > > +static inline u32 dpaa2_sg_get_len(const struct dpaa2_sg_entry *sg)
> > > > +{
> > > > +   if (dpaa2_sg_short_len(sg))
> > > > +   return le32_to_cpu(sg->len) & SG_SHORT_LEN_MASK;
> > > > +
> > > > +   return le32_to_cpu(sg->len);
> > > > +}
> > >
> > > We should do this in dpaa2_fd_get_len() as well. Hardware is capable of
> > > generating FDs with SL bit set for single frame format too, although in
> > > practice I've never actually seen it.
> >
> > Any suggestion on how to test this case?
> 
> Actually, I stand corrected. Apparently WRIOP _always_ generates short
> len frames, it just happens that, for the current default settings, the rest
> of the bits in the 32bit word that contains the short length field are always
> zero.

Ok, so we were getting lucky.  I'll fix that in the next respin.

Thanks,
Stuart
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH 4/9] bus: fsl-mc: dpio: add frame descriptor and scatter/gather APIs

2016-11-04 Thread Stuart Yoder
 > +/**
> > + * dpaa2_fd_set_bpid() - Set the bpid field of frame descriptor
> > + * @fd: the given frame descriptor
> > + * @bpid: buffer pool id to be set
> > + */
> > +static inline void dpaa2_fd_set_bpid(struct dpaa2_fd *fd, uint16_t bpid)
> > +{
> > +   fd->simple.bpid = bpid;
> > +}
> 
> The setter/getter functions for fd.ctrl are missing.

Ok, will add those.  Does the ethernet driver use that field?

> > +
> > +/**
> > + * struct dpaa2_sg_entry - the scatter-gathering structure
> > + * @addr: address of the sg entry
> > + * @len: length in this sg entry
> > + * @bpid: buffer pool id
> > + * @format_offset: offset in the MS 16 bits, BPID in the LS 16 bits
> 
> Description of the format_offset field is incorrect, it shouldn't
> contain the reference to BPID.

Thanks, will fix.

> > +/**
> > + * dpaa2_sg_get_len() - Get the length in SG entry
> > + * @sg: the given scatter-gathering object
> > + *
> > + * Return the length.
> > + */
> > +static inline u32 dpaa2_sg_get_len(const struct dpaa2_sg_entry *sg)
> > +{
> > +   if (dpaa2_sg_short_len(sg))
> > +   return le32_to_cpu(sg->len) & SG_SHORT_LEN_MASK;
> > +
> > +   return le32_to_cpu(sg->len);
> > +}
> 
> We should do this in dpaa2_fd_get_len() as well. Hardware is capable of
> generating FDs with SL bit set for single frame format too, although in
> practice I've never actually seen it.

Any suggestion on how to test this case?

Thanks,
Stuart
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH 3/9] bus: fsl-mc: dpio: add APIs for DPIO objects

2016-11-04 Thread Stuart Yoder


> -Original Message-
> From: Ruxandra Ioana Radulescu
> Sent: Wednesday, November 02, 2016 9:50 AM
> To: Stuart Yoder <stuart.yo...@nxp.com>; gre...@linuxfoundation.org
> Cc: German Rivera <german.riv...@nxp.com>; de...@driverdev.osuosl.org; 
> linux-ker...@vger.kernel.org;
> ag...@suse.de; a...@arndb.de; Leo Li <leoyang...@nxp.com>; Roy Pledge 
> <roy.ple...@nxp.com>; Stuart Yoder
> <stuart.yo...@nxp.com>
> Subject: RE: [PATCH 3/9] bus: fsl-mc: dpio: add APIs for DPIO objects
> 
> > -Original Message-
> > From: Stuart Yoder [mailto:stuart.yo...@nxp.com]
> > Sent: Friday, October 21, 2016 5:02 PM
> > To: gre...@linuxfoundation.org
> > Cc: German Rivera <german.riv...@nxp.com>; de...@driverdev.osuosl.org;
> > linux-ker...@vger.kernel.org; ag...@suse.de; a...@arndb.de; Leo Li
> > <leoyang...@nxp.com>; Ruxandra Ioana Radulescu
> > <ruxandra.radule...@nxp.com>; Roy Pledge <roy.ple...@nxp.com>; Stuart
> > Yoder <stuart.yo...@nxp.com>
> > Subject: [PATCH 3/9] bus: fsl-mc: dpio: add APIs for DPIO objects
> >
> > From: Ioana Radulescu <ruxandra.radule...@nxp.com>
> >
> > Add the command build/parse APIs for operating on DPIO objects through
> > the DPAA2 Management Complex.
> >
> > Signed-off-by: Ioana Radulescu <ruxandra.radule...@nxp.com>
> > Signed-off-by: Roy Pledge <roy.ple...@nxp.com>
> > Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
> > ---
> >  drivers/bus/fsl-mc/Kconfig |  10 ++
> >  drivers/bus/fsl-mc/Makefile|   3 +
> >  drivers/bus/fsl-mc/dpio/Makefile   |   9 ++
> >  drivers/bus/fsl-mc/dpio/dpio-cmd.h | 198
> > 
> >  drivers/bus/fsl-mc/dpio/dpio.c | 229
> > +
> >  drivers/bus/fsl-mc/dpio/dpio.h | 108 +
> >  6 files changed, 557 insertions(+)
> >  create mode 100644 drivers/bus/fsl-mc/dpio/Makefile
> >  create mode 100644 drivers/bus/fsl-mc/dpio/dpio-cmd.h
> >  create mode 100644 drivers/bus/fsl-mc/dpio/dpio.c
> >  create mode 100644 drivers/bus/fsl-mc/dpio/dpio.h
> >
> > diff --git a/drivers/bus/fsl-mc/Kconfig b/drivers/bus/fsl-mc/Kconfig
> > index 5c009ab..a10aaf0 100644
> > --- a/drivers/bus/fsl-mc/Kconfig
> > +++ b/drivers/bus/fsl-mc/Kconfig
> > @@ -15,3 +15,13 @@ config FSL_MC_BUS
> >   architecture.  The fsl-mc bus driver handles discovery of
> >   DPAA2 objects (which are represented as Linux devices) and
> >   binding objects to drivers.
> > +
> > +config FSL_MC_DPIO
> > +tristate "QorIQ DPAA2 DPIO driver"
> > +depends on FSL_MC_BUS
> > +help
> > + Driver for the DPAA2 DPIO object.  A DPIO provides queue and
> > + buffer management facilities for software to interact with
> > + other DPAA2 objects. This driver does not expose the DPIO
> > + objects individually, but groups them under a service layer
> > + API.
> > diff --git a/drivers/bus/fsl-mc/Makefile b/drivers/bus/fsl-mc/Makefile
> > index d56afee..d18df72 100644
> > --- a/drivers/bus/fsl-mc/Makefile
> > +++ b/drivers/bus/fsl-mc/Makefile
> > @@ -17,3 +17,6 @@ mc-bus-driver-objs := fsl-mc-bus.o \
> >   fsl-mc-msi.o \
> >   dpmcp.o \
> >   dpbp.o
> > +
> > +# MC DPIO driver
> > +obj-$(CONFIG_FSL_MC_DPIO) += dpio/
> > diff --git a/drivers/bus/fsl-mc/dpio/Makefile b/drivers/bus/fsl-
> > mc/dpio/Makefile
> > new file mode 100644
> > index 000..128befc
> > --- /dev/null
> > +++ b/drivers/bus/fsl-mc/dpio/Makefile
> > @@ -0,0 +1,9 @@
> > +#
> > +# QorIQ DPAA2 DPIO driver
> > +#
> > +
> > +subdir-ccflags-y := -Werror
> > +
> > +obj-$(CONFIG_FSL_MC_DPIO) += fsl-mc-dpio.o
> > +
> > +fsl-mc-dpio-objs := dpio.o
> > diff --git a/drivers/bus/fsl-mc/dpio/dpio-cmd.h b/drivers/bus/fsl-
> > mc/dpio/dpio-cmd.h
> > new file mode 100644
> > index 000..b25a4cc
> > --- /dev/null
> > +++ b/drivers/bus/fsl-mc/dpio/dpio-cmd.h
> > @@ -0,0 +1,198 @@
> > +/*
> > + * Copyright 2013-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.
> > + * * Redistributi

[PATCH v2 08/12] staging: fsl-mc: improve message clarity by adding __func__

2016-10-26 Thread Stuart Yoder
clarify some error messages by printing the actual function name
involved

Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
---
-v2
   -patch is result of split of original patch, updated
commit messasge to reflect the change

 drivers/staging/fsl-mc/bus/fsl-mc-bus.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c 
b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
index 245acbf..5267c503 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
@@ -166,8 +166,7 @@ static int fsl_mc_driver_probe(struct device *dev)
 
error = mc_drv->probe(mc_dev);
if (error < 0) {
-   dev_err(dev, "MC object device probe callback failed: %d\n",
-   error);
+   dev_err(dev, "%s failed: %d\n", __func__, error);
return error;
}
 
@@ -185,9 +184,7 @@ static int fsl_mc_driver_remove(struct device *dev)
 
error = mc_drv->remove(mc_dev);
if (error < 0) {
-   dev_err(dev,
-   "MC object device remove callback failed: %d\n",
-   error);
+   dev_err(dev, "%s failed: %d\n", __func__, error);
return error;
}
 
-- 
1.9.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 10/12] staging: fsl-mc: improve wording in comments

2016-10-26 Thread Stuart Yoder
improve and clarify miscellaneous comments in the bus driver
and allocator

Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
---
-v2
   -update/improve commit message

 drivers/staging/fsl-mc/bus/fsl-mc-allocator.c | 68 +--
 drivers/staging/fsl-mc/bus/fsl-mc-bus.c   | 18 +++
 2 files changed, 42 insertions(+), 44 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c 
b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c
index e92c780..4a7ac97 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c
@@ -1,5 +1,5 @@
 /*
- * Freescale MC object device allocator driver
+ * fsl-mc object allocator driver
  *
  * Copyright (C) 2013 Freescale Semiconductor, Inc.
  *
@@ -23,15 +23,12 @@
 strcmp(_obj_type, "dpcon") == 0)
 
 /**
- * fsl_mc_resource_pool_add_device - add allocatable device to a resource
- * pool of a given MC bus
+ * fsl_mc_resource_pool_add_device - add allocatable object to a resource
+ * pool of a given fsl-mc bus
  *
- * @mc_bus: pointer to the MC bus
- * @pool_type: MC bus pool type
- * @mc_dev: Pointer to allocatable MC object device
- *
- * It adds an allocatable MC object device to a container's resource pool of
- * the given resource type
+ * @mc_bus: pointer to the fsl-mc bus
+ * @pool_type: pool type
+ * @mc_dev: pointer to allocatable fsl-mc device
  */
 static int __must_check fsl_mc_resource_pool_add_device(struct fsl_mc_bus
*mc_bus,
@@ -95,10 +92,10 @@ static int __must_check 
fsl_mc_resource_pool_add_device(struct fsl_mc_bus
  * fsl_mc_resource_pool_remove_device - remove an allocatable device from a
  * resource pool
  *
- * @mc_dev: Pointer to allocatable MC object device
+ * @mc_dev: pointer to allocatable fsl-mc device
  *
- * It permanently removes an allocatable MC object device from the resource
- * pool, the device is currently in, as long as it is in the pool's free list.
+ * It permanently removes an allocatable fsl-mc device from the resource
+ * pool. It's an error if the device is in use.
  */
 static int __must_check fsl_mc_resource_pool_remove_device(struct fsl_mc_device
   *mc_dev)
@@ -255,17 +252,18 @@ void fsl_mc_resource_free(struct fsl_mc_resource 
*resource)
 EXPORT_SYMBOL_GPL(fsl_mc_resource_free);
 
 /**
- * fsl_mc_object_allocate - Allocates a MC object device of the given
- * pool type from a given MC bus
+ * fsl_mc_object_allocate - Allocates an fsl-mc object of the given
+ * pool type from a given fsl-mc bus instance
  *
- * @mc_dev: MC device for which the MC object device is to be allocated
- * @pool_type: MC bus resource pool type
- * @new_mc_dev: Pointer to area where the pointer to the allocated
- * MC object device is to be returned
+ * @mc_dev: fsl-mc device which is used in conjunction with the
+ * allocated object
+ * @pool_type: pool type
+ * @new_mc_dev: pointer to area where the pointer to the allocated device
+ * is to be returned
  *
- * This function allocates a MC object device from the device's parent DPRC,
- * from the corresponding MC bus' pool of allocatable MC object devices of
- * the given resource type. mc_dev cannot be a DPRC itself.
+ * Allocatable objects are always used in conjunction with some functional
+ * device.  This function allocates an object of the specified type from
+ * the DPRC containing the functional device.
  *
  * NOTE: pool_type must be different from FSL_MC_POOL_MCP, since MC
  * portals are allocated using fsl_mc_portal_allocate(), instead of
@@ -312,10 +310,9 @@ int __must_check fsl_mc_object_allocate(struct 
fsl_mc_device *mc_dev,
 EXPORT_SYMBOL_GPL(fsl_mc_object_allocate);
 
 /**
- * fsl_mc_object_free - Returns an allocatable MC object device to the
- * corresponding resource pool of a given MC bus.
- *
- * @mc_adev: Pointer to the MC object device
+ * fsl_mc_object_free - Returns an fsl-mc object to the resource
+ * pool where it came from.
+ * @mc_adev: Pointer to the fsl-mc device
  */
 void fsl_mc_object_free(struct fsl_mc_device *mc_adev)
 {
@@ -332,8 +329,14 @@ void fsl_mc_object_free(struct fsl_mc_device *mc_adev)
 EXPORT_SYMBOL_GPL(fsl_mc_object_free);
 
 /*
- * Initialize the interrupt pool associated with a MC bus.
- * It allocates a block of IRQs from the GIC-ITS
+ * A DPRC and the devices in the DPRC all share the same GIC-ITS device
+ * ID.  A block of IRQs is pre-allocated and maintained in a pool
+ * from which devices can allocate them when needed.
+ */
+
+/*
+ * Initialize the interrupt pool associated with an fsl-mc bus.
+ * It allocates a block of IRQs from the GIC-ITS.
  */
 int fsl_mc_populate_irq_pool(struct fsl_mc_bus *mc_bus,
 unsigned int irq_count)
@@ -395,7 +398,7 @@ int fsl_mc_populate_irq_pool(struct fsl_mc_bus *mc_bus,
 EXPORT_SYMBOL_GPL(fsl_mc_populate_irq_pool);
 
 /**
- * Teardown the interrupt

[PATCH v2 12/12] staging: fsl-mc: uprev binary interface to match MC v10.x

2016-10-26 Thread Stuart Yoder
From: Ioana Ciornei <ioana.cior...@nxp.com>

DPAA2 will not support MC firmware versions prior to MC v10.x.
Update the MC interface code and drivers to reflect this.
   -update the object .h files and code that builds commands to include
the new command version in the command header
   -object versions are no longer available in the object attributes,
so remove references to them and instead get the version from the
new get_api_version() command
   -create/destroy commands for all objects have new arguments
   -dpmng_get_container_id() is replaced by dprc_get_container_id()

This supports a hardware ABI change and thus to match the new ABI
all the above changes need to happen in a single patch.

All MC firmware versions >= 10 will be supported going forward.

Signed-off-by: Ioana Ciornei <ioana.cior...@nxp.com>
Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
---
-v2
-updated commit message to clarify why all changes must
 happen at once

 drivers/staging/fsl-mc/bus/dpbp-cmd.h| 57 +++-
 drivers/staging/fsl-mc/bus/dpbp.c| 67 ++--
 drivers/staging/fsl-mc/bus/dpmcp-cmd.h   | 45 ++--
 drivers/staging/fsl-mc/bus/dpmcp.c   | 66 +--
 drivers/staging/fsl-mc/bus/dpmcp.h   | 18 ++-
 drivers/staging/fsl-mc/bus/dpmng-cmd.h   | 13 ++---
 drivers/staging/fsl-mc/bus/dpmng.c   | 33 
 drivers/staging/fsl-mc/bus/dprc-cmd.h| 89 +---
 drivers/staging/fsl-mc/bus/dprc-driver.c | 19 +--
 drivers/staging/fsl-mc/bus/dprc.c| 65 ++-
 drivers/staging/fsl-mc/bus/fsl-mc-bus.c  | 22 ++--
 drivers/staging/fsl-mc/bus/mc-sys.c  |  8 +--
 drivers/staging/fsl-mc/include/dpbp.h| 21 
 drivers/staging/fsl-mc/include/dprc.h| 19 ---
 drivers/staging/fsl-mc/include/mc-cmd.h  | 41 +++
 15 files changed, 356 insertions(+), 227 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/dpbp-cmd.h 
b/drivers/staging/fsl-mc/bus/dpbp-cmd.h
index 4cc2918..7d86539 100644
--- a/drivers/staging/fsl-mc/bus/dpbp-cmd.h
+++ b/drivers/staging/fsl-mc/bus/dpbp-cmd.h
@@ -33,37 +33,48 @@
 #define _FSL_DPBP_CMD_H
 
 /* DPBP Version */
-#define DPBP_VER_MAJOR 2
+#define DPBP_VER_MAJOR 3
 #define DPBP_VER_MINOR 2
 
+/* Command versioning */
+#define DPBP_CMD_BASE_VERSION  1
+#define DPBP_CMD_ID_OFFSET 4
+
+#define DPBP_CMD(id)   ((id << DPBP_CMD_ID_OFFSET) | DPBP_CMD_BASE_VERSION)
+
 /* Command IDs */
-#define DPBP_CMDID_CLOSE   0x800
-#define DPBP_CMDID_OPEN0x804
-#define DPBP_CMDID_CREATE  0x904
-#define DPBP_CMDID_DESTROY 0x900
-
-#define DPBP_CMDID_ENABLE  0x002
-#define DPBP_CMDID_DISABLE 0x003
-#define DPBP_CMDID_GET_ATTR0x004
-#define DPBP_CMDID_RESET   0x005
-#define DPBP_CMDID_IS_ENABLED  0x006
-
-#define DPBP_CMDID_SET_IRQ 0x010
-#define DPBP_CMDID_GET_IRQ 0x011
-#define DPBP_CMDID_SET_IRQ_ENABLE  0x012
-#define DPBP_CMDID_GET_IRQ_ENABLE  0x013
-#define DPBP_CMDID_SET_IRQ_MASK0x014
-#define DPBP_CMDID_GET_IRQ_MASK0x015
-#define DPBP_CMDID_GET_IRQ_STATUS  0x016
-#define DPBP_CMDID_CLEAR_IRQ_STATUS0x017
-
-#define DPBP_CMDID_SET_NOTIFICATIONS   0x01b0
-#define DPBP_CMDID_GET_NOTIFICATIONS   0x01b1
+#define DPBP_CMDID_CLOSE   DPBP_CMD(0x800)
+#define DPBP_CMDID_OPENDPBP_CMD(0x804)
+#define DPBP_CMDID_CREATE  DPBP_CMD(0x904)
+#define DPBP_CMDID_DESTROY DPBP_CMD(0x984)
+#define DPBP_CMDID_GET_API_VERSION DPBP_CMD(0xa04)
+
+#define DPBP_CMDID_ENABLE  DPBP_CMD(0x002)
+#define DPBP_CMDID_DISABLE DPBP_CMD(0x003)
+#define DPBP_CMDID_GET_ATTRDPBP_CMD(0x004)
+#define DPBP_CMDID_RESET   DPBP_CMD(0x005)
+#define DPBP_CMDID_IS_ENABLED  DPBP_CMD(0x006)
+
+#define DPBP_CMDID_SET_IRQ DPBP_CMD(0x010)
+#define DPBP_CMDID_GET_IRQ DPBP_CMD(0x011)
+#define DPBP_CMDID_SET_IRQ_ENABLE  DPBP_CMD(0x012)
+#define DPBP_CMDID_GET_IRQ_ENABLE  DPBP_CMD(0x013)
+#define DPBP_CMDID_SET_IRQ_MASKDPBP_CMD(0x014)
+#define DPBP_CMDID_GET_IRQ_MASKDPBP_CMD(0x015)
+#define DPBP_CMDID_GET_IRQ_STATUS  DPBP_CMD(0x016)
+#define DPBP_CMDID_CLEAR_IRQ_STATUSDPBP_CMD(0x017)
+
+#define DPBP_CMDID_SET_NOTIFICATIONS   DPBP_CMD(0x01b0)
+#define DPBP_CMDID_GET_NOTIFICATIONS   DPBP_CMD(0x01

[PATCH v2 09/12] staging: fsl-mc: cleanup: improve clarity of messages

2016-10-26 Thread Stuart Yoder
improve some messages by shortening and rewording

Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
---
-v2
   -patch is result of split of original patch, updated
commit messasge to reflect the change

 drivers/staging/fsl-mc/bus/fsl-mc-allocator.c |  4 ++--
 drivers/staging/fsl-mc/bus/fsl-mc-bus.c   | 13 +
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c 
b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c
index cf10148..e92c780 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c
@@ -605,7 +605,7 @@ static int fsl_mc_allocator_probe(struct fsl_mc_device 
*mc_dev)
return error;
 
dev_dbg(_dev->dev,
-   "Allocatable MC object device bound to fsl_mc_allocator 
driver");
+   "Allocatable fsl-mc device bound to fsl_mc_allocator driver");
return 0;
 }
 
@@ -627,7 +627,7 @@ static int fsl_mc_allocator_remove(struct fsl_mc_device 
*mc_dev)
}
 
dev_dbg(_dev->dev,
-   "Allocatable MC object device unbound from fsl_mc_allocator 
driver");
+   "Allocatable fsl-mc device unbound from fsl_mc_allocator 
driver");
return 0;
 }
 
diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c 
b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
index 5267c503..fb062d3 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
@@ -231,8 +231,7 @@ int __fsl_mc_driver_register(struct fsl_mc_driver 
*mc_driver,
return error;
}
 
-   pr_info("MC object device driver %s registered\n",
-   mc_driver->driver.name);
+   pr_info("driver %s registered\n", mc_driver->driver.name);
return 0;
 }
 EXPORT_SYMBOL_GPL(__fsl_mc_driver_register);
@@ -571,8 +570,7 @@ int fsl_mc_device_add(struct dprc_obj_desc *obj_desc,
}
 
(void)get_device(_dev->dev);
-   dev_dbg(parent_dev, "Added MC object device %s\n",
-   dev_name(_dev->dev));
+   dev_dbg(parent_dev, "added %s\n", dev_name(_dev->dev));
 
*new_mc_dev = mc_dev;
return 0;
@@ -748,7 +746,7 @@ static int fsl_mc_bus_probe(struct platform_device *pdev)
struct mc_version mc_version;
struct resource res;
 
-   dev_info(>dev, "Root MC bus device probed");
+   dev_info(>dev, "root DPRC probed");
 
mc = devm_kzalloc(>dev, sizeof(*mc), GFP_KERNEL);
if (!mc)
@@ -782,8 +780,7 @@ static int fsl_mc_bus_probe(struct platform_device *pdev)
goto error_cleanup_mc_io;
}
 
-   dev_info(>dev,
-"Freescale Management Complex Firmware version: %u.%u.%u\n",
+   dev_info(>dev, "MC firmware version: %u.%u.%u\n",
 mc_version.major, mc_version.minor, mc_version.revision);
 
error = get_mc_addr_translation_ranges(>dev,
@@ -839,7 +836,7 @@ static int fsl_mc_bus_remove(struct platform_device *pdev)
fsl_destroy_mc_io(mc->root_mc_bus_dev->mc_io);
mc->root_mc_bus_dev->mc_io = NULL;
 
-   dev_info(>dev, "Root MC bus device removed");
+   dev_info(>dev, "root DPRC removed");
return 0;
 }
 
-- 
1.9.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 11/12] staging: fsl-mc: update copyright dates

2016-10-26 Thread Stuart Yoder
Many source files have evolved without copyright date
updates.  Update the dates to reflect work through
2016.

Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
---
-v2 
   -no changes

 drivers/staging/fsl-mc/bus/dpcon-cmd.h | 2 +-
 drivers/staging/fsl-mc/bus/dpmcp.h | 2 +-
 drivers/staging/fsl-mc/bus/dprc-driver.c   | 2 +-
 drivers/staging/fsl-mc/bus/fsl-mc-allocator.c  | 2 +-
 drivers/staging/fsl-mc/bus/fsl-mc-bus.c| 2 +-
 drivers/staging/fsl-mc/bus/fsl-mc-msi.c| 2 +-
 drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c | 2 +-
 drivers/staging/fsl-mc/bus/mc-sys.c| 2 +-
 drivers/staging/fsl-mc/include/dpbp.h  | 2 +-
 drivers/staging/fsl-mc/include/dpmng.h | 2 +-
 drivers/staging/fsl-mc/include/dprc.h  | 2 +-
 drivers/staging/fsl-mc/include/mc-bus.h| 2 +-
 drivers/staging/fsl-mc/include/mc-cmd.h| 2 +-
 drivers/staging/fsl-mc/include/mc-sys.h| 2 +-
 drivers/staging/fsl-mc/include/mc.h| 2 +-
 15 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/dpcon-cmd.h 
b/drivers/staging/fsl-mc/bus/dpcon-cmd.h
index 4ebb3fc..d0a5e19 100644
--- a/drivers/staging/fsl-mc/bus/dpcon-cmd.h
+++ b/drivers/staging/fsl-mc/bus/dpcon-cmd.h
@@ -1,5 +1,5 @@
 /*
- * Copyright 2013-2015 Freescale Semiconductor Inc.
+ * Copyright 2013-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:
diff --git a/drivers/staging/fsl-mc/bus/dpmcp.h 
b/drivers/staging/fsl-mc/bus/dpmcp.h
index 3cd1e3a..ff97174 100644
--- a/drivers/staging/fsl-mc/bus/dpmcp.h
+++ b/drivers/staging/fsl-mc/bus/dpmcp.h
@@ -1,5 +1,5 @@
 /*
- * Copyright 2013-2015 Freescale Semiconductor Inc.
+ * Copyright 2013-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:
diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c 
b/drivers/staging/fsl-mc/bus/dprc-driver.c
index 6aa2915..b4e46fb 100644
--- a/drivers/staging/fsl-mc/bus/dprc-driver.c
+++ b/drivers/staging/fsl-mc/bus/dprc-driver.c
@@ -1,7 +1,7 @@
 /*
  * Freescale data path resource container (DPRC) driver
  *
- * Copyright (C) 2014 Freescale Semiconductor, Inc.
+ * Copyright (C) 2014-2016 Freescale Semiconductor, Inc.
  * Author: German Rivera <german.riv...@freescale.com>
  *
  * This file is licensed under the terms of the GNU General Public
diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c 
b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c
index 4a7ac97..ce07096 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c
@@ -1,7 +1,7 @@
 /*
  * fsl-mc object allocator driver
  *
- * Copyright (C) 2013 Freescale Semiconductor, Inc.
+ * Copyright (C) 2013-2016 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
diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c 
b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
index 6f148b2..4588202 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
@@ -1,7 +1,7 @@
 /*
  * Freescale Management Complex (MC) bus driver
  *
- * Copyright (C) 2014 Freescale Semiconductor, Inc.
+ * Copyright (C) 2014-2016 Freescale Semiconductor, Inc.
  * Author: German Rivera <german.riv...@freescale.com>
  *
  * This file is licensed under the terms of the GNU General Public
diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-msi.c 
b/drivers/staging/fsl-mc/bus/fsl-mc-msi.c
index 3d46b1b..7975c6e 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-msi.c
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-msi.c
@@ -1,7 +1,7 @@
 /*
  * Freescale Management Complex (MC) bus driver MSI support
  *
- * Copyright (C) 2015 Freescale Semiconductor, Inc.
+ * Copyright (C) 2015-2016 Freescale Semiconductor, Inc.
  * Author: German Rivera <german.riv...@freescale.com>
  *
  * This file is licensed under the terms of the GNU General Public
diff --git a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c 
b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
index 16b0d4a..6b1cd57 100644
--- a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
+++ b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
@@ -1,7 +1,7 @@
 /*
  * Freescale Management Complex (MC) bus driver MSI support
  *
- * Copyright (C) 2015 Freescale Semiconductor, Inc.
+ * Copyright (C) 2015-2016 Freescale Semiconductor, Inc.
  * Author: German Rivera <german.riv...@freescale.com>
  *
  * This file is licensed under the terms of the GNU General Public
diff --git a/drivers/stagin

[PATCH v2 06/12] staging: fsl-mc: cleanup comment style

2016-10-26 Thread Stuart Yoder
Be consistent and use kernel-preferred multi-line comment style
everywhere.

Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
---
-v2
   -no changes

 drivers/staging/fsl-mc/bus/dpbp-cmd.h   |  3 ++-
 drivers/staging/fsl-mc/bus/dpbp.c   |  3 ++-
 drivers/staging/fsl-mc/bus/dpcon-cmd.h  |  3 ++-
 drivers/staging/fsl-mc/bus/dpmcp-cmd.h  |  3 ++-
 drivers/staging/fsl-mc/bus/dpmcp.c  |  3 ++-
 drivers/staging/fsl-mc/bus/dpmcp.h  |  6 --
 drivers/staging/fsl-mc/bus/dpmng.c  |  3 ++-
 drivers/staging/fsl-mc/bus/dprc.c   |  3 ++-
 drivers/staging/fsl-mc/bus/mc-io.c  |  3 ++-
 drivers/staging/fsl-mc/bus/mc-sys.c |  3 ++-
 drivers/staging/fsl-mc/include/dpbp.h   |  6 --
 drivers/staging/fsl-mc/include/dpmng.h  |  6 --
 drivers/staging/fsl-mc/include/dprc.h   | 33 ++---
 drivers/staging/fsl-mc/include/mc-cmd.h |  3 ++-
 drivers/staging/fsl-mc/include/mc-sys.h |  3 ++-
 15 files changed, 56 insertions(+), 28 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/dpbp-cmd.h 
b/drivers/staging/fsl-mc/bus/dpbp-cmd.h
index 489c27f..4cc2918 100644
--- a/drivers/staging/fsl-mc/bus/dpbp-cmd.h
+++ b/drivers/staging/fsl-mc/bus/dpbp-cmd.h
@@ -1,4 +1,5 @@
-/* Copyright 2013-2016 Freescale Semiconductor Inc.
+/*
+ * Copyright 2013-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:
diff --git a/drivers/staging/fsl-mc/bus/dpbp.c 
b/drivers/staging/fsl-mc/bus/dpbp.c
index 0b2064e..122c40d 100644
--- a/drivers/staging/fsl-mc/bus/dpbp.c
+++ b/drivers/staging/fsl-mc/bus/dpbp.c
@@ -1,4 +1,5 @@
-/* Copyright 2013-2016 Freescale Semiconductor Inc.
+/*
+ * Copyright 2013-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:
diff --git a/drivers/staging/fsl-mc/bus/dpcon-cmd.h 
b/drivers/staging/fsl-mc/bus/dpcon-cmd.h
index c89b305..4ebb3fc 100644
--- a/drivers/staging/fsl-mc/bus/dpcon-cmd.h
+++ b/drivers/staging/fsl-mc/bus/dpcon-cmd.h
@@ -1,4 +1,5 @@
-/* Copyright 2013-2015 Freescale Semiconductor Inc.
+/*
+ * Copyright 2013-2015 Freescale Semiconductor Inc.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
diff --git a/drivers/staging/fsl-mc/bus/dpmcp-cmd.h 
b/drivers/staging/fsl-mc/bus/dpmcp-cmd.h
index b77c902..1073ca2 100644
--- a/drivers/staging/fsl-mc/bus/dpmcp-cmd.h
+++ b/drivers/staging/fsl-mc/bus/dpmcp-cmd.h
@@ -1,4 +1,5 @@
-/* Copyright 2013-2016 Freescale Semiconductor Inc.
+/*
+ * Copyright 2013-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:
diff --git a/drivers/staging/fsl-mc/bus/dpmcp.c 
b/drivers/staging/fsl-mc/bus/dpmcp.c
index 865572d4..faade1e 100644
--- a/drivers/staging/fsl-mc/bus/dpmcp.c
+++ b/drivers/staging/fsl-mc/bus/dpmcp.c
@@ -1,4 +1,5 @@
-/* Copyright 2013-2016 Freescale Semiconductor Inc.
+/*
+ * Copyright 2013-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:
diff --git a/drivers/staging/fsl-mc/bus/dpmcp.h 
b/drivers/staging/fsl-mc/bus/dpmcp.h
index c0e6017..3cd1e3a 100644
--- a/drivers/staging/fsl-mc/bus/dpmcp.h
+++ b/drivers/staging/fsl-mc/bus/dpmcp.h
@@ -1,4 +1,5 @@
-/* Copyright 2013-2015 Freescale Semiconductor Inc.
+/*
+ * Copyright 2013-2015 Freescale Semiconductor Inc.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -31,7 +32,8 @@
 #ifndef __FSL_DPMCP_H
 #define __FSL_DPMCP_H
 
-/* Data Path Management Command Portal API
+/*
+ * Data Path Management Command Portal API
  * Contains initialization APIs and runtime control APIs for DPMCP
  */
 
diff --git a/drivers/staging/fsl-mc/bus/dpmng.c 
b/drivers/staging/fsl-mc/bus/dpmng.c
index 13bec9e..831c6ed 100644
--- a/drivers/staging/fsl-mc/bus/dpmng.c
+++ b/drivers/staging/fsl-mc/bus/dpmng.c
@@ -1,4 +1,5 @@
-/* Copyright 2013-2016 Freescale Semiconductor Inc.
+/*
+ * Copyright 2013-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:
diff --git a/drivers/staging/fsl-mc/bus/dprc.c 
b/drivers/staging/fsl-mc/bus/dprc.c
index 24c8dfb..ace3441 100644
--- a/drivers/staging/fsl-mc/bus/dprc.c
+++ b/drivers/staging/fsl-mc/bus/dprc.c
@@ -1,4 +1,5 @@
-/* Copyright 2013-2016 Freescale Semiconductor Inc.
+/*
+ * Copyright 2013-2016 Freescale Semiconductor Inc.
  *
  * Redistribution and use in source and 

[PATCH v2 03/12] staging: fsl-mc: whitespace cleanup: remove extraenous tabs

2016-10-26 Thread Stuart Yoder
use one tab to separate name and value in #define definitions

Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
---
-v2
   -patch is result of split of original patch, updated
commit messasge and author to reflect the change

 drivers/staging/fsl-mc/include/dprc.h | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/fsl-mc/include/dprc.h 
b/drivers/staging/fsl-mc/include/dprc.h
index 593b2bb..07a11b3 100644
--- a/drivers/staging/fsl-mc/include/dprc.h
+++ b/drivers/staging/fsl-mc/include/dprc.h
@@ -139,7 +139,7 @@ int dprc_reset_container(struct fsl_mc_io *mc_io,
 #define DPRC_IRQ_INDEX  0
 
 /* Number of dprc's IRQs */
-#define DPRC_NUM_OF_IRQS   1
+#define DPRC_NUM_OF_IRQS   1
 
 /* DPRC IRQ events */
 
@@ -274,20 +274,20 @@ int dprc_get_res_quota(struct fsl_mc_io   *mc_io,
  * are explicit and sequential (in case of resources).
  * The base ID is given at res_req at base_align field
  */
-#define DPRC_RES_REQ_OPT_EXPLICIT  0x0001
+#define DPRC_RES_REQ_OPT_EXPLICIT  0x0001
 
 /* Aligned resources request - Relevant only for resources
  * request (and not objects). Indicates that resources base ID should be
  * sequential and aligned to the value given at dprc_res_req base_align field
  */
-#define DPRC_RES_REQ_OPT_ALIGNED   0x0002
+#define DPRC_RES_REQ_OPT_ALIGNED   0x0002
 
 /* Plugged Flag - Relevant only for object assignment request.
  * Indicates that after all objects assigned. An interrupt will be invoked at
  * the relevant GPP. The assigned object will be marked as plugged.
  * plugged objects can't be assigned from their container
  */
-#define DPRC_RES_REQ_OPT_PLUGGED   0x0004
+#define DPRC_RES_REQ_OPT_PLUGGED   0x0004
 
 /**
  * struct dprc_res_req - Resource request descriptor, to be used in assignment
@@ -353,7 +353,7 @@ int dprc_get_obj_count(struct fsl_mc_io *mc_io,
  * masters;
  * user is responsible for proper memory handling through IOMMU configuration.
  */
-#define DPRC_OBJ_FLAG_NO_MEM_SHAREABILITY  0x0001
+#define DPRC_OBJ_FLAG_NO_MEM_SHAREABILITY  0x0001
 
 /**
  * struct dprc_obj_desc - Object descriptor, returned from dprc_get_obj()
-- 
1.9.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 07/12] staging: fsl-mc: improve pr_* messages

2016-10-26 Thread Stuart Yoder
define pr_fmt so non dev_* messages will have an fsl-mc prefix
and remove "fsl-mc" from messages where it would now be redundant

Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
---
-v2
   -patch is result of split of original patch, updated
commit messasge to reflect the change

 drivers/staging/fsl-mc/bus/fsl-mc-bus.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c 
b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
index 44f64b6..245acbf 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
@@ -9,6 +9,8 @@
  * warranty of any kind, whether express or implied.
  */
 
+#define pr_fmt(fmt) "fsl-mc: " fmt
+
 #include 
 #include 
 #include 
@@ -875,11 +877,11 @@ static int __init fsl_mc_bus_driver_init(void)
 
error = bus_register(_mc_bus_type);
if (error < 0) {
-   pr_err("fsl-mc bus type registration failed: %d\n", error);
+   pr_err("bus type registration failed: %d\n", error);
goto error_cleanup_cache;
}
 
-   pr_info("fsl-mc bus type registered\n");
+   pr_info("bus type registered\n");
 
error = platform_driver_register(_mc_bus_driver);
if (error < 0) {
-- 
1.9.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 05/12] staging: fsl-mc: whitespace cleanup: improve alignment in prototypes

2016-10-26 Thread Stuart Yoder
From: Ioana Ciornei <ioana.cior...@nxp.com>

To improve readability for structs and function definitions, separate type
and variable name by a single space, instead of an inconsistent number of
tabs.

Signed-off-by: Ioana Ciornei <ioana.cior...@nxp.com>
Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
---
-v2
   -patch is result of split of original patch, updated
commit messasge to reflect the change

 drivers/staging/fsl-mc/bus/dpmcp.h | 104 +-
 drivers/staging/fsl-mc/include/dpbp.h  | 144 +++---
 drivers/staging/fsl-mc/include/dpmng.h |  12 +-
 drivers/staging/fsl-mc/include/dprc.h  | 342 -
 4 files changed, 301 insertions(+), 301 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/dpmcp.h 
b/drivers/staging/fsl-mc/bus/dpmcp.h
index 0a24c37..c0e6017 100644
--- a/drivers/staging/fsl-mc/bus/dpmcp.h
+++ b/drivers/staging/fsl-mc/bus/dpmcp.h
@@ -58,10 +58,10 @@ struct dpmcp_cfg {
int portal_id;
 };
 
-int dpmcp_create(struct fsl_mc_io  *mc_io,
-u32cmd_flags,
+int dpmcp_create(struct fsl_mc_io *mc_io,
+u32 cmd_flags,
 const struct dpmcp_cfg *cfg,
-u16*token);
+u16 *token);
 
 int dpmcp_destroy(struct fsl_mc_io *mc_io,
  u32 cmd_flags,
@@ -84,53 +84,53 @@ int dpmcp_reset(struct fsl_mc_io *mc_io,
  * @irq_num: A user defined number associated with this IRQ
  */
 struct dpmcp_irq_cfg {
-u64paddr;
-u32val;
-intirq_num;
+u64 paddr;
+u32 val;
+int irq_num;
 };
 
-int dpmcp_set_irq(struct fsl_mc_io *mc_io,
- u32   cmd_flags,
- u16   token,
- u8irq_index,
- struct dpmcp_irq_cfg  *irq_cfg);
-
-int dpmcp_get_irq(struct fsl_mc_io *mc_io,
- u32   cmd_flags,
- u16   token,
- u8irq_index,
- int   *type,
- struct dpmcp_irq_cfg  *irq_cfg);
-
-int dpmcp_set_irq_enable(struct fsl_mc_io  *mc_io,
-u32cmd_flags,
-u16token,
-u8 irq_index,
-u8 en);
-
-int dpmcp_get_irq_enable(struct fsl_mc_io  *mc_io,
-u32cmd_flags,
-u16token,
-u8 irq_index,
-u8 *en);
-
-int dpmcp_set_irq_mask(struct fsl_mc_io*mc_io,
-  u32  cmd_flags,
-  u16  token,
-  u8   irq_index,
-  u32  mask);
-
-int dpmcp_get_irq_mask(struct fsl_mc_io*mc_io,
-  u32  cmd_flags,
-  u16  token,
-  u8   irq_index,
-  u32  *mask);
-
-int dpmcp_get_irq_status(struct fsl_mc_io  *mc_io,
-u32cmd_flags,
-u16token,
-u8 irq_index,
-u32*status);
+int dpmcp_set_irq(struct fsl_mc_io *mc_io,
+ u32 cmd_flags,
+ u16 token,
+ u8 irq_index,
+ struct dpmcp_irq_cfg *irq_cfg);
+
+int dpmcp_get_irq(struct fsl_mc_io *mc_io,
+ u32 cmd_flags,
+ u16 token,
+ u8 irq_index,
+ int *type,
+ struct dpmcp_irq_cfg *irq_cfg);
+
+int dpmcp_set_irq_enable(struct fsl_mc_io *mc_io,
+u32 cmd_flags,
+u16 token,
+u8 irq_index,
+u8 en);
+
+int dpmcp_get_irq_enable(struct fsl_mc_io *mc_io,
+u32 cmd_flags,
+u16 token,
+u8 irq_index,
+u8 *en);
+
+int dpmcp_set_irq_mask(struct fsl_mc_io *mc_io,
+  u32 cmd_flags,
+  u16 token,
+  u8 irq_index,
+  u32 mask);
+
+int dpmcp_get_irq_mask(struct fsl_mc_io *mc_io,
+  u32 cmd_flags,
+  u16 token,
+  u8 irq_index,
+  u32 *mask);
+
+int dpmcp_get_irq_status(struct fsl_mc_io *mc_io,
+u32 cmd_flags,
+u16 token,
+u8 irq_index,
+u32 *status);
 
 /**
  * struct dpmcp_attr - Structure representing DPMCP attributes
@@ -150,9 +150,9 @@

[PATCH v2 04/12] staging: fsl-mc: whitespace cleanup: align function args

2016-10-26 Thread Stuart Yoder
From: Ioana Ciornei <ioana.cior...@nxp.com>

align function arguments that were not aligned to the starting parenthesis

Signed-off-by: Ioana Ciornei <ioana.cior...@nxp.com>
Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
---
-v2
   -patch is result of split of original patch, updated
commit messasge to reflect the change

 drivers/staging/fsl-mc/bus/dpmcp.h| 32 
 drivers/staging/fsl-mc/include/dprc.h |  8 
 2 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/dpmcp.h 
b/drivers/staging/fsl-mc/bus/dpmcp.h
index c40253a..0a24c37 100644
--- a/drivers/staging/fsl-mc/bus/dpmcp.h
+++ b/drivers/staging/fsl-mc/bus/dpmcp.h
@@ -61,7 +61,7 @@ struct dpmcp_cfg {
 int dpmcp_create(struct fsl_mc_io  *mc_io,
 u32cmd_flags,
 const struct dpmcp_cfg *cfg,
-   u16 *token);
+u16*token);
 
 int dpmcp_destroy(struct fsl_mc_io *mc_io,
  u32 cmd_flags,
@@ -92,45 +92,45 @@ struct dpmcp_irq_cfg {
 int dpmcp_set_irq(struct fsl_mc_io *mc_io,
  u32   cmd_flags,
  u16   token,
-u8 irq_index,
+ u8irq_index,
  struct dpmcp_irq_cfg  *irq_cfg);
 
 int dpmcp_get_irq(struct fsl_mc_io *mc_io,
  u32   cmd_flags,
  u16   token,
-u8 irq_index,
-int*type,
-struct dpmcp_irq_cfg   *irq_cfg);
+ u8irq_index,
+ int   *type,
+ struct dpmcp_irq_cfg  *irq_cfg);
 
 int dpmcp_set_irq_enable(struct fsl_mc_io  *mc_io,
 u32cmd_flags,
 u16token,
-   u8  irq_index,
-   u8  en);
+u8 irq_index,
+u8 en);
 
 int dpmcp_get_irq_enable(struct fsl_mc_io  *mc_io,
 u32cmd_flags,
 u16token,
-   u8  irq_index,
-   u8  *en);
+u8 irq_index,
+u8 *en);
 
 int dpmcp_set_irq_mask(struct fsl_mc_io*mc_io,
   u32  cmd_flags,
   u16  token,
- u8irq_index,
- u32   mask);
+  u8   irq_index,
+  u32  mask);
 
 int dpmcp_get_irq_mask(struct fsl_mc_io*mc_io,
   u32  cmd_flags,
   u16  token,
- u8irq_index,
- u32   *mask);
+  u8   irq_index,
+  u32  *mask);
 
 int dpmcp_get_irq_status(struct fsl_mc_io  *mc_io,
 u32cmd_flags,
 u16token,
-   u8  irq_index,
-   u32 *status);
+u8 irq_index,
+u32*status);
 
 /**
  * struct dpmcp_attr - Structure representing DPMCP attributes
@@ -153,6 +153,6 @@ struct dpmcp_attr {
 int dpmcp_get_attributes(struct fsl_mc_io  *mc_io,
 u32cmd_flags,
 u16token,
-   struct dpmcp_attr   *attr);
+struct dpmcp_attr  *attr);
 
 #endif /* __FSL_DPMCP_H */
diff --git a/drivers/staging/fsl-mc/include/dprc.h 
b/drivers/staging/fsl-mc/include/dprc.h
index 07a11b3..c40abcd 100644
--- a/drivers/staging/fsl-mc/include/dprc.h
+++ b/drivers/staging/fsl-mc/include/dprc.h
@@ -389,10 +389,10 @@ int dprc_get_obj(struct fsl_mc_io *mc_io,
 
 int dprc_get_obj_desc(struct fsl_mc_io *mc_io,
  u32   cmd_flags,
-   u16 token,
-   char*obj_type,
-   int obj_id,
-   struct dprc_obj_desc*obj_desc);
+ u16   token,
+ char  *obj_type,
+ int   obj_id,
+ struct dprc_obj_desc  *obj_desc);
 
 int dprc_set_obj_irq(struct fsl_mc_io  *mc_io,
 u32cm

[PATCH v2 02/12] staging: fsl-mc: whitespace cleanup: remove blank lines

2016-10-26 Thread Stuart Yoder
remove instances of multiple blank lines in comments

Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
---
-v2
   -patch is result of split of original patch, updated
commit messasge and author to reflect the change

 drivers/staging/fsl-mc/bus/dpbp-cmd.h  | 1 -
 drivers/staging/fsl-mc/bus/dpbp.c  | 1 -
 drivers/staging/fsl-mc/bus/dpcon-cmd.h | 1 -
 drivers/staging/fsl-mc/bus/dpmcp-cmd.h | 1 -
 drivers/staging/fsl-mc/bus/dpmcp.c | 1 -
 drivers/staging/fsl-mc/bus/dpmcp.h | 1 -
 drivers/staging/fsl-mc/bus/dpmng-cmd.h | 1 -
 drivers/staging/fsl-mc/bus/dpmng.c | 1 -
 drivers/staging/fsl-mc/bus/dprc-cmd.h  | 1 -
 drivers/staging/fsl-mc/bus/dprc.c  | 1 -
 drivers/staging/fsl-mc/bus/mc-io.c | 1 -
 drivers/staging/fsl-mc/bus/mc-sys.c| 1 -
 12 files changed, 12 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/dpbp-cmd.h 
b/drivers/staging/fsl-mc/bus/dpbp-cmd.h
index 2860411..489c27f 100644
--- a/drivers/staging/fsl-mc/bus/dpbp-cmd.h
+++ b/drivers/staging/fsl-mc/bus/dpbp-cmd.h
@@ -11,7 +11,6 @@
  * names of any 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
diff --git a/drivers/staging/fsl-mc/bus/dpbp.c 
b/drivers/staging/fsl-mc/bus/dpbp.c
index b392745..0b2064e 100644
--- a/drivers/staging/fsl-mc/bus/dpbp.c
+++ b/drivers/staging/fsl-mc/bus/dpbp.c
@@ -11,7 +11,6 @@
  * names of any 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
diff --git a/drivers/staging/fsl-mc/bus/dpcon-cmd.h 
b/drivers/staging/fsl-mc/bus/dpcon-cmd.h
index 536b2ef..c89b305 100644
--- a/drivers/staging/fsl-mc/bus/dpcon-cmd.h
+++ b/drivers/staging/fsl-mc/bus/dpcon-cmd.h
@@ -11,7 +11,6 @@
  * names of any 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
diff --git a/drivers/staging/fsl-mc/bus/dpmcp-cmd.h 
b/drivers/staging/fsl-mc/bus/dpmcp-cmd.h
index d098a6d..b77c902 100644
--- a/drivers/staging/fsl-mc/bus/dpmcp-cmd.h
+++ b/drivers/staging/fsl-mc/bus/dpmcp-cmd.h
@@ -11,7 +11,6 @@
  * names of any 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
diff --git a/drivers/staging/fsl-mc/bus/dpmcp.c 
b/drivers/staging/fsl-mc/bus/dpmcp.c
index 55766f7..865572d4 100644
--- a/drivers/staging/fsl-mc/bus/dpmcp.c
+++ b/drivers/staging/fsl-mc/bus/dpmcp.c
@@ -11,7 +11,6 @@
  * names of any 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
diff --git a/drivers/staging/fsl-mc/bus/dpmcp.h 
b/drivers/staging/fsl-mc/bus/dpmcp.h
index 5434e09..c40253a 100644
--- a/drivers/staging/fsl-mc/bus/dpmcp.h
+++ b/drivers/staging/fsl-mc/bus/dpmcp.h
@@ -11,7 +11,6 @@
  * names of any 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
diff --git a/drivers/staging/fsl-mc/bus/dpmng-cmd.h 
b/drivers/staging/fsl-mc/bus/dpmng-cmd.h
index a7b77d5..d42d977 100644
--- a/drivers/staging/fsl-mc/bus/dpmng-cmd.h
+++ b/drivers/staging/fsl-mc/bus/dpmng-cmd.h
@@ -12,7 +12,6 @@
  *   names of any 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 ("G

[PATCH v2 00/12] staging: fsl-mc: cleanup and uprev to MC v10.x

2016-10-26 Thread Stuart Yoder
This patch does miscellaneous minor cleanup and uprevs the supported
MC firmware version to 10.x.

version 2 changes
  -move MAINTAINERS change so it's sorted properly
  -split whitespace cleanup into separate patches
  -split message cleanup into separate patches
  -use pr_fmt to set a message prefix
  -some commit message updates

Ioana Ciornei (3):
  staging: fsl-mc: whitespace cleanup: align function args
  staging: fsl-mc: whitespace cleanup: improve alignment in prototypes
  staging: fsl-mc: uprev binary interface to match MC v10.x

Stuart Yoder (9):
  staging: fsl-mc: update MAINTAINERS
  staging: fsl-mc: whitespace cleanup: remove blank lines
  staging: fsl-mc: whitespace cleanup: remove extraenous tabs
  staging: fsl-mc: cleanup comment style
  staging: fsl-mc: improve pr_* messages
  staging: fsl-mc: improve message clarity by adding __func__
  staging: fsl-mc: cleanup: improve clarity of messages
  staging: fsl-mc: improve wording in comments
  staging: fsl-mc: update copyright dates

 MAINTAINERS|  13 +-
 drivers/staging/fsl-mc/bus/dpbp-cmd.h  |  61 ++--
 drivers/staging/fsl-mc/bus/dpbp.c  |  71 +++-
 drivers/staging/fsl-mc/bus/dpcon-cmd.h |   4 +-
 drivers/staging/fsl-mc/bus/dpmcp-cmd.h |  49 ++-
 drivers/staging/fsl-mc/bus/dpmcp.c |  70 +++-
 drivers/staging/fsl-mc/bus/dpmcp.h | 127 +++
 drivers/staging/fsl-mc/bus/dpmng-cmd.h |  14 +-
 drivers/staging/fsl-mc/bus/dpmng.c |  37 +-
 drivers/staging/fsl-mc/bus/dprc-cmd.h  |  90 ++---
 drivers/staging/fsl-mc/bus/dprc-driver.c   |  21 +-
 drivers/staging/fsl-mc/bus/dprc.c  |  69 +++-
 drivers/staging/fsl-mc/bus/fsl-mc-allocator.c  |  74 ++--
 drivers/staging/fsl-mc/bus/fsl-mc-bus.c|  68 ++--
 drivers/staging/fsl-mc/bus/fsl-mc-msi.c|   2 +-
 .../staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c |   2 +-
 drivers/staging/fsl-mc/bus/mc-io.c |   4 +-
 drivers/staging/fsl-mc/bus/mc-sys.c|  12 +-
 drivers/staging/fsl-mc/include/dpbp.h  | 169 +
 drivers/staging/fsl-mc/include/dpmng.h |  18 +-
 drivers/staging/fsl-mc/include/dprc.h  | 402 +++--
 drivers/staging/fsl-mc/include/mc-bus.h|   2 +-
 drivers/staging/fsl-mc/include/mc-cmd.h|  44 ++-
 drivers/staging/fsl-mc/include/mc-sys.h|   3 +-
 drivers/staging/fsl-mc/include/mc.h|   2 +-
 25 files changed, 783 insertions(+), 645 deletions(-)

-- 
1.9.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 01/12] staging: fsl-mc: update MAINTAINERS

2016-10-26 Thread Stuart Yoder
-German has moved on to other things and wished to be
 removed as a maintainer
-cleanup the driver description to use the proper name
 of the driver (i.e. the fsl-mc bus driver) and remove incorrect
 references to Freescale

Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
Acked-by: J. German Rivera <german.riv...@freescale.com>
---
v2
   -move updated entry so file is properly sorted

 MAINTAINERS | 13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 8d9392a..5adc5ba 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5098,13 +5098,6 @@ F:   sound/soc/fsl/fsl*
 F: sound/soc/fsl/imx*
 F: sound/soc/fsl/mpc8610_hpcd.c
 
-FREESCALE QORIQ MANAGEMENT COMPLEX DRIVER
-M: "J. German Rivera" <german.riv...@freescale.com>
-M: Stuart Yoder <stuart.yo...@nxp.com>
-L: linux-ker...@vger.kernel.org
-S: Maintained
-F: drivers/staging/fsl-mc/
-
 FREEVXFS FILESYSTEM
 M: Christoph Hellwig <h...@infradead.org>
 W: ftp://ftp.openlinux.org/pub/people/hch/vxfs
@@ -9936,6 +9929,12 @@ F:   fs/qnx4/
 F: include/uapi/linux/qnx4_fs.h
 F: include/uapi/linux/qnxtypes.h
 
+QORIQ DPAA2 FSL-MC BUS DRIVER
+M: Stuart Yoder <stuart.yo...@nxp.com>
+L: linux-ker...@vger.kernel.org
+S: Maintained
+F: drivers/staging/fsl-mc/
+
 QT1010 MEDIA DRIVER
 M: Antti Palosaari <cr...@iki.fi>
 L: linux-me...@vger.kernel.org
-- 
1.9.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH 0/9] staging: fsl-mc: move bus driver out of staging, add dpio

2016-10-25 Thread Stuart Yoder


> -Original Message-
> From: Alexander Graf [mailto:ag...@suse.de]
> Sent: Monday, October 24, 2016 9:34 AM
> To: Stuart Yoder <stuart.yo...@nxp.com>; gre...@linuxfoundation.org
> Cc: German Rivera <german.riv...@nxp.com>; de...@driverdev.osuosl.org; 
> linux-ker...@vger.kernel.org;
> a...@arndb.de; Leo Li <leoyang...@nxp.com>
> Subject: Re: [PATCH 0/9] staging: fsl-mc: move bus driver out of staging, add 
> dpio
> 
> Hi Stuart,
> 
> On 10/21/2016 04:01 PM, Stuart Yoder wrote:
> > This patch series: A) addresses the final item in the staging
> > TODO list for the fsl-mc bus driver-- adding a functional driver
> > on top of the bus driver, and B) requests that the fsl-mc bus driver
> > be moved out of staging.
> 
> Awesome, it's great to see progress again! :)
> 
> > The proposed destination for the bus driver is drivers/bus.
> > Proposed location for global header files for fsl-mc and dpaa2
> > is include/linux/fsl.
> >
> > The functional driver added is for the DPIO object which provides
> > queuing services for other DPAA2 drivers.  An overview of the
> 
> I thought the idea of the TODO item was to have a full-fledged user of
> the bus, like a full network driver. The TODO item reads:
> 
> > -* Add at least one device driver for a DPAA2 object (child device of the
> > -  fsl-mc bus).  Most likely candidate for this is adding DPAA2 Ethernet
> > -  driver support, which depends on drivers for several objects: DPNI,
> > -  DPIO, DPMAC.  Other pre-requisites include:

DPIO is a "full fleged user" of the bus.  But, yes, it does provide
infrastructure services and so does not have a standalone I/O function.

> which to me indicates that DPIO is only part of that goal. Of course I'm
> the last person blocking progress to move the driver out of staging. But
> are we at the right point yet?

I thought the goal was to demonstrate a driver on top of the fsl-mc
bus driver because without that it would have been difficult to validate/review
that the bus infrastructure was correct.

The DPIO driver demonstrates full use of the bus driver infrastructure--
getting probed, discovering and mapping mmio regions, initializing the
device, initializing interrupts.

> To me the topmost important bit of having this outside of staging is
> actually missing in the TODO list (probably since it's obvious): Have
> stable, reliable, responsible maintainership for the code.
> 
> So far I've seen German do the initial push upstream, then there was
> silence for a while. Now some time passed and you push a few bits here
> and there again. All of the efforts are great and very appreciated, but
> I'm missing the "maintainer" figure. Some peer to German and you who
> oversees the whole thing, reviews your patches and devotes at least 2-3
> days a week to only upstream fsl-mc work. Someone like York for U-Boot
> or Scott for general Linux work.
> 
> Without that, there's too much of a chance that the code will stay
> incomplete, bitrot, etc. And that'd be bad for everyone involved. I
> think the concept behind fsl-mc is great and exactly what people need,
> so we should make sure it succeeds.

I agree we need that.  We are actively working on getting an additional
maintainer (or two), and until we can get the right person(s) I'm willing
to fill that role.  We're not going to let this code bitrot.

I actually think getting the bus driver out of staging will help spur
broader involvment by NXP engineers in the fsl-mc bus support.  There
are enhancements like a resource management interface for user space,
an interface to see the MC log buffer, SMMU-related hooks for the fsl-mc
bus, and vfio for the fsl-mc bus.  All that stuff is on hold until we
get the bus driver out of staging. The directive we have is to add no
new features until the bus driver is out.

For example, the ARM SMMU driver has an include of ,
but I don't see the SMMU maintainers accepting the following in
arm-smmu.c:
   #include <../drivers/staging/fsl-mc/include/mc.h>

Given that the fsl-mc bus TODO list is done, there is not a whole lot
for a new maintainer to do to the bus driver itself until we get the
driver out of staging (aside from reviewing another DPAA2 object driver
that would also go into staging).

Once the bus driver + dpio is out staging it also opens up the door
for other DPAA2 drivers-- network, crypto, DMA, L2 switch,
decompression/compression, and others to be upstreamed.  I didn't think
we wanted all of those to go into staging, but we were waiting until
some 1 driver was accepted first, proving the bus infrastructure is 
sound.  I was hoping DPI could be that proof of concept.

So, in short, I think getting the bus driver and DPIO out of staging
will open some parallel deve

RE: [PATCH 00/14] staging: fsl-mc: cleanup and uprev to MC v10.x

2016-10-25 Thread Stuart Yoder


> -Original Message-
> From: Greg KH [mailto:gre...@linuxfoundation.org]
> Sent: Tuesday, October 25, 2016 2:50 AM
> To: Stuart Yoder <stuart.yo...@nxp.com>
> Cc: German Rivera <german.riv...@nxp.com>; de...@driverdev.osuosl.org; 
> linux-ker...@vger.kernel.org;
> ag...@suse.de; a...@arndb.de; Leo Li <leoyang...@nxp.com>
> Subject: Re: [PATCH 00/14] staging: fsl-mc: cleanup and uprev to MC v10.x
> 
> On Mon, Oct 17, 2016 at 01:42:09PM -0500, Stuart Yoder wrote:
> > This patch does miscellaneous minor cleanup and uprevs the supported
> > MC firmware version to 10.x.
> >
> > I believe with this series the TODO items on our list are complete,
> > with the exception of "Add at least one device driver for a DPAA2
> > object", which I expect to send a patch for very soon.  I plan to
> > do that in conjunction with a request to move the fsl-mc bus
> > driver out of staging.
> 
> I applied some of these patches, can you rebase and fix up and resend
> the remaining ones?

Yes, will resend.

Regarding the patch:
   [PATCH 14/14] staging: fsl-mc: uprev binary interface to match MC v10.x

...your comment was that it did a lot of different things at once.  In
this case, there is no way for me to break that up.   The things listed
in that patch were the changes to the binary interface of the hardware,
and to match it we have to change everything at once.

Thanks,
Stuart
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 3/9] bus: fsl-mc: dpio: add APIs for DPIO objects

2016-10-21 Thread Stuart Yoder
From: Ioana Radulescu <ruxandra.radule...@nxp.com>

Add the command build/parse APIs for operating on DPIO objects through
the DPAA2 Management Complex.

Signed-off-by: Ioana Radulescu <ruxandra.radule...@nxp.com>
Signed-off-by: Roy Pledge <roy.ple...@nxp.com>
Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
---
 drivers/bus/fsl-mc/Kconfig |  10 ++
 drivers/bus/fsl-mc/Makefile|   3 +
 drivers/bus/fsl-mc/dpio/Makefile   |   9 ++
 drivers/bus/fsl-mc/dpio/dpio-cmd.h | 198 
 drivers/bus/fsl-mc/dpio/dpio.c | 229 +
 drivers/bus/fsl-mc/dpio/dpio.h | 108 +
 6 files changed, 557 insertions(+)
 create mode 100644 drivers/bus/fsl-mc/dpio/Makefile
 create mode 100644 drivers/bus/fsl-mc/dpio/dpio-cmd.h
 create mode 100644 drivers/bus/fsl-mc/dpio/dpio.c
 create mode 100644 drivers/bus/fsl-mc/dpio/dpio.h

diff --git a/drivers/bus/fsl-mc/Kconfig b/drivers/bus/fsl-mc/Kconfig
index 5c009ab..a10aaf0 100644
--- a/drivers/bus/fsl-mc/Kconfig
+++ b/drivers/bus/fsl-mc/Kconfig
@@ -15,3 +15,13 @@ config FSL_MC_BUS
  architecture.  The fsl-mc bus driver handles discovery of
  DPAA2 objects (which are represented as Linux devices) and
  binding objects to drivers.
+
+config FSL_MC_DPIO
+tristate "QorIQ DPAA2 DPIO driver"
+depends on FSL_MC_BUS
+help
+ Driver for the DPAA2 DPIO object.  A DPIO provides queue and
+ buffer management facilities for software to interact with
+ other DPAA2 objects. This driver does not expose the DPIO
+ objects individually, but groups them under a service layer
+ API.
diff --git a/drivers/bus/fsl-mc/Makefile b/drivers/bus/fsl-mc/Makefile
index d56afee..d18df72 100644
--- a/drivers/bus/fsl-mc/Makefile
+++ b/drivers/bus/fsl-mc/Makefile
@@ -17,3 +17,6 @@ mc-bus-driver-objs := fsl-mc-bus.o \
  fsl-mc-msi.o \
  dpmcp.o \
  dpbp.o
+
+# MC DPIO driver
+obj-$(CONFIG_FSL_MC_DPIO) += dpio/
diff --git a/drivers/bus/fsl-mc/dpio/Makefile b/drivers/bus/fsl-mc/dpio/Makefile
new file mode 100644
index 000..128befc
--- /dev/null
+++ b/drivers/bus/fsl-mc/dpio/Makefile
@@ -0,0 +1,9 @@
+#
+# QorIQ DPAA2 DPIO driver
+#
+
+subdir-ccflags-y := -Werror
+
+obj-$(CONFIG_FSL_MC_DPIO) += fsl-mc-dpio.o
+
+fsl-mc-dpio-objs := dpio.o
diff --git a/drivers/bus/fsl-mc/dpio/dpio-cmd.h 
b/drivers/bus/fsl-mc/dpio/dpio-cmd.h
new file mode 100644
index 000..b25a4cc
--- /dev/null
+++ b/drivers/bus/fsl-mc/dpio/dpio-cmd.h
@@ -0,0 +1,198 @@
+/*
+ * Copyright 2013-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 the above-listed copyright holders nor the
+ * names of any 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDERS OR CONTRIBUTORS 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.
+ */
+#ifndef _FSL_DPIO_CMD_H
+#define _FSL_DPIO_CMD_H
+
+/* DPIO Version */
+#define DPIO_VER_MAJOR 4
+#define DPIO_VER_MINOR 2
+
+/* Command Versioning */
+
+#define DPIO_CMD_ID_OFFSET 4
+#define DPIO_CMD_BASE_VERSION  1
+
+#define DPIO_CMD(id)   ((id << DPIO_CMD_ID_OFFSET) | DPIO_CMD_BASE_VERSION)
+
+/* Command IDs */
+#define DPIO_CMDID_CLOSE   DPIO_CMD(0x800)
+#define DPIO_CMDID_OPEN  

[PATCH 0/9] staging: fsl-mc: move bus driver out of staging, add dpio

2016-10-21 Thread Stuart Yoder
This patch series: A) addresses the final item in the staging
TODO list for the fsl-mc bus driver-- adding a functional driver
on top of the bus driver, and B) requests that the fsl-mc bus driver
be moved out of staging.

The proposed destination for the bus driver is drivers/bus.
Proposed location for global header files for fsl-mc and dpaa2
is include/linux/fsl.

The functional driver added is for the DPIO object which provides
queuing services for other DPAA2 drivers.  An overview of the
DPIO object and driver components are in patch 2.  Patches 3-7 are
internal components of the DPIO driver-- bit twiddling of hardware
registers, DPAA2 data structures, and the queuing APIs exposed
to other drivers.

Patch 8 adds the fsl-mc driver for the DPIO object.  It provides
the probe/remove functions, demonstrating a working example of
how fsl-mc drivers initialize, interact with the management
complex hardware, map their mappable MMIO regions, initialize
interrupts, register an ISR, etc.  All other DPAA2 drivers will
follow a similar initialization pattern.

The dpio driver is added under drivers/bus/fsl-mc/dpio.  This 
driver provides queueing related services and there is no other
obvious place it would go.  Like the bus driver, it is part of
the DPAA2 infrastucture and putting it under the fsl-mc bus
driver seems like a logical place.

This series depends on the patch series:
  [PATCH 00/14] staging: fsl-mc: cleanup and uprev to MC v10.x
  https://www.spinics.net/lists/kernel/msg2362567.html

Ioana Radulescu (1):
  bus: fsl-mc: dpio: add APIs for DPIO objects

Roy Pledge (6):
  bus: fsl-mc: dpio: add frame descriptor and scatter/gather APIs
  bus: fsl-mc: dpio: add global dpaa2 definitions
  bus: fsl-mc: dpio: add QBMan portal APIs for DPAA2
  bus: fsl-mc: dpio: add the DPAA2 DPIO service interface
  bus: fsl-mc: dpio: add the DPAA2 DPIO object driver
  bus: fsl-mc: dpio: add maintainer for DPIO

Stuart Yoder (2):
  staging: fsl-mc: move bus driver out of staging
  bus: fsl-mc: dpio: add DPIO driver overview document

 Documentation/dpaa2/dpio-driver.txt|  135 +++
 .../README.txt => Documentation/dpaa2/overview.txt |0
 MAINTAINERS|6 +
 drivers/bus/Kconfig|3 +
 drivers/bus/Makefile   |3 +
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/Kconfig |   10 +
 .../{staging/fsl-mc/bus => bus/fsl-mc}/Makefile|4 +-
 .../{staging/fsl-mc/bus => bus/fsl-mc}/dpbp-cmd.h  |0
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp.c  |6 +-
 .../{staging/fsl-mc/bus => bus/fsl-mc}/dpcon-cmd.h |0
 drivers/bus/fsl-mc/dpio/Makefile   |9 +
 drivers/bus/fsl-mc/dpio/dpio-cmd.h |  198 
 drivers/bus/fsl-mc/dpio/dpio-driver.c  |  289 ++
 drivers/bus/fsl-mc/dpio/dpio-service.c |  614 
 drivers/bus/fsl-mc/dpio/dpio.c |  229 +
 drivers/bus/fsl-mc/dpio/dpio.h |  108 +++
 drivers/bus/fsl-mc/dpio/qbman-portal.c | 1009 
 drivers/bus/fsl-mc/dpio/qbman-portal.h |  464 +
 .../{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp-cmd.h |0
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp.c |5 +-
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp.h |0
 .../{staging/fsl-mc/bus => bus/fsl-mc}/dpmng-cmd.h |0
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmng.c |6 +-
 .../{staging/fsl-mc/bus => bus/fsl-mc}/dprc-cmd.h  |0
 .../fsl-mc/bus => bus/fsl-mc}/dprc-driver.c|4 +-
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc.c  |6 +-
 .../fsl-mc/bus => bus/fsl-mc}/fsl-mc-allocator.c   |4 +-
 .../fsl-mc/bus => bus/fsl-mc}/fsl-mc-bus.c |6 +-
 .../fsl-mc/bus => bus/fsl-mc}/fsl-mc-msi.c |2 +-
 .../fsl-mc/bus => bus/fsl-mc}/fsl-mc-private.h |4 +-
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-io.c |4 +-
 .../{staging/fsl-mc/bus => bus/fsl-mc}/mc-sys.c|6 +-
 drivers/irqchip/Makefile   |1 +
 .../bus => irqchip}/irq-gic-v3-its-fsl-mc-msi.c|2 +-
 drivers/staging/Kconfig|2 -
 drivers/staging/Makefile   |1 -
 drivers/staging/fsl-mc/Kconfig |1 -
 drivers/staging/fsl-mc/Makefile|2 -
 drivers/staging/fsl-mc/TODO|   18 -
 include/linux/fsl/dpaa2-fd.h   |  415 
 include/linux/fsl/dpaa2-global.h   |  203 
 include/linux/fsl/dpaa2-io.h   |  138 +++
 .../fsl-mc/include => include/linux/fsl}/dpbp.h|0
 .../fsl-mc/include => include/linux/fsl}/dpmng.h   |0
 .../fsl-mc/include => include/linux/fsl}/dprc.h|0
 .../fsl-mc/include => include/linux/fsl}/mc-bus.h  |2 +-
 ..

[PATCH 6/9] bus: fsl-mc: dpio: add QBMan portal APIs for DPAA2

2016-10-21 Thread Stuart Yoder
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>
---
 drivers/bus/fsl-mc/dpio/Makefile   |2 +-
 drivers/bus/fsl-mc/dpio/qbman-portal.c | 1009 
 drivers/bus/fsl-mc/dpio/qbman-portal.h |  464 +++
 3 files changed, 1474 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..1eb3dd9
--- /dev/null
+++ b/drivers/bus/fsl-mc/dpio/qbman-portal.c
@@ -0,0 +1,1009 @@
+/*
+ * 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)
+
+/* 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 {
+   qbman_sdqcr_dct_null = 0,
+   qbman_sdqcr_dct_prio_ics,
+   qbman_sdqcr_dct_active_ics,
+   qbman_sdqcr_dct_active
+};
+
+enum qbman_sdqcr_fc {
+   qbman_sdqcr_fc_one = 0,
+   qbman_sdqcr_fc_up_to_3 = 1
+};
+
+/* Portal Access */
+
+static inline u32 qbman_read_register(struct qbman_swp *p, u32 offset)
+{
+   return readl_relaxed(p->addr_ci

[PATCH 7/9] bus: fsl-mc: dpio: add the DPAA2 DPIO service interface

2016-10-21 Thread Stuart Yoder
From: Roy Pledge <roy.ple...@nxp.com>

The DPIO service interface handles initialization of DPIO objects
and exports APIs to be used by other DPAA2 object drivers to perform
queuing and buffer management related operations.  The service allows
registration of callbacks when frames or notifications are received.

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>
---
 drivers/bus/fsl-mc/dpio/Makefile   |   2 +-
 drivers/bus/fsl-mc/dpio/dpio-service.c | 614 +
 include/linux/fsl/dpaa2-io.h   | 138 
 3 files changed, 753 insertions(+), 1 deletion(-)
 create mode 100644 drivers/bus/fsl-mc/dpio/dpio-service.c
 create mode 100644 include/linux/fsl/dpaa2-io.h

diff --git a/drivers/bus/fsl-mc/dpio/Makefile b/drivers/bus/fsl-mc/dpio/Makefile
index 6588498..0778da7 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
+fsl-mc-dpio-objs := dpio.o qbman-portal.o dpio-service.o
diff --git a/drivers/bus/fsl-mc/dpio/dpio-service.c 
b/drivers/bus/fsl-mc/dpio/dpio-service.c
new file mode 100644
index 000..7a455a7
--- /dev/null
+++ b/drivers/bus/fsl-mc/dpio/dpio-service.c
@@ -0,0 +1,614 @@
+/*
+ * 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 "dpio.h"
+#include "qbman-portal.h"
+
+struct dpaa2_io {
+   atomic_t refs;
+   struct dpaa2_io_desc dpio_desc;
+   struct qbman_swp_desc swp_desc;
+   struct qbman_swp *swp;
+   struct list_head node;
+   spinlock_t lock_mgmt_cmd;
+   spinlock_t lock_notifications;
+   struct list_head notifications;
+};
+
+struct dpaa2_io_store {
+   unsigned int max;
+   dma_addr_t paddr;
+   struct dpaa2_dq *vaddr;
+   void *alloced_addr;/* unaligned value from kmalloc() */
+   unsigned int idx;  /* position of the next-to-be-returned entry */
+   struct qbman_swp *swp; /* portal used to issue VDQCR */
+   struct device *dev;/* device used for DMA mapping */
+};
+
+/* keep a per cpu array of DPIOs for fast access */
+static struct dpaa2_io *dpio_by_cpu[NR_CPUS];
+static struct list_head dpio_list = LIST_HEAD_INIT(dpio_list);
+static DEFINE_SPINLOCK(dpio_list_lock);
+
+static inline struct dpaa2_io *service_select_by_cpu(struct dpaa2_io *d,
+int cpu)
+{
+   if (d)
+   return d;
+
+   if (unlikely(cpu >= NR_CPUS))
+   return NULL;
+
+   /*
+* If cpu == -1, choose the current cpu, with no guarantees about
+* potentially being migrated away.
+*/
+   if (unlikely(cpu < 0))
+   cpu = smp_processor_id();
+
+   /* If a specific cpu was requested, pick it up immediately */
+   return dpio_by_cpu[cpu];
+}
+
+static inline struct dpaa2_io *service_select(struct dpaa2_io *d)
+{

[PATCH 2/9] bus: fsl-mc: dpio: add DPIO driver overview document

2016-10-21 Thread Stuart Yoder
add document describing the dpio driver and it's role, components
and major interfaces

Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
---
 Documentation/dpaa2/dpio-driver.txt | 135 
 1 file changed, 135 insertions(+)
 create mode 100644 Documentation/dpaa2/dpio-driver.txt

diff --git a/Documentation/dpaa2/dpio-driver.txt 
b/Documentation/dpaa2/dpio-driver.txt
new file mode 100644
index 000..5c192b3
--- /dev/null
+++ b/Documentation/dpaa2/dpio-driver.txt
@@ -0,0 +1,135 @@
+Copyright (C) 2016 Freescale Semiconductor Inc.
+
+Introduction
+
+
+A DPAA2 DPIO (Data Path I/O) is a hardware object that provides
+interfaces to enqueue and dequeue frames to/from network interfaces
+and other accelerators.  A DPIO also provides hardware buffer
+pool management for network interfaces.
+
+This document provides an overview the Linux DPIO driver, its
+subcomponents, and its APIs.
+
+See Documentation/dpaa2/overview.txt for a general overview of DPAA2
+and the general DPAA2 driver architecture in Linux.
+
+Driver Overview
+---
+
+The DPIO driver is bound to DPIO objects discovered on the fsl-mc bus and
+provides services that:
+  A) allow other drivers, such as the Ethernet driver, to enqueue and dequeue
+ frames for their respective objects
+  B) allow drivers to register callbacks for data availability notifications
+ when data becomes available on a queue or channel
+  C) allow drivers to manage hardware buffer pools
+
+The Linux DPIO driver consists of 3 primary components--
+   DPIO object driver-- fsl-mc driver that manages the DPIO object
+   DPIO service-- provides APIs to other Linux drivers for services
+   QBman portal interface-- sends portal commands, gets responses
+
+  fsl-mc  other
+   bus   drivers
+|   |
++---++   +--+-+
+|DPIO obj|   |DPIO service|
+| driver |---|  (DPIO)|
+++   +--+-+
+|
+ +--+-+
+ |QBman   |
+ | portal i/f |
+ ++
+|
+ hardware
+
+The diagram below shows how the DPIO driver components fit with the other
+DPAA2 Linux driver components:
+   ++
+   | OS Network |
+   |   Stack|
+ ++++
+ | Allocator  |. . . . . . .   |  Ethernet  |
+ |(DPMCP,DPBP)||   (DPNI)   |
+ +-.--++---+---++
+  .  . ^   |
+ ..|   | dequeue>
++-+ .  |   |
+| DPRC driver |  .++ ++
+|   (DPRC)|   . . |DPIO obj| |DPIO service|
++--+--+   | driver |-|  (DPIO)|
+   |  ++ +--+-+
+   | +--|-+
+   | |   QBman|
+  ++--+  | portal i/f |
+  |   MC-bus driver   |  ++
+  |   | |
+  | /soc/fsl-mc   | |
+  +---+ |
+|
+ =|=|
++-+--DPIO---|---+
+|   |   |
+|QBman Portal   |
++---+
+
+ 
+
+
+DPIO Object Driver (dpio-driver.c)
+--
+
+   The dpio-driver component registers with the fsl-mc bus to handle objects of
+   type "dpio".  The implementation of probe() handles basic initialization
+   of the DPIO including mapping of the DPIO regions (the QBman SW portal)
+   and initializing interrupts and registering irq handlers.  The dpio-driver
+   registers the probed DPIO with dpio-service.
+
+DPIO service  (dpio-service.c, dpaa2-io.h)
+--
+
+   The dpio service component provides queuing, notification, and buffers
+   management services to DPAA2 drivers, such as the Ethernet driver.  A system
+   will typically allocate 1 DPIO object per CPU to allow queuing operations
+   to happen simultaneou

[PATCH 9/9] bus: fsl-mc: dpio: add maintainer for DPIO

2016-10-21 Thread Stuart Yoder
From: Roy Pledge <roy.ple...@nxp.com>

add Roy Pledge as maintainer of DPIO

Signed-off-by: Roy Pledge <roy.ple...@nxp.com>
Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
---
 MAINTAINERS | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 797a08a..1aa991e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5097,6 +5097,12 @@ L:   linux-ker...@vger.kernel.org
 S: Maintained
 F: drivers/staging/fsl-mc/
 
+DPAA2 DATAPATH I/O (DPIO) DRIVER
+M: Roy Pledge <roy.ple...@nxp.com>
+L: linux-ker...@vger.kernel.org
+S: Maintained
+F: drivers/bus/fsl-mc/dpio
+
 FREEVXFS FILESYSTEM
 M: Christoph Hellwig <h...@infradead.org>
 W: ftp://ftp.openlinux.org/pub/people/hch/vxfs
-- 
1.9.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 8/9] bus: fsl-mc: dpio: add the DPAA2 DPIO object driver

2016-10-21 Thread Stuart Yoder
From: Roy Pledge <roy.ple...@nxp.com>

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 <roy.ple...@nxp.com>
Signed-off-by: Haiying Wang <haiying.w...@nxp.com>
Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
---
 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(_dev->dev);
+
+   irq = dpio_dev->irqs[0];
+   error = devm_request_irq(_dev->dev,
+irq->msi_desc->irq,
+dpio_irq_handler,
+0,
+dev_name(_dev->dev),
+_dev->dev);
+   if (error < 0) {
+   dev_err(_dev->dev,
+   "devm_request_irq() failed: %d\n",
+   error);
+   return error;
+   }
+
+   /* set the affinity hint */
+   cpumask_clear();
+   cpumask_set_cpu(cpu, );
+   if (irq_set_affinity_hint(irq->msi_desc->irq, )

[PATCH 4/9] bus: fsl-mc: dpio: add frame descriptor and scatter/gather APIs

2016-10-21 Thread Stuart Yoder
From: Roy Pledge <roy.ple...@nxp.com>

Add global definitions for DPAA2 frame descriptors and scatter
gather entries.

Signed-off-by: Roy Pledge <roy.ple...@nxp.com>
Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
---
 include/linux/fsl/dpaa2-fd.h | 415 +++
 1 file changed, 415 insertions(+)
 create mode 100644 include/linux/fsl/dpaa2-fd.h

diff --git a/include/linux/fsl/dpaa2-fd.h b/include/linux/fsl/dpaa2-fd.h
new file mode 100644
index 000..b3fa9ff
--- /dev/null
+++ b/include/linux/fsl/dpaa2-fd.h
@@ -0,0 +1,415 @@
+/*
+ * 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.
+ */
+#ifndef __FSL_DPAA2_FD_H
+#define __FSL_DPAA2_FD_H
+
+#include 
+
+/**
+ * DOC: DPAA2 FD - Frame Descriptor APIs for DPAA2
+ *
+ * Frame Descriptors (FDs) are used to describe frame data in the DPAA2.
+ * Frames can be enqueued and dequeued to Frame Queues (FQs) which are consumed
+ * by the various DPAA accelerators (WRIOP, SEC, PME, DCE)
+ *
+ * There are three types of frames: single, scatter gather, and frame lists.
+ *
+ * The set of APIs in this file must be used to create, manipulate and
+ * query Frame Descriptors.
+ */
+
+/**
+ * struct dpaa2_fd - Struct describing FDs
+ * @words: for easier/faster copying the whole FD structure
+ * @addr:  address in the FD
+ * @len:   length in the FD
+ * @bpid:  buffer pool ID
+ * @format_offset: format and offset fields
+ * @frc:   frame context
+ * @ctrl:  control bits...including dd, sc, va, err, etc
+ * @flc:   flow context address
+ *
+ * This structure represents the basic Frame Descriptor used in the system.
+ */
+struct dpaa2_fd {
+   union {
+   u32 words[8];
+   struct dpaa2_fd_simple {
+   __le64 addr;
+   __le32 len;
+   __le16 bpid;
+   __le16 format_offset;
+   __le32 frc;
+   __le32 ctrl;
+   __le64 flc;
+   } simple;
+   };
+};
+
+#define FD_OFFSET_MASK 0x0FFF
+#define FD_FORMAT_MASK 0x3
+#define FD_FORMAT_SHIFT 12
+#define SG_SHORT_LEN_FLAG_MASK 0x1
+#define SG_SHORT_LEN_FLAG_SHIFT 14
+#define SG_SHORT_LEN_MASK 0x1
+#define SG_OFFSET_MASK 0x0FFF
+#define SG_FORMAT_MASK 0x3
+#define SG_FORMAT_SHIFT 12
+#define SG_BPID_MASK 0x3FFF
+#define SG_FINAL_FLAG_MASK 0x1
+#define SG_FINAL_FLAG_SHIFT 15
+
+enum dpaa2_fd_format {
+   dpaa2_fd_single = 0,
+   dpaa2_fd_list,
+   dpaa2_fd_sg
+};
+
+/**
+ * dpaa2_fd_get_addr() - get the addr field of frame descriptor
+ * @fd: the given frame descriptor
+ *
+ * Return the address in the frame descriptor.
+ */
+static inline dma_addr_t dpaa2_fd_get_addr(const struct dpaa2_fd *fd)
+{
+
+   return (dma_addr_t)fd->simple.addr;
+}
+
+/**
+ * dpaa2_fd_set_addr() - Set the addr field of frame descriptor
+ * @fd: the given frame descriptor
+ * @addr: the address needs to be set in frame descriptor
+ */
+static inline void dpaa2_fd_set_addr(struct dpaa2_fd *fd, dma_addr_t addr)
+{
+   fd->simple.addr = addr;
+}
+
+/**
+ * dpaa2_fd_get_frc() - Get the frame conte

[PATCH 1/9] staging: fsl-mc: move bus driver out of staging

2016-10-21 Thread Stuart Yoder
Move the source files out of staging into their final locations:
  -include files in drivers/staging/fsl-mc/include go to include/linux/fsl
  -irq-gic-v3-its-fsl-mc-msi.c goes to drivers/irqchip
  -source in drivers/staging/fsl-mc/bus goes to drivers/bus/fsl-mc
  -README.txt, providing and overview of DPAA goes to
   Documentation/dpaa2/overview.txt

Delete other remaining staging files-- Makefile, Kconfig, TODO

cc: Thomas Gleixner <t...@linutronix.de>
cc: Jason Cooper <ja...@lakedaemon.net>
cc: Marc Zyngier <marc.zyng...@arm.com>
Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
---
 .../README.txt => Documentation/dpaa2/overview.txt |  0
 drivers/bus/Kconfig|  3 +++
 drivers/bus/Makefile   |  3 +++
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/Kconfig |  0
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/Makefile|  1 -
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp-cmd.h  |  0
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp.c  |  6 +++---
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpcon-cmd.h |  0
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp-cmd.h |  0
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp.c |  5 +++--
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp.h |  0
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmng-cmd.h |  0
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmng.c |  6 +++---
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc-cmd.h  |  0
 .../{staging/fsl-mc/bus => bus/fsl-mc}/dprc-driver.c   |  4 ++--
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc.c  |  6 +++---
 .../fsl-mc/bus => bus/fsl-mc}/fsl-mc-allocator.c   |  4 ++--
 .../{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-bus.c|  6 +++---
 .../{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-msi.c|  2 +-
 .../fsl-mc/bus => bus/fsl-mc}/fsl-mc-private.h |  4 ++--
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-io.c |  4 ++--
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-sys.c|  6 +++---
 drivers/irqchip/Makefile   |  1 +
 .../fsl-mc/bus => irqchip}/irq-gic-v3-its-fsl-mc-msi.c |  2 +-
 drivers/staging/Kconfig|  2 --
 drivers/staging/Makefile   |  1 -
 drivers/staging/fsl-mc/Kconfig |  1 -
 drivers/staging/fsl-mc/Makefile|  2 --
 drivers/staging/fsl-mc/TODO| 18 --
 .../fsl-mc/include => include/linux/fsl}/dpbp.h|  0
 .../fsl-mc/include => include/linux/fsl}/dpmng.h   |  0
 .../fsl-mc/include => include/linux/fsl}/dprc.h|  0
 .../fsl-mc/include => include/linux/fsl}/mc-bus.h  |  2 +-
 .../fsl-mc/include => include/linux/fsl}/mc-cmd.h  |  0
 .../fsl-mc/include => include/linux/fsl}/mc-sys.h  |  0
 .../staging/fsl-mc/include => include/linux/fsl}/mc.h  |  2 +-
 36 files changed, 37 insertions(+), 54 deletions(-)
 rename drivers/staging/fsl-mc/README.txt => Documentation/dpaa2/overview.txt 
(100%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/Kconfig (100%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/Makefile (91%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp-cmd.h (100%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpcon-cmd.h (100%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp-cmd.h (100%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp.h (100%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmng-cmd.h (100%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmng.c (96%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc-cmd.h (100%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc-driver.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-allocator.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-bus.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-msi.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-private.h (96%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-io.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-sys.c (99%)
 rename drivers/{staging/fsl-mc/bus => irqchip}/irq-gic-v3-its-fsl-mc-msi.c 
(99%)
 delete mode 100644 drivers/staging/fsl-mc/Kconfig
 delete mode 100644 drivers/staging/fsl-mc/Makefile
 delete mode 100644 drivers/staging/fsl-mc/TODO
 rename {drivers/staging/fsl-mc/include => include/linux/fsl}/dpbp.h (100%)
 rename {drivers/staging/fsl-mc/include => include/linux/fsl}/dpmng.h (100%)
 rename {drivers/staging/fsl-mc/include => include/linux/fsl}/dprc.h (100%)
 rename {drive

[PATCH 5/9] bus: fsl-mc: dpio: add global dpaa2 definitions

2016-10-21 Thread Stuart Yoder
From: Roy Pledge <roy.ple...@nxp.com>

Create header for global dpaa2 definitions.  Add definitions
for dequeue results.

Signed-off-by: Roy Pledge <roy.ple...@nxp.com>
Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
---
 include/linux/fsl/dpaa2-global.h | 203 +++
 1 file changed, 203 insertions(+)
 create mode 100644 include/linux/fsl/dpaa2-global.h

diff --git a/include/linux/fsl/dpaa2-global.h b/include/linux/fsl/dpaa2-global.h
new file mode 100644
index 000..3ee3f29
--- /dev/null
+++ b/include/linux/fsl/dpaa2-global.h
@@ -0,0 +1,203 @@
+/*
+ * 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.
+ */
+#ifndef __FSL_DPAA2_GLOBAL_H
+#define __FSL_DPAA2_GLOBAL_H
+
+#include 
+#include 
+#include 
+
+struct dpaa2_dq {
+   union {
+   struct common {
+   u8 verb;
+   u8 reserved[63];
+   } common;
+   struct dq {
+   u8 verb;
+   u8 stat;
+   __le16 seqnum;
+   __le16 oprid;
+   u8 reserved;
+   u8 tok;
+   __le32 fqid;
+   u32 reserved2;
+   __le32 fq_byte_cnt;
+   __le32 fq_frm_cnt;
+   __le64 fqd_ctx;
+   u8 fd[32];
+   } dq;
+   struct scn {
+   u8 verb;
+   u8 stat;
+   u8 state;
+   u8 reserved;
+   __le32 rid_tok;
+   __le64 ctx;
+   } scn;
+   };
+};
+
+
+/* Parsing frame dequeue results */
+/* FQ empty */
+#define DPAA2_DQ_STAT_FQEMPTY   0x80
+/* FQ held active */
+#define DPAA2_DQ_STAT_HELDACTIVE0x40
+/* FQ force eligible */
+#define DPAA2_DQ_STAT_FORCEELIGIBLE 0x20
+/* valid frame */
+#define DPAA2_DQ_STAT_VALIDFRAME0x10
+/* FQ ODP enable */
+#define DPAA2_DQ_STAT_ODPVALID  0x04
+/* volatile dequeue */
+#define DPAA2_DQ_STAT_VOLATILE  0x02
+/* volatile dequeue command is expired */
+#define DPAA2_DQ_STAT_EXPIRED   0x01
+
+#define DQ_FQID_MASK 0x00FF
+#define DQ_FRAME_COUNT_MASK 0x00FF
+
+/**
+ * dpaa2_dq_flags() - Get the stat field of dequeue response
+ * @dq: the dequeue result.
+ */
+static inline u32 dpaa2_dq_flags(const struct dpaa2_dq *dq)
+{
+   return dq->dq.stat;
+}
+
+/**
+ * dpaa2_dq_is_pull() - Check whether the dq response is from a pull
+ *  command.
+ * @dq: the dequeue result
+ *
+ * Return 1 for volatile(pull) dequeue, 0 for static dequeue.
+ */
+static inline int dpaa2_dq_is_pull(const struct dpaa2_dq *dq)
+{
+   return (int)(dpaa2_dq_flags(dq) & DPAA2_DQ_STAT_VOLATILE);
+}
+
+/**
+ * dpaa2_dq_is_pull_complete() - Check whether the pull command is completed.
+ * @dq: the dequeue result
+ *
+ * Return boolean.
+ */
+static inline int dpaa2_dq_is_pull_complete(
+   const struct dpaa2_dq *dq)
+{
+   return (int)(dpaa2_dq_flags(dq) & DPAA2_DQ_STAT_EXPIRED);
+}
+
+/**
+ * dpaa2_dq_seqnum() - G

[PATCH 05/14] staging: fsl-mc: update MAINTAINERS

2016-10-17 Thread Stuart Yoder
-German has moved on to other things and wished to be
 removed as a maintainer
-cleanup the driver description to use the proper name
 of the driver (i.e. the fsl-mc bus driver) and remove incorrect
 references to Freescale

Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
Acked-by: J. German Rivera <german.riv...@nxp.com>
---
 MAINTAINERS | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 1cd38a7..797a08a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5091,8 +5091,7 @@ F:sound/soc/fsl/fsl*
 F: sound/soc/fsl/imx*
 F: sound/soc/fsl/mpc8610_hpcd.c
 
-FREESCALE QORIQ MANAGEMENT COMPLEX DRIVER
-M: "J. German Rivera" <german.riv...@freescale.com>
+QORIQ DPAA2 FSL-MC BUS DRIVER
 M: Stuart Yoder <stuart.yo...@nxp.com>
 L: linux-ker...@vger.kernel.org
 S: Maintained
-- 
1.9.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 14/14] staging: fsl-mc: uprev binary interface to match MC v10.x

2016-10-17 Thread Stuart Yoder
From: Ioana Ciornei <ioana.cior...@nxp.com>

DPAA2 will not support MC firmware versions prior to MC v10.x.
Update the MC interface code and drivers to reflect this.
   -update the object .h files and code that builds commands to include
the new command version in the command header
   -object versions are no longer available in the object attributes,
so remove references to them and instead get the version from the
new get_api_version() command
   -create/destroy commands for all objects have new arguments
   -dpmng_get_container_id() is replaced by dprc_get_container_id()

All MC firmware versions >= 10 will be supported going forward.

Signed-off-by: Ioana Ciornei <ioana.cior...@nxp.com>
Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
---
 drivers/staging/fsl-mc/bus/dpbp-cmd.h| 57 +++-
 drivers/staging/fsl-mc/bus/dpbp.c| 67 ++--
 drivers/staging/fsl-mc/bus/dpmcp-cmd.h   | 45 ++--
 drivers/staging/fsl-mc/bus/dpmcp.c   | 66 +--
 drivers/staging/fsl-mc/bus/dpmcp.h   | 16 ++
 drivers/staging/fsl-mc/bus/dpmng-cmd.h   | 13 ++---
 drivers/staging/fsl-mc/bus/dpmng.c   | 33 
 drivers/staging/fsl-mc/bus/dprc-cmd.h| 89 +---
 drivers/staging/fsl-mc/bus/dprc-driver.c | 19 +--
 drivers/staging/fsl-mc/bus/dprc.c| 65 ++-
 drivers/staging/fsl-mc/bus/fsl-mc-bus.c  | 22 ++--
 drivers/staging/fsl-mc/bus/mc-sys.c  |  8 +--
 drivers/staging/fsl-mc/include/dpbp.h| 21 
 drivers/staging/fsl-mc/include/dprc.h| 19 ---
 drivers/staging/fsl-mc/include/mc-cmd.h  | 41 +++
 15 files changed, 355 insertions(+), 226 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/dpbp-cmd.h 
b/drivers/staging/fsl-mc/bus/dpbp-cmd.h
index 4cc2918..7d86539 100644
--- a/drivers/staging/fsl-mc/bus/dpbp-cmd.h
+++ b/drivers/staging/fsl-mc/bus/dpbp-cmd.h
@@ -33,37 +33,48 @@
 #define _FSL_DPBP_CMD_H
 
 /* DPBP Version */
-#define DPBP_VER_MAJOR 2
+#define DPBP_VER_MAJOR 3
 #define DPBP_VER_MINOR 2
 
+/* Command versioning */
+#define DPBP_CMD_BASE_VERSION  1
+#define DPBP_CMD_ID_OFFSET 4
+
+#define DPBP_CMD(id)   ((id << DPBP_CMD_ID_OFFSET) | DPBP_CMD_BASE_VERSION)
+
 /* Command IDs */
-#define DPBP_CMDID_CLOSE   0x800
-#define DPBP_CMDID_OPEN0x804
-#define DPBP_CMDID_CREATE  0x904
-#define DPBP_CMDID_DESTROY 0x900
-
-#define DPBP_CMDID_ENABLE  0x002
-#define DPBP_CMDID_DISABLE 0x003
-#define DPBP_CMDID_GET_ATTR0x004
-#define DPBP_CMDID_RESET   0x005
-#define DPBP_CMDID_IS_ENABLED  0x006
-
-#define DPBP_CMDID_SET_IRQ 0x010
-#define DPBP_CMDID_GET_IRQ 0x011
-#define DPBP_CMDID_SET_IRQ_ENABLE  0x012
-#define DPBP_CMDID_GET_IRQ_ENABLE  0x013
-#define DPBP_CMDID_SET_IRQ_MASK0x014
-#define DPBP_CMDID_GET_IRQ_MASK0x015
-#define DPBP_CMDID_GET_IRQ_STATUS  0x016
-#define DPBP_CMDID_CLEAR_IRQ_STATUS0x017
-
-#define DPBP_CMDID_SET_NOTIFICATIONS   0x01b0
-#define DPBP_CMDID_GET_NOTIFICATIONS   0x01b1
+#define DPBP_CMDID_CLOSE   DPBP_CMD(0x800)
+#define DPBP_CMDID_OPENDPBP_CMD(0x804)
+#define DPBP_CMDID_CREATE  DPBP_CMD(0x904)
+#define DPBP_CMDID_DESTROY DPBP_CMD(0x984)
+#define DPBP_CMDID_GET_API_VERSION DPBP_CMD(0xa04)
+
+#define DPBP_CMDID_ENABLE  DPBP_CMD(0x002)
+#define DPBP_CMDID_DISABLE DPBP_CMD(0x003)
+#define DPBP_CMDID_GET_ATTRDPBP_CMD(0x004)
+#define DPBP_CMDID_RESET   DPBP_CMD(0x005)
+#define DPBP_CMDID_IS_ENABLED  DPBP_CMD(0x006)
+
+#define DPBP_CMDID_SET_IRQ DPBP_CMD(0x010)
+#define DPBP_CMDID_GET_IRQ DPBP_CMD(0x011)
+#define DPBP_CMDID_SET_IRQ_ENABLE  DPBP_CMD(0x012)
+#define DPBP_CMDID_GET_IRQ_ENABLE  DPBP_CMD(0x013)
+#define DPBP_CMDID_SET_IRQ_MASKDPBP_CMD(0x014)
+#define DPBP_CMDID_GET_IRQ_MASKDPBP_CMD(0x015)
+#define DPBP_CMDID_GET_IRQ_STATUS  DPBP_CMD(0x016)
+#define DPBP_CMDID_CLEAR_IRQ_STATUSDPBP_CMD(0x017)
+
+#define DPBP_CMDID_SET_NOTIFICATIONS   DPBP_CMD(0x01b0)
+#define DPBP_CMDID_GET_NOTIFICATIONS   DPBP_CMD(0x01b1)
 
 struct dpbp_cmd_open {
__le32 dpbp_id;
 };
 
+struct dpbp_cmd_destroy {
+   __le32 object_id;
+};
+
 #define DPBP_ENABLE0x1
 
 struct dpbp_rsp_is_enabled {
diff --git a/drivers/s

[PATCH 13/14] staging: fsl-mc: update copyright dates

2016-10-17 Thread Stuart Yoder
Many source files have evolved without copyright date
updates.  Update the dates to reflect work through
2016.

Signed-off-by: Stuart Yoder <stuart.yo...@nxp.com>
---
 drivers/staging/fsl-mc/bus/dpcon-cmd.h | 2 +-
 drivers/staging/fsl-mc/bus/dpmcp.h | 2 +-
 drivers/staging/fsl-mc/bus/dprc-driver.c   | 2 +-
 drivers/staging/fsl-mc/bus/fsl-mc-allocator.c  | 2 +-
 drivers/staging/fsl-mc/bus/fsl-mc-bus.c| 2 +-
 drivers/staging/fsl-mc/bus/fsl-mc-msi.c| 2 +-
 drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c | 2 +-
 drivers/staging/fsl-mc/bus/mc-sys.c| 2 +-
 drivers/staging/fsl-mc/include/dpbp.h  | 2 +-
 drivers/staging/fsl-mc/include/dpmng.h | 2 +-
 drivers/staging/fsl-mc/include/dprc.h  | 2 +-
 drivers/staging/fsl-mc/include/mc-bus.h| 2 +-
 drivers/staging/fsl-mc/include/mc-cmd.h| 2 +-
 drivers/staging/fsl-mc/include/mc-sys.h| 2 +-
 drivers/staging/fsl-mc/include/mc.h| 2 +-
 15 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/dpcon-cmd.h 
b/drivers/staging/fsl-mc/bus/dpcon-cmd.h
index 4ebb3fc..d0a5e19 100644
--- a/drivers/staging/fsl-mc/bus/dpcon-cmd.h
+++ b/drivers/staging/fsl-mc/bus/dpcon-cmd.h
@@ -1,5 +1,5 @@
 /*
- * Copyright 2013-2015 Freescale Semiconductor Inc.
+ * Copyright 2013-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:
diff --git a/drivers/staging/fsl-mc/bus/dpmcp.h 
b/drivers/staging/fsl-mc/bus/dpmcp.h
index 7e70d80..902cddf 100644
--- a/drivers/staging/fsl-mc/bus/dpmcp.h
+++ b/drivers/staging/fsl-mc/bus/dpmcp.h
@@ -1,5 +1,5 @@
 /*
- * Copyright 2013-2015 Freescale Semiconductor Inc.
+ * Copyright 2013-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:
diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c 
b/drivers/staging/fsl-mc/bus/dprc-driver.c
index 6aa2915..b4e46fb 100644
--- a/drivers/staging/fsl-mc/bus/dprc-driver.c
+++ b/drivers/staging/fsl-mc/bus/dprc-driver.c
@@ -1,7 +1,7 @@
 /*
  * Freescale data path resource container (DPRC) driver
  *
- * Copyright (C) 2014 Freescale Semiconductor, Inc.
+ * Copyright (C) 2014-2016 Freescale Semiconductor, Inc.
  * Author: German Rivera <german.riv...@freescale.com>
  *
  * This file is licensed under the terms of the GNU General Public
diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c 
b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c
index 4a7ac97..ce07096 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c
@@ -1,7 +1,7 @@
 /*
  * fsl-mc object allocator driver
  *
- * Copyright (C) 2013 Freescale Semiconductor, Inc.
+ * Copyright (C) 2013-2016 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
diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c 
b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
index 157d6dc..19a1935 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
@@ -1,7 +1,7 @@
 /*
  * Freescale Management Complex (MC) bus driver
  *
- * Copyright (C) 2014 Freescale Semiconductor, Inc.
+ * Copyright (C) 2014-2016 Freescale Semiconductor, Inc.
  * Author: German Rivera <german.riv...@freescale.com>
  *
  * This file is licensed under the terms of the GNU General Public
diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-msi.c 
b/drivers/staging/fsl-mc/bus/fsl-mc-msi.c
index 3d46b1b..7975c6e 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-msi.c
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-msi.c
@@ -1,7 +1,7 @@
 /*
  * Freescale Management Complex (MC) bus driver MSI support
  *
- * Copyright (C) 2015 Freescale Semiconductor, Inc.
+ * Copyright (C) 2015-2016 Freescale Semiconductor, Inc.
  * Author: German Rivera <german.riv...@freescale.com>
  *
  * This file is licensed under the terms of the GNU General Public
diff --git a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c 
b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
index 16b0d4a..6b1cd57 100644
--- a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
+++ b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
@@ -1,7 +1,7 @@
 /*
  * Freescale Management Complex (MC) bus driver MSI support
  *
- * Copyright (C) 2015 Freescale Semiconductor, Inc.
+ * Copyright (C) 2015-2016 Freescale Semiconductor, Inc.
  * Author: German Rivera <german.riv...@freescale.com>
  *
  * This file is licensed under the terms of the GNU General Public
diff --git a/drivers/staging/fsl-mc/bus/mc-sys.

  1   2   >