diff options
Diffstat (limited to 'drivers/ide/legacy/falconide.c')
-rw-r--r-- | drivers/ide/legacy/falconide.c | 56 |
1 files changed, 40 insertions, 16 deletions
diff --git a/drivers/ide/legacy/falconide.c b/drivers/ide/legacy/falconide.c index 129a812bb57f..724f95073d80 100644 --- a/drivers/ide/legacy/falconide.c +++ b/drivers/ide/legacy/falconide.c | |||
@@ -66,6 +66,27 @@ static void falconide_output_data(ide_drive_t *drive, struct request *rq, | |||
66 | outsw_swapw(data_addr, buf, (len + 1) / 2); | 66 | outsw_swapw(data_addr, buf, (len + 1) / 2); |
67 | } | 67 | } |
68 | 68 | ||
69 | /* Atari has a byte-swapped IDE interface */ | ||
70 | static const struct ide_tp_ops falconide_tp_ops = { | ||
71 | .exec_command = ide_exec_command, | ||
72 | .read_status = ide_read_status, | ||
73 | .read_altstatus = ide_read_altstatus, | ||
74 | .read_sff_dma_status = ide_read_sff_dma_status, | ||
75 | |||
76 | .set_irq = ide_set_irq, | ||
77 | |||
78 | .tf_load = ide_tf_load, | ||
79 | .tf_read = ide_tf_read, | ||
80 | |||
81 | .input_data = falconide_input_data, | ||
82 | .output_data = falconide_output_data, | ||
83 | }; | ||
84 | |||
85 | static const struct ide_port_info falconide_port_info = { | ||
86 | .tp_ops = &falconide_tp_ops, | ||
87 | .host_flags = IDE_HFLAG_NO_DMA, | ||
88 | }; | ||
89 | |||
69 | static void __init falconide_setup_ports(hw_regs_t *hw) | 90 | static void __init falconide_setup_ports(hw_regs_t *hw) |
70 | { | 91 | { |
71 | int i; | 92 | int i; |
@@ -91,11 +112,12 @@ static void __init falconide_setup_ports(hw_regs_t *hw) | |||
91 | 112 | ||
92 | static int __init falconide_init(void) | 113 | static int __init falconide_init(void) |
93 | { | 114 | { |
94 | hw_regs_t hw; | 115 | struct ide_host *host; |
95 | ide_hwif_t *hwif; | 116 | hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; |
117 | int rc; | ||
96 | 118 | ||
97 | if (!MACH_IS_ATARI || !ATARIHW_PRESENT(IDE)) | 119 | if (!MACH_IS_ATARI || !ATARIHW_PRESENT(IDE)) |
98 | return 0; | 120 | return -ENODEV; |
99 | 121 | ||
100 | printk(KERN_INFO "ide: Falcon IDE controller\n"); | 122 | printk(KERN_INFO "ide: Falcon IDE controller\n"); |
101 | 123 | ||
@@ -106,23 +128,25 @@ static int __init falconide_init(void) | |||
106 | 128 | ||
107 | falconide_setup_ports(&hw); | 129 | falconide_setup_ports(&hw); |
108 | 130 | ||
109 | hwif = ide_find_port(); | 131 | host = ide_host_alloc(&falconide_port_info, hws); |
110 | if (hwif) { | 132 | if (host == NULL) { |
111 | u8 index = hwif->index; | 133 | rc = -ENOMEM; |
112 | u8 idx[4] = { index, 0xff, 0xff, 0xff }; | 134 | goto err; |
113 | 135 | } | |
114 | ide_init_port_hw(hwif, &hw); | ||
115 | 136 | ||
116 | /* Atari has a byte-swapped IDE interface */ | 137 | ide_get_lock(NULL, NULL); |
117 | hwif->input_data = falconide_input_data; | 138 | rc = ide_host_register(host, &falconide_port_info, hws); |
118 | hwif->output_data = falconide_output_data; | 139 | ide_release_lock(); |
119 | 140 | ||
120 | ide_get_lock(NULL, NULL); | 141 | if (rc) |
121 | ide_device_add(idx, NULL); | 142 | goto err_free; |
122 | ide_release_lock(); | ||
123 | } | ||
124 | 143 | ||
125 | return 0; | 144 | return 0; |
145 | err_free: | ||
146 | ide_host_free(host); | ||
147 | err: | ||
148 | release_mem_region(ATA_HD_BASE, 0x40); | ||
149 | return rc; | ||
126 | } | 150 | } |
127 | 151 | ||
128 | module_init(falconide_init); | 152 | module_init(falconide_init); |