blob: e0aad6de0f787428f9bad0b07f7c6353dc004b54 [file] [log] [blame]
Mike Frysinger4150cec2011-05-30 13:47:38 -04001/*
2 * Code for early processor initialization
3 *
4 * Copyright (c) 2004-2011 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
7 */
8
9#ifndef __BFIN_INITCODE_H__
10#define __BFIN_INITCODE_H__
11
12#include <asm/mach-common/bits/bootrom.h>
13
14#ifndef BFIN_IN_INITCODE
15# define serial_putc(c)
16#endif
17
18#ifndef CONFIG_EBIU_RSTCTL_VAL
19# define CONFIG_EBIU_RSTCTL_VAL 0 /* only MDDRENABLE is useful */
20#endif
21#if ((CONFIG_EBIU_RSTCTL_VAL & 0xFFFFFFC4) != 0)
22# error invalid EBIU_RSTCTL value: must not set reserved bits
23#endif
24
25#ifndef CONFIG_EBIU_MBSCTL_VAL
26# define CONFIG_EBIU_MBSCTL_VAL 0
27#endif
28
29#if defined(CONFIG_EBIU_DDRQUE_VAL) && ((CONFIG_EBIU_DDRQUE_VAL & 0xFFFF8000) != 0)
30# error invalid EBIU_DDRQUE value: must not set reserved bits
31#endif
32
33__attribute__((always_inline)) static inline void
34program_async_controller(ADI_BOOT_DATA *bs)
35{
36#ifdef BFIN_IN_INITCODE
37 /*
38 * We really only need to setup the async banks early if we're
39 * booting out of it. Otherwise, do it later on in cpu_init.
40 */
41 if (CONFIG_BFIN_BOOT_MODE != BFIN_BOOT_BYPASS &&
42 CONFIG_BFIN_BOOT_MODE != BFIN_BOOT_PARA)
43 return;
44#endif
45
46 serial_putc('a');
47
48 /* Program the async banks controller. */
49 bfin_write_EBIU_AMBCTL0(CONFIG_EBIU_AMBCTL0_VAL);
50 bfin_write_EBIU_AMBCTL1(CONFIG_EBIU_AMBCTL1_VAL);
51 bfin_write_EBIU_AMGCTL(CONFIG_EBIU_AMGCTL_VAL);
52
53 serial_putc('b');
54
55 /* Not all parts have these additional MMRs. */
56#ifdef EBIU_MBSCTL
57 bfin_write_EBIU_MBSCTL(CONFIG_EBIU_MBSCTL_VAL);
58#endif
59#ifdef EBIU_MODE
60# ifdef CONFIG_EBIU_MODE_VAL
61 bfin_write_EBIU_MODE(CONFIG_EBIU_MODE_VAL);
62# endif
63# ifdef CONFIG_EBIU_FCTL_VAL
64 bfin_write_EBIU_FCTL(CONFIG_EBIU_FCTL_VAL);
65# endif
66#endif
67
68 serial_putc('c');
69}
70
71#endif