26 #include <linux/types.h>
27 #include <linux/module.h>
28 #include <linux/kernel.h>
37 #define IDE_PALM_ATA_PRI_REG_OFFSET 0x1F0
40 #define IDE_PALM_ATA_PRI_CTL_OFFSET 0x3F6
42 #define BK3710_BMICP 0x00
43 #define BK3710_BMISP 0x02
44 #define BK3710_BMIDTP 0x04
45 #define BK3710_IDETIMP 0x40
46 #define BK3710_IDESTATUS 0x47
47 #define BK3710_UDMACTL 0x48
48 #define BK3710_MISCCTL 0x50
49 #define BK3710_REGSTB 0x54
50 #define BK3710_REGRCVR 0x58
51 #define BK3710_DATSTB 0x5C
52 #define BK3710_DATRCVR 0x60
53 #define BK3710_DMASTB 0x64
54 #define BK3710_DMARCVR 0x68
55 #define BK3710_UDMASTB 0x6C
56 #define BK3710_UDMATRP 0x70
57 #define BK3710_UDMAENV 0x74
58 #define BK3710_IORDYTMP 0x78
60 static unsigned ideclk_period;
77 static void palm_bk3710_setudmamode(
void __iomem *base,
unsigned int dev,
93 val32 |= (t0 << (dev ? 8 : 0));
98 val32 |= (trp << (dev ? 8 : 0));
103 val32 |= (tenv << (dev ? 8 : 0));
111 static void palm_bk3710_setdmamode(
void __iomem *base,
unsigned int dev,
112 unsigned short min_cycle,
131 val32 |= (td << (dev ? 8 : 0));
135 val32 |= (tkw << (dev ? 8 : 0));
144 unsigned int dev,
unsigned int cycletime,
161 val32 |= (t2 << (dev ? 8 : 0));
165 val32 |= (t2i << (dev ? 8 : 0));
183 val32 |= (t2 << (dev ? 8 : 0));
187 val32 |= (t2i << (dev ? 8 : 0));
193 int is_slave = drive->
dn & 1;
198 palm_bk3710_setudmamode(base, is_slave,
201 palm_bk3710_setdmamode(base, is_slave,
209 unsigned int cycle_time;
210 int is_slave = drive->
dn & 1;
219 mate = ide_get_pair_dev(drive);
220 palm_bk3710_setpiomode(base, mate, is_slave, cycle_time,
pio);
276 palm_bk3710_setpiomode(base,
NULL, 0, 600, 0);
277 palm_bk3710_setpiomode(base,
NULL, 1, 600, 0);
298 static const struct ide_port_ops palm_bk3710_ports_ops = {
299 .set_pio_mode = palm_bk3710_set_pio_mode,
300 .set_dma_mode = palm_bk3710_set_dma_mode,
301 .cable_detect = palm_bk3710_cable_detect,
305 .init_dma = palm_bk3710_init_dma,
306 .port_ops = &palm_bk3710_ports_ops,
331 ideclk_period = 1000000000
UL /
rate;
345 mem_size = resource_size(mem);
359 palm_bk3710_chipinit(base);
363 hw.io_ports_array[i] = (
unsigned long)
365 hw.io_ports.ctl_addr = (
unsigned long)
389 .name =
"palm_bk3710",
394 static int __init palm_bk3710_init(
void)