Nobuhiro Iwamatsu | 020d041 | 2012-01-12 11:12:28 +0900 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com> |
| 3 | * Copyright (C) 2011 Renesas Solutions Corp. |
| 4 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
Nobuhiro Iwamatsu | 020d041 | 2012-01-12 11:12:28 +0900 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #include <common.h> |
| 9 | #include <asm/io.h> |
| 10 | #include <asm/processor.h> |
| 11 | #include <netdev.h> |
Nobuhiro Iwamatsu | 5c265ae | 2012-03-02 12:58:33 +0900 | [diff] [blame] | 12 | #include <i2c.h> |
Nobuhiro Iwamatsu | 020d041 | 2012-01-12 11:12:28 +0900 | [diff] [blame] | 13 | |
Nobuhiro Iwamatsu | 020d041 | 2012-01-12 11:12:28 +0900 | [diff] [blame] | 14 | #define MODEMR (0xFFCC0020) |
| 15 | #define MODEMR_MASK (0x6) |
| 16 | #define MODEMR_533MHZ (0x2) |
| 17 | |
| 18 | int checkboard(void) |
| 19 | { |
| 20 | u32 r = readl(MODEMR); |
| 21 | if ((r & MODEMR_MASK) & MODEMR_533MHZ) |
| 22 | puts("CPU Clock: 533MHz\n"); |
| 23 | else |
| 24 | puts("CPU Clock: 400MHz\n"); |
| 25 | |
| 26 | puts("BOARD: Renesas Technology Corp. R0P7734C00000RZ\n"); |
| 27 | return 0; |
| 28 | } |
| 29 | |
| 30 | #define MSTPSR1 (0xFFC80044) |
| 31 | #define MSTPCR1 (0xFFC80034) |
| 32 | #define MSTPSR1_GETHER (1 << 14) |
| 33 | |
| 34 | int board_init(void) |
| 35 | { |
| 36 | #if defined(CONFIG_SH_ETHER) |
| 37 | u32 r = readl(MSTPSR1); |
| 38 | if (r & MSTPSR1_GETHER) |
| 39 | writel((r & ~MSTPSR1_GETHER), MSTPCR1); |
| 40 | #endif |
Nobuhiro Iwamatsu | 5c265ae | 2012-03-02 12:58:33 +0900 | [diff] [blame] | 41 | |
| 42 | return 0; |
| 43 | } |
| 44 | |
| 45 | int board_late_init(void) |
| 46 | { |
| 47 | u8 mac[6]; |
| 48 | |
| 49 | /* Read Mac Address and set*/ |
| 50 | i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); |
| 51 | i2c_set_bus_num(CONFIG_SYS_I2C_MODULE); |
| 52 | |
| 53 | /* Read MAC address */ |
| 54 | i2c_read(0x50, 0x10, 0, mac, 6); |
| 55 | |
Joe Hershberger | 8ecdbed | 2015-04-08 01:41:04 -0500 | [diff] [blame] | 56 | if (is_valid_ethaddr(mac)) |
Nobuhiro Iwamatsu | 5c265ae | 2012-03-02 12:58:33 +0900 | [diff] [blame] | 57 | eth_setenv_enetaddr("ethaddr", mac); |
| 58 | |
Nobuhiro Iwamatsu | 020d041 | 2012-01-12 11:12:28 +0900 | [diff] [blame] | 59 | return 0; |
| 60 | } |
| 61 | |
Nobuhiro Iwamatsu | 020d041 | 2012-01-12 11:12:28 +0900 | [diff] [blame] | 62 | #ifdef CONFIG_SMC911X |
| 63 | int board_eth_init(bd_t *bis) |
| 64 | { |
| 65 | int rc = 0; |
| 66 | rc = smc911x_initialize(0, CONFIG_SMC911X_BASE); |
| 67 | return rc; |
| 68 | } |
| 69 | #endif |