nuke the magicbox target and incorporate a rewritten port into ppc40x - note: no...
[openwrt.git] / target / linux / ppc40x / patches / 003-ppc40x_simple_platform_support.patch
1 diff --git a/arch/powerpc/platforms/40x/Kconfig b/arch/powerpc/platforms/40x/Kconfig
2 index a9260e2..72ba3a7 100644
3 --- a/arch/powerpc/platforms/40x/Kconfig
4 +++ b/arch/powerpc/platforms/40x/Kconfig
5 @@ -14,6 +14,15 @@
6  #      help
7  #        This option enables support for the CPCI405 board.
8  
9 +config ACADIA
10 +       bool "Acadia"
11 +       depends on 40x
12 +       default n
13 +       select PPC40x_SIMPLE
14 +       select 405EZ
15 +       help
16 +         This option enables support for the AMCC 405EZ Acadia evaluation board.
17 +
18  config EP405
19         bool "EP405/EP405PC"
20         depends on 40x
21 @@ -93,6 +102,13 @@ config XILINX_VIRTEX_GENERIC_BOARD
22           Most Virtex designs should use this unless it needs to do some
23           special configuration at board probe time.
24  
25 +config PPC40x_SIMPLE
26 +       bool "Simple PowerPC 40x board support"
27 +       depends on 40x
28 +       default n
29 +       help
30 +         This option enables the simple PowerPC 40x platform support.
31 +
32  # 40x specific CPU modules, selected based on the board above.
33  config NP405H
34         bool
35 @@ -118,6 +134,12 @@ config 405EX
36         select IBM_NEW_EMAC_EMAC4
37         select IBM_NEW_EMAC_RGMII
38  
39 +config 405EZ
40 +       bool
41 +       select IBM_NEW_EMAC_NO_FLOW_CTRL
42 +       select IBM_NEW_EMAC_MAL_CLR_ICINTSTAT
43 +       select IBM_NEW_EMAC_MAL_COMMON_ERR
44 +
45  config 405GPR
46         bool
47  
48 diff --git a/arch/powerpc/platforms/40x/Makefile b/arch/powerpc/platforms/40x/Makefile
49 index 5533a5c..1d93273 100644
50 --- a/arch/powerpc/platforms/40x/Makefile
51 +++ b/arch/powerpc/platforms/40x/Makefile
52 @@ -3,3 +3,4 @@ obj-$(CONFIG_MAKALU)                            += makalu.o
53  obj-$(CONFIG_WALNUT)                           += walnut.o
54  obj-$(CONFIG_XILINX_VIRTEX_GENERIC_BOARD)      += virtex.o
55  obj-$(CONFIG_EP405)                            += ep405.o
56 +obj-$(CONFIG_PPC40x_SIMPLE)            += ppc40x_simple.o
57 diff --git a/arch/powerpc/platforms/40x/ppc40x_simple.c b/arch/powerpc/platforms/40x/ppc40x_simple.c
58 new file mode 100644
59 index 0000000..4498a86
60 --- /dev/null
61 +++ b/arch/powerpc/platforms/40x/ppc40x_simple.c
62 @@ -0,0 +1,80 @@
63 +/*
64 + * Generic PowerPC 40x platform support
65 + *
66 + * Copyright 2008 IBM Corporation
67 + *
68 + * This program is free software; you can redistribute it and/or modify it
69 + * under the terms of the GNU General Public License as published by the
70 + * Free Software Foundation; version 2 of the License.
71 + *
72 + * This implements simple platform support for PowerPC 44x chips.  This is
73 + * mostly used for eval boards or other simple and "generic" 44x boards.  If
74 + * your board has custom functions or hardware, then you will likely want to
75 + * implement your own board.c file to accommodate it.
76 + */
77 +
78 +#include <asm/machdep.h>
79 +#include <asm/pci-bridge.h>
80 +#include <asm/ppc4xx.h>
81 +#include <asm/prom.h>
82 +#include <asm/time.h>
83 +#include <asm/udbg.h>
84 +#include <asm/uic.h>
85 +
86 +#include <linux/init.h>
87 +#include <linux/of_platform.h>
88 +
89 +static __initdata struct of_device_id ppc40x_of_bus[] = {
90 +       { .compatible = "ibm,plb3", },
91 +       { .compatible = "ibm,plb4", },
92 +       { .compatible = "ibm,opb", },
93 +       { .compatible = "ibm,ebc", },
94 +       { .compatible = "simple-bus", },
95 +       {},
96 +};
97 +
98 +static int __init ppc40x_device_probe(void)
99 +{
100 +       of_platform_bus_probe(NULL, ppc40x_of_bus, NULL);
101 +
102 +       return 0;
103 +}
104 +machine_device_initcall(ppc40x_simple, ppc40x_device_probe);
105 +
106 +/* This is the list of boards that can be supported by this simple
107 + * platform code.  This does _not_ mean the boards are compatible,
108 + * as they most certainly are not from a device tree perspective.
109 + * However, their differences are handled by the device tree and the
110 + * drivers and therefore they don't need custom board support files.
111 + *
112 + * Again, if your board needs to do things differently then create a
113 + * board.c file for it rather than adding it to this list.
114 + */
115 +static char *board[] __initdata = {
116 +       "amcc,acadia"
117 +};
118 +
119 +static int __init ppc40x_probe(void)
120 +{
121 +       unsigned long root = of_get_flat_dt_root();
122 +       int i = 0;
123 +
124 +       for (i = 0; i < ARRAY_SIZE(board); i++) {
125 +               if (of_flat_dt_is_compatible(root, board[i])) {
126 +                       ppc_pci_flags = PPC_PCI_REASSIGN_ALL_RSRC;
127 +                       return 1;
128 +               }
129 +       }
130 +
131 +       return 0;
132 +}
133 +
134 +define_machine(ppc40x_simple) {
135 +       .name = "PowerPC 40x Platform",
136 +       .probe = ppc40x_probe,
137 +       .progress = udbg_progress,
138 +       .init_IRQ = uic_init_tree,
139 +       .get_irq = uic_get_irq,
140 +       .restart = ppc4xx_reset_system,
141 +       .calibrate_decr = generic_calibrate_decr,
142 +};