Root/target/linux/brcm47xx/patches-3.3/061-ssb-register-parallel-flash-device.patch

1--- a/drivers/ssb/driver_mipscore.c
2+++ b/drivers/ssb/driver_mipscore.c
3@@ -14,6 +14,7 @@
4 #include <linux/serial_core.h>
5 #include <linux/serial_reg.h>
6 #include <linux/time.h>
7+#include <linux/platform_device.h>
8 
9 #include "ssb_private.h"
10 
11@@ -186,6 +187,19 @@ static void ssb_mips_serial_init(struct
12         mcore->nr_serial_ports = 0;
13 }
14 
15+static struct resource ssb_pflash_resource = {
16+ .name = "ssb_pflash",
17+ .start = 0,
18+ .end = 0,
19+ .flags = 0,
20+};
21+
22+struct platform_device ssb_pflash_dev = {
23+ .name = "bcm47xx-pflash",
24+ .resource = &ssb_pflash_resource,
25+ .num_resources = 1,
26+};
27+
28 static void ssb_mips_flash_detect(struct ssb_mipscore *mcore)
29 {
30     struct ssb_bus *bus = mcore->dev->bus;
31@@ -196,6 +210,9 @@ static void ssb_mips_flash_detect(struct
32         mcore->pflash.buswidth = 2;
33         mcore->pflash.window = SSB_FLASH1;
34         mcore->pflash.window_size = SSB_FLASH1_SZ;
35+ ssb_pflash_resource.start = mcore->pflash.window;
36+ ssb_pflash_resource.end = mcore->pflash.window +
37+ mcore->pflash.window_size;
38         return;
39     }
40 
41@@ -216,6 +233,9 @@ static void ssb_mips_flash_detect(struct
42             mcore->pflash.buswidth = 1;
43         else
44             mcore->pflash.buswidth = 2;
45+ ssb_pflash_resource.start = mcore->pflash.window;
46+ ssb_pflash_resource.end = mcore->pflash.window +
47+ mcore->pflash.window_size;
48         break;
49     }
50 }
51--- a/drivers/ssb/main.c
52+++ b/drivers/ssb/main.c
53@@ -549,6 +549,14 @@ static int ssb_devices_register(struct s
54                    "Error registering serial flash\n");
55     }
56 #endif
57+#ifdef CONFIG_SSB_DRIVER_MIPS
58+ if (bus->mipscore.pflash.present) {
59+ err = platform_device_register(&ssb_pflash_dev);
60+ if (err)
61+ ssb_printk(KERN_ERR PFX
62+ "Error registering parallel flash\n");
63+ }
64+#endif
65 
66     return 0;
67 error:
68--- a/drivers/ssb/ssb_private.h
69+++ b/drivers/ssb/ssb_private.h
70@@ -254,4 +254,6 @@ static inline int ssb_sflash_init(struct
71 }
72 #endif /* CONFIG_SSB_SFLASH */
73 
74+extern struct platform_device ssb_pflash_dev;
75+
76 #endif /* LINUX_SSB_PRIVATE_H_ */
77

Archive Download this file



interactive