aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68knommu
diff options
context:
space:
mode:
Diffstat (limited to 'arch/m68knommu')
-rw-r--r--arch/m68knommu/Kconfig7
-rw-r--r--arch/m68knommu/kernel/process.c5
-rw-r--r--arch/m68knommu/kernel/setup.c92
-rw-r--r--arch/m68knommu/kernel/sys_m68k.c38
-rw-r--r--arch/m68knommu/kernel/syscalltable.S2
-rw-r--r--arch/m68knommu/kernel/vmlinux.lds.S47
-rw-r--r--arch/m68knommu/platform/523x/gpio.c5
-rw-r--r--arch/m68knommu/platform/527x/gpio.c6
-rw-r--r--arch/m68knommu/platform/528x/gpio.c2
-rw-r--r--arch/m68knommu/platform/coldfire/clk.c7
-rw-r--r--arch/m68knommu/platform/coldfire/head.S10
11 files changed, 139 insertions, 82 deletions
diff --git a/arch/m68knommu/Kconfig b/arch/m68knommu/Kconfig
index e2201b90aa22..064f5913db1a 100644
--- a/arch/m68knommu/Kconfig
+++ b/arch/m68knommu/Kconfig
@@ -533,6 +533,13 @@ config AVNET
533 default y 533 default y
534 depends on (AVNET5282) 534 depends on (AVNET5282)
535 535
536config UBOOT
537 bool "Support for U-Boot command line parameters"
538 help
539 If you say Y here kernel will try to collect command
540 line parameters from the initial u-boot stack.
541 default n
542
536config 4KSTACKS 543config 4KSTACKS
537 bool "Use 4Kb for kernel stacks instead of 8Kb" 544 bool "Use 4Kb for kernel stacks instead of 8Kb"
538 default y 545 default y
diff --git a/arch/m68knommu/kernel/process.c b/arch/m68knommu/kernel/process.c
index 8f8f4abab2ff..5c9ecd427090 100644
--- a/arch/m68knommu/kernel/process.c
+++ b/arch/m68knommu/kernel/process.c
@@ -352,15 +352,12 @@ asmlinkage int sys_execve(char *name, char **argv, char **envp)
352 char * filename; 352 char * filename;
353 struct pt_regs *regs = (struct pt_regs *) &name; 353 struct pt_regs *regs = (struct pt_regs *) &name;
354 354
355 lock_kernel();
356 filename = getname(name); 355 filename = getname(name);
357 error = PTR_ERR(filename); 356 error = PTR_ERR(filename);
358 if (IS_ERR(filename)) 357 if (IS_ERR(filename))
359 goto out; 358 return error;
360 error = do_execve(filename, argv, envp, regs); 359 error = do_execve(filename, argv, envp, regs);
361 putname(filename); 360 putname(filename);
362out:
363 unlock_kernel();
364 return error; 361 return error;
365} 362}
366 363
diff --git a/arch/m68knommu/kernel/setup.c b/arch/m68knommu/kernel/setup.c
index 5c2bb3eeaaa2..ba92b90d5fbc 100644
--- a/arch/m68knommu/kernel/setup.c
+++ b/arch/m68knommu/kernel/setup.c
@@ -29,6 +29,8 @@
29#include <linux/bootmem.h> 29#include <linux/bootmem.h>
30#include <linux/seq_file.h> 30#include <linux/seq_file.h>
31#include <linux/init.h> 31#include <linux/init.h>
32#include <linux/initrd.h>
33#include <linux/root_dev.h>
32 34
33#include <asm/setup.h> 35#include <asm/setup.h>
34#include <asm/irq.h> 36#include <asm/irq.h>
@@ -52,7 +54,6 @@ void (*mach_reset)(void);
52void (*mach_halt)(void); 54void (*mach_halt)(void);
53void (*mach_power_off)(void); 55void (*mach_power_off)(void);
54 56
55
56#ifdef CONFIG_M68000 57#ifdef CONFIG_M68000
57 #define CPU "MC68000" 58 #define CPU "MC68000"
58#endif 59#endif
@@ -111,6 +112,69 @@ void (*mach_power_off)(void);
111extern int _stext, _etext, _sdata, _edata, _sbss, _ebss, _end; 112extern int _stext, _etext, _sdata, _edata, _sbss, _ebss, _end;
112extern int _ramstart, _ramend; 113extern int _ramstart, _ramend;
113 114
115#if defined(CONFIG_UBOOT)
116/*
117 * parse_uboot_commandline
118 *
119 * Copies u-boot commandline arguments and store them in the proper linux
120 * variables.
121 *
122 * Assumes:
123 * _init_sp global contains the address in the stack pointer when the
124 * kernel starts (see head.S::_start)
125 *
126 * U-Boot calling convention:
127 * (*kernel) (kbd, initrd_start, initrd_end, cmd_start, cmd_end);
128 *
129 * _init_sp can be parsed as such
130 *
131 * _init_sp+00 = u-boot cmd after jsr into kernel (skip)
132 * _init_sp+04 = &kernel board_info (residual data)
133 * _init_sp+08 = &initrd_start
134 * _init_sp+12 = &initrd_end
135 * _init_sp+16 = &cmd_start
136 * _init_sp+20 = &cmd_end
137 *
138 * This also assumes that the memory locations pointed to are still
139 * unmodified. U-boot places them near the end of external SDRAM.
140 *
141 * Argument(s):
142 * commandp = the linux commandline arg container to fill.
143 * size = the sizeof commandp.
144 *
145 * Returns:
146 */
147void parse_uboot_commandline(char *commandp, int size)
148{
149 extern unsigned long _init_sp;
150 unsigned long *sp;
151 unsigned long uboot_kbd;
152 unsigned long uboot_initrd_start, uboot_initrd_end;
153 unsigned long uboot_cmd_start, uboot_cmd_end;
154
155
156 sp = (unsigned long *)_init_sp;
157 uboot_kbd = sp[1];
158 uboot_initrd_start = sp[2];
159 uboot_initrd_end = sp[3];
160 uboot_cmd_start = sp[4];
161 uboot_cmd_end = sp[5];
162
163 if (uboot_cmd_start && uboot_cmd_end)
164 strncpy(commandp, (const char *)uboot_cmd_start, size);
165#if defined(CONFIG_BLK_DEV_INITRD)
166 if (uboot_initrd_start && uboot_initrd_end &&
167 (uboot_initrd_end > uboot_initrd_start)) {
168 initrd_start = uboot_initrd_start;
169 initrd_end = uboot_initrd_end;
170 ROOT_DEV = Root_RAM0;
171 printk(KERN_INFO "initrd at 0x%lx:0x%lx\n",
172 initrd_start, initrd_end);
173 }
174#endif /* if defined(CONFIG_BLK_DEV_INITRD) */
175}
176#endif /* #if defined(CONFIG_UBOOT) */
177
114void __init setup_arch(char **cmdline_p) 178void __init setup_arch(char **cmdline_p)
115{ 179{
116 int bootmap_size; 180 int bootmap_size;
@@ -128,7 +192,24 @@ void __init setup_arch(char **cmdline_p)
128#if defined(CONFIG_BOOTPARAM) 192#if defined(CONFIG_BOOTPARAM)
129 strncpy(&command_line[0], CONFIG_BOOTPARAM_STRING, sizeof(command_line)); 193 strncpy(&command_line[0], CONFIG_BOOTPARAM_STRING, sizeof(command_line));
130 command_line[sizeof(command_line) - 1] = 0; 194 command_line[sizeof(command_line) - 1] = 0;
131#endif 195#endif /* CONFIG_BOOTPARAM */
196
197#if defined(CONFIG_UBOOT)
198 /* CONFIG_UBOOT and CONFIG_BOOTPARAM defined, concatenate cmdline */
199 #if defined(CONFIG_BOOTPARAM)
200 /* Add the whitespace separator */
201 command_line[strlen(CONFIG_BOOTPARAM_STRING)] = ' ';
202 /* Parse uboot command line into the rest of the buffer */
203 parse_uboot_commandline(
204 &command_line[(strlen(CONFIG_BOOTPARAM_STRING)+1)],
205 (sizeof(command_line) -
206 (strlen(CONFIG_BOOTPARAM_STRING)+1)));
207 /* Only CONFIG_UBOOT defined, create cmdline */
208 #else
209 parse_uboot_commandline(&command_line[0], sizeof(command_line));
210 #endif /* CONFIG_BOOTPARAM */
211 command_line[sizeof(command_line) - 1] = 0;
212#endif /* CONFIG_UBOOT */
132 213
133 printk(KERN_INFO "\x0F\r\n\nuClinux/" CPU "\n"); 214 printk(KERN_INFO "\x0F\r\n\nuClinux/" CPU "\n");
134 215
@@ -204,6 +285,13 @@ void __init setup_arch(char **cmdline_p)
204 free_bootmem(memory_start, memory_end - memory_start); 285 free_bootmem(memory_start, memory_end - memory_start);
205 reserve_bootmem(memory_start, bootmap_size, BOOTMEM_DEFAULT); 286 reserve_bootmem(memory_start, bootmap_size, BOOTMEM_DEFAULT);
206 287
288#if defined(CONFIG_UBOOT) && defined(CONFIG_BLK_DEV_INITRD)
289 if ((initrd_start > 0) && (initrd_start < initrd_end) &&
290 (initrd_end < memory_end))
291 reserve_bootmem(initrd_start, initrd_end - initrd_start,
292 BOOTMEM_DEFAULT);
293#endif /* if defined(CONFIG_BLK_DEV_INITRD) */
294
207 /* 295 /*
208 * Get kmalloc into gear. 296 * Get kmalloc into gear.
209 */ 297 */
diff --git a/arch/m68knommu/kernel/sys_m68k.c b/arch/m68knommu/kernel/sys_m68k.c
index efdd090778a3..b67cbc735a9b 100644
--- a/arch/m68knommu/kernel/sys_m68k.c
+++ b/arch/m68knommu/kernel/sys_m68k.c
@@ -27,39 +27,6 @@
27#include <asm/cacheflush.h> 27#include <asm/cacheflush.h>
28#include <asm/unistd.h> 28#include <asm/unistd.h>
29 29
30/* common code for old and new mmaps */
31static inline long do_mmap2(
32 unsigned long addr, unsigned long len,
33 unsigned long prot, unsigned long flags,
34 unsigned long fd, unsigned long pgoff)
35{
36 int error = -EBADF;
37 struct file * file = NULL;
38
39 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
40 if (!(flags & MAP_ANONYMOUS)) {
41 file = fget(fd);
42 if (!file)
43 goto out;
44 }
45
46 down_write(&current->mm->mmap_sem);
47 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
48 up_write(&current->mm->mmap_sem);
49
50 if (file)
51 fput(file);
52out:
53 return error;
54}
55
56asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
57 unsigned long prot, unsigned long flags,
58 unsigned long fd, unsigned long pgoff)
59{
60 return do_mmap2(addr, len, prot, flags, fd, pgoff);
61}
62
63/* 30/*
64 * Perform the select(nd, in, out, ex, tv) and mmap() system 31 * Perform the select(nd, in, out, ex, tv) and mmap() system
65 * calls. Linux/m68k cloned Linux/i386, which didn't use to be able to 32 * calls. Linux/m68k cloned Linux/i386, which didn't use to be able to
@@ -88,9 +55,8 @@ asmlinkage int old_mmap(struct mmap_arg_struct *arg)
88 if (a.offset & ~PAGE_MASK) 55 if (a.offset & ~PAGE_MASK)
89 goto out; 56 goto out;
90 57
91 a.flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); 58 error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd,
92 59 a.offset >> PAGE_SHIFT);
93 error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT);
94out: 60out:
95 return error; 61 return error;
96} 62}
diff --git a/arch/m68knommu/kernel/syscalltable.S b/arch/m68knommu/kernel/syscalltable.S
index 23535cc415ae..486837efa3d7 100644
--- a/arch/m68knommu/kernel/syscalltable.S
+++ b/arch/m68knommu/kernel/syscalltable.S
@@ -210,7 +210,7 @@ ENTRY(sys_call_table)
210 .long sys_ni_syscall /* streams2 */ 210 .long sys_ni_syscall /* streams2 */
211 .long sys_vfork /* 190 */ 211 .long sys_vfork /* 190 */
212 .long sys_getrlimit 212 .long sys_getrlimit
213 .long sys_mmap2 213 .long sys_mmap_pgoff
214 .long sys_truncate64 214 .long sys_truncate64
215 .long sys_ftruncate64 215 .long sys_ftruncate64
216 .long sys_stat64 /* 195 */ 216 .long sys_stat64 /* 195 */
diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
index 2736a5e309c0..9f1784f586b9 100644
--- a/arch/m68knommu/kernel/vmlinux.lds.S
+++ b/arch/m68knommu/kernel/vmlinux.lds.S
@@ -8,6 +8,8 @@
8 */ 8 */
9 9
10#include <asm-generic/vmlinux.lds.h> 10#include <asm-generic/vmlinux.lds.h>
11#include <asm/page.h>
12#include <asm/thread_info.h>
11 13
12#if defined(CONFIG_RAMKERNEL) 14#if defined(CONFIG_RAMKERNEL)
13#define RAM_START CONFIG_KERNELBASE 15#define RAM_START CONFIG_KERNELBASE
@@ -15,7 +17,7 @@
15#define TEXT ram 17#define TEXT ram
16#define DATA ram 18#define DATA ram
17#define INIT ram 19#define INIT ram
18#define BSS ram 20#define BSSS ram
19#endif 21#endif
20#if defined(CONFIG_ROMKERNEL) || defined(CONFIG_HIMEMKERNEL) 22#if defined(CONFIG_ROMKERNEL) || defined(CONFIG_HIMEMKERNEL)
21#define RAM_START CONFIG_RAMBASE 23#define RAM_START CONFIG_RAMBASE
@@ -27,7 +29,7 @@
27#define TEXT rom 29#define TEXT rom
28#define DATA ram 30#define DATA ram
29#define INIT ram 31#define INIT ram
30#define BSS ram 32#define BSSS ram
31#endif 33#endif
32 34
33#ifndef DATA_ADDR 35#ifndef DATA_ADDR
@@ -147,40 +149,19 @@ SECTIONS {
147 . = ALIGN(4); 149 . = ALIGN(4);
148 _sdata = . ; 150 _sdata = . ;
149 DATA_DATA 151 DATA_DATA
150 . = ALIGN(32); 152 CACHELINE_ALIGNED_DATA(32)
151 *(.data.cacheline_aligned) 153 INIT_TASK_DATA(THREAD_SIZE)
152 . = ALIGN(8192) ;
153 *(.data.init_task)
154 _edata = . ; 154 _edata = . ;
155 } > DATA 155 } > DATA
156 156
157 .init : { 157 .init.text : {
158 . = ALIGN(4096); 158 . = ALIGN(PAGE_SIZE);
159 __init_begin = .; 159 __init_begin = .;
160 _sinittext = .; 160 } > INIT
161 INIT_TEXT 161 INIT_TEXT_SECTION(PAGE_SIZE) > INIT
162 _einittext = .; 162 INIT_DATA_SECTION(16) > INIT
163 INIT_DATA 163 .init.data : {
164 . = ALIGN(16); 164 . = ALIGN(PAGE_SIZE);
165 __setup_start = .;
166 *(.init.setup)
167 __setup_end = .;
168 __initcall_start = .;
169 INITCALLS
170 __initcall_end = .;
171 __con_initcall_start = .;
172 *(.con_initcall.init)
173 __con_initcall_end = .;
174 __security_initcall_start = .;
175 *(.security_initcall.init)
176 __security_initcall_end = .;
177#ifdef CONFIG_BLK_DEV_INITRD
178 . = ALIGN(4);
179 __initramfs_start = .;
180 *(.init.ramfs)
181 __initramfs_end = .;
182#endif
183 . = ALIGN(4096);
184 __init_end = .; 165 __init_end = .;
185 } > INIT 166 } > INIT
186 167
@@ -192,7 +173,7 @@ SECTIONS {
192 . = ALIGN(4) ; 173 . = ALIGN(4) ;
193 _ebss = . ; 174 _ebss = . ;
194 _end = . ; 175 _end = . ;
195 } > BSS 176 } > BSSS
196 177
197 DISCARDS 178 DISCARDS
198} 179}
diff --git a/arch/m68knommu/platform/523x/gpio.c b/arch/m68knommu/platform/523x/gpio.c
index f02840d54d3c..a8842dc27839 100644
--- a/arch/m68knommu/platform/523x/gpio.c
+++ b/arch/m68knommu/platform/523x/gpio.c
@@ -30,7 +30,8 @@ static struct mcf_gpio_chip mcf_gpio_chips[] = {
30 .direction_output = mcf_gpio_direction_output, 30 .direction_output = mcf_gpio_direction_output,
31 .get = mcf_gpio_get_value, 31 .get = mcf_gpio_get_value,
32 .set = mcf_gpio_set_value, 32 .set = mcf_gpio_set_value,
33 .ngpio = 8, 33 .base = 1,
34 .ngpio = 7,
34 }, 35 },
35 .pddr = MCFEPORT_EPDDR, 36 .pddr = MCFEPORT_EPDDR,
36 .podr = MCFEPORT_EPDR, 37 .podr = MCFEPORT_EPDR,
@@ -244,7 +245,7 @@ static struct mcf_gpio_chip mcf_gpio_chips[] = {
244 .get = mcf_gpio_get_value, 245 .get = mcf_gpio_get_value,
245 .set = mcf_gpio_set_value_fast, 246 .set = mcf_gpio_set_value_fast,
246 .base = 96, 247 .base = 96,
247 .ngpio = 4, 248 .ngpio = 8,
248 }, 249 },
249 .pddr = MCFGPIO_PDDR_TIMER, 250 .pddr = MCFGPIO_PDDR_TIMER,
250 .podr = MCFGPIO_PODR_TIMER, 251 .podr = MCFGPIO_PODR_TIMER,
diff --git a/arch/m68knommu/platform/527x/gpio.c b/arch/m68knommu/platform/527x/gpio.c
index 1028142851ac..0b56e19db0f8 100644
--- a/arch/m68knommu/platform/527x/gpio.c
+++ b/arch/m68knommu/platform/527x/gpio.c
@@ -31,7 +31,8 @@ static struct mcf_gpio_chip mcf_gpio_chips[] = {
31 .direction_output = mcf_gpio_direction_output, 31 .direction_output = mcf_gpio_direction_output,
32 .get = mcf_gpio_get_value, 32 .get = mcf_gpio_get_value,
33 .set = mcf_gpio_set_value, 33 .set = mcf_gpio_set_value,
34 .ngpio = 8, 34 .base = 1,
35 .ngpio = 7,
35 }, 36 },
36 .pddr = MCFEPORT_EPDDR, 37 .pddr = MCFEPORT_EPDDR,
37 .podr = MCFEPORT_EPDR, 38 .podr = MCFEPORT_EPDR,
@@ -263,7 +264,8 @@ static struct mcf_gpio_chip mcf_gpio_chips[] = {
263 .direction_output = mcf_gpio_direction_output, 264 .direction_output = mcf_gpio_direction_output,
264 .get = mcf_gpio_get_value, 265 .get = mcf_gpio_get_value,
265 .set = mcf_gpio_set_value, 266 .set = mcf_gpio_set_value,
266 .ngpio = 8, 267 .base = 1,
268 .ngpio = 7,
267 }, 269 },
268 .pddr = MCFEPORT_EPDDR, 270 .pddr = MCFEPORT_EPDDR,
269 .podr = MCFEPORT_EPDR, 271 .podr = MCFEPORT_EPDR,
diff --git a/arch/m68knommu/platform/528x/gpio.c b/arch/m68knommu/platform/528x/gpio.c
index ec593950696a..eedaf0adbcd7 100644
--- a/arch/m68knommu/platform/528x/gpio.c
+++ b/arch/m68knommu/platform/528x/gpio.c
@@ -31,7 +31,7 @@ static struct mcf_gpio_chip mcf_gpio_chips[] = {
31 .get = mcf_gpio_get_value, 31 .get = mcf_gpio_get_value,
32 .set = mcf_gpio_set_value, 32 .set = mcf_gpio_set_value,
33 .base = 1, 33 .base = 1,
34 .ngpio = 8, 34 .ngpio = 7,
35 }, 35 },
36 .pddr = MCFEPORT_EPDDR, 36 .pddr = MCFEPORT_EPDDR,
37 .podr = MCFEPORT_EPDR, 37 .podr = MCFEPORT_EPDR,
diff --git a/arch/m68knommu/platform/coldfire/clk.c b/arch/m68knommu/platform/coldfire/clk.c
index 7cdbf445b28f..9f1260c5e2ad 100644
--- a/arch/m68knommu/platform/coldfire/clk.c
+++ b/arch/m68knommu/platform/coldfire/clk.c
@@ -9,6 +9,7 @@
9/***************************************************************************/ 9/***************************************************************************/
10 10
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/module.h>
12#include <linux/clk.h> 13#include <linux/clk.h>
13#include <asm/coldfire.h> 14#include <asm/coldfire.h>
14 15
@@ -18,23 +19,27 @@ struct clk *clk_get(struct device *dev, const char *id)
18{ 19{
19 return NULL; 20 return NULL;
20} 21}
22EXPORT_SYMBOL(clk_get);
21 23
22int clk_enable(struct clk *clk) 24int clk_enable(struct clk *clk)
23{ 25{
24 return 0; 26 return 0;
25} 27}
28EXPORT_SYMBOL(clk_enable);
26 29
27void clk_disable(struct clk *clk) 30void clk_disable(struct clk *clk)
28{ 31{
29} 32}
33EXPORT_SYMBOL(clk_disable);
30 34
31void clk_put(struct clk *clk) 35void clk_put(struct clk *clk)
32{ 36{
33} 37}
38EXPORT_SYMBOL(clk_put);
34 39
35unsigned long clk_get_rate(struct clk *clk) 40unsigned long clk_get_rate(struct clk *clk)
36{ 41{
37 return MCF_CLK; 42 return MCF_CLK;
38} 43}
39 44EXPORT_SYMBOL(clk_get_rate);
40/***************************************************************************/ 45/***************************************************************************/
diff --git a/arch/m68knommu/platform/coldfire/head.S b/arch/m68knommu/platform/coldfire/head.S
index 2b0d73c0cc32..4b91aa24eb00 100644
--- a/arch/m68knommu/platform/coldfire/head.S
+++ b/arch/m68knommu/platform/coldfire/head.S
@@ -106,6 +106,9 @@
106.global _ramvec 106.global _ramvec
107.global _ramstart 107.global _ramstart
108.global _ramend 108.global _ramend
109#if defined(CONFIG_UBOOT)
110.global _init_sp
111#endif
109 112
110/*****************************************************************************/ 113/*****************************************************************************/
111 114
@@ -124,6 +127,10 @@ _ramstart:
124.long 0 127.long 0
125_ramend: 128_ramend:
126.long 0 129.long 0
130#if defined(CONFIG_UBOOT)
131_init_sp:
132.long 0
133#endif
127 134
128/*****************************************************************************/ 135/*****************************************************************************/
129 136
@@ -137,6 +144,9 @@ __HEAD
137_start: 144_start:
138 nop /* filler */ 145 nop /* filler */
139 movew #0x2700, %sr /* no interrupts */ 146 movew #0x2700, %sr /* no interrupts */
147#if defined(CONFIG_UBOOT)
148 movel %sp,_init_sp /* save initial stack pointer */
149#endif
140 150
141 /* 151 /*
142 * Do any platform or board specific setup now. Most boards 152 * Do any platform or board specific setup now. Most boards