003-ppc40x_simple_platform_support.patch 3.7 KB

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