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 
21 static void 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  */
47 static void __init mpc837x_rdb_setup_arch(void)
48 {
49 	mpc83xx_setup_arch();
50 	mpc837x_usb_cfg();
51 	mpc837x_rdb_sd_cfg();
52 }
53 
54 machine_device_initcall(mpc837x_rdb, mpc83xx_declare_of_platform_devices);
55 
56 static const char * const board[] __initconst = {
57 	"fsl,mpc8377rdb",
58 	"fsl,mpc8378rdb",
59 	"fsl,mpc8379rdb",
60 	"fsl,mpc8377wlan",
61 	NULL
62 };
63 
64 /*
65  * Called very early, MMU is off, device-tree isn't unflattened
66  */
67 static int __init mpc837x_rdb_probe(void)
68 {
69 	return of_device_compatible_match(of_root, board);
70 }
71 
72 define_machine(mpc837x_rdb) {
73 	.name			= "MPC837x RDB/WLAN",
74 	.probe			= mpc837x_rdb_probe,
75 	.setup_arch		= mpc837x_rdb_setup_arch,
76 	.discover_phbs  	= mpc83xx_setup_pci,
77 	.init_IRQ		= mpc83xx_ipic_init_IRQ,
78 	.get_irq		= ipic_get_irq,
79 	.restart		= mpc83xx_restart,
80 	.time_init		= mpc83xx_time_init,
81 	.calibrate_decr		= generic_calibrate_decr,
82 	.progress		= udbg_progress,
83 };
84