[PATCH v3 2/4] staging:fsl-mc: Move DPIO from staging to drivers/soc/fsl

2018-07-24 Thread Roy Pledge
Move the NXP DPIO (Datapath I/O Driver) out of the
drivers/staging directory and into the drivers/soc/fsl directory.

The DPIO driver enables access to Queue and Buffer Manager (QBMAN)
hardware on NXP DPAA2 devices. This is a prerequisite to moving the
DPAA2 Ethernet driver out of staging.

Signed-off-by: Roy Pledge 
---
 MAINTAINERS|  2 +-
 drivers/crypto/caam/sg_sw_qm2.h|  2 +-
 drivers/crypto/caam/sg_sw_sec4.h   |  2 +-
 drivers/soc/fsl/Kconfig| 10 ++
 drivers/soc/fsl/Makefile   |  1 +
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/Makefile  |  0
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-cmd.h|  0
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-driver.c |  2 +-
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-driver.txt   |  0
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-service.c|  2 +-
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.c|  0
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.h|  0
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/qbman-portal.c|  2 +-
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/qbman-portal.h|  2 +-
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h |  4 ++--
 drivers/staging/fsl-mc/bus/Kconfig |  9 -
 drivers/staging/fsl-mc/bus/Makefile|  2 --
 {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-fd.h |  0
 .../staging/fsl-mc/include => include/soc/fsl}/dpaa2-global.h  |  0
 {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-io.h |  0
 20 files changed, 20 insertions(+), 20 deletions(-)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/Makefile (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-cmd.h (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-driver.c (99%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-driver.txt (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-service.c (99%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.c (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.h (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/qbman-portal.c (99%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/qbman-portal.h (99%)
 rename {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-fd.h (100%)
 rename {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-global.h 
(100%)
 rename {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-io.h (100%)

diff --git a/MAINTAINERS b/MAINTAINERS
index 0fe4228..34ce842 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4418,7 +4418,7 @@ DPAA2 DATAPATH I/O (DPIO) DRIVER
 M: Roy Pledge 
 L: linux-ker...@vger.kernel.org
 S: Maintained
-F: drivers/staging/fsl-mc/bus/dpio
+F: drivers/soc/fsl/dpio
 
 DPAA2 ETHERNET DRIVER
 M: Ioana Radulescu 
diff --git a/drivers/crypto/caam/sg_sw_qm2.h b/drivers/crypto/caam/sg_sw_qm2.h
index 31b4407..b5b4c12 100644
--- a/drivers/crypto/caam/sg_sw_qm2.h
+++ b/drivers/crypto/caam/sg_sw_qm2.h
@@ -35,7 +35,7 @@
 #ifndef _SG_SW_QM2_H_
 #define _SG_SW_QM2_H_
 
-#include "../../../drivers/staging/fsl-mc/include/dpaa2-fd.h"
+#include 
 
 static inline void dma_to_qm_sg_one(struct dpaa2_sg_entry *qm_sg_ptr,
dma_addr_t dma, u32 len, u16 offset)
diff --git a/drivers/crypto/caam/sg_sw_sec4.h b/drivers/crypto/caam/sg_sw_sec4.h
index e586ffa..dbfa9fc 100644
--- a/drivers/crypto/caam/sg_sw_sec4.h
+++ b/drivers/crypto/caam/sg_sw_sec4.h
@@ -12,7 +12,7 @@
 #include "ctrl.h"
 #include "regs.h"
 #include "sg_sw_qm2.h"
-#include "../../../drivers/staging/fsl-mc/include/dpaa2-fd.h"
+#include 
 
 struct sec4_sg_entry {
u64 ptr;
diff --git a/drivers/soc/fsl/Kconfig b/drivers/soc/fsl/Kconfig
index 7a9fb9b..c17bf38 100644
--- a/drivers/soc/fsl/Kconfig
+++ b/drivers/soc/fsl/Kconfig
@@ -16,3 +16,13 @@ config FSL_GUTS
  Initially only reading SVR and registering soc device are supported.
  Other guts accesses, such as reading RCW, should eventually be moved
  into this driver as well.
+
+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/soc/fsl/Makefile b/drivers/soc/fsl/Makefile
index 44b3beb..803ef1b 100644
--- a/drivers/soc/fsl/Makefile
+++ b/drivers/soc/fsl/Makefi

[PATCH v3 3/4] drivers/staging: Remove fsl-mc driver from staging

2018-07-24 Thread Roy Pledge
Remove the staging/drivers/fsl-mc directory from the staging
area now that all the components have been moved to the main
kernel areas.

Signed-off-by: Roy Pledge 
---
 drivers/staging/Kconfig | 2 --
 drivers/staging/Makefile| 1 -
 drivers/staging/fsl-mc/Kconfig  | 2 --
 drivers/staging/fsl-mc/Makefile | 3 ---
 drivers/staging/fsl-mc/bus/Kconfig  | 7 ---
 drivers/staging/fsl-mc/bus/Makefile | 7 ---
 6 files changed, 22 deletions(-)
 delete mode 100644 drivers/staging/fsl-mc/Kconfig
 delete mode 100644 drivers/staging/fsl-mc/Makefile
 delete mode 100644 drivers/staging/fsl-mc/bus/Kconfig
 delete mode 100644 drivers/staging/fsl-mc/bus/Makefile

diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
index 75a4804..47b61c3 100644
--- a/drivers/staging/Kconfig
+++ b/drivers/staging/Kconfig
@@ -92,8 +92,6 @@ source "drivers/staging/clocking-wizard/Kconfig"
 
 source "drivers/staging/fbtft/Kconfig"
 
-source "drivers/staging/fsl-mc/Kconfig"
-
 source "drivers/staging/fsl-dpaa2/Kconfig"
 
 source "drivers/staging/wilc1000/Kconfig"
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
index e84959a..bfef8f2 100644
--- a/drivers/staging/Makefile
+++ b/drivers/staging/Makefile
@@ -37,7 +37,6 @@ obj-$(CONFIG_CRYPTO_SKEIN)+= skein/
 obj-$(CONFIG_UNISYSSPAR)   += unisys/
 obj-$(CONFIG_COMMON_CLK_XLNX_CLKWZRD)  += clocking-wizard/
 obj-$(CONFIG_FB_TFT)   += fbtft/
-obj-$(CONFIG_FSL_MC_BUS)   += fsl-mc/
 obj-$(CONFIG_FSL_DPAA2)+= fsl-dpaa2/
 obj-$(CONFIG_WILC1000) += wilc1000/
 obj-$(CONFIG_MOST) += most/
diff --git a/drivers/staging/fsl-mc/Kconfig b/drivers/staging/fsl-mc/Kconfig
deleted file mode 100644
index 3002229..000
--- a/drivers/staging/fsl-mc/Kconfig
+++ /dev/null
@@ -1,2 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-source "drivers/staging/fsl-mc/bus/Kconfig"
diff --git a/drivers/staging/fsl-mc/Makefile b/drivers/staging/fsl-mc/Makefile
deleted file mode 100644
index 1468388..000
--- a/drivers/staging/fsl-mc/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-# Freescale Management Complex (MC) bus drivers
-obj-$(CONFIG_FSL_MC_BUS)   += bus/
diff --git a/drivers/staging/fsl-mc/bus/Kconfig 
b/drivers/staging/fsl-mc/bus/Kconfig
deleted file mode 100644
index 90f234d..000
--- a/drivers/staging/fsl-mc/bus/Kconfig
+++ /dev/null
@@ -1,7 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-#
-# DPAA2 fsl-mc bus
-#
-# Copyright (C) 2014-2016 Freescale Semiconductor, Inc.
-#
-
diff --git a/drivers/staging/fsl-mc/bus/Makefile 
b/drivers/staging/fsl-mc/bus/Makefile
deleted file mode 100644
index 2141e4b..000
--- a/drivers/staging/fsl-mc/bus/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-#
-# Freescale Management Complex (MC) bus drivers
-#
-# Copyright (C) 2014 Freescale Semiconductor, Inc.
-#
-
-- 
2.7.4

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


[PATCH v3 4/4] drivers/soc/fsl/dpio: Convert DPIO documentation to .rst

2018-07-24 Thread Roy Pledge
Convert the Datapath I/O documentation to .rst format
and move to the Documation/networking/dpaa2 directory

Signed-off-by: Roy Pledge 
---
 .../networking/dpaa2/dpio-driver.rst   | 29 +++---
 Documentation/networking/dpaa2/index.rst   |  1 +
 2 files changed, 27 insertions(+), 3 deletions(-)
 rename drivers/soc/fsl/dpio/dpio-driver.txt => 
Documentation/networking/dpaa2/dpio-driver.rst (95%)

diff --git a/drivers/soc/fsl/dpio/dpio-driver.txt 
b/Documentation/networking/dpaa2/dpio-driver.rst
similarity index 95%
rename from drivers/soc/fsl/dpio/dpio-driver.txt
rename to Documentation/networking/dpaa2/dpio-driver.rst
index 72ba9da..1358810 100644
--- a/drivers/soc/fsl/dpio/dpio-driver.txt
+++ b/Documentation/networking/dpaa2/dpio-driver.rst
@@ -1,7 +1,15 @@
-Copyright 2016 NXP
+.. include:: 
+
+DPAA2 DPIO (Data Path I/O) Overview
+===
+
+:Copyright: |copy| 2016-2018 NXP
+
+This document provides an overview of the Freescale DPAA2 DPIO
+drivers
 
 Introduction
-
+
 
 A DPAA2 DPIO (Data Path I/O) is a hardware object that provides
 interfaces to enqueue and dequeue frames to/from network interfaces
@@ -27,8 +35,11 @@ provides services that:
 
 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
@@ -45,8 +56,9 @@ The Linux DPIO driver consists of 3 primary components--
 |
  hardware
 
+
 The diagram below shows how the DPIO driver components fit with the other
-DPAA2 Linux driver components:
+DPAA2 Linux driver components::
++
| OS Network |
|   Stack|
@@ -98,20 +110,29 @@ DPIO service  (dpio-service.c, dpaa2-io.h)
 
Notification handling
   dpaa2_io_service_register()
+
   dpaa2_io_service_deregister()
+
   dpaa2_io_service_rearm()
 
Queuing
   dpaa2_io_service_pull_fq()
+
   dpaa2_io_service_pull_channel()
+
   dpaa2_io_service_enqueue_fq()
+
   dpaa2_io_service_enqueue_qd()
+
   dpaa2_io_store_create()
+
   dpaa2_io_store_destroy()
+
   dpaa2_io_store_next()
 
Buffer pool management
   dpaa2_io_service_release()
+
   dpaa2_io_service_acquire()
 
 QBman portal interface (qbman-portal.c)
@@ -120,7 +141,9 @@ QBman portal interface (qbman-portal.c)
The qbman-portal component provides APIs to do the low level hardware
bit twiddling for operations such as:
   -initializing Qman software portals
+
   -building and sending portal commands
+
   -portal interrupt configuration and processing
 
The qbman-portal APIs are not public to other drivers, and are
diff --git a/Documentation/networking/dpaa2/index.rst 
b/Documentation/networking/dpaa2/index.rst
index 4c6586c..10bea11 100644
--- a/Documentation/networking/dpaa2/index.rst
+++ b/Documentation/networking/dpaa2/index.rst
@@ -6,3 +6,4 @@ DPAA2 Documentation
:maxdepth: 1
 
overview
+   dpio-driver
-- 
2.7.4

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


[PATCH v3 1/4] staging: fsl-dpaa2/eth: move generic FD defines to DPIO

2018-07-24 Thread Roy Pledge
From: Horia Geantă 

Previous commits:
commit 6e2387e8f19e ("staging: fsl-dpaa2/eth: Add Freescale DPAA2
Ethernet driver")
commit 39163c0ce0f4 ("staging: fsl-dpaa2/eth: Errors checking update")

have added bits that are not specific to the WRIOP accelerator.

Move these where they belong (in DPIO) such that other accelerators
can make use of them.

Signed-off-by: Horia Geantă 
Acked-by: Ioana Radulescu 
---
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c |  4 ++--
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h | 18 +-
 drivers/staging/fsl-mc/include/dpaa2-fd.h  | 12 
 3 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
index 3963717..d5f0ac5 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
@@ -455,7 +455,7 @@ static int build_sg_fd(struct dpaa2_eth_priv *priv,
dpaa2_fd_set_format(fd, dpaa2_fd_sg);
dpaa2_fd_set_addr(fd, addr);
dpaa2_fd_set_len(fd, skb->len);
-   dpaa2_fd_set_ctrl(fd, DPAA2_FD_CTRL_PTA | DPAA2_FD_CTRL_PTV1);
+   dpaa2_fd_set_ctrl(fd, FD_CTRL_PTA | FD_CTRL_PTV1);
 
if (priv->tx_tstamp && skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)
enable_tx_tstamp(fd, sgt_buf);
@@ -508,7 +508,7 @@ static int build_single_fd(struct dpaa2_eth_priv *priv,
dpaa2_fd_set_offset(fd, (u16)(skb->data - buffer_start));
dpaa2_fd_set_len(fd, skb->len);
dpaa2_fd_set_format(fd, dpaa2_fd_single);
-   dpaa2_fd_set_ctrl(fd, DPAA2_FD_CTRL_PTA | DPAA2_FD_CTRL_PTV1);
+   dpaa2_fd_set_ctrl(fd, FD_CTRL_PTA | FD_CTRL_PTV1);
 
if (priv->tx_tstamp && skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)
enable_tx_tstamp(fd, buffer_start);
diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
index 905a4e6..9269cb0 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
@@ -124,21 +124,13 @@ struct dpaa2_eth_swa {
 #define DPAA2_FD_FRC_FAICFDV   0x0400
 
 /* Error bits in FD CTRL */
-#define DPAA2_FD_CTRL_UFD  0x0004
-#define DPAA2_FD_CTRL_SBE  0x0008
-#define DPAA2_FD_CTRL_FSE  0x0020
-#define DPAA2_FD_CTRL_FAERR0x0040
-
-#define DPAA2_FD_RX_ERR_MASK   (DPAA2_FD_CTRL_SBE  | \
-DPAA2_FD_CTRL_FAERR)
-#define DPAA2_FD_TX_ERR_MASK   (DPAA2_FD_CTRL_UFD  | \
-DPAA2_FD_CTRL_SBE  | \
-DPAA2_FD_CTRL_FSE  | \
-DPAA2_FD_CTRL_FAERR)
+#define DPAA2_FD_RX_ERR_MASK   (FD_CTRL_SBE | FD_CTRL_FAERR)
+#define DPAA2_FD_TX_ERR_MASK   (FD_CTRL_UFD| \
+FD_CTRL_SBE| \
+FD_CTRL_FSE| \
+FD_CTRL_FAERR)
 
 /* Annotation bits in FD CTRL */
-#define DPAA2_FD_CTRL_PTA  0x0080
-#define DPAA2_FD_CTRL_PTV1 0x0040
 #define DPAA2_FD_CTRL_ASAL 0x0002  /* ASAL = 128B */
 
 /* Frame annotation status */
diff --git a/drivers/staging/fsl-mc/include/dpaa2-fd.h 
b/drivers/staging/fsl-mc/include/dpaa2-fd.h
index b55b89b..2576aba 100644
--- a/drivers/staging/fsl-mc/include/dpaa2-fd.h
+++ b/drivers/staging/fsl-mc/include/dpaa2-fd.h
@@ -67,6 +67,18 @@ struct dpaa2_fd {
 #define SG_FINAL_FLAG_MASK 0x1
 #define SG_FINAL_FLAG_SHIFT15
 
+/* Error bits in FD CTRL */
+#define FD_CTRL_ERR_MASK   0x00FF
+#define FD_CTRL_UFD0x0004
+#define FD_CTRL_SBE0x0008
+#define FD_CTRL_FLC0x0010
+#define FD_CTRL_FSE0x0020
+#define FD_CTRL_FAERR  0x0040
+
+/* Annotation bits in FD CTRL */
+#define FD_CTRL_PTA0x0080
+#define FD_CTRL_PTV1   0x0040
+
 enum dpaa2_fd_format {
dpaa2_fd_single = 0,
dpaa2_fd_list,
-- 
2.7.4

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


[PATCH v3 0/4] staging/fsl-mc/bus: Move DPIO from staging to drivers/soc/fsl

2018-07-24 Thread Roy Pledge
Move the NXP DPIO (Datapath I/O driver) from the staging/fsl-mc/bus/dpio
directory to the drivers/soc/fsl directory.

The DPIO driver enables access to the Queue and Buffer Managemer (QBMAN)
hardware of NXP DPAA2 devices. This is a prerequiste for moving the DPAA2
Ethernet device driver from the staging directory.

Horia Geantă (1):
  staging: fsl-dpaa2/eth: move generic FD defines to DPIO

Roy Pledge (3):
  staging:fsl-mc: Move DPIO from staging to drivers/soc/fsl
  drivers/staging: Remove fsl-mc driver from staging
  drivers/soc/fsl/dpio: Convert DPIO documentation to .rst

 .../networking/dpaa2/dpio-driver.rst   | 29 +++---
 Documentation/networking/dpaa2/index.rst   |  1 +
 MAINTAINERS|  2 +-
 drivers/crypto/caam/sg_sw_qm2.h|  2 +-
 drivers/crypto/caam/sg_sw_sec4.h   |  2 +-
 drivers/soc/fsl/Kconfig| 10 
 drivers/soc/fsl/Makefile   |  1 +
 .../{staging/fsl-mc/bus => soc/fsl}/dpio/Makefile  |  0
 .../fsl-mc/bus => soc/fsl}/dpio/dpio-cmd.h |  0
 .../fsl-mc/bus => soc/fsl}/dpio/dpio-driver.c  |  2 +-
 .../fsl-mc/bus => soc/fsl}/dpio/dpio-service.c |  2 +-
 .../{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.c|  0
 .../{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.h|  0
 .../fsl-mc/bus => soc/fsl}/dpio/qbman-portal.c |  2 +-
 .../fsl-mc/bus => soc/fsl}/dpio/qbman-portal.h |  2 +-
 drivers/staging/Kconfig|  2 --
 drivers/staging/Makefile   |  1 -
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c |  4 +--
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h | 22 ++--
 drivers/staging/fsl-mc/Kconfig |  2 --
 drivers/staging/fsl-mc/Makefile|  3 ---
 drivers/staging/fsl-mc/bus/Kconfig | 16 
 drivers/staging/fsl-mc/bus/Makefile|  9 ---
 .../fsl-mc/include => include/soc/fsl}/dpaa2-fd.h  | 12 +
 .../include => include/soc/fsl}/dpaa2-global.h |  0
 .../fsl-mc/include => include/soc/fsl}/dpaa2-io.h  |  0
 26 files changed, 66 insertions(+), 60 deletions(-)
 rename drivers/staging/fsl-mc/bus/dpio/dpio-driver.txt => 
Documentation/networking/dpaa2/dpio-driver.rst (95%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/Makefile (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-cmd.h (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-driver.c (99%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-service.c (99%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.c (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.h (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/qbman-portal.c (99%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/qbman-portal.h (99%)
 delete mode 100644 drivers/staging/fsl-mc/Kconfig
 delete mode 100644 drivers/staging/fsl-mc/Makefile
 delete mode 100644 drivers/staging/fsl-mc/bus/Kconfig
 delete mode 100644 drivers/staging/fsl-mc/bus/Makefile
 rename {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-fd.h (97%)
 rename {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-global.h 
(100%)
 rename {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-io.h (100%)

--
2.7.4

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


Re: [PATCH v2 4/4] drivers/soc/fsl/dpio: Convert DPIO documentation to .rst

2018-07-24 Thread Roy Pledge
On 7/24/2018 9:52 AM, Horia Geanta wrote:
> On 7/23/2018 8:00 PM, Roy Pledge wrote:
>> Convert the Datapath I/O documentation to .rst format
>> and move to the Documation/networking/dpaa2 directory
> typo: ^^^ Documentation
>
>> Signed-off-by: Roy Pledge 
>> ---
>>  .../networking/dpaa2/dpio-driver.rst   | 30 
>> +++---
>>  Documentation/networking/dpaa2/index.rst   |  1 +
>>  2 files changed, 28 insertions(+), 3 deletions(-)
>>  rename drivers/soc/fsl/dpio/dpio-driver.txt => 
>> Documentation/networking/dpaa2/dpio-driver.rst (94%)
>>
>> diff --git a/drivers/soc/fsl/dpio/dpio-driver.txt 
>> b/Documentation/networking/dpaa2/dpio-driver.rst
>> similarity index 94%
>> rename from drivers/soc/fsl/dpio/dpio-driver.txt
>> rename to Documentation/networking/dpaa2/dpio-driver.rst
>> index 72ba9da..3a33a33 100644
>> --- a/drivers/soc/fsl/dpio/dpio-driver.txt
>> +++ b/Documentation/networking/dpaa2/dpio-driver.rst
>> @@ -1,7 +1,16 @@
>> -Copyright 2016 NXP
>> +.. include:: 
>> +
>> +DPAA2 DPIO (Data Path I/O) Overview
>> +===
>> +
>> +:Copyright: |copy| 2015 Freescale Semiconductor Inc.
>> +:Copyright: |copy| 2018 NXP
>> +
> Existing copyright should be kept.
> 2018 could be appended if needed.
I have resent v3 to address this oversight.

Thanks

Roy
> Regards,
> Horia
>

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


[PATCH v2 4/4] drivers/soc/fsl/dpio: Convert DPIO documentation to .rst

2018-07-23 Thread Roy Pledge
Convert the Datapath I/O documentation to .rst format
and move to the Documation/networking/dpaa2 directory

Signed-off-by: Roy Pledge 
---
 .../networking/dpaa2/dpio-driver.rst   | 30 +++---
 Documentation/networking/dpaa2/index.rst   |  1 +
 2 files changed, 28 insertions(+), 3 deletions(-)
 rename drivers/soc/fsl/dpio/dpio-driver.txt => 
Documentation/networking/dpaa2/dpio-driver.rst (94%)

diff --git a/drivers/soc/fsl/dpio/dpio-driver.txt 
b/Documentation/networking/dpaa2/dpio-driver.rst
similarity index 94%
rename from drivers/soc/fsl/dpio/dpio-driver.txt
rename to Documentation/networking/dpaa2/dpio-driver.rst
index 72ba9da..3a33a33 100644
--- a/drivers/soc/fsl/dpio/dpio-driver.txt
+++ b/Documentation/networking/dpaa2/dpio-driver.rst
@@ -1,7 +1,16 @@
-Copyright 2016 NXP
+.. include:: 
+
+DPAA2 DPIO (Data Path I/O) Overview
+===
+
+:Copyright: |copy| 2015 Freescale Semiconductor Inc.
+:Copyright: |copy| 2018 NXP
+
+This document provides an overview of the Freescale DPAA2 DPIO
+drivers
 
 Introduction
-
+
 
 A DPAA2 DPIO (Data Path I/O) is a hardware object that provides
 interfaces to enqueue and dequeue frames to/from network interfaces
@@ -27,8 +36,11 @@ provides services that:
 
 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
@@ -45,8 +57,9 @@ The Linux DPIO driver consists of 3 primary components--
 |
  hardware
 
+
 The diagram below shows how the DPIO driver components fit with the other
-DPAA2 Linux driver components:
+DPAA2 Linux driver components::
++
| OS Network |
|   Stack|
@@ -98,20 +111,29 @@ DPIO service  (dpio-service.c, dpaa2-io.h)
 
Notification handling
   dpaa2_io_service_register()
+
   dpaa2_io_service_deregister()
+
   dpaa2_io_service_rearm()
 
Queuing
   dpaa2_io_service_pull_fq()
+
   dpaa2_io_service_pull_channel()
+
   dpaa2_io_service_enqueue_fq()
+
   dpaa2_io_service_enqueue_qd()
+
   dpaa2_io_store_create()
+
   dpaa2_io_store_destroy()
+
   dpaa2_io_store_next()
 
Buffer pool management
   dpaa2_io_service_release()
+
   dpaa2_io_service_acquire()
 
 QBman portal interface (qbman-portal.c)
@@ -120,7 +142,9 @@ QBman portal interface (qbman-portal.c)
The qbman-portal component provides APIs to do the low level hardware
bit twiddling for operations such as:
   -initializing Qman software portals
+
   -building and sending portal commands
+
   -portal interrupt configuration and processing
 
The qbman-portal APIs are not public to other drivers, and are
diff --git a/Documentation/networking/dpaa2/index.rst 
b/Documentation/networking/dpaa2/index.rst
index 4c6586c..10bea11 100644
--- a/Documentation/networking/dpaa2/index.rst
+++ b/Documentation/networking/dpaa2/index.rst
@@ -6,3 +6,4 @@ DPAA2 Documentation
:maxdepth: 1
 
overview
+   dpio-driver
-- 
2.7.4

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


[PATCH v2 0/4] staging/fsl-mc/bus: Move DPIO from staging to drivers/soc/fsl

2018-07-23 Thread Roy Pledge
Move the NXP DPIO (Datapath I/O driver) from the staging/fsl-mc/bus/dpio
directory to the drivers/soc/fsl directory.

The DPIO driver enables access to the Queue and Buffer Managemer (QBMAN)
hardware of NXP DPAA2 devices. This is a prerequiste for moving the DPAA2
Ethernet device driver from the staging directory.


Horia Geantă (1):
  staging: fsl-dpaa2/eth: move generic FD defines to DPIO

Roy Pledge (3):
  staging:fsl-mc: Move DPIO from staging to drivers/soc/fsl
  drivers/staging: Remove fsl-mc driver from staging
  drivers/soc/fsl/dpio: Convert DPIO documentation to .rst

 .../networking/dpaa2/dpio-driver.rst   | 30 +++---
 Documentation/networking/dpaa2/index.rst   |  1 +
 MAINTAINERS|  2 +-
 drivers/crypto/caam/sg_sw_qm2.h|  2 +-
 drivers/crypto/caam/sg_sw_sec4.h   |  2 +-
 drivers/soc/fsl/Kconfig| 10 
 drivers/soc/fsl/Makefile   |  1 +
 .../{staging/fsl-mc/bus => soc/fsl}/dpio/Makefile  |  0
 .../fsl-mc/bus => soc/fsl}/dpio/dpio-cmd.h |  0
 .../fsl-mc/bus => soc/fsl}/dpio/dpio-driver.c  |  2 +-
 .../fsl-mc/bus => soc/fsl}/dpio/dpio-service.c |  2 +-
 .../{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.c|  0
 .../{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.h|  0
 .../fsl-mc/bus => soc/fsl}/dpio/qbman-portal.c |  2 +-
 .../fsl-mc/bus => soc/fsl}/dpio/qbman-portal.h |  2 +-
 drivers/staging/Kconfig|  2 --
 drivers/staging/Makefile   |  1 -
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c |  4 +--
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h | 22 +---
 drivers/staging/fsl-mc/Kconfig |  2 --
 drivers/staging/fsl-mc/Makefile|  3 ---
 drivers/staging/fsl-mc/bus/Kconfig | 16 
 drivers/staging/fsl-mc/bus/Makefile|  9 ---
 .../fsl-mc/include => include/soc/fsl}/dpaa2-fd.h  | 12 +
 .../include => include/soc/fsl}/dpaa2-global.h |  0
 .../fsl-mc/include => include/soc/fsl}/dpaa2-io.h  |  0
 26 files changed, 67 insertions(+), 60 deletions(-)
 rename drivers/staging/fsl-mc/bus/dpio/dpio-driver.txt => 
Documentation/networking/dpaa2/dpio-driver.rst (94%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/Makefile (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-cmd.h (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-driver.c (99%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-service.c (99%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.c (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.h (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/qbman-portal.c (99%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/qbman-portal.h (99%)
 delete mode 100644 drivers/staging/fsl-mc/Kconfig
 delete mode 100644 drivers/staging/fsl-mc/Makefile
 delete mode 100644 drivers/staging/fsl-mc/bus/Kconfig
 delete mode 100644 drivers/staging/fsl-mc/bus/Makefile
 rename {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-fd.h (97%)
 rename {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-global.h 
(100%)
 rename {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-io.h (100%)

--
2.7.4

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


[PATCH v2 1/4] staging: fsl-dpaa2/eth: move generic FD defines to DPIO

2018-07-23 Thread Roy Pledge
From: Horia Geantă 

Previous commits:
commit 6e2387e8f19e ("staging: fsl-dpaa2/eth: Add Freescale DPAA2
Ethernet driver")
commit 39163c0ce0f4 ("staging: fsl-dpaa2/eth: Errors checking update")

have added bits that are not specific to the WRIOP accelerator.

Move these where they belong (in DPIO) such that other accelerators
can make use of them.

Signed-off-by: Horia Geantă 
Acked-by: Ioana Radulescu 
---
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c |  4 ++--
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h | 18 +-
 drivers/staging/fsl-mc/include/dpaa2-fd.h  | 12 
 3 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
index 3963717..d5f0ac5 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
@@ -455,7 +455,7 @@ static int build_sg_fd(struct dpaa2_eth_priv *priv,
dpaa2_fd_set_format(fd, dpaa2_fd_sg);
dpaa2_fd_set_addr(fd, addr);
dpaa2_fd_set_len(fd, skb->len);
-   dpaa2_fd_set_ctrl(fd, DPAA2_FD_CTRL_PTA | DPAA2_FD_CTRL_PTV1);
+   dpaa2_fd_set_ctrl(fd, FD_CTRL_PTA | FD_CTRL_PTV1);
 
if (priv->tx_tstamp && skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)
enable_tx_tstamp(fd, sgt_buf);
@@ -508,7 +508,7 @@ static int build_single_fd(struct dpaa2_eth_priv *priv,
dpaa2_fd_set_offset(fd, (u16)(skb->data - buffer_start));
dpaa2_fd_set_len(fd, skb->len);
dpaa2_fd_set_format(fd, dpaa2_fd_single);
-   dpaa2_fd_set_ctrl(fd, DPAA2_FD_CTRL_PTA | DPAA2_FD_CTRL_PTV1);
+   dpaa2_fd_set_ctrl(fd, FD_CTRL_PTA | FD_CTRL_PTV1);
 
if (priv->tx_tstamp && skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)
enable_tx_tstamp(fd, buffer_start);
diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
index 905a4e6..9269cb0 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
@@ -124,21 +124,13 @@ struct dpaa2_eth_swa {
 #define DPAA2_FD_FRC_FAICFDV   0x0400
 
 /* Error bits in FD CTRL */
-#define DPAA2_FD_CTRL_UFD  0x0004
-#define DPAA2_FD_CTRL_SBE  0x0008
-#define DPAA2_FD_CTRL_FSE  0x0020
-#define DPAA2_FD_CTRL_FAERR0x0040
-
-#define DPAA2_FD_RX_ERR_MASK   (DPAA2_FD_CTRL_SBE  | \
-DPAA2_FD_CTRL_FAERR)
-#define DPAA2_FD_TX_ERR_MASK   (DPAA2_FD_CTRL_UFD  | \
-DPAA2_FD_CTRL_SBE  | \
-DPAA2_FD_CTRL_FSE  | \
-DPAA2_FD_CTRL_FAERR)
+#define DPAA2_FD_RX_ERR_MASK   (FD_CTRL_SBE | FD_CTRL_FAERR)
+#define DPAA2_FD_TX_ERR_MASK   (FD_CTRL_UFD| \
+FD_CTRL_SBE| \
+FD_CTRL_FSE| \
+FD_CTRL_FAERR)
 
 /* Annotation bits in FD CTRL */
-#define DPAA2_FD_CTRL_PTA  0x0080
-#define DPAA2_FD_CTRL_PTV1 0x0040
 #define DPAA2_FD_CTRL_ASAL 0x0002  /* ASAL = 128B */
 
 /* Frame annotation status */
diff --git a/drivers/staging/fsl-mc/include/dpaa2-fd.h 
b/drivers/staging/fsl-mc/include/dpaa2-fd.h
index b55b89b..2576aba 100644
--- a/drivers/staging/fsl-mc/include/dpaa2-fd.h
+++ b/drivers/staging/fsl-mc/include/dpaa2-fd.h
@@ -67,6 +67,18 @@ struct dpaa2_fd {
 #define SG_FINAL_FLAG_MASK 0x1
 #define SG_FINAL_FLAG_SHIFT15
 
+/* Error bits in FD CTRL */
+#define FD_CTRL_ERR_MASK   0x00FF
+#define FD_CTRL_UFD0x0004
+#define FD_CTRL_SBE0x0008
+#define FD_CTRL_FLC0x0010
+#define FD_CTRL_FSE0x0020
+#define FD_CTRL_FAERR  0x0040
+
+/* Annotation bits in FD CTRL */
+#define FD_CTRL_PTA0x0080
+#define FD_CTRL_PTV1   0x0040
+
 enum dpaa2_fd_format {
dpaa2_fd_single = 0,
dpaa2_fd_list,
-- 
2.7.4

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


[PATCH v2 3/4] drivers/staging: Remove fsl-mc driver from staging

2018-07-23 Thread Roy Pledge
Remove the staging/drivers/fsl-mc directory from the staging
area now that all the components have been moved to the main
kernel areas.

Signed-off-by: Roy Pledge 
---
 drivers/staging/Kconfig | 2 --
 drivers/staging/Makefile| 1 -
 drivers/staging/fsl-mc/Kconfig  | 2 --
 drivers/staging/fsl-mc/Makefile | 3 ---
 drivers/staging/fsl-mc/bus/Kconfig  | 7 ---
 drivers/staging/fsl-mc/bus/Makefile | 7 ---
 6 files changed, 22 deletions(-)
 delete mode 100644 drivers/staging/fsl-mc/Kconfig
 delete mode 100644 drivers/staging/fsl-mc/Makefile
 delete mode 100644 drivers/staging/fsl-mc/bus/Kconfig
 delete mode 100644 drivers/staging/fsl-mc/bus/Makefile

diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
index 75a4804..47b61c3 100644
--- a/drivers/staging/Kconfig
+++ b/drivers/staging/Kconfig
@@ -92,8 +92,6 @@ source "drivers/staging/clocking-wizard/Kconfig"
 
 source "drivers/staging/fbtft/Kconfig"
 
-source "drivers/staging/fsl-mc/Kconfig"
-
 source "drivers/staging/fsl-dpaa2/Kconfig"
 
 source "drivers/staging/wilc1000/Kconfig"
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
index e84959a..bfef8f2 100644
--- a/drivers/staging/Makefile
+++ b/drivers/staging/Makefile
@@ -37,7 +37,6 @@ obj-$(CONFIG_CRYPTO_SKEIN)+= skein/
 obj-$(CONFIG_UNISYSSPAR)   += unisys/
 obj-$(CONFIG_COMMON_CLK_XLNX_CLKWZRD)  += clocking-wizard/
 obj-$(CONFIG_FB_TFT)   += fbtft/
-obj-$(CONFIG_FSL_MC_BUS)   += fsl-mc/
 obj-$(CONFIG_FSL_DPAA2)+= fsl-dpaa2/
 obj-$(CONFIG_WILC1000) += wilc1000/
 obj-$(CONFIG_MOST) += most/
diff --git a/drivers/staging/fsl-mc/Kconfig b/drivers/staging/fsl-mc/Kconfig
deleted file mode 100644
index 3002229..000
--- a/drivers/staging/fsl-mc/Kconfig
+++ /dev/null
@@ -1,2 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-source "drivers/staging/fsl-mc/bus/Kconfig"
diff --git a/drivers/staging/fsl-mc/Makefile b/drivers/staging/fsl-mc/Makefile
deleted file mode 100644
index 1468388..000
--- a/drivers/staging/fsl-mc/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-# Freescale Management Complex (MC) bus drivers
-obj-$(CONFIG_FSL_MC_BUS)   += bus/
diff --git a/drivers/staging/fsl-mc/bus/Kconfig 
b/drivers/staging/fsl-mc/bus/Kconfig
deleted file mode 100644
index 90f234d..000
--- a/drivers/staging/fsl-mc/bus/Kconfig
+++ /dev/null
@@ -1,7 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-#
-# DPAA2 fsl-mc bus
-#
-# Copyright (C) 2014-2016 Freescale Semiconductor, Inc.
-#
-
diff --git a/drivers/staging/fsl-mc/bus/Makefile 
b/drivers/staging/fsl-mc/bus/Makefile
deleted file mode 100644
index 2141e4b..000
--- a/drivers/staging/fsl-mc/bus/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-#
-# Freescale Management Complex (MC) bus drivers
-#
-# Copyright (C) 2014 Freescale Semiconductor, Inc.
-#
-
-- 
2.7.4

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


[PATCH v2 2/4] staging:fsl-mc: Move DPIO from staging to drivers/soc/fsl

2018-07-23 Thread Roy Pledge
Move the NXP DPIO (Datapath I/O Driver) out of the
drivers/staging directory and into the drivers/soc/fsl directory.

The DPIO driver enables access to Queue and Buffer Manager (QBMAN)
hardware on NXP DPAA2 devices. This is a prerequisite to moving the
DPAA2 Ethernet driver out of staging.

Signed-off-by: Roy Pledge 
---
 MAINTAINERS|  2 +-
 drivers/crypto/caam/sg_sw_qm2.h|  2 +-
 drivers/crypto/caam/sg_sw_sec4.h   |  2 +-
 drivers/soc/fsl/Kconfig| 10 ++
 drivers/soc/fsl/Makefile   |  1 +
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/Makefile  |  0
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-cmd.h|  0
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-driver.c |  2 +-
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-driver.txt   |  0
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-service.c|  2 +-
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.c|  0
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.h|  0
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/qbman-portal.c|  2 +-
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/qbman-portal.h|  2 +-
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h |  4 ++--
 drivers/staging/fsl-mc/bus/Kconfig |  9 -
 drivers/staging/fsl-mc/bus/Makefile|  2 --
 {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-fd.h |  0
 .../staging/fsl-mc/include => include/soc/fsl}/dpaa2-global.h  |  0
 {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-io.h |  0
 20 files changed, 20 insertions(+), 20 deletions(-)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/Makefile (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-cmd.h (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-driver.c (99%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-driver.txt (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-service.c (99%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.c (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.h (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/qbman-portal.c (99%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/qbman-portal.h (99%)
 rename {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-fd.h (100%)
 rename {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-global.h 
(100%)
 rename {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-io.h (100%)

diff --git a/MAINTAINERS b/MAINTAINERS
index 0fe4228..34ce842 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4418,7 +4418,7 @@ DPAA2 DATAPATH I/O (DPIO) DRIVER
 M: Roy Pledge 
 L: linux-ker...@vger.kernel.org
 S: Maintained
-F: drivers/staging/fsl-mc/bus/dpio
+F: drivers/soc/fsl/dpio
 
 DPAA2 ETHERNET DRIVER
 M: Ioana Radulescu 
diff --git a/drivers/crypto/caam/sg_sw_qm2.h b/drivers/crypto/caam/sg_sw_qm2.h
index 31b4407..b5b4c12 100644
--- a/drivers/crypto/caam/sg_sw_qm2.h
+++ b/drivers/crypto/caam/sg_sw_qm2.h
@@ -35,7 +35,7 @@
 #ifndef _SG_SW_QM2_H_
 #define _SG_SW_QM2_H_
 
-#include "../../../drivers/staging/fsl-mc/include/dpaa2-fd.h"
+#include 
 
 static inline void dma_to_qm_sg_one(struct dpaa2_sg_entry *qm_sg_ptr,
dma_addr_t dma, u32 len, u16 offset)
diff --git a/drivers/crypto/caam/sg_sw_sec4.h b/drivers/crypto/caam/sg_sw_sec4.h
index e586ffa..dbfa9fc 100644
--- a/drivers/crypto/caam/sg_sw_sec4.h
+++ b/drivers/crypto/caam/sg_sw_sec4.h
@@ -12,7 +12,7 @@
 #include "ctrl.h"
 #include "regs.h"
 #include "sg_sw_qm2.h"
-#include "../../../drivers/staging/fsl-mc/include/dpaa2-fd.h"
+#include 
 
 struct sec4_sg_entry {
u64 ptr;
diff --git a/drivers/soc/fsl/Kconfig b/drivers/soc/fsl/Kconfig
index 7a9fb9b..c17bf38 100644
--- a/drivers/soc/fsl/Kconfig
+++ b/drivers/soc/fsl/Kconfig
@@ -16,3 +16,13 @@ config FSL_GUTS
  Initially only reading SVR and registering soc device are supported.
  Other guts accesses, such as reading RCW, should eventually be moved
  into this driver as well.
+
+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/soc/fsl/Makefile b/drivers/soc/fsl/Makefile
index 44b3beb..803ef1b 100644
--- a/drivers/soc/fsl/Makefile
+++ b/drivers/soc/fsl/Makefi

Re: [PATCH 1/2] staging:fsl-mc: Move DPIO from staging to drivers/soc/fsl

2018-07-09 Thread Roy Pledge
On 7/9/2018 6:37 AM, Laurentiu Tudor wrote:
> Hi Roy,
>
> Couple of comments inline.
>
> On 05.07.2018 22:41, Roy Pledge wrote:
>> Move the NXP DPIO (Datapath I/O Driver) out of the
>> drivers/staging directory and into the drivers/soc/fsl directory.
>>
>> The DPIO driver enables access to Queue and Buffer Manager (QBMAN)
>> hardware on NXP DPAA2 devices. This is a prerequisite to moving the
>> DPAA2 Ethernet driver out of staging.
>>
>> Signed-off-by: Roy Pledge 
>> ---
>>   MAINTAINERS|  2 +-
>>   drivers/crypto/caam/sg_sw_qm2.h|  2 +-
>>   drivers/crypto/caam/sg_sw_sec4.h   |  2 +-
>>   drivers/soc/fsl/Kconfig| 10 
>> ++
>>   drivers/soc/fsl/Makefile   |  1 +
>>   drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/Makefile  |  0
>>   drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-cmd.h|  0
>>   drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-driver.c |  2 +-
>>   drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-driver.txt   |  0
> Maybe this should be converted to .rst and go in the already existing
> Documentation/networking/dpaa2/?

I can look into converting this to RST but I'm not sure it belongs in
the networking documentation folder since
it will be used by other non networking drivers in the near future -
compress/decompress for example.
>
>>   drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-service.c|  2 +-
>>   drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.c|  0
>>   drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.h|  0
>>   drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/qbman-portal.c|  2 +-
>>   drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/qbman-portal.h|  2 +-
>>   drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h |  4 ++--
>>   drivers/staging/fsl-mc/bus/Kconfig |  9 
>> -
>>   drivers/staging/fsl-mc/bus/Makefile|  2 --
>>   {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-fd.h |  0
>>   .../staging/fsl-mc/include => include/soc/fsl}/dpaa2-global.h  |  0
>>   {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-io.h |  0
>>   20 files changed, 20 insertions(+), 20 deletions(-)
>>   rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/Makefile (100%)
>>   rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-cmd.h (100%)
>>   rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-driver.c (99%)
>>   rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-driver.txt (100%)
>>   rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-service.c (99%)
>>   rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.c (100%)
>>   rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.h (100%)
>>   rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/qbman-portal.c (99%)
>>   rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/qbman-portal.h (99%)
>>   rename {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-fd.h 
>> (100%)
>>   rename {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-global.h 
>> (100%)
>>   rename {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-io.h 
>> (100%)
> I received feedback in the past on mc-bus that a driver should limit to 
> only one public header and one private one. Would it make sense to do 
> the same for dpio too?
Looking at this the dpaa-2global.h file should probably be integrated
into the dpaa2-io.h file. 
The dpaaa2-fd.h can be used by devices that don't need to used DPIO -
the definition of a frame descriptor
isn't DPIO specific so I would argue it should be kept in a seperate file.
 
>
> ---
> Best Regards, Laurentiu


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


Re: [PATCH 0/2] staging/fsl-mc/bus: Move DPIO from staging to drivers/soc/fsl

2018-07-06 Thread Roy Pledge
On 7/6/2018 8:25 AM, Horia Geanta wrote:
> On 7/5/2018 10:41 PM, Roy Pledge wrote:
>> Move the NXP DPIO (Datapath I/O driver) from the staging/fsl-mc/bus/dpio
>> directory to the drivers/soc/fsl directory.
>>
>> The DPIO driver enables access to the Queue and Buffer Managemer (QBMAN)
>> hardware of NXP DPAA2 devices. This is a prerequiste for moving the DPAA2
>> Ethernet device driver from the staging directory.
>>
> Roy, Ioana,
>
> Would it be ok to add the following patch on top of the series?
> It's a dependency for dpseci object.
> If not added now I fear it won't be accepted until dpaa2-ethernet
> moves out of staging, thus gating dpseci upstreaming.
>
> Thanks,
> Horia
I can add this to the series - I will respin and send a v2.
>
> --->8---
> Previous commits:
> 6e2387e8f19ed ("staging: fsl-dpaa2/eth: Add Freescale DPAA2 Ethernet driver")
> 39163c0ce0f48 ("staging: fsl-dpaa2/eth: Errors checking update")
> added bits that are not specific to the WRIOP accelerator.
>
> Move these where they belong (in DPIO) such that other accelerators
> can make use of them.
>
> Signed-off-by: Horia Geantă 
> ---
>  drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c |  4 ++--
>  drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h | 18 +-
>  drivers/staging/fsl-mc/include/dpaa2-fd.h  | 12 
>  3 files changed, 19 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c 
> b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
> index 396371728aa1..d5f0ac5c2d1f 100644
> --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
> +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
> @@ -455,7 +455,7 @@ static int build_sg_fd(struct dpaa2_eth_priv *priv,
>   dpaa2_fd_set_format(fd, dpaa2_fd_sg);
>   dpaa2_fd_set_addr(fd, addr);
>   dpaa2_fd_set_len(fd, skb->len);
> - dpaa2_fd_set_ctrl(fd, DPAA2_FD_CTRL_PTA | DPAA2_FD_CTRL_PTV1);
> + dpaa2_fd_set_ctrl(fd, FD_CTRL_PTA | FD_CTRL_PTV1);
>
>   if (priv->tx_tstamp && skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)
>   enable_tx_tstamp(fd, sgt_buf);
> @@ -508,7 +508,7 @@ static int build_single_fd(struct dpaa2_eth_priv *priv,
>   dpaa2_fd_set_offset(fd, (u16)(skb->data - buffer_start));
>   dpaa2_fd_set_len(fd, skb->len);
>   dpaa2_fd_set_format(fd, dpaa2_fd_single);
> - dpaa2_fd_set_ctrl(fd, DPAA2_FD_CTRL_PTA | DPAA2_FD_CTRL_PTV1);
> + dpaa2_fd_set_ctrl(fd, FD_CTRL_PTA | FD_CTRL_PTV1);
>
>   if (priv->tx_tstamp && skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)
>   enable_tx_tstamp(fd, buffer_start);
> diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h 
> b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
> index 905a4e6be8fa..9269cb05a84b 100644
> --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
> +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
> @@ -124,21 +124,13 @@ struct dpaa2_eth_swa {
>  #define DPAA2_FD_FRC_FAICFDV 0x0400
>
>  /* Error bits in FD CTRL */
> -#define DPAA2_FD_CTRL_UFD0x0004
> -#define DPAA2_FD_CTRL_SBE0x0008
> -#define DPAA2_FD_CTRL_FSE0x0020
> -#define DPAA2_FD_CTRL_FAERR  0x0040
> -
> -#define DPAA2_FD_RX_ERR_MASK (DPAA2_FD_CTRL_SBE  | \
> -  DPAA2_FD_CTRL_FAERR)
> -#define DPAA2_FD_TX_ERR_MASK (DPAA2_FD_CTRL_UFD  | \
> -  DPAA2_FD_CTRL_SBE  | \
> -  DPAA2_FD_CTRL_FSE  | \
> -  DPAA2_FD_CTRL_FAERR)
> +#define DPAA2_FD_RX_ERR_MASK (FD_CTRL_SBE | FD_CTRL_FAERR)
> +#define DPAA2_FD_TX_ERR_MASK (FD_CTRL_UFD| \
> +  FD_CTRL_SBE| \
> +  FD_CTRL_FSE| \
> +  FD_CTRL_FAERR)
>
>  /* Annotation bits in FD CTRL */
> -#define DPAA2_FD_CTRL_PTA0x0080
> -#define DPAA2_FD_CTRL_PTV1   0x0040
>  #define DPAA2_FD_CTRL_ASAL   0x0002  /* ASAL = 128B */
>
>  /* Frame annotation status */
> diff --git a/drivers/staging/fsl-mc/include/dpaa2-fd.h 
> b/drivers/staging/fsl-mc/include/dpaa2-fd.h
> index b55b89ba4eda..2576abaa7779 100644
> --- a/drivers/staging/fsl-mc/include/dpaa2-fd.h
> +++ b/drivers/staging/fsl-mc/include/dpaa2-fd.h
> @@ -67,6 +67,18 @@ struct dpaa2_fd {
>  #define SG_FINAL_FLAG_MASK   0x1
>  #define SG_FINAL_FLAG_SHIFT  15
>
> +/* Error bits in FD CTRL */
> +#define FD_CTRL_ERR_MASK 0x00FF
> +#

[PATCH 1/2] staging:fsl-mc: Move DPIO from staging to drivers/soc/fsl

2018-07-05 Thread Roy Pledge
Move the NXP DPIO (Datapath I/O Driver) out of the
drivers/staging directory and into the drivers/soc/fsl directory.

The DPIO driver enables access to Queue and Buffer Manager (QBMAN)
hardware on NXP DPAA2 devices. This is a prerequisite to moving the
DPAA2 Ethernet driver out of staging.

Signed-off-by: Roy Pledge 
---
 MAINTAINERS|  2 +-
 drivers/crypto/caam/sg_sw_qm2.h|  2 +-
 drivers/crypto/caam/sg_sw_sec4.h   |  2 +-
 drivers/soc/fsl/Kconfig| 10 ++
 drivers/soc/fsl/Makefile   |  1 +
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/Makefile  |  0
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-cmd.h|  0
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-driver.c |  2 +-
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-driver.txt   |  0
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-service.c|  2 +-
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.c|  0
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.h|  0
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/qbman-portal.c|  2 +-
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/qbman-portal.h|  2 +-
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h |  4 ++--
 drivers/staging/fsl-mc/bus/Kconfig |  9 -
 drivers/staging/fsl-mc/bus/Makefile|  2 --
 {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-fd.h |  0
 .../staging/fsl-mc/include => include/soc/fsl}/dpaa2-global.h  |  0
 {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-io.h |  0
 20 files changed, 20 insertions(+), 20 deletions(-)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/Makefile (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-cmd.h (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-driver.c (99%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-driver.txt (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-service.c (99%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.c (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.h (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/qbman-portal.c (99%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/qbman-portal.h (99%)
 rename {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-fd.h (100%)
 rename {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-global.h 
(100%)
 rename {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-io.h (100%)

diff --git a/MAINTAINERS b/MAINTAINERS
index f771ec1..5b41d0d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4442,7 +4442,7 @@ DPAA2 DATAPATH I/O (DPIO) DRIVER
 M: Roy Pledge 
 L: linux-ker...@vger.kernel.org
 S: Maintained
-F: drivers/staging/fsl-mc/bus/dpio
+F: drivers/soc/fsl/dpio
 
 DPAA2 ETHERNET DRIVER
 M: Ioana Radulescu 
diff --git a/drivers/crypto/caam/sg_sw_qm2.h b/drivers/crypto/caam/sg_sw_qm2.h
index 31b4407..b5b4c12 100644
--- a/drivers/crypto/caam/sg_sw_qm2.h
+++ b/drivers/crypto/caam/sg_sw_qm2.h
@@ -35,7 +35,7 @@
 #ifndef _SG_SW_QM2_H_
 #define _SG_SW_QM2_H_
 
-#include "../../../drivers/staging/fsl-mc/include/dpaa2-fd.h"
+#include 
 
 static inline void dma_to_qm_sg_one(struct dpaa2_sg_entry *qm_sg_ptr,
dma_addr_t dma, u32 len, u16 offset)
diff --git a/drivers/crypto/caam/sg_sw_sec4.h b/drivers/crypto/caam/sg_sw_sec4.h
index e586ffa..dbfa9fc 100644
--- a/drivers/crypto/caam/sg_sw_sec4.h
+++ b/drivers/crypto/caam/sg_sw_sec4.h
@@ -12,7 +12,7 @@
 #include "ctrl.h"
 #include "regs.h"
 #include "sg_sw_qm2.h"
-#include "../../../drivers/staging/fsl-mc/include/dpaa2-fd.h"
+#include 
 
 struct sec4_sg_entry {
u64 ptr;
diff --git a/drivers/soc/fsl/Kconfig b/drivers/soc/fsl/Kconfig
index 7a9fb9b..c17bf38 100644
--- a/drivers/soc/fsl/Kconfig
+++ b/drivers/soc/fsl/Kconfig
@@ -16,3 +16,13 @@ config FSL_GUTS
  Initially only reading SVR and registering soc device are supported.
  Other guts accesses, such as reading RCW, should eventually be moved
  into this driver as well.
+
+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/soc/fsl/Makefile b/drivers/soc/fsl/Makefile
index 44b3beb..803ef1b 100644
--- a/drivers/soc/fsl/Makefile
+++ b/drivers/soc/fsl/Makefi

[PATCH 2/2] drivers/staging: Remove fsl-mc driver from staging

2018-07-05 Thread Roy Pledge
Remove the staging/drivers/fsl-mc directory from the staging
area now that all the components have been moved to the main
kernel areas.

Signed-off-by: Roy Pledge 
---
 drivers/staging/Kconfig | 2 --
 drivers/staging/Makefile| 1 -
 drivers/staging/fsl-mc/Kconfig  | 2 --
 drivers/staging/fsl-mc/Makefile | 3 ---
 drivers/staging/fsl-mc/bus/Kconfig  | 7 ---
 drivers/staging/fsl-mc/bus/Makefile | 7 ---
 6 files changed, 22 deletions(-)
 delete mode 100644 drivers/staging/fsl-mc/Kconfig
 delete mode 100644 drivers/staging/fsl-mc/Makefile
 delete mode 100644 drivers/staging/fsl-mc/bus/Kconfig
 delete mode 100644 drivers/staging/fsl-mc/bus/Makefile

diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
index 9339af2..344fcf1 100644
--- a/drivers/staging/Kconfig
+++ b/drivers/staging/Kconfig
@@ -90,8 +90,6 @@ source "drivers/staging/clocking-wizard/Kconfig"
 
 source "drivers/staging/fbtft/Kconfig"
 
-source "drivers/staging/fsl-mc/Kconfig"
-
 source "drivers/staging/fsl-dpaa2/Kconfig"
 
 source "drivers/staging/wilc1000/Kconfig"
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
index aa40b1f..2a84679 100644
--- a/drivers/staging/Makefile
+++ b/drivers/staging/Makefile
@@ -35,7 +35,6 @@ obj-$(CONFIG_GS_FPGABOOT) += gs_fpgaboot/
 obj-$(CONFIG_UNISYSSPAR)   += unisys/
 obj-$(CONFIG_COMMON_CLK_XLNX_CLKWZRD)  += clocking-wizard/
 obj-$(CONFIG_FB_TFT)   += fbtft/
-obj-$(CONFIG_FSL_MC_BUS)   += fsl-mc/
 obj-$(CONFIG_FSL_DPAA2)+= fsl-dpaa2/
 obj-$(CONFIG_WILC1000) += wilc1000/
 obj-$(CONFIG_MOST) += most/
diff --git a/drivers/staging/fsl-mc/Kconfig b/drivers/staging/fsl-mc/Kconfig
deleted file mode 100644
index 3002229..000
--- a/drivers/staging/fsl-mc/Kconfig
+++ /dev/null
@@ -1,2 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-source "drivers/staging/fsl-mc/bus/Kconfig"
diff --git a/drivers/staging/fsl-mc/Makefile b/drivers/staging/fsl-mc/Makefile
deleted file mode 100644
index 1468388..000
--- a/drivers/staging/fsl-mc/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-# Freescale Management Complex (MC) bus drivers
-obj-$(CONFIG_FSL_MC_BUS)   += bus/
diff --git a/drivers/staging/fsl-mc/bus/Kconfig 
b/drivers/staging/fsl-mc/bus/Kconfig
deleted file mode 100644
index 90f234d..000
--- a/drivers/staging/fsl-mc/bus/Kconfig
+++ /dev/null
@@ -1,7 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-#
-# DPAA2 fsl-mc bus
-#
-# Copyright (C) 2014-2016 Freescale Semiconductor, Inc.
-#
-
diff --git a/drivers/staging/fsl-mc/bus/Makefile 
b/drivers/staging/fsl-mc/bus/Makefile
deleted file mode 100644
index 2141e4b..000
--- a/drivers/staging/fsl-mc/bus/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-#
-# Freescale Management Complex (MC) bus drivers
-#
-# Copyright (C) 2014 Freescale Semiconductor, Inc.
-#
-
-- 
2.7.4

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


[PATCH 0/2] staging/fsl-mc/bus: Move DPIO from staging to drivers/soc/fsl

2018-07-05 Thread Roy Pledge
Move the NXP DPIO (Datapath I/O driver) from the staging/fsl-mc/bus/dpio
directory to the drivers/soc/fsl directory.

The DPIO driver enables access to the Queue and Buffer Managemer (QBMAN)
hardware of NXP DPAA2 devices. This is a prerequiste for moving the DPAA2
Ethernet device driver from the staging directory.

Roy Pledge (2):
  staging:fsl-mc: Move DPIO from staging to drivers/soc/fsl
  drivers/staging: Remove fsl-mc driver from staging

 MAINTAINERS  |  2 +-
 drivers/crypto/caam/sg_sw_qm2.h  |  2 +-
 drivers/crypto/caam/sg_sw_sec4.h |  2 +-
 drivers/soc/fsl/Kconfig  | 10 ++
 drivers/soc/fsl/Makefile |  1 +
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/Makefile|  0
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-cmd.h  |  0
 .../{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-driver.c   |  2 +-
 .../{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-driver.txt |  0
 .../{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-service.c  |  2 +-
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.c  |  0
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.h  |  0
 .../{staging/fsl-mc/bus => soc/fsl}/dpio/qbman-portal.c  |  2 +-
 .../{staging/fsl-mc/bus => soc/fsl}/dpio/qbman-portal.h  |  2 +-
 drivers/staging/Kconfig  |  2 --
 drivers/staging/Makefile |  1 -
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h   |  4 ++--
 drivers/staging/fsl-mc/Kconfig   |  2 --
 drivers/staging/fsl-mc/Makefile  |  3 ---
 drivers/staging/fsl-mc/bus/Kconfig   | 16 
 drivers/staging/fsl-mc/bus/Makefile  |  9 -
 .../fsl-mc/include => include/soc/fsl}/dpaa2-fd.h|  0
 .../fsl-mc/include => include/soc/fsl}/dpaa2-global.h|  0
 .../fsl-mc/include => include/soc/fsl}/dpaa2-io.h|  0
 24 files changed, 20 insertions(+), 42 deletions(-)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/Makefile (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-cmd.h (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-driver.c (99%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-driver.txt (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-service.c (99%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.c (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.h (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/qbman-portal.c (99%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/qbman-portal.h (99%)
 delete mode 100644 drivers/staging/fsl-mc/Kconfig
 delete mode 100644 drivers/staging/fsl-mc/Makefile
 delete mode 100644 drivers/staging/fsl-mc/bus/Kconfig
 delete mode 100644 drivers/staging/fsl-mc/bus/Makefile
 rename {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-fd.h (100%)
 rename {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-global.h 
(100%)
 rename {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-io.h (100%)

--
2.7.4

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


[PATCH v4 2/4] drivers/staging/fsl-mc: Fix DPIO error path issue

2018-03-27 Thread Roy Pledge
Remove unneeded call to dev_set_drvdata(dev, NULL) since the device
will be deallocated in any case.

Signed-off-by: Roy Pledge 
---
 drivers/staging/fsl-mc/bus/dpio/dpio-driver.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c 
b/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c
index ffcbd5a..9e12576 100644
--- a/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c
+++ b/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c
@@ -101,7 +101,7 @@ static int dpaa2_dpio_probe(struct fsl_mc_device *dpio_dev)
if (err) {
dev_dbg(dev, "MC portal allocation failed\n");
err = -EPROBE_DEFER;
-   goto err_mcportal;
+   goto err_priv_alloc;
}
 
err = dpio_open(dpio_dev->mc_io, 0, dpio_dev->obj_desc.id,
@@ -196,8 +196,6 @@ static int dpaa2_dpio_probe(struct fsl_mc_device *dpio_dev)
dpio_close(dpio_dev->mc_io, 0, dpio_dev->mc_handle);
 err_open:
fsl_mc_portal_free(dpio_dev->mc_io);
-err_mcportal:
-   dev_set_drvdata(dev, NULL);
 err_priv_alloc:
return err;
 }
@@ -241,8 +239,6 @@ static int dpaa2_dpio_remove(struct fsl_mc_device *dpio_dev)
 
fsl_mc_portal_free(dpio_dev->mc_io);
 
-   dev_set_drvdata(dev, NULL);
-
return 0;
 
 err_open:
-- 
2.7.4

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


[PATCH v4 4/4] drivers/staging: Remove fsl-mc driver from staging

2018-03-27 Thread Roy Pledge
Remove the staging/drivers/fsl-mc directory from the staging
area now that all the components have been moved to the main
kernel areas.

Signed-off-by: Roy Pledge 
---
 drivers/staging/Kconfig | 2 --
 drivers/staging/Makefile| 1 -
 drivers/staging/fsl-mc/Kconfig  | 2 --
 drivers/staging/fsl-mc/Makefile | 3 ---
 drivers/staging/fsl-mc/bus/Kconfig  | 7 ---
 drivers/staging/fsl-mc/bus/Makefile | 7 ---
 6 files changed, 22 deletions(-)
 delete mode 100644 drivers/staging/fsl-mc/Kconfig
 delete mode 100644 drivers/staging/fsl-mc/Makefile
 delete mode 100644 drivers/staging/fsl-mc/bus/Kconfig
 delete mode 100644 drivers/staging/fsl-mc/bus/Makefile

diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
index d5926f0..a0f262a 100644
--- a/drivers/staging/Kconfig
+++ b/drivers/staging/Kconfig
@@ -98,8 +98,6 @@ source "drivers/staging/clocking-wizard/Kconfig"
 
 source "drivers/staging/fbtft/Kconfig"
 
-source "drivers/staging/fsl-mc/Kconfig"
-
 source "drivers/staging/fsl-dpaa2/Kconfig"
 
 source "drivers/staging/wilc1000/Kconfig"
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
index 919753c..326a1e8 100644
--- a/drivers/staging/Makefile
+++ b/drivers/staging/Makefile
@@ -40,7 +40,6 @@ obj-$(CONFIG_CRYPTO_SKEIN)+= skein/
 obj-$(CONFIG_UNISYSSPAR)   += unisys/
 obj-$(CONFIG_COMMON_CLK_XLNX_CLKWZRD)  += clocking-wizard/
 obj-$(CONFIG_FB_TFT)   += fbtft/
-obj-$(CONFIG_FSL_MC_BUS)   += fsl-mc/
 obj-$(CONFIG_FSL_DPAA2)+= fsl-dpaa2/
 obj-$(CONFIG_WILC1000) += wilc1000/
 obj-$(CONFIG_MOST) += most/
diff --git a/drivers/staging/fsl-mc/Kconfig b/drivers/staging/fsl-mc/Kconfig
deleted file mode 100644
index 3002229..000
--- a/drivers/staging/fsl-mc/Kconfig
+++ /dev/null
@@ -1,2 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-source "drivers/staging/fsl-mc/bus/Kconfig"
diff --git a/drivers/staging/fsl-mc/Makefile b/drivers/staging/fsl-mc/Makefile
deleted file mode 100644
index 1468388..000
--- a/drivers/staging/fsl-mc/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-# Freescale Management Complex (MC) bus drivers
-obj-$(CONFIG_FSL_MC_BUS)   += bus/
diff --git a/drivers/staging/fsl-mc/bus/Kconfig 
b/drivers/staging/fsl-mc/bus/Kconfig
deleted file mode 100644
index 90f234d..000
--- a/drivers/staging/fsl-mc/bus/Kconfig
+++ /dev/null
@@ -1,7 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-#
-# DPAA2 fsl-mc bus
-#
-# Copyright (C) 2014-2016 Freescale Semiconductor, Inc.
-#
-
diff --git a/drivers/staging/fsl-mc/bus/Makefile 
b/drivers/staging/fsl-mc/bus/Makefile
deleted file mode 100644
index 2141e4b..000
--- a/drivers/staging/fsl-mc/bus/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-#
-# Freescale Management Complex (MC) bus drivers
-#
-# Copyright (C) 2014 Freescale Semiconductor, Inc.
-#
-
-- 
2.7.4

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


[PATCH v4 3/4] staging:fsl-mc: Move DPIO from staging to drivers/soc/fsl

2018-03-27 Thread Roy Pledge
Move the NXP DPIO (Datapath I/O Driver) out of the
drivers/staging directory and into the drivers/soc/fsl directory.

The DPIO driver enables access to Queue and Buffer Manager (QBMAN)
hardware on NXP DPAA2 devices. This is a prerequisite to moving the
DPAA2 Ethernet driver out of staging.

Signed-off-by: Roy Pledge 
---
 MAINTAINERS|  2 +-
 drivers/crypto/caam/sg_sw_qm2.h|  2 +-
 drivers/crypto/caam/sg_sw_sec4.h   |  2 +-
 drivers/soc/fsl/Kconfig| 10 ++
 drivers/soc/fsl/Makefile   |  1 +
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/Makefile  |  0
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-cmd.h|  0
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-driver.c |  2 +-
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-driver.txt   |  0
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-service.c|  2 +-
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.c|  0
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.h|  0
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/qbman-portal.c|  2 +-
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/qbman-portal.h|  2 +-
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h |  4 ++--
 drivers/staging/fsl-mc/bus/Kconfig |  9 -
 drivers/staging/fsl-mc/bus/Makefile|  2 --
 {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-fd.h |  0
 .../staging/fsl-mc/include => include/soc/fsl}/dpaa2-global.h  |  0
 {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-io.h |  0
 20 files changed, 20 insertions(+), 20 deletions(-)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/Makefile (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-cmd.h (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-driver.c (99%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-driver.txt (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-service.c (99%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.c (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.h (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/qbman-portal.c (99%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/qbman-portal.h (99%)
 rename {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-fd.h (100%)
 rename {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-global.h 
(100%)
 rename {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-io.h (100%)

diff --git a/MAINTAINERS b/MAINTAINERS
index dc74106..e2f234c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4375,7 +4375,7 @@ DPAA2 DATAPATH I/O (DPIO) DRIVER
 M: Roy Pledge 
 L: linux-ker...@vger.kernel.org
 S: Maintained
-F: drivers/staging/fsl-mc/bus/dpio
+F: drivers/soc/fsl/dpio
 
 DPAA2 ETHERNET DRIVER
 M: Ioana Radulescu 
diff --git a/drivers/crypto/caam/sg_sw_qm2.h b/drivers/crypto/caam/sg_sw_qm2.h
index 31b4407..b5b4c12 100644
--- a/drivers/crypto/caam/sg_sw_qm2.h
+++ b/drivers/crypto/caam/sg_sw_qm2.h
@@ -35,7 +35,7 @@
 #ifndef _SG_SW_QM2_H_
 #define _SG_SW_QM2_H_
 
-#include "../../../drivers/staging/fsl-mc/include/dpaa2-fd.h"
+#include 
 
 static inline void dma_to_qm_sg_one(struct dpaa2_sg_entry *qm_sg_ptr,
dma_addr_t dma, u32 len, u16 offset)
diff --git a/drivers/crypto/caam/sg_sw_sec4.h b/drivers/crypto/caam/sg_sw_sec4.h
index e586ffa..dbfa9fc 100644
--- a/drivers/crypto/caam/sg_sw_sec4.h
+++ b/drivers/crypto/caam/sg_sw_sec4.h
@@ -12,7 +12,7 @@
 #include "ctrl.h"
 #include "regs.h"
 #include "sg_sw_qm2.h"
-#include "../../../drivers/staging/fsl-mc/include/dpaa2-fd.h"
+#include 
 
 struct sec4_sg_entry {
u64 ptr;
diff --git a/drivers/soc/fsl/Kconfig b/drivers/soc/fsl/Kconfig
index 7a9fb9b..c17bf38 100644
--- a/drivers/soc/fsl/Kconfig
+++ b/drivers/soc/fsl/Kconfig
@@ -16,3 +16,13 @@ config FSL_GUTS
  Initially only reading SVR and registering soc device are supported.
  Other guts accesses, such as reading RCW, should eventually be moved
  into this driver as well.
+
+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/soc/fsl/Makefile b/drivers/soc/fsl/Makefile
index 44b3beb..803ef1b 100644
--- a/drivers/soc/fsl/Makefile
+++ b/drivers/soc/fsl/Makefi

[PATCH v4 1/4] drivers/staging/fsl-mc: Use devm_memremap/devm_ioremap for DPIO

2018-03-27 Thread Roy Pledge
Change the mapping of the QBMan cache enabled area from using ioremap_wc()
to devm_memremap(). This allows the __iomem attribute to be removed from
the pointer (which makes sense as accesses treat this as cacheable memory
not IO memory).  These changes allow sparse checks to pass.

Also use devm_ioremap() for the cache inhibited area so unmap occurs
automatically when the device is released.

Signed-off-by: Roy Pledge 
---
 drivers/staging/fsl-mc/bus/dpio/dpio-driver.c  | 19 +++
 drivers/staging/fsl-mc/bus/dpio/qbman-portal.h |  4 ++--
 drivers/staging/fsl-mc/include/dpaa2-io.h  |  2 +-
 3 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c 
b/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c
index 182b384..ffcbd5a 100644
--- a/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c
+++ b/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include "../../include/dpaa2-io.h"
@@ -146,10 +147,20 @@ static int dpaa2_dpio_probe(struct fsl_mc_device 
*dpio_dev)
 * Set the CENA regs to be the cache inhibited area of the portal to
 * avoid coherency issues if a user migrates to another core.
 */
-   desc.regs_cena = ioremap_wc(dpio_dev->regions[1].start,
-   resource_size(&dpio_dev->regions[1]));
-   desc.regs_cinh = ioremap(dpio_dev->regions[1].start,
-   resource_size(&dpio_dev->regions[1]));
+   desc.regs_cena = devm_memremap(dev, dpio_dev->regions[1].start,
+  resource_size(&dpio_dev->regions[1]),
+  MEMREMAP_WC);
+   if (!desc.regs_cena) {
+   dev_err(dev, "devm_memremap failed\n");
+   goto err_allocate_irqs;
+   }
+
+   desc.regs_cinh = devm_ioremap(dev, dpio_dev->regions[1].start,
+ resource_size(&dpio_dev->regions[1]));
+   if (!desc.regs_cinh) {
+   dev_err(dev, "devm_ioremap failed\n");
+   goto err_allocate_irqs;
+   }
 
err = fsl_mc_allocate_irqs(dpio_dev);
if (err) {
diff --git a/drivers/staging/fsl-mc/bus/dpio/qbman-portal.h 
b/drivers/staging/fsl-mc/bus/dpio/qbman-portal.h
index 4488a44..69db3c8 100644
--- a/drivers/staging/fsl-mc/bus/dpio/qbman-portal.h
+++ b/drivers/staging/fsl-mc/bus/dpio/qbman-portal.h
@@ -15,7 +15,7 @@ struct qbman_swp;
 /* qbman software portal descriptor structure */
 struct qbman_swp_desc {
void *cena_bar; /* Cache-enabled portal base address */
-   void *cinh_bar; /* Cache-inhibited portal base address */
+   void __iomem *cinh_bar; /* Cache-inhibited portal base address */
u32 qman_version;
 };
 
@@ -102,7 +102,7 @@ struct qbman_release_desc {
 /* portal data structure */
 struct qbman_swp {
const struct qbman_swp_desc *desc;
-   void __iomem *addr_cena;
+   void *addr_cena;
void __iomem *addr_cinh;
 
/* Management commands */
diff --git a/drivers/staging/fsl-mc/include/dpaa2-io.h 
b/drivers/staging/fsl-mc/include/dpaa2-io.h
index f71227d..ab51e40 100644
--- a/drivers/staging/fsl-mc/include/dpaa2-io.h
+++ b/drivers/staging/fsl-mc/include/dpaa2-io.h
@@ -52,7 +52,7 @@ struct dpaa2_io_desc {
int has_8prio;
int cpu;
void *regs_cena;
-   void *regs_cinh;
+   void __iomem *regs_cinh;
int dpio_id;
u32 qman_version;
 };
-- 
2.7.4

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


[PATCH v4 0/4] drives/soc/fsl: Move DPIO driver out of staging

2018-03-27 Thread Roy Pledge
This patchset moves the NXP DPIO (Datapath I/O Driver) out of the
drivers/staging directory and into the drivers/soc/fsl directory.

The DPIO driver enables access to Queue and Buffer Manager (QBMAN)
hardware on NXP DPAA2 devices. This is a prerequisite to moving the
DPAA2 Ethernet driver out of staging.

Changes in v4:
- Remove unneeded dev_kfree() and dev_set_drvdata()
- Use devm_memremap() and devm_ioremap() for device mappings

Changes in v3:
- Update caam files that use dpaa2 frame header files
- Fix sparse errors and memory leak
- Remove empty staging/drivers/fsl-mc directory

Changes in v2:
- Fix minor conflict in latest linux-next branch
- Generate patch using -M


Roy Pledge (4):
  drivers/staging/fsl-mc: Use devm_memremap/devm_ioremap for DPIO
  drivers/staging/fsl-mc: Fix DPIO error path issue
  staging:fsl-mc: Move DPIO from staging to drivers/soc/fsl
  drivers/staging: Remove fsl-mc driver from staging

 MAINTAINERS|  2 +-
 drivers/crypto/caam/sg_sw_qm2.h|  2 +-
 drivers/crypto/caam/sg_sw_sec4.h   |  2 +-
 drivers/soc/fsl/Kconfig| 10 
 drivers/soc/fsl/Makefile   |  1 +
 .../{staging/fsl-mc/bus => soc/fsl}/dpio/Makefile  |  0
 .../fsl-mc/bus => soc/fsl}/dpio/dpio-cmd.h |  0
 .../fsl-mc/bus => soc/fsl}/dpio/dpio-driver.c  | 27 ++
 .../fsl-mc/bus => soc/fsl}/dpio/dpio-driver.txt|  0
 .../fsl-mc/bus => soc/fsl}/dpio/dpio-service.c |  2 +-
 .../{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.c|  0
 .../{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.h|  0
 .../fsl-mc/bus => soc/fsl}/dpio/qbman-portal.c |  2 +-
 .../fsl-mc/bus => soc/fsl}/dpio/qbman-portal.h |  6 ++---
 drivers/staging/Kconfig|  2 --
 drivers/staging/Makefile   |  1 -
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h |  4 ++--
 drivers/staging/fsl-mc/Kconfig |  2 --
 drivers/staging/fsl-mc/Makefile|  3 ---
 drivers/staging/fsl-mc/bus/Kconfig | 16 -
 drivers/staging/fsl-mc/bus/Makefile|  9 
 .../fsl-mc/include => include/soc/fsl}/dpaa2-fd.h  |  0
 .../include => include/soc/fsl}/dpaa2-global.h |  0
 .../fsl-mc/include => include/soc/fsl}/dpaa2-io.h  |  2 +-
 24 files changed, 39 insertions(+), 54 deletions(-)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/Makefile (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-cmd.h (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-driver.c (92%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-driver.txt (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-service.c (99%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.c (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.h (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/qbman-portal.c (99%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/qbman-portal.h (99%)
 delete mode 100644 drivers/staging/fsl-mc/Kconfig
 delete mode 100644 drivers/staging/fsl-mc/Makefile
 delete mode 100644 drivers/staging/fsl-mc/bus/Kconfig
 delete mode 100644 drivers/staging/fsl-mc/bus/Makefile
 rename {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-fd.h (100%)
 rename {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-global.h 
(100%)
 rename {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-io.h (99%)

--
2.7.4

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


Re: [PATCH v3 2/4] drivers/staging/fsl-mc: Fix DPIO error path issues

2018-03-27 Thread Roy Pledge
On 3/27/2018 7:05 AM, Robin Murphy wrote:
> Hi Roy,
>
> On 26/03/18 20:05, Roy Pledge wrote:
>> The error path in the dpaa2_dpio_probe() function was not properly
>> unmapping the QBMan device memory on the error path. This was also
>> missing from the dpaa2_dpio_release() function.
>>
>> Also addresses a memory leak of the device private data structure.
>>
>> Signed-off-by: Roy Pledge 
>> ---
>>drivers/staging/fsl-mc/bus/dpio/dpio-driver.c | 49 
>> +++
>>1 file changed, 34 insertions(+), 15 deletions(-)
>>
>> diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c 
>> b/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c
>> index e00f473..e7a0009 100644
>> --- a/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c
>> +++ b/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c
>> @@ -28,6 +28,7 @@ MODULE_DESCRIPTION("DPIO Driver");
>>
>>struct dpio_priv {
>>  struct dpaa2_io *io;
>> +struct dpaa2_io_desc desc;
>>};
>>
>>static irqreturn_t dpio_irq_handler(int irq_num, void *arg)
>> @@ -85,7 +86,6 @@ static int register_dpio_irq_handlers(struct fsl_mc_device 
>> *dpio_dev, int cpu)
>>static int dpaa2_dpio_probe(struct fsl_mc_device *dpio_dev)
>>{
>>  struct dpio_attr dpio_attrs;
>> -struct dpaa2_io_desc desc;
>>  struct dpio_priv *priv;
>>  int err = -ENOMEM;
>>  struct device *dev = &dpio_dev->dev;
>> @@ -117,7 +117,7 @@ static int dpaa2_dpio_probe(struct fsl_mc_device 
>> *dpio_dev)
>>  dev_err(dev, "dpio_get_attributes() failed %d\n", err);
>>  goto err_get_attr;
>>  }
>> -desc.qman_version = dpio_attrs.qbman_version;
>> +priv->desc.qman_version = dpio_attrs.qbman_version;
>>
>>  err = dpio_enable(dpio_dev->mc_io, 0, dpio_dev->mc_handle);
>>  if (err) {
>> @@ -126,9 +126,9 @@ static int dpaa2_dpio_probe(struct fsl_mc_device 
>> *dpio_dev)
>>  }
>>
>>  /* initialize DPIO descriptor */
>> -desc.receives_notifications = dpio_attrs.num_priorities ? 1 : 0;
>> -desc.has_8prio = dpio_attrs.num_priorities == 8 ? 1 : 0;
>> -desc.dpio_id = dpio_dev->obj_desc.id;
>> +priv->desc.receives_notifications = dpio_attrs.num_priorities ? 1 : 0;
>> +priv->desc.has_8prio = dpio_attrs.num_priorities == 8 ? 1 : 0;
>> +priv->desc.dpio_id = dpio_dev->obj_desc.id;
>>
>>  /* get the cpu to use for the affinity hint */
>>  if (next_cpu == -1)
>> @@ -139,19 +139,28 @@ static int dpaa2_dpio_probe(struct fsl_mc_device 
>> *dpio_dev)
>>  if (!cpu_possible(next_cpu)) {
>>  dev_err(dev, "probe failed. Number of DPIOs exceeds 
>> NR_CPUS.\n");
>>  err = -ERANGE;
>> -goto err_allocate_irqs;
>> +goto err_too_many_cpu;
>>  }
>> -desc.cpu = next_cpu;
>> +priv->desc.cpu = next_cpu;
>>
>>  /*
>>   * Set the CENA regs to be the cache inhibited area of the portal to
>>   * avoid coherency issues if a user migrates to another core.
>>   */
>> -desc.regs_cena = memremap(dpio_dev->regions[1].start,
>> -  resource_size(&dpio_dev->regions[1]),
>> -  MEMREMAP_WC);
>> -desc.regs_cinh = ioremap(dpio_dev->regions[1].start,
>> - resource_size(&dpio_dev->regions[1]));
>> +priv->desc.regs_cena = memremap(dpio_dev->regions[1].start,
>> +resource_size(&dpio_dev->regions[1]),
>> +MEMREMAP_WC);
> Since you already have some devres-managed resources in this driver,
> maybe use devm_memremap? (and perhaps convert the existing ioremap too)
That would make since - will do.
>
>> +if (!priv->desc.regs_cena) {
>> +dev_err(dev, "memremap failed\n");
>> +goto err_too_many_cpu;
>> +}
>> +
>> +priv->desc.regs_cinh = ioremap(dpio_dev->regions[1].start,
>> +   resource_size(&dpio_dev->regions[1]));
>> +if (!priv->desc.regs_cinh) {
>> +dev_err(dev, "ioremap failed\n");
>> +goto err_ioremap_failed;
>> +}
>>
>>  err = fsl_mc_allocate_irqs(dpio_dev);
>>  if (err) {
>> @@ -159,11 +168,11 @@ static int dpaa2_dpio_probe(s

[PATCH v3 2/4] drivers/staging/fsl-mc: Fix DPIO error path issues

2018-03-26 Thread Roy Pledge
The error path in the dpaa2_dpio_probe() function was not properly
unmapping the QBMan device memory on the error path. This was also
missing from the dpaa2_dpio_release() function.

Also addresses a memory leak of the device private data structure.

Signed-off-by: Roy Pledge 
---
 drivers/staging/fsl-mc/bus/dpio/dpio-driver.c | 49 +++
 1 file changed, 34 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c 
b/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c
index e00f473..e7a0009 100644
--- a/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c
+++ b/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c
@@ -28,6 +28,7 @@ MODULE_DESCRIPTION("DPIO Driver");
 
 struct dpio_priv {
struct dpaa2_io *io;
+   struct dpaa2_io_desc desc;
 };
 
 static irqreturn_t dpio_irq_handler(int irq_num, void *arg)
@@ -85,7 +86,6 @@ static int register_dpio_irq_handlers(struct fsl_mc_device 
*dpio_dev, int cpu)
 static int dpaa2_dpio_probe(struct fsl_mc_device *dpio_dev)
 {
struct dpio_attr dpio_attrs;
-   struct dpaa2_io_desc desc;
struct dpio_priv *priv;
int err = -ENOMEM;
struct device *dev = &dpio_dev->dev;
@@ -117,7 +117,7 @@ static int dpaa2_dpio_probe(struct fsl_mc_device *dpio_dev)
dev_err(dev, "dpio_get_attributes() failed %d\n", err);
goto err_get_attr;
}
-   desc.qman_version = dpio_attrs.qbman_version;
+   priv->desc.qman_version = dpio_attrs.qbman_version;
 
err = dpio_enable(dpio_dev->mc_io, 0, dpio_dev->mc_handle);
if (err) {
@@ -126,9 +126,9 @@ static int dpaa2_dpio_probe(struct fsl_mc_device *dpio_dev)
}
 
/* initialize DPIO descriptor */
-   desc.receives_notifications = dpio_attrs.num_priorities ? 1 : 0;
-   desc.has_8prio = dpio_attrs.num_priorities == 8 ? 1 : 0;
-   desc.dpio_id = dpio_dev->obj_desc.id;
+   priv->desc.receives_notifications = dpio_attrs.num_priorities ? 1 : 0;
+   priv->desc.has_8prio = dpio_attrs.num_priorities == 8 ? 1 : 0;
+   priv->desc.dpio_id = dpio_dev->obj_desc.id;
 
/* get the cpu to use for the affinity hint */
if (next_cpu == -1)
@@ -139,19 +139,28 @@ static int dpaa2_dpio_probe(struct fsl_mc_device 
*dpio_dev)
if (!cpu_possible(next_cpu)) {
dev_err(dev, "probe failed. Number of DPIOs exceeds 
NR_CPUS.\n");
err = -ERANGE;
-   goto err_allocate_irqs;
+   goto err_too_many_cpu;
}
-   desc.cpu = next_cpu;
+   priv->desc.cpu = next_cpu;
 
/*
 * Set the CENA regs to be the cache inhibited area of the portal to
 * avoid coherency issues if a user migrates to another core.
 */
-   desc.regs_cena = memremap(dpio_dev->regions[1].start,
- resource_size(&dpio_dev->regions[1]),
- MEMREMAP_WC);
-   desc.regs_cinh = ioremap(dpio_dev->regions[1].start,
-resource_size(&dpio_dev->regions[1]));
+   priv->desc.regs_cena = memremap(dpio_dev->regions[1].start,
+   resource_size(&dpio_dev->regions[1]),
+   MEMREMAP_WC);
+   if (!priv->desc.regs_cena) {
+   dev_err(dev, "memremap failed\n");
+   goto err_too_many_cpu;
+   }
+
+   priv->desc.regs_cinh = ioremap(dpio_dev->regions[1].start,
+  resource_size(&dpio_dev->regions[1]));
+   if (!priv->desc.regs_cinh) {
+   dev_err(dev, "ioremap failed\n");
+   goto err_ioremap_failed;
+   }
 
err = fsl_mc_allocate_irqs(dpio_dev);
if (err) {
@@ -159,11 +168,11 @@ static int dpaa2_dpio_probe(struct fsl_mc_device 
*dpio_dev)
goto err_allocate_irqs;
}
 
-   err = register_dpio_irq_handlers(dpio_dev, desc.cpu);
+   err = register_dpio_irq_handlers(dpio_dev, priv->desc.cpu);
if (err)
goto err_register_dpio_irq;
 
-   priv->io = dpaa2_io_create(&desc);
+   priv->io = dpaa2_io_create(&priv->desc);
if (!priv->io) {
dev_err(dev, "dpaa2_io_create failed\n");
goto err_dpaa2_io_create;
@@ -171,7 +180,7 @@ static int dpaa2_dpio_probe(struct fsl_mc_device *dpio_dev)
 
dev_info(dev, "probed\n");
dev_dbg(dev, "   receives_notifications = %d\n",
-   desc.receives_notifications);
+   priv->desc.receives_notifications);
dpio_close(dpio_dev->mc_io, 0, dpio_dev->mc_handle);
fsl_mc_portal_free(dpio_dev->mc_io);
 
@@ -182,6 +191,10 @@ static int dpaa2_dpio_probe(struct fsl_mc_device *dpio_dev)
 err_register_dpio

[PATCH v3 3/4] staging:fsl-mc: Move DPIO from staging to drivers/soc/fsl

2018-03-26 Thread Roy Pledge
Move the NXP DPIO (Datapath I/O Driver) out of the
drivers/staging directory and into the drivers/soc/fsl directory.

The DPIO driver enables access to Queue and Buffer Manager (QBMAN)
hardware on NXP DPAA2 devices. This is a prerequisite to moving the
DPAA2 Ethernet driver out of staging.

Signed-off-by: Roy Pledge 
---
 MAINTAINERS|  2 +-
 drivers/crypto/caam/sg_sw_qm2.h|  2 +-
 drivers/crypto/caam/sg_sw_sec4.h   |  2 +-
 drivers/soc/fsl/Kconfig| 10 ++
 drivers/soc/fsl/Makefile   |  1 +
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/Makefile  |  0
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-cmd.h|  0
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-driver.c |  2 +-
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-driver.txt   |  0
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-service.c|  2 +-
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.c|  0
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.h|  0
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/qbman-portal.c|  2 +-
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/qbman-portal.h|  2 +-
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h |  4 ++--
 drivers/staging/fsl-mc/bus/Kconfig |  9 -
 drivers/staging/fsl-mc/bus/Makefile|  2 --
 {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-fd.h |  0
 .../staging/fsl-mc/include => include/soc/fsl}/dpaa2-global.h  |  0
 {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-io.h |  0
 20 files changed, 20 insertions(+), 20 deletions(-)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/Makefile (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-cmd.h (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-driver.c (99%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-driver.txt (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-service.c (99%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.c (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.h (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/qbman-portal.c (99%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/qbman-portal.h (99%)
 rename {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-fd.h (100%)
 rename {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-global.h 
(100%)
 rename {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-io.h (100%)

diff --git a/MAINTAINERS b/MAINTAINERS
index dc74106..e2f234c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4375,7 +4375,7 @@ DPAA2 DATAPATH I/O (DPIO) DRIVER
 M: Roy Pledge 
 L: linux-ker...@vger.kernel.org
 S: Maintained
-F: drivers/staging/fsl-mc/bus/dpio
+F: drivers/soc/fsl/dpio
 
 DPAA2 ETHERNET DRIVER
 M: Ioana Radulescu 
diff --git a/drivers/crypto/caam/sg_sw_qm2.h b/drivers/crypto/caam/sg_sw_qm2.h
index 31b4407..b5b4c12 100644
--- a/drivers/crypto/caam/sg_sw_qm2.h
+++ b/drivers/crypto/caam/sg_sw_qm2.h
@@ -35,7 +35,7 @@
 #ifndef _SG_SW_QM2_H_
 #define _SG_SW_QM2_H_
 
-#include "../../../drivers/staging/fsl-mc/include/dpaa2-fd.h"
+#include 
 
 static inline void dma_to_qm_sg_one(struct dpaa2_sg_entry *qm_sg_ptr,
dma_addr_t dma, u32 len, u16 offset)
diff --git a/drivers/crypto/caam/sg_sw_sec4.h b/drivers/crypto/caam/sg_sw_sec4.h
index e586ffa..dbfa9fc 100644
--- a/drivers/crypto/caam/sg_sw_sec4.h
+++ b/drivers/crypto/caam/sg_sw_sec4.h
@@ -12,7 +12,7 @@
 #include "ctrl.h"
 #include "regs.h"
 #include "sg_sw_qm2.h"
-#include "../../../drivers/staging/fsl-mc/include/dpaa2-fd.h"
+#include 
 
 struct sec4_sg_entry {
u64 ptr;
diff --git a/drivers/soc/fsl/Kconfig b/drivers/soc/fsl/Kconfig
index 7a9fb9b..c17bf38 100644
--- a/drivers/soc/fsl/Kconfig
+++ b/drivers/soc/fsl/Kconfig
@@ -16,3 +16,13 @@ config FSL_GUTS
  Initially only reading SVR and registering soc device are supported.
  Other guts accesses, such as reading RCW, should eventually be moved
  into this driver as well.
+
+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/soc/fsl/Makefile b/drivers/soc/fsl/Makefile
index 44b3beb..803ef1b 100644
--- a/drivers/soc/fsl/Makefile
+++ b/drivers/soc/fsl/Makefi

[PATCH v3 0/4] drives/soc/fsl: Move DPIO driver out of staging

2018-03-26 Thread Roy Pledge
This patchset moves the NXP DPIO (Datapath I/O Driver) out of the
drivers/staging directory and into the drivers/soc/fsl directory.

The DPIO driver enables access to Queue and Buffer Manager (QBMAN)
hardware on NXP DPAA2 devices. This is a prerequiset to moving the
DPAA2 Etherney driver out of staging.

Changes in v3:
- Update caam files that use dpaa2 frame header files
- Fix spare errors and memory leak
- Remove empty staging/drivers/fsl-mc directory

Changes in v2:
- Fix minor conflict in latest linux-next branch
- Generate patch using -M


Roy Pledge (4):
  drivers/staging/fsl-mc: Use memremap for DPIO cache enabled area
  drivers/staging/fsl-mc: Fix DPIO error path issues
  staging:fsl-mc: Move DPIO from staging to drivers/soc/fsl
  drivers/staging: Remove fsl-mc driver from staging

 MAINTAINERS|  2 +-
 drivers/crypto/caam/sg_sw_qm2.h|  2 +-
 drivers/crypto/caam/sg_sw_sec4.h   |  2 +-
 drivers/soc/fsl/Kconfig| 10 +
 drivers/soc/fsl/Makefile   |  1 +
 .../{staging/fsl-mc/bus => soc/fsl}/dpio/Makefile  |  0
 .../fsl-mc/bus => soc/fsl}/dpio/dpio-cmd.h |  0
 .../fsl-mc/bus => soc/fsl}/dpio/dpio-driver.c  | 51 +++---
 .../fsl-mc/bus => soc/fsl}/dpio/dpio-driver.txt|  0
 .../fsl-mc/bus => soc/fsl}/dpio/dpio-service.c |  2 +-
 .../{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.c|  0
 .../{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.h|  0
 .../fsl-mc/bus => soc/fsl}/dpio/qbman-portal.c |  2 +-
 .../fsl-mc/bus => soc/fsl}/dpio/qbman-portal.h |  6 +--
 drivers/staging/Kconfig|  2 -
 drivers/staging/Makefile   |  1 -
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h |  4 +-
 drivers/staging/fsl-mc/Kconfig |  2 -
 drivers/staging/fsl-mc/Makefile|  3 --
 drivers/staging/fsl-mc/bus/Kconfig | 16 ---
 drivers/staging/fsl-mc/bus/Makefile|  9 
 .../fsl-mc/include => include/soc/fsl}/dpaa2-fd.h  |  0
 .../include => include/soc/fsl}/dpaa2-global.h |  0
 .../fsl-mc/include => include/soc/fsl}/dpaa2-io.h  |  2 +-
 24 files changed, 58 insertions(+), 59 deletions(-)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/Makefile (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-cmd.h (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-driver.c (83%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-driver.txt (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-service.c (99%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.c (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.h (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/qbman-portal.c (99%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/qbman-portal.h (99%)
 delete mode 100644 drivers/staging/fsl-mc/Kconfig
 delete mode 100644 drivers/staging/fsl-mc/Makefile
 delete mode 100644 drivers/staging/fsl-mc/bus/Kconfig
 delete mode 100644 drivers/staging/fsl-mc/bus/Makefile
 rename {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-fd.h (100%)
 rename {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-global.h 
(100%)
 rename {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-io.h (99%)

--
2.7.4

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


[PATCH v3 4/4] drivers/staging: Remove fsl-mc driver from staging

2018-03-26 Thread Roy Pledge
Remove the staging/drivers/fsl-mc directory from the staging
area now that all the components have been moved to the main
kernel areas.

Signed-off-by: Roy Pledge 
---
 drivers/staging/Kconfig | 2 --
 drivers/staging/Makefile| 1 -
 drivers/staging/fsl-mc/Kconfig  | 2 --
 drivers/staging/fsl-mc/Makefile | 3 ---
 drivers/staging/fsl-mc/bus/Kconfig  | 7 ---
 drivers/staging/fsl-mc/bus/Makefile | 7 ---
 6 files changed, 22 deletions(-)
 delete mode 100644 drivers/staging/fsl-mc/Kconfig
 delete mode 100644 drivers/staging/fsl-mc/Makefile
 delete mode 100644 drivers/staging/fsl-mc/bus/Kconfig
 delete mode 100644 drivers/staging/fsl-mc/bus/Makefile

diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
index d5926f0..a0f262a 100644
--- a/drivers/staging/Kconfig
+++ b/drivers/staging/Kconfig
@@ -98,8 +98,6 @@ source "drivers/staging/clocking-wizard/Kconfig"
 
 source "drivers/staging/fbtft/Kconfig"
 
-source "drivers/staging/fsl-mc/Kconfig"
-
 source "drivers/staging/fsl-dpaa2/Kconfig"
 
 source "drivers/staging/wilc1000/Kconfig"
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
index 919753c..326a1e8 100644
--- a/drivers/staging/Makefile
+++ b/drivers/staging/Makefile
@@ -40,7 +40,6 @@ obj-$(CONFIG_CRYPTO_SKEIN)+= skein/
 obj-$(CONFIG_UNISYSSPAR)   += unisys/
 obj-$(CONFIG_COMMON_CLK_XLNX_CLKWZRD)  += clocking-wizard/
 obj-$(CONFIG_FB_TFT)   += fbtft/
-obj-$(CONFIG_FSL_MC_BUS)   += fsl-mc/
 obj-$(CONFIG_FSL_DPAA2)+= fsl-dpaa2/
 obj-$(CONFIG_WILC1000) += wilc1000/
 obj-$(CONFIG_MOST) += most/
diff --git a/drivers/staging/fsl-mc/Kconfig b/drivers/staging/fsl-mc/Kconfig
deleted file mode 100644
index 3002229..000
--- a/drivers/staging/fsl-mc/Kconfig
+++ /dev/null
@@ -1,2 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-source "drivers/staging/fsl-mc/bus/Kconfig"
diff --git a/drivers/staging/fsl-mc/Makefile b/drivers/staging/fsl-mc/Makefile
deleted file mode 100644
index 1468388..000
--- a/drivers/staging/fsl-mc/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-# Freescale Management Complex (MC) bus drivers
-obj-$(CONFIG_FSL_MC_BUS)   += bus/
diff --git a/drivers/staging/fsl-mc/bus/Kconfig 
b/drivers/staging/fsl-mc/bus/Kconfig
deleted file mode 100644
index 90f234d..000
--- a/drivers/staging/fsl-mc/bus/Kconfig
+++ /dev/null
@@ -1,7 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-#
-# DPAA2 fsl-mc bus
-#
-# Copyright (C) 2014-2016 Freescale Semiconductor, Inc.
-#
-
diff --git a/drivers/staging/fsl-mc/bus/Makefile 
b/drivers/staging/fsl-mc/bus/Makefile
deleted file mode 100644
index 2141e4b..000
--- a/drivers/staging/fsl-mc/bus/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-#
-# Freescale Management Complex (MC) bus drivers
-#
-# Copyright (C) 2014 Freescale Semiconductor, Inc.
-#
-
-- 
2.7.4

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


[PATCH v3 1/4] drivers/staging/fsl-mc: Use memremap for DPIO cache enabled area

2018-03-26 Thread Roy Pledge
Change the mapping of the QBMan cache enabled area from using ioremap_wc()
to memremap(). This allows the __iomem attribute to be removed from the
pointer (which makes sense as accesses try this as cacheable memory not
IO memory).  These changes allow sparse checks to pass.

Signed-off-by: Roy Pledge 
---
 drivers/staging/fsl-mc/bus/dpio/dpio-driver.c  | 8 +---
 drivers/staging/fsl-mc/bus/dpio/qbman-portal.h | 4 ++--
 drivers/staging/fsl-mc/include/dpaa2-io.h  | 2 +-
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c 
b/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c
index 182b384..e00f473 100644
--- a/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c
+++ b/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include "../../include/dpaa2-io.h"
@@ -146,10 +147,11 @@ static int dpaa2_dpio_probe(struct fsl_mc_device 
*dpio_dev)
 * Set the CENA regs to be the cache inhibited area of the portal to
 * avoid coherency issues if a user migrates to another core.
 */
-   desc.regs_cena = ioremap_wc(dpio_dev->regions[1].start,
-   resource_size(&dpio_dev->regions[1]));
+   desc.regs_cena = memremap(dpio_dev->regions[1].start,
+ resource_size(&dpio_dev->regions[1]),
+ MEMREMAP_WC);
desc.regs_cinh = ioremap(dpio_dev->regions[1].start,
-   resource_size(&dpio_dev->regions[1]));
+resource_size(&dpio_dev->regions[1]));
 
err = fsl_mc_allocate_irqs(dpio_dev);
if (err) {
diff --git a/drivers/staging/fsl-mc/bus/dpio/qbman-portal.h 
b/drivers/staging/fsl-mc/bus/dpio/qbman-portal.h
index 4488a44..69db3c8 100644
--- a/drivers/staging/fsl-mc/bus/dpio/qbman-portal.h
+++ b/drivers/staging/fsl-mc/bus/dpio/qbman-portal.h
@@ -15,7 +15,7 @@ struct qbman_swp;
 /* qbman software portal descriptor structure */
 struct qbman_swp_desc {
void *cena_bar; /* Cache-enabled portal base address */
-   void *cinh_bar; /* Cache-inhibited portal base address */
+   void __iomem *cinh_bar; /* Cache-inhibited portal base address */
u32 qman_version;
 };
 
@@ -102,7 +102,7 @@ struct qbman_release_desc {
 /* portal data structure */
 struct qbman_swp {
const struct qbman_swp_desc *desc;
-   void __iomem *addr_cena;
+   void *addr_cena;
void __iomem *addr_cinh;
 
/* Management commands */
diff --git a/drivers/staging/fsl-mc/include/dpaa2-io.h 
b/drivers/staging/fsl-mc/include/dpaa2-io.h
index f71227d..ab51e40 100644
--- a/drivers/staging/fsl-mc/include/dpaa2-io.h
+++ b/drivers/staging/fsl-mc/include/dpaa2-io.h
@@ -52,7 +52,7 @@ struct dpaa2_io_desc {
int has_8prio;
int cpu;
void *regs_cena;
-   void *regs_cinh;
+   void __iomem *regs_cinh;
int dpio_id;
u32 qman_version;
 };
-- 
2.7.4

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


[v2] staging:fsl-mc: Move DPIO from staging to drivers/soc/fsl

2018-03-21 Thread Roy Pledge
Move the NXP DPIO (Datapath I/O Driver) out of the
drivers/staging directory and into the drivers/soc/fsl directory.

The DPIO driver enables access to Queue and Buffer Manager (QBMAN)
hardware on NXP DPAA2 devices. This is a prerequisite to moving the
DPAA2 Ethernet driver out of staging.

Signed-off-by: Roy Pledge 

---
Changes in v2:
- Fix minor conflict in latest linux-next branch
- Generate patch using -M so patch is smaller
---
 MAINTAINERS| 2 +-
 drivers/soc/fsl/Makefile   | 1 +
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/Makefile  | 0
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-cmd.h| 0
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-driver.c | 2 +-
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-driver.txt   | 0
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-service.c| 2 +-
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.c| 0
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.h| 0
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/qbman-portal.c| 2 +-
 drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/qbman-portal.h| 2 +-
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h | 4 ++--
 drivers/staging/fsl-mc/bus/Makefile| 2 --
 {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-fd.h | 0
 {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-global.h | 0
 {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-io.h | 0
 16 files changed, 8 insertions(+), 9 deletions(-)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/Makefile (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-cmd.h (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-driver.c (99%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-driver.txt (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio-service.c (99%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.c (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/dpio.h (100%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/qbman-portal.c (99%)
 rename drivers/{staging/fsl-mc/bus => soc/fsl}/dpio/qbman-portal.h (99%)
 rename {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-fd.h (100%)
 rename {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-global.h 
(100%)
 rename {drivers/staging/fsl-mc/include => include/soc/fsl}/dpaa2-io.h (100%)

diff --git a/MAINTAINERS b/MAINTAINERS
index dc74106..e2f234c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4375,7 +4375,7 @@ DPAA2 DATAPATH I/O (DPIO) DRIVER
 M: Roy Pledge 
 L: linux-ker...@vger.kernel.org
 S: Maintained
-F: drivers/staging/fsl-mc/bus/dpio
+F: drivers/soc/fsl/dpio
 
 DPAA2 ETHERNET DRIVER
 M: Ioana Radulescu 
diff --git a/drivers/soc/fsl/Makefile b/drivers/soc/fsl/Makefile
index 44b3beb..803ef1b 100644
--- a/drivers/soc/fsl/Makefile
+++ b/drivers/soc/fsl/Makefile
@@ -6,3 +6,4 @@ obj-$(CONFIG_FSL_DPAA) += qbman/
 obj-$(CONFIG_QUICC_ENGINE) += qe/
 obj-$(CONFIG_CPM)  += qe/
 obj-$(CONFIG_FSL_GUTS) += guts.o
+obj-$(CONFIG_FSL_MC_DPIO)  += dpio/
diff --git a/drivers/staging/fsl-mc/bus/dpio/Makefile 
b/drivers/soc/fsl/dpio/Makefile
similarity index 100%
rename from drivers/staging/fsl-mc/bus/dpio/Makefile
rename to drivers/soc/fsl/dpio/Makefile
diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio-cmd.h 
b/drivers/soc/fsl/dpio/dpio-cmd.h
similarity index 100%
rename from drivers/staging/fsl-mc/bus/dpio/dpio-cmd.h
rename to drivers/soc/fsl/dpio/dpio-cmd.h
diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c 
b/drivers/soc/fsl/dpio/dpio-driver.c
similarity index 99%
rename from drivers/staging/fsl-mc/bus/dpio/dpio-driver.c
rename to drivers/soc/fsl/dpio/dpio-driver.c
index 182b384..732f025 100644
--- a/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c
+++ b/drivers/soc/fsl/dpio/dpio-driver.c
@@ -15,7 +15,7 @@
 #include 
 
 #include 
-#include "../../include/dpaa2-io.h"
+#include 
 
 #include "qbman-portal.h"
 #include "dpio.h"
diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio-driver.txt 
b/drivers/soc/fsl/dpio/dpio-driver.txt
similarity index 100%
rename from drivers/staging/fsl-mc/bus/dpio/dpio-driver.txt
rename to drivers/soc/fsl/dpio/dpio-driver.txt
diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio-service.c 
b/drivers/soc/fsl/dpio/dpio-service.c
similarity index 99%
rename from drivers/staging/fsl-mc/bus/dpio/dpio-service.c
rename to drivers/soc/fsl/dpio/dpio-service.c
index 14ed2be..9b17f72 100644
--- a/drivers/staging/fsl-mc/bus/dpio/dpio-service.c
+++ b/drivers/soc/fsl/dpio/dpio-service.c
@@ -6,7 +6,7 @@
  */
 #include 
 #include 
-#include "../../include/dpaa2-io.h&

[PATCH] staging: fsl-mc/dpio: Add missing argument identifier

2018-03-07 Thread Roy Pledge
When running checkpatch over the DPIO code the following warning
is reported:

WARNING: function definition argument 'struct dpaa2_io_notification_ctx *' 
should also have an identifier name

Add the missing identifier.

Signed-off-by: Roy Pledge 
---
 drivers/staging/fsl-mc/include/dpaa2-io.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/fsl-mc/include/dpaa2-io.h 
b/drivers/staging/fsl-mc/include/dpaa2-io.h
index 9cb1eec..f71227d 100644
--- a/drivers/staging/fsl-mc/include/dpaa2-io.h
+++ b/drivers/staging/fsl-mc/include/dpaa2-io.h
@@ -80,7 +80,7 @@ struct dpaa2_io *dpaa2_io_service_select(int cpu);
  * Used when a FQDAN/CDAN registration is made by drivers.
  */
 struct dpaa2_io_notification_ctx {
-   void (*cb)(struct dpaa2_io_notification_ctx *);
+   void (*cb)(struct dpaa2_io_notification_ctx *ctx);
int is_cdan;
u32 id;
int desired_cpu;
-- 
2.7.4

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


Re: [PATCH 1/2] staging: fsl-mc/dpio: Add dpaa2_io_service_select() API

2018-01-05 Thread Roy Pledge
On 1/5/2018 6:04 AM, Ioana Radulescu wrote:
> All DPIO service API functions receive a dpaa2_io service pointer
> as parameter (NULL meaning any service will do) which indicates
> the hardware resource to be used to execute the specified command.
> 
> There isn't however any available API for obtaining such a service
> reference that could be used further, effectively forcing the users
> to always request a random service for DPIO operations.
> (The DPIO driver holds internally an array mapping services to cpus,
> and affine services can be indirectly requested by a couple of API
> functions: dpaa2_io_service_register and dpaa2_io_service_rearm
> use the cpu id provided by the user to select the corresponding
> service)
> 
> This patch adds a function for selecting a DPIO service based on
> the specified cpu id. If the user provides a "don't care" value
> for the cpu, we revert to the default behavior and return the next
> DPIO, taken in a round-robin fashion from a list of available
> services.
> 
> Signed-off-by: Ioana Radulescu 
> ---
>   drivers/staging/fsl-mc/bus/dpio/dpio-service.c | 17 +
>   drivers/staging/fsl-mc/include/dpaa2-io.h  |  2 ++
>   2 files changed, 19 insertions(+)
> 
> diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio-service.c 
> b/drivers/staging/fsl-mc/bus/dpio/dpio-service.c
> index a8a8e15..6e8994c 100644
> --- a/drivers/staging/fsl-mc/bus/dpio/dpio-service.c
> +++ b/drivers/staging/fsl-mc/bus/dpio/dpio-service.c
> @@ -104,6 +104,23 @@ static inline struct dpaa2_io *service_select(struct 
> dpaa2_io *d)
>   }
>   
>   /**
> + * dpaa2_io_service_select() - return a dpaa2_io service affined to this cpu
> + * @cpu: the cpu id
> + *
> + * Return the affine dpaa2_io service, or NULL if there is no service affined
> + * to the specified cpu. If DPAA2_IO_ANY_CPU is used, return the next 
> available
> + * service.
> + */
> +struct dpaa2_io *dpaa2_io_service_select(int cpu)
> +{
> + if (cpu == DPAA2_IO_ANY_CPU)
> + return service_select(NULL);
> +
> + return service_select_by_cpu(NULL, cpu);
> +}
> +EXPORT_SYMBOL_GPL(dpaa2_io_service_select);
> +
> +/**
>* dpaa2_io_create() - create a dpaa2_io object.
>* @desc: the dpaa2_io descriptor
>*
> diff --git a/drivers/staging/fsl-mc/include/dpaa2-io.h 
> b/drivers/staging/fsl-mc/include/dpaa2-io.h
> index 07ad15a..9d70251 100644
> --- a/drivers/staging/fsl-mc/include/dpaa2-io.h
> +++ b/drivers/staging/fsl-mc/include/dpaa2-io.h
> @@ -88,6 +88,8 @@ void dpaa2_io_down(struct dpaa2_io *d);
>   
>   irqreturn_t dpaa2_io_irq(struct dpaa2_io *obj);
>   
> +struct dpaa2_io *dpaa2_io_service_select(int cpu);
> +
>   /**
>* struct dpaa2_io_notification_ctx - The DPIO notification context 
> structure
>* @cb:   The callback to be invoked when the notification arrives
> 

Acked-by: Roy Pledge 

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


Re: [PATCH v2] staging: fsl-mc: move bus driver out of staging

2017-11-06 Thread Roy Pledge
>> struct dpaa2_io {
>>   atomic_t refs;
>>
>> That's a kref, please use it instead of trying to roll your own.
>>
>> And even for this, your locking is not correct (i.e. you do not have
>> any), that needs to be fixed so that teardown works correctly.
> 
> I think we can drop this refcount altogether as it's not used. Roy, any
> comment on this?
> 

Yes I think this refcount can be removed.  I'll make a note for when the 
DPIO is moving out of staging but that isn't part of this patchset. 
There are other cleanups needed in DPIO as well. I've been holding off 
on pushing patches for that until the bus driver gets moved to try to 
avoid complex patch dependencies and merge conflict confusion.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


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

2017-03-13 Thread Roy Pledge
From: Roy Pledge 

Add QBman APIs for frame queue and buffer pool operations.

Signed-off-by: Roy Pledge 
Signed-off-by: Haiying Wang 
Signed-off-by: Stuart Yoder 
---

Notes:
-v6
   -checkpatch: Add additional () in QBMAN_INDEX_FROM_DQRR
   -checkpatch: Replace check for NULL with ! operator
-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..c75f546
--- /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

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

2017-03-13 Thread Roy Pledge
From: Roy Pledge 

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 
Signed-off-by: Haiying Wang 
Signed-off-by: Stuart Yoder 
---

Notes:
-v6
   -checkpatch: Add comments for spinlock_t declarations
-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 | 618 +
 drivers/staging/fsl-mc/include/dpaa2-io.h  | 139 ++
 3 files changed, 758 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..e5d6674
--- /dev/null
+++ b/drivers/staging/fsl-mc/bus/dpio/dpio-service.c
@@ -0,0 +1,618 @@
+/*
+ * 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;
+   /* protect against multiple management commands */
+   spinlock_t lock_mgmt_cmd;
+   /* protect notifications list */
+   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_

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

2017-03-13 Thread Roy Pledge
The DPIO driver registers with the fsl-mc bus to handle bus-related
events for DPIO objects.  Key responsibility is mapping I/O
regions, setting up interrupt handlers, and calling the DPIO
service initialization during probe.

Signed-off-by: Roy Pledge 
Signed-off-by: Haiying Wang 
Signed-off-by: Stuart Yoder 
---

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(&dpio_dev->dev);
+
+   irq = dpio_dev->irqs[0];
+   error = devm_request_irq(&dpio_dev->dev,
+irq->msi_desc->irq,
+dpio_irq_handler,
+0,
+dev_name(&dpio_dev->dev),
+&dpio_dev->dev);
+   if (error < 0) 

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

2017-03-13 Thread Roy Pledge
From: Roy Pledge 

add Roy Pledge as maintainer of DPIO

Signed-off-by: Roy Pledge 
Signed-off-by: Stuart Yoder 
---

Notes:
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 6e06cf4..9c85028 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4040,6 +4040,12 @@ S:   Maintained
 F: drivers/char/dtlk.c
 F: include/linux/dtlk.h
 
+DPAA2 DATAPATH I/O (DPIO) DRIVER
+M: Roy Pledge 
+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 
 L: linux-s...@vger.kernel.org
-- 
2.9.3

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


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

2017-03-13 Thread Roy Pledge
From: Ioana Radulescu 

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

Signed-off-by: Ioana Radulescu 
Signed-off-by: Roy Pledge 
Signed-off-by: Stuart Yoder 
---

Notes:
-v6
  - checkpatch: add additional () in DPIO_CMD
-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 |  75 ++
 drivers/staging/fsl-mc/bus/dpio/dpio.c | 224 +
 drivers/staging/fsl-mc/bus/dpio/dpio.h | 109 ++
 6 files changed, 430 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..b2dc6e7
--- /dev/null
+++ b/drivers/staging/fsl-mc/bus/dpio/dpio-cmd.h
@@ -0,0 +1,75 @@
+/*
+ * 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 DPIO_VER_MAJOR

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

2017-03-13 Thread Roy Pledge
From: Roy Pledge 

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

Signed-off-by: Roy Pledge 
Signed-off-by: Stuart Yoder 
---

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 whether the pull command is completed.
+ * @dq: the 

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

2017-03-13 Thread Roy Pledge
From: Roy Pledge 

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

Signed-off-by: Roy Pledge 
Signed-off-by: Stuart Yoder 
---

Notes:
-v6
   -Fix incorrect size of FD_SHORT_LEN_MASK
-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..9500123
--- /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  0x3
+#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_M

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

2017-03-13 Thread Roy Pledge
From: Stuart Yoder 

add document describing the dpio driver and it's role, components
and major interfaces

Signed-off-by: Stuart Yoder 
Signed-off-by: Roy Pledge 
---

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 typical

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

2017-03-13 Thread Roy Pledge
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

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  |   75 ++
 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  |  618 ++
 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, 3776 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

--
2.9.3

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


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

2017-03-08 Thread Roy Pledge
From: Stuart Yoder 

add document describing the dpio driver and it's role, components
and major interfaces

Signed-off-by: Stuart Yoder 
---
 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 CPU to allow queuing operations
+   to happen simultaneously across all 

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

2017-03-08 Thread Roy Pledge
From: Roy Pledge 

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

Signed-off-by: Roy Pledge 
Signed-off-by: Stuart Yoder 
---
 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..9500123
--- /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  0x3
+#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_SHIFT15
+
+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
+ * @add

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

2017-03-08 Thread Roy Pledge
From: Roy Pledge 

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 
Signed-off-by: Haiying Wang 
Signed-off-by: Stuart Yoder 
---
 drivers/staging/fsl-mc/bus/dpio/Makefile   |2 +-
 drivers/staging/fsl-mc/bus/dpio/dpio-service.c |  618 
 drivers/staging/fsl-mc/include/dpaa2-io.h  |  139 ++
 3 files changed, 758 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..e5d6674
--- /dev/null
+++ b/drivers/staging/fsl-mc/bus/dpio/dpio-service.c
@@ -0,0 +1,618 @@
+/*
+ * 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;
+   /* protect against multiple management commands */
+   spinlock_t lock_mgmt_cmd;
+   /* protect notifications list */
+   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.
+*/
+   if (unlikely(cpu < 0))
+   cpu = smp_pro

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

2017-03-08 Thread Roy Pledge
From: Roy Pledge 

Add QBman APIs for frame queue and buffer pool operations.

Signed-off-by: Roy Pledge 
Signed-off-by: Haiying Wang 
Signed-off-by: Stuart Yoder 
---
 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..c75f546
--- /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_SWP_RCR(n)  (0x400 + ((u32)(n) << 6))
+#define QBMAN_CENA_SWP_CR  0x600
+#define QBMAN_CENA_SWP_RR(vb)  (0x700 + ((u32)(vb) >> 1))
+#define QBMAN_CENA_SWP_VDQCR   0x780
+
+/* Reverse mapping of QBMAN_CENA_SWP_DQRR() */
+#define QBMAN_IDX_FROM_DQRR(p) (((unsigned long)(p) & 0x1ff) >> 6)
+
+/* Define token used to determine if response written to memory is valid */
+#define QMAN_DQ_TOKEN_VALID 1
+
+/* SDQCR attribute codes */
+#define QB_SDQCR_FC_SHIFT   29
+#define QB_SDQCR_FC_MASK0x1
+#define QB_SDQCR_DCT_SHIFT  24
+#define QB_SDQCR_DCT_MASK   0x3
+#define QB_SDQCR_TOK_SHIFT  16
+#define QB_SDQCR_TOK_MASK   0xff
+#define QB_SDQCR_SRC_SHIFT  0
+#define QB_SDQCR_SRC_MASK   0x
+
+/* opaque token for static dequeues */
+#define QMAN_SDQCR_TOKEN0xbb
+
+enum qbman_sdqcr_dct {
+   qbman_sdqc

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

2017-03-08 Thread Roy Pledge
From: Roy Pledge 

add Roy Pledge as maintainer of DPIO

Signed-off-by: Roy Pledge 
Signed-off-by: Stuart Yoder 
---
 MAINTAINERS |6 ++
 1 file changed, 6 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 6e06cf4..9c85028 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4040,6 +4040,12 @@ S:   Maintained
 F: drivers/char/dtlk.c
 F: include/linux/dtlk.h
 
+DPAA2 DATAPATH I/O (DPIO) DRIVER
+M: Roy Pledge 
+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 
 L: linux-s...@vger.kernel.org
-- 
1.7.9.5

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


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

2017-03-08 Thread Roy Pledge
From: Ioana Radulescu 

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

Signed-off-by: Ioana Radulescu 
Signed-off-by: Roy Pledge 
Signed-off-by: Stuart Yoder 
---
 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 |   75 ++
 drivers/staging/fsl-mc/bus/dpio/dpio.c |  224 
 drivers/staging/fsl-mc/bus/dpio/dpio.h |  109 ++
 6 files changed, 430 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..b2dc6e7
--- /dev/null
+++ b/drivers/staging/fsl-mc/bus/dpio/dpio-cmd.h
@@ -0,0 +1,75 @@
+/*
+ * 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 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 

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

2017-03-08 Thread Roy Pledge
The DPIO driver registers with the fsl-mc bus to handle bus-related
events for DPIO objects.  Key responsibility is mapping I/O
regions, setting up interrupt handlers, and calling the DPIO
service initialization during probe.

Signed-off-by: Roy Pledge 
Signed-off-by: Haiying Wang 
Signed-off-by: Stuart Yoder 
---
 drivers/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(&dpio_dev->dev);
+
+   irq = dpio_dev->irqs[0];
+   error = devm_request_irq(&dpio_dev->dev,
+irq->msi_desc->irq,
+dpio_irq_handler,
+0,
+dev_name(&dpio_dev->dev),
+&dpio_dev->dev);
+   if (error < 0) {
+   dev_err(&dpio_dev->dev,
+   "devm_request_irq() failed: %d\n",
+   error);
+   return error;
+   }
+
+   /* set the affinity hint *

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

2017-03-08 Thread Roy Pledge
From: Roy Pledge 

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

Signed-off-by: Roy Pledge 
Signed-off-by: Stuart Yoder 
---
 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 whether the pull command is completed.
+ * @dq: the dequeue result
+ *
+ * Return boolean.
+ */
+static inline bool dpaa2_dq_is_pull_complete(const struct dpaa2_dq *dq)
+{
+   return !!(dpaa2_dq_flags(dq) & DPAA2_DQ_STAT_EXPIRED);
+}
+
+/**
+ * dpaa2_dq_seqnum() - Get the

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

2017-03-08 Thread Roy Pledge
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

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  |   75 ++
 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  |  618 ++
 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, 3776 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.7.9.5

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