2 * drivers/ide/ide-h8300.c
3 * H8/300 generic IDE interface
6 #include <linux/init.h>
8 #include <linux/config.h>
16 __asm__("mov.b %w1,r1h\n\t" \
25 static void mm_outw(u16 d
, unsigned long a
)
27 __asm__("mov.b %w0,r2h\n\t"
35 static u16
mm_inw(unsigned long a
)
37 register u16 r
__asm__("er0");
38 __asm__("mov.w @%1,r2\n\t"
47 static void mm_outsw(unsigned long addr
, void *buf
, u32 len
)
49 unsigned short *bp
= (unsigned short *)buf
;
50 for (; len
> 0; len
--, bp
++)
51 *(volatile u16
*)addr
= bswap(*bp
);
54 static void mm_insw(unsigned long addr
, void *buf
, u32 len
)
56 unsigned short *bp
= (unsigned short *)buf
;
57 for (; len
> 0; len
--, bp
++)
58 *bp
= bswap(*(volatile u16
*)addr
);
61 #define H8300_IDE_GAP (2)
63 static inline void hw_setup(hw_regs_t
*hw
)
67 memset(hw
, 0, sizeof(hw_regs_t
));
68 for (i
= 0; i
<= IDE_STATUS_OFFSET
; i
++)
69 hw
->io_ports
[i
] = CONFIG_H8300_IDE_BASE
+ H8300_IDE_GAP
*i
;
70 hw
->io_ports
[IDE_CONTROL_OFFSET
] = CONFIG_H8300_IDE_ALT
;
71 hw
->irq
= EXT_IRQ0
+ CONFIG_H8300_IDE_IRQ
;
73 hw
->chipset
= ide_generic
;
76 static inline void hwif_setup(ide_hwif_t
*hwif
)
78 default_hwif_iops(hwif
);
82 hwif
->OUTSW
= mm_outsw
;
91 void __init
h8300_ide_init(void)
97 if (!request_region(CONFIG_H8300_IDE_BASE
, H8300_IDE_GAP
*8, "ide-h8300"))
99 if (!request_region(CONFIG_H8300_IDE_ALT
, H8300_IDE_GAP
, "ide-h8300")) {
100 release_region(CONFIG_H8300_IDE_BASE
, H8300_IDE_GAP
*8);
107 idx
= ide_register_hw(&hw
, &hwif
);
109 printk(KERN_ERR
"ide-h8300: IDE I/F register failed\n");
114 printk(KERN_INFO
"ide%d: H8/300 generic IDE interface\n", idx
);
118 printk(KERN_ERR
"ide-h8300: IDE I/F resource already used.\n");