H8/300 target support patch
Hello.
I develop H8/300 support of linux kernel.
I made a patch to use IDE driver with a H8/300 target. I want to do merge to source if possible.
How will about it?
Signature · 2 lines
Yoshinori Sato <[email protected]>
drivers/ide/Makefile +1 -1
@@ -30,5 +30,5 @@ obj-$(CONFIG_PROC_FS) += ide-proc.o endif -obj-$(CONFIG_BLK_DEV_IDE) += legacy/ ppc/ arm/ +obj-$(CONFIG_BLK_DEV_IDE) += legacy/ ppc/ arm/ h8300/ obj-$(CONFIG_BLK_DEV_HD) += legacy/
drivers/ide/h8300/Makefile +2 -0
@@ -0,0 +1,2 @@ +obj-$(CONFIG_H8300H_H8MAX) := h8max_ide.o +obj-$(CONFIG_H8300H_AKI3068NET) := aki3068_ide.o
ide/h8300/aki3068_ide.c renamed from drivers/ide/h8300/aki3068_ide.c +139 -0
139 lines not on this page · raw message
drivers/ide/h8300/h8max_ide.c +134 -0
134 lines not on this page · raw message
drivers/ide/ide-probe.c +4 -1
@@ -1102,7 +1102,8 @@spin_unlock_irq (&ide_lock); } -#if !defined(__mc68000__) && !defined(CONFIG_APUS ) && !defined(__sparc__) +#if !defined(__mc68000__) && !defined(CONFIG_APUS ) && !defined(__sparc__) && \ + !defined(__H8300H__) && !defined(__H8300S__) printk("%s at 0x%03lx-0x%03lx,0x%03lx on irq %d", hwif->name, hwif->io_ports[IDE_DATA_OFFSET], hwif->io_ports[IDE_DATA_OFFSET]+7,
@@ -1112,6 +1113,8 @@ hwif->io_ports[IDE_DATA_OFFSET ], hwif->io_ports[IDE_DATA_OFFSET ]+7 , hwif->io_ports[IDE_CONTROL_OFFSET], __irq_itoa(hwif->irq)); +#elif defined(__H8300H__) || defined(__H8300S__) +h8300_ide_print_resource (hwif->name,&(hwif->hw));#else printk ("%s at 0x%08lx on irq %d" , hwif->name, hwif->io_ports[IDE_DATA_OFFSET ], hwif->irq);
drivers/ide/ide.c +6 -0
@@ -2274,6 +2274,12 @@ pnpide_init(1); }#endif /* CONFIG_BLK_DEV_IDEPNP */ +#if defined(__H8300H__) || defined(__H8300S__) + { +extern void h8300_ide_init (void ); +h8300_ide_init (); + } +#endif /* defined(__H8300H__) || defined(__H8300S__) */ }void __init ide_init_builtin_drivers (void )
Quoted 7 lines · Yoshinori Sato
Hello.
I develop H8/300 support of linux kernel.I made a patch to use IDE driver with a H8/300 target. I want to do merge to source if possible.
How will about it?
Hi,
+ * reference schematic is http://www.linet.gr.jp/mituiwa/h8/h8osv3/hddprog/hdd.png
this link is dead
+#include <linux/mm.h>
+#include <linux/interrupt.h>
+#include <linux/blkdev.h>
why do you include mm.h and blkdev.h?
+static void _outsw(unsigned long addr, void *buf, u32 len) +{
+ unsigned volatile short *ap = (unsigned volatile short *)addr;
+ unsigned short *bp = (unsigned short *)buf;
+ unsigned short d;
+ while(len--) {
+ d = *bp++;
+ *ap = (d << 8) | (d >> 8);
+ }
+}
+
+static void _insw(unsigned long addr, void *buf, u32 len) +{
+ unsigned volatile short *ap = (unsigned volatile short *)addr;
+ unsigned short *bp = (unsigned short *)buf;
+ unsigned short d;
+ while(len--) {
+ d = *ap;
+ *bp++ = (d << 8) | (d >> 8);
+ }
+}
why you don't use outsw() and insw() from include/asm-h8300/io.h?
+ ide_setup_ports(&hw, IDE_BASE, (int *)offsets,
+ IDE_CTRL, 0, NULL,IDE_IRQ);
ide_setup_ports() is deprecated, please do not use it.
+ hwif->mmio = 0;
Your driver is doing MMIO, it should request and release resources itself and set hwif->mmio to 2.
+void __init h8300_ide_print_resource(char *name, hw_regs_t *hw) +{
+ printk("%s at 0x%08x-0x%08x,0x%08x on irq %d", name,
+ (unsigned int)hw->io_ports[IDE_DATA_OFFSET],
+ (unsigned int)hw->io_ports[IDE_DATA_OFFSET]+15,
+ (unsigned int)hw->io_ports[IDE_CONTROL_OFFSET],
+ hw->irq);
+}
Is this necessary (this is a reason for extra #ifdefs in ide-probe.c)? Can't we do what m68k is doing (print only address and IRQ) for now?
Both drivers use same IO ops so they can be moved to some include file or both drivers can be merged (preferred solution) - they are for different boards and can't work together (plus MAX_HWIFS is defined to 1 for h8300).
Here is patch (not tested) addressing some of these issues...
Thanks,
--bart
linux-2.6.3-rc2-bk4-root/drivers/ide/h8300/aki3068_ide.c | 96 ++------------- linux-2.6.3-rc2-bk4-root/drivers/ide/h8300/h8_ide_iops.h | 72 +++++++++++ linux-2.6.3-rc2-bk4-root/drivers/ide/h8300/h8max_ide.c | 94 ++------------ 3 files changed, 109 insertions(+), 153 deletions(-)
drivers/ide/h8300/aki3068_ide.c renamed from drivers/ide/h8300/aki3068_ide.c~h8300-ide-fixes +19 -77
@@ -2,7 +2,6 @@/* * linux/drivers/ide/h8300/aki3068_ide.c * AE-3068/AE-3069 IDE I/F support -* reference schematic is http://www.linet.gr.jp/mituiwa/h8/h8osv3/hddprog/hdd.png * * Copyright (C) 2003 Yoshinori Sato <[email protected]> *
@@ -25,6 +24,8 @@#include <asm/irq.h> #include <asm/regs306x.h> +#include "h8_ide_iops.h" +/* IDE I/F configuration */ #define IDE_BASE CONFIG_H8300_IDE_BASE#define IDE_CTRL CONFIG_H8300_IDE_ALT
@@ -39,67 +40,16 @@#define IDE_SELECT 0x0C#define IDE_STATUS 0x0E -const static int offsets[IDE_NR_PORTS ] = { -IDE_DATA ,IDE_ERROR ,IDE_NSECTOR ,IDE_SECTOR ,IDE_LCYL , -IDE_HCYL ,IDE_SELECT ,IDE_STATUS ,-1 ,-1 -}; - -static void _outb (u8 d,unsigned long a) -{ - *(unsigned short *)a = (d &0xff ); -} - -static void _outbsync (ide_drive_t *drive,u8 d,unsigned long a) -{ - *(unsigned short *)a = (d &0xff ); -} - -static u8 _inb (unsigned long a) +static void h8300_ide_ports (hw_regs_t *hw,unsigned long ioaddr) { -return *(unsigned short *)a; -} - -static void _outw (u16 d,unsigned long a) -{ - *(unsigned short *)a = (d <<8 ) | (d >>8 ); -} - -static u16 _inw (unsigned long a) -{ -unsigned short d; - d = *(unsigned short *)a; -return (d <<8 ) | (d >>8 ); -} - -static void _outl (u32 d,unsigned long a) -{ -} - -static u32 _inl (unsigned long a) -{ -return 0xffffffffUL ; -} - -static void _outsw (unsigned long addr,void *buf,u32 len) -{ -unsigned volatile short *ap = (unsigned volatile short *)addr; -unsigned short *bp = (unsigned short *)buf; -unsigned short d; -while (len--) { - d = *bp++; - *ap = (d <<8 ) | (d >>8 ); - } -} - -static void _insw (unsigned long addr,void *buf,u32 len) -{ -unsigned volatile short *ap = (unsigned volatile short *)addr; -unsigned short *bp = (unsigned short *)buf; -unsigned short d; -while (len--) { - d = *ap; - *bp++ = (d <<8 ) | (d >>8 ); - } + hw->io_ports[IDE_DATA_OFFSET ] = ioaddr +IDE_DATA ; + hw->io_ports[IDE_ERROR_OFFSET ] = ioaddr +IDE_ERROR ; + hw->io_ports[IDE_NSECTOR_OFFSET ] = ioaddr +IDE_NSECTOR ; + hw->io_ports[IDE_SECTOR_OFFSET ] = ioaddr +IDE_SECTOR ; + hw->io_ports[IDE_LCYL_OFFSET ] = ioaddr +IDE_LCYL ; + hw->io_ports[IDE_HCYL_OFFSET ] = ioaddr +IDE_HCYL ; + hw->io_ports[IDE_SELECT_OFFSET ] = ioaddr +IDE_SELECT ; + hw->io_ports[IDE_STATUS_OFFSET ] = ioaddr +IDE_STATUS ; }void __init h8300_ide_init (void )
@@ -110,23 +60,15 @@ void __init h8300_ide_init(void)volatile unsigned char *cscr = (volatile unsigned char *)CSCR ; *abwcr &= ~((1 << ((IDE_BASE >>21 ) &7 )) | (1 << ((IDE_CTRL >>21 ) &7 ))); *cscr |= (1 << ((IDE_BASE >>21 ) &7 )) | (1 << ((IDE_CTRL >>21 ) &7 )) |0x0f ; +memset (&hw,0 ,sizeof (hw)); -ide_setup_ports (&hw,IDE_BASE , (int *)offsets, -IDE_CTRL ,0 ,NULL ,IDE_IRQ ); -if (ide_register_hw (&hw, &hwif) !=-1 ) { - hwif->mmio =0 ; - hwif->OUTB = _outb; - hwif->OUTBSYNC = _outbsync; - hwif->OUTW = _outw; - hwif->OUTL = _outl; - hwif->OUTSW = _outsw; - hwif->OUTSL =NULL ; - hwif->INB = _inb; - hwif->INW = _inw; - hwif->INL = _inl; - hwif->INSW = _insw; - hwif->INSL =NULL ; - } + +h8300_ide_ports (&hw,IDE_BASE ); + hw.io_ports[IDE_CONTROL_OFFSET ] =IDE_CTRL ; + hw.irq =IDE_IRQ ; + +if (ide_register_hw (&hw, &hwif) !=-1 ) +h8300_hwif_iops (hwif); }void __init h8300_ide_print_resource (char *name,hw_regs_t *hw)
drivers/ide/h8300/h8max_ide.c renamed from drivers/ide/h8300/h8max_ide.c~h8300-ide-fixes +18 -76
113 lines not on this page · raw message
drivers/ide/h8300/h8_ide_iops.h new file +72 -0
72 lines not on this page · raw message
_
At Sun, 15 Feb 2004 15:40:56 +0100,
Quoted 20 lines · Bartlomiej Zolnierkiewicz
Quoted 7 lines · Yoshinori Sato
Hello.
I develop H8/300 support of linux kernel.I made a patch to use IDE driver with a H8/300 target. I want to do merge to source if possible.
How will about it?
Hi,
+ * reference schematic is http://www.linet.gr.jp/mituiwa/h8/h8osv3/hddprog/hdd.png
this link is dead
(quoted diff) +3
-0+#include <linux/mm.h> +#include <linux/interrupt.h> +#include <linux/blkdev.h>
Quoted 1 line
why do you include
mm.handblkdev.h?
It is code in a thing of 2.4.x
I seem to have left that deleted it when shifted to new driver.
Quoted 22 lines
drivers/ide/h8300/h8_ide_iops.h new file +21
-0+static void _outsw (unsigned long addr,void *buf,u32 len) +{ +unsigned volatile short *ap = (unsigned volatile short *)addr; +unsigned short *bp = (unsigned short *)buf; +unsigned short d; +while (len--) { + d = *bp++; + *ap = (d <<8 ) | (d >>8 ); + } +} + +static void _insw (unsigned long addr,void *buf,u32 len) +{ +unsigned volatile short *ap = (unsigned volatile short *)addr; +unsigned short *bp = (unsigned short *)buf; +unsigned short d; +while (len--) { + d = *ap; + *bp++ = (d <<8 ) | (d >>8 ); + } +}
Quoted 1 line
why you don't use
outsw()andinsw()frominclude/asm-h8300/io.h?
Because bus turns over, insw/outsw is not usable.
Quoted 19 lines
(quoted diff) +2
-0+ ide_setup_ports(&hw, IDE_BASE, (int *)offsets, + IDE_CTRL, 0, NULL,IDE_IRQ);
ide_setup_ports()is deprecated, please do not use it.(quoted diff) +1
-0+ hwif->mmio = 0;Your driver is doing MMIO, it should request and release resources itself and set
hwif->mmioto 2.(quoted diff) +8
-0+void __init h8300_ide_print_resource(char *name, hw_regs_t *hw) +{ + printk("%s at 0x%08x-0x%08x,0x%08x on irq %d", name, + (unsigned int)hw->io_ports[IDE_DATA_OFFSET], + (unsigned int)hw->io_ports[IDE_DATA_OFFSET]+15, + (unsigned int)hw->io_ports[IDE_CONTROL_OFFSET], + hw->irq); +}
Quoted 2 lines
Is this necessary (this is a reason for extra #ifdefs in
ide-probe.c)? Can't we do what m68k is doing (print only address and IRQ) for now?
I can use it.
But there is the problem that resource to use cannot output justly. I think that solved if can define a part of +7 with #define.
Quoted 5 lines
Both drivers use same IO ops so they can be moved to some include file or both drivers can be merged (preferred solution) - they are for different boards and can't work together (plus
MAX_HWIFSis defined to 1 for h8300).Here is patch (not tested) addressing some of these issues...
I identified operation.
MMIO and print_resource examine a correction method.
Thank you.
Signature · 2 lines
Yoshinori Sato <[email protected]>
Quoted 22 lines · Yoshinori Sato
Quoted 22 lines
drivers/ide/h8300/h8_ide_iops.h new file +21
-0+static void _outsw (unsigned long addr,void *buf,u32 len) +{ +unsigned volatile short *ap = (unsigned volatile short *)addr; +unsigned short *bp = (unsigned short *)buf; +unsigned short d; +while (len--) { + d = *bp++; + *ap = (d <<8 ) | (d >>8 ); + } +} + +static void _insw (unsigned long addr,void *buf,u32 len) +{ +unsigned volatile short *ap = (unsigned volatile short *)addr; +unsigned short *bp = (unsigned short *)buf; +unsigned short d; +while (len--) { + d = *ap; + *bp++ = (d <<8 ) | (d >>8 ); + } +}
Quoted 3 lines
Quoted 1 line
why you don't use
outsw()andinsw()frominclude/asm-h8300/io.h?Because bus turns over, insw/outsw is not usable.
Please explain. I don't understand why outsw()/insw() from io.h can't be assigned to hwif->OUTSW/hwif->INSW.
Quoted 19 lines
Quoted 19 lines
(quoted diff) +2
-0+ ide_setup_ports(&hw, IDE_BASE, (int *)offsets, + IDE_CTRL, 0, NULL,IDE_IRQ);
ide_setup_ports()is deprecated, please do not use it.(quoted diff) +1
-0+ hwif->mmio = 0;Your driver is doing MMIO, it should request and release resources itself and set
hwif->mmioto 2.(quoted diff) +8
-0+void __init h8300_ide_print_resource(char *name, hw_regs_t *hw) +{ + printk("%s at 0x%08x-0x%08x,0x%08x on irq %d", name, + (unsigned int)hw->io_ports[IDE_DATA_OFFSET], + (unsigned int)hw->io_ports[IDE_DATA_OFFSET]+15, + (unsigned int)hw->io_ports[IDE_CONTROL_OFFSET], + hw->irq); +}
Quoted 6 lines
Quoted 2 lines
Is this necessary (this is a reason for extra #ifdefs in
ide-probe.c)? Can't we do what m68k is doing (print only address and IRQ) for now?I can use it.
But there is the problem that resource to use cannot output justly. I think that solved if can define a part of +7 with #define.
That's what I'm talking about. Do not print all resources but just base address and IRQ (you can still get rest from /proc/ioports if you want). Nevermind it is minor issue, we can live with one more #ifdef in ide-probe.c.
Quoted 9 lines
Quoted 6 lines
Both drivers use same IO ops so they can be moved to some include file or both drivers can be merged (preferred solution) - they are for different boards and can't work together (plus
MAX_HWIFSis defined to 1 for h8300).Here is patch (not tested) addressing some of these issues...
I identified operation.
MMIO andprint_resourceexamine a correction method.
Thanks.
--bart
Quoted 23 lines · Bartlomiej Zolnierkiewicz
Quoted 22 lines · Yoshinori Sato
Quoted 22 lines
drivers/ide/h8300/h8_ide_iops.h new file +21
-0+static void _outsw (unsigned long addr,void *buf,u32 len) +{ +unsigned volatile short *ap = (unsigned volatile short *)addr; +unsigned short *bp = (unsigned short *)buf; +unsigned short d; +while (len--) { + d = *bp++; + *ap = (d <<8 ) | (d >>8 ); + } +} + +static void _insw (unsigned long addr,void *buf,u32 len) +{ +unsigned volatile short *ap = (unsigned volatile short *)addr; +unsigned short *bp = (unsigned short *)buf; +unsigned short d; +while (len--) { + d = *ap; + *bp++ = (d <<8 ) | (d >>8 ); + } +}
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
why you don't use
outsw()andinsw()frominclude/asm-h8300/io.h?Because bus turns over, insw/outsw is not usable.
Please explain. I don't understand why outsw()/insw() from
io.hcan't be assigned to hwif->OUTSW/hwif->INSW.
I'd add that the above code is incredibely shitty... Whatever the HW does, this is not how it should be implemented.
Quoted 5 lines
Quoted 3 lines
why you don't use
outsw()andinsw()frominclude/asm-h8300/io.h?Because bus turns over, insw/outsw is not usable.
Please explain.
Your IDE bus is flipped backward ? The next one who do that should lose all rights to do any kind of HW design... Or is it a big endian platform ? In this case, use normal flipping inw/outw for IOs and non-flipping for stream IOs (insw/outsw)
Your functions are "streaming" versions, they should be called with the proper name "insw/outsw". Calling the streaming versions from the IO ones is wrong.
At Tue, 17 Feb 2004 09:09:38 +1100,
Quoted 5 lines · Benjamin Herrenschmidt
Quoted 5 lines
Quoted 4 lines
why you don't use
outsw()andinsw()frominclude/asm-h8300/io.h?
Quoted 8 lines
Quoted 1 line
Because bus turns over, insw/outsw is not usable.
Please explain.
Your IDE bus is flipped backward ? The next one who do that should lose all rights to do any kind of HW design... Or is it a big endian platform ? In this case, use normal flipping inw/outw for IOs and non-flipping for stream IOs (insw/outsw)
This architecture is big endian.
Quoted 6 lines
Your functions are "streaming" versions, they should be called with the proper name "insw/outsw". Calling the streaming versions from the IO ones is wrong.
It was my misunderstanding that did not use asm/io.h. It is the patch which it corrected to use it. h8300/h8_ide_iops.h becomes needless.
ide-probe.c renamed from ide-probe.c.orig +4 -5
@@ -983,6 +983,7 @@unsigned int index;ide_hwgroup_t *hwgroup;ide_hwif_t *match =NULL ; +int ide_regs_gap;BUG_ON (in_interrupt ());BUG_ON (irqs_disabled ());
@@ -1101,19 +1102,17 @@spin_unlock_irq (&ide_lock); } -#if !defined(__mc68000__) && !defined(CONFIG_APUS ) && !defined(__sparc__) && \ - !defined(__H8300H__) && !defined(__H8300S__) + ide_regs_gap = hwif->io_ports[IDE_ERROR_OFFSET ] - hwif->io_ports[IDE_DATA_OFFSET ]; +#if !defined(__mc68000__) && !defined(CONFIG_APUS ) && !defined(__sparc__)printk ("%s at 0x%03lx-0x%03lx,0x%03lx on irq %d" , hwif->name, hwif->io_ports[IDE_DATA_OFFSET ], - hwif->io_ports[IDE_DATA_OFFSET ]+7 , + hwif->io_ports[IDE_DATA_OFFSET ] + ide_regs_gap *8 -1 , hwif->io_ports[IDE_CONTROL_OFFSET ], hwif->irq);#elif defined(__sparc__)printk ("%s at 0x%03lx-0x%03lx,0x%03lx on irq %s" , hwif->name, hwif->io_ports[IDE_DATA_OFFSET ], hwif->io_ports[IDE_DATA_OFFSET ]+7 , hwif->io_ports[IDE_CONTROL_OFFSET ],__irq_itoa (hwif->irq)); -#elif defined(__H8300H__) || defined(__H8300S__) -h8300_ide_print_resource (hwif->name,&(hwif->hw));#else printk ("%s at 0x%08lx on irq %d" , hwif->name, hwif->io_ports[IDE_DATA_OFFSET ], hwif->irq);
aki3068_ide.c renamed from aki3068_ide.c.orig +2 -13
@@ -24,8 +24,6 @@#include <asm/irq.h> #include <asm/regs306x.h> -#include "h8_ide_iops.h" -/* IDE I/F configuration */ #define IDE_BASE CONFIG_H8300_IDE_BASE#define IDE_CTRL CONFIG_H8300_IDE_ALT
@@ -40,7 +38,7 @@#define IDE_SELECT 0x0C#define IDE_STATUS 0x0E -static void h8300_ide_ports (hw_regs_t *hw,unsigned long ioaddr) +static void __init h8300_ide_ports (hw_regs_t *hw,unsigned long ioaddr) { hw->io_ports[IDE_DATA_OFFSET ] = ioaddr +IDE_DATA ; hw->io_ports[IDE_ERROR_OFFSET ] = ioaddr +IDE_ERROR ;
@@ -68,14 +66,5 @@ hw.irq =IDE_IRQ ;if (ide_register_hw (&hw, &hwif) !=-1 ) -h8300_hwif_iops (hwif); -} - -void __init h8300_ide_print_resource (char *name,hw_regs_t *hw) -{ -printk ("%s at 0x%08x-0x%08x,0x%08x on irq %d" , name, - (unsigned int )hw->io_ports[IDE_DATA_OFFSET ], - (unsigned int )hw->io_ports[IDE_DATA_OFFSET ]+15 , - (unsigned int )hw->io_ports[IDE_CONTROL_OFFSET ], - hw->irq); +default_hwif_iops (hwif); }
h8max_ide.c renamed from h8max_ide.c.orig +2 -13
@@ -23,8 +23,6 @@#include <linux/init.h> #include <asm/irq.h> -#include "h8_ide_iops.h" -/* IDE I/F configuration */ #define IDE_BASE 0x200000#define IDE_CTRL 0x60000c
@@ -39,7 +37,7 @@#define IDE_SELECT 0x0C#define IDE_STATUS 0x0E -static void h8300_ide_ports (hw_regs_t *hw,unsigned long ioaddr) +static void __init h8300_ide_ports (hw_regs_t *hw,unsigned long ioaddr) { hw->io_ports[IDE_DATA_OFFSET ] = ioaddr +IDE_DATA ; hw->io_ports[IDE_ERROR_OFFSET ] = ioaddr +IDE_ERROR ;
@@ -63,14 +61,5 @@ hw.irq =IDE_IRQ ;if (ide_register_hw (&hw, &hwif) !=-1 ) -h8300_hwif_iops (hwif); -} - -void __init h8300_ide_print_resource (char *name,hw_regs_t *hw) -{ -printk ("%s at 0x%08x-0x%08x,0x%08x on irq %d" , name, - (unsigned int )hw->io_ports[IDE_DATA_OFFSET ], - (unsigned int )hw->io_ports[IDE_DATA_OFFSET ]+15 , - (unsigned int )hw->io_ports[IDE_CONTROL_OFFSET ], - hw->irq); +default_hwif_iops (hwif); }
Signature · 2 lines
Yoshinori Sato <[email protected]>
Quoted 7 lines
Quoted 5 lines
Your IDE bus is flipped backward ? The next one who do that should lose all rights to do any kind of HW design... Or is it a big endian platform ? In this case, use normal flipping inw/outw for IOs and non-flipping for stream IOs (insw/outsw)
This architecture is big endian.
A big endian architecture needs the standard inx/outx macros to be byteswapped, but _not_ the insw/outsw. That should be all done properly from the standard macros in your asm/io.h, you should _not_ have to byteswap normal transfers.
Quoted 3 lines
It was my misunderstanding that did not use
asm/io.h. It is the patch which it corrected to use it.h8300/h8_ide_iops.hbecomes needless.
Ben.
At Tue, 17 Feb 2004 23:55:54 +1100,
Quoted 7 lines · Benjamin Herrenschmidt
Quoted 7 lines
Quoted 6 lines
Your IDE bus is flipped backward ? The next one who do that should lose all rights to do any kind of HW design... Or is it a big endian platform ? In this case, use normal flipping inw/outw for IOs and non-flipping for stream IOs (insw/outsw)
Quoted 6 lines
Quoted 1 line
This architecture is big endian.
A big endian architecture needs the standard inx/outx macros to be byteswapped, but _not_ the insw/outsw. That should be all done properly from the standard macros in your
asm/io.h, you should _not_ have to byteswap normal transfers.
I appreciated incorrectly.
Quoted 7 lines
Quoted 3 lines
It was my misunderstanding that did not use
asm/io.h. It is the patch which it corrected to use it.h8300/h8_ide_iops.hbecomes needless.Ben.
I corrected it.
aki3068_ide.c renamed from aki3068_ide.c.orig +1 -10
@@ -40,7 +40,7 @@#define IDE_SELECT 0x0C#define IDE_STATUS 0x0E -static void h8300_ide_ports (hw_regs_t *hw,unsigned long ioaddr) +static void __init h8300_ide_ports (hw_regs_t *hw,unsigned long ioaddr) { hw->io_ports[IDE_DATA_OFFSET ] = ioaddr +IDE_DATA ; hw->io_ports[IDE_ERROR_OFFSET ] = ioaddr +IDE_ERROR ;
@@ -70,12 +70,3 @@if (ide_register_hw (&hw, &hwif) !=-1 )h8300_hwif_iops (hwif); } - -void __init h8300_ide_print_resource (char *name,hw_regs_t *hw) -{ -printk ("%s at 0x%08x-0x%08x,0x%08x on irq %d" , name, - (unsigned int )hw->io_ports[IDE_DATA_OFFSET ], - (unsigned int )hw->io_ports[IDE_DATA_OFFSET ]+15 , - (unsigned int )hw->io_ports[IDE_CONTROL_OFFSET ], - hw->irq); -}
h8max_ide.c renamed from h8max_ide.c.orig +1 -10
@@ -39,7 +39,7 @@#define IDE_SELECT 0x0C#define IDE_STATUS 0x0E -static void h8300_ide_ports (hw_regs_t *hw,unsigned long ioaddr) +static void __init h8300_ide_ports (hw_regs_t *hw,unsigned long ioaddr) { hw->io_ports[IDE_DATA_OFFSET ] = ioaddr +IDE_DATA ; hw->io_ports[IDE_ERROR_OFFSET ] = ioaddr +IDE_ERROR ;
@@ -65,12 +65,3 @@if (ide_register_hw (&hw, &hwif) !=-1 )h8300_hwif_iops (hwif); } - -void __init h8300_ide_print_resource (char *name,hw_regs_t *hw) -{ -printk ("%s at 0x%08x-0x%08x,0x%08x on irq %d" , name, - (unsigned int )hw->io_ports[IDE_DATA_OFFSET ], - (unsigned int )hw->io_ports[IDE_DATA_OFFSET ]+15 , - (unsigned int )hw->io_ports[IDE_CONTROL_OFFSET ], - hw->irq); -}
h8_ide_iops.h renamed from h8_ide_iops.h.orig +14 -20
@@ -1,28 +1,30 @@ +/* H8/300 IDE I/F I/O operations */ + +#include <asm/io.h> +static void __ide_outb (u8 d,unsigned long a) { - *(unsigned short *)a = d; +outb (d,a); }static void __ide_outbsync (ide_drive_t *drive,u8 d,unsigned long a) { - *(unsigned short *)a = d; +outb (d,a); }static u8 __ide_inb (unsigned long a) { -return *(unsigned short *)a; +return inb (a); }static void __ide_outw (u16 d,unsigned long a) { - *(unsigned short *)a = (d <<8 ) | (d >>8 ); +outw (d,a); }static u16 __ide_inw (unsigned long a) { -unsigned short d; - d = *(unsigned short *)a; -return (d <<8 ) | (d >>8 ); +return inw (a); }static void __ide_outl (u32 d,unsigned long a)
@@ -36,27 +38,19 @@static void __ide_outsw (unsigned long addr,void *buf,u32 len) { -unsigned volatile short *ap = (unsigned volatile short *)addr;unsigned short *bp = (unsigned short *)buf; -unsigned short d; -while (len--) { - d = *bp++; - *ap = (d <<8 ) | (d >>8 ); - } +while (len--) +outw (*bp++,addr); }static void __ide_insw (unsigned long addr,void *buf,u32 len) { -unsigned volatile short *ap = (unsigned volatile short *)addr;unsigned short *bp = (unsigned short *)buf; -unsigned short d; -while (len--) { - d = *ap; - *bp++ = (d <<8 ) | (d >>8 ); - } +while (len--) + *bp++ =inw (addr); } -static void h8300_hwif_iops (ide_hwif_t *hwif) +static void __init h8300_hwif_iops (ide_hwif_t *hwif) { hwif->OUTB = __ide_outb; hwif->OUTBSYNC = __ide_outbsync;
Signature · 2 lines
Yoshinori Sato <[email protected]>
Hi,
Can you send updated patch?
I am lost in incremental changes. :-)
Thanks.
At Thu, 19 Feb 2004 17:34:49 +0100,
Quoted 9 lines · Bartlomiej Zolnierkiewicz
Hi,
Can you send updated patch?
I am lost in incremental changes. :-)Thanks.
Difference with linux-2.6.3.
Signature · 2 lines
Yoshinori Sato <[email protected]>
drivers/ide/Makefile +1 -1
@@ -46,5 +46,5 @@ obj-$(CONFIG_BLK_DEV_IDETAPE) += ide-tape.o obj-$(CONFIG_BLK_DEV_IDEFLOPPY) += ide-floppy.o -obj-$(CONFIG_BLK_DEV_IDE) += legacy/ arm/ +obj-$(CONFIG_BLK_DEV_IDE) += legacy/ arm/ h8300/ obj-$(CONFIG_BLK_DEV_HD) += legacy/
drivers/ide/h8300/Makefile +3 -0
@@ -0,0 +1,3 @@ +obj-$(CONFIG_H8300H_H8MAX) := h8max_ide.o +obj-$(CONFIG_H8300H_AKI3068NET) := aki3068_ide.o +obj-m :=
drivers/ide/h8300/aki3068_ide.c +72 -0
72 lines not on this page · raw message
drivers/ide/h8300/h8_ide_iops.h +66 -0
66 lines not on this page · raw message
drivers/ide/h8300/h8max_ide.c +67 -0
67 lines not on this page · raw message
drivers/ide/ide-probe.c +3 -2
@@ -983,7 +983,7 @@unsigned int index;ide_hwgroup_t *hwgroup;ide_hwif_t *match =NULL ; - +int ide_regs_gap;BUG_ON (in_interrupt ());BUG_ON (irqs_disabled ());
@@ -1102,10 +1102,11 @@spin_unlock_irq (&ide_lock); } + ide_regs_gap = hwif->io_ports[IDE_ERROR_OFFSET ] - hwif->io_ports[IDE_DATA_OFFSET ];#if !defined(__mc68000__) && !defined(CONFIG_APUS ) && !defined(__sparc__)printk ("%s at 0x%03lx-0x%03lx,0x%03lx on irq %d" , hwif->name, hwif->io_ports[IDE_DATA_OFFSET ], - hwif->io_ports[IDE_DATA_OFFSET ]+7 , + hwif->io_ports[IDE_DATA_OFFSET ] + ide_regs_gap *8 -1 , hwif->io_ports[IDE_CONTROL_OFFSET ], hwif->irq);#elif defined(__sparc__) printk("%s at 0x%03lx-0x%03lx,0x%03lx on irq %s", hwif->name,
drivers/ide/ide.c +6 -0
@@ -2239,6 +2239,12 @@ pnpide_init(1); }#endif /* CONFIG_BLK_DEV_IDEPNP */ +#if defined(__H8300H__) || defined(__H8300S__) + { +extern void h8300_ide_init (void ); +h8300_ide_init (); + } +#endif /* defined(__H8300H__) || defined(__H8300S__) */ }/*
Quoted 11 lines · Yoshinori Sato
At Thu, 19 Feb 2004 17:34:49 +0100,
Quoted 6 lines · Bartlomiej Zolnierkiewicz
Hi,
Can you send updated patch?
I am lost in incremental changes. :-)Thanks.
Difference with linux-2.6.3.
Hi,
Your patch lacks Kconfig entries for CONFIG_H8300_IDE_{BASE,ALT,IRQNO} and they are not present in kernel 2.6.3?
Are you aware that you can't build kernel which will support both controllers? Not an issue if you can't build kernel which supports both this boards. :-)
I cleaned up patch a bit, changelog:
- h8max_ide.c and aki3068_ide.c merged into ide-h8300.c
- added #if !defined(__H8300H__) to ide-proc.c
(only place where ->OUTL is used, ->INL is unused in generic IDE code)
- __ide_outl() and __ide_inl() removed
- redundant includes removed
- init driver through initcall (so no need to make changes in ide.c)
Not tested et all, I don't know whether it compiles. :-)
linux-2.6.3-root/drivers/ide/Makefile | 5 linux-2.6.3-root/drivers/ide/h8300/ide-h8300.c | 139 +++++++++++++++++++++++++ linux-2.6.3-root/drivers/ide/ide-probe.c | 5 linux-2.6.3-root/drivers/ide/ide-proc.c | 5 4 files changed, 149 insertions(+), 5 deletions(-)
drivers/ide/h8300/ide-h8300.c new file +139 -0
@@ -0,0 +1,139 @@ +/****************************************************************************/ +/* +* linux/drivers/ide/ide-h8300.c +* H8MAX and aki3068net IDE Interfaces support +* +* Copyright (C) 2003 Yoshinori Sato <[email protected]> +* +* 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/config.h> +#include <linux/types.h> +#include <linux/init.h> +#include <linux/module.h> +#include <linux/ide.h> +#include <linux/interrupt.h> +#include <asm/irq.h> +#include <asm/io.h> +#include <asm/regs306x.h> + +/* IDE I/F configuration */ + +#ifdef CONFIG_H8300H_H8MAX +#define IDE_BASE 0x200000 +#define IDE_CTRL 0x60000c +#define IDE_IRQ EXT_IRQ5 +#endif + +#ifdef CONFIG_H8300H_AKI3068NET +#define IDE_BASE CONFIG_H8300_IDE_BASE +#define IDE_CTRL CONFIG_H8300_IDE_ALT +#define IDE_IRQ (EXT_IRQ0 + CONFIG_H8300_IDE_IRQNO) +#endif + +#define IDE_DATA 0x00 +#define IDE_ERROR 0x02 +#define IDE_NSECTOR 0x04 +#define IDE_SECTOR 0x06 +#define IDE_LCYL 0x08 +#define IDE_HCYL 0x0A +#define IDE_SELECT 0x0C +#define IDE_STATUS 0x0E + +static void __init h8300_ide_ports (hw_regs_t *hw,unsigned long ioaddr) +{ + hw->io_ports[IDE_DATA_OFFSET ] = ioaddr +IDE_DATA ; + hw->io_ports[IDE_ERROR_OFFSET ] = ioaddr +IDE_ERROR ; + hw->io_ports[IDE_NSECTOR_OFFSET ] = ioaddr +IDE_NSECTOR ; + hw->io_ports[IDE_SECTOR_OFFSET ] = ioaddr +IDE_SECTOR ; + hw->io_ports[IDE_LCYL_OFFSET ] = ioaddr +IDE_LCYL ; + hw->io_ports[IDE_HCYL_OFFSET ] = ioaddr +IDE_HCYL ; + hw->io_ports[IDE_SELECT_OFFSET ] = ioaddr +IDE_SELECT ; + hw->io_ports[IDE_STATUS_OFFSET ] = ioaddr +IDE_STATUS ; +} + +/* H8/300 IDE I/F I/O operations */ + +static void __ide_outb (u8 d,unsigned long a) +{ +outb (d,a); +} + +static void __ide_outbsync (ide_drive_t *drive,u8 d,unsigned long a) +{ +outb (d,a); +} + +static u8 __ide_inb (unsigned long a) +{ +return inb (a); +} + +static void __ide_outw (u16 d,unsigned long a) +{ +return outw (d,a); +} + +static u16 __ide_inw (unsigned long a) +{ +return inw (a); +} + +static void __ide_outsw (unsigned long addr,void *buf,u32 len) +{ +unsigned short *bp = (unsigned short *)buf; +while (len--) +outw (*bp++,addr); +} + +static void __ide_insw (unsigned long addr,void *buf,u32 len) +{ +unsigned short *bp = (unsigned short *)buf; +while (len--) + *bp++ =inw (addr); +} + +static void __init h8300_hwif_iops (ide_hwif_t *hwif) +{ + hwif->OUTB = __ide_outb; + hwif->OUTBSYNC = __ide_outbsync; + hwif->OUTW = __ide_outw; + hwif->OUTL =NULL ; + hwif->OUTSW = __ide_outsw; + hwif->OUTSL =NULL ; + hwif->INB = __ide_inb; + hwif->INW = __ide_inw; + hwif->INL =NULL ; + hwif->INSW = __ide_insw; + hwif->INSL =NULL ; +} + +static int __init h8300_ide_init (void ) +{ +hw_regs_t hw; +ide_hwif_t *hwif; + +#ifdef CONFIG_H8300H_AKI3068NET +volatile unsigned char *abwcr = (volatile unsigned char *)ABWCR ; +volatile unsigned char *cscr = (volatile unsigned char *)CSCR ; + *abwcr &= ~((1 << ((IDE_BASE >>21 ) &7 )) | (1 << ((IDE_CTRL >>21 ) &7 ))); + *cscr |= (1 << ((IDE_BASE >>21 ) &7 )) | (1 << ((IDE_CTRL >>21 ) &7 )) |0x0f ; +#endif +memset (&hw,0 ,sizeof (hw)); + +h8300_ide_ports (&hw,IDE_BASE ); + hw.io_ports[IDE_CONTROL_OFFSET ] =IDE_CTRL ; + hw.irq =IDE_IRQ ; + +if (ide_register_hw (&hw, &hwif) !=-1 ) +h8300_hwif_iops (hwif); + +return 0 ; +} + +module_init (h8300_ide_init);
drivers/ide/ide-probe.c renamed from drivers/ide/ide-probe.c~ide_h8300 +3 -2
@@ -965,7 +965,7 @@ static int init_irq (ide_hwif_t *hwif)unsigned int index;ide_hwgroup_t *hwgroup;ide_hwif_t *match =NULL ; - +unsigned int regs_gap;/* needed for H8/300 */ BUG_ON (in_interrupt ());BUG_ON (irqs_disabled ());
@@ -1084,10 +1084,11 @@ static int init_irq (ide_hwif_t *hwif)spin_unlock_irq (&ide_lock); } + regs_gap = hwif->io_ports[IDE_ERROR_OFFSET ] - hwif->io_ports[IDE_DATA_OFFSET ];#if !defined(__mc68000__) && !defined(CONFIG_APUS ) && !defined(__sparc__)printk ("%s at 0x%03lx-0x%03lx,0x%03lx on irq %d" , hwif->name, hwif->io_ports[IDE_DATA_OFFSET ], - hwif->io_ports[IDE_DATA_OFFSET ]+7 , + hwif->io_ports[IDE_DATA_OFFSET ] + regs_gap *8 -1 , hwif->io_ports[IDE_CONTROL_OFFSET ], hwif->irq);#elif defined(__sparc__) printk("%s at 0x%03lx-0x%03lx,0x%03lx on irq %s", hwif->name,
drivers/ide/ide-proc.c renamed from drivers/ide/ide-proc.c~ide_h8300 +2 -3
@@ -239,8 +239,7 @@ static int proc_ide_write_config }#endif /* CONFIG_BLK_DEV_IDEPCI */ }else {/* not pci */ -#if !defined(__mc68000__) && !defined(CONFIG_APUS ) - +#if !defined(__mc68000__) && !defined(CONFIG_APUS ) && !defined(__H8300H__)/* * Geert Uytterhoeven *
@@ -268,7 +267,7 @@ static int proc_ide_write_configcase 8 : hwif->OUTL (val, reg); break; } -#endif /* !__mc68000__ && !CONFIG_APUS */ +#endif /* !__mc68000__ && !CONFIG_APUS !__H8300H__ */ } } }
drivers/ide/Makefile renamed from drivers/ide/Makefile~ide_h8300 +5 -0
@@ -39,6 +39,11 @@ ide-core-$(CONFIG_BLK_DEV_IDE_PMAC) += p ide-core-$(CONFIG_BLK_DEV_IDE_SWARM) += ppc/swarm.o obj-$(CONFIG_BLK_DEV_IDE) += ide-core.o + +# there can be only one interface => no ordering problems +ide-$(CONFIG_H8300H_H8MAX) += h8300/ide-h8300.o +ide-$(CONFIG_H8300H_AKI3068NET) += h8300/ide-h8300.o + obj-$(CONFIG_IDE_GENERIC) += ide-generic.o obj-$(CONFIG_BLK_DEV_IDEDISK) += ide-disk.o
_
At Fri, 20 Feb 2004 16:25:42 +0100,
Quoted 10 lines · Bartlomiej Zolnierkiewicz
Quoted 8 lines · Yoshinori Sato
At Thu, 19 Feb 2004 17:34:49 +0100,
Quoted 5 lines · Bartlomiej Zolnierkiewicz
Hi,
Can you send updated patch?
I am lost in incremental changes. :-)
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
Thanks.
Difference with linux-2.6.3.
Hi,
Your patch lacks
Kconfigentries for CONFIG_H8300_IDE_{BASE,ALT,IRQNO} and they are not present in kernel 2.6.3?
It is not done merge yet.
I compound it with other corrections and will submit it.
Quoted 5 lines
Are you aware that you can't build kernel which will support both controllers? Not an issue if you can't build kernel which supports both this boards. :-)
I cleaned up patch a bit, changelog:
-h8max_ide.candaki3068_ide.cmerged intoide-h8300.c
Because there is a target different in implementation, correspondence becomes easy separated.
Quoted 2 lines
- added #if !defined(__H8300H__) to
ide-proc.c
(only place where ->OUTL is used, ->INL is unused in generic IDE code)
"__H8300S__" becomes the same condition, too.
Quoted 3 lines
-
__ide_outl()and__ide_inl()removed
- redundant includes removed
- init driver through initcall (so no need to make changes inide.c)
It seems to have been overwritten with default_hwif_iops setting of h8300_hwif_iops in module_init.
Quoted 2 lines
Not tested et all, I don't know whether it compiles. :-)
Signature · 2 lines
Yoshinori Sato <[email protected]>
Quoted 4 lines · Yoshinori Sato
Quoted 2 lines
- added #if !defined(__H8300H__) to
ide-proc.c
(only place where ->OUTL is used, ->INL is unused in generic IDE code)"
__H8300S__" becomes the same condition, too.
Oh yes, it should be CONFIG_H8300.
Quoted 6 lines
Quoted 3 lines
-
__ide_outl()and__ide_inl()removed
- redundant includes removed
- init driver through initcall (so no need to make changes inide.c)It seems to have been overwritten with
default_hwif_iopssetting ofh8300_hwif_iopsinmodule_init.
Yep, h8300_ide_init() still should be called from ide.c. (because ide_register_hw() checks "initialization" flag etc.)
At Fri, 20 Feb 2004 19:42:00 +0100,
Quoted 14 lines · Bartlomiej Zolnierkiewicz
Quoted 4 lines · Yoshinori Sato
Quoted 2 lines
- added #if !defined(__H8300H__) to
ide-proc.c
(only place where ->OUTL is used, ->INL is unused in generic IDE code)"
__H8300S__" becomes the same condition, too.Oh yes, it should be
CONFIG_H8300.Quoted 4 lines
Quoted 3 lines
-
__ide_outl()and__ide_inl()removed
- redundant includes removed
- init driver through initcall (so no need to make changes inide.c)
Quoted 6 lines
Quoted 2 lines
It seems to have been overwritten with
default_hwif_iopssetting ofh8300_hwif_iopsinmodule_init.Yep,
h8300_ide_init()still should be called fromide.c. (becauseide_register_hw()checks "initialization" flag etc.)
I corrected it to initialize it with ide_init_default_hwifs. A correction of ide.c becomes needless.
Because h8300-iops.c might change every a target,
I arranged with the other directory.
drivers/ide/Makefile +1 -1
@@ -46,5 +46,5 @@ obj-$(CONFIG_BLK_DEV_IDETAPE) += ide-tape.o obj-$(CONFIG_BLK_DEV_IDEFLOPPY) += ide-floppy.o -obj-$(CONFIG_BLK_DEV_IDE) += legacy/ arm/ +obj-$(CONFIG_BLK_DEV_IDE) += legacy/ arm/ h8300/ obj-$(CONFIG_BLK_DEV_HD) += legacy/
drivers/ide/h8300/Makefile +2 -0
@@ -0,0 +1,2 @@ +obj-$(CONFIG_H8300H_H8MAX) := h8300-iops.o +obj-$(CONFIG_H8300H_AKI3068NET) := h8300-iops.o
drivers/ide/h8300/h8300-iops.c +107 -0
107 lines not on this page · raw message
drivers/ide/ide-probe.c +3 -2
@@ -983,7 +983,7 @@unsigned int index;ide_hwgroup_t *hwgroup;ide_hwif_t *match =NULL ; - +unsigned int ide_regs_gap;/* needed for H8/300 */ BUG_ON (in_interrupt ());BUG_ON (irqs_disabled ());
@@ -1102,11 +1102,12 @@spin_unlock_irq (&ide_lock); } + ide_regs_gap = hwif->io_ports[IDE_ERROR_OFFSET ] - hwif->io_ports[IDE_DATA_OFFSET ];#if !defined(__mc68000__) && !defined(CONFIG_APUS ) && !defined(__sparc__)printk ("%s at 0x%03lx-0x%03lx,0x%03lx on irq %d" , hwif->name, hwif->io_ports[IDE_DATA_OFFSET ], - hwif->io_ports[IDE_DATA_OFFSET ]+7 , + hwif->io_ports[IDE_DATA_OFFSET ] + ide_regs_gap *8 -1 , hwif->io_ports[IDE_CONTROL_OFFSET ], hwif->irq);#elif defined(__sparc__) printk("%s at 0x%03lx-0x%03lx,0x%03lx on irq %s", hwif->name,
drivers/ide/ide-proc.c +2 -3
@@ -239,8 +239,7 @@ static int proc_ide_write_config }#endif /* CONFIG_BLK_DEV_IDEPCI */ }else {/* not pci */ -#if !defined(__mc68000__) && !defined(CONFIG_APUS ) - +#if !defined(__mc68000__) && !defined(CONFIG_APUS ) && !defined(__H8300H__) && !defined(__H8300S__)/* * Geert Uytterhoeven *
@@ -268,7 +267,7 @@ static int proc_ide_write_configcase 8 : hwif->OUTL (val, reg); break; } -#endif /* !__mc68000__ && !CONFIG_APUS */ +#endif /* !__mc68000__ && !CONFIG_APUS !__H8300H__ && !__H8300S__ */ } } }
include/asm-h8300/ide.h +16 -9
@@ -16,19 +16,26 @@#ifdef __KERNEL__/****************************************************************************/ -void h8300_ide_print_resource (char *name,hw_regs_t *hw); -static inline int ide_default_irq (unsigned long base) {return 0 ; }; -static inline unsigned long ide_default_io_base (int index) {return 0 ; }; +#define H8300_IDE_DEFINE +#include <asm/machine-depend.h> +#undef H8300_IDE_DEFINE -static __inline__void ide_init_hwif_ports (hw_regs_t *hw,unsigned long data_port, -unsigned long ctrl_port,int *irq) +static __inline__int ide_default_irq (unsigned long base) { -} +return IDE_IRQ ; +}; - -static inline void ide_init_default_hwifs (void ) +static __inline__unsigned long ide_default_io_base (int index) { -} +if (index ==0 ) +return IDE_BASE ; +else +return 0 ; +}; + +void ide_init_hwif_ports (hw_regs_t *hw,unsigned long data_port, +unsigned long ctrl_port,int *irq); +void ide_init_default_hwifs (void );#define MAX_HWIFS 1
Signature · 2 lines
Yoshinori Sato <[email protected]>
Quoted 16 lines · Yoshinori Sato
At Fri, 20 Feb 2004 19:42:00 +0100,
Quoted 13 lines · Bartlomiej Zolnierkiewicz
Quoted 5 lines · Yoshinori Sato
Quoted 3 lines
- added #if !defined(__H8300H__) to
ide-proc.c
(only place where ->OUTL is used, ->INL is unused in generic IDE
code)"
__H8300S__" becomes the same condition, too.Oh yes, it should be
CONFIG_H8300.Quoted 4 lines
Quoted 3 lines
-
__ide_outl()and__ide_inl()removed
- redundant includes removed
- init driver through initcall (so no need to make changes inide.c)
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
It seems to have been overwritten with
default_hwif_iopssetting ofh8300_hwif_iopsinmodule_init.Yep,
h8300_ide_init()still should be called fromide.c. (becauseide_register_hw()checks "initialization" flag etc.)I corrected it to initialize it with
ide_init_default_hwifs. A correction ofide.cbecomes needless.
NO!!! ide_init_default_hwifs() should DIE!
The same goes for ide_default_{irq,io_base}().
They are not needed - you have driver(s) for H8/300 IDE controllers!
Quoted 2 lines
Because
h8300-iops.cmight change every a target,
I arranged with the other directory.
Please explain.
drivers/ide/h8300/h8300-iops.c line 47
Quoted 13 lines
drivers/ide/h8300/h8300-iops.c +13
-0+static u16 __ide_inw (unsigned long a) +{ +return inw (a); +} + +static void __ide_outl (u32 d,unsigned long a) +{ +} + +static u32 __ide_inl (unsigned long a) +{ +return 0xffffffffUL ; +}
__ide_outl() and __inl() are really not needed
drivers/ide/h8300/h8300-iops.c line 79
Quoted 2 lines
drivers/ide/h8300/h8300-iops.c +2
-0+void __init ide_init_hwif_ports (hw_regs_t *hw,unsigned long data_port, +unsigned long ctrl_port,int *irq)
This should be static as it was before.
include/asm-h8300/ide.h line 21
Quoted 6 lines
include/asm-h8300/ide.h +3
-3-void h8300_ide_print_resource (char *name,hw_regs_t *hw); -static inline int ide_default_irq (unsigned long base) {return 0 ; }; -static inline unsigned long ide_default_io_base (int index) {return 0 ; }; +#define H8300_IDE_DEFINE +#include <asm/machine-depend.h> +#undef H8300_IDE_DEFINE
What's that?
If you want to choose between H8MAX and IDE expand for AE-3068/9 just do this using arch specific Kconfig or (better in my opinion) in drivers/ide/Kconfig.
Quoted 12 lines
-static
__inline__void ide_init_hwif_ports(hw_regs_t *hw, unsigned longdata_port, - unsigned longctrl_port, int *irq)include/asm-h8300/ide.h +4
-3+static __inline__int ide_default_irq (unsigned long base) { -} +return IDE_IRQ ; +}; - -static inline void ide_init_default_hwifs (void ) +static __inline__unsigned long ide_default_io_base (int index) {
include/asm-h8300/ide.h line 38
Quoted 10 lines
include/asm-h8300/ide.h +9
-1-} +if (index ==0 ) +return IDE_BASE ; +else +return 0 ; +}; + +void ide_init_hwif_ports (hw_regs_t *hw,unsigned long data_port, +unsigned long ctrl_port,int *irq); +void ide_init_default_hwifs (void );
This is just wrong and redundant.
Please, no more <asm/ide.h> crap for new IDE drivers.
Cheers,
--bart
Quoted 7 lines · Bartlomiej Zolnierkiewicz
Quoted 2 lines
I corrected it to initialize it with
ide_init_default_hwifs. A correction ofide.cbecomes needless.NO!!!
ide_init_default_hwifs()should DIE!
The same goes for ide_default_{irq,io_base}().They are not needed - you have driver(s) for H8/300 IDE controllers!
It should be like that:
You should have host drivers for your IDE controllers, not inline functions for ide.c and ide-probe.c.
At Sun, 22 Feb 2004 18:28:18 +0100,
Quoted 9 lines · Bartlomiej Zolnierkiewicz
Quoted 6 lines · Bartlomiej Zolnierkiewicz
Quoted 2 lines
I corrected it to initialize it with
ide_init_default_hwifs. A correction ofide.cbecomes needless.NO!!!
ide_init_default_hwifs()should DIE!
The same goes for ide_default_{irq,io_base}().
Quoted 7 lines
Quoted 1 line
They are not needed - you have driver(s) for H8/300 IDE controllers!
It should be like that:
You should have host drivers for your IDE controllers, not inline functions for
ide.candide-probe.c.
I tuned to a driver of PC/AT wherever practicable. Examination is necessary for a call method of h8300_hwif_iops. CONFIG_H8300_IDE_foo defines it with arch/h8300/Kconfig.
drivers/ide/Makefile +1 -1
@@ -46,5 +46,5 @@ obj-$(CONFIG_BLK_DEV_IDETAPE) += ide-tape.o obj-$(CONFIG_BLK_DEV_IDEFLOPPY) += ide-floppy.o -obj-$(CONFIG_BLK_DEV_IDE) += legacy/ arm/ +obj-$(CONFIG_BLK_DEV_IDE) += legacy/ arm/ h8300/ obj-$(CONFIG_BLK_DEV_HD) += legacy/
drivers/ide/h8300/Makefile +2 -0
@@ -0,0 +1,2 @@ +obj-$(CONFIG_H8300H_H8MAX) := h8300-iops.o +obj-$(CONFIG_H8300H_AKI3068NET) := h8300-iops.o
drivers/ide/h8300/h8300-iops.c +67 -0
67 lines not on this page · raw message
drivers/ide/ide-iops.c +7 -0
@@ -31,6 +31,7 @@* Conventional PIO operations for ATA devices */ +#if !defined(__H8300H__) && !defined(__H8300S__)/* not use H8/300 target */ static u8 ide_inb (unsigned long port) {return (u8 )inb (port);
@@ -88,9 +158,14 @@ {outsl (port, addr, count); } +#endif /* !defined(__H8300H__) && !defined(__H8300S__) */ void default_hwif_iops (ide_hwif_t *hwif) { +#if defined(__H8300H__) || defined(__H8300S__) +void h8300_hwif_iops (ide_hwif_t *hwif); +h8300_hwif_iops (hwif); +#else hwif->OUTB = ide_outb; hwif->OUTBSYNC = ide_outbsync; hwif->OUTW = ide_outw;
@@ -102,6 +177,7 @@ hwif->INL = ide_inl; hwif->INSW = ide_insw; hwif->INSL = ide_insl; +#endif }EXPORT_SYMBOL (default_hwif_iops);
include/asm-h8300/ide.h +46 -6
66 lines not on this page · raw message
Yoshinori Sato
<[email protected]>
Quoted 10 lines · Yoshinori Sato
At Sun, 22 Feb 2004 18:28:18 +0100,
Quoted 7 lines · Bartlomiej Zolnierkiewicz
Quoted 6 lines · Bartlomiej Zolnierkiewicz
Quoted 2 lines
I corrected it to initialize it with
ide_init_default_hwifs. A correction ofide.cbecomes needless.NO!!!
ide_init_default_hwifs()should DIE!
The same goes for ide_default_{irq,io_base}().
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
They are not needed - you have driver(s) for H8/300 IDE controllers!
It should be like that:
You should have host drivers for your IDE controllers, not inline functions for
ide.candide-probe.c.I tuned to a driver of PC/AT wherever practicable.
Just because original/legacy PC/AT driver is braindamaged (and dated) doesn't mean your code should be, does it? Hiding driver's code into asm/ide.h causes MAJOR problems for IDE code reorganization.
Quoted 1 line
Examination is necessary for a call method of
h8300_hwif_iops.
All ide-iops.c #ifdef-s won't be needed if you separate you driver properly from asm/ide.h (thus overriding default_hwif_iops() ops by ones used by your driver).
Please revert to putting your code into ide/h8300/.
Thanks.
At Thu, 26 Feb 2004 20:26:51 +0100,
Quoted 25 lines · Bartlomiej Zolnierkiewicz
Quoted 10 lines · Yoshinori Sato
At Sun, 22 Feb 2004 18:28:18 +0100,
Quoted 7 lines · Bartlomiej Zolnierkiewicz
Quoted 6 lines · Bartlomiej Zolnierkiewicz
Quoted 2 lines
I corrected it to initialize it with
ide_init_default_hwifs. A correction ofide.cbecomes needless.NO!!!
ide_init_default_hwifs()should DIE!
The same goes for ide_default_{irq,io_base}().Quoted 8 lines
Quoted 6 lines
Quoted 1 line
They are not needed - you have driver(s) for H8/300 IDE controllers!
It should be like that:
You should have host drivers for your IDE controllers, not inline functions for
ide.candide-probe.c.I tuned to a driver of PC/AT wherever practicable.
Just because original/legacy PC/AT driver is braindamaged (and dated) doesn't mean your code should be, does it? Hiding driver's code into
asm/ide.hcauses MAJOR problems for IDE code reorganization.
Quoted 8 lines
Quoted 1 line
Examination is necessary for a call method of
h8300_hwif_iops.All
ide-iops.c#ifdef-s won't be needed if you separate you driver properly fromasm/ide.h(thus overridingdefault_hwif_iops()ops by ones used by your driver).Please revert to putting your code into ide/h8300/.
I did overriding of default_hwif_iops in form to replace obj because it was not possible well.
It is difference m with linux-2.6.4-rc1.
Do not change asm/ide.h.
Index: drivers/ide/Makefile
===================================================================
RCS file: /var/lib/cvs/linux-2.6/drivers/ide/Makefile,v retrieving revision 1.1.1.7
drivers/ide/Makefile +5 -1
@@ -16,6 +16,10 @@ ide-core-y += ide.o ide-default.o ide-io.o ide-iops.o ide-lib.o ide-probe.o \ ide-taskfile.o +ifndef CONFIG_H8300 +ide-core-y += ide-lowio.o +endif + ide-core-$(CONFIG_BLK_DEV_CMD640) += pci/cmd640.o # Core IDE code - must come before legacy
@@ -46,5 +50,5 @@ obj-$(CONFIG_BLK_DEV_IDETAPE) += ide-tape.o obj-$(CONFIG_BLK_DEV_IDEFLOPPY) += ide-floppy.o -obj-$(CONFIG_BLK_DEV_IDE) += legacy/ arm/ +obj-$(CONFIG_BLK_DEV_IDE) += legacy/ arm/ h8300/ obj-$(CONFIG_BLK_DEV_HD) += legacy/
Index: drivers/ide/ide-iops.c
===================================================================
RCS file: /var/lib/cvs/linux-2.6/drivers/ide/ide-iops.c,v retrieving revision 1.1.1.3
drivers/ide/ide-iops.c +0 -154
160 lines not on this page · raw message
Index: drivers/ide/ide-lowio.c
===================================================================
RCS file: drivers/ide/ide-lowio.c
drivers/ide/ide-lowio.c new file +231 -0
231 lines not on this page · raw message
Index: drivers/ide/ide-probe.c
===================================================================
RCS file: /var/lib/cvs/linux-2.6/drivers/ide/ide-probe.c,v retrieving revision 1.1.1.8
retrieving revision 1.6
drivers/ide/ide-probe.c +3 -2
@@ -978,7 +978,7 @@unsigned int index;ide_hwgroup_t *hwgroup;ide_hwif_t *match =NULL ; - +int ide_regs_gap;BUG_ON (in_interrupt ());BUG_ON (irqs_disabled ());
@@ -1097,10 +1097,11 @@spin_unlock_irq (&ide_lock); } + ide_regs_gap = hwif->io_ports[IDE_ERROR_OFFSET ] - hwif->io_ports[IDE_DATA_OFFSET ];#if !defined(__mc68000__) && !defined(CONFIG_APUS ) && !defined(__sparc__)printk ("%s at 0x%03lx-0x%03lx,0x%03lx on irq %d" , hwif->name, hwif->io_ports[IDE_DATA_OFFSET ], - hwif->io_ports[IDE_DATA_OFFSET ]+7 , + hwif->io_ports[IDE_DATA_OFFSET ] + ide_regs_gap *8 -1 , hwif->io_ports[IDE_CONTROL_OFFSET ], hwif->irq);#elif defined(__sparc__) printk("%s at 0x%03lx-0x%03lx,0x%03lx on irq %s", hwif->name,
Index: drivers/ide/h8300/Makefile
===================================================================
RCS file: drivers/ide/h8300/Makefile
drivers/ide/h8300/Makefile new file +2 -0
@@ -0,0 +1,2 @@ +obj-$(CONFIG_H8300H_H8MAX) := h8300-lowio.o +obj-$(CONFIG_H8300H_AKI3068NET) := h8300-lowio.o
Index: drivers/ide/h8300/h8300-lowio.c
===================================================================
RCS file: drivers/ide/h8300/h8300-lowio.c
drivers/ide/h8300/h8300-lowio.c new file +79 -0
79 lines not on this page · raw message
Signature · 2 lines
Yoshiori Sato <[email protected]>
Quoted 34 lines · Yoshinori Sato
At Thu, 26 Feb 2004 20:26:51 +0100,
Quoted 31 lines · Bartlomiej Zolnierkiewicz
Quoted 13 lines · Yoshinori Sato
At Sun, 22 Feb 2004 18:28:18 +0100,
Quoted 10 lines · Bartlomiej Zolnierkiewicz
Quoted 8 lines · Bartlomiej Zolnierkiewicz
Quoted 2 lines
I corrected it to initialize it with
ide_init_default_hwifs. A correction ofide.cbecomes needless.NO!!!
ide_init_default_hwifs()should DIE!
The same goes for ide_default_{irq,io_base}().They are not needed - you have driver(s) for H8/300 IDE controllers!
Quoted 6 lines
Quoted 4 lines
It should be like that:
You should have host drivers for your IDE controllers, not inline functions for
ide.candide-probe.c.I tuned to a driver of PC/AT wherever practicable.
Just because original/legacy PC/AT driver is braindamaged (and dated) doesn't mean your code should be, does it? Hiding driver's code into
asm/ide.hcauses MAJOR problems for IDE code reorganization.Quoted 1 line
Examination is necessary for a call method of
h8300_hwif_iops.All
ide-iops.c#ifdef-s won't be needed if you separate you driver properly fromasm/ide.h(thus overridingdefault_hwif_iops()ops by ones used by your driver).
Quoted 6 lines
Quoted 1 line
Please revert to putting your code into ide/h8300/.
I did overriding of
default_hwif_iopsin form to replace obj because it was not possible well.It is difference m with linux-2.6.4-rc1.
This change won't be needed if you correct your driver as asked. BTW Your patch re-adds recently deleted unplugged_hwif_iops for no reason.
Quoted 1 line
Do not change
asm/ide.h.
Please correct your patch to not abuse asm/ide.h (ide_init_default_hwifs(), ide_default_irq() and ide_default_io_base() needs to die).
Cheers,
Bartlomiej