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