Commit a86fd4c6 authored by Mikael Starvik's avatar Mikael Starvik Committed by Linus Torvalds

[PATCH] CRIS: update simple drivers

Updates for 2.6.9 in basic character based drivers.
Signed-off-by: default avatarMikael Starvik <starvik@axis.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 4ffc1434
......@@ -11,6 +11,9 @@
* partition split defined below.
*
* $Log: axisflashmap.c,v $
* Revision 1.10 2004/08/16 12:37:22 starvik
* Merge of Linux 2.6.8
*
* Revision 1.8 2004/05/14 07:58:03 starvik
* Merge of changes from 2.4
*
......@@ -153,6 +156,14 @@
#define FLASH_CACHED_ADDR KSEG_F
#endif
#if CONFIG_ETRAX_FLASH_BUSWIDTH==1
#define flash_data __u8
#elif CONFIG_ETRAX_FLASH_BUSWIDTH==2
#define flash_data __u16
#elif CONFIG_ETRAX_FLASH_BUSWIDTH==4
#define flash_data __u16
#endif
/* From head.S */
extern unsigned long romfs_start, romfs_length, romfs_in_flash;
......@@ -161,19 +172,11 @@ struct mtd_info* axisflash_mtd = NULL;
/* Map driver functions. */
static __u8 flash_read8(struct map_info *map, unsigned long ofs)
{
return *(__u8 *)(map->map_priv_1 + ofs);
}
static __u16 flash_read16(struct map_info *map, unsigned long ofs)
static map_word flash_read(struct map_info *map, unsigned long ofs)
{
return *(__u16 *)(map->map_priv_1 + ofs);
}
static __u32 flash_read32(struct map_info *map, unsigned long ofs)
{
return *(volatile unsigned int *)(map->map_priv_1 + ofs);
map_word tmp;
tmp.x[0] = *(flash_data *)(map->map_priv_1 + ofs);
return tmp;
}
static void flash_copy_from(struct map_info *map, void *to,
......@@ -182,19 +185,9 @@ static void flash_copy_from(struct map_info *map, void *to,
memcpy(to, (void *)(map->map_priv_1 + from), len);
}
static void flash_write8(struct map_info *map, __u8 d, unsigned long adr)
{
*(__u8 *)(map->map_priv_1 + adr) = d;
}
static void flash_write16(struct map_info *map, __u16 d, unsigned long adr)
{
*(__u16 *)(map->map_priv_1 + adr) = d;
}
static void flash_write32(struct map_info *map, __u32 d, unsigned long adr)
static void flash_write(struct map_info *map, map_word d, unsigned long adr)
{
*(__u32 *)(map->map_priv_1 + adr) = d;
*(flash_data *)(map->map_priv_1 + adr) = (flash_data)d.x[0];
}
/*
......@@ -215,14 +208,10 @@ static void flash_write32(struct map_info *map, __u32 d, unsigned long adr)
static struct map_info map_cse0 = {
.name = "cse0",
.size = MEM_CSE0_SIZE,
.buswidth = CONFIG_ETRAX_FLASH_BUSWIDTH,
.read8 = flash_read8,
.read16 = flash_read16,
.read32 = flash_read32,
.bankwidth = CONFIG_ETRAX_FLASH_BUSWIDTH,
.read = flash_read,
.copy_from = flash_copy_from,
.write8 = flash_write8,
.write16 = flash_write16,
.write32 = flash_write32,
.write = flash_write,
.map_priv_1 = FLASH_UNCACHED_ADDR
};
......@@ -235,14 +224,10 @@ static struct map_info map_cse0 = {
static struct map_info map_cse1 = {
.name = "cse1",
.size = MEM_CSE1_SIZE,
.buswidth = CONFIG_ETRAX_FLASH_BUSWIDTH,
.read8 = flash_read8,
.read16 = flash_read16,
.read32 = flash_read32,
.bankwidth = CONFIG_ETRAX_FLASH_BUSWIDTH,
.read = flash_read,
.copy_from = flash_copy_from,
.write8 = flash_write8,
.write16 = flash_write16,
.write32 = flash_write32,
.write = flash_write,
.map_priv_1 = FLASH_UNCACHED_ADDR + MEM_CSE0_SIZE
};
......
......@@ -7,6 +7,9 @@
*! Functions exported: ds1302_readreg, ds1302_writereg, ds1302_init
*!
*! $Log: ds1302.c,v $
*! Revision 1.14 2004/08/24 06:48:43 starvik
*! Whitespace cleanup
*!
*! Revision 1.13 2004/05/28 09:26:59 starvik
*! Modified I2C initialization to work in 2.6.
*!
......@@ -123,7 +126,7 @@
*!
*! (C) Copyright 1999, 2000, 2001 Axis Communications AB, LUND, SWEDEN
*!
*! $Id: ds1302.c,v 1.13 2004/05/28 09:26:59 starvik Exp $
*! $Id: ds1302.c,v 1.14 2004/08/24 06:48:43 starvik Exp $
*!
*!***************************************************************************/
......
/* $Id: gpio.c,v 1.11 2004/05/14 07:58:03 starvik Exp $
/* $Id: gpio.c,v 1.12 2004/08/24 07:19:59 starvik Exp $
*
* Etrax general port I/O device
*
......@@ -9,6 +9,9 @@
* Johan Adolfsson (read/set directions, write, port G)
*
* $Log: gpio.c,v $
* Revision 1.12 2004/08/24 07:19:59 starvik
* Whitespace cleanup
*
* Revision 1.11 2004/05/14 07:58:03 starvik
* Merge of changes from 2.4
*
......
......@@ -12,6 +12,12 @@
*! don't use PB_I2C if DS1302 uses same bits,
*! use PB.
*! $Log: i2c.c,v $
*! Revision 1.9 2004/08/24 06:49:14 starvik
*! Whitespace cleanup
*!
*! Revision 1.8 2004/06/08 08:48:26 starvik
*! Removed unused code
*!
*! Revision 1.7 2004/05/28 09:26:59 starvik
*! Modified I2C initialization to work in 2.6.
*!
......@@ -69,7 +75,7 @@
*! (C) Copyright 1999-2002 Axis Communications AB, LUND, SWEDEN
*!
*!***************************************************************************/
/* $Id: i2c.c,v 1.7 2004/05/28 09:26:59 starvik Exp $ */
/* $Id: i2c.c,v 1.9 2004/08/24 06:49:14 starvik Exp $ */
/****************** INCLUDE FILES SECTION ***********************************/
......@@ -110,14 +116,6 @@ static const char i2c_name[] = "i2c";
#define I2C_DATA_HIGH 1
#define I2C_DATA_LOW 0
#if 0
/* TODO: fix this so the CONFIG_ETRAX_I2C_USES... is set in Config.in instead */
#if defined(CONFIG_DS1302) && (CONFIG_DS1302_SDABIT==0) && \
(CONFIG_DS1302_SCLBIT == 1)
#define CONFIG_ETRAX_I2C_USES_PB_NOT_PB_I2C
#endif
#endif
#ifdef CONFIG_ETRAX_I2C_USES_PB_NOT_PB_I2C
/* Use PB and not PB_I2C */
#ifndef CONFIG_ETRAX_I2C_DATA_PORT
......
......@@ -15,7 +15,7 @@
*
* Author: Tobias Anderberg <tobiasa@axis.com>.
*
* $Id: pcf8563.c,v 1.4 2004/05/28 09:26:59 starvik Exp $
* $Id: pcf8563.c,v 1.8 2004/08/24 06:42:51 starvik Exp $
*/
#include <linux/config.h>
......@@ -40,7 +40,7 @@
#define PCF8563_MAJOR 121 /* Local major number. */
#define DEVICE_NAME "rtc" /* Name which is registered in /proc/devices. */
#define PCF8563_NAME "PCF8563"
#define DRIVER_VERSION "$Revision: 1.4 $"
#define DRIVER_VERSION "$Revision: 1.8 $"
/* I2C bus slave registers. */
#define RTC_I2C_READ 0xa3
......
/* $Id: serial.c,v 1.20 2004/05/24 12:00:20 starvik Exp $
/* $Id: serial.c,v 1.25 2004/09/29 10:33:49 starvik Exp $
*
* Serial port driver for the ETRAX 100LX chip
*
......@@ -7,6 +7,20 @@
* Many, many authors. Based once upon a time on serial.c for 16x50.
*
* $Log: serial.c,v $
* Revision 1.25 2004/09/29 10:33:49 starvik
* Resolved a dealock when printing debug from kernel.
*
* Revision 1.24 2004/08/27 23:25:59 johana
* rs_set_termios() must call change_speed() if c_iflag has changed or
* automatic XOFF handling will be enabled and transmitter will stop
* if 0x13 is received.
*
* Revision 1.23 2004/08/24 06:57:13 starvik
* More whitespace cleanup
*
* Revision 1.22 2004/08/24 06:12:20 starvik
* Whitespace cleanup
*
* Revision 1.20 2004/05/24 12:00:20 starvik
* Big merge of stuff from Linux 2.4 (e.g. manual mode for the serial port).
*
......@@ -409,7 +423,7 @@
*
*/
static char *serial_version = "$Revision: 1.20 $";
static char *serial_version = "$Revision: 1.25 $";
#include <linux/config.h>
#include <linux/version.h>
......@@ -435,7 +449,7 @@ static char *serial_version = "$Revision: 1.20 $";
#include <asm/irq.h>
#include <asm/system.h>
#include <asm/segment.h>
#include <linux/bitops.h>
#include <asm/bitops.h>
#include <linux/delay.h>
#include <asm/arch/svinto.h>
......@@ -577,12 +591,12 @@ unsigned long timer_data_to_ns(unsigned long timer_data);
static void change_speed(struct e100_serial *info);
static void rs_throttle(struct tty_struct * tty);
static void rs_wait_until_sent(struct tty_struct *tty, int timeout);
static int rs_write(struct tty_struct * tty,
static int rs_write(struct tty_struct * tty, int from_user,
const unsigned char *buf, int count);
extern _INLINE_ int rs_raw_write(struct tty_struct * tty,
extern _INLINE_ int rs_raw_write(struct tty_struct * tty, int from_user,
const unsigned char *buf, int count);
#ifdef CONFIG_ETRAX_RS485
static int e100_write_rs485(struct tty_struct * tty,
static int e100_write_rs485(struct tty_struct * tty, int from_user,
const unsigned char *buf, int count);
#endif
static int get_lsr_info(struct e100_serial * info, unsigned int *value);
......@@ -1786,7 +1800,7 @@ e100_enable_rs485(struct tty_struct *tty,struct rs485_control *r)
}
static int
e100_write_rs485(struct tty_struct *tty,
e100_write_rs485(struct tty_struct *tty, int from_user,
const unsigned char *buf, int count)
{
struct e100_serial * info = (struct e100_serial *)tty->driver_data;
......@@ -1799,7 +1813,7 @@ e100_write_rs485(struct tty_struct *tty,
*/
info->rs485.enabled = 1;
/* rs_write now deals with RS485 if enabled */
count = rs_write(tty, buf, count);
count = rs_write(tty, from_user, buf, count);
info->rs485.enabled = old_enabled;
return count;
}
......@@ -3614,7 +3628,7 @@ rs_flush_chars(struct tty_struct *tty)
}
extern _INLINE_ int
rs_raw_write(struct tty_struct * tty,
rs_raw_write(struct tty_struct * tty, int from_user,
const unsigned char *buf, int count)
{
int c, ret = 0;
......@@ -3649,8 +3663,42 @@ rs_raw_write(struct tty_struct * tty,
* atomic operation... this could perhaps be avoided by more clever
* design.
*/
cli();
if (from_user) {
down(&tmp_buf_sem);
while (1) {
int c1;
c = CIRC_SPACE_TO_END(info->xmit.head,
info->xmit.tail,
SERIAL_XMIT_SIZE);
if (count < c)
c = count;
if (c <= 0)
break;
c -= copy_from_user(tmp_buf, buf, c);
if (!c) {
if (!ret)
ret = -EFAULT;
break;
}
cli();
c1 = CIRC_SPACE_TO_END(info->xmit.head,
info->xmit.tail,
SERIAL_XMIT_SIZE);
if (c1 < c)
c = c1;
memcpy(info->xmit.buf + info->xmit.head, tmp_buf, c);
info->xmit.head = ((info->xmit.head + c) &
(SERIAL_XMIT_SIZE-1));
restore_flags(flags);
buf += c;
count -= c;
ret += c;
}
up(&tmp_buf_sem);
} else {
cli();
while (count) {
c = CIRC_SPACE_TO_END(info->xmit.head,
info->xmit.tail,
SERIAL_XMIT_SIZE);
......@@ -3668,6 +3716,7 @@ rs_raw_write(struct tty_struct * tty,
ret += c;
}
restore_flags(flags);
}
/* enable transmitter if not running, unless the tty is stopped
* this does not need IRQ protection since if tr_running == 0
......@@ -3686,7 +3735,7 @@ rs_raw_write(struct tty_struct * tty,
} /* raw_raw_write() */
static int
rs_write(struct tty_struct * tty,
rs_write(struct tty_struct * tty, int from_user,
const unsigned char *buf, int count)
{
#if defined(CONFIG_ETRAX_RS485)
......@@ -3715,7 +3764,7 @@ rs_write(struct tty_struct * tty,
}
#endif /* CONFIG_ETRAX_RS485 */
count = rs_raw_write(tty, buf, count);
count = rs_raw_write(tty, from_user, buf, count);
#if defined(CONFIG_ETRAX_RS485)
if (info->rs485.enabled)
......@@ -4217,7 +4266,8 @@ rs_set_termios(struct tty_struct *tty, struct termios *old_termios)
{
struct e100_serial *info = (struct e100_serial *)tty->driver_data;
if (tty->termios->c_cflag == old_termios->c_cflag)
if (tty->termios->c_cflag == old_termios->c_cflag &&
tty->termios->c_iflag == old_termios->c_iflag)
return;
change_speed(info);
......@@ -4241,6 +4291,7 @@ extern debugport_write_function debug_write_function;
static int rs_debug_write_function(int i, const char *buf, unsigned int len)
{
int cnt;
int written = 0;
struct tty_struct *tty;
static int recurse_cnt = 0;
......@@ -4252,14 +4303,17 @@ static int rs_debug_write_function(int i, const char *buf, unsigned int len)
local_irq_save(flags);
recurse_cnt++;
local_irq_restore(flags);
do {
cnt = rs_write(tty, 0, buf, len);
cnt = rs_write(tty, 0, buf + written, len);
if (cnt >= 0) {
written += cnt;
buf += cnt;
len -= cnt;
} else
len = cnt;
} while(len > 0);
local_irq_save(flags);
recurse_cnt--;
local_irq_restore(flags);
return 1;
......
......@@ -102,6 +102,7 @@
#include <asm/rtc.h>
#include <linux/config.h>
#include <linux/version.h>
#include <asm/arch/svinto.h>
#include <asm/fasttimer.h>
......@@ -598,8 +599,23 @@ void schedule_usleep(unsigned long us)
#ifdef CONFIG_PROC_FS
static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
,int *eof, void *data_unused);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
,int *eof, void *data_unused
#else
,int unused
#endif
);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
static struct proc_dir_entry *fasttimer_proc_entry;
#else
static struct proc_dir_entry fasttimer_proc_entry =
{
0, 9, "fasttimer",
S_IFREG | S_IRUGO, 1, 0, 0,
0, NULL /* ops -- default to array */,
&proc_fasttimer_read /* get_info */,
};
#endif
#endif /* CONFIG_PROC_FS */
#ifdef CONFIG_PROC_FS
......@@ -608,7 +624,12 @@ static struct proc_dir_entry *fasttimer_proc_entry;
#define BIG_BUF_SIZE (500 + NUM_TIMER_STATS * 300)
static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
,int *eof, void *data_unused)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
,int *eof, void *data_unused
#else
,int unused
#endif
)
{
unsigned long flags;
int i = 0;
......@@ -784,7 +805,9 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
memcpy(buf, bigbuf + offset, len);
*start = buf;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
*eof = 1;
#endif
return len;
}
......@@ -959,8 +982,12 @@ void fast_timer_init(void)
}
#endif
#ifdef CONFIG_PROC_FS
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
if ((fasttimer_proc_entry = create_proc_entry( "fasttimer", 0, 0 )))
fasttimer_proc_entry->read_proc = proc_fasttimer_read;
#else
proc_register_dynamic(&proc_root, &fasttimer_proc_entry);
#endif
#endif /* PROC_FS */
if(request_irq(TIMER1_IRQ_NBR, timer1_handler, SA_SHIRQ,
"fast timer int", NULL))
......
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