1 * rename the offset definition to avoid abiguity with the standard ATA
3 * read and write four bytes at once like the original driver does
4 * use writesl() and readsl() which implicitly iterate over the data
6 This patch assumes buflen to be a multiple of four, which is true for
7 ATA devices. ATAPI support is not known, though unlikely, as the
8 original driver always transfers 512 Bytes at once.
10 Signed-off-by: Phil Sutter <n0-1@freewrt.org>
11 Acked-by: Sergei Shtyltov <sshtylyov@ru.mvista.com>
13 drivers/ata/pata_rb532_cf.c | 20 +++++++++-----------
14 1 files changed, 9 insertions(+), 11 deletions(-)
16 diff --git a/drivers/ata/pata_rb532_cf.c b/drivers/ata/pata_rb532_cf.c
17 index 7b11f40..b919012 100644
18 --- a/drivers/ata/pata_rb532_cf.c
19 +++ b/drivers/ata/pata_rb532_cf.c
21 #define RB500_CF_REG_BASE 0x0800
22 #define RB500_CF_REG_ERR 0x080D
23 #define RB500_CF_REG_CTRL 0x080E
24 -#define RB500_CF_REG_DATA 0x0C00
25 +/* 32bit buffered data register offset */
26 +#define RB500_CF_REG_DBUF32 0x0C00
28 struct rb532_cf_info {
30 @@ -74,19 +75,16 @@ static void rb532_pata_exec_command(struct ata_port *ap,
31 rb532_pata_finish_io(ap);
34 -static void rb532_pata_data_xfer(struct ata_device *adev, unsigned char *buf,
35 - unsigned int buflen, int write_data)
36 +static void rb532_pata_data_xfer(struct ata_device *adev,
37 + unsigned char *buf, unsigned int buflen, int write_data)
39 struct ata_port *ap = adev->link->ap;
40 void __iomem *ioaddr = ap->ioaddr.data_addr;
43 - for (; buflen > 0; buflen--, buf++)
44 - writeb(*buf, ioaddr);
46 - for (; buflen > 0; buflen--, buf++)
47 - *buf = readb(ioaddr);
50 + writesl(ioaddr, buf, buflen / sizeof(u32));
52 + readsl(ioaddr, buf, buflen / sizeof(u32));
54 rb532_pata_finish_io(adev->link->ap);
56 @@ -156,7 +154,7 @@ static void rb532_pata_setup_ports(struct ata_host *ah)
58 ata_sff_std_ports(&ap->ioaddr);
60 - ap->ioaddr.data_addr = info->iobase + RB500_CF_REG_DATA;
61 + ap->ioaddr.data_addr = info->iobase + RB500_CF_REG_DBUF32;
62 ap->ioaddr.error_addr = info->iobase + RB500_CF_REG_ERR;