lkml.org 
[lkml]   [2010]   [Jan]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
Subject[PATCH 42/68] pata_cs5520: move code to be re-used by ide2libata to pata_cs5520.h
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] pata_cs5520: move code to be re-used by ide2libata to pata_cs5520.h

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ata/pata_cs5520.c | 60 ----------------------------------------------
drivers/ata/pata_cs5520.h | 60 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 61 insertions(+), 59 deletions(-)

Index: b/drivers/ata/pata_cs5520.c
===================================================================
--- a/drivers/ata/pata_cs5520.c
+++ b/drivers/ata/pata_cs5520.c
@@ -43,65 +43,7 @@
#define DRV_NAME "pata_cs5520"
#define DRV_VERSION "0.6.6"

-struct pio_clocks
-{
- int address;
- int assert;
- int recovery;
-};
-
-static const struct pio_clocks cs5520_pio_clocks[]={
- {3, 6, 11},
- {2, 5, 6},
- {1, 4, 3},
- {1, 3, 2},
- {1, 2, 1}
-};
-
-/**
- * cs5520_set_timings - program PIO timings
- * @ap: ATA port
- * @adev: ATA device
- *
- * Program the PIO mode timings for the controller according to the pio
- * clocking table.
- */
-
-static void cs5520_set_timings(struct ata_port *ap, struct ata_device *adev, int pio)
-{
- struct pci_dev *pdev = to_pci_dev(ap->host->dev);
- int slave = adev->devno;
-
- pio -= XFER_PIO_0;
-
- /* Channel command timing */
- pci_write_config_byte(pdev, 0x62 + ap->port_no,
- (cs5520_pio_clocks[pio].recovery << 4) |
- (cs5520_pio_clocks[pio].assert));
- /* FIXME: should these use address ? */
- /* Read command timing */
- pci_write_config_byte(pdev, 0x64 + 4*ap->port_no + slave,
- (cs5520_pio_clocks[pio].recovery << 4) |
- (cs5520_pio_clocks[pio].assert));
- /* Write command timing */
- pci_write_config_byte(pdev, 0x66 + 4*ap->port_no + slave,
- (cs5520_pio_clocks[pio].recovery << 4) |
- (cs5520_pio_clocks[pio].assert));
-}
-
-/**
- * cs5520_set_piomode - program PIO timings
- * @ap: ATA port
- * @adev: ATA device
- *
- * Program the PIO mode timings for the controller according to the pio
- * clocking table.
- */
-
-static void cs5520_set_piomode(struct ata_port *ap, struct ata_device *adev)
-{
- cs5520_set_timings(ap, adev, adev->pio_mode);
-}
+#include "pata_cs5520.h"

static struct scsi_host_template cs5520_sht = {
ATA_BMDMA_SHT(DRV_NAME),
Index: b/drivers/ata/pata_cs5520.h
===================================================================
--- /dev/null
+++ b/drivers/ata/pata_cs5520.h
@@ -0,0 +1,60 @@
+
+struct pio_clocks {
+ int address;
+ int assert;
+ int recovery;
+};
+
+static const struct pio_clocks cs5520_pio_clocks[] = {
+ { 3, 6, 11 },
+ { 2, 5, 6 },
+ { 1, 4, 3 },
+ { 1, 3, 2 },
+ { 1, 2, 1 }
+};
+
+/**
+ * cs5520_set_timings - program PIO timings
+ * @ap: ATA port
+ * @adev: ATA device
+ *
+ * Program the PIO mode timings for the controller according to the pio
+ * clocking table.
+ */
+
+static void cs5520_set_timings(struct ata_port *ap, struct ata_device *adev,
+ int pio)
+{
+ struct pci_dev *pdev = to_pci_dev(ap->host->dev);
+ int slave = adev->devno;
+
+ pio -= XFER_PIO_0;
+
+ /* Channel command timing */
+ pci_write_config_byte(pdev, 0x62 + ap->port_no,
+ (cs5520_pio_clocks[pio].recovery << 4) |
+ (cs5520_pio_clocks[pio].assert));
+ /* FIXME: should these use address ? */
+ /* Read command timing */
+ pci_write_config_byte(pdev, 0x64 + 4*ap->port_no + slave,
+ (cs5520_pio_clocks[pio].recovery << 4) |
+ (cs5520_pio_clocks[pio].assert));
+ /* Write command timing */
+ pci_write_config_byte(pdev, 0x66 + 4*ap->port_no + slave,
+ (cs5520_pio_clocks[pio].recovery << 4) |
+ (cs5520_pio_clocks[pio].assert));
+}
+
+/**
+ * cs5520_set_piomode - program PIO timings
+ * @ap: ATA port
+ * @adev: ATA device
+ *
+ * Program the PIO mode timings for the controller according to the pio
+ * clocking table.
+ */
+
+static void cs5520_set_piomode(struct ata_port *ap, struct ata_device *adev)
+{
+ cs5520_set_timings(ap, adev, adev->pio_mode);
+}

\
 
 \ /
  Last update: 2010-01-29 17:17    [W:0.182 / U:0.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site