13 #include <linux/kernel.h>
14 #include <linux/module.h>
16 #include <linux/device.h>
21 #include <linux/slab.h>
28 #include <mach/board.h>
31 #define DRV_NAME "pata_at32"
32 #define DRV_VERSION "0.0.3"
48 #define CF_IDE_OFFSET 0x00c00000
49 #define CF_ALT_IDE_OFFSET 0x00e00000
50 #define CF_RES_SIZE 2048
91 static int pata_at32_setup_timing(
struct device *
dev,
136 dev_dbg(dev,
"ATA: C=%d S=%d P=%d R=%d\n",
139 dev_dbg(dev,
"SMC: C=%d S=%d P=%d NS=%d NP=%d\n",
160 dev_warn(ap->
dev,
"Failed to compute ATA timing %d\n", ret);
165 ret = pata_at32_setup_timing(ap->
dev, info, &
timing);
167 dev_warn(ap->
dev,
"Failed to setup ATA timing %d\n", ret);
179 .set_piomode = pata_at32_set_piomode,
182 static int __init pata_at32_init_one(
struct device *dev,
195 ap->
ops = &at32_port_ops;
211 ap->ioaddr.altstatus_addr = info->
alt_addr + (0x06 << 1);
212 ap->ioaddr.ctl_addr = info->
alt_addr + (0x06 << 1);
240 static void __init pata_at32_debug_bus(
struct device *dev,
252 for (i = 0; i < 8; i++) {
270 {
XFER_PIO_0, 70, 290, 240, 600, 165, 150, 600, 0};
298 info->
cs = board->
cs;
308 goto err_req_res_ide;
317 goto err_req_res_alt;
320 info->
smc.bus_width = 2;
321 info->
smc.nrd_controlled = 1;
322 info->
smc.nwe_controlled = 0;
323 info->
smc.nwait_mode = 3;
324 info->
smc.byte_write = 0;
325 info->
smc.tdf_mode = 0;
326 info->
smc.tdf_cycles = 0;
329 ret = pata_at32_setup_timing(dev, info, &initial_timing);
331 goto err_setup_timing;
341 pata_at32_debug_bus(dev, info);
345 ret = pata_at32_init_one(dev, info);
365 struct ata_host *host = platform_get_drvdata(pdev);
389 .remove =
__exit_p(pata_at32_remove),
396 static int __init pata_at32_init(
void)
401 static void __exit pata_at32_exit(
void)