xref: /openbmc/u-boot/board/renesas/r7780mp/r7780mp.c (revision ad3098f7)
1 /*
2  * Copyright (C) 2007,2008 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
3  * Copyright (C) 2008 Yusuke Goda <goda.yusuke@renesas.com>
4  *
5  * SPDX-License-Identifier:	GPL-2.0+
6  */
7 
8 #include <common.h>
9 #include <ide.h>
10 #include <asm/processor.h>
11 #include <asm/io.h>
12 #include <asm/pci.h>
13 #include <netdev.h>
14 #include "r7780mp.h"
15 
16 DECLARE_GLOBAL_DATA_PTR;
17 
18 int checkboard(void)
19 {
20 #if defined(CONFIG_R7780MP)
21 	puts("BOARD: Renesas Solutions R7780MP\n");
22 #else
23 	puts("BOARD: Renesas Solutions R7780RP\n");
24 #endif
25 	return 0;
26 }
27 
28 int board_init(void)
29 {
30 	/* SCIF Enable */
31 	writew(0x0, PHCR);
32 
33 	return 0;
34 }
35 
36 int dram_init(void)
37 {
38 	gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
39 	gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
40 	printf("DRAM:  %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024));
41 	return 0;
42 }
43 
44 void led_set_state(unsigned short value)
45 {
46 
47 }
48 
49 void ide_set_reset(int idereset)
50 {
51 	/* if reset = 1 IDE reset will be asserted */
52 	if (idereset) {
53 		writew(0x432, FPGA_CFCTL);
54 #if defined(CONFIG_R7780MP)
55 		writew(inw(FPGA_CFPOW)|0x01, FPGA_CFPOW);
56 #else
57 		writew(inw(FPGA_CFPOW)|0x02, FPGA_CFPOW);
58 #endif
59 		writew(0x01, FPGA_CFCDINTCLR);
60 	}
61 }
62 
63 static struct pci_controller hose;
64 void pci_init_board(void)
65 {
66 	pci_sh7780_init(&hose);
67 }
68 
69 int board_eth_init(bd_t *bis)
70 {
71 	/* return >= 0 if a chip is found, the board's AX88796L is n2k-based */
72 	return ne2k_register() + pci_eth_init(bis);
73 }
74