Subject: Re: [PATCH] ide: Add tx4938ide driver (v2)

From: Sergei Shtylyov <[email-masked]>
Date: Sun, 08 Feb 2009 14:44:58 +0300

Hello.

Atsushi Nemoto wrote:

> This is the driver for the Toshiba TX4938 SoC EBUS controller ATA mode.
> It has custom set_pio_mode and some hacks for big endian.
>
> Signed-off-by: Atsushi Nemoto <[email-masked]>
>   
[...]
> +static void tx4938ide_input_data_swap(ide_drive_t *drive, struct request *rq,
> +				void *buf, unsigned int len)
> +{
> +	unsigned long port = drive->hwif->io_ports.data_addr;
> +	unsigned short *ptr = buf;
> +	unsigned int count = (len + 1) / 2;
> +
> +	while (count--)
> +		*ptr++ = cpu_to_le16(__raw_readw((void __iomem *)port));
> +	__ide_flush_dcache_range((unsigned long)buf, count * 2);
> +}
> +
> +static void tx4938ide_output_data_swap(ide_drive_t *drive, struct request *rq,
> +				void *buf, unsigned int len)
> +{
> +	unsigned long port = drive->hwif->io_ports.data_addr;
> +	unsigned short *ptr = buf;
> +	unsigned int count = (len + 1) / 2;
> +
> +	while (count--) {
> +		__raw_writew(le16_to_cpu(*ptr), (void __iomem *)port);
> +		ptr++;
> +	}
> +	__ide_flush_dcache_range((unsigned long)buf, count * 2);
> +}

   Atsushi, does TX49 really suffer from the issue that these flushes 
are trying to address?

MBR, Sergei

---

From: Sergei Shtylyov <[email-masked]>
Date: Sun, 08 Feb 2009 14:52:48 +0300

>   Atsushi, does TX49 really suffer from the issue that these flushes 

   Well, looking thru the TX4939 thread, it appears that I've asked this 
question already. Isn't this related to VIVT caches?

MBR, Sergei

---

From: Atsushi Nemoto <[email-masked]>
Date: Mon, 09 Feb 2009 01:53:21 +0900 (JST)

> question already. Isn't this related to VIVT caches?

No, TX49 has VIPT cache.  It is related to D-cache aliasing on PIO.
My first attempt to fix this issue goes back to 2004:

http://www.linux-mips.org/archives/linux-mips/2004-03/msg00185.html

And more generic lengthy discussion can be found on (as mentioned in
the previous tx4939 thread):

http://lkml.org/lkml/2006/1/13/156

---
Atsushi Nemoto