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 DECLARE_GLOBAL_DATA_PTR; 19 20 int checkboard(void) 21 { 22 puts("BOARD: Renesas RSK7269\n"); 23 return 0; 24 } 25 26 int board_init(void) 27 { 28 return 0; 29 } 30 31 int dram_init(void) 32 { 33 gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; 34 gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE; 35 printf("DRAM: %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024)); 36 return 0; 37 } 38 39 void led_set_state(unsigned short value) 40 { 41 } 42 43 /* 44 * The RSK board has the SMSC89218 wired up 'incorrectly'. 45 * Byte-swapping is necessary, and so poor performance is inevitable. 46 * This problem cannot evade by the swap function of CHIP, this can 47 * evade by software Byte-swapping. 48 * And this has problem by FIFO access only. pkt_data_pull/pkt_data_push 49 * functions necessary to solve this problem. 50 */ 51 u32 pkt_data_pull(struct eth_device *dev, u32 addr) 52 { 53 volatile u16 *addr_16 = (u16 *)(dev->iobase + addr); 54 return (u32)((swab16(*addr_16) << 16) & 0xFFFF0000)\ 55 | swab16(*(addr_16 + 1)); 56 } 57 58 void pkt_data_push(struct eth_device *dev, u32 addr, u32 val) 59 { 60 addr += dev->iobase; 61 *(volatile u16 *)(addr + 2) = swab16((u16)val); 62 *(volatile u16 *)(addr) = swab16((u16)(val >> 16)); 63 } 64 65 int board_eth_init(bd_t *bis) 66 { 67 int rc = 0; 68 #ifdef CONFIG_SMC911X 69 rc = smc911x_initialize(0, CONFIG_SMC911X_BASE); 70 #endif 71 return rc; 72 } 73