aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc/syslib/m8xx_setup.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/ppc/syslib/m8xx_setup.c')
-rw-r--r--arch/ppc/syslib/m8xx_setup.c65
1 files changed, 57 insertions, 8 deletions
diff --git a/arch/ppc/syslib/m8xx_setup.c b/arch/ppc/syslib/m8xx_setup.c
index 688616de3cde..dae9af78bde1 100644
--- a/arch/ppc/syslib/m8xx_setup.c
+++ b/arch/ppc/syslib/m8xx_setup.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/ppc/kernel/setup.c
3 *
4 * Copyright (C) 1995 Linus Torvalds 2 * Copyright (C) 1995 Linus Torvalds
5 * Adapted from 'alpha' version by Gary Thomas 3 * Adapted from 'alpha' version by Gary Thomas
6 * Modified by Cort Dougan (cort@cs.nmt.edu) 4 * Modified by Cort Dougan (cort@cs.nmt.edu)
@@ -34,6 +32,13 @@
34#include <linux/seq_file.h> 32#include <linux/seq_file.h>
35#include <linux/root_dev.h> 33#include <linux/root_dev.h>
36 34
35#if defined(CONFIG_MTD) && defined(CONFIG_MTD_PHYSMAP)
36#include <linux/mtd/partitions.h>
37#include <linux/mtd/physmap.h>
38#include <linux/mtd/mtd.h>
39#include <linux/mtd/map.h>
40#endif
41
37#include <asm/mmu.h> 42#include <asm/mmu.h>
38#include <asm/reg.h> 43#include <asm/reg.h>
39#include <asm/residual.h> 44#include <asm/residual.h>
@@ -49,6 +54,34 @@
49 54
50#include "ppc8xx_pic.h" 55#include "ppc8xx_pic.h"
51 56
57#ifdef CONFIG_MTD_PHYSMAP
58#define MPC8xxADS_BANK_WIDTH 4
59#endif
60
61#define MPC8xxADS_U_BOOT_SIZE 0x80000
62#define MPC8xxADS_FREE_AREA_OFFSET MPC8xxADS_U_BOOT_SIZE
63
64#if defined(CONFIG_MTD_PARTITIONS)
65 /*
66 NOTE: bank width and interleave relative to the installed flash
67 should have been chosen within MTD_CFI_GEOMETRY options.
68 */
69static struct mtd_partition mpc8xxads_partitions[] = {
70 {
71 .name = "bootloader",
72 .size = MPC8xxADS_U_BOOT_SIZE,
73 .offset = 0,
74 .mask_flags = MTD_WRITEABLE, /* force read-only */
75 }, {
76 .name = "User FS",
77 .offset = MPC8xxADS_FREE_AREA_OFFSET
78 }
79};
80
81#define mpc8xxads_part_num (sizeof (mpc8xxads_partitions) / sizeof (mpc8xxads_partitions[0]))
82
83#endif
84
52static int m8xx_set_rtc_time(unsigned long time); 85static int m8xx_set_rtc_time(unsigned long time);
53static unsigned long m8xx_get_rtc_time(void); 86static unsigned long m8xx_get_rtc_time(void);
54void m8xx_calibrate_decr(void); 87void m8xx_calibrate_decr(void);
@@ -71,6 +104,10 @@ board_init(void)
71void __init 104void __init
72m8xx_setup_arch(void) 105m8xx_setup_arch(void)
73{ 106{
107#if defined(CONFIG_MTD) && defined(CONFIG_MTD_PHYSMAP)
108 bd_t *binfo = (bd_t *)__res;
109#endif
110
74 /* Reset the Communication Processor Module. 111 /* Reset the Communication Processor Module.
75 */ 112 */
76 m8xx_cpm_reset(); 113 m8xx_cpm_reset();
@@ -106,6 +143,17 @@ m8xx_setup_arch(void)
106 } 143 }
107#endif 144#endif
108#endif 145#endif
146
147#if defined (CONFIG_MPC86XADS) || defined (CONFIG_MPC885ADS)
148#if defined(CONFIG_MTD_PHYSMAP)
149 physmap_configure(binfo->bi_flashstart, binfo->bi_flashsize,
150 MPC8xxADS_BANK_WIDTH, NULL);
151#ifdef CONFIG_MTD_PARTITIONS
152 physmap_set_partitions(mpc8xxads_partitions, mpc8xxads_part_num);
153#endif /* CONFIG_MTD_PARTITIONS */
154#endif /* CONFIG_MTD_PHYSMAP */
155#endif
156
109 board_init(); 157 board_init();
110} 158}
111 159
@@ -140,9 +188,11 @@ void __init __attribute__ ((weak))
140init_internal_rtc(void) 188init_internal_rtc(void)
141{ 189{
142 /* Disable the RTC one second and alarm interrupts. */ 190 /* Disable the RTC one second and alarm interrupts. */
143 out_be16(&((immap_t *)IMAP_ADDR)->im_sit.sit_rtcsc, in_be16(&((immap_t *)IMAP_ADDR)->im_sit.sit_rtcsc) & ~(RTCSC_SIE | RTCSC_ALE)); 191 clrbits16(&((immap_t *)IMAP_ADDR)->im_sit.sit_rtcsc, (RTCSC_SIE | RTCSC_ALE));
192
144 /* Enable the RTC */ 193 /* Enable the RTC */
145 out_be16(&((immap_t *)IMAP_ADDR)->im_sit.sit_rtcsc, in_be16(&((immap_t *)IMAP_ADDR)->im_sit.sit_rtcsc) | (RTCSC_RTF | RTCSC_RTE)); 194 setbits16(&((immap_t *)IMAP_ADDR)->im_sit.sit_rtcsc, (RTCSC_RTF | RTCSC_RTE));
195
146} 196}
147 197
148/* The decrementer counts at the system (internal) clock frequency divided by 198/* The decrementer counts at the system (internal) clock frequency divided by
@@ -159,8 +209,7 @@ void __init m8xx_calibrate_decr(void)
159 out_be32(&((immap_t *)IMAP_ADDR)->im_clkrstk.cark_sccrk, KAPWR_KEY); 209 out_be32(&((immap_t *)IMAP_ADDR)->im_clkrstk.cark_sccrk, KAPWR_KEY);
160 210
161 /* Force all 8xx processors to use divide by 16 processor clock. */ 211 /* Force all 8xx processors to use divide by 16 processor clock. */
162 out_be32(&((immap_t *)IMAP_ADDR)->im_clkrst.car_sccr, 212 setbits32(&((immap_t *)IMAP_ADDR)->im_clkrst.car_sccr, 0x02000000);
163 in_be32(&((immap_t *)IMAP_ADDR)->im_clkrst.car_sccr)|0x02000000);
164 /* Processor frequency is MHz. 213 /* Processor frequency is MHz.
165 * The value 'fp' is the number of decrementer ticks per second. 214 * The value 'fp' is the number of decrementer ticks per second.
166 */ 215 */
@@ -239,8 +288,8 @@ m8xx_restart(char *cmd)
239 __volatile__ unsigned char dummy; 288 __volatile__ unsigned char dummy;
240 289
241 local_irq_disable(); 290 local_irq_disable();
242 out_be32(&((immap_t *)IMAP_ADDR)->im_clkrst.car_plprcr, in_be32(&((immap_t *)IMAP_ADDR)->im_clkrst.car_plprcr) | 0x00000080);
243 291
292 setbits32(&((immap_t *)IMAP_ADDR)->im_clkrst.car_plprcr, 0x00000080);
244 /* Clear the ME bit in MSR to cause checkstop on machine check 293 /* Clear the ME bit in MSR to cause checkstop on machine check
245 */ 294 */
246 mtmsr(mfmsr() & ~0x1000); 295 mtmsr(mfmsr() & ~0x1000);
@@ -310,8 +359,8 @@ m8xx_init_IRQ(void)
310 i8259_init(0); 359 i8259_init(0);
311 360
312 /* The i8259 cascade interrupt must be level sensitive. */ 361 /* The i8259 cascade interrupt must be level sensitive. */
313 out_be32(&((immap_t *)IMAP_ADDR)->im_siu_conf.sc_siel, in_be32(&((immap_t *)IMAP_ADDR)->im_siu_conf.sc_siel & ~(0x80000000 >> ISA_BRIDGE_INT)));
314 362
363 clrbits32(&((immap_t *)IMAP_ADDR)->im_siu_conf.sc_siel, (0x80000000 >> ISA_BRIDGE_INT));
315 if (setup_irq(ISA_BRIDGE_INT, &mbx_i8259_irqaction)) 364 if (setup_irq(ISA_BRIDGE_INT, &mbx_i8259_irqaction))
316 enable_irq(ISA_BRIDGE_INT); 365 enable_irq(ISA_BRIDGE_INT);
317#endif /* CONFIG_PCI */ 366#endif /* CONFIG_PCI */