Root/target/linux/mpc83xx/patches-2.6.36/020-rb333-support.patch

1--- a/arch/powerpc/platforms/83xx/rbppc.c
2+++ b/arch/powerpc/platforms/83xx/rbppc.c
3@@ -1,4 +1,5 @@
4 /*
5+ * Copyright (C) 2010 Alexandros C. Couloumbis <alex@ozo.com>
6  * Copyright (C) 2008-2009 Noah Fontes <nfontes@transtruct.org>
7  * Copyright (C) 2009 Michael Guntsche <mike@it-loops.com>
8  * Copyright (C) Mikrotik 2007
9@@ -167,6 +168,9 @@ static int __init rbppc_probe(void)
10     if (!model)
11         return 0;
12 
13+ if (strcmp(model, "RB333") == 0)
14+ return 1;
15+
16     if (strcmp(model, "RB600") == 0)
17         return 1;
18 
19@@ -227,6 +231,9 @@ static void __init rbppc_beeper_init(str
20 #define SBIT(x) (0x80000000 >> (x))
21 #define DBIT(x, y) ((y) << (32 - (((x % 16) + 1) * 2)))
22 
23+#define GPIO_DIR_RB333(x) ((x) + (0x1408 >> 2))
24+#define GPIO_DATA_RB333(x) ((x) + (0x1404 >> 2))
25+
26 #define SICRL_RB600(x) ((x) + (0x114 >> 2))
27 #define GPIO_DIR_RB600(x) ((x) + (0xc00 >> 2))
28 #define GPIO_DATA_RB600(x) ((x) + (0xc08 >> 2))
29@@ -234,14 +241,38 @@ static void __init rbppc_beeper_init(str
30 static void rbppc_restart(char *cmd)
31 {
32     __be32 __iomem *reg;
33-
34- reg = ioremap(get_immrbase(), 0x1000);
35- local_irq_disable();
36- out_be32(SICRL_RB600(reg), in_be32(SICRL_RB600(reg)) & ~0x00800000);
37- out_be32(GPIO_DIR_RB600(reg), in_be32(GPIO_DIR_RB600(reg)) | SBIT(2));
38- out_be32(GPIO_DATA_RB600(reg), in_be32(GPIO_DATA_RB600(reg)) & ~SBIT(2));
39-
40- while (1);
41+ unsigned rb_model;
42+ struct device_node *root;
43+ unsigned int size;
44+
45+ root = of_find_node_by_path("/");
46+ if (root) {
47+ const char *prop = (char *) of_get_property(root, "model", &size);
48+ rb_model = prop[sizeof("RB") - 1] - '0';
49+ of_node_put(root);
50+ switch (rb_model) {
51+ case 3:
52+ reg = ioremap(get_immrbase(), 0x2000);
53+ local_irq_disable();
54+ out_be32(GPIO_DIR_RB333(reg),
55+ (in_be32(GPIO_DIR_RB333(reg)) & ~DBIT(4, 3)) | DBIT(4, 1));
56+ out_be32(GPIO_DATA_RB333(reg), in_be32(GPIO_DATA_RB333(reg)) & ~SBIT(4));
57+ break;
58+ case 6:
59+ reg = ioremap(get_immrbase(), 0x1000);
60+ local_irq_disable();
61+ out_be32(SICRL_RB600(reg), in_be32(SICRL_RB600(reg)) & ~0x00800000);
62+ out_be32(GPIO_DIR_RB600(reg), in_be32(GPIO_DIR_RB600(reg)) | SBIT(2));
63+ out_be32(GPIO_DATA_RB600(reg), in_be32(GPIO_DATA_RB600(reg)) & ~SBIT(2));
64+ break;
65+ default:
66+ mpc83xx_restart(cmd);
67+ break;
68+ }
69+ }
70+ else mpc83xx_restart(cmd);
71+
72+ for (;;) ;
73 }
74 
75 static void rbppc_halt(void)
76@@ -301,10 +332,10 @@ static int __init rbppc_declare_of_platf
77 
78     return 0;
79 }
80-device_initcall(rbppc_declare_of_platform_devices);
81+machine_device_initcall(rb600, rbppc_declare_of_platform_devices);
82 
83 define_machine(rb600) {
84- .name = "MikroTik RouterBOARD 600 series",
85+ .name = "MikroTik RouterBOARD 333/600 series",
86     .probe = rbppc_probe,
87     .setup_arch = rbppc_setup_arch,
88     .init_IRQ = rbppc_init_IRQ,
89@@ -314,3 +345,31 @@ define_machine(rb600) {
90     .time_init = mpc83xx_time_init,
91     .calibrate_decr = generic_calibrate_decr,
92 };
93+
94+static void fixup_pcibridge(struct pci_dev *dev)
95+{
96+ if ((dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) {
97+ /* let the kernel itself set right memory windows */
98+ pci_write_config_word(dev, PCI_MEMORY_BASE, 0);
99+ pci_write_config_word(dev, PCI_MEMORY_LIMIT, 0);
100+ pci_write_config_word(dev, PCI_PREF_MEMORY_BASE, 0);
101+ pci_write_config_word(dev, PCI_PREF_MEMORY_LIMIT, 0);
102+ pci_write_config_byte(dev, PCI_IO_BASE, 0);
103+ pci_write_config_byte(dev, PCI_IO_LIMIT, 4 << 4);
104+
105+ pci_write_config_byte(
106+ dev, PCI_COMMAND,
107+ PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY | PCI_COMMAND_IO);
108+ pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, 8);
109+ }
110+}
111+
112+
113+static void fixup_rb604(struct pci_dev *dev)
114+{
115+ pci_write_config_byte(dev, 0xC0, 0x01);
116+}
117+
118+DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, fixup_pcibridge)
119+DECLARE_PCI_FIXUP_HEADER(0x3388, 0x0021, fixup_rb604)
120+
121--- a/drivers/mtd/nand/Kconfig
122+++ b/drivers/mtd/nand/Kconfig
123@@ -440,11 +440,11 @@ config MTD_NAND_PLATFORM
124       via platform_data.
125 
126 config MTD_NAND_RB_PPC
127- tristate "MikroTik RB600 NAND support"
128+ tristate "MikroTik RB 333/600 NAND support"
129     depends on MTD_NAND && MTD_PARTITIONS && RB_PPC
130     help
131       This option enables support for the NAND device on MikroTik
132- RouterBOARD 600 series boards.
133+ RouterBOARD 333/600 series boards.
134 
135 config MTD_ALAUDA
136     tristate "MTD driver for Olympus MAUSB-10 and Fujifilm DPC-R1"
137--- a/drivers/mtd/nand/rbppc_nand.c
138+++ b/drivers/mtd/nand/rbppc_nand.c
139@@ -126,7 +126,7 @@ static int rbppc_nand_probe(struct of_de
140     void *baddr;
141     const unsigned *rdy, *nce, *cle, *ale;
142 
143- printk(KERN_INFO "rbppc_nand_probe: MikroTik RouterBOARD 600 series NAND driver, version " DRV_VERSION "\n");
144+ printk(KERN_INFO "rbppc_nand_probe: MikroTik RouterBOARD 333/600 series NAND driver, version " DRV_VERSION "\n");
145 
146     info = kmalloc(sizeof(*info), GFP_KERNEL);
147 
148@@ -244,7 +244,7 @@ static void __exit rbppc_nand_exit(void)
149 MODULE_AUTHOR("Mikrotikls SIA");
150 MODULE_AUTHOR("Noah Fontes");
151 MODULE_AUTHOR("Michael Guntsche");
152-MODULE_DESCRIPTION("MikroTik RouterBOARD 600 series NAND driver");
153+MODULE_DESCRIPTION("MikroTik RouterBOARD 333/600 series NAND driver");
154 MODULE_LICENSE("GPL");
155 MODULE_VERSION(DRV_VERSION);
156 
157--- a/arch/powerpc/platforms/83xx/Kconfig
158+++ b/arch/powerpc/platforms/83xx/Kconfig
159@@ -39,13 +39,14 @@ config MPC832x_RDB
160       This option enables support for the MPC8323 RDB board.
161 
162 config RB_PPC
163- bool "MikroTik RouterBOARD 600 series"
164+ bool "MikroTik RouterBOARD 333/600 series"
165     select DEFAULT_UIMAGE
166     select QUICC_ENGINE
167+ select PPC_MPC832x
168     select PPC_MPC834x
169     select RB_IOMAP
170     help
171- This option enables support for MikroTik RouterBOARD 600 series boards.
172+ This option enables support for MikroTik RouterBOARD 333/600 series boards.
173 
174 config MPC834x_MDS
175     bool "Freescale MPC834x MDS"
176--- a/arch/powerpc/boot/Makefile
177+++ b/arch/powerpc/boot/Makefile
178@@ -74,7 +74,7 @@ src-plat := of.c cuboot-52xx.c cuboot-82
179         cuboot-pq2.c cuboot-sequoia.c treeboot-walnut.c \
180         cuboot-bamboo.c cuboot-mpc7448hpc2.c cuboot-taishan.c \
181         fixed-head.S ep88xc.c ep405.c cuboot-c2k.c \
182- cuboot-katmai.c cuboot-rainier.c redboot-8xx.c ep8248e.c rb600.c \
183+ cuboot-katmai.c cuboot-rainier.c redboot-8xx.c ep8248e.c rb600.c rb333.c \
184         cuboot-warp.c cuboot-85xx-cpm2.c cuboot-yosemite.c simpleboot.c \
185         virtex405-head.S virtex.c redboot-83xx.c cuboot-sam440ep.c \
186         cuboot-acadia.c cuboot-amigaone.c cuboot-kilauea.c \
187@@ -235,7 +235,8 @@ image-$(CONFIG_MPC834x_ITX) += cuImage.
188 image-$(CONFIG_MPC834x_MDS) += cuImage.mpc834x_mds
189 image-$(CONFIG_MPC836x_MDS) += cuImage.mpc836x_mds
190 image-$(CONFIG_ASP834x) += dtbImage.asp834x-redboot
191-image-$(CONFIG_RB_PPC) += dtbImage.rb600
192+image-$(CONFIG_RB_PPC) += dtbImage.rb600 \
193+ dtbImage.rb333
194 
195 # Board ports in arch/powerpc/platform/85xx/Kconfig
196 image-$(CONFIG_MPC8540_ADS) += cuImage.mpc8540ads
197--- a/arch/powerpc/boot/wrapper
198+++ b/arch/powerpc/boot/wrapper
199@@ -212,7 +212,7 @@ ps3)
200     isection=.kernel:initrd
201     link_address=''
202     ;;
203-ep88xc|ep405|ep8248e|rb600)
204+ep88xc|ep405|ep8248e|rb600|rb333)
205     platformo="$object/fixed-head.o $object/$platform.o"
206     binary=y
207     ;;
208

Archive Download this file



interactive