common.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * linux/arch/arm/mach-mmp/common.c
  4. *
  5. * Code common to PXA168 processor lines
  6. */
  7. #include <linux/init.h>
  8. #include <linux/kernel.h>
  9. #include <linux/module.h>
  10. #include <asm/page.h>
  11. #include <asm/mach/map.h>
  12. #include <asm/system_misc.h>
  13. #include "addr-map.h"
  14. #include <linux/soc/mmp/cputype.h>
  15. #include "common.h"
  16. #define MMP_CHIPID CIU_REG(0x00)
  17. unsigned int mmp_chip_id;
  18. EXPORT_SYMBOL(mmp_chip_id);
  19. static struct map_desc standard_io_desc[] __initdata = {
  20. {
  21. .pfn = __phys_to_pfn(APB_PHYS_BASE),
  22. .virtual = (unsigned long)APB_VIRT_BASE,
  23. .length = APB_PHYS_SIZE,
  24. .type = MT_DEVICE,
  25. }, {
  26. .pfn = __phys_to_pfn(AXI_PHYS_BASE),
  27. .virtual = (unsigned long)AXI_VIRT_BASE,
  28. .length = AXI_PHYS_SIZE,
  29. .type = MT_DEVICE,
  30. },
  31. };
  32. static struct map_desc mmp2_io_desc[] __initdata = {
  33. {
  34. .pfn = __phys_to_pfn(PGU_PHYS_BASE),
  35. .virtual = (unsigned long)PGU_VIRT_BASE,
  36. .length = PGU_PHYS_SIZE,
  37. .type = MT_DEVICE,
  38. },
  39. };
  40. void __init mmp_map_io(void)
  41. {
  42. iotable_init(standard_io_desc, ARRAY_SIZE(standard_io_desc));
  43. /* this is early, initialize mmp_chip_id here */
  44. mmp_chip_id = __raw_readl(MMP_CHIPID);
  45. }
  46. void __init mmp2_map_io(void)
  47. {
  48. mmp_map_io();
  49. iotable_init(mmp2_io_desc, ARRAY_SIZE(mmp2_io_desc));
  50. }
  51. void mmp_restart(enum reboot_mode mode, const char *cmd)
  52. {
  53. soft_restart(0);
  54. }