]>
git.ipfire.org Git - people/ms/u-boot.git/blob - board/alphaproject/ap_sh4a_4a/ap_sh4a_4a.c
2 * Copyright (C) 2012 Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
3 * Copyright (C) 2012 Renesas Solutions Corp.
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
22 #include <asm/processor.h>
26 DECLARE_GLOBAL_DATA_PTR
;
28 #define MODEMR (0xFFCC0020)
29 #define MODEMR_MASK (0x6)
30 #define MODEMR_533MHZ (0x2)
34 u32 r
= readl(MODEMR
);
35 if ((r
& MODEMR_MASK
) & MODEMR_533MHZ
)
36 puts("CPU Clock: 533MHz\n");
38 puts("CPU Clock: 400MHz\n");
40 puts("BOARD: Alpha Project. AP-SH4A-4A\n");
44 #define MSTPSR1 (0xFFC80044)
45 #define MSTPCR1 (0xFFC80034)
46 #define MSTPSR1_GETHER (1 << 14)
49 #define ET0_ETXD0 (0x4 << 3)
50 #define ET0_GTX_CLK_A (0x4 << 6)
51 #define ET0_ETXD1_A (0x4 << 9)
52 #define ET0_ETXD2_A (0x4 << 12)
53 #define ET0_ETXD3_A (0x4 << 15)
54 #define ET0_ETXD4 (0x3 << 18)
55 #define ET0_ETXD5_A (0x5 << 21)
56 #define ET0_ETXD6_A (0x5 << 24)
57 #define ET0_ETXD7 (0x4 << 27)
58 #define IPSR3_ETH_ENABLE \
59 (ET0_ETXD0 | ET0_GTX_CLK_A | ET0_ETXD1_A | ET0_ETXD2_A | \
60 ET0_ETXD3_A | ET0_ETXD4 | ET0_ETXD5_A | ET0_ETXD6_A | ET0_ETXD7)
63 #define ET0_ERXD7 (0x4)
64 #define ET0_RX_DV (0x4 << 3)
65 #define ET0_RX_ER (0x4 << 6)
66 #define ET0_CRS (0x4 << 9)
67 #define ET0_COL (0x4 << 12)
68 #define ET0_MDC (0x4 << 15)
69 #define ET0_MDIO_A (0x3 << 18)
70 #define ET0_LINK_A (0x3 << 20)
71 #define ET0_PHY_INT_A (0x3 << 24)
73 #define IPSR4_ETH_ENABLE \
74 (ET0_ERXD7 | ET0_RX_DV | ET0_RX_ER | ET0_CRS | ET0_COL | \
75 ET0_MDC | ET0_MDIO_A | ET0_LINK_A | ET0_PHY_INT_A)
78 #define ET0_ERXD0 (0x4 << 20)
79 #define ET0_ERXD1 (0x4 << 23)
80 #define ET0_ERXD2_A (0x3 << 26)
81 #define ET0_ERXD3_A (0x3 << 28)
82 #define IPSR8_ETH_ENABLE \
83 (ET0_ERXD0 | ET0_ERXD1 | ET0_ERXD2_A | ET0_ERXD3_A)
86 #define RX4_D (0x1 << 22)
87 #define TX4_D (0x1 << 23)
88 #define IPSR10_SCIF_ENABLE (RX4_D | TX4_D)
91 #define ET0_ERXD4 (0x4 << 4)
92 #define ET0_ERXD5 (0x4 << 7)
93 #define ET0_ERXD6 (0x3 << 10)
94 #define ET0_TX_EN (0x2 << 19)
95 #define ET0_TX_ER (0x2 << 21)
96 #define ET0_TX_CLK_A (0x4 << 23)
97 #define ET0_RX_CLK_A (0x3 << 26)
98 #define IPSR11_ETH_ENABLE \
99 (ET0_ERXD4 | ET0_ERXD5 | ET0_ERXD6 | ET0_TX_EN | ET0_TX_ER | \
100 ET0_TX_CLK_A | ET0_RX_CLK_A)
102 #define GPSR1_INIT (0xFFFF7FFF)
103 #define GPSR2_INIT (0x4005FEFF)
104 #define GPSR3_INIT (0x2EFFFFFF)
105 #define GPSR4_INIT (0xC7000000)
111 /* Set IPSR register */
113 data
|= IPSR3_ETH_ENABLE
;
118 data
|= IPSR4_ETH_ENABLE
;
123 data
|= IPSR8_ETH_ENABLE
;
127 data
= readl(IPSR10
);
128 data
|= IPSR10_SCIF_ENABLE
;
130 writel(data
, IPSR10
);
132 data
= readl(IPSR11
);
133 data
|= IPSR11_ETH_ENABLE
;
135 writel(data
, IPSR11
);
159 data
= MODESEL2_INIT
;
161 writel(data
, MODESEL2
);
163 #if defined(CONFIG_SH_ETHER)
164 u32 r
= readl(MSTPSR1
);
165 if (r
& MSTPSR1_GETHER
)
166 writel((r
& ~MSTPSR1_GETHER
), MSTPCR1
);
171 int board_late_init(void)
175 /* Read Mac Address and set*/
176 i2c_init(CONFIG_SYS_I2C_SPEED
, CONFIG_SYS_I2C_SLAVE
);
177 i2c_set_bus_num(CONFIG_SYS_I2C_MODULE
);
179 /* Read MAC address */
180 i2c_read(0x50, 0x0, 0, mac
, 6);
182 if (is_valid_ether_addr(mac
))
183 eth_setenv_enetaddr("ethaddr", mac
);
190 gd
->bd
->bi_memstart
= CONFIG_SYS_SDRAM_BASE
;
191 gd
->bd
->bi_memsize
= CONFIG_SYS_SDRAM_SIZE
;
192 printf("DRAM: %dMB\n", CONFIG_SYS_SDRAM_SIZE
/ (1024 * 1024));