aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/bcm47xx/wgt634u.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/bcm47xx/wgt634u.c')
-rw-r--r--arch/mips/bcm47xx/wgt634u.c71
1 files changed, 67 insertions, 4 deletions
diff --git a/arch/mips/bcm47xx/wgt634u.c b/arch/mips/bcm47xx/wgt634u.c
index 5a017eaee712..d1d90c9ef2fa 100644
--- a/arch/mips/bcm47xx/wgt634u.c
+++ b/arch/mips/bcm47xx/wgt634u.c
@@ -9,6 +9,7 @@
9#include <linux/platform_device.h> 9#include <linux/platform_device.h>
10#include <linux/module.h> 10#include <linux/module.h>
11#include <linux/leds.h> 11#include <linux/leds.h>
12#include <linux/mtd/physmap.h>
12#include <linux/ssb/ssb.h> 13#include <linux/ssb/ssb.h>
13#include <asm/mach-bcm47xx/bcm47xx.h> 14#include <asm/mach-bcm47xx/bcm47xx.h>
14 15
@@ -43,6 +44,61 @@ static struct platform_device wgt634u_gpio_leds = {
43 } 44 }
44}; 45};
45 46
47
48/* 8MiB flash. The struct mtd_partition matches original Netgear WGT634U
49 firmware. */
50static struct mtd_partition wgt634u_partitions[] = {
51 {
52 .name = "cfe",
53 .offset = 0,
54 .size = 0x60000, /* 384k */
55 .mask_flags = MTD_WRITEABLE /* force read-only */
56 },
57 {
58 .name = "config",
59 .offset = 0x60000,
60 .size = 0x20000 /* 128k */
61 },
62 {
63 .name = "linux",
64 .offset = 0x80000,
65 .size = 0x140000 /* 1280k */
66 },
67 {
68 .name = "jffs",
69 .offset = 0x1c0000,
70 .size = 0x620000 /* 6272k */
71 },
72 {
73 .name = "nvram",
74 .offset = 0x7e0000,
75 .size = 0x20000 /* 128k */
76 },
77};
78
79static struct physmap_flash_data wgt634u_flash_data = {
80 .parts = wgt634u_partitions,
81 .nr_parts = ARRAY_SIZE(wgt634u_partitions)
82};
83
84static struct resource wgt634u_flash_resource = {
85 .flags = IORESOURCE_MEM,
86};
87
88static struct platform_device wgt634u_flash = {
89 .name = "physmap-flash",
90 .id = 0,
91 .dev = { .platform_data = &wgt634u_flash_data, },
92 .resource = &wgt634u_flash_resource,
93 .num_resources = 1,
94};
95
96/* Platform devices */
97static struct platform_device *wgt634u_devices[] __initdata = {
98 &wgt634u_flash,
99 &wgt634u_gpio_leds,
100};
101
46static int __init wgt634u_init(void) 102static int __init wgt634u_init(void)
47{ 103{
48 /* There is no easy way to detect that we are running on a WGT634U 104 /* There is no easy way to detect that we are running on a WGT634U
@@ -50,13 +106,20 @@ static int __init wgt634u_init(void)
50 * been allocated ranges 00:09:5b:xx:xx:xx and 00:0f:b5:xx:xx:xx. 106 * been allocated ranges 00:09:5b:xx:xx:xx and 00:0f:b5:xx:xx:xx.
51 */ 107 */
52 108
53 u8 *et0mac = ssb_bcm47xx.sprom.r1.et0mac; 109 u8 *et0mac = ssb_bcm47xx.sprom.et0mac;
54 110
55 if (et0mac[0] == 0x00 && 111 if (et0mac[0] == 0x00 &&
56 ((et0mac[1] == 0x09 && et0mac[2] == 0x5b) || 112 ((et0mac[1] == 0x09 && et0mac[2] == 0x5b) ||
57 (et0mac[1] == 0x0f && et0mac[2] == 0xb5))) 113 (et0mac[1] == 0x0f && et0mac[2] == 0xb5))) {
58 return platform_device_register(&wgt634u_gpio_leds); 114 struct ssb_mipscore *mcore = &ssb_bcm47xx.mipscore;
59 else 115 wgt634u_flash_data.width = mcore->flash_buswidth;
116 wgt634u_flash_resource.start = mcore->flash_window;
117 wgt634u_flash_resource.end = mcore->flash_window
118 + mcore->flash_window_size
119 - 1;
120 return platform_add_devices(wgt634u_devices,
121 ARRAY_SIZE(wgt634u_devices));
122 } else
60 return -ENODEV; 123 return -ENODEV;
61} 124}
62 125