blob: 4cc5e75724a914202ee5e3033f549599aaf3b2f4 [file] [log] [blame]
Masahiro Yamadabb2ff9d2014-10-03 19:21:06 +09001/*
Masahiro Yamada8ce9bdf2015-02-27 02:26:48 +09002 * Copyright (C) 2011-2015 Panasonic Corporation
Masahiro Yamadabb2ff9d2014-10-03 19:21:06 +09003 * Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
4 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7
8#include <common.h>
9#include <asm/io.h>
Masahiro Yamada95387e22015-02-27 02:26:44 +090010#include <mach/sbc-regs.h>
11#include <mach/sg-regs.h>
Masahiro Yamadabb2ff9d2014-10-03 19:21:06 +090012
13void sbc_init(void)
14{
15#if defined(CONFIG_PFC_MICRO_SUPPORT_CARD)
16 /*
17 * Only CS1 is connected to support card.
18 * BKSZ[1:0] should be set to "01".
19 */
20 writel(SBCTRL0_SAVEPIN_PERI_VALUE, SBCTRL10);
21 writel(SBCTRL1_SAVEPIN_PERI_VALUE, SBCTRL11);
22 writel(SBCTRL2_SAVEPIN_PERI_VALUE, SBCTRL12);
23 writel(SBCTRL4_SAVEPIN_PERI_VALUE, SBCTRL14);
24
Masahiro Yamadae6a91272014-12-06 00:03:19 +090025 if (boot_is_swapped()) {
Masahiro Yamadabb2ff9d2014-10-03 19:21:06 +090026 /*
27 * Boot Swap On: boot from external NOR/SRAM
28 * 0x02000000-0x03ffffff is a mirror of 0x00000000-0x01ffffff.
29 *
30 * 0x00000000-0x01efffff, 0x02000000-0x03efffff: memory bank
31 * 0x01f00000-0x01ffffff, 0x03f00000-0x03ffffff: peripherals
32 */
33 writel(0x0000bc01, SBBASE0);
Masahiro Yamadae6a91272014-12-06 00:03:19 +090034 } else {
35 /*
36 * Boot Swap Off: boot from mask ROM
37 * 0x00000000-0x01ffffff: mask ROM
Masahiro Yamada8ce9bdf2015-02-27 02:26:48 +090038 * 0x02000000-0x03efffff: memory bank (31MB)
39 * 0x03f00000-0x03ffffff: peripherals (1MB)
Masahiro Yamadae6a91272014-12-06 00:03:19 +090040 */
41 writel(0x0000be01, SBBASE0); /* dummy */
42 writel(0x0200be01, SBBASE1);
Masahiro Yamadabb2ff9d2014-10-03 19:21:06 +090043 }
44#elif defined(CONFIG_DCC_MICRO_SUPPORT_CARD)
Masahiro Yamadabb2ff9d2014-10-03 19:21:06 +090045 /* XECS0: boot/sub memory (boot swap = off/on) */
46 writel(SBCTRL0_SAVEPIN_MEM_VALUE, SBCTRL00);
47 writel(SBCTRL1_SAVEPIN_MEM_VALUE, SBCTRL01);
48 writel(SBCTRL2_SAVEPIN_MEM_VALUE, SBCTRL02);
49 writel(SBCTRL4_SAVEPIN_MEM_VALUE, SBCTRL04);
Masahiro Yamada8763f312015-02-27 02:26:49 +090050
Masahiro Yamadabb2ff9d2014-10-03 19:21:06 +090051 /* XECS1: sub/boot memory (boot swap = off/on) */
52 writel(SBCTRL0_SAVEPIN_MEM_VALUE, SBCTRL10);
53 writel(SBCTRL1_SAVEPIN_MEM_VALUE, SBCTRL11);
54 writel(SBCTRL2_SAVEPIN_MEM_VALUE, SBCTRL12);
55 writel(SBCTRL4_SAVEPIN_MEM_VALUE, SBCTRL14);
56
57 /* XECS3: peripherals */
58 writel(SBCTRL0_SAVEPIN_PERI_VALUE, SBCTRL30);
59 writel(SBCTRL1_SAVEPIN_PERI_VALUE, SBCTRL31);
60 writel(SBCTRL2_SAVEPIN_PERI_VALUE, SBCTRL32);
61 writel(SBCTRL4_SAVEPIN_PERI_VALUE, SBCTRL34);
62
63 writel(0x0000bc01, SBBASE0); /* boot memory */
64 writel(0x0400bc01, SBBASE1); /* sub memory */
65 writel(0x0800bf01, SBBASE3); /* peripherals */
66
Masahiro Yamada8763f312015-02-27 02:26:49 +090067 /* enable access to sub memory when boot swap is on */
68 if (boot_is_swapped())
69 sg_set_pinsel(318, 5); /* PORT22 -> XECS0 */
70
Masahiro Yamadabb2ff9d2014-10-03 19:21:06 +090071 sg_set_pinsel(313, 5); /* PORT15 -> XECS3 */
72 writel(0x00000001, SG_LOADPINCTRL);
73
74#endif /* CONFIG_XXX_MICRO_SUPPORT_CARD */
75}