1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License.  See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * IDE routines for typical pc-like standard configurations
7 * for the ZAO Networks Capcella.
8 *
9 * Copyright (C) 1998, 1999, 2001 by Ralf Baechle
10 */
11/*
12 * Changes:
13 *  Yoichi Yuasa <yuasa@hh.iij4u.or.jp>  Fri, 23 Aug 2002
14 *  - Added Victor MP-C303/304 support.
15 */
16#include <linux/sched.h>
17#include <linux/ide.h>
18#include <linux/ioport.h>
19#include <linux/hdreg.h>
20#include <asm/ptrace.h>
21#include <asm/hdreg.h>
22
23static int mpc30x_ide_default_irq(ide_ioreg_t base)
24{
25	return 0;
26}
27
28static ide_ioreg_t mpc30x_ide_default_io_base(int index)
29{
30	return 0;
31}
32
33static void mpc30x_ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port,
34                                       ide_ioreg_t ctrl_port, int *irq)
35{
36	ide_ioreg_t reg = data_port;
37	int i;
38
39	for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
40		hw->io_ports[i] = reg;
41		reg += 1;
42	}
43	if (ctrl_port) {
44		hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
45	} else {
46		hw->io_ports[IDE_CONTROL_OFFSET] = hw->io_ports[IDE_DATA_OFFSET] + 0x206;
47	}
48	if (irq != NULL)
49		*irq = 0;
50	hw->io_ports[IDE_IRQ_OFFSET] = 0;
51}
52
53static int mpc30x_ide_request_irq(unsigned int irq,
54                                  void (*handler)(int,void *, struct pt_regs *),
55                                  unsigned long flags, const char *device,
56                                  void *dev_id)
57{
58	return request_irq(irq, handler, flags, device, dev_id);
59}
60
61static void mpc30x_ide_free_irq(unsigned int irq, void *dev_id)
62{
63	free_irq(irq, dev_id);
64}
65
66static int mpc30x_ide_check_region(ide_ioreg_t from, unsigned int extent)
67{
68	return check_region(from, extent);
69}
70
71static void mpc30x_ide_request_region(ide_ioreg_t from, unsigned int extent,
72                                      const char *name)
73{
74	request_region(from, extent, name);
75}
76
77static void mpc30x_ide_release_region(ide_ioreg_t from, unsigned int extent)
78{
79	release_region(from, extent);
80}
81
82struct ide_ops mpc30x_ide_ops = {
83	&mpc30x_ide_default_irq,
84	&mpc30x_ide_default_io_base,
85	&mpc30x_ide_init_hwif_ports,
86	&mpc30x_ide_request_irq,
87	&mpc30x_ide_free_irq,
88	&mpc30x_ide_check_region,
89	&mpc30x_ide_request_region,
90	&mpc30x_ide_release_region
91};
92