Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Nobuhiro Iwamatsu | 6f7d436 | 2008-08-31 23:02:04 +0900 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2008 Nobuhiro Iwamatsu |
| 4 | * Copyright (C) 2008 Renesas Solutions Corp. |
| 5 | * |
| 6 | * u-boot/board/rsk7203/rsk7203.c |
Nobuhiro Iwamatsu | 6f7d436 | 2008-08-31 23:02:04 +0900 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | #include <common.h> |
Jean-Christophe PLAGNIOL-VILLARD | d79a314 | 2009-08-23 14:14:52 +0200 | [diff] [blame] | 10 | #include <net.h> |
Ben Warren | fbfdd3a | 2009-07-20 22:01:11 -0700 | [diff] [blame] | 11 | #include <netdev.h> |
Nobuhiro Iwamatsu | 6f7d436 | 2008-08-31 23:02:04 +0900 | [diff] [blame] | 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 | { |
Nobuhiro Iwamatsu | 6f7d436 | 2008-08-31 23:02:04 +0900 | [diff] [blame] | 23 | return 0; |
| 24 | } |
| 25 | |
| 26 | void led_set_state(unsigned short value) |
| 27 | { |
| 28 | } |
Nobuhiro Iwamatsu | e9dd88e | 2008-08-28 13:40:52 +0900 | [diff] [blame] | 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 | */ |
Ben Warren | fbfdd3a | 2009-07-20 22:01:11 -0700 | [diff] [blame] | 38 | u32 pkt_data_pull(struct eth_device *dev, u32 addr) |
Nobuhiro Iwamatsu | e9dd88e | 2008-08-28 13:40:52 +0900 | [diff] [blame] | 39 | { |
Ben Warren | fbfdd3a | 2009-07-20 22:01:11 -0700 | [diff] [blame] | 40 | volatile u16 *addr_16 = (u16 *)(dev->iobase + addr); |
Nobuhiro Iwamatsu | e9dd88e | 2008-08-28 13:40:52 +0900 | [diff] [blame] | 41 | return (u32)((swab16(*addr_16) << 16) & 0xFFFF0000)\ |
| 42 | | swab16(*(addr_16 + 1)); |
| 43 | } |
| 44 | |
Ben Warren | fbfdd3a | 2009-07-20 22:01:11 -0700 | [diff] [blame] | 45 | void pkt_data_push(struct eth_device *dev, u32 addr, u32 val) |
Nobuhiro Iwamatsu | e9dd88e | 2008-08-28 13:40:52 +0900 | [diff] [blame] | 46 | { |
Ben Warren | fbfdd3a | 2009-07-20 22:01:11 -0700 | [diff] [blame] | 47 | addr += dev->iobase; |
Nobuhiro Iwamatsu | e9dd88e | 2008-08-28 13:40:52 +0900 | [diff] [blame] | 48 | *(volatile u16 *)(addr + 2) = swab16((u16)val); |
| 49 | *(volatile u16 *)(addr) = swab16((u16)(val >> 16)); |
| 50 | } |
Ben Warren | fbfdd3a | 2009-07-20 22:01:11 -0700 | [diff] [blame] | 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 | } |