From: YAEGASHI T. <yae...@ma...> - 2000-06-06 10:35:12
|
Developers, Ok, here is the patch against linux-sh-2000-06-05.diff.gz from m17n.org, please review it. I'll appreciate all your coments and suggestions. Regards, -- YAEGASHI Takeshi <yae...@ma...> diff -ruN linux-2.4.0-test1.orig/ChangeLog linux/ChangeLog --- linux-2.4.0-test1.orig/ChangeLog Tue Jun 6 18:35:53 2000 +++ linux/ChangeLog Tue Jun 6 19:12:23 2000 @@ -1,3 +1,35 @@ +2000-06-06 YAEGASHI Takeshi <yae...@ma...> + + * include/asm-sh/linux_logo.h: Needed for the frame buffer console. + Would anyone design and contribute our logo? :-> + + * net/ipv4/ipconfig.c: Remove inclusion of <asm/segment.h>. + + * drivers/char/Makefile, include/asm-sh/keyboard.h, + drivers/char/scan_keyb.c, drivers/char/scan_keyb.h, + drivers/char/hp600_keyb.c: Add generic scan keyboard driver and + HP690 scan code table. + + * arch/sh/kernel/Makefile, arch/sh/kernel/hd64461.c, + include/asm-sh/hd64461.h, arch/sh/kernel/irq.c: Add support for + HD64461 companion chip. + + * drivers/video/Config.in, drivers/video/Makefile, + drivers/video/fbmem.c, drivers/video/hitfb.c: Add support for + HD64461 frame buffer. + + * drivers/char/vt.c: Add !defined(__sh__) to the #if conditionals to + avoid sys_ioperm(). + + * arch/sh/kernel/time.c, drivers/char/sh-sci.h, + include/asm-sh/ide.h: ad hoc work around for HP690... + + * arch/sh/config.in: introduce new configs: CONFIG_SH_HP600, + CONFIG_HD64461, and so on. + + * arch/sh/boot/compressed/Makefile: my kernel is now bigger than + 1MB... + 2000-06-02 NIIBE Yutaka <gn...@m1...> * arch/sh/kernel/entry.S (Throughout): Use ".align 2" instead diff -ruN linux-2.4.0-test1.orig/arch/sh/Makefile linux/arch/sh/Makefile --- linux-2.4.0-test1.orig/arch/sh/Makefile Tue Jun 6 18:35:53 2000 +++ linux/arch/sh/Makefile Tue Jun 6 17:38:52 2000 @@ -15,7 +15,7 @@ # # Select the object file format to substitute into the linker script. # -tool-prefix = sh-linux-gnu- +tool-prefix = sh-linux- ifdef CONFIG_LITTLE_ENDIAN CFLAGS += -ml diff -ruN linux-2.4.0-test1.orig/arch/sh/boot/compressed/Makefile linux/arch/sh/boot/compressed/Makefile --- linux-2.4.0-test1.orig/arch/sh/boot/compressed/Makefile Tue Jun 6 18:35:53 2000 +++ linux/arch/sh/boot/compressed/Makefile Tue Jun 6 17:36:10 2000 @@ -14,7 +14,7 @@ # # ZIMAGE_OFFSET is the load offset of the compression loader # -ZIMAGE_OFFSET = $(shell printf "0x%8x" $$[0x80000000+0x$(CONFIG_MEMORY_START)+0x100000]) +ZIMAGE_OFFSET = $(shell printf "0x%8x" $$[0x80000000+0x$(CONFIG_MEMORY_START)+0x200000]) ZLINKFLAGS = -Ttext $(ZIMAGE_OFFSET) $(ZLDFLAGS) diff -ruN linux-2.4.0-test1.orig/arch/sh/config.in linux/arch/sh/config.in --- linux-2.4.0-test1.orig/arch/sh/config.in Sun May 21 04:05:29 2000 +++ linux/arch/sh/config.in Tue Jun 6 17:36:10 2000 @@ -17,7 +17,8 @@ comment 'Processor type and features' choice 'SuperH system type' \ "Generic CONFIG_SH_GENERIC \ - SolutionEngine CONFIG_SH_SOLUTION_ENGINE" Generic + SolutionEngine CONFIG_SH_SOLUTION_ENGINE \ + HP600 CONFIG_SH_HP600" Generic choice 'Processor type' \ "SH7708 CONFIG_CPU_SUBTYPE_SH7708 \ @@ -61,8 +62,15 @@ bool 'Networking support' CONFIG_NET -if [ "$CONFIG_SH_SOLUTION_ENGINE" != "y" ]; then +if [ "$CONFIG_SH_SOLUTION_ENGINE" != "y" -a "$CONFIG_SH_HP600" != "y" ]; then bool 'Directly Connected Compact Flash support' CONFIG_CF_ENABLER +fi + +bool 'Hitachi HD64461 companion chip support' CONFIG_HD64461 +if [ "$CONFIG_HD64461" = "y" ]; then + hex 'HD64461 I/O base address' CONFIG_HD64461_IOBASE b0000000 + int 'HD64461 IRQ' CONFIG_HD64461_IRQ 36 + bool 'HD64461 PCMCIA enabler' CONFIG_HD64461_ENABLER fi bool 'PCI support' CONFIG_PCI diff -ruN linux-2.4.0-test1.orig/arch/sh/kernel/Makefile linux/arch/sh/kernel/Makefile --- linux-2.4.0-test1.orig/arch/sh/kernel/Makefile Sun May 21 04:05:29 2000 +++ linux/arch/sh/kernel/Makefile Tue Jun 6 17:36:10 2000 @@ -28,8 +28,16 @@ O_OBJS += setup_se.o io_se.o endif +ifdef CONFIG_SH_HP600 +O_OBJS += io_generic.o +endif + ifdef CONFIG_CPU_SH4 O_OBJS += fpu.o +endif + +ifdef CONFIG_HD64461 +O_OBJS += hd64461.o endif all: kernel.o head.o init_task.o diff -ruN linux-2.4.0-test1.orig/arch/sh/kernel/hd64461.c linux/arch/sh/kernel/hd64461.c --- linux-2.4.0-test1.orig/arch/sh/kernel/hd64461.c Thu Jan 1 09:00:00 1970 +++ linux/arch/sh/kernel/hd64461.c Tue Jun 6 17:36:10 2000 @@ -0,0 +1,126 @@ +/* + * $Id$ + * Copyright (C) 2000 YAEGASHI Takeshi + * Hitachi HD64461 companion chip support + */ + +#include <linux/config.h> +#include <linux/sched.h> +#include <linux/kernel.h> +#include <linux/param.h> +#include <linux/interrupt.h> +#include <linux/init.h> +#include <linux/irq.h> + +#include <asm/io.h> +#include <asm/irq.h> + +#include <asm/hd64461.h> + +static void disable_hd64461_irq(unsigned int irq) +{ + unsigned long flags; + unsigned short nimr; + unsigned short mask = 1 << (irq - HD64461_IRQBASE); + + save_and_cli(flags); + nimr = hd64461_inw(HD64461_NIMR); + nimr |= mask; + hd64461_outw(nimr, HD64461_NIMR); + restore_flags(flags); +} + + +static void enable_hd64461_irq(unsigned int irq) +{ + unsigned long flags; + unsigned short nimr; + unsigned short mask = 1 << (irq - HD64461_IRQBASE); + + save_and_cli(flags); + nimr = hd64461_inw(HD64461_NIMR); + nimr &= ~mask; + hd64461_outw(nimr, HD64461_NIMR); + restore_flags(flags); +} + + +static void mask_and_ack_hd64461(unsigned int irq) +{ + disable_hd64461_irq(irq); +#ifdef CONFIG_HD64461_ENABLER + if (irq == HD64461_IRQBASE + 13) + hd64461_outb(0x00, HD64461_PCC1CSCR); +#endif +} + + +static void end_hd64461_irq(unsigned int irq) +{ + enable_hd64461_irq(irq); +} + + +static unsigned int startup_hd64461_irq(unsigned int irq) +{ + enable_hd64461_irq(irq); + return 0; +} + + +static void shutdown_hd64461_irq(unsigned int irq) +{ + disable_hd64461_irq(irq); +} + + +static struct hw_interrupt_type hd64461_irq_type = { + "HD64461-IRQ", + startup_hd64461_irq, + shutdown_hd64461_irq, + enable_hd64461_irq, + disable_hd64461_irq, + mask_and_ack_hd64461, + end_hd64461_irq +}; + + +static void hd64461_interrupt(int irq, void *dev_id, struct pt_regs *regs) +{ + printk(KERN_INFO + "HD64461: spurious interrupt, nirr: 0x%lx nimr: 0x%lx\n", + hd64461_inw(HD64461_NIRR), hd64461_inw(HD64461_NIMR)); +} + + +static struct irqaction irq0 = { hd64461_interrupt, SA_INTERRUPT, 0, "HD64461", NULL, NULL}; + + +static void __init setup_hd64461(void) +{ + int i; + + printk(KERN_INFO "HD64461 at 0x%x on irq %d (%d - %d)\n", + CONFIG_HD64461_IOBASE, CONFIG_HD64461_IRQ, + HD64461_IRQBASE, HD64461_IRQBASE+15); +#if 1 + /* IRQ line for HD64461 should be set level trigger mode("10"). */ + /* And this should be done earlier than kernel starts. */ + ctrl_outw(0x0200, INTC_ICR1); /* when connected to IRQ4. */ +#endif + hd64461_outw(0xffff, HD64461_NIMR); + + for (i = HD64461_IRQBASE; i < HD64461_IRQBASE + 16; i++) { + irq_desc[i].handler = &hd64461_irq_type; + } + + setup_irq(CONFIG_HD64461_IRQ, &irq0); + +#ifdef CONFIG_HD64461_ENABLER + printk(KERN_INFO "HD64461: enabling PCMCIA devices\n"); + hd64461_outb(0x04, HD64461_PCC1CSCIER); + hd64461_outb(0x00, HD64461_PCC1CSCR); +#endif +} + +module_init(setup_hd64461); diff -ruN linux-2.4.0-test1.orig/arch/sh/kernel/irq.c linux/arch/sh/kernel/irq.c --- linux-2.4.0-test1.orig/arch/sh/kernel/irq.c Mon May 22 12:55:06 2000 +++ linux/arch/sh/kernel/irq.c Tue Jun 6 17:36:10 2000 @@ -37,6 +37,9 @@ #include <asm/irq.h> #include <linux/irq.h> +#ifdef CONFIG_HD64461 +#include <asm/hd64461.h> +#endif unsigned int local_bh_count[NR_CPUS]; unsigned int local_irq_count[NR_CPUS]; @@ -243,6 +246,18 @@ "shlr %0\n\t" "add #-16, %0\n\t" :"=z" (irq)); +#if defined(CONFIG_HD64461) + if (irq == CONFIG_HD64461_IRQ) { + unsigned short bit=1; + unsigned short nirr = hd64461_inw(HD64461_NIRR); + unsigned short nimr = hd64461_inw(HD64461_NIMR); + nirr &= ~nimr; + for (bit = 1, irq = 0; irq < 16; bit <<= 1, irq++) + if (nirr & bit) break; + if (irq == 16) irq = CONFIG_HD64461_IRQ; + else irq += HD64461_IRQBASE; + } +#endif kstat.irqs[cpu][irq]++; desc = irq_desc + irq; diff -ruN linux-2.4.0-test1.orig/arch/sh/kernel/time.c linux/arch/sh/kernel/time.c --- linux-2.4.0-test1.orig/arch/sh/kernel/time.c Sun May 21 04:05:29 2000 +++ linux/arch/sh/kernel/time.c Tue Jun 6 17:38:38 2000 @@ -421,7 +421,11 @@ tmp = (frqcr & 0x2000) >> 11; tmp |= frqcr & 0x0003; pfc = pfc_table[tmp]; +#ifdef CONFIG_SH_HP600 + master_clock = cpu_clock/6; +#else master_clock = cpu_clock; +#endif bus_clock = master_clock/pfc; } #elif defined(__SH4__) diff -ruN linux-2.4.0-test1.orig/drivers/char/Makefile linux/drivers/char/Makefile --- linux-2.4.0-test1.orig/drivers/char/Makefile Sun May 21 04:07:56 2000 +++ linux/drivers/char/Makefile Tue Jun 6 17:36:10 2000 @@ -73,6 +73,11 @@ KEYBD = CONSOLE = SERIAL = + ifeq ($(CONFIG_SH_HP600),y) + KEYMAP = defkeymap.o + KEYBD = scan_keyb.o hp600_keyb.o + CONSOLE = console.o + endif ifeq ($(CONFIG_SERIAL),y) SERIAL = generic_serial.o sh-sci.o else diff -ruN linux-2.4.0-test1.orig/drivers/char/hp600_keyb.c linux/drivers/char/hp600_keyb.c --- linux-2.4.0-test1.orig/drivers/char/hp600_keyb.c Thu Jan 1 09:00:00 1970 +++ linux/drivers/char/hp600_keyb.c Tue Jun 6 17:36:10 2000 @@ -0,0 +1,119 @@ +/* + * $Id$ + * Copyright (C) 2000 YAEGASHI Takeshi + * HP600 keyboard scan routine and translate table + */ + +#include <linux/kernel.h> +#include <linux/init.h> +#include <asm/io.h> +#include "scan_keyb.h" + +#define PCDR 0xa4000124 +#define PDDR 0xa4000126 +#define PEDR 0xa4000128 +#define PFDR 0xa400012a +#define PGDR 0xa400012c +#define PHDR 0xa400012e + +static const unsigned char hp690_japanese_table[]={ + 0x00, 0x00, 0x00, 0x01, 0x00, 0x29, 0x70, 0x3a, + 0x3f, 0x3e, 0x40, 0x41, 0x42, 0x3d, 0x3c, 0x3b, + + 0x00, 0x00, 0x00, 0x2c, 0x00, 0x1c, 0x28, 0x35, + 0x31, 0x30, 0x32, 0x33, 0x34, 0x2f, 0x2e, 0x2d, + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x50, + 0x7b, 0x38, 0x00, 0x00, 0x4b, 0x00, 0x00, 0x00, + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xf9, 0x73, 0x53, 0x39, 0x00, 0x1d, + + 0x00, 0x00, 0x00, 0x1e, 0x00, 0x2b, 0x1b, 0x27, + 0x23, 0x22, 0x24, 0x25, 0x26, 0x21, 0x20, 0x1f, + + 0x00, 0x00, 0x00, 0x0f, 0x00, 0x36, 0x7d, 0x48, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, + + 0x00, 0x00, 0x00, 0x10, 0x00, 0x0e, 0x1a, 0x19, + 0x15, 0x14, 0x16, 0x17, 0x18, 0x13, 0x12, 0x11, + + 0x00, 0x00, 0x00, 0x02, 0x00, 0x0d, 0x0c, 0x0b, + 0x07, 0x06, 0x08, 0x09, 0x0a, 0x05, 0x04, 0x03, + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + + +static void hp690_japanese_scan_kbd(unsigned char *s) +{ + ctrl_outb(0xfd, PDDR); ctrl_outb(0xff, PEDR); + *s++=ctrl_inb(PCDR); *s++=ctrl_inb(PFDR); + ctrl_outb(0xdf, PDDR); ctrl_outb(0xff, PEDR); + *s++=ctrl_inb(PCDR); *s++=ctrl_inb(PFDR); + ctrl_outb(0x7f, PDDR); ctrl_outb(0xff, PEDR); + *s++=ctrl_inb(PCDR); *s++=ctrl_inb(PFDR); + ctrl_outb(0xff, PDDR); ctrl_outb(0xfe, PEDR); + *s++=ctrl_inb(PCDR); *s++=ctrl_inb(PFDR); + ctrl_outb(0xff, PDDR); ctrl_outb(0xfd, PEDR); + *s++=ctrl_inb(PCDR); *s++=ctrl_inb(PFDR); + ctrl_outb(0xff, PDDR); ctrl_outb(0xf7, PEDR); + *s++=ctrl_inb(PCDR); *s++=ctrl_inb(PFDR); + ctrl_outb(0xff, PDDR); ctrl_outb(0xbf, PEDR); + *s++=ctrl_inb(PCDR); *s++=ctrl_inb(PFDR); + ctrl_outb(0xff, PDDR); ctrl_outb(0x7f, PEDR); + *s++=ctrl_inb(PCDR); *s++=ctrl_inb(PFDR); + *s++=ctrl_inb(PGDR); *s++=ctrl_inb(PHDR); +} + + +void __init hp600_kbd_init_hw(void) +{ + scan_kbd_init(); + register_scan_keyboard(hp690_japanese_scan_kbd, + hp690_japanese_table, 18); + printk(KERN_INFO "HP600 matrix scan keyboard registered\n"); +} + + +/**************************************************************** +HP Jornada 690(Japanese version) keyboard scan matrix + + PTC7 PTC6 PTC5 PTC4 PTC3 PTC2 PTC1 PTC0 +PTD1 REC Escape on/off Han/Zen Hira Eisu +PTD5 REC Z on/off Enter : / +PTD7 REC Right Down +PTE0 REC Windows on/off +PTE1 REC A on/off ] [ ; +PTE3 REC Tab on/off ShirtR \ Up +PTE6 REC Q on/off BS @ P +PTE7 REC 1 on/off ^ - 0 + + + PTF7 PTF6 PTF5 PTF4 PTF3 PTF2 PTF1 PTF0 +PTD1 F5 F4 F6 F7 F8 F3 F2 F1 +PTD5 N B M , . V C X +PTD7 Muhen Alt Left +PTE0 Henkan _ Del Space Ctrl +PTE1 H G J K L F D S +PTE3 ShiftL +PTE6 Y T U I O R E W +PTE7 6 5 7 8 9 4 3 2 + + PTG5 PTG4 PTG3 PTG0 PTH0 +* REC REW FWW Cover on/off + + + 7 6 5 4 3 2 1 0 +C: 0xffff 0xdf IP IP IP IP IP IP IP IP +D: 0x6786 0x59 O I O IP I F O I +E: 0x5045 0x00 O O F F O F O O +F: 0xffff 0xff IP IP IP IP IP IP IP IP +G: 0xaffe 0xfd I I IP IP IP IP IP I +H: 0x70f2 0x49 O IP F F IP IP F I +J: 0x0704 0x22 F F O IP F F O F +K: 0x0100 0x10 F F F O F F F F +L: 0x0c3c 0x26 F F IP F F IP IP F + +****************************************************************/ diff -ruN linux-2.4.0-test1.orig/drivers/char/scan_keyb.c linux/drivers/char/scan_keyb.c --- linux-2.4.0-test1.orig/drivers/char/scan_keyb.c Thu Jan 1 09:00:00 1970 +++ linux/drivers/char/scan_keyb.c Tue Jun 6 17:37:17 2000 @@ -0,0 +1,129 @@ +/* + * $Id$ + * Copyright (C) 2000 YAEGASHI Takeshi + * Generic scan keyboard driver + */ + +#include <linux/config.h> + +#include <linux/spinlock.h> +#include <linux/sched.h> +#include <linux/interrupt.h> +#include <linux/tty.h> +#include <linux/mm.h> +#include <linux/signal.h> +#include <linux/init.h> +#include <linux/kbd_ll.h> +#include <linux/delay.h> +#include <linux/random.h> +#include <linux/poll.h> +#include <linux/miscdevice.h> +#include <linux/malloc.h> +#include <linux/kbd_kern.h> + +struct scan_keyboard { + struct scan_keyboard *next; + void (*scan)(unsigned char *buffer); + const unsigned char *table; + unsigned char *s0, *s1; + int length; +}; + +static struct scan_keyboard *keyboards=NULL; +static struct tq_struct task_scan_kbd; + +static void check_kbd(const unsigned char *table, + unsigned char *new, unsigned char *old, int length) +{ + int need_tasklet_schedule=0; + unsigned char xor, bit; + + while(length-->0) { + if((xor=*new^*old)==0) { + table+=8; + } + else { + for(bit=0x80; bit!=0; bit>>=1) { + if(xor&bit) { + handle_scancode(*table, !(*new&bit)); + need_tasklet_schedule=1; + } + table++; + } + } + new++; old++; + } + + if(need_tasklet_schedule) + tasklet_schedule(&keyboard_tasklet); +} + + +static void scan_kbd(void *dummy) +{ + struct scan_keyboard *kbd; + + for(kbd=keyboards; kbd!=NULL; kbd=kbd->next) { + if(jiffies&1) { + kbd->scan(kbd->s0); + check_kbd(kbd->table, kbd->s0, kbd->s1, kbd->length); + } + else { + kbd->scan(kbd->s1); + check_kbd(kbd->table, kbd->s1, kbd->s0, kbd->length); + } + + } + queue_task(&task_scan_kbd, &tq_timer); +} + + +int register_scan_keyboard(void (*scan)(unsigned char *buffer), + const unsigned char *table, + int length) +{ + struct scan_keyboard *kbd; + + if((kbd=kmalloc(sizeof(struct scan_keyboard), GFP_KERNEL))==NULL) + goto error_out; + + kbd->scan=scan; + kbd->table=table; + kbd->length=length; + + kbd->s0=kbd->s1=NULL; + if((kbd->s0=kmalloc(length, GFP_KERNEL))==NULL) + goto error_out; + if((kbd->s1=kmalloc(length, GFP_KERNEL))==NULL) + goto error_out; + + kbd->scan(kbd->s0); + kbd->scan(kbd->s1); + + kbd->next=keyboards; + keyboards=kbd; + + return 0; + + error_mem_free: + if(kbd->s0) + kfree(kbd->s0); + if(kbd->s1) + kfree(kbd->s1); + kfree(kbd); + + error_out: + return -ENOMEM; +} + + +void __init scan_kbd_init(void) +{ + + task_scan_kbd.next=NULL; + task_scan_kbd.sync=0; + task_scan_kbd.routine=scan_kbd; + task_scan_kbd.data=NULL; + queue_task(&task_scan_kbd, &tq_timer); + printk(KERN_INFO "Generic scan keyboard driver initialized\n"); +} diff -ruN linux-2.4.0-test1.orig/drivers/char/scan_keyb.h linux/drivers/char/scan_keyb.h --- linux-2.4.0-test1.orig/drivers/char/scan_keyb.h Thu Jan 1 09:00:00 1970 +++ linux/drivers/char/scan_keyb.h Tue Jun 6 17:36:10 2000 @@ -0,0 +1,15 @@ +#ifndef __DRIVER_CHAR_SCAN_KEYB_H +#define __DRIVER_CHAR_SCAN_KEYB_H +/* + * $Id$ + * Copyright (C) 2000 YAEGASHI Takeshi + * Generic scan keyboard driver + */ + +int register_scan_keyboard(void (*scan)(unsigned char *buffer), + const unsigned char *table, + int length); + +void __init scan_kbd_init(void); + +#endif diff -ruN linux-2.4.0-test1.orig/drivers/char/sh-sci.h linux/drivers/char/sh-sci.h --- linux-2.4.0-test1.orig/drivers/char/sh-sci.h Tue Jun 6 18:35:53 2000 +++ linux/drivers/char/sh-sci.h Tue Jun 6 17:42:41 2000 @@ -202,7 +202,11 @@ */ #if defined(__sh3__) #if defined(CONFIG_CPU_SUBTYPE_SH7709) +#ifdef CONFIG_SH_HP600 +#define PCLK 22222222 +#else #define PCLK 33333333 +#endif #else #define PCLK 14745600 /* Isn't it 15MHz? */ #endif diff -ruN linux-2.4.0-test1.orig/drivers/char/vt.c linux/drivers/char/vt.c --- linux-2.4.0-test1.orig/drivers/char/vt.c Wed May 3 08:48:16 2000 +++ linux/drivers/char/vt.c Tue Jun 6 17:36:10 2000 @@ -62,7 +62,7 @@ */ unsigned char keyboard_type = KB_101; -#if !defined(__alpha__) && !defined(__mips__) && !defined(__arm__) +#if !defined(__alpha__) && !defined(__mips__) && !defined(__arm__) && !defined(__sh__) asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int on); #endif @@ -472,7 +472,7 @@ ucval = keyboard_type; goto setchar; -#if !defined(__alpha__) && !defined(__mips__) && !defined(__arm__) +#if !defined(__alpha__) && !defined(__mips__) && !defined(__arm__) && !defined(__sh__) /* * These cannot be implemented on any machine that implements * ioperm() in user level (such as Alpha PCs). diff -ruN linux-2.4.0-test1.orig/drivers/video/Config.in linux/drivers/video/Config.in --- linux-2.4.0-test1.orig/drivers/video/Config.in Thu May 25 10:38:26 2000 +++ linux/drivers/video/Config.in Tue Jun 6 17:36:10 2000 @@ -155,6 +155,9 @@ fi fi fi + if [ "$CONFIG_HD64461" = "y" ]; then + tristate ' HD64461 Frame Buffer support' CONFIG_FB_HIT + fi if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then tristate ' Virtual Frame Buffer support (ONLY FOR TESTING!)' CONFIG_FB_VIRTUAL fi diff -ruN linux-2.4.0-test1.orig/drivers/video/Makefile linux/drivers/video/Makefile --- linux-2.4.0-test1.orig/drivers/video/Makefile Thu May 25 10:38:26 2000 +++ linux/drivers/video/Makefile Tue Jun 6 17:36:10 2000 @@ -115,6 +115,7 @@ obj-$(CONFIG_FB_HGA) += hgafb.o obj-$(CONFIG_FB_SA1100) += sa1100fb.o obj-$(CONFIG_FB_VIRTUAL) += vfb.o +obj-$(CONFIG_FB_HIT) += hitfb.o fbgen.o # Generic Low Level Drivers diff -ruN linux-2.4.0-test1.orig/drivers/video/fbmem.c linux/drivers/video/fbmem.c --- linux-2.4.0-test1.orig/drivers/video/fbmem.c Fri May 26 01:35:27 2000 +++ linux/drivers/video/fbmem.c Tue Jun 6 17:36:52 2000 @@ -61,6 +61,8 @@ extern int retz3fb_setup(char*); extern int clgenfb_init(void); extern int clgenfb_setup(char*); +extern int hitfb_init(void); +extern int hitfb_setup(char*); extern int vfb_init(void); extern int vfb_setup(char*); extern int offb_init(void); @@ -229,6 +231,9 @@ #ifdef CONFIG_FB_SUN3 { "sun3", sun3fb_init, sun3fb_setup }, #endif +#ifdef CONFIG_FB_HIT + { "hitfb", hitfb_init, hitfb_setup }, +#endif #ifdef CONFIG_GSP_RESOLVER /* Not a real frame buffer device... */ { "resolver", NULL, resolver_video_setup }, @@ -528,6 +533,8 @@ */ pgprot_val(vma->vm_page_prot) &= ~(PTE_CACHEABLE | PTE_BUFFERABLE); #endif +#elif defined(__sh__) + pgprot_val(vma->vm_page_prot) &= ~_PAGE_CACHABLE; #else #warning What do we have to do here?? #endif diff -ruN linux-2.4.0-test1.orig/drivers/video/hitfb.c linux/drivers/video/hitfb.c --- linux-2.4.0-test1.orig/drivers/video/hitfb.c Thu Jan 1 09:00:00 1970 +++ linux/drivers/video/hitfb.c Tue Jun 6 17:36:10 2000 @@ -0,0 +1,364 @@ +/* + * $Id: hitfb.c,v 1.1 2000/03/24 04:03:06 keshi Exp $ + * linux/drivers/video/hitfb.c -- Hitachi LCD frame buffer device + * (C) 1999 Mihai Spatar + * (C) 2000 YAEGASHI Takeshi + * + * 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 archive for + * more details. + */ + +#include <linux/module.h> +#include <linux/kernel.h> +#include <linux/sched.h> +#include <linux/errno.h> +#include <linux/string.h> +#include <linux/mm.h> +#include <linux/tty.h> +#include <linux/malloc.h> +#include <linux/delay.h> +#include <linux/nubus.h> +#include <linux/init.h> + +#include <asm/uaccess.h> +#include <asm/pgtable.h> +#include <asm/io.h> + +#include <linux/fb.h> + +#include <video/fbcon.h> +#include <video/fbcon-cfb8.h> +#include <video/fbcon-cfb16.h> + +#include <asm/hd64461.h> + +#define CONFIG_SH_LCD_VIDEOBASE (CONFIG_HD64461_IOBASE+0x2000000) +#define CONFIG_SH_LCD_VIDEOSIZE 1024*1024 +#define CONFIG_SH_LCD_HORZ 640 +#define CONFIG_SH_LCD_VERT 240 +#define CONFIG_SH_LCD_DEFAULTBPP 16 + +struct hitfb_info { + struct fb_info_gen gen; +}; + +struct hitfb_par +{ + int x, y; + int bpp; +}; + +static struct hitfb_info fb_info; +static struct hitfb_par current_par; +static int current_par_valid = 0; +static struct display disp; + +static union { +#ifdef FBCON_HAS_CFB16 + u16 cfb16[16]; +#endif +} fbcon_cmap; + +unsigned long hit_videobase, hit_videosize; +static struct fb_var_screeninfo default_var; + +int hitfb_init(void); +int hitfb_setup(char*); + +static void hitfb_set_par(struct hitfb_par *par, const struct fb_info *info); +static void hitfb_encode_var(struct fb_var_screeninfo *var, + struct hitfb_par *par, + const struct fb_info *info); + + +static void hitfb_detect(void) +{ + struct hitfb_par par; + + hit_videobase=CONFIG_SH_LCD_VIDEOBASE; + hit_videosize=CONFIG_SH_LCD_VIDEOSIZE; + par.x=CONFIG_SH_LCD_HORZ; + par.y=CONFIG_SH_LCD_VERT; + par.bpp=CONFIG_SH_LCD_DEFAULTBPP; + + hitfb_set_par(&par, NULL); + hitfb_encode_var(&default_var, &par, NULL); +} + +static int hitfb_encode_fix(struct fb_fix_screeninfo *fix, + struct hitfb_par *par, + const struct fb_info *info) +{ + memset(fix, 0, sizeof(struct fb_fix_screeninfo)); + strcpy(fix->id, "Hitachi HD64461"); + fix->smem_start=hit_videobase; + fix->smem_len=hit_videosize; + fix->type = FB_TYPE_PACKED_PIXELS; + fix->type_aux = 0; + fix->visual = FB_VISUAL_TRUECOLOR; + fix->xpanstep=0; + fix->ypanstep=0; + fix->ywrapstep=0; + switch(par->bpp) { + default: + case 8: + fix->line_length=par->x; + case 16: + fix->line_length=par->x*2; + } + return 0; +} + + +static int hitfb_decode_var(struct fb_var_screeninfo *var, + struct hitfb_par *par, + const struct fb_info *info) +{ + par->x=var->xres; + par->y=var->yres; + par->bpp=var->bits_per_pixel; + return 0; +} + + +static void hitfb_encode_var(struct fb_var_screeninfo *var, + struct hitfb_par *par, + const struct fb_info *info) +{ + memset(var, 0, sizeof(*var)); + var->xres=par->x; + var->yres=par->y; + var->xres_virtual=var->xres; + var->yres_virtual=var->yres; + var->xoffset=0; + var->yoffset=0; + var->bits_per_pixel=par->bpp; + var->grayscale=0; + var->transp.offset=0; + var->transp.length=0; + var->transp.msb_right=0; + var->nonstd=0; + var->activate=0; + var->height= -1; + var->width= -1; + var->vmode=FB_VMODE_NONINTERLACED; + var->pixclock=0; + var->sync=0; + var->left_margin=0; + var->right_margin=0; + var->upper_margin=0; + var->lower_margin=0; + var->hsync_len=0; + var->vsync_len=0; + + switch (var->bits_per_pixel) { + case 8: + var->red.offset = 0; + var->red.length = 8; + var->green.offset = 0; + var->green.length = 8; + var->blue.offset = 0; + var->blue.length = 8; + var->transp.offset = 0; + var->transp.length = 0; + break; + case 16: /* RGB 565 */ + var->red.offset = 11; + var->red.length = 5; + var->green.offset = 5; + var->green.length = 6; + var->blue.offset = 0; + var->blue.length = 5; + var->transp.offset = 0; + var->transp.length = 0; + break; + } + var->red.msb_right = 0; + var->green.msb_right = 0; + var->blue.msb_right = 0; + var->transp.msb_right = 0; +} + + +static void hitfb_get_par(struct hitfb_par *par, const struct fb_info *info) +{ + *par = current_par; +} + + +static void hitfb_set_par(struct hitfb_par *par, const struct fb_info *info) +{ + /* + * Set the hardware according to 'par'. + */ + current_par=*par; + current_par_valid=1; +} + + +static int hitfb_getcolreg(u_int regno, u_int *red, u_int *green, u_int *blue, + u_int *transp, struct fb_info *info) +{ + if (regno > 255) + return 1; + hd64461_outw(regno<<8, HD64461_CPTRAR); + *red = hd64461_inw(HD64461_CPTRDR)<<10; + *green = hd64461_inw(HD64461_CPTRDR)<<10; + *blue = hd64461_inw(HD64461_CPTRDR)<<10; + *transp = 0; + + return 0; +} + + +static int hitfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, + u_int transp, struct fb_info *info) +{ + if (regno > 255) + return 1; + + hd64461_outw(regno<<8, HD64461_CPTWAR); + hd64461_outw(red>>10, HD64461_CPTWDR); + hd64461_outw(green>>10, HD64461_CPTWDR); + hd64461_outw(blue>>10, HD64461_CPTWDR); + + if(regno<16) { + switch(current_par.bpp) { +#ifdef FBCON_HAS_CFB16 + case 16: + fbcon_cmap.cfb16[regno] = + ((red & 0xf800) ) | + ((green & 0xfc00) >> 5) | + ((blue & 0xf800) >> 11); + break; +#endif + } + } + return 0; +} + +static int hitfb_pan_display(struct fb_var_screeninfo *var, + struct hitfb_par *par, const struct fb_info *info) +{ + return 0; +} + + +static int hitfb_blank(int blank_mode, const struct fb_info *info) +{ + return 0; +} + + +static void hitfb_set_disp(const void *par, struct display *disp, + struct fb_info_gen *info) +{ + disp->screen_base = (void *)hit_videobase; + switch(((struct hitfb_par *)par)->bpp) { +#ifdef FBCON_HAS_CFB8 + case 8: + disp->dispsw = &fbcon_cfb8; + break; +#endif +#ifdef FBCON_HAS_CFB16 + case 16: + disp->dispsw = &fbcon_cfb16; + disp->dispsw_data = fbcon_cmap.cfb16; + break; +#endif + default: + disp->dispsw = &fbcon_dummy; + } +} + + +struct fbgen_hwswitch hitfb_switch = { + hitfb_detect, + hitfb_encode_fix, + hitfb_decode_var, + hitfb_encode_var, + hitfb_get_par, + hitfb_set_par, + hitfb_getcolreg, + hitfb_setcolreg, + hitfb_pan_display, + hitfb_blank, + hitfb_set_disp +}; + + +static int hitfb_open(const struct fb_info *info, int user) +{ + MOD_INC_USE_COUNT; + return 0; +} + + +static int hitfb_release(const struct fb_info *info, int user) +{ + MOD_DEC_USE_COUNT; + return 0; +} + + +static struct fb_ops hitfb_ops = { + hitfb_open, hitfb_release, fbgen_get_fix, fbgen_get_var, fbgen_set_var, + fbgen_get_cmap, fbgen_set_cmap, fbgen_pan_display, fbgen_ioctl +}; + + +int __init hitfb_init(void) +{ + strcpy(fb_info.gen.info.modename, "Hitachi HD64461"); + fb_info.gen.info.node = -1; + fb_info.gen.info.flags = FBINFO_FLAG_DEFAULT; + fb_info.gen.info.fbops = &hitfb_ops; + fb_info.gen.info.disp = &disp; + fb_info.gen.info.changevar = NULL; + fb_info.gen.info.switch_con = &fbgen_switch; + fb_info.gen.info.updatevar = &fbgen_update_var; + fb_info.gen.info.blank = &fbgen_blank; + fb_info.gen.parsize = sizeof(struct hitfb_par); + fb_info.gen.fbhw = &hitfb_switch; + fb_info.gen.fbhw->detect(); + + fbgen_get_var(&disp.var, -1, &fb_info.gen.info); + disp.var.activate = FB_ACTIVATE_NOW; + fbgen_do_set_var(&disp.var, 1, &fb_info.gen); + fbgen_set_disp(-1, &fb_info.gen); + fbgen_install_cmap(0, &fb_info.gen); + + if(register_framebuffer(&fb_info.gen.info)<0) return -EINVAL; + + printk(KERN_INFO "fb%d: %s frame buffer device\n", + GET_FB_IDX(fb_info.gen.info.node), fb_info.gen.info.modename); + + return 0; +} + + +void hitfb_cleanup(struct fb_info *info) +{ + unregister_framebuffer(info); +} + + +int __init hitfb_setup(char *options) +{ + /* */ + return 0; +} + + +#ifdef MODULE +int init_module(void) +{ + return hitfb_init(); +} + +void cleanup_module(void) +{ + hitfb_cleanup(void); +} +#endif /* MODULE */ diff -ruN linux-2.4.0-test1.orig/include/asm-sh/hd64461.h linux/include/asm-sh/hd64461.h --- linux-2.4.0-test1.orig/include/asm-sh/hd64461.h Thu Jan 1 09:00:00 1970 +++ linux/include/asm-sh/hd64461.h Tue Jun 6 17:42:55 2000 @@ -0,0 +1,58 @@ +#ifndef __ASM_SH_HD64461 +#define __ASM_SH_HD64461 +/* + * $Id$ + * Copyright (C) 2000 YAEGASHI Takeshi + * Hitachi HD64461 companion chip support + */ + +#define HD64461_CPTWAR 0x1030 +#define HD64461_CPTWDR 0x1032 +#define HD64461_CPTRAR 0x1034 +#define HD64461_CPTRDR 0x1036 + +#define HD64461_PCC0ISR 0x2000 +#define HD64461_PCC0GCR 0x2002 +#define HD64461_PCC0CSCR 0x2004 +#define HD64461_PCC0CSCIER 0x2006 +#define HD64461_PCC0SCR 0x2008 +#define HD64461_PCC1ISR 0x2010 +#define HD64461_PCC1GCR 0x2012 +#define HD64461_PCC1CSCR 0x2014 +#define HD64461_PCC1CSCIER 0x2016 +#define HD64461_PCC1SCR 0x2018 +#define HD64461_P0OCR 0x202a +#define HD64461_P1OCR 0x202c +#define HD64461_PGCR 0x202e + +#define HD64461_NIRR 0x5000 +#define HD64461_NIMR 0x5002 + +#ifndef CONFIG_HD64461_IOBASE +#define CONFIG_HD64461_IOBASE 0xb0000000 +#endif + +#define HD64461_IRQBASE 64 + + +static __inline__ unsigned long hd64461_inb(unsigned int port) +{ + return *(volatile unsigned char *)(CONFIG_HD64461_IOBASE+port); +} + +static __inline__ unsigned long hd64461_inw(unsigned int port) +{ + return *(volatile unsigned short *)(CONFIG_HD64461_IOBASE+port); +} + +static __inline__ void hd64461_outb(unsigned long b, unsigned int port) +{ + *(volatile unsigned char *)(CONFIG_HD64461_IOBASE+port) = b; +} + +static __inline__ void hd64461_outw(unsigned long b, unsigned int port) +{ + *(volatile unsigned short *)(CONFIG_HD64461_IOBASE+port) = b; +} + +#endif diff -ruN linux-2.4.0-test1.orig/include/asm-sh/ide.h linux/include/asm-sh/ide.h --- linux-2.4.0-test1.orig/include/asm-sh/ide.h Tue Jun 6 18:35:53 2000 +++ linux/include/asm-sh/ide.h Tue Jun 6 17:42:57 2000 @@ -25,8 +25,13 @@ static __inline__ int ide_default_irq(ide_ioreg_t base) { switch (base) { +#ifdef CONFIG_SH_HP600 + case 0x150001f0: return 77; + case 0x15000170: return 77; +#else case 0x01f0: return 14; case 0x0170: return 15; +#endif default: return 0; } @@ -35,10 +40,17 @@ static __inline__ ide_ioreg_t ide_default_io_base(int index) { switch (index) { +#ifdef CONFIG_SH_HP600 case 0: - return 0x01f0; + return 0x150001f0; case 1: - return 0x0170; + return 0x15000170; +#else + case 0: + return 0x1f0; + case 1: + return 0x170; +#endif default: return 0; } diff -ruN linux-2.4.0-test1.orig/include/asm-sh/irq.h linux/include/asm-sh/irq.h --- linux-2.4.0-test1.orig/include/asm-sh/irq.h Sun May 21 04:05:30 2000 +++ linux/include/asm-sh/irq.h Tue Jun 6 19:18:02 2000 @@ -43,7 +43,11 @@ #elif defined(CONFIG_CPU_SUBTYPE_SH7708) #define NR_IRQS 32 #elif defined(CONFIG_CPU_SUBTYPE_SH7709) +#ifdef CONFIG_HD64461 +#define NR_IRQS 80 +#else #define NR_IRQS 61 +#endif #endif extern void disable_irq(unsigned int); diff -ruN linux-2.4.0-test1.orig/include/asm-sh/keyboard.h linux/include/asm-sh/keyboard.h --- linux-2.4.0-test1.orig/include/asm-sh/keyboard.h Thu Jan 1 09:00:00 1970 +++ linux/include/asm-sh/keyboard.h Tue Jun 6 17:42:29 2000 @@ -0,0 +1,43 @@ +#ifndef __ASM_SH_KEYBOARD_H +#define __ASM_SH_KEYBOARD_H +/* + * $Id: keyboard.h,v 1.1 2000/03/24 04:03:16 keshi Exp $ + */ + +static __inline__ int kbd_setkeycode(unsigned int scancode, + unsigned int keycode) +{ + return -EOPNOTSUPP; +} + +static __inline__ int kbd_getkeycode(unsigned int scancode) +{ + return scancode > 127 ? -EINVAL : scancode; +} + +static __inline__ int kbd_translate(unsigned char scancode, + unsigned char *keycode, char raw_mode) +{ + *keycode = scancode; + return 1; +} + +static __inline__ char kbd_unexpected_up(unsigned char keycode) +{ + return 0200; +} + +static __inline__ void kbd_leds(unsigned char leds) +{ +} + +#ifdef CONFIG_SH_HP600 +void __init hp600_kbd_init_hw(void); +#define kbd_init_hw hp600_kbd_init_hw +#else +static __inline__ void kbd_init_hw(void) +{ +} +#endif + +#endif diff -ruN linux-2.4.0-test1.orig/include/asm-sh/linux_logo.h linux/include/asm-sh/linux_logo.h --- linux-2.4.0-test1.orig/include/asm-sh/linux_logo.h Thu Jan 1 09:00:00 1970 +++ linux/include/asm-sh/linux_logo.h Tue Jun 6 19:19:49 2000 @@ -0,0 +1,48 @@ +/* $Id: linux_logo.h,v 1.1 2000/03/24 04:03:16 keshi Exp $ + * include/asm-i386/linux_logo.h: This is a linux logo + * to be displayed on boot. + * + * Copyright (C) 1996 Larry Ewing (le...@is...) + * Copyright (C) 1996 Jakub Jelinek (jj...@su...) + * + * You can put anything here, but: + * LINUX_LOGO_COLORS has to be less than 224 + * image size has to be 80x80 + * values have to start from 0x20 + * (i.e. RGB(linux_logo_red[0], + * linux_logo_green[0], + * linux_logo_blue[0]) is color 0x20) + * BW image has to be 80x80 as well, with MS bit + * on the left + * Serial_console ascii image can be any size, + * but should contain %s to display the version + */ + +#include <linux/init.h> +#include <linux/version.h> + +#define linux_logo_banner "Linux/ia32 version " UTS_RELEASE + +#define LINUX_LOGO_COLORS 214 + +#ifdef INCLUDE_LINUX_LOGO_DATA + +#define INCLUDE_LINUX_LOGOBW +#define INCLUDE_LINUX_LOGO16 + +#include <linux/linux_logo.h> + +#else + +/* prototypes only */ +extern unsigned char linux_logo_red[]; +extern unsigned char linux_logo_green[]; +extern unsigned char linux_logo_blue[]; +extern unsigned char linux_logo[]; +extern unsigned char linux_logo_bw[]; +extern unsigned char linux_logo16_red[]; +extern unsigned char linux_logo16_green[]; +extern unsigned char linux_logo16_blue[]; +extern unsigned char linux_logo16[]; + +#endif diff -ruN linux-2.4.0-test1.orig/net/ipv4/ipconfig.c linux/net/ipv4/ipconfig.c --- linux-2.4.0-test1.orig/net/ipv4/ipconfig.c Wed May 3 17:48:03 2000 +++ linux/net/ipv4/ipconfig.c Tue Jun 6 19:06:45 2000 @@ -40,7 +40,9 @@ #include <net/ip.h> #include <net/ipconfig.h> +#if defined(__sh__) #include <asm/segment.h> +#endif #include <asm/uaccess.h> #include <asm/checksum.h> |