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
29 extern int mpc837x_usb_cfg(void);
31 static int mpc837xmds_usb_cfg(void)
33 struct device_node *np;
34 const void *phy_type, *mode;
35 void __iomem *bcsr_regs = NULL;
39 ret = mpc837x_usb_cfg();
43 np = of_find_compatible_node(NULL, NULL, "fsl,mpc837xmds-bcsr");
45 bcsr_regs = of_iomap(np, 0);
51 np = of_find_node_by_name(NULL, "usb");
54 phy_type = of_get_property(np, "phy_type", NULL);
55 if (phy_type && !strcmp(phy_type, "ulpi")) {
56 clrbits8(bcsr_regs + 12, BCSR12_USB_SER_PIN);
57 } else if (phy_type && !strcmp(phy_type, "serial")) {
58 mode = of_get_property(np, "dr_mode", NULL);
59 bcsr12 = in_8(bcsr_regs + 12) & ~BCSR12_USB_SER_MASK;
60 bcsr12 |= BCSR12_USB_SER_PIN;
61 if (mode && !strcmp(mode, "peripheral"))
62 bcsr12 |= BCSR12_USB_SER_DEVICE;
63 out_8(bcsr_regs + 12, bcsr12);
65 printk(KERN_ERR "USB DR: unsupported PHY\n");
73 /* ************************************************************************
75 * Setup the architecture
78 static void __init mpc837x_mds_setup_arch(void)
81 struct device_node *np;
85 ppc_md.progress("mpc837x_mds_setup_arch()", 0);
88 for_each_compatible_node(np, "pci", "fsl,mpc8349-pci")
89 mpc83xx_add_bridge(np);
94 static struct of_device_id mpc837x_ids[] = {
96 { .compatible = "soc", },
97 { .compatible = "simple-bus", },
101 static int __init mpc837x_declare_of_platform_devices(void)
103 /* Publish of_device */
104 of_platform_bus_probe(NULL, mpc837x_ids, NULL);
108 machine_device_initcall(mpc837x_mds, mpc837x_declare_of_platform_devices);
110 static void __init mpc837x_mds_init_IRQ(void)
112 struct device_node *np;
114 np = of_find_compatible_node(NULL, NULL, "fsl,ipic");
120 /* Initialize the default interrupt mapping priorities,
121 * in case the boot rom changed something on us.
123 ipic_set_default_priority();
127 * Called very early, MMU is off, device-tree isn't unflattened
129 static int __init mpc837x_mds_probe(void)
131 unsigned long root = of_get_flat_dt_root();
133 return of_flat_dt_is_compatible(root, "fsl,mpc837xmds");
136 define_machine(mpc837x_mds) {
137 .name = "MPC837x MDS",
138 .probe = mpc837x_mds_probe,
139 .setup_arch = mpc837x_mds_setup_arch,
140 .init_IRQ = mpc837x_mds_init_IRQ,
141 .get_irq = ipic_get_irq,
142 .restart = mpc83xx_restart,
143 .time_init = mpc83xx_time_init,
144 .calibrate_decr = generic_calibrate_decr,
145 .progress = udbg_progress,