Re: [U-Boot] [PATCH] Powerpc/QE: Add QE support for T1040

2014-01-26 Thread qiang.z...@freescale.com



On Sat, Jan 25, 2014 at 11:49 PM, Timur Tabiti...@tabi.org wrote:
 -Original Message-
 From: Timur Tabi [mailto:ti...@tabi.org]
 Sent: Saturday, January 25, 2014 11:49 PM
 To: Zhao Qiang-B45475
 Cc: U-Boot Mailing List; Xu Jiucheng-B37781; Xie Xiaobo-R63061
 Subject: Re: [U-Boot] [PATCH] Powerpc/QE: Add QE support for T1040
 
 On Fri, Jan 24, 2014 at 3:05 AM, Zhao Qiang b45...@freescale.com wrote:
  +#ifdef CONFIG_PPC_T1040
  +   qe_upload_firmware((const void *)CONFIG_SYS_QE_UCODE_FW_ADDR);
  +#else
  qe_upload_firmware((const void *)CONFIG_SYS_QE_FMAN_FW_ADDR);
  +#endif
 
 
 
 It's been a while since I looked at the QE code in U-Boot, but this
 should be unnecessary.  CONFIG_SYS_QE_FMAN_FW_ADDR is supposed to point
 to the QE microcode blob.  Why do you need to define
 CONFIG_SYS_QE_UCODE_FW_ADDR?  That's redundant.
 
CONFIG_SYS_QE_FMAN_FW_ADDR is used for Fman microcode while 
CONFIG_SYS_QE_UCODE_FW_ADDR used 
For QE microcode.

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


Re: [U-Boot] [PATCH] Powerpc/QE: Add QE support for T1040

2014-01-26 Thread qiang.z...@freescale.com
Timur Tabi wrote:



 -Original Message-
 From: Timur Tabi [mailto:ti...@tabi.org]
 Sent: Sunday, January 26, 2014 12:37 PM
 To: Zhao Qiang-B45475
 Cc: U-Boot Mailing List; Xu Jiucheng-B37781; Xie Xiaobo-R63061
 Subject: Re: [U-Boot] [PATCH] Powerpc/QE: Add QE support for T1040
 
 qiang.z...@freescale.com wrote:
  Other boards have either Fman or QE, So CONFIG_SYS_QE_FMAN_FW_ADDR can
  be used either Fman or QE.
 
  But T1040QDS have both Fman and QE.
 
 Does the T1040QDS have microcode for both Fman and QE?  Normally, QE
 microcode is not needed.
 

T1040QDS has microcode for Fman and another microcode for QE.
The two microcodes is different.

QE microcode is needed.

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


Re: [U-Boot] [PATCH] Powerpc/QE: Add QE support for T1040

2014-01-26 Thread qiang.z...@freescale.com
Timur Tabi wrote:

 -Original Message-
 From: Timur Tabi [mailto:ti...@tabi.org]
 Sent: Sunday, January 26, 2014 11:23 AM
 To: Zhao Qiang-B45475
 Cc: U-Boot Mailing List; Xu Jiucheng-B37781; Xie Xiaobo-R63061
 Subject: Re: [U-Boot] [PATCH] Powerpc/QE: Add QE support for T1040
 
 qiang.z...@freescale.com wrote:
  CONFIG_SYS_QE_FMAN_FW_ADDR is used for Fman microcode while
  CONFIG_SYS_QE_UCODE_FW_ADDR used For QE microcode.
 
 No, CONFIG_SYS_QE_FMAN_FW_ADDR is used for both QE and Fman microcode.
 That's why it says QE_FMAN in it.  This is documented in the README.
 

Other boards have either Fman or QE, So CONFIG_SYS_QE_FMAN_FW_ADDR can 
be used either Fman or QE.

But T1040QDS have both Fman and QE.

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


Re: [U-Boot] [PATCH] Powerpc/QE: Add QE support for T1040

2014-01-26 Thread Timur Tabi

qiang.z...@freescale.com wrote:

T1040QDS has microcode for Fman and another microcode for QE.
The two microcodes is different.

QE microcode is needed.


Then why do you have an #else statement:

+#ifdef CONFIG_PPC_T1040
+   qe_upload_firmware((const void *)CONFIG_SYS_QE_UCODE_FW_ADDR);
+#else
qe_upload_firmware((const void *)CONFIG_SYS_QE_FMAN_FW_ADDR);
+#endif

On the T1040, you're uploading only the QE firmware.

I think you're going to have to do a lot of work to fix this.  #ifdef 
CONFIG_PPC_T1040 is not acceptable.


1. Replace CONFIG_SYS_QE_FMAN_FW_ADDR with CONFIG_SYS_QE_FW_ADDR and 
CONFIG_SYS_FMAN_FW_ADDR.  Any board that uses CONFIG_SYS_QE_FMAN_FW_ADDR 
for QE firmware will use CONFIG_SYS_QE_FW_ADDR instead.  Any board that 
uses CONFIG_SYS_QE_FMAN_FW_ADDR for Fman firmware will use 
CONFIG_SYS_FMAN_FW_ADDR instead.


2. Modify the QE code to use CONFIG_SYS_QE_FW_ADDR to upload the QE 
firmware.  Modify the Fman code to use CONFIG_SYS_FMAN_FW_ADDR to upload 
the Fman firmwre.  Then you can do this:


#ifdef CONFIG_SYS_QE_FW_ADDR
   qe_upload_firmware((const void *)CONFIG_SYS_QE_FW_ADDR);
#endif
#ifdef CONFIG_SYS_FMAN_FW_ADDR
   qe_upload_firmware((const void *)CONFIG_SYS_FMAN_FW_ADDR);
+#endif

3. Update the README

This way, you can support all SoCs that have QE and/or Fman, without 
making the code work only on the T1040.  Don't forget to test other 
boards with QE and Fman before posting patches so that you know you 
didn't break any other boards.


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


Re: [U-Boot] [PATCH] Powerpc/QE: Add QE support for T1040

2014-01-25 Thread Timur Tabi
On Fri, Jan 24, 2014 at 3:05 AM, Zhao Qiang b45...@freescale.com wrote:
 +#ifdef CONFIG_PPC_T1040
 +   qe_upload_firmware((const void *)CONFIG_SYS_QE_UCODE_FW_ADDR);
 +#else
 qe_upload_firmware((const void *)CONFIG_SYS_QE_FMAN_FW_ADDR);
 +#endif



It's been a while since I looked at the QE code in U-Boot, but this
should be unnecessary.  CONFIG_SYS_QE_FMAN_FW_ADDR is supposed to
point to the QE microcode blob.  Why do you need to define
CONFIG_SYS_QE_UCODE_FW_ADDR?  That's redundant.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] Powerpc/QE: Add QE support for T1040

2014-01-25 Thread Timur Tabi

qiang.z...@freescale.com wrote:

CONFIG_SYS_QE_FMAN_FW_ADDR is used for Fman microcode while 
CONFIG_SYS_QE_UCODE_FW_ADDR used
For QE microcode.


No, CONFIG_SYS_QE_FMAN_FW_ADDR is used for both QE and Fman microcode. 
That's why it says QE_FMAN in it.  This is documented in the README.

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


Re: [U-Boot] [PATCH] Powerpc/QE: Add QE support for T1040

2014-01-25 Thread Timur Tabi

qiang.z...@freescale.com wrote:

Other boards have either Fman or QE, So CONFIG_SYS_QE_FMAN_FW_ADDR can
be used either Fman or QE.

But T1040QDS have both Fman and QE.


Does the T1040QDS have microcode for both Fman and QE?  Normally, QE 
microcode is not needed.

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


[U-Boot] [PATCH] Powerpc/QE: Add QE support for T1040

2014-01-24 Thread Zhao Qiang
T1040 has QE-related addresses different from other boards,
modify those addresses value with macro CONFIG_PPC_T1040
and CONFIG_T1040QDS.
Add function qe_board_setup to mux the bus to tdm or uart
according to hwconfig.

Signed-off-by: Jiucheng Xu jiucheng...@freescale.com
Signed-off-by: Zhao Qiang b45...@freescale.com
---
 arch/powerpc/cpu/mpc85xx/cpu_init.c   | 11 +--
 arch/powerpc/cpu/mpc85xx/qe_io.c  |  2 +-
 arch/powerpc/cpu/mpc85xx/speed.c  |  6 ++
 arch/powerpc/cpu/mpc85xx/t1040_ids.c  |  1 +
 arch/powerpc/include/asm/config_mpc85xx.h |  3 +++
 arch/powerpc/include/asm/fsl_liodn.h  |  4 
 arch/powerpc/include/asm/immap_85xx.h |  9 -
 board/freescale/t1040qds/t1040qds.c   | 29 +
 drivers/qe/qe.c   |  4 
 drivers/qe/qe.h   |  2 ++
 include/configs/T1040QDS.h|  2 ++
 11 files changed, 69 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/cpu/mpc85xx/cpu_init.c 
b/arch/powerpc/cpu/mpc85xx/cpu_init.c
index b31efb7..4448e04 100644
--- a/arch/powerpc/cpu/mpc85xx/cpu_init.c
+++ b/arch/powerpc/cpu/mpc85xx/cpu_init.c
@@ -33,15 +33,15 @@
 #endif
 
 #include ../../../../drivers/block/fsl_sata.h
+#include ../../../../drivers/qe/qe.h
 
 DECLARE_GLOBAL_DATA_PTR;
 
 #ifdef CONFIG_QE
+#ifndef CONFIG_PPC_T1040
 extern qe_iop_conf_t qe_iop_conf_tab[];
 extern void qe_config_iopin(u8 port, u8 pin, int dir,
int open_drain, int assign);
-extern void qe_init(uint qe_base);
-extern void qe_reset(void);
 
 static void config_qe_ioports(void)
 {
@@ -59,6 +59,7 @@ static void config_qe_ioports(void)
}
 }
 #endif
+#endif
 
 #ifdef CONFIG_CPM2
 void config_8560_ioports (volatile ccsr_cpm_t * cpm)
@@ -262,9 +263,11 @@ void cpu_init_f (void)
m8560_cpm_reset();
 #endif
 #ifdef CONFIG_QE
+#ifndef CONFIG_PPC_T1040
/* Config QE ioports */
config_qe_ioports();
 #endif
+#endif
 #if defined(CONFIG_FSL_DMA)
dma_init();
 #endif
@@ -736,7 +739,11 @@ int sata_initialize(void)
 void cpu_secondary_init_r(void)
 {
 #ifdef CONFIG_QE
+#ifdef CONFIG_PPC_T1040
+   uint qe_base = CONFIG_SYS_IMMR + 0x0014; /* QE immr base */
+#else
uint qe_base = CONFIG_SYS_IMMR + 0x0008; /* QE immr base */
+#endif
 #ifdef CONFIG_SYS_QE_FMAN_FW_IN_NAND
int ret;
size_t fw_length = CONFIG_SYS_QE_FMAN_FW_LENGTH;
diff --git a/arch/powerpc/cpu/mpc85xx/qe_io.c b/arch/powerpc/cpu/mpc85xx/qe_io.c
index 76c60da..a495080 100644
--- a/arch/powerpc/cpu/mpc85xx/qe_io.c
+++ b/arch/powerpc/cpu/mpc85xx/qe_io.c
@@ -12,7 +12,7 @@
 #include asm/io.h
 #include asm/immap_85xx.h
 
-#if defined(CONFIG_QE)
+#if defined(CONFIG_QE)  !defined(CONFIG_T1040QDS)
 #defineNUM_OF_PINS 32
 void qe_config_iopin(u8 port, u8 pin, int dir, int open_drain, int assign)
 {
diff --git a/arch/powerpc/cpu/mpc85xx/speed.c b/arch/powerpc/cpu/mpc85xx/speed.c
index 35867df..634f107 100644
--- a/arch/powerpc/cpu/mpc85xx/speed.c
+++ b/arch/powerpc/cpu/mpc85xx/speed.c
@@ -335,6 +335,12 @@ void get_sys_info(sys_info_t *sys_info)
 
 #endif /* CONFIG_SYS_FSL_QORIQ_CHASSIS2 */
 
+#ifdef CONFIG_QE
+#if defined(CONFIG_PPC_T1040)
+   sys_info-freq_qe =  sys_info-freq_systembus / 2;
+#endif
+#endif
+
 #else /* CONFIG_FSL_CORENET */
uint plat_ratio, e500_ratio, half_freq_systembus;
int i;
diff --git a/arch/powerpc/cpu/mpc85xx/t1040_ids.c 
b/arch/powerpc/cpu/mpc85xx/t1040_ids.c
index 32075ce..4984727 100644
--- a/arch/powerpc/cpu/mpc85xx/t1040_ids.c
+++ b/arch/powerpc/cpu/mpc85xx/t1040_ids.c
@@ -66,6 +66,7 @@ struct liodn_id_table liodn_tbl[] = {
SET_GUTS_LIODN(NULL, 202, rio2maintliodnr, 0),
 
/* SET_NEXUS_LIODN(557), -- not yet implemented */
+   SET_QE_LIODN(559),
 };
 int liodn_tbl_sz = ARRAY_SIZE(liodn_tbl);
 
diff --git a/arch/powerpc/include/asm/config_mpc85xx.h 
b/arch/powerpc/include/asm/config_mpc85xx.h
index 54ce2f0..ee994cc 100644
--- a/arch/powerpc/include/asm/config_mpc85xx.h
+++ b/arch/powerpc/include/asm/config_mpc85xx.h
@@ -718,6 +718,9 @@ defined(CONFIG_PPC_T1020) || defined(CONFIG_PPC_T1022)
 #define CONFIG_SYS_FSL_USB2_PHY_ENABLE
 #define CONFIG_SYS_FSL_USB_INTERNAL_UTMI_PHY
 #define CONFIG_SYS_CCSRBAR_DEFAULT 0xfe00
+#define QE_MURAM_SIZE  0x6000UL
+#define MAX_QE_RISC1
+#define QE_NUM_OF_SNUM 28
 
 #elif defined(CONFIG_PPC_T2080) || defined(CONFIG_PPC_T2081)
 #define CONFIG_E6500
diff --git a/arch/powerpc/include/asm/fsl_liodn.h 
b/arch/powerpc/include/asm/fsl_liodn.h
index 44bc88d..f658bcb 100644
--- a/arch/powerpc/include/asm/fsl_liodn.h
+++ b/arch/powerpc/include/asm/fsl_liodn.h
@@ -99,6 +99,10 @@ extern void fdt_fixup_liodn(void *blob);
SET_GUTS_LIODN(fsl,esdhc, liodn, sdmmc##sdhcNum##liodnr,\
CONFIG_SYS_MPC85xx_ESDHC_OFFSET)
 
+#define SET_QE_LIODN(liodn) \
+   SET_GUTS_LIODN(fsl,qe, liodn, qeliodnr,\
+