Skip to contentSkip to conversation

Blackfin: add new processor and board

PATCH New Bob Liu 1 participant 13 messages Nov 14, 2012

Subsystems (2)
lore
Share & tools
lore

Bob Liu

author
#0 lore raw

v3 cover Blackfin: add new processor and board

Blackfin bf60x is a new processor for blackfin.
This series patches add some basic support for it with a bf609-ezkit reference board.

I got some suggestion in the former commit. Some of them are fixed, but some is still not clear.
Since it's a long time ago, i send out V3 for feedback.

Bob Liu (7):
Blackfin: bf60x: new processor header files
Blackfin: bf60x: add dma support
Blackfin: bf60x: support big cplb page
Blackfin: bf60x: add gpio support
Blackfin: bf60x: core support
blackfin: bf609: add board support
Blackfin: bf60x: add hw watchdog support

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

Sonic Zhang (3):
Blackfin: bf60x: add serial support
Blackfin: bf60x: add rsi/sdh support
Blackfin: bf609-ezkit: implement soft switch

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

 MAINTAINERS                                        |    1 +
 arch/blackfin/cpu/cpu.c                            |    4 +-
 arch/blackfin/cpu/gpio.c                           |   36 +-
 arch/blackfin/cpu/initcode.c                       |  365 +-
 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-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 +
 board/bf609-ezkit/soft_switch.c                    |  169 +
 board/bf609-ezkit/soft_switch.h                    |   71 +
 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                      |  175 +
 include/configs/bfin_adi_common.h                  |    8 +-
 47 files changed, 7611 insertions(+), 420 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 board/bf609-ezkit/soft_switch.c
 create mode 100644 board/bf609-ezkit/soft_switch.h
 create mode 100644 drivers/spi/bfin_spi6xx.c
 create mode 100644 include/configs/bf609-ezkit.h
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH v3 1/12 Blackfin: Bf60x: new processor header files

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 deletion(-)
 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.9.5

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

author
#2 lore raw

PATCH v3 2/12 Blackfin: bf60x: add serial support

In reply to Bob Liu

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-common/bits/uart4.h |   66 +++++
 5 files changed, 545 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 6603dc0..7d4dad9 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 serial_register_bfin_uart(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 serial_register_bfin_uart(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-common/bits/uart4.h new file +66 -0

66 lines not on this page · raw message

Signature · 1 line
1.7.9.5
author
#3 lore raw

PATCH v3 3/12 Blackfin: bf60x: add dma support

In reply to Bob Liu

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.9.5
author
#4 lore raw

PATCH v3 4/12 Blackfin: bf60x: support big cplb page

In reply to Bob Liu

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 c380d27..32c5fc9 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.9.5
author
#5 lore raw

PATCH v3 5/12 Blackfin: bf60x: add rsi/sdh support

In reply to Bob Liu

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.9.5
author
#6 lore raw

PATCH v3 6/12 Blackfin: bf609-ezkit: implement soft switch

In reply to Bob Liu

From: Sonic Zhang <[email protected]>

Set up soft switch pins properly in board init code.

---
 board/bf609-ezkit/soft_switch.c |  169 +++++++++++++++++++++++++++++++++++++++
 board/bf609-ezkit/soft_switch.h |   71 ++++++++++++++++
 2 files changed, 240 insertions(+)
 create mode 100644 board/bf609-ezkit/soft_switch.c
 create mode 100644 board/bf609-ezkit/soft_switch.h
board/bf609-ezkit/soft_switch.c new file +169 -0
new file mode 100644
index 0000000..1e83e1d
@@ -0,0 +1,169 @@
+/*
+ * U-boot - main board file
+ *
+ * Copyright (c) 2008-2011 Analog Devices Inc.
+ *
+ * Licensed under the GPL-2 or later.
+ */
+
+#include <common.h>
+#include <asm/blackfin.h>
+#include <asm/io.h>
+#include <i2c.h>
+#include "soft_switch.h"
+
+#define SWITCH_ADDR     0x21
+
+#define NUM_SWITCH      3
+#define IODIRA          0x0
+#define IODIRB          0x1
+#define OLATA           0x14
+#define OLATB           0x15
+
+struct switch_config {
+	uchar dir0; /* IODIRA */
+	uchar dir1; /* IODIRB */
+	uchar value0; /* OLATA */
+	uchar value1; /* OLATB */
+};
+
+static struct switch_config switch_config_array[NUM_SWITCH] = {
+	{
+/*
+	U45 Port A                                  U45 Port B
+
+	7---------------  RMII_CLK_EN       |       7--------------- ~TEMP_THERM_EN
+	| 6------------- ~CNT0ZM_EN         |       | 6------------- ~TEMP_IRQ_EN
+	| | 5----------- ~CNT0DG_EN         |       | | 5----------- ~UART0CTS_146_EN
+	| | | 4--------- ~CNT0UD_EN         |       | | | 4--------- ~UART0CTS_RST_EN
+	| | | | 3------- ~CAN0RX_EN         |       | | | | 3------- ~UART0CTS_RTS_LPBK
+	| | | | | 2----- ~CAN0_ERR_EN       |       | | | | | 2----- ~UART0CTS_EN
+	| | | | | | 1--- ~CAN_STB           |       | | | | | | 1--- ~UART0RX_EN
+	| | | | | | | 0-  CAN_EN            |       | | | | | | | 0- ~UART0RTS_EN
+	| | | | | | | |                     |       | | | | | | | |
+	O O O O O O O O                     |       O O O O O O O O     ( I/O direction )
+	1 0 0 0 0 0 1 1                     |       1 1 1 1 1 0 0 0     ( value being set )
+*/
+		.dir0 = 0x0, /* all output */
+		.dir1 = 0x0, /* all output */
+		.value0 = RMII_CLK_EN | CAN_STB | CAN_EN,
+		.value1 = TEMP_THERM_EN | TEMP_IRQ_EN | UART0CTS_146_EN
+				| UART0CTS_RST_EN | UART0CTS_RTS_LPBK,
+	},
+	{
+/*
+	U46 Port A                                  U46 Port B
+
+	7--------------- ~LED4_GPIO_EN          |       7---------------  EMPTY
+	| 6------------- ~LED3_GPIO_EN          |       | 6------------- ~SPI0D3_EN
+	| | 5----------- ~LED2_GPIO_EN          |       | | 5----------- ~SPI0D2_EN
+	| | | 4--------- ~LED1_GPIO_EN          |       | | | 4--------- ~SPIFLASH_CS_EN
+	| | | | 3-------  SMC0_LP0_EN           |       | | | | 3------- ~SD_WP_EN
+	| | | | | 2-----  EMPTY                 |       | | | | | 2----- ~SD_CD_EN
+	| | | | | | 1---  SMC0_EPPI2_LP1_SWITCH |       | | | | | | 1--- ~PUSHBUTTON2_EN
+	| | | | | | | 0-  OVERRIDE_SMC0_LP0_BOOT|       | | | | | | | 0- ~PUSHBUTTON1_EN
+	| | | | | | | |                         |       | | | | | | | |
+	O O O O O O O O                         |       O O O O O O O O     ( I/O direction )
+	0 0 0 0 0 X 0 1                         |       X 0 0 0 0 0 0 0     ( value being set )
+*/
+		.dir0 = 0x0, /* all output */
+		.dir1 = 0x0, /* all output */
+#ifdef CONFIG_BFIN_LINKPORT
+		.value0 = OVERRIDE_SMC0_LP0_BOOT,
+#else
+		.value0 = SMC0_EPPI2_LP1_SWITCH,
+#endif
+		.value1 = 0x0,
+	},
+	{
+/*
+	U47 Port A                                                  U47 Port B
+
+	7--------------- ~PD2_SPI0MISO_EI3_EN                   |       7---------------  EMPTY
+	| 6------------- ~PD1_SPI0D3_EPPI1D17_SPI0SEL2_EI3_EN   |       | 6-------------  EMPTY
+	| | 5----------- ~PD0_SPI0D2_EPPI1D16_SPI0SEL3_EI3_EN   |       | | 5-----------  EMPTY
+	| | | 4--------- ~WAKE_PUSHBUTTON_EN                    |       | | | 4---------  EMPTY
+	| | | | 3------- ~ETHERNET_EN                           |       | | | | 3-------  EMPTY
+	| | | | | 2-----  PHYAD0                                |       | | | | | 2-----  EMPTY
+	| | | | | | 1---  PHY_PWR_DWN_INT                       |       | | | | | | 1--- ~PD4_SPI0CK_EI3_EN
+	| | | | | | | 0- ~PHYINT_EN                             |       | | | | | | | 0- ~PD3_SPI0MOSI_EI3_EN
+	| | | | | | | |                                         |       | | | | | | | |
+	O O O O O I I O                                         |       O O O O O O O O     ( I/O direction )
+	1 1 1 0 0 0 0 0                                         |       X X X X X X 1 1     ( value being set )
+*/
+		.dir0 = 0x6, /* bits 1 and 2 input, all others output */
+		.dir1 = 0x0, /* all output */
+		.value0 = PD1_SPI0D3_EN | PD0_SPI0D2_EN,
+		.value1 = 0,
+	},
+};
+
+static int setup_soft_switch(int addr, struct switch_config *config)
+{
+	int ret = 0;
+
+	ret = i2c_write(addr, OLATA, 1, &config->value0, 1);
+	if (ret)
+		return ret;
+	ret = i2c_write(addr, OLATB, 1, &config->value1, 1);
+	if (ret)
+		return ret;
+
+	ret = i2c_write(addr, IODIRA, 1, &config->dir0, 1);
+	if (ret)
+		return ret;
+	return i2c_write(addr, IODIRB, 1, &config->dir1, 1);
+}
+
+int config_switch_bit(int num, int port, int bit, int dir, uchar value)
+{
+	int addr = SWITCH_ADDR + num;
+	int ret, data_reg, dir_reg;
+	uchar tmp;
+
+	if (port == IO_PORT_A) {
+		data_reg = OLATA;
+		dir_reg = IODIRA;
+	} else {
+		data_reg = OLATB;
+		dir_reg = IODIRB;
+	}
+
+	if (dir == IO_PORT_INPUT) {
+		ret = i2c_read(addr, dir_reg, 1, &tmp, 1);
+		if (ret)
+			return ret;
+		tmp |= bit;
+		return i2c_write(addr, dir_reg, 1, &tmp, 1);
+	} else {
+		ret = i2c_read(addr, data_reg, 1, &tmp, 1);
+		if (ret)
+			return ret;
+		if (value)
+			tmp |= bit;
+		else
+			tmp &= ~bit;
+		ret = i2c_write(addr, data_reg, 1, &tmp, 1);
+		if (ret)
+			return ret;
+		ret = i2c_read(addr, dir_reg, 1, &tmp, 1);
+		if (ret)
+			return ret;
+		tmp &= ~bit;
+		return i2c_write(addr, dir_reg, 1, &tmp, 1);
+	}
+}
+
+int setup_board_switches(void)
+{
+	int ret;
+	int i;
+
+	for (i = 0; i < NUM_SWITCH; i++) {
+		ret = setup_soft_switch(SWITCH_ADDR + i,
+				&switch_config_array[i]);
+		if (ret)
+			return ret;
+	}
+	return 0;
+}
board/bf609-ezkit/soft_switch.h new file +71 -0

71 lines not on this page · raw message

Signature · 1 line
1.7.9.5
author
#7 lore raw

PATCH v3 7/12 Blackfin: spi: add bf6xx spi driver

In reply to Bob Liu

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(+)
 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 c20f1f2..bec7de7 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_DAVINCI_SPI) += davinci_spi.o
 COBJS-$(CONFIG_KIRKWOOD_SPI) += kirkwood_spi.o
drivers/spi/bfin_spi6xx.c new file +308 -0

308 lines not on this page · raw message

Signature · 1 line
1.7.9.5
author
#8 lore raw

PATCH v3 8/12 Blackfin: bf60x: add gpio support

In reply to Bob Liu
---
 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.9.5
author
#9 lore raw

PATCH v3 9/12 Blackfin: bf60x: core support

In reply to Bob Liu

Core changed for supporting bf60x.

---
 arch/blackfin/cpu/cpu.c                |    4 +-
 arch/blackfin/cpu/initcode.c           |  308 ++++++++++++++++++++++++++++++--
 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, 473 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 +293 -15

466 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 4ce67d4..88aa1da 100644
@@ -31,6 +31,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)
@@ -49,6 +51,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 32c5fc9..f72068a 100644
@@ -310,7 +310,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 908876c..ef49017 100644
@@ -190,7 +190,7 @@ int do_reginfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 #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());
@@ -226,7 +226,24 @@ int do_reginfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	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.9.5
author
#10 lore raw

PATCH v3 10/12 blackfin: bf609: add board support

In reply to Bob Liu

Board files for bf609-ezkit support.

---
 MAINTAINERS                       |    1 +
 board/bf609-ezkit/Makefile        |   55 ++++++++++++
 board/bf609-ezkit/bf609-ezkit.c   |   67 ++++++++++++++
 boards.cfg                        |    1 +
 include/configs/bf609-ezkit.h     |  174 +++++++++++++++++++++++++++++++++++++
 include/configs/bfin_adi_common.h |    8 +-
 6 files changed, 302 insertions(+), 4 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 +1 -0
index fd0c65c..2c447d4 100644
@@ -1154,6 +1154,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 2d36d83..8d275a3 100644
@@ -313,6 +313,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 +174 -0

174 lines not on this page · raw message

include/configs/bfin_adi_common.h +4 -4
index 3fbf5c6..a32d741 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.9.5
author
#11 lore raw

PATCH v3 11/12 Blackfin: bf60x: add hw watchdog support

In reply to Bob Liu
---
 arch/blackfin/cpu/initcode.c  |   13 +++++++++++++
 arch/blackfin/cpu/start.S     |    2 ++
 include/configs/bf609-ezkit.h |    1 +
 3 files changed, 16 insertions(+)
arch/blackfin/cpu/initcode.c +13 -0
index 3bbdf22..6740e34 100644
@@ -456,8 +456,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 939459a..d6f5190 100644
@@ -73,6 +73,7 @@
 #define CONFIG_SYS_MONITOR_LEN	(512 * 1024)
 #define CONFIG_SYS_MALLOC_LEN	(256 * 1024)
 
+#define CONFIG_HW_WATCHDOG
 /*
  * Network Settings
  */
Signature · 1 line
1.7.9.5
author
#12 lore raw

PATCH v3 12/12 Blackfin: bf60x: add resume from hibernate

In reply to Bob Liu

From: Steven Miao <[email protected]>

Add Bf60x resume from hibernate support

---
 arch/blackfin/cpu/initcode.c |   44 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)
arch/blackfin/cpu/initcode.c +44 -0
index 6740e34..3fd6d84 100644
@@ -504,6 +504,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__ */
 
@@ -818,6 +823,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
@@ -885,7 +891,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)
@@ -917,6 +960,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.9.5