xref: /openbmc/u-boot/board/renesas/rsk7269/rsk7269.c (revision a3b36c84)
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  * SPDX-License-Identifier:	GPL-2.0+
10  */
11 
12 #include <common.h>
13 #include <net.h>
14 #include <netdev.h>
15 #include <asm/io.h>
16 #include <asm/processor.h>
17 
18 int checkboard(void)
19 {
20 	puts("BOARD: Renesas RSK7269\n");
21 	return 0;
22 }
23 
24 int board_init(void)
25 {
26 	return 0;
27 }
28 
29 void led_set_state(unsigned short value)
30 {
31 }
32 
33 /*
34  * The RSK board has the SMSC89218 wired up 'incorrectly'.
35  * Byte-swapping is necessary, and so poor performance is inevitable.
36  * This problem cannot evade by the swap function of CHIP, this can
37  * evade by software Byte-swapping.
38  * And this has problem by FIFO access only. pkt_data_pull/pkt_data_push
39  * functions necessary to solve this problem.
40  */
41 u32 pkt_data_pull(struct eth_device *dev, u32 addr)
42 {
43 	volatile u16 *addr_16 = (u16 *)(dev->iobase + addr);
44 	return (u32)((swab16(*addr_16) << 16) & 0xFFFF0000)\
45 				| swab16(*(addr_16 + 1));
46 }
47 
48 void pkt_data_push(struct eth_device *dev, u32 addr, u32 val)
49 {
50 	addr += dev->iobase;
51 	*(volatile u16 *)(addr + 2) = swab16((u16)val);
52 	*(volatile u16 *)(addr) = swab16((u16)(val >> 16));
53 }
54 
55 int board_eth_init(bd_t *bis)
56 {
57 	int rc = 0;
58 #ifdef CONFIG_SMC911X
59 	rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);
60 #endif
61 	return rc;
62 }
63