efika-setup.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /*
  2. *
  3. * Efika 5K2 platform setup
  4. * Some code really inspired from the lite5200b platform.
  5. *
  6. * Copyright (C) 2006 bplan GmbH
  7. *
  8. * This file is licensed under the terms of the GNU General Public License
  9. * version 2. This program is licensed "as is" without any warranty of any
  10. * kind, whether express or implied.
  11. *
  12. */
  13. #include <linux/errno.h>
  14. #include <linux/kernel.h>
  15. #include <linux/slab.h>
  16. #include <linux/reboot.h>
  17. #include <linux/init.h>
  18. #include <linux/utsrelease.h>
  19. #include <linux/seq_file.h>
  20. #include <linux/root_dev.h>
  21. #include <linux/initrd.h>
  22. #include <linux/timer.h>
  23. #include <linux/pci.h>
  24. #include <asm/pgtable.h>
  25. #include <asm/prom.h>
  26. #include <asm/time.h>
  27. #include <asm/machdep.h>
  28. #include <asm/rtas.h>
  29. #include <asm/of_device.h>
  30. #include <asm/of_platform.h>
  31. #include <asm/mpc52xx.h>
  32. #include "efika.h"
  33. static void efika_show_cpuinfo(struct seq_file *m)
  34. {
  35. struct device_node *root;
  36. const char *revision = NULL;
  37. const char *codegendescription = NULL;
  38. const char *codegenvendor = NULL;
  39. root = of_find_node_by_path("/");
  40. if (!root)
  41. return;
  42. revision = get_property(root, "revision", NULL);
  43. codegendescription =
  44. get_property(root, "CODEGEN,description", NULL);
  45. codegenvendor = get_property(root, "CODEGEN,vendor", NULL);
  46. if (codegendescription)
  47. seq_printf(m, "machine\t\t: %s\n", codegendescription);
  48. else
  49. seq_printf(m, "machine\t\t: Efika\n");
  50. if (revision)
  51. seq_printf(m, "revision\t: %s\n", revision);
  52. if (codegenvendor)
  53. seq_printf(m, "vendor\t\t: %s\n", codegenvendor);
  54. of_node_put(root);
  55. }
  56. static void __init efika_setup_arch(void)
  57. {
  58. rtas_initialize();
  59. #ifdef CONFIG_BLK_DEV_INITRD
  60. initrd_below_start_ok = 1;
  61. if (initrd_start)
  62. ROOT_DEV = Root_RAM0;
  63. else
  64. #endif
  65. ROOT_DEV = Root_SDA2; /* sda2 (sda1 is for the kernel) */
  66. efika_pcisetup();
  67. if (ppc_md.progress)
  68. ppc_md.progress("Linux/PPC " UTS_RELEASE " running on Efika ;-)\n", 0x0);
  69. }
  70. static int __init efika_probe(void)
  71. {
  72. char *model = of_get_flat_dt_prop(of_get_flat_dt_root(),
  73. "model", NULL);
  74. if (model == NULL)
  75. return 0;
  76. if (strcmp(model, "EFIKA5K2"))
  77. return 0;
  78. ISA_DMA_THRESHOLD = ~0L;
  79. DMA_MODE_READ = 0x44;
  80. DMA_MODE_WRITE = 0x48;
  81. return 1;
  82. }
  83. define_machine(efika)
  84. {
  85. .name = EFIKA_PLATFORM_NAME,
  86. .probe = efika_probe,
  87. .setup_arch = efika_setup_arch,
  88. .init = mpc52xx_declare_of_platform_devices,
  89. .show_cpuinfo = efika_show_cpuinfo,
  90. .init_IRQ = mpc52xx_init_irq,
  91. .get_irq = mpc52xx_get_irq,
  92. .restart = rtas_restart,
  93. .power_off = rtas_power_off,
  94. .halt = rtas_halt,
  95. .set_rtc_time = rtas_set_rtc_time,
  96. .get_rtc_time = rtas_get_rtc_time,
  97. .progress = rtas_progress,
  98. .get_boot_time = rtas_get_boot_time,
  99. .calibrate_decr = generic_calibrate_decr,
  100. .phys_mem_access_prot = pci_phys_mem_access_prot,
  101. };