pata_it8213: Add new driver for the IT8213 card.
PATCH 1/1 pata_it8213: Add new driver for the IT8213 card.
Add a driver for the IT8213 which is a single channel ICH-ish PATA controller. As it is very different to the IT8211/2 it gets its own driver. There is a legacy drivers/ide driver also available and I'll post that once I get time to test it all out (probably early January). If anyone else needs the drivers/ide driver and wants to do the merge for drivers/ide (Bart ??) then I'll forward it.
drivers/ata/Kconfig +10 -1
@@ -305,7 +305,7 @@ If unsure, say N. config PATA_IT821X - tristate "IT821x PATA support (Experimental)" + tristate "IT8211/2 PATA support (Experimental)" depends on PCI && EXPERIMENTAL help This option enables support for the ITE 8211 and 8212
@@ -314,6 +314,15 @@ If unsure, say N. +config PATA_IT8213 + tristate "IT8213 PATA support (Experimental)" + depends on PCI && EXPERIMENTAL + help + This option enables support for the ITE 821 PATA + controllers via the new ATA layer. + + If unsure, say N. + config PATA_JMICRON tristate "JMicron PATA support" depends on PCI
drivers/ata/Makefile +1 -0
@@ -33,6 +33,7 @@ obj-$(CONFIG_PATA_HPT3X3) += pata_hpt3x3.o obj-$(CONFIG_PATA_ISAPNP) += pata_isapnp.o obj-$(CONFIG_PATA_IT821X) += pata_it821x.o +obj-$(CONFIG_PATA_IT8213) += pata_it8213.o obj-$(CONFIG_PATA_JMICRON) += pata_jmicron.o obj-$(CONFIG_PATA_NETCELL) += pata_netcell.o obj-$(CONFIG_PATA_NS87410) += pata_ns87410.o
drivers/ata/pata_it8213.c +355 -0
355 lines not on this page · raw message
Quoted 36 lines · On Mon, 4 Dec 2006 16:49:31 +0000 Alan <[email protected]> wrote:
Add a driver for the IT8213 which is a single channel ICH-ish PATA controller. As it is very different to the IT8211/2 it gets its own driver. There is a legacy
drivers/idedriver also available and I'll post that once I get time to test it all out (probably early January). If anyone else needs thedrivers/idedriver and wants to do the merge fordrivers/ide(Bart ??) then I'll forward it....
(quoted diff) +24
-0+static void it8213_set_piomode (struct ata_port *ap, struct ata_device *adev) +{ + unsigned int pio = adev->pio_mode - XFER_PIO_0; + struct pci_dev *dev = to_pci_dev(ap->host->dev); + unsigned int idetm_port= ap->port_no ? 0x42 : 0x40; + u16 idetm_data; + int control = 0; + + /* + * See Intel Document 298600-004 for the timing programing rules + * for PIIX/ICH. The 8213 is a clone so very similar + */ + + static const /* ISP RTC */ + u8 timings[][2] = { { 0, 0 }, + { 0, 0 }, + { 1, 0 }, + { 2, 1 }, + { 2, 3 }, }; + +static void it8213_set_dmamode (struct ata_port *ap, struct ata_device *adev) +{ + struct pci_dev *dev = to_pci_dev(ap->host->dev); + u16 master_data;
Review
Quoted 10 lines
(quoted diff) +10
-0+ u8 speed = adev->dma_mode; + int devid = adev->devno; + u8 udma_enable; + + static const /* ISP RTC */ + u8 timings[][2] = { { 0, 0 }, + { 0, 0 }, + { 1, 0 }, + { 2, 1 }, + { 2, 3 }, };
Was the duplication of timings[] deliberate?
Review
Quoted 3 lines
(quoted diff) +3
-0+ const unsigned int needed_pio[3] = { + XFER_PIO_0, XFER_PIO_3, XFER_PIO_4 + };
I made this static (save the world and all that).
Review
Quoted 2 lines
(quoted diff) +2
-0+static const struct pci_device_id it8213_pci_tbl[] = { + { PCI_VDEVICE(ITE, PCI_DEVICE_ID_ITE_8213), },
drivers/ata/pata_it8213.c:323: error: 'PCI_DEVICE_ID_ITE_8213' undeclared here (not in a function)
I went out on a limb and...
drivers/ata/pata_it8213.c renamed from drivers/ata/pata_it8213.c~pata_it8213-add-new-driver-for-the-it8213-card-tidy +1 -2
@@ -194,7 +194,7 @@ static void it8213_set_dmamode (struct aunsigned int mwdma = adev->dma_mode -XFER_MW_DMA_0 ;unsigned int control;u8 slave_data; -const unsigned int needed_pio[3 ] = { +static const unsigned int needed_pio[3 ] = {XFER_PIO_0 ,XFER_PIO_3 ,XFER_PIO_4 };int pio = needed_pio[mwdma] -XFER_PIO_0 ;
@@ -352,4 +352,3 @@ MODULE_DESCRIPTION("SCSI low-level driveMODULE_LICENSE ("GPL" );MODULE_DEVICE_TABLE (pci, it8213_pci_tbl);MODULE_VERSION (DRV_VERSION ); -
include/linux/pci_ids.h renamed from include/linux/pci_ids.h~pata_it8213-add-new-driver-for-the-it8213-card-tidy +1 -0
@@ -1622,6 +1622,7 @@#define PCI_VENDOR_ID_ITE 0x1283#define PCI_DEVICE_ID_ITE_8211 0x8211#define PCI_DEVICE_ID_ITE_8212 0x8212 +#define PCI_DEVICE_ID_ITE_8213 0x8213#define PCI_DEVICE_ID_ITE_8872 0x8872#define PCI_DEVICE_ID_ITE_IT8330G_0 0xe886
_
Quoted 1 line
Was the duplication of timings[] deliberate?
It's actually duplicated in all the PIIX/ICH-alike drivers. I could move it in them all. Jeff - its copied from your piix driver - shall I move them all ?
include/linux/pci_ids.h line 1625
Quoted 8 lines
diff -puN
include/linux/pci_ids.h~pata_it8213-add-new-driver-for-the-it8213-card-tidyinclude/linux/pci_ids.hinclude/linux/pci_ids.h renamed from include/linux/pci_ids.h~pata_it8213-add-new-driver-for-the-it8213-card-tidy +1
-0@@ -1622,6 +1622,7 @@#define PCI_VENDOR_ID_ITE 0x1283#define PCI_DEVICE_ID_ITE_8211 0x8211#define PCI_DEVICE_ID_ITE_8212 0x8212 +#define PCI_DEVICE_ID_ITE_8213 0x8213
Sorry about that one - your guess is 100% correct of course
Quoted 5 lines · Alan
Quoted 1 line
Was the duplication of timings[] deliberate?
It's actually duplicated in all the PIIX/ICH-alike drivers. I could move it in them all. Jeff - its copied from your piix driver - shall I move them all ?
Please do...
Jeff
Quoted 8 lines · Alan
Add a driver for the IT8213 which is a single channel ICH-ish PATA controller. As it is very different to the IT8211/2 it gets its own driver. There is a legacy
drivers/idedriver also available and I'll post that once I get time to test it all out (probably early January). If anyone else needs thedrivers/idedriver and wants to do the merge fordrivers/ide(Bart ??) then I'll forward it.Signed-off-by Alan Cox <[email protected]>
ACK. I believe Andrew added some cleanups which I should want?