blob: b1cd6a28901f6b5f5292340de8b99b001112b50a [file] [log] [blame]
Roy Zang2602a212011-05-19 20:20:13 -05001/*
2 * Copyright 2010-2011 Freescale Semiconductor, Inc.
3 *
4 * Author: Roy Zang <tie-fei.zang@freescale.com>
5 *
6 * Description:
7 * P1023 RDS Board Setup
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 */
14
15#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/errno.h>
18#include <linux/pci.h>
19#include <linux/delay.h>
20#include <linux/module.h>
21#include <linux/fsl_devices.h>
22#include <linux/of_platform.h>
23#include <linux/of_device.h>
24
25#include <asm/system.h>
26#include <asm/time.h>
27#include <asm/machdep.h>
28#include <asm/pci-bridge.h>
29#include <mm/mmu_decl.h>
30#include <asm/prom.h>
31#include <asm/udbg.h>
32#include <asm/mpic.h>
Kyle Moffett582d3e02011-12-02 06:27:58 +000033#include "smp.h"
Roy Zang2602a212011-05-19 20:20:13 -050034
35#include <sysdev/fsl_soc.h>
36#include <sysdev/fsl_pci.h>
37
Kumar Gala199bfbe2011-11-24 01:00:10 -060038#include "mpc85xx.h"
39
Roy Zang2602a212011-05-19 20:20:13 -050040/* ************************************************************************
41 *
42 * Setup the architecture
43 *
44 */
Roy Zang2602a212011-05-19 20:20:13 -050045static void __init mpc85xx_rds_setup_arch(void)
46{
47 struct device_node *np;
48
49 if (ppc_md.progress)
50 ppc_md.progress("p1023_rds_setup_arch()", 0);
51
52 /* Map BCSR area */
53 np = of_find_node_by_name(NULL, "bcsr");
54 if (np != NULL) {
55 static u8 __iomem *bcsr_regs;
56
57 bcsr_regs = of_iomap(np, 0);
58 of_node_put(np);
59
60 if (!bcsr_regs) {
61 printk(KERN_ERR
62 "BCSR: Failed to map bcsr register space\n");
63 return;
64 } else {
65#define BCSR15_I2C_BUS0_SEG_CLR 0x07
66#define BCSR15_I2C_BUS0_SEG2 0x02
67/*
68 * Note: Accessing exclusively i2c devices.
69 *
70 * The i2c controller selects initially ID EEPROM in the u-boot;
71 * but if menu configuration selects RTC support in the kernel,
72 * the i2c controller switches to select RTC chip in the kernel.
73 */
74#ifdef CONFIG_RTC_CLASS
75 /* Enable RTC chip on the segment #2 of i2c */
76 clrbits8(&bcsr_regs[15], BCSR15_I2C_BUS0_SEG_CLR);
77 setbits8(&bcsr_regs[15], BCSR15_I2C_BUS0_SEG2);
78#endif
79
80 iounmap(bcsr_regs);
81 }
82 }
83
84#ifdef CONFIG_PCI
85 for_each_compatible_node(np, "pci", "fsl,p1023-pcie")
86 fsl_add_bridge(np, 0);
87#endif
88
Roy Zang2602a212011-05-19 20:20:13 -050089 mpc85xx_smp_init();
Roy Zang2602a212011-05-19 20:20:13 -050090}
91
Kumar Gala199bfbe2011-11-24 01:00:10 -060092machine_device_initcall(p1023_rds, mpc85xx_common_publish_devices);
Roy Zang2602a212011-05-19 20:20:13 -050093
94static void __init mpc85xx_rds_pic_init(void)
95{
Kyle Moffett996983b2011-12-02 06:28:02 +000096 struct mpic *mpic = mpic_alloc(NULL, 0,
Kyle Moffettbe8bec52011-12-02 06:28:03 +000097 MPIC_WANTS_RESET | MPIC_BIG_ENDIAN |
Kyle Moffett50196092011-12-22 10:19:12 +000098 MPIC_SINGLE_DEST_CPU,
Roy Zang2602a212011-05-19 20:20:13 -050099 0, 256, " OpenPIC ");
100
101 BUG_ON(mpic == NULL);
Roy Zang2602a212011-05-19 20:20:13 -0500102
103 mpic_init(mpic);
104}
105
106static int __init p1023_rds_probe(void)
107{
108 unsigned long root = of_get_flat_dt_root();
109
110 return of_flat_dt_is_compatible(root, "fsl,P1023RDS");
111
112}
113
114define_machine(p1023_rds) {
115 .name = "P1023 RDS",
116 .probe = p1023_rds_probe,
117 .setup_arch = mpc85xx_rds_setup_arch,
118 .init_IRQ = mpc85xx_rds_pic_init,
119 .get_irq = mpic_get_irq,
120 .restart = fsl_rstcr_restart,
121 .calibrate_decr = generic_calibrate_decr,
122 .progress = udbg_progress,
123#ifdef CONFIG_PCI
124 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
125#endif
126};
127