Skip to contentSkip to conversation

Add BF60x processor support to Blackfin architecture.

PATCH Superseded Sonic Zhang 4 participants 40 messages Feb 7, 2013 – Mar 5, 2013

Subsystems (2)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

cover Add BF60x processor support to Blackfin architecture.

From: Sonic Zhang <[email protected]>

ADSP-BF60x is the new generation Blackfin?? dual-core processor announced by Analog Devices in late March, 2012. This patch set adds BF60x processor support to Das U-Boot Blackfin architecture.

For more information, see http://blackfin.uclinux.org .

In addition, the maintainer of the Blackfin system is changed to Sonic Zhang <[email protected]>, because Mike Frysinger is no longer with Analog Devices any more.

Bob Liu (5):
Blackfin: bf60x: new processor header files
Blackfin: bf60x: add dma support
Blackfin: bf60x: support big cplb page
Blackfin: bf60x: add gpio support
Blackfin: bf60x: add hw watchdog support

Scott Jiang (1):
Blackfin: spi: add bf6xx spi driver

Sonic Zhang (4):
Blackfin: bf60x: Port blackfin core architecture code to boot on

    bf60x.

Blackfin: bf60x: add serial support
blackfin: bf609: add board and headers files to support bf609
Blackfin: bf60x: add rsi/sdh support

Steven Miao (1):
Blackfin: bf60x: add resume from hibernate

 MAINTAINERS                                        |    3 +-
 arch/blackfin/cpu/cpu.c                            |    4 +-
 arch/blackfin/cpu/gpio.c                           |   36 +-
 arch/blackfin/cpu/initcode.c                       |  370 ++-
 arch/blackfin/cpu/initcode.h                       |   52 +
 arch/blackfin/cpu/reset.c                          |    6 +
 arch/blackfin/cpu/serial.c                         |   81 +-
 arch/blackfin/cpu/serial.h                         |  222 +--
 arch/blackfin/cpu/serial1.h                        |  275 ++
 arch/blackfin/cpu/serial4.h                        |  139 +
 arch/blackfin/cpu/start.S                          |    2 +
 arch/blackfin/include/asm/blackfin_cdef.h          |    3 +
 arch/blackfin/include/asm/blackfin_def.h           |    5 +
 arch/blackfin/include/asm/blackfin_local.h         |    3 +
 arch/blackfin/include/asm/config-pre.h             |    4 +
 arch/blackfin/include/asm/cplb.h                   |   17 +-
 arch/blackfin/include/asm/dma.h                    |  113 +-
 arch/blackfin/include/asm/gpio.h                   |    2 +-
 arch/blackfin/include/asm/mach-bf533/BF531_def.h   |    1 +
 arch/blackfin/include/asm/mach-bf561/BF561_def.h   |    1 +
 arch/blackfin/include/asm/mach-bf609/BF609_cdef.h  |  543 +++
 arch/blackfin/include/asm/mach-bf609/BF609_def.h   | 3758 ++++++++++++++++++++
 arch/blackfin/include/asm/mach-bf609/anomaly.h     |  128 +
 arch/blackfin/include/asm/mach-bf609/def_local.h   |    5 +
 arch/blackfin/include/asm/mach-bf609/gpio.h        |  151 +
 arch/blackfin/include/asm/mach-bf609/portmux.h     |  257 ++
 arch/blackfin/include/asm/mach-bf609/ports.h       |  103 +
 arch/blackfin/include/asm/mach-common/bits/cgu.h   |   80 +
 arch/blackfin/include/asm/mach-common/bits/dde.h   |   88 +
 arch/blackfin/include/asm/mach-common/bits/dma.h   |   48 +-
 arch/blackfin/include/asm/mach-common/bits/mpu.h   |    6 +-
 arch/blackfin/include/asm/mach-common/bits/pll.h   |    5 +
 arch/blackfin/include/asm/mach-common/bits/sdh.h   |   38 +-
 .../blackfin/include/asm/mach-common/bits/spi6xx.h |  240 ++
 arch/blackfin/include/asm/mach-common/bits/uart4.h |   66 +
 arch/blackfin/lib/board.c                          |   33 +-
 arch/blackfin/lib/clocks.c                         |  113 +-
 arch/blackfin/lib/string.c                         |   97 +-
 board/bf609-ezkit/Makefile                         |   55 +
 board/bf609-ezkit/bf609-ezkit.c                    |   67 +
 boards.cfg                                         |    1 +
 common/cmd_reginfo.c                               |   19 +-
 drivers/mmc/bfin_sdh.c                             |   68 +-
 drivers/spi/Makefile                               |    1 +
 drivers/spi/bfin_spi6xx.c                          |  308 ++
 include/configs/bf609-ezkit.h                      |  169 +
 include/configs/bfin_adi_common.h                  |    8 +-
 47 files changed, 7373 insertions(+), 421 deletions(-)
 create mode 100644 arch/blackfin/cpu/serial1.h
 create mode 100644 arch/blackfin/cpu/serial4.h
 create mode 100644 arch/blackfin/include/asm/mach-bf609/BF609_cdef.h
 create mode 100644 arch/blackfin/include/asm/mach-bf609/BF609_def.h
 create mode 100644 arch/blackfin/include/asm/mach-bf609/anomaly.h
 create mode 100644 arch/blackfin/include/asm/mach-bf609/def_local.h
 create mode 100644 arch/blackfin/include/asm/mach-bf609/gpio.h
 create mode 100644 arch/blackfin/include/asm/mach-bf609/portmux.h
 create mode 100644 arch/blackfin/include/asm/mach-bf609/ports.h
 create mode 100644 arch/blackfin/include/asm/mach-common/bits/cgu.h
 create mode 100644 arch/blackfin/include/asm/mach-common/bits/dde.h
 create mode 100644 arch/blackfin/include/asm/mach-common/bits/spi6xx.h
 create mode 100644 arch/blackfin/include/asm/mach-common/bits/uart4.h
 create mode 100644 board/bf609-ezkit/Makefile
 create mode 100644 board/bf609-ezkit/bf609-ezkit.c
 create mode 100644 drivers/spi/bfin_spi6xx.c
 create mode 100644 include/configs/bf609-ezkit.h
#1 lore raw

PATCH 1/11 Blackfin: bf60x: new processor header files

From: Bob Liu <[email protected]>

Add header files for blackfin new processor bf60x.

---
 arch/blackfin/include/asm/blackfin_cdef.h         |    3 +
 arch/blackfin/include/asm/blackfin_def.h          |    5 +
 arch/blackfin/include/asm/blackfin_local.h        |    3 +
 arch/blackfin/include/asm/mach-bf609/BF609_cdef.h |  543 +++
 arch/blackfin/include/asm/mach-bf609/BF609_def.h  | 3758 +++++++++++++++++++++
 arch/blackfin/include/asm/mach-bf609/anomaly.h    |  128 +
 arch/blackfin/include/asm/mach-bf609/def_local.h  |    5 +
 arch/blackfin/include/asm/mach-bf609/portmux.h    |  257 ++
 arch/blackfin/include/asm/mach-bf609/ports.h      |  103 +
 arch/blackfin/include/asm/mach-common/bits/cgu.h  |   80 +
 arch/blackfin/include/asm/mach-common/bits/dde.h  |   88 +
 arch/blackfin/include/asm/mach-common/bits/mpu.h  |    6 +-
 arch/blackfin/include/asm/mach-common/bits/pll.h  |    5 +
 13 files changed, 4983 insertions(+), 1 deletions(-)
 create mode 100644 arch/blackfin/include/asm/mach-bf609/BF609_cdef.h
 create mode 100644 arch/blackfin/include/asm/mach-bf609/BF609_def.h
 create mode 100644 arch/blackfin/include/asm/mach-bf609/anomaly.h
 create mode 100644 arch/blackfin/include/asm/mach-bf609/def_local.h
 create mode 100644 arch/blackfin/include/asm/mach-bf609/portmux.h
 create mode 100644 arch/blackfin/include/asm/mach-bf609/ports.h
 create mode 100644 arch/blackfin/include/asm/mach-common/bits/cgu.h
 create mode 100644 arch/blackfin/include/asm/mach-common/bits/dde.h
arch/blackfin/include/asm/blackfin_cdef.h +3 -0
index a19f0f7..8608711 100644
@@ -84,5 +84,8 @@
 #ifdef __ADSPBF561__
 # include "mach-bf561/BF561_cdef.h"
 #endif
+#ifdef __ADSPBF609__
+# include "mach-bf609/BF609_cdef.h"
+#endif
 
 #endif /* __MACH_CDEF_BLACKFIN__ */
arch/blackfin/include/asm/blackfin_def.h +5 -0
index f06d1f1..c96a3ec 100644
@@ -136,5 +136,10 @@
 # include "mach-bf561/anomaly.h"
 # include "mach-bf561/def_local.h"
 #endif
+#ifdef __ADSPBF609__
+# include "mach-bf609/BF609_def.h"
+# include "mach-bf609/anomaly.h"
+# include "mach-bf609/def_local.h"
+#endif
 
 #endif /* __MACH_DEF_BLACKFIN__ */
arch/blackfin/include/asm/blackfin_local.h +3 -0
index 49d0c9e..fc46ef4 100644
@@ -61,6 +61,9 @@
 extern u_long get_vco(void);
 extern u_long get_cclk(void);
 extern u_long get_sclk(void);
+extern u_long get_sclk0(void);
+extern u_long get_sclk1(void);
+extern u_long get_dclk(void);
 
 # define bfin_revid() (bfin_read_CHIPID() >> 28)
 
arch/blackfin/include/asm/mach-bf609/BF609_cdef.h new file +543 -0

543 lines not on this page · raw message

arch/blackfin/include/asm/mach-bf609/BF609_def.h new file +3758 -0

2,430 lines not on this page · raw message

arch/blackfin/include/asm/mach-bf609/anomaly.h new file +128 -0

128 lines not on this page · raw message

arch/blackfin/include/asm/mach-bf609/def_local.h new file +5 -0
new file mode 100644
index 0000000..d4250e6

Lines of this file are not shown. View the raw message.

arch/blackfin/include/asm/mach-bf609/portmux.h new file +257 -0

257 lines not on this page · raw message

arch/blackfin/include/asm/mach-bf609/ports.h new file +103 -0

103 lines not on this page · raw message

arch/blackfin/include/asm/mach-common/bits/cgu.h new file +80 -0

80 lines not on this page · raw message

arch/blackfin/include/asm/mach-common/bits/dde.h new file +88 -0

88 lines not on this page · raw message

arch/blackfin/include/asm/mach-common/bits/mpu.h +5 -1
index 39998f8..d067ef9 100644

Lines of this file are not shown. View the raw message.

arch/blackfin/include/asm/mach-common/bits/pll.h +5 -0
index 9009f26..fe0ba0f 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.7.0.4

Part of the diff is not shown here. View the raw message.

#2 lore raw

PATCH 2/11 Blackfin: bf60x: Port blackfin core architecture code to boot on bf60x.

In reply to Sonic Zhang

From: Sonic Zhang <[email protected]>

Set up clocks, DDR controller, Nor flash controller, reboot, serial port. Add new SPI boot modes.

---
 arch/blackfin/cpu/cpu.c                |    4 +-
 arch/blackfin/cpu/initcode.c           |  313 ++++++++++++++++++++++++++++++--
 arch/blackfin/cpu/initcode.h           |   52 ++++++
 arch/blackfin/cpu/reset.c              |    6 +
 arch/blackfin/include/asm/config-pre.h |    4 +
 arch/blackfin/lib/board.c              |    6 +
 arch/blackfin/lib/clocks.c             |  113 +++++++++---
 common/cmd_reginfo.c                   |   19 ++-
 8 files changed, 478 insertions(+), 39 deletions(-)
arch/blackfin/cpu/cpu.c +3 -1
index 6a0bcca..b9fdb07 100644
@@ -68,7 +68,9 @@ void cpu_init_f(ulong bootflag, ulong loaded_from_ldr)
 	/* Reset upon a double exception rather than just hanging.
 	 * Do not do bfin_read on SWRST as that will reset status bits.
 	 */
+# ifdef SWRST
 	bfin_write_SWRST(DOUBLE_FAULT);
+# endif
 #endif
 
 	serial_early_puts("Board init flash\n");
@@ -92,7 +94,7 @@ int irq_init(void)
 #elif defined(SICA_IMASK0)
 	bfin_write_SICA_IMASK0(0);
 	bfin_write_SICA_IMASK1(0);
-#else
+#elif defined(SIC_IMASK)
 	bfin_write_SIC_IMASK(0);
 #endif
 	/* Set up a dummy NMI handler if needed.  */
arch/blackfin/cpu/initcode.c +298 -15

472 lines not on this page · raw message

arch/blackfin/cpu/initcode.h +52 -0

80 lines not on this page · raw message

arch/blackfin/cpu/reset.c +6 -0
index ff39035..b6718d3 100644
@@ -23,6 +23,7 @@
 __attribute__ ((__l1_text__, __noreturn__))
 static void bfin_reset(void)
 {
+#ifdef SWRST
 	/* Wait for completion of "system" events such as cache line
 	 * line fills so that we avoid infinite stalls later on as
 	 * much as possible.  This code is in L1, so it won't trigger
@@ -66,10 +67,15 @@ static void bfin_reset(void)
 		: "a" (15 * 1)
 		: "LC1", "LB1", "LT1"
 	);
+#endif
 
 	while (1)
+#if defined(__ADSPBF60x__)
+		bfin_write_RCU0_CTL(0x1);
+#else
 		/* Issue core reset */
 		asm("raise 1");
+#endif
 }
 
 /* We need to trampoline ourselves up into L1 since our linker
arch/blackfin/include/asm/config-pre.h +4 -0
index be5687c..d0fd537 100644
@@ -29,6 +29,8 @@
 #define BFIN_BOOT_16HOST_DMA  11      /* boot ldr from 16-bit host dma */
 #define BFIN_BOOT_8HOST_DMA   12      /* boot ldr from 8-bit host dma */
 #define BFIN_BOOT_NAND        13      /* boot ldr from nand flash */
+#define BFIN_BOOT_RSI_MASTER  14      /* boot ldr from rsi */
+#define BFIN_BOOT_LP_SLAVE    15      /* boot ldr from link port */
 
 #ifndef __ASSEMBLY__
 static inline const char *get_bfin_boot_mode(int bfin_boot)
@@ -47,6 +49,8 @@ static inline const char *get_bfin_boot_mode(int bfin_boot)
 	case BFIN_BOOT_16HOST_DMA: return "16bit dma";
 	case BFIN_BOOT_8HOST_DMA:  return "8bit dma";
 	case BFIN_BOOT_NAND:       return "nand flash";
+	case BFIN_BOOT_RSI_MASTER: return "rsi master";
+	case BFIN_BOOT_LP_SLAVE:   return "link port slave";
 	default:                   return "INVALID";
 	}
 }
arch/blackfin/lib/board.c +6 -0
index 9fbbea0..098f685 100644
@@ -295,7 +295,13 @@ void board_init_f(ulong bootflag)
 
 	printf("Clock: VCO: %s MHz, ", strmhz(buf, get_vco()));
 	printf("Core: %s MHz, ", strmhz(buf, get_cclk()));
+#if defined(__ADSPBF60x__)
+	printf("System0: %s MHz, ", strmhz(buf, get_sclk0()));
+	printf("System1: %s MHz, ", strmhz(buf, get_sclk1()));
+	printf("Dclk: %s MHz\n", strmhz(buf, get_dclk()));
+#else
 	printf("System: %s MHz\n", strmhz(buf, get_sclk()));
+#endif
 
 	if (CONFIG_MEM_SIZE) {
 		printf("RAM:   ");
arch/blackfin/lib/clocks.c +91 -22

160 lines not on this page · raw message

common/cmd_reginfo.c +18 -1
index 08a6563..b591bd3 100644
@@ -191,7 +191,7 @@ static int do_reginfo(cmd_tbl_t *cmdtp, int flag, int argc,
 
 #elif defined(CONFIG_BLACKFIN)
 	puts("\nSystem Configuration registers\n");
-
+#ifndef __ADSPBF60x__
 	puts("\nPLL Registers\n");
 	printf("\tPLL_DIV:   0x%04x   PLL_CTL:      0x%04x\n",
 		bfin_read_PLL_DIV(), bfin_read_PLL_CTL());
@@ -227,7 +227,24 @@ static int do_reginfo(cmd_tbl_t *cmdtp, int flag, int argc,
 	printf("\tEBIU_SDSTAT:  0x%04x   EBIU_SDGCTL:  0x%08x\n",
 		bfin_read_EBIU_SDSTAT(), bfin_read_EBIU_SDGCTL());
 # endif
+#else
+	puts("\nCGU Registers\n");
+	printf("\tCGU_DIV:   0x%08x   CGU_CTL:      0x%08x\n",
+		bfin_read_CGU_DIV(), bfin_read_CGU_CTL());
+	printf("\tCGU_STAT:  0x%08x   CGU_LOCKCNT:  0x%08x\n",
+		bfin_read_CGU_STAT(), bfin_read_CGU_CLKOUTSEL());
 
+	puts("\nSMC DDR Registers\n");
+	printf("\tDDR_CFG:   0x%08x   DDR_TR0:      0x%08x\n",
+		bfin_read_DMC0_CFG(), bfin_read_DMC0_TR0());
+	printf("\tDDR_TR1:   0x%08x   DDR_TR2:      0x%08x\n",
+		bfin_read_DMC0_TR1(), bfin_read_DMC0_TR2());
+	printf("\tDDR_MR:    0x%08x   DDR_EMR1:     0x%08x\n",
+		bfin_read_DMC0_MR(), bfin_read_DMC0_EMR1());
+	printf("\tDDR_CTL:   0x%08x   DDR_STAT:     0x%08x\n",
+		bfin_read_DMC0_CTL(), bfin_read_DMC0_STAT());
+	printf("\tDDR_DLLCTL:0x%08x\n", bfin_read_DMC0_DLLCTL());
+#endif
 #endif /* CONFIG_BLACKFIN */
 
 	return 0;
Signature · 1 line
1.7.0.4
#3 lore raw

PATCH 2/11 Blackfin: bf60x: Port blackfin core architecture code to boot on bf60x.

Dear Sonic Zhang,

Quoted 4 lines · In message <[email protected]> you wrote:

From: Sonic Zhang <[email protected]>

Set up clocks, DDR controller, Nor flash controller, reboot, serial port. Add new SPI boot modes.

Checkpatch issues, please fix.

arch/blackfin/cpu/initcode.c line 30

Quoted 5 lines
arch/blackfin/cpu/initcode.c +5 -0
+#ifndef __ADSPBF60x__
+#include <asm/mach-common/bits/pll.h>
+#else
+#include <asm/mach-common/bits/cgu.h>
+#endif

General question: you add a _lot_ of new #ifdef's all over the place.

Also, I think I see lots of duplicated (or very similar) code.

Can this not be avoided?

arch/blackfin/cpu/initcode.c static inline void serial_init(void) · line 200

Quoted 4 lines
arch/blackfin/cpu/initcode.c +1 -1
 	if (BFIN_DEBUG_EARLY_SERIAL) {
-		int ucen = bfin_read16(&pUART->gctl) & UCEN;
+		int enabled = serial_early_enabled(uart_base);
 		serial_early_init(uart_base);

Please spearate declarations and code by a blankline. Please fix globally (at least where you touch the code anyway).

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Successful and fortunate crime is called virtue.             - Seneca
#4 lore raw

PATCH 2/11 Blackfin: bf60x: Port blackfin core architecture code to boot on bf60x.

Quoted 10 lines · Wolfgang Denk

Dear Sonic Zhang,

Quoted 4 lines · In message <[email protected]> you wrote:

From: Sonic Zhang <[email protected]>

Set up clocks, DDR controller, Nor flash controller, reboot, serial port. Add new SPI boot modes.

Checkpatch issues, please fix.

OK

Quoted 9 lines

arch/blackfin/cpu/initcode.c line 30

Quoted 6 lines
arch/blackfin/cpu/initcode.c +5 -0
+#ifndef __ADSPBF60x__
+#include <asm/mach-common/bits/pll.h>
+#else
+#include <asm/mach-common/bits/cgu.h>
+#endif

General question: you add a _lot_ of new #ifdef's all over the place.

Quoted 3 lines

Also, I think I see lots of duplicated (or very similar) code.

Can this not be avoided?

I tried to avoid #ifdef's. But, BF60x differs a lot in on-chip peripherals from those in BF5xx. I will try to clean up the #ifdef's on my best.

Quoted 9 lines

arch/blackfin/cpu/initcode.c static inline void serial_init(void) · line 200

Quoted 6 lines

      if (BFIN_DEBUG_EARLY_SERIAL) {
arch/blackfin/cpu/initcode.c +1 -1
-             int ucen = bfin_read16(&pUART->gctl) & UCEN;
+             int enabled = serial_early_enabled(uart_base);
              serial_early_init(uart_base);

Please spearate declarations and code by a blankline. Please fix globally (at least where you touch the code anyway).

OK.

Thanks,

Sonic

#5 lore raw

PATCH 3/11 Blackfin: bf60x: add serial support

In reply to Sonic Zhang

From: Sonic Zhang <[email protected]>

Add serial for bf60x.

---
 arch/blackfin/cpu/serial.c                         |   81 ++++---
 arch/blackfin/cpu/serial.h                         |  222 ++---------------
 arch/blackfin/cpu/serial1.h                        |  275 ++++++++++++++++++++
 arch/blackfin/cpu/serial4.h                        |  139 ++++++++++
 arch/blackfin/include/asm/mach-bf533/BF531_def.h   |    1 +
 arch/blackfin/include/asm/mach-bf561/BF561_def.h   |    1 +
 arch/blackfin/include/asm/mach-common/bits/uart4.h |   66 +++++
 7 files changed, 547 insertions(+), 238 deletions(-)
 create mode 100644 arch/blackfin/cpu/serial1.h
 create mode 100644 arch/blackfin/cpu/serial4.h
 create mode 100644 arch/blackfin/include/asm/mach-common/bits/uart4.h
arch/blackfin/cpu/serial.c +49 -32
index 64340ec..9847e9f 100644
@@ -43,7 +43,6 @@
 #include <serial.h>
 #include <linux/compiler.h>
 #include <asm/blackfin.h>
-#include <asm/mach-common/bits/uart.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -52,8 +51,8 @@ DECLARE_GLOBAL_DATA_PTR;
 #include "serial.h"
 
 #ifdef CONFIG_DEBUG_SERIAL
-static uint16_t cached_lsr[256];
-static uint16_t cached_rbr[256];
+static uart_lsr_t cached_lsr[256];
+static uart_lsr_t cached_rbr[256];
 static size_t cache_count;
 
 /* The LSR is read-to-clear on some parts, so we have to make sure status
@@ -61,10 +60,10 @@ static size_t cache_count;
  * works around anomaly 05000099 at the same time by keeping a cumulative
  * tally of all the status bits.
  */
-static uint16_t uart_lsr_save;
-static uint16_t uart_lsr_read(uint32_t uart_base)
+static uart_lsr_t uart_lsr_save;
+static uart_lsr_t uart_lsr_read(uint32_t uart_base)
 {
-	uint16_t lsr = bfin_read(&pUART->lsr);
+	uart_lsr_t lsr = _lsr_read(pUART);
 	uart_lsr_save |= (lsr & (OE|PE|FE|BI));
 	return lsr | uart_lsr_save;
 }
@@ -72,20 +71,20 @@ static uint16_t uart_lsr_read(uint32_t uart_base)
 static void uart_lsr_clear(uint32_t uart_base)
 {
 	uart_lsr_save = 0;
-	bfin_write(&pUART->lsr, bfin_read(&pUART->lsr) | -1);
+	_lsr_write(pUART, -1);
 }
 #else
 /* When debugging is disabled, we only care about the DR bit, so if other
  * bits get set/cleared, we don't really care since we don't read them
  * anyways (and thus anomaly 05000099 is irrelevant).
  */
-static inline uint16_t uart_lsr_read(uint32_t uart_base)
+static inline uart_lsr_t uart_lsr_read(uint32_t uart_base)
 {
-	return bfin_read(&pUART->lsr);
+	return _lsr_read(pUART);
 }
 static void uart_lsr_clear(uint32_t uart_base)
 {
-	bfin_write(&pUART->lsr, bfin_read(&pUART->lsr) | -1);
+	_lsr_write(pUART, -1);
 }
 #endif
 
@@ -127,20 +126,14 @@ static int uart_getc(uint32_t uart_base)
 
 #ifdef CONFIG_DEBUG_SERIAL
 	/* grab & clear the LSR */
-	uint16_t uart_lsr_val = uart_lsr_read(uart_base);
+	uart_lsr_t uart_lsr_val = uart_lsr_read(uart_base);
 
 	cached_lsr[cache_count] = uart_lsr_val;
 	cached_rbr[cache_count] = uart_rbr_val;
 	cache_count = (cache_count + 1) % ARRAY_SIZE(cached_lsr);
 
 	if (uart_lsr_val & (OE|PE|FE|BI)) {
-		uint16_t dll, dlh;
 		printf("\n[SERIAL ERROR]\n");
-		ACCESS_LATCH();
-		dll = bfin_read(&pUART->dll);
-		dlh = bfin_read(&pUART->dlh);
-		ACCESS_PORT_IER();
-		printf("\tDLL=0x%x DLH=0x%x\n", dll, dlh);
 		do {
 			--cache_count;
 			printf("\t%3zu: RBR=0x%02x LSR=0x%02x\n", cache_count,
@@ -160,6 +153,8 @@ static int uart_getc(uint32_t uart_base)
 # define LOOP(x)
 #endif
 
+#if BFIN_UART_HW_VER < 4
+
 LOOP(
 static void uart_loop(uint32_t uart_base, int state)
 {
@@ -178,6 +173,28 @@ static void uart_loop(uint32_t uart_base, int state)
 }
 )
 
+#else
+
+LOOP(
+static void uart_loop(uint32_t uart_base, int state)
+{
+	u32 control;
+
+	/* Drain the TX fifo first so bytes don't come back */
+	while (!(uart_lsr_read(uart_base) & TEMT))
+		continue;
+
+	control = bfin_read(&pUART->control);
+	if (state)
+		control |= LOOP_ENA | MRTS;
+	else
+		control &= ~(LOOP_ENA | MRTS);
+	bfin_write(&pUART->control, control);
+}
+)
+
+#endif
+
 #ifdef CONFIG_SYS_BFIN_UART
 
 static void uart_puts(uint32_t uart_base, const char *s)
@@ -246,16 +263,16 @@ struct serial_device bfin_serial##n##_device = { \
 	LOOP(.loop = uart##n##_loop) \
 };
 
-#ifdef UART0_DLL
+#ifdef UART0_RBR
 DECL_BFIN_UART(0)
 #endif
-#ifdef UART1_DLL
+#ifdef UART1_RBR
 DECL_BFIN_UART(1)
 #endif
-#ifdef UART2_DLL
+#ifdef UART2_RBR
 DECL_BFIN_UART(2)
 #endif
-#ifdef UART3_DLL
+#ifdef UART3_RBR
 DECL_BFIN_UART(3)
 #endif
 
@@ -274,16 +291,16 @@ __weak struct serial_device *default_serial_console(void)
 
 void bfin_serial_initialize(void)
 {
-#ifdef UART0_DLL
+#ifdef UART0_RBR
 	serial_register(&bfin_serial0_device);
 #endif
-#ifdef UART1_DLL
+#ifdef UART1_RBR
 	serial_register(&bfin_serial1_device);
 #endif
-#ifdef UART2_DLL
+#ifdef UART2_RBR
 	serial_register(&bfin_serial2_device);
 #endif
-#ifdef UART3_DLL
+#ifdef UART3_RBR
 	serial_register(&bfin_serial3_device);
 #endif
 }
@@ -293,7 +310,7 @@ void bfin_serial_initialize(void)
 /* Symbol for our assembly to call. */
 void serial_set_baud(uint32_t baud)
 {
-	serial_early_set_baud(UART_DLL, baud);
+	serial_early_set_baud(UART_BASE, baud);
 }
 
 /* Symbol for common u-boot code to call.
@@ -307,7 +324,7 @@ void serial_setbrg(void)
 /* Symbol for our assembly to call. */
 void serial_initialize(void)
 {
-	serial_early_init(UART_DLL);
+	serial_early_init(UART_BASE);
 }
 
 /* Symbol for common u-boot code to call. */
@@ -315,23 +332,23 @@ int serial_init(void)
 {
 	serial_initialize();
 	serial_setbrg();
-	uart_lsr_clear(UART_DLL);
+	uart_lsr_clear(UART_BASE);
 	return 0;
 }
 
 int serial_tstc(void)
 {
-	return uart_tstc(UART_DLL);
+	return uart_tstc(UART_BASE);
 }
 
 int serial_getc(void)
 {
-	return uart_getc(UART_DLL);
+	return uart_getc(UART_BASE);
 }
 
 void serial_putc(const char c)
 {
-	uart_putc(UART_DLL, c);
+	uart_putc(UART_BASE, c);
 }
 
 void serial_puts(const char *s)
@@ -343,7 +360,7 @@ void serial_puts(const char *s)
 LOOP(
 void serial_loop(int state)
 {
-	uart_loop(UART_DLL, state);
+	uart_loop(UART_BASE, state);
 }
 )
 
arch/blackfin/cpu/serial.h +16 -206

261 lines not on this page · raw message

arch/blackfin/cpu/serial1.h new file +275 -0

275 lines not on this page · raw message

arch/blackfin/cpu/serial4.h new file +139 -0

139 lines not on this page · raw message

arch/blackfin/include/asm/mach-bf533/BF531_def.h +1 -0
index 3b61aaf..2bcd2d8 100644
@@ -149,6 +149,7 @@
 #define UART_LSR                       0xFFC00414
 #define UART_SCR                       0xFFC0041C
 #define UART_RBR                       0xFFC00400 /* Receive Buffer */
+#define UART0_RBR                      UART_RBR
 #define UART_GCTL                      0xFFC00424
 #define SPT0_TX_CONFIG0                0xFFC00800
 #define SPT0_TX_CONFIG1                0xFFC00804
arch/blackfin/include/asm/mach-bf561/BF561_def.h +1 -0
index 46925f8..a7ff5a3 100644
@@ -690,6 +690,7 @@
 #define PPI1_FRAME                     0xFFC01310
 #define UART_THR                       0xFFC00400
 #define UART_RBR                       0xFFC00400
+#define UART0_RBR                      UART_RBR
 #define UART_DLL                       0xFFC00400
 #define UART_DLH                       0xFFC00404
 #define UART_IER                       0xFFC00404
arch/blackfin/include/asm/mach-common/bits/uart4.h new file +66 -0

66 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#6 lore raw

PATCH 3/11 Blackfin: bf60x: add serial support

Dear Sonic Zhang,

Quoted 2 lines · In message <[email protected]> you wrote:

Add serial for bf60x.

There is a large number of checkpatch issues. Please fix!!

Quoted 30 lines
arch/blackfin/cpu/serial1.h new file +30 -0
+/*
+ * All Blackfin system MMRs are padded to 32bits even if the register
+ * itself is only 16bits.  So use a helper macro to streamline this.
+ */
+#define __BFP(m) u16 m; u16 __pad_##m
+struct bfin_mmr_serial {
+#if BFIN_UART_HW_VER == 2
+	__BFP(dll);
+	__BFP(dlh);
+	__BFP(gctl);
+	__BFP(lcr);
+	__BFP(mcr);
+	__BFP(lsr);
+	__BFP(msr);
+	__BFP(scr);
+	__BFP(ier_set);
+	__BFP(ier_clear);
+	__BFP(thr);
+	__BFP(rbr);
+#else
+	union {
+		u16 dll;
+		u16 thr;
+		const u16 rbr;
+	};
+	const u16 __spad0;
+	union {
+		u16 dlh;
+		u16 ier;
+	};

arch/blackfin/cpu/serial1.h line 69

Quoted 10 lines
arch/blackfin/cpu/serial1.h new file +10 -0
+	const u16 __spad1;
+	const __BFP(iir);
+	__BFP(lcr);
+	__BFP(mcr);
+	__BFP(lsr);
+	__BFP(msr);
+	__BFP(scr);
+	const u32 __spad2;
+	__BFP(gctl);
+#endif

Sorry, but this is totally unreadable.

arch/blackfin/cpu/serial1.h line 98

Quoted 10 lines
arch/blackfin/cpu/serial1.h new file +10 -0
+# define DO_MUX(port, mux_tx, mux_rx, tx, rx) \
+	bfin_write_PORT##port##_MUX((bfin_read_PORT##port##_MUX() & ~(PORT_x_MUX_##mux_tx##_MASK | PORT_x_MUX_##mux_rx##_MASK)) | PORT_x_MUX_##mux_tx##_FUNC_1 | PORT_x_MUX_##mux_rx##_FUNC_1); \
+	bfin_write_PORT##port##_FER(bfin_read_PORT##port##_FER() | P##port##tx | P##port##rx);
+	switch (CONFIG_UART_CONSOLE) {
+	case 0:
+		DO_MUX(G, 7, 7, 12, 13);
+		break;	/* Port G; mux 7; PG12 and PG13 */
+	case 1:
+		DO_MUX(F, 3, 3, 6, 7);
+		break;	/* Port F; mux 3; PF6 and PF7 */

This is totally unreadable.

This needs serious fixing.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Too bad that all the people who know how to run the country are  busy
driving taxicabs and cutting hair.                     - George Burns
#7 lore raw

PATCH 3/11 Blackfin: bf60x: add serial support

Quoted 8 lines · Wolfgang Denk

Dear Sonic Zhang,

Quoted 2 lines · In message <[email protected]> you wrote:

Add serial for bf60x.

There is a large number of checkpatch issues. Please fix!!

OK.

Quoted 34 lines
Quoted 34 lines
arch/blackfin/cpu/serial1.h new file +34 -0
+/*
+ * All Blackfin system MMRs are padded to 32bits even if the register
+ * itself is only 16bits.  So use a helper macro to streamline this.
+ */
+#define __BFP(m) u16 m; u16 __pad_##m
+struct bfin_mmr_serial {
+#if BFIN_UART_HW_VER == 2
+     __BFP(dll);
+     __BFP(dlh);
+     __BFP(gctl);
+     __BFP(lcr);
+     __BFP(mcr);
+     __BFP(lsr);
+     __BFP(msr);
+     __BFP(scr);
+     __BFP(ier_set);
+     __BFP(ier_clear);
+     __BFP(thr);
+     __BFP(rbr);
+#else
+     union {
+             u16 dll;
+             u16 thr;
+             const u16 rbr;
+     };
+     const u16 __spad0;
+     union {
+             u16 dlh;
+             u16 ier;
+     };
+     const u16 __spad1;
+     const __BFP(iir);
+     __BFP(lcr);
+     __BFP(mcr);
Quoted 9 lines

arch/blackfin/cpu/serial1.h line 69

Quoted 6 lines
arch/blackfin/cpu/serial1.h new file +6 -0
+     __BFP(lsr);
+     __BFP(msr);
+     __BFP(scr);
+     const u32 __spad2;
+     __BFP(gctl);
+#endif

Sorry, but this is totally unreadable.

I will turn back to normal definition other than the help Macro.

Quoted 12 lines

arch/blackfin/cpu/serial1.h line 98

Quoted 11 lines
arch/blackfin/cpu/serial1.h new file +10 -0
+# define DO_MUX(port, mux_tx, mux_rx, tx, rx) \
+     bfin_write_PORT##port##_MUX((bfin_read_PORT##port##_MUX() & ~(PORT_x_MUX_##mux_tx##_MASK | PORT_x_MUX_##mux_rx##_MASK)) | PORT_x_MUX_##mux_tx##_FUNC_1 | PORT_x_MUX_##mux_rx##_FUNC_1); \
+     bfin_write_PORT##port##_FER(bfin_read_PORT##port##_FER() | P##port##tx | P##port##rx);
+     switch (CONFIG_UART_CONSOLE) {
+     case 0:
+             DO_MUX(G, 7, 7, 12, 13);
+             break;  /* Port G; mux 7; PG12 and PG13 */
+     case 1:
+             DO_MUX(F, 3, 3, 6, 7);
+             break;  /* Port F; mux 3; PF6 and PF7 */
Quoted 3 lines

This is totally unreadable.

This needs serious fixing.

I will fix it.

Sonic

#8 lore raw

PATCH 4/11 Blackfin: bf60x: add dma support

In reply to Sonic Zhang

From: Bob Liu <[email protected]>

Add dma support for bf60x.

---
 arch/blackfin/include/asm/dma.h                  |  113 ++++++++++++----------
 arch/blackfin/include/asm/mach-common/bits/dma.h |   48 +++++++++-
 arch/blackfin/lib/string.c                       |   97 ++++++++++---------
 3 files changed, 159 insertions(+), 99 deletions(-)
arch/blackfin/include/asm/dma.h +61 -52
index 21ff1cf..211719a 100644
@@ -8,68 +8,77 @@
 #ifndef _BLACKFIN_DMA_H_
 #define _BLACKFIN_DMA_H_
 
+#include <linux/types.h>
+#ifdef __ADSPBF60x__
+#include <asm/mach-common/bits/dde.h>
+#else
 #include <asm/mach-common/bits/dma.h>
+#endif
 
 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));
 
+/*
+ * All Blackfin system MMRs are padded to 32bits even if the register
+ * itself is only 16bits.  So use a helper macro to streamline this.
+ */
+#define __BFP(m) m; u16 __pad_##m
 struct dma_register {
-	void *next_desc_ptr;	/* DMA Next Descriptor Pointer register */
-	unsigned long start_addr;	/* DMA Start address  register */
-
-	unsigned short cfg;	/* DMA Configuration register */
-	unsigned short dummy1;	/* DMA Configuration register */
-
-	unsigned long reserved;
-
-	unsigned short x_count;	/* DMA x_count register */
-	unsigned short dummy2;
-
-	short x_modify;	/* DMA x_modify register */
-	unsigned short dummy3;
-
-	unsigned short y_count;	/* DMA y_count register */
-	unsigned short dummy4;
-
-	short y_modify;	/* DMA y_modify register */
-	unsigned short dummy5;
-
-	void *curr_desc_ptr;	/* DMA Current Descriptor Pointer
-					   register */
-	unsigned long curr_addr_ptr;	/* DMA Current Address Pointer
-						   register */
-	unsigned short irq_status;	/* DMA irq status register */
-	unsigned short dummy6;
-
-	unsigned short peripheral_map;	/* DMA peripheral map register */
-	unsigned short dummy7;
-
-	unsigned short curr_x_count;	/* DMA Current x-count register */
-	unsigned short dummy8;
-
-	unsigned long reserved2;
-
-	unsigned short curr_y_count;	/* DMA Current y-count register */
-	unsigned short dummy9;
-
-	unsigned long reserved3;
-
+#ifdef __ADSPBF60x__
+	void *next_desc_ptr;
+	u32 start_addr;
+	u32 config;
+	u32 x_count;
+	s32 x_modify;
+	u32 y_count;
+	s32 y_modify;
+	u32 __pad0[2];
+	void *curr_desc_ptr;
+	void *prev_desc_ptr;
+	void *curr_addr;
+	u32 status;
+	u32 curr_x_count;
+	u32 curr_y_count;
+	u32 __pad1[2];
+	u32 bw_limit;
+	u32 curr_bw_limit;
+	u32 bw_monitor;
+	u32 curr_bw_monitor;
+#else
+	void *next_desc_ptr;
+	u32 start_addr;
+	u16 __BFP(config);
+	u32 __pad0;
+	u16 __BFP(x_count);
+	s16 __BFP(x_modify);
+	u16 __BFP(y_count);
+	s16 __BFP(y_modify);
+	void *curr_desc_ptr;
+	u32 curr_addr_ptr;
+	u16 __BFP(status);
+	u16 __BFP(peripheral_map);
+	u16 __BFP(curr_x_count);
+	u32 __pad1;
+	u16 __BFP(curr_y_count);
+	u32 __pad2;
+#endif
 };
+#undef __BFP
 
 #endif
arch/blackfin/include/asm/mach-common/bits/dma.h +46 -2

74 lines not on this page · raw message

arch/blackfin/lib/string.c +52 -45

140 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#9 lore raw

PATCH 4/11 Blackfin: bf60x: add dma support

Dear Sonic Zhang,

Quoted 11 lines · In message <[email protected]> you wrote:

From: Bob Liu <[email protected]>

Add dma support for bf60x.

---
 arch/blackfin/include/asm/dma.h                  |  113 ++++++++++++----------
 arch/blackfin/include/asm/mach-common/bits/dma.h |   48 +++++++++-
 arch/blackfin/lib/string.c                       |   97 ++++++++++---------
 3 files changed, 159 insertions(+), 99 deletions(-)

There are checkpatch errors and warnings. Please fix these!!

Quoted 20 lines

struct dmasg_large {

arch/blackfin/include/asm/dma.h +6 -9
 	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;

arch/blackfin/include/asm/dma.h line 35

Quoted 10 lines
arch/blackfin/include/asm/dma.h +6 -3
-	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));

These appear totally unrelated changes. These should be split out into separate patches.

Quoted 40 lines
arch/blackfin/include/asm/dma.h +5 -34
+/*
+ * All Blackfin system MMRs are padded to 32bits even if the register
+ * itself is only 16bits.  So use a helper macro to streamline this.
+ */
+#define __BFP(m) m; u16 __pad_##m
 struct dma_register {
-	void *next_desc_ptr;	/* DMA Next Descriptor Pointer register */
-	unsigned long start_addr;	/* DMA Start address  register */
-
-	unsigned short cfg;	/* DMA Configuration register */
-	unsigned short dummy1;	/* DMA Configuration register */
-
-	unsigned long reserved;
-
-	unsigned short x_count;	/* DMA x_count register */
-	unsigned short dummy2;
-
-	short x_modify;	/* DMA x_modify register */
-	unsigned short dummy3;
-
-	unsigned short y_count;	/* DMA y_count register */
-	unsigned short dummy4;
-
-	short y_modify;	/* DMA y_modify register */
-	unsigned short dummy5;
-
-	void *curr_desc_ptr;	/* DMA Current Descriptor Pointer
-					   register */
-	unsigned long curr_addr_ptr;	/* DMA Current Address Pointer
-						   register */
-	unsigned short irq_status;	/* DMA irq status register */
-	unsigned short dummy6;
-
-	unsigned short peripheral_map;	/* DMA peripheral map register */
-	unsigned short dummy7;
-
-	unsigned short curr_x_count;	/* DMA Current x-count register */
-	unsigned short dummy8;
-
-	unsigned long reserved2;

arch/blackfin/include/asm/dma.h line 46

Quoted 10 lines
arch/blackfin/include/asm/dma.h +4 -6
-
-	unsigned short curr_y_count;	/* DMA Current y-count register */
-	unsigned short dummy9;
-
-	unsigned long reserved3;
-
+#ifdef __ADSPBF60x__
+	void *next_desc_ptr;
+	u32 start_addr;
+	u32 config;

You drop all the comments; please don't do that.

Also, "cfg" used to be a short, now it gets replaced by "config" which is a u32. Is this correct?

Quoted 6 lines
arch/blackfin/include/asm/dma.h +6 -0
+	void *next_desc_ptr;
+	u32 start_addr;
+	u16 __BFP(config);
+	u32 __pad0;
+	u16 __BFP(x_count);
+	s16 __BFP(x_modify);

arch/blackfin/include/asm/dma.h line 79

Quoted 10 lines
arch/blackfin/include/asm/dma.h +10 -0
+	u16 __BFP(y_count);
+	s16 __BFP(y_modify);
+	void *curr_desc_ptr;
+	u32 curr_addr_ptr;
+	u16 __BFP(status);
+	u16 __BFP(peripheral_map);
+	u16 __BFP(curr_x_count);
+	u32 __pad1;
+	u16 __BFP(curr_y_count);
+	u32 __pad2;

Sorry, but this is unreadable. NAK.

Best regards,

Wolfgang Denk

Signature · 7 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Software suppliers are trying to make their  software  packages  more
``user-friendly''.  .  .  .  Their best approach, so far, has been to
take all the old brochures, and stamp the words, ``user-friendly'' on
the cover.                                               - Bill Gates
#10 lore raw

PATCH 4/11 Blackfin: bf60x: add dma support

Quoted 15 lines · Wolfgang Denk

Dear Sonic Zhang,

Quoted 11 lines · In message <[email protected]> you wrote:

From: Bob Liu <[email protected]>

Add dma support for bf60x.

---
 arch/blackfin/include/asm/dma.h                  |  113 ++++++++++++----------
 arch/blackfin/include/asm/mach-common/bits/dma.h |   48 +++++++++-
 arch/blackfin/lib/string.c                       |   97 ++++++++++---------
 3 files changed, 159 insertions(+), 99 deletions(-)
Quoted 2 lines

There are checkpatch errors and warnings. Please fix these!!

No problem.

Quoted 32 lines
Quoted 21 lines
 struct dmasg_large {
      void *next_desc_addr;
arch/blackfin/include/asm/dma.h +6 -9
-     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;

arch/blackfin/include/asm/dma.h line 35

Quoted 10 lines
arch/blackfin/include/asm/dma.h +6 -3
-     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));
Quoted 3 lines

These appear totally unrelated changes. These should be split out into separate patches.

OK, I will move these changes out as a new patch.

Quoted 53 lines
Quoted 40 lines
arch/blackfin/include/asm/dma.h +5 -34
+/*
+ * All Blackfin system MMRs are padded to 32bits even if the register
+ * itself is only 16bits.  So use a helper macro to streamline this.
+ */
+#define __BFP(m) m; u16 __pad_##m
 struct dma_register {
-     void *next_desc_ptr;    /* DMA Next Descriptor Pointer register */
-     unsigned long start_addr;       /* DMA Start address  register */
-
-     unsigned short cfg;     /* DMA Configuration register */
-     unsigned short dummy1;  /* DMA Configuration register */
-
-     unsigned long reserved;
-
-     unsigned short x_count; /* DMA x_count register */
-     unsigned short dummy2;
-
-     short x_modify; /* DMA x_modify register */
-     unsigned short dummy3;
-
-     unsigned short y_count; /* DMA y_count register */
-     unsigned short dummy4;
-
-     short y_modify; /* DMA y_modify register */
-     unsigned short dummy5;
-
-     void *curr_desc_ptr;    /* DMA Current Descriptor Pointer
-                                        register */
-     unsigned long curr_addr_ptr;    /* DMA Current Address Pointer
-                                                register */
-     unsigned short irq_status;      /* DMA irq status register */
-     unsigned short dummy6;
-
-     unsigned short peripheral_map;  /* DMA peripheral map register */
-     unsigned short dummy7;
-
-     unsigned short curr_x_count;    /* DMA Current x-count register */
-     unsigned short dummy8;
-
-     unsigned long reserved2;

arch/blackfin/include/asm/dma.h line 46

Quoted 10 lines
arch/blackfin/include/asm/dma.h +4 -6
-
-     unsigned short curr_y_count;    /* DMA Current y-count register */
-     unsigned short dummy9;
-
-     unsigned long reserved3;
-
+#ifdef __ADSPBF60x__
+     void *next_desc_ptr;
+     u32 start_addr;
+     u32 config;

You drop all the comments; please don't do that.

Quoted 2 lines

Also, "cfg" used to be a short, now it gets replaced by "config" which is a u32. Is this correct?

Yes, this is correct for BF60x. The DMA config MMR on BF60x is 32 bits while it is 16 bits on BF5xx.

Quoted 18 lines
Quoted 7 lines
arch/blackfin/include/asm/dma.h +6 -0
+     void *next_desc_ptr;
+     u32 start_addr;
+     u16 __BFP(config);
+     u32 __pad0;
+     u16 __BFP(x_count);
+     s16 __BFP(x_modify);

arch/blackfin/include/asm/dma.h line 79

Quoted 10 lines
arch/blackfin/include/asm/dma.h +10 -0
+     u16 __BFP(y_count);
+     s16 __BFP(y_modify);
+     void *curr_desc_ptr;
+     u32 curr_addr_ptr;
+     u16 __BFP(status);
+     u16 __BFP(peripheral_map);
+     u16 __BFP(curr_x_count);
+     u32 __pad1;
+     u16 __BFP(curr_y_count);
+     u32 __pad2;
Quoted 2 lines

Sorry, but this is unreadable. NAK.

OK, I will change back to the former definition style.

Sonic Zhang

#11 lore raw

PATCH 5/11 Blackfin: bf60x: support big cplb page

In reply to Sonic Zhang

From: Bob Liu <[email protected]>

Bf60x support 16K, 64K, 16M and 64M cplb pages, this patch add support for them. So that bf609-ezkit can use it's 128M memory.

---
 arch/blackfin/include/asm/cplb.h |   17 +++++++++++------
 arch/blackfin/lib/board.c        |   27 ++++++++++++++++++++-------
 2 files changed, 31 insertions(+), 13 deletions(-)
arch/blackfin/include/asm/cplb.h +11 -6
index cc21e93..afdc920 100644
@@ -45,9 +45,14 @@
 #define CPLB_INOCACHE		CPLB_USER_RD | CPLB_VALID
 #define CPLB_IDOCACHE		CPLB_INOCACHE | CPLB_L1_CHBL
 
-/* Data Attibutes*/
+#if defined(__ADSPBF60x__)
+#define PAGE_SIZE      (PAGE_SIZE_16MB)
+#else
+#define PAGE_SIZE      (PAGE_SIZE_4MB)
+#endif
 
-#define SDRAM_IGENERIC          (PAGE_SIZE_4MB | CPLB_L1_CHBL | CPLB_USER_RD | CPLB_VALID)
+/* Data Attibutes*/
+#define SDRAM_IGENERIC          (PAGE_SIZE | CPLB_L1_CHBL | CPLB_USER_RD | CPLB_VALID)
 #define SDRAM_IKERNEL           (PAGE_SIZE_4MB | CPLB_L1_CHBL | CPLB_USER_RD | CPLB_VALID | CPLB_LOCK)
 #define L1_IMEMORY              (PAGE_SIZE_1MB | CPLB_USER_RD | CPLB_VALID | CPLB_LOCK)
 #define SDRAM_INON_CHBL         (PAGE_SIZE_4MB | CPLB_USER_RD | CPLB_VALID)
@@ -59,18 +64,18 @@
 #endif
 
 #ifdef CONFIG_DCACHE_WB		/*Write Back Policy */
-#define SDRAM_DGENERIC          (PAGE_SIZE_4MB | CPLB_L1_CHBL | CPLB_DIRTY | CPLB_SUPV_WR | CPLB_USER_WR | CPLB_USER_RD | CPLB_VALID | ANOMALY_05000158_WORKAROUND)
+#define SDRAM_DGENERIC          (PAGE_SIZE | CPLB_L1_CHBL | CPLB_DIRTY | CPLB_SUPV_WR | CPLB_USER_WR | CPLB_USER_RD | CPLB_VALID | ANOMALY_05000158_WORKAROUND)
 #define SDRAM_DNON_CHBL         (PAGE_SIZE_4MB | CPLB_DIRTY | CPLB_SUPV_WR | CPLB_USER_RD | CPLB_USER_WR | CPLB_VALID | ANOMALY_05000158_WORKAROUND)
 #define SDRAM_DKERNEL           (PAGE_SIZE_4MB | CPLB_L1_CHBL | CPLB_USER_RD | CPLB_USER_WR | CPLB_DIRTY | CPLB_SUPV_WR | CPLB_VALID | CPLB_LOCK | ANOMALY_05000158_WORKAROUND)
 #define L1_DMEMORY              (PAGE_SIZE_4MB | CPLB_SUPV_WR | CPLB_USER_WR | CPLB_USER_RD | CPLB_VALID | ANOMALY_05000158_WORKAROUND)
-#define SDRAM_EBIU              (PAGE_SIZE_4MB | CPLB_DIRTY | CPLB_USER_RD | CPLB_USER_WR | CPLB_SUPV_WR | CPLB_VALID | ANOMALY_05000158_WORKAROUND)
+#define SDRAM_EBIU              (PAGE_SIZE | CPLB_DIRTY | CPLB_USER_RD | CPLB_USER_WR | CPLB_SUPV_WR | CPLB_VALID | ANOMALY_05000158_WORKAROUND)
 
 #else				/*Write Through */
-#define SDRAM_DGENERIC          (PAGE_SIZE_4MB | CPLB_L1_CHBL | CPLB_WT | CPLB_L1_AOW | CPLB_SUPV_WR | CPLB_USER_RD | CPLB_USER_WR | CPLB_VALID | ANOMALY_05000158_WORKAROUND)
+#define SDRAM_DGENERIC          (PAGE_SIZE | CPLB_L1_CHBL | CPLB_WT | CPLB_L1_AOW | CPLB_SUPV_WR | CPLB_USER_RD | CPLB_USER_WR | CPLB_VALID | ANOMALY_05000158_WORKAROUND)
 #define SDRAM_DNON_CHBL         (PAGE_SIZE_4MB | CPLB_WT | CPLB_L1_AOW | CPLB_SUPV_WR | CPLB_USER_WR | CPLB_USER_RD | CPLB_VALID | ANOMALY_05000158_WORKAROUND)
 #define SDRAM_DKERNEL           (PAGE_SIZE_4MB | CPLB_L1_CHBL | CPLB_WT | CPLB_L1_AOW | CPLB_USER_RD | CPLB_SUPV_WR | CPLB_USER_WR | CPLB_VALID | CPLB_LOCK | ANOMALY_05000158_WORKAROUND)
 #define L1_DMEMORY              (PAGE_SIZE_4MB | CPLB_SUPV_WR | CPLB_USER_WR | CPLB_VALID | ANOMALY_05000158_WORKAROUND)
-#define SDRAM_EBIU              (PAGE_SIZE_4MB | CPLB_WT | CPLB_L1_AOW | CPLB_USER_RD | CPLB_USER_WR | CPLB_SUPV_WR | CPLB_VALID | ANOMALY_05000158_WORKAROUND)
+#define SDRAM_EBIU              (PAGE_SIZE | CPLB_WT | CPLB_L1_AOW | CPLB_USER_RD | CPLB_USER_WR | CPLB_SUPV_WR | CPLB_VALID | ANOMALY_05000158_WORKAROUND)
 #endif
 
 #endif				/* _CPLB_H */
arch/blackfin/lib/board.c +20 -7
index 098f685..e3f7fe3 100644
@@ -94,12 +94,12 @@ static void display_global_data(void)
 	printf("   \\-bi_flashoffset: %lx\n", bd->bi_flashoffset);
 }
 
-#define CPLB_PAGE_SIZE (4 * 1024 * 1024)
-#define CPLB_PAGE_MASK (~(CPLB_PAGE_SIZE - 1))
 void init_cplbtables(void)
 {
 	volatile uint32_t *ICPLB_ADDR, *ICPLB_DATA;
 	volatile uint32_t *DCPLB_ADDR, *DCPLB_DATA;
+	uint32_t cplb_page_size;
+	uint32_t cplb_page_mask;
 	uint32_t extern_memory;
 	size_t i;
 
@@ -127,12 +127,19 @@ void init_cplbtables(void)
 	icplb_add(0xFFA00000, L1_IMEMORY);
 	dcplb_add(0xFF800000, L1_DMEMORY);
 	++i;
+#if defined(__ADSPBF60x__)
+	icplb_add(0x0, 0x0);
+	dcplb_add(CONFIG_SYS_FLASH_BASE, SDRAM_EBIU);
+	++i;
+#endif
+	cplb_page_size = (4 * 1024 * 1024);
+	cplb_page_mask = (~(cplb_page_size - 1));
 
 	if (CONFIG_MEM_SIZE) {
 		uint32_t mbase = CONFIG_SYS_MONITOR_BASE;
 		uint32_t mend  = mbase + CONFIG_SYS_MONITOR_LEN;
-		mbase &= CPLB_PAGE_MASK;
-		mend &= CPLB_PAGE_MASK;
+		mbase &= cplb_page_mask;
+		mend &= cplb_page_mask;
 
 		icplb_add(mbase, SDRAM_IKERNEL);
 		dcplb_add(mbase, SDRAM_DKERNEL);
@@ -150,9 +157,11 @@ void init_cplbtables(void)
 		}
 	}
 
+#ifndef __ADSPBF60x__
 	icplb_add(0x20000000, SDRAM_INON_CHBL);
 	dcplb_add(0x20000000, SDRAM_EBIU);
 	++i;
+#endif
 
 	/* Add entries for the rest of external RAM up to the bootrom */
 	extern_memory = 0;
@@ -163,14 +172,18 @@ void init_cplbtables(void)
 	++i;
 	icplb_add(extern_memory, SDRAM_IKERNEL);
 	dcplb_add(extern_memory, SDRAM_DKERNEL);
-	extern_memory += CPLB_PAGE_SIZE;
+	extern_memory += cplb_page_size;
 	++i;
 #endif
 
-	while (i < 16 && extern_memory < (CONFIG_SYS_MONITOR_BASE & CPLB_PAGE_MASK)) {
+#if defined(__ADSPBF60x__)
+	cplb_page_size = (16 * 1024 * 1024);
+	cplb_page_mask = (~(cplb_page_size - 1));
+#endif
+	while (i < 16 && extern_memory < (CONFIG_SYS_MONITOR_BASE & cplb_page_mask)) {
 		icplb_add(extern_memory, SDRAM_IGENERIC);
 		dcplb_add(extern_memory, SDRAM_DGENERIC);
-		extern_memory += CPLB_PAGE_SIZE;
+		extern_memory += cplb_page_size;
 		++i;
 	}
 	while (i < 16) {
Signature · 1 line
1.7.0.4
#12 lore raw

PATCH 5/11 Blackfin: bf60x: support big cplb page

Dear Sonic Zhang,

Quoted 4 lines · In message <[email protected]> you wrote:

From: Bob Liu <[email protected]>

Bf60x support 16K, 64K, 16M and 64M cplb pages, this patch add support for them. So that bf609-ezkit can use it's 128M memory.

Checkpatch issues, please fix.

Quoted 2 lines
arch/blackfin/lib/board.c +0 -2
-#define CPLB_PAGE_SIZE (4 * 1024 * 1024)
-#define CPLB_PAGE_MASK (~(CPLB_PAGE_SIZE - 1))

...

Quoted 2 lines
arch/blackfin/lib/board.c +2 -0
+	uint32_t cplb_page_size;
+	uint32_t cplb_page_mask;

...

Quoted 2 lines
arch/blackfin/lib/board.c +2 -0
+	cplb_page_size = (4 * 1024 * 1024);
+	cplb_page_mask = (~(cplb_page_size - 1));

...

arch/blackfin/lib/board.c void init_cplbtables(void) · line 142

Quoted 4 lines
arch/blackfin/lib/board.c +2 -2
-		mbase &= CPLB_PAGE_MASK;
-		mend &= CPLB_PAGE_MASK;
+		mbase &= cplb_page_mask;
+		mend &= cplb_page_mask;

What exsactly is the reason for replacing a compile-time calculation with a run-time one?

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Whom the gods would destroy, they first teach BASIC.
#13 lore raw

PATCH 5/11 Blackfin: bf60x: support big cplb page

Quoted 10 lines · Wolfgang Denk

Dear Sonic Zhang,

Quoted 4 lines · In message <[email protected]> you wrote:

From: Bob Liu <[email protected]>

Bf60x support 16K, 64K, 16M and 64M cplb pages, this patch add support for them. So that bf609-ezkit can use it's 128M memory.

Checkpatch issues, please fix.

OK

Quoted 9 lines
Quoted 3 lines
arch/blackfin/lib/board.c +0 -2
-#define CPLB_PAGE_SIZE (4 * 1024 * 1024)
-#define CPLB_PAGE_MASK (~(CPLB_PAGE_SIZE - 1))

...

Quoted 2 lines
arch/blackfin/lib/board.c +2 -0
+     uint32_t cplb_page_size;
+     uint32_t cplb_page_mask;

...

arch/blackfin/lib/board.c void init_cplbtables(void) · line 136

Quoted 2 lines
arch/blackfin/lib/board.c +2 -0
+     cplb_page_size = (4 * 1024 * 1024);
+     cplb_page_mask = (~(cplb_page_size - 1));
Quoted 8 lines

...

arch/blackfin/lib/board.c void init_cplbtables(void) · line 142

Quoted 4 lines
arch/blackfin/lib/board.c +2 -2
-             mbase &= CPLB_PAGE_MASK;
-             mend &= CPLB_PAGE_MASK;
+             mbase &= cplb_page_mask;
+             mend &= cplb_page_mask;

What exsactly is the reason for replacing a compile-time calculation with a run-time one?

I will check with Bob on this change.

Sonic Zhang

#14 lore raw

PATCH 5/11 Blackfin: bf60x: support big cplb page

In reply to Wolfgang Denk
Quoted 19 lines · Wolfgang Denk

Dear Sonic Zhang,

Quoted 4 lines · In message <[email protected]> you wrote:

From: Bob Liu <[email protected]>

Bf60x support 16K, 64K, 16M and 64M cplb pages, this patch add support for them. So that bf609-ezkit can use it's 128M memory.

Checkpatch issues, please fix.

Quoted 2 lines
arch/blackfin/lib/board.c +0 -2
-#define CPLB_PAGE_SIZE (4 * 1024 * 1024)
-#define CPLB_PAGE_MASK (~(CPLB_PAGE_SIZE - 1))

...

Quoted 2 lines
arch/blackfin/lib/board.c +2 -0
+     uint32_t cplb_page_size;
+     uint32_t cplb_page_mask;

...

arch/blackfin/lib/board.c void init_cplbtables(void) · line 136

Quoted 2 lines
arch/blackfin/lib/board.c +2 -0
+     cplb_page_size = (4 * 1024 * 1024);
+     cplb_page_mask = (~(cplb_page_size - 1));
Quoted 9 lines

...

arch/blackfin/lib/board.c void init_cplbtables(void) · line 142

Quoted 4 lines
arch/blackfin/lib/board.c +2 -2
-             mbase &= CPLB_PAGE_MASK;
-             mend &= CPLB_PAGE_MASK;
+             mbase &= cplb_page_mask;
+             mend &= cplb_page_mask;

What exsactly is the reason for replacing a compile-time calculation with a run-time one?

Because bf60x will use different cplb page size in some place, if don't use run-time variable then
more marco and #ifdef are needed.
I prefer to reuse this code with run-time variable.

Quoted 13 lines

Best regards,

Wolfgang Denk

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Whom the gods would destroy, they first teach BASIC.
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Signature · 2 lines
Thanks,
--Bob
#15 lore raw

PATCH 5/11 Blackfin: bf60x: support big cplb page

Hi Bob,

Quoted 26 lines · Bob Liu
Quoted 25 lines · Wolfgang Denk

Dear Sonic Zhang,

Quoted 4 lines · In message <[email protected]> you wrote:

From: Bob Liu <[email protected]>

Bf60x support 16K, 64K, 16M and 64M cplb pages, this patch add support for them. So that bf609-ezkit can use it's 128M memory.

Checkpatch issues, please fix.

Quoted 2 lines
arch/blackfin/lib/board.c +0 -2
-#define CPLB_PAGE_SIZE (4 * 1024 * 1024)
-#define CPLB_PAGE_MASK (~(CPLB_PAGE_SIZE - 1))

...

Quoted 2 lines
arch/blackfin/lib/board.c +2 -0
+     uint32_t cplb_page_size;
+     uint32_t cplb_page_mask;

...

Quoted 2 lines
arch/blackfin/lib/board.c +2 -0
+     cplb_page_size = (4 * 1024 * 1024);
+     cplb_page_mask = (~(cplb_page_size - 1));

...

Quoted 4 lines
arch/blackfin/lib/board.c +2 -2
-             mbase &= CPLB_PAGE_MASK;
-             mend &= CPLB_PAGE_MASK;
+             mbase &= cplb_page_mask;
+             mend &= cplb_page_mask;
Quoted 8 lines
Quoted 3 lines

What exsactly is the reason for replacing a compile-time calculation with a run-time one?

Because bf60x will use different cplb page size in some place, if don't use run-time variable then
more marco and #ifdef are needed.
I prefer to reuse this code with run-time variable.

Thanks for explanation. I changed your run-time variable into new macro to avoid this problem.

Regards,

Sonic

#16 lore raw

PATCH 6/11 Blackfin: bf60x: add gpio support

In reply to Sonic Zhang

From: Bob Liu <[email protected]>

---
 arch/blackfin/cpu/gpio.c                    |   36 +++++--
 arch/blackfin/include/asm/gpio.h            |    2 +-
 arch/blackfin/include/asm/mach-bf609/gpio.h |  151 +++++++++++++++++++++++++++
 3 files changed, 181 insertions(+), 8 deletions(-)
 create mode 100644 arch/blackfin/include/asm/mach-bf609/gpio.h
arch/blackfin/cpu/gpio.c +29 -7
index 5674d42..f684be5 100644
@@ -66,6 +66,14 @@ static struct gpio_port_t * const gpio_array[] = {
 	(struct gpio_port_t *)PORTH_FER,
 	(struct gpio_port_t *)PORTI_FER,
 	(struct gpio_port_t *)PORTJ_FER,
+#elif defined(CONFIG_BF60x)
+	(struct gpio_port_t *)PORTA_FER,
+	(struct gpio_port_t *)PORTB_FER,
+	(struct gpio_port_t *)PORTC_FER,
+	(struct gpio_port_t *)PORTD_FER,
+	(struct gpio_port_t *)PORTE_FER,
+	(struct gpio_port_t *)PORTF_FER,
+	(struct gpio_port_t *)PORTG_FER,
 #else
 # error no gpio arrays defined
 #endif
@@ -216,6 +224,12 @@ static void port_setup(unsigned gpio, unsigned short usage)
 	else
 		gpio_array[gpio_bank(gpio)]->port_fer |= gpio_bit(gpio);
 	SSYNC();
+#elif defined(CONFIG_BF60x)
+	if (usage == GPIO_USAGE)
+		gpio_array[gpio_bank(gpio)]->port_fer_clear = gpio_bit(gpio);
+	else
+		gpio_array[gpio_bank(gpio)]->port_fer_set = gpio_bit(gpio);
+	SSYNC();
 #endif
 }
 
@@ -290,7 +304,7 @@ static void portmux_setup(unsigned short per)
 		}
 	}
 }
-#elif defined(CONFIG_BF54x)
+#elif defined(CONFIG_BF54x) || defined(CONFIG_BF60x)
 inline void portmux_setup(unsigned short per)
 {
 	u32 pmux;
@@ -330,7 +344,7 @@ inline void portmux_setup(unsigned short per)
 # define portmux_setup(...)  do { } while (0)
 #endif
 
-#ifndef CONFIG_BF54x
+#if !defined(CONFIG_BF54x) && !defined(CONFIG_BF60x)
 /***********************************************************
 *
 * FUNCTIONS: Blackfin General Purpose Ports Access Functions
@@ -534,7 +548,7 @@ int peripheral_request(unsigned short per, const char *label)
 		 * be requested and used by several drivers
 		 */
 
-#ifdef CONFIG_BF54x
+#if defined(CONFIG_BF54x) || defined(CONFIG_BF60x)
 		if (!((per & P_MAYSHARE) && get_portmux(per) == P_FUNCT2MUX(per))) {
 #else
 		if (!(per & P_MAYSHARE)) {
@@ -651,7 +665,7 @@ int bfin_gpio_request(unsigned gpio, const char *label)
 		       gpio, get_label(gpio));
 		return -EBUSY;
 	}
-#ifndef CONFIG_BF54x
+#if !defined(CONFIG_BF54x) && !defined(CONFIG_BF60x)
 	else {	/* Reset POLAR setting when acquiring a gpio for the first time */
 		set_gpio_polar(gpio, 0);
 	}
@@ -732,12 +746,16 @@ void bfin_special_gpio_free(unsigned gpio)
 
 static inline void __bfin_gpio_direction_input(unsigned gpio)
 {
-#ifdef CONFIG_BF54x
+#if defined(CONFIG_BF54x) || defined(CONFIG_BF60x)
 	gpio_array[gpio_bank(gpio)]->dir_clear = gpio_bit(gpio);
 #else
 	gpio_array[gpio_bank(gpio)]->dir &= ~gpio_bit(gpio);
 #endif
+#if defined(CONFIG_BF60x)
+	gpio_array[gpio_bank(gpio)]->inen_set = gpio_bit(gpio);
+#else
 	gpio_array[gpio_bank(gpio)]->inen |= gpio_bit(gpio);
+#endif
 }
 
 int bfin_gpio_direction_input(unsigned gpio)
@@ -785,9 +803,13 @@ int bfin_gpio_direction_output(unsigned gpio, int value)
 
 	local_irq_save(flags);
 
+#if defined(CONFIG_BF60x)
+	gpio_array[gpio_bank(gpio)]->inen_clear = gpio_bit(gpio);
+#else
 	gpio_array[gpio_bank(gpio)]->inen &= ~gpio_bit(gpio);
+#endif
 	gpio_set_value(gpio, value);
-#ifdef CONFIG_BF54x
+#if defined(CONFIG_BF54x) || defined(CONFIG_BF60x)
 	gpio_array[gpio_bank(gpio)]->dir_set = gpio_bit(gpio);
 #else
 	gpio_array[gpio_bank(gpio)]->dir |= gpio_bit(gpio);
@@ -801,7 +823,7 @@ int bfin_gpio_direction_output(unsigned gpio, int value)
 
 int bfin_gpio_get_value(unsigned gpio)
 {
-#ifdef CONFIG_BF54x
+#if defined(CONFIG_BF54x) || defined(CONFIG_BF60x)
 	return (1 & (gpio_array[gpio_bank(gpio)]->data >> gpio_sub_n(gpio)));
 #else
 	unsigned long flags;
arch/blackfin/include/asm/gpio.h +1 -1
index 224688f..05131b5 100644
@@ -68,7 +68,7 @@
 
 #ifndef __ASSEMBLY__
 
-#ifndef CONFIG_BF54x
+#if !defined(CONFIG_BF54x) && !defined(CONFIG_BF60x)
 void set_gpio_dir(unsigned, unsigned short);
 void set_gpio_inen(unsigned, unsigned short);
 void set_gpio_polar(unsigned, unsigned short);
arch/blackfin/include/asm/mach-bf609/gpio.h new file +151 -0

151 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#17 lore raw

PATCH 7/11 blackfin: bf609: add board and headers files to support bf609

In reply to Sonic Zhang

From: Sonic Zhang <[email protected]>

Board and config header files for bf609-ezkit support.

---
 MAINTAINERS                       |    3 +-
 board/bf609-ezkit/Makefile        |   55 ++++++++++++
 board/bf609-ezkit/bf609-ezkit.c   |   67 +++++++++++++++
 boards.cfg                        |    1 +
 include/configs/bf609-ezkit.h     |  168 +++++++++++++++++++++++++++++++++++++
 include/configs/bfin_adi_common.h |    8 +-
 6 files changed, 297 insertions(+), 5 deletions(-)
 create mode 100644 board/bf609-ezkit/Makefile
 create mode 100644 board/bf609-ezkit/bf609-ezkit.c
 create mode 100644 include/configs/bf609-ezkit.h
MAINTAINERS +2 -1
index 28c052d..76368cf 100644
@@ -1214,7 +1214,7 @@ Yoshihiro Shimoda <[email protected]>
 #	Board		CPU						#
 #########################################################################
 
-Mike Frysinger <[email protected]>
+Sonic Zhang <[email protected]>
 Blackfin Team <[email protected]>
 
 	BF506F-EZKIT	BF506
@@ -1231,6 +1231,7 @@ Blackfin Team <[email protected]>
 	BF538F-EZKIT	BF538
 	BF548-EZKIT	BF548
 	BF561-EZKIT	BF561
+	BF609-EZKIT	BF609
 
 M.Hasewinkel (MHA) <[email protected]>
 
board/bf609-ezkit/Makefile new file +55 -0

55 lines not on this page · raw message

board/bf609-ezkit/bf609-ezkit.c new file +67 -0

67 lines not on this page · raw message

boards.cfg +1 -0
index e4b0d44..11060c4 100644
@@ -356,6 +356,7 @@ bf538f-ezkit                 blackfin    blackfin
 bf548-ezkit                  blackfin    blackfin
 bf561-acvilon                blackfin    blackfin
 bf561-ezkit                  blackfin    blackfin
+bf609-ezkit                  blackfin    blackfin
 blackstamp                   blackfin    blackfin
 blackvme                     blackfin    blackfin
 br4                          blackfin    blackfin
include/configs/bf609-ezkit.h new file +168 -0

168 lines not on this page · raw message

include/configs/bfin_adi_common.h +4 -4
index ccdec0d..b6ac14e 100644
@@ -193,10 +193,10 @@
 		"nand erase 0 0x40000;" \
 		"nand write $(loadaddr) 0 0x40000"
 # else
-#  define UBOOT_ENV_UPDATE \
-		"protect off 0x20000000 +$(filesize);" \
-		"erase 0x20000000 +$(filesize);" \
-		"cp.b $(loadaddr) 0x20000000 $(filesize)"
+# define UBOOT_ENV_UPDATE \
+		"protect off " MK_STR(CONFIG_SYS_FLASH_BASE) " +$(filesize);" \
+		"erase " MK_STR(CONFIG_SYS_FLASH_BASE) " +$(filesize);" \
+		"cp.b $(loadaddr)"  MK_STR(CONFIG_SYS_FLASH_BASE) " $(filesize)"
 # endif
 # ifdef CONFIG_NETCONSOLE
 #  define NETCONSOLE_ENV \
Signature · 1 line
1.7.0.4
#18 lore raw

PATCH 7/11 blackfin: bf609: add board and headers files to support bf609

Dear Sonic Zhang,

Quoted 3 lines · In message <[email protected]> you wrote:

From: Sonic Zhang <[email protected]>

Board and config header files for bf609-ezkit support.

Checkpatch errors, please fix.

include/configs/bf609-ezkit.h line 75

Quoted 3 lines
include/configs/bf609-ezkit.h new file +3 -0
+#define ADI_CMDS_NETWORK	1
+#define CONFIG_NETCONSOLE	1
+#define CONFIG_NET_MULTI	1

Please do not define values for variables that don't actually have one. Please fix globally.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
America has been discovered before, but it has always been hushed up.
- Oscar Wilde
#19 lore raw

PATCH 7/11 blackfin: bf609: add board and headers files to support bf609

Quoted 8 lines · Wolfgang Denk

Dear Sonic Zhang,

Quoted 3 lines · In message <[email protected]> you wrote:

From: Sonic Zhang <[email protected]>

Board and config header files for bf609-ezkit support.

Checkpatch errors, please fix.

OK

Quoted 8 lines

include/configs/bf609-ezkit.h line 75

Quoted 5 lines
include/configs/bf609-ezkit.h new file +3 -0
+#define ADI_CMDS_NETWORK     1
+#define CONFIG_NETCONSOLE    1
+#define CONFIG_NET_MULTI     1

Please do not define values for variables that don't actually have one. Please fix globally.

Will put to a new patch.

Thanks,

Sonic

#20 lore raw

PATCH 7/11 blackfin: bf609: add board and headers files to support bf609

In reply to Wolfgang Denk
Quoted 10 lines · Wolfgang Denk

Dear Sonic Zhang,

Quoted 3 lines · In message <[email protected]> you wrote:

From: Sonic Zhang <[email protected]>

Board and config header files for bf609-ezkit support.

Checkpatch errors, please fix.

+#define CONFIG_BFIN_CPU bf609-0.0

Sorry, the cpu name bf609-0.0 is use as the link flags and is not a checkpatch error.

Regards,

Sonic

#21 lore raw

PATCH 7/11 blackfin: bf609: add board and headers files to support bf609

In reply to Wolfgang Denk
Quoted 10 lines · Wolfgang Denk

Dear Sonic Zhang,

Quoted 3 lines · In message <[email protected]> you wrote:

From: Sonic Zhang <[email protected]>

Board and config header files for bf609-ezkit support.

Checkpatch errors, please fix.

Quoted 6 lines

include/configs/bf609-ezkit.h line 75

Quoted 3 lines
include/configs/bf609-ezkit.h new file +3 -0
+#define ADI_CMDS_NETWORK     1
+#define CONFIG_NETCONSOLE    1
+#define CONFIG_NET_MULTI     1

Please do not define values for variables that don't actually have one. Please fix globally.

The values of these 3 variables are used in include/configs/bfin_adi_common.h. They should be defined values, otherwise the compilation fails.

Regards,

Sonic

#22 lore raw

PATCH 7/11 blackfin: bf609: add board and headers files to support bf609

Dear Sonic Zhang,

Quoted 18 lines · In message <CAJxxZ0MbkmPgGjFrQR3Uq0M=V-67gBryF1oTQd6_ayv8pZh2Dw@mail.gmail.com>…
Quoted 10 lines · Wolfgang Denk

Dear Sonic Zhang,

Quoted 3 lines · In message <[email protected]> you wrote:

From: Sonic Zhang <[email protected]>

Board and config header files for bf609-ezkit support.

Checkpatch errors, please fix.

Quoted 6 lines

include/configs/bf609-ezkit.h line 75

Quoted 3 lines
include/configs/bf609-ezkit.h new file +3 -0
+#define ADI_CMDS_NETWORK     1
+#define CONFIG_NETCONSOLE    1
+#define CONFIG_NET_MULTI     1

Please do not define values for variables that don't actually have one. Please fix globally.

Quoted 3 lines

The values of these 3 variables are used in include/configs/bfin_adi_common.h. They should be defined values, otherwise the compilation fails.

This is a bug in include/configs/bfin_adi_common.h then, which needs to be fixed there.

It is wrong to use #if on these defines.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
How much net work could a network work, if a network could net work?
#23 lore raw

PATCH 8/11 Blackfin: bf60x: add rsi/sdh support

In reply to Sonic Zhang

From: Sonic Zhang <[email protected]>

Add rsi/sdh support for bf60x.

---
 arch/blackfin/include/asm/mach-common/bits/sdh.h |   38 +++++++++++-
 drivers/mmc/bfin_sdh.c                           |   68 ++++++++++++++++-----
 2 files changed, 88 insertions(+), 18 deletions(-)
arch/blackfin/include/asm/mach-common/bits/sdh.h +36 -2
index 8c5dd33..3495558 100644
@@ -12,18 +12,35 @@
 #define                 CMD_INT_E  0x100      /* Command Interrupt */
 #define                CMD_PEND_E  0x200      /* Command Pending */
 #define                     CMD_E  0x400      /* Command Enable */
+#ifdef RSI_BLKSZ
+#define           CMD_CRC_CHECK_D  0x800      /* CRC Check is disabled */
+#define            CMD_DATA0_BUSY  0x1000     /* Check for Busy State on the DATA0 pin */
+#endif
 
 /* Bit masks for SDH_PWR_CTL */
+#ifndef RSI_BLKSZ
 #define                    PWR_ON  0x3        /* Power On */
 #define                 SD_CMD_OD  0x40       /* Open Drain Output */
 #define                   ROD_CTL  0x80       /* Rod Control */
+#endif
 
 /* Bit masks for SDH_CLK_CTL */
 #define                    CLKDIV  0xff       /* MC_CLK Divisor */
 #define                     CLK_E  0x100      /* MC_CLK Bus Clock Enable */
 #define                  PWR_SV_E  0x200      /* Power Save Enable */
 #define             CLKDIV_BYPASS  0x400      /* Bypass Divisor */
-#define                  WIDE_BUS  0x800      /* Wide Bus Mode Enable */
+#define             BUS_MODE_MASK  0x1800     /* Bus Mode Mask */
+#define                 STD_BUS_1  0x000      /* Standard Bus 1 bit mode */
+#define                WIDE_BUS_4  0x800      /* Wide Bus 4 bit mode */
+#define                BYTE_BUS_8  0x1000     /* Byte Bus 8 bit mode */
+#ifdef RSI_BLKSZ
+#define            CARD_TYPE_MASK  0xe000     /* Card type mask */
+#define          CARD_TYPE_OFFSET  13         /* Card type offset */
+#define            CARD_TYPE_SDIO  0
+#define            CARD_TYPE_eMMC  1
+#define              CARD_TYPE_SD  2
+#define           CARD_TYPE_CEATA  3
+#endif
 
 /* Bit masks for SDH_RESP_CMD */
 #define                  RESP_CMD  0x3f       /* Response Command */
@@ -33,7 +50,13 @@
 #define                   DTX_DIR  0x2        /* Data Transfer Direction */
 #define                  DTX_MODE  0x4        /* Data Transfer Mode */
 #define                 DTX_DMA_E  0x8        /* Data Transfer DMA Enable */
+#ifndef RSI_BLKSZ
 #define              DTX_BLK_LGTH  0xf0       /* Data Transfer Block Length */
+#else
+
+/* Bit masks for SDH_BLK_SIZE */
+#define              DTX_BLK_LGTH  0x1fff     /* Data Transfer Block Length */
+#endif
 
 /* Bit masks for SDH_STATUS */
 #define              CMD_CRC_FAIL  0x1        /* CMD CRC Fail */
@@ -102,10 +125,13 @@
 /* Bit masks for SDH_E_STATUS */
 #define              SDIO_INT_DET  0x2        /* SDIO Int Detected */
 #define               SD_CARD_DET  0x10       /* SD Card Detect */
+#define          SD_CARD_BUSYMODE  0x80000000 /* Card is in Busy mode */
+#define           SD_CARD_SLPMODE  0x40000000 /* Card in Sleep Mode */
+#define             SD_CARD_READY  0x00020000 /* Card Ready */
 
 /* Bit masks for SDH_E_MASK */
 #define                  SDIO_MSK  0x2        /* Mask SDIO Int Detected */
-#define                   SCD_MSK  0x40       /* Mask Card Detect */
+#define                   SCD_MSK  0x10       /* Mask Card Detect */
 
 /* Bit masks for SDH_CFG */
 #define                   CLKS_EN  0x1        /* Clocks Enable */
@@ -114,7 +140,15 @@
 #define                    SD_RST  0x10       /* SDMMC Reset */
 #define                 PUP_SDDAT  0x20       /* Pull-up SD_DAT */
 #define                PUP_SDDAT3  0x40       /* Pull-up SD_DAT3 */
+#ifndef RSI_BLKSZ
 #define                 PD_SDDAT3  0x80       /* Pull-down SD_DAT3 */
+#else
+#define                    PWR_ON  0x600      /* Power On */
+#define                 SD_CMD_OD  0x800      /* Open Drain Output */
+#define                   BOOT_EN  0x1000     /* Boot Enable */
+#define                 BOOT_MODE  0x2000     /* Alternate Boot Mode */.
+#define               BOOT_ACK_EN  0x4000     /* Boot ACK is expected */
+#endif
 
 /* Bit masks for SDH_RD_WAIT_EN */
 #define                       RWR  0x1        /* Read Wait Request */
drivers/mmc/bfin_sdh.c +52 -16

149 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#24 lore raw

PATCH 8/11 Blackfin: bf60x: add rsi/sdh support

Dear Sonic Zhang,

Quoted 3 lines · In message <[email protected]> you wrote:

From: Sonic Zhang <[email protected]>

Add rsi/sdh support for bf60x.

Checkpatch errors. Please fix.

Quoted 1 line
(quoted diff) +0 -0
@@ -113,16 +131,19 @@ static int sdh_setup_data(struct mmc *mmc, struct mmc_data *data)

...

Quoted 1 line
drivers/mmc/bfin_sdh.c +0 -1
-	int ret = 0;

...

drivers/mmc/bfin_sdh.c static int sdh_setup_data(struct mmc *mmc, struct mmc_data *data) · line 161

Quoted 2 lines
drivers/mmc/bfin_sdh.c +1 -1
-	return ret;
+	return 0;

If this function can always only return 0, then please make it void.

Please fix globally.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
It is dangerous to be right on a subject  on  which  the  established
authorities are wrong.                                    -- Voltaire
#25 lore raw

PATCH 8/11 Blackfin: bf60x: add rsi/sdh support

Quoted 8 lines · Wolfgang Denk

Dear Sonic Zhang,

Quoted 3 lines · In message <[email protected]> you wrote:

From: Sonic Zhang <[email protected]>

Add rsi/sdh support for bf60x.

Checkpatch errors. Please fix.

OK

Quoted 12 lines
Quoted 2 lines
(quoted diff) +0 -0
@@ -113,16 +131,19 @@ static int sdh_setup_data(struct mmc *mmc, struct mmc_data *data)

...

Quoted 1 line

- int ret = 0;

...

drivers/mmc/bfin_sdh.c static int sdh_setup_data(struct mmc *mmc, struct mmc_data *data) · line 161

Quoted 2 lines
drivers/mmc/bfin_sdh.c +1 -1
-     return ret;
+     return 0;

If this function can always only return 0, then please make it void.

Please fix globally.

Yes

Thanks,

Sonic

#26 lore raw

PATCH 8/11 Blackfin: bf60x: add rsi/sdh support

In reply to Wolfgang Denk
Quoted 11 lines · Wolfgang Denk

Dear Sonic Zhang,

Quoted 3 lines · In message <[email protected]> you wrote:

From: Sonic Zhang <[email protected]>

Add rsi/sdh support for bf60x.

Checkpatch errors. Please fix.

Quoted 1 line
(quoted diff) +0 -0
@@ -113,16 +131,19 @@ static int sdh_setup_data(struct mmc *mmc, struct mmc_data *data)

...

Quoted 8 lines
Quoted 1 line

- int ret = 0;

...

drivers/mmc/bfin_sdh.c static int sdh_setup_data(struct mmc *mmc, struct mmc_data *data) · line 161

Quoted 2 lines
drivers/mmc/bfin_sdh.c +1 -1
-     return ret;
+     return 0;

If this function can always only return 0, then please make it void.

Please fix globally.

I am sorry, this function can't be changed to void, because it may return error. See bellow code.

static int sdh_setup_data(struct mmc *mmc, struct mmc_data *data)

{
        u16 data_ctl = 0;
        u16 dma_cfg = 0;
        unsigned long data_size = data->blocksize * data->blocks;

        /* Don't support write yet. */
        if (data->flags & MMC_DATA_WRITE)
                return UNUSABLE_ERR;

......

Regards,

Sonic

#27 lore raw

PATCH 8/11 Blackfin: bf60x: add rsi/sdh support

Dear Sonic Zhang,

Quoted 8 lines · In message <CAJxxZ0OTwow6X2KX8yAujtrxc6qicVPMO2rP4MHwJQVQUbhecw@mail.gmail.com>…
Quoted 8 lines
Quoted 2 lines
(quoted diff) +0 -0
@@ -113,16 +131,19 @@ static int sdh_setup_data(struct mmc *mmc, struct mmc_data *data)

...

Quoted 1 line

- int ret = 0;

...

Quoted 2 lines
drivers/mmc/bfin_sdh.c +1 -1
-     return ret;
+     return 0;
Quoted 6 lines
Quoted 3 lines

If this function can always only return 0, then please make it void.

Please fix globally.

I am sorry, this function can't be changed to void, because it may return error. See bellow code.

You are contradicting yourself. You _always_ return a 0 here. Your code CANNOT return an error code.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Build a system that even a fool can use and only a fool will want  to
use it.
#28 lore raw

PATCH 8/11 Blackfin: bf60x: add rsi/sdh support

Hi Wolfgang,

Quoted 13 lines · Wolfgang Denk

Dear Sonic Zhang,

Quoted 10 lines · In message <CAJxxZ0OTwow6X2KX8yAujtrxc6qicVPMO2rP4MHwJQVQUbhecw@mail.gmail.com>…
Quoted 10 lines
Quoted 2 lines
(quoted diff) +0 -0
@@ -113,16 +131,19 @@ static int sdh_setup_data(struct mmc *mmc, struct mmc_data *data)

...

Quoted 1 line

- int ret = 0;

...

drivers/mmc/bfin_sdh.c static int sdh_setup_data(struct mmc *mmc, struct mmc_data *data) · line 161

Quoted 2 lines
drivers/mmc/bfin_sdh.c +1 -1
-     return ret;
+     return 0;

If this function can always only return 0, then please make it void.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Please fix globally.

I am sorry, this function can't be changed to void, because it may return error. See bellow code.

You are contradicting yourself. You _always_ return a 0 here. Your code CANNOT return an error code.

Maybe I didn't describe it clearly. Yes, I return 0 at the end of this function. But, the same function may return UNUSABLE_ERR(-17) at the beginning if the data flags match MMC_DATA_WRITE. That's why the function can't return void. Is anything contradicting in my explanation?

@@ -113,16 +131,19 @@ static int sdh_setup_data(struct mmc *mmc, struct mmc_data *data)

 {
        u16 data_ctl = 0;
        u16 dma_cfg = 0;
-       int ret = 0;
        unsigned long data_size = data->blocksize * data->blocks;

        /* Don't support write yet. */
        if (data->flags & MMC_DATA_WRITE)
                return UNUSABLE_ERR;

@@ -137,7 +158,7 @@ static int sdh_setup_data(struct mmc *mmc, struct mmc_data *data)

        /* kick off transfer */
        bfin_write_SDH_DATA_CTL(bfin_read_SDH_DATA_CTL() | DTX_DMA_E | DTX_E);

- return ret;
+ return 0;
}

Regards,

Sonic Zhang

#29 lore raw

PATCH 8/11 Blackfin: bf60x: add rsi/sdh support

Dear Sonic Zhang,

Quoted 6 lines · In message <CAJxxZ0O_OZk7w_CDfJkzPwDMFqwT1m-Yn_Bz6yzHRDFqT6wrBw@mail.gmail.com>…

Maybe I didn't describe it clearly. Yes, I return 0 at the end of this function. But, the same function may return UNUSABLE_ERR(-17) at the beginning if the data flags match MMC_DATA_WRITE. That's why the function can't return void. Is anything contradicting in my explanation?

I see. Sorry, I missed that other return.

One additional question, though:

drivers/mmc/bfin_sdh.c static int sdh_setup_data(struct mmc *mmc, struct mmc_data *data) · line 161

Quoted 5 lines
        /* kick off transfer */
        bfin_write_SDH_DATA_CTL(bfin_read_SDH_DATA_CTL() | DTX_DMA_E | DTX_E);
drivers/mmc/bfin_sdh.c +1 -1
-       return ret;
+       return 0;

Are the bfin_read_SDH_DATA_CTL() and bfin_write_SDH_DATA_CTL() supposed to always work, i. e. are we positively sure that these can never fail, so there is no need to test the return code and handle error conditions?

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
People have one thing in common: they are all different.
#30 lore raw

PATCH 8/11 Blackfin: bf60x: add rsi/sdh support

Hi Wolfgang,

Quoted 17 lines · Wolfgang Denk

Dear Sonic Zhang,

Quoted 6 lines · In message <CAJxxZ0O_OZk7w_CDfJkzPwDMFqwT1m-Yn_Bz6yzHRDFqT6wrBw@mail.gmail.com>…

Maybe I didn't describe it clearly. Yes, I return 0 at the end of this function. But, the same function may return UNUSABLE_ERR(-17) at the beginning if the data flags match MMC_DATA_WRITE. That's why the function can't return void. Is anything contradicting in my explanation?

I see. Sorry, I missed that other return.

One additional question, though:

Quoted 3 lines
        /* kick off transfer */
        bfin_write_SDH_DATA_CTL(bfin_read_SDH_DATA_CTL() | DTX_DMA_E | DTX_E);
Quoted 7 lines

drivers/mmc/bfin_sdh.c static int sdh_setup_data(struct mmc *mmc, struct mmc_data *data) · line 161

Quoted 2 lines
drivers/mmc/bfin_sdh.c +1 -1
-       return ret;
+       return 0;

Are the bfin_read_SDH_DATA_CTL() and bfin_write_SDH_DATA_CTL() supposed to always work, i. e. are we positively sure that these can never fail, so there is no need to test the return code and handle error conditions?

Yes, bfin_write_XXX and bfin_read_XXX are simply defined as memory access operations. They either succeed or cause hardware error exception.

#define bfin_read_SDH_DATA_CTL() bfin_read16(SDH_DATA_CTL)

#define _bfin_readX(addr, size, asm_size, asm_ext) ({ \
        u32 __v; \
        __asm__ __volatile__( \
                "%0 = " #asm_size "[%1]" #asm_ext ";" \
                : "=d" (__v) \
                : "a" (addr) \
        ); \
        __v; })

Regards,

Sonic

#31 lore raw

PATCH 9/11 Blackfin: spi: add bf6xx spi driver

In reply to Sonic Zhang

From: Scott Jiang <[email protected]>

Spi driver for bf60x is different from old one, so implement a new driver for it.

---
 .../blackfin/include/asm/mach-common/bits/spi6xx.h |  240 +++++++++++++++
 drivers/spi/Makefile                               |    1 +
 drivers/spi/bfin_spi6xx.c                          |  308 ++++++++++++++++++++
 3 files changed, 549 insertions(+), 0 deletions(-)
 create mode 100644 arch/blackfin/include/asm/mach-common/bits/spi6xx.h
 create mode 100644 drivers/spi/bfin_spi6xx.c
arch/blackfin/include/asm/mach-common/bits/spi6xx.h new file +240 -0
new file mode 100644
index 0000000..8b8dd25
@@ -0,0 +1,240 @@
+/*
+ * Analog Devices bfin_spi3 controller driver
+ *
+ * Copyright (c) 2011 Analog Devices Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef _SPI_CHANNEL_H_
+#define _SPI_CHANNEL_H_
+
+#include <linux/types.h>
+
+/* SPI_CONTROL */
+#define SPI_CTL_EN                  0x00000001    /* Enable */
+#define SPI_CTL_MSTR                0x00000002    /* Master/Slave */
+#define SPI_CTL_PSSE                0x00000004    /* controls modf error in master mode */
+#define SPI_CTL_ODM                 0x00000008    /* Open Drain Mode */
+#define SPI_CTL_CPHA                0x00000010    /* Clock Phase */
+#define SPI_CTL_CPOL                0x00000020    /* Clock Polarity */
+#define SPI_CTL_ASSEL               0x00000040    /* Slave Select Pin Control */
+#define SPI_CTL_SELST               0x00000080    /* Slave Select Polarity in-between transfers */
+#define SPI_CTL_EMISO               0x00000100    /* Enable MISO */
+#define SPI_CTL_SIZE                0x00000600    /* Word Transfer Size */
+#define SPI_CTL_SIZE08              0x00000000    /* SIZE: 8 bits */
+#define SPI_CTL_SIZE16              0x00000200    /* SIZE: 16 bits */
+#define SPI_CTL_SIZE32              0x00000400    /* SIZE: 32 bits */
+#define SPI_CTL_LSBF                0x00001000    /* LSB First */
+#define SPI_CTL_FCEN                0x00002000    /* Flow-Control Enable */
+#define SPI_CTL_FCCH                0x00004000    /* Flow-Control Channel Selection */
+#define SPI_CTL_FCPL                0x00008000    /* Flow-Control Polarity */
+#define SPI_CTL_FCWM                0x00030000    /* Flow-Control Water-Mark */
+#define SPI_CTL_FIFO0               0x00000000    /* FCWM: TFIFO empty or RFIFO Full */
+#define SPI_CTL_FIFO1               0x00010000    /* FCWM: TFIFO 75% or more empty or RFIFO 75% or more full */
+#define SPI_CTL_FIFO2               0x00020000    /* FCWM: TFIFO 50% or more empty or RFIFO 50% or more full */
+#define SPI_CTL_FMODE               0x00040000    /* Fast-mode Enable */
+#define SPI_CTL_MIOM                0x00300000    /* Multiple I/O Mode */
+#define SPI_CTL_MIO_DIS             0x00000000    /* MIOM: Disable */
+#define SPI_CTL_MIO_DUAL            0x00100000    /* MIOM: Enable DIOM (Dual I/O Mode) */
+#define SPI_CTL_MIO_QUAD            0x00200000    /* MIOM: Enable QUAD (Quad SPI Mode) */
+#define SPI_CTL_SOSI                0x00400000    /* Start on MOSI */
+/* SPI_RX_CONTROL */
+#define SPI_RXCTL_REN               0x00000001    /* Receive Channel Enable */
+#define SPI_RXCTL_RTI               0x00000004    /* Receive Transfer Initiate */
+#define SPI_RXCTL_RWCEN             0x00000008    /* Receive Word Counter Enable */
+#define SPI_RXCTL_RDR               0x00000070    /* Receive Data Request */
+#define SPI_RXCTL_RDR_DIS           0x00000000    /* RDR: Disabled */
+#define SPI_RXCTL_RDR_NE            0x00000010    /* RDR: RFIFO not empty */
+#define SPI_RXCTL_RDR_25            0x00000020    /* RDR: RFIFO 25% full */
+#define SPI_RXCTL_RDR_50            0x00000030    /* RDR: RFIFO 50% full */
+#define SPI_RXCTL_RDR_75            0x00000040    /* RDR: RFIFO 75% full */
+#define SPI_RXCTL_RDR_FULL          0x00000050    /* RDR: RFIFO full */
+#define SPI_RXCTL_RDO               0x00000100    /* Receive Data Over-Run */
+#define SPI_RXCTL_RRWM              0x00003000    /* FIFO Regular Water-Mark */
+#define SPI_RXCTL_RWM_0             0x00000000    /* RRWM: RFIFO Empty */
+#define SPI_RXCTL_RWM_25            0x00001000    /* RRWM: RFIFO 25% full */
+#define SPI_RXCTL_RWM_50            0x00002000    /* RRWM: RFIFO 50% full */
+#define SPI_RXCTL_RWM_75            0x00003000    /* RRWM: RFIFO 75% full */
+#define SPI_RXCTL_RUWM              0x00070000    /* FIFO Urgent Water-Mark */
+#define SPI_RXCTL_UWM_DIS           0x00000000    /* RUWM: Disabled */
+#define SPI_RXCTL_UWM_25            0x00010000    /* RUWM: RFIFO 25% full */
+#define SPI_RXCTL_UWM_50            0x00020000    /* RUWM: RFIFO 50% full */
+#define SPI_RXCTL_UWM_75            0x00030000    /* RUWM: RFIFO 75% full */
+#define SPI_RXCTL_UWM_FULL          0x00040000    /* RUWM: RFIFO full */
+/* SPI_TX_CONTROL */
+#define SPI_TXCTL_TEN               0x00000001    /* Transmit Channel Enable */
+#define SPI_TXCTL_TTI               0x00000004    /* Transmit Transfer Initiate */
+#define SPI_TXCTL_TWCEN             0x00000008    /* Transmit Word Counter Enable */
+#define SPI_TXCTL_TDR               0x00000070    /* Transmit Data Request */
+#define SPI_TXCTL_TDR_DIS           0x00000000    /* TDR: Disabled */
+#define SPI_TXCTL_TDR_NF            0x00000010    /* TDR: TFIFO not full */
+#define SPI_TXCTL_TDR_25            0x00000020    /* TDR: TFIFO 25% empty */
+#define SPI_TXCTL_TDR_50            0x00000030    /* TDR: TFIFO 50% empty */
+#define SPI_TXCTL_TDR_75            0x00000040    /* TDR: TFIFO 75% empty */
+#define SPI_TXCTL_TDR_EMPTY         0x00000050    /* TDR: TFIFO empty */
+#define SPI_TXCTL_TDU               0x00000100    /* Transmit Data Under-Run */
+#define SPI_TXCTL_TRWM              0x00003000    /* FIFO Regular Water-Mark */
+#define SPI_TXCTL_RWM_FULL          0x00000000    /* TRWM: TFIFO full */
+#define SPI_TXCTL_RWM_25            0x00001000    /* TRWM: TFIFO 25% empty */
+#define SPI_TXCTL_RWM_50            0x00002000    /* TRWM: TFIFO 50% empty */
+#define SPI_TXCTL_RWM_75            0x00003000    /* TRWM: TFIFO 75% empty */
+#define SPI_TXCTL_TUWM              0x00070000    /* FIFO Urgent Water-Mark */
+#define SPI_TXCTL_UWM_DIS           0x00000000    /* TUWM: Disabled */
+#define SPI_TXCTL_UWM_25            0x00010000    /* TUWM: TFIFO 25% empty */
+#define SPI_TXCTL_UWM_50            0x00020000    /* TUWM: TFIFO 50% empty */
+#define SPI_TXCTL_UWM_75            0x00030000    /* TUWM: TFIFO 75% empty */
+#define SPI_TXCTL_UWM_EMPTY         0x00040000    /* TUWM: TFIFO empty */
+/* SPI_CLOCK */
+#define SPI_CLK_BAUD                0x0000FFFF    /* Baud Rate */
+/* SPI_DELAY */
+#define SPI_DLY_STOP                0x000000FF    /* Transfer delay time in multiples of SCK period */
+#define SPI_DLY_LEADX               0x00000100    /* Extended (1 SCK) LEAD Control */
+#define SPI_DLY_LAGX                0x00000200    /* Extended (1 SCK) LAG control */
+/* SPI_SSEL */
+#define SPI_SLVSEL_SSE1             0x00000002    /* SPISSEL1 Enable */
+#define SPI_SLVSEL_SSE2             0x00000004    /* SPISSEL2 Enable */
+#define SPI_SLVSEL_SSE3             0x00000008    /* SPISSEL3 Enable */
+#define SPI_SLVSEL_SSE4             0x00000010    /* SPISSEL4 Enable */
+#define SPI_SLVSEL_SSE5             0x00000020    /* SPISSEL5 Enable */
+#define SPI_SLVSEL_SSE6             0x00000040    /* SPISSEL6 Enable */
+#define SPI_SLVSEL_SSE7             0x00000080    /* SPISSEL7 Enable */
+#define SPI_SLVSEL_SSEL1            0x00000200    /* SPISSEL1 Value */
+#define SPI_SLVSEL_SSEL2            0x00000400    /* SPISSEL2 Value */
+#define SPI_SLVSEL_SSEL3            0x00000800    /* SPISSEL3 Value */
+#define SPI_SLVSEL_SSEL4            0x00001000    /* SPISSEL4 Value */
+#define SPI_SLVSEL_SSEL5            0x00002000    /* SPISSEL5 Value */
+#define SPI_SLVSEL_SSEL6            0x00004000    /* SPISSEL6 Value */
+#define SPI_SLVSEL_SSEL7            0x00008000    /* SPISSEL7 Value */
+/* SPI_RWC */
+#define SPI_RWC_VALUE               0x0000FFFF    /* Received Word-Count */
+/* SPI_RWCR */
+#define SPI_RWCR_VALUE              0x0000FFFF    /* Received Word-Count Reload */
+/* SPI_TWC */
+#define SPI_TWC_VALUE               0x0000FFFF    /* Transmitted Word-Count */
+/* SPI_TWCR */
+#define SPI_TWCR_VALUE              0x0000FFFF    /* Transmitted Word-Count Reload */
+/* SPI_IMASK */
+#define SPI_IMSK_RUWM               0x00000002    /* Receive Urgent Water-Mark Interrupt Mask */
+#define SPI_IMSK_TUWM               0x00000004    /* Transmit Urgent Water-Mark Interrupt Mask */
+#define SPI_IMSK_ROM                0x00000010    /* Receive Over-Run Error Interrupt Mask */
+#define SPI_IMSK_TUM                0x00000020    /* Transmit Under-Run Error Interrupt Mask */
+#define SPI_IMSK_TCM                0x00000040    /* Transmit Collision Error Interrupt Mask */
+#define SPI_IMSK_MFM                0x00000080    /* Mode Fault Error Interrupt Mask */
+#define SPI_IMSK_RSM                0x00000100    /* Receive Start Interrupt Mask */
+#define SPI_IMSK_TSM                0x00000200    /* Transmit Start Interrupt Mask */
+#define SPI_IMSK_RFM                0x00000400    /* Receive Finish Interrupt Mask */
+#define SPI_IMSK_TFM                0x00000800    /* Transmit Finish Interrupt Mask */
+/* SPI_IMASKCL */
+#define SPI_IMSK_CLR_RUW            0x00000002    /* Receive Urgent Water-Mark Interrupt Mask */
+#define SPI_IMSK_CLR_TUWM           0x00000004    /* Transmit Urgent Water-Mark Interrupt Mask */
+#define SPI_IMSK_CLR_ROM            0x00000010    /* Receive Over-Run Error Interrupt Mask */
+#define SPI_IMSK_CLR_TUM            0x00000020    /* Transmit Under-Run Error Interrupt Mask */
+#define SPI_IMSK_CLR_TCM            0x00000040    /* Transmit Collision Error Interrupt Mask */
+#define SPI_IMSK_CLR_MFM            0x00000080    /* Mode Fault Error Interrupt Mask */
+#define SPI_IMSK_CLR_RSM            0x00000100    /* Receive Start Interrupt Mask */
+#define SPI_IMSK_CLR_TSM            0x00000200    /* Transmit Start Interrupt Mask */
+#define SPI_IMSK_CLR_RFM            0x00000400    /* Receive Finish Interrupt Mask */
+#define SPI_IMSK_CLR_TFM            0x00000800    /* Transmit Finish Interrupt Mask */
+/* SPI_IMASKST */
+#define SPI_IMSK_SET_RUWM           0x00000002    /* Receive Urgent Water-Mark Interrupt Mask */
+#define SPI_IMSK_SET_TUWM           0x00000004    /* Transmit Urgent Water-Mark Interrupt Mask */
+#define SPI_IMSK_SET_ROM            0x00000010    /* Receive Over-Run Error Interrupt Mask */
+#define SPI_IMSK_SET_TUM            0x00000020    /* Transmit Under-Run Error Interrupt Mask */
+#define SPI_IMSK_SET_TCM            0x00000040    /* Transmit Collision Error Interrupt Mask */
+#define SPI_IMSK_SET_MFM            0x00000080    /* Mode Fault Error Interrupt Mask */
+#define SPI_IMSK_SET_RSM            0x00000100    /* Receive Start Interrupt Mask */
+#define SPI_IMSK_SET_TSM            0x00000200    /* Transmit Start Interrupt Mask */
+#define SPI_IMSK_SET_RFM            0x00000400    /* Receive Finish Interrupt Mask */
+#define SPI_IMSK_SET_TFM            0x00000800    /* Transmit Finish Interrupt Mask */
+/* SPI_STATUS */
+#define SPI_STAT_SPIF               0x00000001    /* SPI Finished */
+#define SPI_STAT_RUWM               0x00000002    /* Receive Urgent Water-Mark Breached */
+#define SPI_STAT_TUWM               0x00000004    /* Transmit Urgent Water-Mark Breached */
+#define SPI_STAT_ROE                0x00000010    /* Receive Over-Run Error Indication */
+#define SPI_STAT_TUE                0x00000020    /* Transmit Under-Run Error Indication */
+#define SPI_STAT_TCE                0x00000040    /* Transmit Collision Error Indication */
+#define SPI_STAT_MODF               0x00000080    /* Mode Fault Error Indication */
+#define SPI_STAT_RS                 0x00000100    /* Receive Start Indication */
+#define SPI_STAT_TS                 0x00000200    /* Transmit Start Indication */
+#define SPI_STAT_RF                 0x00000400    /* Receive Finish Indication */
+#define SPI_STAT_TF                 0x00000800    /* Transmit Finish Indication */
+#define SPI_STAT_RFS                0x00007000    /* SPI_RFIFO status */
+#define SPI_STAT_RFIFO_EMPTY        0x00000000    /* RFS: RFIFO Empty */
+#define SPI_STAT_RFIFO_25           0x00001000    /* RFS: RFIFO 25% Full */
+#define SPI_STAT_RFIFO_50           0x00002000    /* RFS: RFIFO 50% Full */
+#define SPI_STAT_RFIFO_75           0x00003000    /* RFS: RFIFO 75% Full */
+#define SPI_STAT_RFIFO_FULL         0x00004000    /* RFS: RFIFO Full */
+#define SPI_STAT_TFS                0x00070000    /* SPI_TFIFO status */
+#define SPI_STAT_TFIFO_FULL         0x00000000    /* TFS: TFIFO full */
+#define SPI_STAT_TFIFO_25           0x00010000    /* TFS: TFIFO 25% empty */
+#define SPI_STAT_TFIFO_50           0x00020000    /* TFS: TFIFO 50% empty */
+#define SPI_STAT_TFIFO_75           0x00030000    /* TFS: TFIFO 75% empty */
+#define SPI_STAT_TFIFO_EMPTY        0x00040000    /* TFS: TFIFO empty */
+#define SPI_STAT_FCS                0x00100000    /* Flow-Control Stall Indication */
+#define SPI_STAT_RFE                0x00400000    /* SPI_RFIFO Empty */
+#define SPI_STAT_TFF                0x00800000    /* SPI_TFIFO Full */
+/* SPI_ILAT */
+#define SPI_ILAT_RUWMI              0x00000002    /* Receive Urgent Water Mark Interrupt */
+#define SPI_ILAT_TUWMI              0x00000004    /* Transmit Urgent Water Mark Interrupt */
+#define SPI_ILAT_ROI                0x00000010    /* Receive Over-Run Error Indication */
+#define SPI_ILAT_TUI                0x00000020    /* Transmit Under-Run Error Indication */
+#define SPI_ILAT_TCI                0x00000040    /* Transmit Collision Error Indication */
+#define SPI_ILAT_MFI                0x00000080    /* Mode Fault Error Indication */
+#define SPI_ILAT_RSI                0x00000100    /* Receive Start Indication */
+#define SPI_ILAT_TSI                0x00000200    /* Transmit Start Indication */
+#define SPI_ILAT_RFI                0x00000400    /* Receive Finish Indication */
+#define SPI_ILAT_TFI                0x00000800    /* Transmit Finish Indication */
+/* SPI_ILATCL */
+#define SPI_ILAT_CLR_RUWMI          0x00000002    /* Receive Urgent Water Mark Interrupt */
+#define SPI_ILAT_CLR_TUWMI          0x00000004    /* Transmit Urgent Water Mark Interrupt */
+#define SPI_ILAT_CLR_ROI            0x00000010    /* Receive Over-Run Error Indication */
+#define SPI_ILAT_CLR_TUI            0x00000020    /* Transmit Under-Run Error Indication */
+#define SPI_ILAT_CLR_TCI            0x00000040    /* Transmit Collision Error Indication */
+#define SPI_ILAT_CLR_MFI            0x00000080    /* Mode Fault Error Indication */
+#define SPI_ILAT_CLR_RSI            0x00000100    /* Receive Start Indication */
+#define SPI_ILAT_CLR_TSI            0x00000200    /* Transmit Start Indication */
+#define SPI_ILAT_CLR_RFI            0x00000400    /* Receive Finish Indication */
+#define SPI_ILAT_CLR_TFI            0x00000800    /* Transmit Finish Indication */
+
+/*
+ * bfin spi3 registers layout
+ */
+struct bfin_spi_regs {
+	u32 revid;
+	u32 control;
+	u32 rx_control;
+	u32 tx_control;
+	u32 clock;
+	u32 delay;
+	u32 ssel;
+	u32 rwc;
+	u32 rwcr;
+	u32 twc;
+	u32 twcr;
+	u32 reserved0;
+	u32 emask;
+	u32 emaskcl;
+	u32 emaskst;
+	u32 reserved1;
+	u32 status;
+	u32 elat;
+	u32 elatcl;
+	u32 reserved2;
+	u32 rfifo;
+	u32 reserved3;
+	u32 tfifo;
+};
+
+#endif /* _SPI_CHANNEL_H_ */
drivers/spi/Makefile +1 -0
index 824d357..42aa1a7 100644
@@ -31,6 +31,7 @@ COBJS-$(CONFIG_ARMADA100_SPI) += armada100_spi.o
 COBJS-$(CONFIG_ATMEL_DATAFLASH_SPI) += atmel_dataflash_spi.o
 COBJS-$(CONFIG_ATMEL_SPI) += atmel_spi.o
 COBJS-$(CONFIG_BFIN_SPI) += bfin_spi.o
+COBJS-$(CONFIG_BFIN_SPI6XX) += bfin_spi6xx.o
 COBJS-$(CONFIG_CF_SPI) += cf_spi.o
 COBJS-$(CONFIG_CF_QSPI) += cf_qspi.o
 COBJS-$(CONFIG_DAVINCI_SPI) += davinci_spi.o
drivers/spi/bfin_spi6xx.c new file +308 -0

308 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#32 lore raw

PATCH 9/11 Blackfin: spi: add bf6xx spi driver

Dear Sonic Zhang,

Quoted 4 lines · In message <[email protected]> you wrote:

From: Scott Jiang <[email protected]>

Spi driver for bf60x is different from old one, so implement a new driver for it.

Checkpatch issues, please fix.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
A Chairman was as necessary to a Board planet  as  the  zero  was  in
mathematics, but being a zero had big disadvantages...
                         - Terry Pratchett, _The Dark Side of the Sun_
#33 lore raw

PATCH 9/11 Blackfin: spi: add bf6xx spi driver

Quoted 10 lines · Wolfgang Denk

Dear Sonic Zhang,

Quoted 4 lines · In message <[email protected]> you wrote:

From: Scott Jiang <[email protected]>

Spi driver for bf60x is different from old one, so implement a new driver for it.

Checkpatch issues, please fix.

Could the checkpatch warning "line over 80 characters" in head file Macro definition be ignored? I think put the explanation and the definition on the same line is more clean than to chopping to 80.

#define SPI_CTL_FIFO0 0x00000000 /* FCWM: TFIFO empty
or RFIFO Full */
#define SPI_CTL_FIFO1 0x00010000 /* FCWM: TFIFO 75%
or more empty or RFIFO 75% or more full */
#define SPI_CTL_FIFO2 0x00020000 /* FCWM: TFIFO 50%
or more empty or RFIFO 50% or more full */

Regards,

Sonic

#34 lore raw

PATCH 9/11 Blackfin: spi: add bf6xx spi driver

Dear Sonic Zhang,

Quoted 6 lines · In message <CAJxxZ0OLH71+HCkGiR1CdFApdqqY4fKoa3e_mjvhozUSa=sEzg@mail.gmail.com>…
Quoted 3 lines

Checkpatch issues, please fix.

Could the checkpatch warning "line over 80 characters" in head file Macro definition be ignored? I think put the explanation and the definition on the same line is more clean than to chopping to 80.

No. It is more or less a mandatory requirement.

Quoted 6 lines

#define SPI_CTL_FIFO0 0x00000000 /* FCWM: TFIFO empty
or RFIFO Full */
#define SPI_CTL_FIFO1 0x00010000 /* FCWM: TFIFO 75%
or more empty or RFIFO 75% or more full */
#define SPI_CTL_FIFO2 0x00020000 /* FCWM: TFIFO 50%
or more empty or RFIFO 50% or more full */

There ius no need for so much white speace between name and value; and explanation can be given in a much terse way, or summarized in a comment preceeding these defines.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
There were meetings. There were always meetings. And they were  dull,
which is part of the reason they were meetings. Dull likes company.
                                    - Terry Pratchett, _Making_Money_
#35 lore raw

PATCH 10/11 Blackfin: bf60x: add hw watchdog support

In reply to Sonic Zhang

From: Bob Liu <[email protected]>

---
 arch/blackfin/cpu/initcode.c  |   13 +++++++++++++
 arch/blackfin/cpu/start.S     |    2 ++
 include/configs/bf609-ezkit.h |    1 +
 3 files changed, 16 insertions(+), 0 deletions(-)
arch/blackfin/cpu/initcode.c +13 -0
index acfa475..5ee2203 100644
@@ -461,8 +461,21 @@ program_early_devices(ADI_BOOT_DATA *bs, uint *sdivB, uint *divB, uint *vcoB)
 	 */
 	if (CONFIG_BFIN_BOOT_MODE != BFIN_BOOT_BYPASS) {
 		serial_putc('e');
+#ifdef __ADSPBF60x__
+		bfin_write_SEC_GCTL(0x2);
+		SSYNC();
+		bfin_write_SEC_FCTL(0xc1);
+		bfin_write_SEC_SCTL(2, bfin_read_SEC_SCTL(2) | 0x6);
+
+		bfin_write_SEC_CCTL(0x2);
+		SSYNC();
+		bfin_write_SEC_GCTL(0x1);
+		bfin_write_SEC_CCTL(0x1);
+#endif
 		bfin_write_WDOG_CNT(MSEC_TO_SCLK(CONFIG_HW_WATCHDOG_TIMEOUT_INITCODE));
+#if CONFIG_BFIN_BOOT_MODE != BFIN_BOOT_UART
 		bfin_write_WDOG_CTL(0);
+#endif
 		serial_putc('f');
 	}
 #endif
arch/blackfin/cpu/start.S +2 -0
index 90b4d1a..7155fc8 100644
@@ -65,6 +65,7 @@ ENTRY(_start)
 	p5.h = HI(COREMMR_BASE);
 
 #ifdef CONFIG_HW_WATCHDOG
+#ifndef __ADSPBF60x__
 # ifndef CONFIG_HW_WATCHDOG_TIMEOUT_START
 #  define CONFIG_HW_WATCHDOG_TIMEOUT_START 5000
 # endif
@@ -78,6 +79,7 @@ ENTRY(_start)
 	/* fire up the watchdog - R0.L above needs to be 0x0000 */
 	W[p4 + (WDOG_CTL - SYSMMR_BASE)] = r0;
 #endif
+#endif
 
 	/* Turn on the serial for debugging the init process */
 	serial_early_init
include/configs/bf609-ezkit.h +1 -0
index a599127..0b5859f 100644
@@ -67,6 +67,7 @@
 #define CONFIG_SYS_MONITOR_LEN	(768 * 1024)
 #define CONFIG_SYS_MALLOC_LEN	(512 * 1024)
 
+#define CONFIG_HW_WATCHDOG
 /*
  * Network Settings
  */
Signature · 1 line
1.7.0.4
#36 lore raw

PATCH 11/11 Blackfin: bf60x: add resume from hibernate

In reply to Sonic Zhang

From: Steven Miao <[email protected]>

Add Bf60x resume from hibernate support

---
 arch/blackfin/cpu/initcode.c |   44 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 44 insertions(+), 0 deletions(-)
arch/blackfin/cpu/initcode.c +44 -0
index 5ee2203..1d293cc 100644
@@ -509,6 +509,11 @@ maybe_self_refresh(ADI_BOOT_DATA *bs)
 		return false;
 
 #ifdef __ADSPBF60x__
+	/* resume from hibernate, return false let ddr initialize */
+	if ((bfin_read32(DPM0_STAT) & 0xF0) == 0x50) {
+		serial_putc('b');
+		return false;
+	}
 
 #else /* __ADSPBF60x__ */
 
@@ -823,6 +828,7 @@ program_memory_controller(ADI_BOOT_DATA *bs, bool put_into_srfs)
 	while (!(bfin_read_DMC0_STAT() & DLLCALDONE))
 		continue;
 	serial_putc('!');
+
 #else /* __ADSPBF60x__ */
 
 	/* Program the external memory controller before we come out of
@@ -890,7 +896,44 @@ check_hibernation(ADI_BOOT_DATA *bs, u16 vr_ctl, bool put_into_srfs)
 		return;
 
 	serial_putc('b');
+#ifdef __ADSPBF60x__
+	if (bfin_read32(DPM0_RESTORE0) != 0) {
+		uint32_t reg = bfin_read_DMC0_CTL();
+		reg &= ~0x8;
+		bfin_write_DMC0_CTL(reg);
+
+		while ((bfin_read_DMC0_STAT() & 0x8))
+			continue;
+		while (!(bfin_read_DMC0_STAT() & 0x1))
+			continue;
 
+		serial_putc('z');
+		uint32_t *hibernate_magic = bfin_read32(DPM0_RESTORE4);
+		SSYNC(); /* make sure memory controller is done */
+		if (hibernate_magic[0] == 0xDEADBEEF) {
+			serial_putc('c');
+			SSYNC();
+			bfin_write_EVT15(hibernate_magic[1]);
+			bfin_write_IMASK(EVT_IVG15);
+			__asm__ __volatile__ (
+				/* load reti early to avoid anomaly 281 */
+				"reti = %2;"
+				/* clear hibernate magic */
+				"[%0] = %1;"
+				/* load stack pointer */
+				"SP = [%0 + 8];"
+				/* lower ourselves from reset ivg to ivg15 */
+				"raise 15;"
+				"nop;nop;nop;"
+				"rti;"
+				:
+				: "p"(hibernate_magic), "d"(0x2000 /* jump.s 0 */), "d"(0xffa00000)
+			);
+		}
+
+
+	}
+#else
 	/* Are we coming out of hibernate (suspend to memory) ?
 	 * The memory layout is:
 	 * 0x0: hibernate magic for anomaly 307 (0xDEADBEEF)
@@ -922,6 +965,7 @@ check_hibernation(ADI_BOOT_DATA *bs, u16 vr_ctl, bool put_into_srfs)
 		}
 		serial_putc('d');
 	}
+#endif
 
 	serial_putc('e');
 }
Signature · 1 line
1.7.0.4
#37 lore raw

PATCH 11/11 Blackfin: bf60x: add resume from hibernate

Dear Sonic Zhang,

Quoted 7 lines · In message <[email protected]> you wrote:

From: Steven Miao <[email protected]>

Add Bf60x resume from hibernate support

Checkpatch issues, please fix.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
In the future, you're going to get computers as prizes  in  breakfast
cereals.  You'll  throw  them out because your house will be littered
with them.                                             - Robert Lucky
#38 lore raw

cover Add BF60x processor support to Blackfin architecture.

In reply to Sonic Zhang

Dear Sonic Zhang,

Quoted 4 lines · In message <[email protected]> you wrote:

ADSP-BF60x is the new generation Blackfin? dual-core processor announced by Analog Devices in late March, 2012. This patch set adds BF60x processor support to Das U-Boot Blackfin architecture.

It appears there are a number of chackpatch issues with this series.

Please read http://www.denx.de/wiki/U-Boot/Patches and follow the rules.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
As far as we know, our computer has never had an undetected error.
		                                           -- Weisert
#39 lore raw

cover Add BF60x processor support to Blackfin architecture.

Hi Sonic,

Quoted 4 lines · Wolfgang Denk

Dear Sonic Zhang,

Quoted 1 line · In message <[email protected]> you wrote:
Quoted 8 lines
Quoted 3 lines

ADSP-BF60x is the new generation Blackfin? dual-core processor announced by Analog Devices in late March, 2012. This patch set adds BF60x processor support to Das U-Boot Blackfin architecture.

It appears there are a number of chackpatch issues with this series.

Please read http://www.denx.de/wiki/U-Boot/Patches and follow the rules.

Also read http://www.denx.de/wiki/U-Boot/Custodians : this series should have been addressed To: the Blackfin, not ARM, custodian.

Quoted 3 lines

Best regards,

Wolfgang Denk

Amicalement,

Signature · 1 line
Albert.