1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * arch/powerpc/platforms/83xx/mpc837x_rdb.c
4 *
5 * Copyright (C) 2007 Freescale Semiconductor, Inc. All rights reserved.
6 *
7 * MPC837x RDB board specific routines
8 */
9
10#include <linux/pci.h>
11#include <linux/of_platform.h>
12
13#include <asm/time.h>
14#include <asm/ipic.h>
15#include <asm/udbg.h>
16#include <sysdev/fsl_soc.h>
17#include <sysdev/fsl_pci.h>
18
19#include "mpc83xx.h"
20
21static void __init mpc837x_rdb_sd_cfg(void)
22{
23	void __iomem *im;
24
25	im = ioremap(get_immrbase(), 0x1000);
26	if (!im) {
27		WARN_ON(1);
28		return;
29	}
30
31	/*
32	 * On RDB boards (in contrast to MDS) USBB pins are used for SD only,
33	 * so we can safely mux them away from the USB block.
34	 */
35	clrsetbits_be32(im + MPC83XX_SICRL_OFFS, MPC837X_SICRL_USBB_MASK,
36						 MPC837X_SICRL_SD);
37	clrsetbits_be32(im + MPC83XX_SICRH_OFFS, MPC837X_SICRH_SPI_MASK,
38						 MPC837X_SICRH_SD);
39	iounmap(im);
40}
41
42/* ************************************************************************
43 *
44 * Setup the architecture
45 *
46 */
47static void __init mpc837x_rdb_setup_arch(void)
48{
49	mpc83xx_setup_arch();
50	mpc837x_usb_cfg();
51	mpc837x_rdb_sd_cfg();
52}
53
54machine_device_initcall(mpc837x_rdb, mpc83xx_declare_of_platform_devices);
55
56static const char * const board[] __initconst = {
57	"fsl,mpc8377rdb",
58	"fsl,mpc8378rdb",
59	"fsl,mpc8379rdb",
60	"fsl,mpc8377wlan",
61	NULL
62};
63
64define_machine(mpc837x_rdb) {
65	.name			= "MPC837x RDB/WLAN",
66	.compatibles		= board,
67	.setup_arch		= mpc837x_rdb_setup_arch,
68	.discover_phbs  	= mpc83xx_setup_pci,
69	.init_IRQ		= mpc83xx_ipic_init_IRQ,
70	.get_irq		= ipic_get_irq,
71	.restart		= mpc83xx_restart,
72	.time_init		= mpc83xx_time_init,
73	.progress		= udbg_progress,
74};
75