blob: 780c1866be1a36db4fbcbab5495cc05ae200dacc [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +09002/*
3 * Copyright (C) 2008 Nobuhiro Iwamatsu
4 * Copyright (C) 2008 Renesas Solutions Corp.
5 *
6 * u-boot/board/rsk7203/rsk7203.c
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +09007 */
8
9#include <common.h>
Jean-Christophe PLAGNIOL-VILLARDd79a3142009-08-23 14:14:52 +020010#include <net.h>
Ben Warrenfbfdd3a2009-07-20 22:01:11 -070011#include <netdev.h>
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +090012#include <asm/io.h>
13#include <asm/processor.h>
14
15int checkboard(void)
16{
17 puts("BOARD: Renesas Technology RSK7203\n");
18 return 0;
19}
20
21int board_init(void)
22{
Nobuhiro Iwamatsu6f7d4362008-08-31 23:02:04 +090023 return 0;
24}
25
26void led_set_state(unsigned short value)
27{
28}
Nobuhiro Iwamatsue9dd88e2008-08-28 13:40:52 +090029
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 */
Ben Warrenfbfdd3a2009-07-20 22:01:11 -070038u32 pkt_data_pull(struct eth_device *dev, u32 addr)
Nobuhiro Iwamatsue9dd88e2008-08-28 13:40:52 +090039{
Ben Warrenfbfdd3a2009-07-20 22:01:11 -070040 volatile u16 *addr_16 = (u16 *)(dev->iobase + addr);
Nobuhiro Iwamatsue9dd88e2008-08-28 13:40:52 +090041 return (u32)((swab16(*addr_16) << 16) & 0xFFFF0000)\
42 | swab16(*(addr_16 + 1));
43}
44
Ben Warrenfbfdd3a2009-07-20 22:01:11 -070045void pkt_data_push(struct eth_device *dev, u32 addr, u32 val)
Nobuhiro Iwamatsue9dd88e2008-08-28 13:40:52 +090046{
Ben Warrenfbfdd3a2009-07-20 22:01:11 -070047 addr += dev->iobase;
Nobuhiro Iwamatsue9dd88e2008-08-28 13:40:52 +090048 *(volatile u16 *)(addr + 2) = swab16((u16)val);
49 *(volatile u16 *)(addr) = swab16((u16)(val >> 16));
50}
Ben Warrenfbfdd3a2009-07-20 22:01:11 -070051
52int 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}