blob: 9df01ad25aaa7f45245eb4c235332c0d5c9016df [file] [log] [blame]
Mike Frysingerd4d77302008-02-04 19:26:55 -05001/*
2 * blackfin-config-pre.h - common defines for Blackfin boards in config.h
3 *
4 * Copyright (c) 2007 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
7 */
8
9#ifndef __ASM_BLACKFIN_CONFIG_PRE_H__
10#define __ASM_BLACKFIN_CONFIG_PRE_H__
11
12/* Misc helper functions */
13#define XMK_STR(x) #x
14#define MK_STR(x) XMK_STR(x)
15#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
16
17/* Configurable Blackfin-specific monitor commands */
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020018#define CONFIG_SYS_BFIN_CMD_BOOTLDR 0x01
19#define CONFIG_SYS_BFIN_CMD_CPLBINFO 0x02
20#define CONFIG_SYS_BFIN_CMD_OTP 0x04
21#define CONFIG_SYS_BFIN_CMD_CACHE_DUMP 0x08
Mike Frysingerd4d77302008-02-04 19:26:55 -050022
Mike Frysinger30fb9d22008-08-07 13:17:03 -040023/* Bootmode defines -- your config needs to select this via CONFIG_BFIN_BOOT_MODE.
Mike Frysingerd4d77302008-02-04 19:26:55 -050024 * Depending on your cpu, some of these may not be valid, check your HRM.
25 * The actual values here are meaningless as long as they're unique.
26 */
27#define BFIN_BOOT_BYPASS 1 /* bypass bootrom */
28#define BFIN_BOOT_PARA 2 /* boot ldr out of parallel flash */
29#define BFIN_BOOT_SPI_MASTER 3 /* boot ldr out of serial flash */
30#define BFIN_BOOT_SPI_SLAVE 4 /* boot ldr as spi slave */
31#define BFIN_BOOT_TWI_MASTER 5 /* boot ldr over twi device */
32#define BFIN_BOOT_TWI_SLAVE 6 /* boot ldr over twi slave */
33#define BFIN_BOOT_UART 7 /* boot ldr over uart */
34#define BFIN_BOOT_IDLE 8 /* do nothing, just idle */
35#define BFIN_BOOT_FIFO 9 /* boot ldr out of FIFO */
36#define BFIN_BOOT_MEM 10 /* boot ldr out of memory (warmboot) */
37#define BFIN_BOOT_16HOST_DMA 11 /* boot ldr from 16-bit host dma */
38#define BFIN_BOOT_8HOST_DMA 12 /* boot ldr from 8-bit host dma */
Mike Frysinger30fb9d22008-08-07 13:17:03 -040039#define BFIN_BOOT_NAND 13 /* boot ldr from nand flash */
Mike Frysingerd4d77302008-02-04 19:26:55 -050040
Mike Frysingerfc68f9f2009-01-06 06:16:19 -050041#ifndef __ASSEMBLY__
42static inline const char *get_bfin_boot_mode(int bfin_boot)
43{
44 switch (bfin_boot) {
45 case BFIN_BOOT_BYPASS: return "bypass";
46 case BFIN_BOOT_PARA: return "parallel flash";
47 case BFIN_BOOT_SPI_MASTER: return "spi flash";
48 case BFIN_BOOT_SPI_SLAVE: return "spi slave";
49 case BFIN_BOOT_TWI_MASTER: return "i2c flash";
50 case BFIN_BOOT_TWI_SLAVE: return "i2c slave";
51 case BFIN_BOOT_UART: return "uart";
52 case BFIN_BOOT_IDLE: return "idle";
53 case BFIN_BOOT_FIFO: return "fifo";
54 case BFIN_BOOT_MEM: return "memory";
55 case BFIN_BOOT_16HOST_DMA: return "16bit dma";
56 case BFIN_BOOT_8HOST_DMA: return "8bit dma";
57 case BFIN_BOOT_NAND: return "nand flash";
58 default: return "INVALID";
59 }
60}
61#endif
62
Mike Frysinger4b7e3d02009-01-13 11:00:29 -050063/* Define the default SPI CS used when booting out of SPI */
64#if defined(__ADSPBF531__) || defined(__ADSPBF532__) || defined(__ADSPBF533__) || \
65 defined(__ADSPBF538__) || defined(__ADSPBF539__) || defined(__ADSPBF561__) || \
66 defined(__ADSPBF51x__)
67# define BFIN_BOOT_SPI_SSEL 2
68#else
69# define BFIN_BOOT_SPI_SSEL 1
70#endif
71
Mike Frysingerd4d77302008-02-04 19:26:55 -050072#endif