Skip to contentSkip to conversation

Blackfin: BF60x: new processor port

PATCH New Bob Liu 2 participants 44 messages Aug 7, 2012 – Aug 23, 2012

Subsystems (2)
lore
Share & tools
lore

Bob Liu

author
#0 lore raw

PATCH 1/16 Blackfin: BF60x: new processor port

From: Mike Frysinger <[email protected]>

Add basic support for blackfin new processor BF60x.

---
 arch/blackfin/cpu/cpu.c                            |    4 +-
 arch/blackfin/cpu/gpio.c                           |   36 +-
 arch/blackfin/cpu/initcode.c                       |   53 +-
 arch/blackfin/cpu/reset.c                          |    2 +
 arch/blackfin/cpu/serial.c                         |   65 +-
 arch/blackfin/cpu/serial.h                         |  222 +-
 arch/blackfin/cpu/serial1.h                        |  236 ++
 arch/blackfin/cpu/serial4.h                        |  113 +
 arch/blackfin/include/asm/blackfin_cdef.h          |    3 +
 arch/blackfin/include/asm/blackfin_def.h           |    5 +
 arch/blackfin/include/asm/blackfin_local.h         |    2 +
 arch/blackfin/include/asm/dma.h                    |  113 +-
 arch/blackfin/include/asm/gpio.h                   |    2 +-
 arch/blackfin/include/asm/mach-bf609/BF609_cdef.h  |  540 +++
 arch/blackfin/include/asm/mach-bf609/BF609_def.h   | 3752 ++++++++++++++++++++
 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     |  251 ++
 arch/blackfin/include/asm/mach-bf609/ports.h       |   63 +
 arch/blackfin/include/asm/mach-common/bits/cgu.h   |   78 +
 arch/blackfin/include/asm/mach-common/bits/dde.h   |   88 +
 arch/blackfin/include/asm/mach-common/bits/dma.h   |    1 +
 arch/blackfin/include/asm/mach-common/bits/pll.h   |    5 +
 arch/blackfin/include/asm/mach-common/bits/uart4.h |   66 +
 arch/blackfin/lib/board.c                          |    2 +-
 arch/blackfin/lib/clocks.c                         |  128 +-
 arch/blackfin/lib/string.c                         |   97 +-
 include/configs/bfin_adi_common.h                  |    2 +
 29 files changed, 5843 insertions(+), 370 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/uart4.h
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/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/cpu/initcode.c +42 -11

129 lines not on this page · raw message

arch/blackfin/cpu/reset.c +2 -0
index ff39035..33df0fc 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,6 +67,7 @@ static void bfin_reset(void)
 		: "a" (15 * 1)
 		: "LC1", "LB1", "LT1"
 	);
+#endif
 
 	while (1)
 		/* Issue core reset */
arch/blackfin/cpu/serial.c +41 -24

162 lines not on this page · raw message

arch/blackfin/cpu/serial.h +16 -206

261 lines not on this page · raw message

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

236 lines not on this page · raw message

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

113 lines not on this page · raw message

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 +2 -0
index 49d0c9e..1ca5440 100644
@@ -61,6 +61,8 @@
 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);
 
 # define bfin_revid() (bfin_read_CHIPID() >> 28)
 
arch/blackfin/include/asm/dma.h +61 -52

129 lines not on this page · raw message

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/BF609_cdef.h new file +540 -0

540 lines not on this page · raw message

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

1,268 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/gpio.h new file +151 -0

151 lines not on this page · raw message

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

251 lines not on this page · raw message

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

63 lines not on this page · raw message

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

78 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/dma.h +1 -0
index 136313e..ee209c6 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.

arch/blackfin/include/asm/mach-common/bits/uart4.h new file +66 -0

66 lines not on this page · raw message

arch/blackfin/lib/board.c +1 -1
index c380d27..cfb38e8 100644

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

arch/blackfin/lib/clocks.c +106 -22

128 lines not on this page · raw message

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

97 lines not on this page · raw message

include/configs/bfin_adi_common.h +2 -0
index 3fbf5c6..5cec778 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
#1 lore raw

PATCH 2/16 Blackfin: bf609-ezkit: new board port

From: Mike Frysinger <[email protected]>

Add basic support for new board bf609-ezkit.

---
 arch/blackfin/cpu/initcode.c                   |   96 ++++++++++-----
 arch/blackfin/cpu/initcode.h                   |    9 ++
 arch/blackfin/cpu/serial1.h                    |   19 +++
 arch/blackfin/cpu/serial4.h                    |   35 +++++-
 arch/blackfin/include/asm/mach-bf609/portmux.h |    5 +
 arch/blackfin/include/asm/mach-bf609/ports.h   |   56 +++++++--
 board/bf609-ezkit/Makefile                     |   54 +++++++++
 board/bf609-ezkit/bf609-ezkit.c                |   63 ++++++++++
 boards.cfg                                     |    1 +
 common/cmd_reginfo.c                           |    4 +-
 include/configs/bf609-ezkit.h                  |  148 ++++++++++++++++++++++++
 11 files changed, 446 insertions(+), 44 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
arch/blackfin/cpu/initcode.c +66 -30
index ae3fe7a..9888f10 100644
@@ -23,16 +23,18 @@
 
 #include "serial.h"
 
-#if 0
-
+#ifndef __ADSPBF60x__
 #include <asm/mach-common/bits/pll.h>
+#else
+#include <asm/mach-common/bits/cgu.h>
+#endif
 
 __attribute__((always_inline))
 static inline void serial_init(void)
 {
 	uint32_t uart_base = UART_BASE;
 
-#ifdef __ADSPBF54x__
+#if defined(__ADSPBF54x__) || defined(__ADSPBF60x__)
 # ifdef BFIN_BOOT_UART_USE_RTS
 #  define BFIN_UART_USE_RTS 1
 # else
@@ -42,7 +44,11 @@ static inline void serial_init(void)
 		size_t i;
 
 		/* force RTS rather than relying on auto RTS */
+#if BFIN_UART_HW_VER < 4
 		bfin_write16(&pUART->mcr, bfin_read16(&pUART->mcr) | FCPOL);
+#else
+		bfin_write32(&pUART->control, bfin_read32(&pUART->control) | FCPOL);
+#endif
 
 		/* Wait for the line to clear up.  We cannot rely on UART
 		 * registers as none of them reflect the status of the RSR.
@@ -86,12 +92,16 @@ static inline void serial_init(void)
 __attribute__((always_inline))
 static inline void serial_deinit(void)
 {
-#ifdef __ADSPBF54x__
+#if defined(__ADSPBF54x__) || defined(__ADSPBF60x__)
 	uint32_t uart_base = UART_BASE;
 
 	if (BFIN_UART_USE_RTS && CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_UART) {
 		/* clear forced RTS rather than relying on auto RTS */
+#if BFIN_UART_HW_VER < 4
 		bfin_write16(&pUART->mcr, bfin_read16(&pUART->mcr) & ~FCPOL);
+#else
+		bfin_write32(&pUART->control, bfin_read32(&pUART->control) & ~FCPOL);
+#endif
 	}
 #endif
 }
@@ -107,7 +117,7 @@ static inline void serial_putc(char c)
 	if (c == '\n')
 		serial_putc('\r');
 
-	bfin_write16(&pUART->thr, c);
+	bfin_write(&pUART->thr, c);
 
 	while (!(_lsr_read(pUART) & TEMT))
 		continue;
@@ -156,6 +166,25 @@ program_nmi_handler(void)
 # define bfin_write_SPI_BAUD bfin_write_SPI0_BAUD
 #endif
 
+#ifdef __ADSPBF60x__
+
+#ifndef CONFIG_CGU_CTL_VAL
+# define CONFIG_CGU_CTL_VAL ((CONFIG_VCO_MULT << 8) | CONFIG_CLKIN_HALF)
+#endif
+
+#ifndef CONFIG_CGU_DIV_VAL
+# define CONFIG_CGU_DIV_VAL \
+	(1 << UPDT_P) | \
+	((CONFIG_CCLK_DIV   << CSEL_P)   | \
+	 (CONFIG_SCLK0_DIV  << S0SEL_P)  | \
+	 (CONFIG_SCLK_DIV << SYSSEL_P) | \
+	 (CONFIG_SCLK1_DIV  << S1SEL_P)  | \
+	 (CONFIG_DCLK_DIV   << DSEL_P)   | \
+	 (CONFIG_OCLK_DIV   << OSEL_P))
+#endif
+
+#else /* __ADSPBF60x__ */
+
 /* PLL_DIV defines */
 #ifndef CONFIG_PLL_DIV_VAL
 # if (CONFIG_CCLK_DIV == 1)
@@ -279,6 +308,8 @@ program_nmi_handler(void)
 # endif
 #endif
 
+#endif /*  __ADSPBF60x__ */
+
 __attribute__((always_inline)) static inline void
 program_early_devices(ADI_BOOT_DATA *bs, uint *sdivB, uint *divB, uint *vcoB)
 {
@@ -287,8 +318,12 @@ program_early_devices(ADI_BOOT_DATA *bs, uint *sdivB, uint *divB, uint *vcoB)
 	/* Save the clock pieces that are used in baud rate calculation */
 	if (BFIN_DEBUG_EARLY_SERIAL || CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_UART) {
 		serial_putc('b');
+#ifdef __ADSPBF60x__
+
+#else
 		*sdivB = bfin_read_PLL_DIV() & 0xf;
 		*vcoB = (bfin_read_PLL_CTL() >> 9) & 0x3f;
+#endif
 		*divB = serial_early_get_div();
 		serial_putc('c');
 	}
@@ -341,6 +376,10 @@ maybe_self_refresh(ADI_BOOT_DATA *bs)
 	if (!CONFIG_MEM_SIZE)
 		return false;
 
+#ifdef __ADSPBF60x__
+
+#else /* __ADSPBF60x__ */
+
 	/* If external memory is enabled, put it into self refresh first. */
 #if defined(EBIU_RSTCTL)
 	if (bfin_read_EBIU_RSTCTL() & DDR_SRESET) {
@@ -356,6 +395,7 @@ maybe_self_refresh(ADI_BOOT_DATA *bs)
 	}
 #endif
 
+#endif /* __ADSPBF60x__ */
 	serial_putc('c');
 
 	return false;
@@ -368,6 +408,15 @@ program_clocks(ADI_BOOT_DATA *bs, bool put_into_srfs)
 
 	serial_putc('a');
 
+#ifdef __ADSPBF60x__
+
+	bfin_write_CGU_CTL(CONFIG_CGU_CTL_VAL);
+	bfin_write_CGU_DIV(CONFIG_CGU_DIV_VAL);
+	while (!(bfin_read_CGU_STAT() & CLKSALGN))
+		continue;
+
+#else /* __ADSPBF60x__ */
+
 	vr_ctl = bfin_read_VR_CTL();
 
 	serial_putc('b');
@@ -495,6 +544,8 @@ program_clocks(ADI_BOOT_DATA *bs, bool put_into_srfs)
 		serial_putc('n');
 	}
 
+#endif /* __ADSPBF60x__ */
+
 	serial_putc('o');
 
 	return vr_ctl;
@@ -513,14 +564,18 @@ update_serial_clocks(ADI_BOOT_DATA *bs, uint sdivB, uint divB, uint vcoB)
 	if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_UART) {
 		serial_putc('b');
 		unsigned int sdivR, vcoR;
+#ifdef __ADSPBF60x__
+
+#else
 		sdivR = bfin_read_PLL_DIV() & 0xf;
 		vcoR = (bfin_read_PLL_CTL() >> 9) & 0x3f;
+#endif
 		int dividend = sdivB * divB * vcoR;
 		int divisor = vcoB * sdivR;
 		unsigned int quotient;
 		for (quotient = 0; dividend > 0; ++quotient)
 			dividend -= divisor;
-		serial_early_put_div(UART_BASE, quotient - ANOMALY_05000230);
+		serial_early_put_div(quotient - ANOMALY_05000230);
 		serial_putc('c');
 	}
 
@@ -537,6 +592,10 @@ program_memory_controller(ADI_BOOT_DATA *bs, bool put_into_srfs)
 
 	serial_putc('b');
 
+#ifdef __ADSPBF60x__
+
+#else /* __ADSPBF60x__ */
+
 	/* Program the external memory controller before we come out of
 	 * self-refresh.  This only works with our SDRAM controller.
 	 */
@@ -589,6 +648,7 @@ program_memory_controller(ADI_BOOT_DATA *bs, bool put_into_srfs)
 # endif
 #endif
 
+#endif /* __ADSPBF60x__ */
 	serial_putc('e');
 }
 
@@ -696,27 +756,3 @@ void initcode(ADI_BOOT_DATA *bs)
 	serial_deinit();
 }
 
-#else
-
-#include <asm/mach-common/bits/cgu.h>
-
-#ifndef CONFIG_CGU_CTL_VAL
-# define CONFIG_CGU_CTL_VAL ((CONFIG_VCO_MULT << 8) | CONFIG_CLKIN_HALF)
-#endif
-
-#ifndef CONFIG_CGU_DIV_VAL
-# define CONFIG_CGU_DIV_VAL \
-	((CONFIG_CCLK_DIV   << CSEL_P)   | \
-	 (CONFIG_SCLK0_DIV  << S0SEL_P)  | \
-	 (CONFIG_SYSCLK_DIV << SYSSEL_P) | \
-	 (CONFIG_SCLK1_DIV  << S1SEL_P)  | \
-	 (CONFIG_DCLK_DIV   << DSEL_P)   | \
-	 (CONFIG_OCLK_DIV   << OSEL_P))
-#endif
-
-BOOTROM_CALLED_FUNC_ATTR
-void initcode(ADI_BOOT_DATA *bs)
-{
-}
-
-#endif
arch/blackfin/cpu/initcode.h +9 -0
index e0aad6d..d263ab3 100644
@@ -15,6 +15,8 @@
 # define serial_putc(c)
 #endif
 
+#ifndef __ADSPBF60x__
+
 #ifndef CONFIG_EBIU_RSTCTL_VAL
 # define CONFIG_EBIU_RSTCTL_VAL 0 /* only MDDRENABLE is useful */
 #endif
@@ -30,6 +32,8 @@
 # error invalid EBIU_DDRQUE value: must not set reserved bits
 #endif
 
+#endif /* __ADSPBF60x__ */
+
 __attribute__((always_inline)) static inline void
 program_async_controller(ADI_BOOT_DATA *bs)
 {
@@ -45,6 +49,10 @@ program_async_controller(ADI_BOOT_DATA *bs)
 
 	serial_putc('a');
 
+#ifdef __ADSPBF60x__
+
+#else /* __ADSPBF60x__ */
+
 	/* Program the async banks controller. */
 	bfin_write_EBIU_AMBCTL0(CONFIG_EBIU_AMBCTL0_VAL);
 	bfin_write_EBIU_AMBCTL1(CONFIG_EBIU_AMBCTL1_VAL);
@@ -65,6 +73,7 @@ program_async_controller(ADI_BOOT_DATA *bs)
 # endif
 #endif
 
+#endif
 	serial_putc('c');
 }
 
arch/blackfin/cpu/serial1.h +19 -0
index eb169e2..0d038d5 100644
@@ -212,6 +212,25 @@ static inline void serial_early_set_baud(uint32_t uart_base, uint32_t baud)
 }
 
 __attribute__((always_inline))
+static inline void serial_early_put_div(uint16_t divisor)
+{
+	uint32_t uart_base = UART_BASE;
+
+	/* Set DLAB in LCR to Access DLL and DLH */
+	ACCESS_LATCH();
+	SSYNC();
+
+	/* Program the divisor to get the baud rate we want */
+	bfin_write(&pUART->dll, LOB(divisor));
+	bfin_write(&pUART->dlh, HIB(divisor));
+	SSYNC();
+
+	/* Clear DLAB in LCR to Access THR RBR IER */
+	ACCESS_PORT_IER();
+	SSYNC();
+}
+
+__attribute__((always_inline))
 static inline uint16_t serial_early_get_div(void)
 {
 	uint32_t uart_base = UART_BASE;
arch/blackfin/cpu/serial4.h +31 -4
index 088363a..bf4db6f 100644
@@ -43,6 +43,26 @@ typedef uint32_t uart_lsr_t;
 __attribute__((always_inline))
 static inline void serial_early_do_portmux(void)
 {
+#if defined(__ADSPBF60x__)
+# define DO_MUX(port, tx, rx, func) do \
+{\
+	bfin_write_PORT##port##_MUX((bfin_read_PORT##port##_MUX() & ~(PORT_x_MUX_##tx##_MASK | PORT_x_MUX_##rx##_MASK)) | PORT_x_MUX_##tx##_FUNC_##func | PORT_x_MUX_##rx##_FUNC_##func); \
+	bfin_write_PORT##port##_FER_SET(P##port##tx | P##port##rx);\
+} while (0);
+	switch (CONFIG_UART_CONSOLE) {
+	case 0:
+		DO_MUX(D, 7, 8, 2);
+		break; /* Port D; PD7 and PD8; function 2 */
+	case 1:
+		DO_MUX(G, 15, 14, 1);
+		break; /* Port G; PG15 and PH14; function 1 */
+	}
+	SSYNC();
+#else
+# if (P_UART(RX) & P_DEFINED) || (P_UART(TX) & P_DEFINED)
+#  error "missing portmux logic for UART"
+# endif
+#endif
 }
 
 __attribute__((always_inline))
@@ -50,7 +70,7 @@ static inline uint32_t uart_sclk(void)
 {
 #if defined(BFIN_IN_INITCODE) || defined(CONFIG_DEBUG_EARLY_SERIAL)
 	/* We cannot use get_sclk() early on as it uses caches in external memory */
-	return (CONFIG_CLKIN_HZ * CONFIG_VCO_MULT / CONFIG_SYSCLK_DIV / CONFIG_SCLK0_DIV);
+	return (CONFIG_CLKIN_HZ * CONFIG_VCO_MULT / CONFIG_SCLK_DIV / CONFIG_SCLK0_DIV);
 #else
 	return get_sclk0();
 #endif
@@ -94,15 +114,22 @@ static inline int serial_early_enabled(uint32_t uart_base)
 __attribute__((always_inline))
 static inline void serial_early_set_baud(uint32_t uart_base, uint32_t baud)
 {
-	uint32_t divisor = uart_sclk() / baud;
+	uint32_t divisor = uart_sclk() / (baud * 16);
 
 	/* Program the divisor to get the baud rate we want */
-	bfin_write(&pUART->clock, divisor | 0x80000000);
+	bfin_write(&pUART->clock, divisor);
 	SSYNC();
 }
 
 __attribute__((always_inline))
-static inline uint16_t serial_early_get_div(void)
+static inline void serial_early_put_div(uint32_t divisor)
+{
+	uint32_t uart_base = UART_BASE;
+	bfin_write(&pUART->clock, divisor);
+}
+
+__attribute__((always_inline))
+static inline uint32_t serial_early_get_div(void)
 {
 	uint32_t uart_base = UART_BASE;
 	return bfin_read(&pUART->clock);
arch/blackfin/include/asm/mach-bf609/portmux.h +5 -0
index 5356334..1cf6fd8 100644
@@ -33,6 +33,8 @@
 	P_MII0_PHYINT, \
 	P_MII0_CRS, \
 	P_MII0_MDC, \
+	P_PTP0_PPS, \
+	P_PTP1_PPS, \
 	P_MII0_MDIO, 0}
 
 #define P_MII1_MDC	(P_DEFINED | P_IDENT(GPIO_PE10) | P_FUNCT(0))
@@ -244,6 +246,9 @@
 #define P_AMS2		(P_DEFINED | P_IDENT(GPIO_PB4) | P_FUNCT(0))
 #define P_AMS3		(P_DEFINED | P_IDENT(GPIO_PB5) | P_FUNCT(0))
 
+#define P_ABE0		(P_DEFINED | P_IDENT(GPIO_PB4) | P_FUNCT(1))
+#define P_ABE1		(P_DEFINED | P_IDENT(GPIO_PB5) | P_FUNCT(1))
+
 /* CAN */
 #define P_CAN0_TX	(P_DEFINED | P_IDENT(GPIO_PG1) | P_FUNCT(2))
 #define P_CAN0_RX	(P_DEFINED | P_IDENT(GPIO_PG4) | P_FUNCT(2))
arch/blackfin/include/asm/mach-bf609/ports.h +48 -8

68 lines not on this page · raw message

board/bf609-ezkit/Makefile new file +54 -0

54 lines not on this page · raw message

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

63 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
common/cmd_reginfo.c +2 -2
index 908876c..bf94119 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,7 @@ 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
-
+#endif
 #endif /* CONFIG_BLACKFIN */
 
 	return 0;
include/configs/bf609-ezkit.h new file +148 -0

148 lines not on this page · raw message

Signature · 1 line
1.7.9.5
author
#4 lore raw

PATCH 3/16 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                 |   13 +++++++++-
 arch/blackfin/include/asm/mach-common/bits/mpu.h |    6 ++++-
 arch/blackfin/lib/board.c                        |   28 ++++++++++++++++------
 include/configs/bf609-ezkit.h                    |    6 +----
 4 files changed, 39 insertions(+), 14 deletions(-)
arch/blackfin/include/asm/cplb.h +12 -1
index cc21e93..5a0588b 100644
@@ -46,8 +46,11 @@
 #define CPLB_IDOCACHE		CPLB_INOCACHE | CPLB_L1_CHBL
 
 /* Data Attibutes*/
-
+#if defined(__ADSPBF60x__)
+#define SDRAM_IGENERIC          (PAGE_SIZE_16MB | CPLB_L1_CHBL | CPLB_USER_RD | CPLB_VALID)
+#else
 #define SDRAM_IGENERIC          (PAGE_SIZE_4MB | CPLB_L1_CHBL | CPLB_USER_RD | CPLB_VALID)
+#endif
 #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,14 +62,22 @@
 #endif
 
 #ifdef CONFIG_DCACHE_WB		/*Write Back Policy */
+#if defined(__ADSPBF60x__)
+#define SDRAM_DGENERIC          (PAGE_SIZE_16MB | CPLB_L1_CHBL | CPLB_DIRTY | CPLB_SUPV_WR | CPLB_USER_WR | CPLB_USER_RD | CPLB_VALID | ANOMALY_05000158_WORKAROUND)
+#else
 #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)
+#endif
 #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)
 
 #else				/*Write Through */
+#if defined(__ADSPBF60x__)
+#define SDRAM_DGENERIC          (PAGE_SIZE_16MB | CPLB_L1_CHBL | CPLB_WT | CPLB_L1_AOW | CPLB_SUPV_WR | CPLB_USER_RD | CPLB_USER_WR | CPLB_VALID | ANOMALY_05000158_WORKAROUND)
+#else
 #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)
+#endif
 #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)
arch/blackfin/include/asm/mach-common/bits/mpu.h +5 -1
index 39998f8..d067ef9 100644
@@ -70,7 +70,11 @@
 #define PAGE_SIZE_4KB		0x00010000	/* 4 KB page size */
 #define PAGE_SIZE_1MB		0x00020000	/* 1 MB page size */
 #define PAGE_SIZE_4MB		0x00030000	/* 4 MB page size */
-#define PAGE_SIZE_MASK		0x00030000	/* the bits for the page_size field */
+#define PAGE_SIZE_16KB		0x00040000	/* 16 KB page size */
+#define PAGE_SIZE_64KB		0x00050000	/* 64 KB page size */
+#define PAGE_SIZE_16MB		0x00060000	/* 16 MB page size */
+#define PAGE_SIZE_64MB		0x00070000	/* 64 MB page size */
+#define PAGE_SIZE_MASK		0x00070000	/* the bits for the page_size field */
 #define PAGE_SIZE_SHIFT		16
 #define CPLB_L1SRAM		0x00000020	/* 0=SRAM mapped in L1, 0=SRAM not mapped to L1 */
 #define CPLB_PORTPRIO		0x00000200	/* 0=low priority port, 1= high priority port */
arch/blackfin/lib/board.c +21 -7
index cfb38e8..4e44bf0 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,20 @@ 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, PAGE_SIZE_16MB | CPLB_DIRTY | CPLB_SUPV_WR |
+			CPLB_USER_WR | CPLB_USER_RD | CPLB_VALID);
+	++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 +158,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 +173,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) {
include/configs/bf609-ezkit.h +1 -5
index 9b1f6c2..1fc2a18 100644
@@ -62,11 +62,10 @@
 #define CONFIG_BFIN_GET_SCLK0 (get_sclk()/CONFIG_SCLK0_DIV)
 #define CONFIG_BFIN_GET_SCLK1 (get_sclk()/CONFIG_SCLK1_DIV)
 
-
 /*
  * Memory Settings
  */
-#define CONFIG_MEM_SIZE		32
+#define CONFIG_MEM_SIZE		128
 
 #define CONFIG_SMC_GCTL_VAL	0x00000010
 #define CONFIG_SMC_B1CTL_VAL	0x01002001
@@ -76,9 +75,6 @@
 #define CONFIG_SYS_MONITOR_LEN	(256 * 1024)
 #define CONFIG_SYS_MALLOC_LEN	(256 * 1024)
 
-#define CONFIG_ICACHE_OFF
-#define CONFIG_DCACHE_OFF
-
 /*
  * Network Settings
  */
Signature · 1 line
1.7.9.5
author
#8 lore raw

PATCH 4/16 Blackfin: Rsi: add support for bf609-ezkit

In reply to Bob Liu

From: Sonic Zhang <[email protected]>

Add support for bf609-ezkit to board file and mmc driver.

---
 arch/blackfin/include/asm/config-pre.h           |    4 ++
 arch/blackfin/include/asm/mach-common/bits/dma.h |   47 +++++++++++++++++++++-
 arch/blackfin/include/asm/mach-common/bits/sdh.h |   38 ++++++++++++++++-
 board/bf609-ezkit/bf609-ezkit.c                  |    7 ++++
 drivers/mmc/bfin_sdh.c                           |   45 +++++++++++++++------
 include/configs/bf609-ezkit.h                    |    9 ++++-
 6 files changed, 132 insertions(+), 18 deletions(-)
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/include/asm/mach-common/bits/dma.h +45 -2

67 lines not on this page · raw message

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 */
board/bf609-ezkit/bf609-ezkit.c +7 -0
index ceb2eb9..398a6b0 100644
@@ -61,3 +61,10 @@ int board_eth_init(bd_t *bis)
 	return ret;
 }
 #endif
+
+#ifdef CONFIG_BFIN_SDH
+int board_mmc_init(bd_t *bis)
+{
+	return bfin_mmc_init(bis);
+}
+#endif
drivers/mmc/bfin_sdh.c +32 -13

97 lines not on this page · raw message

include/configs/bf609-ezkit.h +8 -1
index 1fc2a18..4dcfeca 100644
@@ -72,7 +72,7 @@
 #define CONFIG_SMC_B1TIM_VAL	0x08070977
 #define CONFIG_SMC_B1ETIM_VAL	0x00092231
 
-#define CONFIG_SYS_MONITOR_LEN	(256 * 1024)
+#define CONFIG_SYS_MONITOR_LEN	(512 * 1024)
 #define CONFIG_SYS_MALLOC_LEN	(256 * 1024)
 
 /*
@@ -117,6 +117,13 @@
 #undef CONFIG_CMD_IMPORTENV
 
 /*
+ * SDH Settings
+ */
+#define CONFIG_GENERIC_MMC
+#define CONFIG_MMC
+#define CONFIG_BFIN_SDH
+
+/*
  * Misc Settings
  */
 #define CONFIG_BOARD_EARLY_INIT_F
Signature · 1 line
1.7.9.5
author
#11 lore raw

PATCH 5/16 Blackfin: Paraflash: add support for bf609-ezkit

In reply to Bob Liu

Add paraflash support for bf609-ezkit to board file.

---
 arch/blackfin/include/asm/mach-bf609/portmux.h |    1 +
 board/bf609-ezkit/bf609-ezkit.c                |    8 +++---
 include/configs/bf609-ezkit.h                  |   35 +++++++++++++++++++-----
 include/configs/bfin_adi_common.h              |    4 ++-
 4 files changed, 36 insertions(+), 12 deletions(-)
arch/blackfin/include/asm/mach-bf609/portmux.h +1 -0
index 1cf6fd8..757570f 100644
@@ -241,6 +241,7 @@
 #define P_A23		(P_DEFINED | P_IDENT(GPIO_PB8) | P_FUNCT(0))
 #define P_A24		(P_DEFINED | P_IDENT(GPIO_PB10) | P_FUNCT(0))
 #define P_A25		(P_DEFINED | P_IDENT(GPIO_PB11) | P_FUNCT(0))
+#define P_NORCK         (P_DEFINED | P_IDENT(GPIO_PB0) | P_FUNCT(0))
 
 #define P_AMS1		(P_DEFINED | P_IDENT(GPIO_PB1) | P_FUNCT(0))
 #define P_AMS2		(P_DEFINED | P_IDENT(GPIO_PB4) | P_FUNCT(0))
board/bf609-ezkit/bf609-ezkit.c +4 -4
index 398a6b0..d701c36 100644
@@ -22,11 +22,11 @@ int checkboard(void)
 int board_early_init_f(void)
 {
 	static const unsigned short pins[] = {
-		P_A4, P_A5, P_A6, P_A7, P_A8, P_A9, P_A10, P_A11, P_A12, P_A13,
-		P_A14, P_A15, P_A16, P_A17, P_A18, P_A19, P_A20, P_A21, P_A22,
-		P_A23, P_A24, P_A25, P_AMS1, P_ABE0, P_ABE1, 0,
+		P_A3, P_A4, P_A5, P_A6, P_A7, P_A8, P_A9, P_A10, P_A11, P_A12,
+		P_A13, P_A14, P_A15, P_A16, P_A17, P_A18, P_A19, P_A20, P_A21,
+		P_A22, P_A23, P_A24, P_A25, P_NORCK, 0,
 	};
-	peripheral_request_list(pins, "smc");
+	peripheral_request_list(pins, "smc0");
 
 	return 0;
 }
include/configs/bf609-ezkit.h +28 -7
index 4dcfeca..91b0cf3 100644
@@ -68,9 +68,9 @@
 #define CONFIG_MEM_SIZE		128
 
 #define CONFIG_SMC_GCTL_VAL	0x00000010
-#define CONFIG_SMC_B1CTL_VAL	0x01002001
-#define CONFIG_SMC_B1TIM_VAL	0x08070977
-#define CONFIG_SMC_B1ETIM_VAL	0x00092231
+#define CONFIG_SMC_B0CTL_VAL	0x01007011
+#define CONFIG_SMC_B0TIM_VAL	0x08170977
+#define CONFIG_SMC_B0ETIM_VAL	0x00092231
 
 #define CONFIG_SYS_MONITOR_LEN	(512 * 1024)
 #define CONFIG_SYS_MALLOC_LEN	(256 * 1024)
@@ -107,14 +107,35 @@
 #define CONFIG_SYS_FLASH_PROTECTION
 #define CONFIG_SYS_MAX_FLASH_BANKS     1
 #define CONFIG_SYS_MAX_FLASH_SECT      131
+#define CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS
 
 /*
  * Env Storage Settings
  */
-#define CONFIG_ENV_IS_NOWHERE
-#define CONFIG_ENV_SIZE 0x600
-#undef CONFIG_CMD_EXPORTENV
-#undef CONFIG_CMD_IMPORTENV
+#if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_SPI_MASTER)
+#define CONFIG_ENV_IS_IN_SPI_FLASH
+#define CONFIG_ENV_OFFSET       0x10000
+#define CONFIG_ENV_SIZE         0x2000
+#define CONFIG_ENV_SECT_SIZE    0x10000
+#define CONFIG_ENV_IS_EMBEDDED_IN_LDR
+#elif (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_NAND)
+#define CONFIG_ENV_IS_IN_NAND
+#define CONFIG_ENV_OFFSET       0x60000
+#define CONFIG_ENV_SIZE         0x20000
+#else
+#define CONFIG_ENV_IS_IN_FLASH
+#define CONFIG_ENV_ADDR         (CONFIG_SYS_FLASH_BASE + CONFIG_ENV_OFFSET)
+#define CONFIG_ENV_OFFSET       0x8000
+#define CONFIG_ENV_SIZE         0x8000
+#define CONFIG_ENV_SECT_SIZE    0x8000
+#define CONFIG_ENV_IS_EMBEDDED_IN_LDR
+#define UBOOT_ENV_UPDATE \
+                "protect off 0xB0000000 +$(filesize);" \
+                "erase 0xB0000000 +$(filesize);" \
+                "cp.b $(loadaddr) 0xB0000000 $(filesize)"
+#endif
+
+#define FLASHBOOT_ENV_SETTINGS "flashboot=bootm 0xB0100000\0"
 
 /*
  * SDH Settings
include/configs/bfin_adi_common.h +3 -1
index 5cec778..164e8ca 100644
@@ -195,10 +195,12 @@
 		"nand erase 0 0x40000;" \
 		"nand write $(loadaddr) 0 0x40000"
 # else
-#  define UBOOT_ENV_UPDATE \
+#  ifndef UBOOT_ENV_UPDATE
+#   define UBOOT_ENV_UPDATE \
 		"protect off 0x20000000 +$(filesize);" \
 		"erase 0x20000000 +$(filesize);" \
 		"cp.b $(loadaddr) 0x20000000 $(filesize)"
+#  endif
 # endif
 # ifdef CONFIG_NETCONSOLE
 #  define NETCONSOLE_ENV \
Signature · 1 line
1.7.9.5
author
#14 lore raw

PATCH 6/16 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/Makefile      |    1 +
 board/bf609-ezkit/bf609-ezkit.c |   22 +++--
 board/bf609-ezkit/soft_switch.c |  173 +++++++++++++++++++++++++++++++++++++++
 board/bf609-ezkit/soft_switch.h |   71 ++++++++++++++++
 include/configs/bf609-ezkit.h   |    6 +-
 5 files changed, 260 insertions(+), 13 deletions(-)
 create mode 100644 board/bf609-ezkit/soft_switch.c
 create mode 100644 board/bf609-ezkit/soft_switch.h
board/bf609-ezkit/Makefile +1 -0
index cde8168..0bb8fe6 100644
@@ -30,6 +30,7 @@ include $(TOPDIR)/config.mk
 LIB	= $(obj)lib$(BOARD).o
 
 COBJS-y	:= $(BOARD).o
+COBJS-$(CONFIG_BFIN_SOFT_SWITCH)   += soft_switch.o
 
 SRCS	:= $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS-y))
board/bf609-ezkit/bf609-ezkit.c +10 -12
index d701c36..d54906b 100644
@@ -11,6 +11,7 @@
 #include <asm/blackfin.h>
 #include <asm/io.h>
 #include <asm/portmux.h>
+#include "soft_switch.h"
 
 int checkboard(void)
 {
@@ -32,30 +33,20 @@ int board_early_init_f(void)
 }
 
 #ifdef CONFIG_DESIGNWARE_ETH
-#define TWI_ADDR 0x20
 int board_eth_init(bd_t *bis)
 {
 	int ret = 0;
-	uchar idira = 0x0;
-	uchar lata = 0xff;
 
 	if (CONFIG_DW_PORTS & 1) {
 		static const unsigned short pins[] = P_RMII0;
 		if (!peripheral_request_list(pins, "emac0")) {
-			/* enable phy clk */
-			ret = i2c_write(TWI_ADDR, 0x0, 1, &idira, 1);
-			if (!ret) {
-				ret = i2c_write(TWI_ADDR, 0x14, 1, &lata, 1);
-				if (!ret)
-					ret += designware_initialize(0, EMAC0_MACCFG, 1, 0);
-			}
+			ret += designware_initialize(0, EMAC0_MACCFG, 1, 0);
 		}
 	}
-
 	if (CONFIG_DW_PORTS & 2) {
 		static const unsigned short pins[] = P_RMII1;
 		if (!peripheral_request_list(pins, "emac1"))
-			ret += designware_initialize(1, EMAC1_MACCFG, 1, 0, 1);
+			ret += designware_initialize(1, EMAC1_MACCFG, 1, 0);
 	}
 
 	return ret;
@@ -68,3 +59,10 @@ int board_mmc_init(bd_t *bis)
 	return bfin_mmc_init(bis);
 }
 #endif
+
+/* miscellaneous platform dependent initialisations */
+int misc_init_r(void)
+{
+	printf("other init\n");
+	return setup_board_switches();
+}
board/bf609-ezkit/soft_switch.c new file +173 -0

173 lines not on this page · raw message

board/bf609-ezkit/soft_switch.h new file +71 -0

71 lines not on this page · raw message

include/configs/bf609-ezkit.h +5 -1
index 91b0cf3..e56916f 100644
@@ -19,6 +19,9 @@
 #define CONFIG_BFIN_BOOT_MODE       BFIN_BOOT_PARA
 
 
+/* For ez-board version 1.0, else undef this */
+#define CONFIG_BFIN_BOARD_VERSION_1_0
+
 /*
  * Clock Settings
  *	CCLK = (CLKIN * VCO_MULT) / CCLK_DIV
@@ -44,7 +47,7 @@
 #define CONFIG_SYSCLK_DIV		3
 /* Values can range from 0-7 (where 0 means 8)				*/
 #define CONFIG_SCLK0_DIV		1
-#define CONFIG_SCLK1_DIV		2
+#define CONFIG_SCLK1_DIV		1
 /* DCLK_DIV controls the DDR clock divider				*/
 /* Values can range from 0-31 (where 0 means 32)			*/
 #define CONFIG_DCLK_DIV			2
@@ -157,6 +160,7 @@
 #define CONFIG_CMD_MEMORY
 
 #define CONFIG_SYS_MEMTEST_END (CONFIG_STACKBASE - 20*1024*1024 + 4)
+#define CONFIG_BFIN_SOFT_SWITCH
 
 #if 0
 #define CONFIG_UART_MEM 1024
Signature · 1 line
1.7.9.5
author
#18 lore raw

PATCH 7/16 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 ++++++++++++++++++++
 include/configs/bf609-ezkit.h                      |    9 +
 4 files changed, 558 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..535a24a
@@ -0,0 +1,240 @@
+/*
+ * Analog Devices 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

include/configs/bf609-ezkit.h +9 -0
index e56916f..c847069 100644
@@ -113,6 +113,15 @@
 #define CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS
 
 /*
+ * SPI Settings
+ */
+#define CONFIG_BFIN_SPI6XX
+#define CONFIG_ENV_SPI_MAX_HZ	30000000
+#define CONFIG_SF_DEFAULT_SPEED	30000000
+#define CONFIG_SPI_FLASH
+#define CONFIG_SPI_FLASH_ALL
+
+/*
  * Env Storage Settings
  */
 #if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_SPI_MASTER)
Signature · 1 line
1.7.9.5
author
#21 lore raw

PATCH 8/16 Blackfin: add more print info for Bf60x

In reply to Bob Liu

Add system0, system1, dclk and cgu print info for Bf60x.

---
 arch/blackfin/lib/board.c     |    6 ++++++
 arch/blackfin/lib/clocks.c    |   10 +++++++++-
 common/cmd_reginfo.c          |   17 +++++++++++++++++
 include/configs/bf609-ezkit.h |    1 +
 4 files changed, 33 insertions(+), 1 deletion(-)
arch/blackfin/lib/board.c +6 -0
index 4e44bf0..e03bd57 100644
@@ -311,7 +311,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 +9 -1
index f867123..519a3e1 100644
@@ -79,7 +79,7 @@ u_long get_cclk(void)
 /* Get the System clock */
 #ifdef CGU_DIV
 
-static u_long cached_sclk_pll_div, cached_sclk, cached_sclk0, cached_sclk1;
+static u_long cached_sclk_pll_div, cached_sclk, cached_sclk0, cached_sclk1, cached_dclk;
 static u_long _get_sclk(u_long *cache)
 {
 	u_long div, ssel;
@@ -132,6 +132,14 @@ u_long get_sclk1(void)
 #endif
 }
 
+u_long get_dclk(void)
+{
+#ifndef CONFIG_BFIN_GET_DCLK
+	return _get_sclk(&cached_dclk);
+#else
+	return CONFIG_BFIN_GET_DCLK;
+#endif
+}
 #else
 
 u_long get_sclk(void)
common/cmd_reginfo.c +17 -0
index bf94119..ef49017 100644
@@ -226,6 +226,23 @@ 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 */
 
include/configs/bf609-ezkit.h +1 -0
index c847069..c7cb834 100644
@@ -64,6 +64,7 @@
 #define CONFIG_BFIN_GET_SCLK (CONFIG_PLL_CLK/CONFIG_SYSCLK_DIV)
 #define CONFIG_BFIN_GET_SCLK0 (get_sclk()/CONFIG_SCLK0_DIV)
 #define CONFIG_BFIN_GET_SCLK1 (get_sclk()/CONFIG_SCLK1_DIV)
+#define CONFIG_BFIN_GET_DCLK (get_cclk()/CONFIG_DCLK_DIV)
 
 /*
  * Memory Settings
Signature · 1 line
1.7.9.5
author
#24 lore raw

PATCH 9/16 Blackfin: Bf60x: add reset support

In reply to Bob Liu
---
 arch/blackfin/cpu/reset.c |    4 ++++
 1 file changed, 4 insertions(+)
arch/blackfin/cpu/reset.c +4 -0
index 33df0fc..b6718d3 100644
@@ -70,8 +70,12 @@ static void bfin_reset(void)
 #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
Signature · 1 line
1.7.9.5
author
#27 lore raw

PATCH 10/16 Blackfin: Bf60x: Check card ready for each RSI command

In reply to Bob Liu

From: Sonic Zhang <[email protected]>

Set up RSI data before sending RSI command if data is applicable.

---
 drivers/mmc/bfin_sdh.c |   23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)
drivers/mmc/bfin_sdh.c +20 -3
index 4dd9b78..f22429a 100644
@@ -79,6 +79,9 @@ sdh_send_cmd(struct mmc *mmc, struct mmc_cmd *mmc_cmd)
 		sdh_cmd |= CMD_RSP;
 	if (flags & MMC_RSP_136)
 		sdh_cmd |= CMD_L_RSP;
+#ifdef RSI_BLKSZ
+	sdh_cmd |= CMD_DATA0_BUSY;
+#endif
 
 	bfin_write_SDH_ARGUMENT(arg);
 	bfin_write_SDH_COMMAND(sdh_cmd);
@@ -113,6 +116,12 @@ sdh_send_cmd(struct mmc *mmc, struct mmc_cmd *mmc_cmd)
 
 	bfin_write_SDH_STATUS_CLR(CMD_SENT_STAT | CMD_RESP_END_STAT |
 				CMD_TIMEOUT_STAT | CMD_CRC_FAIL_STAT);
+#ifdef RSI_BLKSZ
+	/* wait till card ready */
+	while (!(bfin_read_RSI_ESTAT() & SD_CARD_READY))
+		;
+	bfin_write_RSI_ESTAT(SD_CARD_READY);
+#endif
 
 	return ret;
 }
@@ -122,7 +131,6 @@ 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. */
@@ -150,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;
 }
 
 
@@ -160,15 +168,23 @@ static int bfin_sdh_request(struct mmc *mmc, struct mmc_cmd *cmd,
 	u32 status;
 	int ret = 0;
 
+	if (data) {
+		ret = sdh_setup_data(mmc, data);
+		if (ret)
+			return ret;
+	}
+
 	ret = sdh_send_cmd(mmc, cmd);
 	if (ret) {
 		bfin_write_SDH_COMMAND(0);
+		bfin_write_DMA_CONFIG(0);
+		bfin_write_SDH_DATA_CTL(0);
 		SSYNC();
 		printf("sending CMD%d failed\n", cmd->cmdidx);
 		return ret;
 	}
+
 	if (data) {
-		ret = sdh_setup_data(mmc, data);
 		do {
 			udelay(1);
 			status = bfin_read_SDH_STATUS();
@@ -253,6 +269,7 @@ static int bfin_sdh_init(struct mmc *mmc)
 	bfin_write_SDH_PWR_CTL(PWR_ON | ROD_CTL);
 #else
 	bfin_write_SDH_CFG(bfin_read_SDH_CFG() | PWR_ON);
+#endif
 	return 0;
 }
 
Signature · 1 line
1.7.9.5
author
#30 lore raw

PATCH 11/16 Blackfin: Bf60x: support clock init

In reply to Bob Liu

Add a way to set clock to values getting from config file bf609-ezkit.h

---
 arch/blackfin/cpu/initcode.c                     |  221 +++++++++++++++++++++-
 arch/blackfin/include/asm/mach-common/bits/cgu.h |    2 +
 include/configs/bf609-ezkit.h                    |   35 ++--
 3 files changed, 234 insertions(+), 24 deletions(-)
arch/blackfin/cpu/initcode.c +215 -6
index 9888f10..3bb2b98 100644
@@ -29,6 +29,121 @@
 #include <asm/mach-common/bits/cgu.h>
 #endif
 
+#ifdef __ADSPBF60x__
+#define CONFIG_BFIN_GET_DCLK_M 		(CONFIG_BFIN_GET_DCLK/1000000)
+
+#ifndef CONFIG_DMC_DDRCFG
+#if ((CONFIG_BFIN_GET_DCLK_M != 125) && \
+	(CONFIG_BFIN_GET_DCLK_M != 133) && \
+	(CONFIG_BFIN_GET_DCLK_M != 150) && \
+	(CONFIG_BFIN_GET_DCLK_M != 166) && \
+	(CONFIG_BFIN_GET_DCLK_M != 200) && \
+	(CONFIG_BFIN_GET_DCLK_M != 225) && \
+	(CONFIG_BFIN_GET_DCLK_M != 250))
+#error "DDR2 CLK must be in (125, 133, 150, 166, 200, 225, 250)MHz"
+#endif
+#endif
+
+/* DMC status bits */
+#define IDLE                    0x1
+#define MEMINITDONE             0x4
+#define SRACK                   0x8
+#define PDACK                   0x10
+#define DPDACK                  0x20
+#define DLLCALDONE              0x2000
+#define PENDREF                 0xF0000
+#define PHYRDPHASE              0xF00000
+#define PHYRDPHASE_OFFSET       20
+
+/* DMC DLL control bits */
+#define DLLCALRDCNT             0xFF
+#define DATACYC_OFFSET          8
+
+struct ddr_config {
+	u32 ddr_clk;
+	u32 dmc_ddrctl;
+	u32 dmc_ddrcfg;
+	u32 dmc_ddrtr0;
+	u32 dmc_ddrtr1;
+	u32 dmc_ddrtr2;
+	u32 dmc_ddrmr;
+	u32 dmc_ddrmr1;
+};
+
+static struct ddr_config ddr_config_table[] = {
+	[0] = {
+		.ddr_clk    = 125, 	/* 125MHz */
+		.dmc_ddrctl = 0x00000904,
+		.dmc_ddrcfg = 0x00000422,
+		.dmc_ddrtr0 = 0x20705212,
+		.dmc_ddrtr1 = 0x201003CF,
+		.dmc_ddrtr2 = 0x00320107,
+		.dmc_ddrmr  = 0x00000422,
+		.dmc_ddrmr1 = 0x4,
+	},
+	[1] = {
+		.ddr_clk    = 133, 	/* 133MHz */
+		.dmc_ddrctl = 0x00000904,
+		.dmc_ddrcfg = 0x00000422,
+		.dmc_ddrtr0 = 0x20806313,
+		.dmc_ddrtr1 = 0x2013040D,
+		.dmc_ddrtr2 = 0x00320108,
+		.dmc_ddrmr  = 0x00000632,
+		.dmc_ddrmr1 = 0x4,
+	},
+	[2] = {
+		.ddr_clk    = 150, 	/* 150MHz */
+		.dmc_ddrctl = 0x00000904,
+		.dmc_ddrcfg = 0x00000422,
+		.dmc_ddrtr0 = 0x20A07323,
+		.dmc_ddrtr1 = 0x20160492,
+		.dmc_ddrtr2 = 0x00320209,
+		.dmc_ddrmr  = 0x00000632,
+		.dmc_ddrmr1 = 0x4,
+	},
+	[3] = {
+		.ddr_clk    = 166, 	/* 166MHz */
+		.dmc_ddrctl = 0x00000904,
+		.dmc_ddrcfg = 0x00000422,
+		.dmc_ddrtr0 = 0x20A07323,
+		.dmc_ddrtr1 = 0x2016050E,
+		.dmc_ddrtr2 = 0x00320209,
+		.dmc_ddrmr  = 0x00000632,
+		.dmc_ddrmr1 = 0x4,
+	},
+	[4] = {
+		.ddr_clk    = 200, 	/* 200MHz */
+		.dmc_ddrctl = 0x00000904,
+		.dmc_ddrcfg = 0x00000422,
+		.dmc_ddrtr0 = 0x20a07323,
+		.dmc_ddrtr1 = 0x2016050f,
+		.dmc_ddrtr2 = 0x00320509,
+		.dmc_ddrmr  = 0x00000632,
+		.dmc_ddrmr1 = 0x4,
+	},
+	[5] = {
+		.ddr_clk    = 225, 	/* 225MHz */
+		.dmc_ddrctl = 0x00000904,
+		.dmc_ddrcfg = 0x00000422,
+		.dmc_ddrtr0 = 0x20E0A424,
+		.dmc_ddrtr1 = 0x302006DB,
+		.dmc_ddrtr2 = 0x0032020D,
+		.dmc_ddrmr  = 0x00000842,
+		.dmc_ddrmr1 = 0x4,
+	},
+	[6] = {
+		.ddr_clk    = 250, 	/* 250MHz */
+		.dmc_ddrctl = 0x00000904,
+		.dmc_ddrcfg = 0x00000422,
+		.dmc_ddrtr0 = 0x20E0A424,
+		.dmc_ddrtr1 = 0x3020079E,
+		.dmc_ddrtr2 = 0x0032020D,
+		.dmc_ddrmr  = 0x00000842,
+		.dmc_ddrmr1 = 0x4,
+	},
+};
+#endif
+
 __attribute__((always_inline))
 static inline void serial_init(void)
 {
@@ -174,7 +289,6 @@ program_nmi_handler(void)
 
 #ifndef CONFIG_CGU_DIV_VAL
 # define CONFIG_CGU_DIV_VAL \
-	(1 << UPDT_P) | \
 	((CONFIG_CCLK_DIV   << CSEL_P)   | \
 	 (CONFIG_SCLK0_DIV  << S0SEL_P)  | \
 	 (CONFIG_SCLK_DIV << SYSSEL_P) | \
@@ -409,12 +523,34 @@ program_clocks(ADI_BOOT_DATA *bs, bool put_into_srfs)
 	serial_putc('a');
 
 #ifdef __ADSPBF60x__
+	if (bfin_read_DMC0_STAT() & MEMINITDONE) {
+		bfin_write_DMC0_CTL(bfin_read_DMC0_CTL() | SRREQ);
+		__builtin_bfin_ssync();
+		while (!(bfin_read_DMC0_STAT() & SRACK))
+			continue;
+	}
+
+	/* Don't set the same value of MSEL and DF to CGU_CTL */
+	if ((bfin_read_CGU_CTL() & (MSEL_MASK | DF_MASK))
+			!= CONFIG_CGU_CTL_VAL) {
+		bfin_write_CGU_DIV(CONFIG_CGU_DIV_VAL);
+		bfin_write_CGU_CTL(CONFIG_CGU_CTL_VAL);
+		while ((bfin_read_CGU_STAT() & (CLKSALGN | PLLBP)) ||
+				!(bfin_read_CGU_STAT() & PLLLK))
+			continue;
+	}
 
-	bfin_write_CGU_CTL(CONFIG_CGU_CTL_VAL);
-	bfin_write_CGU_DIV(CONFIG_CGU_DIV_VAL);
-	while (!(bfin_read_CGU_STAT() & CLKSALGN))
+	bfin_write_CGU_DIV(CONFIG_CGU_DIV_VAL | UPDT);
+	while (bfin_read_CGU_STAT() & CLKSALGN)
 		continue;
 
+	if (bfin_read_DMC0_STAT() & MEMINITDONE) {
+		bfin_write_DMC0_CTL(bfin_read_DMC0_CTL() & ~SRREQ);
+		__builtin_bfin_ssync();
+		while (bfin_read_DMC0_STAT() & SRACK)
+			continue;
+	}
+
 #else /* __ADSPBF60x__ */
 
 	vr_ctl = bfin_read_VR_CTL();
@@ -586,14 +722,87 @@ __attribute__((always_inline)) static inline void
 program_memory_controller(ADI_BOOT_DATA *bs, bool put_into_srfs)
 {
 	serial_putc('a');
-
+/*
 	if (!CONFIG_MEM_SIZE)
 		return;
-
+*/
 	serial_putc('b');
 
 #ifdef __ADSPBF60x__
+	int dlldatacycle;
+	int dll_ctl;
+	int i = 0;
+
+	if (CONFIG_BFIN_GET_DCLK_M ==  125)
+		i = 0;
+	else if (CONFIG_BFIN_GET_DCLK_M ==  133)
+		i = 1;
+	else if (CONFIG_BFIN_GET_DCLK_M ==  150)
+		i = 2;
+	else if (CONFIG_BFIN_GET_DCLK_M ==  166)
+		i = 3;
+	else if (CONFIG_BFIN_GET_DCLK_M ==  200)
+		i = 4;
+	else if (CONFIG_BFIN_GET_DCLK_M ==  225)
+		i = 5;
+	else if (CONFIG_BFIN_GET_DCLK_M ==  250)
+		i = 6;
+
+#if 0
+	for (i = 0; i < ARRAY_SIZE(ddr_config_table); i++)
+		if (CONFIG_BFIN_GET_DCLK_M == ddr_config_table[i].ddr_clk)
+			break;
+#endif
+
+#ifndef CONFIG_DMC_DDRCFG
+	bfin_write_DMC0_CFG(ddr_config_table[i].dmc_ddrcfg);
+#else
+	bfin_write_DMC0_CFG(CONFIG_DMC_DDRCFG);
+#endif
+#ifndef CONFIG_DMC_DDRTR0
+	bfin_write_DMC0_TR0(ddr_config_table[i].dmc_ddrtr0);
+#else
+	bfin_write_DMC0_TR0(CONFIG_DMC_DDRTR0);
+#endif
+#ifndef CONFIG_DMC_DDRTR1
+	bfin_write_DMC0_TR1(ddr_config_table[i].dmc_ddrtr1);
+#else
+	bfin_write_DMC0_TR1(CONFIG_DMC_DDRTR1);
+#endif
+#ifndef CONFIG_DMC_DDRTR2
+	bfin_write_DMC0_TR2(ddr_config_table[i].dmc_ddrtr2);
+#else
+	bfin_write_DMC0_TR2(CONFIG_DMC_DDRTR2);
+#endif
+#ifndef CONFIG_DMC_DDRMR
+	bfin_write_DMC0_MR(ddr_config_table[i].dmc_ddrmr);
+#else
+	bfin_write_DMC0_MR(CONFIG_DMC_DDRMR);
+#endif
+#ifndef CONFIG_DMC_DDREMR1
+	bfin_write_DMC0_EMR1(ddr_config_table[i].dmc_ddrmr1);
+#else
+	bfin_write_DMC0_EMR1(CONFIG_DMC_DDREMR1);
+#endif
+#ifndef CONFIG_DMC_DDRCTL
+	bfin_write_DMC0_CTL(ddr_config_table[i].dmc_ddrctl);
+#else
+	bfin_write_DMC0_CTL(CONFIG_DMC_DDRCTL);
+#endif
 
+	__builtin_bfin_ssync();
+	while (!(bfin_read_DMC0_STAT() & MEMINITDONE))
+		continue;
+
+	dlldatacycle = (bfin_read_DMC0_STAT() & PHYRDPHASE) >> PHYRDPHASE_OFFSET;
+	dll_ctl = bfin_read_DMC0_DLLCTL();
+	dll_ctl &= 0x0ff;
+	bfin_write_DMC0_DLLCTL(dll_ctl | (dlldatacycle << DATACYC_OFFSET));
+
+	__builtin_bfin_ssync();
+	while (!(bfin_read_DMC0_STAT() & DLLCALDONE))
+		continue;
+	serial_putc('!');
 #else /* __ADSPBF60x__ */
 
 	/* Program the external memory controller before we come out of
arch/blackfin/include/asm/mach-common/bits/cgu.h +2 -0
index a1c1940..cdf7349 100644
@@ -15,6 +15,8 @@
 #define MSEL_P			8
 #define WIDLE_P			30
 #define LOCK_P			31
+#define MSEL_MASK               0x7F00
+#define DF_MASK                 0x1
 
 /* CGU_STAT Masks */
 #define PLLEN			(1 << 0)
include/configs/bf609-ezkit.h +17 -18
index c7cb834..311b2e4 100644
@@ -7,7 +7,6 @@
 
 #include <asm/config-pre.h>
 
-
 /*
  * Processor Settings
  */
@@ -30,41 +29,41 @@
  *	SCLK1 = SCLK / SCLK1_DIV
  */
 /* CONFIG_CLKIN_HZ is any value in Hz					*/
-#define CONFIG_CLKIN_HZ			25000000
+#define CONFIG_CLKIN_HZ			(25000000)
 /* CLKIN_HALF controls the DF bit in PLL_CTL      0 = CLKIN		*/
 /*                                                1 = CLKIN / 2		*/
-#define CONFIG_CLKIN_HALF		0
+#define CONFIG_CLKIN_HALF		(0)
 
 /* VCO_MULT controls the MSEL (multiplier) bits in PLL_CTL		*/
 /* Values can range from 0-127 (where 0 means 128)			*/
-#define CONFIG_VCO_MULT			15
+#define CONFIG_VCO_MULT			(20)
 
 /* CCLK_DIV controls the core clock divider				*/
 /* Values can range from 0-31 (where 0 means 32)			*/
-#define CONFIG_CCLK_DIV			1
+#define CONFIG_CCLK_DIV			(1)
 /* SCLK_DIV controls the system clock divider				*/
 /* Values can range from 0-31 (where 0 means 32)			*/
-#define CONFIG_SYSCLK_DIV		3
+#define CONFIG_SCLK_DIV		(4)
 /* Values can range from 0-7 (where 0 means 8)				*/
-#define CONFIG_SCLK0_DIV		1
-#define CONFIG_SCLK1_DIV		1
+#define CONFIG_SCLK0_DIV		(1)
+#define CONFIG_SCLK1_DIV		(1)
 /* DCLK_DIV controls the DDR clock divider				*/
 /* Values can range from 0-31 (where 0 means 32)			*/
-#define CONFIG_DCLK_DIV			2
+#define CONFIG_DCLK_DIV			(2)
 /* OCLK_DIV controls the output clock divider				*/
 /* Values can range from 0-127 (where 0 means 128)			*/
-#define CONFIG_OCLK_DIV			16
+#define CONFIG_OCLK_DIV			(16)
 
-#define CONFIG_BFIN_GET_VCO CONFIG_CLKIN_HZ
-#define CONFIG_PLL_CLK  (get_vco()*CONFIG_VCO_MULT)
+#define CONFIG_BFIN_GET_VCO 		(CONFIG_CLKIN_HZ)
+#define CONFIG_PLL_CLK  		(get_vco()*CONFIG_VCO_MULT)
 
-#define CONFIG_BFIN_GET_CCLK (CONFIG_PLL_CLK/CONFIG_CCLK_DIV)
-#define CONFIG_CCLK_HZ CONFIG_BFIN_GET_CCLK
+#define CONFIG_BFIN_GET_CCLK 		(CONFIG_PLL_CLK/CONFIG_CCLK_DIV)
+#define CONFIG_CCLK_HZ 			(CONFIG_BFIN_GET_CCLK)
 
-#define CONFIG_BFIN_GET_SCLK (CONFIG_PLL_CLK/CONFIG_SYSCLK_DIV)
-#define CONFIG_BFIN_GET_SCLK0 (get_sclk()/CONFIG_SCLK0_DIV)
-#define CONFIG_BFIN_GET_SCLK1 (get_sclk()/CONFIG_SCLK1_DIV)
-#define CONFIG_BFIN_GET_DCLK (get_cclk()/CONFIG_DCLK_DIV)
+#define CONFIG_BFIN_GET_SCLK 		(CONFIG_PLL_CLK/CONFIG_SCLK_DIV)
+#define CONFIG_BFIN_GET_SCLK0 		(get_sclk()/CONFIG_SCLK0_DIV)
+#define CONFIG_BFIN_GET_SCLK1 		(get_sclk()/CONFIG_SCLK1_DIV)
+#define CONFIG_BFIN_GET_DCLK 		((CONFIG_CLKIN_HZ*CONFIG_VCO_MULT)/CONFIG_DCLK_DIV)
 
 /*
  * Memory Settings
Signature · 1 line
1.7.9.5
author
#32 lore raw

PATCH 12/16 Blackfin: Bf60x: initcode: set up uart baud properly

In reply to Bob Liu

From: Sonic Zhang <[email protected]>

Set up uart baud properly for booting u-boot over UART

---
 arch/blackfin/cpu/initcode.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
arch/blackfin/cpu/initcode.c +6 -2
index 3bb2b98..3197c40 100644
@@ -433,7 +433,9 @@ program_early_devices(ADI_BOOT_DATA *bs, uint *sdivB, uint *divB, uint *vcoB)
 	if (BFIN_DEBUG_EARLY_SERIAL || CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_UART) {
 		serial_putc('b');
 #ifdef __ADSPBF60x__
-
+		*sdivB = bfin_read_CGU_DIV();
+		*sdivB = ((*sdivB >> 8) & 0x1f) * ((*sdivB >> 5) & 0x7);
+		*vcoB = (bfin_read_CGU_CTL() >> 8) & 0x7f;
 #else
 		*sdivB = bfin_read_PLL_DIV() & 0xf;
 		*vcoB = (bfin_read_PLL_CTL() >> 9) & 0x3f;
@@ -701,7 +703,9 @@ update_serial_clocks(ADI_BOOT_DATA *bs, uint sdivB, uint divB, uint vcoB)
 		serial_putc('b');
 		unsigned int sdivR, vcoR;
 #ifdef __ADSPBF60x__
-
+		sdivR = bfin_read_CGU_DIV();
+		sdivR = ((sdivR >> 8) & 0x1f) * ((sdivR >> 5) & 0x7);
+		vcoR = (bfin_read_CGU_CTL() >> 8) & 0x7f;
 #else
 		sdivR = bfin_read_PLL_DIV() & 0xf;
 		vcoR = (bfin_read_PLL_CTL() >> 9) & 0x3f;
Signature · 1 line
1.7.9.5
author
#34 lore raw

PATCH 13/16 Blackfin: Bf60x: add hw watchdog support

In reply to Bob Liu
---
 arch/blackfin/cpu/initcode.c  |   14 ++++++++++++++
 arch/blackfin/cpu/start.S     |    2 ++
 include/configs/bf609-ezkit.h |    1 +
 3 files changed, 17 insertions(+)
arch/blackfin/cpu/initcode.c +14 -0
index 3197c40..c68302f 100644
@@ -458,8 +458,22 @@ 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__
+		int i;
+		bfin_write_SEC_GCTL(0x2);
+		while (i++ < 100000);
+		bfin_write_SEC_FCTL(0xc1);
+		bfin_write_SEC_SCTL(2, bfin_read_SEC_SCTL(2) | 0x6);
+
+		bfin_write_SEC_CCTL(0x2);
+		while (i++ < 100000);
+		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 311b2e4..64b1eb6 100644
@@ -78,6 +78,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
#37 lore raw

PATCH 14/16 Blackfin: setup SMC if user desires it

In reply to Bob Liu

From: Mike Frysinger <[email protected]>

The static memory controller is how people connect flashes to newer Blackfin processors, so add knobs for people to program settings if they so desire.

---
 arch/blackfin/cpu/initcode.h |   51 ++++++++++++++++++++++++++++++++++++++----
 1 file changed, 47 insertions(+), 4 deletions(-)
arch/blackfin/cpu/initcode.h +47 -4
index d263ab3..0b8c033 100644
@@ -50,13 +50,12 @@ program_async_controller(ADI_BOOT_DATA *bs)
 	serial_putc('a');
 
 #ifdef __ADSPBF60x__
-
-#else /* __ADSPBF60x__ */
-
 	/* Program the async banks controller. */
+#ifdef EBIU_AMGCTL
 	bfin_write_EBIU_AMBCTL0(CONFIG_EBIU_AMBCTL0_VAL);
 	bfin_write_EBIU_AMBCTL1(CONFIG_EBIU_AMBCTL1_VAL);
 	bfin_write_EBIU_AMGCTL(CONFIG_EBIU_AMGCTL_VAL);
+#endif
 
 	serial_putc('b');
 
@@ -73,8 +72,52 @@ program_async_controller(ADI_BOOT_DATA *bs)
 # endif
 #endif
 
-#endif
 	serial_putc('c');
+
+#else 	/* __ADSPBF60x__ */
+	/* Program the static memory controller. */
+# ifdef CONFIG_SMC_GCTL_VAL
+	bfin_write_SMC_GCTL(CONFIG_SMC_GCTL_VAL);
+# endif
+# ifdef CONFIG_SMC_B0CTL_VAL
+	bfin_write_SMC_B0CTL(CONFIG_SMC_B0CTL_VAL);
+# endif
+# ifdef CONFIG_SMC_B0TIM_VAL
+	bfin_write_SMC_B0TIM(CONFIG_SMC_B0TIM_VAL);
+# endif
+# ifdef CONFIG_SMC_B0ETIM_VAL
+	bfin_write_SMC_B0ETIM(CONFIG_SMC_B0ETIM_VAL);
+# endif
+# ifdef CONFIG_SMC_B1CTL_VAL
+	bfin_write_SMC_B1CTL(CONFIG_SMC_B1CTL_VAL);
+# endif
+# ifdef CONFIG_SMC_B1TIM_VAL
+	bfin_write_SMC_B1TIM(CONFIG_SMC_B1TIM_VAL);
+# endif
+# ifdef CONFIG_SMC_B1ETIM_VAL
+	bfin_write_SMC_B1ETIM(CONFIG_SMC_B1ETIM_VAL);
+# endif
+# ifdef CONFIG_SMC_B2CTL_VAL
+	bfin_write_SMC_B2CTL(CONFIG_SMC_B2CTL_VAL);
+# endif
+# ifdef CONFIG_SMC_B2TIM_VAL
+	bfin_write_SMC_B2TIM(CONFIG_SMC_B2TIM_VAL);
+# endif
+# ifdef CONFIG_SMC_B2ETIM_VAL
+	bfin_write_SMC_B2ETIM(CONFIG_SMC_B2ETIM_VAL);
+# endif
+# ifdef CONFIG_SMC_B3CTL_VAL
+	bfin_write_SMC_B3CTL(CONFIG_SMC_B3CTL_VAL);
+# endif
+# ifdef CONFIG_SMC_B3TIM_VAL
+	bfin_write_SMC_B3TIM(CONFIG_SMC_B3TIM_VAL);
+# endif
+# ifdef CONFIG_SMC_B3ETIM_VAL
+	bfin_write_SMC_B3ETIM(CONFIG_SMC_B3ETIM_VAL);
+# endif
+
+#endif
+	serial_putc('d');
 }
 
 #endif
Signature · 1 line
1.7.9.5
author
#38 lore raw

PATCH 15/16 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 |   46 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
arch/blackfin/cpu/initcode.c +46 -0
index c68302f..0640c81 100644
@@ -507,6 +507,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__ */
 
@@ -821,6 +826,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
@@ -888,7 +894,46 @@ 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');
+		volatile uint32_t *hibernate_magic = bfin_read32(DPM0_RESTORE4);
+		__builtin_bfin_ssync(); /* make sure memory controller is done */
+		if (hibernate_magic[0] == 0xDEADBEEF) {
+			serial_putc('c');
+
+			__builtin_bfin_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)
@@ -920,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.9.5
author
#39 lore raw

PATCH 16/16 Blackfin: update license to Clear BSD license.

In reply to Bob Liu

From: Sonic Zhang <[email protected]>

Per the request from ADI Legal.

---
 arch/blackfin/Clear_BSD.txt                    |   33 ++++++++++++++++++++++++
 arch/blackfin/cpu/bootcount.c                  |    2 +-
 arch/blackfin/cpu/os_log.c                     |    2 +-
 arch/blackfin/include/asm/mach-bf506/anomaly.h |    3 +--
 arch/blackfin/include/asm/mach-bf518/anomaly.h |    3 +--
 arch/blackfin/include/asm/mach-bf527/anomaly.h |    3 +--
 arch/blackfin/include/asm/mach-bf533/anomaly.h |    3 +--
 arch/blackfin/include/asm/mach-bf537/anomaly.h |    3 +--
 arch/blackfin/include/asm/mach-bf538/anomaly.h |    3 +--
 arch/blackfin/include/asm/mach-bf548/anomaly.h |    3 +--
 arch/blackfin/include/asm/mach-bf561/anomaly.h |    3 +--
 arch/blackfin/include/asm/mach-bf609/anomaly.h |    3 +--
 12 files changed, 44 insertions(+), 20 deletions(-)
 create mode 100644 arch/blackfin/Clear_BSD.txt
arch/blackfin/Clear_BSD.txt new file +33 -0
new file mode 100644
index 0000000..bfa4b37
@@ -0,0 +1,33 @@
+The Clear BSD license:
+
+Copyright (c) 2012, Analog Devices, Inc.  All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted (subject to the limitations in the
+disclaimer below) provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the
+   distribution.
+
+* Neither the name of Analog Devices, Inc.  nor the names of its
+   contributors may be used to endorse or promote products derived
+   from this software without specific prior written permission.
+
+NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+GRANTED BY THIS LICENSE.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
arch/blackfin/cpu/bootcount.c +1 -1
index 6cf6dd5..83e8546 100644
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 2010 Analog Devices Inc.
  *
- * Licensed under the 2-clause BSD.
+ * Licensed under the Clear BSD.
  */
 
 /* This version uses one 32bit storage and combines the magic/count */
arch/blackfin/cpu/os_log.c +1 -1
index e1c8e29..51501f7 100644
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 2009 Analog Devices Inc.
  *
- * Licensed under the 2-clause BSD.
+ * Licensed under the Clear BSD.
  */
 
 #include <common.h>
arch/blackfin/include/asm/mach-bf506/anomaly.h +1 -2
index 5b3227a..00d5e43 100644
@@ -6,8 +6,7 @@
  * DO NOT EDIT THIS FILE
  *
  * Copyright 2004-2011 Analog Devices Inc.
- * Licensed under the ADI BSD license.
- *   https://docs.blackfin.uclinux.org/doku.php?id=adi_bsd
+ * Licensed under the Clear BSD license.
  */
 
 /* This file should be up to date with:
arch/blackfin/include/asm/mach-bf518/anomaly.h +1 -2
index 56383f7..845e6bc 100644
@@ -6,8 +6,7 @@
  * DO NOT EDIT THIS FILE
  *
  * Copyright 2004-2011 Analog Devices Inc.
- * Licensed under the ADI BSD license.
- *   https://docs.blackfin.uclinux.org/doku.php?id=adi_bsd
+ * Licensed under the Clear BSD license.
  */
 
 /* This file should be up to date with:
arch/blackfin/include/asm/mach-bf527/anomaly.h +1 -2
index 6884706..aa14110 100644
@@ -6,8 +6,7 @@
  * DO NOT EDIT THIS FILE
  *
  * Copyright 2004-2011 Analog Devices Inc.
- * Licensed under the ADI BSD license.
- *   https://docs.blackfin.uclinux.org/doku.php?id=adi_bsd
+ * Licensed under the Clear BSD license.
  */
 
 /* This file should be up to date with:
arch/blackfin/include/asm/mach-bf533/anomaly.h +1 -2
index 03f2b40..3a8f73a 100644
@@ -6,8 +6,7 @@
  * DO NOT EDIT THIS FILE
  *
  * Copyright 2004-2011 Analog Devices Inc.
- * Licensed under the ADI BSD license.
- *   https://docs.blackfin.uclinux.org/doku.php?id=adi_bsd
+ * Licensed under the Clear BSD license.
  */
 
 /* This file should be up to date with:
arch/blackfin/include/asm/mach-bf537/anomaly.h +1 -2
index 543cd3f..df92126 100644
@@ -6,8 +6,7 @@
  * DO NOT EDIT THIS FILE
  *
  * Copyright 2004-2011 Analog Devices Inc.
- * Licensed under the ADI BSD license.
- *   https://docs.blackfin.uclinux.org/doku.php?id=adi_bsd
+ * Licensed under the Clear BSD license.
  */
 
 /* This file should be up to date with:
arch/blackfin/include/asm/mach-bf538/anomaly.h +1 -2
index b6ca997..318d922 100644
@@ -6,8 +6,7 @@
  * DO NOT EDIT THIS FILE
  *
  * Copyright 2004-2011 Analog Devices Inc.
- * Licensed under the ADI BSD license.
- *   https://docs.blackfin.uclinux.org/doku.php?id=adi_bsd
+ * Licensed under the Clear BSD license.
  */
 
 /* This file should be up to date with:
arch/blackfin/include/asm/mach-bf548/anomaly.h +1 -2
index 021fb19..874eac1 100644
@@ -6,8 +6,7 @@
  * DO NOT EDIT THIS FILE
  *
  * Copyright 2004-2011 Analog Devices Inc.
- * Licensed under the ADI BSD license.
- *   https://docs.blackfin.uclinux.org/doku.php?id=adi_bsd
+ * Licensed under the Clear BSD license.
  */
 
 /* This file should be up to date with:
arch/blackfin/include/asm/mach-bf561/anomaly.h +1 -2
index b27173c..01c26f9 100644
@@ -6,8 +6,7 @@
  * DO NOT EDIT THIS FILE
  *
  * Copyright 2004-2011 Analog Devices Inc.
- * Licensed under the ADI BSD license.
- *   https://docs.blackfin.uclinux.org/doku.php?id=adi_bsd
+ * Licensed under the Clear BSD license.
  */
 
 /* This file should be up to date with:
arch/blackfin/include/asm/mach-bf609/anomaly.h +1 -2
index cfe1a1d..1b8227f 100644
@@ -6,8 +6,7 @@
  * DO NOT EDIT THIS FILE
  *
  * Copyright 2004-2010 Analog Devices Inc.
- * Licensed under the ADI BSD license.
- *   https://docs.blackfin.uclinux.org/doku.php?id=adi_bsd
+ * Licensed under the Clear BSD license.
  */
 
 /* This file should be up to date with:
Signature · 1 line
1.7.9.5
#42 lore raw

PATCH 1/16 Blackfin: BF60x: new processor port

In reply to Bob Liu
Quoted 3 lines · On Tuesday 07 August 2012 04:07:40 Bob Liu wrote:

From: Mike Frysinger <[email protected]>

Add basic support for blackfin new processor BF60x.

i had always intended to clean & split this 1 change up, but never got a chance before i left

Quoted 21 lines
 arch/blackfin/cpu/cpu.c                            |    4 +-
 arch/blackfin/cpu/gpio.c                           |   36 +-
 arch/blackfin/cpu/initcode.c                       |   53 +-
 arch/blackfin/cpu/reset.c                          |    2 +
 arch/blackfin/cpu/serial.c                         |   65 +-
 arch/blackfin/cpu/serial.h                         |  222 +-
 arch/blackfin/cpu/serial1.h                        |  236 ++
 arch/blackfin/cpu/serial4.h                        |  113 +
 arch/blackfin/include/asm/blackfin_cdef.h          |    3 +
 arch/blackfin/include/asm/blackfin_def.h           |    5 +
 arch/blackfin/include/asm/blackfin_local.h         |    2 +
 arch/blackfin/include/asm/dma.h                    |  113 +-
 arch/blackfin/include/asm/gpio.h                   |    2 +-
 arch/blackfin/include/asm/mach-bf609/BF609_cdef.h  |  540 +++
 arch/blackfin/include/asm/mach-bf609/BF609_def.h   | 3752
 arch/blackfin/include/asm/mach-bf609/anomaly.h     | 
 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     |  251 ++
 arch/blackfin/include/asm/mach-bf609/ports.h       |   63 +
 arch/blackfin/include/asm/mach-common/bits/cgu.h   |   78 +
Quoted 8 lines
 arch/blackfin/include/asm/mach-common/bits/dde.h   |   88 +
 arch/blackfin/include/asm/mach-common/bits/dma.h   |    1 +
 arch/blackfin/include/asm/mach-common/bits/pll.h   |    5 +
 arch/blackfin/include/asm/mach-common/bits/uart4.h |   66 +
 arch/blackfin/lib/board.c                          |    2 +-
 arch/blackfin/lib/clocks.c                         |  128 +-
 arch/blackfin/lib/string.c                         |   97 +-
 include/configs/bfin_adi_common.h                  |    2 +

i would split this into at least 5 pieces:
- gpio changes
- dma changes
- serial changes
- new headers (asm/mach-bf609/* and the blackfin_{cdef,def,local} changes
which include those)
- core changes (cpu/reset/board/etc...)

once that's been split up, it'll be much easier to digest/review. some changes i won't mind merging now, but others (see below) will clearly need updating first

arch/blackfin/cpu/initcode.c line 22

Quoted 12 lines
arch/blackfin/cpu/initcode.c +2 -2
@@ -16,17 +16,21 @@
 #include <asm/mach-common/bits/bootrom.h>
 #include <asm/mach-common/bits/core.h>
 #include <asm/mach-common/bits/ebiu.h>
-#include <asm/mach-common/bits/pll.h>
-#include <asm/mach-common/bits/uart.h>
+
+#define BUG() while (1) { asm volatile("emuexcpt;"); }
 
 #define BUG() while (1) { asm volatile("emuexcpt;"); }

looks like you got a rebase error here

arch/blackfin/cpu/initcode.c line 28

Quoted 3 lines
arch/blackfin/cpu/initcode.c +3 -0
+#if 0
+
+#include <asm/mach-common/bits/pll.h>

well that'll obviously need updating :)

Quoted 14 lines
arch/blackfin/cpu/initcode.c +14 -0
+#else
+
+#include <asm/mach-common/bits/cgu.h>
+
+#ifndef CONFIG_CGU_CTL_VAL
+# define CONFIG_CGU_CTL_VAL ((CONFIG_VCO_MULT << 8) | CONFIG_CLKIN_HALF)
+#endif
+
+#ifndef CONFIG_CGU_DIV_VAL
+# define CONFIG_CGU_DIV_VAL \
+	((CONFIG_CCLK_DIV   << CSEL_P)   | \
+	 (CONFIG_SCLK0_DIV  << S0SEL_P)  | \
+	 (CONFIG_SYSCLK_DIV << SYSSEL_P) | \
+	 (CONFIG_SCLK1_DIV  << S1SEL_P)  | \

arch/blackfin/cpu/initcode.c void initcode(ADI_BOOT_DATA *bs) · line 722

Quoted 10 lines
arch/blackfin/cpu/initcode.c +10 -0
+	 (CONFIG_DCLK_DIV   << DSEL_P)   | \
+	 (CONFIG_OCLK_DIV   << OSEL_P))
+#endif
+
+BOOTROM_CALLED_FUNC_ATTR
+void initcode(ADI_BOOT_DATA *bs)
+{
+}
+
+#endif

there was no bootrom when i did the initial port. i'd like to think that there's a bootrom now that you guys have actual silicon back. is that not the case ? this will def need implementing, otherwise how can you boot a bf60x cpu ?

arch/blackfin/lib/board.c static int display_banner(void) · line 61

Quoted 11 lines
arch/blackfin/lib/board.c +1 -1
 
 		"(Detected Rev: 0.%d) "
 		"(%s boot)\n",
 		gd->bd->bi_cpu,
-		bfin_revid(),
+		/*bfin_revid()*/0,
 		get_bfin_boot_mode(CONFIG_BFIN_BOOT_MODE));
 	return 0;
 }

that needs implementing :)

include/configs/bfin_adi_common.h line 119

Quoted 9 lines
include/configs/bfin_adi_common.h +2 -0
 
 #ifndef CONFIG_DEBUG_EARLY_SERIAL
+#ifndef __ADSPBF60x__
 # define CONFIG_SERIAL_MULTI
 # define CONFIG_SYS_BFIN_UART
 #endif
+#endif

i don't recall if i turned this off as an optimization for early work, or because it was unimplemented. i think the former, but if it's the latter, it'll need implementing and this ifdef thrown away.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120808/fb561e01/attachment.pgp>

#2 lore raw

PATCH 2/16 Blackfin: bf609-ezkit: new board port

In reply to Bob Liu
Quoted 11 lines · On Tuesday 07 August 2012 04:07:41 Bob Liu wrote:
 arch/blackfin/cpu/initcode.c                   |   96 ++++++++++-----
 arch/blackfin/cpu/initcode.h                   |    9 ++
 arch/blackfin/cpu/serial1.h                    |   19 +++
 arch/blackfin/cpu/serial4.h                    |   35 +++++-
 arch/blackfin/include/asm/mach-bf609/portmux.h |    5 +
 arch/blackfin/include/asm/mach-bf609/ports.h   |   56 +++++++--
 board/bf609-ezkit/Makefile                     |   54 +++++++++
 board/bf609-ezkit/bf609-ezkit.c                |   63 ++++++++++
 boards.cfg                                     |    1 +
 common/cmd_reginfo.c                           |    4 +-
 include/configs/bf609-ezkit.h                  |  148

another one i intended on cleaning up & splitting, and in some cases merging with the first commit in this series. many of these changes are clearly not board-specific, so they should be squashed into the initial core patches.

also, needs a new entry in the MAINTAINERS file
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120808/446752a7/attachment.pgp>

#5 lore raw

PATCH 3/16 Blackfin: Bf60x: support big cplb page

In reply to Bob Liu
Quoted 2 lines · On Tuesday 07 August 2012 04:07:42 Bob Liu wrote:

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.

"it's" -> "its"

Quoted 13 lines
 arch/blackfin/include/asm/cplb.h                 |   13 +++++++++-
 arch/blackfin/include/asm/mach-common/bits/mpu.h |    6 ++++-
 arch/blackfin/lib/board.c                        |   28
++++++++++++++++------ include/configs/bf609-ezkit.h                    | 
  6 +----
 4 files changed, 39 insertions(+), 14 deletions(-)
(quoted diff) +0 -0

b/arch/blackfin/include/asm/cplb.h index cc21e93..5a0588b 100644

arch/blackfin/include/asm/cplb.h +0 -0
@@ -46,8 +46,11 @@
 #define CPLB_IDOCACHE		CPLB_INOCACHE | CPLB_L1_CHBL

arch/blackfin/include/asm/cplb.h line 55

Quoted 10 lines
arch/blackfin/include/asm/cplb.h +4 -1
 
 /* Data Attibutes*/
-
+#if defined(__ADSPBF60x__)
+#define SDRAM_IGENERIC          (PAGE_SIZE_16MB | CPLB_L1_CHBL |
 CPLB_USER_RD | CPLB_VALID)
+#else
 #define SDRAM_IGENERIC          (PAGE_SIZE_4MB | CPLB_L1_CHBL |
 CPLB_USER_RD | CPLB_VALID)
+#endif

many of these ifdefs are largely the same thing. add a define at the top like:
#ifdef __ADSPBF60x__

# define PAGE_SIZE_MAX PAGE_SIZE_16MB
#else
# define PAGE_SIZE_MAX PAGE_SIZE_14MB
#endif

and then use that in all the other places. this way you don't need to duplicate the vast majority of the content.

arch/blackfin/include/asm/mach-common/bits/mpu.h

Quoted 2 lines
arch/blackfin/include/asm/mach-common/bits/mpu.h +0 -0

this should get merged into the main cpu update patch i think

arch/blackfin/lib/board.c static void display_global_data(void)

Quoted 8 lines
arch/blackfin/lib/board.c +2 -0
 
 void init_cplbtables(void)
 {
...
+#if defined(__ADSPBF60x__)
+	icplb_add(0x0, 0x0);

err, why ?

arch/blackfin/lib/board.c

Quoted 2 lines
arch/blackfin/lib/board.c +2 -0
+	dcplb_add(CONFIG_SYS_FLASH_BASE, PAGE_SIZE_16MB | CPLB_DIRTY |
+			CPLB_SUPV_WR | CPLB_USER_WR | CPLB_USER_RD | CPLB_VALID);

can't you use SDRAM_EBIU/SDRAM_INON_CHBL like BF5xx ? that's what the code below is for:

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

Quoted 5 lines
arch/blackfin/lib/board.c +2 -0
+#ifndef __ADSPBF60x__
 	icplb_add(0x20000000, SDRAM_INON_CHBL);
 	dcplb_add(0x20000000, SDRAM_EBIU);
 	++i;
+#endif

this is the async memory blocks ...

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

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

why only use CPLBs of 4 megs for external memory on BF60x ? you would want to maximize the usage of 16MiB to reduce CPLB overhead.

Quoted 16 lines
include/configs/bf609-ezkit.h +1 -2
@@ -62,11 +62,10 @@
 #define CONFIG_BFIN_GET_SCLK0 (get_sclk()/CONFIG_SCLK0_DIV)
 #define CONFIG_BFIN_GET_SCLK1 (get_sclk()/CONFIG_SCLK1_DIV)
 
-
 /*
  * Memory Settings
  */
-#define CONFIG_MEM_SIZE		32
+#define CONFIG_MEM_SIZE		128
 
 #define CONFIG_SMC_GCTL_VAL	0x00000010
 #define CONFIG_SMC_B1CTL_VAL	0x01002001

include/configs/bf609-ezkit.h line 80

Quoted 9 lines
include/configs/bf609-ezkit.h +0 -3
@@ -76,9 +75,6 @@
 #define CONFIG_SYS_MONITOR_LEN	(256 * 1024)
 #define CONFIG_SYS_MALLOC_LEN	(256 * 1024)
 
-#define CONFIG_ICACHE_OFF
-#define CONFIG_DCACHE_OFF
-
 /*
  * Network Settings
  */

once the CPLB code is updated, you can squash this into the new bf609-ezkit patch
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120808/3f815085/attachment.pgp>

#9 lore raw

PATCH 4/16 Blackfin: Rsi: add support for bf609-ezkit

In reply to Bob Liu
Quoted 7 lines · On Tuesday 07 August 2012 04:07:43 Bob Liu wrote:
arch/blackfin/include/asm/config-pre.h +1 -0
 
 #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 */

arch/blackfin/include/asm/config-pre.h

Quoted 10 lines
arch/blackfin/include/asm/config-pre.h +3 -0
+#define BFIN_BOOT_LP_SLAVE    15      /* boot ldr from link port */
 
    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";
 	}
 }

seems like a change that should be by itself, or squashed into the "core bf60x support" patch

arch/blackfin/include/asm/mach-common/bits/dma.h

Quoted 2 lines
arch/blackfin/include/asm/mach-common/bits/dma.h +0 -0

should be part of the "bf60x dma" patch

drivers/mmc/bfin_sdh.c

Quoted 4 lines
arch/blackfin/include/asm/mach-common/bits/sdh.h +0 -0
drivers/mmc/bfin_sdh.c +0 -0

these are about the only changes that should be in this patch, and the subject should be:

	Blackfin: rsi: add support for bf60x

include/configs/bf609-ezkit.h

Quoted 4 lines
board/bf609-ezkit/bf609-ezkit.c +0 -0
include/configs/bf609-ezkit.h +0 -0

merge the rsi patch first, then squash this into the bf609-ezkit board patch -mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120808/18bba44f/attachment.pgp>

#12 lore raw

PATCH 5/16 Blackfin: Paraflash: add support for bf609-ezkit

In reply to Bob Liu

arch/blackfin/include/asm/mach-bf609/portmux.h

Quoted 2 lines · On Tuesday 07 August 2012 04:07:44 Bob Liu wrote:
arch/blackfin/include/asm/mach-bf609/portmux.h +0 -0

this should be part of the initial commit of this header (one of the initial bf60x support patches)

include/configs/bf609-ezkit.h

Quoted 4 lines
board/bf609-ezkit/bf609-ezkit.c +0 -0
include/configs/bf609-ezkit.h +0 -0

then squash these into the initial bf609-ezkit board patch

Quoted 6 lines
include/configs/bfin_adi_common.h +0 -0
@@ -195,10 +195,12 @@
 		"nand erase 0 0x40000;" \
 		"nand write $(loadaddr) 0 0x40000"
 # else

include/configs/bfin_adi_common.h line 206

Quoted 10 lines
include/configs/bfin_adi_common.h +3 -1
-#  define UBOOT_ENV_UPDATE \
+#  ifndef UBOOT_ENV_UPDATE
+#   define UBOOT_ENV_UPDATE \
 		"protect off 0x20000000 +$(filesize);" \
 		"erase 0x20000000 +$(filesize);" \
 		"cp.b $(loadaddr) 0x20000000 $(filesize)"
+#  endif
 # endif
 # ifdef CONFIG_NETCONSOLE
 #  define NETCONSOLE_ENV \

replace the 0x20000000 with a define and then there's no need to override it

#   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)"

-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120808/70de63aa/attachment.pgp>

#15 lore raw

PATCH 6/16 Blackfin: Bf609-ezkit: implement soft switch

In reply to Bob Liu

board/bf609-ezkit/Makefile include $(TOPDIR)/config.mk · line 33

Quoted 4 lines · On Tuesday 07 August 2012 04:07:45 Bob Liu wrote:
board/bf609-ezkit/Makefile +1 -0
 
+COBJS-$(CONFIG_BFIN_SOFT_SWITCH)   += soft_switch.o

is there any reason we *wouldn't* want to build this ? i would just skip making this an option and always enable it.

also, any reason for not just squashing into the initial bf609-ezkit board port ? there's quite a bit of rudimentary code in bf609-ezkit.c before to support this.

board/bf609-ezkit/bf609-ezkit.c int board_mmc_init(bd_t *bis) · line 66

Quoted 7 lines
board/bf609-ezkit/bf609-ezkit.c +4 -0
 
+/* miscellaneous platform dependent initialisations */
+int misc_init_r(void)
+{
+	printf("other init\n");

useless display -> delete

board/bf609-ezkit/soft_switch.c line 19

Quoted 8 lines
board/bf609-ezkit/soft_switch.c new file +5 -0
 
+#ifdef CONFIG_BFIN_BOARD_VERSION_1_0
+#define SWITCH_ADDR     0x21
+#else
+#define SWITCH_ADDR     0x20
+#endif

must this be a runtime define ? can't you probe the slave address at runtime to figure out which one to use ?

start with the address that the newest boards are using, and then fallback to the older ones. this way there's no runtime penalty on newer boards, but older ones continue to work.

shouldn't there be a new u-boot command here so people can toggle peripherals themselves ? i thought that was the intention when we first discussed this idea with the firmware team.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120808/422c6b92/attachment.pgp>

#19 lore raw

PATCH 7/16 Blackfin: Spi: add bf6xx spi driver

In reply to Bob Liu

arch/blackfin/include/asm/mach-common/bits/spi6xx.h line 2

Quoted 5 lines · On Tuesday 07 August 2012 04:07:46 Bob Liu wrote:
arch/blackfin/include/asm/mach-common/bits/spi6xx.h new file +2 -0
@@ -0,0 +1,240 @@
+/*
+ * Analog Devices SPI3 controller driver

i'd prefer to call it "bfin_spi3" then since it represents the version of the IP block and not the SoC it happens to be shipped with

include/configs/bf609-ezkit.h

Quoted 2 lines
include/configs/bf609-ezkit.h +0 -0

this should be squashed into the bf609-ezkit board port patch
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120808/a559b492/attachment.pgp>

#22 lore raw

PATCH 8/16 Blackfin: add more print info for Bf60x

In reply to Bob Liu

arch/blackfin/lib/clocks.c u_long get_sclk1(void) · line 142

Quoted 11 lines · On Tuesday 07 August 2012 04:07:47 Bob Liu wrote:
arch/blackfin/lib/clocks.c +8 -0
 
+u_long get_dclk(void)
+{
+#ifndef CONFIG_BFIN_GET_DCLK
+	return _get_sclk(&cached_dclk);
+#else
+	return CONFIG_BFIN_GET_DCLK;
+#endif
+}

this looks like my incomplete hack where the implementation of clock lookups weren't finished. that was because at the time, the hardware blocks of the bf60x were not finished which means i couldn't query the MMRs to calculate the values. please implement this ...

include/configs/bf609-ezkit.h line 67

Quoted 7 lines
include/configs/bf609-ezkit.h +1 -0
 
 #define CONFIG_BFIN_GET_SCLK (CONFIG_PLL_CLK/CONFIG_SYSCLK_DIV)
 #define CONFIG_BFIN_GET_SCLK0 (get_sclk()/CONFIG_SCLK0_DIV)
 #define CONFIG_BFIN_GET_SCLK1 (get_sclk()/CONFIG_SCLK1_DIV)
+#define CONFIG_BFIN_GET_DCLK (get_cclk()/CONFIG_DCLK_DIV)

and then point all these hard coded defines. these existed purely for initial FPGA bring up and were not intended to be shipped as the final code.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120808/908c9934/attachment.pgp>

#28 lore raw

PATCH 10/16 Blackfin: Bf60x: Check card ready for each RSI command

In reply to Bob Liu
Quoted 1 line · On Tuesday 07 August 2012 04:07:49 Bob Liu wrote:

Set up RSI data before sending RSI command if data is applicable.

squash into the "Blackfin: rsi: add bf60x support" patch
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120808/7f6edf3c/attachment.pgp>

#33 lore raw

PATCH 12/16 Blackfin: Bf60x: initcode: set up uart baud properly

In reply to Bob Liu
Quoted 1 line · On Tuesday 07 August 2012 04:07:51 Bob Liu wrote:

Set up uart baud properly for booting u-boot over UART

squash into one of the earlier "initial bf60x support" patches
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120808/b7982c7f/attachment.pgp>

#35 lore raw

PATCH 13/16 Blackfin: Bf60x: add hw watchdog support

In reply to Bob Liu
Quoted 7 lines · On Tuesday 07 August 2012 04:07:52 Bob Liu wrote:
arch/blackfin/cpu/initcode.c +2 -0
 
 	if (CONFIG_BFIN_BOOT_MODE != BFIN_BOOT_BYPASS) {
 		serial_putc('e');
+#ifdef __ADSPBF60x__
+		int i;

arch/blackfin/cpu/initcode.c program_early_devices(ADI_BOOT_DATA *bs, uint *sdivB, uint *divB, uint *vcoB) · line 472

Quoted 10 lines
arch/blackfin/cpu/initcode.c +10 -0
+		bfin_write_SEC_GCTL(0x2);
+		while (i++ < 100000);
+		bfin_write_SEC_FCTL(0xc1);
+		bfin_write_SEC_SCTL(2, bfin_read_SEC_SCTL(2) | 0x6);
+
+		bfin_write_SEC_CCTL(0x2);
+		while (i++ < 100000);
+		bfin_write_SEC_GCTL(0x1);
+		bfin_write_SEC_CCTL(0x1);
+#endif

err, this doesn't look like hardware watchdog ... this is the interrupt controller isn't it ?

those while() loops also won't fly -- you need to use a proper sync function here. certainly not without comments as to what's going on.

Quoted 11 lines
arch/blackfin/cpu/start.S +1 -0
@@ -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

arch/blackfin/cpu/start.S ENTRY(_start) · line 82

Quoted 4 lines
arch/blackfin/cpu/start.S +1 -0
@@ -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

you need to implement the bf60x equivalent here and not just disable the bf5xx code
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120808/88ec1718/attachment.pgp>

author
#43 lore raw

PATCH 1/16 Blackfin: BF60x: new processor port

In reply to Mike Frysinger
Quoted 38 lines · Mike Frysinger
Quoted 3 lines · On Tuesday 07 August 2012 04:07:40 Bob Liu wrote:

From: Mike Frysinger <[email protected]>

Add basic support for blackfin new processor BF60x.

i had always intended to clean & split this 1 change up, but never got a chance before i left

Quoted 21 lines
 arch/blackfin/cpu/cpu.c                            |    4 +-
 arch/blackfin/cpu/gpio.c                           |   36 +-
 arch/blackfin/cpu/initcode.c                       |   53 +-
 arch/blackfin/cpu/reset.c                          |    2 +
 arch/blackfin/cpu/serial.c                         |   65 +-
 arch/blackfin/cpu/serial.h                         |  222 +-
 arch/blackfin/cpu/serial1.h                        |  236 ++
 arch/blackfin/cpu/serial4.h                        |  113 +
 arch/blackfin/include/asm/blackfin_cdef.h          |    3 +
 arch/blackfin/include/asm/blackfin_def.h           |    5 +
 arch/blackfin/include/asm/blackfin_local.h         |    2 +
 arch/blackfin/include/asm/dma.h                    |  113 +-
 arch/blackfin/include/asm/gpio.h                   |    2 +-
 arch/blackfin/include/asm/mach-bf609/BF609_cdef.h  |  540 +++
 arch/blackfin/include/asm/mach-bf609/BF609_def.h   | 3752
 arch/blackfin/include/asm/mach-bf609/anomaly.h     |
 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     |  251 ++
 arch/blackfin/include/asm/mach-bf609/ports.h       |   63 +
 arch/blackfin/include/asm/mach-common/bits/cgu.h   |   78 +
Quoted 8 lines
 arch/blackfin/include/asm/mach-common/bits/dde.h   |   88 +
 arch/blackfin/include/asm/mach-common/bits/dma.h   |    1 +
 arch/blackfin/include/asm/mach-common/bits/pll.h   |    5 +
 arch/blackfin/include/asm/mach-common/bits/uart4.h |   66 +
 arch/blackfin/lib/board.c                          |    2 +-
 arch/blackfin/lib/clocks.c                         |  128 +-
 arch/blackfin/lib/string.c                         |   97 +-
 include/configs/bfin_adi_common.h                  |    2 +
Quoted 8 lines

i would split this into at least 5 pieces:
- gpio changes
- dma changes
- serial changes
- new headers (asm/mach-bf609/* and the blackfin_{cdef,def,local} changes
which include those)
- core changes (cpu/reset/board/etc...)

Okay, it will be split in next version.

Quoted 15 lines

once that's been split up, it'll be much easier to digest/review. some changes i won't mind merging now, but others (see below) will clearly need updating first

Quoted 11 lines
arch/blackfin/cpu/initcode.c +2 -2
@@ -16,17 +16,21 @@
 #include <asm/mach-common/bits/bootrom.h>
 #include <asm/mach-common/bits/core.h>
 #include <asm/mach-common/bits/ebiu.h>
-#include <asm/mach-common/bits/pll.h>
-#include <asm/mach-common/bits/uart.h>
+
+#define BUG() while (1) { asm volatile("emuexcpt;"); }
 
Quoted 4 lines

arch/blackfin/cpu/initcode.c line 22

Quoted 1 line
arch/blackfin/cpu/initcode.c +0 -0
 #define BUG() while (1) { asm volatile("emuexcpt;"); }

looks like you got a rebase error here

Will be updated

Quoted 6 lines

arch/blackfin/cpu/initcode.c line 28

Quoted 3 lines
arch/blackfin/cpu/initcode.c +3 -0
+#if 0
+
+#include <asm/mach-common/bits/pll.h>

well that'll obviously need updating :)

Will be updated

Quoted 21 lines
Quoted 21 lines
arch/blackfin/cpu/initcode.c +21 -0
+#else
+
+#include <asm/mach-common/bits/cgu.h>
+
+#ifndef CONFIG_CGU_CTL_VAL
+# define CONFIG_CGU_CTL_VAL ((CONFIG_VCO_MULT << 8) | CONFIG_CLKIN_HALF)
+#endif
+
+#ifndef CONFIG_CGU_DIV_VAL
+# define CONFIG_CGU_DIV_VAL \
+     ((CONFIG_CCLK_DIV   << CSEL_P)   | \
+      (CONFIG_SCLK0_DIV  << S0SEL_P)  | \
+      (CONFIG_SYSCLK_DIV << SYSSEL_P) | \
+      (CONFIG_SCLK1_DIV  << S1SEL_P)  | \
+      (CONFIG_DCLK_DIV   << DSEL_P)   | \
+      (CONFIG_OCLK_DIV   << OSEL_P))
+#endif
+
+BOOTROM_CALLED_FUNC_ATTR
+void initcode(ADI_BOOT_DATA *bs)
+{
Quoted 9 lines

arch/blackfin/cpu/initcode.c void initcode(ADI_BOOT_DATA *bs) · line 722

Quoted 3 lines
arch/blackfin/cpu/initcode.c +3 -0
+}
+
+#endif

there was no bootrom when i did the initial port. i'd like to think that there's a bootrom now that you guys have actual silicon back. is that not the case ? this will def need implementing, otherwise how can you boot a bf60x cpu ?

Will be implemented.

Quoted 13 lines

arch/blackfin/lib/board.c static int display_banner(void) · line 61

Quoted 11 lines
arch/blackfin/lib/board.c +1 -1
 
              "(Detected Rev: 0.%d) "
              "(%s boot)\n",
              gd->bd->bi_cpu,
-             bfin_revid(),
+             /*bfin_revid()*/0,
              get_bfin_boot_mode(CONFIG_BFIN_BOOT_MODE));
      return 0;
 }

that needs implementing :)

Will be implemented.

Quoted 4 lines
Quoted 3 lines
include/configs/bfin_adi_common.h +0 -0
Quoted 10 lines

include/configs/bfin_adi_common.h line 119

Quoted 6 lines

#ifndef CONFIG_DEBUG_EARLY_SERIAL

include/configs/bfin_adi_common.h +2 -0
+#ifndef __ADSPBF60x__
 # define CONFIG_SERIAL_MULTI
 # define CONFIG_SYS_BFIN_UART
 #endif
+#endif

i don't recall if i turned this off as an optimization for early work, or because it was unimplemented. i think the former, but if it's the latter, it'll need implementing and this ifdef thrown away.

Will be implemented.
Thank you!

Signature · 2 lines
Regards,
--Bob
author
#3 lore raw

PATCH 2/16 Blackfin: bf609-ezkit: new board port

In reply to Mike Frysinger
Quoted 13 lines · Mike Frysinger
Quoted 11 lines · On Tuesday 07 August 2012 04:07:41 Bob Liu wrote:
 arch/blackfin/cpu/initcode.c                   |   96 ++++++++++-----
 arch/blackfin/cpu/initcode.h                   |    9 ++
 arch/blackfin/cpu/serial1.h                    |   19 +++
 arch/blackfin/cpu/serial4.h                    |   35 +++++-
 arch/blackfin/include/asm/mach-bf609/portmux.h |    5 +
 arch/blackfin/include/asm/mach-bf609/ports.h   |   56 +++++++--
 board/bf609-ezkit/Makefile                     |   54 +++++++++
 board/bf609-ezkit/bf609-ezkit.c                |   63 ++++++++++
 boards.cfg                                     |    1 +
 common/cmd_reginfo.c                           |    4 +-
 include/configs/bf609-ezkit.h                  |  148
Quoted 3 lines

another one i intended on cleaning up & splitting, and in some cases merging with the first commit in this series. many of these changes are clearly not board-specific, so they should be squashed into the initial core patches.

Will be split.

Quoted 2 lines

also, needs a new entry in the MAINTAINERS file

Okay.

Signature · 2 lines
Regards,
--Bob
author
#6 lore raw

PATCH 3/16 Blackfin: Bf60x: support big cplb page

In reply to Mike Frysinger
Quoted 32 lines · Mike Frysinger
Quoted 2 lines · On Tuesday 07 August 2012 04:07:42 Bob Liu wrote:

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.

"it's" -> "its"

Quoted 13 lines
 arch/blackfin/include/asm/cplb.h                 |   13 +++++++++-
 arch/blackfin/include/asm/mach-common/bits/mpu.h |    6 ++++-
 arch/blackfin/lib/board.c                        |   28
++++++++++++++++------ include/configs/bf609-ezkit.h                    |
  6 +----
 4 files changed, 39 insertions(+), 14 deletions(-)
(quoted diff) +0 -0

b/arch/blackfin/include/asm/cplb.h index cc21e93..5a0588b 100644

arch/blackfin/include/asm/cplb.h +0 -0
@@ -46,8 +46,11 @@
 #define CPLB_IDOCACHE                CPLB_INOCACHE | CPLB_L1_CHBL

arch/blackfin/include/asm/cplb.h line 55

Quoted 10 lines
arch/blackfin/include/asm/cplb.h +4 -1
 
 /* Data Attibutes*/
-
+#if defined(__ADSPBF60x__)
+#define SDRAM_IGENERIC          (PAGE_SIZE_16MB | CPLB_L1_CHBL |
 CPLB_USER_RD | CPLB_VALID)
+#else
 #define SDRAM_IGENERIC          (PAGE_SIZE_4MB | CPLB_L1_CHBL |
 CPLB_USER_RD | CPLB_VALID)
+#endif

many of these ifdefs are largely the same thing. add a define at the top like:
#ifdef __ADSPBF60x__

Quoted 7 lines
# define PAGE_SIZE_MAX PAGE_SIZE_16MB
#else
# define PAGE_SIZE_MAX PAGE_SIZE_14MB
#endif

and then use that in all the other places. this way you don't need to duplicate the vast majority of the content.

Okay.

Quoted 9 lines

arch/blackfin/include/asm/mach-common/bits/mpu.h

Quoted 3 lines
arch/blackfin/include/asm/mach-common/bits/mpu.h +0 -0

this should get merged into the main cpu update patch i think

Quoted 3 lines
arch/blackfin/lib/board.c +0 -0
Quoted 7 lines

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

Quoted 5 lines

void init_cplbtables(void)
{
...

arch/blackfin/lib/board.c +2 -0
+#if defined(__ADSPBF60x__)
+     icplb_add(0x0, 0x0);

err, why ?

Because other place use value "i" for both icplb and dcplb this make them consistent.

Quoted 14 lines

arch/blackfin/lib/board.c

Quoted 3 lines
arch/blackfin/lib/board.c +2 -0
+     dcplb_add(CONFIG_SYS_FLASH_BASE, PAGE_SIZE_16MB | CPLB_DIRTY |
+                     CPLB_SUPV_WR | CPLB_USER_WR | CPLB_USER_RD | CPLB_VALID);

can't you use SDRAM_EBIU/SDRAM_INON_CHBL like BF5xx ? that's what the code below is for:

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

Quoted 5 lines
arch/blackfin/lib/board.c +2 -0
+#ifndef __ADSPBF60x__
      icplb_add(0x20000000, SDRAM_INON_CHBL);
      dcplb_add(0x20000000, SDRAM_EBIU);
      ++i;
+#endif

this is the async memory blocks ...

Quoted 5 lines

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

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

why only use CPLBs of 4 megs for external memory on BF60x ? you would want to maximize the usage of 16MiB to reduce CPLB overhead.

Bf60x will reinit cplb_page_size/mask behind.

Quoted 20 lines
Quoted 20 lines
include/configs/bf609-ezkit.h +1 -2
@@ -62,11 +62,10 @@
 #define CONFIG_BFIN_GET_SCLK0 (get_sclk()/CONFIG_SCLK0_DIV)
 #define CONFIG_BFIN_GET_SCLK1 (get_sclk()/CONFIG_SCLK1_DIV)
 
-
 /*
  * Memory Settings
  */
-#define CONFIG_MEM_SIZE              32
+#define CONFIG_MEM_SIZE              128
 
 #define CONFIG_SMC_GCTL_VAL  0x00000010
 #define CONFIG_SMC_B1CTL_VAL 0x01002001
@@ -76,9 +75,6 @@
 #define CONFIG_SYS_MONITOR_LEN       (256 * 1024)
 #define CONFIG_SYS_MALLOC_LEN        (256 * 1024)
 
Quoted 9 lines

include/configs/bf609-ezkit.h line 80

Quoted 6 lines
include/configs/bf609-ezkit.h +0 -3
-#define CONFIG_ICACHE_OFF
-#define CONFIG_DCACHE_OFF
-
 /*
  * Network Settings
  */

once the CPLB code is updated, you can squash this into the new bf609-ezkit patch

Okay.

Signature · 2 lines
Regards,
--Bob
author
#10 lore raw

PATCH 4/16 Blackfin: Rsi: add support for bf609-ezkit

In reply to Mike Frysinger
Quoted 34 lines · Mike Frysinger
Quoted 7 lines · On Tuesday 07 August 2012 04:07:43 Bob Liu wrote:
arch/blackfin/include/asm/config-pre.h +1 -0
 
 #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 */

arch/blackfin/include/asm/config-pre.h

Quoted 10 lines
arch/blackfin/include/asm/config-pre.h +3 -0
+#define BFIN_BOOT_LP_SLAVE    15      /* boot ldr from link port */
 
    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";
      }
 }

seems like a change that should be by itself, or squashed into the "core bf60x support" patch

arch/blackfin/include/asm/mach-common/bits/dma.h

Quoted 2 lines
arch/blackfin/include/asm/mach-common/bits/dma.h +0 -0

should be part of the "bf60x dma" patch

drivers/mmc/bfin_sdh.c

Quoted 4 lines
arch/blackfin/include/asm/mach-common/bits/sdh.h +0 -0
drivers/mmc/bfin_sdh.c +0 -0

these are about the only changes that should be in this patch, and the subject should be:

Quoted 8 lines
        Blackfin: rsi: add support for bf60x

include/configs/bf609-ezkit.h

Quoted 4 lines
board/bf609-ezkit/bf609-ezkit.c +0 -0
include/configs/bf609-ezkit.h +0 -0

merge the rsi patch first, then squash this into the bf609-ezkit board patch

Okay.

Signature · 2 lines
Regards,
--Bob
author
#13 lore raw

PATCH 5/16 Blackfin: Paraflash: add support for bf609-ezkit

In reply to Mike Frysinger
Quoted 32 lines · Mike Frysinger

arch/blackfin/include/asm/mach-bf609/portmux.h

Quoted 2 lines · On Tuesday 07 August 2012 04:07:44 Bob Liu wrote:
arch/blackfin/include/asm/mach-bf609/portmux.h +0 -0

this should be part of the initial commit of this header (one of the initial bf60x support patches)

include/configs/bf609-ezkit.h

Quoted 4 lines
board/bf609-ezkit/bf609-ezkit.c +0 -0
include/configs/bf609-ezkit.h +0 -0

then squash these into the initial bf609-ezkit board patch

Quoted 6 lines
include/configs/bfin_adi_common.h +0 -0
@@ -195,10 +195,12 @@
              "nand erase 0 0x40000;" \
              "nand write $(loadaddr) 0 0x40000"
 # else

include/configs/bfin_adi_common.h line 206

Quoted 10 lines
include/configs/bfin_adi_common.h +3 -1
-#  define UBOOT_ENV_UPDATE \
+#  ifndef UBOOT_ENV_UPDATE
+#   define UBOOT_ENV_UPDATE \
              "protect off 0x20000000 +$(filesize);" \
              "erase 0x20000000 +$(filesize);" \
              "cp.b $(loadaddr) 0x20000000 $(filesize)"
+#  endif
 # endif
 # ifdef CONFIG_NETCONSOLE
 #  define NETCONSOLE_ENV \

replace the 0x20000000 with a define and then there's no need to override it

Quoted 4 lines
#   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)"

Okay.

Signature · 2 lines
Regards,
--Bob
author
#16 lore raw

PATCH 6/16 Blackfin: Bf609-ezkit: implement soft switch

In reply to Mike Frysinger
Quoted 4 lines · Mike Frysinger
Quoted 3 lines · On Tuesday 07 August 2012 04:07:45 Bob Liu wrote:
board/bf609-ezkit/Makefile +0 -0
Quoted 8 lines
Quoted 1 line

+COBJS-$(CONFIG_BFIN_SOFT_SWITCH) += soft_switch.o

is there any reason we *wouldn't* want to build this ? i would just skip making this an option and always enable it.

also, any reason for not just squashing into the initial bf609-ezkit board port ? there's quite a bit of rudimentary code in bf609-ezkit.c before to support this.

Okay.

Quoted 10 lines

board/bf609-ezkit/bf609-ezkit.c int board_mmc_init(bd_t *bis) · line 66

Quoted 8 lines
board/bf609-ezkit/bf609-ezkit.c +4 -0
 
+/* miscellaneous platform dependent initialisations */
+int misc_init_r(void)
+{
+     printf("other init\n");

useless display -> delete

Will be deleted.

Quoted 4 lines
Quoted 4 lines
board/bf609-ezkit/soft_switch.c new file +0 -0
Quoted 9 lines

board/bf609-ezkit/soft_switch.c line 19

Quoted 5 lines
board/bf609-ezkit/soft_switch.c new file +5 -0
+#ifdef CONFIG_BFIN_BOARD_VERSION_1_0
+#define SWITCH_ADDR     0x21
+#else
+#define SWITCH_ADDR     0x20
+#endif

must this be a runtime define ? can't you probe the slave address at runtime to figure out which one to use ?

This will be removed. We only support board version above 1.0.

Quoted 7 lines

start with the address that the newest boards are using, and then fallback to the older ones. this way there's no runtime penalty on newer boards, but older ones continue to work.

shouldn't there be a new u-boot command here so people can toggle peripherals themselves ? i thought that was the intention when we first discussed this idea with the firmware team.

I don't know whether a blackfin specific u-boot command can be accepted. What about merge these series with the default setting first? Because it's already a little big, let's make it simple at first.

And then we can consider to add a new command in a separated patch in future. Thank you.

Signature · 2 lines
Regards,
--Bob
author
#20 lore raw

PATCH 7/16 Blackfin: Spi: add bf6xx spi driver

In reply to Mike Frysinger
Quoted 10 lines · Mike Frysinger

arch/blackfin/include/asm/mach-common/bits/spi6xx.h line 2

Quoted 5 lines · On Tuesday 07 August 2012 04:07:46 Bob Liu wrote:
arch/blackfin/include/asm/mach-common/bits/spi6xx.h new file +2 -0
@@ -0,0 +1,240 @@
+/*
+ * Analog Devices SPI3 controller driver

i'd prefer to call it "bfin_spi3" then since it represents the version of the IP block and not the SoC it happens to be shipped with

Quoted 5 lines

include/configs/bf609-ezkit.h

Quoted 2 lines
include/configs/bf609-ezkit.h +0 -0

this should be squashed into the bf609-ezkit board port patch -mike

Okay

Signature · 2 lines
Regards,
--Bob
author
#23 lore raw

PATCH 8/16 Blackfin: add more print info for Bf60x

In reply to Mike Frysinger
Quoted 4 lines · Mike Frysinger
Quoted 3 lines · On Tuesday 07 August 2012 04:07:47 Bob Liu wrote:
arch/blackfin/lib/clocks.c +0 -0
Quoted 13 lines

arch/blackfin/lib/clocks.c u_long get_sclk1(void) · line 142

Quoted 8 lines
arch/blackfin/lib/clocks.c +8 -0
+u_long get_dclk(void)
+{
+#ifndef CONFIG_BFIN_GET_DCLK
+     return _get_sclk(&cached_dclk);
+#else
+     return CONFIG_BFIN_GET_DCLK;
+#endif
+}

this looks like my incomplete hack where the implementation of clock lookups weren't finished. that was because at the time, the hardware blocks of the bf60x were not finished which means i couldn't query the MMRs to calculate the values. please implement this ...

Will be implemented.

Quoted 11 lines

include/configs/bf609-ezkit.h line 67

Quoted 8 lines
include/configs/bf609-ezkit.h +1 -0
 
 #define CONFIG_BFIN_GET_SCLK (CONFIG_PLL_CLK/CONFIG_SYSCLK_DIV)
 #define CONFIG_BFIN_GET_SCLK0 (get_sclk()/CONFIG_SCLK0_DIV)
 #define CONFIG_BFIN_GET_SCLK1 (get_sclk()/CONFIG_SCLK1_DIV)
+#define CONFIG_BFIN_GET_DCLK (get_cclk()/CONFIG_DCLK_DIV)

and then point all these hard coded defines. these existed purely for initial FPGA bring up and were not intended to be shipped as the final code.

Will be updated.
Thank you

Signature · 2 lines
Regards,
--Bob
author
#26 lore raw

PATCH 9/16 Blackfin: Bf60x: add reset support

In reply to Mike Frysinger
Quoted 2 lines · Mike Frysinger

please squash into one of the "initial bf60x cpu support" patches -mike

Okay.

Signature · 2 lines
Regards,
--Bob
author
#29 lore raw

PATCH 10/16 Blackfin: Bf60x: Check card ready for each RSI command

In reply to Mike Frysinger
Quoted 5 lines · Mike Frysinger
Quoted 1 line · On Tuesday 07 August 2012 04:07:49 Bob Liu wrote:

Set up RSI data before sending RSI command if data is applicable.

squash into the "Blackfin: rsi: add bf60x support" patch -mike

Okay.

Signature · 2 lines
Regards,
--Bob
author
#36 lore raw

PATCH 13/16 Blackfin: Bf60x: add hw watchdog support

In reply to Mike Frysinger
Quoted 13 lines · Mike Frysinger
Quoted 12 lines · On Tuesday 07 August 2012 04:07:52 Bob Liu wrote:
arch/blackfin/cpu/initcode.c +7 -0
 
      if (CONFIG_BFIN_BOOT_MODE != BFIN_BOOT_BYPASS) {
              serial_putc('e');
+#ifdef __ADSPBF60x__
+             int i;
+             bfin_write_SEC_GCTL(0x2);
+             while (i++ < 100000);
+             bfin_write_SEC_FCTL(0xc1);
+             bfin_write_SEC_SCTL(2, bfin_read_SEC_SCTL(2) | 0x6);
+
Quoted 8 lines

arch/blackfin/cpu/initcode.c program_early_devices(ADI_BOOT_DATA *bs, uint *sdivB, uint *divB, uint *vcoB) · line 472

Quoted 5 lines
arch/blackfin/cpu/initcode.c +5 -0
+             bfin_write_SEC_CCTL(0x2);
+             while (i++ < 100000);
+             bfin_write_SEC_GCTL(0x1);
+             bfin_write_SEC_CCTL(0x1);
+#endif

err, this doesn't look like hardware watchdog ... this is the interrupt controller isn't it ?

The interrupt controller in bf60x has integrated a fault controller. The watchdog can trigger a reset fault then the system can do automatic reset.

Quoted 3 lines

those while() loops also won't fly -- you need to use a proper sync function here. certainly not without comments as to what's going on.

Will be updated.

Quoted 6 lines
Quoted 6 lines
arch/blackfin/cpu/start.S +0 -0
@@ -65,6 +65,7 @@ ENTRY(_start)
      p5.h = HI(COREMMR_BASE);
 
Quoted 13 lines

arch/blackfin/cpu/start.S ENTRY(_start) · line 82

Quoted 10 lines
arch/blackfin/cpu/start.S +2 -0
 #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

you need to implement the bf60x equivalent here and not just disable the bf5xx code

This code is setup a watchdog for bootstrap itself before entering uboot common routine.
It's not that important and a little complicate to setup the interrupt controller using assemble.
So i'd prefer to disable it for bf60x first.

Signature · 2 lines
Regards,
--Bob
author
#41 lore raw

PATCH 16/16 Blackfin: update license to Clear BSD license.

In reply to Mike Frysinger
Quoted 2 lines · Mike Frysinger

obviously this is OK regardless of my opinion on it ;) -mike

Thank for all your review.

Signature · 2 lines
Regards,
--Bob
#7 lore raw

PATCH 3/16 Blackfin: Bf60x: support big cplb page

In reply to Bob Liu
Quoted 13 lines · On Monday 20 August 2012 04:00:21 Bob Liu wrote:
Quoted 11 lines · Mike Frysinger

arch/blackfin/lib/board.c static void display_global_data(void)

Quoted 8 lines · On Tuesday 07 August 2012 04:07:42 Bob Liu wrote:
arch/blackfin/lib/board.c +2 -0
 
 void init_cplbtables(void)
 {
...
+#if defined(__ADSPBF60x__)
+     icplb_add(0x0, 0x0);

err, why ?

Quoted 2 lines

Because other place use value "i" for both icplb and dcplb this make them consistent.

why not add an ICPLB entry for the same region you just added a DCPLB entry for ? we can directly execute out of the flash memory region ...

Quoted 7 lines
Quoted 5 lines

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

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

why only use CPLBs of 4 megs for external memory on BF60x ? you would want to maximize the usage of 16MiB to reduce CPLB overhead.

Bf60x will reinit cplb_page_size/mask behind.

sorry, i don't understand what you mean
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120822/4f60cd3a/attachment.pgp>

#17 lore raw

PATCH 6/16 Blackfin: Bf609-ezkit: implement soft switch

In reply to Bob Liu
Quoted 10 lines · On Monday 20 August 2012 04:11:17 Bob Liu wrote:
Quoted 7 lines · Mike Frysinger

start with the address that the newest boards are using, and then fallback to the older ones. this way there's no runtime penalty on newer boards, but older ones continue to work.

shouldn't there be a new u-boot command here so people can toggle peripherals themselves ? i thought that was the intention when we first discussed this idea with the firmware team.

I don't know whether a blackfin specific u-boot command can be accepted.

sure it will. we've got some already (like "bootldr" and "otp" and "cplbinfo" and "ldrinfo"). if it's board specific (i suspect it will be), then just add it to the bf609-ezkit board dir. you can add u-boot commands in there just as easily as the common/ directory.

common/cmd_cplbinfo.c is probably the easiest example to get you up and running

Quoted 2 lines

What about merge these series with the default setting first? Because it's already a little big, let's make it simple at first.

sure, setting up sane defaults is OK, but we'll still want the command :) -mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120822/b12cca41/attachment.pgp>