Root/target/linux/mpc83xx/patches-2.6.33/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 @@
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 @@
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 @@
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 @@
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 @@
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 2010-03-19 12:30:12.000000000 +0200
122+++ b/drivers/mtd/nand/Kconfig 2010-03-19 12:30:28.000000000 +0200
123@@ -387,11 +387,11 @@
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 2010-03-19 12:43:48.000000000 +0200
138+++ b/drivers/mtd/nand/rbppc_nand.c 2010-03-19 12:44:17.000000000 +0200
139@@ -126,7 +126,7 @@
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 @@
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 2010-03-19 12:47:36.000000000 +0200
158+++ b/arch/powerpc/platforms/83xx/Kconfig 2010-03-19 12:50:07.000000000 +0200
159@@ -31,9 +31,10 @@
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@@ -38,7 +38,7 @@
172     select PPC_MPC834x
173     select RB_IOMAP
174     help
175- This option enables support for MikroTik RouterBOARD 600 series boards.
176+ This option enables support for MikroTik RouterBOARD 333/600 series boards.
177 
178 config MPC834x_MDS
179     bool "Freescale MPC834x MDS"
180--- a/arch/powerpc/boot/Makefile 2010-03-18 21:32:32.000000000 +0200
181+++ b/arch/powerpc/boot/Makefile 2010-03-18 21:32:53.000000000 +0200
182@@ -72,7 +72,7 @@
183         cuboot-pq2.c cuboot-sequoia.c treeboot-walnut.c \
184         cuboot-bamboo.c cuboot-mpc7448hpc2.c cuboot-taishan.c \
185         fixed-head.S ep88xc.c ep405.c cuboot-c2k.c \
186- cuboot-katmai.c cuboot-rainier.c redboot-8xx.c ep8248e.c rb600.c \
187+ cuboot-katmai.c cuboot-rainier.c redboot-8xx.c ep8248e.c rb600.c rb333.c \
188         cuboot-warp.c cuboot-85xx-cpm2.c cuboot-yosemite.c simpleboot.c \
189         virtex405-head.S virtex.c redboot-83xx.c cuboot-sam440ep.c \
190         cuboot-acadia.c cuboot-amigaone.c
191@@ -229,7 +229,8 @@
192 image-$(CONFIG_MPC834x_MDS) += cuImage.mpc834x_mds
193 image-$(CONFIG_MPC836x_MDS) += cuImage.mpc836x_mds
194 image-$(CONFIG_ASP834x) += dtbImage.asp834x-redboot
195-image-$(CONFIG_RB_PPC) += dtbImage.rb600
196+image-$(CONFIG_RB_PPC) += dtbImage.rb600 \
197+ dtbImage.rb333
198 
199 # Board ports in arch/powerpc/platform/85xx/Kconfig
200 image-$(CONFIG_MPC8540_ADS) += cuImage.mpc8540ads
201--- a/arch/powerpc/boot/wrapper 2010-03-18 21:34:24.000000000 +0200
202+++ b/arch/powerpc/boot/wrapper 2010-03-18 21:34:45.000000000 +0200
203@@ -201,7 +201,7 @@
204     isection=.kernel:initrd
205     link_address=''
206     ;;
207-ep88xc|ep405|ep8248e|rb600)
208+ep88xc|ep405|ep8248e|rb600|rb333)
209     platformo="$object/fixed-head.o $object/$platform.o"
210     binary=y
211     ;;
212

Archive Download this file



interactive