LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] H8/300 IDE support update
@ 2004-05-14 12:39 Yoshinori Sato
  2004-05-14 13:07 ` Bartlomiej Zolnierkiewicz
  0 siblings, 1 reply; 4+ messages in thread
From: Yoshinori Sato @ 2004-05-14 12:39 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux kernel Mailing List

- IDE support update.
- unused memory hole delete.

-- 
Yoshinori Sato
<ysato@users.sourceforge.jp>

diff -Nru linux-2.6.6/arch/h8300/Kconfig.ide linux-2.6.6-h8300/arch/h8300/Kconfig.ide
--- linux-2.6.6/arch/h8300/Kconfig.ide	11 May 2004 02:16:05 -0000
+++ linux-2.6.6-h8300/arch/h8300/Kconfig.ide	14 May 2004 11:44:08 -0000
@@ -1,23 +1,44 @@
 # uClinux H8/300 Target Board Selection Menu (IDE)
 
+if (H8300H_AKI3068NET)
 menu "IDE Extra configuration"
 
 config H8300_IDE_BASE
 	hex "IDE regitser base address"
 	depends on IDE
+	default 0
 	help
 	  IDE registers base address
 
 config H8300_IDE_ALT
 	hex "IDE regitser alternate address"
 	depends on IDE
+	default 0
 	help
 	  IDE alternate registers address
 
 config H8300_IDE_IRQ
 	int "IDE IRQ no"
 	depends on IDE
+	default 0
 	help
-	  IDE I/F using IRQ no
-
+	  IDE use IRQ no
 endmenu
+endif
+
+if (H8300H_H8MAX)
+config H8300_IDE_BASE
+	hex
+	depends on IDE
+	default 0x200000
+
+config H8300_IDE_ALT
+	hex
+	depends on IDE
+	default 0x60000c
+
+config H8300_IDE_IRQ
+	int
+	depends on IDE
+	default 5
+endif
diff -Nru linux-2.6.6/arch/h8300/kernel/setup.c linux-2.6.6-h8300/arch/h8300/kernel/setup.c
--- linux-2.6.6/arch/h8300/kernel/setup.c	26 Mar 2004 09:12:36 -0000
+++ linux-2.6.6-h8300/arch/h8300/kernel/setup.c	14 May 2004 11:36:34 -0000
@@ -40,16 +40,12 @@
 
 #if defined(__H8300H__)
 #define CPU "H8/300H"
+#include <asm/regs306x.h>
 #endif
 
 #if defined(__H8300S__)
 #define CPU "H8S"
-#endif
-
-#if defined(CONFIG_INTELFLASH)
-#define BLKOFFSET 512
-#else
-#define BLKOFFSET 0
+#include <asm/regs267x.h>
 #endif
 
 #define STUBSIZE 0xc000;
@@ -58,8 +54,6 @@
 unsigned long memory_start;
 unsigned long memory_end;
 
-struct task_struct *_current_task;
-
 char command_line[512];
 char saved_command_line[512];
 
@@ -107,12 +101,11 @@
 	memory_start = (unsigned long) &_ramstart;
 
 	/* allow for ROMFS on the end of the kernel */
-	if (memcmp((void *)(memory_start + BLKOFFSET), "-rom1fs-", 8) == 0) {
+	if (memcmp((void *)memory_start, "-rom1fs-", 8) == 0) {
 #if defined(CONFIG_BLK_DEV_INITRD)
-		initrd_start = memory_start += BLKOFFSET;
+		initrd_start = memory_start;
 		initrd_end = memory_start += be32_to_cpu(((unsigned long *) (memory_start))[2]);
 #else
-		memory_start += BLKOFFSET;
 		memory_start += be32_to_cpu(((unsigned long *) memory_start)[2]);
 #endif
 	}
@@ -190,6 +183,16 @@
 	 */
 	paging_init();
 	h8300_gpio_init();
+#if defined(CONFIG_H8300_AKI3068NET) && defined(CONFIG_IDE)
+	{
+#define AREABIT(addr) (1 << (((addr) >> 21) & 7))
+		/* setup BSC */
+		volatile unsigned char *abwcr = (volatile unsigned char *)ABWCR;
+		volatile unsigned char *cscr = (volatile unsigned char *)CSCR;
+		*abwcr &= ~(AREABIT(CONFIG_H8300_IDE_BASE) | AREABIT(CONFIG_H8300_IDE_ALT));
+		*cscr  |= (AREABIT(CONFIG_H8300_IDE_BASE) | AREABIT(CONFIG_H8300_IDE_ALT)) | 0x0f;
+	}
+#endif
 #ifdef DEBUG
 	printk(KERN_DEBUG "Done setup_arch\n");
 #endif
diff -Nru linux-2.6.6/include/asm-h8300/ide.h linux-2.6.6-h8300/include/asm-h8300/ide.h
--- linux-2.6.6/include/asm-h8300/ide.h	11 May 2004 12:28:11 -0000
+++ linux-2.6.6-h8300/include/asm-h8300/ide.h	14 May 2004 11:36:35 -0000
@@ -16,37 +16,25 @@
 #ifdef __KERNEL__
 /****************************************************************************/
 
-#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
-
-#define IDE_BASE CONFIG_H8300_IDE_BASE
-#define IDE_CTRL CONFIG_H8300_IDE_ALT
-#define IDE_IRQ  (EXT_IRQ0 + CONFIG_H8300_IDE_IRQ)
-
 static __inline__ int ide_default_irq(unsigned long base)
 {
-	return IDE_IRQ;
+	return EXT_IRQ0 + CONFIG_H8300_IDE_IRQ;
 }
 #define ide_init_default_irq(base) ide_default_irq(base)
 
 static __inline__ unsigned long ide_default_io_base(int index)
 {
-	return 0;
+	return CONFIG_H8300_IDE_BASE;
 }
 
 static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
 					   unsigned long ctrl_port, int *irq)
 {
+	int i;
+	for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++)
+		hw->io_ports[i] = data_port + 2*i;
+	hw->io_ports[IDE_CONTROL_OFFSET] = CONFIG_H8300_IDE_ALT;
 }
-
-void ide_init_default_hwifs(void);
-
 
 #define MAX_HWIFS	1
 
diff -Nru linux-2.6.6/include/asm-h8300/io.h linux-2.6.6-h8300/include/asm-h8300/io.h
--- linux-2.6.6/include/asm-h8300/io.h	11 May 2004 12:28:11 -0000
+++ linux-2.6.6-h8300/include/asm-h8300/io.h	14 May 2004 11:36:35 -0000
@@ -96,7 +96,7 @@
 	volatile unsigned short *ap = (volatile unsigned short *) addr;
 	unsigned short *bp = (unsigned short *) buf;
 	while (len--)
-		*ap = *bp++;
+		*ap = _swapw(*bp++);
 }
 
 static inline void io_outsl(unsigned int addr, const void *buf, int len)
@@ -104,7 +104,7 @@
 	volatile unsigned int *ap = (volatile unsigned int *) addr;
 	unsigned long *bp = (unsigned long *) buf;
 	while (len--)
-		*ap = *bp++;
+		*ap = _swapl(*bp++);
 }
 
 static inline void io_insb(unsigned int addr, void *buf, int len)
@@ -129,7 +129,7 @@
 	volatile unsigned short *ap = (volatile unsigned short *) addr;
 	unsigned short *bp = (unsigned short *) buf;
 	while (len--)
-		*bp++ = *ap;
+		*bp++ = _swapw(*ap);
 }
 
 static inline void io_insl(unsigned int addr, void *buf, int len)
@@ -137,7 +137,7 @@
 	volatile unsigned int *ap = (volatile unsigned int *) addr;
 	unsigned long *bp = (unsigned long *) buf;
 	while (len--)
-		*bp++ = *ap;
+		*bp++ = _swapl(*ap);
 }
 
 /*

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] H8/300 IDE support update
  2004-05-14 12:39 [PATCH] H8/300 IDE support update Yoshinori Sato
@ 2004-05-14 13:07 ` Bartlomiej Zolnierkiewicz
  2004-05-14 17:50   ` Yoshinori Sato
  0 siblings, 1 reply; 4+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2004-05-14 13:07 UTC (permalink / raw)
  To: Yoshinori Sato, Linus Torvalds; +Cc: linux kernel Mailing List

On Friday 14 of May 2004 14:39, Yoshinori Sato wrote:
> - IDE support update.
> - unused memory hole delete.

Yoshinori, this patch doesn't apply to vanilla 2.6.6 / 2.6.6-bk1.

And once again: please do not use ide_default_{irq,io_base}()
and ide_init_hwif_ports() in new IDE code.

Regards,
Bartlomiej


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] H8/300 IDE support update
  2004-05-14 13:07 ` Bartlomiej Zolnierkiewicz
@ 2004-05-14 17:50   ` Yoshinori Sato
  2004-05-14 19:38     ` Bartlomiej Zolnierkiewicz
  0 siblings, 1 reply; 4+ messages in thread
From: Yoshinori Sato @ 2004-05-14 17:50 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz; +Cc: Linus Torvalds, linux kernel Mailing List

At Fri, 14 May 2004 15:07:31 +0200,
Bartlomiej Zolnierkiewicz wrote:
> 
> On Friday 14 of May 2004 14:39, Yoshinori Sato wrote:
> > - IDE support update.
> > - unused memory hole delete.
> 
> Yoshinori, this patch doesn't apply to vanilla 2.6.6 / 2.6.6-bk1.
> 
> And once again: please do not use ide_default_{irq,io_base}()
> and ide_init_hwif_ports() in new IDE code.
> 

Because an address does not continue, 
Cannot set a right address in ide_std_init_ports.

-- 
Yoshinori Sato
<ysato@users.sourceforge.jp>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] H8/300 IDE support update
  2004-05-14 17:50   ` Yoshinori Sato
@ 2004-05-14 19:38     ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 4+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2004-05-14 19:38 UTC (permalink / raw)
  To: Yoshinori Sato; +Cc: Linus Torvalds, linux kernel Mailing List

On Friday 14 of May 2004 19:50, Yoshinori Sato wrote:
> At Fri, 14 May 2004 15:07:31 +0200,
>
> Bartlomiej Zolnierkiewicz wrote:
> > On Friday 14 of May 2004 14:39, Yoshinori Sato wrote:
> > > - IDE support update.
> > > - unused memory hole delete.
> >
> > Yoshinori, this patch doesn't apply to vanilla 2.6.6 / 2.6.6-bk1.
> >
> > And once again: please do not use ide_default_{irq,io_base}()
> > and ide_init_hwif_ports() in new IDE code.
>
> Because an address does not continue,
> Cannot set a right address in ide_std_init_ports.

You don't need to use ide_std_init_ports() - it is just a helper
and you shouldn't need ide_init_hwif_ports() et all!

Just add driver to drivers/ide/h8300/ and describe what changes
(not hacks) to the core IDE code you need to make it work (if any).

Cheers.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-05-14 19:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-14 12:39 [PATCH] H8/300 IDE support update Yoshinori Sato
2004-05-14 13:07 ` Bartlomiej Zolnierkiewicz
2004-05-14 17:50   ` Yoshinori Sato
2004-05-14 19:38     ` Bartlomiej Zolnierkiewicz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).