xref: /openbmc/u-boot/board/renesas/rsk7269/rsk7269.c (revision 99fc4fd1)
1 /*
2  * Copyright (C) 2012 Renesas Electronics Europe Ltd.
3  * Copyright (C) 2012 Phil Edworthy
4  * Copyright (C) 2008 Renesas Solutions Corp.
5  * Copyright (C) 2008 Nobuhiro Iwamatsu
6  *
7  * Based on u-boot/board/rsk7264/rsk7264.c
8  *
9  * This file is released under the terms of GPL v2 and any later version.
10  * See the file COPYING in the root directory of the source tree for details.
11  */
12 
13 #include <common.h>
14 #include <net.h>
15 #include <netdev.h>
16 #include <asm/io.h>
17 #include <asm/processor.h>
18 
19 DECLARE_GLOBAL_DATA_PTR;
20 
21 int checkboard(void)
22 {
23 	puts("BOARD: Renesas RSK7269\n");
24 	return 0;
25 }
26 
27 int board_init(void)
28 {
29 	return 0;
30 }
31 
32 int dram_init(void)
33 {
34 	gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
35 	gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
36 	printf("DRAM:  %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024));
37 	return 0;
38 }
39 
40 void led_set_state(unsigned short value)
41 {
42 }
43 
44 /*
45  * The RSK board has the SMSC89218 wired up 'incorrectly'.
46  * Byte-swapping is necessary, and so poor performance is inevitable.
47  * This problem cannot evade by the swap function of CHIP, this can
48  * evade by software Byte-swapping.
49  * And this has problem by FIFO access only. pkt_data_pull/pkt_data_push
50  * functions necessary to solve this problem.
51  */
52 u32 pkt_data_pull(struct eth_device *dev, u32 addr)
53 {
54 	volatile u16 *addr_16 = (u16 *)(dev->iobase + addr);
55 	return (u32)((swab16(*addr_16) << 16) & 0xFFFF0000)\
56 				| swab16(*(addr_16 + 1));
57 }
58 
59 void pkt_data_push(struct eth_device *dev, u32 addr, u32 val)
60 {
61 	addr += dev->iobase;
62 	*(volatile u16 *)(addr + 2) = swab16((u16)val);
63 	*(volatile u16 *)(addr) = swab16((u16)(val >> 16));
64 }
65 
66 int board_eth_init(bd_t *bis)
67 {
68 	int rc = 0;
69 #ifdef CONFIG_SMC911X
70 	rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);
71 #endif
72 	return rc;
73 }
74