[U-Boot] [PATCH v4] mpc85xx: inhibit bman portals by default

2014-12-08 Thread Jeffrey Ladouceur
Not all portals might be managed and therefore visible.
Set the isdr register so that the corresponding isr register
won't be set. This is needed for deepsleep.

Signed-off-by: Jeffrey Ladouceur 
---
The following dependent patches should be applied first:
http://patchwork.ozlabs.org/patch/403532
http://patchwork.ozlabs.org/patch/403533
http://patchwork.ozlabs.org/patch/403540
http://patchwork.ozlabs.org/patch/403534
http://patchwork.ozlabs.org/patch/403535
http://patchwork.ozlabs.org/patch/403538
http://patchwork.ozlabs.org/patch/403536
http://patchwork.ozlabs.org/patch/403539

Changes in v4:
 - The assertion that reading from portal reserved memory would return zero
 is incorrect. Therefore modify code to depend on specified number of
 portals in board config file

Changes in v3:
 - Update subject title to be consistent
Changes in v2:
 - Removed P1023RDS as it is no longer supported.

 arch/powerpc/cpu/mpc85xx/portals.c  |   36 +++
 include/configs/B4860QDS.h  |8 
 include/configs/P1023RDB.h  |8 
 include/configs/P2041RDB.h  |8 
 include/configs/T102xQDS.h  |8 
 include/configs/T102xRDB.h  |8 
 include/configs/T1040QDS.h  |8 
 include/configs/T104xRDB.h  |8 
 include/configs/T208xQDS.h  |8 
 include/configs/T208xRDB.h  |8 
 include/configs/T4240EMU.h  |8 
 include/configs/T4240QDS.h  |8 
 include/configs/T4240RDB.h  |8 
 include/configs/corenet_ds.h|8 
 include/configs/km/kmp204x-common.h |8 
 15 files changed, 148 insertions(+)

diff --git a/arch/powerpc/cpu/mpc85xx/portals.c 
b/arch/powerpc/cpu/mpc85xx/portals.c
index 98815f8..2972865 100644
--- a/arch/powerpc/cpu/mpc85xx/portals.c
+++ b/arch/powerpc/cpu/mpc85xx/portals.c
@@ -14,6 +14,39 @@
 #include 
 #include 
 
+#define MAX_PORTALS (CONFIG_SYS_BMAN_CINH_SIZE / CONFIG_SYS_BMAN_SP_CINH_SIZE)
+void inhibit_bman_portals(void)
+{
+   void __iomem *addr = (void *)CONFIG_SYS_BMAN_CINH_BASE +
+   CONFIG_SYS_BMAN_SWP_ISDR_REG;
+   uint32_t val;
+   int i, max_portals = CONFIG_SYS_BMAN_NUM_PORTALS;
+
+   /* MAX_PORTALS is the maximum based on memory size. This includes the
+* reserved memory in the SoC.  CONFIG_SYS_BMAN_NUM_PORTALS is the
+* number of physical portals in the SoC */
+   if (CONFIG_SYS_BMAN_NUM_PORTALS > MAX_PORTALS) {
+   printf("ERROR: BMAN portal config error\n");
+   max_portals = MAX_PORTALS;
+   }
+
+   for (i = 0; i < max_portals; i++) {
+   out_be32(addr, -1);
+   val = in_be32(addr);
+   if (!val) {
+   printf("ERROR: Stopped after %d BMan portals\n", i);
+   goto done;
+   }
+   addr += CONFIG_SYS_BMAN_SP_CINH_SIZE;
+   }
+#ifdef DEBUG
+   printf("Cleared %d Bman portals\n", i);
+#endif
+done:
+
+   return;
+}
+
 void setup_portals(void)
 {
ccsr_qman_t *qman = (void *)CONFIG_SYS_FSL_QMAN_ADDR;
@@ -38,6 +71,9 @@ void setup_portals(void)
out_be32(&qman->qcsp_bare, (u32)(CONFIG_SYS_QMAN_MEM_PHYS >> 32));
 #endif
out_be32(&qman->qcsp_bar, (u32)CONFIG_SYS_QMAN_MEM_PHYS);
+
+   /* Change default state of BMan ISDR portals to all 1s */
+   inhibit_bman_portals();
 }
 
 /* Update portal containter to match LAW setup of portal in phy map */
diff --git a/include/configs/B4860QDS.h b/include/configs/B4860QDS.h
index dc1a9bc..31f1d3f 100644
--- a/include/configs/B4860QDS.h
+++ b/include/configs/B4860QDS.h
@@ -641,6 +641,14 @@ unsigned long get_board_ddr_clk(void);
 #define CONFIG_SYS_BMAN_MEM_PHYS   CONFIG_SYS_BMAN_MEM_BASE
 #endif
 #define CONFIG_SYS_BMAN_MEM_SIZE   0x0200
+#define CONFIG_SYS_BMAN_SP_CENA_SIZE   0x4000
+#define CONFIG_SYS_BMAN_SP_CINH_SIZE   0x1000
+#define CONFIG_SYS_BMAN_CENA_BASE  CONFIG_SYS_BMAN_MEM_BASE
+#define CONFIG_SYS_BMAN_CENA_SIZE  (CONFIG_SYS_BMAN_MEM_SIZE >> 1)
+#define CONFIG_SYS_BMAN_CINH_BASE  (CONFIG_SYS_BMAN_MEM_BASE + \
+   CONFIG_SYS_BMAN_CENA_SIZE)
+#define CONFIG_SYS_BMAN_CINH_SIZE  (CONFIG_SYS_BMAN_MEM_SIZE >> 1)
+#define CONFIG_SYS_BMAN_SWP_ISDR_REG   0xE08
 #define CONFIG_SYS_QMAN_NUM_PORTALS25
 #define CONFIG_SYS_QMAN_MEM_BASE   0xf600
 #ifdef CONFIG_PHYS_64BIT
diff --git a/include/configs/P1023RDB.h b/include/configs/P1023RDB.h
index 6b29add..053113f 100644
--- a/include/configs/P1023RDB.h
+++ b/include/configs/P1023RDB.h
@@ -347,6 +347,14 @@ extern unsigned long get_clock_freq(void);
 #define CONFIG_SYS_BMAN_MEM_BASE   0xff20
 #define CONFIG_SYS_BMAN_MEM_PHYS   CONFIG_SYS_BMAN_MEM_BASE
 #define CONFIG_SYS_BMAN_MEM_SIZE 

[U-Boot] [PATCH V5] mpc85xx: inhibit qman and bman portals by default

2014-12-08 Thread Jeffrey Ladouceur
Not all portals might be managed and therefore visible.
Set the isdr register so that the corresponding isr register
won't be set. This is required when supporting power management.

Signed-off-by: Jeffrey Ladouceur 
---
The following dependent patches should be applied first:
http://patchwork.ozlabs.org/patch/403532
http://patchwork.ozlabs.org/patch/403533
http://patchwork.ozlabs.org/patch/403540
http://patchwork.ozlabs.org/patch/403534
http://patchwork.ozlabs.org/patch/403535
http://patchwork.ozlabs.org/patch/403538
http://patchwork.ozlabs.org/patch/403536
http://patchwork.ozlabs.org/patch/403539

Changes in v5:
 - Qman portals also require their isdr register to be set in order to support
 power management (sleep, deepsleep). Otherwise QMan will appear to not be idle
 if all portals are not managed by the OS.

Changes in v4:
 - The assertion that reading from portal reserved memory would return zero
 is incorrect. Therefore modify code to depend on specified number of
 portals in board config file

Changes in v3:
 - Update subject title to be consistent
Changes in v2:
 - Removed P1023RDS as it is no longer supported.

 arch/powerpc/cpu/mpc85xx/portals.c  |   43 +++
 include/configs/B4860QDS.h  |   16 +
 include/configs/P1023RDB.h  |   16 +
 include/configs/P2041RDB.h  |   16 +
 include/configs/T102xQDS.h  |   16 +
 include/configs/T102xRDB.h  |   16 +
 include/configs/T1040QDS.h  |   16 +
 include/configs/T104xRDB.h  |   16 +
 include/configs/T208xQDS.h  |   16 +
 include/configs/T208xRDB.h  |   16 +
 include/configs/T4240EMU.h  |   16 +
 include/configs/T4240QDS.h  |   16 +
 include/configs/T4240RDB.h  |   16 +
 include/configs/corenet_ds.h|   16 +
 include/configs/km/kmp204x-common.h |   16 +
 15 files changed, 267 insertions(+)

diff --git a/arch/powerpc/cpu/mpc85xx/portals.c 
b/arch/powerpc/cpu/mpc85xx/portals.c
index 98815f8..ec3b292 100644
--- a/arch/powerpc/cpu/mpc85xx/portals.c
+++ b/arch/powerpc/cpu/mpc85xx/portals.c
@@ -14,9 +14,46 @@
 #include 
 #include 
 
+#define MAX_BPORTALS (CONFIG_SYS_BMAN_CINH_SIZE / CONFIG_SYS_BMAN_SP_CINH_SIZE)
+#define MAX_QPORTALS (CONFIG_SYS_QMAN_CINH_SIZE / CONFIG_SYS_QMAN_SP_CINH_SIZE)
+static void inhibit_portals(void __iomem *addr, int max_portals,
+   int arch_max_portals, int portal_cinh_size)
+{
+   uint32_t val;
+   int i;
+
+   /* arch_max_portals is the maximum based on memory size. This includes
+* the reserved memory in the SoC.  max_portals the number of physical
+* portals in the SoC */
+   if (max_portals > arch_max_portals) {
+   printf("ERROR: portal config error\n");
+   max_portals = arch_max_portals;
+   }
+
+   for (i = 0; i < max_portals; i++) {
+   out_be32(addr, -1);
+   val = in_be32(addr);
+   if (!val) {
+   printf("ERROR: Stopped after %d portals\n", i);
+   goto done;
+   }
+   addr += portal_cinh_size;
+   }
+#ifdef DEBUG
+   printf("Cleared %d portals\n", i);
+#endif
+done:
+
+   return;
+}
+
 void setup_portals(void)
 {
ccsr_qman_t *qman = (void *)CONFIG_SYS_FSL_QMAN_ADDR;
+   void __iomem *bpaddr = (void *)CONFIG_SYS_BMAN_CINH_BASE +
+   CONFIG_SYS_BMAN_SWP_ISDR_REG;
+   void __iomem *qpaddr = (void *)CONFIG_SYS_QMAN_CINH_BASE +
+   CONFIG_SYS_QMAN_SWP_ISDR_REG;
 #ifdef CONFIG_FSL_CORENET
int i;
 
@@ -38,6 +75,12 @@ void setup_portals(void)
out_be32(&qman->qcsp_bare, (u32)(CONFIG_SYS_QMAN_MEM_PHYS >> 32));
 #endif
out_be32(&qman->qcsp_bar, (u32)CONFIG_SYS_QMAN_MEM_PHYS);
+
+   /* Change default state of BMan ISDR portals to all 1s */
+   inhibit_portals(bpaddr, CONFIG_SYS_BMAN_NUM_PORTALS, MAX_BPORTALS,
+   CONFIG_SYS_BMAN_SP_CINH_SIZE);
+   inhibit_portals(qpaddr, CONFIG_SYS_QMAN_NUM_PORTALS, MAX_QPORTALS,
+   CONFIG_SYS_QMAN_SP_CINH_SIZE);
 }
 
 /* Update portal containter to match LAW setup of portal in phy map */
diff --git a/include/configs/B4860QDS.h b/include/configs/B4860QDS.h
index dc1a9bc..4256488 100644
--- a/include/configs/B4860QDS.h
+++ b/include/configs/B4860QDS.h
@@ -641,6 +641,14 @@ unsigned long get_board_ddr_clk(void);
 #define CONFIG_SYS_BMAN_MEM_PHYS   CONFIG_SYS_BMAN_MEM_BASE
 #endif
 #define CONFIG_SYS_BMAN_MEM_SIZE   0x0200
+#define CONFIG_SYS_BMAN_SP_CENA_SIZE   0x4000
+#define CONFIG_SYS_BMAN_SP_CINH_SIZE   0x1000
+#define CONFIG_SYS_BMAN_CENA_BASE  CONFIG_SYS_BMAN_MEM_BASE
+#define CONFIG_SYS

[U-Boot] [PATCH] powerpc/T10xx: Fix number of portals

2014-12-03 Thread Jeffrey Ladouceur
Following boards has incorrect number of portals defined.
powerpc/T102xQDS
powerpc/T102xRDB
powerpc/T1040QDS
powerpc/T104xRDB

Signed-off-by: Jeffrey Ladouceur 
---
 include/configs/T102xQDS.h |4 ++--
 include/configs/T102xRDB.h |4 ++--
 include/configs/T1040QDS.h |4 ++--
 include/configs/T104xRDB.h |4 ++--
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/include/configs/T102xQDS.h b/include/configs/T102xQDS.h
index 35834fa..86eba50 100644
--- a/include/configs/T102xQDS.h
+++ b/include/configs/T102xQDS.h
@@ -716,7 +716,7 @@ unsigned long get_board_ddr_clk(void);
 /* Qman/Bman */
 #ifndef CONFIG_NOBQFMAN
 #define CONFIG_SYS_DPAA_QBMAN  /* Support Q/Bman */
-#define CONFIG_SYS_BMAN_NUM_PORTALS25
+#define CONFIG_SYS_BMAN_NUM_PORTALS10
 #define CONFIG_SYS_BMAN_MEM_BASE   0xf400
 #ifdef CONFIG_PHYS_64BIT
 #define CONFIG_SYS_BMAN_MEM_PHYS   0xff400ull
@@ -732,7 +732,7 @@ unsigned long get_board_ddr_clk(void);
CONFIG_SYS_BMAN_CENA_SIZE)
 #define CONFIG_SYS_BMAN_CINH_SIZE   (CONFIG_SYS_BMAN_MEM_SIZE >> 1)
 #define CONFIG_SYS_BMAN_SWP_ISDR_REG   0xE08
-#define CONFIG_SYS_QMAN_NUM_PORTALS25
+#define CONFIG_SYS_QMAN_NUM_PORTALS10
 #define CONFIG_SYS_QMAN_MEM_BASE   0xf600
 #ifdef CONFIG_PHYS_64BIT
 #define CONFIG_SYS_QMAN_MEM_PHYS   0xff600ull
diff --git a/include/configs/T102xRDB.h b/include/configs/T102xRDB.h
index e54e100..65aad20 100644
--- a/include/configs/T102xRDB.h
+++ b/include/configs/T102xRDB.h
@@ -677,7 +677,7 @@ unsigned long get_board_ddr_clk(void);
 /* Qman/Bman */
 #ifndef CONFIG_NOBQFMAN
 #define CONFIG_SYS_DPAA_QBMAN  /* Support Q/Bman */
-#define CONFIG_SYS_BMAN_NUM_PORTALS25
+#define CONFIG_SYS_BMAN_NUM_PORTALS10
 #define CONFIG_SYS_BMAN_MEM_BASE   0xf400
 #ifdef CONFIG_PHYS_64BIT
 #define CONFIG_SYS_BMAN_MEM_PHYS   0xff400ull
@@ -693,7 +693,7 @@ unsigned long get_board_ddr_clk(void);
CONFIG_SYS_BMAN_CENA_SIZE)
 #define CONFIG_SYS_BMAN_CINH_SIZE   (CONFIG_SYS_BMAN_MEM_SIZE >> 1)
 #define CONFIG_SYS_BMAN_SWP_ISDR_REG   0xE08
-#define CONFIG_SYS_QMAN_NUM_PORTALS25
+#define CONFIG_SYS_QMAN_NUM_PORTALS10
 #define CONFIG_SYS_QMAN_MEM_BASE   0xf600
 #ifdef CONFIG_PHYS_64BIT
 #define CONFIG_SYS_QMAN_MEM_PHYS   0xff600ull
diff --git a/include/configs/T1040QDS.h b/include/configs/T1040QDS.h
index d09c58d..73c8537 100644
--- a/include/configs/T1040QDS.h
+++ b/include/configs/T1040QDS.h
@@ -603,7 +603,7 @@ unsigned long get_board_ddr_clk(void);
 /* Qman/Bman */
 #ifndef CONFIG_NOBQFMAN
 #define CONFIG_SYS_DPAA_QBMAN  /* Support Q/Bman */
-#define CONFIG_SYS_BMAN_NUM_PORTALS25
+#define CONFIG_SYS_BMAN_NUM_PORTALS10
 #define CONFIG_SYS_BMAN_MEM_BASE   0xf400
 #define CONFIG_SYS_BMAN_MEM_PHYS   0xff400ull
 #define CONFIG_SYS_BMAN_MEM_SIZE   0x0200
@@ -615,7 +615,7 @@ unsigned long get_board_ddr_clk(void);
CONFIG_SYS_BMAN_CENA_SIZE)
 #define CONFIG_SYS_BMAN_CINH_SIZE   (CONFIG_SYS_BMAN_MEM_SIZE >> 1)
 #define CONFIG_SYS_BMAN_SWP_ISDR_REG   0xE08
-#define CONFIG_SYS_QMAN_NUM_PORTALS25
+#define CONFIG_SYS_QMAN_NUM_PORTALS10
 #define CONFIG_SYS_QMAN_MEM_BASE   0xf600
 #define CONFIG_SYS_QMAN_MEM_PHYS   0xff600ull
 #define CONFIG_SYS_QMAN_MEM_SIZE   0x0200
diff --git a/include/configs/T104xRDB.h b/include/configs/T104xRDB.h
index 5b663a0..d59296e 100644
--- a/include/configs/T104xRDB.h
+++ b/include/configs/T104xRDB.h
@@ -626,7 +626,7 @@
 /* Qman/Bman */
 #ifndef CONFIG_NOBQFMAN
 #define CONFIG_SYS_DPAA_QBMAN  /* Support Q/Bman */
-#define CONFIG_SYS_BMAN_NUM_PORTALS25
+#define CONFIG_SYS_BMAN_NUM_PORTALS10
 #define CONFIG_SYS_BMAN_MEM_BASE   0xf400
 #define CONFIG_SYS_BMAN_MEM_PHYS   0xff400ull
 #define CONFIG_SYS_BMAN_MEM_SIZE   0x0200
@@ -638,7 +638,7 @@
CONFIG_SYS_BMAN_CENA_SIZE)
 #define CONFIG_SYS_BMAN_CINH_SIZE   (CONFIG_SYS_BMAN_MEM_SIZE >> 1)
 #define CONFIG_SYS_BMAN_SWP_ISDR_REG   0xE08
-#define CONFIG_SYS_QMAN_NUM_PORTALS25
+#define CONFIG_SYS_QMAN_NUM_PORTALS10
 #define CONFIG_SYS_QMAN_MEM_BASE   0xf600
 #define CONFIG_SYS_QMAN_MEM_PHYS   0xff600ull
 #define CONFIG_SYS_QMAN_MEM_SIZE   0x0200
-- 
1.7.9.5

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4] mpc85xx: inhibit bman portals by default

2014-12-03 Thread Jeffrey Ladouceur
Not all portals might be managed and therefore visible.
Set the isdr register so that the corresponding isr register
won't be set. This is needed for deepsleep.

Signed-off-by: Jeffrey Ladouceur 
---
The following dependent patches should be applied first:
http://patchwork.ozlabs.org/patch/403532
http://patchwork.ozlabs.org/patch/403533
http://patchwork.ozlabs.org/patch/403540
http://patchwork.ozlabs.org/patch/403534
http://patchwork.ozlabs.org/patch/403535
http://patchwork.ozlabs.org/patch/403538
http://patchwork.ozlabs.org/patch/403536
http://patchwork.ozlabs.org/patch/403539

Changes in v4:
 - The assertion that reading from portal reserved memory would return zero
 is incorrect. Therefore modify code to depend on specified number of
 portals in board config file

Changes in v3:
 - Update subject title to be consistent
Changes in v2:
 - Removed P1023RDS as it is no longer supported.

 arch/powerpc/cpu/mpc85xx/portals.c  |   36 +++
 include/configs/B4860QDS.h  |8 
 include/configs/P1023RDB.h  |8 
 include/configs/P2041RDB.h  |8 
 include/configs/T102xQDS.h  |8 
 include/configs/T102xRDB.h  |8 
 include/configs/T1040QDS.h  |8 
 include/configs/T104xRDB.h  |8 
 include/configs/T208xQDS.h  |8 
 include/configs/T208xRDB.h  |8 
 include/configs/T4240EMU.h  |8 
 include/configs/T4240QDS.h  |8 
 include/configs/T4240RDB.h  |8 
 include/configs/corenet_ds.h|8 
 include/configs/km/kmp204x-common.h |8 
 15 files changed, 148 insertions(+)

diff --git a/arch/powerpc/cpu/mpc85xx/portals.c 
b/arch/powerpc/cpu/mpc85xx/portals.c
index 98815f8..2972865 100644
--- a/arch/powerpc/cpu/mpc85xx/portals.c
+++ b/arch/powerpc/cpu/mpc85xx/portals.c
@@ -14,6 +14,39 @@
 #include 
 #include 
 
+#define MAX_PORTALS (CONFIG_SYS_BMAN_CINH_SIZE / CONFIG_SYS_BMAN_SP_CINH_SIZE)
+void inhibit_bman_portals(void)
+{
+   void __iomem *addr = (void *)CONFIG_SYS_BMAN_CINH_BASE +
+   CONFIG_SYS_BMAN_SWP_ISDR_REG;
+   uint32_t val;
+   int i, max_portals = CONFIG_SYS_BMAN_NUM_PORTALS;
+
+   /* MAX_PORTALS is the maximum based on memory size. This includes the
+* reserved memory in the SoC.  CONFIG_SYS_BMAN_NUM_PORTALS is the
+* number of physical portals in the SoC */
+   if (CONFIG_SYS_BMAN_NUM_PORTALS > MAX_PORTALS) {
+   printf("ERROR: BMAN portal config error\n");
+   max_portals = MAX_PORTALS;
+   }
+
+   for (i = 0; i < max_portals; i++) {
+   out_be32(addr, -1);
+   val = in_be32(addr);
+   if (!val) {
+   printf("ERROR: Stopped after %d BMan portals\n", i);
+   goto done;
+   }
+   addr += CONFIG_SYS_BMAN_SP_CINH_SIZE;
+   }
+#ifdef DEBUG
+   printf("Cleared %d Bman portals\n", i);
+#endif
+done:
+
+   return;
+}
+
 void setup_portals(void)
 {
ccsr_qman_t *qman = (void *)CONFIG_SYS_FSL_QMAN_ADDR;
@@ -38,6 +71,9 @@ void setup_portals(void)
out_be32(&qman->qcsp_bare, (u32)(CONFIG_SYS_QMAN_MEM_PHYS >> 32));
 #endif
out_be32(&qman->qcsp_bar, (u32)CONFIG_SYS_QMAN_MEM_PHYS);
+
+   /* Change default state of BMan ISDR portals to all 1s */
+   inhibit_bman_portals();
 }
 
 /* Update portal containter to match LAW setup of portal in phy map */
diff --git a/include/configs/B4860QDS.h b/include/configs/B4860QDS.h
index dc1a9bc..31f1d3f 100644
--- a/include/configs/B4860QDS.h
+++ b/include/configs/B4860QDS.h
@@ -641,6 +641,14 @@ unsigned long get_board_ddr_clk(void);
 #define CONFIG_SYS_BMAN_MEM_PHYS   CONFIG_SYS_BMAN_MEM_BASE
 #endif
 #define CONFIG_SYS_BMAN_MEM_SIZE   0x0200
+#define CONFIG_SYS_BMAN_SP_CENA_SIZE   0x4000
+#define CONFIG_SYS_BMAN_SP_CINH_SIZE   0x1000
+#define CONFIG_SYS_BMAN_CENA_BASE  CONFIG_SYS_BMAN_MEM_BASE
+#define CONFIG_SYS_BMAN_CENA_SIZE  (CONFIG_SYS_BMAN_MEM_SIZE >> 1)
+#define CONFIG_SYS_BMAN_CINH_BASE  (CONFIG_SYS_BMAN_MEM_BASE + \
+   CONFIG_SYS_BMAN_CENA_SIZE)
+#define CONFIG_SYS_BMAN_CINH_SIZE  (CONFIG_SYS_BMAN_MEM_SIZE >> 1)
+#define CONFIG_SYS_BMAN_SWP_ISDR_REG   0xE08
 #define CONFIG_SYS_QMAN_NUM_PORTALS25
 #define CONFIG_SYS_QMAN_MEM_BASE   0xf600
 #ifdef CONFIG_PHYS_64BIT
diff --git a/include/configs/P1023RDB.h b/include/configs/P1023RDB.h
index 6b29add..053113f 100644
--- a/include/configs/P1023RDB.h
+++ b/include/configs/P1023RDB.h
@@ -347,6 +347,14 @@ extern unsigned long get_clock_freq(void);
 #define CONFIG_SYS_BMAN_MEM_BASE   0xff20
 #define CONFIG_SYS_BMAN_MEM_PHYS   CONFIG_SYS_BMAN_MEM_BASE
 #define CONFIG_SYS_BMAN_MEM_SIZE 

[U-Boot] [PATCH v3] mpc85xx: inhibit bman portals by default

2014-11-10 Thread Jeffrey Ladouceur
Not all portals might be managed and therefore visible.
Set the isdr register so that the corresponding isr register
won't be set. This is needed for deepsleep.

Signed-off-by: Jeffrey Ladouceur 
---
The following dependent patches should be applied first:
http://patchwork.ozlabs.org/patch/403532
http://patchwork.ozlabs.org/patch/403533
http://patchwork.ozlabs.org/patch/403540
http://patchwork.ozlabs.org/patch/403534
http://patchwork.ozlabs.org/patch/403535
http://patchwork.ozlabs.org/patch/403538
http://patchwork.ozlabs.org/patch/403536
http://patchwork.ozlabs.org/patch/403539

Changes in v3:
 - Update subject title to be consistent
Changes in v2:
 - Removed P1023RDS as it is no longer supported.

 arch/powerpc/cpu/mpc85xx/portals.c  |   41 +++
 include/configs/B4860QDS.h  |8 +++
 include/configs/P1023RDB.h  |8 +++
 include/configs/P2041RDB.h  |8 +++
 include/configs/T102xQDS.h  |8 +++
 include/configs/T102xRDB.h  |8 +++
 include/configs/T1040QDS.h  |8 +++
 include/configs/T104xRDB.h  |8 +++
 include/configs/T208xQDS.h  |8 +++
 include/configs/T208xRDB.h  |8 +++
 include/configs/T4240EMU.h  |8 +++
 include/configs/T4240QDS.h  |8 +++
 include/configs/T4240RDB.h  |8 +++
 include/configs/corenet_ds.h|8 +++
 include/configs/km/kmp204x-common.h |8 +++
 15 files changed, 153 insertions(+)

diff --git a/arch/powerpc/cpu/mpc85xx/portals.c 
b/arch/powerpc/cpu/mpc85xx/portals.c
index 98815f8..4c2ee98 100644
--- a/arch/powerpc/cpu/mpc85xx/portals.c
+++ b/arch/powerpc/cpu/mpc85xx/portals.c
@@ -14,6 +14,44 @@
 #include 
 #include 
 
+#define MAX_PORTALS (CONFIG_SYS_BMAN_CINH_SIZE / CONFIG_SYS_BMAN_SP_CINH_SIZE)
+void inhibit_bman_portals(void)
+{
+   void __iomem *addr = (void *)CONFIG_SYS_BMAN_CINH_BASE +
+   CONFIG_SYS_BMAN_SWP_ISDR_REG;
+   uint32_t val;
+   int portal_count = 0;
+
+   /* Dynamically determine number of portals */
+   do {
+   val = in_be32(addr);
+   if (val) {
+   printf("ERROR: should be zero at 0x%p\n", addr);
+   goto done;
+   }
+   out_be32(addr, -1);
+   val = in_be32(addr);
+   if (!val) {
+   /* end of portals */
+   if (!portal_count)
+   printf("ERROR: No portals\n");
+   goto done;
+   }
+   portal_count++;
+   addr += CONFIG_SYS_BMAN_SP_CINH_SIZE;
+   if (portal_count >= MAX_PORTALS)
+   goto done;
+   } while (1);
+
+done:
+
+#ifdef DEBUG
+   printf("BMan portal counted %u, defined is %u\n",
+  portal_count, CONFIG_SYS_BMAN_NUM_PORTALS);
+#endif
+   return;
+}
+
 void setup_portals(void)
 {
ccsr_qman_t *qman = (void *)CONFIG_SYS_FSL_QMAN_ADDR;
@@ -38,6 +76,9 @@ void setup_portals(void)
out_be32(&qman->qcsp_bare, (u32)(CONFIG_SYS_QMAN_MEM_PHYS >> 32));
 #endif
out_be32(&qman->qcsp_bar, (u32)CONFIG_SYS_QMAN_MEM_PHYS);
+
+   /* Change default state of BMan ISDR portals to all 1s */
+   inhibit_bman_portals();
 }
 
 /* Update portal containter to match LAW setup of portal in phy map */
diff --git a/include/configs/B4860QDS.h b/include/configs/B4860QDS.h
index dc1a9bc..31f1d3f 100644
--- a/include/configs/B4860QDS.h
+++ b/include/configs/B4860QDS.h
@@ -641,6 +641,14 @@ unsigned long get_board_ddr_clk(void);
 #define CONFIG_SYS_BMAN_MEM_PHYS   CONFIG_SYS_BMAN_MEM_BASE
 #endif
 #define CONFIG_SYS_BMAN_MEM_SIZE   0x0200
+#define CONFIG_SYS_BMAN_SP_CENA_SIZE   0x4000
+#define CONFIG_SYS_BMAN_SP_CINH_SIZE   0x1000
+#define CONFIG_SYS_BMAN_CENA_BASE  CONFIG_SYS_BMAN_MEM_BASE
+#define CONFIG_SYS_BMAN_CENA_SIZE  (CONFIG_SYS_BMAN_MEM_SIZE >> 1)
+#define CONFIG_SYS_BMAN_CINH_BASE  (CONFIG_SYS_BMAN_MEM_BASE + \
+   CONFIG_SYS_BMAN_CENA_SIZE)
+#define CONFIG_SYS_BMAN_CINH_SIZE  (CONFIG_SYS_BMAN_MEM_SIZE >> 1)
+#define CONFIG_SYS_BMAN_SWP_ISDR_REG   0xE08
 #define CONFIG_SYS_QMAN_NUM_PORTALS25
 #define CONFIG_SYS_QMAN_MEM_BASE   0xf600
 #ifdef CONFIG_PHYS_64BIT
diff --git a/include/configs/P1023RDB.h b/include/configs/P1023RDB.h
index ba3da06..107db72 100644
--- a/include/configs/P1023RDB.h
+++ b/include/configs/P1023RDB.h
@@ -347,6 +347,14 @@ extern unsigned long get_clock_freq(void);
 #define CONFIG_SYS_BMAN_MEM_BASE   0xff20
 #define CONFIG_SYS_BMAN_MEM_PHYS   CONFIG_SYS_BMAN_MEM_BASE
 #define CONFIG_SYS_BMAN_MEM_SIZE   0x0020
+#define CONFIG_SYS_BMAN_SP_CENA_SIZE0x4000
+#define CONFIG_SYS_BMAN_SP_CINH_SIZE0x1000
+#de

[U-Boot] [U-Boot,v2] mpc85xx: inhibit bman portals by default

2014-11-08 Thread Jeffrey Ladouceur
Not all portals might be managed and therefore visible.
Set the isdr register so that the corresponding isr register
won't be set. This is needed for deepsleep.

Signed-off-by: Jeffrey Ladouceur 
---

The following dependent patches should be applied first:
http://patchwork.ozlabs.org/patch/403532
http://patchwork.ozlabs.org/patch/403533
http://patchwork.ozlabs.org/patch/403540
http://patchwork.ozlabs.org/patch/403534
http://patchwork.ozlabs.org/patch/403535
http://patchwork.ozlabs.org/patch/403538
http://patchwork.ozlabs.org/patch/403536
http://patchwork.ozlabs.org/patch/403539

Changes in v2:
 - Removed P1023RDS as it is no longer supported.

 arch/powerpc/cpu/mpc85xx/portals.c  |   41 +++
 include/configs/B4860QDS.h  |8 +++
 include/configs/P1023RDB.h  |8 +++
 include/configs/P2041RDB.h  |8 +++
 include/configs/T102xQDS.h  |8 +++
 include/configs/T102xRDB.h  |8 +++
 include/configs/T1040QDS.h  |8 +++
 include/configs/T104xRDB.h  |8 +++
 include/configs/T208xQDS.h  |8 +++
 include/configs/T208xRDB.h  |8 +++
 include/configs/T4240EMU.h  |8 +++
 include/configs/T4240QDS.h  |8 +++
 include/configs/T4240RDB.h  |8 +++
 include/configs/corenet_ds.h|8 +++
 include/configs/km/kmp204x-common.h |8 +++
 15 files changed, 153 insertions(+)

diff --git a/arch/powerpc/cpu/mpc85xx/portals.c 
b/arch/powerpc/cpu/mpc85xx/portals.c
index 98815f8..4c2ee98 100644
--- a/arch/powerpc/cpu/mpc85xx/portals.c
+++ b/arch/powerpc/cpu/mpc85xx/portals.c
@@ -14,6 +14,44 @@
 #include 
 #include 
 
+#define MAX_PORTALS (CONFIG_SYS_BMAN_CINH_SIZE / CONFIG_SYS_BMAN_SP_CINH_SIZE)
+void inhibit_bman_portals(void)
+{
+   void __iomem *addr = (void *)CONFIG_SYS_BMAN_CINH_BASE +
+   CONFIG_SYS_BMAN_SWP_ISDR_REG;
+   uint32_t val;
+   int portal_count = 0;
+
+   /* Dynamically determine number of portals */
+   do {
+   val = in_be32(addr);
+   if (val) {
+   printf("ERROR: should be zero at 0x%p\n", addr);
+   goto done;
+   }
+   out_be32(addr, -1);
+   val = in_be32(addr);
+   if (!val) {
+   /* end of portals */
+   if (!portal_count)
+   printf("ERROR: No portals\n");
+   goto done;
+   }
+   portal_count++;
+   addr += CONFIG_SYS_BMAN_SP_CINH_SIZE;
+   if (portal_count >= MAX_PORTALS)
+   goto done;
+   } while (1);
+
+done:
+
+#ifdef DEBUG
+   printf("BMan portal counted %u, defined is %u\n",
+  portal_count, CONFIG_SYS_BMAN_NUM_PORTALS);
+#endif
+   return;
+}
+
 void setup_portals(void)
 {
ccsr_qman_t *qman = (void *)CONFIG_SYS_FSL_QMAN_ADDR;
@@ -38,6 +76,9 @@ void setup_portals(void)
out_be32(&qman->qcsp_bare, (u32)(CONFIG_SYS_QMAN_MEM_PHYS >> 32));
 #endif
out_be32(&qman->qcsp_bar, (u32)CONFIG_SYS_QMAN_MEM_PHYS);
+
+   /* Change default state of BMan ISDR portals to all 1s */
+   inhibit_bman_portals();
 }
 
 /* Update portal containter to match LAW setup of portal in phy map */
diff --git a/include/configs/B4860QDS.h b/include/configs/B4860QDS.h
index dc1a9bc..31f1d3f 100644
--- a/include/configs/B4860QDS.h
+++ b/include/configs/B4860QDS.h
@@ -641,6 +641,14 @@ unsigned long get_board_ddr_clk(void);
 #define CONFIG_SYS_BMAN_MEM_PHYS   CONFIG_SYS_BMAN_MEM_BASE
 #endif
 #define CONFIG_SYS_BMAN_MEM_SIZE   0x0200
+#define CONFIG_SYS_BMAN_SP_CENA_SIZE   0x4000
+#define CONFIG_SYS_BMAN_SP_CINH_SIZE   0x1000
+#define CONFIG_SYS_BMAN_CENA_BASE  CONFIG_SYS_BMAN_MEM_BASE
+#define CONFIG_SYS_BMAN_CENA_SIZE  (CONFIG_SYS_BMAN_MEM_SIZE >> 1)
+#define CONFIG_SYS_BMAN_CINH_BASE  (CONFIG_SYS_BMAN_MEM_BASE + \
+   CONFIG_SYS_BMAN_CENA_SIZE)
+#define CONFIG_SYS_BMAN_CINH_SIZE  (CONFIG_SYS_BMAN_MEM_SIZE >> 1)
+#define CONFIG_SYS_BMAN_SWP_ISDR_REG   0xE08
 #define CONFIG_SYS_QMAN_NUM_PORTALS25
 #define CONFIG_SYS_QMAN_MEM_BASE   0xf600
 #ifdef CONFIG_PHYS_64BIT
diff --git a/include/configs/P1023RDB.h b/include/configs/P1023RDB.h
index ba3da06..107db72 100644
--- a/include/configs/P1023RDB.h
+++ b/include/configs/P1023RDB.h
@@ -347,6 +347,14 @@ extern unsigned long get_clock_freq(void);
 #define CONFIG_SYS_BMAN_MEM_BASE   0xff20
 #define CONFIG_SYS_BMAN_MEM_PHYS   CONFIG_SYS_BMAN_MEM_BASE
 #define CONFIG_SYS_BMAN_MEM_SIZE   0x0020
+#define CONFIG_SYS_BMAN_SP_CENA_SIZE0x4000
+#define CONFIG_SYS_BMAN_SP_CINH_SIZE0x1000
+#define CONFIG_SYS_BMAN_CENA_BASE   CONFIG_SYS_BMAN_MEM_BASE
+

[U-Boot] mpc85xx: inhibit bman portals by default

2014-11-07 Thread Jeffrey Ladouceur
Not all portals might be managed and therefore visible.
Set the isdr register so that the corresponding isr register
won't be set. This is needed for deepsleep.

Signed-off-by: Jeffrey Ladouceur 
---
Depends on at minimum:
Developed during T102X testing.
http://patchwork.ozlabs.org/patch/403533
http://patchwork.ozlabs.org/patch/403539/
 
 arch/powerpc/cpu/mpc85xx/portals.c  |   41 +++
 include/configs/B4860QDS.h  |8 +++
 include/configs/P1023RDB.h  |8 +++
 include/configs/P1023RDS.h  |8 +++
 include/configs/P2041RDB.h  |8 +++
 include/configs/T102xQDS.h  |8 +++
 include/configs/T102xRDB.h  |8 +++
 include/configs/T1040QDS.h  |8 +++
 include/configs/T104xRDB.h  |8 +++
 include/configs/T208xQDS.h  |8 +++
 include/configs/T208xRDB.h  |8 +++
 include/configs/T4240EMU.h  |8 +++
 include/configs/T4240QDS.h  |8 +++
 include/configs/T4240RDB.h  |8 +++
 include/configs/corenet_ds.h|8 +++
 include/configs/km/kmp204x-common.h |8 +++
 16 files changed, 161 insertions(+)

diff --git a/arch/powerpc/cpu/mpc85xx/portals.c 
b/arch/powerpc/cpu/mpc85xx/portals.c
index 98815f8..4c2ee98 100644
--- a/arch/powerpc/cpu/mpc85xx/portals.c
+++ b/arch/powerpc/cpu/mpc85xx/portals.c
@@ -14,6 +14,44 @@
 #include 
 #include 
 
+#define MAX_PORTALS (CONFIG_SYS_BMAN_CINH_SIZE / CONFIG_SYS_BMAN_SP_CINH_SIZE)
+void inhibit_bman_portals(void)
+{
+   void __iomem *addr = (void *)CONFIG_SYS_BMAN_CINH_BASE +
+   CONFIG_SYS_BMAN_SWP_ISDR_REG;
+   uint32_t val;
+   int portal_count = 0;
+
+   /* Dynamically determine number of portals */
+   do {
+   val = in_be32(addr);
+   if (val) {
+   printf("ERROR: should be zero at 0x%p\n", addr);
+   goto done;
+   }
+   out_be32(addr, -1);
+   val = in_be32(addr);
+   if (!val) {
+   /* end of portals */
+   if (!portal_count)
+   printf("ERROR: No portals\n");
+   goto done;
+   }
+   portal_count++;
+   addr += CONFIG_SYS_BMAN_SP_CINH_SIZE;
+   if (portal_count >= MAX_PORTALS)
+   goto done;
+   } while (1);
+
+done:
+
+#ifdef DEBUG
+   printf("BMan portal counted %u, defined is %u\n",
+  portal_count, CONFIG_SYS_BMAN_NUM_PORTALS);
+#endif
+   return;
+}
+
 void setup_portals(void)
 {
ccsr_qman_t *qman = (void *)CONFIG_SYS_FSL_QMAN_ADDR;
@@ -38,6 +76,9 @@ void setup_portals(void)
out_be32(&qman->qcsp_bare, (u32)(CONFIG_SYS_QMAN_MEM_PHYS >> 32));
 #endif
out_be32(&qman->qcsp_bar, (u32)CONFIG_SYS_QMAN_MEM_PHYS);
+
+   /* Change default state of BMan ISDR portals to all 1s */
+   inhibit_bman_portals();
 }
 
 /* Update portal containter to match LAW setup of portal in phy map */
diff --git a/include/configs/B4860QDS.h b/include/configs/B4860QDS.h
index 2fbb2c7..3f074ea 100644
--- a/include/configs/B4860QDS.h
+++ b/include/configs/B4860QDS.h
@@ -641,6 +641,14 @@ unsigned long get_board_ddr_clk(void);
 #define CONFIG_SYS_BMAN_MEM_PHYS   CONFIG_SYS_BMAN_MEM_BASE
 #endif
 #define CONFIG_SYS_BMAN_MEM_SIZE   0x0200
+#define CONFIG_SYS_BMAN_SP_CENA_SIZE   0x4000
+#define CONFIG_SYS_BMAN_SP_CINH_SIZE   0x1000
+#define CONFIG_SYS_BMAN_CENA_BASE  CONFIG_SYS_BMAN_MEM_BASE
+#define CONFIG_SYS_BMAN_CENA_SIZE  (CONFIG_SYS_BMAN_MEM_SIZE >> 1)
+#define CONFIG_SYS_BMAN_CINH_BASE  (CONFIG_SYS_BMAN_MEM_BASE + \
+   CONFIG_SYS_BMAN_CENA_SIZE)
+#define CONFIG_SYS_BMAN_CINH_SIZE  (CONFIG_SYS_BMAN_MEM_SIZE >> 1)
+#define CONFIG_SYS_BMAN_SWP_ISDR_REG   0xE08
 #define CONFIG_SYS_QMAN_NUM_PORTALS25
 #define CONFIG_SYS_QMAN_MEM_BASE   0xf600
 #ifdef CONFIG_PHYS_64BIT
diff --git a/include/configs/P1023RDB.h b/include/configs/P1023RDB.h
index ba3da06..107db72 100644
--- a/include/configs/P1023RDB.h
+++ b/include/configs/P1023RDB.h
@@ -347,6 +347,14 @@ extern unsigned long get_clock_freq(void);
 #define CONFIG_SYS_BMAN_MEM_BASE   0xff20
 #define CONFIG_SYS_BMAN_MEM_PHYS   CONFIG_SYS_BMAN_MEM_BASE
 #define CONFIG_SYS_BMAN_MEM_SIZE   0x0020
+#define CONFIG_SYS_BMAN_SP_CENA_SIZE0x4000
+#define CONFIG_SYS_BMAN_SP_CINH_SIZE0x1000
+#define CONFIG_SYS_BMAN_CENA_BASE   CONFIG_SYS_BMAN_MEM_BASE
+#define CONFIG_SYS_BMAN_CENA_SIZE   (CONFIG_SYS_BMAN_MEM_SIZE >> 1)
+#define CONFIG_SYS_BMAN_CINH_BASE   (CONFIG_SYS_BMAN_MEM_BASE + \
+   CONFIG_SYS_BMAN_CENA_SIZE)
+#define CONFIG_SYS_BMAN_CINH_SIZE   (CONFIG_SYS

[U-Boot] powerpc/mpc85xx: Add revision properties in portal device tree node 'pme'

2013-01-25 Thread Jeffrey Ladouceur
The 'fsl,pme-rev1' and 'fsl-pme-rev2' properties have been added to the
pme portal node. This is required for software to determine which version
of PME hardware is present and take appropriate actions.
These properties are a direct reflection of the corresponding ccsr pme
register value.

Also removed unnecessary static global variables.

Signed-off-by: Jeffrey Ladouceur 
---
 arch/powerpc/cpu/mpc85xx/portals.c |   20 +---
 1 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/cpu/mpc85xx/portals.c 
b/arch/powerpc/cpu/mpc85xx/portals.c
index b59ef69..d529095 100644
--- a/arch/powerpc/cpu/mpc85xx/portals.c
+++ b/arch/powerpc/cpu/mpc85xx/portals.c
@@ -30,11 +30,9 @@
 #include 
 #include 
 
-static ccsr_qman_t *qman = (void *)CONFIG_SYS_FSL_QMAN_ADDR;
-static ccsr_bman_t *bman = (void *)CONFIG_SYS_FSL_BMAN_ADDR;
-
 void setup_portals(void)
 {
+   ccsr_qman_t *qman = (void *)CONFIG_SYS_FSL_QMAN_ADDR;
 #ifdef CONFIG_FSL_CORENET
int i;
 
@@ -166,6 +164,20 @@ static int fdt_qportal(void *blob, int off, int id, char 
*name,
num = get_dpaa_liodn(dev, &liodns[0], id);
ret = fdt_setprop(blob, childoff, "fsl,liodn",
  &liodns[0], sizeof(u32) * num);
+   if (!strncmp(name, "pme", 3)) {
+   u32 pme_rev1, pme_rev2;
+   ccsr_pme_t *pme_regs =
+   (void *)CONFIG_SYS_FSL_CORENET_PME_ADDR;
+
+   pme_rev1 = in_be32(&pme_regs->pm_ip_rev_1);
+   pme_rev2 = in_be32(&pme_regs->pm_ip_rev_2);
+   ret = fdt_setprop(blob, childoff,
+   "fsl,pme-rev1", &pme_rev1, sizeof(u32));
+   if (ret < 0)
+   return ret;
+   ret = fdt_setprop(blob, childoff,
+   "fsl,pme-rev2", &pme_rev2, sizeof(u32));
+   }
 #endif
} else {
return childoff;
@@ -183,6 +195,7 @@ void fdt_fixup_qportals(void *blob)
int off, err;
unsigned int maj, min;
unsigned int ip_cfg;
+   ccsr_qman_t *qman = (void *)CONFIG_SYS_FSL_QMAN_ADDR;
u32 rev_1 = in_be32(&qman->ip_rev_1);
u32 rev_2 = in_be32(&qman->ip_rev_2);
char compat[64];
@@ -272,6 +285,7 @@ void fdt_fixup_bportals(void *blob)
int off, err;
unsigned int maj, min;
unsigned int ip_cfg;
+   ccsr_bman_t *bman = (void *)CONFIG_SYS_FSL_BMAN_ADDR;
u32 rev_1 = in_be32(&bman->ip_rev_1);
u32 rev_2 = in_be32(&bman->ip_rev_2);
char compat[64];
-- 
1.7.2.1


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot