2 * arch/powerpc/platforms/83xx/mpc837x_mds.c
4 * Copyright (C) 2007 Freescale Semiconductor, Inc. All rights reserved.
6 * MPC837x MDS board specific routines
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
14 #include <linux/pci.h>
16 #include <linux/of_platform.h>
22 #include <sysdev/fsl_pci.h>
26 #define BCSR12_USB_SER_MASK 0x8a
27 #define BCSR12_USB_SER_PIN 0x80
28 #define BCSR12_USB_SER_DEVICE 0x02
30 static int mpc837xmds_usb_cfg(void)
32 struct device_node
*np
;
33 const void *phy_type
, *mode
;
34 void __iomem
*bcsr_regs
= NULL
;
38 ret
= mpc837x_usb_cfg();
42 np
= of_find_compatible_node(NULL
, NULL
, "fsl,mpc837xmds-bcsr");
44 bcsr_regs
= of_iomap(np
, 0);
50 np
= of_find_node_by_name(NULL
, "usb");
55 phy_type
= of_get_property(np
, "phy_type", NULL
);
56 if (phy_type
&& !strcmp(phy_type
, "ulpi")) {
57 clrbits8(bcsr_regs
+ 12, BCSR12_USB_SER_PIN
);
58 } else if (phy_type
&& !strcmp(phy_type
, "serial")) {
59 mode
= of_get_property(np
, "dr_mode", NULL
);
60 bcsr12
= in_8(bcsr_regs
+ 12) & ~BCSR12_USB_SER_MASK
;
61 bcsr12
|= BCSR12_USB_SER_PIN
;
62 if (mode
&& !strcmp(mode
, "peripheral"))
63 bcsr12
|= BCSR12_USB_SER_DEVICE
;
64 out_8(bcsr_regs
+ 12, bcsr12
);
66 printk(KERN_ERR
"USB DR: unsupported PHY\n");
75 /* ************************************************************************
77 * Setup the architecture
80 static void __init
mpc837x_mds_setup_arch(void)
86 machine_device_initcall(mpc837x_mds
, mpc83xx_declare_of_platform_devices
);
89 * Called very early, MMU is off, device-tree isn't unflattened
91 static int __init
mpc837x_mds_probe(void)
93 return of_machine_is_compatible("fsl,mpc837xmds");
96 define_machine(mpc837x_mds
) {
97 .name
= "MPC837x MDS",
98 .probe
= mpc837x_mds_probe
,
99 .setup_arch
= mpc837x_mds_setup_arch
,
100 .init_IRQ
= mpc83xx_ipic_init_IRQ
,
101 .get_irq
= ipic_get_irq
,
102 .restart
= mpc83xx_restart
,
103 .time_init
= mpc83xx_time_init
,
104 .calibrate_decr
= generic_calibrate_decr
,
105 .progress
= udbg_progress
,