Advertisement
Guest User

Untitled

a guest
Nov 16th, 2014
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. diff --git a/arch/mips/jz4740/prom.c b/arch/mips/jz4740/prom.c
  2. index 5a93f38..562b6d3 100644
  3. --- a/arch/mips/jz4740/prom.c
  4. +++ b/arch/mips/jz4740/prom.c
  5. @@ -17,6 +17,9 @@
  6. #include <linux/kernel.h>
  7. #include <linux/init.h>
  8. #include <linux/string.h>
  9. +#include <linux/bootmem.h>
  10. +#include <linux/of_platform.h>
  11. +#include <linux/of_fdt.h>
  12.  
  13. #include <linux/serial_reg.h>
  14.  
  15. @@ -44,6 +47,22 @@ static __init void jz4740_init_cmdline(int argc, char *argv[])
  16. *dst = 0;
  17. }
  18.  
  19. +void __init device_tree_init(void)
  20. +{
  21. + unsigned long base, size;
  22. +
  23. + if (!initial_boot_params)
  24. + return;
  25. +
  26. + base = virt_to_phys((void *)initial_boot_params);
  27. + size = be32_to_cpu(initial_boot_params->totalsize);
  28. +
  29. + /* Before we do anything, lets reserve the dt blob */
  30. + reserve_bootmem(base, size, BOOTMEM_DEFAULT);
  31. +
  32. + unflatten_device_tree();
  33. +}
  34. +
  35. void __init prom_init(void)
  36. {
  37. jz4740_init_cmdline((int)fw_arg0, (char **)fw_arg1);
  38. @@ -66,3 +85,16 @@ void prom_putchar(char c)
  39.  
  40. writeb(c, UART_REG(UART_TX));
  41. }
  42. +
  43. +static const struct of_device_id __initdata of_ids[] = {
  44. + { .compatible = "simple-bus", },
  45. + {},
  46. +};
  47. +
  48. +static int __init plat_of_setup(void)
  49. +{
  50. + if (!of_have_populated_dt())
  51. + return 0;
  52. + return of_platform_bus_probe(NULL, of_ids, NULL);
  53. +}
  54. +arch_initcall(plat_of_setup);
  55. diff --git a/arch/mips/jz4740/setup.c b/arch/mips/jz4740/setup.c
  56. index 76eafcb..12c049b 100644
  57. --- a/arch/mips/jz4740/setup.c
  58. +++ b/arch/mips/jz4740/setup.c
  59. @@ -17,8 +17,11 @@
  60. #include <linux/init.h>
  61. #include <linux/io.h>
  62. #include <linux/kernel.h>
  63. +#include <linux/of_platform.h>
  64. +#include <linux/of_fdt.h>
  65.  
  66. #include <asm/bootinfo.h>
  67. +#include <asm/mips-boards/generic.h>
  68.  
  69. #include <asm/mach-jz4740/base.h>
  70.  
  71. @@ -27,7 +30,6 @@
  72.  
  73. #define JZ4740_EMC_SDRAM_CTRL 0x80
  74.  
  75. -
  76. static void __init jz4740_detect_mem(void)
  77. {
  78. void __iomem *jz_emc_base;
  79. @@ -53,6 +55,7 @@ void __init plat_mem_setup(void)
  80. {
  81. jz4740_reset_init();
  82. jz4740_detect_mem();
  83. + __dt_setup_arch(&__dtb_start);
  84. }
  85.  
  86. const char *get_system_type(void)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement