common.c 861 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Routines common to most mpc86xx-based boards.
  4. */
  5. #include <linux/init.h>
  6. #include <linux/mod_devicetable.h>
  7. #include <linux/of_platform.h>
  8. #include <asm/reg.h>
  9. #include <asm/synch.h>
  10. #include "mpc86xx.h"
  11. static const struct of_device_id mpc86xx_common_ids[] __initconst = {
  12. { .type = "soc", },
  13. { .compatible = "soc", },
  14. { .compatible = "simple-bus", },
  15. { .name = "localbus", },
  16. { .compatible = "gianfar", },
  17. { .compatible = "fsl,mpc8641-pcie", },
  18. {},
  19. };
  20. int __init mpc86xx_common_publish_devices(void)
  21. {
  22. return of_platform_bus_probe(NULL, mpc86xx_common_ids, NULL);
  23. }
  24. long __init mpc86xx_time_init(void)
  25. {
  26. unsigned int temp;
  27. /* Set the time base to zero */
  28. mtspr(SPRN_TBWL, 0);
  29. mtspr(SPRN_TBWU, 0);
  30. temp = mfspr(SPRN_HID0);
  31. temp |= HID0_TBEN;
  32. mtspr(SPRN_HID0, temp);
  33. isync();
  34. return 0;
  35. }