18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Embedded Planet EP8248E support
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright 2007 Freescale Semiconductor, Inc.
68c2ecf20Sopenharmony_ci * Author: Scott Wood <scottwood@freescale.com>
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#include <linux/init.h>
108c2ecf20Sopenharmony_ci#include <linux/interrupt.h>
118c2ecf20Sopenharmony_ci#include <linux/fsl_devices.h>
128c2ecf20Sopenharmony_ci#include <linux/mdio-bitbang.h>
138c2ecf20Sopenharmony_ci#include <linux/of_mdio.h>
148c2ecf20Sopenharmony_ci#include <linux/slab.h>
158c2ecf20Sopenharmony_ci#include <linux/of_platform.h>
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#include <asm/io.h>
188c2ecf20Sopenharmony_ci#include <asm/cpm2.h>
198c2ecf20Sopenharmony_ci#include <asm/udbg.h>
208c2ecf20Sopenharmony_ci#include <asm/machdep.h>
218c2ecf20Sopenharmony_ci#include <asm/time.h>
228c2ecf20Sopenharmony_ci#include <asm/mpc8260.h>
238c2ecf20Sopenharmony_ci#include <asm/prom.h>
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci#include <sysdev/fsl_soc.h>
268c2ecf20Sopenharmony_ci#include <sysdev/cpm2_pic.h>
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci#include "pq2.h"
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_cistatic u8 __iomem *ep8248e_bcsr;
318c2ecf20Sopenharmony_cistatic struct device_node *ep8248e_bcsr_node;
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci#define BCSR7_SCC2_ENABLE 0x10
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#define BCSR8_PHY1_ENABLE 0x80
368c2ecf20Sopenharmony_ci#define BCSR8_PHY1_POWER  0x40
378c2ecf20Sopenharmony_ci#define BCSR8_PHY2_ENABLE 0x20
388c2ecf20Sopenharmony_ci#define BCSR8_PHY2_POWER  0x10
398c2ecf20Sopenharmony_ci#define BCSR8_MDIO_READ   0x04
408c2ecf20Sopenharmony_ci#define BCSR8_MDIO_CLOCK  0x02
418c2ecf20Sopenharmony_ci#define BCSR8_MDIO_DATA   0x01
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci#define BCSR9_USB_ENABLE  0x80
448c2ecf20Sopenharmony_ci#define BCSR9_USB_POWER   0x40
458c2ecf20Sopenharmony_ci#define BCSR9_USB_HOST    0x20
468c2ecf20Sopenharmony_ci#define BCSR9_USB_FULL_SPEED_TARGET 0x10
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_cistatic void __init ep8248e_pic_init(void)
498c2ecf20Sopenharmony_ci{
508c2ecf20Sopenharmony_ci	struct device_node *np = of_find_compatible_node(NULL, NULL, "fsl,pq2-pic");
518c2ecf20Sopenharmony_ci	if (!np) {
528c2ecf20Sopenharmony_ci		printk(KERN_ERR "PIC init: can not find cpm-pic node\n");
538c2ecf20Sopenharmony_ci		return;
548c2ecf20Sopenharmony_ci	}
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci	cpm2_pic_init(np);
578c2ecf20Sopenharmony_ci	of_node_put(np);
588c2ecf20Sopenharmony_ci}
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_cistatic void ep8248e_set_mdc(struct mdiobb_ctrl *ctrl, int level)
618c2ecf20Sopenharmony_ci{
628c2ecf20Sopenharmony_ci	if (level)
638c2ecf20Sopenharmony_ci		setbits8(&ep8248e_bcsr[8], BCSR8_MDIO_CLOCK);
648c2ecf20Sopenharmony_ci	else
658c2ecf20Sopenharmony_ci		clrbits8(&ep8248e_bcsr[8], BCSR8_MDIO_CLOCK);
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci	/* Read back to flush the write. */
688c2ecf20Sopenharmony_ci	in_8(&ep8248e_bcsr[8]);
698c2ecf20Sopenharmony_ci}
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_cistatic void ep8248e_set_mdio_dir(struct mdiobb_ctrl *ctrl, int output)
728c2ecf20Sopenharmony_ci{
738c2ecf20Sopenharmony_ci	if (output)
748c2ecf20Sopenharmony_ci		clrbits8(&ep8248e_bcsr[8], BCSR8_MDIO_READ);
758c2ecf20Sopenharmony_ci	else
768c2ecf20Sopenharmony_ci		setbits8(&ep8248e_bcsr[8], BCSR8_MDIO_READ);
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ci	/* Read back to flush the write. */
798c2ecf20Sopenharmony_ci	in_8(&ep8248e_bcsr[8]);
808c2ecf20Sopenharmony_ci}
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_cistatic void ep8248e_set_mdio_data(struct mdiobb_ctrl *ctrl, int data)
838c2ecf20Sopenharmony_ci{
848c2ecf20Sopenharmony_ci	if (data)
858c2ecf20Sopenharmony_ci		setbits8(&ep8248e_bcsr[8], BCSR8_MDIO_DATA);
868c2ecf20Sopenharmony_ci	else
878c2ecf20Sopenharmony_ci		clrbits8(&ep8248e_bcsr[8], BCSR8_MDIO_DATA);
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci	/* Read back to flush the write. */
908c2ecf20Sopenharmony_ci	in_8(&ep8248e_bcsr[8]);
918c2ecf20Sopenharmony_ci}
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_cistatic int ep8248e_get_mdio_data(struct mdiobb_ctrl *ctrl)
948c2ecf20Sopenharmony_ci{
958c2ecf20Sopenharmony_ci	return in_8(&ep8248e_bcsr[8]) & BCSR8_MDIO_DATA;
968c2ecf20Sopenharmony_ci}
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_cistatic const struct mdiobb_ops ep8248e_mdio_ops = {
998c2ecf20Sopenharmony_ci	.set_mdc = ep8248e_set_mdc,
1008c2ecf20Sopenharmony_ci	.set_mdio_dir = ep8248e_set_mdio_dir,
1018c2ecf20Sopenharmony_ci	.set_mdio_data = ep8248e_set_mdio_data,
1028c2ecf20Sopenharmony_ci	.get_mdio_data = ep8248e_get_mdio_data,
1038c2ecf20Sopenharmony_ci	.owner = THIS_MODULE,
1048c2ecf20Sopenharmony_ci};
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_cistatic struct mdiobb_ctrl ep8248e_mdio_ctrl = {
1078c2ecf20Sopenharmony_ci	.ops = &ep8248e_mdio_ops,
1088c2ecf20Sopenharmony_ci};
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_cistatic int ep8248e_mdio_probe(struct platform_device *ofdev)
1118c2ecf20Sopenharmony_ci{
1128c2ecf20Sopenharmony_ci	struct mii_bus *bus;
1138c2ecf20Sopenharmony_ci	struct resource res;
1148c2ecf20Sopenharmony_ci	struct device_node *node;
1158c2ecf20Sopenharmony_ci	int ret;
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_ci	node = of_get_parent(ofdev->dev.of_node);
1188c2ecf20Sopenharmony_ci	of_node_put(node);
1198c2ecf20Sopenharmony_ci	if (node != ep8248e_bcsr_node)
1208c2ecf20Sopenharmony_ci		return -ENODEV;
1218c2ecf20Sopenharmony_ci
1228c2ecf20Sopenharmony_ci	ret = of_address_to_resource(ofdev->dev.of_node, 0, &res);
1238c2ecf20Sopenharmony_ci	if (ret)
1248c2ecf20Sopenharmony_ci		return ret;
1258c2ecf20Sopenharmony_ci
1268c2ecf20Sopenharmony_ci	bus = alloc_mdio_bitbang(&ep8248e_mdio_ctrl);
1278c2ecf20Sopenharmony_ci	if (!bus)
1288c2ecf20Sopenharmony_ci		return -ENOMEM;
1298c2ecf20Sopenharmony_ci
1308c2ecf20Sopenharmony_ci	bus->name = "ep8248e-mdio-bitbang";
1318c2ecf20Sopenharmony_ci	bus->parent = &ofdev->dev;
1328c2ecf20Sopenharmony_ci	snprintf(bus->id, MII_BUS_ID_SIZE, "%x", res.start);
1338c2ecf20Sopenharmony_ci
1348c2ecf20Sopenharmony_ci	ret = of_mdiobus_register(bus, ofdev->dev.of_node);
1358c2ecf20Sopenharmony_ci	if (ret)
1368c2ecf20Sopenharmony_ci		goto err_free_bus;
1378c2ecf20Sopenharmony_ci
1388c2ecf20Sopenharmony_ci	return 0;
1398c2ecf20Sopenharmony_cierr_free_bus:
1408c2ecf20Sopenharmony_ci	free_mdio_bitbang(bus);
1418c2ecf20Sopenharmony_ci	return ret;
1428c2ecf20Sopenharmony_ci}
1438c2ecf20Sopenharmony_ci
1448c2ecf20Sopenharmony_cistatic int ep8248e_mdio_remove(struct platform_device *ofdev)
1458c2ecf20Sopenharmony_ci{
1468c2ecf20Sopenharmony_ci	BUG();
1478c2ecf20Sopenharmony_ci	return 0;
1488c2ecf20Sopenharmony_ci}
1498c2ecf20Sopenharmony_ci
1508c2ecf20Sopenharmony_cistatic const struct of_device_id ep8248e_mdio_match[] = {
1518c2ecf20Sopenharmony_ci	{
1528c2ecf20Sopenharmony_ci		.compatible = "fsl,ep8248e-mdio-bitbang",
1538c2ecf20Sopenharmony_ci	},
1548c2ecf20Sopenharmony_ci	{},
1558c2ecf20Sopenharmony_ci};
1568c2ecf20Sopenharmony_ci
1578c2ecf20Sopenharmony_cistatic struct platform_driver ep8248e_mdio_driver = {
1588c2ecf20Sopenharmony_ci	.driver = {
1598c2ecf20Sopenharmony_ci		.name = "ep8248e-mdio-bitbang",
1608c2ecf20Sopenharmony_ci		.of_match_table = ep8248e_mdio_match,
1618c2ecf20Sopenharmony_ci	},
1628c2ecf20Sopenharmony_ci	.probe = ep8248e_mdio_probe,
1638c2ecf20Sopenharmony_ci	.remove = ep8248e_mdio_remove,
1648c2ecf20Sopenharmony_ci};
1658c2ecf20Sopenharmony_ci
1668c2ecf20Sopenharmony_cistruct cpm_pin {
1678c2ecf20Sopenharmony_ci	int port, pin, flags;
1688c2ecf20Sopenharmony_ci};
1698c2ecf20Sopenharmony_ci
1708c2ecf20Sopenharmony_cistatic __initdata struct cpm_pin ep8248e_pins[] = {
1718c2ecf20Sopenharmony_ci	/* SMC1 */
1728c2ecf20Sopenharmony_ci	{2, 4, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
1738c2ecf20Sopenharmony_ci	{2, 5, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
1748c2ecf20Sopenharmony_ci
1758c2ecf20Sopenharmony_ci	/* SCC1 */
1768c2ecf20Sopenharmony_ci	{2, 14, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
1778c2ecf20Sopenharmony_ci	{2, 15, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
1788c2ecf20Sopenharmony_ci	{3, 29, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
1798c2ecf20Sopenharmony_ci	{3, 30, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY},
1808c2ecf20Sopenharmony_ci	{3, 31, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
1818c2ecf20Sopenharmony_ci
1828c2ecf20Sopenharmony_ci	/* FCC1 */
1838c2ecf20Sopenharmony_ci	{0, 14, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
1848c2ecf20Sopenharmony_ci	{0, 15, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
1858c2ecf20Sopenharmony_ci	{0, 16, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
1868c2ecf20Sopenharmony_ci	{0, 17, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
1878c2ecf20Sopenharmony_ci	{0, 18, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
1888c2ecf20Sopenharmony_ci	{0, 19, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
1898c2ecf20Sopenharmony_ci	{0, 20, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
1908c2ecf20Sopenharmony_ci	{0, 21, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
1918c2ecf20Sopenharmony_ci	{0, 26, CPM_PIN_INPUT | CPM_PIN_SECONDARY},
1928c2ecf20Sopenharmony_ci	{0, 27, CPM_PIN_INPUT | CPM_PIN_SECONDARY},
1938c2ecf20Sopenharmony_ci	{0, 28, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY},
1948c2ecf20Sopenharmony_ci	{0, 29, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY},
1958c2ecf20Sopenharmony_ci	{0, 30, CPM_PIN_INPUT | CPM_PIN_SECONDARY},
1968c2ecf20Sopenharmony_ci	{0, 31, CPM_PIN_INPUT | CPM_PIN_SECONDARY},
1978c2ecf20Sopenharmony_ci	{2, 21, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
1988c2ecf20Sopenharmony_ci	{2, 22, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
1998c2ecf20Sopenharmony_ci
2008c2ecf20Sopenharmony_ci	/* FCC2 */
2018c2ecf20Sopenharmony_ci	{1, 18, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
2028c2ecf20Sopenharmony_ci	{1, 19, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
2038c2ecf20Sopenharmony_ci	{1, 20, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
2048c2ecf20Sopenharmony_ci	{1, 21, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
2058c2ecf20Sopenharmony_ci	{1, 22, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
2068c2ecf20Sopenharmony_ci	{1, 23, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
2078c2ecf20Sopenharmony_ci	{1, 24, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
2088c2ecf20Sopenharmony_ci	{1, 25, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
2098c2ecf20Sopenharmony_ci	{1, 26, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
2108c2ecf20Sopenharmony_ci	{1, 27, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
2118c2ecf20Sopenharmony_ci	{1, 28, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
2128c2ecf20Sopenharmony_ci	{1, 29, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY},
2138c2ecf20Sopenharmony_ci	{1, 30, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
2148c2ecf20Sopenharmony_ci	{1, 31, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
2158c2ecf20Sopenharmony_ci	{2, 18, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
2168c2ecf20Sopenharmony_ci	{2, 19, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
2178c2ecf20Sopenharmony_ci
2188c2ecf20Sopenharmony_ci	/* I2C */
2198c2ecf20Sopenharmony_ci	{4, 14, CPM_PIN_INPUT | CPM_PIN_SECONDARY},
2208c2ecf20Sopenharmony_ci	{4, 15, CPM_PIN_INPUT | CPM_PIN_SECONDARY},
2218c2ecf20Sopenharmony_ci
2228c2ecf20Sopenharmony_ci	/* USB */
2238c2ecf20Sopenharmony_ci	{2, 10, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
2248c2ecf20Sopenharmony_ci	{2, 11, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
2258c2ecf20Sopenharmony_ci	{2, 20, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
2268c2ecf20Sopenharmony_ci	{2, 24, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
2278c2ecf20Sopenharmony_ci	{3, 23, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
2288c2ecf20Sopenharmony_ci	{3, 24, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
2298c2ecf20Sopenharmony_ci	{3, 25, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
2308c2ecf20Sopenharmony_ci};
2318c2ecf20Sopenharmony_ci
2328c2ecf20Sopenharmony_cistatic void __init init_ioports(void)
2338c2ecf20Sopenharmony_ci{
2348c2ecf20Sopenharmony_ci	int i;
2358c2ecf20Sopenharmony_ci
2368c2ecf20Sopenharmony_ci	for (i = 0; i < ARRAY_SIZE(ep8248e_pins); i++) {
2378c2ecf20Sopenharmony_ci		const struct cpm_pin *pin = &ep8248e_pins[i];
2388c2ecf20Sopenharmony_ci		cpm2_set_pin(pin->port, pin->pin, pin->flags);
2398c2ecf20Sopenharmony_ci	}
2408c2ecf20Sopenharmony_ci
2418c2ecf20Sopenharmony_ci	cpm2_smc_clk_setup(CPM_CLK_SMC1, CPM_BRG7);
2428c2ecf20Sopenharmony_ci	cpm2_clk_setup(CPM_CLK_SCC1, CPM_BRG1, CPM_CLK_RX);
2438c2ecf20Sopenharmony_ci	cpm2_clk_setup(CPM_CLK_SCC1, CPM_BRG1, CPM_CLK_TX);
2448c2ecf20Sopenharmony_ci	cpm2_clk_setup(CPM_CLK_SCC3, CPM_CLK8, CPM_CLK_TX); /* USB */
2458c2ecf20Sopenharmony_ci	cpm2_clk_setup(CPM_CLK_FCC1, CPM_CLK11, CPM_CLK_RX);
2468c2ecf20Sopenharmony_ci	cpm2_clk_setup(CPM_CLK_FCC1, CPM_CLK10, CPM_CLK_TX);
2478c2ecf20Sopenharmony_ci	cpm2_clk_setup(CPM_CLK_FCC2, CPM_CLK13, CPM_CLK_RX);
2488c2ecf20Sopenharmony_ci	cpm2_clk_setup(CPM_CLK_FCC2, CPM_CLK14, CPM_CLK_TX);
2498c2ecf20Sopenharmony_ci}
2508c2ecf20Sopenharmony_ci
2518c2ecf20Sopenharmony_cistatic void __init ep8248e_setup_arch(void)
2528c2ecf20Sopenharmony_ci{
2538c2ecf20Sopenharmony_ci	if (ppc_md.progress)
2548c2ecf20Sopenharmony_ci		ppc_md.progress("ep8248e_setup_arch()", 0);
2558c2ecf20Sopenharmony_ci
2568c2ecf20Sopenharmony_ci	cpm2_reset();
2578c2ecf20Sopenharmony_ci
2588c2ecf20Sopenharmony_ci	/* When this is set, snooping CPM DMA from RAM causes
2598c2ecf20Sopenharmony_ci	 * machine checks.  See erratum SIU18.
2608c2ecf20Sopenharmony_ci	 */
2618c2ecf20Sopenharmony_ci	clrbits32(&cpm2_immr->im_siu_conf.siu_82xx.sc_bcr, MPC82XX_BCR_PLDP);
2628c2ecf20Sopenharmony_ci
2638c2ecf20Sopenharmony_ci	ep8248e_bcsr_node =
2648c2ecf20Sopenharmony_ci		of_find_compatible_node(NULL, NULL, "fsl,ep8248e-bcsr");
2658c2ecf20Sopenharmony_ci	if (!ep8248e_bcsr_node) {
2668c2ecf20Sopenharmony_ci		printk(KERN_ERR "No bcsr in device tree\n");
2678c2ecf20Sopenharmony_ci		return;
2688c2ecf20Sopenharmony_ci	}
2698c2ecf20Sopenharmony_ci
2708c2ecf20Sopenharmony_ci	ep8248e_bcsr = of_iomap(ep8248e_bcsr_node, 0);
2718c2ecf20Sopenharmony_ci	if (!ep8248e_bcsr) {
2728c2ecf20Sopenharmony_ci		printk(KERN_ERR "Cannot map BCSR registers\n");
2738c2ecf20Sopenharmony_ci		of_node_put(ep8248e_bcsr_node);
2748c2ecf20Sopenharmony_ci		ep8248e_bcsr_node = NULL;
2758c2ecf20Sopenharmony_ci		return;
2768c2ecf20Sopenharmony_ci	}
2778c2ecf20Sopenharmony_ci
2788c2ecf20Sopenharmony_ci	setbits8(&ep8248e_bcsr[7], BCSR7_SCC2_ENABLE);
2798c2ecf20Sopenharmony_ci	setbits8(&ep8248e_bcsr[8], BCSR8_PHY1_ENABLE | BCSR8_PHY1_POWER |
2808c2ecf20Sopenharmony_ci	                           BCSR8_PHY2_ENABLE | BCSR8_PHY2_POWER);
2818c2ecf20Sopenharmony_ci
2828c2ecf20Sopenharmony_ci	init_ioports();
2838c2ecf20Sopenharmony_ci
2848c2ecf20Sopenharmony_ci	if (ppc_md.progress)
2858c2ecf20Sopenharmony_ci		ppc_md.progress("ep8248e_setup_arch(), finish", 0);
2868c2ecf20Sopenharmony_ci}
2878c2ecf20Sopenharmony_ci
2888c2ecf20Sopenharmony_cistatic const struct of_device_id of_bus_ids[] __initconst = {
2898c2ecf20Sopenharmony_ci	{ .compatible = "simple-bus", },
2908c2ecf20Sopenharmony_ci	{ .compatible = "fsl,ep8248e-bcsr", },
2918c2ecf20Sopenharmony_ci	{},
2928c2ecf20Sopenharmony_ci};
2938c2ecf20Sopenharmony_ci
2948c2ecf20Sopenharmony_cistatic int __init declare_of_platform_devices(void)
2958c2ecf20Sopenharmony_ci{
2968c2ecf20Sopenharmony_ci	of_platform_bus_probe(NULL, of_bus_ids, NULL);
2978c2ecf20Sopenharmony_ci
2988c2ecf20Sopenharmony_ci	if (IS_ENABLED(CONFIG_MDIO_BITBANG))
2998c2ecf20Sopenharmony_ci		platform_driver_register(&ep8248e_mdio_driver);
3008c2ecf20Sopenharmony_ci
3018c2ecf20Sopenharmony_ci	return 0;
3028c2ecf20Sopenharmony_ci}
3038c2ecf20Sopenharmony_cimachine_device_initcall(ep8248e, declare_of_platform_devices);
3048c2ecf20Sopenharmony_ci
3058c2ecf20Sopenharmony_ci/*
3068c2ecf20Sopenharmony_ci * Called very early, device-tree isn't unflattened
3078c2ecf20Sopenharmony_ci */
3088c2ecf20Sopenharmony_cistatic int __init ep8248e_probe(void)
3098c2ecf20Sopenharmony_ci{
3108c2ecf20Sopenharmony_ci	return of_machine_is_compatible("fsl,ep8248e");
3118c2ecf20Sopenharmony_ci}
3128c2ecf20Sopenharmony_ci
3138c2ecf20Sopenharmony_cidefine_machine(ep8248e)
3148c2ecf20Sopenharmony_ci{
3158c2ecf20Sopenharmony_ci	.name = "Embedded Planet EP8248E",
3168c2ecf20Sopenharmony_ci	.probe = ep8248e_probe,
3178c2ecf20Sopenharmony_ci	.setup_arch = ep8248e_setup_arch,
3188c2ecf20Sopenharmony_ci	.init_IRQ = ep8248e_pic_init,
3198c2ecf20Sopenharmony_ci	.get_irq = cpm2_get_irq,
3208c2ecf20Sopenharmony_ci	.calibrate_decr = generic_calibrate_decr,
3218c2ecf20Sopenharmony_ci	.restart = pq2_restart,
3228c2ecf20Sopenharmony_ci	.progress = udbg_progress,
3238c2ecf20Sopenharmony_ci};
324