Yusuke Goda | cf23602 | 2008-03-11 12:55:12 +0900 | [diff] [blame] | 1 | /* |
Nobuhiro Iwamatsu | d76619d | 2008-03-12 18:02:57 +0900 | [diff] [blame] | 2 | * Copyright (C) 2007,2008 Nobuhiro Iwamatsu <iwamatsu@nigauri.org> |
Yusuke Goda | cf23602 | 2008-03-11 12:55:12 +0900 | [diff] [blame] | 3 | * Copyright (C) 2008 Yusuke Goda <goda.yusuke@renesas.com> |
| 4 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
Yusuke Goda | cf23602 | 2008-03-11 12:55:12 +0900 | [diff] [blame] | 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> |
Ben Warren | 26425a6 | 2008-08-31 09:49:42 -0700 | [diff] [blame] | 13 | #include <netdev.h> |
Yusuke Goda | cf23602 | 2008-03-11 12:55:12 +0900 | [diff] [blame] | 14 | #include "r7780mp.h" |
| 15 | |
John Rigby | 0d21ed0 | 2010-12-20 18:27:51 -0700 | [diff] [blame] | 16 | DECLARE_GLOBAL_DATA_PTR; |
| 17 | |
Yusuke Goda | cf23602 | 2008-03-11 12:55:12 +0900 | [diff] [blame] | 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 */ |
Nobuhiro Iwamatsu | 9aa0bd7 | 2008-06-17 16:27:41 +0900 | [diff] [blame] | 31 | writew(0x0, PHCR); |
Yusuke Goda | cf23602 | 2008-03-11 12:55:12 +0900 | [diff] [blame] | 32 | |
Yusuke Goda | cf23602 | 2008-03-11 12:55:12 +0900 | [diff] [blame] | 33 | return 0; |
| 34 | } |
| 35 | |
Nobuhiro Iwamatsu | 9aa0bd7 | 2008-06-17 16:27:41 +0900 | [diff] [blame] | 36 | int dram_init(void) |
Yusuke Goda | cf23602 | 2008-03-11 12:55:12 +0900 | [diff] [blame] | 37 | { |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 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)); |
Yusuke Goda | cf23602 | 2008-03-11 12:55:12 +0900 | [diff] [blame] | 41 | return 0; |
| 42 | } |
| 43 | |
Nobuhiro Iwamatsu | 9aa0bd7 | 2008-06-17 16:27:41 +0900 | [diff] [blame] | 44 | void led_set_state(unsigned short value) |
Yusuke Goda | cf23602 | 2008-03-11 12:55:12 +0900 | [diff] [blame] | 45 | { |
| 46 | |
| 47 | } |
| 48 | |
Nobuhiro Iwamatsu | 9aa0bd7 | 2008-06-17 16:27:41 +0900 | [diff] [blame] | 49 | void ide_set_reset(int idereset) |
Yusuke Goda | cf23602 | 2008-03-11 12:55:12 +0900 | [diff] [blame] | 50 | { |
| 51 | /* if reset = 1 IDE reset will be asserted */ |
Nobuhiro Iwamatsu | 9aa0bd7 | 2008-06-17 16:27:41 +0900 | [diff] [blame] | 52 | if (idereset) { |
| 53 | writew(0x432, FPGA_CFCTL); |
Yusuke Goda | cf23602 | 2008-03-11 12:55:12 +0900 | [diff] [blame] | 54 | #if defined(CONFIG_R7780MP) |
Nobuhiro Iwamatsu | 9aa0bd7 | 2008-06-17 16:27:41 +0900 | [diff] [blame] | 55 | writew(inw(FPGA_CFPOW)|0x01, FPGA_CFPOW); |
Yusuke Goda | cf23602 | 2008-03-11 12:55:12 +0900 | [diff] [blame] | 56 | #else |
Nobuhiro Iwamatsu | 9aa0bd7 | 2008-06-17 16:27:41 +0900 | [diff] [blame] | 57 | writew(inw(FPGA_CFPOW)|0x02, FPGA_CFPOW); |
Yusuke Goda | cf23602 | 2008-03-11 12:55:12 +0900 | [diff] [blame] | 58 | #endif |
Nobuhiro Iwamatsu | 9aa0bd7 | 2008-06-17 16:27:41 +0900 | [diff] [blame] | 59 | writew(0x01, FPGA_CFCDINTCLR); |
Yusuke Goda | cf23602 | 2008-03-11 12:55:12 +0900 | [diff] [blame] | 60 | } |
| 61 | } |
| 62 | |
Yusuke Goda | cf23602 | 2008-03-11 12:55:12 +0900 | [diff] [blame] | 63 | static struct pci_controller hose; |
| 64 | void pci_init_board(void) |
| 65 | { |
Nobuhiro Iwamatsu | 9aa0bd7 | 2008-06-17 16:27:41 +0900 | [diff] [blame] | 66 | pci_sh7780_init(&hose); |
Yusuke Goda | cf23602 | 2008-03-11 12:55:12 +0900 | [diff] [blame] | 67 | } |
Ben Warren | 26425a6 | 2008-08-31 09:49:42 -0700 | [diff] [blame] | 68 | |
| 69 | int board_eth_init(bd_t *bis) |
| 70 | { |
Bernhard Kaindl | adb18ea | 2011-10-20 10:56:59 +0000 | [diff] [blame] | 71 | /* return >= 0 if a chip is found, the board's AX88796L is n2k-based */ |
| 72 | return ne2k_register() + pci_eth_init(bis); |
Ben Warren | 26425a6 | 2008-08-31 09:49:42 -0700 | [diff] [blame] | 73 | } |