aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/lasat
diff options
context:
space:
mode:
authorYoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>2007-07-09 00:10:55 -0400
committerRalf Baechle <ralf@linux-mips.org>2007-07-10 12:33:04 -0400
commitc99cabf034d42c9e4a9c1ed9dfd26411b2fb9b57 (patch)
tree30a696c0ab083427b8865418004f2a8bab96be44 /arch/mips/lasat
parentecd27b92fbb41f779d857632a69bd45dbaf0f915 (diff)
[MIPS] remove LASAT Networks platforms support
Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/lasat')
-rw-r--r--arch/mips/lasat/Kconfig15
-rw-r--r--arch/mips/lasat/Makefile14
-rw-r--r--arch/mips/lasat/at93c.c148
-rw-r--r--arch/mips/lasat/at93c.h18
-rw-r--r--arch/mips/lasat/ds1603.c183
-rw-r--r--arch/mips/lasat/ds1603.h33
-rw-r--r--arch/mips/lasat/image/Makefile53
-rw-r--r--arch/mips/lasat/image/head.S31
-rw-r--r--arch/mips/lasat/image/romscript.normal23
-rw-r--r--arch/mips/lasat/interrupt.c130
-rw-r--r--arch/mips/lasat/lasat_board.c279
-rw-r--r--arch/mips/lasat/lasat_models.h63
-rw-r--r--arch/mips/lasat/picvue.c240
-rw-r--r--arch/mips/lasat/picvue.h48
-rw-r--r--arch/mips/lasat/picvue_proc.c186
-rw-r--r--arch/mips/lasat/prom.c117
-rw-r--r--arch/mips/lasat/prom.h5
-rw-r--r--arch/mips/lasat/reset.c69
-rw-r--r--arch/mips/lasat/setup.c182
-rw-r--r--arch/mips/lasat/sysctl.c441
-rw-r--r--arch/mips/lasat/sysctl.h24
21 files changed, 0 insertions, 2302 deletions
diff --git a/arch/mips/lasat/Kconfig b/arch/mips/lasat/Kconfig
deleted file mode 100644
index 1d2ee8a9be13..000000000000
--- a/arch/mips/lasat/Kconfig
+++ /dev/null
@@ -1,15 +0,0 @@
1config PICVUE
2 tristate "PICVUE LCD display driver"
3 depends on LASAT
4
5config PICVUE_PROC
6 tristate "PICVUE LCD display driver /proc interface"
7 depends on PICVUE
8
9config DS1603
10 bool "DS1603 RTC driver"
11 depends on LASAT
12
13config LASAT_SYSCTL
14 bool "LASAT sysctl interface"
15 depends on LASAT
diff --git a/arch/mips/lasat/Makefile b/arch/mips/lasat/Makefile
deleted file mode 100644
index 99f5046fdf49..000000000000
--- a/arch/mips/lasat/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
1#
2# Makefile for the LASAT specific kernel interface routines under Linux.
3#
4
5obj-y += reset.o setup.o prom.o lasat_board.o \
6 at93c.o interrupt.o
7
8obj-$(CONFIG_LASAT_SYSCTL) += sysctl.o
9obj-$(CONFIG_DS1603) += ds1603.o
10obj-$(CONFIG_PICVUE) += picvue.o
11obj-$(CONFIG_PICVUE_PROC) += picvue_proc.o
12
13clean:
14 make -C image clean
diff --git a/arch/mips/lasat/at93c.c b/arch/mips/lasat/at93c.c
deleted file mode 100644
index ca26e554615e..000000000000
--- a/arch/mips/lasat/at93c.c
+++ /dev/null
@@ -1,148 +0,0 @@
1/*
2 * Atmel AT93C46 serial eeprom driver
3 *
4 * Brian Murphy <brian.murphy@eicon.com>
5 *
6 */
7#include <linux/kernel.h>
8#include <linux/delay.h>
9#include <asm/lasat/lasat.h>
10#include <linux/module.h>
11#include <linux/init.h>
12
13#include "at93c.h"
14
15#define AT93C_ADDR_SHIFT 7
16#define AT93C_ADDR_MAX ((1 << AT93C_ADDR_SHIFT) - 1)
17#define AT93C_RCMD (0x6 << AT93C_ADDR_SHIFT)
18#define AT93C_WCMD (0x5 << AT93C_ADDR_SHIFT)
19#define AT93C_WENCMD 0x260
20#define AT93C_WDSCMD 0x200
21
22struct at93c_defs *at93c;
23
24static void at93c_reg_write(u32 val)
25{
26 *at93c->reg = val;
27}
28
29static u32 at93c_reg_read(void)
30{
31 u32 tmp = *at93c->reg;
32 return tmp;
33}
34
35static u32 at93c_datareg_read(void)
36{
37 u32 tmp = *at93c->rdata_reg;
38 return tmp;
39}
40
41static void at93c_cycle_clk(u32 data)
42{
43 at93c_reg_write(data | at93c->clk);
44 lasat_ndelay(250);
45 at93c_reg_write(data & ~at93c->clk);
46 lasat_ndelay(250);
47}
48
49static void at93c_write_databit(u8 bit)
50{
51 u32 data = at93c_reg_read();
52 if (bit)
53 data |= 1 << at93c->wdata_shift;
54 else
55 data &= ~(1 << at93c->wdata_shift);
56
57 at93c_reg_write(data);
58 lasat_ndelay(100);
59 at93c_cycle_clk(data);
60}
61
62static unsigned int at93c_read_databit(void)
63{
64 u32 data;
65
66 at93c_cycle_clk(at93c_reg_read());
67 data = (at93c_datareg_read() >> at93c->rdata_shift) & 1;
68 return data;
69}
70
71static u8 at93c_read_byte(void)
72{
73 int i;
74 u8 data = 0;
75
76 for (i = 0; i<=7; i++) {
77 data <<= 1;
78 data |= at93c_read_databit();
79 }
80 return data;
81}
82
83static void at93c_write_bits(u32 data, int size)
84{
85 int i;
86 int shift = size - 1;
87 u32 mask = (1 << shift);
88
89 for (i = 0; i < size; i++) {
90 at93c_write_databit((data & mask) >> shift);
91 data <<= 1;
92 }
93}
94
95static void at93c_init_op(void)
96{
97 at93c_reg_write((at93c_reg_read() | at93c->cs) & ~at93c->clk & ~(1 << at93c->rdata_shift));
98 lasat_ndelay(50);
99}
100
101static void at93c_end_op(void)
102{
103 at93c_reg_write(at93c_reg_read() & ~at93c->cs);
104 lasat_ndelay(250);
105}
106
107static void at93c_wait(void)
108{
109 at93c_init_op();
110 while (!at93c_read_databit())
111 ;
112 at93c_end_op();
113};
114
115static void at93c_disable_wp(void)
116{
117 at93c_init_op();
118 at93c_write_bits(AT93C_WENCMD, 10);
119 at93c_end_op();
120}
121
122static void at93c_enable_wp(void)
123{
124 at93c_init_op();
125 at93c_write_bits(AT93C_WDSCMD, 10);
126 at93c_end_op();
127}
128
129u8 at93c_read(u8 addr)
130{
131 u8 byte;
132 at93c_init_op();
133 at93c_write_bits((addr & AT93C_ADDR_MAX)|AT93C_RCMD, 10);
134 byte = at93c_read_byte();
135 at93c_end_op();
136 return byte;
137}
138
139void at93c_write(u8 addr, u8 data)
140{
141 at93c_disable_wp();
142 at93c_init_op();
143 at93c_write_bits((addr & AT93C_ADDR_MAX)|AT93C_WCMD, 10);
144 at93c_write_bits(data, 8);
145 at93c_end_op();
146 at93c_wait();
147 at93c_enable_wp();
148}
diff --git a/arch/mips/lasat/at93c.h b/arch/mips/lasat/at93c.h
deleted file mode 100644
index cfe2f99b1d44..000000000000
--- a/arch/mips/lasat/at93c.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/*
2 * Atmel AT93C46 serial eeprom driver
3 *
4 * Brian Murphy <brian.murphy@eicon.com>
5 *
6 */
7
8extern struct at93c_defs {
9 volatile u32 *reg;
10 volatile u32 *rdata_reg;
11 int rdata_shift;
12 int wdata_shift;
13 u32 cs;
14 u32 clk;
15} *at93c;
16
17u8 at93c_read(u8 addr);
18void at93c_write(u8 addr, u8 data);
diff --git a/arch/mips/lasat/ds1603.c b/arch/mips/lasat/ds1603.c
deleted file mode 100644
index 7dced67c55eb..000000000000
--- a/arch/mips/lasat/ds1603.c
+++ /dev/null
@@ -1,183 +0,0 @@
1/*
2 * Dallas Semiconductors 1603 RTC driver
3 *
4 * Brian Murphy <brian@murphy.dk>
5 *
6 */
7#include <linux/kernel.h>
8#include <asm/lasat/lasat.h>
9#include <linux/delay.h>
10#include <asm/lasat/ds1603.h>
11#include <asm/time.h>
12
13#include "ds1603.h"
14
15#define READ_TIME_CMD 0x81
16#define SET_TIME_CMD 0x80
17#define TRIMMER_SET_CMD 0xC0
18#define TRIMMER_VALUE_MASK 0x38
19#define TRIMMER_SHIFT 3
20
21struct ds_defs *ds1603 = NULL;
22
23/* HW specific register functions */
24static void rtc_reg_write(unsigned long val)
25{
26 *ds1603->reg = val;
27}
28
29static unsigned long rtc_reg_read(void)
30{
31 unsigned long tmp = *ds1603->reg;
32 return tmp;
33}
34
35static unsigned long rtc_datareg_read(void)
36{
37 unsigned long tmp = *ds1603->data_reg;
38 return tmp;
39}
40
41static void rtc_nrst_high(void)
42{
43 rtc_reg_write(rtc_reg_read() | ds1603->rst);
44}
45
46static void rtc_nrst_low(void)
47{
48 rtc_reg_write(rtc_reg_read() & ~ds1603->rst);
49}
50
51static void rtc_cycle_clock(unsigned long data)
52{
53 data |= ds1603->clk;
54 rtc_reg_write(data);
55 lasat_ndelay(250);
56 if (ds1603->data_reversed)
57 data &= ~ds1603->data;
58 else
59 data |= ds1603->data;
60 data &= ~ds1603->clk;
61 rtc_reg_write(data);
62 lasat_ndelay(250 + ds1603->huge_delay);
63}
64
65static void rtc_write_databit(unsigned int bit)
66{
67 unsigned long data = rtc_reg_read();
68 if (ds1603->data_reversed)
69 bit = !bit;
70 if (bit)
71 data |= ds1603->data;
72 else
73 data &= ~ds1603->data;
74
75 rtc_reg_write(data);
76 lasat_ndelay(50 + ds1603->huge_delay);
77 rtc_cycle_clock(data);
78}
79
80static unsigned int rtc_read_databit(void)
81{
82 unsigned int data;
83
84 data = (rtc_datareg_read() & (1 << ds1603->data_read_shift))
85 >> ds1603->data_read_shift;
86 rtc_cycle_clock(rtc_reg_read());
87 return data;
88}
89
90static void rtc_write_byte(unsigned int byte)
91{
92 int i;
93
94 for (i = 0; i<=7; i++) {
95 rtc_write_databit(byte & 1L);
96 byte >>= 1;
97 }
98}
99
100static void rtc_write_word(unsigned long word)
101{
102 int i;
103
104 for (i = 0; i<=31; i++) {
105 rtc_write_databit(word & 1L);
106 word >>= 1;
107 }
108}
109
110static unsigned long rtc_read_word(void)
111{
112 int i;
113 unsigned long word = 0;
114 unsigned long shift = 0;
115
116 for (i = 0; i<=31; i++) {
117 word |= rtc_read_databit() << shift;
118 shift++;
119 }
120 return word;
121}
122
123static void rtc_init_op(void)
124{
125 rtc_nrst_high();
126
127 rtc_reg_write(rtc_reg_read() & ~ds1603->clk);
128
129 lasat_ndelay(50);
130}
131
132static void rtc_end_op(void)
133{
134 rtc_nrst_low();
135 lasat_ndelay(1000);
136}
137
138/* interface */
139unsigned long ds1603_read(void)
140{
141 unsigned long word;
142 unsigned long flags;
143
144 spin_lock_irqsave(&rtc_lock, flags);
145 rtc_init_op();
146 rtc_write_byte(READ_TIME_CMD);
147 word = rtc_read_word();
148 rtc_end_op();
149 spin_unlock_irqrestore(&rtc_lock, flags);
150 return word;
151}
152
153int ds1603_set(unsigned long time)
154{
155 unsigned long flags;
156
157 spin_lock_irqsave(&rtc_lock, flags);
158 rtc_init_op();
159 rtc_write_byte(SET_TIME_CMD);
160 rtc_write_word(time);
161 rtc_end_op();
162 spin_unlock_irqrestore(&rtc_lock, flags);
163
164 return 0;
165}
166
167void ds1603_set_trimmer(unsigned int trimval)
168{
169 rtc_init_op();
170 rtc_write_byte(((trimval << TRIMMER_SHIFT) & TRIMMER_VALUE_MASK)
171 | (TRIMMER_SET_CMD));
172 rtc_end_op();
173}
174
175void ds1603_disable(void)
176{
177 ds1603_set_trimmer(TRIMMER_DISABLE_RTC);
178}
179
180void ds1603_enable(void)
181{
182 ds1603_set_trimmer(TRIMMER_DEFAULT);
183}
diff --git a/arch/mips/lasat/ds1603.h b/arch/mips/lasat/ds1603.h
deleted file mode 100644
index c2e5c76a379d..000000000000
--- a/arch/mips/lasat/ds1603.h
+++ /dev/null
@@ -1,33 +0,0 @@
1/*
2 * Dallas Semiconductors 1603 RTC driver
3 *
4 * Brian Murphy <brian@murphy.dk>
5 *
6 */
7#ifndef __DS1603_H
8#define __DS1603_H
9
10struct ds_defs {
11 volatile u32 *reg;
12 volatile u32 *data_reg;
13 u32 rst;
14 u32 clk;
15 u32 data;
16 u32 data_read_shift;
17 char data_reversed;
18 u32 huge_delay;
19};
20
21extern struct ds_defs *ds1603;
22
23unsigned long ds1603_read(void);
24int ds1603_set(unsigned long);
25void ds1603_set_trimmer(unsigned int);
26void ds1603_enable(void);
27void ds1603_disable(void);
28void ds1603_init(struct ds_defs *);
29
30#define TRIMMER_DEFAULT 3
31#define TRIMMER_DISABLE_RTC 0
32
33#endif
diff --git a/arch/mips/lasat/image/Makefile b/arch/mips/lasat/image/Makefile
deleted file mode 100644
index 35ecd6483ef6..000000000000
--- a/arch/mips/lasat/image/Makefile
+++ /dev/null
@@ -1,53 +0,0 @@
1#
2# MAKEFILE FOR THE MIPS LINUX BOOTLOADER AND ROM DEBUGGER
3#
4# i-data Networks
5#
6# Author: Thomas Horsten <thh@i-data.com>
7#
8
9ifndef Version
10 Version = "$(USER)-test"
11endif
12
13MKLASATIMG = mklasatimg
14MKLASATIMG_ARCH = mq2,mqpro,sp100,sp200
15KERNEL_IMAGE = $(TOPDIR)/vmlinux
16KERNEL_START = $(shell $(NM) $(KERNEL_IMAGE) | grep " _text" | cut -f1 -d\ )
17KERNEL_ENTRY = $(shell $(NM) $(KERNEL_IMAGE) | grep kernel_entry | cut -f1 -d\ )
18
19LDSCRIPT= -L$(obj) -Tromscript.normal
20
21HEAD_DEFINES := -D_kernel_start=0x$(KERNEL_START) \
22 -D_kernel_entry=0x$(KERNEL_ENTRY) \
23 -D VERSION="\"$(Version)\"" \
24 -D TIMESTAMP=$(shell date +%s)
25
26$(obj)/head.o: $(obj)/head.S $(KERNEL_IMAGE)
27 $(CC) -fno-pic $(HEAD_DEFINES) -I$(TOPDIR)/include -c -o $@ $<
28
29OBJECTS = head.o kImage.o
30
31rom.sw: $(obj)/rom.sw
32
33$(obj)/rom.sw: $(obj)/rom.bin
34 $(MKLASATIMG) -o $@ -k $^ -m $(MKLASATIMG_ARCH)
35
36$(obj)/rom.bin: $(obj)/rom
37 $(OBJCOPY) -O binary -S $^ $@
38
39# Rule to make the bootloader
40$(obj)/rom: $(addprefix $(obj)/,$(OBJECTS))
41 $(LD) $(LDFLAGS) $(LDSCRIPT) -o $@ $^
42
43$(obj)/%.o: $(obj)/%.gz
44 $(LD) -r -o $@ -b binary $<
45
46$(obj)/%.gz: $(obj)/%.bin
47 gzip -cf -9 $< > $@
48
49$(obj)/kImage.bin: $(KERNEL_IMAGE)
50 $(OBJCOPY) -O binary -S $^ $@
51
52clean:
53 rm -f rom rom.bin rom.sw kImage.bin kImage.o
diff --git a/arch/mips/lasat/image/head.S b/arch/mips/lasat/image/head.S
deleted file mode 100644
index efb95f2609c2..000000000000
--- a/arch/mips/lasat/image/head.S
+++ /dev/null
@@ -1,31 +0,0 @@
1#include <asm/lasat/head.h>
2
3 .text
4 .section .text.start, "ax"
5 .set noreorder
6 .set mips3
7
8 /* Magic words identifying a software image */
9 .word LASAT_K_MAGIC0_VAL
10 .word LASAT_K_MAGIC1_VAL
11
12 /* Image header version */
13 .word 0x00000002
14
15 /* image start and size */
16 .word _image_start
17 .word _image_size
18
19 /* start of kernel and entrypoint in uncompressed image */
20 .word _kernel_start
21 .word _kernel_entry
22
23 /* Here we have room for future flags */
24
25 .org 0x40
26reldate:
27 .word TIMESTAMP
28
29 .org 0x50
30release:
31 .string VERSION
diff --git a/arch/mips/lasat/image/romscript.normal b/arch/mips/lasat/image/romscript.normal
deleted file mode 100644
index 988f8ad189cb..000000000000
--- a/arch/mips/lasat/image/romscript.normal
+++ /dev/null
@@ -1,23 +0,0 @@
1OUTPUT_ARCH(mips)
2
3SECTIONS
4{
5 .text :
6 {
7 *(.text.start)
8 }
9
10 /* Data in ROM */
11
12 .data ALIGN(0x10) :
13 {
14 *(.data)
15 }
16 _image_start = ADDR(.data);
17 _image_size = SIZEOF(.data);
18
19 .other :
20 {
21 *(.*)
22 }
23}
diff --git a/arch/mips/lasat/interrupt.c b/arch/mips/lasat/interrupt.c
deleted file mode 100644
index 9a622b9a1051..000000000000
--- a/arch/mips/lasat/interrupt.c
+++ /dev/null
@@ -1,130 +0,0 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * This program is free software; you can distribute it and/or modify it
6 * under the terms of the GNU General Public License (Version 2) as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 *
18 * Routines for generic manipulation of the interrupts found on the
19 * Lasat boards.
20 */
21#include <linux/init.h>
22#include <linux/sched.h>
23#include <linux/slab.h>
24#include <linux/interrupt.h>
25#include <linux/kernel_stat.h>
26
27#include <asm/bootinfo.h>
28#include <asm/irq.h>
29#include <asm/lasat/lasatint.h>
30#include <asm/time.h>
31#include <asm/gdb-stub.h>
32
33static volatile int *lasat_int_status = NULL;
34static volatile int *lasat_int_mask = NULL;
35static volatile int lasat_int_mask_shift;
36
37void disable_lasat_irq(unsigned int irq_nr)
38{
39 *lasat_int_mask &= ~(1 << irq_nr) << lasat_int_mask_shift;
40}
41
42void enable_lasat_irq(unsigned int irq_nr)
43{
44 *lasat_int_mask |= (1 << irq_nr) << lasat_int_mask_shift;
45}
46
47static struct irq_chip lasat_irq_type = {
48 .name = "Lasat",
49 .ack = disable_lasat_irq,
50 .mask = disable_lasat_irq,
51 .mask_ack = disable_lasat_irq,
52 .unmask = enable_lasat_irq,
53};
54
55static inline int ls1bit32(unsigned int x)
56{
57 int b = 31, s;
58
59 s = 16; if (x << 16 == 0) s = 0; b -= s; x <<= s;
60 s = 8; if (x << 8 == 0) s = 0; b -= s; x <<= s;
61 s = 4; if (x << 4 == 0) s = 0; b -= s; x <<= s;
62 s = 2; if (x << 2 == 0) s = 0; b -= s; x <<= s;
63 s = 1; if (x << 1 == 0) s = 0; b -= s;
64
65 return b;
66}
67
68static unsigned long (* get_int_status)(void);
69
70static unsigned long get_int_status_100(void)
71{
72 return *lasat_int_status & *lasat_int_mask;
73}
74
75static unsigned long get_int_status_200(void)
76{
77 unsigned long int_status;
78
79 int_status = *lasat_int_status;
80 int_status &= (int_status >> LASATINT_MASK_SHIFT_200) & 0xffff;
81 return int_status;
82}
83
84asmlinkage void plat_irq_dispatch(void)
85{
86 unsigned long int_status;
87 unsigned int cause = read_c0_cause();
88 int irq;
89
90 if (cause & CAUSEF_IP7) { /* R4000 count / compare IRQ */
91 ll_timer_interrupt(7);
92 return;
93 }
94
95 int_status = get_int_status();
96
97 /* if int_status == 0, then the interrupt has already been cleared */
98 if (int_status) {
99 irq = ls1bit32(int_status);
100
101 do_IRQ(irq);
102 }
103}
104
105void __init arch_init_irq(void)
106{
107 int i;
108
109 switch (mips_machtype) {
110 case MACH_LASAT_100:
111 lasat_int_status = (void *)LASAT_INT_STATUS_REG_100;
112 lasat_int_mask = (void *)LASAT_INT_MASK_REG_100;
113 lasat_int_mask_shift = LASATINT_MASK_SHIFT_100;
114 get_int_status = get_int_status_100;
115 *lasat_int_mask = 0;
116 break;
117 case MACH_LASAT_200:
118 lasat_int_status = (void *)LASAT_INT_STATUS_REG_200;
119 lasat_int_mask = (void *)LASAT_INT_MASK_REG_200;
120 lasat_int_mask_shift = LASATINT_MASK_SHIFT_200;
121 get_int_status = get_int_status_200;
122 *lasat_int_mask &= 0xffff;
123 break;
124 default:
125 panic("arch_init_irq: mips_machtype incorrect");
126 }
127
128 for (i = 0; i <= LASATINT_END; i++)
129 set_irq_chip_and_handler(i, &lasat_irq_type, handle_level_irq);
130}
diff --git a/arch/mips/lasat/lasat_board.c b/arch/mips/lasat/lasat_board.c
deleted file mode 100644
index fbe9a87bd0ad..000000000000
--- a/arch/mips/lasat/lasat_board.c
+++ /dev/null
@@ -1,279 +0,0 @@
1/*
2 * Thomas Horsten <thh@lasat.com>
3 * Copyright (C) 2000 LASAT Networks A/S.
4 *
5 * This program is free software; you can distribute it and/or modify it
6 * under the terms of the GNU General Public License (Version 2) as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 *
18 * Routines specific to the LASAT boards
19 */
20#include <linux/types.h>
21#include <linux/crc32.h>
22#include <asm/lasat/lasat.h>
23#include <linux/kernel.h>
24#include <linux/string.h>
25#include <linux/ctype.h>
26#include <asm/bootinfo.h>
27#include <asm/addrspace.h>
28#include "at93c.h"
29/* New model description table */
30#include "lasat_models.h"
31
32#define EEPROM_CRC(data, len) (~0 ^ crc32(~0, data, len))
33
34struct lasat_info lasat_board_info;
35
36void update_bcastaddr(void);
37
38int EEPROMRead(unsigned int pos, unsigned char *data, int len)
39{
40 int i;
41
42 for (i=0; i<len; i++)
43 *data++ = at93c_read(pos++);
44
45 return 0;
46}
47int EEPROMWrite(unsigned int pos, unsigned char *data, int len)
48{
49 int i;
50
51 for (i=0; i<len; i++)
52 at93c_write(pos++, *data++);
53
54 return 0;
55}
56
57static void init_flash_sizes(void)
58{
59 int i;
60 unsigned long *lb = lasat_board_info.li_flashpart_base;
61 unsigned long *ls = lasat_board_info.li_flashpart_size;
62
63 ls[LASAT_MTD_BOOTLOADER] = 0x40000;
64 ls[LASAT_MTD_SERVICE] = 0xC0000;
65 ls[LASAT_MTD_NORMAL] = 0x100000;
66
67 if (mips_machtype == MACH_LASAT_100) {
68 lasat_board_info.li_flash_base = 0x1e000000;
69
70 lb[LASAT_MTD_BOOTLOADER] = 0x1e400000;
71
72 if (lasat_board_info.li_flash_size > 0x200000) {
73 ls[LASAT_MTD_CONFIG] = 0x100000;
74 ls[LASAT_MTD_FS] = 0x500000;
75 }
76 } else {
77 lasat_board_info.li_flash_base = 0x10000000;
78
79 if (lasat_board_info.li_flash_size < 0x1000000) {
80 lb[LASAT_MTD_BOOTLOADER] = 0x10000000;
81 ls[LASAT_MTD_CONFIG] = 0x100000;
82 if (lasat_board_info.li_flash_size >= 0x400000) {
83 ls[LASAT_MTD_FS] = lasat_board_info.li_flash_size - 0x300000;
84 }
85 }
86 }
87
88 for (i = 1; i < LASAT_MTD_LAST; i++)
89 lb[i] = lb[i-1] + ls[i-1];
90}
91
92int lasat_init_board_info(void)
93{
94 int c;
95 unsigned long crc;
96 unsigned long cfg0, cfg1;
97 const product_info_t *ppi;
98 int i_n_base_models = N_BASE_MODELS;
99 const char * const * i_txt_base_models = txt_base_models;
100 int i_n_prids = N_PRIDS;
101
102 memset(&lasat_board_info, 0, sizeof(lasat_board_info));
103
104 /* First read the EEPROM info */
105 EEPROMRead(0, (unsigned char *)&lasat_board_info.li_eeprom_info,
106 sizeof(struct lasat_eeprom_struct));
107
108 /* Check the CRC */
109 crc = EEPROM_CRC((unsigned char *)(&lasat_board_info.li_eeprom_info),
110 sizeof(struct lasat_eeprom_struct) - 4);
111
112 if (crc != lasat_board_info.li_eeprom_info.crc32) {
113 printk(KERN_WARNING "WARNING...\nWARNING...\nEEPROM CRC does "
114 "not match calculated, attempting to soldier on...\n");
115 }
116
117 if (lasat_board_info.li_eeprom_info.version != LASAT_EEPROM_VERSION) {
118 printk(KERN_WARNING "WARNING...\nWARNING...\nEEPROM version "
119 "%d, wanted version %d, attempting to soldier on...\n",
120 (unsigned int)lasat_board_info.li_eeprom_info.version,
121 LASAT_EEPROM_VERSION);
122 }
123
124 cfg0 = lasat_board_info.li_eeprom_info.cfg[0];
125 cfg1 = lasat_board_info.li_eeprom_info.cfg[1];
126
127 if ( LASAT_W0_DSCTYPE(cfg0) != 1) {
128 printk(KERN_WARNING "WARNING...\nWARNING...\n"
129 "Invalid configuration read from EEPROM, attempting to "
130 "soldier on...");
131 }
132 /* We have a valid configuration */
133
134 switch (LASAT_W0_SDRAMBANKSZ(cfg0)) {
135 case 0:
136 lasat_board_info.li_memsize = 0x0800000;
137 break;
138 case 1:
139 lasat_board_info.li_memsize = 0x1000000;
140 break;
141 case 2:
142 lasat_board_info.li_memsize = 0x2000000;
143 break;
144 case 3:
145 lasat_board_info.li_memsize = 0x4000000;
146 break;
147 case 4:
148 lasat_board_info.li_memsize = 0x8000000;
149 break;
150 default:
151 lasat_board_info.li_memsize = 0;
152 }
153
154 switch (LASAT_W0_SDRAMBANKS(cfg0)) {
155 case 0:
156 break;
157 case 1:
158 lasat_board_info.li_memsize *= 2;
159 break;
160 default:
161 break;
162 }
163
164 switch (LASAT_W0_BUSSPEED(cfg0)) {
165 case 0x0:
166 lasat_board_info.li_bus_hz = 60000000;
167 break;
168 case 0x1:
169 lasat_board_info.li_bus_hz = 66000000;
170 break;
171 case 0x2:
172 lasat_board_info.li_bus_hz = 66666667;
173 break;
174 case 0x3:
175 lasat_board_info.li_bus_hz = 80000000;
176 break;
177 case 0x4:
178 lasat_board_info.li_bus_hz = 83333333;
179 break;
180 case 0x5:
181 lasat_board_info.li_bus_hz = 100000000;
182 break;
183 }
184
185 switch (LASAT_W0_CPUCLK(cfg0)) {
186 case 0x0:
187 lasat_board_info.li_cpu_hz =
188 lasat_board_info.li_bus_hz;
189 break;
190 case 0x1:
191 lasat_board_info.li_cpu_hz =
192 lasat_board_info.li_bus_hz +
193 (lasat_board_info.li_bus_hz >> 1);
194 break;
195 case 0x2:
196 lasat_board_info.li_cpu_hz =
197 lasat_board_info.li_bus_hz +
198 lasat_board_info.li_bus_hz;
199 break;
200 case 0x3:
201 lasat_board_info.li_cpu_hz =
202 lasat_board_info.li_bus_hz +
203 lasat_board_info.li_bus_hz +
204 (lasat_board_info.li_bus_hz >> 1);
205 break;
206 case 0x4:
207 lasat_board_info.li_cpu_hz =
208 lasat_board_info.li_bus_hz +
209 lasat_board_info.li_bus_hz +
210 lasat_board_info.li_bus_hz;
211 break;
212 }
213
214 /* Flash size */
215 switch (LASAT_W1_FLASHSIZE(cfg1)) {
216 case 0:
217 lasat_board_info.li_flash_size = 0x200000;
218 break;
219 case 1:
220 lasat_board_info.li_flash_size = 0x400000;
221 break;
222 case 2:
223 lasat_board_info.li_flash_size = 0x800000;
224 break;
225 case 3:
226 lasat_board_info.li_flash_size = 0x1000000;
227 break;
228 case 4:
229 lasat_board_info.li_flash_size = 0x2000000;
230 break;
231 }
232
233 init_flash_sizes();
234
235 lasat_board_info.li_bmid = LASAT_W0_BMID(cfg0);
236 lasat_board_info.li_prid = lasat_board_info.li_eeprom_info.prid;
237 if (lasat_board_info.li_prid == 0xffff || lasat_board_info.li_prid == 0)
238 lasat_board_info.li_prid = lasat_board_info.li_bmid;
239
240 /* Base model stuff */
241 if (lasat_board_info.li_bmid > i_n_base_models)
242 lasat_board_info.li_bmid = i_n_base_models;
243 strcpy(lasat_board_info.li_bmstr, i_txt_base_models[lasat_board_info.li_bmid]);
244
245 /* Product ID dependent values */
246 c = lasat_board_info.li_prid;
247 if (c >= i_n_prids) {
248 strcpy(lasat_board_info.li_namestr, "Unknown Model");
249 strcpy(lasat_board_info.li_typestr, "Unknown Type");
250 } else {
251 ppi = &vendor_info_table[0].vi_product_info[c];
252 strcpy(lasat_board_info.li_namestr, ppi->pi_name);
253 if (ppi->pi_type)
254 strcpy(lasat_board_info.li_typestr, ppi->pi_type);
255 else
256 sprintf(lasat_board_info.li_typestr, "%d",10*c);
257 }
258
259#if defined(CONFIG_INET) && defined(CONFIG_SYSCTL)
260 update_bcastaddr();
261#endif
262
263 return 0;
264}
265
266void lasat_write_eeprom_info(void)
267{
268 unsigned long crc;
269
270 /* Generate the CRC */
271 crc = EEPROM_CRC((unsigned char *)(&lasat_board_info.li_eeprom_info),
272 sizeof(struct lasat_eeprom_struct) - 4);
273 lasat_board_info.li_eeprom_info.crc32 = crc;
274
275 /* Write the EEPROM info */
276 EEPROMWrite(0, (unsigned char *)&lasat_board_info.li_eeprom_info,
277 sizeof(struct lasat_eeprom_struct));
278}
279
diff --git a/arch/mips/lasat/lasat_models.h b/arch/mips/lasat/lasat_models.h
deleted file mode 100644
index ae0c5d0bd403..000000000000
--- a/arch/mips/lasat/lasat_models.h
+++ /dev/null
@@ -1,63 +0,0 @@
1/*
2 * Model description tables
3 */
4
5typedef struct product_info_t {
6 const char *pi_name;
7 const char *pi_type;
8} product_info_t;
9
10typedef struct vendor_info_t {
11 const char *vi_name;
12 const product_info_t *vi_product_info;
13} vendor_info_t;
14
15/*
16 * Base models
17 */
18static const char * const txt_base_models[] = {
19 "MQ 2", "MQ Pro", "SP 25", "SP 50", "SP 100", "SP 5000", "SP 7000", "SP 1000", "Unknown"
20};
21#define N_BASE_MODELS (sizeof(txt_base_models)/sizeof(char*)-1)
22
23/*
24 * Eicon Networks
25 */
26static const char txt_en_mq[] = "Masquerade";
27static const char txt_en_sp[] = "Safepipe";
28
29static const product_info_t product_info_eicon[] = {
30 { txt_en_mq, "II" }, /* 0 */
31 { txt_en_mq, "Pro" }, /* 1 */
32 { txt_en_sp, "25" }, /* 2 */
33 { txt_en_sp, "50" }, /* 3 */
34 { txt_en_sp, "100" }, /* 4 */
35 { txt_en_sp, "5000" }, /* 5 */
36 { txt_en_sp, "7000" }, /* 6 */
37 { txt_en_sp, "30" }, /* 7 */
38 { txt_en_sp, "5100" }, /* 8 */
39 { txt_en_sp, "7100" }, /* 9 */
40 { txt_en_sp, "1110" }, /* 10 */
41 { txt_en_sp, "3020" }, /* 11 */
42 { txt_en_sp, "3030" }, /* 12 */
43 { txt_en_sp, "5020" }, /* 13 */
44 { txt_en_sp, "5030" }, /* 14 */
45 { txt_en_sp, "1120" }, /* 15 */
46 { txt_en_sp, "1130" }, /* 16 */
47 { txt_en_sp, "6010" }, /* 17 */
48 { txt_en_sp, "6110" }, /* 18 */
49 { txt_en_sp, "6210" }, /* 19 */
50 { txt_en_sp, "1020" }, /* 20 */
51 { txt_en_sp, "1040" }, /* 21 */
52 { txt_en_sp, "1050" }, /* 22 */
53 { txt_en_sp, "1060" }, /* 23 */
54};
55#define N_PRIDS (sizeof(product_info_eicon)/sizeof(product_info_t))
56
57/*
58 * The vendor table
59 */
60static vendor_info_t const vendor_info_table[] = {
61 { "Eicon Networks", product_info_eicon },
62};
63#define N_VENDORS (sizeof(vendor_info_table)/sizeof(vendor_info_t))
diff --git a/arch/mips/lasat/picvue.c b/arch/mips/lasat/picvue.c
deleted file mode 100644
index 9ae82c3ffb07..000000000000
--- a/arch/mips/lasat/picvue.c
+++ /dev/null
@@ -1,240 +0,0 @@
1/*
2 * Picvue PVC160206 display driver
3 *
4 * Brian Murphy <brian@murphy.dk>
5 *
6 */
7#include <linux/kernel.h>
8#include <linux/delay.h>
9#include <asm/bootinfo.h>
10#include <asm/lasat/lasat.h>
11#include <linux/module.h>
12#include <linux/init.h>
13#include <linux/errno.h>
14#include <linux/string.h>
15
16#include "picvue.h"
17
18#define PVC_BUSY 0x80
19#define PVC_NLINES 2
20#define PVC_DISPMEM 80
21#define PVC_LINELEN PVC_DISPMEM / PVC_NLINES
22
23struct pvc_defs *picvue = NULL;
24
25DECLARE_MUTEX(pvc_sem);
26
27static void pvc_reg_write(u32 val)
28{
29 *picvue->reg = val;
30}
31
32static u32 pvc_reg_read(void)
33{
34 u32 tmp = *picvue->reg;
35 return tmp;
36}
37
38static void pvc_write_byte(u32 data, u8 byte)
39{
40 data |= picvue->e;
41 pvc_reg_write(data);
42 data &= ~picvue->data_mask;
43 data |= byte << picvue->data_shift;
44 pvc_reg_write(data);
45 ndelay(220);
46 pvc_reg_write(data & ~picvue->e);
47 ndelay(220);
48}
49
50static u8 pvc_read_byte(u32 data)
51{
52 u8 byte;
53
54 data |= picvue->e;
55 pvc_reg_write(data);
56 ndelay(220);
57 byte = (pvc_reg_read() & picvue->data_mask) >> picvue->data_shift;
58 data &= ~picvue->e;
59 pvc_reg_write(data);
60 ndelay(220);
61 return byte;
62}
63
64static u8 pvc_read_data(void)
65{
66 u32 data = pvc_reg_read();
67 u8 byte;
68 data |= picvue->rw;
69 data &= ~picvue->rs;
70 pvc_reg_write(data);
71 ndelay(40);
72 byte = pvc_read_byte(data);
73 data |= picvue->rs;
74 pvc_reg_write(data);
75 return byte;
76}
77
78#define TIMEOUT 1000
79static int pvc_wait(void)
80{
81 int i = TIMEOUT;
82 int err = 0;
83
84 while ((pvc_read_data() & PVC_BUSY) && i)
85 i--;
86 if (i == 0)
87 err = -ETIME;
88
89 return err;
90}
91
92#define MODE_INST 0
93#define MODE_DATA 1
94static void pvc_write(u8 byte, int mode)
95{
96 u32 data = pvc_reg_read();
97 data &= ~picvue->rw;
98 if (mode == MODE_DATA)
99 data |= picvue->rs;
100 else
101 data &= ~picvue->rs;
102 pvc_reg_write(data);
103 ndelay(40);
104 pvc_write_byte(data, byte);
105 if (mode == MODE_DATA)
106 data &= ~picvue->rs;
107 else
108 data |= picvue->rs;
109 pvc_reg_write(data);
110 pvc_wait();
111}
112
113void pvc_write_string(const unsigned char *str, u8 addr, int line)
114{
115 int i = 0;
116
117 if (line > 0 && (PVC_NLINES > 1))
118 addr += 0x40 * line;
119 pvc_write(0x80 | addr, MODE_INST);
120
121 while (*str != 0 && i < PVC_LINELEN) {
122 pvc_write(*str++, MODE_DATA);
123 i++;
124 }
125}
126
127void pvc_write_string_centered(const unsigned char *str, int line)
128{
129 int len = strlen(str);
130 u8 addr;
131
132 if (len > PVC_VISIBLE_CHARS)
133 addr = 0;
134 else
135 addr = (PVC_VISIBLE_CHARS - strlen(str))/2;
136
137 pvc_write_string(str, addr, line);
138}
139
140void pvc_dump_string(const unsigned char *str)
141{
142 int len = strlen(str);
143
144 pvc_write_string(str, 0, 0);
145 if (len > PVC_VISIBLE_CHARS)
146 pvc_write_string(&str[PVC_VISIBLE_CHARS], 0, 1);
147}
148
149#define BM_SIZE 8
150#define MAX_PROGRAMMABLE_CHARS 8
151int pvc_program_cg(int charnum, u8 bitmap[BM_SIZE])
152{
153 int i;
154 int addr;
155
156 if (charnum > MAX_PROGRAMMABLE_CHARS)
157 return -ENOENT;
158
159 addr = charnum * 8;
160 pvc_write(0x40 | addr, MODE_INST);
161
162 for (i=0; i<BM_SIZE; i++)
163 pvc_write(bitmap[i], MODE_DATA);
164 return 0;
165}
166
167#define FUNC_SET_CMD 0x20
168#define EIGHT_BYTE (1 << 4)
169#define FOUR_BYTE 0
170#define TWO_LINES (1 << 3)
171#define ONE_LINE 0
172#define LARGE_FONT (1 << 2)
173#define SMALL_FONT 0
174static void pvc_funcset(u8 cmd)
175{
176 pvc_write(FUNC_SET_CMD | (cmd & (EIGHT_BYTE|TWO_LINES|LARGE_FONT)), MODE_INST);
177}
178
179#define ENTRYMODE_CMD 0x4
180#define AUTO_INC (1 << 1)
181#define AUTO_DEC 0
182#define CURSOR_FOLLOWS_DISP (1 << 0)
183static void pvc_entrymode(u8 cmd)
184{
185 pvc_write(ENTRYMODE_CMD | (cmd & (AUTO_INC|CURSOR_FOLLOWS_DISP)), MODE_INST);
186}
187
188#define DISP_CNT_CMD 0x08
189#define DISP_OFF 0
190#define DISP_ON (1 << 2)
191#define CUR_ON (1 << 1)
192#define CUR_BLINK (1 << 0)
193void pvc_dispcnt(u8 cmd)
194{
195 pvc_write(DISP_CNT_CMD | (cmd & (DISP_ON|CUR_ON|CUR_BLINK)), MODE_INST);
196}
197
198#define MOVE_CMD 0x10
199#define DISPLAY (1 << 3)
200#define CURSOR 0
201#define RIGHT (1 << 2)
202#define LEFT 0
203void pvc_move(u8 cmd)
204{
205 pvc_write(MOVE_CMD | (cmd & (DISPLAY|RIGHT)), MODE_INST);
206}
207
208#define CLEAR_CMD 0x1
209void pvc_clear(void)
210{
211 pvc_write(CLEAR_CMD, MODE_INST);
212}
213
214#define HOME_CMD 0x2
215void pvc_home(void)
216{
217 pvc_write(HOME_CMD, MODE_INST);
218}
219
220int pvc_init(void)
221{
222 u8 cmd = EIGHT_BYTE;
223
224 if (PVC_NLINES == 2)
225 cmd |= (SMALL_FONT|TWO_LINES);
226 else
227 cmd |= (LARGE_FONT|ONE_LINE);
228 pvc_funcset(cmd);
229 pvc_dispcnt(DISP_ON);
230 pvc_entrymode(AUTO_INC);
231
232 pvc_clear();
233 pvc_write_string_centered("Display", 0);
234 pvc_write_string_centered("Initialized", 1);
235
236 return 0;
237}
238
239module_init(pvc_init);
240MODULE_LICENSE("GPL");
diff --git a/arch/mips/lasat/picvue.h b/arch/mips/lasat/picvue.h
deleted file mode 100644
index 2a96bf971897..000000000000
--- a/arch/mips/lasat/picvue.h
+++ /dev/null
@@ -1,48 +0,0 @@
1/*
2 * Picvue PVC160206 display driver
3 *
4 * Brian Murphy <brian.murphy@eicon.com>
5 *
6 */
7#include <asm/semaphore.h>
8
9struct pvc_defs {
10 volatile u32 *reg;
11 u32 data_shift;
12 u32 data_mask;
13 u32 e;
14 u32 rw;
15 u32 rs;
16};
17
18extern struct pvc_defs *picvue;
19
20#define PVC_NLINES 2
21#define PVC_DISPMEM 80
22#define PVC_LINELEN PVC_DISPMEM / PVC_NLINES
23#define PVC_VISIBLE_CHARS 16
24
25void pvc_write_string(const unsigned char *str, u8 addr, int line);
26void pvc_write_string_centered(const unsigned char *str, int line);
27void pvc_dump_string(const unsigned char *str);
28
29#define BM_SIZE 8
30#define MAX_PROGRAMMABLE_CHARS 8
31int pvc_program_cg(int charnum, u8 bitmap[BM_SIZE]);
32
33void pvc_dispcnt(u8 cmd);
34#define DISP_OFF 0
35#define DISP_ON (1 << 2)
36#define CUR_ON (1 << 1)
37#define CUR_BLINK (1 << 0)
38
39void pvc_move(u8 cmd);
40#define DISPLAY (1 << 3)
41#define CURSOR 0
42#define RIGHT (1 << 2)
43#define LEFT 0
44
45void pvc_clear(void);
46void pvc_home(void);
47
48extern struct semaphore pvc_sem;
diff --git a/arch/mips/lasat/picvue_proc.c b/arch/mips/lasat/picvue_proc.c
deleted file mode 100644
index cce7cddcdb08..000000000000
--- a/arch/mips/lasat/picvue_proc.c
+++ /dev/null
@@ -1,186 +0,0 @@
1/*
2 * Picvue PVC160206 display driver
3 *
4 * Brian Murphy <brian.murphy@eicon.com>
5 *
6 */
7#include <linux/kernel.h>
8#include <linux/module.h>
9#include <linux/init.h>
10#include <linux/errno.h>
11
12#include <linux/proc_fs.h>
13#include <linux/interrupt.h>
14
15#include <linux/timer.h>
16
17#include "picvue.h"
18
19static char pvc_lines[PVC_NLINES][PVC_LINELEN+1];
20static int pvc_linedata[PVC_NLINES];
21static struct proc_dir_entry *pvc_display_dir;
22static char *pvc_linename[PVC_NLINES] = {"line1", "line2"};
23#define DISPLAY_DIR_NAME "display"
24static int scroll_dir = 0, scroll_interval = 0;
25
26static struct timer_list timer;
27
28static void pvc_display(unsigned long data) {
29 int i;
30
31 pvc_clear();
32 for (i=0; i<PVC_NLINES; i++)
33 pvc_write_string(pvc_lines[i], 0, i);
34}
35
36static DECLARE_TASKLET(pvc_display_tasklet, &pvc_display, 0);
37
38static int pvc_proc_read_line(char *page, char **start,
39 off_t off, int count,
40 int *eof, void *data)
41{
42 char *origpage = page;
43 int lineno = *(int *)data;
44
45 if (lineno < 0 || lineno > PVC_NLINES) {
46 printk("proc_read_line: invalid lineno %d\n", lineno);
47 return 0;
48 }
49
50 down(&pvc_sem);
51 page += sprintf(page, "%s\n", pvc_lines[lineno]);
52 up(&pvc_sem);
53
54 return page - origpage;
55}
56
57static int pvc_proc_write_line(struct file *file, const char *buffer,
58 unsigned long count, void *data)
59{
60 int origcount = count;
61 int lineno = *(int *)data;
62
63 if (lineno < 0 || lineno > PVC_NLINES) {
64 printk("proc_write_line: invalid lineno %d\n", lineno);
65 return origcount;
66 }
67
68 if (count > PVC_LINELEN)
69 count = PVC_LINELEN;
70
71 if (buffer[count-1] == '\n')
72 count--;
73
74 down(&pvc_sem);
75 strncpy(pvc_lines[lineno], buffer, count);
76 pvc_lines[lineno][count] = '\0';
77 up(&pvc_sem);
78
79 tasklet_schedule(&pvc_display_tasklet);
80
81 return origcount;
82}
83
84static int pvc_proc_write_scroll(struct file *file, const char *buffer,
85 unsigned long count, void *data)
86{
87 int origcount = count;
88 int cmd = simple_strtol(buffer, NULL, 10);
89
90 down(&pvc_sem);
91 if (scroll_interval != 0)
92 del_timer(&timer);
93
94 if (cmd == 0) {
95 scroll_dir = 0;
96 scroll_interval = 0;
97 } else {
98 if (cmd < 0) {
99 scroll_dir = -1;
100 scroll_interval = -cmd;
101 } else {
102 scroll_dir = 1;
103 scroll_interval = cmd;
104 }
105 add_timer(&timer);
106 }
107 up(&pvc_sem);
108
109 return origcount;
110}
111
112static int pvc_proc_read_scroll(char *page, char **start,
113 off_t off, int count,
114 int *eof, void *data)
115{
116 char *origpage = page;
117
118 down(&pvc_sem);
119 page += sprintf(page, "%d\n", scroll_dir * scroll_interval);
120 up(&pvc_sem);
121
122 return page - origpage;
123}
124
125
126void pvc_proc_timerfunc(unsigned long data)
127{
128 if (scroll_dir < 0)
129 pvc_move(DISPLAY|RIGHT);
130 else if (scroll_dir > 0)
131 pvc_move(DISPLAY|LEFT);
132
133 timer.expires = jiffies + scroll_interval;
134 add_timer(&timer);
135}
136
137static void pvc_proc_cleanup(void)
138{
139 int i;
140 for (i=0; i<PVC_NLINES; i++)
141 remove_proc_entry(pvc_linename[i], pvc_display_dir);
142 remove_proc_entry("scroll", pvc_display_dir);
143 remove_proc_entry(DISPLAY_DIR_NAME, NULL);
144
145 del_timer(&timer);
146}
147
148static int __init pvc_proc_init(void)
149{
150 struct proc_dir_entry *proc_entry;
151 int i;
152
153 pvc_display_dir = proc_mkdir(DISPLAY_DIR_NAME, NULL);
154 if (pvc_display_dir == NULL)
155 goto error;
156
157 for (i=0; i<PVC_NLINES; i++) {
158 strcpy(pvc_lines[i], "");
159 pvc_linedata[i] = i;
160 }
161 for (i=0; i<PVC_NLINES; i++) {
162 proc_entry = create_proc_entry(pvc_linename[i], 0644, pvc_display_dir);
163 if (proc_entry == NULL)
164 goto error;
165 proc_entry->read_proc = pvc_proc_read_line;
166 proc_entry->write_proc = pvc_proc_write_line;
167 proc_entry->data = &pvc_linedata[i];
168 }
169 proc_entry = create_proc_entry("scroll", 0644, pvc_display_dir);
170 if (proc_entry == NULL)
171 goto error;
172 proc_entry->write_proc = pvc_proc_write_scroll;
173 proc_entry->read_proc = pvc_proc_read_scroll;
174
175 init_timer(&timer);
176 timer.function = pvc_proc_timerfunc;
177
178 return 0;
179error:
180 pvc_proc_cleanup();
181 return -ENOMEM;
182}
183
184module_init(pvc_proc_init);
185module_exit(pvc_proc_cleanup);
186MODULE_LICENSE("GPL");
diff --git a/arch/mips/lasat/prom.c b/arch/mips/lasat/prom.c
deleted file mode 100644
index 812c6ac366be..000000000000
--- a/arch/mips/lasat/prom.c
+++ /dev/null
@@ -1,117 +0,0 @@
1/*
2 * PROM interface routines.
3 */
4#include <linux/types.h>
5#include <linux/init.h>
6#include <linux/string.h>
7#include <linux/ctype.h>
8#include <linux/kernel.h>
9#include <linux/mm.h>
10#include <linux/bootmem.h>
11#include <linux/ioport.h>
12#include <asm/bootinfo.h>
13#include <asm/lasat/lasat.h>
14#include <asm/cpu.h>
15
16#include "at93c.h"
17#include <asm/lasat/eeprom.h>
18#include "prom.h"
19
20#define RESET_VECTOR 0xbfc00000
21#define PROM_JUMP_TABLE_ENTRY(n) (*((u32 *)(RESET_VECTOR + 0x20) + n))
22#define PROM_DISPLAY_ADDR PROM_JUMP_TABLE_ENTRY(0)
23#define PROM_PUTC_ADDR PROM_JUMP_TABLE_ENTRY(1)
24#define PROM_MONITOR_ADDR PROM_JUMP_TABLE_ENTRY(2)
25
26static void null_prom_display(const char *string, int pos, int clear)
27{
28}
29
30static void null_prom_monitor(void)
31{
32}
33
34static void null_prom_putc(char c)
35{
36}
37
38/* these are functions provided by the bootloader */
39static void (* __prom_putc)(char c) = null_prom_putc;
40
41void prom_putchar(char c)
42{
43 __prom_putc(c);
44}
45
46void (* prom_display)(const char *string, int pos, int clear) =
47 null_prom_display;
48void (* prom_monitor)(void) = null_prom_monitor;
49
50unsigned int lasat_ndelay_divider;
51
52static void setup_prom_vectors(void)
53{
54 u32 version = *(u32 *)(RESET_VECTOR + 0x90);
55
56 if (version >= 307) {
57 prom_display = (void *)PROM_DISPLAY_ADDR;
58 __prom_putc = (void *)PROM_PUTC_ADDR;
59 prom_monitor = (void *)PROM_MONITOR_ADDR;
60 }
61 printk("prom vectors set up\n");
62}
63
64static struct at93c_defs at93c_defs[N_MACHTYPES] = {
65 {(void *)AT93C_REG_100, (void *)AT93C_RDATA_REG_100, AT93C_RDATA_SHIFT_100,
66 AT93C_WDATA_SHIFT_100, AT93C_CS_M_100, AT93C_CLK_M_100},
67 {(void *)AT93C_REG_200, (void *)AT93C_RDATA_REG_200, AT93C_RDATA_SHIFT_200,
68 AT93C_WDATA_SHIFT_200, AT93C_CS_M_200, AT93C_CLK_M_200},
69};
70
71void __init prom_init(void)
72{
73 int argc = fw_arg0;
74 char **argv = (char **) fw_arg1;
75
76 setup_prom_vectors();
77
78 if (current_cpu_data.cputype == CPU_R5000) {
79 printk("LASAT 200 board\n");
80 mips_machtype = MACH_LASAT_200;
81 lasat_ndelay_divider = LASAT_200_DIVIDER;
82 } else {
83 printk("LASAT 100 board\n");
84 mips_machtype = MACH_LASAT_100;
85 lasat_ndelay_divider = LASAT_100_DIVIDER;
86 }
87
88 at93c = &at93c_defs[mips_machtype];
89
90 lasat_init_board_info(); /* Read info from EEPROM */
91
92 mips_machgroup = MACH_GROUP_LASAT;
93
94 /* Get the command line */
95 if (argc > 0) {
96 strncpy(arcs_cmdline, argv[0], CL_SIZE-1);
97 arcs_cmdline[CL_SIZE-1] = '\0';
98 }
99
100 /* Set the I/O base address */
101 set_io_port_base(KSEG1);
102
103 /* Set memory regions */
104 ioport_resource.start = 0;
105 ioport_resource.end = 0xffffffff; /* Wrong, fixme. */
106
107 add_memory_region(0, lasat_board_info.li_memsize, BOOT_MEM_RAM);
108}
109
110void __init prom_free_prom_memory(void)
111{
112}
113
114const char *get_system_type(void)
115{
116 return lasat_board_info.li_bmstr;
117}
diff --git a/arch/mips/lasat/prom.h b/arch/mips/lasat/prom.h
deleted file mode 100644
index 019d45fbd268..000000000000
--- a/arch/mips/lasat/prom.h
+++ /dev/null
@@ -1,5 +0,0 @@
1#ifndef PROM_H
2#define PROM_H
3extern void (* prom_display)(const char *string, int pos, int clear);
4extern void (* prom_monitor)(void);
5#endif
diff --git a/arch/mips/lasat/reset.c b/arch/mips/lasat/reset.c
deleted file mode 100644
index 9e22acf03083..000000000000
--- a/arch/mips/lasat/reset.c
+++ /dev/null
@@ -1,69 +0,0 @@
1/*
2 * Thomas Horsten <thh@lasat.com>
3 * Copyright (C) 2000 LASAT Networks A/S.
4 *
5 * This program is free software; you can distribute it and/or modify it
6 * under the terms of the GNU General Public License (Version 2) as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 *
18 * Reset the LASAT board.
19 */
20#include <linux/kernel.h>
21#include <linux/pm.h>
22
23#include <asm/reboot.h>
24#include <asm/system.h>
25#include <asm/lasat/lasat.h>
26
27#include "picvue.h"
28#include "prom.h"
29
30static void lasat_machine_restart(char *command);
31static void lasat_machine_halt(void);
32
33/* Used to set machine to boot in service mode via /proc interface */
34int lasat_boot_to_service = 0;
35
36static void lasat_machine_restart(char *command)
37{
38 local_irq_disable();
39
40 if (lasat_boot_to_service) {
41 printk("machine_restart: Rebooting to service mode\n");
42 *(volatile unsigned int *)0xa0000024 = 0xdeadbeef;
43 *(volatile unsigned int *)0xa00000fc = 0xfedeabba;
44 }
45 *lasat_misc->reset_reg = 0xbedead;
46 for (;;) ;
47}
48
49#define MESSAGE "System halted"
50static void lasat_machine_halt(void)
51{
52 local_irq_disable();
53
54 /* Disable interrupts and loop forever */
55 printk(KERN_NOTICE MESSAGE "\n");
56#ifdef CONFIG_PICVUE
57 pvc_clear();
58 pvc_write_string(MESSAGE, 0, 0);
59#endif
60 prom_monitor();
61 for (;;) ;
62}
63
64void lasat_reboot_setup(void)
65{
66 _machine_restart = lasat_machine_restart;
67 _machine_halt = lasat_machine_halt;
68 pm_power_off = lasat_machine_halt;
69}
diff --git a/arch/mips/lasat/setup.c b/arch/mips/lasat/setup.c
deleted file mode 100644
index 488007f13988..000000000000
--- a/arch/mips/lasat/setup.c
+++ /dev/null
@@ -1,182 +0,0 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 1999 MIPS Technologies, Inc. All rights reserved.
4 *
5 * Thomas Horsten <thh@lasat.com>
6 * Copyright (C) 2000 LASAT Networks A/S.
7 *
8 * Brian Murphy <brian@murphy.dk>
9 *
10 * This program is free software; you can distribute it and/or modify it
11 * under the terms of the GNU General Public License (Version 2) as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 * for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * Lasat specific setup.
24 */
25#include <linux/init.h>
26#include <linux/sched.h>
27#include <linux/pci.h>
28#include <linux/interrupt.h>
29#include <linux/tty.h>
30#include <linux/serial.h>
31#include <linux/serial_core.h>
32
33#include <asm/time.h>
34#include <asm/cpu.h>
35#include <asm/bootinfo.h>
36#include <asm/irq.h>
37#include <asm/lasat/lasat.h>
38#include <asm/lasat/serial.h>
39
40#ifdef CONFIG_PICVUE
41#include <linux/notifier.h>
42#endif
43
44#include "ds1603.h"
45#include <asm/lasat/ds1603.h>
46#include <asm/lasat/picvue.h>
47#include <asm/lasat/eeprom.h>
48
49#include "prom.h"
50
51int lasat_command_line = 0;
52void lasatint_init(void);
53
54extern void lasat_reboot_setup(void);
55extern void pcisetup(void);
56extern void edhac_init(void *, void *, void *);
57extern void addrflt_init(void);
58
59struct lasat_misc lasat_misc_info[N_MACHTYPES] = {
60 {(void *)KSEG1ADDR(0x1c840000), (void *)KSEG1ADDR(0x1c800000), 2},
61 {(void *)KSEG1ADDR(0x11080000), (void *)KSEG1ADDR(0x11000000), 6}
62};
63
64struct lasat_misc *lasat_misc = NULL;
65
66#ifdef CONFIG_DS1603
67static struct ds_defs ds_defs[N_MACHTYPES] = {
68 { (void *)DS1603_REG_100, (void *)DS1603_REG_100,
69 DS1603_RST_100, DS1603_CLK_100, DS1603_DATA_100,
70 DS1603_DATA_SHIFT_100, 0, 0 },
71 { (void *)DS1603_REG_200, (void *)DS1603_DATA_REG_200,
72 DS1603_RST_200, DS1603_CLK_200, DS1603_DATA_200,
73 DS1603_DATA_READ_SHIFT_200, 1, 2000 }
74};
75#endif
76
77#ifdef CONFIG_PICVUE
78#include "picvue.h"
79static struct pvc_defs pvc_defs[N_MACHTYPES] = {
80 { (void *)PVC_REG_100, PVC_DATA_SHIFT_100, PVC_DATA_M_100,
81 PVC_E_100, PVC_RW_100, PVC_RS_100 },
82 { (void *)PVC_REG_200, PVC_DATA_SHIFT_200, PVC_DATA_M_200,
83 PVC_E_200, PVC_RW_200, PVC_RS_200 }
84};
85#endif
86
87static int lasat_panic_display(struct notifier_block *this,
88 unsigned long event, void *ptr)
89{
90#ifdef CONFIG_PICVUE
91 unsigned char *string = ptr;
92 if (string == NULL)
93 string = "Kernel Panic";
94 pvc_dump_string(string);
95#endif
96 return NOTIFY_DONE;
97}
98
99static int lasat_panic_prom_monitor(struct notifier_block *this,
100 unsigned long event, void *ptr)
101{
102 prom_monitor();
103 return NOTIFY_DONE;
104}
105
106static struct notifier_block lasat_panic_block[] =
107{
108 { lasat_panic_display, NULL, INT_MAX },
109 { lasat_panic_prom_monitor, NULL, INT_MIN }
110};
111
112static void lasat_time_init(void)
113{
114 mips_hpt_frequency = lasat_board_info.li_cpu_hz / 2;
115}
116
117void __init plat_timer_setup(struct irqaction *irq)
118{
119 change_c0_status(ST0_IM, IE_IRQ0 | IE_IRQ5);
120}
121
122#define DYNAMIC_SERIAL_INIT
123#ifdef DYNAMIC_SERIAL_INIT
124void __init serial_init(void)
125{
126#ifdef CONFIG_SERIAL_8250
127 struct uart_port s;
128
129 memset(&s, 0, sizeof(s));
130
131 s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
132 s.iotype = UPIO_MEM;
133
134 if (mips_machtype == MACH_LASAT_100) {
135 s.uartclk = LASAT_BASE_BAUD_100 * 16;
136 s.irq = LASATINT_UART_100;
137 s.regshift = LASAT_UART_REGS_SHIFT_100;
138 s.membase = (char *)KSEG1ADDR(LASAT_UART_REGS_BASE_100);
139 } else {
140 s.uartclk = LASAT_BASE_BAUD_200 * 16;
141 s.irq = LASATINT_UART_200;
142 s.regshift = LASAT_UART_REGS_SHIFT_200;
143 s.membase = (char *)KSEG1ADDR(LASAT_UART_REGS_BASE_200);
144 }
145
146 if (early_serial_setup(&s) != 0)
147 printk(KERN_ERR "Serial setup failed!\n");
148#endif
149}
150#endif
151
152void __init plat_mem_setup(void)
153{
154 int i;
155 lasat_misc = &lasat_misc_info[mips_machtype];
156#ifdef CONFIG_PICVUE
157 picvue = &pvc_defs[mips_machtype];
158#endif
159
160 /* Set up panic notifier */
161 for (i = 0; i < sizeof(lasat_panic_block) / sizeof(struct notifier_block); i++)
162 atomic_notifier_chain_register(&panic_notifier_list,
163 &lasat_panic_block[i]);
164
165 lasat_reboot_setup();
166
167 board_time_init = lasat_time_init;
168
169#ifdef CONFIG_DS1603
170 ds1603 = &ds_defs[mips_machtype];
171 rtc_mips_get_time = ds1603_read;
172 rtc_mips_set_time = ds1603_set;
173#endif
174
175#ifdef DYNAMIC_SERIAL_INIT
176 serial_init();
177#endif
178 /* Switch from prom exception handler to normal mode */
179 change_c0_status(ST0_BEV,0);
180
181 pr_info("Lasat specific initialization complete\n");
182}
diff --git a/arch/mips/lasat/sysctl.c b/arch/mips/lasat/sysctl.c
deleted file mode 100644
index 699ab1886ceb..000000000000
--- a/arch/mips/lasat/sysctl.c
+++ /dev/null
@@ -1,441 +0,0 @@
1/*
2 * Thomas Horsten <thh@lasat.com>
3 * Copyright (C) 2000 LASAT Networks A/S.
4 *
5 * This program is free software; you can distribute it and/or modify it
6 * under the terms of the GNU General Public License (Version 2) as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 *
18 * Routines specific to the LASAT boards
19 */
20#include <linux/types.h>
21#include <asm/lasat/lasat.h>
22
23#include <linux/module.h>
24#include <linux/sysctl.h>
25#include <linux/stddef.h>
26#include <linux/init.h>
27#include <linux/fs.h>
28#include <linux/ctype.h>
29#include <linux/string.h>
30#include <linux/net.h>
31#include <linux/inet.h>
32#include <linux/mutex.h>
33#include <asm/uaccess.h>
34
35#include "sysctl.h"
36#include "ds1603.h"
37
38static DEFINE_MUTEX(lasat_info_mutex);
39
40/* Strategy function to write EEPROM after changing string entry */
41int sysctl_lasatstring(ctl_table *table, int *name, int nlen,
42 void *oldval, size_t *oldlenp,
43 void *newval, size_t newlen)
44{
45 int r;
46 mutex_lock(&lasat_info_mutex);
47 r = sysctl_string(table, name,
48 nlen, oldval, oldlenp, newval, newlen);
49 if (r < 0) {
50 mutex_unlock(&lasat_info_mutex);
51 return r;
52 }
53 if (newval && newlen) {
54 lasat_write_eeprom_info();
55 }
56 mutex_unlock(&lasat_info_mutex);
57 return 1;
58}
59
60
61/* And the same for proc */
62int proc_dolasatstring(ctl_table *table, int write, struct file *filp,
63 void *buffer, size_t *lenp, loff_t *ppos)
64{
65 int r;
66 mutex_lock(&lasat_info_mutex);
67 r = proc_dostring(table, write, filp, buffer, lenp, ppos);
68 if ( (!write) || r) {
69 mutex_unlock(&lasat_info_mutex);
70 return r;
71 }
72 lasat_write_eeprom_info();
73 mutex_unlock(&lasat_info_mutex);
74 return 0;
75}
76
77/* proc function to write EEPROM after changing int entry */
78int proc_dolasatint(ctl_table *table, int write, struct file *filp,
79 void *buffer, size_t *lenp, loff_t *ppos)
80{
81 int r;
82 mutex_lock(&lasat_info_mutex);
83 r = proc_dointvec(table, write, filp, buffer, lenp, ppos);
84 if ( (!write) || r) {
85 mutex_unlock(&lasat_info_mutex);
86 return r;
87 }
88 lasat_write_eeprom_info();
89 mutex_unlock(&lasat_info_mutex);
90 return 0;
91}
92
93static int rtctmp;
94
95#ifdef CONFIG_DS1603
96/* proc function to read/write RealTime Clock */
97int proc_dolasatrtc(ctl_table *table, int write, struct file *filp,
98 void *buffer, size_t *lenp, loff_t *ppos)
99{
100 int r;
101 mutex_lock(&lasat_info_mutex);
102 if (!write) {
103 rtctmp = ds1603_read();
104 /* check for time < 0 and set to 0 */
105 if (rtctmp < 0)
106 rtctmp = 0;
107 }
108 r = proc_dointvec(table, write, filp, buffer, lenp, ppos);
109 if ( (!write) || r) {
110 mutex_unlock(&lasat_info_mutex);
111 return r;
112 }
113 ds1603_set(rtctmp);
114 mutex_unlock(&lasat_info_mutex);
115 return 0;
116}
117#endif
118
119/* Sysctl for setting the IP addresses */
120int sysctl_lasat_intvec(ctl_table *table, int *name, int nlen,
121 void *oldval, size_t *oldlenp,
122 void *newval, size_t newlen)
123{
124 int r;
125 mutex_lock(&lasat_info_mutex);
126 r = sysctl_intvec(table, name, nlen, oldval, oldlenp, newval, newlen);
127 if (r < 0) {
128 mutex_unlock(&lasat_info_mutex);
129 return r;
130 }
131 if (newval && newlen) {
132 lasat_write_eeprom_info();
133 }
134 mutex_unlock(&lasat_info_mutex);
135 return 1;
136}
137
138#ifdef CONFIG_DS1603
139/* Same for RTC */
140int sysctl_lasat_rtc(ctl_table *table, int *name, int nlen,
141 void *oldval, size_t *oldlenp,
142 void *newval, size_t newlen)
143{
144 int r;
145 mutex_lock(&lasat_info_mutex);
146 rtctmp = ds1603_read();
147 if (rtctmp < 0)
148 rtctmp = 0;
149 r = sysctl_intvec(table, name, nlen, oldval, oldlenp, newval, newlen);
150 if (r < 0) {
151 mutex_unlock(&lasat_info_mutex);
152 return r;
153 }
154 if (newval && newlen) {
155 ds1603_set(rtctmp);
156 }
157 mutex_unlock(&lasat_info_mutex);
158 return 1;
159}
160#endif
161
162#ifdef CONFIG_INET
163static char lasat_bcastaddr[16];
164
165void update_bcastaddr(void)
166{
167 unsigned int ip;
168
169 ip = (lasat_board_info.li_eeprom_info.ipaddr &
170 lasat_board_info.li_eeprom_info.netmask) |
171 ~lasat_board_info.li_eeprom_info.netmask;
172
173 sprintf(lasat_bcastaddr, "%d.%d.%d.%d",
174 (ip ) & 0xff,
175 (ip >> 8) & 0xff,
176 (ip >> 16) & 0xff,
177 (ip >> 24) & 0xff);
178}
179
180static char proc_lasat_ipbuf[32];
181/* Parsing of IP address */
182int proc_lasat_ip(ctl_table *table, int write, struct file *filp,
183 void *buffer, size_t *lenp, loff_t *ppos)
184{
185 int len;
186 unsigned int ip;
187 char *p, c;
188
189 if (!table->data || !table->maxlen || !*lenp ||
190 (*ppos && !write)) {
191 *lenp = 0;
192 return 0;
193 }
194
195 mutex_lock(&lasat_info_mutex);
196 if (write) {
197 len = 0;
198 p = buffer;
199 while (len < *lenp) {
200 if(get_user(c, p++)) {
201 mutex_unlock(&lasat_info_mutex);
202 return -EFAULT;
203 }
204 if (c == 0 || c == '\n')
205 break;
206 len++;
207 }
208 if (len >= sizeof(proc_lasat_ipbuf)-1)
209 len = sizeof(proc_lasat_ipbuf) - 1;
210 if (copy_from_user(proc_lasat_ipbuf, buffer, len))
211 {
212 mutex_unlock(&lasat_info_mutex);
213 return -EFAULT;
214 }
215 proc_lasat_ipbuf[len] = 0;
216 *ppos += *lenp;
217 /* Now see if we can convert it to a valid IP */
218 ip = in_aton(proc_lasat_ipbuf);
219 *(unsigned int *)(table->data) = ip;
220 lasat_write_eeprom_info();
221 } else {
222 ip = *(unsigned int *)(table->data);
223 sprintf(proc_lasat_ipbuf, "%d.%d.%d.%d",
224 (ip ) & 0xff,
225 (ip >> 8) & 0xff,
226 (ip >> 16) & 0xff,
227 (ip >> 24) & 0xff);
228 len = strlen(proc_lasat_ipbuf);
229 if (len > *lenp)
230 len = *lenp;
231 if (len)
232 if(copy_to_user(buffer, proc_lasat_ipbuf, len)) {
233 mutex_unlock(&lasat_info_mutex);
234 return -EFAULT;
235 }
236 if (len < *lenp) {
237 if(put_user('\n', ((char *) buffer) + len)) {
238 mutex_unlock(&lasat_info_mutex);
239 return -EFAULT;
240 }
241 len++;
242 }
243 *lenp = len;
244 *ppos += len;
245 }
246 update_bcastaddr();
247 mutex_unlock(&lasat_info_mutex);
248 return 0;
249}
250#endif /* defined(CONFIG_INET) */
251
252static int sysctl_lasat_eeprom_value(ctl_table *table, int *name, int nlen,
253 void *oldval, size_t *oldlenp,
254 void *newval, size_t newlen)
255{
256 int r;
257
258 mutex_lock(&lasat_info_mutex);
259 r = sysctl_intvec(table, name, nlen, oldval, oldlenp, newval, newlen);
260 if (r < 0) {
261 mutex_unlock(&lasat_info_mutex);
262 return r;
263 }
264
265 if (newval && newlen)
266 {
267 if (name && *name == LASAT_PRID)
268 lasat_board_info.li_eeprom_info.prid = *(int*)newval;
269
270 lasat_write_eeprom_info();
271 lasat_init_board_info();
272 }
273 mutex_unlock(&lasat_info_mutex);
274
275 return 0;
276}
277
278int proc_lasat_eeprom_value(ctl_table *table, int write, struct file *filp,
279 void *buffer, size_t *lenp, loff_t *ppos)
280{
281 int r;
282 mutex_lock(&lasat_info_mutex);
283 r = proc_dointvec(table, write, filp, buffer, lenp, ppos);
284 if ( (!write) || r) {
285 mutex_unlock(&lasat_info_mutex);
286 return r;
287 }
288 if (filp && filp->f_path.dentry)
289 {
290 if (!strcmp(filp->f_path.dentry->d_name.name, "prid"))
291 lasat_board_info.li_eeprom_info.prid = lasat_board_info.li_prid;
292 if (!strcmp(filp->f_path.dentry->d_name.name, "debugaccess"))
293 lasat_board_info.li_eeprom_info.debugaccess = lasat_board_info.li_debugaccess;
294 }
295 lasat_write_eeprom_info();
296 mutex_unlock(&lasat_info_mutex);
297 return 0;
298}
299
300extern int lasat_boot_to_service;
301
302#ifdef CONFIG_SYSCTL
303
304static ctl_table lasat_table[] = {
305 {
306 .ctl_name = CTL_UNNUMBERED,
307 .procname = "cpu-hz",
308 .data = &lasat_board_info.li_cpu_hz,
309 .maxlen = sizeof(int),
310 .mode = 0444,
311 .proc_handler = &proc_dointvec,
312 .strategy = &sysctl_intvec
313 },
314 {
315 .ctl_name = CTL_UNNUMBERED,
316 .procname = "bus-hz",
317 .data = &lasat_board_info.li_bus_hz,
318 .maxlen = sizeof(int),
319 .mode = 0444,
320 .proc_handler = &proc_dointvec,
321 .strategy = &sysctl_intvec
322 },
323 {
324 .ctl_name = CTL_UNNUMBERED,
325 .procname = "bmid",
326 .data = &lasat_board_info.li_bmid,
327 .maxlen = sizeof(int),
328 .mode = 0444,
329 .proc_handler = &proc_dointvec,
330 .strategy = &sysctl_intvec
331 },
332 {
333 .ctl_name = CTL_UNNUMBERED,
334 .procname = "prid",
335 .data = &lasat_board_info.li_prid,
336 .maxlen = sizeof(int),
337 .mode = 0644,
338 .proc_handler = &proc_lasat_eeprom_value,
339 .strategy = &sysctl_lasat_eeprom_value
340 },
341#ifdef CONFIG_INET
342 {
343 .ctl_name = CTL_UNNUMBERED,
344 .procname = "ipaddr",
345 .data = &lasat_board_info.li_eeprom_info.ipaddr,
346 .maxlen = sizeof(int),
347 .mode = 0644,
348 .proc_handler = &proc_lasat_ip,
349 .strategy = &sysctl_lasat_intvec
350 },
351 {
352 .ctl_name = LASAT_NETMASK,
353 .procname = "netmask",
354 .data = &lasat_board_info.li_eeprom_info.netmask,
355 .maxlen = sizeof(int),
356 .mode = 0644,
357 .proc_handler = &proc_lasat_ip,
358 .strategy = &sysctl_lasat_intvec
359 },
360 {
361 .ctl_name = CTL_UNNUMBERED,
362 .procname = "bcastaddr",
363 .data = &lasat_bcastaddr,
364 .maxlen = sizeof(lasat_bcastaddr),
365 .mode = 0600,
366 .proc_handler = &proc_dostring,
367 .strategy = &sysctl_string
368 },
369#endif
370 {
371 .ctl_name = CTL_UNNUMBERED,
372 .procname = "passwd_hash",
373 .data = &lasat_board_info.li_eeprom_info.passwd_hash,
374 .maxlen = sizeof(lasat_board_info.li_eeprom_info.passwd_hash),
375 .mode = 0600,
376 .proc_handler = &proc_dolasatstring,
377 .strategy = &sysctl_lasatstring
378 },
379 {
380 .ctl_name = CTL_UNNUMBERED,
381 .procname = "boot-service",
382 .data = &lasat_boot_to_service,
383 .maxlen = sizeof(int),
384 .mode = 0644,
385 .proc_handler = &proc_dointvec,
386 .strategy = &sysctl_intvec
387 },
388#ifdef CONFIG_DS1603
389 {
390 .ctl_name = CTL_UNNUMBERED,
391 .procname = "rtc",
392 .data = &rtctmp,
393 .maxlen = sizeof(int),
394 .mode = 0644,
395 .proc_handler = &proc_dolasatrtc,
396 .strategy = &sysctl_lasat_rtc
397 },
398#endif
399 {
400 .ctl_name = CTL_UNNUMBERED,
401 .procname = "namestr",
402 .data = &lasat_board_info.li_namestr,
403 .maxlen = sizeof(lasat_board_info.li_namestr),
404 .mode = 0444,
405 .proc_handler = &proc_dostring,
406 .strategy = &sysctl_string
407 },
408 {
409 .ctl_name = CTL_UNNUMBERED,
410 .procname = "typestr",
411 .data = &lasat_board_info.li_typestr,
412 .maxlen = sizeof(lasat_board_info.li_typestr),
413 .mode = 0444,
414 .proc_handler = &proc_dostring,
415 .strategy = &sysctl_string
416 },
417 {}
418};
419
420static ctl_table lasat_root_table[] = {
421 {
422 .ctl_name = CTL_UNNUMBERED,
423 .procname = "lasat",
424 .mode = 0555,
425 .child = lasat_table
426 },
427 {}
428};
429
430static int __init lasat_register_sysctl(void)
431{
432 struct ctl_table_header *lasat_table_header;
433
434 lasat_table_header =
435 register_sysctl_table(lasat_root_table);
436
437 return 0;
438}
439
440__initcall(lasat_register_sysctl);
441#endif /* CONFIG_SYSCTL */
diff --git a/arch/mips/lasat/sysctl.h b/arch/mips/lasat/sysctl.h
deleted file mode 100644
index 4d139d2adbdf..000000000000
--- a/arch/mips/lasat/sysctl.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/*
2 * LASAT sysctl values
3 */
4
5#ifndef _LASAT_SYSCTL_H
6#define _LASAT_SYSCTL_H
7
8/* /proc/sys/lasat */
9enum {
10 LASAT_CPU_HZ=1,
11 LASAT_BUS_HZ,
12 LASAT_MODEL,
13 LASAT_PRID,
14 LASAT_IPADDR,
15 LASAT_NETMASK,
16 LASAT_BCAST,
17 LASAT_PASSWORD,
18 LASAT_SBOOT,
19 LASAT_RTC,
20 LASAT_NAMESTR,
21 LASAT_TYPESTR,
22};
23
24#endif /* _LASAT_SYSCTL_H */