ar71xx: register DSA switch for the AP91 based boards
[openwrt-10.03/.git] / target / linux / ar71xx / files / arch / mips / ar71xx / dev-ap91-eth.c
1 /*
2  *  Atheros AP91 reference board ethernet initialization
3  *
4  *  Copyright (C) 2010 Gabor Juhos <juhosg@openwrt.org>
5  *
6  *  This program is free software; you can redistribute it and/or modify it
7  *  under the terms of the GNU General Public License version 2 as published
8  *  by the Free Software Foundation.
9  */
10
11 #include "devices.h"
12 #include "dev-dsa.h"
13
14 static struct dsa_chip_data ap91_dsa_chip = {
15         .port_names[0]  = "cpu",
16         .port_names[1]  = "lan1",
17         .port_names[2]  = "lan2",
18         .port_names[3]  = "lan3",
19         .port_names[4]  = "lan4",
20 };
21
22 static struct dsa_platform_data ap91_dsa_data = {
23         .nr_chips       = 1,
24         .chip           = &ap91_dsa_chip,
25 };
26
27 void __init ap91_eth_init(u8 *mac_addr)
28 {
29         if (mac_addr)
30                 ar71xx_set_mac_base(mac_addr);
31
32         /* WAN port */
33         ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
34         ar71xx_eth0_data.phy_mask = 0x0;
35         ar71xx_eth0_data.speed = SPEED_100;
36         ar71xx_eth0_data.duplex = DUPLEX_FULL;
37         ar71xx_eth0_data.fifo_cfg1 = 0x0fff0000;
38         ar71xx_eth0_data.fifo_cfg2 = 0x00001fff;
39         ar71xx_eth0_data.fifo_cfg3 = 0x008001ff;
40
41         /* LAN ports */
42         ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
43         ar71xx_eth1_data.phy_mask = 0x0;
44         ar71xx_eth1_data.speed = SPEED_1000;
45         ar71xx_eth1_data.duplex = DUPLEX_FULL;
46         ar71xx_eth1_data.fifo_cfg1 = 0x0fff0000;
47         ar71xx_eth1_data.fifo_cfg2 = 0x00001fff;
48         ar71xx_eth1_data.fifo_cfg3 = 0x008001ff;
49
50         ar71xx_add_device_mdio(0x0);
51         ar71xx_add_device_eth(1);
52         ar71xx_add_device_eth(0);
53
54         ar71xx_add_device_dsa(1, &ap91_dsa_data);
55 }