Commit 6be102ce authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://ppc.bkbits.net/for-linus-ppc

into home.transmeta.com:/home/torvalds/v2.5/linux
parents 96b7bd95 1b9e349f
This diff is collapsed.
......@@ -102,7 +102,7 @@ pcibios_fixup_final(struct pci_dev *dev)
{
unsigned int class = dev->class >> 8;
if (class == PCI_CLASS_BRIDGE_ISA || class == PCI_CLASS_BRIDGE_ISA) {
if (class == PCI_CLASS_BRIDGE_ISA || class == PCI_CLASS_BRIDGE_EISA) {
dev->dma_mask = MAX_ISA_DMA_ADDRESS - 1;
isa_bridge = dev;
}
......
......@@ -366,8 +366,8 @@ do_sys_ptrace(long request, long pid, long addr, long data,
ret = -EIO;
if ((unsigned long) data > _NSIG)
break;
/* Set single stepping. */
ptrace_set_bpt(child);
/* Mark single stepping. */
child->thread_info->bpt_nsaved = -1;
clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
wake_up_process(child);
child->exit_code = data;
......
......@@ -619,7 +619,10 @@ do_signal(sigset_t *oldset, struct pt_regs * regs, struct switch_stack * sw,
if (!oldset)
oldset = &current->blocked;
/* This lets the debugger run, ... */
signr = get_signal_to_deliver(&info, regs, NULL);
/* ... so re-check the single stepping. */
single_stepping |= ptrace_cancel_bpt(current);
if (signr > 0) {
/* Whee! Actually deliver the signal. */
......
......@@ -417,12 +417,7 @@ fork_by_hand(void)
/* Don't care about the contents of regs since we'll never
reschedule the forked task. */
struct pt_regs regs;
int pid;
pid = do_fork(CLONE_VM|CLONE_IDLETASK, 0, &regs, 0, NULL, NULL);
if (pid < 0)
return NULL;
return find_task_by_pid (pid);
return copy_process(CLONE_VM|CLONE_IDLETASK, 0, &regs, 0, NULL, NULL);
}
/*
......@@ -441,9 +436,11 @@ smp_boot_one_cpu(int cpuid)
wish. We can't use kernel_thread since we must avoid
rescheduling the child. */
idle = fork_by_hand();
if (!idle)
if (IS_ERR(idle))
panic("failed fork for CPU %d", cpuid);
wake_up_forked_process(idle);
init_idle(idle, cpuid);
unhash_process(idle);
......
......@@ -31,11 +31,11 @@
.global __put_user_1
__put_user_1:
bic r2, sp, #0x1f00
bic r2, r2, #0x00ff
ldr r2, [r2, #TI_ADDR_LIMIT]
sub r2, r2, #1
cmp r0, r2
bic ip, sp, #0x1f00
bic ip, ip, #0x00ff
ldr ip, [ip, #TI_ADDR_LIMIT]
sub ip, ip, #1
cmp r0, ip
1: strlsbt r1, [r0]
movls r0, #0
movls pc, lr
......@@ -43,17 +43,17 @@ __put_user_1:
.global __put_user_2
__put_user_2:
bic r2, sp, #0x1f00
bic r2, r2, #0x00ff
ldr r2, [r2, #TI_ADDR_LIMIT]
sub r2, r2, #2
cmp r0, r2
movls r2, r1, lsr #8
bic ip, sp, #0x1f00
bic ip, ip, #0x00ff
ldr ip, [ip, #TI_ADDR_LIMIT]
sub ip, ip, #2
cmp r0, ip
movls ip, r1, lsr #8
#ifndef __ARMEB__
2: strlsbt r1, [r0], #1
3: strlsbt r2, [r0]
3: strlsbt ip, [r0]
#else
2: strlsbt r2, [r0], #1
2: strlsbt ip, [r0], #1
3: strlsbt r1, [r0]
#endif
movls r0, #0
......@@ -62,11 +62,11 @@ __put_user_2:
.global __put_user_4
__put_user_4:
bic r2, sp, #0x1f00
bic r2, r2, #0x00ff
ldr r2, [r2, #TI_ADDR_LIMIT]
sub r2, r2, #4
cmp r0, r2
bic ip, sp, #0x1f00
bic ip, ip, #0x00ff
ldr ip, [ip, #TI_ADDR_LIMIT]
sub ip, ip, #4
cmp r0, ip
4: strlst r1, [r0]
movls r0, #0
movls pc, lr
......
......@@ -47,7 +47,7 @@
#define TABLE_SIZE ((TABLE_OFFSET + PTRS_PER_PTE) * sizeof(pte_t))
struct mmu_gather mmu_gathers[NR_CPUS];
DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
extern char _stext, _text, _etext, _end, __init_begin, __init_end;
......
......@@ -118,7 +118,7 @@ int dragen2_cs8900_setup(struct net_device *dev)
static void init_hardware(void)
{
#if CONFIG_DIRECT_IO_ACCESS
#ifdef CONFIG_DIRECT_IO_ACCESS
SCR = 0x10; /* allow user access to internal registers */
#endif
......
/* Linker script for the NEC AS85EP1 V850E evaluation board
(CONFIG_V850E_AS85EP1), with kernel in ROM (CONFIG_ROM_KERNEL). */
/* Note, all symbols are prefixed with an extra `_' for compatibility with
the existing linux sources. */
MEMORY {
/* 4MB of flash ROM. */
ROM : ORIGIN = 0, LENGTH = 0x00400000
......@@ -12,7 +9,7 @@ MEMORY {
SRAM : ORIGIN = 0x00400000, LENGTH = 0x00100000
/* About 58MB of DRAM. This can actually be at one of two
positions, determined by jump JP3; we have to use the first
positions, determined by jumper JP3; we have to use the first
position because the second is partially out of processor
instruction addressing range (though in the second position
there's actually 64MB available). */
......
This diff is collapsed.
/*
* arch/v850/kernel/irq.c -- High-level interrupt handling
*
* Copyright (C) 2001,02,03 NEC Corporation
* Copyright (C) 2001,02,03 NEC Electronics Corporation
* Copyright (C) 2001,02,03 Miles Bader <miles@gnu.org>
* Copyright (C) 1994-2000 Ralf Baechle
* Copyright (C) 1992 Linus Torvalds
......@@ -35,7 +35,7 @@ irq_desc_t irq_desc[NR_IRQS] __cacheline_aligned =
* Special irq handlers.
*/
void no_action(int cpl, void *dev_id, struct pt_regs *regs) { }
irqreturn_t no_action(int cpl, void *dev_id, struct pt_regs *regs) { }
/*
* Generic no controller code
......@@ -352,7 +352,7 @@ unsigned int handle_irq (int irq, struct pt_regs *regs)
*/
int request_irq(unsigned int irq,
void (*handler)(int, void *, struct pt_regs *),
irqreturn_t (*handler)(int, void *, struct pt_regs *),
unsigned long irqflags,
const char * devname,
void *dev_id)
......
/*
* arch/v850/kernel/ma.c -- V850E/MA series of cpu chips
*
* Copyright (C) 2001,02 NEC Corporation
* Copyright (C) 2001,02 Miles Bader <miles@gnu.org>
* Copyright (C) 2001,02,03 NEC Electronics Corporation
* Copyright (C) 2001,02,03 Miles Bader <miles@gnu.org>
*
* This file is subject to the terms and conditions of the GNU General
* Public License. See the file COPYING in the main directory of this
......
/*
* arch/v850/kernel/mach.h -- Machine-dependent functions used by v850 port
*
* Copyright (C) 2001,02 NEC Corporation
* Copyright (C) 2001,02 Miles Bader <miles@gnu.org>
* Copyright (C) 2001,02,03 NEC Electronics Corporation
* Copyright (C) 2001,02,03 Miles Bader <miles@gnu.org>
*
* This file is subject to the terms and conditions of the GNU General
* Public License. See the file COPYING in the main directory of this
......
/*
* arch/v850/kernel/process.c -- Arch-dependent process handling
*
* Copyright (C) 2001,02,03 NEC Corporation
* Copyright (C) 2001,02,03 NEC Electronics Corporation
* Copyright (C) 2001,02,03 Miles Bader <miles@gnu.org>
*
* This file is subject to the terms and conditions of the GNU General
......@@ -200,14 +200,6 @@ int sys_execve (char *name, char **argv, char **envp, struct pt_regs *regs)
return error;
}
/* This is the common part of the various fork-like system calls (which
are in entry.S). */
int fork_common (int flags, unsigned long new_sp, struct pt_regs *regs)
{
struct task_struct *p = do_fork (flags, new_sp, regs, 0, 0, 0);
return IS_ERR (p) ? PTR_ERR (p) : p->pid;
}
/*
* These bracket the sleeping functions..
......
/*
* arch/v850/kernel/ptrace.c -- `ptrace' system call
*
* Copyright (C) 2002 NEC Corporation
* Copyright (C) 2002 Miles Bader <miles@gnu.org>
* Copyright (C) 2002,03 NEC Electronics Corporation
* Copyright (C) 2002,03 Miles Bader <miles@gnu.org>
*
* Derived from arch/mips/kernel/ptrace.c:
*
......@@ -29,6 +29,89 @@
#include <asm/processor.h>
#include <asm/uaccess.h>
/* Returns the address where the register at REG_OFFS in P is stashed away. */
static v850_reg_t *reg_save_addr (unsigned reg_offs, struct task_struct *t)
{
struct pt_regs *regs;
/* Three basic cases:
(1) A register normally saved before calling the scheduler, is
available in the kernel entry pt_regs structure at the top
of the kernel stack. The kernel trap/irq exit path takes
care to save/restore almost all registers for ptrace'd
processes.
(2) A call-clobbered register, where the process P entered the
kernel via [syscall] trap, is not stored anywhere; that's
OK, because such registers are not expected to be preserved
when the trap returns anyway (so we don't actually bother to
test for this case).
(3) A few registers not used at all by the kernel, and so
normally never saved except by context-switches, are in the
context switch state. */
if (reg_offs == PT_CTPC || reg_offs == PT_CTPSW || reg_offs == PT_CTBP)
/* Register saved during context switch. */
regs = thread_saved_regs (t);
else
/* Register saved during kernel entry (or not available). */
regs = task_regs (t);
return (v850_reg_t *)((char *)regs + reg_offs);
}
/* Set the bits SET and clear the bits CLEAR in the v850e DIR
(`debug information register'). Returns the new value of DIR. */
static inline v850_reg_t set_dir (v850_reg_t set, v850_reg_t clear)
{
register v850_reg_t rval asm ("r10");
register v850_reg_t arg0 asm ("r6") = set;
register v850_reg_t arg1 asm ("r7") = clear;
/* The dbtrap handler has exactly this functionality when called
from kernel mode. 0xf840 is a `dbtrap' insn. */
asm (".short 0xf840" : "=r" (rval) : "r" (arg0), "r" (arg1));
return rval;
}
/* Makes sure hardware single-stepping is (globally) enabled.
Returns true if successful. */
static inline int enable_single_stepping (void)
{
static int enabled = 0; /* Remember whether we already did it. */
if (! enabled) {
/* Turn on the SE (`single-step enable') bit, 0x100, in the
DIR (`debug information register'). This may fail if a
processor doesn't support it or something. We also try
to clear bit 0x40 (`INI'), which is necessary to use the
debug stuff on the v850e2; on the v850e, clearing 0x40
shouldn't cause any problem. */
v850_reg_t dir = set_dir (0x100, 0x40);
/* Make sure it really got set. */
if (dir & 0x100)
enabled = 1;
}
return enabled;
}
/* Try to set CHILD's single-step flag to VAL. Returns true if successful. */
static int set_single_step (struct task_struct *t, int val)
{
v850_reg_t *psw_addr = reg_save_addr(PT_PSW, t);
if (val) {
/* Make sure single-stepping is enabled. */
if (! enable_single_stepping ())
return 0;
/* Set T's single-step flag. */
*psw_addr |= 0x800;
} else
*psw_addr &= ~0x800;
return 1;
}
int sys_ptrace(long request, long pid, long addr, long data)
{
struct task_struct *child;
......@@ -36,12 +119,6 @@ int sys_ptrace(long request, long pid, long addr, long data)
lock_kernel();
#if 0
printk("ptrace(r=%d,pid=%d,addr=%08lx,data=%08lx)\n",
(int) request, (int) pid, (unsigned long) addr,
(unsigned long) data);
#endif
if (request == PTRACE_TRACEME) {
/* are we already being traced? */
if (current->ptrace & PT_PTRACED) {
......@@ -81,31 +158,15 @@ int sys_ptrace(long request, long pid, long addr, long data)
goto out_tsk;
switch (request) {
case PTRACE_PEEKTEXT: /* read word at location addr. */
case PTRACE_PEEKDATA:{
unsigned long tmp;
int copied;
unsigned long val, copied;
copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0);
case PTRACE_PEEKTEXT: /* read word at location addr. */
case PTRACE_PEEKDATA:
copied = access_process_vm(child, addr, &val, sizeof(val), 0);
rval = -EIO;
if (copied != sizeof(tmp))
if (copied != sizeof(val))
break;
rval = put_user(tmp,(unsigned long *) data);
goto out;
}
/* Read the word at location addr in the USER area. */
case PTRACE_PEEKUSR:
if (addr >= 0 && addr < PT_SIZE && (addr & 0x3) == 0) {
struct pt_regs *regs = task_regs (child);
unsigned long val =
*(unsigned long *)((char *)regs + addr);
rval = put_user (val, (unsigned long *)data);
} else {
rval = 0;
rval = -EIO;
}
rval = put_user(val, (unsigned long *)data);
goto out;
case PTRACE_POKETEXT: /* write the word at location addr. */
......@@ -117,27 +178,54 @@ int sys_ptrace(long request, long pid, long addr, long data)
rval = -EIO;
goto out;
/* Read/write the word at location ADDR in the registers. */
case PTRACE_PEEKUSR:
case PTRACE_POKEUSR:
if (addr >= 0 && addr < PT_SIZE && (addr & 0x3) == 0) {
struct pt_regs *regs = task_regs (child);
unsigned long *loc =
(unsigned long *)((char *)regs + addr);
*loc = data;
} else {
rval = 0;
if (addr >= PT_SIZE && request == PTRACE_PEEKUSR) {
/* Special requests that don't actually correspond
to offsets in struct pt_regs. */
if (addr == PT_TEXT_ADDR)
val = child->mm->start_code;
else if (addr == PT_DATA_ADDR)
val = child->mm->start_data;
else if (addr == PT_TEXT_LEN)
val = child->mm->end_code
- child->mm->start_code;
else
rval = -EIO;
}
} else if (addr >= 0 && addr < PT_SIZE && (addr & 0x3) == 0) {
v850_reg_t *reg_addr = reg_save_addr(addr, child);
if (request == PTRACE_PEEKUSR)
val = *reg_addr;
else
*reg_addr = data;
} else
rval = -EIO;
if (rval == 0 && request == PTRACE_PEEKUSR)
rval = put_user (val, (unsigned long *)data);
goto out;
case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */
case PTRACE_CONT: /* rvaltart after signal. */
/* Continue and stop at next (return from) syscall */
case PTRACE_SYSCALL:
/* Restart after a signal. */
case PTRACE_CONT:
/* Execute a single instruction. */
case PTRACE_SINGLESTEP:
rval = -EIO;
if ((unsigned long) data > _NSIG)
break;
/* Turn CHILD's single-step flag on or off. */
if (! set_single_step (child, request == PTRACE_SINGLESTEP))
break;
if (request == PTRACE_SYSCALL)
set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
else
clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
child->exit_code = data;
wake_up_process(child);
rval = 0;
......@@ -157,6 +245,7 @@ int sys_ptrace(long request, long pid, long addr, long data)
break;
case PTRACE_DETACH: /* detach a process that was attached. */
set_single_step (child, 0); /* Clear single-step flag */
rval = ptrace_detach(child, data);
break;
......
/*
* include/asm-v850/rte_cb_leds.c -- Midas lab RTE-CB board LED device support
*
* Copyright (C) 2002 NEC Corporation
* Copyright (C) 2002 Miles Bader <miles@gnu.org>
* Copyright (C) 2002,03 NEC Electronics Corporation
* Copyright (C) 2002,03 Miles Bader <miles@gnu.org>
*
* This file is subject to the terms and conditions of the GNU General
* Public License. See the file COPYING in the main directory of this
......@@ -14,6 +14,7 @@
#include <linux/config.h>
#include <linux/init.h>
#include <linux/spinlock.h>
#include <linux/fs.h>
#include <linux/miscdevice.h>
#include <asm/uaccess.h>
......
......@@ -2,7 +2,7 @@
* include/asm-v850/rte_multi.c -- Support for Multi debugger monitor ROM
* on Midas lab RTE-CB series of evaluation boards
*
* Copyright (C) 2001,02,03 NEC Corporation
* Copyright (C) 2001,02,03 NEC Electronics Corporation
* Copyright (C) 2001,02,03 Miles Bader <miles@gnu.org>
*
* This file is subject to the terms and conditions of the GNU General
......
/*
* arch/v850/kernel/rte_ma1_cb.c -- Midas labs RTE-V850E/MA1-CB board
*
* Copyright (C) 2001,02,03 NEC Corporation
* Copyright (C) 2001,02,03 NEC Electronics Corporation
* Copyright (C) 2001,02,03 Miles Bader <miles@gnu.org>
*
* This file is subject to the terms and conditions of the GNU General
......
......@@ -105,9 +105,9 @@
#define RAMK_INIT_CONTENTS_NO_END \
. = ALIGN (4096) ; \
__init_start = . ; \
_sinittext = .; \
__sinittext = .; \
*(.init.text) /* 2.5 convention */ \
_einittext = .; \
__einittext = .; \
*(.init.data) \
*(.text.init) /* 2.4 convention */ \
*(.data.init) \
......
......@@ -124,7 +124,7 @@ void machine_restart(char * __unused)
{
int i;
#if CONFIG_SMP
#ifdef CONFIG_SMP
smp_halt();
#endif
......
......@@ -48,33 +48,33 @@ static inline u64 RORu64(u64 x, u64 y)
}
const u64 sha512_K[80] = {
0x428a2f98d728ae22, 0x7137449123ef65cd, 0xb5c0fbcfec4d3b2f,
0xe9b5dba58189dbbc, 0x3956c25bf348b538, 0x59f111f1b605d019,
0x923f82a4af194f9b, 0xab1c5ed5da6d8118, 0xd807aa98a3030242,
0x12835b0145706fbe, 0x243185be4ee4b28c, 0x550c7dc3d5ffb4e2,
0x72be5d74f27b896f, 0x80deb1fe3b1696b1, 0x9bdc06a725c71235,
0xc19bf174cf692694, 0xe49b69c19ef14ad2, 0xefbe4786384f25e3,
0x0fc19dc68b8cd5b5, 0x240ca1cc77ac9c65, 0x2de92c6f592b0275,
0x4a7484aa6ea6e483, 0x5cb0a9dcbd41fbd4, 0x76f988da831153b5,
0x983e5152ee66dfab, 0xa831c66d2db43210, 0xb00327c898fb213f,
0xbf597fc7beef0ee4, 0xc6e00bf33da88fc2, 0xd5a79147930aa725,
0x06ca6351e003826f, 0x142929670a0e6e70, 0x27b70a8546d22ffc,
0x2e1b21385c26c926, 0x4d2c6dfc5ac42aed, 0x53380d139d95b3df,
0x650a73548baf63de, 0x766a0abb3c77b2a8, 0x81c2c92e47edaee6,
0x92722c851482353b, 0xa2bfe8a14cf10364, 0xa81a664bbc423001,
0xc24b8b70d0f89791, 0xc76c51a30654be30, 0xd192e819d6ef5218,
0xd69906245565a910, 0xf40e35855771202a, 0x106aa07032bbd1b8,
0x19a4c116b8d2d0c8, 0x1e376c085141ab53, 0x2748774cdf8eeb99,
0x34b0bcb5e19b48a8, 0x391c0cb3c5c95a63, 0x4ed8aa4ae3418acb,
0x5b9cca4f7763e373, 0x682e6ff3d6b2b8a3, 0x748f82ee5defb2fc,
0x78a5636f43172f60, 0x84c87814a1f0ab72, 0x8cc702081a6439ec,
0x90befffa23631e28, 0xa4506cebde82bde9, 0xbef9a3f7b2c67915,
0xc67178f2e372532b, 0xca273eceea26619c, 0xd186b8c721c0c207,
0xeada7dd6cde0eb1e, 0xf57d4f7fee6ed178, 0x06f067aa72176fba,
0x0a637dc5a2c898a6, 0x113f9804bef90dae, 0x1b710b35131c471b,
0x28db77f523047d84, 0x32caab7b40c72493, 0x3c9ebe0a15c9bebc,
0x431d67c49c100d4c, 0x4cc5d4becb3e42b6, 0x597f299cfc657e2a,
0x5fcb6fab3ad6faec, 0x6c44198c4a475817,
0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL, 0xb5c0fbcfec4d3b2fULL,
0xe9b5dba58189dbbcULL, 0x3956c25bf348b538ULL, 0x59f111f1b605d019ULL,
0x923f82a4af194f9bULL, 0xab1c5ed5da6d8118ULL, 0xd807aa98a3030242ULL,
0x12835b0145706fbeULL, 0x243185be4ee4b28cULL, 0x550c7dc3d5ffb4e2ULL,
0x72be5d74f27b896fULL, 0x80deb1fe3b1696b1ULL, 0x9bdc06a725c71235ULL,
0xc19bf174cf692694ULL, 0xe49b69c19ef14ad2ULL, 0xefbe4786384f25e3ULL,
0x0fc19dc68b8cd5b5ULL, 0x240ca1cc77ac9c65ULL, 0x2de92c6f592b0275ULL,
0x4a7484aa6ea6e483ULL, 0x5cb0a9dcbd41fbd4ULL, 0x76f988da831153b5ULL,
0x983e5152ee66dfabULL, 0xa831c66d2db43210ULL, 0xb00327c898fb213fULL,
0xbf597fc7beef0ee4ULL, 0xc6e00bf33da88fc2ULL, 0xd5a79147930aa725ULL,
0x06ca6351e003826fULL, 0x142929670a0e6e70ULL, 0x27b70a8546d22ffcULL,
0x2e1b21385c26c926ULL, 0x4d2c6dfc5ac42aedULL, 0x53380d139d95b3dfULL,
0x650a73548baf63deULL, 0x766a0abb3c77b2a8ULL, 0x81c2c92e47edaee6ULL,
0x92722c851482353bULL, 0xa2bfe8a14cf10364ULL, 0xa81a664bbc423001ULL,
0xc24b8b70d0f89791ULL, 0xc76c51a30654be30ULL, 0xd192e819d6ef5218ULL,
0xd69906245565a910ULL, 0xf40e35855771202aULL, 0x106aa07032bbd1b8ULL,
0x19a4c116b8d2d0c8ULL, 0x1e376c085141ab53ULL, 0x2748774cdf8eeb99ULL,
0x34b0bcb5e19b48a8ULL, 0x391c0cb3c5c95a63ULL, 0x4ed8aa4ae3418acbULL,
0x5b9cca4f7763e373ULL, 0x682e6ff3d6b2b8a3ULL, 0x748f82ee5defb2fcULL,
0x78a5636f43172f60ULL, 0x84c87814a1f0ab72ULL, 0x8cc702081a6439ecULL,
0x90befffa23631e28ULL, 0xa4506cebde82bde9ULL, 0xbef9a3f7b2c67915ULL,
0xc67178f2e372532bULL, 0xca273eceea26619cULL, 0xd186b8c721c0c207ULL,
0xeada7dd6cde0eb1eULL, 0xf57d4f7fee6ed178ULL, 0x06f067aa72176fbaULL,
0x0a637dc5a2c898a6ULL, 0x113f9804bef90daeULL, 0x1b710b35131c471bULL,
0x28db77f523047d84ULL, 0x32caab7b40c72493ULL, 0x3c9ebe0a15c9bebcULL,
0x431d67c49c100d4cULL, 0x4cc5d4becb3e42b6ULL, 0x597f299cfc657e2aULL,
0x5fcb6fab3ad6faecULL, 0x6c44198c4a475817ULL,
};
#define e0(x) (RORu64(x,28) ^ RORu64(x,34) ^ RORu64(x,39))
......@@ -83,24 +83,24 @@ const u64 sha512_K[80] = {
#define s1(x) (RORu64(x,19) ^ RORu64(x,61) ^ (x >> 6))
/* H* initial state for SHA-512 */
#define H0 0x6a09e667f3bcc908
#define H1 0xbb67ae8584caa73b
#define H2 0x3c6ef372fe94f82b
#define H3 0xa54ff53a5f1d36f1
#define H4 0x510e527fade682d1
#define H5 0x9b05688c2b3e6c1f
#define H6 0x1f83d9abfb41bd6b
#define H7 0x5be0cd19137e2179
#define H0 0x6a09e667f3bcc908ULL
#define H1 0xbb67ae8584caa73bULL
#define H2 0x3c6ef372fe94f82bULL
#define H3 0xa54ff53a5f1d36f1ULL
#define H4 0x510e527fade682d1ULL
#define H5 0x9b05688c2b3e6c1fULL
#define H6 0x1f83d9abfb41bd6bULL
#define H7 0x5be0cd19137e2179ULL
/* H'* initial state for SHA-384 */
#define HP0 0xcbbb9d5dc1059ed8
#define HP1 0x629a292a367cd507
#define HP2 0x9159015a3070dd17
#define HP3 0x152fecd8f70e5939
#define HP4 0x67332667ffc00b31
#define HP5 0x8eb44a8768581511
#define HP6 0xdb0c2e0d64f98fa7
#define HP7 0x47b5481dbefa4fa4
#define HP0 0xcbbb9d5dc1059ed8ULL
#define HP1 0x629a292a367cd507ULL
#define HP2 0x9159015a3070dd17ULL
#define HP3 0x152fecd8f70e5939ULL
#define HP4 0x67332667ffc00b31ULL
#define HP5 0x8eb44a8768581511ULL
#define HP6 0xdb0c2e0d64f98fa7ULL
#define HP7 0x47b5481dbefa4fa4ULL
static inline void LOAD_OP(int I, u64 *W, const u8 *input)
{
......
......@@ -2,22 +2,6 @@
# Makefile for the acorn character device drivers.
#
obj-arc := keyb_arc.o defkeymap-acorn.o
obj-$(CONFIG_ARCH_ACORN) += i2c.o pcf8583.o
obj-$(CONFIG_L7200_KEYB) += defkeymap-l7200.o keyb_l7200.o
obj-y += $(obj-$(MACHINE))
$(obj)/defkeymap-acorn.o: $(obj)/defkeymap-acorn.c
# Uncomment if you're changing the keymap and have an appropriate
# loadkeys version for the map. By default, we'll use the shipped
# versions.
# GENERATE_KEYMAP := 1
ifdef GENERATE_KEYMAP
$(obj)/defkeymap-acorn.c: $(obj)/%.c: $(src)/%.map
loadkeys --mktable $< > $@
endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* Driver for PS/2 mouse on IOMD interface
*/
#include <linux/sched.h>
#include <linux/interrupt.h>
#include <linux/tty.h>
#include <linux/tty_flip.h>
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/ptrace.h>
#include <linux/signal.h>
#include <linux/timer.h>
#include <linux/random.h>
#include <linux/ctype.h>
#include <linux/kbd_ll.h>
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/poll.h>
#include <linux/miscdevice.h>
#include <asm/bitops.h>
#include <asm/irq.h>
#include <asm/hardware.h>
#include <asm/io.h>
#include <asm/hardware/iomd.h>
#include <asm/system.h>
#include <asm/uaccess.h>
/*
* PS/2 Auxiliary Device
*/
static struct aux_queue *queue; /* Mouse data buffer. */
static int aux_count = 0;
/* used when we send commands to the mouse that expect an ACK. */
static unsigned char mouse_reply_expected = 0;
#define MAX_RETRIES 60 /* some aux operations take long time*/
/*
* Mouse Commands
*/
#define AUX_SET_RES 0xE8 /* Set resolution */
#define AUX_SET_SCALE11 0xE6 /* Set 1:1 scaling */
#define AUX_SET_SCALE21 0xE7 /* Set 2:1 scaling */
#define AUX_GET_SCALE 0xE9 /* Get scaling factor */
#define AUX_SET_STREAM 0xEA /* Set stream mode */
#define AUX_SET_SAMPLE 0xF3 /* Set sample rate */
#define AUX_ENABLE_DEV 0xF4 /* Enable aux device */
#define AUX_DISABLE_DEV 0xF5 /* Disable aux device */
#define AUX_RESET 0xFF /* Reset aux device */
#define AUX_ACK 0xFA /* Command byte ACK. */
#define AUX_BUF_SIZE 2048 /* This might be better divisible by
three to make overruns stay in sync
but then the read function would
need a lock etc - ick */
struct aux_queue {
unsigned long head;
unsigned long tail;
wait_queue_head_t proc_list;
struct fasync_struct *fasync;
unsigned char buf[AUX_BUF_SIZE];
};
/*
* Send a byte to the mouse.
*/
static void aux_write_dev(int val)
{
while (!(iomd_readb(IOMD_MSECTL) & 0x80));
iomd_writeb(val, IOMD_MSEDAT);
}
/*
* Send a byte to the mouse & handle returned ack
*/
static void aux_write_ack(int val)
{
while (!(iomd_readb(IOMD_MSECTL) & 0x80));
iomd_writeb(val, IOMD_MSEDAT);
/* we expect an ACK in response. */
mouse_reply_expected++;
}
static unsigned char get_from_queue(void)
{
unsigned char result;
result = queue->buf[queue->tail];
queue->tail = (queue->tail + 1) & (AUX_BUF_SIZE-1);
return result;
}
static void psaux_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
int val = iomd_readb(IOMD_MSEDAT);
if (mouse_reply_expected) {
if (val == AUX_ACK) {
mouse_reply_expected--;
return;
}
mouse_reply_expected = 0;
}
add_mouse_randomness(val);
if (aux_count) {
int head = queue->head;
queue->buf[head] = val;
head = (head + 1) & (AUX_BUF_SIZE-1);
if (head != queue->tail) {
queue->head = head;
kill_fasync(&queue->fasync, SIGIO, POLL_IN);
wake_up_interruptible(&queue->proc_list);
}
}
}
static inline int queue_empty(void)
{
return queue->head == queue->tail;
}
static int fasync_aux(int fd, struct file *filp, int on)
{
int retval;
retval = fasync_helper(fd, filp, on, &queue->fasync);
if (retval < 0)
return retval;
return 0;
}
/*
* Random magic cookie for the aux device
*/
#define AUX_DEV ((void *)queue)
static int release_aux(struct inode * inode, struct file * file)
{
fasync_aux(-1, file, 0);
if (--aux_count)
return 0;
free_irq(IRQ_MOUSERX, AUX_DEV);
return 0;
}
/*
* Install interrupt handler.
* Enable auxiliary device.
*/
static int open_aux(struct inode * inode, struct file * file)
{
if (aux_count++)
return 0;
queue->head = queue->tail = 0; /* Flush input queue */
if (request_irq(IRQ_MOUSERX, psaux_interrupt, SA_SHIRQ, "ps/2 mouse",
AUX_DEV)) {
aux_count--;
return -EBUSY;
}
aux_write_ack(AUX_ENABLE_DEV); /* Enable aux device */
return 0;
}
/*
* Put bytes from input queue to buffer.
*/
static ssize_t read_aux(struct file * file, char * buffer,
size_t count, loff_t *ppos)
{
DECLARE_WAITQUEUE(wait, current);
ssize_t i = count;
unsigned char c;
if (queue_empty()) {
if (file->f_flags & O_NONBLOCK)
return -EAGAIN;
add_wait_queue(&queue->proc_list, &wait);
repeat:
current->state = TASK_INTERRUPTIBLE;
if (queue_empty() && !signal_pending(current)) {
schedule();
goto repeat;
}
current->state = TASK_RUNNING;
remove_wait_queue(&queue->proc_list, &wait);
}
while (i > 0 && !queue_empty()) {
c = get_from_queue();
put_user(c, buffer++);
i--;
}
if (count-i) {
file->f_dentry->d_inode->i_atime = CURRENT_TIME;
return count-i;
}
if (signal_pending(current))
return -ERESTARTSYS;
return 0;
}
/*
* Write to the aux device.
*/
static ssize_t write_aux(struct file * file, const char * buffer,
size_t count, loff_t *ppos)
{
ssize_t retval = 0;
if (count) {
ssize_t written = 0;
if (count > 32)
count = 32; /* Limit to 32 bytes. */
do {
char c;
get_user(c, buffer++);
aux_write_dev(c);
written++;
} while (--count);
retval = -EIO;
if (written) {
retval = written;
file->f_dentry->d_inode->i_mtime = CURRENT_TIME;
}
}
return retval;
}
static unsigned int aux_poll(struct file *file, poll_table * wait)
{
poll_wait(file, &queue->proc_list, wait);
if (!queue_empty())
return POLLIN | POLLRDNORM;
return 0;
}
struct file_operations psaux_fops = {
.read = read_aux,
.write = write_aux,
.poll = aux_poll,
.open = open_aux,
.release = release_aux,
.fasync = fasync_aux,
};
/*
* Initialize driver.
*/
static struct miscdevice psaux_mouse = {
PSMOUSE_MINOR, "psaux", &psaux_fops
};
int __init psaux_init(void)
{
/* Reset the mouse state machine. */
iomd_writeb(0, IOMD_MSECTL);
iomd_writeb(8, IOMD_MSECTL);
queue = (struct aux_queue *) kmalloc(sizeof(*queue), GFP_KERNEL);
if (queue == NULL)
return -ENOMEM;
if (misc_register(&psaux_mouse)) {
kfree(queue);
return -ENODEV;
}
memset(queue, 0, sizeof(*queue));
queue->head = queue->tail = 0;
init_waitqueue_head(&queue->proc_list);
aux_write_ack(AUX_SET_SAMPLE);
aux_write_ack(100); /* 100 samples/sec */
aux_write_ack(AUX_SET_RES);
aux_write_ack(3); /* 8 counts per mm */
aux_write_ack(AUX_SET_SCALE21); /* 2:1 scaling */
return 0;
}
......@@ -413,11 +413,12 @@ struct request *blk_queue_find_tag(request_queue_t *q, int tag)
{
struct blk_queue_tag *bqt = q->queue_tags;
if (unlikely(bqt == NULL || bqt->max_depth < tag))
if (unlikely(bqt == NULL || tag >= bqt->real_max_depth))
return NULL;
return bqt->tag_index[tag];
}
/**
* blk_queue_free_tags - release tag maintenance info
* @q: the request queue for the device
......@@ -448,39 +449,28 @@ void blk_queue_free_tags(request_queue_t *q)
q->queue_flags &= ~(1 << QUEUE_FLAG_QUEUED);
}
/**
* blk_queue_init_tags - initialize the queue tag info
* @q: the request queue for the device
* @depth: the maximum queue depth supported
**/
int blk_queue_init_tags(request_queue_t *q, int depth)
static int init_tag_map(struct blk_queue_tag *tags, int depth)
{
struct blk_queue_tag *tags;
int bits, i;
if (depth > (queue_nr_requests*2)) {
depth = (queue_nr_requests*2);
printk("blk_queue_init_tags: adjusted depth to %d\n", depth);
printk(KERN_ERR "%s: adjusted depth to %d\n", __FUNCTION__, depth);
}
tags = kmalloc(sizeof(struct blk_queue_tag),GFP_ATOMIC);
if (!tags)
goto fail;
tags->tag_index = kmalloc(depth * sizeof(struct request *), GFP_ATOMIC);
if (!tags->tag_index)
goto fail_index;
goto fail;
bits = (depth / BLK_TAGS_PER_LONG) + 1;
tags->tag_map = kmalloc(bits * sizeof(unsigned long), GFP_ATOMIC);
if (!tags->tag_map)
goto fail_map;
goto fail;
memset(tags->tag_index, 0, depth * sizeof(struct request *));
memset(tags->tag_map, 0, bits * sizeof(unsigned long));
INIT_LIST_HEAD(&tags->busy_list);
tags->busy = 0;
tags->max_depth = depth;
tags->real_max_depth = bits * BITS_PER_LONG;
/*
* set the upper bits if the depth isn't a multiple of the word size
......@@ -488,19 +478,86 @@ int blk_queue_init_tags(request_queue_t *q, int depth)
for (i = depth; i < bits * BLK_TAGS_PER_LONG; i++)
__set_bit(i, tags->tag_map);
return 0;
fail:
kfree(tags->tag_index);
return -ENOMEM;
}
/**
* blk_queue_init_tags - initialize the queue tag info
* @q: the request queue for the device
* @depth: the maximum queue depth supported
**/
int blk_queue_init_tags(request_queue_t *q, int depth)
{
struct blk_queue_tag *tags;
tags = kmalloc(sizeof(struct blk_queue_tag),GFP_ATOMIC);
if (!tags)
goto fail;
if (init_tag_map(tags, depth))
goto fail;
INIT_LIST_HEAD(&tags->busy_list);
tags->busy = 0;
/*
* assign it, all done
*/
q->queue_tags = tags;
q->queue_flags |= (1 << QUEUE_FLAG_QUEUED);
return 0;
fail_map:
kfree(tags->tag_index);
fail_index:
kfree(tags);
fail:
kfree(tags);
return -ENOMEM;
}
/**
* blk_queue_resize_tags - change the queueing depth
* @q: the request queue for the device
* @new_depth: the new max command queueing depth
*
* Notes:
* Must be called with the queue lock held.
**/
int blk_queue_resize_tags(request_queue_t *q, int new_depth)
{
struct blk_queue_tag *bqt = q->queue_tags;
struct request **tag_index;
unsigned long *tag_map;
int bits, max_depth;
if (!bqt)
return -ENXIO;
/*
* don't bother sizing down
*/
if (new_depth <= bqt->real_max_depth) {
bqt->max_depth = new_depth;
return 0;
}
/*
* save the old state info, so we can copy it back
*/
tag_index = bqt->tag_index;
tag_map = bqt->tag_map;
max_depth = bqt->real_max_depth;
if (init_tag_map(bqt, new_depth))
return -ENOMEM;
memcpy(bqt->tag_index, tag_index, max_depth * sizeof(struct request *));
bits = max_depth / BLK_TAGS_PER_LONG;
memcpy(bqt->tag_map, bqt->tag_map, bits * sizeof(unsigned long));
kfree(tag_index);
kfree(tag_map);
return 0;
}
/**
......@@ -524,7 +581,7 @@ void blk_queue_end_tag(request_queue_t *q, struct request *rq)
BUG_ON(tag == -1);
if (unlikely(tag >= bqt->max_depth))
if (unlikely(tag >= bqt->real_max_depth))
return;
if (unlikely(!__test_and_clear_bit(tag, bqt->tag_map))) {
......
......@@ -3131,9 +3131,18 @@ void mgslpc_remove_device(MGSLPC_INFO *remove_info)
}
}
static struct pcmcia_driver mgslpc_driver = {
.owner = THIS_MODULE,
.drv = {
.name = "synclink_cs",
},
.attach = mgslpc_attach,
.detach = mgslpc_detach,
};
static int __init synclink_cs_init(void)
{
servinfo_t serv;
int error;
if (break_on_load) {
mgslpc_get_text_ptr();
......@@ -3142,13 +3151,9 @@ static int __init synclink_cs_init(void)
printk("%s %s\n", driver_name, driver_version);
CardServices(GetCardServicesInfo, &serv);
if (serv.Revision != CS_RELEASE_CODE) {
printk(KERN_NOTICE "synclink_cs: Card Services release "
"does not match!\n");
return -1;
}
register_pccard_driver(&dev_info, &mgslpc_attach, &mgslpc_detach);
error = pcmcia_register_driver(&mgslpc_driver);
if (error)
return error;
/* Initialize the tty_driver structure */
......@@ -3217,7 +3222,9 @@ static void __exit synclink_cs_exit(void)
printk("%s(%d) failed to unregister tty driver err=%d\n",
__FILE__,__LINE__,rc);
unregister_pccard_driver(&dev_info);
pcmcia_unregister_driver(&mgslpc_driver);
/* XXX: this really needs to move into generic code.. */
while (dev_list != NULL) {
if (dev_list->state & DEV_CONFIG)
mgslpc_release((u_long)dev_list);
......
......@@ -2993,12 +2993,6 @@ static int ide_cdrom_prep_fs(request_queue_t *q, struct request *rq)
long block = (long)rq->hard_sector / (hard_sect >> 9);
unsigned long blocks = rq->hard_nr_sectors / (hard_sect >> 9);
BUG_ON(sizeof(rq->hard_sector) > 4 && (rq->hard_sector >> 32));
if (rq->hard_nr_sectors != rq->nr_sectors) {
printk(KERN_ERR "ide-cd: hard_nr_sectors differs from nr_sectors! %lu %lu\n",
rq->nr_sectors, rq->hard_nr_sectors);
}
memset(rq->cmd, 0, sizeof(rq->cmd));
if (rq_data_dir(rq) == READ)
......
......@@ -470,26 +470,23 @@ int ide_event(event_t event, int priority,
return 0;
} /* ide_event */
/*====================================================================*/
static struct pcmcia_driver ide_cs_driver = {
.owner = THIS_MODULE,
.drv = {
.name = "ide_cs",
},
.attach = ide_attach,
.detach = ide_detach,
};
static int __init init_ide_cs(void)
{
servinfo_t serv;
DEBUG(0, "%s\n", version);
CardServices(GetCardServicesInfo, &serv);
if (serv.Revision != CS_RELEASE_CODE) {
printk(KERN_NOTICE "ide-cs: Card Services release "
"does not match!\n");
return -EINVAL;
}
register_pccard_driver(&dev_info, &ide_attach, &ide_detach);
return 0;
return pcmcia_register_driver(&ide_cs_driver);
}
static void __exit exit_ide_cs(void)
{
DEBUG(0, "ide-cs: unloading\n");
unregister_pccard_driver(&dev_info);
pcmcia_unregister_driver(&ide_cs_driver);
while (dev_list != NULL)
ide_detach(dev_list);
}
......
......@@ -510,24 +510,25 @@ static int avmcs_event(event_t event, int priority,
return 0;
} /* avmcs_event */
/*====================================================================*/
static struct pcmcia_driver avmcs_driver = {
.owner = THIS_MODULE,
.drv = {
.name = "avmcs_cs",
},
.attach = avmcs_attach,
.detach = avmcs_detach,
};
static int __init avmcs_init(void)
{
servinfo_t serv;
CardServices(GetCardServicesInfo, &serv);
if (serv.Revision != CS_RELEASE_CODE) {
printk(KERN_NOTICE "avm_cs: Card Services release "
"does not match!\n");
return -1;
}
register_pccard_driver(&dev_info, &avmcs_attach, &avmcs_detach);
return 0;
return pcmcia_register_driver(&avmcs_driver);
}
static void __exit avmcs_exit(void)
{
unregister_pccard_driver(&dev_info);
pcmcia_unregister_driver(&avmcs_driver);
/* XXX: this really needs to move into generic code.. */
while (dev_list != NULL) {
if (dev_list->state & DEV_CONFIG)
avmcs_release((u_long)dev_list);
......
......@@ -515,30 +515,30 @@ static int avma1cs_event(event_t event, int priority,
return 0;
} /* avma1cs_event */
/*====================================================================*/
static struct pcmcia_driver avma1cs_driver = {
.owner = THIS_MODULE,
.drv = {
.name = "avma1_cs",
},
.attach = avma1cs_attach,
.detach = avma1cs_detach,
};
static int __init init_avma1_cs(void)
{
servinfo_t serv;
DEBUG(0, "%s\n", version);
CardServices(GetCardServicesInfo, &serv);
if (serv.Revision != CS_RELEASE_CODE) {
printk(KERN_NOTICE "avma1_cs: Card Services release "
"does not match!\n");
return -1;
}
register_pccard_driver(&dev_info, &avma1cs_attach, &avma1cs_detach);
return 0;
return pcmcia_register_driver(&avma1cs_driver);
}
static void __exit exit_avma1_cs(void)
{
DEBUG(0, "avma1_cs: unloading\n");
unregister_pccard_driver(&dev_info);
while (dev_list != NULL)
pcmcia_unregister_driver(&avma1cs_driver);
/* XXX: this really needs to move into generic code.. */
while (dev_list != NULL) {
if (dev_list->state & DEV_CONFIG)
avma1cs_release((u_long)dev_list);
avma1cs_detach(dev_list);
}
}
module_init(init_avma1_cs);
......
......@@ -531,26 +531,25 @@ static int elsa_cs_event(event_t event, int priority,
return 0;
} /* elsa_cs_event */
/*====================================================================*/
static struct pcmcia_driver elsa_cs_driver = {
.owner = THIS_MODULE,
.drv = {
.name = "elsa_cs",
},
.attach = elsa_cs_attach,
.detach = elsa_cs_detach,
};
static int __init init_elsa_cs(void)
{
servinfo_t serv;
DEBUG(0, "%s\n", version);
CardServices(GetCardServicesInfo, &serv);
if (serv.Revision != CS_RELEASE_CODE) {
printk(KERN_NOTICE "elsa_cs: Card Services release "
"does not match!\n");
return -1;
}
register_pccard_driver(&dev_info, &elsa_cs_attach, &elsa_cs_detach);
return 0;
return pcmcia_register_driver(&elsa_cs_driver);
}
static void __exit exit_elsa_cs(void)
{
DEBUG(0, "elsa_cs: unloading\n");
unregister_pccard_driver(&dev_info);
pcmcia_unregister_driver(&elsa_cs_driver);
/* XXX: this really needs to move into generic code.. */
while (dev_list != NULL)
elsa_cs_detach(dev_list);
}
......
......@@ -633,26 +633,25 @@ static int sedlbauer_event(event_t event, int priority,
return 0;
} /* sedlbauer_event */
/*====================================================================*/
static struct pcmcia_driver sedlbauer_driver = {
.owner = THIS_MODULE,
.drv = {
.name = "sedlbauer_cs",
},
.attach = sedlbauer_attach,
.detach = sedlbauer_detach,
};
static int __init init_sedlbauer_cs(void)
{
servinfo_t serv;
DEBUG(0, "%s\n", version);
CardServices(GetCardServicesInfo, &serv);
if (serv.Revision != CS_RELEASE_CODE) {
printk(KERN_NOTICE "sedlbauer_cs: Card Services release "
"does not match!\n");
return -1;
}
register_pccard_driver(&dev_info, &sedlbauer_attach, &sedlbauer_detach);
return 0;
return pcmcia_register_driver(&sedlbauer_driver);
}
static void __exit exit_sedlbauer_cs(void)
{
DEBUG(0, "sedlbauer_cs: unloading\n");
unregister_pccard_driver(&dev_info);
pcmcia_unregister_driver(&sedlbauer_driver);
/* XXX: this really needs to move into generic code.. */
while (dev_list != NULL) {
del_timer(&dev_list->release);
if (dev_list->state & DEV_CONFIG)
......@@ -663,4 +662,3 @@ static void __exit exit_sedlbauer_cs(void)
module_init(init_sedlbauer_cs);
module_exit(exit_sedlbauer_cs);
# $Id: Config.in,v 1.74 2002/04/23 13:52:14 mag Exp $
# $Id: Kconfig,v 1.3 2003/05/28 11:02:23 dwmw2 Exp $
menu "Memory Technology Devices (MTD)"
......@@ -199,13 +199,28 @@ config NFTL
not use it.
config NFTL_RW
bool "Write support for NFTL (BETA)"
bool "Write support for NFTL"
depends on NFTL
help
If you're lucky, this will actually work. Don't whinge if it
doesn't. Send mail to the MTD mailing list
<linux-mtd@lists.infradead.org> if you want to help to make it more
reliable.
Support for writing to the NAND Flash Translation Layer, as used
on the DiskOnChip.
config INFTL
tristate "INFTL (Inverse NAND Flash Translation Layer) support"
depends on MTD
---help---
This provides support for the Inverse NAND Flash Translation
Layer which is used on M-Systems' newer DiskOnChip devices. It
uses a kind of pseudo-file system on a flash device to emulate
a block device with 512-byte sectors, on top of which you put
a 'normal' file system.
You may find that the algorithms used in this code are patented
unless you live in the Free World where software patents aren't
legal - in the USA you are only permitted to use this on DiskOnChip
hardware, although under the terms of the GPL you're obviously
permitted to copy, modify and distribute the code as you wish. Just
not use it.
source "drivers/mtd/chips/Kconfig"
......
#
# Makefile for the memory technology device drivers.
#
# Based on:
# $Id: Makefile,v 1.66 2002/04/23 13:52:14 mag Exp $
obj-y += chips/ maps/ devices/ nand/
# $Id: Makefile.common,v 1.2 2003/05/23 11:38:29 dwmw2 Exp $
# *** BIG UGLY NOTE ***
#
......@@ -27,14 +24,18 @@ obj-$(CONFIG_MTD) += mtdcore.o
obj-$(CONFIG_MTD_CONCAT) += mtdconcat.o
obj-$(CONFIG_MTD_PARTITIONS) += mtdpart.o
obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o
obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdline.o
obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdlinepart.o
obj-$(CONFIG_MTD_AFS_PARTS) += afs.o
# 'Users' - code which presents functionality to userspace.
obj-$(CONFIG_MTD_CHAR) += mtdchar.o
obj-$(CONFIG_MTD_BLOCK) += mtdblock.o
obj-$(CONFIG_MTD_BLOCK_RO) += mtdblock_ro.o
obj-$(CONFIG_FTL) += ftl.o
obj-$(CONFIG_NFTL) += nftl.o
obj-$(CONFIG_MTD_BLOCK) += mtdblock.o mtd_blkdevs.o
obj-$(CONFIG_MTD_BLOCK_RO) += mtdblock_ro.o mtd_blkdevs.o
obj-$(CONFIG_FTL) += ftl.o mtd_blkdevs.o
obj-$(CONFIG_NFTL) += nftl.o mtd_blkdevs.o
obj-$(CONFIG_INFTL) += inftl.o mtd_blkdevs.o
nftl-objs := nftlcore.o nftlmount.o
inftl-objs := inftlcore.o inftlmount.o
obj-y += chips/ maps/ devices/ nand/
......@@ -21,7 +21,7 @@
This is access code for flashes using ARM's flash partitioning
standards.
$Id: afs.c,v 1.8 2002/05/04 08:49:09 rmk Exp $
$Id: afs.c,v 1.11 2003/05/16 17:08:24 dwmw2 Exp $
======================================================================*/
......@@ -125,7 +125,9 @@ afs_read_iis(struct mtd_info *mtd, struct image_info_struct *iis, u_int ptr)
return ret;
}
int parse_afs_partitions(struct mtd_info *mtd, struct mtd_partition **pparts)
static int parse_afs_partitions(struct mtd_info *mtd,
struct mtd_partition **pparts,
unsigned long origin)
{
struct mtd_partition *parts;
u_int mask, off, idx, sz;
......@@ -227,7 +229,25 @@ int parse_afs_partitions(struct mtd_info *mtd, struct mtd_partition **pparts)
return idx ? idx : ret;
}
EXPORT_SYMBOL(parse_afs_partitions);
static struct mtd_part_parser afs_parser = {
.owner = THIS_MODULE,
.parse_fn = parse_afs_partitions,
.name = "afs",
};
static int __init afs_parser_init(void)
{
return register_mtd_parser(&afs_parser);
}
static void __exit afs_parser_exit(void)
{
deregister_mtd_parser(&afs_parser);
}
module_init(afs_parser_init);
module_exit(afs_parser_exit);
MODULE_AUTHOR("ARM Ltd");
MODULE_DESCRIPTION("ARM Firmware Suite partition parser");
......
# drivers/mtd/chips/Config.in
# $Id: Config.in,v 1.12 2001/09/23 15:35:21 dwmw2 Exp $
# drivers/mtd/chips/Kconfig
# $Id: Kconfig,v 1.3 2003/05/28 15:13:24 dwmw2 Exp $
menu "RAM/ROM/Flash chip drivers"
depends on MTD!=n
......@@ -15,7 +15,6 @@ config MTD_CFI
option. Visit <http://www.amd.com/products/nvd/overview/cfi.html>
for more information on CFI.
#dep_tristate ' Detect non-CFI Intel-compatible flash chips' CONFIG_MTD_INTELPROBE $CONFIG_MTD
config MTD_JEDECPROBE
tristate "Detect non-CFI AMD/JEDEC-compatible flash chips"
depends on MTD
......@@ -107,6 +106,13 @@ config MTD_CFI_B4
If you wish to support CFI devices on a physical bus which is
32 bits wide, say 'Y'.
config MTD_CFI_B8
bool "Support 64-bit buswidth"
depends on MTD_CFI_GEOMETRY
help
If you wish to support CFI devices on a physical bus which is
64 bits wide, say 'Y'.
config MTD_CFI_I1
bool "Support 1-chip flash interleave" if !MTD_CFI_B1
depends on MTD_CFI_GEOMETRY
......@@ -129,6 +135,13 @@ config MTD_CFI_I4
If your flash chips are interleaved in fours - i.e. you have four
flash chips addressed by each bus cycle, then say 'Y'.
config MTD_CFI_I8
bool "Support 8-chip flash interleave"
depends on MTD_CFI_GEOMETRY
help
If your flash chips are interleaved in eights - i.e. you have eight
flash chips addressed by each bus cycle, then say 'Y'.
config MTD_CFI_INTELEXT
tristate "Support for Intel/Sharp flash chips"
depends on MTD_GEN_PROBE
......@@ -145,7 +158,15 @@ config MTD_CFI_AMDSTD
The Common Flash Interface defines a number of different command
sets which a CFI-compliant chip may claim to implement. This code
provides support for one of those command sets, used on chips
chips including the AMD Am29LV320.
including the AMD Am29LV320.
config MTD_CFI_STAA
tristate "Support for ST (Advanced Architecture) flash chips"
depends on MTD_GEN_PROBE
help
The Common Flash Interface defines a number of different command
sets which a CFI-compliant chip may claim to implement. This code
provides support for one of those command sets.
config MTD_RAM
tristate "Support for RAM chips in bus mapping"
......@@ -177,10 +198,10 @@ config MTD_OBSOLETE_CHIPS
help
This option does not enable any code directly, but will allow you to
select some other chip drivers which are now considered obsolete,
because the generic CONFIG_JEDEC_PROBE code above should now detect
because the generic CONFIG_JEDECPROBE code above should now detect
the chips which are supported by these drivers, and allow the generic
CFI-compatible drivers to drive the chips. Say 'N' here unless you have
already tried the CONFIG_JEDEC_PROBE method and reported its failure
already tried the CONFIG_JEDECPROBE method and reported its failure
to the MTD mailing list at <linux-mtd@lists.infradead.org>
config MTD_AMDSTD
......@@ -209,8 +230,7 @@ config MTD_JEDEC
programming flash. It is commonly used in older AMD chips. It is
only called JEDEC because the JEDEC association
<http://www.jedec.org/> distributes the identification codes for the
chips. WARNING!!!! This code does not compile and is incomplete as
are the specific JEDEC devices drivers.
chips.
endmenu
#
# linux/drivers/chips/Makefile
#
# $Id: Makefile,v 1.7 2001/10/05 06:53:51 dwmw2 Exp $
# $Id: Makefile.common,v 1.1 2003/05/21 15:00:01 dwmw2 Exp $
# *** BIG UGLY NOTE ***
#
......@@ -13,10 +13,10 @@
obj-$(CONFIG_MTD) += chipreg.o
obj-$(CONFIG_MTD_AMDSTD) += amd_flash.o
obj-$(CONFIG_MTD_CFI) += cfi_probe.o
obj-$(CONFIG_MTD_CFI_STAA) += cfi_cmdset_0020.o
obj-$(CONFIG_MTD_CFI_AMDSTD) += cfi_cmdset_0002.o
obj-$(CONFIG_MTD_CFI_INTELEXT) += cfi_cmdset_0001.o
obj-$(CONFIG_MTD_GEN_PROBE) += gen_probe.o
obj-$(CONFIG_MTD_INTELPROBE) += intel_probe.o
obj-$(CONFIG_MTD_JEDEC) += jedec.o
obj-$(CONFIG_MTD_JEDECPROBE) += jedec_probe.o
obj-$(CONFIG_MTD_RAM) += map_ram.o
......
......@@ -3,7 +3,7 @@
*
* Author: Jonas Holmberg <jonas.holmberg@axis.com>
*
* $Id: amd_flash.c,v 1.15 2001/10/02 15:05:11 dwmw2 Exp $
* $Id: amd_flash.c,v 1.22 2003/05/28 13:47:19 dwmw2 Exp $
*
* Copyright (c) 2001 Axis Communications AB
*
......@@ -52,6 +52,7 @@
/* Manufacturers */
#define MANUFACTURER_AMD 0x0001
#define MANUFACTURER_ATMEL 0x001F
#define MANUFACTURER_FUJITSU 0x0004
#define MANUFACTURER_ST 0x0020
#define MANUFACTURER_SST 0x00BF
......@@ -67,10 +68,14 @@
#define AM29BDS323D 0x22D1
#define AM29BDS643D 0x227E
/* Atmel */
#define AT49xV16x 0x00C0
#define AT49xV16xT 0x00C2
/* Fujitsu */
#define MBM29LV160TE 0x22C4
#define MBM29LV160BE 0x2249
#define MBM29LV800BB 0x225B
/* ST - www.st.com */
#define M29W800T 0x00D7
......@@ -135,11 +140,11 @@ static const char im_name[] = "amd_flash";
static inline __u32 wide_read(struct map_info *map, __u32 addr)
{
if (map->buswidth == 1) {
return map->read8(map, addr);
return map_read8(map, addr);
} else if (map->buswidth == 2) {
return map->read16(map, addr);
return map_read16(map, addr);
} else if (map->buswidth == 4) {
return map->read32(map, addr);
return map_read32(map, addr);
}
return 0;
......@@ -148,11 +153,11 @@ static inline __u32 wide_read(struct map_info *map, __u32 addr)
static inline void wide_write(struct map_info *map, __u32 val, __u32 addr)
{
if (map->buswidth == 1) {
map->write8(map, val, addr);
map_write8(map, val, addr);
} else if (map->buswidth == 2) {
map->write16(map, val, addr);
map_write16(map, val, addr);
} else if (map->buswidth == 4) {
map->write32(map, val, addr);
map_write32(map, val, addr);
}
}
......@@ -419,10 +424,7 @@ static int probe_new_chip(struct mtd_info *mtd, __u32 base,
static struct mtd_info *amd_flash_probe(struct map_info *map)
{
/* Keep this table on the stack so that it gets deallocated after the
* probe is done.
*/
const struct amd_flash_info table[] = {
static const struct amd_flash_info table[] = {
{
.mfr_id = MANUFACTURER_AMD,
.dev_id = AM29LV160DT,
......@@ -555,6 +557,18 @@ static struct mtd_info *amd_flash_probe(struct map_info *map)
{ .offset = 0x0F8000, .erasesize = 0x02000, .numblocks = 2 },
{ .offset = 0x0FC000, .erasesize = 0x04000, .numblocks = 1 }
}
}, {
.mfr_id = MANUFACTURER_FUJITSU,
.dev_id = MBM29LV800BB,
.name = "Fujitsu MBM29LV800BB",
.size = 0x00100000,
.numeraseregions = 4,
.regions = {
{ .offset = 0x000000, .erasesize = 0x04000, .numblocks = 1 },
{ .offset = 0x004000, .erasesize = 0x02000, .numblocks = 2 },
{ .offset = 0x008000, .erasesize = 0x08000, .numblocks = 1 },
{ .offset = 0x010000, .erasesize = 0x10000, .numblocks = 15 }
}
}, {
.mfr_id = MANUFACTURER_ST,
.dev_id = M29W800T,
......@@ -613,6 +627,26 @@ static struct mtd_info *amd_flash_probe(struct map_info *map)
{ .offset = 0x600000, .erasesize = 0x10000, .numblocks = 31 },
{ .offset = 0x7f0000, .erasesize = 0x02000, .numblocks = 8 },
}
}, {
.mfr_id = MANUFACTURER_ATMEL,
.dev_id = AT49xV16x,
.name = "Atmel AT49xV16x",
.size = 0x00200000,
.numeraseregions = 2,
.regions = {
{ .offset = 0x000000, .erasesize = 0x02000, .numblocks = 8 },
{ .offset = 0x010000, .erasesize = 0x10000, .numblocks = 31 }
}
}, {
.mfr_id = MANUFACTURER_ATMEL,
.dev_id = AT49xV16xT,
.name = "Atmel AT49xV16xT",
.size = 0x00200000,
.numeraseregions = 2,
.regions = {
{ .offset = 0x000000, .erasesize = 0x10000, .numblocks = 31 },
{ .offset = 0x1F0000, .erasesize = 0x02000, .numblocks = 8 }
}
}
};
......@@ -785,7 +819,7 @@ static inline int read_one_chip(struct map_info *map, struct flchip *chip,
chip->state = FL_READY;
map->copy_from(map, buf, adr, len);
map_copy_from(map, buf, adr, len);
wake_up(&chip->wq);
spin_unlock_bh(chip->mutex);
......@@ -947,7 +981,7 @@ static int amd_flash_write(struct mtd_info *mtd, loff_t to , size_t len,
u_char tmp_buf[4];
__u32 datum;
map->copy_from(map, tmp_buf,
map_copy_from(map, tmp_buf,
bus_ofs + private->chips[chipnum].start,
map->buswidth);
while (len && i < map->buswidth)
......@@ -1020,7 +1054,7 @@ static int amd_flash_write(struct mtd_info *mtd, loff_t to , size_t len,
u_char tmp_buf[2];
__u32 datum;
map->copy_from(map, tmp_buf,
map_copy_from(map, tmp_buf,
ofs + private->chips[chipnum].start,
map->buswidth);
while (len--) {
......@@ -1141,7 +1175,7 @@ static inline int erase_one_block(struct map_info *map, struct flchip *chip,
__u8 verify;
for (address = adr; address < (adr + size); address++) {
if ((verify = map->read8(map, address)) != 0xFF) {
if ((verify = map_read8(map, address)) != 0xFF) {
error = 1;
break;
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
Common Flash Interface probe code.
(C) 2000 Red Hat. GPL'd.
$Id: cfi_probe.c,v 1.66 2001/10/02 15:05:12 dwmw2 Exp $
$Id: cfi_probe.c,v 1.71 2003/05/28 12:51:48 dwmw2 Exp $
*/
#include <linux/config.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <asm/io.h>
#include <asm/byteorder.h>
#include <linux/errno.h>
......@@ -24,16 +25,13 @@
static void print_cfi_ident(struct cfi_ident *);
#endif
int cfi_jedec_setup(struct cfi_private *p_cfi, int index);
int cfi_jedec_lookup(int index, int mfr_id, int dev_id);
static int cfi_probe_chip(struct map_info *map, __u32 base,
struct flchip *chips, struct cfi_private *cfi);
static int cfi_chip_setup(struct map_info *map, struct cfi_private *cfi);
struct mtd_info *cfi_probe(struct map_info *map);
/* check for QRY, or search for jedec id.
/* check for QRY.
in: interleave,type,mode
ret: table index, <0 for error
*/
......@@ -55,6 +53,18 @@ static int cfi_probe_chip(struct map_info *map, __u32 base,
{
int i;
if ((base + 0) >= map->size) {
printk(KERN_NOTICE
"Probe at base[0x00](0x%08lx) past the end of the map(0x%08lx)\n",
(unsigned long)base, map->size -1);
return 0;
}
if ((base + 0xff) >= map->size) {
printk(KERN_NOTICE
"Probe at base[0x55](0x%08lx) past the end of the map(0x%08lx)\n",
(unsigned long)base + 0x55, map->size -1);
return 0;
}
cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL);
cfi_send_gen_cmd(0x98, 0x55, base, map, cfi, cfi->device_type, NULL);
......@@ -139,7 +149,7 @@ static int cfi_chip_setup(struct map_info *map,
memset(cfi->cfiq,0,sizeof(struct cfi_ident));
cfi->cfi_mode = 1;
cfi->cfi_mode = CFI_MODE_CFI;
cfi->fast_prog=1; /* CFI supports fast programming */
/* Read the CFI info structure */
......@@ -250,11 +260,11 @@ static void print_cfi_ident(struct cfi_ident *cfip)
else
printk("Full buffer write not supported\n");
printk("Typical block erase timeout: %d s\n", 1<<cfip->BlockEraseTimeoutTyp);
printk("Maximum block erase timeout: %d s\n", (1<<cfip->BlockEraseTimeoutMax) * (1<<cfip->BlockEraseTimeoutTyp));
printk("Typical block erase timeout: %d ms\n", 1<<cfip->BlockEraseTimeoutTyp);
printk("Maximum block erase timeout: %d ms\n", (1<<cfip->BlockEraseTimeoutMax) * (1<<cfip->BlockEraseTimeoutTyp));
if (cfip->ChipEraseTimeoutTyp || cfip->ChipEraseTimeoutMax) {
printk("Typical chip erase timeout: %d s\n", 1<<cfip->ChipEraseTimeoutTyp);
printk("Maximum chip erase timeout: %d s\n", (1<<cfip->ChipEraseTimeoutMax) * (1<<cfip->ChipEraseTimeoutTyp));
printk("Typical chip erase timeout: %d ms\n", 1<<cfip->ChipEraseTimeoutTyp);
printk("Maximum chip erase timeout: %d ms\n", (1<<cfip->ChipEraseTimeoutMax) * (1<<cfip->ChipEraseTimeoutTyp));
}
else
printk("Chip erase not supported\n");
......
/*
* $Id: chipreg.c,v 1.12 2001/10/02 15:29:53 dwmw2 Exp $
* $Id: chipreg.c,v 1.15 2003/05/21 15:15:05 dwmw2 Exp $
*
* Registration for chip drivers
*
......@@ -7,10 +7,13 @@
#include <linux/kernel.h>
#include <linux/config.h>
#include <linux/module.h>
#include <linux/kmod.h>
#include <linux/spinlock.h>
#include <linux/mtd/compatmac.h>
#include <linux/slab.h>
#include <linux/mtd/map.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/compatmac.h>
spinlock_t chip_drvs_lock = SPIN_LOCK_UNLOCKED;
static LIST_HEAD(chip_drvs_list);
......@@ -29,7 +32,7 @@ void unregister_mtd_chip_driver(struct mtd_chip_driver *drv)
spin_unlock(&chip_drvs_lock);
}
static struct mtd_chip_driver *get_mtd_chip_driver (char *name)
static struct mtd_chip_driver *get_mtd_chip_driver (const char *name)
{
struct list_head *pos;
struct mtd_chip_driver *ret = NULL, *this;
......@@ -44,10 +47,8 @@ static struct mtd_chip_driver *get_mtd_chip_driver (char *name)
break;
}
}
if (ret && !try_module_get(ret->module)) {
/* Eep. Failed. */
if (ret && !try_module_get(ret->module))
ret = NULL;
}
spin_unlock(&chip_drvs_lock);
......@@ -57,7 +58,7 @@ static struct mtd_chip_driver *get_mtd_chip_driver (char *name)
/* Hide all the horrid details, like some silly person taking
get_module_symbol() away from us, from the caller. */
struct mtd_info *do_map_probe(char *name, struct map_info *map)
struct mtd_info *do_map_probe(const char *name, struct map_info *map)
{
struct mtd_chip_driver *drv;
struct mtd_info *ret;
......@@ -84,10 +85,26 @@ struct mtd_info *do_map_probe(char *name, struct map_info *map)
return NULL;
}
/*
* Destroy an MTD device which was created for a map device.
* Make sure the MTD device is already unregistered before calling this
*/
void map_destroy(struct mtd_info *mtd)
{
struct map_info *map = mtd->priv;
if (map->fldrv->destroy)
map->fldrv->destroy(mtd);
module_put(map->fldrv->module);
kfree(mtd);
}
EXPORT_SYMBOL(register_mtd_chip_driver);
EXPORT_SYMBOL(unregister_mtd_chip_driver);
EXPORT_SYMBOL(do_map_probe);
EXPORT_SYMBOL(map_destroy);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org>");
......
......@@ -2,13 +2,16 @@
* Routines common to all CFI-type probes.
* (C) 2001, 2001 Red Hat, Inc.
* GPL'd
* $Id: gen_probe.c,v 1.5 2001/10/02 15:05:12 dwmw2 Exp $
* $Id: gen_probe.c,v 1.11 2003/05/21 15:15:05 dwmw2 Exp $
*/
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
#include <linux/mtd/cfi.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/gen_probe.h>
static struct mtd_info *check_cmd_set(struct map_info *, int);
......@@ -38,7 +41,7 @@ struct mtd_info *mtd_do_chip_probe(struct map_info *map, struct chip_probe *cp)
if (mtd)
return mtd;
printk(KERN_WARNING"cfi_probe: No supported Vendor Command Set found\n");
printk(KERN_WARNING"gen_probe: No supported Vendor Command Set found\n");
kfree(cfi->cfiq);
kfree(cfi);
......@@ -57,6 +60,7 @@ struct cfi_private *genprobe_ident_chips(struct map_info *map, struct chip_probe
int i;
memset(&cfi, 0, sizeof(cfi));
memset(&chip[0], 0, sizeof(chip));
/* Call the probetype-specific code with all permutations of
interleave and device type, etc. */
......@@ -106,6 +110,12 @@ struct cfi_private *genprobe_ident_chips(struct map_info *map, struct chip_probe
* Now probe for other chips, checking sensibly for aliases while
* we're at it. The new_chip probe above should have let the first
* chip in read mode.
*
* NOTE: Here, we're checking if there is room for another chip
* the same size within the mapping. Therefore,
* base + chipsize <= map->size is the correct thing to do,
* because, base + chipsize would be the _first_ byte of the
* next chip, not the one we're currently pondering.
*/
for (base = (1<<cfi.chipshift); base + (1<<cfi.chipshift) <= map->size;
......@@ -224,6 +234,41 @@ static int genprobe_new_chip(struct map_info *map, struct chip_probe *cp,
break;
#endif /* CFIDEV_BUSWIDTH_4 */
#ifdef CFIDEV_BUSWIDTH_8
case CFIDEV_BUSWIDTH_8:
#if defined(CFIDEV_INTERLEAVE_2) && defined(SOMEONE_ACTUALLY_MAKES_THESE)
cfi->interleave = CFIDEV_INTERLEAVE_2;
cfi->device_type = CFI_DEVICETYPE_X32;
if (cp->probe_chip(map, 0, NULL, cfi))
return 1;
#endif /* CFIDEV_INTERLEAVE_2 */
#ifdef CFIDEV_INTERLEAVE_4
cfi->interleave = CFIDEV_INTERLEAVE_4;
#ifdef SOMEONE_ACTUALLY_MAKES_THESE
cfi->device_type = CFI_DEVICETYPE_X32;
if (cp->probe_chip(map, 0, NULL, cfi))
return 1;
#endif
cfi->device_type = CFI_DEVICETYPE_X16;
if (cp->probe_chip(map, 0, NULL, cfi))
return 1;
#endif /* CFIDEV_INTERLEAVE_4 */
#ifdef CFIDEV_INTERLEAVE_8
cfi->interleave = CFIDEV_INTERLEAVE_8;
cfi->device_type = CFI_DEVICETYPE_X16;
if (cp->probe_chip(map, 0, NULL, cfi))
return 1;
cfi->device_type = CFI_DEVICETYPE_X8;
if (cp->probe_chip(map, 0, NULL, cfi))
return 1;
#endif /* CFIDEV_INTERLEAVE_8 */
break;
#endif /* CFIDEV_BUSWIDTH_8 */
default:
printk(KERN_WARNING "genprobe_new_chip called with unsupported buswidth %d\n", map->buswidth);
return 0;
......@@ -288,6 +333,10 @@ static struct mtd_info *check_cmd_set(struct map_info *map, int primary)
#ifdef CONFIG_MTD_CFI_AMDSTD
case 0x0002:
return cfi_cmdset_0002(map, primary);
#endif
#ifdef CONFIG_MTD_CFI_STAA
case 0x0020:
return cfi_cmdset_0020(map, primary);
#endif
}
......
......@@ -11,10 +11,16 @@
* not going to guess how to send commands to them, plus I expect they will
* all speak CFI..
*
* $Id: jedec.c,v 1.12 2001/11/06 14:37:35 dwmw2 Exp $
* $Id: jedec.c,v 1.18 2003/05/28 12:51:48 dwmw2 Exp $
*/
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/mtd/jedec.h>
#include <linux/mtd/map.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/compatmac.h>
static struct mtd_info *jedec_probe(struct map_info *);
static int jedec_probe8(struct map_info *map,unsigned long base,
......@@ -168,7 +174,8 @@ static struct mtd_info *jedec_probe(struct map_info *map)
/* Generate a part name that includes the number of different chips and
other configuration information */
count = 1;
strlcpy(Part,map->name,sizeof(Part)-10);
strncpy(Part,map->name,sizeof(Part)-10);
Part[sizeof(Part)-11] = 0;
strcat(Part," ");
Uniq = 0;
for (I = 0; priv->chips[I].jedec != 0 && I < MAX_JEDEC_CHIPS; I++)
......@@ -245,7 +252,8 @@ static struct mtd_info *jedec_probe(struct map_info *map)
// printk("Part: '%s'\n",Part);
memset(MTD,0,sizeof(*MTD));
// strlcpy(MTD->name,Part,sizeof(MTD->name));
// strncpy(MTD->name,Part,sizeof(MTD->name));
// MTD->name[sizeof(MTD->name)-1] = 0;
MTD->name = map->name;
MTD->type = MTD_NORFLASH;
MTD->flags = MTD_CAP_NORFLASH;
......@@ -264,7 +272,7 @@ static struct mtd_info *jedec_probe(struct map_info *map)
MTD->priv = map;
map->fldrv_priv = priv;
map->fldrv = &jedec_chipdrv;
MOD_INC_USE_COUNT;
__module_get(THIS_MODULE);
return MTD;
}
......@@ -386,8 +394,8 @@ static const struct JEDECTable *jedec_idtoinf(__u8 mfr,__u8 id)
static int jedec_probe8(struct map_info *map,unsigned long base,
struct jedec_private *priv)
{
#define flread(x) map->read8(map,base+x)
#define flwrite(v,x) map->write8(map,v,base+x)
#define flread(x) map_read8(map,base+x)
#define flwrite(v,x) map_write8(map,v,base+x)
const unsigned long AutoSel1 = 0xAA;
const unsigned long AutoSel2 = 0x55;
......@@ -446,8 +454,8 @@ static int jedec_probe16(struct map_info *map,unsigned long base,
static int jedec_probe32(struct map_info *map,unsigned long base,
struct jedec_private *priv)
{
#define flread(x) map->read32(map,base+((x)<<2))
#define flwrite(v,x) map->write32(map,v,base+((x)<<2))
#define flread(x) map_read32(map,base+((x)<<2))
#define flwrite(v,x) map_write32(map,v,base+((x)<<2))
const unsigned long AutoSel1 = 0xAAAAAAAA;
const unsigned long AutoSel2 = 0x55555555;
......@@ -500,8 +508,8 @@ static int jedec_probe32(struct map_info *map,unsigned long base,
we call this routine with the JEDEC return still enabled, if two or
more flashes have a truncated address space the probe test will still
work */
if (base + Size+0x555 < map->size &&
base + Size+0x555 < (base & (~(my_bank_size-1))) + my_bank_size)
if (base + (Size<<2)+0x555 < map->size &&
base + (Size<<2)+0x555 < (base & (~(my_bank_size-1))) + my_bank_size)
{
if (flread(base+Size) != flread(base+Size + 0x100) ||
flread(base+Size + 1) != flread(base+Size + 0x101))
......@@ -525,7 +533,7 @@ static int jedec_read(struct mtd_info *mtd, loff_t from, size_t len,
{
struct map_info *map = (struct map_info *)mtd->priv;
map->copy_from(map, buf, from, len);
map_copy_from(map, buf, from, len);
*retlen = len;
return 0;
}
......@@ -549,7 +557,7 @@ static int jedec_read_banked(struct mtd_info *mtd, loff_t from, size_t len,
get = priv->bank_fill[0] - offset;
bank /= priv->bank_fill[0];
map->copy_from(map,buf + *retlen,bank*my_bank_size + offset,get);
map_copy_from(map,buf + *retlen,bank*my_bank_size + offset,get);
len -= get;
*retlen += get;
......@@ -580,8 +588,8 @@ static void jedec_flash_failed(unsigned char code)
static int flash_erase(struct mtd_info *mtd, struct erase_info *instr)
{
// Does IO to the currently selected chip
#define flread(x) map->read8(map,chip->base+((x)<<chip->addrshift))
#define flwrite(v,x) map->write8(map,v,chip->base+((x)<<chip->addrshift))
#define flread(x) map_read8(map,chip->base+((x)<<chip->addrshift))
#define flwrite(v,x) map_write8(map,v,chip->base+((x)<<chip->addrshift))
unsigned long Time = 0;
unsigned long NoTime = 0;
......@@ -686,19 +694,19 @@ static int flash_erase(struct mtd_info *mtd, struct erase_info *instr)
or this is not really flash ;> */
switch (map->buswidth) {
case 1:
Last[0] = map->read8(map,(chip->base >> chip->addrshift) + chip->start + off);
Last[1] = map->read8(map,(chip->base >> chip->addrshift) + chip->start + off);
Last[2] = map->read8(map,(chip->base >> chip->addrshift) + chip->start + off);
Last[0] = map_read8(map,(chip->base >> chip->addrshift) + chip->start + off);
Last[1] = map_read8(map,(chip->base >> chip->addrshift) + chip->start + off);
Last[2] = map_read8(map,(chip->base >> chip->addrshift) + chip->start + off);
break;
case 2:
Last[0] = map->read16(map,(chip->base >> chip->addrshift) + chip->start + off);
Last[1] = map->read16(map,(chip->base >> chip->addrshift) + chip->start + off);
Last[2] = map->read16(map,(chip->base >> chip->addrshift) + chip->start + off);
Last[0] = map_read16(map,(chip->base >> chip->addrshift) + chip->start + off);
Last[1] = map_read16(map,(chip->base >> chip->addrshift) + chip->start + off);
Last[2] = map_read16(map,(chip->base >> chip->addrshift) + chip->start + off);
break;
case 3:
Last[0] = map->read32(map,(chip->base >> chip->addrshift) + chip->start + off);
Last[1] = map->read32(map,(chip->base >> chip->addrshift) + chip->start + off);
Last[2] = map->read32(map,(chip->base >> chip->addrshift) + chip->start + off);
Last[0] = map_read32(map,(chip->base >> chip->addrshift) + chip->start + off);
Last[1] = map_read32(map,(chip->base >> chip->addrshift) + chip->start + off);
Last[2] = map_read32(map,(chip->base >> chip->addrshift) + chip->start + off);
break;
}
Count = 3;
......@@ -734,13 +742,13 @@ static int flash_erase(struct mtd_info *mtd, struct erase_info *instr)
switch (map->buswidth) {
case 1:
Last[Count % 4] = map->read8(map,(chip->base >> chip->addrshift) + chip->start + off);
Last[Count % 4] = map_read8(map,(chip->base >> chip->addrshift) + chip->start + off);
break;
case 2:
Last[Count % 4] = map->read16(map,(chip->base >> chip->addrshift) + chip->start + off);
Last[Count % 4] = map_read16(map,(chip->base >> chip->addrshift) + chip->start + off);
break;
case 4:
Last[Count % 4] = map->read32(map,(chip->base >> chip->addrshift) + chip->start + off);
Last[Count % 4] = map_read32(map,(chip->base >> chip->addrshift) + chip->start + off);
break;
}
Count++;
......@@ -773,6 +781,7 @@ static int flash_erase(struct mtd_info *mtd, struct erase_info *instr)
}
//printk("done\n");
instr->state = MTD_ERASE_DONE;
if (instr->callback)
instr->callback(instr);
return 0;
......@@ -790,9 +799,9 @@ static int flash_write(struct mtd_info *mtd, loff_t start, size_t len,
{
/* Does IO to the currently selected chip. It takes the bank addressing
base (which is divisible by the chip size) adds the necessary lower bits
of addrshift (interleve index) and then adds the control register index. */
#define flread(x) map->read8(map,base+(off&((1<<chip->addrshift)-1))+((x)<<chip->addrshift))
#define flwrite(v,x) map->write8(map,v,base+(off&((1<<chip->addrshift)-1))+((x)<<chip->addrshift))
of addrshift (interleave index) and then adds the control register index. */
#define flread(x) map_read8(map,base+(off&((1<<chip->addrshift)-1))+((x)<<chip->addrshift))
#define flwrite(v,x) map_write8(map,v,base+(off&((1<<chip->addrshift)-1))+((x)<<chip->addrshift))
struct map_info *map = (struct map_info *)mtd->priv;
struct jedec_private *priv = (struct jedec_private *)map->fldrv_priv;
......@@ -828,7 +837,7 @@ static int flash_write(struct mtd_info *mtd, loff_t start, size_t len,
// Loop over this page
for (; off != (chip->size << chip->addrshift) && len != 0; start++, len--, off++,buf++)
{
unsigned char oldbyte = map->read8(map,base+off);
unsigned char oldbyte = map_read8(map,base+off);
unsigned char Last[4];
unsigned long Count = 0;
......@@ -843,10 +852,10 @@ static int flash_write(struct mtd_info *mtd, loff_t start, size_t len,
flwrite(0xAA,0x555);
flwrite(0x55,0x2AA);
flwrite(0xA0,0x555);
map->write8(map,*buf,base + off);
Last[0] = map->read8(map,base + off);
Last[1] = map->read8(map,base + off);
Last[2] = map->read8(map,base + off);
map_write8(map,*buf,base + off);
Last[0] = map_read8(map,base + off);
Last[1] = map_read8(map,base + off);
Last[2] = map_read8(map,base + off);
/* Wait for the flash to finish the operation. We store the last 4
status bytes that have been retrieved so we can determine why
......@@ -854,7 +863,7 @@ static int flash_write(struct mtd_info *mtd, loff_t start, size_t len,
failure */
for (Count = 3; Last[(Count - 1) % 4] != Last[(Count - 2) % 4] &&
Count < 10000; Count++)
Last[Count % 4] = map->read8(map,base + off);
Last[Count % 4] = map_read8(map,base + off);
if (Last[(Count - 1) % 4] != *buf)
{
jedec_flash_failed(Last[(Count - 3) % 4]);
......
This diff is collapsed.
/*
* Common code to handle absent "placeholder" devices
* Copyright 2001 Resilience Corporation <ebrower@resilience.com>
* $Id: map_absent.c,v 1.2 2001/10/02 15:05:12 dwmw2 Exp $
* $Id: map_absent.c,v 1.4 2003/05/28 12:51:49 dwmw2 Exp $
*
* This map driver is used to allocate "placeholder" MTD
* devices on systems that have socketed/removable media.
......@@ -23,9 +23,10 @@
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
#include <linux/mtd/compatmac.h>
static int map_absent_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
static int map_absent_write (struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
......@@ -65,7 +66,7 @@ static struct mtd_info *map_absent_probe(struct map_info *map)
mtd->flags = 0;
mtd->erasesize = PAGE_SIZE;
MOD_INC_USE_COUNT;
__module_get(THIS_MODULE);
return mtd;
}
......
/*
* Common code to handle map devices which are simple RAM
* (C) 2000 Red Hat. GPL'd.
* $Id: map_ram.c,v 1.14 2001/10/02 15:05:12 dwmw2 Exp $
* $Id: map_ram.c,v 1.17 2003/05/28 12:51:49 dwmw2 Exp $
*/
#include <linux/module.h>
......@@ -11,8 +11,10 @@
#include <asm/byteorder.h>
#include <linux/errno.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
#include <linux/mtd/compatmac.h>
static int mapram_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
......@@ -34,21 +36,21 @@ static struct mtd_info *map_ram_probe(struct map_info *map)
/* Check the first byte is RAM */
#if 0
map->write8(map, 0x55, 0);
if (map->read8(map, 0) != 0x55)
map_write8(map, 0x55, 0);
if (map_read8(map, 0) != 0x55)
return NULL;
map->write8(map, 0xAA, 0);
if (map->read8(map, 0) != 0xAA)
map_write8(map, 0xAA, 0);
if (map_read8(map, 0) != 0xAA)
return NULL;
/* Check the last byte is RAM */
map->write8(map, 0x55, map->size-1);
if (map->read8(map, map->size-1) != 0x55)
map_write8(map, 0x55, map->size-1);
if (map_read8(map, map->size-1) != 0x55)
return NULL;
map->write8(map, 0xAA, map->size-1);
if (map->read8(map, map->size-1) != 0xAA)
map_write8(map, 0xAA, map->size-1);
if (map_read8(map, map->size-1) != 0xAA)
return NULL;
#endif
/* OK. It seems to be RAM. */
......@@ -74,7 +76,7 @@ static struct mtd_info *map_ram_probe(struct map_info *map)
while(mtd->size & (mtd->erasesize - 1))
mtd->erasesize >>= 1;
MOD_INC_USE_COUNT;
__module_get(THIS_MODULE);
return mtd;
}
......@@ -83,7 +85,7 @@ static int mapram_read (struct mtd_info *mtd, loff_t from, size_t len, size_t *r
{
struct map_info *map = (struct map_info *)mtd->priv;
map->copy_from(map, buf, from, len);
map_copy_from(map, buf, from, len);
*retlen = len;
return 0;
}
......@@ -92,7 +94,7 @@ static int mapram_write (struct mtd_info *mtd, loff_t to, size_t len, size_t *re
{
struct map_info *map = (struct map_info *)mtd->priv;
map->copy_to(map, to, buf, len);
map_copy_to(map, to, buf, len);
*retlen = len;
return 0;
}
......@@ -105,7 +107,7 @@ static int mapram_erase (struct mtd_info *mtd, struct erase_info *instr)
unsigned long i;
for (i=0; i<instr->len; i++)
map->write8(map, 0xFF, instr->addr + i);
map_write8(map, 0xFF, instr->addr + i);
if (instr->callback)
instr->callback(instr);
......
/*
* Common code to handle map devices which are simple ROM
* (C) 2000 Red Hat. GPL'd.
* $Id: map_rom.c,v 1.17 2001/10/02 15:05:12 dwmw2 Exp $
* $Id: map_rom.c,v 1.20 2003/05/28 12:51:49 dwmw2 Exp $
*/
#include <linux/version.h>
......@@ -12,8 +12,10 @@
#include <asm/byteorder.h>
#include <linux/errno.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
#include <linux/mtd/compatmac.h>
static int maprom_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
static int maprom_write (struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
......@@ -49,7 +51,7 @@ struct mtd_info *map_rom_probe(struct map_info *map)
while(mtd->size & (mtd->erasesize - 1))
mtd->erasesize >>= 1;
MOD_INC_USE_COUNT;
__module_get(THIS_MODULE);
return mtd;
}
......@@ -58,7 +60,7 @@ static int maprom_read (struct mtd_info *mtd, loff_t from, size_t len, size_t *r
{
struct map_info *map = (struct map_info *)mtd->priv;
map->copy_from(map, buf, from, len);
map_copy_from(map, buf, from, len);
*retlen = len;
return 0;
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment