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