Skip to contentSkip to conversation

Bug fixing and clean up to Blackfin architecture.

PATCH New Sonic Zhang 1 participant 7 messages Feb 27, 2013

lore
Share & tools
lore
#0 lore raw

cover Bug fixing and clean up to Blackfin architecture.

These patches clean up blackfin architecture code and fix some bugs.

Bob Liu (2):
blackfin: reduce size of u-boot.ldr in bf548-ezkit default config.
blackfin: add baudrate to bdinfo

Mike Frysinger (1):
Blackfin: adjust asm constraints with NMI workaround

Sonic Zhang (3):
blackfin: Change the member's type in dma structures.
blackfin: limit the max memory dma peripheral transfer size to 4
bytes.
blackfin: run core1 from L1 code sram start address in uboot init
code on core 0

 arch/blackfin/cpu/cpu.c                          |   29 ++++++++++++++++++++++
 arch/blackfin/cpu/initcode.c                     |    3 +-
 arch/blackfin/include/asm/dma.h                  |   24 +++++++++---------
 arch/blackfin/include/asm/mach-bf561/BF561_def.h |    2 +
 arch/blackfin/include/asm/mach-bf609/BF609_def.h |    2 +
 arch/blackfin/lib/board.c                        |    2 +
 arch/blackfin/lib/string.c                       |    9 ++++--
 include/configs/bf548-ezkit.h                    |   23 +++++++----------
 include/configs/bf561-ezkit.h                    |    5 ++++
 include/configs/bf609-ezkit.h                    |    5 ++++
 10 files changed, 74 insertions(+), 30 deletions(-)
#1 lore raw

PATCH 1/6 blackfin: Change the member's type in dma structures.

From: Sonic Zhang <[email protected]>

---
 arch/blackfin/include/asm/dma.h |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)
arch/blackfin/include/asm/dma.h +12 -12
index ef1db6e..8a7c079 100644
@@ -17,21 +17,21 @@
 
 struct dmasg_large {
 	void *next_desc_addr;
-	unsigned long start_addr;
-	unsigned short cfg;
-	unsigned short x_count;
-	short x_modify;
-	unsigned short y_count;
-	short y_modify;
+	u32 start_addr;
+	u16 cfg;
+	u16 x_count;
+	s16 x_modify;
+	u16 y_count;
+	s16 y_modify;
 } __attribute__((packed));
 
 struct dmasg {
-	unsigned long start_addr;
-	unsigned short cfg;
-	unsigned short x_count;
-	short x_modify;
-	unsigned short y_count;
-	short y_modify;
+	u32 start_addr;
+	u16 cfg;
+	u16 x_count;
+	s16 x_modify;
+	u16 y_count;
+	s16 y_modify;
 } __attribute__((packed));
 
 struct dma_register {
Signature · 1 line
1.7.0.4
#2 lore raw

PATCH 2/6 blackfin: limit the max memory dma peripheral transfer size to 4 bytes.

In reply to Sonic Zhang

From: Sonic Zhang <[email protected]>

Othersize, the bf609 memory dma halts after being enabled.

---
 arch/blackfin/lib/string.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
arch/blackfin/lib/string.c +6 -3
index 44d8c6d..5b7ac0b 100644
@@ -128,10 +128,12 @@ static void dma_calc_size(unsigned long ldst, unsigned long lsrc, size_t count,
 	unsigned long limit;
 
 #ifdef MSIZE
-	limit = 6;
+	/* The max memory DMA memory transfer size is 32 bytes. */
+	limit = 5;
 	*dshift = MSIZE_P;
 #else
-	limit = 3;
+	/* The max memory DMA memory transfer size is 4 bytes. */
+	limit = 2;
 	*dshift = WDSIZE_P;
 #endif
 
@@ -170,7 +172,8 @@ void dma_memcpy_nocache(void *dst, const void *src, size_t count)
 	mod = 1 << bpos;
 
 #ifdef PSIZE
-	dsize |= min(3, bpos) << PSIZE_P;
+	/* The max memory DMA peripheral transfer size is 4 bytes. */
+	dsize |= min(2, bpos) << PSIZE_P;
 #endif
 
 	/* Copy sram functions from sdram to sram */
Signature · 1 line
1.7.0.4
#3 lore raw

PATCH 3/6 blackfin: reduce size of u-boot.ldr in bf548-ezkit default config.

In reply to Sonic Zhang

From: Bob Liu <[email protected]>

Enable VIDEO and NAND supports only when the config options is defined.

---
 include/configs/bf548-ezkit.h |   23 +++++++++--------------
 1 files changed, 9 insertions(+), 14 deletions(-)
include/configs/bf548-ezkit.h +9 -14
index e6b05db..7ed0ea9 100644
@@ -120,18 +120,16 @@
 #define CONFIG_ENV_SECT_SIZE	0x8000
 #endif
 
-
 /*
  * NAND Settings
  */
-#define CONFIG_BFIN_NFC_CTL_VAL	0x0033
 #if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_NAND)
-# define CONFIG_BFIN_NFC_BOOTROM_ECC
-#endif
+#define CONFIG_BFIN_NFC_CTL_VAL        0x0033
+#define CONFIG_BFIN_NFC_BOOTROM_ECC
 #define CONFIG_DRIVER_NAND_BFIN
-#define CONFIG_SYS_NAND_BASE		0 /* not actually used */
-#define CONFIG_SYS_MAX_NAND_DEVICE	1
-
+#define CONFIG_SYS_NAND_BASE           0 /* not actually used */
+#define CONFIG_SYS_MAX_NAND_DEVICE     1
+#endif
 
 /*
  * I2C Settings
@@ -184,13 +182,10 @@
 #define CONFIG_UART_CONSOLE	1
 #define CONFIG_BFIN_SPI_IMG_SIZE 0x50000
 
-#ifndef __ADSPBF542__
-/* Don't waste time transferring a logo over the UART */
-# if (CONFIG_BFIN_BOOT_MODE != BFIN_BOOT_UART)
-#  define CONFIG_VIDEO
-#  define EASYLOGO_HEADER <asm/bfin_logo_230x230_gzip.h>
-# endif
-# define CONFIG_DEB_DMA_URGENT
+#undef CONFIG_VIDEO
+#ifdef CONFIG_VIDEO
+#define EASYLOGO_HEADER < asm/bfin_logo_230x230_gzip.h >
+#define CONFIG_DEB_DMA_URGENT
 #endif
 
 /* Define if want to do post memory test */
Signature · 1 line
1.7.0.4
#4 lore raw

PATCH 4/6 Blackfin: adjust asm constraints with NMI workaround

In reply to Sonic Zhang

From: Mike Frysinger <[email protected]>

Newer gcc versions will sometimes use a Preg when "r" constraints, but that'll fail if we use an Ireg in the assignment. So force the code to always use a Dreg.

This also fixes early boot crashes for older Blackfin parts when compiled with gcc-4.5. This version ends up selecting the same register for the input and output variables which corrupts the output assignment triggering an exception.

	P2 = 0xffe02008;	/* EVT2 */
	R0 = RETS;
	CALL 1f;
	RTN;
1:	P2 = RETS;	<-- BAD
	RETS = R0;
	[P2] = P2;	<-- BAD
---
 arch/blackfin/cpu/initcode.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
arch/blackfin/cpu/initcode.c +2 -1
index 1a06680..e8ea0ba 100644
@@ -262,7 +262,8 @@ program_nmi_handler(void)
 		"%1 = RETS;" /* Load addr of NMI handler */
 		"RETS = %0;" /* Restore RETS */
 		"[%2] = %1;" /* Write NMI handler */
-		: "=r"(tmp1), "=r"(tmp2) : "ab"(EVT2)
+		: "=d"(tmp1), "=d"(tmp2)
+		: "ab"(EVT2)
 	);
 }
 
Signature · 1 line
1.7.0.4
#5 lore raw

PATCH 5/6 blackfin: add baudrate to bdinfo

In reply to Sonic Zhang

From: Bob Liu <[email protected]>

---
 arch/blackfin/lib/board.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
arch/blackfin/lib/board.c +2 -0
index 288dc82..c1e14e2 100644
@@ -231,6 +231,8 @@ static int global_board_data_init(void)
 	bd->bi_sclk = get_sclk();
 	bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
 	bd->bi_memsize = CONFIG_SYS_MAX_RAM_SIZE;
+	bd->bi_baudrate = (gd->baudrate > 0)
+		? simple_strtoul(gd->baudrate, NULL, 10) : CONFIG_BAUDRATE;
 
 	return 0;
 }
Signature · 1 line
1.7.0.4
#6 lore raw

PATCH 6/6 blackfin: run core1 from L1 code sram start address in uboot init code on core 0

In reply to Sonic Zhang

From: Sonic Zhang <[email protected]>

Define core 1 L1 code sram start address.
Add function to enable core 1 for BF609 and BF561.
Add config macro to allow customer to run core 1 in uboot init code on core 0.

---
 arch/blackfin/cpu/cpu.c                          |   29 ++++++++++++++++++++++
 arch/blackfin/include/asm/mach-bf561/BF561_def.h |    2 +
 arch/blackfin/include/asm/mach-bf609/BF609_def.h |    2 +
 include/configs/bf561-ezkit.h                    |    5 ++++
 include/configs/bf609-ezkit.h                    |    5 ++++
 5 files changed, 43 insertions(+), 0 deletions(-)
arch/blackfin/cpu/cpu.c +29 -0
index b9fdb07..d841f64 100644
@@ -23,6 +23,31 @@
 
 ulong bfin_poweron_retx;
 
+#if defined(CONFIG_CORE1_RUN) && defined(COREB_L1_CODE_START)
+void bfin_core1_start(void)
+{
+#ifdef BF561_FAMILY
+	/* Enable core 1 */
+	bfin_write_SYSCR(bfin_read_SYSCR() & ~0x0020);
+#else
+	/* Enable core 1 */
+	bfin_write32(RCU0_SVECT1, COREB_L1_CODE_START);
+	bfin_write32(RCU0_CRCTL, 0);
+
+	bfin_write32(RCU0_CRCTL, 0x2);
+
+	/* Check if core 1 starts */
+	while (!(bfin_read32(RCU0_CRSTAT) & 0x2))
+		continue;
+
+	bfin_write32(RCU0_CRCTL, 0);
+
+	/* flag to notify cces core 1 application */
+	bfin_write32(SDU0_MSG_SET, (1 << 19));
+#endif
+}
+#endif
+
 __attribute__ ((__noreturn__))
 void cpu_init_f(ulong bootflag, ulong loaded_from_ldr)
 {
@@ -73,6 +98,10 @@ void cpu_init_f(ulong bootflag, ulong loaded_from_ldr)
 # endif
 #endif
 
+#if defined(CONFIG_CORE1_RUN) && defined(COREB_L1_CODE_START)
+	bfin_core1_start();
+#endif
+
 	serial_early_puts("Board init flash\n");
 	board_init_f(bootflag);
 }
arch/blackfin/include/asm/mach-bf561/BF561_def.h +2 -0
index a7ff5a3..8fd552f 100644
@@ -714,4 +714,6 @@
 #define L1_INST_SRAM_SIZE (0xFFA03FFF - 0xFFA00000 + 1)
 #define L1_INST_SRAM_END (L1_INST_SRAM + L1_INST_SRAM_SIZE)
 
+#define COREB_L1_CODE_START       0xFF600000
+
 #endif /* __BFIN_DEF_ADSP_BF561_proc__ */
arch/blackfin/include/asm/mach-bf609/BF609_def.h +2 -0
index 0fb0fdf..15016db 100644
@@ -238,4 +238,6 @@
 #define L1_INST_SRAM_SIZE 0x8000
 #define L1_INST_SRAM_END (L1_INST_SRAM + L1_INST_SRAM_SIZE)
 
+#define COREB_L1_CODE_START       0xFF600000
+
 #endif /* __BFIN_DEF_ADSP_BF609_proc__ */
include/configs/bf561-ezkit.h +5 -0
index 1a9d27e..6ee1e4c 100644
@@ -98,6 +98,11 @@
  */
 #define CONFIG_UART_CONSOLE	0
 
+/*
+ * Run core 1 from L1 SRAM start address when init uboot on core 0
+ */
+/* #define CONFIG_CORE1_RUN	1 */
+
 
 /*
  * Pull in common ADI header for remaining command/environment setup
include/configs/bf609-ezkit.h +5 -0
index 02149fa..8b90129 100644
@@ -156,6 +156,11 @@
 #endif
 
 /*
+ * Run core 1 from L1 SRAM start address when init uboot on core 0
+ */
+/* #define CONFIG_CORE1_RUN	1 */
+
+/*
  * Pull in common ADI header for remaining command/environment setup
  */
 #include <configs/bfin_adi_common.h>
Signature · 1 line
1.7.0.4