2 * H8/300 generic IDE interface
5 #include <linux/init.h>
11 #define DRV_NAME "ide-h8300"
16 __asm__("mov.b %w1,r1h\n\t" \
25 static void mm_outsw(unsigned long addr
, void *buf
, u32 len
)
27 unsigned short *bp
= (unsigned short *)buf
;
28 for (; len
> 0; len
--, bp
++)
29 *(volatile u16
*)addr
= bswap(*bp
);
32 static void mm_insw(unsigned long addr
, void *buf
, u32 len
)
34 unsigned short *bp
= (unsigned short *)buf
;
35 for (; len
> 0; len
--, bp
++)
36 *bp
= bswap(*(volatile u16
*)addr
);
39 static void h8300_input_data(ide_drive_t
*drive
, struct ide_cmd
*cmd
,
40 void *buf
, unsigned int len
)
42 mm_insw(drive
->hwif
->io_ports
.data_addr
, buf
, (len
+ 1) / 2);
45 static void h8300_output_data(ide_drive_t
*drive
, struct ide_cmd
*cmd
,
46 void *buf
, unsigned int len
)
48 mm_outsw(drive
->hwif
->io_ports
.data_addr
, buf
, (len
+ 1) / 2);
51 static const struct ide_tp_ops h8300_tp_ops
= {
52 .exec_command
= ide_exec_command
,
53 .read_status
= ide_read_status
,
54 .read_altstatus
= ide_read_altstatus
,
55 .write_devctl
= ide_write_devctl
,
57 .dev_select
= ide_dev_select
,
58 .tf_load
= ide_tf_load
,
59 .tf_read
= ide_tf_read
,
61 .input_data
= h8300_input_data
,
62 .output_data
= h8300_output_data
,
65 #define H8300_IDE_GAP (2)
67 static inline void hw_setup(hw_regs_t
*hw
)
71 memset(hw
, 0, sizeof(hw_regs_t
));
72 for (i
= 0; i
<= 7; i
++)
73 hw
->io_ports_array
[i
] = CONFIG_H8300_IDE_BASE
+ H8300_IDE_GAP
*i
;
74 hw
->io_ports
.ctl_addr
= CONFIG_H8300_IDE_ALT
;
75 hw
->irq
= EXT_IRQ0
+ CONFIG_H8300_IDE_IRQ
;
76 hw
->chipset
= ide_generic
;
79 static const struct ide_port_info h8300_port_info
= {
80 .tp_ops
= &h8300_tp_ops
,
81 .host_flags
= IDE_HFLAG_NO_IO_32BIT
| IDE_HFLAG_NO_DMA
,
84 static int __init
h8300_ide_init(void)
86 hw_regs_t hw
, *hws
[] = { &hw
, NULL
, NULL
, NULL
};
88 printk(KERN_INFO DRV_NAME
": H8/300 generic IDE interface\n");
90 if (!request_region(CONFIG_H8300_IDE_BASE
, H8300_IDE_GAP
*8, "ide-h8300"))
92 if (!request_region(CONFIG_H8300_IDE_ALT
, H8300_IDE_GAP
, "ide-h8300")) {
93 release_region(CONFIG_H8300_IDE_BASE
, H8300_IDE_GAP
*8);
99 return ide_host_add(&h8300_port_info
, hws
, NULL
);
102 printk(KERN_ERR
"ide-h8300: IDE I/F resource already used.\n");
107 module_init(h8300_ide_init
);
109 MODULE_LICENSE("GPL");