From: Masahiro A. <m-...@aa...> - 2001-07-18 11:17:24
|
Third patch and the last of the series - ADX board support. --- diff -ruN linux-cvs0718-mr-cf/ChangeLog linux-cvs0718-mr-cf-adx/ChangeLog --- linux-cvs0718-mr-cf/ChangeLog Wed Jul 18 19:12:57 2001 +++ linux-cvs0718-mr-cf-adx/ChangeLog Wed Jul 18 19:37:47 2001 @@ -1,5 +1,15 @@ 2001-07-18 Masahiro ABE <m-...@aa...> + * Documentation/Configure.help (CONFIG_SH_GENERIC): Added ADX + * arch/sh/config.in (CONFIG_SH_ADX): Added for ADX support + (CONFIG_MEMORY_START): Added definition for ADX + (CONFIG_CF_ENABLER): Added ADX + * arch/sh/kernel/Makefile : Added ADX support + * arch/sh/kernel/{io_adx.c,mach_adx.c,setup_adx.c} : Added for ADX support + * include/asm-sh/io.h : Added ADX support + * include/asm-sh/io_adx.h : Added for ADX support + * include/asm-sh/machvec.h : Added ADX support + * Documentation/Configure.help (CONFIG_CF_ENABLER): Support area 5 also. (CONFIG_CF_AREA): Added. * arch/sh/config.in : Added selection of CompactFlash area. diff -ruN linux-cvs0718-mr-cf/Documentation/Configure.help linux-cvs0718-mr-cf-adx/Documentation/Configure.help --- linux-cvs0718-mr-cf/Documentation/Configure.help Wed Jul 18 19:18:14 2001 +++ linux-cvs0718-mr-cf-adx/Documentation/Configure.help Wed Jul 18 19:30:00 2001 @@ -16382,6 +16382,7 @@ - "CAT68701" for CAT 68701 Evaluation Board (SH7708) - "BigSur" for Big Sur Evaluation Board - "SH2000" for SH2000 Evaluation Board (SH7709A) + - "ADX" for A&D ADX - "BareCPU" for Bare CPU board such as CqREEK SH-3 If unsure, select "BareCPU". diff -ruN linux-cvs0718-mr-cf/arch/sh/config.in linux-cvs0718-mr-cf-adx/arch/sh/config.in --- linux-cvs0718-mr-cf/arch/sh/config.in Wed Jul 18 19:08:15 2001 +++ linux-cvs0718-mr-cf-adx/arch/sh/config.in Wed Jul 18 19:30:08 2001 @@ -42,6 +42,7 @@ CAT68701 CONFIG_SH_CAT68701 \ BigSur CONFIG_SH_BIGSUR \ SH2000 CONFIG_SH_SH2000 \ + ADX CONFIG_SH_ADX \ BareCPU CONFIG_SH_UNKNOWN" Generic # The SH7750 RTC module is disabled in the Dreamcast @@ -101,7 +102,11 @@ hex 'EMI physical memory start address' CONFIG_MEMORY_START 08000000 fi else + if [ "$CONFIG_SH_ADX" = "y" ]; then + define_hex CONFIG_MEMORY_START 08000000 + else hex 'Physical memory start address' CONFIG_MEMORY_START 08000000 + fi fi fi endmenu @@ -126,7 +131,8 @@ bool 'Networking support' CONFIG_NET if [ "$CONFIG_SH_GENERIC" = "y" -o "$CONFIG_SH_SOLUTION_ENGINE" = "y" -o \ - "$CONFIG_SH_UNKNOWN" = "y" -o "$CONFIG_SH_CAT68701" = "y" ]; then + "$CONFIG_SH_UNKNOWN" = "y" -o "$CONFIG_SH_CAT68701" = "y" -o \ + "$CONFIG_SH_ADX" = "y" ]; then bool 'Compact Flash Enabler support' CONFIG_CF_ENABLER fi diff -ruN linux-cvs0718-mr-cf/arch/sh/kernel/Makefile linux-cvs0718-mr-cf-adx/arch/sh/kernel/Makefile --- linux-cvs0718-mr-cf/arch/sh/kernel/Makefile Wed Jul 18 18:55:00 2001 +++ linux-cvs0718-mr-cf-adx/arch/sh/kernel/Makefile Wed Jul 18 19:27:05 2001 @@ -64,6 +64,9 @@ obj-$(CONFIG_CPU_SUBTYPE_ST40STB1) +=irq_intc2.o +obj-$(CONFIG_SH_ADX) += mach_adx.o setup_adx.o io_adx.o irq_maskreg.o +machine-specific-objs += mach_adx.o setup_adx.o io_adx.o irq_maskreg.o + # Doesn't compile well, so don't include in machine-specific-objs obj-$(CONFIG_HD64465) += setup_hd64465.o io_hd64465.o hd64465_gpio.o obj-$(CONFIG_SH_DMIDA) += mach_dmida.o diff -ruN linux-cvs0718-mr-cf/arch/sh/kernel/io_adx.c linux-cvs0718-mr-cf-adx/arch/sh/kernel/io_adx.c --- linux-cvs0718-mr-cf/arch/sh/kernel/io_adx.c Thu Jan 1 09:00:00 1970 +++ linux-cvs0718-mr-cf-adx/arch/sh/kernel/io_adx.c Wed Jul 18 19:27:05 2001 @@ -0,0 +1,192 @@ +/* + * linux/arch/sh/kernel/io_adx.c + * + * Copyright (C) 2001 A&D Co., Ltd. + * + * I/O routine and setup routines for A&D ADX Board + * + * 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 <asm/io.h> +#include <asm/machvec.h> +#include <linux/module.h> + +#define PORT2ADDR(x) (adx_isa_port2addr(x)) + +static inline void delay(void) +{ + ctrl_inw(0xa0000000); +} + +unsigned char adx_inb(unsigned long port) +{ + return *(volatile unsigned char*)PORT2ADDR(port); +} + +unsigned short adx_inw(unsigned long port) +{ + return *(volatile unsigned short*)PORT2ADDR(port); +} + +unsigned int adx_inl(unsigned long port) +{ + return *(volatile unsigned long*)PORT2ADDR(port); +} + +unsigned char adx_inb_p(unsigned long port) +{ + unsigned long v = *(volatile unsigned char*)PORT2ADDR(port); + + delay(); + return v; +} + +unsigned short adx_inw_p(unsigned long port) +{ + unsigned long v = *(volatile unsigned short*)PORT2ADDR(port); + + delay(); + return v; +} + +unsigned int adx_inl_p(unsigned long port) +{ + unsigned long v = *(volatile unsigned long*)PORT2ADDR(port); + + delay(); + return v; +} + +void adx_insb(unsigned long port, void *buffer, unsigned long count) +{ + unsigned char *buf = buffer; + while(count--) *buf++ = inb(port); +} + +void adx_insw(unsigned long port, void *buffer, unsigned long count) +{ + unsigned short *buf = buffer; + while(count--) *buf++ = inw(port); +} + +void adx_insl(unsigned long port, void *buffer, unsigned long count) +{ + unsigned long *buf = buffer; + while(count--) *buf++ = inl(port); +} + +void adx_outb(unsigned char b, unsigned long port) +{ + *(volatile unsigned char*)PORT2ADDR(port) = b; +} + +void adx_outw(unsigned short b, unsigned long port) +{ + *(volatile unsigned short*)PORT2ADDR(port) = b; +} + +void adx_outl(unsigned int b, unsigned long port) +{ + *(volatile unsigned long*)PORT2ADDR(port) = b; +} + +void adx_outb_p(unsigned char b, unsigned long port) +{ + *(volatile unsigned char*)PORT2ADDR(port) = b; + delay(); +} + +void adx_outw_p(unsigned short b, unsigned long port) +{ + *(volatile unsigned short*)PORT2ADDR(port) = b; + delay(); +} + +void adx_outl_p(unsigned int b, unsigned long port) +{ + *(volatile unsigned long*)PORT2ADDR(port) = b; + delay(); +} + +void adx_outsb(unsigned long port, const void *buffer, unsigned long count) +{ + const unsigned char *buf = buffer; + while(count--) outb(*buf++, port); +} + +void adx_outsw(unsigned long port, const void *buffer, unsigned long count) +{ + const unsigned short *buf = buffer; + while(count--) outw(*buf++, port); +} + +void adx_outsl(unsigned long port, const void *buffer, unsigned long count) +{ + const unsigned long *buf = buffer; + while(count--) outl(*buf++, port); +} + +unsigned char adx_readb(unsigned long addr) +{ + return *(volatile unsigned char*)addr; +} + +unsigned short adx_readw(unsigned long addr) +{ + return *(volatile unsigned short*)addr; +} + +unsigned int adx_readl(unsigned long addr) +{ + return *(volatile unsigned long*)addr; +} + +void adx_writeb(unsigned char b, unsigned long addr) +{ + *(volatile unsigned char*)addr = b; +} + +void adx_writew(unsigned short b, unsigned long addr) +{ + *(volatile unsigned short*)addr = b; +} + +void adx_writel(unsigned int b, unsigned long addr) +{ + *(volatile unsigned long*)addr = b; +} + +void *adx_ioremap(unsigned long offset, unsigned long size) +{ + return (void *)P2SEGADDR(offset); +} + +EXPORT_SYMBOL (adx_ioremap); + +void adx_iounmap(void *addr) +{ +} + +EXPORT_SYMBOL(adx_iounmap); + +#include <linux/vmalloc.h> +extern void *cf_io_base; + +unsigned long adx_isa_port2addr(unsigned long offset) +{ + /* CompactFlash (IDE) */ + if (((offset >= 0x1f0) && (offset <= 0x1f7)) || (offset == 0x3f6)) { + return (unsigned long)cf_io_base + offset; + } + + /* eth0 */ + if ((offset >= 0x300) && (offset <= 0x30f)) { + return 0xa5000000 + offset; /* COMM BOARD (AREA1) */ + } + + return offset + 0xb0000000; /* IOBUS (AREA 4)*/ +} diff -ruN linux-cvs0718-mr-cf/arch/sh/kernel/mach_adx.c linux-cvs0718-mr-cf-adx/arch/sh/kernel/mach_adx.c --- linux-cvs0718-mr-cf/arch/sh/kernel/mach_adx.c Thu Jan 1 09:00:00 1970 +++ linux-cvs0718-mr-cf-adx/arch/sh/kernel/mach_adx.c Wed Jul 18 19:27:05 2001 @@ -0,0 +1,73 @@ +/* + * linux/arch/sh/kernel/mach_adx.c + * + * Copyright (C) 2001 A&D Co., Ltd. + * + * May be copied or modified under the terms of the GNU General Public + * License. See linux/COPYING for more information. + * + * Machine vector for the A&D ADX Board + */ + +#include <linux/config.h> +#include <linux/init.h> + +#include <asm/machvec.h> +#include <asm/rtc.h> +#include <asm/machvec_init.h> +#include <asm/io_adx.h> + +extern void setup_adx(void); +extern void init_adx_IRQ(void); + +/* + * The Machine Vector + */ + +struct sh_machine_vector mv_adx __initmv = { + mv_name: "A&D_ADX", + + mv_nr_irqs: 48, + + mv_inb: adx_inb, + mv_inw: adx_inw, + mv_inl: adx_inl, + mv_outb: adx_outb, + mv_outw: adx_outw, + mv_outl: adx_outl, + + mv_inb_p: adx_inb_p, + mv_inw_p: adx_inw, + mv_inl_p: adx_inl, + mv_outb_p: adx_outb_p, + mv_outw_p: adx_outw, + mv_outl_p: adx_outl, + + mv_insb: adx_insb, + mv_insw: adx_insw, + mv_insl: adx_insl, + mv_outsb: adx_outsb, + mv_outsw: adx_outsw, + mv_outsl: adx_outsl, + + mv_readb: adx_readb, + mv_readw: adx_readw, + mv_readl: adx_readl, + mv_writeb: adx_writeb, + mv_writew: adx_writew, + mv_writel: adx_writel, + + mv_ioremap: adx_ioremap, + mv_iounmap: adx_iounmap, + + mv_isa_port2addr: adx_isa_port2addr, + + mv_init_arch: setup_adx, + mv_init_irq: init_adx_IRQ, + + mv_rtc_gettimeofday: sh_rtc_gettimeofday, + mv_rtc_settimeofday: sh_rtc_settimeofday, + + mv_hw_adx: 1, +}; +ALIAS_MV(adx) diff -ruN linux-cvs0718-mr-cf/arch/sh/kernel/setup_adx.c linux-cvs0718-mr-cf-adx/arch/sh/kernel/setup_adx.c --- linux-cvs0718-mr-cf/arch/sh/kernel/setup_adx.c Thu Jan 1 09:00:00 1970 +++ linux-cvs0718-mr-cf-adx/arch/sh/kernel/setup_adx.c Wed Jul 18 19:27:05 2001 @@ -0,0 +1,40 @@ +/* + * linux/arch/sh/kernel/setup_adx.c + * + * Copyright (C) 2001 A&D Co., Ltd. + * + * I/O routine and setup routines for A&D ADX Board + * + * 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 <asm/io.h> +#include <asm/machvec.h> +#include <asm/irq.h> +#include <linux/module.h> + +void setup_adx(void) +{ + /* nothing to do just yet */ +/* printk("setup_adx()\n");*/ +} + +void init_adx_IRQ(void) +{ + int i; + +/* printk("init_adx_IRQ()\n");*/ + /* setup irq_mask_register */ + irq_mask_register = (unsigned short *)0xa6000008; + + /* cover all external interrupt area by maskreg_irq_type + * (Actually, irq15 doesn't exist) + */ + for (i = 0; i < 16; i++) { + make_maskreg_irq(i); + disable_irq(i); + } +} diff -ruN linux-cvs0718-mr-cf/include/asm-sh/io.h linux-cvs0718-mr-cf-adx/include/asm-sh/io.h --- linux-cvs0718-mr-cf/include/asm-sh/io.h Wed Jul 18 18:54:13 2001 +++ linux-cvs0718-mr-cf-adx/include/asm-sh/io.h Wed Jul 18 19:27:05 2001 @@ -125,6 +125,8 @@ # include <asm/io_cat68701.h> # elif defined(CONFIG_SH_BIGSUR) # include <asm/io_bigsur.h> +# elif defined(CONFIG_SH_ADX) +# include <asm/io_adx.h> # elif defined(CONFIG_SH_UNKNOWN) # include <asm/io_unknown.h> # else diff -ruN linux-cvs0718-mr-cf/include/asm-sh/io_adx.h linux-cvs0718-mr-cf-adx/include/asm-sh/io_adx.h --- linux-cvs0718-mr-cf/include/asm-sh/io_adx.h Thu Jan 1 09:00:00 1970 +++ linux-cvs0718-mr-cf-adx/include/asm-sh/io_adx.h Wed Jul 18 19:27:05 2001 @@ -0,0 +1,86 @@ +/* + * include/asm-sh/io_adx.h + * + * Copyright (C) 2001 A&D Co., Ltd. + * + * May be copied or modified under the terms of the GNU General Public + * License. See linux/COPYING for more information. + * + * IO functions for an A&D ADX Board + */ + +#ifndef _ASM_SH_IO_ADX_H +#define _ASM_SH_IO_ADX_H + +#include <asm/io_generic.h> + +extern unsigned char adx_inb(unsigned long port); +extern unsigned short adx_inw(unsigned long port); +extern unsigned int adx_inl(unsigned long port); + +extern void adx_outb(unsigned char value, unsigned long port); +extern void adx_outw(unsigned short value, unsigned long port); +extern void adx_outl(unsigned int value, unsigned long port); + +extern unsigned char adx_inb_p(unsigned long port); +extern void adx_outb_p(unsigned char value, unsigned long port); + +extern void adx_insb(unsigned long port, void *addr, unsigned long count); +extern void adx_insw(unsigned long port, void *addr, unsigned long count); +extern void adx_insl(unsigned long port, void *addr, unsigned long count); +extern void adx_outsb(unsigned long port, const void *addr, unsigned long count); +extern void adx_outsw(unsigned long port, const void *addr, unsigned long count); +extern void adx_outsl(unsigned long port, const void *addr, unsigned long count); + +extern unsigned char adx_readb(unsigned long addr); +extern unsigned short adx_readw(unsigned long addr); +extern unsigned int adx_readl(unsigned long addr); +extern void adx_writeb(unsigned char b, unsigned long addr); +extern void adx_writew(unsigned short b, unsigned long addr); +extern void adx_writel(unsigned int b, unsigned long addr); + +extern void * adx_ioremap(unsigned long offset, unsigned long size); +extern void adx_iounmap(void *addr); + +extern unsigned long adx_isa_port2addr(unsigned long offset); + +extern void setup_adx(void); +extern void init_adx_IRQ(void); + +#ifdef __WANT_IO_DEF + +#define __inb adx_inb +#define __inw adx_inw +#define __inl adx_inl +#define __outb adx_outb +#define __outw adx_outw +#define __outl adx_outl + +#define __inb_p adx_inb_p +#define __inw_p adx_inw +#define __inl_p adx_inl +#define __outb_p adx_outb_p +#define __outw_p adx_outw +#define __outl_p adx_outl + +#define __insb adx_insb +#define __insw adx_insw +#define __insl adx_insl +#define __outsb adx_outsb +#define __outsw adx_outsw +#define __outsl adx_outsl + +#define __readb adx_readb +#define __readw adx_readw +#define __readl adx_readl +#define __writeb adx_writeb +#define __writew adx_writew +#define __writel adx_writel + +#define __isa_port2addr adx_isa_port2addr +#define __ioremap adx_ioremap +#define __iounmap adx_iounmap + +#endif + +#endif /* _ASM_SH_IO_AANDD_H */ diff -ruN linux-cvs0718-mr-cf/include/asm-sh/machvec.h linux-cvs0718-mr-cf-adx/include/asm-sh/machvec.h --- linux-cvs0718-mr-cf/include/asm-sh/machvec.h Wed Jul 18 18:54:13 2001 +++ linux-cvs0718-mr-cf-adx/include/asm-sh/machvec.h Wed Jul 18 19:27:05 2001 @@ -76,6 +76,7 @@ unsigned int mv_hw_hd64465 : 1; unsigned int mv_hw_dreamcast : 1; unsigned int mv_hw_bigsur : 1; + unsigned int mv_hw_adx : 1; }; extern struct sh_machine_vector sh_mv; @@ -92,6 +93,7 @@ #define MACH_SH2000 (sh_mv.mv_hw_sh2000) #define MACH_DREAMCAST (sh_mv.mv_hw_dreamcast) #define MACH_BIGSUR (sh_mv.mv_hw_bigsur) +#define MACH_ADX (sh_mv.mv_hw_adx) #else # if defined(CONFIG_SH_SOLUTION_ENGINE) || \ defined(CONFIG_SH_7751_SOLUTION_ENGINE) @@ -148,6 +150,11 @@ # define MACH_BIGSUR 1 # else # define MACH_BIGSUR 0 +# endif +# ifdef CONFIG_SH_ADX +# define MACH_ADX 1 +# else +# define MACH_ADX 0 # endif #endif --- ================================= Masahiro ABE, A&D Co., Ltd. Japan |