OpenWrt – Blame information for rev 4
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
4 | office | 1 | /* |
2 | * (C) Copyright 2010 |
||
3 | * Michael Kurz <michi.kurz@googlemail.com>. |
||
4 | * |
||
5 | * See file CREDITS for list of people who contributed to this |
||
6 | * project. |
||
7 | * |
||
8 | * This program is free software; you can redistribute it and/or |
||
9 | * modify it under the terms of the GNU General Public License as |
||
10 | * published by the Free Software Foundation; either version 2 of |
||
11 | * the License, or (at your option) any later version. |
||
12 | * |
||
13 | * This program is distributed in the hope that it will be useful, |
||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
16 | * GNU General Public License for more details. |
||
17 | * |
||
18 | * You should have received a copy of the GNU General Public License |
||
19 | * along with this program; if not, write to the Free Software |
||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
||
21 | * MA 02111-1307 USA |
||
22 | */ |
||
23 | |||
24 | #include <common.h> |
||
25 | #include <netdev.h> |
||
26 | #include <asm/mipsregs.h> |
||
27 | #include <asm/addrspace.h> |
||
28 | #include <asm/reboot.h> |
||
29 | #include <asm/ar71xx.h> |
||
30 | #include <asm/ar71xx_gpio.h> |
||
31 | |||
32 | #define NBG460N_WAN_LED 19 |
||
33 | |||
34 | phys_size_t initdram(int board_type) |
||
35 | { |
||
36 | return (32*1024*1024); |
||
37 | } |
||
38 | |||
39 | int checkboard(void) |
||
40 | { |
||
41 | // Set pin 19 to 1, to stop WAN LED blinking |
||
42 | ar71xx_setpindir(NBG460N_WAN_LED, 1); |
||
43 | ar71xx_setpin(NBG460N_WAN_LED, 1); |
||
44 | |||
45 | printf("U-boot on Zyxel NBG460N\n"); |
||
46 | return 0; |
||
47 | } |
||
48 | |||
49 | void _machine_restart(void) |
||
50 | { |
||
51 | for (;;) { |
||
52 | writel((RESET_MODULE_FULL_CHIP | RESET_MODULE_DDR), |
||
53 | KSEG1ADDR(AR71XX_RESET_BASE + AR91XX_RESET_REG_RESET_MODULE)); |
||
54 | readl(KSEG1ADDR(AR71XX_RESET_BASE + AR91XX_RESET_REG_RESET_MODULE)); |
||
55 | } |
||
56 | } |
||
57 | |||
58 | int board_eth_init(bd_t *bis) |
||
59 | { |
||
60 | char *phynames[] = {RTL8366_DEVNAME, RTL8366_DEVNAME}; |
||
61 | u16 phyids[] = {RTL8366_LANPHY_ID, RTL8366_WANPHY_ID}; |
||
62 | u16 phyfixed[] = {1, 0}; |
||
63 | |||
64 | if (ag71xx_register(bis, phynames, phyids, phyfixed) <= 0) |
||
65 | return -1; |
||
66 | |||
67 | if (rtl8366s_initialize()) |
||
68 | return -1; |
||
69 | |||
70 | if (rtl8366_mii_register(bis)) |
||
71 | return -1; |
||
72 | |||
73 | return 0; |
||
74 | } |
||
75 | |||
76 | int misc_init_r(void) { |
||
77 | uint8_t macaddr[6]; |
||
78 | uint8_t enetaddr[6]; |
||
79 | |||
80 | debug("Testing mac addresses\n"); |
||
81 | |||
82 | memcpy(macaddr, (uint8_t *) CONFIG_ETHADDR_ADDR, 6); |
||
83 | |||
84 | if (!eth_getenv_enetaddr("ethaddr", enetaddr)) { |
||
85 | debug("Setting eth0 mac addr to %pM\n", macaddr); |
||
86 | eth_setenv_enetaddr("ethaddr", macaddr); |
||
87 | } |
||
88 | |||
89 | if (!eth_getenv_enetaddr("eth1addr", enetaddr)) { |
||
90 | macaddr[5] += 1; |
||
91 | debug("Setting eth1 mac addr to %pM\n", macaddr); |
||
92 | eth_setenv_enetaddr("eth1addr", macaddr); |
||
93 | } |
||
94 | |||
95 | return 0; |
||
96 | } |