From: Masahiro A. <m-...@aa...> - 2001-06-11 07:32:14
|
On Sun, 10 Jun 2001 14:36:50 +1000 Greg Banks <gn...@al...> wrote: > Masahiro Abe wrote: > > > I don't want to touch linux/mm/memory.c but couldn't come up with better > > idea than this. > > The correct solution would be to compile in the existing but unused > ioremap() code, but rename it to something else like ioremap_real(). > Sadly I am unable to fix this. Well, I've tried the way Greg suggested. It is working. Which is preferred modification? (I prefer this one over the previous patch.), Or, much better way out there than those? Some notes: -Same as the previous patch, config.in needs the later half of last hunk only. -I removed "make_imask_irq/disable_irq" call from cf_init_default and put "make_imask_irq" call only into init_adx_irq. Calling "disable_irq" in cf_init_default causes "lost interrupt" at Partition check. This may be because startup_imask_irq doesn't do anything. I guess it should call enable_imask_irq. --------------------------------------------------------------------- diff -ruN linux-2.4.4-sh.orig/arch/sh/config.in linux-2.4.4-adx/arch/sh/config.in --- linux-2.4.4-sh.orig/arch/sh/config.in Thu May 3 15:00:35 2001 +++ linux-2.4.4-adx/arch/sh/config.in Sat Jun 9 16:32:35 2001 @@ -38,6 +38,7 @@ DMIDA CONFIG_SH_DMIDA \ EC3104 CONFIG_SH_EC3104 \ Dreamcast CONFIG_SH_DREAMCAST \ + A&D-ADX CONFIG_SH_ADX \ BareCPU CONFIG_SH_UNKNOWN" Generic define_bool CONFIG_SH_RTC y @@ -73,7 +74,11 @@ "$CONFIG_SH_OVERDRIVE" = "y" ]; then define_hex CONFIG_MEMORY_START 0c000000 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 endmenu @@ -90,8 +95,21 @@ bool 'Networking support' CONFIG_NET -if [ "$CONFIG_SH_GENERIC" = "y" -o "$CONFIG_SH_SOLUTION_ENGINE" = "y" -o "$CONFIG_SH_UNKNOWN" = "y" ]; then +if [ "$CONFIG_SH_GENERIC" = "y" -o "$CONFIG_SH_SOLUTION_ENGINE" = "y" -o \ + "$CONFIG_SH_ADX" = "y" -o "$CONFIG_SH_UNKNOWN" = "y" ]; then bool 'Compact Flash Enabler support' CONFIG_CF_ENABLER +fi + +if [ "$CONFIG_CF_ENABLER" = "y" ]; then + choice 'Compact Flash Area' \ + "Area5(H'b4000000) CONFIG_CF_AREA5 \ + Area6(H'b8000000) CONFIG_CF_AREA6" Area6(H'b8000000) + if [ "$CONFIG_CF_AREA5" = "y" ]; then + define_hex CONFIG_CF_BASE_ADDR b4000000 + fi + if [ "$CONFIG_CF_AREA6" = "y" ]; then + define_hex CONFIG_CF_BASE_ADDR b8000000 + fi fi bool 'Hitachi HD64461 companion chip support' CONFIG_HD64461 diff -ruN linux-2.4.4-sh.orig/arch/sh/kernel/cf-enabler.c linux-2.4.4-adx/arch/sh/kernel/cf-enabler.c --- linux-2.4.4-sh.orig/arch/sh/kernel/cf-enabler.c Thu May 3 14:33:25 2001 +++ linux-2.4.4-adx/arch/sh/kernel/cf-enabler.c Mon Jun 11 16:00:08 2001 @@ -14,7 +14,8 @@ #include <asm/io.h> #include <asm/irq.h> -#define CF_CIS_BASE 0xb8000000 +/* this must be done in boot-loader - Masahiro Abe +#define CF_CIS_BASE 0xb8000000 */ /* * You can connect Compact Flash directly to the bus of SuperH. * This is the enabler for that. @@ -29,15 +30,58 @@ * 0xB8001000 : Common Memory * 0xBA000000 : I/O */ +#if defined(CONFIG_IDE) && defined(__SH4__) +/* SH4 can't access PCMCIA interface through P2 area. + * we must remap it with appropreate attribute bit of the page set. + * this part is based on Greg Banks' hd64465_ss.c implementation - Masahiro Abe */ +#include <linux/mm.h> +#include <linux/vmalloc.h> + +#if defined(CONFIG_CF_AREA6) +#define slot_no 0 +#else +#define slot_no 1 +#endif + +extern void * ioremap_real(unsigned long phys_addr, unsigned long size, unsigned long flags); + +void *cf_io_base; + +static int __init allocate_cf_area(void) +{ + pgprot_t prot; + unsigned long paddrbase, psize; + +/* open I/O area window */ + paddrbase = virt_to_phys((void*)CONFIG_CF_BASE_ADDR); + psize = PAGE_SIZE; + prot = PAGE_KERNEL_PCC(slot_no, _PAGE_PCC_IO16); + cf_io_base = ioremap_real(paddrbase, psize, prot.pgprot); + if (!cf_io_base) { + printk("allocate_cf_area : can't open CF I/O window!\n"); + return -ENOMEM; + } +/* printk("ioremap_real(paddr=0x%08lx, psize=0x%08lx, prot=0x%08lx)=0x%08lx\n", + paddrbase, psize, prot.pgprot, cf_io_base);*/ + + /* XXX : do we need attribute and common-memory area also? */ + + return 0; +} +#endif static int __init cf_init_default(void) { #ifdef CONFIG_IDE +#if defined(CONFIG_IDE) && defined(__SH4__) + allocate_cf_area(); +#endif /* Enable the card, and set the level interrupt */ - ctrl_outw(0x0042, CF_CIS_BASE+0x0200); +/* this must be done in boot-loader - Masahiro Abe + ctrl_outw(0x0042, CF_CIS_BASE+0x0200);*/ #endif - make_imask_irq(14); - disable_irq(14); +/* make_imask_irq(14); + disable_irq(14);*/ return 0; } diff -ruN linux-2.4.4-sh.orig/arch/sh/mm/Makefile linux-2.4.4-adx/arch/sh/mm/Makefile --- linux-2.4.4-sh.orig/arch/sh/mm/Makefile Thu May 3 14:33:25 2001 +++ linux-2.4.4-adx/arch/sh/mm/Makefile Mon Jun 11 15:33:56 2001 @@ -8,6 +8,7 @@ # Note 2! The CFLAGS definition is now in the main makefile... O_TARGET := mm.o -obj-y := init.o fault.o extable.o cache.o # ioremap.o +#obj-y := init.o fault.o extable.o cache.o # ioremap.o +obj-y := init.o fault.o extable.o cache.o ioremap.o include $(TOPDIR)/Rules.make diff -ruN linux-2.4.4-sh.orig/arch/sh/mm/ioremap.c linux-2.4.4-adx/arch/sh/mm/ioremap.c --- linux-2.4.4-sh.orig/arch/sh/mm/ioremap.c Thu May 3 14:33:25 2001 +++ linux-2.4.4-adx/arch/sh/mm/ioremap.c Mon Jun 11 15:33:43 2001 @@ -106,7 +106,8 @@ * have to convert them into an offset in a page-aligned mapping, but the * caller shouldn't need to know that small detail. */ -void * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags) +/*void * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags)*/ +void * ioremap_real(unsigned long phys_addr, unsigned long size, unsigned long flags) { void * addr; struct vm_struct * area; @@ -150,7 +151,8 @@ return (void *) (offset + (char *)addr); } -void iounmap(void *addr) +/*void iounmap(void *addr)*/ +void iounmap_real(void *addr) { if (addr > high_memory) return vfree((void *) (PAGE_MASK & (unsigned long) addr)); --------------------------------------------------------------------- +-------------------------------------+ | Masahiro Abe, Software Engineer | | A&D Co., Ltd. of Tokyo, Japan | | mailto:m-...@aa... | +-------------------------------------+ |This is my opinion, not my employer's| +-------------------------------------+ |