ar71xx: add preliminary support for wzr-hp-g450h
[openwrt.git] / target / linux / ar71xx / files / arch / mips / ar71xx / mach-wzr-hp-g450h.c
1 /*
2  *  Atheros G450 board support
3  *
4  *  Copyright (C) 2010 Felix Fietkau <nbd@openwrt.org>
5  *  Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
6  *  Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
7  *
8  *  This program is free software; you can redistribute it and/or modify it
9  *  under the terms of the GNU General Public License version 2 as published
10  *  by the Free Software Foundation.
11  */
12
13 #include <linux/mtd/mtd.h>
14 #include <linux/mtd/partitions.h>
15 #include <asm/mach-ar71xx/ar71xx.h>
16
17 #include "machtype.h"
18 #include "devices.h"
19 #include "dev-m25p80.h"
20 #include "dev-ap91-pci.h"
21
22 #ifdef CONFIG_MTD_PARTITIONS
23 static struct mtd_partition wzrhpg450h_partitions[] = {
24         {
25                 .name           = "u-boot",
26                 .offset         = 0,
27                 .size           = 0x0040000,
28                 .mask_flags     = MTD_WRITEABLE,
29         }, {
30                 .name           = "u-boot-env",
31                 .offset         = 0x0040000,
32                 .size           = 0x0010000,
33         }, {
34                 .name           = "ART",
35                 .offset         = 0x0050000,
36                 .size           = 0x0010000,
37                 .mask_flags     = MTD_WRITEABLE,
38         }, {
39                 .name           = "uImage",
40                 .offset         = 0x0060000,
41                 .size           = 0x0100000,
42         }, {
43                 .name           = "rootfs",
44                 .offset         = 0x0160000,
45                 .size           = 0x1e80000,
46         }, {
47                 .name           = "user_property",
48                 .offset         = 0x1fe0000,
49                 .size           = 0x0020000,
50         }, {
51                 .name           = "firmware",
52                 .offset         = 0x0060000,
53                 .size           = 0x1f80000,
54         }
55 };
56 #endif /* CONFIG_MTD_PARTITIONS */
57
58 static struct flash_platform_data wzrhpg450h_flash_data = {
59 #ifdef CONFIG_MTD_PARTITIONS
60         .parts          = wzrhpg450h_partitions,
61         .nr_parts       = ARRAY_SIZE(wzrhpg450h_partitions),
62 #endif
63 };
64
65 static void __init wzrhpg450h_init(void)
66 {
67         u8 *ee = (u8 *) KSEG1ADDR(0x1f051000);
68         u8 *mac = (u8 *) ee + 2;
69
70         ar71xx_add_device_m25p80_multi(&wzrhpg450h_flash_data);
71
72         ar71xx_add_device_mdio(0, ~BIT(0));
73         ar71xx_init_mac(ar71xx_eth0_data.mac_addr, mac, 0);
74         ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
75         ar71xx_eth0_data.speed = SPEED_1000;
76         ar71xx_eth0_data.duplex = DUPLEX_FULL;
77         ar71xx_eth0_data.phy_mask = BIT(0);
78
79         ar71xx_add_device_eth(0);
80
81         ap91_pci_init(ee, NULL);
82 }
83
84 MIPS_MACHINE(AR71XX_MACH_WZR_HP_G450H, "WZR-HP-G450H", "Buffalo WZR-HP-G450H",
85              wzrhpg450h_init);