1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * arch/powerpc/platforms/83xx/mpc837x_mds.c
5 * Copyright (C) 2007 Freescale Semiconductor, Inc. All rights reserved.
7 * MPC837x MDS board specific routines
10 #include <linux/pci.h>
12 #include <linux/of_platform.h>
18 #include <sysdev/fsl_pci.h>
22 #define BCSR12_USB_SER_MASK 0x8a
23 #define BCSR12_USB_SER_PIN 0x80
24 #define BCSR12_USB_SER_DEVICE 0x02
26 static int mpc837xmds_usb_cfg(void)
28 struct device_node
*np
;
29 const void *phy_type
, *mode
;
30 void __iomem
*bcsr_regs
= NULL
;
34 ret
= mpc837x_usb_cfg();
38 np
= of_find_compatible_node(NULL
, NULL
, "fsl,mpc837xmds-bcsr");
40 bcsr_regs
= of_iomap(np
, 0);
46 np
= of_find_node_by_name(NULL
, "usb");
51 phy_type
= of_get_property(np
, "phy_type", NULL
);
52 if (phy_type
&& !strcmp(phy_type
, "ulpi")) {
53 clrbits8(bcsr_regs
+ 12, BCSR12_USB_SER_PIN
);
54 } else if (phy_type
&& !strcmp(phy_type
, "serial")) {
55 mode
= of_get_property(np
, "dr_mode", NULL
);
56 bcsr12
= in_8(bcsr_regs
+ 12) & ~BCSR12_USB_SER_MASK
;
57 bcsr12
|= BCSR12_USB_SER_PIN
;
58 if (mode
&& !strcmp(mode
, "peripheral"))
59 bcsr12
|= BCSR12_USB_SER_DEVICE
;
60 out_8(bcsr_regs
+ 12, bcsr12
);
62 printk(KERN_ERR
"USB DR: unsupported PHY\n");
71 /* ************************************************************************
73 * Setup the architecture
76 static void __init
mpc837x_mds_setup_arch(void)
82 machine_device_initcall(mpc837x_mds
, mpc83xx_declare_of_platform_devices
);
85 * Called very early, MMU is off, device-tree isn't unflattened
87 static int __init
mpc837x_mds_probe(void)
89 return of_machine_is_compatible("fsl,mpc837xmds");
92 define_machine(mpc837x_mds
) {
93 .name
= "MPC837x MDS",
94 .probe
= mpc837x_mds_probe
,
95 .setup_arch
= mpc837x_mds_setup_arch
,
96 .init_IRQ
= mpc83xx_ipic_init_IRQ
,
97 .get_irq
= ipic_get_irq
,
98 .restart
= mpc83xx_restart
,
99 .time_init
= mpc83xx_time_init
,
100 .calibrate_decr
= generic_calibrate_decr
,
101 .progress
= udbg_progress
,