2 * Freescale Lite5200 board support
4 * Written by: Grant Likely <grant.likely@secretlab.ca>
6 * Copyright (C) Secret Lab Technologies Ltd. 2006. All rights reserved.
7 * Copyright (C) Freescale Semicondutor, Inc. 2006. All rights reserved.
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
18 #include <linux/init.h>
19 #include <linux/pci.h>
23 #include <asm/machdep.h>
25 #include <asm/mpc52xx.h>
27 /* ************************************************************************
29 * Setup the architecture
34 lite5200_setup_cpu(void)
36 struct mpc52xx_gpio __iomem *gpio;
40 gpio = mpc52xx_find_and_map("mpc5200-gpio");
42 printk(KERN_ERR __FILE__ ": "
43 "Error while mapping GPIO register for port config. "
44 "Expect some abnormal behavior\n");
49 port_config = in_be32(&gpio->port_config);
51 port_config &= ~0x00800000; /* 48Mhz internal, pin is GPIO */
53 port_config &= ~0x00007000; /* USB port : Differential mode */
54 port_config |= 0x00001000; /* USB 1 only */
56 port_config &= ~0x03000000; /* ATA CS is on csb_4/5 */
57 port_config |= 0x01000000;
59 pr_debug("port_config: old:%x new:%x\n",
60 in_be32(&gpio->port_config), port_config);
61 out_be32(&gpio->port_config, port_config);
69 static void lite5200_suspend_prepare(void __iomem *mbar)
71 u8 pin = 1; /* GPIO_WKUP_1 (GPIO_PSC2_4) */
72 u8 level = 0; /* wakeup on low level */
73 mpc52xx_set_wakeup_gpio(pin, level);
77 * this needs to be called before of-ohci suspend code
80 /* set ports to "power switched" and "powered at the same time"
81 * USB Rh descriptor A: NPS = 0, PSM = 0 */
82 out_be32(mbar + 0x1048, in_be32(mbar + 0x1048) & ~0x300);
83 /* USB Rh status: LPS = 1 - turn off power */
84 out_be32(mbar + 0x1050, 0x00000001);
87 static void lite5200_resume_finish(void __iomem *mbar)
89 /* USB Rh status: LPSC = 1 - turn on power */
90 out_be32(mbar + 0x1050, 0x00010000);
94 static void __init lite5200_setup_arch(void)
97 struct device_node *np;
101 ppc_md.progress("lite5200_setup_arch()", 0);
103 /* CPU & Port mux setup */
104 mpc52xx_setup_cpu(); /* Generic */
105 lite5200_setup_cpu(); /* Platorm specific */
108 mpc52xx_suspend.board_suspend_prepare = lite5200_suspend_prepare;
109 mpc52xx_suspend.board_resume_finish = lite5200_resume_finish;
114 np = of_find_node_by_type(NULL, "pci");
116 mpc52xx_add_bridge(np);
121 #ifdef CONFIG_BLK_DEV_INITRD
123 ROOT_DEV = Root_RAM0;
126 #ifdef CONFIG_ROOT_NFS
129 ROOT_DEV = Root_HDA1;
135 * Called very early, MMU is off, device-tree isn't unflattened
137 static int __init lite5200_probe(void)
139 unsigned long node = of_get_flat_dt_root();
140 const char *model = of_get_flat_dt_prop(node, "model", NULL);
142 if (!of_flat_dt_is_compatible(node, "fsl,lite5200") &&
143 !of_flat_dt_is_compatible(node, "fsl,lite5200b"))
145 pr_debug("%s board found\n", model ? model : "unknown");
150 define_machine(lite5200) {
152 .probe = lite5200_probe,
153 .setup_arch = lite5200_setup_arch,
154 .init = mpc52xx_declare_of_platform_devices,
155 .init_IRQ = mpc52xx_init_irq,
156 .get_irq = mpc52xx_get_irq,
157 .calibrate_decr = generic_calibrate_decr,