2 * arch/ppc/platforms/85xx/mpc8540_ads.c
4 * MPC8540ADS board specific routines
6 * Maintainer: Kumar Gala <kumar.gala@freescale.com>
8 * Copyright 2004 Freescale Semiconductor Inc.
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.
16 #include <linux/config.h>
17 #include <linux/stddef.h>
18 #include <linux/kernel.h>
19 #include <linux/init.h>
20 #include <linux/errno.h>
21 #include <linux/reboot.h>
22 #include <linux/pci.h>
23 #include <linux/kdev_t.h>
24 #include <linux/major.h>
25 #include <linux/console.h>
26 #include <linux/delay.h>
27 #include <linux/irq.h>
28 #include <linux/seq_file.h>
29 #include <linux/root_dev.h>
30 #include <linux/serial.h>
31 #include <linux/tty.h> /* for linux/serial_core.h */
32 #include <linux/serial_core.h>
33 #include <linux/module.h>
35 #include <asm/system.h>
36 #include <asm/pgtable.h>
38 #include <asm/atomic.h>
41 #include <asm/machdep.h>
43 #include <asm/open_pic.h>
44 #include <asm/bootinfo.h>
45 #include <asm/pci-bridge.h>
46 #include <asm/mpc85xx.h>
48 #include <asm/immap_85xx.h>
51 #include <mm/mmu_decl.h>
53 #include <syslib/ppc85xx_common.h>
54 #include <syslib/ppc85xx_setup.h>
56 struct ocp_gfar_data mpc85xx_tsec1_def = {
57 .interruptTransmit = MPC85xx_IRQ_TSEC1_TX,
58 .interruptError = MPC85xx_IRQ_TSEC1_ERROR,
59 .interruptReceive = MPC85xx_IRQ_TSEC1_RX,
60 .interruptPHY = MPC85xx_IRQ_EXT5,
61 .flags = (GFAR_HAS_GIGABIT | GFAR_HAS_MULTI_INTR
63 | GFAR_HAS_PHY_INTR | GFAR_HAS_COALESCE),
68 struct ocp_gfar_data mpc85xx_tsec2_def = {
69 .interruptTransmit = MPC85xx_IRQ_TSEC2_TX,
70 .interruptError = MPC85xx_IRQ_TSEC2_ERROR,
71 .interruptReceive = MPC85xx_IRQ_TSEC2_RX,
72 .interruptPHY = MPC85xx_IRQ_EXT5,
73 .flags = (GFAR_HAS_GIGABIT | GFAR_HAS_MULTI_INTR
75 | GFAR_HAS_PHY_INTR | GFAR_HAS_COALESCE),
80 struct ocp_gfar_data mpc85xx_fec_def = {
81 .interruptTransmit = MPC85xx_IRQ_FEC,
82 .interruptError = MPC85xx_IRQ_FEC,
83 .interruptReceive = MPC85xx_IRQ_FEC,
84 .interruptPHY = MPC85xx_IRQ_EXT5,
90 struct ocp_fs_i2c_data mpc85xx_i2c1_def = {
91 .flags = FS_I2C_SEPARATE_DFSRR,
94 /* ************************************************************************
96 * Setup the architecture
100 mpc8540ads_setup_arch(void)
103 struct ocp_gfar_data *einfo;
104 bd_t *binfo = (bd_t *) __res;
107 /* get the core frequency */
108 freq = binfo->bi_intfreq;
111 ppc_md.progress("mpc8540ads_setup_arch()", 0);
113 /* Set loops_per_jiffy to a half-way reasonable value,
114 for use until calibrate_delay gets called. */
115 loops_per_jiffy = freq / HZ;
118 /* setup PCI host bridges */
119 mpc85xx_setup_hose();
122 #ifdef CONFIG_DUMMY_CONSOLE
123 conswitchp = &dummy_con;
126 #ifdef CONFIG_SERIAL_8250
127 mpc85xx_early_serial_map();
130 #ifdef CONFIG_SERIAL_TEXT_DEBUG
131 /* Invalidate the entry we stole earlier the serial ports
132 * should be properly mapped */
133 invalidate_tlbcam_entry(NUM_TLBCAMS - 1);
136 def = ocp_get_one_device(OCP_VENDOR_FREESCALE, OCP_FUNC_GFAR, 0);
138 einfo = (struct ocp_gfar_data *) def->additions;
139 memcpy(einfo->mac_addr, binfo->bi_enetaddr, 6);
142 def = ocp_get_one_device(OCP_VENDOR_FREESCALE, OCP_FUNC_GFAR, 1);
144 einfo = (struct ocp_gfar_data *) def->additions;
145 memcpy(einfo->mac_addr, binfo->bi_enet1addr, 6);
148 def = ocp_get_one_device(OCP_VENDOR_FREESCALE, OCP_FUNC_GFAR, 2);
150 einfo = (struct ocp_gfar_data *) def->additions;
151 memcpy(einfo->mac_addr, binfo->bi_enet2addr, 6);
154 #ifdef CONFIG_BLK_DEV_INITRD
156 ROOT_DEV = Root_RAM0;
159 #ifdef CONFIG_ROOT_NFS
162 ROOT_DEV = Root_HDA1;
165 ocp_for_each_device(mpc85xx_update_paddr_ocp, &(binfo->bi_immr_base));
168 /* ************************************************************************ */
170 platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
171 unsigned long r6, unsigned long r7)
173 /* parse_bootinfo must always be called first */
174 parse_bootinfo(find_bootinfo());
177 * If we were passed in a board information, copy it into the
178 * residual data area.
181 memcpy((void *) __res, (void *) (r3 + KERNELBASE),
184 #ifdef CONFIG_SERIAL_TEXT_DEBUG
186 bd_t *binfo = (bd_t *) __res;
188 /* Use the last TLB entry to map CCSRBAR to allow access to DUART regs */
189 settlbcam(NUM_TLBCAMS - 1, binfo->bi_immr_base,
190 binfo->bi_immr_base, MPC85xx_CCSRBAR_SIZE, _PAGE_IO, 0);
194 #if defined(CONFIG_BLK_DEV_INITRD)
196 * If the init RAM disk has been configured in, and there's a valid
197 * starting address for it, set it up.
200 initrd_start = r4 + KERNELBASE;
201 initrd_end = r5 + KERNELBASE;
203 #endif /* CONFIG_BLK_DEV_INITRD */
205 /* Copy the kernel command line arguments to a safe place. */
208 *(char *) (r7 + KERNELBASE) = 0;
209 strcpy(cmd_line, (char *) (r6 + KERNELBASE));
212 /* setup the PowerPC module struct */
213 ppc_md.setup_arch = mpc8540ads_setup_arch;
214 ppc_md.show_cpuinfo = mpc85xx_ads_show_cpuinfo;
216 ppc_md.init_IRQ = mpc85xx_ads_init_IRQ;
217 ppc_md.get_irq = openpic_get_irq;
219 ppc_md.restart = mpc85xx_restart;
220 ppc_md.power_off = mpc85xx_power_off;
221 ppc_md.halt = mpc85xx_halt;
223 ppc_md.find_end_of_memory = mpc85xx_find_end_of_memory;
225 ppc_md.time_init = NULL;
226 ppc_md.set_rtc_time = NULL;
227 ppc_md.get_rtc_time = NULL;
228 ppc_md.calibrate_decr = mpc85xx_calibrate_decr;
230 #if defined(CONFIG_SERIAL_8250) && defined(CONFIG_SERIAL_TEXT_DEBUG)
231 ppc_md.progress = gen550_progress;
232 #endif /* CONFIG_SERIAL_8250 && CONFIG_SERIAL_TEXT_DEBUG */
235 ppc_md.progress("mpc8540ads_init(): exit", 0);