[PATCH v2 1/2] staging: fsl-mc: Move DPBP out of staging

2018-03-02 Thread Bogdan Purcareata
Move the source files out of staging into their final locations:
- dpbp.c goes to drivers/bus/fsl-mc/, next to the core infrastructure
- dpbp-cmd.h gets merged into drivers/bus/fsl-mc/fsl-mc-private.h, next
  to the other internally used APIs
- dpbp.h gets merged into include/linux/fsl/mc.h, exposing the public
  API

Update references in the dpaa2-eth staging driver.

DPBP stands for Data Path Buffer Pool - you can read more about the
object in Documentation/networking/dpaa2/overview.rst

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
Reviewed-by: Laurentiu Tudor <laurentiu.tu...@nxp.com>
---
v1 -> v2:
- properly refactor #include line (Laurentiu)

 drivers/bus/fsl-mc/Makefile   |  1 +
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp.c |  4 +-
 drivers/bus/fsl-mc/fsl-mc-private.h   | 39 +
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h|  2 +-
 drivers/staging/fsl-mc/bus/Makefile   |  3 +-
 drivers/staging/fsl-mc/bus/dpbp-cmd.h | 44 ---
 drivers/staging/fsl-mc/include/dpbp.h | 53 ---
 include/linux/fsl/mc.h| 42 ++
 8 files changed, 86 insertions(+), 102 deletions(-)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp.c (98%)
 delete mode 100644 drivers/staging/fsl-mc/bus/dpbp-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/include/dpbp.h

diff --git a/drivers/bus/fsl-mc/Makefile b/drivers/bus/fsl-mc/Makefile
index 6a97f2c..da26e52 100644
--- a/drivers/bus/fsl-mc/Makefile
+++ b/drivers/bus/fsl-mc/Makefile
@@ -9,6 +9,7 @@ obj-$(CONFIG_FSL_MC_BUS) += mc-bus-driver.o
 mc-bus-driver-objs := fsl-mc-bus.o \
  mc-sys.o \
  mc-io.o \
+ dpbp.o \
  dprc.o \
  dprc-driver.o \
  fsl-mc-allocator.o \
diff --git a/drivers/staging/fsl-mc/bus/dpbp.c b/drivers/bus/fsl-mc/dpbp.c
similarity index 98%
rename from drivers/staging/fsl-mc/bus/dpbp.c
rename to drivers/bus/fsl-mc/dpbp.c
index 85735bb..0aeacc5 100644
--- a/drivers/staging/fsl-mc/bus/dpbp.c
+++ b/drivers/bus/fsl-mc/dpbp.c
@@ -5,9 +5,9 @@
  */
 #include 
 #include 
-#include "../include/dpbp.h"
+#include 
 
-#include "dpbp-cmd.h"
+#include "fsl-mc-private.h"
 
 /**
  * dpbp_open() - Open a control session for the specified object.
diff --git a/drivers/bus/fsl-mc/fsl-mc-private.h 
b/drivers/bus/fsl-mc/fsl-mc-private.h
index bed990c..4ef8d7e 100644
--- a/drivers/bus/fsl-mc/fsl-mc-private.h
+++ b/drivers/bus/fsl-mc/fsl-mc-private.h
@@ -379,6 +379,45 @@ int dprc_get_container_id(struct fsl_mc_io *mc_io,
  u32 cmd_flags,
  int *container_id);
 
+/*
+ * Data Path Buffer Pool (DPBP) API
+ */
+
+/* DPBP Version */
+#define DPBP_VER_MAJOR 3
+#define DPBP_VER_MINOR 2
+
+/* Command versioning */
+#define DPBP_CMD_BASE_VERSION  1
+#define DPBP_CMD_ID_OFFSET 4
+
+#define DPBP_CMD(id)   (((id) << DPBP_CMD_ID_OFFSET) | DPBP_CMD_BASE_VERSION)
+
+/* Command IDs */
+#define DPBP_CMDID_CLOSE   DPBP_CMD(0x800)
+#define DPBP_CMDID_OPENDPBP_CMD(0x804)
+
+#define DPBP_CMDID_ENABLE  DPBP_CMD(0x002)
+#define DPBP_CMDID_DISABLE DPBP_CMD(0x003)
+#define DPBP_CMDID_GET_ATTRDPBP_CMD(0x004)
+#define DPBP_CMDID_RESET   DPBP_CMD(0x005)
+
+struct dpbp_cmd_open {
+   __le32 dpbp_id;
+};
+
+#define DPBP_ENABLE0x1
+
+struct dpbp_rsp_get_attributes {
+   /* response word 0 */
+   __le16 pad;
+   __le16 bpid;
+   __le32 id;
+   /* response word 1 */
+   __le16 version_major;
+   __le16 version_minor;
+};
+
 /**
  * Maximum number of total IRQs that can be pre-allocated for an MC bus'
  * IRQ pool
diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
index e577410..ce864ee 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
@@ -35,10 +35,10 @@
 
 #include 
 #include 
+#include 
 
 #include "../../fsl-mc/include/dpaa2-io.h"
 #include "../../fsl-mc/include/dpaa2-fd.h"
-#include "../../fsl-mc/include/dpbp.h"
 #include "../../fsl-mc/include/dpcon.h"
 #include "dpni.h"
 #include "dpni-cmd.h"
diff --git a/drivers/staging/fsl-mc/bus/Makefile 
b/drivers/staging/fsl-mc/bus/Makefile
index b67889e..ea6479f 100644
--- a/drivers/staging/fsl-mc/bus/Makefile
+++ b/drivers/staging/fsl-mc/bus/Makefile
@@ -4,8 +4,7 @@
 #
 # Copyright (C) 2014 Freescale Semiconductor, Inc.
 #
-obj-$(CONFIG_FSL_MC_BUS) += dpbp.o \
-   dpcon.o
+obj-$(CONFIG_FSL_MC_BUS) += dpcon.o
 
 # MC DPIO driver
 obj-$(CONFIG_FSL_MC_DP

[PATCH v2 1/2] staging: fsl-mc: Move DPBP out of staging

2018-03-02 Thread Bogdan Purcareata
Move the source files out of staging into their final locations:
- dpbp.c goes to drivers/bus/fsl-mc/, next to the core infrastructure
- dpbp-cmd.h gets merged into drivers/bus/fsl-mc/fsl-mc-private.h, next
  to the other internally used APIs
- dpbp.h gets merged into include/linux/fsl/mc.h, exposing the public
  API

Update references in the dpaa2-eth staging driver.

DPBP stands for Data Path Buffer Pool - you can read more about the
object in Documentation/networking/dpaa2/overview.rst

Signed-off-by: Bogdan Purcareata 
Reviewed-by: Laurentiu Tudor 
---
v1 -> v2:
- properly refactor #include line (Laurentiu)

 drivers/bus/fsl-mc/Makefile   |  1 +
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp.c |  4 +-
 drivers/bus/fsl-mc/fsl-mc-private.h   | 39 +
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h|  2 +-
 drivers/staging/fsl-mc/bus/Makefile   |  3 +-
 drivers/staging/fsl-mc/bus/dpbp-cmd.h | 44 ---
 drivers/staging/fsl-mc/include/dpbp.h | 53 ---
 include/linux/fsl/mc.h| 42 ++
 8 files changed, 86 insertions(+), 102 deletions(-)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp.c (98%)
 delete mode 100644 drivers/staging/fsl-mc/bus/dpbp-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/include/dpbp.h

diff --git a/drivers/bus/fsl-mc/Makefile b/drivers/bus/fsl-mc/Makefile
index 6a97f2c..da26e52 100644
--- a/drivers/bus/fsl-mc/Makefile
+++ b/drivers/bus/fsl-mc/Makefile
@@ -9,6 +9,7 @@ obj-$(CONFIG_FSL_MC_BUS) += mc-bus-driver.o
 mc-bus-driver-objs := fsl-mc-bus.o \
  mc-sys.o \
  mc-io.o \
+ dpbp.o \
  dprc.o \
  dprc-driver.o \
  fsl-mc-allocator.o \
diff --git a/drivers/staging/fsl-mc/bus/dpbp.c b/drivers/bus/fsl-mc/dpbp.c
similarity index 98%
rename from drivers/staging/fsl-mc/bus/dpbp.c
rename to drivers/bus/fsl-mc/dpbp.c
index 85735bb..0aeacc5 100644
--- a/drivers/staging/fsl-mc/bus/dpbp.c
+++ b/drivers/bus/fsl-mc/dpbp.c
@@ -5,9 +5,9 @@
  */
 #include 
 #include 
-#include "../include/dpbp.h"
+#include 
 
-#include "dpbp-cmd.h"
+#include "fsl-mc-private.h"
 
 /**
  * dpbp_open() - Open a control session for the specified object.
diff --git a/drivers/bus/fsl-mc/fsl-mc-private.h 
b/drivers/bus/fsl-mc/fsl-mc-private.h
index bed990c..4ef8d7e 100644
--- a/drivers/bus/fsl-mc/fsl-mc-private.h
+++ b/drivers/bus/fsl-mc/fsl-mc-private.h
@@ -379,6 +379,45 @@ int dprc_get_container_id(struct fsl_mc_io *mc_io,
  u32 cmd_flags,
  int *container_id);
 
+/*
+ * Data Path Buffer Pool (DPBP) API
+ */
+
+/* DPBP Version */
+#define DPBP_VER_MAJOR 3
+#define DPBP_VER_MINOR 2
+
+/* Command versioning */
+#define DPBP_CMD_BASE_VERSION  1
+#define DPBP_CMD_ID_OFFSET 4
+
+#define DPBP_CMD(id)   (((id) << DPBP_CMD_ID_OFFSET) | DPBP_CMD_BASE_VERSION)
+
+/* Command IDs */
+#define DPBP_CMDID_CLOSE   DPBP_CMD(0x800)
+#define DPBP_CMDID_OPENDPBP_CMD(0x804)
+
+#define DPBP_CMDID_ENABLE  DPBP_CMD(0x002)
+#define DPBP_CMDID_DISABLE DPBP_CMD(0x003)
+#define DPBP_CMDID_GET_ATTRDPBP_CMD(0x004)
+#define DPBP_CMDID_RESET   DPBP_CMD(0x005)
+
+struct dpbp_cmd_open {
+   __le32 dpbp_id;
+};
+
+#define DPBP_ENABLE0x1
+
+struct dpbp_rsp_get_attributes {
+   /* response word 0 */
+   __le16 pad;
+   __le16 bpid;
+   __le32 id;
+   /* response word 1 */
+   __le16 version_major;
+   __le16 version_minor;
+};
+
 /**
  * Maximum number of total IRQs that can be pre-allocated for an MC bus'
  * IRQ pool
diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
index e577410..ce864ee 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
@@ -35,10 +35,10 @@
 
 #include 
 #include 
+#include 
 
 #include "../../fsl-mc/include/dpaa2-io.h"
 #include "../../fsl-mc/include/dpaa2-fd.h"
-#include "../../fsl-mc/include/dpbp.h"
 #include "../../fsl-mc/include/dpcon.h"
 #include "dpni.h"
 #include "dpni-cmd.h"
diff --git a/drivers/staging/fsl-mc/bus/Makefile 
b/drivers/staging/fsl-mc/bus/Makefile
index b67889e..ea6479f 100644
--- a/drivers/staging/fsl-mc/bus/Makefile
+++ b/drivers/staging/fsl-mc/bus/Makefile
@@ -4,8 +4,7 @@
 #
 # Copyright (C) 2014 Freescale Semiconductor, Inc.
 #
-obj-$(CONFIG_FSL_MC_BUS) += dpbp.o \
-   dpcon.o
+obj-$(CONFIG_FSL_MC_BUS) += dpcon.o
 
 # MC DPIO driver
 obj-$(CONFIG_FSL_MC_DPIO) += dpio/
diff --git a/drivers/staging/fsl-mc/bus/dpbp-cmd

[PATCH v2 2/2] staging: fsl-mc: Move DPCON out of staging

2018-03-02 Thread Bogdan Purcareata
Move the source files out of staging into their final locations:
- dpcon.c goes to drivers/bus/fsl-mc/, next to the core infrastructure
- dpcon-cmd.h gets merged into drivers/bus/fsl-mc/fsl-mc-private.h, next
  to the other internally used APIs
- dpcon.h gets merged into include/linux/fsl/mc.h, exposing the public
  API

Update references in the dpaa2-eth staging driver.

DPCON stands for Data Path Concentrator - an interface between DPIO
(Data Path IO) and its users (e.g. dpaa2-eth). You can read more about
DPIO in Documentation/networking/dpaa2/overview.rst

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
Reviewed-by: Laurentiu Tudor <laurentiu.tu...@nxp.com>
---
v1 -> v2:
- properly refactor #include line (Laurentiu)

 drivers/bus/fsl-mc/Makefile|  1 +
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpcon.c |  4 +-
 drivers/bus/fsl-mc/fsl-mc-private.h| 48 +
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h |  1 -
 drivers/staging/fsl-mc/bus/Makefile|  1 -
 drivers/staging/fsl-mc/bus/dpcon-cmd.h | 53 ---
 drivers/staging/fsl-mc/include/dpcon.h | 79 --
 include/linux/fsl/mc.h | 66 ++
 8 files changed, 117 insertions(+), 136 deletions(-)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpcon.c (99%)
 delete mode 100644 drivers/staging/fsl-mc/bus/dpcon-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/include/dpcon.h

diff --git a/drivers/bus/fsl-mc/Makefile b/drivers/bus/fsl-mc/Makefile
index da26e52..3c518c7 100644
--- a/drivers/bus/fsl-mc/Makefile
+++ b/drivers/bus/fsl-mc/Makefile
@@ -10,6 +10,7 @@ mc-bus-driver-objs := fsl-mc-bus.o \
  mc-sys.o \
  mc-io.o \
  dpbp.o \
+ dpcon.o \
  dprc.o \
  dprc-driver.o \
  fsl-mc-allocator.o \
diff --git a/drivers/staging/fsl-mc/bus/dpcon.c b/drivers/bus/fsl-mc/dpcon.c
similarity index 99%
rename from drivers/staging/fsl-mc/bus/dpcon.c
rename to drivers/bus/fsl-mc/dpcon.c
index 021b425..a1ba819 100644
--- a/drivers/staging/fsl-mc/bus/dpcon.c
+++ b/drivers/bus/fsl-mc/dpcon.c
@@ -5,9 +5,9 @@
  */
 #include 
 #include 
-#include "../include/dpcon.h"
+#include 
 
-#include "dpcon-cmd.h"
+#include "fsl-mc-private.h"
 
 /**
  * dpcon_open() - Open a control session for the specified object
diff --git a/drivers/bus/fsl-mc/fsl-mc-private.h 
b/drivers/bus/fsl-mc/fsl-mc-private.h
index 4ef8d7e..52c069d 100644
--- a/drivers/bus/fsl-mc/fsl-mc-private.h
+++ b/drivers/bus/fsl-mc/fsl-mc-private.h
@@ -418,6 +418,54 @@ struct dpbp_rsp_get_attributes {
__le16 version_minor;
 };
 
+/*
+ * Data Path Concentrator (DPCON) API
+ */
+
+/* DPCON Version */
+#define DPCON_VER_MAJOR3
+#define DPCON_VER_MINOR2
+
+/* Command versioning */
+#define DPCON_CMD_BASE_VERSION 1
+#define DPCON_CMD_ID_OFFSET4
+
+#define DPCON_CMD(id)  (((id) << DPCON_CMD_ID_OFFSET) | DPCON_CMD_BASE_VERSION)
+
+/* Command IDs */
+#define DPCON_CMDID_CLOSE  DPCON_CMD(0x800)
+#define DPCON_CMDID_OPEN   DPCON_CMD(0x808)
+
+#define DPCON_CMDID_ENABLE DPCON_CMD(0x002)
+#define DPCON_CMDID_DISABLEDPCON_CMD(0x003)
+#define DPCON_CMDID_GET_ATTR   DPCON_CMD(0x004)
+#define DPCON_CMDID_RESET  DPCON_CMD(0x005)
+
+#define DPCON_CMDID_SET_NOTIFICATION   DPCON_CMD(0x100)
+
+struct dpcon_cmd_open {
+   __le32 dpcon_id;
+};
+
+#define DPCON_ENABLE   1
+
+struct dpcon_rsp_get_attr {
+   /* response word 0 */
+   __le32 id;
+   __le16 qbman_ch_id;
+   u8 num_priorities;
+   u8 pad;
+};
+
+struct dpcon_cmd_set_notification {
+   /* cmd word 0 */
+   __le32 dpio_id;
+   u8 priority;
+   u8 pad[3];
+   /* cmd word 1 */
+   __le64 user_ctx;
+};
+
 /**
  * Maximum number of total IRQs that can be pre-allocated for an MC bus'
  * IRQ pool
diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
index ce864ee..b8990cf 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
@@ -39,7 +39,6 @@
 
 #include "../../fsl-mc/include/dpaa2-io.h"
 #include "../../fsl-mc/include/dpaa2-fd.h"
-#include "../../fsl-mc/include/dpcon.h"
 #include "dpni.h"
 #include "dpni-cmd.h"
 
diff --git a/drivers/staging/fsl-mc/bus/Makefile 
b/drivers/staging/fsl-mc/bus/Makefile
index ea6479f..21d8ebc 100644
--- a/drivers/staging/fsl-mc/bus/Makefile
+++ b/drivers/staging/fsl-mc/bus/Makefile
@@ -4,7 +4,6 @@
 #
 # Copyright (C) 2014 Freescale Semiconductor

[PATCH v2 2/2] staging: fsl-mc: Move DPCON out of staging

2018-03-02 Thread Bogdan Purcareata
Move the source files out of staging into their final locations:
- dpcon.c goes to drivers/bus/fsl-mc/, next to the core infrastructure
- dpcon-cmd.h gets merged into drivers/bus/fsl-mc/fsl-mc-private.h, next
  to the other internally used APIs
- dpcon.h gets merged into include/linux/fsl/mc.h, exposing the public
  API

Update references in the dpaa2-eth staging driver.

DPCON stands for Data Path Concentrator - an interface between DPIO
(Data Path IO) and its users (e.g. dpaa2-eth). You can read more about
DPIO in Documentation/networking/dpaa2/overview.rst

Signed-off-by: Bogdan Purcareata 
Reviewed-by: Laurentiu Tudor 
---
v1 -> v2:
- properly refactor #include line (Laurentiu)

 drivers/bus/fsl-mc/Makefile|  1 +
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpcon.c |  4 +-
 drivers/bus/fsl-mc/fsl-mc-private.h| 48 +
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h |  1 -
 drivers/staging/fsl-mc/bus/Makefile|  1 -
 drivers/staging/fsl-mc/bus/dpcon-cmd.h | 53 ---
 drivers/staging/fsl-mc/include/dpcon.h | 79 --
 include/linux/fsl/mc.h | 66 ++
 8 files changed, 117 insertions(+), 136 deletions(-)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpcon.c (99%)
 delete mode 100644 drivers/staging/fsl-mc/bus/dpcon-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/include/dpcon.h

diff --git a/drivers/bus/fsl-mc/Makefile b/drivers/bus/fsl-mc/Makefile
index da26e52..3c518c7 100644
--- a/drivers/bus/fsl-mc/Makefile
+++ b/drivers/bus/fsl-mc/Makefile
@@ -10,6 +10,7 @@ mc-bus-driver-objs := fsl-mc-bus.o \
  mc-sys.o \
  mc-io.o \
  dpbp.o \
+ dpcon.o \
  dprc.o \
  dprc-driver.o \
  fsl-mc-allocator.o \
diff --git a/drivers/staging/fsl-mc/bus/dpcon.c b/drivers/bus/fsl-mc/dpcon.c
similarity index 99%
rename from drivers/staging/fsl-mc/bus/dpcon.c
rename to drivers/bus/fsl-mc/dpcon.c
index 021b425..a1ba819 100644
--- a/drivers/staging/fsl-mc/bus/dpcon.c
+++ b/drivers/bus/fsl-mc/dpcon.c
@@ -5,9 +5,9 @@
  */
 #include 
 #include 
-#include "../include/dpcon.h"
+#include 
 
-#include "dpcon-cmd.h"
+#include "fsl-mc-private.h"
 
 /**
  * dpcon_open() - Open a control session for the specified object
diff --git a/drivers/bus/fsl-mc/fsl-mc-private.h 
b/drivers/bus/fsl-mc/fsl-mc-private.h
index 4ef8d7e..52c069d 100644
--- a/drivers/bus/fsl-mc/fsl-mc-private.h
+++ b/drivers/bus/fsl-mc/fsl-mc-private.h
@@ -418,6 +418,54 @@ struct dpbp_rsp_get_attributes {
__le16 version_minor;
 };
 
+/*
+ * Data Path Concentrator (DPCON) API
+ */
+
+/* DPCON Version */
+#define DPCON_VER_MAJOR3
+#define DPCON_VER_MINOR2
+
+/* Command versioning */
+#define DPCON_CMD_BASE_VERSION 1
+#define DPCON_CMD_ID_OFFSET4
+
+#define DPCON_CMD(id)  (((id) << DPCON_CMD_ID_OFFSET) | DPCON_CMD_BASE_VERSION)
+
+/* Command IDs */
+#define DPCON_CMDID_CLOSE  DPCON_CMD(0x800)
+#define DPCON_CMDID_OPEN   DPCON_CMD(0x808)
+
+#define DPCON_CMDID_ENABLE DPCON_CMD(0x002)
+#define DPCON_CMDID_DISABLEDPCON_CMD(0x003)
+#define DPCON_CMDID_GET_ATTR   DPCON_CMD(0x004)
+#define DPCON_CMDID_RESET  DPCON_CMD(0x005)
+
+#define DPCON_CMDID_SET_NOTIFICATION   DPCON_CMD(0x100)
+
+struct dpcon_cmd_open {
+   __le32 dpcon_id;
+};
+
+#define DPCON_ENABLE   1
+
+struct dpcon_rsp_get_attr {
+   /* response word 0 */
+   __le32 id;
+   __le16 qbman_ch_id;
+   u8 num_priorities;
+   u8 pad;
+};
+
+struct dpcon_cmd_set_notification {
+   /* cmd word 0 */
+   __le32 dpio_id;
+   u8 priority;
+   u8 pad[3];
+   /* cmd word 1 */
+   __le64 user_ctx;
+};
+
 /**
  * Maximum number of total IRQs that can be pre-allocated for an MC bus'
  * IRQ pool
diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
index ce864ee..b8990cf 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
@@ -39,7 +39,6 @@
 
 #include "../../fsl-mc/include/dpaa2-io.h"
 #include "../../fsl-mc/include/dpaa2-fd.h"
-#include "../../fsl-mc/include/dpcon.h"
 #include "dpni.h"
 #include "dpni-cmd.h"
 
diff --git a/drivers/staging/fsl-mc/bus/Makefile 
b/drivers/staging/fsl-mc/bus/Makefile
index ea6479f..21d8ebc 100644
--- a/drivers/staging/fsl-mc/bus/Makefile
+++ b/drivers/staging/fsl-mc/bus/Makefile
@@ -4,7 +4,6 @@
 #
 # Copyright (C) 2014 Freescale Semiconductor, Inc.
 #
-obj-$(CONFIG_FSL_MC_BUS) += dpcon.o
 
 # MC DPIO dr

[PATCH v2 0/2] staging: fsl-mc: Move DPBP and DPCON out of staging

2018-03-02 Thread Bogdan Purcareata
Previous submission: https://lkml.org/lkml/2018/3/1/733

Commit 6bd067c48ef ("staging: fsl-mc: Move core bus out of staging")
moves the fsl-mc bus driver infrastructure out of staging to
drivers/bus/fsl-mc. The next step is moving a couple of tightly
connected DPAA2 objects - DPBP (Data Path Buffer Pool) and DPCON
(Data Path Concentrator).

The patches handle moving out the mentioned objects, one at a time.

v1 -> v2:
- previous cleanup patch already applied, so removed from patchset
- properly refactor #include line (Laurentiu)

Bogdan Purcareata (2):
  staging: fsl-mc: Move DPBP out of staging
  staging: fsl-mc: Move DPCON out of staging

 drivers/bus/fsl-mc/Makefile|   2 +
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp.c  |   4 +-
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpcon.c |   4 +-
 drivers/bus/fsl-mc/fsl-mc-private.h|  87 +
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h |   3 +-
 drivers/staging/fsl-mc/bus/Makefile|   2 -
 drivers/staging/fsl-mc/bus/dpbp-cmd.h  |  44 -
 drivers/staging/fsl-mc/bus/dpcon-cmd.h |  53 --
 drivers/staging/fsl-mc/include/dpbp.h  |  53 --
 drivers/staging/fsl-mc/include/dpcon.h |  79 ---
 include/linux/fsl/mc.h | 108 +
 11 files changed, 202 insertions(+), 237 deletions(-)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp.c (98%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpcon.c (99%)
 delete mode 100644 drivers/staging/fsl-mc/bus/dpbp-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/bus/dpcon-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/include/dpbp.h
 delete mode 100644 drivers/staging/fsl-mc/include/dpcon.h

-- 
2.7.4



[PATCH v2 0/2] staging: fsl-mc: Move DPBP and DPCON out of staging

2018-03-02 Thread Bogdan Purcareata
Previous submission: https://lkml.org/lkml/2018/3/1/733

Commit 6bd067c48ef ("staging: fsl-mc: Move core bus out of staging")
moves the fsl-mc bus driver infrastructure out of staging to
drivers/bus/fsl-mc. The next step is moving a couple of tightly
connected DPAA2 objects - DPBP (Data Path Buffer Pool) and DPCON
(Data Path Concentrator).

The patches handle moving out the mentioned objects, one at a time.

v1 -> v2:
- previous cleanup patch already applied, so removed from patchset
- properly refactor #include line (Laurentiu)

Bogdan Purcareata (2):
  staging: fsl-mc: Move DPBP out of staging
  staging: fsl-mc: Move DPCON out of staging

 drivers/bus/fsl-mc/Makefile|   2 +
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp.c  |   4 +-
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpcon.c |   4 +-
 drivers/bus/fsl-mc/fsl-mc-private.h|  87 +
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h |   3 +-
 drivers/staging/fsl-mc/bus/Makefile|   2 -
 drivers/staging/fsl-mc/bus/dpbp-cmd.h  |  44 -
 drivers/staging/fsl-mc/bus/dpcon-cmd.h |  53 --
 drivers/staging/fsl-mc/include/dpbp.h  |  53 --
 drivers/staging/fsl-mc/include/dpcon.h |  79 ---
 include/linux/fsl/mc.h | 108 +
 11 files changed, 202 insertions(+), 237 deletions(-)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp.c (98%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpcon.c (99%)
 delete mode 100644 drivers/staging/fsl-mc/bus/dpbp-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/bus/dpcon-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/include/dpbp.h
 delete mode 100644 drivers/staging/fsl-mc/include/dpcon.h

-- 
2.7.4



RE: [PATCH 2/3] staging: fsl-mc: Move DPBP out of staging

2018-03-02 Thread Bogdan Purcareata
> -Original Message-
> From: Laurentiu Tudor
> Sent: Friday, March 02, 2018 11:18 AM
> To: Bogdan Purcareata <bogdan.purcare...@nxp.com>; gre...@linuxfoundation.org;
> Ruxandra Ioana Ciocoi Radulescu <ruxandra.radule...@nxp.com>
> Cc: stuyo...@gmail.com; Ioana Ciornei <ioana.cior...@nxp.com>; Nipun Gupta
> <nipun.gu...@nxp.com>; Roy Pledge <roy.ple...@nxp.com>; Horia Geantă
> <horia.gea...@nxp.com>; de...@driverdev.osuosl.org; linux-
> ker...@vger.kernel.org; linux-arm-ker...@lists.infradead.org
> Subject: Re: [PATCH 2/3] staging: fsl-mc: Move DPBP out of staging
> 
> Hi Bogdan,
> 
> On 03/01/2018 07:47 PM, Bogdan Purcareata wrote:
> > Move the source files out of staging into their final locations:
> > - dpbp.c goes to drivers/bus/fsl-mc/, next to the core infrastructure
> > - dpbp-cmd.h gets merged into drivers/bus/fsl-mc/fsl-mc-private.h, next
> >to the other internally used APIs
> > - dpbp.h gets merged into include/linux/fsl/mc.h, exposing the public
> >API
> >
> > Update references in the dpaa2-eth staging driver.
> >
> > DPBP stands for Data Path Buffer Pool - you can read more about the
> > object in Documentation/networking/dpaa2/overview.rst
> >
> > Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
> > ---
> >   drivers/bus/fsl-mc/Makefile   |  1 +
> >   drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp.c |  4 +-
> >   drivers/bus/fsl-mc/fsl-mc-private.h   | 39 +
> >   drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h|  2 +-
> >   drivers/staging/fsl-mc/bus/Makefile   |  3 +-
> >   drivers/staging/fsl-mc/bus/dpbp-cmd.h | 44 ---
> >   drivers/staging/fsl-mc/include/dpbp.h | 53 
> > 
> ---
> >   include/linux/fsl/mc.h| 42 ++
> >   8 files changed, 86 insertions(+), 102 deletions(-)
> >   rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp.c (98%)
> >   delete mode 100644 drivers/staging/fsl-mc/bus/dpbp-cmd.h
> >   delete mode 100644 drivers/staging/fsl-mc/include/dpbp.h
> >
> > diff --git a/drivers/bus/fsl-mc/Makefile b/drivers/bus/fsl-mc/Makefile
> > index 6a97f2c..da26e52 100644
> > --- a/drivers/bus/fsl-mc/Makefile
> > +++ b/drivers/bus/fsl-mc/Makefile
> > @@ -9,6 +9,7 @@ obj-$(CONFIG_FSL_MC_BUS) += mc-bus-driver.o
> >   mc-bus-driver-objs := fsl-mc-bus.o \
> >   mc-sys.o \
> >   mc-io.o \
> > + dpbp.o \
> >   dprc.o \
> >   dprc-driver.o \
> >   fsl-mc-allocator.o \
> > diff --git a/drivers/staging/fsl-mc/bus/dpbp.c b/drivers/bus/fsl-mc/dpbp.c
> > similarity index 98%
> > rename from drivers/staging/fsl-mc/bus/dpbp.c
> > rename to drivers/bus/fsl-mc/dpbp.c
> > index 85735bb..31a360b 100644
> > --- a/drivers/staging/fsl-mc/bus/dpbp.c
> > +++ b/drivers/bus/fsl-mc/dpbp.c
> > @@ -5,9 +5,9 @@
> >*/
> >   #include 
> >   #include 
> > -#include "../include/dpbp.h"
> > +#include "linux/fsl/mc.h"
> 
> I think we can use <> here, same comment for patch 3/3.
> 
> Other than that, the series looks ok to me so for all the patches:
> 
> Reviewed-by: Laurentiu Tudor <laurentiu.tu...@nxp.com>

Thank you!
I will update the patchset - seeing that the cleanup one has already been 
applied - and will send a v2 shortly.

Best regards,
Bogdan


RE: [PATCH 2/3] staging: fsl-mc: Move DPBP out of staging

2018-03-02 Thread Bogdan Purcareata
> -Original Message-
> From: Laurentiu Tudor
> Sent: Friday, March 02, 2018 11:18 AM
> To: Bogdan Purcareata ; gre...@linuxfoundation.org;
> Ruxandra Ioana Ciocoi Radulescu 
> Cc: stuyo...@gmail.com; Ioana Ciornei ; Nipun Gupta
> ; Roy Pledge ; Horia Geantă
> ; de...@driverdev.osuosl.org; linux-
> ker...@vger.kernel.org; linux-arm-ker...@lists.infradead.org
> Subject: Re: [PATCH 2/3] staging: fsl-mc: Move DPBP out of staging
> 
> Hi Bogdan,
> 
> On 03/01/2018 07:47 PM, Bogdan Purcareata wrote:
> > Move the source files out of staging into their final locations:
> > - dpbp.c goes to drivers/bus/fsl-mc/, next to the core infrastructure
> > - dpbp-cmd.h gets merged into drivers/bus/fsl-mc/fsl-mc-private.h, next
> >to the other internally used APIs
> > - dpbp.h gets merged into include/linux/fsl/mc.h, exposing the public
> >API
> >
> > Update references in the dpaa2-eth staging driver.
> >
> > DPBP stands for Data Path Buffer Pool - you can read more about the
> > object in Documentation/networking/dpaa2/overview.rst
> >
> > Signed-off-by: Bogdan Purcareata 
> > ---
> >   drivers/bus/fsl-mc/Makefile   |  1 +
> >   drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp.c |  4 +-
> >   drivers/bus/fsl-mc/fsl-mc-private.h   | 39 +
> >   drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h|  2 +-
> >   drivers/staging/fsl-mc/bus/Makefile   |  3 +-
> >   drivers/staging/fsl-mc/bus/dpbp-cmd.h | 44 ---
> >   drivers/staging/fsl-mc/include/dpbp.h | 53 
> > 
> ---
> >   include/linux/fsl/mc.h| 42 ++
> >   8 files changed, 86 insertions(+), 102 deletions(-)
> >   rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp.c (98%)
> >   delete mode 100644 drivers/staging/fsl-mc/bus/dpbp-cmd.h
> >   delete mode 100644 drivers/staging/fsl-mc/include/dpbp.h
> >
> > diff --git a/drivers/bus/fsl-mc/Makefile b/drivers/bus/fsl-mc/Makefile
> > index 6a97f2c..da26e52 100644
> > --- a/drivers/bus/fsl-mc/Makefile
> > +++ b/drivers/bus/fsl-mc/Makefile
> > @@ -9,6 +9,7 @@ obj-$(CONFIG_FSL_MC_BUS) += mc-bus-driver.o
> >   mc-bus-driver-objs := fsl-mc-bus.o \
> >   mc-sys.o \
> >   mc-io.o \
> > + dpbp.o \
> >   dprc.o \
> >   dprc-driver.o \
> >   fsl-mc-allocator.o \
> > diff --git a/drivers/staging/fsl-mc/bus/dpbp.c b/drivers/bus/fsl-mc/dpbp.c
> > similarity index 98%
> > rename from drivers/staging/fsl-mc/bus/dpbp.c
> > rename to drivers/bus/fsl-mc/dpbp.c
> > index 85735bb..31a360b 100644
> > --- a/drivers/staging/fsl-mc/bus/dpbp.c
> > +++ b/drivers/bus/fsl-mc/dpbp.c
> > @@ -5,9 +5,9 @@
> >*/
> >   #include 
> >   #include 
> > -#include "../include/dpbp.h"
> > +#include "linux/fsl/mc.h"
> 
> I think we can use <> here, same comment for patch 3/3.
> 
> Other than that, the series looks ok to me so for all the patches:
> 
> Reviewed-by: Laurentiu Tudor 

Thank you!
I will update the patchset - seeing that the cleanup one has already been 
applied - and will send a v2 shortly.

Best regards,
Bogdan


[PATCH 0/3] staging: fsl-mc: Move DPBP and DPCON out of staging

2018-03-01 Thread Bogdan Purcareata
Commit 6bd067c48ef ("staging: fsl-mc: Move core bus out of staging")
moves the fsl-mc bus driver infrastructure out of staging to
drivers/bus/fsl-mc. The next step is moving a couple of tightly
connected DPAA2 objects - DPBP (Data Path Buffer Pool) and DPCON
(Data Path Concentrator).

Patch 1 removes dead code from the involved source files.

Patches 2-3 handle moving out the mentioned objects, one at a time.

Bogdan Purcareata (3):
  staging: fsl-mc: Cleanup dpbp and dpcon API
  staging: fsl-mc: Move DPBP out of staging
  staging: fsl-mc: Move DPCON out of staging

 drivers/bus/fsl-mc/Makefile|   2 +
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp.c  |  71 +-
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpcon.c |   4 +-
 drivers/bus/fsl-mc/fsl-mc-private.h|  87 +
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h |   3 +-
 drivers/staging/fsl-mc/bus/Makefile|   2 -
 drivers/staging/fsl-mc/bus/dpbp-cmd.h  |  54 ---
 drivers/staging/fsl-mc/bus/dpcon-cmd.h |  53 --
 drivers/staging/fsl-mc/include/dpbp.h  |  63 
 drivers/staging/fsl-mc/include/dpcon.h |  79 ---
 include/linux/fsl/mc.h | 108 +
 11 files changed, 202 insertions(+), 324 deletions(-)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp.c (73%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpcon.c (99%)
 delete mode 100644 drivers/staging/fsl-mc/bus/dpbp-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/bus/dpcon-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/include/dpbp.h
 delete mode 100644 drivers/staging/fsl-mc/include/dpcon.h

-- 
2.7.4



[PATCH 0/3] staging: fsl-mc: Move DPBP and DPCON out of staging

2018-03-01 Thread Bogdan Purcareata
Commit 6bd067c48ef ("staging: fsl-mc: Move core bus out of staging")
moves the fsl-mc bus driver infrastructure out of staging to
drivers/bus/fsl-mc. The next step is moving a couple of tightly
connected DPAA2 objects - DPBP (Data Path Buffer Pool) and DPCON
(Data Path Concentrator).

Patch 1 removes dead code from the involved source files.

Patches 2-3 handle moving out the mentioned objects, one at a time.

Bogdan Purcareata (3):
  staging: fsl-mc: Cleanup dpbp and dpcon API
  staging: fsl-mc: Move DPBP out of staging
  staging: fsl-mc: Move DPCON out of staging

 drivers/bus/fsl-mc/Makefile|   2 +
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp.c  |  71 +-
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpcon.c |   4 +-
 drivers/bus/fsl-mc/fsl-mc-private.h|  87 +
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h |   3 +-
 drivers/staging/fsl-mc/bus/Makefile|   2 -
 drivers/staging/fsl-mc/bus/dpbp-cmd.h  |  54 ---
 drivers/staging/fsl-mc/bus/dpcon-cmd.h |  53 --
 drivers/staging/fsl-mc/include/dpbp.h  |  63 
 drivers/staging/fsl-mc/include/dpcon.h |  79 ---
 include/linux/fsl/mc.h | 108 +
 11 files changed, 202 insertions(+), 324 deletions(-)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp.c (73%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpcon.c (99%)
 delete mode 100644 drivers/staging/fsl-mc/bus/dpbp-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/bus/dpcon-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/include/dpbp.h
 delete mode 100644 drivers/staging/fsl-mc/include/dpcon.h

-- 
2.7.4



[PATCH 3/3] staging: fsl-mc: Move DPCON out of staging

2018-03-01 Thread Bogdan Purcareata
Move the source files out of staging into their final locations:
- dpcon.c goes to drivers/bus/fsl-mc/, next to the core infrastructure
- dpcon-cmd.h gets merged into drivers/bus/fsl-mc/fsl-mc-private.h, next
  to the other internally used APIs
- dpcon.h gets merged into include/linux/fsl/mc.h, exposing the public
  API

Update references in the dpaa2-eth staging driver.

DPCON stands for Data Path Concentrator - an interface between DPIO
(Data Path IO) and its users (e.g. dpaa2-eth). You can read more about
DPIO in Documentation/networking/dpaa2/overview.rst

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
---
 drivers/bus/fsl-mc/Makefile|  1 +
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpcon.c |  4 +-
 drivers/bus/fsl-mc/fsl-mc-private.h| 48 +
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h |  1 -
 drivers/staging/fsl-mc/bus/Makefile|  1 -
 drivers/staging/fsl-mc/bus/dpcon-cmd.h | 53 ---
 drivers/staging/fsl-mc/include/dpcon.h | 79 --
 include/linux/fsl/mc.h | 66 ++
 8 files changed, 117 insertions(+), 136 deletions(-)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpcon.c (99%)
 delete mode 100644 drivers/staging/fsl-mc/bus/dpcon-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/include/dpcon.h

diff --git a/drivers/bus/fsl-mc/Makefile b/drivers/bus/fsl-mc/Makefile
index da26e52..3c518c7 100644
--- a/drivers/bus/fsl-mc/Makefile
+++ b/drivers/bus/fsl-mc/Makefile
@@ -10,6 +10,7 @@ mc-bus-driver-objs := fsl-mc-bus.o \
  mc-sys.o \
  mc-io.o \
  dpbp.o \
+ dpcon.o \
  dprc.o \
  dprc-driver.o \
  fsl-mc-allocator.o \
diff --git a/drivers/staging/fsl-mc/bus/dpcon.c b/drivers/bus/fsl-mc/dpcon.c
similarity index 99%
rename from drivers/staging/fsl-mc/bus/dpcon.c
rename to drivers/bus/fsl-mc/dpcon.c
index 021b425..5d220c9 100644
--- a/drivers/staging/fsl-mc/bus/dpcon.c
+++ b/drivers/bus/fsl-mc/dpcon.c
@@ -5,9 +5,9 @@
  */
 #include 
 #include 
-#include "../include/dpcon.h"
+#include "linux/fsl/mc.h"
 
-#include "dpcon-cmd.h"
+#include "fsl-mc-private.h"
 
 /**
  * dpcon_open() - Open a control session for the specified object
diff --git a/drivers/bus/fsl-mc/fsl-mc-private.h 
b/drivers/bus/fsl-mc/fsl-mc-private.h
index 4ef8d7e..52c069d 100644
--- a/drivers/bus/fsl-mc/fsl-mc-private.h
+++ b/drivers/bus/fsl-mc/fsl-mc-private.h
@@ -418,6 +418,54 @@ struct dpbp_rsp_get_attributes {
__le16 version_minor;
 };
 
+/*
+ * Data Path Concentrator (DPCON) API
+ */
+
+/* DPCON Version */
+#define DPCON_VER_MAJOR3
+#define DPCON_VER_MINOR2
+
+/* Command versioning */
+#define DPCON_CMD_BASE_VERSION 1
+#define DPCON_CMD_ID_OFFSET4
+
+#define DPCON_CMD(id)  (((id) << DPCON_CMD_ID_OFFSET) | DPCON_CMD_BASE_VERSION)
+
+/* Command IDs */
+#define DPCON_CMDID_CLOSE  DPCON_CMD(0x800)
+#define DPCON_CMDID_OPEN   DPCON_CMD(0x808)
+
+#define DPCON_CMDID_ENABLE DPCON_CMD(0x002)
+#define DPCON_CMDID_DISABLEDPCON_CMD(0x003)
+#define DPCON_CMDID_GET_ATTR   DPCON_CMD(0x004)
+#define DPCON_CMDID_RESET  DPCON_CMD(0x005)
+
+#define DPCON_CMDID_SET_NOTIFICATION   DPCON_CMD(0x100)
+
+struct dpcon_cmd_open {
+   __le32 dpcon_id;
+};
+
+#define DPCON_ENABLE   1
+
+struct dpcon_rsp_get_attr {
+   /* response word 0 */
+   __le32 id;
+   __le16 qbman_ch_id;
+   u8 num_priorities;
+   u8 pad;
+};
+
+struct dpcon_cmd_set_notification {
+   /* cmd word 0 */
+   __le32 dpio_id;
+   u8 priority;
+   u8 pad[3];
+   /* cmd word 1 */
+   __le64 user_ctx;
+};
+
 /**
  * Maximum number of total IRQs that can be pre-allocated for an MC bus'
  * IRQ pool
diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
index ce864ee..b8990cf 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
@@ -39,7 +39,6 @@
 
 #include "../../fsl-mc/include/dpaa2-io.h"
 #include "../../fsl-mc/include/dpaa2-fd.h"
-#include "../../fsl-mc/include/dpcon.h"
 #include "dpni.h"
 #include "dpni-cmd.h"
 
diff --git a/drivers/staging/fsl-mc/bus/Makefile 
b/drivers/staging/fsl-mc/bus/Makefile
index ea6479f..21d8ebc 100644
--- a/drivers/staging/fsl-mc/bus/Makefile
+++ b/drivers/staging/fsl-mc/bus/Makefile
@@ -4,7 +4,6 @@
 #
 # Copyright (C) 2014 Freescale Semiconductor, Inc.
 #
-obj-$(CONFIG_FSL_MC_BUS) += dpcon.o
 
 # MC DPIO driver
 obj-$(CONFIG_FSL_MC_DPIO) +=

[PATCH 3/3] staging: fsl-mc: Move DPCON out of staging

2018-03-01 Thread Bogdan Purcareata
Move the source files out of staging into their final locations:
- dpcon.c goes to drivers/bus/fsl-mc/, next to the core infrastructure
- dpcon-cmd.h gets merged into drivers/bus/fsl-mc/fsl-mc-private.h, next
  to the other internally used APIs
- dpcon.h gets merged into include/linux/fsl/mc.h, exposing the public
  API

Update references in the dpaa2-eth staging driver.

DPCON stands for Data Path Concentrator - an interface between DPIO
(Data Path IO) and its users (e.g. dpaa2-eth). You can read more about
DPIO in Documentation/networking/dpaa2/overview.rst

Signed-off-by: Bogdan Purcareata 
---
 drivers/bus/fsl-mc/Makefile|  1 +
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpcon.c |  4 +-
 drivers/bus/fsl-mc/fsl-mc-private.h| 48 +
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h |  1 -
 drivers/staging/fsl-mc/bus/Makefile|  1 -
 drivers/staging/fsl-mc/bus/dpcon-cmd.h | 53 ---
 drivers/staging/fsl-mc/include/dpcon.h | 79 --
 include/linux/fsl/mc.h | 66 ++
 8 files changed, 117 insertions(+), 136 deletions(-)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpcon.c (99%)
 delete mode 100644 drivers/staging/fsl-mc/bus/dpcon-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/include/dpcon.h

diff --git a/drivers/bus/fsl-mc/Makefile b/drivers/bus/fsl-mc/Makefile
index da26e52..3c518c7 100644
--- a/drivers/bus/fsl-mc/Makefile
+++ b/drivers/bus/fsl-mc/Makefile
@@ -10,6 +10,7 @@ mc-bus-driver-objs := fsl-mc-bus.o \
  mc-sys.o \
  mc-io.o \
  dpbp.o \
+ dpcon.o \
  dprc.o \
  dprc-driver.o \
  fsl-mc-allocator.o \
diff --git a/drivers/staging/fsl-mc/bus/dpcon.c b/drivers/bus/fsl-mc/dpcon.c
similarity index 99%
rename from drivers/staging/fsl-mc/bus/dpcon.c
rename to drivers/bus/fsl-mc/dpcon.c
index 021b425..5d220c9 100644
--- a/drivers/staging/fsl-mc/bus/dpcon.c
+++ b/drivers/bus/fsl-mc/dpcon.c
@@ -5,9 +5,9 @@
  */
 #include 
 #include 
-#include "../include/dpcon.h"
+#include "linux/fsl/mc.h"
 
-#include "dpcon-cmd.h"
+#include "fsl-mc-private.h"
 
 /**
  * dpcon_open() - Open a control session for the specified object
diff --git a/drivers/bus/fsl-mc/fsl-mc-private.h 
b/drivers/bus/fsl-mc/fsl-mc-private.h
index 4ef8d7e..52c069d 100644
--- a/drivers/bus/fsl-mc/fsl-mc-private.h
+++ b/drivers/bus/fsl-mc/fsl-mc-private.h
@@ -418,6 +418,54 @@ struct dpbp_rsp_get_attributes {
__le16 version_minor;
 };
 
+/*
+ * Data Path Concentrator (DPCON) API
+ */
+
+/* DPCON Version */
+#define DPCON_VER_MAJOR3
+#define DPCON_VER_MINOR2
+
+/* Command versioning */
+#define DPCON_CMD_BASE_VERSION 1
+#define DPCON_CMD_ID_OFFSET4
+
+#define DPCON_CMD(id)  (((id) << DPCON_CMD_ID_OFFSET) | DPCON_CMD_BASE_VERSION)
+
+/* Command IDs */
+#define DPCON_CMDID_CLOSE  DPCON_CMD(0x800)
+#define DPCON_CMDID_OPEN   DPCON_CMD(0x808)
+
+#define DPCON_CMDID_ENABLE DPCON_CMD(0x002)
+#define DPCON_CMDID_DISABLEDPCON_CMD(0x003)
+#define DPCON_CMDID_GET_ATTR   DPCON_CMD(0x004)
+#define DPCON_CMDID_RESET  DPCON_CMD(0x005)
+
+#define DPCON_CMDID_SET_NOTIFICATION   DPCON_CMD(0x100)
+
+struct dpcon_cmd_open {
+   __le32 dpcon_id;
+};
+
+#define DPCON_ENABLE   1
+
+struct dpcon_rsp_get_attr {
+   /* response word 0 */
+   __le32 id;
+   __le16 qbman_ch_id;
+   u8 num_priorities;
+   u8 pad;
+};
+
+struct dpcon_cmd_set_notification {
+   /* cmd word 0 */
+   __le32 dpio_id;
+   u8 priority;
+   u8 pad[3];
+   /* cmd word 1 */
+   __le64 user_ctx;
+};
+
 /**
  * Maximum number of total IRQs that can be pre-allocated for an MC bus'
  * IRQ pool
diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
index ce864ee..b8990cf 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
@@ -39,7 +39,6 @@
 
 #include "../../fsl-mc/include/dpaa2-io.h"
 #include "../../fsl-mc/include/dpaa2-fd.h"
-#include "../../fsl-mc/include/dpcon.h"
 #include "dpni.h"
 #include "dpni-cmd.h"
 
diff --git a/drivers/staging/fsl-mc/bus/Makefile 
b/drivers/staging/fsl-mc/bus/Makefile
index ea6479f..21d8ebc 100644
--- a/drivers/staging/fsl-mc/bus/Makefile
+++ b/drivers/staging/fsl-mc/bus/Makefile
@@ -4,7 +4,6 @@
 #
 # Copyright (C) 2014 Freescale Semiconductor, Inc.
 #
-obj-$(CONFIG_FSL_MC_BUS) += dpcon.o
 
 # MC DPIO driver
 obj-$(CONFIG_FSL_MC_DPIO) += dpio/
diff --git a/drivers/s

[PATCH 2/3] staging: fsl-mc: Move DPBP out of staging

2018-03-01 Thread Bogdan Purcareata
Move the source files out of staging into their final locations:
- dpbp.c goes to drivers/bus/fsl-mc/, next to the core infrastructure
- dpbp-cmd.h gets merged into drivers/bus/fsl-mc/fsl-mc-private.h, next
  to the other internally used APIs
- dpbp.h gets merged into include/linux/fsl/mc.h, exposing the public
  API

Update references in the dpaa2-eth staging driver.

DPBP stands for Data Path Buffer Pool - you can read more about the
object in Documentation/networking/dpaa2/overview.rst

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
---
 drivers/bus/fsl-mc/Makefile   |  1 +
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp.c |  4 +-
 drivers/bus/fsl-mc/fsl-mc-private.h   | 39 +
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h|  2 +-
 drivers/staging/fsl-mc/bus/Makefile   |  3 +-
 drivers/staging/fsl-mc/bus/dpbp-cmd.h | 44 ---
 drivers/staging/fsl-mc/include/dpbp.h | 53 ---
 include/linux/fsl/mc.h| 42 ++
 8 files changed, 86 insertions(+), 102 deletions(-)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp.c (98%)
 delete mode 100644 drivers/staging/fsl-mc/bus/dpbp-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/include/dpbp.h

diff --git a/drivers/bus/fsl-mc/Makefile b/drivers/bus/fsl-mc/Makefile
index 6a97f2c..da26e52 100644
--- a/drivers/bus/fsl-mc/Makefile
+++ b/drivers/bus/fsl-mc/Makefile
@@ -9,6 +9,7 @@ obj-$(CONFIG_FSL_MC_BUS) += mc-bus-driver.o
 mc-bus-driver-objs := fsl-mc-bus.o \
  mc-sys.o \
  mc-io.o \
+ dpbp.o \
  dprc.o \
  dprc-driver.o \
  fsl-mc-allocator.o \
diff --git a/drivers/staging/fsl-mc/bus/dpbp.c b/drivers/bus/fsl-mc/dpbp.c
similarity index 98%
rename from drivers/staging/fsl-mc/bus/dpbp.c
rename to drivers/bus/fsl-mc/dpbp.c
index 85735bb..31a360b 100644
--- a/drivers/staging/fsl-mc/bus/dpbp.c
+++ b/drivers/bus/fsl-mc/dpbp.c
@@ -5,9 +5,9 @@
  */
 #include 
 #include 
-#include "../include/dpbp.h"
+#include "linux/fsl/mc.h"
 
-#include "dpbp-cmd.h"
+#include "fsl-mc-private.h"
 
 /**
  * dpbp_open() - Open a control session for the specified object.
diff --git a/drivers/bus/fsl-mc/fsl-mc-private.h 
b/drivers/bus/fsl-mc/fsl-mc-private.h
index bed990c..4ef8d7e 100644
--- a/drivers/bus/fsl-mc/fsl-mc-private.h
+++ b/drivers/bus/fsl-mc/fsl-mc-private.h
@@ -379,6 +379,45 @@ int dprc_get_container_id(struct fsl_mc_io *mc_io,
  u32 cmd_flags,
  int *container_id);
 
+/*
+ * Data Path Buffer Pool (DPBP) API
+ */
+
+/* DPBP Version */
+#define DPBP_VER_MAJOR 3
+#define DPBP_VER_MINOR 2
+
+/* Command versioning */
+#define DPBP_CMD_BASE_VERSION  1
+#define DPBP_CMD_ID_OFFSET 4
+
+#define DPBP_CMD(id)   (((id) << DPBP_CMD_ID_OFFSET) | DPBP_CMD_BASE_VERSION)
+
+/* Command IDs */
+#define DPBP_CMDID_CLOSE   DPBP_CMD(0x800)
+#define DPBP_CMDID_OPENDPBP_CMD(0x804)
+
+#define DPBP_CMDID_ENABLE  DPBP_CMD(0x002)
+#define DPBP_CMDID_DISABLE DPBP_CMD(0x003)
+#define DPBP_CMDID_GET_ATTRDPBP_CMD(0x004)
+#define DPBP_CMDID_RESET   DPBP_CMD(0x005)
+
+struct dpbp_cmd_open {
+   __le32 dpbp_id;
+};
+
+#define DPBP_ENABLE0x1
+
+struct dpbp_rsp_get_attributes {
+   /* response word 0 */
+   __le16 pad;
+   __le16 bpid;
+   __le32 id;
+   /* response word 1 */
+   __le16 version_major;
+   __le16 version_minor;
+};
+
 /**
  * Maximum number of total IRQs that can be pre-allocated for an MC bus'
  * IRQ pool
diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
index e577410..ce864ee 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
@@ -35,10 +35,10 @@
 
 #include 
 #include 
+#include 
 
 #include "../../fsl-mc/include/dpaa2-io.h"
 #include "../../fsl-mc/include/dpaa2-fd.h"
-#include "../../fsl-mc/include/dpbp.h"
 #include "../../fsl-mc/include/dpcon.h"
 #include "dpni.h"
 #include "dpni-cmd.h"
diff --git a/drivers/staging/fsl-mc/bus/Makefile 
b/drivers/staging/fsl-mc/bus/Makefile
index b67889e..ea6479f 100644
--- a/drivers/staging/fsl-mc/bus/Makefile
+++ b/drivers/staging/fsl-mc/bus/Makefile
@@ -4,8 +4,7 @@
 #
 # Copyright (C) 2014 Freescale Semiconductor, Inc.
 #
-obj-$(CONFIG_FSL_MC_BUS) += dpbp.o \
-   dpcon.o
+obj-$(CONFIG_FSL_MC_BUS) += dpcon.o
 
 # MC DPIO driver
 obj-$(CONFIG_FSL_MC_DPIO) += dpio/
diff --git a/drivers/staging/fsl-mc/bus/dpbp-cmd.h 
b/drivers/staging/fsl-mc/bu

[PATCH 2/3] staging: fsl-mc: Move DPBP out of staging

2018-03-01 Thread Bogdan Purcareata
Move the source files out of staging into their final locations:
- dpbp.c goes to drivers/bus/fsl-mc/, next to the core infrastructure
- dpbp-cmd.h gets merged into drivers/bus/fsl-mc/fsl-mc-private.h, next
  to the other internally used APIs
- dpbp.h gets merged into include/linux/fsl/mc.h, exposing the public
  API

Update references in the dpaa2-eth staging driver.

DPBP stands for Data Path Buffer Pool - you can read more about the
object in Documentation/networking/dpaa2/overview.rst

Signed-off-by: Bogdan Purcareata 
---
 drivers/bus/fsl-mc/Makefile   |  1 +
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp.c |  4 +-
 drivers/bus/fsl-mc/fsl-mc-private.h   | 39 +
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h|  2 +-
 drivers/staging/fsl-mc/bus/Makefile   |  3 +-
 drivers/staging/fsl-mc/bus/dpbp-cmd.h | 44 ---
 drivers/staging/fsl-mc/include/dpbp.h | 53 ---
 include/linux/fsl/mc.h| 42 ++
 8 files changed, 86 insertions(+), 102 deletions(-)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp.c (98%)
 delete mode 100644 drivers/staging/fsl-mc/bus/dpbp-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/include/dpbp.h

diff --git a/drivers/bus/fsl-mc/Makefile b/drivers/bus/fsl-mc/Makefile
index 6a97f2c..da26e52 100644
--- a/drivers/bus/fsl-mc/Makefile
+++ b/drivers/bus/fsl-mc/Makefile
@@ -9,6 +9,7 @@ obj-$(CONFIG_FSL_MC_BUS) += mc-bus-driver.o
 mc-bus-driver-objs := fsl-mc-bus.o \
  mc-sys.o \
  mc-io.o \
+ dpbp.o \
  dprc.o \
  dprc-driver.o \
  fsl-mc-allocator.o \
diff --git a/drivers/staging/fsl-mc/bus/dpbp.c b/drivers/bus/fsl-mc/dpbp.c
similarity index 98%
rename from drivers/staging/fsl-mc/bus/dpbp.c
rename to drivers/bus/fsl-mc/dpbp.c
index 85735bb..31a360b 100644
--- a/drivers/staging/fsl-mc/bus/dpbp.c
+++ b/drivers/bus/fsl-mc/dpbp.c
@@ -5,9 +5,9 @@
  */
 #include 
 #include 
-#include "../include/dpbp.h"
+#include "linux/fsl/mc.h"
 
-#include "dpbp-cmd.h"
+#include "fsl-mc-private.h"
 
 /**
  * dpbp_open() - Open a control session for the specified object.
diff --git a/drivers/bus/fsl-mc/fsl-mc-private.h 
b/drivers/bus/fsl-mc/fsl-mc-private.h
index bed990c..4ef8d7e 100644
--- a/drivers/bus/fsl-mc/fsl-mc-private.h
+++ b/drivers/bus/fsl-mc/fsl-mc-private.h
@@ -379,6 +379,45 @@ int dprc_get_container_id(struct fsl_mc_io *mc_io,
  u32 cmd_flags,
  int *container_id);
 
+/*
+ * Data Path Buffer Pool (DPBP) API
+ */
+
+/* DPBP Version */
+#define DPBP_VER_MAJOR 3
+#define DPBP_VER_MINOR 2
+
+/* Command versioning */
+#define DPBP_CMD_BASE_VERSION  1
+#define DPBP_CMD_ID_OFFSET 4
+
+#define DPBP_CMD(id)   (((id) << DPBP_CMD_ID_OFFSET) | DPBP_CMD_BASE_VERSION)
+
+/* Command IDs */
+#define DPBP_CMDID_CLOSE   DPBP_CMD(0x800)
+#define DPBP_CMDID_OPENDPBP_CMD(0x804)
+
+#define DPBP_CMDID_ENABLE  DPBP_CMD(0x002)
+#define DPBP_CMDID_DISABLE DPBP_CMD(0x003)
+#define DPBP_CMDID_GET_ATTRDPBP_CMD(0x004)
+#define DPBP_CMDID_RESET   DPBP_CMD(0x005)
+
+struct dpbp_cmd_open {
+   __le32 dpbp_id;
+};
+
+#define DPBP_ENABLE0x1
+
+struct dpbp_rsp_get_attributes {
+   /* response word 0 */
+   __le16 pad;
+   __le16 bpid;
+   __le32 id;
+   /* response word 1 */
+   __le16 version_major;
+   __le16 version_minor;
+};
+
 /**
  * Maximum number of total IRQs that can be pre-allocated for an MC bus'
  * IRQ pool
diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
index e577410..ce864ee 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
@@ -35,10 +35,10 @@
 
 #include 
 #include 
+#include 
 
 #include "../../fsl-mc/include/dpaa2-io.h"
 #include "../../fsl-mc/include/dpaa2-fd.h"
-#include "../../fsl-mc/include/dpbp.h"
 #include "../../fsl-mc/include/dpcon.h"
 #include "dpni.h"
 #include "dpni-cmd.h"
diff --git a/drivers/staging/fsl-mc/bus/Makefile 
b/drivers/staging/fsl-mc/bus/Makefile
index b67889e..ea6479f 100644
--- a/drivers/staging/fsl-mc/bus/Makefile
+++ b/drivers/staging/fsl-mc/bus/Makefile
@@ -4,8 +4,7 @@
 #
 # Copyright (C) 2014 Freescale Semiconductor, Inc.
 #
-obj-$(CONFIG_FSL_MC_BUS) += dpbp.o \
-   dpcon.o
+obj-$(CONFIG_FSL_MC_BUS) += dpcon.o
 
 # MC DPIO driver
 obj-$(CONFIG_FSL_MC_DPIO) += dpio/
diff --git a/drivers/staging/fsl-mc/bus/dpbp-cmd.h 
b/drivers/staging/fsl-mc/bus/dpbp-cmd.h
deleted file mode 1

[PATCH 1/3] staging: fsl-mc: Cleanup dpbp and dpcon API

2018-03-01 Thread Bogdan Purcareata
Some functions and associated structures are not used by current code,
so remove them.

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
---
 drivers/staging/fsl-mc/bus/dpbp-cmd.h | 10 --
 drivers/staging/fsl-mc/bus/dpbp.c | 67 ---
 drivers/staging/fsl-mc/include/dpbp.h | 10 --
 3 files changed, 87 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/dpbp-cmd.h 
b/drivers/staging/fsl-mc/bus/dpbp-cmd.h
index 0b7f5c0..3340021 100644
--- a/drivers/staging/fsl-mc/bus/dpbp-cmd.h
+++ b/drivers/staging/fsl-mc/bus/dpbp-cmd.h
@@ -19,28 +19,18 @@
 /* Command IDs */
 #define DPBP_CMDID_CLOSE   DPBP_CMD(0x800)
 #define DPBP_CMDID_OPENDPBP_CMD(0x804)
-#define DPBP_CMDID_GET_API_VERSION DPBP_CMD(0xa04)
 
 #define DPBP_CMDID_ENABLE  DPBP_CMD(0x002)
 #define DPBP_CMDID_DISABLE DPBP_CMD(0x003)
 #define DPBP_CMDID_GET_ATTRDPBP_CMD(0x004)
 #define DPBP_CMDID_RESET   DPBP_CMD(0x005)
-#define DPBP_CMDID_IS_ENABLED  DPBP_CMD(0x006)
 
 struct dpbp_cmd_open {
__le32 dpbp_id;
 };
 
-struct dpbp_cmd_destroy {
-   __le32 object_id;
-};
-
 #define DPBP_ENABLE0x1
 
-struct dpbp_rsp_is_enabled {
-   u8 enabled;
-};
-
 struct dpbp_rsp_get_attributes {
/* response word 0 */
__le16 pad;
diff --git a/drivers/staging/fsl-mc/bus/dpbp.c 
b/drivers/staging/fsl-mc/bus/dpbp.c
index c0addaa..85735bb 100644
--- a/drivers/staging/fsl-mc/bus/dpbp.c
+++ b/drivers/staging/fsl-mc/bus/dpbp.c
@@ -126,40 +126,6 @@ int dpbp_disable(struct fsl_mc_io *mc_io,
 EXPORT_SYMBOL_GPL(dpbp_disable);
 
 /**
- * dpbp_is_enabled() - Check if the DPBP is enabled.
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPBP object
- * @en:Returns '1' if object is enabled; '0' otherwise
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpbp_is_enabled(struct fsl_mc_io *mc_io,
-   u32 cmd_flags,
-   u16 token,
-   int *en)
-{
-   struct mc_command cmd = { 0 };
-   struct dpbp_rsp_is_enabled *rsp_params;
-   int err;
-   /* prepare command */
-   cmd.header = mc_encode_cmd_header(DPBP_CMDID_IS_ENABLED, cmd_flags,
- token);
-
-   /* send command to mc*/
-   err = mc_send_command(mc_io, );
-   if (err)
-   return err;
-
-   /* retrieve response parameters */
-   rsp_params = (struct dpbp_rsp_is_enabled *)cmd.params;
-   *en = rsp_params->enabled & DPBP_ENABLE;
-
-   return 0;
-}
-EXPORT_SYMBOL_GPL(dpbp_is_enabled);
-
-/**
  * dpbp_reset() - Reset the DPBP, returns the object to initial state.
  * @mc_io: Pointer to MC portal's I/O object
  * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
@@ -218,36 +184,3 @@ int dpbp_get_attributes(struct fsl_mc_io *mc_io,
return 0;
 }
 EXPORT_SYMBOL_GPL(dpbp_get_attributes);
-
-/**
- * dpbp_get_api_version - Get Data Path Buffer Pool API version
- * @mc_io: Pointer to Mc portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @major_ver: Major version of Buffer Pool API
- * @minor_ver: Minor version of Buffer Pool API
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpbp_get_api_version(struct fsl_mc_io *mc_io,
-u32 cmd_flags,
-u16 *major_ver,
-u16 *minor_ver)
-{
-   struct mc_command cmd = { 0 };
-   int err;
-
-   /* prepare command */
-   cmd.header = mc_encode_cmd_header(DPBP_CMDID_GET_API_VERSION,
- cmd_flags, 0);
-
-   /* send command to mc */
-   err = mc_send_command(mc_io, );
-   if (err)
-   return err;
-
-   /* retrieve response parameters */
-   mc_cmd_read_api_version(, major_ver, minor_ver);
-
-   return 0;
-}
-EXPORT_SYMBOL_GPL(dpbp_get_api_version);
diff --git a/drivers/staging/fsl-mc/include/dpbp.h 
b/drivers/staging/fsl-mc/include/dpbp.h
index 4a18096..7b9f7ad 100644
--- a/drivers/staging/fsl-mc/include/dpbp.h
+++ b/drivers/staging/fsl-mc/include/dpbp.h
@@ -30,11 +30,6 @@ int dpbp_disable(struct fsl_mc_io *mc_io,
 u32 cmd_flags,
 u16 token);
 
-int dpbp_is_enabled(struct fsl_mc_io *mc_io,
-   u32 cmd_flags,
-   u16 token,
-   int *en);
-
 int dpbp_reset(struct fsl_mc_io *mc_io,
   u32 cmd_flags,
   u16 token);
@@ -55,9 +50,4 @@ int dpbp_get_attributes(struct fsl_mc_io *mc_io,
u16 token,
struct dpbp_attr *attr);
 
-int dpbp_get_api_version(struct fsl_mc_io *mc_io,
-u32 cmd_flags,
-u16 *major_ver,
-u

[PATCH 1/3] staging: fsl-mc: Cleanup dpbp and dpcon API

2018-03-01 Thread Bogdan Purcareata
Some functions and associated structures are not used by current code,
so remove them.

Signed-off-by: Bogdan Purcareata 
---
 drivers/staging/fsl-mc/bus/dpbp-cmd.h | 10 --
 drivers/staging/fsl-mc/bus/dpbp.c | 67 ---
 drivers/staging/fsl-mc/include/dpbp.h | 10 --
 3 files changed, 87 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/dpbp-cmd.h 
b/drivers/staging/fsl-mc/bus/dpbp-cmd.h
index 0b7f5c0..3340021 100644
--- a/drivers/staging/fsl-mc/bus/dpbp-cmd.h
+++ b/drivers/staging/fsl-mc/bus/dpbp-cmd.h
@@ -19,28 +19,18 @@
 /* Command IDs */
 #define DPBP_CMDID_CLOSE   DPBP_CMD(0x800)
 #define DPBP_CMDID_OPENDPBP_CMD(0x804)
-#define DPBP_CMDID_GET_API_VERSION DPBP_CMD(0xa04)
 
 #define DPBP_CMDID_ENABLE  DPBP_CMD(0x002)
 #define DPBP_CMDID_DISABLE DPBP_CMD(0x003)
 #define DPBP_CMDID_GET_ATTRDPBP_CMD(0x004)
 #define DPBP_CMDID_RESET   DPBP_CMD(0x005)
-#define DPBP_CMDID_IS_ENABLED  DPBP_CMD(0x006)
 
 struct dpbp_cmd_open {
__le32 dpbp_id;
 };
 
-struct dpbp_cmd_destroy {
-   __le32 object_id;
-};
-
 #define DPBP_ENABLE0x1
 
-struct dpbp_rsp_is_enabled {
-   u8 enabled;
-};
-
 struct dpbp_rsp_get_attributes {
/* response word 0 */
__le16 pad;
diff --git a/drivers/staging/fsl-mc/bus/dpbp.c 
b/drivers/staging/fsl-mc/bus/dpbp.c
index c0addaa..85735bb 100644
--- a/drivers/staging/fsl-mc/bus/dpbp.c
+++ b/drivers/staging/fsl-mc/bus/dpbp.c
@@ -126,40 +126,6 @@ int dpbp_disable(struct fsl_mc_io *mc_io,
 EXPORT_SYMBOL_GPL(dpbp_disable);
 
 /**
- * dpbp_is_enabled() - Check if the DPBP is enabled.
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPBP object
- * @en:Returns '1' if object is enabled; '0' otherwise
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpbp_is_enabled(struct fsl_mc_io *mc_io,
-   u32 cmd_flags,
-   u16 token,
-   int *en)
-{
-   struct mc_command cmd = { 0 };
-   struct dpbp_rsp_is_enabled *rsp_params;
-   int err;
-   /* prepare command */
-   cmd.header = mc_encode_cmd_header(DPBP_CMDID_IS_ENABLED, cmd_flags,
- token);
-
-   /* send command to mc*/
-   err = mc_send_command(mc_io, );
-   if (err)
-   return err;
-
-   /* retrieve response parameters */
-   rsp_params = (struct dpbp_rsp_is_enabled *)cmd.params;
-   *en = rsp_params->enabled & DPBP_ENABLE;
-
-   return 0;
-}
-EXPORT_SYMBOL_GPL(dpbp_is_enabled);
-
-/**
  * dpbp_reset() - Reset the DPBP, returns the object to initial state.
  * @mc_io: Pointer to MC portal's I/O object
  * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
@@ -218,36 +184,3 @@ int dpbp_get_attributes(struct fsl_mc_io *mc_io,
return 0;
 }
 EXPORT_SYMBOL_GPL(dpbp_get_attributes);
-
-/**
- * dpbp_get_api_version - Get Data Path Buffer Pool API version
- * @mc_io: Pointer to Mc portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @major_ver: Major version of Buffer Pool API
- * @minor_ver: Minor version of Buffer Pool API
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpbp_get_api_version(struct fsl_mc_io *mc_io,
-u32 cmd_flags,
-u16 *major_ver,
-u16 *minor_ver)
-{
-   struct mc_command cmd = { 0 };
-   int err;
-
-   /* prepare command */
-   cmd.header = mc_encode_cmd_header(DPBP_CMDID_GET_API_VERSION,
- cmd_flags, 0);
-
-   /* send command to mc */
-   err = mc_send_command(mc_io, );
-   if (err)
-   return err;
-
-   /* retrieve response parameters */
-   mc_cmd_read_api_version(, major_ver, minor_ver);
-
-   return 0;
-}
-EXPORT_SYMBOL_GPL(dpbp_get_api_version);
diff --git a/drivers/staging/fsl-mc/include/dpbp.h 
b/drivers/staging/fsl-mc/include/dpbp.h
index 4a18096..7b9f7ad 100644
--- a/drivers/staging/fsl-mc/include/dpbp.h
+++ b/drivers/staging/fsl-mc/include/dpbp.h
@@ -30,11 +30,6 @@ int dpbp_disable(struct fsl_mc_io *mc_io,
 u32 cmd_flags,
 u16 token);
 
-int dpbp_is_enabled(struct fsl_mc_io *mc_io,
-   u32 cmd_flags,
-   u16 token,
-   int *en);
-
 int dpbp_reset(struct fsl_mc_io *mc_io,
   u32 cmd_flags,
   u16 token);
@@ -55,9 +50,4 @@ int dpbp_get_attributes(struct fsl_mc_io *mc_io,
u16 token,
struct dpbp_attr *attr);
 
-int dpbp_get_api_version(struct fsl_mc_io *mc_io,
-u32 cmd_flags,
-u16 *major_ver,
-u16 *minor_ver);
-
 #endif /* __FSL

RE: [PATCH v6 1/2] staging: fsl-mc: Move core bus out of staging

2018-02-06 Thread Bogdan Purcareata
> -Original Message-
> From: Horia Geantă
> Sent: Tuesday, February 06, 2018 9:18 AM
> To: Bogdan Purcareata <bogdan.purcare...@nxp.com>; gre...@linuxfoundation.org;
> Laurentiu Tudor <laurentiu.tu...@nxp.com>; Ruxandra Ioana Ciocoi Radulescu
> <ruxandra.radule...@nxp.com>
> Cc: stuyo...@gmail.com; a...@arndb.de; r...@kernel.org; Razvan Stefanescu
> <razvan.stefane...@nxp.com>; Ioana Ciornei <ioana.cior...@nxp.com>; Nipun 
> Gupta
> <nipun.gu...@nxp.com>; Roy Pledge <roy.ple...@nxp.com>; marc.zyng...@arm.com;
> t...@linutronix.de; ja...@lakedaemon.net; de...@driverdev.osuosl.org; linux-
> ker...@vger.kernel.org; linux-arm-ker...@lists.infradead.org
> Subject: Re: [PATCH v6 1/2] staging: fsl-mc: Move core bus out of staging
> 
> On 2/5/2018 4:08 PM, Bogdan Purcareata wrote:
> > Move the source files out of staging into their final locations:
> >   -mc.h include file in drivers/staging/fsl-mc/include go to
> include/linux/fsl
> >   -source files in drivers/staging/fsl-mc/bus go to drivers/bus/fsl-mc
> >   -overview.rst, providing an overview of DPAA2, goes to
> >Documentation/networking/dpaa2/overview.rst
> [...]
> >  rename {drivers/staging/fsl-mc =>
> Documentation/networking/dpaa2}/overview.rst (100%)
> 
> Is this the proper location for documentation?
> The doc focuses on networking, however there's also information about fsl mc
> bus, dpio.

Yes, after internal discussions we concluded it would be the best fit, since
the end usage scenario is a networking one. So far the main user of the fsl-mc
bus and dpio is dpaa2-eth, which is an Ethernet driver. It's also next to the
previous DPAA generation driver documentation at 
Documentation/networking/dpaa.txt.

> In the future, we might want to add doc for other dpaa2 objects sitting on the
> fsl mc bus:
> -dpseci ("Data Path SEC Interface" - abstraction for the crypto engine)
> -dpdcei ("Data Path Decompression and Compression Engine Interface")
> 
> Would these fit under networking doc folder too?

IMO it would make sense to place them in the same 
Documentation/networking/dpaa2/
folder, since they're part of the same architecture. Of course, the end location
can be changed based on later feedback.

Cheers,
Bogdan P.


RE: [PATCH v6 1/2] staging: fsl-mc: Move core bus out of staging

2018-02-06 Thread Bogdan Purcareata
> -Original Message-
> From: Horia Geantă
> Sent: Tuesday, February 06, 2018 9:18 AM
> To: Bogdan Purcareata ; gre...@linuxfoundation.org;
> Laurentiu Tudor ; Ruxandra Ioana Ciocoi Radulescu
> 
> Cc: stuyo...@gmail.com; a...@arndb.de; r...@kernel.org; Razvan Stefanescu
> ; Ioana Ciornei ; Nipun 
> Gupta
> ; Roy Pledge ; marc.zyng...@arm.com;
> t...@linutronix.de; ja...@lakedaemon.net; de...@driverdev.osuosl.org; linux-
> ker...@vger.kernel.org; linux-arm-ker...@lists.infradead.org
> Subject: Re: [PATCH v6 1/2] staging: fsl-mc: Move core bus out of staging
> 
> On 2/5/2018 4:08 PM, Bogdan Purcareata wrote:
> > Move the source files out of staging into their final locations:
> >   -mc.h include file in drivers/staging/fsl-mc/include go to
> include/linux/fsl
> >   -source files in drivers/staging/fsl-mc/bus go to drivers/bus/fsl-mc
> >   -overview.rst, providing an overview of DPAA2, goes to
> >Documentation/networking/dpaa2/overview.rst
> [...]
> >  rename {drivers/staging/fsl-mc =>
> Documentation/networking/dpaa2}/overview.rst (100%)
> 
> Is this the proper location for documentation?
> The doc focuses on networking, however there's also information about fsl mc
> bus, dpio.

Yes, after internal discussions we concluded it would be the best fit, since
the end usage scenario is a networking one. So far the main user of the fsl-mc
bus and dpio is dpaa2-eth, which is an Ethernet driver. It's also next to the
previous DPAA generation driver documentation at 
Documentation/networking/dpaa.txt.

> In the future, we might want to add doc for other dpaa2 objects sitting on the
> fsl mc bus:
> -dpseci ("Data Path SEC Interface" - abstraction for the crypto engine)
> -dpdcei ("Data Path Decompression and Compression Engine Interface")
> 
> Would these fit under networking doc folder too?

IMO it would make sense to place them in the same 
Documentation/networking/dpaa2/
folder, since they're part of the same architecture. Of course, the end location
can be changed based on later feedback.

Cheers,
Bogdan P.


[PATCH v6 1/2] staging: fsl-mc: Move core bus out of staging

2018-02-05 Thread Bogdan Purcareata
Move the source files out of staging into their final locations:
  -mc.h include file in drivers/staging/fsl-mc/include go to include/linux/fsl
  -source files in drivers/staging/fsl-mc/bus go to drivers/bus/fsl-mc
  -overview.rst, providing an overview of DPAA2, goes to
   Documentation/networking/dpaa2/overview.rst

Update or delete other remaining staging files -- Makefile, Kconfig, TODO.
Update dpaa2_eth and dpio staging drivers.
Add integration bits for the documentation build system.

Signed-off-by: Stuart Yoder <stuyo...@gmail.com>
[rebased, add dpaa2_eth and dpio #include updates]
Signed-off-by: Laurentiu Tudor <laurentiu.tu...@nxp.com>
[rebased, split irqchip to separate patch]
Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
Cc: Thomas Gleixner <t...@linutronix.de>
Cc: Jason Cooper <ja...@lakedaemon.net>
Cc: Marc Zyngier <marc.zyng...@arm.com>
---
Notes:
-v6:
  - generate patch with rename detection enabled (GregKH)
-v5:
  - split irqchip glue code to separate patch (GregKH)
  - integrate doc with the kernel build system
-v4:
  - regenerated patch with renames detection disabled (Andrew Lunn)
-v3:
  - rebased
-v2:
  - group irqchip gic its glue code together with the rest (Marc Zyngier)

 Documentation/networking/dpaa2/index.rst   |  8 
 .../networking/dpaa2}/overview.rst |  0
 Documentation/networking/index.rst |  1 +
 MAINTAINERS|  3 ++-
 drivers/bus/Kconfig|  2 ++
 drivers/bus/Makefile   |  4 
 drivers/bus/fsl-mc/Kconfig | 16 
 drivers/bus/fsl-mc/Makefile| 16 
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp.c |  2 +-
 .../{staging/fsl-mc/bus => bus/fsl-mc}/dprc-driver.c   |  2 +-
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc.c  |  3 ++-
 .../fsl-mc/bus => bus/fsl-mc}/fsl-mc-allocator.c   |  2 +-
 .../{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-bus.c|  0
 .../{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-msi.c|  1 +
 .../fsl-mc/bus => bus/fsl-mc}/fsl-mc-private.h |  2 +-
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-io.c |  2 +-
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-sys.c|  2 +-
 drivers/staging/fsl-dpaa2/ethernet/README  |  2 +-
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c |  2 +-
 drivers/staging/fsl-dpaa2/ethernet/dpni.c  |  2 +-
 drivers/staging/fsl-mc/TODO| 18 --
 drivers/staging/fsl-mc/bus/Kconfig | 10 --
 drivers/staging/fsl-mc/bus/Makefile| 16 +++-
 drivers/staging/fsl-mc/bus/dpbp.c  |  2 +-
 drivers/staging/fsl-mc/bus/dpcon.c |  2 +-
 drivers/staging/fsl-mc/bus/dpio/dpio-driver.c  |  2 +-
 drivers/staging/fsl-mc/bus/dpio/dpio-service.c |  2 +-
 drivers/staging/fsl-mc/bus/dpio/dpio.c |  2 +-
 drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c |  2 +-
 .../staging/fsl-mc/include => include/linux/fsl}/mc.h  |  0
 30 files changed, 70 insertions(+), 58 deletions(-)
 create mode 100644 Documentation/networking/dpaa2/index.rst
 rename {drivers/staging/fsl-mc => Documentation/networking/dpaa2}/overview.rst 
(100%)
 create mode 100644 drivers/bus/fsl-mc/Kconfig
 create mode 100644 drivers/bus/fsl-mc/Makefile
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp.c (98%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc-driver.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-allocator.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-bus.c (100%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-msi.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-private.h (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-io.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-sys.c (99%)
 delete mode 100644 drivers/staging/fsl-mc/TODO
 rename {drivers/staging/fsl-mc/include => include/linux/fsl}/mc.h (100%)

diff --git a/Documentation/networking/dpaa2/index.rst 
b/Documentation/networking/dpaa2/index.rst
new file mode 100644
index 000..4c6586c
--- /dev/null
+++ b/Documentation/networking/dpaa2/index.rst
@@ -0,0 +1,8 @@
+===
+DPAA2 Documentation
+===
+
+.. toctree::
+   :maxdepth: 1
+
+   overview
diff --git a/drivers/staging/fsl-mc/overview.rst 
b/Documentation/networking/dpaa2/overview.rst
similarity index 100%
rename from drivers/staging/fsl-mc/overview.rst
rename to Documentation/networking/dpaa2/overview.rst
diff --git a/Documentation/networking/index.rst

[PATCH v6 1/2] staging: fsl-mc: Move core bus out of staging

2018-02-05 Thread Bogdan Purcareata
Move the source files out of staging into their final locations:
  -mc.h include file in drivers/staging/fsl-mc/include go to include/linux/fsl
  -source files in drivers/staging/fsl-mc/bus go to drivers/bus/fsl-mc
  -overview.rst, providing an overview of DPAA2, goes to
   Documentation/networking/dpaa2/overview.rst

Update or delete other remaining staging files -- Makefile, Kconfig, TODO.
Update dpaa2_eth and dpio staging drivers.
Add integration bits for the documentation build system.

Signed-off-by: Stuart Yoder 
[rebased, add dpaa2_eth and dpio #include updates]
Signed-off-by: Laurentiu Tudor 
[rebased, split irqchip to separate patch]
Signed-off-by: Bogdan Purcareata 
Cc: Thomas Gleixner 
Cc: Jason Cooper 
Cc: Marc Zyngier 
---
Notes:
-v6:
  - generate patch with rename detection enabled (GregKH)
-v5:
  - split irqchip glue code to separate patch (GregKH)
  - integrate doc with the kernel build system
-v4:
  - regenerated patch with renames detection disabled (Andrew Lunn)
-v3:
  - rebased
-v2:
  - group irqchip gic its glue code together with the rest (Marc Zyngier)

 Documentation/networking/dpaa2/index.rst   |  8 
 .../networking/dpaa2}/overview.rst |  0
 Documentation/networking/index.rst |  1 +
 MAINTAINERS|  3 ++-
 drivers/bus/Kconfig|  2 ++
 drivers/bus/Makefile   |  4 
 drivers/bus/fsl-mc/Kconfig | 16 
 drivers/bus/fsl-mc/Makefile| 16 
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp.c |  2 +-
 .../{staging/fsl-mc/bus => bus/fsl-mc}/dprc-driver.c   |  2 +-
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc.c  |  3 ++-
 .../fsl-mc/bus => bus/fsl-mc}/fsl-mc-allocator.c   |  2 +-
 .../{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-bus.c|  0
 .../{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-msi.c|  1 +
 .../fsl-mc/bus => bus/fsl-mc}/fsl-mc-private.h |  2 +-
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-io.c |  2 +-
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-sys.c|  2 +-
 drivers/staging/fsl-dpaa2/ethernet/README  |  2 +-
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c |  2 +-
 drivers/staging/fsl-dpaa2/ethernet/dpni.c  |  2 +-
 drivers/staging/fsl-mc/TODO| 18 --
 drivers/staging/fsl-mc/bus/Kconfig | 10 --
 drivers/staging/fsl-mc/bus/Makefile| 16 +++-
 drivers/staging/fsl-mc/bus/dpbp.c  |  2 +-
 drivers/staging/fsl-mc/bus/dpcon.c |  2 +-
 drivers/staging/fsl-mc/bus/dpio/dpio-driver.c  |  2 +-
 drivers/staging/fsl-mc/bus/dpio/dpio-service.c |  2 +-
 drivers/staging/fsl-mc/bus/dpio/dpio.c |  2 +-
 drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c |  2 +-
 .../staging/fsl-mc/include => include/linux/fsl}/mc.h  |  0
 30 files changed, 70 insertions(+), 58 deletions(-)
 create mode 100644 Documentation/networking/dpaa2/index.rst
 rename {drivers/staging/fsl-mc => Documentation/networking/dpaa2}/overview.rst 
(100%)
 create mode 100644 drivers/bus/fsl-mc/Kconfig
 create mode 100644 drivers/bus/fsl-mc/Makefile
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp.c (98%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc-driver.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-allocator.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-bus.c (100%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-msi.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-private.h (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-io.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-sys.c (99%)
 delete mode 100644 drivers/staging/fsl-mc/TODO
 rename {drivers/staging/fsl-mc/include => include/linux/fsl}/mc.h (100%)

diff --git a/Documentation/networking/dpaa2/index.rst 
b/Documentation/networking/dpaa2/index.rst
new file mode 100644
index 000..4c6586c
--- /dev/null
+++ b/Documentation/networking/dpaa2/index.rst
@@ -0,0 +1,8 @@
+===
+DPAA2 Documentation
+===
+
+.. toctree::
+   :maxdepth: 1
+
+   overview
diff --git a/drivers/staging/fsl-mc/overview.rst 
b/Documentation/networking/dpaa2/overview.rst
similarity index 100%
rename from drivers/staging/fsl-mc/overview.rst
rename to Documentation/networking/dpaa2/overview.rst
diff --git a/Documentation/networking/index.rst 
b/Documentation/networking/index.rst
index 90966c2..f204eaf 100644
--- a/Documentation/networking/index.rst
+++ b/Documentation/networking/index.rst
@@ -8,6 +8,7

[PATCH v6 0/2] staging: fsl-mc: Move bus driver out of staging

2018-02-05 Thread Bogdan Purcareata
Previous submission: https://lkml.org/lkml/2018/1/26/215

Split the code into moving out the core bus infrastructure separate from
the irqchip glue code. Add a Kconfig dependency on ARM_GIC_V3_ITS.
Integrate the documentation with the kernel build system.

This patchset only handles moving the fsl-mc bus core out of staging.
The remaining objects (DPBP, DPCON) and drivers (dpio, dpaa2-eth) will
be moved out in subsequent patches.

Notes:
-v6:
  - generate patchset with rename detection enabled (GregKH)
  - add Kconfig dependecy on ARM_GIC_V3_ITS (Mark Zyngier)
-v5:
  - split irqchip glue code to separate patch (GregKH)
  - integrate doc with the kernel build system
-v4:
  - regenerated patch with renames detection disabled (Andrew Lunn)
-v3:
  - rebased
-v2:
  - group irqchip gic its glue code together with the rest (Marc Zyngier)

Bogdan Purcareata (2):
  staging: fsl-mc: Move core bus out of staging
  staging: fsl-mc: Move irqchip code out of staging

 Documentation/networking/dpaa2/index.rst   |  8 
 .../networking/dpaa2}/overview.rst |  0
 Documentation/networking/index.rst |  1 +
 MAINTAINERS|  3 ++-
 drivers/bus/Kconfig|  2 ++
 drivers/bus/Makefile   |  4 
 drivers/bus/fsl-mc/Kconfig | 16 
 drivers/bus/fsl-mc/Makefile| 16 
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp.c |  2 +-
 .../{staging/fsl-mc/bus => bus/fsl-mc}/dprc-driver.c   |  2 +-
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc.c  |  3 ++-
 .../fsl-mc/bus => bus/fsl-mc}/fsl-mc-allocator.c   |  2 +-
 .../{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-bus.c|  0
 .../{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-msi.c|  1 +
 .../fsl-mc/bus => bus/fsl-mc}/fsl-mc-private.h |  2 +-
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-io.c |  2 +-
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-sys.c|  2 +-
 drivers/irqchip/Kconfig|  6 ++
 drivers/irqchip/Makefile   |  1 +
 .../fsl-mc/bus => irqchip}/irq-gic-v3-its-fsl-mc-msi.c |  4 +---
 drivers/staging/fsl-dpaa2/ethernet/README  |  2 +-
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c |  2 +-
 drivers/staging/fsl-dpaa2/ethernet/dpni.c  |  2 +-
 drivers/staging/fsl-mc/TODO| 18 --
 drivers/staging/fsl-mc/bus/Kconfig | 10 --
 drivers/staging/fsl-mc/bus/Makefile| 15 ++-
 drivers/staging/fsl-mc/bus/dpbp.c  |  2 +-
 drivers/staging/fsl-mc/bus/dpcon.c |  2 +-
 drivers/staging/fsl-mc/bus/dpio/dpio-driver.c  |  2 +-
 drivers/staging/fsl-mc/bus/dpio/dpio-service.c |  2 +-
 drivers/staging/fsl-mc/bus/dpio/dpio.c |  2 +-
 .../staging/fsl-mc/include => include/linux/fsl}/mc.h  |  0
 32 files changed, 76 insertions(+), 60 deletions(-)
 create mode 100644 Documentation/networking/dpaa2/index.rst
 rename {drivers/staging/fsl-mc => Documentation/networking/dpaa2}/overview.rst 
(100%)
 create mode 100644 drivers/bus/fsl-mc/Kconfig
 create mode 100644 drivers/bus/fsl-mc/Makefile
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp.c (98%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc-driver.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-allocator.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-bus.c (100%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-msi.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-private.h (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-io.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-sys.c (99%)
 rename drivers/{staging/fsl-mc/bus => irqchip}/irq-gic-v3-its-fsl-mc-msi.c 
(97%)
 delete mode 100644 drivers/staging/fsl-mc/TODO
 rename {drivers/staging/fsl-mc/include => include/linux/fsl}/mc.h (100%)

-- 
2.7.4



[PATCH v6 2/2] staging: fsl-mc: Move irqchip code out of staging

2018-02-05 Thread Bogdan Purcareata
Now that the fsl-mc bus core infrastructure is out of staging, the
remaining irqchip glue code used (irq-gic-v3-its-fsl-mc-msi.c) goes
to drivers/irqchip.

Create new Kconfig option for irqchip code that depends on
FSL_MC_BUS and ARM_GIC_V3_ITS. This ensures irqchip code only
gets built on ARM64 platforms. We can now remove #ifdef
GENERIC_MSI_DOMAIN_OPS as it was only needed for x86.

Signed-off-by: Stuart Yoder <stuyo...@gmail.com>
[rebased, add dpaa2_eth and dpio #include updates]
Signed-off-by: Laurentiu Tudor <laurentiu.tu...@nxp.com>
[rebased, split irqchip to separate patch]
Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
[add Kconfig dependency on ARM_GIC_V3_ITS]
Signed-off-by: Ioana Radulescu <ruxandra.radule...@nxp.com>
Cc: Thomas Gleixner <t...@linutronix.de>
Cc: Jason Cooper <ja...@lakedaemon.net>
Cc: Marc Zyngier <marc.zyng...@arm.com>
---
Notes:
-v6:
  - generate patch with rename detection enabled (GregKH)
  - add Kconfig dependecy on ARM_GIC_V3_ITS (Mark Zyngier)
-v5:
  - split irqchip glue code to separate patch (GregKH)
-v4 - v1:
  - no change

 drivers/irqchip/Kconfig | 6 ++
 drivers/irqchip/Makefile| 1 +
 drivers/{staging/fsl-mc/bus => irqchip}/irq-gic-v3-its-fsl-mc-msi.c | 2 --
 drivers/staging/fsl-mc/bus/Makefile | 3 +--
 4 files changed, 8 insertions(+), 4 deletions(-)
 rename drivers/{staging/fsl-mc/bus => irqchip}/irq-gic-v3-its-fsl-mc-msi.c 
(98%)

diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
index d913aec..f2ace51 100644
--- a/drivers/irqchip/Kconfig
+++ b/drivers/irqchip/Kconfig
@@ -51,6 +51,12 @@ config ARM_GIC_V3_ITS_PCI
depends on PCI_MSI
default ARM_GIC_V3_ITS
 
+config ARM_GIC_V3_ITS_FSL_MC
+   bool
+   depends on ARM_GIC_V3_ITS
+   depends on FSL_MC_BUS
+   default ARM_GIC_V3_ITS
+
 config ARM_NVIC
bool
select IRQ_DOMAIN
diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile
index d27e3e3..1ba4390 100644
--- a/drivers/irqchip/Makefile
+++ b/drivers/irqchip/Makefile
@@ -32,6 +32,7 @@ obj-$(CONFIG_ARM_GIC_V2M) += irq-gic-v2m.o
 obj-$(CONFIG_ARM_GIC_V3)   += irq-gic-v3.o irq-gic-common.o
 obj-$(CONFIG_ARM_GIC_V3_ITS)   += irq-gic-v3-its.o 
irq-gic-v3-its-platform-msi.o irq-gic-v4.o
 obj-$(CONFIG_ARM_GIC_V3_ITS_PCI)   += irq-gic-v3-its-pci-msi.o
+obj-$(CONFIG_ARM_GIC_V3_ITS_FSL_MC)+= irq-gic-v3-its-fsl-mc-msi.o
 obj-$(CONFIG_PARTITION_PERCPU) += irq-partition-percpu.o
 obj-$(CONFIG_HISILICON_IRQ_MBIGEN) += irq-mbigen.o
 obj-$(CONFIG_ARM_NVIC) += irq-nvic.o
diff --git a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c 
b/drivers/irqchip/irq-gic-v3-its-fsl-mc-msi.c
similarity index 98%
rename from drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
rename to drivers/irqchip/irq-gic-v3-its-fsl-mc-msi.c
index b365fbb..13a5d9a 100644
--- a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
+++ b/drivers/irqchip/irq-gic-v3-its-fsl-mc-msi.c
@@ -43,9 +43,7 @@ static int its_fsl_mc_msi_prepare(struct irq_domain 
*msi_domain,
 * NOTE: This device id corresponds to the IOMMU stream ID
 * associated with the DPRC object (ICID).
 */
-#ifdef GENERIC_MSI_DOMAIN_OPS
info->scratchpad[0].ul = mc_bus_dev->icid;
-#endif
msi_info = msi_get_domain_info(msi_domain->parent);
return msi_info->ops->msi_prepare(msi_domain->parent, dev, nvec, info);
 }
diff --git a/drivers/staging/fsl-mc/bus/Makefile 
b/drivers/staging/fsl-mc/bus/Makefile
index 18b1b5f..b67889e 100644
--- a/drivers/staging/fsl-mc/bus/Makefile
+++ b/drivers/staging/fsl-mc/bus/Makefile
@@ -4,8 +4,7 @@
 #
 # Copyright (C) 2014 Freescale Semiconductor, Inc.
 #
-obj-$(CONFIG_FSL_MC_BUS) += irq-gic-v3-its-fsl-mc-msi.o \
-   dpbp.o \
+obj-$(CONFIG_FSL_MC_BUS) += dpbp.o \
dpcon.o
 
 # MC DPIO driver
-- 
2.7.4



[PATCH v6 0/2] staging: fsl-mc: Move bus driver out of staging

2018-02-05 Thread Bogdan Purcareata
Previous submission: https://lkml.org/lkml/2018/1/26/215

Split the code into moving out the core bus infrastructure separate from
the irqchip glue code. Add a Kconfig dependency on ARM_GIC_V3_ITS.
Integrate the documentation with the kernel build system.

This patchset only handles moving the fsl-mc bus core out of staging.
The remaining objects (DPBP, DPCON) and drivers (dpio, dpaa2-eth) will
be moved out in subsequent patches.

Notes:
-v6:
  - generate patchset with rename detection enabled (GregKH)
  - add Kconfig dependecy on ARM_GIC_V3_ITS (Mark Zyngier)
-v5:
  - split irqchip glue code to separate patch (GregKH)
  - integrate doc with the kernel build system
-v4:
  - regenerated patch with renames detection disabled (Andrew Lunn)
-v3:
  - rebased
-v2:
  - group irqchip gic its glue code together with the rest (Marc Zyngier)

Bogdan Purcareata (2):
  staging: fsl-mc: Move core bus out of staging
  staging: fsl-mc: Move irqchip code out of staging

 Documentation/networking/dpaa2/index.rst   |  8 
 .../networking/dpaa2}/overview.rst |  0
 Documentation/networking/index.rst |  1 +
 MAINTAINERS|  3 ++-
 drivers/bus/Kconfig|  2 ++
 drivers/bus/Makefile   |  4 
 drivers/bus/fsl-mc/Kconfig | 16 
 drivers/bus/fsl-mc/Makefile| 16 
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp.c |  2 +-
 .../{staging/fsl-mc/bus => bus/fsl-mc}/dprc-driver.c   |  2 +-
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc.c  |  3 ++-
 .../fsl-mc/bus => bus/fsl-mc}/fsl-mc-allocator.c   |  2 +-
 .../{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-bus.c|  0
 .../{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-msi.c|  1 +
 .../fsl-mc/bus => bus/fsl-mc}/fsl-mc-private.h |  2 +-
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-io.c |  2 +-
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-sys.c|  2 +-
 drivers/irqchip/Kconfig|  6 ++
 drivers/irqchip/Makefile   |  1 +
 .../fsl-mc/bus => irqchip}/irq-gic-v3-its-fsl-mc-msi.c |  4 +---
 drivers/staging/fsl-dpaa2/ethernet/README  |  2 +-
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c |  2 +-
 drivers/staging/fsl-dpaa2/ethernet/dpni.c  |  2 +-
 drivers/staging/fsl-mc/TODO| 18 --
 drivers/staging/fsl-mc/bus/Kconfig | 10 --
 drivers/staging/fsl-mc/bus/Makefile| 15 ++-
 drivers/staging/fsl-mc/bus/dpbp.c  |  2 +-
 drivers/staging/fsl-mc/bus/dpcon.c |  2 +-
 drivers/staging/fsl-mc/bus/dpio/dpio-driver.c  |  2 +-
 drivers/staging/fsl-mc/bus/dpio/dpio-service.c |  2 +-
 drivers/staging/fsl-mc/bus/dpio/dpio.c |  2 +-
 .../staging/fsl-mc/include => include/linux/fsl}/mc.h  |  0
 32 files changed, 76 insertions(+), 60 deletions(-)
 create mode 100644 Documentation/networking/dpaa2/index.rst
 rename {drivers/staging/fsl-mc => Documentation/networking/dpaa2}/overview.rst 
(100%)
 create mode 100644 drivers/bus/fsl-mc/Kconfig
 create mode 100644 drivers/bus/fsl-mc/Makefile
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp.c (98%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc-driver.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-allocator.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-bus.c (100%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-msi.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-private.h (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-io.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-sys.c (99%)
 rename drivers/{staging/fsl-mc/bus => irqchip}/irq-gic-v3-its-fsl-mc-msi.c 
(97%)
 delete mode 100644 drivers/staging/fsl-mc/TODO
 rename {drivers/staging/fsl-mc/include => include/linux/fsl}/mc.h (100%)

-- 
2.7.4



[PATCH v6 2/2] staging: fsl-mc: Move irqchip code out of staging

2018-02-05 Thread Bogdan Purcareata
Now that the fsl-mc bus core infrastructure is out of staging, the
remaining irqchip glue code used (irq-gic-v3-its-fsl-mc-msi.c) goes
to drivers/irqchip.

Create new Kconfig option for irqchip code that depends on
FSL_MC_BUS and ARM_GIC_V3_ITS. This ensures irqchip code only
gets built on ARM64 platforms. We can now remove #ifdef
GENERIC_MSI_DOMAIN_OPS as it was only needed for x86.

Signed-off-by: Stuart Yoder 
[rebased, add dpaa2_eth and dpio #include updates]
Signed-off-by: Laurentiu Tudor 
[rebased, split irqchip to separate patch]
Signed-off-by: Bogdan Purcareata 
[add Kconfig dependency on ARM_GIC_V3_ITS]
Signed-off-by: Ioana Radulescu 
Cc: Thomas Gleixner 
Cc: Jason Cooper 
Cc: Marc Zyngier 
---
Notes:
-v6:
  - generate patch with rename detection enabled (GregKH)
  - add Kconfig dependecy on ARM_GIC_V3_ITS (Mark Zyngier)
-v5:
  - split irqchip glue code to separate patch (GregKH)
-v4 - v1:
  - no change

 drivers/irqchip/Kconfig | 6 ++
 drivers/irqchip/Makefile| 1 +
 drivers/{staging/fsl-mc/bus => irqchip}/irq-gic-v3-its-fsl-mc-msi.c | 2 --
 drivers/staging/fsl-mc/bus/Makefile | 3 +--
 4 files changed, 8 insertions(+), 4 deletions(-)
 rename drivers/{staging/fsl-mc/bus => irqchip}/irq-gic-v3-its-fsl-mc-msi.c 
(98%)

diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
index d913aec..f2ace51 100644
--- a/drivers/irqchip/Kconfig
+++ b/drivers/irqchip/Kconfig
@@ -51,6 +51,12 @@ config ARM_GIC_V3_ITS_PCI
depends on PCI_MSI
default ARM_GIC_V3_ITS
 
+config ARM_GIC_V3_ITS_FSL_MC
+   bool
+   depends on ARM_GIC_V3_ITS
+   depends on FSL_MC_BUS
+   default ARM_GIC_V3_ITS
+
 config ARM_NVIC
bool
select IRQ_DOMAIN
diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile
index d27e3e3..1ba4390 100644
--- a/drivers/irqchip/Makefile
+++ b/drivers/irqchip/Makefile
@@ -32,6 +32,7 @@ obj-$(CONFIG_ARM_GIC_V2M) += irq-gic-v2m.o
 obj-$(CONFIG_ARM_GIC_V3)   += irq-gic-v3.o irq-gic-common.o
 obj-$(CONFIG_ARM_GIC_V3_ITS)   += irq-gic-v3-its.o 
irq-gic-v3-its-platform-msi.o irq-gic-v4.o
 obj-$(CONFIG_ARM_GIC_V3_ITS_PCI)   += irq-gic-v3-its-pci-msi.o
+obj-$(CONFIG_ARM_GIC_V3_ITS_FSL_MC)+= irq-gic-v3-its-fsl-mc-msi.o
 obj-$(CONFIG_PARTITION_PERCPU) += irq-partition-percpu.o
 obj-$(CONFIG_HISILICON_IRQ_MBIGEN) += irq-mbigen.o
 obj-$(CONFIG_ARM_NVIC) += irq-nvic.o
diff --git a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c 
b/drivers/irqchip/irq-gic-v3-its-fsl-mc-msi.c
similarity index 98%
rename from drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
rename to drivers/irqchip/irq-gic-v3-its-fsl-mc-msi.c
index b365fbb..13a5d9a 100644
--- a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
+++ b/drivers/irqchip/irq-gic-v3-its-fsl-mc-msi.c
@@ -43,9 +43,7 @@ static int its_fsl_mc_msi_prepare(struct irq_domain 
*msi_domain,
 * NOTE: This device id corresponds to the IOMMU stream ID
 * associated with the DPRC object (ICID).
 */
-#ifdef GENERIC_MSI_DOMAIN_OPS
info->scratchpad[0].ul = mc_bus_dev->icid;
-#endif
msi_info = msi_get_domain_info(msi_domain->parent);
return msi_info->ops->msi_prepare(msi_domain->parent, dev, nvec, info);
 }
diff --git a/drivers/staging/fsl-mc/bus/Makefile 
b/drivers/staging/fsl-mc/bus/Makefile
index 18b1b5f..b67889e 100644
--- a/drivers/staging/fsl-mc/bus/Makefile
+++ b/drivers/staging/fsl-mc/bus/Makefile
@@ -4,8 +4,7 @@
 #
 # Copyright (C) 2014 Freescale Semiconductor, Inc.
 #
-obj-$(CONFIG_FSL_MC_BUS) += irq-gic-v3-its-fsl-mc-msi.o \
-   dpbp.o \
+obj-$(CONFIG_FSL_MC_BUS) += dpbp.o \
dpcon.o
 
 # MC DPIO driver
-- 
2.7.4



RE: [PATCH v5 1/2] staging: fsl-mc: Move core bus out of staging

2018-01-26 Thread Bogdan Purcareata
> -Original Message-
> From: Greg KH [mailto:gre...@linuxfoundation.org]
> Sent: Friday, January 26, 2018 4:06 PM
> To: Bogdan Purcareata <bogdan.purcare...@nxp.com>
> Cc: Laurentiu Tudor <laurentiu.tu...@nxp.com>; Ruxandra Ioana Ciocoi Radulescu
> <ruxandra.radule...@nxp.com>; stuyo...@gmail.com; a...@arndb.de;
> r...@kernel.org; Ioana Ciornei <ioana.cior...@nxp.com>; Nipun Gupta
> <nipun.gu...@nxp.com>; Roy Pledge <roy.ple...@nxp.com>; Horia Geantă
> <horia.gea...@nxp.com>; marc.zyng...@arm.com; t...@linutronix.de;
> ja...@lakedaemon.net; de...@driverdev.osuosl.org; 
> linux-kernel@vger.kernel.org;
> linux-arm-ker...@lists.infradead.org
> Subject: Re: [PATCH v5 1/2] staging: fsl-mc: Move core bus out of staging
> 
> On Fri, Jan 26, 2018 at 06:51:26AM -0600, Bogdan Purcareata wrote:
> > Move the source files out of staging into their final locations:
> >   -mc.h include file in drivers/staging/fsl-mc/include go to
> include/linux/fsl
> >   -source files in drivers/staging/fsl-mc/bus go to drivers/bus/fsl-mc
> >   -overview.rst, providing an overview of DPAA2, goes to
> >Documentation/networking/dpaa2/overview.rst
> >
> > Update or delete other remaining staging files -- Makefile, Kconfig, TODO.
> > Update dpaa2_eth and dpio staging drivers.
> > Add integration bits for the documentation build system.
> >
> > Signed-off-by: Stuart Yoder <stuyo...@gmail.com>
> > [rebased, add dpaa2_eth and dpio #include updates]
> > Signed-off-by: Laurentiu Tudor <laurentiu.tu...@nxp.com>
> > [rebased, split irqchip to separate patch]
> > Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
> > Cc: Thomas Gleixner <t...@linutronix.de>
> > Cc: Jason Cooper <ja...@lakedaemon.net>
> > Cc: Marc Zyngier <marc.zyng...@arm.com>
> > ---
> > Notes:
> > -v5:
> >   - split irqchip glue code to separate patch (GregKH)
> >   - integrate doc with the kernel build system
> > -v4:
> >   - regenerated patch with renames detection disabled (Andrew Lunn)
> > -v3:
> >   - rebased
> > -v2:
> >   - group irqchip gic its glue code together with the rest (Marc 
> > Zyngier)
> >
> >  Documentation/networking/dpaa2/index.rst   |   8 +
> >  Documentation/networking/dpaa2/overview.rst| 404 +
> >  Documentation/networking/index.rst |   1 +
> >  MAINTAINERS|   3 +-
> >  drivers/bus/Kconfig|   2 +
> >  drivers/bus/Makefile   |   4 +
> >  drivers/bus/fsl-mc/Kconfig |  16 +
> >  drivers/bus/fsl-mc/Makefile|  16 +
> >  drivers/bus/fsl-mc/dpmcp.c |  99 +++
> >  drivers/bus/fsl-mc/dprc-driver.c   | 809 ++
> >  drivers/bus/fsl-mc/dprc.c  | 532 
> >  drivers/bus/fsl-mc/fsl-mc-allocator.c  | 648 ++
> >  drivers/bus/fsl-mc/fsl-mc-bus.c| 948
> +
> >  drivers/bus/fsl-mc/fsl-mc-msi.c| 285 +++
> >  drivers/bus/fsl-mc/fsl-mc-private.h| 475 +++
> >  drivers/bus/fsl-mc/mc-io.c | 268 ++
> >  drivers/bus/fsl-mc/mc-sys.c| 296 +++
> >  drivers/staging/fsl-dpaa2/ethernet/README  |   2 +-
> >  drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c |   2 +-
> >  drivers/staging/fsl-dpaa2/ethernet/dpni.c  |   2 +-
> >  drivers/staging/fsl-mc/TODO|  18 -
> >  drivers/staging/fsl-mc/bus/Kconfig |  10 -
> >  drivers/staging/fsl-mc/bus/Makefile|  16 +-
> >  drivers/staging/fsl-mc/bus/dpbp.c  |   2 +-
> >  drivers/staging/fsl-mc/bus/dpcon.c |   2 +-
> >  drivers/staging/fsl-mc/bus/dpio/dpio-driver.c  |   2 +-
> >  drivers/staging/fsl-mc/bus/dpio/dpio-service.c |   2 +-
> >  drivers/staging/fsl-mc/bus/dpio/dpio.c |   2 +-
> >  drivers/staging/fsl-mc/bus/dpmcp.c |  99 ---
> >  drivers/staging/fsl-mc/bus/dprc-driver.c   | 809 --
> >  drivers/staging/fsl-mc/bus/dprc.c  | 531 
> >  drivers/staging/fsl-mc/bus/fsl-mc-allocator.c  | 648 --
> >  drivers/staging/fsl-mc/bus/fsl-mc-bus.c| 948 
> > ---
> --
> >  drivers/staging/fsl-mc/bus/fsl-mc-msi.c

RE: [PATCH v5 1/2] staging: fsl-mc: Move core bus out of staging

2018-01-26 Thread Bogdan Purcareata
> -Original Message-
> From: Greg KH [mailto:gre...@linuxfoundation.org]
> Sent: Friday, January 26, 2018 4:06 PM
> To: Bogdan Purcareata 
> Cc: Laurentiu Tudor ; Ruxandra Ioana Ciocoi Radulescu
> ; stuyo...@gmail.com; a...@arndb.de;
> r...@kernel.org; Ioana Ciornei ; Nipun Gupta
> ; Roy Pledge ; Horia Geantă
> ; marc.zyng...@arm.com; t...@linutronix.de;
> ja...@lakedaemon.net; de...@driverdev.osuosl.org; 
> linux-kernel@vger.kernel.org;
> linux-arm-ker...@lists.infradead.org
> Subject: Re: [PATCH v5 1/2] staging: fsl-mc: Move core bus out of staging
> 
> On Fri, Jan 26, 2018 at 06:51:26AM -0600, Bogdan Purcareata wrote:
> > Move the source files out of staging into their final locations:
> >   -mc.h include file in drivers/staging/fsl-mc/include go to
> include/linux/fsl
> >   -source files in drivers/staging/fsl-mc/bus go to drivers/bus/fsl-mc
> >   -overview.rst, providing an overview of DPAA2, goes to
> >Documentation/networking/dpaa2/overview.rst
> >
> > Update or delete other remaining staging files -- Makefile, Kconfig, TODO.
> > Update dpaa2_eth and dpio staging drivers.
> > Add integration bits for the documentation build system.
> >
> > Signed-off-by: Stuart Yoder 
> > [rebased, add dpaa2_eth and dpio #include updates]
> > Signed-off-by: Laurentiu Tudor 
> > [rebased, split irqchip to separate patch]
> > Signed-off-by: Bogdan Purcareata 
> > Cc: Thomas Gleixner 
> > Cc: Jason Cooper 
> > Cc: Marc Zyngier 
> > ---
> > Notes:
> > -v5:
> >   - split irqchip glue code to separate patch (GregKH)
> >   - integrate doc with the kernel build system
> > -v4:
> >   - regenerated patch with renames detection disabled (Andrew Lunn)
> > -v3:
> >   - rebased
> > -v2:
> >   - group irqchip gic its glue code together with the rest (Marc 
> > Zyngier)
> >
> >  Documentation/networking/dpaa2/index.rst   |   8 +
> >  Documentation/networking/dpaa2/overview.rst| 404 +
> >  Documentation/networking/index.rst |   1 +
> >  MAINTAINERS|   3 +-
> >  drivers/bus/Kconfig|   2 +
> >  drivers/bus/Makefile   |   4 +
> >  drivers/bus/fsl-mc/Kconfig |  16 +
> >  drivers/bus/fsl-mc/Makefile|  16 +
> >  drivers/bus/fsl-mc/dpmcp.c |  99 +++
> >  drivers/bus/fsl-mc/dprc-driver.c   | 809 ++
> >  drivers/bus/fsl-mc/dprc.c  | 532 
> >  drivers/bus/fsl-mc/fsl-mc-allocator.c  | 648 ++
> >  drivers/bus/fsl-mc/fsl-mc-bus.c| 948
> +
> >  drivers/bus/fsl-mc/fsl-mc-msi.c| 285 +++
> >  drivers/bus/fsl-mc/fsl-mc-private.h| 475 +++
> >  drivers/bus/fsl-mc/mc-io.c | 268 ++
> >  drivers/bus/fsl-mc/mc-sys.c| 296 +++
> >  drivers/staging/fsl-dpaa2/ethernet/README  |   2 +-
> >  drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c |   2 +-
> >  drivers/staging/fsl-dpaa2/ethernet/dpni.c  |   2 +-
> >  drivers/staging/fsl-mc/TODO|  18 -
> >  drivers/staging/fsl-mc/bus/Kconfig |  10 -
> >  drivers/staging/fsl-mc/bus/Makefile|  16 +-
> >  drivers/staging/fsl-mc/bus/dpbp.c  |   2 +-
> >  drivers/staging/fsl-mc/bus/dpcon.c |   2 +-
> >  drivers/staging/fsl-mc/bus/dpio/dpio-driver.c  |   2 +-
> >  drivers/staging/fsl-mc/bus/dpio/dpio-service.c |   2 +-
> >  drivers/staging/fsl-mc/bus/dpio/dpio.c |   2 +-
> >  drivers/staging/fsl-mc/bus/dpmcp.c |  99 ---
> >  drivers/staging/fsl-mc/bus/dprc-driver.c   | 809 --
> >  drivers/staging/fsl-mc/bus/dprc.c  | 531 
> >  drivers/staging/fsl-mc/bus/fsl-mc-allocator.c  | 648 --
> >  drivers/staging/fsl-mc/bus/fsl-mc-bus.c| 948 
> > ---
> --
> >  drivers/staging/fsl-mc/bus/fsl-mc-msi.c| 284 --
> >  drivers/staging/fsl-mc/bus/fsl-mc-private.h| 475 ---
> >  .../staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c |   2 +-
> >  drivers/staging/fsl-mc/bus/mc-io.c | 268 --
> >  drivers/staging/fsl-mc/bus/mc-sys.c| 296 ---
> >  drivers/staging/fsl-mc/include/mc.h   

[PATCH v5 2/2] staging: fsl-mc: Move irqchip code out of staging

2018-01-26 Thread Bogdan Purcareata
Now that the fsl-mc bus core infrastructure is out of staging, the
remaining irqchip glue code used (irq-gic-v3-its-fsl-mc-msi.c) goes
to drivers/irqchip.

Signed-off-by: Stuart Yoder <stuyo...@gmail.com>
[rebased, add dpaa2_eth and dpio #include updates]
Signed-off-by: Laurentiu Tudor <laurentiu.tu...@nxp.com>
[rebased, split irqchip to separate patch]
Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
Cc: Thomas Gleixner <t...@linutronix.de>
Cc: Jason Cooper <ja...@lakedaemon.net>
Cc: Marc Zyngier <marc.zyng...@arm.com>
---
Notes:
-v5:
  - split irqchip glue code to separate patch (GregKH)
-v4 - v1:
  - no change

 drivers/irqchip/Makefile   |   1 +
 drivers/irqchip/irq-gic-v3-its-fsl-mc-msi.c| 100 +
 drivers/staging/fsl-mc/bus/Makefile|   3 +-
 .../staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c | 100 -
 4 files changed, 102 insertions(+), 102 deletions(-)
 create mode 100644 drivers/irqchip/irq-gic-v3-its-fsl-mc-msi.c
 delete mode 100644 drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c

diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile
index d2df34a..641d8a4 100644
--- a/drivers/irqchip/Makefile
+++ b/drivers/irqchip/Makefile
@@ -32,6 +32,7 @@ obj-$(CONFIG_ARM_GIC_V2M) += irq-gic-v2m.o
 obj-$(CONFIG_ARM_GIC_V3)   += irq-gic-v3.o irq-gic-common.o
 obj-$(CONFIG_ARM_GIC_V3_ITS)   += irq-gic-v3-its.o 
irq-gic-v3-its-platform-msi.o irq-gic-v4.o
 obj-$(CONFIG_ARM_GIC_V3_ITS_PCI)   += irq-gic-v3-its-pci-msi.o
+obj-$(CONFIG_FSL_MC_BUS)   += irq-gic-v3-its-fsl-mc-msi.o
 obj-$(CONFIG_PARTITION_PERCPU) += irq-partition-percpu.o
 obj-$(CONFIG_HISILICON_IRQ_MBIGEN) += irq-mbigen.o
 obj-$(CONFIG_ARM_NVIC) += irq-nvic.o
diff --git a/drivers/irqchip/irq-gic-v3-its-fsl-mc-msi.c 
b/drivers/irqchip/irq-gic-v3-its-fsl-mc-msi.c
new file mode 100644
index 000..b365fbb
--- /dev/null
+++ b/drivers/irqchip/irq-gic-v3-its-fsl-mc-msi.c
@@ -0,0 +1,100 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Freescale Management Complex (MC) bus driver MSI support
+ *
+ * Copyright (C) 2015-2016 Freescale Semiconductor, Inc.
+ * Author: German Rivera <german.riv...@freescale.com>
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static struct irq_chip its_msi_irq_chip = {
+   .name = "ITS-fMSI",
+   .irq_mask = irq_chip_mask_parent,
+   .irq_unmask = irq_chip_unmask_parent,
+   .irq_eoi = irq_chip_eoi_parent,
+   .irq_set_affinity = msi_domain_set_affinity
+};
+
+static int its_fsl_mc_msi_prepare(struct irq_domain *msi_domain,
+ struct device *dev,
+ int nvec, msi_alloc_info_t *info)
+{
+   struct fsl_mc_device *mc_bus_dev;
+   struct msi_domain_info *msi_info;
+
+   if (!dev_is_fsl_mc(dev))
+   return -EINVAL;
+
+   mc_bus_dev = to_fsl_mc_device(dev);
+   if (!(mc_bus_dev->flags & FSL_MC_IS_DPRC))
+   return -EINVAL;
+
+   /*
+* Set the device Id to be passed to the GIC-ITS:
+*
+* NOTE: This device id corresponds to the IOMMU stream ID
+* associated with the DPRC object (ICID).
+*/
+#ifdef GENERIC_MSI_DOMAIN_OPS
+   info->scratchpad[0].ul = mc_bus_dev->icid;
+#endif
+   msi_info = msi_get_domain_info(msi_domain->parent);
+   return msi_info->ops->msi_prepare(msi_domain->parent, dev, nvec, info);
+}
+
+static struct msi_domain_ops its_fsl_mc_msi_ops __ro_after_init = {
+   .msi_prepare = its_fsl_mc_msi_prepare,
+};
+
+static struct msi_domain_info its_fsl_mc_msi_domain_info = {
+   .flags  = (MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS),
+   .ops= _fsl_mc_msi_ops,
+   .chip   = _msi_irq_chip,
+};
+
+static const struct of_device_id its_device_id[] = {
+   {   .compatible = "arm,gic-v3-its", },
+   {},
+};
+
+static int __init its_fsl_mc_msi_init(void)
+{
+   struct device_node *np;
+   struct irq_domain *parent;
+   struct irq_domain *mc_msi_domain;
+
+   for (np = of_find_matching_node(NULL, its_device_id); np;
+np = of_find_matching_node(np, its_device_id)) {
+   if (!of_property_read_bool(np, "msi-controller"))
+   continue;
+
+   parent = irq_find_matching_host(np, DOMAIN_BUS_NEXUS);
+   if (!parent || !msi_get_domain_info(parent)) {
+   pr_err("%pOF: unable to locate ITS domain\n", np);
+   continue;
+   }
+
+   mc_msi_domain = fsl_mc_msi_create_irq_domain(
+of_node_to_fwnode(np),
+_fsl_mc_ms

[PATCH v5 0/2] staging: fsl-mc: Move bus driver out of staging

2018-01-26 Thread Bogdan Purcareata
Previous submission: https://patchwork.kernel.org/patch/10081731/

Most of the feedback was addressed by a separate series of cleanup
/ refactoring patches [1] which were applied.

The thing left to do is to split the original patch into moving out the
core bus infrastructure separate from the irqchip glue code, and
integrate the documentation with the kernel build system.

This patchset only handles moving the fsl-mc bus core out of staging.
The remaining objects (DPBP, DPCON) and drivers (dpio, dpaa2-eth) will
be moved out in subsequent patches.

[1] https://lkml.org/lkml/2018/1/16/386

Notes:
-v5:
  - split irqchip glue code to separate patch (GregKH)
  - integrate doc with the kernel build system
-v4:
  - regenerated patch with renames detection disabled (Andrew Lunn)
-v3:
  - rebased
-v2:
  - group irqchip gic its glue code together with the rest (Marc Zyngier)

Bogdan Purcareata (2):
  staging: fsl-mc: Move core bus out of staging
  staging: fsl-mc: Move irqchip code out of staging

 Documentation/networking/dpaa2/index.rst   |   8 +
 Documentation/networking/dpaa2/overview.rst| 404 +
 Documentation/networking/index.rst |   1 +
 MAINTAINERS|   3 +-
 drivers/bus/Kconfig|   2 +
 drivers/bus/Makefile   |   4 +
 drivers/bus/fsl-mc/Kconfig |  16 +
 drivers/bus/fsl-mc/Makefile|  16 +
 drivers/bus/fsl-mc/dpmcp.c |  99 +++
 drivers/bus/fsl-mc/dprc-driver.c   | 809 ++
 drivers/bus/fsl-mc/dprc.c  | 532 
 drivers/bus/fsl-mc/fsl-mc-allocator.c  | 648 ++
 drivers/bus/fsl-mc/fsl-mc-bus.c| 948 +
 drivers/bus/fsl-mc/fsl-mc-msi.c| 285 +++
 drivers/bus/fsl-mc/fsl-mc-private.h| 475 +++
 drivers/bus/fsl-mc/mc-io.c | 268 ++
 drivers/bus/fsl-mc/mc-sys.c| 296 +++
 drivers/irqchip/Makefile   |   1 +
 drivers/irqchip/irq-gic-v3-its-fsl-mc-msi.c| 100 +++
 drivers/staging/fsl-dpaa2/ethernet/README  |   2 +-
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c |   2 +-
 drivers/staging/fsl-dpaa2/ethernet/dpni.c  |   2 +-
 drivers/staging/fsl-mc/TODO|  18 -
 drivers/staging/fsl-mc/bus/Kconfig |  10 -
 drivers/staging/fsl-mc/bus/Makefile|  15 +-
 drivers/staging/fsl-mc/bus/dpbp.c  |   2 +-
 drivers/staging/fsl-mc/bus/dpcon.c |   2 +-
 drivers/staging/fsl-mc/bus/dpio/dpio-driver.c  |   2 +-
 drivers/staging/fsl-mc/bus/dpio/dpio-service.c |   2 +-
 drivers/staging/fsl-mc/bus/dpio/dpio.c |   2 +-
 drivers/staging/fsl-mc/bus/dpmcp.c |  99 ---
 drivers/staging/fsl-mc/bus/dprc-driver.c   | 809 --
 drivers/staging/fsl-mc/bus/dprc.c  | 531 
 drivers/staging/fsl-mc/bus/fsl-mc-allocator.c  | 648 --
 drivers/staging/fsl-mc/bus/fsl-mc-bus.c| 948 -
 drivers/staging/fsl-mc/bus/fsl-mc-msi.c| 284 --
 drivers/staging/fsl-mc/bus/fsl-mc-private.h| 475 ---
 .../staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c | 100 ---
 drivers/staging/fsl-mc/bus/mc-io.c | 268 --
 drivers/staging/fsl-mc/bus/mc-sys.c| 296 ---
 drivers/staging/fsl-mc/include/mc.h| 454 --
 drivers/staging/fsl-mc/overview.rst| 404 -
 include/linux/fsl/mc.h | 454 ++
 43 files changed, 5378 insertions(+), 5366 deletions(-)
 create mode 100644 Documentation/networking/dpaa2/index.rst
 create mode 100644 Documentation/networking/dpaa2/overview.rst
 create mode 100644 drivers/bus/fsl-mc/Kconfig
 create mode 100644 drivers/bus/fsl-mc/Makefile
 create mode 100644 drivers/bus/fsl-mc/dpmcp.c
 create mode 100644 drivers/bus/fsl-mc/dprc-driver.c
 create mode 100644 drivers/bus/fsl-mc/dprc.c
 create mode 100644 drivers/bus/fsl-mc/fsl-mc-allocator.c
 create mode 100644 drivers/bus/fsl-mc/fsl-mc-bus.c
 create mode 100644 drivers/bus/fsl-mc/fsl-mc-msi.c
 create mode 100644 drivers/bus/fsl-mc/fsl-mc-private.h
 create mode 100644 drivers/bus/fsl-mc/mc-io.c
 create mode 100644 drivers/bus/fsl-mc/mc-sys.c
 create mode 100644 drivers/irqchip/irq-gic-v3-its-fsl-mc-msi.c
 delete mode 100644 drivers/staging/fsl-mc/TODO
 delete mode 100644 drivers/staging/fsl-mc/bus/dpmcp.c
 delete mode 100644 drivers/staging/fsl-mc/bus/dprc-driver.c
 delete mode 100644 drivers/staging/fsl-mc/bus/dprc.c
 delete mode 100644 drivers/staging/fsl-mc/bus/fsl-mc-allocator.c
 delete mode 100644 drivers/staging/fsl-mc/bus/fsl-mc-bus.c
 delete

[PATCH v5 2/2] staging: fsl-mc: Move irqchip code out of staging

2018-01-26 Thread Bogdan Purcareata
Now that the fsl-mc bus core infrastructure is out of staging, the
remaining irqchip glue code used (irq-gic-v3-its-fsl-mc-msi.c) goes
to drivers/irqchip.

Signed-off-by: Stuart Yoder 
[rebased, add dpaa2_eth and dpio #include updates]
Signed-off-by: Laurentiu Tudor 
[rebased, split irqchip to separate patch]
Signed-off-by: Bogdan Purcareata 
Cc: Thomas Gleixner 
Cc: Jason Cooper 
Cc: Marc Zyngier 
---
Notes:
-v5:
  - split irqchip glue code to separate patch (GregKH)
-v4 - v1:
  - no change

 drivers/irqchip/Makefile   |   1 +
 drivers/irqchip/irq-gic-v3-its-fsl-mc-msi.c| 100 +
 drivers/staging/fsl-mc/bus/Makefile|   3 +-
 .../staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c | 100 -
 4 files changed, 102 insertions(+), 102 deletions(-)
 create mode 100644 drivers/irqchip/irq-gic-v3-its-fsl-mc-msi.c
 delete mode 100644 drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c

diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile
index d2df34a..641d8a4 100644
--- a/drivers/irqchip/Makefile
+++ b/drivers/irqchip/Makefile
@@ -32,6 +32,7 @@ obj-$(CONFIG_ARM_GIC_V2M) += irq-gic-v2m.o
 obj-$(CONFIG_ARM_GIC_V3)   += irq-gic-v3.o irq-gic-common.o
 obj-$(CONFIG_ARM_GIC_V3_ITS)   += irq-gic-v3-its.o 
irq-gic-v3-its-platform-msi.o irq-gic-v4.o
 obj-$(CONFIG_ARM_GIC_V3_ITS_PCI)   += irq-gic-v3-its-pci-msi.o
+obj-$(CONFIG_FSL_MC_BUS)   += irq-gic-v3-its-fsl-mc-msi.o
 obj-$(CONFIG_PARTITION_PERCPU) += irq-partition-percpu.o
 obj-$(CONFIG_HISILICON_IRQ_MBIGEN) += irq-mbigen.o
 obj-$(CONFIG_ARM_NVIC) += irq-nvic.o
diff --git a/drivers/irqchip/irq-gic-v3-its-fsl-mc-msi.c 
b/drivers/irqchip/irq-gic-v3-its-fsl-mc-msi.c
new file mode 100644
index 000..b365fbb
--- /dev/null
+++ b/drivers/irqchip/irq-gic-v3-its-fsl-mc-msi.c
@@ -0,0 +1,100 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Freescale Management Complex (MC) bus driver MSI support
+ *
+ * Copyright (C) 2015-2016 Freescale Semiconductor, Inc.
+ * Author: German Rivera 
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static struct irq_chip its_msi_irq_chip = {
+   .name = "ITS-fMSI",
+   .irq_mask = irq_chip_mask_parent,
+   .irq_unmask = irq_chip_unmask_parent,
+   .irq_eoi = irq_chip_eoi_parent,
+   .irq_set_affinity = msi_domain_set_affinity
+};
+
+static int its_fsl_mc_msi_prepare(struct irq_domain *msi_domain,
+ struct device *dev,
+ int nvec, msi_alloc_info_t *info)
+{
+   struct fsl_mc_device *mc_bus_dev;
+   struct msi_domain_info *msi_info;
+
+   if (!dev_is_fsl_mc(dev))
+   return -EINVAL;
+
+   mc_bus_dev = to_fsl_mc_device(dev);
+   if (!(mc_bus_dev->flags & FSL_MC_IS_DPRC))
+   return -EINVAL;
+
+   /*
+* Set the device Id to be passed to the GIC-ITS:
+*
+* NOTE: This device id corresponds to the IOMMU stream ID
+* associated with the DPRC object (ICID).
+*/
+#ifdef GENERIC_MSI_DOMAIN_OPS
+   info->scratchpad[0].ul = mc_bus_dev->icid;
+#endif
+   msi_info = msi_get_domain_info(msi_domain->parent);
+   return msi_info->ops->msi_prepare(msi_domain->parent, dev, nvec, info);
+}
+
+static struct msi_domain_ops its_fsl_mc_msi_ops __ro_after_init = {
+   .msi_prepare = its_fsl_mc_msi_prepare,
+};
+
+static struct msi_domain_info its_fsl_mc_msi_domain_info = {
+   .flags  = (MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS),
+   .ops= _fsl_mc_msi_ops,
+   .chip   = _msi_irq_chip,
+};
+
+static const struct of_device_id its_device_id[] = {
+   {   .compatible = "arm,gic-v3-its", },
+   {},
+};
+
+static int __init its_fsl_mc_msi_init(void)
+{
+   struct device_node *np;
+   struct irq_domain *parent;
+   struct irq_domain *mc_msi_domain;
+
+   for (np = of_find_matching_node(NULL, its_device_id); np;
+np = of_find_matching_node(np, its_device_id)) {
+   if (!of_property_read_bool(np, "msi-controller"))
+   continue;
+
+   parent = irq_find_matching_host(np, DOMAIN_BUS_NEXUS);
+   if (!parent || !msi_get_domain_info(parent)) {
+   pr_err("%pOF: unable to locate ITS domain\n", np);
+   continue;
+   }
+
+   mc_msi_domain = fsl_mc_msi_create_irq_domain(
+of_node_to_fwnode(np),
+_fsl_mc_msi_domain_info,
+parent);
+   if (!mc_msi_domain) {
+   pr_err("%pOF: unable to create fsl-mc domain\n", np);
+   con

[PATCH v5 0/2] staging: fsl-mc: Move bus driver out of staging

2018-01-26 Thread Bogdan Purcareata
Previous submission: https://patchwork.kernel.org/patch/10081731/

Most of the feedback was addressed by a separate series of cleanup
/ refactoring patches [1] which were applied.

The thing left to do is to split the original patch into moving out the
core bus infrastructure separate from the irqchip glue code, and
integrate the documentation with the kernel build system.

This patchset only handles moving the fsl-mc bus core out of staging.
The remaining objects (DPBP, DPCON) and drivers (dpio, dpaa2-eth) will
be moved out in subsequent patches.

[1] https://lkml.org/lkml/2018/1/16/386

Notes:
-v5:
  - split irqchip glue code to separate patch (GregKH)
  - integrate doc with the kernel build system
-v4:
  - regenerated patch with renames detection disabled (Andrew Lunn)
-v3:
  - rebased
-v2:
  - group irqchip gic its glue code together with the rest (Marc Zyngier)

Bogdan Purcareata (2):
  staging: fsl-mc: Move core bus out of staging
  staging: fsl-mc: Move irqchip code out of staging

 Documentation/networking/dpaa2/index.rst   |   8 +
 Documentation/networking/dpaa2/overview.rst| 404 +
 Documentation/networking/index.rst |   1 +
 MAINTAINERS|   3 +-
 drivers/bus/Kconfig|   2 +
 drivers/bus/Makefile   |   4 +
 drivers/bus/fsl-mc/Kconfig |  16 +
 drivers/bus/fsl-mc/Makefile|  16 +
 drivers/bus/fsl-mc/dpmcp.c |  99 +++
 drivers/bus/fsl-mc/dprc-driver.c   | 809 ++
 drivers/bus/fsl-mc/dprc.c  | 532 
 drivers/bus/fsl-mc/fsl-mc-allocator.c  | 648 ++
 drivers/bus/fsl-mc/fsl-mc-bus.c| 948 +
 drivers/bus/fsl-mc/fsl-mc-msi.c| 285 +++
 drivers/bus/fsl-mc/fsl-mc-private.h| 475 +++
 drivers/bus/fsl-mc/mc-io.c | 268 ++
 drivers/bus/fsl-mc/mc-sys.c| 296 +++
 drivers/irqchip/Makefile   |   1 +
 drivers/irqchip/irq-gic-v3-its-fsl-mc-msi.c| 100 +++
 drivers/staging/fsl-dpaa2/ethernet/README  |   2 +-
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c |   2 +-
 drivers/staging/fsl-dpaa2/ethernet/dpni.c  |   2 +-
 drivers/staging/fsl-mc/TODO|  18 -
 drivers/staging/fsl-mc/bus/Kconfig |  10 -
 drivers/staging/fsl-mc/bus/Makefile|  15 +-
 drivers/staging/fsl-mc/bus/dpbp.c  |   2 +-
 drivers/staging/fsl-mc/bus/dpcon.c |   2 +-
 drivers/staging/fsl-mc/bus/dpio/dpio-driver.c  |   2 +-
 drivers/staging/fsl-mc/bus/dpio/dpio-service.c |   2 +-
 drivers/staging/fsl-mc/bus/dpio/dpio.c |   2 +-
 drivers/staging/fsl-mc/bus/dpmcp.c |  99 ---
 drivers/staging/fsl-mc/bus/dprc-driver.c   | 809 --
 drivers/staging/fsl-mc/bus/dprc.c  | 531 
 drivers/staging/fsl-mc/bus/fsl-mc-allocator.c  | 648 --
 drivers/staging/fsl-mc/bus/fsl-mc-bus.c| 948 -
 drivers/staging/fsl-mc/bus/fsl-mc-msi.c| 284 --
 drivers/staging/fsl-mc/bus/fsl-mc-private.h| 475 ---
 .../staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c | 100 ---
 drivers/staging/fsl-mc/bus/mc-io.c | 268 --
 drivers/staging/fsl-mc/bus/mc-sys.c| 296 ---
 drivers/staging/fsl-mc/include/mc.h| 454 --
 drivers/staging/fsl-mc/overview.rst| 404 -
 include/linux/fsl/mc.h | 454 ++
 43 files changed, 5378 insertions(+), 5366 deletions(-)
 create mode 100644 Documentation/networking/dpaa2/index.rst
 create mode 100644 Documentation/networking/dpaa2/overview.rst
 create mode 100644 drivers/bus/fsl-mc/Kconfig
 create mode 100644 drivers/bus/fsl-mc/Makefile
 create mode 100644 drivers/bus/fsl-mc/dpmcp.c
 create mode 100644 drivers/bus/fsl-mc/dprc-driver.c
 create mode 100644 drivers/bus/fsl-mc/dprc.c
 create mode 100644 drivers/bus/fsl-mc/fsl-mc-allocator.c
 create mode 100644 drivers/bus/fsl-mc/fsl-mc-bus.c
 create mode 100644 drivers/bus/fsl-mc/fsl-mc-msi.c
 create mode 100644 drivers/bus/fsl-mc/fsl-mc-private.h
 create mode 100644 drivers/bus/fsl-mc/mc-io.c
 create mode 100644 drivers/bus/fsl-mc/mc-sys.c
 create mode 100644 drivers/irqchip/irq-gic-v3-its-fsl-mc-msi.c
 delete mode 100644 drivers/staging/fsl-mc/TODO
 delete mode 100644 drivers/staging/fsl-mc/bus/dpmcp.c
 delete mode 100644 drivers/staging/fsl-mc/bus/dprc-driver.c
 delete mode 100644 drivers/staging/fsl-mc/bus/dprc.c
 delete mode 100644 drivers/staging/fsl-mc/bus/fsl-mc-allocator.c
 delete mode 100644 drivers/staging/fsl-mc/bus/fsl-mc-bus.c
 delete

[PATCH v2] staging: fsl-mc: Add SPDX license identifiers

2018-01-17 Thread Bogdan Purcareata
The fsl-mc bus and dpio driver files use a combination of GPL-2.0 and
GPL-2.0+ OR BSD-3-Clause licenses. Add SPDX tags and delete the full
license text, keeping the existing license for each file. Add GPL-2.0
for Kconfig / Makefile, where not present.

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
Reviewed-by: Laurentiu Tudor <laurentiu.tu...@nxp.com>
---
v1 -> v2:
- keep existing license for each file, only update to use SPDX tags,
  don't change the license

 drivers/staging/fsl-mc/Kconfig |  1 +
 drivers/staging/fsl-mc/Makefile|  1 +
 drivers/staging/fsl-mc/bus/Kconfig |  3 +-
 drivers/staging/fsl-mc/bus/Makefile|  3 +-
 drivers/staging/fsl-mc/bus/dpbp-cmd.h  | 28 +--
 drivers/staging/fsl-mc/bus/dpbp.c  | 28 +--
 drivers/staging/fsl-mc/bus/dpcon-cmd.h | 28 +--
 drivers/staging/fsl-mc/bus/dpcon.c | 32 ++
 drivers/staging/fsl-mc/bus/dpio/Makefile   |  1 +
 drivers/staging/fsl-mc/bus/dpio/dpio-cmd.h | 28 +--
 drivers/staging/fsl-mc/bus/dpio/dpio-driver.c  | 27 +-
 drivers/staging/fsl-mc/bus/dpio/dpio-service.c | 27 +-
 drivers/staging/fsl-mc/bus/dpio/dpio.c | 28 +--
 drivers/staging/fsl-mc/bus/dpio/dpio.h | 28 +--
 drivers/staging/fsl-mc/bus/dpio/qbman-portal.c | 27 +-
 drivers/staging/fsl-mc/bus/dpio/qbman-portal.h | 27 +-
 drivers/staging/fsl-mc/bus/dpmcp.c | 28 +--
 drivers/staging/fsl-mc/bus/dprc-driver.c   |  4 +--
 drivers/staging/fsl-mc/bus/dprc.c  | 28 +--
 drivers/staging/fsl-mc/bus/fsl-mc-allocator.c  |  4 +--
 drivers/staging/fsl-mc/bus/fsl-mc-bus.c|  4 +--
 drivers/staging/fsl-mc/bus/fsl-mc-msi.c|  4 +--
 drivers/staging/fsl-mc/bus/fsl-mc-private.h|  4 +--
 .../staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c |  4 +--
 drivers/staging/fsl-mc/bus/mc-io.c | 28 +--
 drivers/staging/fsl-mc/bus/mc-sys.c| 28 +--
 drivers/staging/fsl-mc/include/dpaa2-fd.h  | 27 +-
 drivers/staging/fsl-mc/include/dpaa2-global.h  | 27 +-
 drivers/staging/fsl-mc/include/dpaa2-io.h  | 27 +-
 drivers/staging/fsl-mc/include/dpbp.h  | 29 +---
 drivers/staging/fsl-mc/include/dpcon.h | 32 ++
 drivers/staging/fsl-mc/include/mc.h|  4 +--
 32 files changed, 36 insertions(+), 563 deletions(-)

diff --git a/drivers/staging/fsl-mc/Kconfig b/drivers/staging/fsl-mc/Kconfig
index 32df07b..3002229 100644
--- a/drivers/staging/fsl-mc/Kconfig
+++ b/drivers/staging/fsl-mc/Kconfig
@@ -1 +1,2 @@
+# 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
index 9c6a001..1468388 100644
--- a/drivers/staging/fsl-mc/Makefile
+++ b/drivers/staging/fsl-mc/Makefile
@@ -1,2 +1,3 @@
+# 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
index 504c987..1f91000 100644
--- a/drivers/staging/fsl-mc/bus/Kconfig
+++ b/drivers/staging/fsl-mc/bus/Kconfig
@@ -1,10 +1,9 @@
+# SPDX-License-Identifier: GPL-2.0
 #
 # DPAA2 fsl-mc bus
 #
 # Copyright (C) 2014-2016 Freescale Semiconductor, Inc.
 #
-# This file is released under the GPLv2
-#
 
 config FSL_MC_BUS
bool "QorIQ DPAA2 fsl-mc bus driver"
diff --git a/drivers/staging/fsl-mc/bus/Makefile 
b/drivers/staging/fsl-mc/bus/Makefile
index 6df407e..29059db 100644
--- a/drivers/staging/fsl-mc/bus/Makefile
+++ b/drivers/staging/fsl-mc/bus/Makefile
@@ -1,10 +1,9 @@
+# SPDX-License-Identifier: GPL-2.0
 #
 # Freescale Management Complex (MC) bus drivers
 #
 # Copyright (C) 2014 Freescale Semiconductor, Inc.
 #
-# This file is released under the GPLv2
-#
 obj-$(CONFIG_FSL_MC_BUS) += mc-bus-driver.o
 
 mc-bus-driver-objs := fsl-mc-bus.o \
diff --git a/drivers/staging/fsl-mc/bus/dpbp-cmd.h 
b/drivers/staging/fsl-mc/bus/dpbp-cmd.h
index 5904836..0b7f5c0 100644
--- a/drivers/staging/fsl-mc/bus/dpbp-cmd.h
+++ b/drivers/staging/fsl-mc/bus/dpbp-cmd.h
@@ -1,33 +1,7 @@
+/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
 /*
  * Copyright 2013-2016 Freescale Semiconductor Inc.
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the followin

[PATCH v2] staging: fsl-mc: Add SPDX license identifiers

2018-01-17 Thread Bogdan Purcareata
The fsl-mc bus and dpio driver files use a combination of GPL-2.0 and
GPL-2.0+ OR BSD-3-Clause licenses. Add SPDX tags and delete the full
license text, keeping the existing license for each file. Add GPL-2.0
for Kconfig / Makefile, where not present.

Signed-off-by: Bogdan Purcareata 
Reviewed-by: Laurentiu Tudor 
---
v1 -> v2:
- keep existing license for each file, only update to use SPDX tags,
  don't change the license

 drivers/staging/fsl-mc/Kconfig |  1 +
 drivers/staging/fsl-mc/Makefile|  1 +
 drivers/staging/fsl-mc/bus/Kconfig |  3 +-
 drivers/staging/fsl-mc/bus/Makefile|  3 +-
 drivers/staging/fsl-mc/bus/dpbp-cmd.h  | 28 +--
 drivers/staging/fsl-mc/bus/dpbp.c  | 28 +--
 drivers/staging/fsl-mc/bus/dpcon-cmd.h | 28 +--
 drivers/staging/fsl-mc/bus/dpcon.c | 32 ++
 drivers/staging/fsl-mc/bus/dpio/Makefile   |  1 +
 drivers/staging/fsl-mc/bus/dpio/dpio-cmd.h | 28 +--
 drivers/staging/fsl-mc/bus/dpio/dpio-driver.c  | 27 +-
 drivers/staging/fsl-mc/bus/dpio/dpio-service.c | 27 +-
 drivers/staging/fsl-mc/bus/dpio/dpio.c | 28 +--
 drivers/staging/fsl-mc/bus/dpio/dpio.h | 28 +--
 drivers/staging/fsl-mc/bus/dpio/qbman-portal.c | 27 +-
 drivers/staging/fsl-mc/bus/dpio/qbman-portal.h | 27 +-
 drivers/staging/fsl-mc/bus/dpmcp.c | 28 +--
 drivers/staging/fsl-mc/bus/dprc-driver.c   |  4 +--
 drivers/staging/fsl-mc/bus/dprc.c  | 28 +--
 drivers/staging/fsl-mc/bus/fsl-mc-allocator.c  |  4 +--
 drivers/staging/fsl-mc/bus/fsl-mc-bus.c|  4 +--
 drivers/staging/fsl-mc/bus/fsl-mc-msi.c|  4 +--
 drivers/staging/fsl-mc/bus/fsl-mc-private.h|  4 +--
 .../staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c |  4 +--
 drivers/staging/fsl-mc/bus/mc-io.c | 28 +--
 drivers/staging/fsl-mc/bus/mc-sys.c| 28 +--
 drivers/staging/fsl-mc/include/dpaa2-fd.h  | 27 +-
 drivers/staging/fsl-mc/include/dpaa2-global.h  | 27 +-
 drivers/staging/fsl-mc/include/dpaa2-io.h  | 27 +-
 drivers/staging/fsl-mc/include/dpbp.h  | 29 +---
 drivers/staging/fsl-mc/include/dpcon.h | 32 ++
 drivers/staging/fsl-mc/include/mc.h|  4 +--
 32 files changed, 36 insertions(+), 563 deletions(-)

diff --git a/drivers/staging/fsl-mc/Kconfig b/drivers/staging/fsl-mc/Kconfig
index 32df07b..3002229 100644
--- a/drivers/staging/fsl-mc/Kconfig
+++ b/drivers/staging/fsl-mc/Kconfig
@@ -1 +1,2 @@
+# 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
index 9c6a001..1468388 100644
--- a/drivers/staging/fsl-mc/Makefile
+++ b/drivers/staging/fsl-mc/Makefile
@@ -1,2 +1,3 @@
+# 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
index 504c987..1f91000 100644
--- a/drivers/staging/fsl-mc/bus/Kconfig
+++ b/drivers/staging/fsl-mc/bus/Kconfig
@@ -1,10 +1,9 @@
+# SPDX-License-Identifier: GPL-2.0
 #
 # DPAA2 fsl-mc bus
 #
 # Copyright (C) 2014-2016 Freescale Semiconductor, Inc.
 #
-# This file is released under the GPLv2
-#
 
 config FSL_MC_BUS
bool "QorIQ DPAA2 fsl-mc bus driver"
diff --git a/drivers/staging/fsl-mc/bus/Makefile 
b/drivers/staging/fsl-mc/bus/Makefile
index 6df407e..29059db 100644
--- a/drivers/staging/fsl-mc/bus/Makefile
+++ b/drivers/staging/fsl-mc/bus/Makefile
@@ -1,10 +1,9 @@
+# SPDX-License-Identifier: GPL-2.0
 #
 # Freescale Management Complex (MC) bus drivers
 #
 # Copyright (C) 2014 Freescale Semiconductor, Inc.
 #
-# This file is released under the GPLv2
-#
 obj-$(CONFIG_FSL_MC_BUS) += mc-bus-driver.o
 
 mc-bus-driver-objs := fsl-mc-bus.o \
diff --git a/drivers/staging/fsl-mc/bus/dpbp-cmd.h 
b/drivers/staging/fsl-mc/bus/dpbp-cmd.h
index 5904836..0b7f5c0 100644
--- a/drivers/staging/fsl-mc/bus/dpbp-cmd.h
+++ b/drivers/staging/fsl-mc/bus/dpbp-cmd.h
@@ -1,33 +1,7 @@
+/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
 /*
  * Copyright 2013-2016 Freescale Semiconductor Inc.
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reprod

RE: [PATCH 3/8] staging: fsl-mc: Add SPDX license identifiers

2018-01-17 Thread Bogdan Purcareata
> -Original Message-
> From: Greg KH [mailto:gre...@linuxfoundation.org]
> Sent: Tuesday, January 16, 2018 5:13 PM
> To: Bogdan Purcareata <bogdan.purcare...@nxp.com>
> Cc: Laurentiu Tudor <laurentiu.tu...@nxp.com>; Ruxandra Ioana Ciocoi Radulescu
> <ruxandra.radule...@nxp.com>; de...@driverdev.osuosl.org; r...@kernel.org;
> stuyo...@gmail.com; a...@arndb.de; marc.zyng...@arm.com; Roy Pledge
> <roy.ple...@nxp.com>; Ioana Ciornei <ioana.cior...@nxp.com>; linux-
> ker...@vger.kernel.org; Horia Geantă <horia.gea...@nxp.com>; Nipun Gupta
> <nipun.gu...@nxp.com>; t...@linutronix.de; linux-arm-
> ker...@lists.infradead.org; ja...@lakedaemon.net
> Subject: Re: [PATCH 3/8] staging: fsl-mc: Add SPDX license identifiers
> 
> On Tue, Jan 16, 2018 at 03:19:05PM +0200, Bogdan Purcareata wrote:
> > diff --git a/drivers/staging/fsl-mc/bus/dpbp-cmd.h b/drivers/staging/fsl-
> mc/bus/dpbp-cmd.h
> > index 5904836..1ac8ec6 100644
> > --- a/drivers/staging/fsl-mc/bus/dpbp-cmd.h
> > +++ b/drivers/staging/fsl-mc/bus/dpbp-cmd.h
> > @@ -1,33 +1,8 @@
> > +/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
> 
> Hm, I don't think you want to do that.  How can a Linux driver subsytem
> that wraps calls to the kernel's driver core (which are GPL-only), be
> accessed by BSD-3 code?

For this particular file, the original license was dual GPL/BSD. The patch 
removes the license text and adds an equivalent SPDX tag.

> If I didn't know any better, I would think you were trying to create a
> "GPL Condom" here :)
> 
> Anyway, why all of the BSD-3 stuff here?  That makes no sense for kernel
> code at all, and this is a relicensing of the file, have you gotten
> legal approval of everyone that has modified the file while it was under
> the GPL-v2 only text to be able to change it to BSD-3 as well?

Previous to this patch, the files under drivers/staging/fsl-mc/ use a 
combination of GPL-2.0 and (GPL-2.0+ / BSD-3-Clause) licenses (expressed by the 
full license text). 

The original intent was to have an uniform dual license for all files. Before 
making this change, I have consulted the other current contributors, but based 
on your feedback, we think it's best to keep the current licenses.

> Careful, this is a _VERY_ tricky thing to do right.  I need a
> signed-off-by on this type of patch from your legal council to ensure
> that they know exactly what you are doing, and have reviewed it
> properly, before I can take it.
> 
> Hint, stick to the existing license in the files, it makes more sense,
> you are not going to be taking this code out of Linux and putting it
> anywhere.

I will send a v2 keeping the existing license for each file - removing the full 
license text and adding a SPDX tag. This way there will be no change from a 
legal standpoint.

Thank you for the feedback!

Bogdan


RE: [PATCH 3/8] staging: fsl-mc: Add SPDX license identifiers

2018-01-17 Thread Bogdan Purcareata
> -Original Message-
> From: Greg KH [mailto:gre...@linuxfoundation.org]
> Sent: Tuesday, January 16, 2018 5:13 PM
> To: Bogdan Purcareata 
> Cc: Laurentiu Tudor ; Ruxandra Ioana Ciocoi Radulescu
> ; de...@driverdev.osuosl.org; r...@kernel.org;
> stuyo...@gmail.com; a...@arndb.de; marc.zyng...@arm.com; Roy Pledge
> ; Ioana Ciornei ; linux-
> ker...@vger.kernel.org; Horia Geantă ; Nipun Gupta
> ; t...@linutronix.de; linux-arm-
> ker...@lists.infradead.org; ja...@lakedaemon.net
> Subject: Re: [PATCH 3/8] staging: fsl-mc: Add SPDX license identifiers
> 
> On Tue, Jan 16, 2018 at 03:19:05PM +0200, Bogdan Purcareata wrote:
> > diff --git a/drivers/staging/fsl-mc/bus/dpbp-cmd.h b/drivers/staging/fsl-
> mc/bus/dpbp-cmd.h
> > index 5904836..1ac8ec6 100644
> > --- a/drivers/staging/fsl-mc/bus/dpbp-cmd.h
> > +++ b/drivers/staging/fsl-mc/bus/dpbp-cmd.h
> > @@ -1,33 +1,8 @@
> > +/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
> 
> Hm, I don't think you want to do that.  How can a Linux driver subsytem
> that wraps calls to the kernel's driver core (which are GPL-only), be
> accessed by BSD-3 code?

For this particular file, the original license was dual GPL/BSD. The patch 
removes the license text and adds an equivalent SPDX tag.

> If I didn't know any better, I would think you were trying to create a
> "GPL Condom" here :)
> 
> Anyway, why all of the BSD-3 stuff here?  That makes no sense for kernel
> code at all, and this is a relicensing of the file, have you gotten
> legal approval of everyone that has modified the file while it was under
> the GPL-v2 only text to be able to change it to BSD-3 as well?

Previous to this patch, the files under drivers/staging/fsl-mc/ use a 
combination of GPL-2.0 and (GPL-2.0+ / BSD-3-Clause) licenses (expressed by the 
full license text). 

The original intent was to have an uniform dual license for all files. Before 
making this change, I have consulted the other current contributors, but based 
on your feedback, we think it's best to keep the current licenses.

> Careful, this is a _VERY_ tricky thing to do right.  I need a
> signed-off-by on this type of patch from your legal council to ensure
> that they know exactly what you are doing, and have reviewed it
> properly, before I can take it.
> 
> Hint, stick to the existing license in the files, it makes more sense,
> you are not going to be taking this code out of Linux and putting it
> anywhere.

I will send a v2 keeping the existing license for each file - removing the full 
license text and adding a SPDX tag. This way there will be no change from a 
legal standpoint.

Thank you for the feedback!

Bogdan


[PATCH 1/8] staging: fsl-mc: Cleanup dprc and dpmcp header files

2018-01-16 Thread Bogdan Purcareata
A lot of API and associated structures are not used by current code, so
remove them.

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
Reviewed-by: Laurentiu Tudor <laurentiu.tu...@nxp.com>
---
 drivers/staging/fsl-mc/bus/dpmcp-cmd.h |   2 -
 drivers/staging/fsl-mc/bus/dpmcp.c |  32 
 drivers/staging/fsl-mc/bus/dpmcp.h |   5 -
 drivers/staging/fsl-mc/bus/dprc-cmd.h  | 263 -
 drivers/staging/fsl-mc/bus/dprc.c  | 224 
 drivers/staging/fsl-mc/bus/dprc.h  |  65 
 6 files changed, 591 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/dpmcp-cmd.h 
b/drivers/staging/fsl-mc/bus/dpmcp-cmd.h
index 861b2a7..60fff6f 100644
--- a/drivers/staging/fsl-mc/bus/dpmcp-cmd.h
+++ b/drivers/staging/fsl-mc/bus/dpmcp-cmd.h
@@ -45,8 +45,6 @@
 /* Command IDs */
 #define DPMCP_CMDID_CLOSE  DPMCP_CMD(0x800)
 #define DPMCP_CMDID_OPEN   DPMCP_CMD(0x80b)
-#define DPMCP_CMDID_GET_API_VERSIONDPMCP_CMD(0xa0b)
-
 #define DPMCP_CMDID_RESET  DPMCP_CMD(0x005)
 
 struct dpmcp_cmd_open {
diff --git a/drivers/staging/fsl-mc/bus/dpmcp.c 
b/drivers/staging/fsl-mc/bus/dpmcp.c
index eea42f6..2989cc4 100644
--- a/drivers/staging/fsl-mc/bus/dpmcp.c
+++ b/drivers/staging/fsl-mc/bus/dpmcp.c
@@ -124,35 +124,3 @@ int dpmcp_reset(struct fsl_mc_io *mc_io,
/* send command to mc*/
return mc_send_command(mc_io, );
 }
-
-/**
- * dpmcp_get_api_version - Get Data Path Management Command Portal API version
- * @mc_io: Pointer to Mc portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @major_ver: Major version of Data Path Management Command Portal API
- * @minor_ver: Minor version of Data Path Management Command Portal API
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpmcp_get_api_version(struct fsl_mc_io *mc_io,
- u32 cmd_flags,
- u16 *major_ver,
- u16 *minor_ver)
-{
-   struct mc_command cmd = { 0 };
-   int err;
-
-   /* prepare command */
-   cmd.header = mc_encode_cmd_header(DPMCP_CMDID_GET_API_VERSION,
- cmd_flags, 0);
-
-   /* send command to mc */
-   err = mc_send_command(mc_io, );
-   if (err)
-   return err;
-
-   /* retrieve response parameters */
-   mc_cmd_read_api_version(, major_ver, minor_ver);
-
-   return 0;
-}
diff --git a/drivers/staging/fsl-mc/bus/dpmcp.h 
b/drivers/staging/fsl-mc/bus/dpmcp.h
index f616031..873a4d0 100644
--- a/drivers/staging/fsl-mc/bus/dpmcp.h
+++ b/drivers/staging/fsl-mc/bus/dpmcp.h
@@ -48,11 +48,6 @@ int dpmcp_close(struct fsl_mc_io *mc_io,
u32 cmd_flags,
u16 token);
 
-int dpmcp_get_api_version(struct fsl_mc_io *mc_io,
- u32 cmd_flags,
- u16 *major_ver,
- u16 *minor_ver);
-
 int dpmcp_reset(struct fsl_mc_io *mc_io,
u32 cmd_flags,
u16 token);
diff --git a/drivers/staging/fsl-mc/bus/dprc-cmd.h 
b/drivers/staging/fsl-mc/bus/dprc-cmd.h
index d9b2dcd..ab13175 100644
--- a/drivers/staging/fsl-mc/bus/dprc-cmd.h
+++ b/drivers/staging/fsl-mc/bus/dprc-cmd.h
@@ -58,56 +58,21 @@
 #define DPRC_CMDID_GET_ATTR DPRC_CMD(0x004)
 
 #define DPRC_CMDID_SET_IRQ  DPRC_CMD(0x010)
-#define DPRC_CMDID_GET_IRQ  DPRC_CMD(0x011)
 #define DPRC_CMDID_SET_IRQ_ENABLE   DPRC_CMD(0x012)
-#define DPRC_CMDID_GET_IRQ_ENABLE   DPRC_CMD(0x013)
 #define DPRC_CMDID_SET_IRQ_MASK DPRC_CMD(0x014)
-#define DPRC_CMDID_GET_IRQ_MASK DPRC_CMD(0x015)
 #define DPRC_CMDID_GET_IRQ_STATUS   DPRC_CMD(0x016)
 #define DPRC_CMDID_CLEAR_IRQ_STATUS DPRC_CMD(0x017)
 
 #define DPRC_CMDID_GET_CONT_ID  DPRC_CMD(0x830)
 #define DPRC_CMDID_GET_OBJ_COUNTDPRC_CMD(0x159)
 #define DPRC_CMDID_GET_OBJ  DPRC_CMD(0x15A)
-#define DPRC_CMDID_GET_RES_COUNTDPRC_CMD(0x15B)
 #define DPRC_CMDID_GET_OBJ_REG  DPRC_CMD(0x15E)
 #define DPRC_CMDID_SET_OBJ_IRQ  DPRC_CMD(0x15F)
-#define DPRC_CMDID_GET_OBJ_IRQ  DPRC_CMD(0x160)
 
 struct dprc_cmd_open {
__le32 container_id;
 };
 
-struct dprc_cmd_create_container {
-   /* cmd word 0 */
-   __le32 options;
-   __le16 icid;
-   __le16 pad0;
-   /* cmd word 1 */
-   __le32 pad1;
-   __le32 portal_id;
-   /* cmd words 2-3 */
-   u8 label[16];
-};
-
-struct dprc_rsp_create_container {
-   /* response word 0 */
-   __le64 pad0;
-   /* response word 1 */
-   __le32 child_container_id;
-   __le32 pad1;
-   /* response word 2 */
-   __le64 child_portal_addr;
-};
-
-struct dprc_cmd_destroy_container {
-   __le32 child_

[PATCH 2/8] staging: fsl-mc: Consolidate bus core header files

2018-01-16 Thread Bogdan Purcareata
The DPAA2 objects involved (DPMNG, DPMCP, DPRC) are used by the fsl-mc
bus infrastructure only, so group the APIs and structs into
fsl-mc-private.h.

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
Reviewed-by: Laurentiu Tudor <laurentiu.tu...@nxp.com>
---
 drivers/staging/fsl-mc/bus/dpmcp-cmd.h  |  54 
 drivers/staging/fsl-mc/bus/dpmcp.c  |   3 +-
 drivers/staging/fsl-mc/bus/dpmcp.h  |  55 -
 drivers/staging/fsl-mc/bus/dpmng-cmd.h  |  58 -
 drivers/staging/fsl-mc/bus/dprc-cmd.h   | 188 --
 drivers/staging/fsl-mc/bus/dprc-driver.c|   1 -
 drivers/staging/fsl-mc/bus/dprc.c   |   4 +-
 drivers/staging/fsl-mc/bus/dprc.h   | 203 ---
 drivers/staging/fsl-mc/bus/fsl-mc-bus.c |   2 -
 drivers/staging/fsl-mc/bus/fsl-mc-private.h | 369 +++-
 drivers/staging/fsl-mc/bus/mc-io.c  |   2 -
 drivers/staging/fsl-mc/bus/mc-sys.c |   2 +-
 12 files changed, 371 insertions(+), 570 deletions(-)
 delete mode 100644 drivers/staging/fsl-mc/bus/dpmcp-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/bus/dpmcp.h
 delete mode 100644 drivers/staging/fsl-mc/bus/dpmng-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/bus/dprc-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/bus/dprc.h

diff --git a/drivers/staging/fsl-mc/bus/dpmcp-cmd.h 
b/drivers/staging/fsl-mc/bus/dpmcp-cmd.h
deleted file mode 100644
index 60fff6f..000
--- a/drivers/staging/fsl-mc/bus/dpmcp-cmd.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2013-2016 Freescale Semiconductor Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the above-listed copyright holders nor the
- * names of any contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * ALTERNATIVELY, this software may be distributed under the terms of the
- * GNU General Public License ("GPL") as published by the Free Software
- * Foundation, either version 2 of that License or (at your option) any
- * later version.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef _FSL_DPMCP_CMD_H
-#define _FSL_DPMCP_CMD_H
-
-/* Minimal supported DPMCP Version */
-#define DPMCP_MIN_VER_MAJOR3
-#define DPMCP_MIN_VER_MINOR0
-
-/* Command versioning */
-#define DPMCP_CMD_BASE_VERSION 1
-#define DPMCP_CMD_ID_OFFSET4
-
-#define DPMCP_CMD(id)  (((id) << DPMCP_CMD_ID_OFFSET) | DPMCP_CMD_BASE_VERSION)
-
-/* Command IDs */
-#define DPMCP_CMDID_CLOSE  DPMCP_CMD(0x800)
-#define DPMCP_CMDID_OPEN   DPMCP_CMD(0x80b)
-#define DPMCP_CMDID_RESET  DPMCP_CMD(0x005)
-
-struct dpmcp_cmd_open {
-   __le32 dpmcp_id;
-};
-
-#endif /* _FSL_DPMCP_CMD_H */
diff --git a/drivers/staging/fsl-mc/bus/dpmcp.c 
b/drivers/staging/fsl-mc/bus/dpmcp.c
index 2989cc4..63b967c 100644
--- a/drivers/staging/fsl-mc/bus/dpmcp.c
+++ b/drivers/staging/fsl-mc/bus/dpmcp.c
@@ -32,8 +32,7 @@
 #include 
 #include "../include/mc.h"
 
-#include "dpmcp.h"
-#include "dpmcp-cmd.h"
+#include "fsl-mc-private.h"
 
 /**
  * dpmcp_open() - Open a control session for the specified object.
diff --git a/drivers/staging/fsl-mc/bus/dpmcp.h 
b/drivers/staging/fsl-mc/bus/dpmcp.h
deleted file mode 100644
index 873a4d0..000
--- a/drivers/staging/fsl-mc/bus/dpmcp.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2013-2016 Freescale Semiconductor Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the ab

[PATCH 1/8] staging: fsl-mc: Cleanup dprc and dpmcp header files

2018-01-16 Thread Bogdan Purcareata
A lot of API and associated structures are not used by current code, so
remove them.

Signed-off-by: Bogdan Purcareata 
Reviewed-by: Laurentiu Tudor 
---
 drivers/staging/fsl-mc/bus/dpmcp-cmd.h |   2 -
 drivers/staging/fsl-mc/bus/dpmcp.c |  32 
 drivers/staging/fsl-mc/bus/dpmcp.h |   5 -
 drivers/staging/fsl-mc/bus/dprc-cmd.h  | 263 -
 drivers/staging/fsl-mc/bus/dprc.c  | 224 
 drivers/staging/fsl-mc/bus/dprc.h  |  65 
 6 files changed, 591 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/dpmcp-cmd.h 
b/drivers/staging/fsl-mc/bus/dpmcp-cmd.h
index 861b2a7..60fff6f 100644
--- a/drivers/staging/fsl-mc/bus/dpmcp-cmd.h
+++ b/drivers/staging/fsl-mc/bus/dpmcp-cmd.h
@@ -45,8 +45,6 @@
 /* Command IDs */
 #define DPMCP_CMDID_CLOSE  DPMCP_CMD(0x800)
 #define DPMCP_CMDID_OPEN   DPMCP_CMD(0x80b)
-#define DPMCP_CMDID_GET_API_VERSIONDPMCP_CMD(0xa0b)
-
 #define DPMCP_CMDID_RESET  DPMCP_CMD(0x005)
 
 struct dpmcp_cmd_open {
diff --git a/drivers/staging/fsl-mc/bus/dpmcp.c 
b/drivers/staging/fsl-mc/bus/dpmcp.c
index eea42f6..2989cc4 100644
--- a/drivers/staging/fsl-mc/bus/dpmcp.c
+++ b/drivers/staging/fsl-mc/bus/dpmcp.c
@@ -124,35 +124,3 @@ int dpmcp_reset(struct fsl_mc_io *mc_io,
/* send command to mc*/
return mc_send_command(mc_io, );
 }
-
-/**
- * dpmcp_get_api_version - Get Data Path Management Command Portal API version
- * @mc_io: Pointer to Mc portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @major_ver: Major version of Data Path Management Command Portal API
- * @minor_ver: Minor version of Data Path Management Command Portal API
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpmcp_get_api_version(struct fsl_mc_io *mc_io,
- u32 cmd_flags,
- u16 *major_ver,
- u16 *minor_ver)
-{
-   struct mc_command cmd = { 0 };
-   int err;
-
-   /* prepare command */
-   cmd.header = mc_encode_cmd_header(DPMCP_CMDID_GET_API_VERSION,
- cmd_flags, 0);
-
-   /* send command to mc */
-   err = mc_send_command(mc_io, );
-   if (err)
-   return err;
-
-   /* retrieve response parameters */
-   mc_cmd_read_api_version(, major_ver, minor_ver);
-
-   return 0;
-}
diff --git a/drivers/staging/fsl-mc/bus/dpmcp.h 
b/drivers/staging/fsl-mc/bus/dpmcp.h
index f616031..873a4d0 100644
--- a/drivers/staging/fsl-mc/bus/dpmcp.h
+++ b/drivers/staging/fsl-mc/bus/dpmcp.h
@@ -48,11 +48,6 @@ int dpmcp_close(struct fsl_mc_io *mc_io,
u32 cmd_flags,
u16 token);
 
-int dpmcp_get_api_version(struct fsl_mc_io *mc_io,
- u32 cmd_flags,
- u16 *major_ver,
- u16 *minor_ver);
-
 int dpmcp_reset(struct fsl_mc_io *mc_io,
u32 cmd_flags,
u16 token);
diff --git a/drivers/staging/fsl-mc/bus/dprc-cmd.h 
b/drivers/staging/fsl-mc/bus/dprc-cmd.h
index d9b2dcd..ab13175 100644
--- a/drivers/staging/fsl-mc/bus/dprc-cmd.h
+++ b/drivers/staging/fsl-mc/bus/dprc-cmd.h
@@ -58,56 +58,21 @@
 #define DPRC_CMDID_GET_ATTR DPRC_CMD(0x004)
 
 #define DPRC_CMDID_SET_IRQ  DPRC_CMD(0x010)
-#define DPRC_CMDID_GET_IRQ  DPRC_CMD(0x011)
 #define DPRC_CMDID_SET_IRQ_ENABLE   DPRC_CMD(0x012)
-#define DPRC_CMDID_GET_IRQ_ENABLE   DPRC_CMD(0x013)
 #define DPRC_CMDID_SET_IRQ_MASK DPRC_CMD(0x014)
-#define DPRC_CMDID_GET_IRQ_MASK DPRC_CMD(0x015)
 #define DPRC_CMDID_GET_IRQ_STATUS   DPRC_CMD(0x016)
 #define DPRC_CMDID_CLEAR_IRQ_STATUS DPRC_CMD(0x017)
 
 #define DPRC_CMDID_GET_CONT_ID  DPRC_CMD(0x830)
 #define DPRC_CMDID_GET_OBJ_COUNTDPRC_CMD(0x159)
 #define DPRC_CMDID_GET_OBJ  DPRC_CMD(0x15A)
-#define DPRC_CMDID_GET_RES_COUNTDPRC_CMD(0x15B)
 #define DPRC_CMDID_GET_OBJ_REG  DPRC_CMD(0x15E)
 #define DPRC_CMDID_SET_OBJ_IRQ  DPRC_CMD(0x15F)
-#define DPRC_CMDID_GET_OBJ_IRQ  DPRC_CMD(0x160)
 
 struct dprc_cmd_open {
__le32 container_id;
 };
 
-struct dprc_cmd_create_container {
-   /* cmd word 0 */
-   __le32 options;
-   __le16 icid;
-   __le16 pad0;
-   /* cmd word 1 */
-   __le32 pad1;
-   __le32 portal_id;
-   /* cmd words 2-3 */
-   u8 label[16];
-};
-
-struct dprc_rsp_create_container {
-   /* response word 0 */
-   __le64 pad0;
-   /* response word 1 */
-   __le32 child_container_id;
-   __le32 pad1;
-   /* response word 2 */
-   __le64 child_portal_addr;
-};
-
-struct dprc_cmd_destroy_container {
-   __le32 child_container_id;
-};
-
-struct dprc_cmd_reset_container

[PATCH 2/8] staging: fsl-mc: Consolidate bus core header files

2018-01-16 Thread Bogdan Purcareata
The DPAA2 objects involved (DPMNG, DPMCP, DPRC) are used by the fsl-mc
bus infrastructure only, so group the APIs and structs into
fsl-mc-private.h.

Signed-off-by: Bogdan Purcareata 
Reviewed-by: Laurentiu Tudor 
---
 drivers/staging/fsl-mc/bus/dpmcp-cmd.h  |  54 
 drivers/staging/fsl-mc/bus/dpmcp.c  |   3 +-
 drivers/staging/fsl-mc/bus/dpmcp.h  |  55 -
 drivers/staging/fsl-mc/bus/dpmng-cmd.h  |  58 -
 drivers/staging/fsl-mc/bus/dprc-cmd.h   | 188 --
 drivers/staging/fsl-mc/bus/dprc-driver.c|   1 -
 drivers/staging/fsl-mc/bus/dprc.c   |   4 +-
 drivers/staging/fsl-mc/bus/dprc.h   | 203 ---
 drivers/staging/fsl-mc/bus/fsl-mc-bus.c |   2 -
 drivers/staging/fsl-mc/bus/fsl-mc-private.h | 369 +++-
 drivers/staging/fsl-mc/bus/mc-io.c  |   2 -
 drivers/staging/fsl-mc/bus/mc-sys.c |   2 +-
 12 files changed, 371 insertions(+), 570 deletions(-)
 delete mode 100644 drivers/staging/fsl-mc/bus/dpmcp-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/bus/dpmcp.h
 delete mode 100644 drivers/staging/fsl-mc/bus/dpmng-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/bus/dprc-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/bus/dprc.h

diff --git a/drivers/staging/fsl-mc/bus/dpmcp-cmd.h 
b/drivers/staging/fsl-mc/bus/dpmcp-cmd.h
deleted file mode 100644
index 60fff6f..000
--- a/drivers/staging/fsl-mc/bus/dpmcp-cmd.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2013-2016 Freescale Semiconductor Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the above-listed copyright holders nor the
- * names of any contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * ALTERNATIVELY, this software may be distributed under the terms of the
- * GNU General Public License ("GPL") as published by the Free Software
- * Foundation, either version 2 of that License or (at your option) any
- * later version.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef _FSL_DPMCP_CMD_H
-#define _FSL_DPMCP_CMD_H
-
-/* Minimal supported DPMCP Version */
-#define DPMCP_MIN_VER_MAJOR3
-#define DPMCP_MIN_VER_MINOR0
-
-/* Command versioning */
-#define DPMCP_CMD_BASE_VERSION 1
-#define DPMCP_CMD_ID_OFFSET4
-
-#define DPMCP_CMD(id)  (((id) << DPMCP_CMD_ID_OFFSET) | DPMCP_CMD_BASE_VERSION)
-
-/* Command IDs */
-#define DPMCP_CMDID_CLOSE  DPMCP_CMD(0x800)
-#define DPMCP_CMDID_OPEN   DPMCP_CMD(0x80b)
-#define DPMCP_CMDID_RESET  DPMCP_CMD(0x005)
-
-struct dpmcp_cmd_open {
-   __le32 dpmcp_id;
-};
-
-#endif /* _FSL_DPMCP_CMD_H */
diff --git a/drivers/staging/fsl-mc/bus/dpmcp.c 
b/drivers/staging/fsl-mc/bus/dpmcp.c
index 2989cc4..63b967c 100644
--- a/drivers/staging/fsl-mc/bus/dpmcp.c
+++ b/drivers/staging/fsl-mc/bus/dpmcp.c
@@ -32,8 +32,7 @@
 #include 
 #include "../include/mc.h"
 
-#include "dpmcp.h"
-#include "dpmcp-cmd.h"
+#include "fsl-mc-private.h"
 
 /**
  * dpmcp_open() - Open a control session for the specified object.
diff --git a/drivers/staging/fsl-mc/bus/dpmcp.h 
b/drivers/staging/fsl-mc/bus/dpmcp.h
deleted file mode 100644
index 873a4d0..000
--- a/drivers/staging/fsl-mc/bus/dpmcp.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2013-2016 Freescale Semiconductor Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * *

[PATCH 7/8] staging: fsl-mc: README cleanup

2018-01-16 Thread Bogdan Purcareata
From: Ioana Radulescu 

Minor cosmetic changes to the DPAA2 overview documentation file.
Add a reference to the mc-bus driver sysfs documentation.

Signed-off-by: Ioana Radulescu 
Reviewed-by: Laurentiu Tudor 
---
 drivers/staging/fsl-mc/README.txt | 33 +
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/fsl-mc/README.txt 
b/drivers/staging/fsl-mc/README.txt
index 524eda1..0ea5cd7 100644
--- a/drivers/staging/fsl-mc/README.txt
+++ b/drivers/staging/fsl-mc/README.txt
@@ -1,7 +1,7 @@
 Copyright (C) 2015 Freescale Semiconductor Inc.
 
-DPAA2 (Data Path Acceleration Architecture Gen2)
-
+DPAA2 (Data Path Acceleration Architecture Gen2) Overview
+-
 
 This document provides an overview of the Freescale DPAA2 architecture
 and how it is integrated into the Linux kernel.
@@ -17,8 +17,8 @@ Contents summary
 -Ethernet
 -MAC
 
-DPAA2 Overview
---
+Introduction
+
 
 DPAA2 is a hardware architecture designed for high-speeed network
 packet processing.  DPAA2 consists of sophisticated mechanisms for
@@ -35,7 +35,7 @@ network ports to create functional objects/devices such as 
network
 interfaces, an L2 switch, or accelerator instances.
 
 The MC provides memory-mapped I/O command interfaces (MC portals)
-which DPAA2 software drivers use to operate on DPAA2 objects:
+which DPAA2 software drivers use to operate on DPAA2 objects.
 
 The diagram below shows an overview of the DPAA2 resource management
 architecture:
@@ -130,8 +130,7 @@ in creating a network interfaces.
 level.
 
 DPRCs can be defined statically and populated with objects
-via a config file passed to the MC when firmware starts
-it.
+via a config file passed to the MC when firmware starts it.
 
 -DPAA2 Objects for an Ethernet Network Interface
 
@@ -217,8 +216,8 @@ in creating a network interfaces.
-IRQs: command completion
-commands: IRQ config, enable, reset
 
-Object Connections
---
+Object Connections
+--
 Some objects have explicit relationships that must
 be configured:
 
@@ -242,8 +241,8 @@ in creating a network interfaces.
   Ethernet driver configures the DPBPs associated with
   the network interface.
 
-Interrupts
---
+Interrupts
+--
 All interrupts generated by DPAA2 objects are message
 interrupts.  At the hardware level message interrupts
 generated by devices will normally have 3 components--
@@ -255,8 +254,8 @@ in creating a network interfaces.
 For ARM-based SoC this is the same as the stream ID.
 
 
-DPAA2 Linux Driver Overview

+DPAA2 Linux Drivers Overview
+
 
 This section provides an overview of the Linux kernel drivers for
 DPAA2-- 1) the bus driver and associated "DPAA2 infrastructure"
@@ -291,7 +290,7 @@ of each driver follows.
   ++--+ |  +--+---+
   |   MC-bus driver   | |  | PHY  |
   |   | |  |driver|
-  | /soc/fsl-mc   | |  +--+---+
+  | /bus/fsl-mc   | |  +--+---+
   +---+ | |
 | |
   HARDWARE =|=|==
@@ -322,6 +321,8 @@ A brief description of each driver is provided below.
 a bind of the root DPRC to the DPRC driver
 The binding for the MC-bus device-tree node can be consulted here:
 Documentation/devicetree/bindings/misc/fsl,qoriq-mc.txt
+The sysfs bind/unbind interfaces for the MC-bus can be consulted here:
+Documentation/ABI/testing/sysfs-bus-fsl-mc*
 
 DPRC driver
 ---
@@ -366,8 +367,8 @@ A brief description of each driver is provided below.
 active in the kernel--  Ethernet, crypto, compression,
 etc.
 
-Ethernet
-
+Ethernet driver
+---
 The Ethernet driver is bound to a DPNI and implements the kernel
 interfaces needed to connect the DPAA2 network interface to
 the network stack.
-- 
2.7.4



[PATCH 7/8] staging: fsl-mc: README cleanup

2018-01-16 Thread Bogdan Purcareata
From: Ioana Radulescu 

Minor cosmetic changes to the DPAA2 overview documentation file.
Add a reference to the mc-bus driver sysfs documentation.

Signed-off-by: Ioana Radulescu 
Reviewed-by: Laurentiu Tudor 
---
 drivers/staging/fsl-mc/README.txt | 33 +
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/fsl-mc/README.txt 
b/drivers/staging/fsl-mc/README.txt
index 524eda1..0ea5cd7 100644
--- a/drivers/staging/fsl-mc/README.txt
+++ b/drivers/staging/fsl-mc/README.txt
@@ -1,7 +1,7 @@
 Copyright (C) 2015 Freescale Semiconductor Inc.
 
-DPAA2 (Data Path Acceleration Architecture Gen2)
-
+DPAA2 (Data Path Acceleration Architecture Gen2) Overview
+-
 
 This document provides an overview of the Freescale DPAA2 architecture
 and how it is integrated into the Linux kernel.
@@ -17,8 +17,8 @@ Contents summary
 -Ethernet
 -MAC
 
-DPAA2 Overview
---
+Introduction
+
 
 DPAA2 is a hardware architecture designed for high-speeed network
 packet processing.  DPAA2 consists of sophisticated mechanisms for
@@ -35,7 +35,7 @@ network ports to create functional objects/devices such as 
network
 interfaces, an L2 switch, or accelerator instances.
 
 The MC provides memory-mapped I/O command interfaces (MC portals)
-which DPAA2 software drivers use to operate on DPAA2 objects:
+which DPAA2 software drivers use to operate on DPAA2 objects.
 
 The diagram below shows an overview of the DPAA2 resource management
 architecture:
@@ -130,8 +130,7 @@ in creating a network interfaces.
 level.
 
 DPRCs can be defined statically and populated with objects
-via a config file passed to the MC when firmware starts
-it.
+via a config file passed to the MC when firmware starts it.
 
 -DPAA2 Objects for an Ethernet Network Interface
 
@@ -217,8 +216,8 @@ in creating a network interfaces.
-IRQs: command completion
-commands: IRQ config, enable, reset
 
-Object Connections
---
+Object Connections
+--
 Some objects have explicit relationships that must
 be configured:
 
@@ -242,8 +241,8 @@ in creating a network interfaces.
   Ethernet driver configures the DPBPs associated with
   the network interface.
 
-Interrupts
---
+Interrupts
+--
 All interrupts generated by DPAA2 objects are message
 interrupts.  At the hardware level message interrupts
 generated by devices will normally have 3 components--
@@ -255,8 +254,8 @@ in creating a network interfaces.
 For ARM-based SoC this is the same as the stream ID.
 
 
-DPAA2 Linux Driver Overview

+DPAA2 Linux Drivers Overview
+
 
 This section provides an overview of the Linux kernel drivers for
 DPAA2-- 1) the bus driver and associated "DPAA2 infrastructure"
@@ -291,7 +290,7 @@ of each driver follows.
   ++--+ |  +--+---+
   |   MC-bus driver   | |  | PHY  |
   |   | |  |driver|
-  | /soc/fsl-mc   | |  +--+---+
+  | /bus/fsl-mc   | |  +--+---+
   +---+ | |
 | |
   HARDWARE =|=|==
@@ -322,6 +321,8 @@ A brief description of each driver is provided below.
 a bind of the root DPRC to the DPRC driver
 The binding for the MC-bus device-tree node can be consulted here:
 Documentation/devicetree/bindings/misc/fsl,qoriq-mc.txt
+The sysfs bind/unbind interfaces for the MC-bus can be consulted here:
+Documentation/ABI/testing/sysfs-bus-fsl-mc*
 
 DPRC driver
 ---
@@ -366,8 +367,8 @@ A brief description of each driver is provided below.
 active in the kernel--  Ethernet, crypto, compression,
 etc.
 
-Ethernet
-
+Ethernet driver
+---
 The Ethernet driver is bound to a DPNI and implements the kernel
 interfaces needed to connect the DPAA2 network interface to
 the network stack.
-- 
2.7.4



[PATCH 8/8] staging: fsl-mc: Convert documentation to rst format

2018-01-16 Thread Bogdan Purcareata
From: Ioana Radulescu 

Update the doc file to comply with the rst format.

It's not integrated into the documentation build structure yet,
since it's still located in drivers/staging.

Signed-off-by: Ioana Radulescu 
Reviewed-by: Laurentiu Tudor 
---
 drivers/staging/fsl-mc/README.txt   | 387 --
 drivers/staging/fsl-mc/overview.rst | 404 
 2 files changed, 404 insertions(+), 387 deletions(-)
 delete mode 100644 drivers/staging/fsl-mc/README.txt
 create mode 100644 drivers/staging/fsl-mc/overview.rst

diff --git a/drivers/staging/fsl-mc/README.txt 
b/drivers/staging/fsl-mc/README.txt
deleted file mode 100644
index 0ea5cd7..000
--- a/drivers/staging/fsl-mc/README.txt
+++ /dev/null
@@ -1,387 +0,0 @@
-Copyright (C) 2015 Freescale Semiconductor Inc.
-
-DPAA2 (Data Path Acceleration Architecture Gen2) Overview
--
-
-This document provides an overview of the Freescale DPAA2 architecture
-and how it is integrated into the Linux kernel.
-
-Contents summary
-   -DPAA2 overview
-   -Overview of DPAA2 objects
-   -DPAA2 Linux driver architecture overview
--bus driver
--DPRC driver
--allocator
--DPIO driver
--Ethernet
--MAC
-
-Introduction
-
-
-DPAA2 is a hardware architecture designed for high-speeed network
-packet processing.  DPAA2 consists of sophisticated mechanisms for
-processing Ethernet packets, queue management, buffer management,
-autonomous L2 switching, virtual Ethernet bridging, and accelerator
-(e.g. crypto) sharing.
-
-A DPAA2 hardware component called the Management Complex (or MC) manages the
-DPAA2 hardware resources.  The MC provides an object-based abstraction for
-software drivers to use the DPAA2 hardware.
-
-The MC uses DPAA2 hardware resources such as queues, buffer pools, and
-network ports to create functional objects/devices such as network
-interfaces, an L2 switch, or accelerator instances.
-
-The MC provides memory-mapped I/O command interfaces (MC portals)
-which DPAA2 software drivers use to operate on DPAA2 objects.
-
-The diagram below shows an overview of the DPAA2 resource management
-architecture:
-
- +--+
- |  OS  |
- |DPAA2 drivers |
- | ||
- +-|+
-   |
-   | (create,discover,connect
-   |  config,use,destroy)
-   |
- DPAA2 |
- +| mc portal |-+
- | ||
- |   +- - - - - - - - - - - - -V- - -+  |
- |   |   |  |
- |   |   Management Complex (MC) |  |
- |   |   |  |
- |   +- - - - - - - - - - - - - - - -+  |
- |  |
- | Hardware  Hardware   |
- | Resources Objects|
- | - ---|
- | -queues   -DPRC  |
- | -buffer pools -DPMCP |
- | -Eth MACs/ports   -DPIO  |
- | -network interface-DPNI  |
- |  profiles -DPMAC |
- | -queue portals-DPBP  |
- | -MC portals...   |
- |  ... |
- |  |
- +--+
-
-The MC mediates operations such as create, discover,
-connect, configuration, and destroy.  Fast-path operations
-on data, such as packet transmit/receive, are not mediated by
-the MC and are done directly using memory mapped regions in
-DPIO objects.
-
-Overview of DPAA2 Objects
--
-The section provides a brief overview of some key DPAA2 objects.
-A simple scenario is described illustrating the objects involved
-in creating a network interfaces.
-
--DPRC (Datapath Resource Container)
-
-A DPRC is a container object that holds all the other
-types of DPAA2 objects.  In the example diagram below there
-are 8 objects of 5 types (DPMCP, DPIO, DPBP, DPNI, and DPMAC)
-in the container.
-
-+-+
-| DPRC|
-| |
-|  +---+  +---+  +---+  +---+  +---+  |
-|  | DPMCP |  | DPIO  |  | DPBP  |  | DPNI  |  | DPMAC |  |
-|  +---+  

[PATCH 8/8] staging: fsl-mc: Convert documentation to rst format

2018-01-16 Thread Bogdan Purcareata
From: Ioana Radulescu 

Update the doc file to comply with the rst format.

It's not integrated into the documentation build structure yet,
since it's still located in drivers/staging.

Signed-off-by: Ioana Radulescu 
Reviewed-by: Laurentiu Tudor 
---
 drivers/staging/fsl-mc/README.txt   | 387 --
 drivers/staging/fsl-mc/overview.rst | 404 
 2 files changed, 404 insertions(+), 387 deletions(-)
 delete mode 100644 drivers/staging/fsl-mc/README.txt
 create mode 100644 drivers/staging/fsl-mc/overview.rst

diff --git a/drivers/staging/fsl-mc/README.txt 
b/drivers/staging/fsl-mc/README.txt
deleted file mode 100644
index 0ea5cd7..000
--- a/drivers/staging/fsl-mc/README.txt
+++ /dev/null
@@ -1,387 +0,0 @@
-Copyright (C) 2015 Freescale Semiconductor Inc.
-
-DPAA2 (Data Path Acceleration Architecture Gen2) Overview
--
-
-This document provides an overview of the Freescale DPAA2 architecture
-and how it is integrated into the Linux kernel.
-
-Contents summary
-   -DPAA2 overview
-   -Overview of DPAA2 objects
-   -DPAA2 Linux driver architecture overview
--bus driver
--DPRC driver
--allocator
--DPIO driver
--Ethernet
--MAC
-
-Introduction
-
-
-DPAA2 is a hardware architecture designed for high-speeed network
-packet processing.  DPAA2 consists of sophisticated mechanisms for
-processing Ethernet packets, queue management, buffer management,
-autonomous L2 switching, virtual Ethernet bridging, and accelerator
-(e.g. crypto) sharing.
-
-A DPAA2 hardware component called the Management Complex (or MC) manages the
-DPAA2 hardware resources.  The MC provides an object-based abstraction for
-software drivers to use the DPAA2 hardware.
-
-The MC uses DPAA2 hardware resources such as queues, buffer pools, and
-network ports to create functional objects/devices such as network
-interfaces, an L2 switch, or accelerator instances.
-
-The MC provides memory-mapped I/O command interfaces (MC portals)
-which DPAA2 software drivers use to operate on DPAA2 objects.
-
-The diagram below shows an overview of the DPAA2 resource management
-architecture:
-
- +--+
- |  OS  |
- |DPAA2 drivers |
- | ||
- +-|+
-   |
-   | (create,discover,connect
-   |  config,use,destroy)
-   |
- DPAA2 |
- +| mc portal |-+
- | ||
- |   +- - - - - - - - - - - - -V- - -+  |
- |   |   |  |
- |   |   Management Complex (MC) |  |
- |   |   |  |
- |   +- - - - - - - - - - - - - - - -+  |
- |  |
- | Hardware  Hardware   |
- | Resources Objects|
- | - ---|
- | -queues   -DPRC  |
- | -buffer pools -DPMCP |
- | -Eth MACs/ports   -DPIO  |
- | -network interface-DPNI  |
- |  profiles -DPMAC |
- | -queue portals-DPBP  |
- | -MC portals...   |
- |  ... |
- |  |
- +--+
-
-The MC mediates operations such as create, discover,
-connect, configuration, and destroy.  Fast-path operations
-on data, such as packet transmit/receive, are not mediated by
-the MC and are done directly using memory mapped regions in
-DPIO objects.
-
-Overview of DPAA2 Objects
--
-The section provides a brief overview of some key DPAA2 objects.
-A simple scenario is described illustrating the objects involved
-in creating a network interfaces.
-
--DPRC (Datapath Resource Container)
-
-A DPRC is a container object that holds all the other
-types of DPAA2 objects.  In the example diagram below there
-are 8 objects of 5 types (DPMCP, DPIO, DPBP, DPNI, and DPMAC)
-in the container.
-
-+-+
-| DPRC|
-| |
-|  +---+  +---+  +---+  +---+  +---+  |
-|  | DPMCP |  | DPIO  |  | DPBP  |  | DPNI  |  | DPMAC |  |
-|  +---+  +---+  +---+  +---+---+  +---+---+  |
-|  | DPMCP |  | DPIO  |  

[PATCH 5/8] staging: fsl-mc: Remove unnecessary dependency

2018-01-16 Thread Bogdan Purcareata
From: Ioana Radulescu 

The function that enables fsl-mc msi interrupts doesn't need
to be explicitly called from the fsl-mc bus driver initialization
routine.

Mark it to be independently called at system init; this is in line
with how things are handled by other GICv3 irqchip users.

Due to this change we now have an unused cleanup function, so
remove it.

Signed-off-by: Ioana Radulescu 
Reviewed-by: Laurentiu Tudor 
---
 drivers/staging/fsl-mc/bus/fsl-mc-allocator.c  | 5 -
 drivers/staging/fsl-mc/bus/fsl-mc-bus.c| 7 ---
 drivers/staging/fsl-mc/bus/fsl-mc-private.h| 4 
 drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c | 2 ++
 4 files changed, 2 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c 
b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c
index 041d341..b9f5a56 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c
@@ -647,8 +647,3 @@ int __init fsl_mc_allocator_driver_init(void)
 {
return fsl_mc_driver_register(_mc_allocator_driver);
 }
-
-void fsl_mc_allocator_driver_exit(void)
-{
-   fsl_mc_driver_unregister(_mc_allocator_driver);
-}
diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c 
b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
index 0d010aa..9cb08c2 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
@@ -932,15 +932,8 @@ static int __init fsl_mc_bus_driver_init(void)
if (error < 0)
goto error_cleanup_dprc_driver;
 
-   error = its_fsl_mc_msi_init();
-   if (error < 0)
-   goto error_cleanup_mc_allocator;
-
return 0;
 
-error_cleanup_mc_allocator:
-   fsl_mc_allocator_driver_exit();
-
 error_cleanup_dprc_driver:
dprc_driver_exit();
 
diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-private.h 
b/drivers/staging/fsl-mc/bus/fsl-mc-private.h
index a74186e..7e50cd4 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-private.h
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-private.h
@@ -439,8 +439,6 @@ void dprc_driver_exit(void);
 
 int __init fsl_mc_allocator_driver_init(void);
 
-void fsl_mc_allocator_driver_exit(void);
-
 void fsl_mc_init_all_resource_pools(struct fsl_mc_device *mc_bus_dev);
 
 void fsl_mc_cleanup_all_resource_pools(struct fsl_mc_device *mc_bus_dev);
@@ -457,8 +455,6 @@ int fsl_mc_msi_domain_alloc_irqs(struct device *dev,
 
 void fsl_mc_msi_domain_free_irqs(struct device *dev);
 
-int __init its_fsl_mc_msi_init(void);
-
 int fsl_mc_find_msi_domain(struct device *mc_platform_dev,
   struct irq_domain **mc_msi_domain);
 
diff --git a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c 
b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
index 097c401f..506fce1 100644
--- a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
+++ b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
@@ -97,3 +97,5 @@ int __init its_fsl_mc_msi_init(void)
 
return 0;
 }
+
+early_initcall(its_fsl_mc_msi_init);
-- 
2.7.4



[PATCH 5/8] staging: fsl-mc: Remove unnecessary dependency

2018-01-16 Thread Bogdan Purcareata
From: Ioana Radulescu 

The function that enables fsl-mc msi interrupts doesn't need
to be explicitly called from the fsl-mc bus driver initialization
routine.

Mark it to be independently called at system init; this is in line
with how things are handled by other GICv3 irqchip users.

Due to this change we now have an unused cleanup function, so
remove it.

Signed-off-by: Ioana Radulescu 
Reviewed-by: Laurentiu Tudor 
---
 drivers/staging/fsl-mc/bus/fsl-mc-allocator.c  | 5 -
 drivers/staging/fsl-mc/bus/fsl-mc-bus.c| 7 ---
 drivers/staging/fsl-mc/bus/fsl-mc-private.h| 4 
 drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c | 2 ++
 4 files changed, 2 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c 
b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c
index 041d341..b9f5a56 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c
@@ -647,8 +647,3 @@ int __init fsl_mc_allocator_driver_init(void)
 {
return fsl_mc_driver_register(_mc_allocator_driver);
 }
-
-void fsl_mc_allocator_driver_exit(void)
-{
-   fsl_mc_driver_unregister(_mc_allocator_driver);
-}
diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c 
b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
index 0d010aa..9cb08c2 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
@@ -932,15 +932,8 @@ static int __init fsl_mc_bus_driver_init(void)
if (error < 0)
goto error_cleanup_dprc_driver;
 
-   error = its_fsl_mc_msi_init();
-   if (error < 0)
-   goto error_cleanup_mc_allocator;
-
return 0;
 
-error_cleanup_mc_allocator:
-   fsl_mc_allocator_driver_exit();
-
 error_cleanup_dprc_driver:
dprc_driver_exit();
 
diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-private.h 
b/drivers/staging/fsl-mc/bus/fsl-mc-private.h
index a74186e..7e50cd4 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-private.h
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-private.h
@@ -439,8 +439,6 @@ void dprc_driver_exit(void);
 
 int __init fsl_mc_allocator_driver_init(void);
 
-void fsl_mc_allocator_driver_exit(void);
-
 void fsl_mc_init_all_resource_pools(struct fsl_mc_device *mc_bus_dev);
 
 void fsl_mc_cleanup_all_resource_pools(struct fsl_mc_device *mc_bus_dev);
@@ -457,8 +455,6 @@ int fsl_mc_msi_domain_alloc_irqs(struct device *dev,
 
 void fsl_mc_msi_domain_free_irqs(struct device *dev);
 
-int __init its_fsl_mc_msi_init(void);
-
 int fsl_mc_find_msi_domain(struct device *mc_platform_dev,
   struct irq_domain **mc_msi_domain);
 
diff --git a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c 
b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
index 097c401f..506fce1 100644
--- a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
+++ b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
@@ -97,3 +97,5 @@ int __init its_fsl_mc_msi_init(void)
 
return 0;
 }
+
+early_initcall(its_fsl_mc_msi_init);
-- 
2.7.4



[PATCH 6/8] staging: fsl-mc: Update include header

2018-01-16 Thread Bogdan Purcareata
From: Ioana Radulescu 

With the declarations of its_fsl_mc_msi_init/cleanup() now removed
from fsl-mc-private.h, irq-gic-v3-its-fsl-mc-msi.c only needs a
couple of definitions from mc.h, so include that header directly.

Signed-off-by: Ioana Radulescu 
Reviewed-by: Laurentiu Tudor 
---
 drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c 
b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
index 506fce1..12734dd 100644
--- a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
+++ b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
@@ -14,7 +14,7 @@
 #include 
 #include 
 #include 
-#include "fsl-mc-private.h"
+#include "../include/mc.h"
 
 static struct irq_chip its_msi_irq_chip = {
.name = "ITS-fMSI",
-- 
2.7.4



[PATCH 6/8] staging: fsl-mc: Update include header

2018-01-16 Thread Bogdan Purcareata
From: Ioana Radulescu 

With the declarations of its_fsl_mc_msi_init/cleanup() now removed
from fsl-mc-private.h, irq-gic-v3-its-fsl-mc-msi.c only needs a
couple of definitions from mc.h, so include that header directly.

Signed-off-by: Ioana Radulescu 
Reviewed-by: Laurentiu Tudor 
---
 drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c 
b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
index 506fce1..12734dd 100644
--- a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
+++ b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
@@ -14,7 +14,7 @@
 #include 
 #include 
 #include 
-#include "fsl-mc-private.h"
+#include "../include/mc.h"
 
 static struct irq_chip its_msi_irq_chip = {
.name = "ITS-fMSI",
-- 
2.7.4



[PATCH 4/8] staging: fsl-mc: Remove dead code

2018-01-16 Thread Bogdan Purcareata
From: Ioana Radulescu 

Remove one unused function from irq-gic-v3-its-fsl-mc-msi.c

Signed-off-by: Ioana Radulescu 
Reviewed-by: Laurentiu Tudor 
---
 drivers/staging/fsl-mc/bus/fsl-mc-private.h   |  2 --
 .../staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c| 19 ---
 2 files changed, 21 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-private.h 
b/drivers/staging/fsl-mc/bus/fsl-mc-private.h
index 4023c4f..a74186e 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-private.h
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-private.h
@@ -459,8 +459,6 @@ void fsl_mc_msi_domain_free_irqs(struct device *dev);
 
 int __init its_fsl_mc_msi_init(void);
 
-void its_fsl_mc_msi_cleanup(void);
-
 int fsl_mc_find_msi_domain(struct device *mc_platform_dev,
   struct irq_domain **mc_msi_domain);
 
diff --git a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c 
b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
index bbef06f..097c401f 100644
--- a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
+++ b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
@@ -97,22 +97,3 @@ int __init its_fsl_mc_msi_init(void)
 
return 0;
 }
-
-void its_fsl_mc_msi_cleanup(void)
-{
-   struct device_node *np;
-
-   for (np = of_find_matching_node(NULL, its_device_id); np;
-np = of_find_matching_node(np, its_device_id)) {
-   struct irq_domain *mc_msi_domain = irq_find_matching_host(
-   np,
-   DOMAIN_BUS_FSL_MC_MSI);
-
-   if (!of_property_read_bool(np, "msi-controller"))
-   continue;
-
-   if (mc_msi_domain &&
-   mc_msi_domain->host_data == _fsl_mc_msi_domain_info)
-   irq_domain_remove(mc_msi_domain);
-   }
-}
-- 
2.7.4



[PATCH 4/8] staging: fsl-mc: Remove dead code

2018-01-16 Thread Bogdan Purcareata
From: Ioana Radulescu 

Remove one unused function from irq-gic-v3-its-fsl-mc-msi.c

Signed-off-by: Ioana Radulescu 
Reviewed-by: Laurentiu Tudor 
---
 drivers/staging/fsl-mc/bus/fsl-mc-private.h   |  2 --
 .../staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c| 19 ---
 2 files changed, 21 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-private.h 
b/drivers/staging/fsl-mc/bus/fsl-mc-private.h
index 4023c4f..a74186e 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-private.h
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-private.h
@@ -459,8 +459,6 @@ void fsl_mc_msi_domain_free_irqs(struct device *dev);
 
 int __init its_fsl_mc_msi_init(void);
 
-void its_fsl_mc_msi_cleanup(void);
-
 int fsl_mc_find_msi_domain(struct device *mc_platform_dev,
   struct irq_domain **mc_msi_domain);
 
diff --git a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c 
b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
index bbef06f..097c401f 100644
--- a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
+++ b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
@@ -97,22 +97,3 @@ int __init its_fsl_mc_msi_init(void)
 
return 0;
 }
-
-void its_fsl_mc_msi_cleanup(void)
-{
-   struct device_node *np;
-
-   for (np = of_find_matching_node(NULL, its_device_id); np;
-np = of_find_matching_node(np, its_device_id)) {
-   struct irq_domain *mc_msi_domain = irq_find_matching_host(
-   np,
-   DOMAIN_BUS_FSL_MC_MSI);
-
-   if (!of_property_read_bool(np, "msi-controller"))
-   continue;
-
-   if (mc_msi_domain &&
-   mc_msi_domain->host_data == _fsl_mc_msi_domain_info)
-   irq_domain_remove(mc_msi_domain);
-   }
-}
-- 
2.7.4



[PATCH 3/8] staging: fsl-mc: Add SPDX license identifiers

2018-01-16 Thread Bogdan Purcareata
The fsl-mc bus and dpio driver files use a combination of GPL-2.0 and
GPL-2.0+ OR BSD-3-Clause licenses. Update to latter for all files. Add SPDX
tags and delete the full license text. Update copyright information.

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
Reviewed-by: Laurentiu Tudor <laurentiu.tu...@nxp.com>
---
 drivers/staging/fsl-mc/Kconfig |  1 +
 drivers/staging/fsl-mc/Makefile|  1 +
 drivers/staging/fsl-mc/bus/Kconfig |  3 +-
 drivers/staging/fsl-mc/bus/Makefile|  3 +-
 drivers/staging/fsl-mc/bus/dpbp-cmd.h  | 29 ++-
 drivers/staging/fsl-mc/bus/dpbp.c  | 29 ++-
 drivers/staging/fsl-mc/bus/dpcon-cmd.h | 29 ++-
 drivers/staging/fsl-mc/bus/dpcon.c | 33 +++---
 drivers/staging/fsl-mc/bus/dpio/Makefile   |  1 +
 drivers/staging/fsl-mc/bus/dpio/dpio-cmd.h | 30 ++--
 drivers/staging/fsl-mc/bus/dpio/dpio-driver.c  | 29 ++-
 drivers/staging/fsl-mc/bus/dpio/dpio-service.c | 29 ++-
 drivers/staging/fsl-mc/bus/dpio/dpio.c | 30 ++--
 drivers/staging/fsl-mc/bus/dpio/dpio.h | 30 ++--
 drivers/staging/fsl-mc/bus/dpio/qbman-portal.c | 29 ++-
 drivers/staging/fsl-mc/bus/dpio/qbman-portal.h | 29 ++-
 drivers/staging/fsl-mc/bus/dpmcp.c | 29 ++-
 drivers/staging/fsl-mc/bus/dprc-driver.c   |  5 ++--
 drivers/staging/fsl-mc/bus/dprc.c  | 29 ++-
 drivers/staging/fsl-mc/bus/fsl-mc-allocator.c  |  5 ++--
 drivers/staging/fsl-mc/bus/fsl-mc-bus.c|  5 ++--
 drivers/staging/fsl-mc/bus/fsl-mc-msi.c|  5 ++--
 drivers/staging/fsl-mc/bus/fsl-mc-private.h|  5 ++--
 .../staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c |  5 ++--
 drivers/staging/fsl-mc/bus/mc-io.c | 29 ++-
 drivers/staging/fsl-mc/bus/mc-sys.c| 29 ++-
 drivers/staging/fsl-mc/include/dpaa2-fd.h  | 29 ++-
 drivers/staging/fsl-mc/include/dpaa2-global.h  | 29 ++-
 drivers/staging/fsl-mc/include/dpaa2-io.h  | 29 ++-
 drivers/staging/fsl-mc/include/dpbp.h  | 30 ++--
 drivers/staging/fsl-mc/include/dpcon.h | 33 +++---
 drivers/staging/fsl-mc/include/mc.h|  5 ++--
 32 files changed, 63 insertions(+), 573 deletions(-)

diff --git a/drivers/staging/fsl-mc/Kconfig b/drivers/staging/fsl-mc/Kconfig
index 32df07b..d4bab69 100644
--- a/drivers/staging/fsl-mc/Kconfig
+++ b/drivers/staging/fsl-mc/Kconfig
@@ -1 +1,2 @@
+# SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
 source "drivers/staging/fsl-mc/bus/Kconfig"
diff --git a/drivers/staging/fsl-mc/Makefile b/drivers/staging/fsl-mc/Makefile
index 9c6a001..d717b41 100644
--- a/drivers/staging/fsl-mc/Makefile
+++ b/drivers/staging/fsl-mc/Makefile
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
 # 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
index 504c987..9adb2a6 100644
--- a/drivers/staging/fsl-mc/bus/Kconfig
+++ b/drivers/staging/fsl-mc/bus/Kconfig
@@ -1,10 +1,9 @@
+# SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
 #
 # DPAA2 fsl-mc bus
 #
 # Copyright (C) 2014-2016 Freescale Semiconductor, Inc.
 #
-# This file is released under the GPLv2
-#
 
 config FSL_MC_BUS
bool "QorIQ DPAA2 fsl-mc bus driver"
diff --git a/drivers/staging/fsl-mc/bus/Makefile 
b/drivers/staging/fsl-mc/bus/Makefile
index 6df407e..cdf319f 100644
--- a/drivers/staging/fsl-mc/bus/Makefile
+++ b/drivers/staging/fsl-mc/bus/Makefile
@@ -1,10 +1,9 @@
+# SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
 #
 # Freescale Management Complex (MC) bus drivers
 #
 # Copyright (C) 2014 Freescale Semiconductor, Inc.
 #
-# This file is released under the GPLv2
-#
 obj-$(CONFIG_FSL_MC_BUS) += mc-bus-driver.o
 
 mc-bus-driver-objs := fsl-mc-bus.o \
diff --git a/drivers/staging/fsl-mc/bus/dpbp-cmd.h 
b/drivers/staging/fsl-mc/bus/dpbp-cmd.h
index 5904836..1ac8ec6 100644
--- a/drivers/staging/fsl-mc/bus/dpbp-cmd.h
+++ b/drivers/staging/fsl-mc/bus/dpbp-cmd.h
@@ -1,33 +1,8 @@
+/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
 /*
  * Copyright 2013-2016 Freescale Semiconductor Inc.
+ * Copyright 2016-2017 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.
- * * Red

[PATCH 3/8] staging: fsl-mc: Add SPDX license identifiers

2018-01-16 Thread Bogdan Purcareata
The fsl-mc bus and dpio driver files use a combination of GPL-2.0 and
GPL-2.0+ OR BSD-3-Clause licenses. Update to latter for all files. Add SPDX
tags and delete the full license text. Update copyright information.

Signed-off-by: Bogdan Purcareata 
Reviewed-by: Laurentiu Tudor 
---
 drivers/staging/fsl-mc/Kconfig |  1 +
 drivers/staging/fsl-mc/Makefile|  1 +
 drivers/staging/fsl-mc/bus/Kconfig |  3 +-
 drivers/staging/fsl-mc/bus/Makefile|  3 +-
 drivers/staging/fsl-mc/bus/dpbp-cmd.h  | 29 ++-
 drivers/staging/fsl-mc/bus/dpbp.c  | 29 ++-
 drivers/staging/fsl-mc/bus/dpcon-cmd.h | 29 ++-
 drivers/staging/fsl-mc/bus/dpcon.c | 33 +++---
 drivers/staging/fsl-mc/bus/dpio/Makefile   |  1 +
 drivers/staging/fsl-mc/bus/dpio/dpio-cmd.h | 30 ++--
 drivers/staging/fsl-mc/bus/dpio/dpio-driver.c  | 29 ++-
 drivers/staging/fsl-mc/bus/dpio/dpio-service.c | 29 ++-
 drivers/staging/fsl-mc/bus/dpio/dpio.c | 30 ++--
 drivers/staging/fsl-mc/bus/dpio/dpio.h | 30 ++--
 drivers/staging/fsl-mc/bus/dpio/qbman-portal.c | 29 ++-
 drivers/staging/fsl-mc/bus/dpio/qbman-portal.h | 29 ++-
 drivers/staging/fsl-mc/bus/dpmcp.c | 29 ++-
 drivers/staging/fsl-mc/bus/dprc-driver.c   |  5 ++--
 drivers/staging/fsl-mc/bus/dprc.c  | 29 ++-
 drivers/staging/fsl-mc/bus/fsl-mc-allocator.c  |  5 ++--
 drivers/staging/fsl-mc/bus/fsl-mc-bus.c|  5 ++--
 drivers/staging/fsl-mc/bus/fsl-mc-msi.c|  5 ++--
 drivers/staging/fsl-mc/bus/fsl-mc-private.h|  5 ++--
 .../staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c |  5 ++--
 drivers/staging/fsl-mc/bus/mc-io.c | 29 ++-
 drivers/staging/fsl-mc/bus/mc-sys.c| 29 ++-
 drivers/staging/fsl-mc/include/dpaa2-fd.h  | 29 ++-
 drivers/staging/fsl-mc/include/dpaa2-global.h  | 29 ++-
 drivers/staging/fsl-mc/include/dpaa2-io.h  | 29 ++-
 drivers/staging/fsl-mc/include/dpbp.h  | 30 ++--
 drivers/staging/fsl-mc/include/dpcon.h | 33 +++---
 drivers/staging/fsl-mc/include/mc.h|  5 ++--
 32 files changed, 63 insertions(+), 573 deletions(-)

diff --git a/drivers/staging/fsl-mc/Kconfig b/drivers/staging/fsl-mc/Kconfig
index 32df07b..d4bab69 100644
--- a/drivers/staging/fsl-mc/Kconfig
+++ b/drivers/staging/fsl-mc/Kconfig
@@ -1 +1,2 @@
+# SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
 source "drivers/staging/fsl-mc/bus/Kconfig"
diff --git a/drivers/staging/fsl-mc/Makefile b/drivers/staging/fsl-mc/Makefile
index 9c6a001..d717b41 100644
--- a/drivers/staging/fsl-mc/Makefile
+++ b/drivers/staging/fsl-mc/Makefile
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
 # 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
index 504c987..9adb2a6 100644
--- a/drivers/staging/fsl-mc/bus/Kconfig
+++ b/drivers/staging/fsl-mc/bus/Kconfig
@@ -1,10 +1,9 @@
+# SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
 #
 # DPAA2 fsl-mc bus
 #
 # Copyright (C) 2014-2016 Freescale Semiconductor, Inc.
 #
-# This file is released under the GPLv2
-#
 
 config FSL_MC_BUS
bool "QorIQ DPAA2 fsl-mc bus driver"
diff --git a/drivers/staging/fsl-mc/bus/Makefile 
b/drivers/staging/fsl-mc/bus/Makefile
index 6df407e..cdf319f 100644
--- a/drivers/staging/fsl-mc/bus/Makefile
+++ b/drivers/staging/fsl-mc/bus/Makefile
@@ -1,10 +1,9 @@
+# SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
 #
 # Freescale Management Complex (MC) bus drivers
 #
 # Copyright (C) 2014 Freescale Semiconductor, Inc.
 #
-# This file is released under the GPLv2
-#
 obj-$(CONFIG_FSL_MC_BUS) += mc-bus-driver.o
 
 mc-bus-driver-objs := fsl-mc-bus.o \
diff --git a/drivers/staging/fsl-mc/bus/dpbp-cmd.h 
b/drivers/staging/fsl-mc/bus/dpbp-cmd.h
index 5904836..1ac8ec6 100644
--- a/drivers/staging/fsl-mc/bus/dpbp-cmd.h
+++ b/drivers/staging/fsl-mc/bus/dpbp-cmd.h
@@ -1,33 +1,8 @@
+/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
 /*
  * Copyright 2013-2016 Freescale Semiconductor Inc.
+ * Copyright 2016-2017 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
-

[PATCH 0/8] staging: fsl-mc: Cleanup

2018-01-16 Thread Bogdan Purcareata
The patchset aims to address most of the feedback gathered at the latest
attempt to move it out of staging. You can find the discussion here [1].

Patches 1-2 remove unused code and consolidate the fsl-mc core bus
infrastructure header files into fsl-mc-private.h.

Patch 3 removes full license text and adds SPDX tags to files under
staging/fsl-mc.

Patches 4-6 cleanup the fsl-mc msi/irq code, updating the initialization
routine and removing code that's no longer needed.

Patches 7-8 cleanup the fsl-mc bus documentation and convert it to be
compatible with the kernel documentation build process (.rst).

[1] https://patchwork.kernel.org/patch/10081731/

Bogdan Purcareata (3):
  staging: fsl-mc: Cleanup dprc and dpmcp header files
  staging: fsl-mc: Consolidate bus core header files
  staging: fsl-mc: Add SPDX license identifiers

Ioana Radulescu (5):
  staging: fsl-mc: Remove dead code
  staging: fsl-mc: Remove unnecessary dependency
  staging: fsl-mc: Update include header
  staging: fsl-mc: README cleanup
  staging: fsl-mc: Convert documentation to rst format

 drivers/staging/fsl-mc/Kconfig |   1 +
 drivers/staging/fsl-mc/Makefile|   1 +
 drivers/staging/fsl-mc/README.txt  | 386 --
 drivers/staging/fsl-mc/bus/Kconfig |   3 +-
 drivers/staging/fsl-mc/bus/Makefile|   3 +-
 drivers/staging/fsl-mc/bus/dpbp-cmd.h  |  29 +-
 drivers/staging/fsl-mc/bus/dpbp.c  |  29 +-
 drivers/staging/fsl-mc/bus/dpcon-cmd.h |  29 +-
 drivers/staging/fsl-mc/bus/dpcon.c |  33 +-
 drivers/staging/fsl-mc/bus/dpio/Makefile   |   1 +
 drivers/staging/fsl-mc/bus/dpio/dpio-cmd.h |  30 +-
 drivers/staging/fsl-mc/bus/dpio/dpio-driver.c  |  29 +-
 drivers/staging/fsl-mc/bus/dpio/dpio-service.c |  29 +-
 drivers/staging/fsl-mc/bus/dpio/dpio.c |  30 +-
 drivers/staging/fsl-mc/bus/dpio/dpio.h |  30 +-
 drivers/staging/fsl-mc/bus/dpio/qbman-portal.c |  29 +-
 drivers/staging/fsl-mc/bus/dpio/qbman-portal.h |  29 +-
 drivers/staging/fsl-mc/bus/dpmcp-cmd.h |  56 ---
 drivers/staging/fsl-mc/bus/dpmcp.c |  64 +--
 drivers/staging/fsl-mc/bus/dpmcp.h |  60 ---
 drivers/staging/fsl-mc/bus/dpmng-cmd.h |  58 ---
 drivers/staging/fsl-mc/bus/dprc-cmd.h  | 451 -
 drivers/staging/fsl-mc/bus/dprc-driver.c   |   6 +-
 drivers/staging/fsl-mc/bus/dprc.c  | 257 +---
 drivers/staging/fsl-mc/bus/dprc.h  | 268 
 drivers/staging/fsl-mc/bus/fsl-mc-allocator.c  |  10 +-
 drivers/staging/fsl-mc/bus/fsl-mc-bus.c|  14 +-
 drivers/staging/fsl-mc/bus/fsl-mc-msi.c|   5 +-
 drivers/staging/fsl-mc/bus/fsl-mc-private.h| 380 -
 .../staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c |  26 +-
 drivers/staging/fsl-mc/bus/mc-io.c |  31 +-
 drivers/staging/fsl-mc/bus/mc-sys.c|  31 +-
 drivers/staging/fsl-mc/include/dpaa2-fd.h  |  29 +-
 drivers/staging/fsl-mc/include/dpaa2-global.h  |  29 +-
 drivers/staging/fsl-mc/include/dpaa2-io.h  |  29 +-
 drivers/staging/fsl-mc/include/dpbp.h  |  30 +-
 drivers/staging/fsl-mc/include/dpcon.h |  33 +-
 drivers/staging/fsl-mc/include/mc.h|   5 +-
 drivers/staging/fsl-mc/overview.rst| 404 ++
 39 files changed, 840 insertions(+), 2157 deletions(-)
 delete mode 100644 drivers/staging/fsl-mc/README.txt
 delete mode 100644 drivers/staging/fsl-mc/bus/dpmcp-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/bus/dpmcp.h
 delete mode 100644 drivers/staging/fsl-mc/bus/dpmng-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/bus/dprc-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/bus/dprc.h
 create mode 100644 drivers/staging/fsl-mc/overview.rst

-- 
2.7.4



[PATCH 0/8] staging: fsl-mc: Cleanup

2018-01-16 Thread Bogdan Purcareata
The patchset aims to address most of the feedback gathered at the latest
attempt to move it out of staging. You can find the discussion here [1].

Patches 1-2 remove unused code and consolidate the fsl-mc core bus
infrastructure header files into fsl-mc-private.h.

Patch 3 removes full license text and adds SPDX tags to files under
staging/fsl-mc.

Patches 4-6 cleanup the fsl-mc msi/irq code, updating the initialization
routine and removing code that's no longer needed.

Patches 7-8 cleanup the fsl-mc bus documentation and convert it to be
compatible with the kernel documentation build process (.rst).

[1] https://patchwork.kernel.org/patch/10081731/

Bogdan Purcareata (3):
  staging: fsl-mc: Cleanup dprc and dpmcp header files
  staging: fsl-mc: Consolidate bus core header files
  staging: fsl-mc: Add SPDX license identifiers

Ioana Radulescu (5):
  staging: fsl-mc: Remove dead code
  staging: fsl-mc: Remove unnecessary dependency
  staging: fsl-mc: Update include header
  staging: fsl-mc: README cleanup
  staging: fsl-mc: Convert documentation to rst format

 drivers/staging/fsl-mc/Kconfig |   1 +
 drivers/staging/fsl-mc/Makefile|   1 +
 drivers/staging/fsl-mc/README.txt  | 386 --
 drivers/staging/fsl-mc/bus/Kconfig |   3 +-
 drivers/staging/fsl-mc/bus/Makefile|   3 +-
 drivers/staging/fsl-mc/bus/dpbp-cmd.h  |  29 +-
 drivers/staging/fsl-mc/bus/dpbp.c  |  29 +-
 drivers/staging/fsl-mc/bus/dpcon-cmd.h |  29 +-
 drivers/staging/fsl-mc/bus/dpcon.c |  33 +-
 drivers/staging/fsl-mc/bus/dpio/Makefile   |   1 +
 drivers/staging/fsl-mc/bus/dpio/dpio-cmd.h |  30 +-
 drivers/staging/fsl-mc/bus/dpio/dpio-driver.c  |  29 +-
 drivers/staging/fsl-mc/bus/dpio/dpio-service.c |  29 +-
 drivers/staging/fsl-mc/bus/dpio/dpio.c |  30 +-
 drivers/staging/fsl-mc/bus/dpio/dpio.h |  30 +-
 drivers/staging/fsl-mc/bus/dpio/qbman-portal.c |  29 +-
 drivers/staging/fsl-mc/bus/dpio/qbman-portal.h |  29 +-
 drivers/staging/fsl-mc/bus/dpmcp-cmd.h |  56 ---
 drivers/staging/fsl-mc/bus/dpmcp.c |  64 +--
 drivers/staging/fsl-mc/bus/dpmcp.h |  60 ---
 drivers/staging/fsl-mc/bus/dpmng-cmd.h |  58 ---
 drivers/staging/fsl-mc/bus/dprc-cmd.h  | 451 -
 drivers/staging/fsl-mc/bus/dprc-driver.c   |   6 +-
 drivers/staging/fsl-mc/bus/dprc.c  | 257 +---
 drivers/staging/fsl-mc/bus/dprc.h  | 268 
 drivers/staging/fsl-mc/bus/fsl-mc-allocator.c  |  10 +-
 drivers/staging/fsl-mc/bus/fsl-mc-bus.c|  14 +-
 drivers/staging/fsl-mc/bus/fsl-mc-msi.c|   5 +-
 drivers/staging/fsl-mc/bus/fsl-mc-private.h| 380 -
 .../staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c |  26 +-
 drivers/staging/fsl-mc/bus/mc-io.c |  31 +-
 drivers/staging/fsl-mc/bus/mc-sys.c|  31 +-
 drivers/staging/fsl-mc/include/dpaa2-fd.h  |  29 +-
 drivers/staging/fsl-mc/include/dpaa2-global.h  |  29 +-
 drivers/staging/fsl-mc/include/dpaa2-io.h  |  29 +-
 drivers/staging/fsl-mc/include/dpbp.h  |  30 +-
 drivers/staging/fsl-mc/include/dpcon.h |  33 +-
 drivers/staging/fsl-mc/include/mc.h|   5 +-
 drivers/staging/fsl-mc/overview.rst| 404 ++
 39 files changed, 840 insertions(+), 2157 deletions(-)
 delete mode 100644 drivers/staging/fsl-mc/README.txt
 delete mode 100644 drivers/staging/fsl-mc/bus/dpmcp-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/bus/dpmcp.h
 delete mode 100644 drivers/staging/fsl-mc/bus/dpmng-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/bus/dprc-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/bus/dprc.h
 create mode 100644 drivers/staging/fsl-mc/overview.rst

-- 
2.7.4



RE: [PATCH 4/5] staging: fsl-dpaa2/eth: Change RX buffer alignment

2017-10-30 Thread Bogdan Purcareata
> -Original Message-
> From: Dan Carpenter [mailto:dan.carpen...@oracle.com]
> Sent: Monday, October 30, 2017 10:56 AM
> To: Bogdan Purcareata <bogdan.purcare...@nxp.com>
> Cc: de...@driverdev.osuosl.org; gre...@linuxfoundation.org; linux-
> ker...@vger.kernel.org
> Subject: Re: [PATCH 4/5] staging: fsl-dpaa2/eth: Change RX buffer alignment
> 
> On Fri, Oct 27, 2017 at 02:44:37PM +, Bogdan Purcareata wrote:
> > > -Original Message-
> > > From: Dan Carpenter [mailto:dan.carpen...@oracle.com]
> > > Sent: Friday, October 27, 2017 5:30 PM
> > > To: Bogdan Purcareata <bogdan.purcare...@nxp.com>
> > > Cc: Ruxandra Ioana Radulescu <ruxandra.radule...@nxp.com>;
> > > gre...@linuxfoundation.org; linux-kernel@vger.kernel.org;
> > > de...@driverdev.osuosl.org
> > > Subject: Re: [PATCH 4/5] staging: fsl-dpaa2/eth: Change RX buffer 
> > > alignment
> > >
> > > On Fri, Oct 27, 2017 at 02:11:35PM +, Bogdan Purcareata wrote:
> > > > @@ -93,10 +100,10 @@
> > > >   * buffers large enough to allow building an skb around them and also
> > > account
> > > >   * for alignment restrictions
> > > >   */
> > > > -#define DPAA2_ETH_BUF_RAW_SIZE \
> > > > +#define DPAA2_ETH_BUF_RAW_SIZE(priv) \
> > > > (DPAA2_ETH_RX_BUF_SIZE + \
> > > > SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) + \
> > > > -   DPAA2_ETH_RX_BUF_ALIGN)
> > > > +   (priv)->rx_buf_align)
> > > >
> > >
> > > Not related to this patch, but this macro is ugly.  It would be better
> > > as function.
> >
> > Okay, will change the macros to inline functions in v2, where applicable.
> >
> 
> You didn't need to do that, because I said it was "not related to this
> change".  I try not to make people redo paches for stuff like this.  But
> thanks, it looks nicer now.

I agree with you, it does look better with inline functions. I know the change
wasn't absolutely necessary, but the code is easier on the eyes in v2, so I
thought it was good enough reason to go for it.

Thanks for the feedback! :)
Bogdan P.


RE: [PATCH 4/5] staging: fsl-dpaa2/eth: Change RX buffer alignment

2017-10-30 Thread Bogdan Purcareata
> -Original Message-
> From: Dan Carpenter [mailto:dan.carpen...@oracle.com]
> Sent: Monday, October 30, 2017 10:56 AM
> To: Bogdan Purcareata 
> Cc: de...@driverdev.osuosl.org; gre...@linuxfoundation.org; linux-
> ker...@vger.kernel.org
> Subject: Re: [PATCH 4/5] staging: fsl-dpaa2/eth: Change RX buffer alignment
> 
> On Fri, Oct 27, 2017 at 02:44:37PM +, Bogdan Purcareata wrote:
> > > -Original Message-
> > > From: Dan Carpenter [mailto:dan.carpen...@oracle.com]
> > > Sent: Friday, October 27, 2017 5:30 PM
> > > To: Bogdan Purcareata 
> > > Cc: Ruxandra Ioana Radulescu ;
> > > gre...@linuxfoundation.org; linux-kernel@vger.kernel.org;
> > > de...@driverdev.osuosl.org
> > > Subject: Re: [PATCH 4/5] staging: fsl-dpaa2/eth: Change RX buffer 
> > > alignment
> > >
> > > On Fri, Oct 27, 2017 at 02:11:35PM +, Bogdan Purcareata wrote:
> > > > @@ -93,10 +100,10 @@
> > > >   * buffers large enough to allow building an skb around them and also
> > > account
> > > >   * for alignment restrictions
> > > >   */
> > > > -#define DPAA2_ETH_BUF_RAW_SIZE \
> > > > +#define DPAA2_ETH_BUF_RAW_SIZE(priv) \
> > > > (DPAA2_ETH_RX_BUF_SIZE + \
> > > > SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) + \
> > > > -   DPAA2_ETH_RX_BUF_ALIGN)
> > > > +   (priv)->rx_buf_align)
> > > >
> > >
> > > Not related to this patch, but this macro is ugly.  It would be better
> > > as function.
> >
> > Okay, will change the macros to inline functions in v2, where applicable.
> >
> 
> You didn't need to do that, because I said it was "not related to this
> change".  I try not to make people redo paches for stuff like this.  But
> thanks, it looks nicer now.

I agree with you, it does look better with inline functions. I know the change
wasn't absolutely necessary, but the code is easier on the eyes in v2, so I
thought it was good enough reason to go for it.

Thanks for the feedback! :)
Bogdan P.


[PATCH v2 2/5] staging: fsl-dpaa2/eth: Split function

2017-10-29 Thread Bogdan Purcareata
From: Ioana Radulescu <ruxandra.radule...@nxp.com>

Since setup_dpni() became a bit too long, move the buffer layout
configuration to a separate function.

Signed-off-by: Ioana Radulescu <ruxandra.radule...@nxp.com>
Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
---
v1 -> v2:
- no changes

 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 79 +++---
 1 file changed, 45 insertions(+), 34 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
index 5d2bd18..92faaaf 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
@@ -1776,42 +1776,12 @@ static void free_dpbp(struct dpaa2_eth_priv *priv)
fsl_mc_object_free(priv->dpbp_dev);
 }
 
-/* Configure the DPNI object this interface is associated with */
-static int setup_dpni(struct fsl_mc_device *ls_dev)
+static int set_buffer_layout(struct dpaa2_eth_priv *priv)
 {
-   struct device *dev = _dev->dev;
-   struct dpaa2_eth_priv *priv;
-   struct net_device *net_dev;
+   struct device *dev = priv->net_dev->dev.parent;
struct dpni_buffer_layout buf_layout = {0};
int err;
 
-   net_dev = dev_get_drvdata(dev);
-   priv = netdev_priv(net_dev);
-
-   /* get a handle for the DPNI object */
-   err = dpni_open(priv->mc_io, 0, ls_dev->obj_desc.id, >mc_token);
-   if (err) {
-   dev_err(dev, "dpni_open() failed\n");
-   return err;
-   }
-
-   ls_dev->mc_io = priv->mc_io;
-   ls_dev->mc_handle = priv->mc_token;
-
-   err = dpni_reset(priv->mc_io, 0, priv->mc_token);
-   if (err) {
-   dev_err(dev, "dpni_reset() failed\n");
-   goto close;
-   }
-
-   err = dpni_get_attributes(priv->mc_io, 0, priv->mc_token,
- >dpni_attrs);
-   if (err) {
-   dev_err(dev, "dpni_get_attributes() failed (err=%d)\n", err);
-   goto close;
-   }
-
-   /* Configure buffer layouts */
/* rx buffer */
buf_layout.pass_parser_result = true;
buf_layout.pass_frame_status = true;
@@ -1825,7 +1795,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
 DPNI_QUEUE_RX, _layout);
if (err) {
dev_err(dev, "dpni_set_buffer_layout(RX) failed\n");
-   goto close;
+   return err;
}
 
/* tx buffer */
@@ -1835,7 +1805,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
 DPNI_QUEUE_TX, _layout);
if (err) {
dev_err(dev, "dpni_set_buffer_layout(TX) failed\n");
-   goto close;
+   return err;
}
 
/* tx-confirm buffer */
@@ -1844,9 +1814,50 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
 DPNI_QUEUE_TX_CONFIRM, _layout);
if (err) {
dev_err(dev, "dpni_set_buffer_layout(TX_CONF) failed\n");
+   return err;
+   }
+
+   return 0;
+}
+
+/* Configure the DPNI object this interface is associated with */
+static int setup_dpni(struct fsl_mc_device *ls_dev)
+{
+   struct device *dev = _dev->dev;
+   struct dpaa2_eth_priv *priv;
+   struct net_device *net_dev;
+   int err;
+
+   net_dev = dev_get_drvdata(dev);
+   priv = netdev_priv(net_dev);
+
+   /* get a handle for the DPNI object */
+   err = dpni_open(priv->mc_io, 0, ls_dev->obj_desc.id, >mc_token);
+   if (err) {
+   dev_err(dev, "dpni_open() failed\n");
+   return err;
+   }
+
+   ls_dev->mc_io = priv->mc_io;
+   ls_dev->mc_handle = priv->mc_token;
+
+   err = dpni_reset(priv->mc_io, 0, priv->mc_token);
+   if (err) {
+   dev_err(dev, "dpni_reset() failed\n");
goto close;
}
 
+   err = dpni_get_attributes(priv->mc_io, 0, priv->mc_token,
+ >dpni_attrs);
+   if (err) {
+   dev_err(dev, "dpni_get_attributes() failed (err=%d)\n", err);
+   goto close;
+   }
+
+   err = set_buffer_layout(priv);
+   if (err)
+   goto close;
+
/* Now that we've set our tx buffer layout, retrieve the minimum
 * required tx data offset.
 */
-- 
2.7.4



[PATCH v2 2/5] staging: fsl-dpaa2/eth: Split function

2017-10-29 Thread Bogdan Purcareata
From: Ioana Radulescu 

Since setup_dpni() became a bit too long, move the buffer layout
configuration to a separate function.

Signed-off-by: Ioana Radulescu 
Signed-off-by: Bogdan Purcareata 
---
v1 -> v2:
- no changes

 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 79 +++---
 1 file changed, 45 insertions(+), 34 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
index 5d2bd18..92faaaf 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
@@ -1776,42 +1776,12 @@ static void free_dpbp(struct dpaa2_eth_priv *priv)
fsl_mc_object_free(priv->dpbp_dev);
 }
 
-/* Configure the DPNI object this interface is associated with */
-static int setup_dpni(struct fsl_mc_device *ls_dev)
+static int set_buffer_layout(struct dpaa2_eth_priv *priv)
 {
-   struct device *dev = _dev->dev;
-   struct dpaa2_eth_priv *priv;
-   struct net_device *net_dev;
+   struct device *dev = priv->net_dev->dev.parent;
struct dpni_buffer_layout buf_layout = {0};
int err;
 
-   net_dev = dev_get_drvdata(dev);
-   priv = netdev_priv(net_dev);
-
-   /* get a handle for the DPNI object */
-   err = dpni_open(priv->mc_io, 0, ls_dev->obj_desc.id, >mc_token);
-   if (err) {
-   dev_err(dev, "dpni_open() failed\n");
-   return err;
-   }
-
-   ls_dev->mc_io = priv->mc_io;
-   ls_dev->mc_handle = priv->mc_token;
-
-   err = dpni_reset(priv->mc_io, 0, priv->mc_token);
-   if (err) {
-   dev_err(dev, "dpni_reset() failed\n");
-   goto close;
-   }
-
-   err = dpni_get_attributes(priv->mc_io, 0, priv->mc_token,
- >dpni_attrs);
-   if (err) {
-   dev_err(dev, "dpni_get_attributes() failed (err=%d)\n", err);
-   goto close;
-   }
-
-   /* Configure buffer layouts */
/* rx buffer */
buf_layout.pass_parser_result = true;
buf_layout.pass_frame_status = true;
@@ -1825,7 +1795,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
 DPNI_QUEUE_RX, _layout);
if (err) {
dev_err(dev, "dpni_set_buffer_layout(RX) failed\n");
-   goto close;
+   return err;
}
 
/* tx buffer */
@@ -1835,7 +1805,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
 DPNI_QUEUE_TX, _layout);
if (err) {
dev_err(dev, "dpni_set_buffer_layout(TX) failed\n");
-   goto close;
+   return err;
}
 
/* tx-confirm buffer */
@@ -1844,9 +1814,50 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
 DPNI_QUEUE_TX_CONFIRM, _layout);
if (err) {
dev_err(dev, "dpni_set_buffer_layout(TX_CONF) failed\n");
+   return err;
+   }
+
+   return 0;
+}
+
+/* Configure the DPNI object this interface is associated with */
+static int setup_dpni(struct fsl_mc_device *ls_dev)
+{
+   struct device *dev = _dev->dev;
+   struct dpaa2_eth_priv *priv;
+   struct net_device *net_dev;
+   int err;
+
+   net_dev = dev_get_drvdata(dev);
+   priv = netdev_priv(net_dev);
+
+   /* get a handle for the DPNI object */
+   err = dpni_open(priv->mc_io, 0, ls_dev->obj_desc.id, >mc_token);
+   if (err) {
+   dev_err(dev, "dpni_open() failed\n");
+   return err;
+   }
+
+   ls_dev->mc_io = priv->mc_io;
+   ls_dev->mc_handle = priv->mc_token;
+
+   err = dpni_reset(priv->mc_io, 0, priv->mc_token);
+   if (err) {
+   dev_err(dev, "dpni_reset() failed\n");
goto close;
}
 
+   err = dpni_get_attributes(priv->mc_io, 0, priv->mc_token,
+ >dpni_attrs);
+   if (err) {
+   dev_err(dev, "dpni_get_attributes() failed (err=%d)\n", err);
+   goto close;
+   }
+
+   err = set_buffer_layout(priv);
+   if (err)
+   goto close;
+
/* Now that we've set our tx buffer layout, retrieve the minimum
 * required tx data offset.
 */
-- 
2.7.4



[PATCH v2 4/5] staging: fsl-dpaa2/eth: Change RX buffer alignment

2017-10-29 Thread Bogdan Purcareata
The WRIOP hardware block v1.0.0 (found on LS2080A board)
requires data in RX buffers to be aligned to 256B, but
newer revisions (e.g. on LS2088A, LS1088A) only require
64B alignment.

Check WRIOP version and decide at runtime which alignment
requirement to configure for ingress buffers.

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
Signed-off-by: Ioana Radulescu <ruxandra.radule...@nxp.com>
---
v1 -> v2:
- changed *_RAW_BUF_SIZE macro to inline function

 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 18 +
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h | 27 ++
 2 files changed, 33 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
index d68c1f5..d65950d 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
@@ -766,11 +766,11 @@ static int add_bufs(struct dpaa2_eth_priv *priv, u16 bpid)
/* Allocate buffer visible to WRIOP + skb shared info +
 * alignment padding
 */
-   buf = napi_alloc_frag(DPAA2_ETH_BUF_RAW_SIZE);
+   buf = napi_alloc_frag(dpaa2_eth_buf_raw_size(priv));
if (unlikely(!buf))
goto err_alloc;
 
-   buf = PTR_ALIGN(buf, DPAA2_ETH_RX_BUF_ALIGN);
+   buf = PTR_ALIGN(buf, priv->rx_buf_align);
 
addr = dma_map_single(dev, buf, DPAA2_ETH_RX_BUF_SIZE,
  DMA_FROM_DEVICE);
@@ -781,7 +781,7 @@ static int add_bufs(struct dpaa2_eth_priv *priv, u16 bpid)
 
/* tracing point */
trace_dpaa2_eth_buf_seed(priv->net_dev,
-buf, DPAA2_ETH_BUF_RAW_SIZE,
+buf, dpaa2_eth_buf_raw_size(priv),
 addr, DPAA2_ETH_RX_BUF_SIZE,
 bpid);
}
@@ -1782,11 +1782,21 @@ static int set_buffer_layout(struct dpaa2_eth_priv 
*priv)
struct dpni_buffer_layout buf_layout = {0};
int err;
 
+   /* We need to check for WRIOP version 1.0.0, but depending on the MC
+* version, this number is not always provided correctly on rev1.
+* We need to check for both alternatives in this situation.
+*/
+   if (priv->dpni_attrs.wriop_version == DPAA2_WRIOP_VERSION(0, 0, 0) ||
+   priv->dpni_attrs.wriop_version == DPAA2_WRIOP_VERSION(1, 0, 0))
+   priv->rx_buf_align = DPAA2_ETH_RX_BUF_ALIGN_REV1;
+   else
+   priv->rx_buf_align = DPAA2_ETH_RX_BUF_ALIGN;
+
/* rx buffer */
buf_layout.pass_parser_result = true;
buf_layout.pass_frame_status = true;
buf_layout.private_data_size = DPAA2_ETH_SWA_SIZE;
-   buf_layout.data_align = DPAA2_ETH_RX_BUF_ALIGN;
+   buf_layout.data_align = priv->rx_buf_align;
buf_layout.options = DPNI_BUF_LAYOUT_OPT_PARSER_RESULT |
 DPNI_BUF_LAYOUT_OPT_FRAME_STATUS |
 DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE |
diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
index bfbabae..749bd6b 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
@@ -45,6 +45,8 @@
 
 #include "dpaa2-eth-trace.h"
 
+#define DPAA2_WRIOP_VERSION(x, y, z) ((x) << 10 | (y) << 5 | (z) << 0)
+
 #define DPAA2_ETH_STORE_SIZE   16
 
 /* Maximum number of scatter-gather entries in an ingress frame,
@@ -85,18 +87,15 @@
  */
 #define DPAA2_ETH_RX_BUF_SIZE  2048
 #define DPAA2_ETH_TX_BUF_ALIGN 64
-#define DPAA2_ETH_RX_BUF_ALIGN 256
+
 #define DPAA2_ETH_NEEDED_HEADROOM(p_priv) \
((p_priv)->tx_data_offset + DPAA2_ETH_TX_BUF_ALIGN)
 
-/* Hardware only sees DPAA2_ETH_RX_BUF_SIZE, but we need to allocate ingress
- * buffers large enough to allow building an skb around them and also account
- * for alignment restrictions
+/* Due to a limitation in WRIOP 1.0.0, the RX buffer data must be aligned
+ * to 256B. For newer revisions, the requirement is only for 64B alignment
  */
-#define DPAA2_ETH_BUF_RAW_SIZE \
-   (DPAA2_ETH_RX_BUF_SIZE + \
-   SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) + \
-   DPAA2_ETH_RX_BUF_ALIGN)
+#define DPAA2_ETH_RX_BUF_ALIGN_REV1256
+#define DPAA2_ETH_RX_BUF_ALIGN 64
 
 /* We are accommodating a skb backpointer and some S/G info
  * in the frame's software annotation. The hardware
@@ -318,6 +317,7 @@ struct dpaa2_eth_priv {
struct iommu_domain *iommu_domain;
 
u16 tx_qdid;
+   u16 rx_buf_align;
struct fsl_mc_io *mc_io;
/* Cores which have an affine DPIO/DPCON.
 * This is the cpu set on which Rx and Tx c

[PATCH v2 5/5] staging: fsl-dpaa2/eth: Extra headroom in RX buffers

2017-10-29 Thread Bogdan Purcareata
The needed headroom that we ask the stack to reserve for us in TX
skbs is larger than the headroom available in RX frames, which
leads to skb reallocations in forwarding scenarios involving two
DPNI interfaces.

Configure the hardware to reserve some extra space in the RX
frame headroom to avoid this situation. The value is chosen based
on the Tx frame data offset, the Rx buffer alignment value and the
netdevice required headroom.

The network stack will take care to reserve space for HH_DATA_MOD when
building the skb, so there's no need to account for it in the netdevice
needed headroom.

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
Signed-off-by: Ioana Radulescu <ruxandra.radule...@nxp.com>
---
v1 -> v2:
- changed *_RX_HEAD_ROOM from macro to inline function
- since the patch is touching the area, did the same for *_NEEDED_HEADROOM

 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 85 +++---
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h | 39 
 2 files changed, 76 insertions(+), 48 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
index d65950d..0d8ed00 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
@@ -135,8 +135,7 @@ static struct sk_buff *build_linear_skb(struct 
dpaa2_eth_priv *priv,
 
ch->buf_count--;
 
-   skb = build_skb(fd_vaddr, DPAA2_ETH_RX_BUF_SIZE +
-   SKB_DATA_ALIGN(sizeof(struct skb_shared_info)));
+   skb = build_skb(fd_vaddr, DPAA2_ETH_SKB_SIZE);
if (unlikely(!skb))
return NULL;
 
@@ -178,8 +177,7 @@ static struct sk_buff *build_frag_skb(struct dpaa2_eth_priv 
*priv,
 
if (i == 0) {
/* We build the skb around the first data buffer */
-   skb = build_skb(sg_vaddr, DPAA2_ETH_RX_BUF_SIZE +
-   SKB_DATA_ALIGN(sizeof(struct skb_shared_info)));
+   skb = build_skb(sg_vaddr, DPAA2_ETH_SKB_SIZE);
if (unlikely(!skb)) {
/* Free the first SG entry now, since we already
 * unmapped it and obtained the virtual address
@@ -573,10 +571,10 @@ static netdev_tx_t dpaa2_eth_tx(struct sk_buff *skb, 
struct net_device *net_dev)
percpu_stats = this_cpu_ptr(priv->percpu_stats);
percpu_extras = this_cpu_ptr(priv->percpu_extras);
 
-   if (unlikely(skb_headroom(skb) < DPAA2_ETH_NEEDED_HEADROOM(priv))) {
+   if (unlikely(skb_headroom(skb) < dpaa2_eth_needed_headroom(priv))) {
struct sk_buff *ns;
 
-   ns = skb_realloc_headroom(skb, DPAA2_ETH_NEEDED_HEADROOM(priv));
+   ns = skb_realloc_headroom(skb, dpaa2_eth_needed_headroom(priv));
if (unlikely(!ns)) {
percpu_stats->tx_dropped++;
goto err_alloc_headroom;
@@ -1792,23 +1790,9 @@ static int set_buffer_layout(struct dpaa2_eth_priv *priv)
else
priv->rx_buf_align = DPAA2_ETH_RX_BUF_ALIGN;
 
-   /* rx buffer */
-   buf_layout.pass_parser_result = true;
+   /* tx buffer */
buf_layout.pass_frame_status = true;
buf_layout.private_data_size = DPAA2_ETH_SWA_SIZE;
-   buf_layout.data_align = priv->rx_buf_align;
-   buf_layout.options = DPNI_BUF_LAYOUT_OPT_PARSER_RESULT |
-DPNI_BUF_LAYOUT_OPT_FRAME_STATUS |
-DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE |
-DPNI_BUF_LAYOUT_OPT_DATA_ALIGN;
-   err = dpni_set_buffer_layout(priv->mc_io, 0, priv->mc_token,
-DPNI_QUEUE_RX, _layout);
-   if (err) {
-   dev_err(dev, "dpni_set_buffer_layout(RX) failed\n");
-   return err;
-   }
-
-   /* tx buffer */
buf_layout.options = DPNI_BUF_LAYOUT_OPT_FRAME_STATUS |
 DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE;
err = dpni_set_buffer_layout(priv->mc_io, 0, priv->mc_token,
@@ -1827,6 +1811,36 @@ static int set_buffer_layout(struct dpaa2_eth_priv *priv)
return err;
}
 
+   /* Now that we've set our tx buffer layout, retrieve the minimum
+* required tx data offset.
+*/
+   err = dpni_get_tx_data_offset(priv->mc_io, 0, priv->mc_token,
+ >tx_data_offset);
+   if (err) {
+   dev_err(dev, "dpni_get_tx_data_offset() failed\n");
+   return err;
+   }
+
+   if ((priv->tx_data_offset % 64) != 0)
+   dev_warn(dev, "Tx data offset (%d) not a multiple of 64B\n",
+priv->tx_data_offset);
+
+   /* rx buffer */
+   buf_layout.pass_parser_resu

[PATCH v2 1/5] staging: fsl-dpaa2/eth: Label cleanup

2017-10-29 Thread Bogdan Purcareata
From: Ioana Radulescu <ruxandra.radule...@nxp.com>

Clean up goto labels in a couple of functions, by
removing/renaming redundant ones.

Signed-off-by: Ioana Radulescu <ruxandra.radule...@nxp.com>
Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
---
v1 -> v2:
- no changes

 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 35 +++---
 1 file changed, 15 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
index 9fbc0ee..5d2bd18 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
@@ -1444,34 +1444,32 @@ static struct fsl_mc_device *setup_dpcon(struct 
dpaa2_eth_priv *priv)
err = dpcon_open(priv->mc_io, 0, dpcon->obj_desc.id, >mc_handle);
if (err) {
dev_err(dev, "dpcon_open() failed\n");
-   goto err_open;
+   goto free;
}
 
err = dpcon_reset(priv->mc_io, 0, dpcon->mc_handle);
if (err) {
dev_err(dev, "dpcon_reset() failed\n");
-   goto err_reset;
+   goto close;
}
 
err = dpcon_get_attributes(priv->mc_io, 0, dpcon->mc_handle, );
if (err) {
dev_err(dev, "dpcon_get_attributes() failed\n");
-   goto err_get_attr;
+   goto close;
}
 
err = dpcon_enable(priv->mc_io, 0, dpcon->mc_handle);
if (err) {
dev_err(dev, "dpcon_enable() failed\n");
-   goto err_enable;
+   goto close;
}
 
return dpcon;
 
-err_enable:
-err_get_attr:
-err_reset:
+close:
dpcon_close(priv->mc_io, 0, dpcon->mc_handle);
-err_open:
+free:
fsl_mc_object_free(dpcon);
 
return NULL;
@@ -1794,7 +1792,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
err = dpni_open(priv->mc_io, 0, ls_dev->obj_desc.id, >mc_token);
if (err) {
dev_err(dev, "dpni_open() failed\n");
-   goto err_open;
+   return err;
}
 
ls_dev->mc_io = priv->mc_io;
@@ -1803,14 +1801,14 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
err = dpni_reset(priv->mc_io, 0, priv->mc_token);
if (err) {
dev_err(dev, "dpni_reset() failed\n");
-   goto err_reset;
+   goto close;
}
 
err = dpni_get_attributes(priv->mc_io, 0, priv->mc_token,
  >dpni_attrs);
if (err) {
dev_err(dev, "dpni_get_attributes() failed (err=%d)\n", err);
-   goto err_get_attr;
+   goto close;
}
 
/* Configure buffer layouts */
@@ -1827,7 +1825,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
 DPNI_QUEUE_RX, _layout);
if (err) {
dev_err(dev, "dpni_set_buffer_layout(RX) failed\n");
-   goto err_buf_layout;
+   goto close;
}
 
/* tx buffer */
@@ -1837,7 +1835,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
 DPNI_QUEUE_TX, _layout);
if (err) {
dev_err(dev, "dpni_set_buffer_layout(TX) failed\n");
-   goto err_buf_layout;
+   goto close;
}
 
/* tx-confirm buffer */
@@ -1846,7 +1844,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
 DPNI_QUEUE_TX_CONFIRM, _layout);
if (err) {
dev_err(dev, "dpni_set_buffer_layout(TX_CONF) failed\n");
-   goto err_buf_layout;
+   goto close;
}
 
/* Now that we've set our tx buffer layout, retrieve the minimum
@@ -1856,7 +1854,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
  >tx_data_offset);
if (err) {
dev_err(dev, "dpni_get_tx_data_offset() failed\n");
-   goto err_data_offset;
+   goto close;
}
 
if ((priv->tx_data_offset % 64) != 0)
@@ -1868,12 +1866,9 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
 
return 0;
 
-err_data_offset:
-err_buf_layout:
-err_get_attr:
-err_reset:
+close:
dpni_close(priv->mc_io, 0, priv->mc_token);
-err_open:
+
return err;
 }
 
-- 
2.7.4



[PATCH v2 4/5] staging: fsl-dpaa2/eth: Change RX buffer alignment

2017-10-29 Thread Bogdan Purcareata
The WRIOP hardware block v1.0.0 (found on LS2080A board)
requires data in RX buffers to be aligned to 256B, but
newer revisions (e.g. on LS2088A, LS1088A) only require
64B alignment.

Check WRIOP version and decide at runtime which alignment
requirement to configure for ingress buffers.

Signed-off-by: Bogdan Purcareata 
Signed-off-by: Ioana Radulescu 
---
v1 -> v2:
- changed *_RAW_BUF_SIZE macro to inline function

 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 18 +
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h | 27 ++
 2 files changed, 33 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
index d68c1f5..d65950d 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
@@ -766,11 +766,11 @@ static int add_bufs(struct dpaa2_eth_priv *priv, u16 bpid)
/* Allocate buffer visible to WRIOP + skb shared info +
 * alignment padding
 */
-   buf = napi_alloc_frag(DPAA2_ETH_BUF_RAW_SIZE);
+   buf = napi_alloc_frag(dpaa2_eth_buf_raw_size(priv));
if (unlikely(!buf))
goto err_alloc;
 
-   buf = PTR_ALIGN(buf, DPAA2_ETH_RX_BUF_ALIGN);
+   buf = PTR_ALIGN(buf, priv->rx_buf_align);
 
addr = dma_map_single(dev, buf, DPAA2_ETH_RX_BUF_SIZE,
  DMA_FROM_DEVICE);
@@ -781,7 +781,7 @@ static int add_bufs(struct dpaa2_eth_priv *priv, u16 bpid)
 
/* tracing point */
trace_dpaa2_eth_buf_seed(priv->net_dev,
-buf, DPAA2_ETH_BUF_RAW_SIZE,
+buf, dpaa2_eth_buf_raw_size(priv),
 addr, DPAA2_ETH_RX_BUF_SIZE,
 bpid);
}
@@ -1782,11 +1782,21 @@ static int set_buffer_layout(struct dpaa2_eth_priv 
*priv)
struct dpni_buffer_layout buf_layout = {0};
int err;
 
+   /* We need to check for WRIOP version 1.0.0, but depending on the MC
+* version, this number is not always provided correctly on rev1.
+* We need to check for both alternatives in this situation.
+*/
+   if (priv->dpni_attrs.wriop_version == DPAA2_WRIOP_VERSION(0, 0, 0) ||
+   priv->dpni_attrs.wriop_version == DPAA2_WRIOP_VERSION(1, 0, 0))
+   priv->rx_buf_align = DPAA2_ETH_RX_BUF_ALIGN_REV1;
+   else
+   priv->rx_buf_align = DPAA2_ETH_RX_BUF_ALIGN;
+
/* rx buffer */
buf_layout.pass_parser_result = true;
buf_layout.pass_frame_status = true;
buf_layout.private_data_size = DPAA2_ETH_SWA_SIZE;
-   buf_layout.data_align = DPAA2_ETH_RX_BUF_ALIGN;
+   buf_layout.data_align = priv->rx_buf_align;
buf_layout.options = DPNI_BUF_LAYOUT_OPT_PARSER_RESULT |
 DPNI_BUF_LAYOUT_OPT_FRAME_STATUS |
 DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE |
diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
index bfbabae..749bd6b 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
@@ -45,6 +45,8 @@
 
 #include "dpaa2-eth-trace.h"
 
+#define DPAA2_WRIOP_VERSION(x, y, z) ((x) << 10 | (y) << 5 | (z) << 0)
+
 #define DPAA2_ETH_STORE_SIZE   16
 
 /* Maximum number of scatter-gather entries in an ingress frame,
@@ -85,18 +87,15 @@
  */
 #define DPAA2_ETH_RX_BUF_SIZE  2048
 #define DPAA2_ETH_TX_BUF_ALIGN 64
-#define DPAA2_ETH_RX_BUF_ALIGN 256
+
 #define DPAA2_ETH_NEEDED_HEADROOM(p_priv) \
((p_priv)->tx_data_offset + DPAA2_ETH_TX_BUF_ALIGN)
 
-/* Hardware only sees DPAA2_ETH_RX_BUF_SIZE, but we need to allocate ingress
- * buffers large enough to allow building an skb around them and also account
- * for alignment restrictions
+/* Due to a limitation in WRIOP 1.0.0, the RX buffer data must be aligned
+ * to 256B. For newer revisions, the requirement is only for 64B alignment
  */
-#define DPAA2_ETH_BUF_RAW_SIZE \
-   (DPAA2_ETH_RX_BUF_SIZE + \
-   SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) + \
-   DPAA2_ETH_RX_BUF_ALIGN)
+#define DPAA2_ETH_RX_BUF_ALIGN_REV1256
+#define DPAA2_ETH_RX_BUF_ALIGN 64
 
 /* We are accommodating a skb backpointer and some S/G info
  * in the frame's software annotation. The hardware
@@ -318,6 +317,7 @@ struct dpaa2_eth_priv {
struct iommu_domain *iommu_domain;
 
u16 tx_qdid;
+   u16 rx_buf_align;
struct fsl_mc_io *mc_io;
/* Cores which have an affine DPIO/DPCON.
 * This is the cpu set on which Rx and Tx conf frames are processed
@@ -353,6 +353,17 @@ struct dpaa2_eth_pr

[PATCH v2 5/5] staging: fsl-dpaa2/eth: Extra headroom in RX buffers

2017-10-29 Thread Bogdan Purcareata
The needed headroom that we ask the stack to reserve for us in TX
skbs is larger than the headroom available in RX frames, which
leads to skb reallocations in forwarding scenarios involving two
DPNI interfaces.

Configure the hardware to reserve some extra space in the RX
frame headroom to avoid this situation. The value is chosen based
on the Tx frame data offset, the Rx buffer alignment value and the
netdevice required headroom.

The network stack will take care to reserve space for HH_DATA_MOD when
building the skb, so there's no need to account for it in the netdevice
needed headroom.

Signed-off-by: Bogdan Purcareata 
Signed-off-by: Ioana Radulescu 
---
v1 -> v2:
- changed *_RX_HEAD_ROOM from macro to inline function
- since the patch is touching the area, did the same for *_NEEDED_HEADROOM

 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 85 +++---
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h | 39 
 2 files changed, 76 insertions(+), 48 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
index d65950d..0d8ed00 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
@@ -135,8 +135,7 @@ static struct sk_buff *build_linear_skb(struct 
dpaa2_eth_priv *priv,
 
ch->buf_count--;
 
-   skb = build_skb(fd_vaddr, DPAA2_ETH_RX_BUF_SIZE +
-   SKB_DATA_ALIGN(sizeof(struct skb_shared_info)));
+   skb = build_skb(fd_vaddr, DPAA2_ETH_SKB_SIZE);
if (unlikely(!skb))
return NULL;
 
@@ -178,8 +177,7 @@ static struct sk_buff *build_frag_skb(struct dpaa2_eth_priv 
*priv,
 
if (i == 0) {
/* We build the skb around the first data buffer */
-   skb = build_skb(sg_vaddr, DPAA2_ETH_RX_BUF_SIZE +
-   SKB_DATA_ALIGN(sizeof(struct skb_shared_info)));
+   skb = build_skb(sg_vaddr, DPAA2_ETH_SKB_SIZE);
if (unlikely(!skb)) {
/* Free the first SG entry now, since we already
 * unmapped it and obtained the virtual address
@@ -573,10 +571,10 @@ static netdev_tx_t dpaa2_eth_tx(struct sk_buff *skb, 
struct net_device *net_dev)
percpu_stats = this_cpu_ptr(priv->percpu_stats);
percpu_extras = this_cpu_ptr(priv->percpu_extras);
 
-   if (unlikely(skb_headroom(skb) < DPAA2_ETH_NEEDED_HEADROOM(priv))) {
+   if (unlikely(skb_headroom(skb) < dpaa2_eth_needed_headroom(priv))) {
struct sk_buff *ns;
 
-   ns = skb_realloc_headroom(skb, DPAA2_ETH_NEEDED_HEADROOM(priv));
+   ns = skb_realloc_headroom(skb, dpaa2_eth_needed_headroom(priv));
if (unlikely(!ns)) {
percpu_stats->tx_dropped++;
goto err_alloc_headroom;
@@ -1792,23 +1790,9 @@ static int set_buffer_layout(struct dpaa2_eth_priv *priv)
else
priv->rx_buf_align = DPAA2_ETH_RX_BUF_ALIGN;
 
-   /* rx buffer */
-   buf_layout.pass_parser_result = true;
+   /* tx buffer */
buf_layout.pass_frame_status = true;
buf_layout.private_data_size = DPAA2_ETH_SWA_SIZE;
-   buf_layout.data_align = priv->rx_buf_align;
-   buf_layout.options = DPNI_BUF_LAYOUT_OPT_PARSER_RESULT |
-DPNI_BUF_LAYOUT_OPT_FRAME_STATUS |
-DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE |
-DPNI_BUF_LAYOUT_OPT_DATA_ALIGN;
-   err = dpni_set_buffer_layout(priv->mc_io, 0, priv->mc_token,
-DPNI_QUEUE_RX, _layout);
-   if (err) {
-   dev_err(dev, "dpni_set_buffer_layout(RX) failed\n");
-   return err;
-   }
-
-   /* tx buffer */
buf_layout.options = DPNI_BUF_LAYOUT_OPT_FRAME_STATUS |
 DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE;
err = dpni_set_buffer_layout(priv->mc_io, 0, priv->mc_token,
@@ -1827,6 +1811,36 @@ static int set_buffer_layout(struct dpaa2_eth_priv *priv)
return err;
}
 
+   /* Now that we've set our tx buffer layout, retrieve the minimum
+* required tx data offset.
+*/
+   err = dpni_get_tx_data_offset(priv->mc_io, 0, priv->mc_token,
+ >tx_data_offset);
+   if (err) {
+   dev_err(dev, "dpni_get_tx_data_offset() failed\n");
+   return err;
+   }
+
+   if ((priv->tx_data_offset % 64) != 0)
+   dev_warn(dev, "Tx data offset (%d) not a multiple of 64B\n",
+priv->tx_data_offset);
+
+   /* rx buffer */
+   buf_layout.pass_parser_result = true;
+   buf_layout.data_align =

[PATCH v2 1/5] staging: fsl-dpaa2/eth: Label cleanup

2017-10-29 Thread Bogdan Purcareata
From: Ioana Radulescu 

Clean up goto labels in a couple of functions, by
removing/renaming redundant ones.

Signed-off-by: Ioana Radulescu 
Signed-off-by: Bogdan Purcareata 
---
v1 -> v2:
- no changes

 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 35 +++---
 1 file changed, 15 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
index 9fbc0ee..5d2bd18 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
@@ -1444,34 +1444,32 @@ static struct fsl_mc_device *setup_dpcon(struct 
dpaa2_eth_priv *priv)
err = dpcon_open(priv->mc_io, 0, dpcon->obj_desc.id, >mc_handle);
if (err) {
dev_err(dev, "dpcon_open() failed\n");
-   goto err_open;
+   goto free;
}
 
err = dpcon_reset(priv->mc_io, 0, dpcon->mc_handle);
if (err) {
dev_err(dev, "dpcon_reset() failed\n");
-   goto err_reset;
+   goto close;
}
 
err = dpcon_get_attributes(priv->mc_io, 0, dpcon->mc_handle, );
if (err) {
dev_err(dev, "dpcon_get_attributes() failed\n");
-   goto err_get_attr;
+   goto close;
}
 
err = dpcon_enable(priv->mc_io, 0, dpcon->mc_handle);
if (err) {
dev_err(dev, "dpcon_enable() failed\n");
-   goto err_enable;
+   goto close;
}
 
return dpcon;
 
-err_enable:
-err_get_attr:
-err_reset:
+close:
dpcon_close(priv->mc_io, 0, dpcon->mc_handle);
-err_open:
+free:
fsl_mc_object_free(dpcon);
 
return NULL;
@@ -1794,7 +1792,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
err = dpni_open(priv->mc_io, 0, ls_dev->obj_desc.id, >mc_token);
if (err) {
dev_err(dev, "dpni_open() failed\n");
-   goto err_open;
+   return err;
}
 
ls_dev->mc_io = priv->mc_io;
@@ -1803,14 +1801,14 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
err = dpni_reset(priv->mc_io, 0, priv->mc_token);
if (err) {
dev_err(dev, "dpni_reset() failed\n");
-   goto err_reset;
+   goto close;
}
 
err = dpni_get_attributes(priv->mc_io, 0, priv->mc_token,
  >dpni_attrs);
if (err) {
dev_err(dev, "dpni_get_attributes() failed (err=%d)\n", err);
-   goto err_get_attr;
+   goto close;
}
 
/* Configure buffer layouts */
@@ -1827,7 +1825,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
 DPNI_QUEUE_RX, _layout);
if (err) {
dev_err(dev, "dpni_set_buffer_layout(RX) failed\n");
-   goto err_buf_layout;
+   goto close;
}
 
/* tx buffer */
@@ -1837,7 +1835,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
 DPNI_QUEUE_TX, _layout);
if (err) {
dev_err(dev, "dpni_set_buffer_layout(TX) failed\n");
-   goto err_buf_layout;
+   goto close;
}
 
/* tx-confirm buffer */
@@ -1846,7 +1844,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
 DPNI_QUEUE_TX_CONFIRM, _layout);
if (err) {
dev_err(dev, "dpni_set_buffer_layout(TX_CONF) failed\n");
-   goto err_buf_layout;
+   goto close;
}
 
/* Now that we've set our tx buffer layout, retrieve the minimum
@@ -1856,7 +1854,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
  >tx_data_offset);
if (err) {
dev_err(dev, "dpni_get_tx_data_offset() failed\n");
-   goto err_data_offset;
+   goto close;
}
 
if ((priv->tx_data_offset % 64) != 0)
@@ -1868,12 +1866,9 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
 
return 0;
 
-err_data_offset:
-err_buf_layout:
-err_get_attr:
-err_reset:
+close:
dpni_close(priv->mc_io, 0, priv->mc_token);
-err_open:
+
return err;
 }
 
-- 
2.7.4



[PATCH v2 3/5] staging: fsl-dpaa2/eth: Don't account SWA in tx_data_offset

2017-10-29 Thread Bogdan Purcareata
When configuring the Tx buffer layout, the software annotation size is
mentioned, and MC accounts for it when configuring the frame
tx_data_offset. No need to handle it in the driver as well.

This results in 64B less memory allocated per frame.

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
---
v1 -> v2:
- added clarification in commit message

 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
index 92faaaf..d68c1f5 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
@@ -1872,9 +1872,6 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
dev_warn(dev, "Tx data offset (%d) not a multiple of 64B\n",
 priv->tx_data_offset);
 
-   /* Accommodate software annotation space (SWA) */
-   priv->tx_data_offset += DPAA2_ETH_SWA_SIZE;
-
return 0;
 
 close:
-- 
2.7.4



[PATCH v2 3/5] staging: fsl-dpaa2/eth: Don't account SWA in tx_data_offset

2017-10-29 Thread Bogdan Purcareata
When configuring the Tx buffer layout, the software annotation size is
mentioned, and MC accounts for it when configuring the frame
tx_data_offset. No need to handle it in the driver as well.

This results in 64B less memory allocated per frame.

Signed-off-by: Bogdan Purcareata 
---
v1 -> v2:
- added clarification in commit message

 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
index 92faaaf..d68c1f5 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
@@ -1872,9 +1872,6 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
dev_warn(dev, "Tx data offset (%d) not a multiple of 64B\n",
 priv->tx_data_offset);
 
-   /* Accommodate software annotation space (SWA) */
-   priv->tx_data_offset += DPAA2_ETH_SWA_SIZE;
-
return 0;
 
 close:
-- 
2.7.4



[PATCH v2 0/5] staging: fsl-dpaa2/eth: Frame buffer work

2017-10-29 Thread Bogdan Purcareata
This patchset does some refactoring in the frame buffer area, in order
for it to be in line with firmware (MC) configuration.

Patches 1 - 2 do some label cleanup and move the buffer layout setup
to a dedicated function.

Patch 3 updates tx_data_offset - the offset for Tx frame buffers - to
not account the software annotation area, since it's already accounted
for by the firmware. This results in slightly less allocated memory.

Patch 4 updates the required alignment for Rx frame buffers, based on
the accelerator hardware version.

Patch 5 configures a headroom in the Rx frame buffers to prevent
netstack reallocations in forwarding scenarios.

Patchset sent against staging-next.

v1 -> v2:
- clarified one commit message
- changed some macros to inline functions
- more comments per individual patches

Bogdan Purcareata (3):
  staging: fsl-dpaa2/eth: Don't account SWA in tx_data_offset
  staging: fsl-dpaa2/eth: Change RX buffer alignment
  staging: fsl-dpaa2/eth: Extra headroom in RX buffers

Ioana Radulescu (2):
  staging: fsl-dpaa2/eth: Label cleanup
  staging: fsl-dpaa2/eth: Split function

 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 176 ++---
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h |  54 +---
 2 files changed, 141 insertions(+), 89 deletions(-)

-- 
2.7.4



[PATCH v2 0/5] staging: fsl-dpaa2/eth: Frame buffer work

2017-10-29 Thread Bogdan Purcareata
This patchset does some refactoring in the frame buffer area, in order
for it to be in line with firmware (MC) configuration.

Patches 1 - 2 do some label cleanup and move the buffer layout setup
to a dedicated function.

Patch 3 updates tx_data_offset - the offset for Tx frame buffers - to
not account the software annotation area, since it's already accounted
for by the firmware. This results in slightly less allocated memory.

Patch 4 updates the required alignment for Rx frame buffers, based on
the accelerator hardware version.

Patch 5 configures a headroom in the Rx frame buffers to prevent
netstack reallocations in forwarding scenarios.

Patchset sent against staging-next.

v1 -> v2:
- clarified one commit message
- changed some macros to inline functions
- more comments per individual patches

Bogdan Purcareata (3):
  staging: fsl-dpaa2/eth: Don't account SWA in tx_data_offset
  staging: fsl-dpaa2/eth: Change RX buffer alignment
  staging: fsl-dpaa2/eth: Extra headroom in RX buffers

Ioana Radulescu (2):
  staging: fsl-dpaa2/eth: Label cleanup
  staging: fsl-dpaa2/eth: Split function

 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 176 ++---
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h |  54 +---
 2 files changed, 141 insertions(+), 89 deletions(-)

-- 
2.7.4



RE: [PATCH 4/5] staging: fsl-dpaa2/eth: Change RX buffer alignment

2017-10-27 Thread Bogdan Purcareata
> -Original Message-
> From: Dan Carpenter [mailto:dan.carpen...@oracle.com]
> Sent: Friday, October 27, 2017 5:30 PM
> To: Bogdan Purcareata <bogdan.purcare...@nxp.com>
> Cc: Ruxandra Ioana Radulescu <ruxandra.radule...@nxp.com>;
> gre...@linuxfoundation.org; linux-kernel@vger.kernel.org;
> de...@driverdev.osuosl.org
> Subject: Re: [PATCH 4/5] staging: fsl-dpaa2/eth: Change RX buffer alignment
> 
> On Fri, Oct 27, 2017 at 02:11:35PM +, Bogdan Purcareata wrote:
> > @@ -93,10 +100,10 @@
> >   * buffers large enough to allow building an skb around them and also
> account
> >   * for alignment restrictions
> >   */
> > -#define DPAA2_ETH_BUF_RAW_SIZE \
> > +#define DPAA2_ETH_BUF_RAW_SIZE(priv) \
> > (DPAA2_ETH_RX_BUF_SIZE + \
> > SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) + \
> > -   DPAA2_ETH_RX_BUF_ALIGN)
> > +   (priv)->rx_buf_align)
> >
> 
> Not related to this patch, but this macro is ugly.  It would be better
> as function.

Okay, will change the macros to inline functions in v2, where applicable.

Thank you!
Bogdan P.


RE: [PATCH 4/5] staging: fsl-dpaa2/eth: Change RX buffer alignment

2017-10-27 Thread Bogdan Purcareata
> -Original Message-
> From: Dan Carpenter [mailto:dan.carpen...@oracle.com]
> Sent: Friday, October 27, 2017 5:30 PM
> To: Bogdan Purcareata 
> Cc: Ruxandra Ioana Radulescu ;
> gre...@linuxfoundation.org; linux-kernel@vger.kernel.org;
> de...@driverdev.osuosl.org
> Subject: Re: [PATCH 4/5] staging: fsl-dpaa2/eth: Change RX buffer alignment
> 
> On Fri, Oct 27, 2017 at 02:11:35PM +, Bogdan Purcareata wrote:
> > @@ -93,10 +100,10 @@
> >   * buffers large enough to allow building an skb around them and also
> account
> >   * for alignment restrictions
> >   */
> > -#define DPAA2_ETH_BUF_RAW_SIZE \
> > +#define DPAA2_ETH_BUF_RAW_SIZE(priv) \
> > (DPAA2_ETH_RX_BUF_SIZE + \
> > SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) + \
> > -   DPAA2_ETH_RX_BUF_ALIGN)
> > +   (priv)->rx_buf_align)
> >
> 
> Not related to this patch, but this macro is ugly.  It would be better
> as function.

Okay, will change the macros to inline functions in v2, where applicable.

Thank you!
Bogdan P.


RE: [PATCH 3/5] staging: fsl-dpaa2/eth: Don't account SWA in tx_data_offset

2017-10-27 Thread Bogdan Purcareata
> -Original Message-
> From: Dan Carpenter [mailto:dan.carpen...@oracle.com]
> Sent: Friday, October 27, 2017 5:34 PM
> To: Bogdan Purcareata <bogdan.purcare...@nxp.com>
> Cc: Ruxandra Ioana Radulescu <ruxandra.radule...@nxp.com>;
> gre...@linuxfoundation.org; linux-kernel@vger.kernel.org;
> de...@driverdev.osuosl.org
> Subject: Re: [PATCH 3/5] staging: fsl-dpaa2/eth: Don't account SWA in
> tx_data_offset
> 
> On Fri, Oct 27, 2017 at 02:31:22PM +, Bogdan Purcareata wrote:
> > > -Original Message-
> > > From: Dan Carpenter [mailto:dan.carpen...@oracle.com]
> > > Sent: Friday, October 27, 2017 5:27 PM
> > > To: Bogdan Purcareata <bogdan.purcare...@nxp.com>
> > > Cc: Ruxandra Ioana Radulescu <ruxandra.radule...@nxp.com>;
> > > gre...@linuxfoundation.org; linux-kernel@vger.kernel.org;
> > > de...@driverdev.osuosl.org
> > > Subject: Re: [PATCH 3/5] staging: fsl-dpaa2/eth: Don't account SWA in
> > > tx_data_offset
> > >
> > >
> > > On Fri, Oct 27, 2017 at 02:11:34PM +, Bogdan Purcareata wrote:
> > > > When configuring the Tx buffer layout, the software annotation size is
> > > > mentioned, and MC accounts for it when configuring the frame
> > > > tx_data_offset. No need to handle it in the driver as well.
> > > >
> > >
> > > The impact is that we allocate slightly less memory right?
> >
> > Yes, 64B per frame.
> 
> Ok.  Cool.  Please put this kind of stuff in the changelog.  At first I
> thought it was maybe a buffer overflow just from reading what was in the
> email without looking at the code.

Okay, will update in v2.

Thank you!
Bogdan P.


RE: [PATCH 3/5] staging: fsl-dpaa2/eth: Don't account SWA in tx_data_offset

2017-10-27 Thread Bogdan Purcareata
> -Original Message-
> From: Dan Carpenter [mailto:dan.carpen...@oracle.com]
> Sent: Friday, October 27, 2017 5:34 PM
> To: Bogdan Purcareata 
> Cc: Ruxandra Ioana Radulescu ;
> gre...@linuxfoundation.org; linux-kernel@vger.kernel.org;
> de...@driverdev.osuosl.org
> Subject: Re: [PATCH 3/5] staging: fsl-dpaa2/eth: Don't account SWA in
> tx_data_offset
> 
> On Fri, Oct 27, 2017 at 02:31:22PM +, Bogdan Purcareata wrote:
> > > -Original Message-
> > > From: Dan Carpenter [mailto:dan.carpen...@oracle.com]
> > > Sent: Friday, October 27, 2017 5:27 PM
> > > To: Bogdan Purcareata 
> > > Cc: Ruxandra Ioana Radulescu ;
> > > gre...@linuxfoundation.org; linux-kernel@vger.kernel.org;
> > > de...@driverdev.osuosl.org
> > > Subject: Re: [PATCH 3/5] staging: fsl-dpaa2/eth: Don't account SWA in
> > > tx_data_offset
> > >
> > >
> > > On Fri, Oct 27, 2017 at 02:11:34PM +, Bogdan Purcareata wrote:
> > > > When configuring the Tx buffer layout, the software annotation size is
> > > > mentioned, and MC accounts for it when configuring the frame
> > > > tx_data_offset. No need to handle it in the driver as well.
> > > >
> > >
> > > The impact is that we allocate slightly less memory right?
> >
> > Yes, 64B per frame.
> 
> Ok.  Cool.  Please put this kind of stuff in the changelog.  At first I
> thought it was maybe a buffer overflow just from reading what was in the
> email without looking at the code.

Okay, will update in v2.

Thank you!
Bogdan P.


RE: [PATCH 3/5] staging: fsl-dpaa2/eth: Don't account SWA in tx_data_offset

2017-10-27 Thread Bogdan Purcareata
> -Original Message-
> From: Dan Carpenter [mailto:dan.carpen...@oracle.com]
> Sent: Friday, October 27, 2017 5:27 PM
> To: Bogdan Purcareata <bogdan.purcare...@nxp.com>
> Cc: Ruxandra Ioana Radulescu <ruxandra.radule...@nxp.com>;
> gre...@linuxfoundation.org; linux-kernel@vger.kernel.org;
> de...@driverdev.osuosl.org
> Subject: Re: [PATCH 3/5] staging: fsl-dpaa2/eth: Don't account SWA in
> tx_data_offset
> 
> 
> On Fri, Oct 27, 2017 at 02:11:34PM +, Bogdan Purcareata wrote:
> > When configuring the Tx buffer layout, the software annotation size is
> > mentioned, and MC accounts for it when configuring the frame
> > tx_data_offset. No need to handle it in the driver as well.
> >
> 
> The impact is that we allocate slightly less memory right?

Yes, 64B per frame.

Bogdan P.


RE: [PATCH 3/5] staging: fsl-dpaa2/eth: Don't account SWA in tx_data_offset

2017-10-27 Thread Bogdan Purcareata
> -Original Message-
> From: Dan Carpenter [mailto:dan.carpen...@oracle.com]
> Sent: Friday, October 27, 2017 5:27 PM
> To: Bogdan Purcareata 
> Cc: Ruxandra Ioana Radulescu ;
> gre...@linuxfoundation.org; linux-kernel@vger.kernel.org;
> de...@driverdev.osuosl.org
> Subject: Re: [PATCH 3/5] staging: fsl-dpaa2/eth: Don't account SWA in
> tx_data_offset
> 
> 
> On Fri, Oct 27, 2017 at 02:11:34PM +, Bogdan Purcareata wrote:
> > When configuring the Tx buffer layout, the software annotation size is
> > mentioned, and MC accounts for it when configuring the frame
> > tx_data_offset. No need to handle it in the driver as well.
> >
> 
> The impact is that we allocate slightly less memory right?

Yes, 64B per frame.

Bogdan P.


[PATCH 4/5] staging: fsl-dpaa2/eth: Change RX buffer alignment

2017-10-27 Thread Bogdan Purcareata
The WRIOP hardware block v1.0.0 (found on LS2080A board)
requires data in RX buffers to be aligned to 256B, but
newer revisions (e.g. on LS2088A, LS1088A) only require
64B alignment.

Check WRIOP version and decide at runtime which alignment
requirement to configure for ingress buffers.

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
Signed-off-by: Ioana Radulescu <ruxandra.radule...@nxp.com>
---
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 18 ++
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h | 14 +++---
 2 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
index d68c1f5..29b4928 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
@@ -766,11 +766,11 @@ static int add_bufs(struct dpaa2_eth_priv *priv, u16 bpid)
/* Allocate buffer visible to WRIOP + skb shared info +
 * alignment padding
 */
-   buf = napi_alloc_frag(DPAA2_ETH_BUF_RAW_SIZE);
+   buf = napi_alloc_frag(DPAA2_ETH_BUF_RAW_SIZE(priv));
if (unlikely(!buf))
goto err_alloc;
 
-   buf = PTR_ALIGN(buf, DPAA2_ETH_RX_BUF_ALIGN);
+   buf = PTR_ALIGN(buf, priv->rx_buf_align);
 
addr = dma_map_single(dev, buf, DPAA2_ETH_RX_BUF_SIZE,
  DMA_FROM_DEVICE);
@@ -781,7 +781,7 @@ static int add_bufs(struct dpaa2_eth_priv *priv, u16 bpid)
 
/* tracing point */
trace_dpaa2_eth_buf_seed(priv->net_dev,
-buf, DPAA2_ETH_BUF_RAW_SIZE,
+buf, DPAA2_ETH_BUF_RAW_SIZE(priv),
 addr, DPAA2_ETH_RX_BUF_SIZE,
 bpid);
}
@@ -1782,11 +1782,21 @@ static int set_buffer_layout(struct dpaa2_eth_priv 
*priv)
struct dpni_buffer_layout buf_layout = {0};
int err;
 
+   /* We need to check for WRIOP version 1.0.0, but depending on the MC
+* version, this number is not always provided correctly on rev1.
+* We need to check for both alternatives in this situation.
+*/
+   if (priv->dpni_attrs.wriop_version == DPAA2_WRIOP_VERSION(0, 0, 0) ||
+   priv->dpni_attrs.wriop_version == DPAA2_WRIOP_VERSION(1, 0, 0))
+   priv->rx_buf_align = DPAA2_ETH_RX_BUF_ALIGN_REV1;
+   else
+   priv->rx_buf_align = DPAA2_ETH_RX_BUF_ALIGN;
+
/* rx buffer */
buf_layout.pass_parser_result = true;
buf_layout.pass_frame_status = true;
buf_layout.private_data_size = DPAA2_ETH_SWA_SIZE;
-   buf_layout.data_align = DPAA2_ETH_RX_BUF_ALIGN;
+   buf_layout.data_align = priv->rx_buf_align;
buf_layout.options = DPNI_BUF_LAYOUT_OPT_PARSER_RESULT |
 DPNI_BUF_LAYOUT_OPT_FRAME_STATUS |
 DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE |
diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
index bfbabae..374a99a 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
@@ -45,6 +45,8 @@
 
 #include "dpaa2-eth-trace.h"
 
+#define DPAA2_WRIOP_VERSION(x, y, z) ((x) << 10 | (y) << 5 | (z) << 0)
+
 #define DPAA2_ETH_STORE_SIZE   16
 
 /* Maximum number of scatter-gather entries in an ingress frame,
@@ -85,7 +87,12 @@
  */
 #define DPAA2_ETH_RX_BUF_SIZE  2048
 #define DPAA2_ETH_TX_BUF_ALIGN 64
-#define DPAA2_ETH_RX_BUF_ALIGN 256
+/* Due to a limitation in WRIOP 1.0.0, the RX buffer data must be aligned
+ * to 256B. For newer revisions, the requirement is only for 64B alignment
+ */
+#define DPAA2_ETH_RX_BUF_ALIGN_REV1256
+#define DPAA2_ETH_RX_BUF_ALIGN 64
+
 #define DPAA2_ETH_NEEDED_HEADROOM(p_priv) \
((p_priv)->tx_data_offset + DPAA2_ETH_TX_BUF_ALIGN)
 
@@ -93,10 +100,10 @@
  * buffers large enough to allow building an skb around them and also account
  * for alignment restrictions
  */
-#define DPAA2_ETH_BUF_RAW_SIZE \
+#define DPAA2_ETH_BUF_RAW_SIZE(priv) \
(DPAA2_ETH_RX_BUF_SIZE + \
SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) + \
-   DPAA2_ETH_RX_BUF_ALIGN)
+   (priv)->rx_buf_align)
 
 /* We are accommodating a skb backpointer and some S/G info
  * in the frame's software annotation. The hardware
@@ -318,6 +325,7 @@ struct dpaa2_eth_priv {
struct iommu_domain *iommu_domain;
 
u16 tx_qdid;
+   u16 rx_buf_align;
struct fsl_mc_io *mc_io;
/* Cores which have an affine DPIO/DPCON.
 * This is the cpu set on which Rx and Tx conf frames are processed
-- 
2.7.4



[PATCH 4/5] staging: fsl-dpaa2/eth: Change RX buffer alignment

2017-10-27 Thread Bogdan Purcareata
The WRIOP hardware block v1.0.0 (found on LS2080A board)
requires data in RX buffers to be aligned to 256B, but
newer revisions (e.g. on LS2088A, LS1088A) only require
64B alignment.

Check WRIOP version and decide at runtime which alignment
requirement to configure for ingress buffers.

Signed-off-by: Bogdan Purcareata 
Signed-off-by: Ioana Radulescu 
---
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 18 ++
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h | 14 +++---
 2 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
index d68c1f5..29b4928 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
@@ -766,11 +766,11 @@ static int add_bufs(struct dpaa2_eth_priv *priv, u16 bpid)
/* Allocate buffer visible to WRIOP + skb shared info +
 * alignment padding
 */
-   buf = napi_alloc_frag(DPAA2_ETH_BUF_RAW_SIZE);
+   buf = napi_alloc_frag(DPAA2_ETH_BUF_RAW_SIZE(priv));
if (unlikely(!buf))
goto err_alloc;
 
-   buf = PTR_ALIGN(buf, DPAA2_ETH_RX_BUF_ALIGN);
+   buf = PTR_ALIGN(buf, priv->rx_buf_align);
 
addr = dma_map_single(dev, buf, DPAA2_ETH_RX_BUF_SIZE,
  DMA_FROM_DEVICE);
@@ -781,7 +781,7 @@ static int add_bufs(struct dpaa2_eth_priv *priv, u16 bpid)
 
/* tracing point */
trace_dpaa2_eth_buf_seed(priv->net_dev,
-buf, DPAA2_ETH_BUF_RAW_SIZE,
+buf, DPAA2_ETH_BUF_RAW_SIZE(priv),
 addr, DPAA2_ETH_RX_BUF_SIZE,
 bpid);
}
@@ -1782,11 +1782,21 @@ static int set_buffer_layout(struct dpaa2_eth_priv 
*priv)
struct dpni_buffer_layout buf_layout = {0};
int err;
 
+   /* We need to check for WRIOP version 1.0.0, but depending on the MC
+* version, this number is not always provided correctly on rev1.
+* We need to check for both alternatives in this situation.
+*/
+   if (priv->dpni_attrs.wriop_version == DPAA2_WRIOP_VERSION(0, 0, 0) ||
+   priv->dpni_attrs.wriop_version == DPAA2_WRIOP_VERSION(1, 0, 0))
+   priv->rx_buf_align = DPAA2_ETH_RX_BUF_ALIGN_REV1;
+   else
+   priv->rx_buf_align = DPAA2_ETH_RX_BUF_ALIGN;
+
/* rx buffer */
buf_layout.pass_parser_result = true;
buf_layout.pass_frame_status = true;
buf_layout.private_data_size = DPAA2_ETH_SWA_SIZE;
-   buf_layout.data_align = DPAA2_ETH_RX_BUF_ALIGN;
+   buf_layout.data_align = priv->rx_buf_align;
buf_layout.options = DPNI_BUF_LAYOUT_OPT_PARSER_RESULT |
 DPNI_BUF_LAYOUT_OPT_FRAME_STATUS |
 DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE |
diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
index bfbabae..374a99a 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
@@ -45,6 +45,8 @@
 
 #include "dpaa2-eth-trace.h"
 
+#define DPAA2_WRIOP_VERSION(x, y, z) ((x) << 10 | (y) << 5 | (z) << 0)
+
 #define DPAA2_ETH_STORE_SIZE   16
 
 /* Maximum number of scatter-gather entries in an ingress frame,
@@ -85,7 +87,12 @@
  */
 #define DPAA2_ETH_RX_BUF_SIZE  2048
 #define DPAA2_ETH_TX_BUF_ALIGN 64
-#define DPAA2_ETH_RX_BUF_ALIGN 256
+/* Due to a limitation in WRIOP 1.0.0, the RX buffer data must be aligned
+ * to 256B. For newer revisions, the requirement is only for 64B alignment
+ */
+#define DPAA2_ETH_RX_BUF_ALIGN_REV1256
+#define DPAA2_ETH_RX_BUF_ALIGN 64
+
 #define DPAA2_ETH_NEEDED_HEADROOM(p_priv) \
((p_priv)->tx_data_offset + DPAA2_ETH_TX_BUF_ALIGN)
 
@@ -93,10 +100,10 @@
  * buffers large enough to allow building an skb around them and also account
  * for alignment restrictions
  */
-#define DPAA2_ETH_BUF_RAW_SIZE \
+#define DPAA2_ETH_BUF_RAW_SIZE(priv) \
(DPAA2_ETH_RX_BUF_SIZE + \
SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) + \
-   DPAA2_ETH_RX_BUF_ALIGN)
+   (priv)->rx_buf_align)
 
 /* We are accommodating a skb backpointer and some S/G info
  * in the frame's software annotation. The hardware
@@ -318,6 +325,7 @@ struct dpaa2_eth_priv {
struct iommu_domain *iommu_domain;
 
u16 tx_qdid;
+   u16 rx_buf_align;
struct fsl_mc_io *mc_io;
/* Cores which have an affine DPIO/DPCON.
 * This is the cpu set on which Rx and Tx conf frames are processed
-- 
2.7.4



[PATCH 5/5] staging: fsl-dpaa2/eth: Extra headroom in RX buffers

2017-10-27 Thread Bogdan Purcareata
The needed headroom that we ask the stack to reserve for us in TX
skbs is larger than the headroom available in RX frames, which
leads to skb reallocations in forwarding scenarios involving two
DPNI interfaces.

Configure the hardware to reserve some extra space in the RX
frame headroom to avoid this situation. The value is chosen based
on the Tx frame data offset, the Rx buffer alignment value and the
netdevice required headroom.

The network stack will take care to reserve space for HH_DATA_MOD when
building the skb, so there's no need to account for it in the netdevice
needed headroom.

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
Signed-off-by: Ioana Radulescu <ruxandra.radule...@nxp.com>
---
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 79 +++---
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h | 32 +++
 2 files changed, 67 insertions(+), 44 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
index 29b4928..636beac 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
@@ -135,8 +135,7 @@ static struct sk_buff *build_linear_skb(struct 
dpaa2_eth_priv *priv,
 
ch->buf_count--;
 
-   skb = build_skb(fd_vaddr, DPAA2_ETH_RX_BUF_SIZE +
-   SKB_DATA_ALIGN(sizeof(struct skb_shared_info)));
+   skb = build_skb(fd_vaddr, DPAA2_ETH_SKB_SIZE);
if (unlikely(!skb))
return NULL;
 
@@ -178,8 +177,7 @@ static struct sk_buff *build_frag_skb(struct dpaa2_eth_priv 
*priv,
 
if (i == 0) {
/* We build the skb around the first data buffer */
-   skb = build_skb(sg_vaddr, DPAA2_ETH_RX_BUF_SIZE +
-   SKB_DATA_ALIGN(sizeof(struct skb_shared_info)));
+   skb = build_skb(sg_vaddr, DPAA2_ETH_SKB_SIZE);
if (unlikely(!skb)) {
/* Free the first SG entry now, since we already
 * unmapped it and obtained the virtual address
@@ -1792,23 +1790,9 @@ static int set_buffer_layout(struct dpaa2_eth_priv *priv)
else
priv->rx_buf_align = DPAA2_ETH_RX_BUF_ALIGN;
 
-   /* rx buffer */
-   buf_layout.pass_parser_result = true;
+   /* tx buffer */
buf_layout.pass_frame_status = true;
buf_layout.private_data_size = DPAA2_ETH_SWA_SIZE;
-   buf_layout.data_align = priv->rx_buf_align;
-   buf_layout.options = DPNI_BUF_LAYOUT_OPT_PARSER_RESULT |
-DPNI_BUF_LAYOUT_OPT_FRAME_STATUS |
-DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE |
-DPNI_BUF_LAYOUT_OPT_DATA_ALIGN;
-   err = dpni_set_buffer_layout(priv->mc_io, 0, priv->mc_token,
-DPNI_QUEUE_RX, _layout);
-   if (err) {
-   dev_err(dev, "dpni_set_buffer_layout(RX) failed\n");
-   return err;
-   }
-
-   /* tx buffer */
buf_layout.options = DPNI_BUF_LAYOUT_OPT_FRAME_STATUS |
 DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE;
err = dpni_set_buffer_layout(priv->mc_io, 0, priv->mc_token,
@@ -1827,6 +1811,36 @@ static int set_buffer_layout(struct dpaa2_eth_priv *priv)
return err;
}
 
+   /* Now that we've set our tx buffer layout, retrieve the minimum
+* required tx data offset.
+*/
+   err = dpni_get_tx_data_offset(priv->mc_io, 0, priv->mc_token,
+ >tx_data_offset);
+   if (err) {
+   dev_err(dev, "dpni_get_tx_data_offset() failed\n");
+   return err;
+   }
+
+   if ((priv->tx_data_offset % 64) != 0)
+   dev_warn(dev, "Tx data offset (%d) not a multiple of 64B\n",
+priv->tx_data_offset);
+
+   /* rx buffer */
+   buf_layout.pass_parser_result = true;
+   buf_layout.data_align = priv->rx_buf_align;
+   buf_layout.data_head_room = DPAA2_ETH_RX_HEAD_ROOM(priv);
+   buf_layout.private_data_size = 0;
+   buf_layout.options = DPNI_BUF_LAYOUT_OPT_PARSER_RESULT |
+DPNI_BUF_LAYOUT_OPT_FRAME_STATUS |
+DPNI_BUF_LAYOUT_OPT_DATA_ALIGN |
+DPNI_BUF_LAYOUT_OPT_DATA_HEAD_ROOM;
+   err = dpni_set_buffer_layout(priv->mc_io, 0, priv->mc_token,
+DPNI_QUEUE_RX, _layout);
+   if (err) {
+   dev_err(dev, "dpni_set_buffer_layout(RX) failed\n");
+   return err;
+   }
+
return 0;
 }
 
@@ -1868,19 +1882,6 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
if (err)
goto close;
 
-   /*

[PATCH 5/5] staging: fsl-dpaa2/eth: Extra headroom in RX buffers

2017-10-27 Thread Bogdan Purcareata
The needed headroom that we ask the stack to reserve for us in TX
skbs is larger than the headroom available in RX frames, which
leads to skb reallocations in forwarding scenarios involving two
DPNI interfaces.

Configure the hardware to reserve some extra space in the RX
frame headroom to avoid this situation. The value is chosen based
on the Tx frame data offset, the Rx buffer alignment value and the
netdevice required headroom.

The network stack will take care to reserve space for HH_DATA_MOD when
building the skb, so there's no need to account for it in the netdevice
needed headroom.

Signed-off-by: Bogdan Purcareata 
Signed-off-by: Ioana Radulescu 
---
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 79 +++---
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h | 32 +++
 2 files changed, 67 insertions(+), 44 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
index 29b4928..636beac 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
@@ -135,8 +135,7 @@ static struct sk_buff *build_linear_skb(struct 
dpaa2_eth_priv *priv,
 
ch->buf_count--;
 
-   skb = build_skb(fd_vaddr, DPAA2_ETH_RX_BUF_SIZE +
-   SKB_DATA_ALIGN(sizeof(struct skb_shared_info)));
+   skb = build_skb(fd_vaddr, DPAA2_ETH_SKB_SIZE);
if (unlikely(!skb))
return NULL;
 
@@ -178,8 +177,7 @@ static struct sk_buff *build_frag_skb(struct dpaa2_eth_priv 
*priv,
 
if (i == 0) {
/* We build the skb around the first data buffer */
-   skb = build_skb(sg_vaddr, DPAA2_ETH_RX_BUF_SIZE +
-   SKB_DATA_ALIGN(sizeof(struct skb_shared_info)));
+   skb = build_skb(sg_vaddr, DPAA2_ETH_SKB_SIZE);
if (unlikely(!skb)) {
/* Free the first SG entry now, since we already
 * unmapped it and obtained the virtual address
@@ -1792,23 +1790,9 @@ static int set_buffer_layout(struct dpaa2_eth_priv *priv)
else
priv->rx_buf_align = DPAA2_ETH_RX_BUF_ALIGN;
 
-   /* rx buffer */
-   buf_layout.pass_parser_result = true;
+   /* tx buffer */
buf_layout.pass_frame_status = true;
buf_layout.private_data_size = DPAA2_ETH_SWA_SIZE;
-   buf_layout.data_align = priv->rx_buf_align;
-   buf_layout.options = DPNI_BUF_LAYOUT_OPT_PARSER_RESULT |
-DPNI_BUF_LAYOUT_OPT_FRAME_STATUS |
-DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE |
-DPNI_BUF_LAYOUT_OPT_DATA_ALIGN;
-   err = dpni_set_buffer_layout(priv->mc_io, 0, priv->mc_token,
-DPNI_QUEUE_RX, _layout);
-   if (err) {
-   dev_err(dev, "dpni_set_buffer_layout(RX) failed\n");
-   return err;
-   }
-
-   /* tx buffer */
buf_layout.options = DPNI_BUF_LAYOUT_OPT_FRAME_STATUS |
 DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE;
err = dpni_set_buffer_layout(priv->mc_io, 0, priv->mc_token,
@@ -1827,6 +1811,36 @@ static int set_buffer_layout(struct dpaa2_eth_priv *priv)
return err;
}
 
+   /* Now that we've set our tx buffer layout, retrieve the minimum
+* required tx data offset.
+*/
+   err = dpni_get_tx_data_offset(priv->mc_io, 0, priv->mc_token,
+ >tx_data_offset);
+   if (err) {
+   dev_err(dev, "dpni_get_tx_data_offset() failed\n");
+   return err;
+   }
+
+   if ((priv->tx_data_offset % 64) != 0)
+   dev_warn(dev, "Tx data offset (%d) not a multiple of 64B\n",
+priv->tx_data_offset);
+
+   /* rx buffer */
+   buf_layout.pass_parser_result = true;
+   buf_layout.data_align = priv->rx_buf_align;
+   buf_layout.data_head_room = DPAA2_ETH_RX_HEAD_ROOM(priv);
+   buf_layout.private_data_size = 0;
+   buf_layout.options = DPNI_BUF_LAYOUT_OPT_PARSER_RESULT |
+DPNI_BUF_LAYOUT_OPT_FRAME_STATUS |
+DPNI_BUF_LAYOUT_OPT_DATA_ALIGN |
+DPNI_BUF_LAYOUT_OPT_DATA_HEAD_ROOM;
+   err = dpni_set_buffer_layout(priv->mc_io, 0, priv->mc_token,
+DPNI_QUEUE_RX, _layout);
+   if (err) {
+   dev_err(dev, "dpni_set_buffer_layout(RX) failed\n");
+   return err;
+   }
+
return 0;
 }
 
@@ -1868,19 +1882,6 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
if (err)
goto close;
 
-   /* Now that we've set our tx buffer layout, retrieve the minimum
-* required t

[PATCH 2/5] staging: fsl-dpaa2/eth: Split function

2017-10-27 Thread Bogdan Purcareata
From: Ioana Radulescu <ruxandra.radule...@nxp.com>

Since setup_dpni() became a bit too long, move the buffer layout
configuration to a separate function.

Signed-off-by: Ioana Radulescu <ruxandra.radule...@nxp.com>
Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
---
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 79 +++---
 1 file changed, 45 insertions(+), 34 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
index 5d2bd18..92faaaf 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
@@ -1776,42 +1776,12 @@ static void free_dpbp(struct dpaa2_eth_priv *priv)
fsl_mc_object_free(priv->dpbp_dev);
 }
 
-/* Configure the DPNI object this interface is associated with */
-static int setup_dpni(struct fsl_mc_device *ls_dev)
+static int set_buffer_layout(struct dpaa2_eth_priv *priv)
 {
-   struct device *dev = _dev->dev;
-   struct dpaa2_eth_priv *priv;
-   struct net_device *net_dev;
+   struct device *dev = priv->net_dev->dev.parent;
struct dpni_buffer_layout buf_layout = {0};
int err;
 
-   net_dev = dev_get_drvdata(dev);
-   priv = netdev_priv(net_dev);
-
-   /* get a handle for the DPNI object */
-   err = dpni_open(priv->mc_io, 0, ls_dev->obj_desc.id, >mc_token);
-   if (err) {
-   dev_err(dev, "dpni_open() failed\n");
-   return err;
-   }
-
-   ls_dev->mc_io = priv->mc_io;
-   ls_dev->mc_handle = priv->mc_token;
-
-   err = dpni_reset(priv->mc_io, 0, priv->mc_token);
-   if (err) {
-   dev_err(dev, "dpni_reset() failed\n");
-   goto close;
-   }
-
-   err = dpni_get_attributes(priv->mc_io, 0, priv->mc_token,
- >dpni_attrs);
-   if (err) {
-   dev_err(dev, "dpni_get_attributes() failed (err=%d)\n", err);
-   goto close;
-   }
-
-   /* Configure buffer layouts */
/* rx buffer */
buf_layout.pass_parser_result = true;
buf_layout.pass_frame_status = true;
@@ -1825,7 +1795,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
 DPNI_QUEUE_RX, _layout);
if (err) {
dev_err(dev, "dpni_set_buffer_layout(RX) failed\n");
-   goto close;
+   return err;
}
 
/* tx buffer */
@@ -1835,7 +1805,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
 DPNI_QUEUE_TX, _layout);
if (err) {
dev_err(dev, "dpni_set_buffer_layout(TX) failed\n");
-   goto close;
+   return err;
}
 
/* tx-confirm buffer */
@@ -1844,9 +1814,50 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
 DPNI_QUEUE_TX_CONFIRM, _layout);
if (err) {
dev_err(dev, "dpni_set_buffer_layout(TX_CONF) failed\n");
+   return err;
+   }
+
+   return 0;
+}
+
+/* Configure the DPNI object this interface is associated with */
+static int setup_dpni(struct fsl_mc_device *ls_dev)
+{
+   struct device *dev = _dev->dev;
+   struct dpaa2_eth_priv *priv;
+   struct net_device *net_dev;
+   int err;
+
+   net_dev = dev_get_drvdata(dev);
+   priv = netdev_priv(net_dev);
+
+   /* get a handle for the DPNI object */
+   err = dpni_open(priv->mc_io, 0, ls_dev->obj_desc.id, >mc_token);
+   if (err) {
+   dev_err(dev, "dpni_open() failed\n");
+   return err;
+   }
+
+   ls_dev->mc_io = priv->mc_io;
+   ls_dev->mc_handle = priv->mc_token;
+
+   err = dpni_reset(priv->mc_io, 0, priv->mc_token);
+   if (err) {
+   dev_err(dev, "dpni_reset() failed\n");
goto close;
}
 
+   err = dpni_get_attributes(priv->mc_io, 0, priv->mc_token,
+ >dpni_attrs);
+   if (err) {
+   dev_err(dev, "dpni_get_attributes() failed (err=%d)\n", err);
+   goto close;
+   }
+
+   err = set_buffer_layout(priv);
+   if (err)
+   goto close;
+
/* Now that we've set our tx buffer layout, retrieve the minimum
 * required tx data offset.
 */
-- 
2.7.4



[PATCH 2/5] staging: fsl-dpaa2/eth: Split function

2017-10-27 Thread Bogdan Purcareata
From: Ioana Radulescu 

Since setup_dpni() became a bit too long, move the buffer layout
configuration to a separate function.

Signed-off-by: Ioana Radulescu 
Signed-off-by: Bogdan Purcareata 
---
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 79 +++---
 1 file changed, 45 insertions(+), 34 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
index 5d2bd18..92faaaf 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
@@ -1776,42 +1776,12 @@ static void free_dpbp(struct dpaa2_eth_priv *priv)
fsl_mc_object_free(priv->dpbp_dev);
 }
 
-/* Configure the DPNI object this interface is associated with */
-static int setup_dpni(struct fsl_mc_device *ls_dev)
+static int set_buffer_layout(struct dpaa2_eth_priv *priv)
 {
-   struct device *dev = _dev->dev;
-   struct dpaa2_eth_priv *priv;
-   struct net_device *net_dev;
+   struct device *dev = priv->net_dev->dev.parent;
struct dpni_buffer_layout buf_layout = {0};
int err;
 
-   net_dev = dev_get_drvdata(dev);
-   priv = netdev_priv(net_dev);
-
-   /* get a handle for the DPNI object */
-   err = dpni_open(priv->mc_io, 0, ls_dev->obj_desc.id, >mc_token);
-   if (err) {
-   dev_err(dev, "dpni_open() failed\n");
-   return err;
-   }
-
-   ls_dev->mc_io = priv->mc_io;
-   ls_dev->mc_handle = priv->mc_token;
-
-   err = dpni_reset(priv->mc_io, 0, priv->mc_token);
-   if (err) {
-   dev_err(dev, "dpni_reset() failed\n");
-   goto close;
-   }
-
-   err = dpni_get_attributes(priv->mc_io, 0, priv->mc_token,
- >dpni_attrs);
-   if (err) {
-   dev_err(dev, "dpni_get_attributes() failed (err=%d)\n", err);
-   goto close;
-   }
-
-   /* Configure buffer layouts */
/* rx buffer */
buf_layout.pass_parser_result = true;
buf_layout.pass_frame_status = true;
@@ -1825,7 +1795,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
 DPNI_QUEUE_RX, _layout);
if (err) {
dev_err(dev, "dpni_set_buffer_layout(RX) failed\n");
-   goto close;
+   return err;
}
 
/* tx buffer */
@@ -1835,7 +1805,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
 DPNI_QUEUE_TX, _layout);
if (err) {
dev_err(dev, "dpni_set_buffer_layout(TX) failed\n");
-   goto close;
+   return err;
}
 
/* tx-confirm buffer */
@@ -1844,9 +1814,50 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
 DPNI_QUEUE_TX_CONFIRM, _layout);
if (err) {
dev_err(dev, "dpni_set_buffer_layout(TX_CONF) failed\n");
+   return err;
+   }
+
+   return 0;
+}
+
+/* Configure the DPNI object this interface is associated with */
+static int setup_dpni(struct fsl_mc_device *ls_dev)
+{
+   struct device *dev = _dev->dev;
+   struct dpaa2_eth_priv *priv;
+   struct net_device *net_dev;
+   int err;
+
+   net_dev = dev_get_drvdata(dev);
+   priv = netdev_priv(net_dev);
+
+   /* get a handle for the DPNI object */
+   err = dpni_open(priv->mc_io, 0, ls_dev->obj_desc.id, >mc_token);
+   if (err) {
+   dev_err(dev, "dpni_open() failed\n");
+   return err;
+   }
+
+   ls_dev->mc_io = priv->mc_io;
+   ls_dev->mc_handle = priv->mc_token;
+
+   err = dpni_reset(priv->mc_io, 0, priv->mc_token);
+   if (err) {
+   dev_err(dev, "dpni_reset() failed\n");
goto close;
}
 
+   err = dpni_get_attributes(priv->mc_io, 0, priv->mc_token,
+ >dpni_attrs);
+   if (err) {
+   dev_err(dev, "dpni_get_attributes() failed (err=%d)\n", err);
+   goto close;
+   }
+
+   err = set_buffer_layout(priv);
+   if (err)
+   goto close;
+
/* Now that we've set our tx buffer layout, retrieve the minimum
 * required tx data offset.
 */
-- 
2.7.4



[PATCH 3/5] staging: fsl-dpaa2/eth: Don't account SWA in tx_data_offset

2017-10-27 Thread Bogdan Purcareata
When configuring the Tx buffer layout, the software annotation size is
mentioned, and MC accounts for it when configuring the frame
tx_data_offset. No need to handle it in the driver as well.

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
---
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
index 92faaaf..d68c1f5 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
@@ -1872,9 +1872,6 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
dev_warn(dev, "Tx data offset (%d) not a multiple of 64B\n",
 priv->tx_data_offset);
 
-   /* Accommodate software annotation space (SWA) */
-   priv->tx_data_offset += DPAA2_ETH_SWA_SIZE;
-
return 0;
 
 close:
-- 
2.7.4



[PATCH 3/5] staging: fsl-dpaa2/eth: Don't account SWA in tx_data_offset

2017-10-27 Thread Bogdan Purcareata
When configuring the Tx buffer layout, the software annotation size is
mentioned, and MC accounts for it when configuring the frame
tx_data_offset. No need to handle it in the driver as well.

Signed-off-by: Bogdan Purcareata 
---
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
index 92faaaf..d68c1f5 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
@@ -1872,9 +1872,6 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
dev_warn(dev, "Tx data offset (%d) not a multiple of 64B\n",
 priv->tx_data_offset);
 
-   /* Accommodate software annotation space (SWA) */
-   priv->tx_data_offset += DPAA2_ETH_SWA_SIZE;
-
return 0;
 
 close:
-- 
2.7.4



[PATCH 1/5] staging: fsl-dpaa2/eth: Label cleanup

2017-10-27 Thread Bogdan Purcareata
From: Ioana Radulescu <ruxandra.radule...@nxp.com>

Clean up goto labels in a couple of functions, by
removing/renaming redundant ones.

Signed-off-by: Ioana Radulescu <ruxandra.radule...@nxp.com>
Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
---
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 35 +++---
 1 file changed, 15 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
index 9fbc0ee..5d2bd18 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
@@ -1444,34 +1444,32 @@ static struct fsl_mc_device *setup_dpcon(struct 
dpaa2_eth_priv *priv)
err = dpcon_open(priv->mc_io, 0, dpcon->obj_desc.id, >mc_handle);
if (err) {
dev_err(dev, "dpcon_open() failed\n");
-   goto err_open;
+   goto free;
}
 
err = dpcon_reset(priv->mc_io, 0, dpcon->mc_handle);
if (err) {
dev_err(dev, "dpcon_reset() failed\n");
-   goto err_reset;
+   goto close;
}
 
err = dpcon_get_attributes(priv->mc_io, 0, dpcon->mc_handle, );
if (err) {
dev_err(dev, "dpcon_get_attributes() failed\n");
-   goto err_get_attr;
+   goto close;
}
 
err = dpcon_enable(priv->mc_io, 0, dpcon->mc_handle);
if (err) {
dev_err(dev, "dpcon_enable() failed\n");
-   goto err_enable;
+   goto close;
}
 
return dpcon;
 
-err_enable:
-err_get_attr:
-err_reset:
+close:
dpcon_close(priv->mc_io, 0, dpcon->mc_handle);
-err_open:
+free:
fsl_mc_object_free(dpcon);
 
return NULL;
@@ -1794,7 +1792,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
err = dpni_open(priv->mc_io, 0, ls_dev->obj_desc.id, >mc_token);
if (err) {
dev_err(dev, "dpni_open() failed\n");
-   goto err_open;
+   return err;
}
 
ls_dev->mc_io = priv->mc_io;
@@ -1803,14 +1801,14 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
err = dpni_reset(priv->mc_io, 0, priv->mc_token);
if (err) {
dev_err(dev, "dpni_reset() failed\n");
-   goto err_reset;
+   goto close;
}
 
err = dpni_get_attributes(priv->mc_io, 0, priv->mc_token,
  >dpni_attrs);
if (err) {
dev_err(dev, "dpni_get_attributes() failed (err=%d)\n", err);
-   goto err_get_attr;
+   goto close;
}
 
/* Configure buffer layouts */
@@ -1827,7 +1825,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
 DPNI_QUEUE_RX, _layout);
if (err) {
dev_err(dev, "dpni_set_buffer_layout(RX) failed\n");
-   goto err_buf_layout;
+   goto close;
}
 
/* tx buffer */
@@ -1837,7 +1835,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
 DPNI_QUEUE_TX, _layout);
if (err) {
dev_err(dev, "dpni_set_buffer_layout(TX) failed\n");
-   goto err_buf_layout;
+   goto close;
}
 
/* tx-confirm buffer */
@@ -1846,7 +1844,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
 DPNI_QUEUE_TX_CONFIRM, _layout);
if (err) {
dev_err(dev, "dpni_set_buffer_layout(TX_CONF) failed\n");
-   goto err_buf_layout;
+   goto close;
}
 
/* Now that we've set our tx buffer layout, retrieve the minimum
@@ -1856,7 +1854,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
  >tx_data_offset);
if (err) {
dev_err(dev, "dpni_get_tx_data_offset() failed\n");
-   goto err_data_offset;
+   goto close;
}
 
if ((priv->tx_data_offset % 64) != 0)
@@ -1868,12 +1866,9 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
 
return 0;
 
-err_data_offset:
-err_buf_layout:
-err_get_attr:
-err_reset:
+close:
dpni_close(priv->mc_io, 0, priv->mc_token);
-err_open:
+
return err;
 }
 
-- 
2.7.4



[PATCH 1/5] staging: fsl-dpaa2/eth: Label cleanup

2017-10-27 Thread Bogdan Purcareata
From: Ioana Radulescu 

Clean up goto labels in a couple of functions, by
removing/renaming redundant ones.

Signed-off-by: Ioana Radulescu 
Signed-off-by: Bogdan Purcareata 
---
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 35 +++---
 1 file changed, 15 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
index 9fbc0ee..5d2bd18 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
@@ -1444,34 +1444,32 @@ static struct fsl_mc_device *setup_dpcon(struct 
dpaa2_eth_priv *priv)
err = dpcon_open(priv->mc_io, 0, dpcon->obj_desc.id, >mc_handle);
if (err) {
dev_err(dev, "dpcon_open() failed\n");
-   goto err_open;
+   goto free;
}
 
err = dpcon_reset(priv->mc_io, 0, dpcon->mc_handle);
if (err) {
dev_err(dev, "dpcon_reset() failed\n");
-   goto err_reset;
+   goto close;
}
 
err = dpcon_get_attributes(priv->mc_io, 0, dpcon->mc_handle, );
if (err) {
dev_err(dev, "dpcon_get_attributes() failed\n");
-   goto err_get_attr;
+   goto close;
}
 
err = dpcon_enable(priv->mc_io, 0, dpcon->mc_handle);
if (err) {
dev_err(dev, "dpcon_enable() failed\n");
-   goto err_enable;
+   goto close;
}
 
return dpcon;
 
-err_enable:
-err_get_attr:
-err_reset:
+close:
dpcon_close(priv->mc_io, 0, dpcon->mc_handle);
-err_open:
+free:
fsl_mc_object_free(dpcon);
 
return NULL;
@@ -1794,7 +1792,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
err = dpni_open(priv->mc_io, 0, ls_dev->obj_desc.id, >mc_token);
if (err) {
dev_err(dev, "dpni_open() failed\n");
-   goto err_open;
+   return err;
}
 
ls_dev->mc_io = priv->mc_io;
@@ -1803,14 +1801,14 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
err = dpni_reset(priv->mc_io, 0, priv->mc_token);
if (err) {
dev_err(dev, "dpni_reset() failed\n");
-   goto err_reset;
+   goto close;
}
 
err = dpni_get_attributes(priv->mc_io, 0, priv->mc_token,
  >dpni_attrs);
if (err) {
dev_err(dev, "dpni_get_attributes() failed (err=%d)\n", err);
-   goto err_get_attr;
+   goto close;
}
 
/* Configure buffer layouts */
@@ -1827,7 +1825,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
 DPNI_QUEUE_RX, _layout);
if (err) {
dev_err(dev, "dpni_set_buffer_layout(RX) failed\n");
-   goto err_buf_layout;
+   goto close;
}
 
/* tx buffer */
@@ -1837,7 +1835,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
 DPNI_QUEUE_TX, _layout);
if (err) {
dev_err(dev, "dpni_set_buffer_layout(TX) failed\n");
-   goto err_buf_layout;
+   goto close;
}
 
/* tx-confirm buffer */
@@ -1846,7 +1844,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
 DPNI_QUEUE_TX_CONFIRM, _layout);
if (err) {
dev_err(dev, "dpni_set_buffer_layout(TX_CONF) failed\n");
-   goto err_buf_layout;
+   goto close;
}
 
/* Now that we've set our tx buffer layout, retrieve the minimum
@@ -1856,7 +1854,7 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
  >tx_data_offset);
if (err) {
dev_err(dev, "dpni_get_tx_data_offset() failed\n");
-   goto err_data_offset;
+   goto close;
}
 
if ((priv->tx_data_offset % 64) != 0)
@@ -1868,12 +1866,9 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
 
return 0;
 
-err_data_offset:
-err_buf_layout:
-err_get_attr:
-err_reset:
+close:
dpni_close(priv->mc_io, 0, priv->mc_token);
-err_open:
+
return err;
 }
 
-- 
2.7.4



[PATCH 0/5] staging: fsl-dpaa2/eth: Frame buffer work

2017-10-27 Thread Bogdan Purcareata
This patchset does some refactoring in the frame buffer area, in order
for it to be in line with firmware (MC) configuration.

Patches 1 - 2 do some label cleanup and move the buffer layout setup
to a dedicated function.

Patch 3 updates tx_data_offset - the offset for Tx frame buffers - to
not account the software annotation area, since it's already accounted
for by the firmware.

Patch 4 updates the required alignment for Rx frame buffers, based on
the accelerator hardware version.

Patch 5 configures a headroom in the Rx frame buffers to prevent
netstack reallocations in forwarding scenarios.

Patchset sent against staging-next.

Bogdan Purcareata (3):
  staging: fsl-dpaa2/eth: Don't account SWA in tx_data_offset
  staging: fsl-dpaa2/eth: Change RX buffer alignment
  staging: fsl-dpaa2/eth: Extra headroom in RX buffers

Ioana Radulescu (2):
  staging: fsl-dpaa2/eth: Label cleanup
  staging: fsl-dpaa2/eth: Split function

 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 170 ++---
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h |  44 +--
 2 files changed, 129 insertions(+), 85 deletions(-)

-- 
2.7.4



[PATCH 0/5] staging: fsl-dpaa2/eth: Frame buffer work

2017-10-27 Thread Bogdan Purcareata
This patchset does some refactoring in the frame buffer area, in order
for it to be in line with firmware (MC) configuration.

Patches 1 - 2 do some label cleanup and move the buffer layout setup
to a dedicated function.

Patch 3 updates tx_data_offset - the offset for Tx frame buffers - to
not account the software annotation area, since it's already accounted
for by the firmware.

Patch 4 updates the required alignment for Rx frame buffers, based on
the accelerator hardware version.

Patch 5 configures a headroom in the Rx frame buffers to prevent
netstack reallocations in forwarding scenarios.

Patchset sent against staging-next.

Bogdan Purcareata (3):
  staging: fsl-dpaa2/eth: Don't account SWA in tx_data_offset
  staging: fsl-dpaa2/eth: Change RX buffer alignment
  staging: fsl-dpaa2/eth: Extra headroom in RX buffers

Ioana Radulescu (2):
  staging: fsl-dpaa2/eth: Label cleanup
  staging: fsl-dpaa2/eth: Split function

 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 170 ++---
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h |  44 +--
 2 files changed, 129 insertions(+), 85 deletions(-)

-- 
2.7.4



RE: [RESEND PATCH 2/6] staging: fsl-dpaa2/ethsw: Add Freescale DPAA2 Ethernet Switch driver

2017-09-29 Thread Bogdan Purcareata
> Introduce the DPAA2 Ethernet Switch driver, which manages Datapath Switch
> (DPSW) objects discovered on the MC bus.
> 
> Suggested-by: Alexandru Marginean 
> Signed-off-by: Razvan Stefanescu 
> ---
>  drivers/staging/fsl-dpaa2/ethsw/Makefile |2 +-
>  drivers/staging/fsl-dpaa2/ethsw/ethsw.c  | 1523 
> ++
>  drivers/staging/fsl-dpaa2/ethsw/ethsw.h  |   88 ++
>  3 files changed, 1612 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/staging/fsl-dpaa2/ethsw/ethsw.c
>  create mode 100644 drivers/staging/fsl-dpaa2/ethsw/ethsw.h
> 
> diff --git a/drivers/staging/fsl-dpaa2/ethsw/Makefile b/drivers/staging/fsl-
> dpaa2/ethsw/Makefile
> index db137f7..a6d72d1 100644
> --- a/drivers/staging/fsl-dpaa2/ethsw/Makefile
> +++ b/drivers/staging/fsl-dpaa2/ethsw/Makefile
> @@ -4,4 +4,4 @@
> 
>  obj-$(CONFIG_FSL_DPAA2_ETHSW) += dpaa2-ethsw.o
> 
> -dpaa2-ethsw-objs := dpsw.o
> +dpaa2-ethsw-objs := ethsw.o dpsw.o
> diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c b/drivers/staging/fsl-
> dpaa2/ethsw/ethsw.c
> new file mode 100644
> index 000..ae86078
> --- /dev/null
> +++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
> @@ -0,0 +1,1523 @@
> +/* Copyright 2014-2016 Freescale Semiconductor Inc.
> + * Copyright 2017 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.
> + */
> +
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include "../../fsl-mc/include/mc.h"
> +
> +#include "ethsw.h"
> +
> +static struct workqueue_struct *ethsw_owq;
> +
> +/* Minimal supported DPSW version */
> +#define DPSW_MIN_VER_MAJOR   8
> +#define DPSW_MIN_VER_MINOR   0
> +
> +#define DEFAULT_VLAN_ID  1
> +
> +static int ethsw_add_vlan(struct ethsw_core *ethsw, u16 vid)
> +{
> + int err;
> +
> + struct dpsw_vlan_cfgvcfg = {
> + .fdb_id = 0,
> + };
> +
> + if (ethsw->vlans[vid]) {
> + dev_err(ethsw->dev, "VLAN already configured\n");
> + return -EEXIST;
> + }
> +
> + err = dpsw_vlan_add(ethsw->mc_io, 0,
> + ethsw->dpsw_handle, vid, );
> + if (err) {
> + dev_err(ethsw->dev, "dpsw_vlan_add err %d\n", err);
> + return err;
> + }
> + ethsw->vlans[vid] = ETHSW_VLAN_MEMBER;/
> +
> + return 0;
> +}
> +
> +static int ethsw_port_add_vlan(struct ethsw_port_priv *port_priv,
> +u16 vid, u16 flags)
> +{
> + struct ethsw_core *ethsw = port_priv->ethsw_data;
> + struct net_device *netdev = port_priv->netdev;
> + struct dpsw_vlan_if_cfg vcfg;
> + bool is_oper;
> + int err, err2;

Mild suggestion - s/err2/ret/, just because it sounds better, at least to me 
(same for similar situations in the rest of the file).

> +
> + if (port_priv->vlans[vid]) {
> + netdev_warn(netdev, "VLAN %d already configured\n", vid);
> + return -EEXIST;
> + }
> +
> + vcfg.num_ifs = 1;
> + vcfg.if_id[0] = port_priv->idx;
> + err = dpsw_vlan_add_if(ethsw->mc_io, 0, ethsw->dpsw_handle, vid, );
> + if (err) {
> + 

RE: [RESEND PATCH 2/6] staging: fsl-dpaa2/ethsw: Add Freescale DPAA2 Ethernet Switch driver

2017-09-29 Thread Bogdan Purcareata
> Introduce the DPAA2 Ethernet Switch driver, which manages Datapath Switch
> (DPSW) objects discovered on the MC bus.
> 
> Suggested-by: Alexandru Marginean 
> Signed-off-by: Razvan Stefanescu 
> ---
>  drivers/staging/fsl-dpaa2/ethsw/Makefile |2 +-
>  drivers/staging/fsl-dpaa2/ethsw/ethsw.c  | 1523 
> ++
>  drivers/staging/fsl-dpaa2/ethsw/ethsw.h  |   88 ++
>  3 files changed, 1612 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/staging/fsl-dpaa2/ethsw/ethsw.c
>  create mode 100644 drivers/staging/fsl-dpaa2/ethsw/ethsw.h
> 
> diff --git a/drivers/staging/fsl-dpaa2/ethsw/Makefile b/drivers/staging/fsl-
> dpaa2/ethsw/Makefile
> index db137f7..a6d72d1 100644
> --- a/drivers/staging/fsl-dpaa2/ethsw/Makefile
> +++ b/drivers/staging/fsl-dpaa2/ethsw/Makefile
> @@ -4,4 +4,4 @@
> 
>  obj-$(CONFIG_FSL_DPAA2_ETHSW) += dpaa2-ethsw.o
> 
> -dpaa2-ethsw-objs := dpsw.o
> +dpaa2-ethsw-objs := ethsw.o dpsw.o
> diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c b/drivers/staging/fsl-
> dpaa2/ethsw/ethsw.c
> new file mode 100644
> index 000..ae86078
> --- /dev/null
> +++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
> @@ -0,0 +1,1523 @@
> +/* Copyright 2014-2016 Freescale Semiconductor Inc.
> + * Copyright 2017 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.
> + */
> +
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include "../../fsl-mc/include/mc.h"
> +
> +#include "ethsw.h"
> +
> +static struct workqueue_struct *ethsw_owq;
> +
> +/* Minimal supported DPSW version */
> +#define DPSW_MIN_VER_MAJOR   8
> +#define DPSW_MIN_VER_MINOR   0
> +
> +#define DEFAULT_VLAN_ID  1
> +
> +static int ethsw_add_vlan(struct ethsw_core *ethsw, u16 vid)
> +{
> + int err;
> +
> + struct dpsw_vlan_cfgvcfg = {
> + .fdb_id = 0,
> + };
> +
> + if (ethsw->vlans[vid]) {
> + dev_err(ethsw->dev, "VLAN already configured\n");
> + return -EEXIST;
> + }
> +
> + err = dpsw_vlan_add(ethsw->mc_io, 0,
> + ethsw->dpsw_handle, vid, );
> + if (err) {
> + dev_err(ethsw->dev, "dpsw_vlan_add err %d\n", err);
> + return err;
> + }
> + ethsw->vlans[vid] = ETHSW_VLAN_MEMBER;/
> +
> + return 0;
> +}
> +
> +static int ethsw_port_add_vlan(struct ethsw_port_priv *port_priv,
> +u16 vid, u16 flags)
> +{
> + struct ethsw_core *ethsw = port_priv->ethsw_data;
> + struct net_device *netdev = port_priv->netdev;
> + struct dpsw_vlan_if_cfg vcfg;
> + bool is_oper;
> + int err, err2;

Mild suggestion - s/err2/ret/, just because it sounds better, at least to me 
(same for similar situations in the rest of the file).

> +
> + if (port_priv->vlans[vid]) {
> + netdev_warn(netdev, "VLAN %d already configured\n", vid);
> + return -EEXIST;
> + }
> +
> + vcfg.num_ifs = 1;
> + vcfg.if_id[0] = port_priv->idx;
> + err = dpsw_vlan_add_if(ethsw->mc_io, 0, ethsw->dpsw_handle, vid, );
> + if (err) {
> + netdev_err(netdev, "dpsw_vlan_add_if err %d\n", err);
> +

[PATCH] staging: fsl-mc/dpio: Skip endianness conversion in portal config

2017-07-20 Thread Bogdan Purcareata
Writing to the register using writel does the CPU to LE conversion down the
line, so it's not required here. Doing it breaks portal configuration on
big endian kernels.

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
---
 drivers/staging/fsl-mc/bus/dpio/qbman-portal.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/dpio/qbman-portal.c 
b/drivers/staging/fsl-mc/bus/dpio/qbman-portal.c
index 7988612..163bdac 100644
--- a/drivers/staging/fsl-mc/bus/dpio/qbman-portal.c
+++ b/drivers/staging/fsl-mc/bus/dpio/qbman-portal.c
@@ -136,18 +136,18 @@ static inline u32 qbman_set_swp_cfg(u8 max_fill, u8 wn,   
u8 est, u8 rpm, u8 dcm,
u8 epm, int sd, int sp, int se,
int dp, int de, int ep)
 {
-   return cpu_to_le32 (max_fill << SWP_CFG_DQRR_MF_SHIFT |
-   est << SWP_CFG_EST_SHIFT |
-   wn << SWP_CFG_WN_SHIFT |
-   rpm << SWP_CFG_RPM_SHIFT |
-   dcm << SWP_CFG_DCM_SHIFT |
-   epm << SWP_CFG_EPM_SHIFT |
-   sd << SWP_CFG_SD_SHIFT |
-   sp << SWP_CFG_SP_SHIFT |
-   se << SWP_CFG_SE_SHIFT |
-   dp << SWP_CFG_DP_SHIFT |
-   de << SWP_CFG_DE_SHIFT |
-   ep << SWP_CFG_EP_SHIFT);
+   return (max_fill << SWP_CFG_DQRR_MF_SHIFT |
+   est << SWP_CFG_EST_SHIFT |
+   wn << SWP_CFG_WN_SHIFT |
+   rpm << SWP_CFG_RPM_SHIFT |
+   dcm << SWP_CFG_DCM_SHIFT |
+   epm << SWP_CFG_EPM_SHIFT |
+   sd << SWP_CFG_SD_SHIFT |
+   sp << SWP_CFG_SP_SHIFT |
+   se << SWP_CFG_SE_SHIFT |
+   dp << SWP_CFG_DP_SHIFT |
+   de << SWP_CFG_DE_SHIFT |
+   ep << SWP_CFG_EP_SHIFT);
 }
 
 /**
-- 
2.7.4



[PATCH] staging: fsl-mc/dpio: Skip endianness conversion in portal config

2017-07-20 Thread Bogdan Purcareata
Writing to the register using writel does the CPU to LE conversion down the
line, so it's not required here. Doing it breaks portal configuration on
big endian kernels.

Signed-off-by: Bogdan Purcareata 
---
 drivers/staging/fsl-mc/bus/dpio/qbman-portal.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/dpio/qbman-portal.c 
b/drivers/staging/fsl-mc/bus/dpio/qbman-portal.c
index 7988612..163bdac 100644
--- a/drivers/staging/fsl-mc/bus/dpio/qbman-portal.c
+++ b/drivers/staging/fsl-mc/bus/dpio/qbman-portal.c
@@ -136,18 +136,18 @@ static inline u32 qbman_set_swp_cfg(u8 max_fill, u8 wn,   
u8 est, u8 rpm, u8 dcm,
u8 epm, int sd, int sp, int se,
int dp, int de, int ep)
 {
-   return cpu_to_le32 (max_fill << SWP_CFG_DQRR_MF_SHIFT |
-   est << SWP_CFG_EST_SHIFT |
-   wn << SWP_CFG_WN_SHIFT |
-   rpm << SWP_CFG_RPM_SHIFT |
-   dcm << SWP_CFG_DCM_SHIFT |
-   epm << SWP_CFG_EPM_SHIFT |
-   sd << SWP_CFG_SD_SHIFT |
-   sp << SWP_CFG_SP_SHIFT |
-   se << SWP_CFG_SE_SHIFT |
-   dp << SWP_CFG_DP_SHIFT |
-   de << SWP_CFG_DE_SHIFT |
-   ep << SWP_CFG_EP_SHIFT);
+   return (max_fill << SWP_CFG_DQRR_MF_SHIFT |
+   est << SWP_CFG_EST_SHIFT |
+   wn << SWP_CFG_WN_SHIFT |
+   rpm << SWP_CFG_RPM_SHIFT |
+   dcm << SWP_CFG_DCM_SHIFT |
+   epm << SWP_CFG_EPM_SHIFT |
+   sd << SWP_CFG_SD_SHIFT |
+   sp << SWP_CFG_SP_SHIFT |
+   se << SWP_CFG_SE_SHIFT |
+   dp << SWP_CFG_DP_SHIFT |
+   de << SWP_CFG_DE_SHIFT |
+   ep << SWP_CFG_EP_SHIFT);
 }
 
 /**
-- 
2.7.4



RE: [PATCH 1/2] staging: fsl-dpaa2/eth: Fix skb use after free

2017-07-20 Thread Bogdan Purcareata
> -Original Message-
> From: Dan Carpenter [mailto:dan.carpen...@oracle.com]
> Sent: Thursday, July 20, 2017 2:18 PM
> To: Bogdan Purcareata <bogdan.purcare...@nxp.com>
> Cc: Ruxandra Ioana Radulescu <ruxandra.radule...@nxp.com>;
> gre...@linuxfoundation.org; linux-kernel@vger.kernel.org;
> de...@driverdev.osuosl.org
> Subject: Re: [PATCH 1/2] staging: fsl-dpaa2/eth: Fix skb use after free
> 
> On Thu, Jul 20, 2017 at 10:58:37AM +, Bogdan Purcareata wrote:
> > Once a Tx frame descriptor is enqueued, an interrupt might be triggered
> > to process the Tx confirmation and free the skb, hitting a memory use
> > after free when updating the tx_bytes statistic based on skb->len.
> >
> > Use the frame descriptor length instead.
> >
> > Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
> > ---
> >  drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
> b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
> > index b9a0a31..0f3e497 100644
> > --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
> > +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
> > @@ -616,7 +616,7 @@ static netdev_tx_t dpaa2_eth_tx(struct sk_buff *skb,
> struct net_device *net_dev)
> > free_tx_fd(priv, , NULL);
> > } else {
> > percpu_stats->tx_packets++;
> > -   percpu_stats->tx_bytes += skb->len;
> > +   percpu_stats->tx_bytes += dpaa2_fd_get_len();
> 
> This feels like the wrong thing.  Can't we just save skb->len earlier
> in the function and use it here?  This is the common case right?  So
> we'd be saving slightly wrong information for almost every packet.

The "len" field in the frame descriptor means the length of the actual data, 
like the "len" field in the skb. It's set to skb->len both for linear 
(build_single_fd) and fragmented (build_sg_fd) skbs. I thought it would be more 
straightforward to use it rather than define an additional local variable 
solely for this purpose.

Thank you!
Bogdan P.


RE: [PATCH 1/2] staging: fsl-dpaa2/eth: Fix skb use after free

2017-07-20 Thread Bogdan Purcareata
> -Original Message-
> From: Dan Carpenter [mailto:dan.carpen...@oracle.com]
> Sent: Thursday, July 20, 2017 2:18 PM
> To: Bogdan Purcareata 
> Cc: Ruxandra Ioana Radulescu ;
> gre...@linuxfoundation.org; linux-kernel@vger.kernel.org;
> de...@driverdev.osuosl.org
> Subject: Re: [PATCH 1/2] staging: fsl-dpaa2/eth: Fix skb use after free
> 
> On Thu, Jul 20, 2017 at 10:58:37AM +, Bogdan Purcareata wrote:
> > Once a Tx frame descriptor is enqueued, an interrupt might be triggered
> > to process the Tx confirmation and free the skb, hitting a memory use
> > after free when updating the tx_bytes statistic based on skb->len.
> >
> > Use the frame descriptor length instead.
> >
> > Signed-off-by: Bogdan Purcareata 
> > ---
> >  drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
> b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
> > index b9a0a31..0f3e497 100644
> > --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
> > +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
> > @@ -616,7 +616,7 @@ static netdev_tx_t dpaa2_eth_tx(struct sk_buff *skb,
> struct net_device *net_dev)
> > free_tx_fd(priv, , NULL);
> > } else {
> > percpu_stats->tx_packets++;
> > -   percpu_stats->tx_bytes += skb->len;
> > +   percpu_stats->tx_bytes += dpaa2_fd_get_len();
> 
> This feels like the wrong thing.  Can't we just save skb->len earlier
> in the function and use it here?  This is the common case right?  So
> we'd be saving slightly wrong information for almost every packet.

The "len" field in the frame descriptor means the length of the actual data, 
like the "len" field in the skb. It's set to skb->len both for linear 
(build_single_fd) and fragmented (build_sg_fd) skbs. I thought it would be more 
straightforward to use it rather than define an additional local variable 
solely for this purpose.

Thank you!
Bogdan P.


[PATCH 1/2] staging: fsl-dpaa2/eth: Fix skb use after free

2017-07-20 Thread Bogdan Purcareata
Once a Tx frame descriptor is enqueued, an interrupt might be triggered
to process the Tx confirmation and free the skb, hitting a memory use
after free when updating the tx_bytes statistic based on skb->len.

Use the frame descriptor length instead.

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
---
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
index b9a0a31..0f3e497 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
@@ -616,7 +616,7 @@ static netdev_tx_t dpaa2_eth_tx(struct sk_buff *skb, struct 
net_device *net_dev)
free_tx_fd(priv, , NULL);
} else {
percpu_stats->tx_packets++;
-   percpu_stats->tx_bytes += skb->len;
+   percpu_stats->tx_bytes += dpaa2_fd_get_len();
}
 
return NETDEV_TX_OK;
-- 
2.7.4



[PATCH 1/2] staging: fsl-dpaa2/eth: Fix skb use after free

2017-07-20 Thread Bogdan Purcareata
Once a Tx frame descriptor is enqueued, an interrupt might be triggered
to process the Tx confirmation and free the skb, hitting a memory use
after free when updating the tx_bytes statistic based on skb->len.

Use the frame descriptor length instead.

Signed-off-by: Bogdan Purcareata 
---
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
index b9a0a31..0f3e497 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
@@ -616,7 +616,7 @@ static netdev_tx_t dpaa2_eth_tx(struct sk_buff *skb, struct 
net_device *net_dev)
free_tx_fd(priv, , NULL);
} else {
percpu_stats->tx_packets++;
-   percpu_stats->tx_bytes += skb->len;
+   percpu_stats->tx_bytes += dpaa2_fd_get_len();
}
 
return NETDEV_TX_OK;
-- 
2.7.4



[PATCH 2/2] staging: fsl-dpaa2/eth: Error report format fixes

2017-07-20 Thread Bogdan Purcareata
Fix mishaps in error format strings.

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
---
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
index 0f3e497..26017fe 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
@@ -656,7 +656,7 @@ static void dpaa2_eth_tx_conf(struct dpaa2_eth_priv *priv,
has_fas_errors = (fd_errors & DPAA2_FD_CTRL_FAERR) &&
 !!(dpaa2_fd_get_frc(fd) & DPAA2_FD_FRC_FASV);
if (net_ratelimit())
-   netdev_dbg(priv->net_dev, "TX frame FD error: %x08\n",
+   netdev_dbg(priv->net_dev, "TX frame FD error: 0x%08x\n",
   fd_errors);
}
 
@@ -670,7 +670,7 @@ static void dpaa2_eth_tx_conf(struct dpaa2_eth_priv *priv,
percpu_stats->tx_errors++;
 
if (has_fas_errors && net_ratelimit())
-   netdev_dbg(priv->net_dev, "TX frame FAS error: %x08\n",
+   netdev_dbg(priv->net_dev, "TX frame FAS error: 0x%08x\n",
   status & DPAA2_FAS_TX_ERR_MASK);
 }
 
-- 
2.7.4



[PATCH 2/2] staging: fsl-dpaa2/eth: Error report format fixes

2017-07-20 Thread Bogdan Purcareata
Fix mishaps in error format strings.

Signed-off-by: Bogdan Purcareata 
---
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
index 0f3e497..26017fe 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
@@ -656,7 +656,7 @@ static void dpaa2_eth_tx_conf(struct dpaa2_eth_priv *priv,
has_fas_errors = (fd_errors & DPAA2_FD_CTRL_FAERR) &&
 !!(dpaa2_fd_get_frc(fd) & DPAA2_FD_FRC_FASV);
if (net_ratelimit())
-   netdev_dbg(priv->net_dev, "TX frame FD error: %x08\n",
+   netdev_dbg(priv->net_dev, "TX frame FD error: 0x%08x\n",
   fd_errors);
}
 
@@ -670,7 +670,7 @@ static void dpaa2_eth_tx_conf(struct dpaa2_eth_priv *priv,
percpu_stats->tx_errors++;
 
if (has_fas_errors && net_ratelimit())
-   netdev_dbg(priv->net_dev, "TX frame FAS error: %x08\n",
+   netdev_dbg(priv->net_dev, "TX frame FAS error: 0x%08x\n",
   status & DPAA2_FAS_TX_ERR_MASK);
 }
 
-- 
2.7.4



RE: [PATCH] staging: fsl-dpaa2/eth: Remove dead code

2017-06-30 Thread Bogdan Purcareata
> -Original Message-
> From: Ioana Radulescu [mailto:ruxandra.radule...@nxp.com]
> Sent: Thursday, June 29, 2017 7:26 PM
> To: gre...@linuxfoundation.org
> Cc: de...@driverdev.osuosl.org; linux-kernel@vger.kernel.org;
> ag...@suse.de; a...@arndb.de; linux-arm-ker...@lists.infradead.org; Bogdan
> Purcareata <bogdan.purcare...@nxp.com>; stuyo...@gmail.com; Laurentiu Tudor
> <laurentiu.tu...@nxp.com>
> Subject: [PATCH] staging: fsl-dpaa2/eth: Remove dead code
> 
> All possible values of the switch statement are explicitly
> handled, so there's no need to have a default branch.
> 
> Signed-off-by: Ioana Radulescu <ruxandra.radule...@nxp.com>

Acked-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>

> ---
>  drivers/staging/fsl-dpaa2/ethernet/dpaa2-ethtool.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-ethtool.c
> b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-ethtool.c
> index 5312edc26f01..031179ab3a22 100644
> --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-ethtool.c
> +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-ethtool.c
> @@ -217,8 +217,6 @@ static void dpaa2_eth_get_ethtool_stats(struct
> net_device *net_dev,
>   case 2:
>   num_cnt = sizeof(dpni_stats.page_2) / sizeof(u64);
>   break;
> - default:
> - break;
>   }
>   for (k = 0; k < num_cnt; k++)
>   *(data + i++) = dpni_stats.raw.counter[k];
> --
> 2.11.0



RE: [PATCH] staging: fsl-dpaa2/eth: Remove dead code

2017-06-30 Thread Bogdan Purcareata
> -Original Message-
> From: Ioana Radulescu [mailto:ruxandra.radule...@nxp.com]
> Sent: Thursday, June 29, 2017 7:26 PM
> To: gre...@linuxfoundation.org
> Cc: de...@driverdev.osuosl.org; linux-kernel@vger.kernel.org;
> ag...@suse.de; a...@arndb.de; linux-arm-ker...@lists.infradead.org; Bogdan
> Purcareata ; stuyo...@gmail.com; Laurentiu Tudor
> 
> Subject: [PATCH] staging: fsl-dpaa2/eth: Remove dead code
> 
> All possible values of the switch statement are explicitly
> handled, so there's no need to have a default branch.
> 
> Signed-off-by: Ioana Radulescu 

Acked-by: Bogdan Purcareata 

> ---
>  drivers/staging/fsl-dpaa2/ethernet/dpaa2-ethtool.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-ethtool.c
> b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-ethtool.c
> index 5312edc26f01..031179ab3a22 100644
> --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-ethtool.c
> +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-ethtool.c
> @@ -217,8 +217,6 @@ static void dpaa2_eth_get_ethtool_stats(struct
> net_device *net_dev,
>   case 2:
>   num_cnt = sizeof(dpni_stats.page_2) / sizeof(u64);
>   break;
> - default:
> - break;
>   }
>   for (k = 0; k < num_cnt; k++)
>   *(data + i++) = dpni_stats.raw.counter[k];
> --
> 2.11.0



RE: [PATCH] staging: fsl-mc/dpio: Propagate error code

2017-06-15 Thread Bogdan Purcareata
> -Original Message-
> From: Ioana Radulescu [mailto:ruxandra.radule...@nxp.com]
> Sent: Thursday, June 15, 2017 11:55 AM
> To: gre...@linuxfoundation.org
> Cc: de...@driverdev.osuosl.org; linux-kernel@vger.kernel.org;
> ag...@suse.de; a...@arndb.de; linux-arm-ker...@lists.infradead.org; Bogdan
> Purcareata <bogdan.purcare...@nxp.com>; stuyo...@gmail.com; Laurentiu Tudor
> <laurentiu.tu...@nxp.com>; Ruxandra Ioana Radulescu
> <ruxandra.radule...@nxp.com>; Roy Pledge <roy.ple...@nxp.com>; Haiying Wang
> <haiying.w...@nxp.com>
> Subject: [PATCH] staging: fsl-mc/dpio: Propagate error code
> 
> dpaa2_io_service_register() returns zero even if
> qbman_swp_CDAN_set() encountered an error. Fix this
> by propagating the error code so the caller is informed
> data availability notifications are not properly set
> for a channel.
> 
> Signed-off-by: Ioana Radulescu <ruxandra.radule...@nxp.com>

Acked-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>

> ---
>  drivers/staging/fsl-mc/bus/dpio/dpio-service.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio-service.c
> b/drivers/staging/fsl-mc/bus/dpio/dpio-service.c
> index e5d66749614c..762f045f53f7 100644
> --- a/drivers/staging/fsl-mc/bus/dpio/dpio-service.c
> +++ b/drivers/staging/fsl-mc/bus/dpio/dpio-service.c
> @@ -260,9 +260,9 @@ int dpaa2_io_service_register(struct dpaa2_io *d,
> 
>   /* Enable the generation of CDAN notifications */
>   if (ctx->is_cdan)
> - qbman_swp_CDAN_set_context_enable(d->swp,
> -   (u16)ctx->id,
> -   ctx->qman64);
> + return qbman_swp_CDAN_set_context_enable(d->swp,
> +  (u16)ctx->id,
> +  ctx->qman64);
>   return 0;
>  }
>  EXPORT_SYMBOL(dpaa2_io_service_register);
> --
> 2.11.0



RE: [PATCH] staging: fsl-mc/dpio: Propagate error code

2017-06-15 Thread Bogdan Purcareata
> -Original Message-
> From: Ioana Radulescu [mailto:ruxandra.radule...@nxp.com]
> Sent: Thursday, June 15, 2017 11:55 AM
> To: gre...@linuxfoundation.org
> Cc: de...@driverdev.osuosl.org; linux-kernel@vger.kernel.org;
> ag...@suse.de; a...@arndb.de; linux-arm-ker...@lists.infradead.org; Bogdan
> Purcareata ; stuyo...@gmail.com; Laurentiu Tudor
> ; Ruxandra Ioana Radulescu
> ; Roy Pledge ; Haiying Wang
> 
> Subject: [PATCH] staging: fsl-mc/dpio: Propagate error code
> 
> dpaa2_io_service_register() returns zero even if
> qbman_swp_CDAN_set() encountered an error. Fix this
> by propagating the error code so the caller is informed
> data availability notifications are not properly set
> for a channel.
> 
> Signed-off-by: Ioana Radulescu 

Acked-by: Bogdan Purcareata 

> ---
>  drivers/staging/fsl-mc/bus/dpio/dpio-service.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio-service.c
> b/drivers/staging/fsl-mc/bus/dpio/dpio-service.c
> index e5d66749614c..762f045f53f7 100644
> --- a/drivers/staging/fsl-mc/bus/dpio/dpio-service.c
> +++ b/drivers/staging/fsl-mc/bus/dpio/dpio-service.c
> @@ -260,9 +260,9 @@ int dpaa2_io_service_register(struct dpaa2_io *d,
> 
>   /* Enable the generation of CDAN notifications */
>   if (ctx->is_cdan)
> - qbman_swp_CDAN_set_context_enable(d->swp,
> -   (u16)ctx->id,
> -   ctx->qman64);
> + return qbman_swp_CDAN_set_context_enable(d->swp,
> +  (u16)ctx->id,
> +  ctx->qman64);
>   return 0;
>  }
>  EXPORT_SYMBOL(dpaa2_io_service_register);
> --
> 2.11.0



[PATCH v4 2/2] dt-bindings: net: Add Cortina device tree bindings

2017-05-29 Thread Bogdan Purcareata
Add device tree description info for Cortina 10G phy devices.

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
---
v3 -> v4:
- Consistency nit between phy label and reg value.
- Add CORTINNA trademark info.

Patch introduced in v3 of the patchset.

 Documentation/devicetree/bindings/net/cortina.txt | 21 +
 1 file changed, 21 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/cortina.txt

diff --git a/Documentation/devicetree/bindings/net/cortina.txt 
b/Documentation/devicetree/bindings/net/cortina.txt
new file mode 100644
index 000..40d0bd9
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/cortina.txt
@@ -0,0 +1,21 @@
+Cortina Phy Driver Device Tree Bindings
+---
+
+CORTINA is a registered trademark of Cortina Systems, Inc.
+
+The driver supports the Cortina Electronic Dispersion Compensation (EDC)
+devices, equipped with clock and data recovery (CDR) circuits. These
+devices make use of registers that are not compatible with Clause 45 or
+Clause 22, therefore they need to be described using the
+"ethernet-phy-id" compatible.
+
+Since the driver only implements  polling mode support, interrupts info
+can be skipped.
+
+Example (CS4340 phy):
+   mdio {
+   cs4340_phy@10 {
+   compatible = "ethernet-phy-id13e5.1002";
+   reg = <0x10>;
+   };
+   };
-- 
1.9.1



[PATCH v4 1/2] net: phy: Add Cortina CS4340 driver

2017-05-29 Thread Bogdan Purcareata
Add basic support for Cortina PHY drivers. Support only CS4340 for now.
The phys are not compatible with IEEE 802.3 clause 22/45 registers.

Implement proper read_status support. The generic 10G phy driver causes
bus register access errors.

The driver should be described using the "ethernet-phy-id" device tree
compatible.

Signed-off-by: Bogdan Purcareata <bogdan.purcare...@nxp.com>
---
v3 -> v4:
- Add CORTINA trademark info.
- Change id_lsb and id_msb from u32 to int to cover error checking.

v2 -> v3:
- Add probe function to check the device we're talking with is the same
  as the one described in the device tree.
- Change the link status (GPIO interrupt status) register and validate
  that the read is done from the right place (cable plug-in / plug-out).
- Some functions + Kconfig entry renaming.

v1 -> v2:
- Rename "mdio-cortina.c" to "cortina.c" since it's a phy driver.
- Test probing based on the "ethernet-phy-id" compatible. In the previous
  version, getting the phy_id via get_phy_c45_ids() involved an additional
  hack. Drop that approach and document probing in the commit message.

 drivers/net/phy/Kconfig   |   5 ++
 drivers/net/phy/Makefile  |   1 +
 drivers/net/phy/cortina.c | 118 ++
 3 files changed, 124 insertions(+)
 create mode 100644 drivers/net/phy/cortina.c

diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index 22dea7f..12c033c 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -240,6 +240,11 @@ config CICADA_PHY
---help---
  Currently supports the cis8204
 
+config CORTINA_PHY
+   tristate "Cortina EDC CDR 10G Ethernet PHY"
+   ---help---
+ Currently supports the CS4340 phy.
+
 config DAVICOM_PHY
tristate "Davicom PHYs"
---help---
diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile
index 79365be..0de3e20 100644
--- a/drivers/net/phy/Makefile
+++ b/drivers/net/phy/Makefile
@@ -47,6 +47,7 @@ obj-$(CONFIG_BCM_CYGNUS_PHY)  += bcm-cygnus.o
 obj-$(CONFIG_BCM_NET_PHYLIB)   += bcm-phy-lib.o
 obj-$(CONFIG_BROADCOM_PHY) += broadcom.o
 obj-$(CONFIG_CICADA_PHY)   += cicada.o
+obj-$(CONFIG_CORTINA_PHY)  += cortina.o
 obj-$(CONFIG_DAVICOM_PHY)  += davicom.o
 obj-$(CONFIG_DP83640_PHY)  += dp83640.o
 obj-$(CONFIG_DP83848_PHY)  += dp83848.o
diff --git a/drivers/net/phy/cortina.c b/drivers/net/phy/cortina.c
new file mode 100644
index 000..72f4228
--- /dev/null
+++ b/drivers/net/phy/cortina.c
@@ -0,0 +1,118 @@
+/*
+ *Copyright 2017 NXP
+ *
+ *This program is free software; you can redistribute it and/or modify
+ *it under the terms of the GNU General Public License as published by
+ *the Free Software Foundation; either version 2 of the License, or
+ *(at your option) any later version.
+ *
+ *This program is distributed in the hope that it will be useful,
+ *but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *GNU General Public License for more details.
+ *
+ *CORTINA is a registered trademark of Cortina Systems, Inc.
+ *
+ */
+#include 
+#include 
+
+#define PHY_ID_CS4340  0x13e51002
+
+#define VILLA_GLOBAL_CHIP_ID_LSB   0x0
+#define VILLA_GLOBAL_CHIP_ID_MSB   0x1
+
+#define VILLA_GLOBAL_GPIO_1_INTS   0x017
+
+static int cortina_read_reg(struct phy_device *phydev, u16 regnum)
+{
+   return mdiobus_read(phydev->mdio.bus, phydev->mdio.addr,
+   MII_ADDR_C45 | regnum);
+}
+
+static int cortina_config_aneg(struct phy_device *phydev)
+{
+   phydev->supported = SUPPORTED_1baseT_Full;
+   phydev->advertising = SUPPORTED_1baseT_Full;
+
+   return 0;
+}
+
+static int cortina_read_status(struct phy_device *phydev)
+{
+   int gpio_int_status, ret = 0;
+
+   gpio_int_status = cortina_read_reg(phydev, VILLA_GLOBAL_GPIO_1_INTS);
+   if (gpio_int_status < 0) {
+   ret = gpio_int_status;
+   goto err;
+   }
+
+   if (gpio_int_status & 0x8) {
+   /* up when edc_convergedS set */
+   phydev->speed = SPEED_1;
+   phydev->duplex = DUPLEX_FULL;
+   phydev->link = 1;
+   } else {
+   phydev->link = 0;
+   }
+
+err:
+   return ret;
+}
+
+static int cortina_soft_reset(struct phy_device *phydev)
+{
+   return 0;
+}
+
+static int cortina_probe(struct phy_device *phydev)
+{
+   u32 phy_id = 0;
+   int id_lsb = 0, id_msb = 0;
+
+   /* Read device id from phy registers. */
+   id_lsb = cortina_read_reg(phydev, VILLA_GLOBAL_CHIP_ID_LSB);
+   if (id_lsb < 0)
+   return -ENXIO;
+
+   phy_id = id_lsb << 16;
+
+   id_msb = cortina_read_reg(phydev, VILLA_GLOBAL_CHIP

  1   2   3   >