Skip to contentSkip to conversation

qe: add u-qe support to arm board

PATCH New Zhao Qiang 1 participant 3 messages Sep 16, 2015 Arm (32-bit)

lore
Share & tools
lore

Zhao Qiang

author
#0 lore raw

PATCH 1/3 qe: add u-qe support to arm board

From: Zhao Qiang <[email protected]>

ls1021 is arm-core and support qe which is u-qe.
add u-qe init for arm board.

---
 arch/arm/include/asm/arch-ls102xa/config.h |  4 ++++
 arch/arm/include/asm/global_data.h         |  8 ++++++++
 drivers/Makefile                           |  1 +
 drivers/qe/Makefile                        |  3 ++-
 drivers/qe/fdt.c                           |  2 ++
 drivers/qe/qe.c                            | 15 +++++++++++++++
 drivers/qe/qe.h                            |  1 +
 7 files changed, 33 insertions(+), 1 deletion(-)
arch/arm/include/asm/arch-ls102xa/config.h +4 -0
index a500b5b..9c1b520 100644
@@ -69,6 +69,10 @@
 
 #define DCU_LAYER_MAX_NUM			16
 
+#define QE_MURAM_SIZE          0x6000UL
+#define MAX_QE_RISC            1
+#define QE_NUM_OF_SNUM         28
+
 #define CONFIG_SYS_FSL_SRDS_1
 
 #ifdef CONFIG_LS102XA
arch/arm/include/asm/global_data.h +8 -0
index c69d064..438f128 100644
@@ -17,6 +17,14 @@ struct arch_global_data {
 #if defined(CONFIG_FSL_ESDHC)
 	u32 sdhc_clk;
 #endif
+
+#if defined(CONFIG_U_QE)
+	u32 qe_clk;
+	u32 brg_clk;
+	uint mp_alloc_base;
+	uint mp_alloc_top;
+#endif /* CONFIG_U_QE */
+
 #ifdef CONFIG_AT91FAMILY
 	/* "static data" needed by at91's clock.c */
 	unsigned long	cpu_clk_rate_hz;
drivers/Makefile +1 -0
index d8361d9..5ff3943 100644
@@ -16,6 +16,7 @@ obj-y += twserial/
 obj-y += video/
 obj-y += watchdog/
 obj-$(CONFIG_QE) += qe/
+obj-$(CONFIG_U_QE) += qe/
 obj-y += memory/
 obj-y += pwm/
 obj-y += input/
drivers/qe/Makefile +2 -1
index 7f1bd06..8fa4866 100644
@@ -4,5 +4,6 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-obj-y := qe.o uccf.o uec.o uec_phy.o
+obj-$(CONFIG_QE) += qe.o uccf.o uec.o uec_phy.o
+obj-$(CONFIG_U_QE) += qe.o
 obj-$(CONFIG_OF_LIBFDT) += fdt.o
drivers/qe/fdt.c +2 -0
index d9a7d82..dfae4bf 100644
@@ -12,6 +12,7 @@
 #include <fdt_support.h>
 #include "qe.h"
 
+#ifdef CONFIG_QE
 DECLARE_GLOBAL_DATA_PTR;
 
 /*
@@ -72,3 +73,4 @@ void ft_qe_setup(void *blob)
 		"clock-frequency", gd->arch.qe_clk / 2, 1);
 	fdt_fixup_qe_firmware(blob);
 }
+#endif
drivers/qe/qe.c +15 -0
index 4358a91..b545ec9 100644
@@ -40,6 +40,7 @@ void qe_issue_cmd(uint cmd, uint sbc, u8 mcn, u32 cmd_data)
 	return;
 }
 
+#ifdef CONFIG_QE
 uint qe_muram_alloc(uint size, uint align)
 {
 	uint	retloc;
@@ -70,6 +71,7 @@ uint qe_muram_alloc(uint size, uint align)
 
 	return retloc;
 }
+#endif
 
 void *qe_muram_addr(uint offset)
 {
@@ -180,6 +182,17 @@ void qe_init(uint qe_base)
 	qe_snums_init();
 }
 
+#ifdef CONFIG_U_QE
+void u_qe_init(void)
+{
+	uint qe_base = CONFIG_SYS_IMMR + 0x01400000; /* QE immr base */
+	qe_immr = (qe_map_t *)qe_base;
+
+	qe_upload_firmware((const void *)CONFIG_SYS_QE_FW_ADDR);
+	out_be32(&qe_immr->iram.iready, QE_IRAM_READY);
+}
+#endif
+
 void qe_reset(void)
 {
 	qe_issue_cmd(QE_RESET, QE_CR_SUBBLOCK_INVALID,
@@ -212,6 +225,7 @@ void qe_assign_page(uint snum, uint para_ram_base)
 
 #define BRG_CLK		(gd->arch.brg_clk)
 
+#ifdef CONFIG_QE
 int qe_set_brg(uint brg, uint rate)
 {
 	volatile uint	*bp;
@@ -239,6 +253,7 @@ int qe_set_brg(uint brg, uint rate)
 
 	return 0;
 }
+#endif
 
 /* Set ethernet MII clock master
 */
drivers/qe/qe.h +1 -0
index ebb7c5f..30484b8 100644
@@ -275,6 +275,7 @@ void *qe_muram_addr(uint offset);
 int qe_get_snum(void);
 void qe_put_snum(u8 snum);
 void qe_init(uint qe_base);
+void u_qe_init(void);
 void qe_reset(void);
 void qe_assign_page(uint snum, uint para_ram_base);
 int qe_set_brg(uint brg, uint rate);
Signature · 1 line
2.1.0.27.g96db324
author
#1 lore raw

PATCH 2/3 qe: add qe support to ls1021aqds

add qe support MACRO to ls1021aqds head file

---
 board/freescale/ls1021aqds/ls1021aqds.c | 8 ++++++++
 include/configs/ls1021aqds.h            | 6 ++++++
 2 files changed, 14 insertions(+)
board/freescale/ls1021aqds/ls1021aqds.c +8 -0
index 12e83f7..3bc4a68 100644
@@ -16,6 +16,9 @@
 
 #include "../common/qixis.h"
 #include "ls1021aqds_qixis.h"
+#ifdef CONFIG_U_QE
+#include "../../../drivers/qe/qe.h"
+#endif
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -227,6 +230,11 @@ int board_init(void)
 	fsl_serdes_init();
 	config_serdes_mux();
 #endif
+
+#ifdef CONFIG_U_QE
+	u_qe_init();
+#endif
+
 	return 0;
 }
 
include/configs/ls1021aqds.h +6 -0
index bb47813..ee23af4 100644
@@ -69,6 +69,10 @@ unsigned long get_board_ddr_clk(void);
 
 #define CONFIG_SYS_HAS_SERDES
 
+#if !defined(CONFIG_SDCARD) && !defined(CONFIG_NAND) && !defined(CONFIG_SPI)
+#define CONFIG_U_QE
+#endif
+
 /*
  * IFC Definitions
  */
@@ -331,6 +335,8 @@ unsigned long get_board_ddr_clk(void);
 
 #define CONFIG_BOOTDELAY		3
 
+#define CONFIG_SYS_QE_FW_ADDR     0x600c0000
+
 #define CONFIG_EXTRA_ENV_SETTINGS	\
 	"bootargs=root=/dev/ram0 rw console=ttyS0,115200\0" \
 	"fdt_high=0xcfffffff\0"		\
Signature · 1 line
2.1.0.27.g96db324
author
#2 lore raw

PATCH 3/3 qe: add qe support for ls1021a-twr board

In reply to Zhao Qiang

qe: add qe support MACRO to ls1021a-twr head file

---
 board/freescale/ls1021atwr/ls1021atwr.c | 7 +++++++
 include/configs/ls1021atwr.h            | 6 ++++++
 2 files changed, 13 insertions(+)
board/freescale/ls1021atwr/ls1021atwr.c +7 -0
index b522ff2..da09d6e 100644
@@ -16,6 +16,9 @@
 #include <netdev.h>
 #include <fsl_mdio.h>
 #include <tsec.h>
+#ifdef CONFIG_U_QE
+#include "../../../drivers/qe/qe.h"
+#endif
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -277,6 +280,10 @@ int board_init(void)
 	config_serdes_mux();
 #endif
 
+#ifdef CONFIG_U_QE
+	u_qe_init();
+#endif
+
 	return 0;
 }
 
include/configs/ls1021atwr.h +6 -0
index 45b2272..c4408b8 100644
@@ -48,6 +48,10 @@
 
 #define CONFIG_SYS_HAS_SERDES
 
+#if !defined(CONFIG_SDCARD) && !defined(CONFIG_NAND) && !defined(CONFIG_SPI)
+#define CONFIG_U_QE
+#endif
+
 /*
  * IFC Definitions
  */
@@ -274,6 +278,8 @@
 
 #define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE    /* start of monitor */
 
+#define CONFIG_SYS_QE_FW_ADDR     0x600c0000
+
 /*
  * Environment
  */
Signature · 1 line
2.1.0.27.g96db324