Yusuke Goda | c133c1f | 2008-03-11 12:55:12 +0900 | [diff] [blame] | 1 | /* |
Nobuhiro Iwamatsu | f309fa3 | 2008-03-12 18:02:57 +0900 | [diff] [blame] | 2 | * Copyright (C) 2007,2008 Nobuhiro Iwamatsu <iwamatsu@nigauri.org> |
Yusuke Goda | c133c1f | 2008-03-11 12:55:12 +0900 | [diff] [blame] | 3 | * Copyright (C) 2008 Yusuke Goda <goda.yusuke@renesas.com> |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU General Public License as |
| 7 | * published by the Free Software Foundation; either version 2 of |
| 8 | * the License, or (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 18 | * MA 02111-1307 USA |
| 19 | */ |
| 20 | |
| 21 | #include <common.h> |
| 22 | #include <ide.h> |
| 23 | #include <asm/processor.h> |
| 24 | #include <asm/io.h> |
| 25 | #include <asm/pci.h> |
Ben Warren | 02d6989 | 2008-08-31 09:49:42 -0700 | [diff] [blame] | 26 | #include <netdev.h> |
Yusuke Goda | c133c1f | 2008-03-11 12:55:12 +0900 | [diff] [blame] | 27 | #include "r7780mp.h" |
| 28 | |
John Rigby | 2956532 | 2010-12-20 18:27:51 -0700 | [diff] [blame] | 29 | DECLARE_GLOBAL_DATA_PTR; |
| 30 | |
Yusuke Goda | c133c1f | 2008-03-11 12:55:12 +0900 | [diff] [blame] | 31 | int checkboard(void) |
| 32 | { |
| 33 | #if defined(CONFIG_R7780MP) |
| 34 | puts("BOARD: Renesas Solutions R7780MP\n"); |
| 35 | #else |
| 36 | puts("BOARD: Renesas Solutions R7780RP\n"); |
| 37 | #endif |
| 38 | return 0; |
| 39 | } |
| 40 | |
| 41 | int board_init(void) |
| 42 | { |
| 43 | /* SCIF Enable */ |
Nobuhiro Iwamatsu | 4ec7e91 | 2008-06-17 16:27:41 +0900 | [diff] [blame] | 44 | writew(0x0, PHCR); |
Yusuke Goda | c133c1f | 2008-03-11 12:55:12 +0900 | [diff] [blame] | 45 | |
Yusuke Goda | c133c1f | 2008-03-11 12:55:12 +0900 | [diff] [blame] | 46 | return 0; |
| 47 | } |
| 48 | |
Nobuhiro Iwamatsu | 4ec7e91 | 2008-06-17 16:27:41 +0900 | [diff] [blame] | 49 | int dram_init(void) |
Yusuke Goda | c133c1f | 2008-03-11 12:55:12 +0900 | [diff] [blame] | 50 | { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 51 | gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; |
| 52 | gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE; |
| 53 | printf("DRAM: %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024)); |
Yusuke Goda | c133c1f | 2008-03-11 12:55:12 +0900 | [diff] [blame] | 54 | return 0; |
| 55 | } |
| 56 | |
Nobuhiro Iwamatsu | 4ec7e91 | 2008-06-17 16:27:41 +0900 | [diff] [blame] | 57 | void led_set_state(unsigned short value) |
Yusuke Goda | c133c1f | 2008-03-11 12:55:12 +0900 | [diff] [blame] | 58 | { |
| 59 | |
| 60 | } |
| 61 | |
Nobuhiro Iwamatsu | 4ec7e91 | 2008-06-17 16:27:41 +0900 | [diff] [blame] | 62 | void ide_set_reset(int idereset) |
Yusuke Goda | c133c1f | 2008-03-11 12:55:12 +0900 | [diff] [blame] | 63 | { |
| 64 | /* if reset = 1 IDE reset will be asserted */ |
Nobuhiro Iwamatsu | 4ec7e91 | 2008-06-17 16:27:41 +0900 | [diff] [blame] | 65 | if (idereset) { |
| 66 | writew(0x432, FPGA_CFCTL); |
Yusuke Goda | c133c1f | 2008-03-11 12:55:12 +0900 | [diff] [blame] | 67 | #if defined(CONFIG_R7780MP) |
Nobuhiro Iwamatsu | 4ec7e91 | 2008-06-17 16:27:41 +0900 | [diff] [blame] | 68 | writew(inw(FPGA_CFPOW)|0x01, FPGA_CFPOW); |
Yusuke Goda | c133c1f | 2008-03-11 12:55:12 +0900 | [diff] [blame] | 69 | #else |
Nobuhiro Iwamatsu | 4ec7e91 | 2008-06-17 16:27:41 +0900 | [diff] [blame] | 70 | writew(inw(FPGA_CFPOW)|0x02, FPGA_CFPOW); |
Yusuke Goda | c133c1f | 2008-03-11 12:55:12 +0900 | [diff] [blame] | 71 | #endif |
Nobuhiro Iwamatsu | 4ec7e91 | 2008-06-17 16:27:41 +0900 | [diff] [blame] | 72 | writew(0x01, FPGA_CFCDINTCLR); |
Yusuke Goda | c133c1f | 2008-03-11 12:55:12 +0900 | [diff] [blame] | 73 | } |
| 74 | } |
| 75 | |
Yusuke Goda | c133c1f | 2008-03-11 12:55:12 +0900 | [diff] [blame] | 76 | static struct pci_controller hose; |
| 77 | void pci_init_board(void) |
| 78 | { |
Nobuhiro Iwamatsu | 4ec7e91 | 2008-06-17 16:27:41 +0900 | [diff] [blame] | 79 | pci_sh7780_init(&hose); |
Yusuke Goda | c133c1f | 2008-03-11 12:55:12 +0900 | [diff] [blame] | 80 | } |
Ben Warren | 02d6989 | 2008-08-31 09:49:42 -0700 | [diff] [blame] | 81 | |
| 82 | int board_eth_init(bd_t *bis) |
| 83 | { |
Bernhard Kaindl | d020169 | 2011-10-20 10:56:59 +0000 | [diff] [blame] | 84 | /* return >= 0 if a chip is found, the board's AX88796L is n2k-based */ |
| 85 | return ne2k_register() + pci_eth_init(bis); |
Ben Warren | 02d6989 | 2008-08-31 09:49:42 -0700 | [diff] [blame] | 86 | } |