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