From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: linux-ide@vger.kernel.org
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH 83/86] pata_via: add via_fixup()
Date: Wed, 25 Nov 2009 18:12:25 +0100 [thread overview]
Message-ID: <20091125171225.5446.58040.sendpatchset@localhost> (raw)
In-Reply-To: <20091125170218.5446.13513.sendpatchset@localhost>
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] pata_via: add via_fixup()
Factor out common code from via_[re]init_one() to via_fixup().
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
drivers/ata/pata_via.c | 53 +++++++++++++++++++++----------------------------
1 file changed, 23 insertions(+), 30 deletions(-)
Index: b/drivers/ata/pata_via.c
===================================================================
--- a/drivers/ata/pata_via.c
+++ b/drivers/ata/pata_via.c
@@ -468,6 +468,27 @@ static void via_config_fifo(struct pci_d
}
}
+static void via_fixup(struct pci_dev *pdev, const struct via_isa_bridge *config)
+{
+ u32 timing;
+
+ /* Initialise the FIFO for the enabled channels. */
+ via_config_fifo(pdev, config->flags);
+
+ if ((config->flags & VIA_UDMA) == VIA_UDMA_66) {
+ /* The 66 MHz devices require we enable the clock */
+ pci_read_config_dword(pdev, 0x50, &timing);
+ timing |= 0x80008;
+ pci_write_config_dword(pdev, 0x50, timing);
+ }
+ if (config->flags & VIA_BAD_CLK66) {
+ /* Disable the 66MHz clock on problem devices */
+ pci_read_config_dword(pdev, 0x50, &timing);
+ timing &= ~0x80008;
+ pci_write_config_dword(pdev, 0x50, timing);
+ }
+}
+
/**
* via_init_one - discovery callback
* @pdev: PCI device
@@ -530,7 +551,6 @@ static int via_init_one(struct pci_dev *
const struct via_isa_bridge *config;
static int printed_version;
u8 enable;
- u32 timing;
unsigned long flags = id->driver_data;
int rc;
@@ -568,9 +588,6 @@ static int via_init_one(struct pci_dev *
return -ENODEV;
}
- /* Initialise the FIFO for the enabled channels. */
- via_config_fifo(pdev, config->flags);
-
/* Clock set up */
switch(config->flags & VIA_UDMA) {
case VIA_UDMA_NONE:
@@ -584,10 +601,6 @@ static int via_init_one(struct pci_dev *
break;
case VIA_UDMA_66:
ppi[0] = &via_udma66_info;
- /* The 66 MHz devices require we enable the clock */
- pci_read_config_dword(pdev, 0x50, &timing);
- timing |= 0x80008;
- pci_write_config_dword(pdev, 0x50, timing);
break;
case VIA_UDMA_100:
ppi[0] = &via_udma100_info;
@@ -600,12 +613,7 @@ static int via_init_one(struct pci_dev *
return -ENODEV;
}
- if (config->flags & VIA_BAD_CLK66) {
- /* Disable the 66MHz clock on problem devices */
- pci_read_config_dword(pdev, 0x50, &timing);
- timing &= ~0x80008;
- pci_write_config_dword(pdev, 0x50, timing);
- }
+ via_fixup(pdev, config);
/* We have established the device type, now fire it up */
return ata_pci_sff_init_one(pdev, ppi, &via_sht, (void *)config);
@@ -624,29 +632,14 @@ static int via_init_one(struct pci_dev *
static int via_reinit_one(struct pci_dev *pdev)
{
- u32 timing;
struct ata_host *host = dev_get_drvdata(&pdev->dev);
- const struct via_isa_bridge *config = host->private_data;
int rc;
rc = ata_pci_device_do_resume(pdev);
if (rc)
return rc;
- via_config_fifo(pdev, config->flags);
-
- if ((config->flags & VIA_UDMA) == VIA_UDMA_66) {
- /* The 66 MHz devices require we enable the clock */
- pci_read_config_dword(pdev, 0x50, &timing);
- timing |= 0x80008;
- pci_write_config_dword(pdev, 0x50, timing);
- }
- if (config->flags & VIA_BAD_CLK66) {
- /* Disable the 66MHz clock on problem devices */
- pci_read_config_dword(pdev, 0x50, &timing);
- timing &= ~0x80008;
- pci_write_config_dword(pdev, 0x50, timing);
- }
+ via_fixup(pdev, host->private_data);
ata_host_resume(host);
return 0;
next prev parent reply other threads:[~2009-11-25 17:12 UTC|newest]
Thread overview: 188+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-25 17:02 [PATCH 00/86] PATA fixes Bartlomiej Zolnierkiewicz
2009-11-25 17:02 ` [PATCH 01/86] ata_piix: fix MWDMA handling on PIIX3 Bartlomiej Zolnierkiewicz
2009-11-25 17:02 ` [PATCH 02/86] ata_piix: unify code for programming PIO and MWDMA timings Bartlomiej Zolnierkiewicz
2009-11-25 17:02 ` [PATCH 03/86] pata_artop: add 32-bit PIO support Bartlomiej Zolnierkiewicz
2009-11-25 17:12 ` Alan Cox
2009-11-25 17:18 ` Bartlomiej Zolnierkiewicz
2009-11-25 17:59 ` Alan Cox
2009-11-25 17:02 ` [PATCH 04/86] pata_artop: fix chipsets naming Bartlomiej Zolnierkiewicz
2009-11-25 17:02 ` [PATCH 05/86] pata_artop: add Power Management support Bartlomiej Zolnierkiewicz
2009-12-01 18:34 ` Sergei Shtylyov
2009-11-25 17:03 ` [PATCH 06/86] pata_artop: unify ->prereset methods Bartlomiej Zolnierkiewicz
2009-11-25 17:03 ` [PATCH 07/86] pata_artop: remove dead 34MHz PCI clock support Bartlomiej Zolnierkiewicz
2009-12-01 17:23 ` Sergei Shtylyov
2009-11-25 17:03 ` [PATCH 08/86] pata_atiixp: add 32-bit PIO support Bartlomiej Zolnierkiewicz
2009-11-25 17:03 ` [PATCH 09/86] pata_atiixp: no need to program PIO timings for MWDMA Bartlomiej Zolnierkiewicz
2009-11-25 17:25 ` Alan Cox
2009-11-25 17:03 ` [PATCH 10/86] pata_atiixp: add MWDMA0 support Bartlomiej Zolnierkiewicz
2009-11-25 17:03 ` [PATCH 11/86] pata_atiixp: remove custom BMDMA methods Bartlomiej Zolnierkiewicz
2009-11-25 17:34 ` Alan Cox
2009-11-25 17:03 ` [PATCH 12/86] pata_atiixp: add proper ->prereset method Bartlomiej Zolnierkiewicz
2009-11-25 17:15 ` Alan Cox
2009-11-25 17:03 ` [PATCH 13/86] pata_efar: add 32-bit PIO support Bartlomiej Zolnierkiewicz
2009-11-25 17:03 ` [PATCH 14/86] pata_efar: fix wrong PIO timings being programmed Bartlomiej Zolnierkiewicz
2009-11-25 17:04 ` [PATCH 15/86] pata_efar: fix wrong MWDMA " Bartlomiej Zolnierkiewicz
2009-11-25 17:04 ` [PATCH 16/86] pata_efar: MWDMA0 is unsupported Bartlomiej Zolnierkiewicz
2009-11-25 17:25 ` Alan Cox
2009-11-26 14:53 ` Bartlomiej Zolnierkiewicz
2009-11-26 15:15 ` Alan Cox
2009-11-26 15:33 ` Sergei Shtylyov
2009-11-26 15:40 ` Bartlomiej Zolnierkiewicz
2009-11-26 16:17 ` Sergei Shtylyov
2009-11-26 16:29 ` Bartlomiej Zolnierkiewicz
2009-11-26 16:44 ` Sergei Shtylyov
2009-12-03 20:50 ` Jeff Garzik
2009-11-25 17:04 ` [PATCH 17/86] pata_efar: fix register naming used in efar_set_piomode() Bartlomiej Zolnierkiewicz
2009-11-25 17:25 ` Alan Cox
2009-11-25 17:32 ` Bartlomiej Zolnierkiewicz
2009-11-25 17:04 ` [PATCH 18/86] pata_efar: unify code for programming PIO and MWDMA timings Bartlomiej Zolnierkiewicz
2009-11-25 17:04 ` [PATCH 19/86] pata_cmd640: document known issues Bartlomiej Zolnierkiewicz
2009-11-25 17:26 ` Alan Cox
2009-11-25 17:34 ` Bartlomiej Zolnierkiewicz
2009-11-25 18:14 ` Alan Cox
2009-11-25 17:37 ` Jeff Garzik
2009-11-25 17:44 ` Bartlomiej Zolnierkiewicz
2009-11-25 17:04 ` [PATCH 20/86] pata_cmd64x: add 32-bit PIO support Bartlomiej Zolnierkiewicz
2009-11-25 17:04 ` [PATCH 21/86] pata_cmd64x: add enablebits checking Bartlomiej Zolnierkiewicz
2009-11-25 17:04 ` [PATCH 22/86] pata_cmd64x: add cmd64x_fixup() Bartlomiej Zolnierkiewicz
2009-11-25 17:05 ` [PATCH 23/86] pata_cs5520: add 32-bit PIO support Bartlomiej Zolnierkiewicz
2009-11-25 17:05 ` [PATCH 24/86] pata_cs5520: remove dead VDMA support Bartlomiej Zolnierkiewicz
2009-11-25 17:28 ` Alan Cox
2009-11-25 17:05 ` [PATCH 25/86] pata_cs5530: add 32-bit PIO support Bartlomiej Zolnierkiewicz
2009-11-25 17:05 ` [PATCH 26/86] pata_cs5535: " Bartlomiej Zolnierkiewicz
2009-11-25 17:05 ` [PATCH 27/86] pata_cs5535: no need to program PIO0 timings during device init Bartlomiej Zolnierkiewicz
2009-11-25 17:05 ` [PATCH 28/86] pata_cypress: add 32-bit PIO support Bartlomiej Zolnierkiewicz
2009-11-25 17:05 ` [PATCH 29/86] pata_cypress: document known issues Bartlomiej Zolnierkiewicz
2009-11-25 17:05 ` [PATCH 30/86] pata_hpt366: add 32-bit PIO support Bartlomiej Zolnierkiewicz
2009-11-25 17:06 ` [PATCH 31/86] pata_hpt37x: " Bartlomiej Zolnierkiewicz
2009-11-25 17:06 ` [PATCH 32/86] pata_hpt3x2n: " Bartlomiej Zolnierkiewicz
2009-11-25 17:06 ` [PATCH 33/86] pata_hpt3x3: Power Management fix Bartlomiej Zolnierkiewicz
2009-11-25 17:06 ` [PATCH 34/86] pata_it8213: add 32-bit PIO support Bartlomiej Zolnierkiewicz
2009-11-25 17:06 ` [PATCH 35/86] pata_it8213: fix UDMA handling Bartlomiej Zolnierkiewicz
2009-11-25 17:06 ` [PATCH 36/86] pata_it8213: add UDMA100 and UDMA133 support Bartlomiej Zolnierkiewicz
2009-11-26 15:05 ` Sergei Shtylyov
2009-11-26 15:17 ` Sergei Shtylyov
2009-11-26 15:36 ` Bartlomiej Zolnierkiewicz
2009-11-26 18:10 ` Sergei Shtylyov
2009-11-25 17:06 ` [PATCH 37/86] pata_it8213: fix wrong PIO timings being programmed Bartlomiej Zolnierkiewicz
2009-11-25 17:06 ` [PATCH 38/86] pata_it8213: fix PIO2 underclocking Bartlomiej Zolnierkiewicz
2009-11-25 17:06 ` [PATCH 39/86] pata_it8213: fix wrong MWDMA timings being programmed Bartlomiej Zolnierkiewicz
2009-11-25 17:07 ` [PATCH 40/86] pata_it8213: fix register naming used in it8213_set_piomode() Bartlomiej Zolnierkiewicz
2009-11-25 17:07 ` [PATCH 41/86] pata_efar: unify code for programming PIO and MWDMA timings Bartlomiej Zolnierkiewicz
2009-11-26 18:29 ` Sergei Shtylyov
2009-11-25 17:07 ` [PATCH 42/86] pata_it8213: fix it8213_pre_reset() documentation Bartlomiej Zolnierkiewicz
2009-11-25 17:07 ` [PATCH 43/86] pata_it821x: add 32-bit PIO support Bartlomiej Zolnierkiewicz
2009-11-25 17:07 ` [PATCH 44/86] pata_jmicron: " Bartlomiej Zolnierkiewicz
2009-11-25 17:07 ` [PATCH 45/86] pata_legacy: do not probe extra ports automatically if PCI is not present Bartlomiej Zolnierkiewicz
2009-11-25 17:32 ` Alan Cox
2009-11-25 17:45 ` Bartlomiej Zolnierkiewicz
2009-11-25 18:12 ` Alan Cox
2009-11-25 18:20 ` Bartlomiej Zolnierkiewicz
2009-11-25 17:07 ` [PATCH 46/86] pata_legacy: fix QDI6580DP support Bartlomiej Zolnierkiewicz
2009-11-25 17:07 ` [PATCH 47/86] pata_legacy: fix access to control register for QDI6580 Bartlomiej Zolnierkiewicz
2009-11-25 17:08 ` [PATCH 48/86] pata_legacy: add pointers to QDI65x0 documentation Bartlomiej Zolnierkiewicz
2009-11-25 17:38 ` Alan Cox
2009-11-25 17:44 ` Bartlomiej Zolnierkiewicz
2009-11-25 18:12 ` Alan Cox
2009-11-25 18:21 ` Bartlomiej Zolnierkiewicz
2009-11-25 17:08 ` [PATCH 49/86] pata_legacy: unify QDI ->set_piomode methods Bartlomiej Zolnierkiewicz
2009-11-25 17:08 ` [PATCH 50/86] pata_legacy: use PIO mask defines Bartlomiej Zolnierkiewicz
2009-11-25 17:08 ` [PATCH 51/86] libata: remove no longer needed pata_qdi driver Bartlomiej Zolnierkiewicz
2009-11-25 17:41 ` Alan Cox
2009-11-25 17:08 ` [PATCH 52/86] libata: remove no longer needed pata_winbond driver Bartlomiej Zolnierkiewicz
2009-11-25 17:08 ` [PATCH 53/86] pata_marvell: fix marvell_pre_reset() documentation Bartlomiej Zolnierkiewicz
2009-11-25 17:08 ` [PATCH 54/86] pata_ns87415: add 32-bit PIO support Bartlomiej Zolnierkiewicz
2009-11-25 17:08 ` [PATCH 55/86] pata_ns87415: Power Management fix Bartlomiej Zolnierkiewicz
2009-11-25 17:09 ` [PATCH 56/86] pata_oldpiix: unify code for programming PIO and MWDMA timings Bartlomiej Zolnierkiewicz
2009-11-25 17:09 ` [PATCH 57/86] pata_opti: add 32-bit PIO support Bartlomiej Zolnierkiewicz
2009-11-25 17:09 ` [PATCH 58/86] pata_pdc2027x: " Bartlomiej Zolnierkiewicz
2009-11-25 17:09 ` [PATCH 59/86] pata_pdc2027x: add Power Management support Bartlomiej Zolnierkiewicz
2009-11-25 17:09 ` [PATCH 60/86] pata_pdc202xx_old: add 32-bit PIO support Bartlomiej Zolnierkiewicz
2009-11-25 17:09 ` [PATCH 61/86] pata_sis: Power Management fix Bartlomiej Zolnierkiewicz
2009-11-25 17:09 ` [PATCH 62/86] pata_pdc202xx_old: document known issues Bartlomiej Zolnierkiewicz
2009-11-25 17:46 ` Alan Cox
2009-11-25 17:50 ` Jeff Garzik
2009-11-25 17:52 ` Bartlomiej Zolnierkiewicz
2009-11-25 18:04 ` Jeff Garzik
2009-11-25 18:29 ` Bartlomiej Zolnierkiewicz
2009-11-25 20:38 ` Jeff Garzik
2009-11-25 22:02 ` Bartlomiej Zolnierkiewicz
2009-11-26 3:14 ` Jeff Garzik
2009-11-26 11:57 ` Bartlomiej Zolnierkiewicz
2009-11-25 18:09 ` Alan Cox
2009-11-25 17:09 ` [PATCH 63/86] pata_radisys: fix UDMA handling Bartlomiej Zolnierkiewicz
2009-11-25 17:10 ` [PATCH 64/86] pata_radisys: unify code for programming PIO and MWDMA timings Bartlomiej Zolnierkiewicz
2009-11-26 19:03 ` Sergei Shtylyov
2009-11-25 17:10 ` [PATCH 65/86] pata_rdc: " Bartlomiej Zolnierkiewicz
2009-11-25 17:10 ` [PATCH 66/86] pata_rz1000: add 32-bit PIO support Bartlomiej Zolnierkiewicz
2009-11-25 17:10 ` [PATCH 67/86] pata_rz1000: Power Management fix Bartlomiej Zolnierkiewicz
2009-11-25 17:10 ` [PATCH 68/86] pata_sc1200: add 32-bit PIO support Bartlomiej Zolnierkiewicz
2009-11-25 17:10 ` [PATCH 69/86] pata_scc: " Bartlomiej Zolnierkiewicz
2009-11-25 17:48 ` Alan Cox
2009-11-25 17:49 ` Bartlomiej Zolnierkiewicz
2009-11-25 17:10 ` [PATCH 70/86] pata_scc: add proper cable detection method Bartlomiej Zolnierkiewicz
2009-11-25 17:10 ` [PATCH 71/86] pata_sch: add 32-bit PIO support Bartlomiej Zolnierkiewicz
2009-11-25 17:11 ` [PATCH 72/86] pata_serverworks: " Bartlomiej Zolnierkiewicz
2009-11-25 17:11 ` [PATCH 73/86] pata_serverworks: use standard cable detection methods Bartlomiej Zolnierkiewicz
2009-11-25 17:11 ` [PATCH 74/86] pata_serverworks: add serverworks_fixup() Bartlomiej Zolnierkiewicz
2009-11-25 17:11 ` [PATCH 75/86] pata_sl82c105: add 32-bit PIO support Bartlomiej Zolnierkiewicz
2009-11-25 17:11 ` [PATCH 76/86] pata_sl82c105: add Power Management support Bartlomiej Zolnierkiewicz
2009-11-25 17:11 ` [PATCH 77/86] pata_sis: add 32-bit PIO support Bartlomiej Zolnierkiewicz
2009-11-25 17:11 ` [PATCH 78/86] pata_sis: Power Management fix Bartlomiej Zolnierkiewicz
2009-11-25 17:11 ` [PATCH 79/86] pata_triflex: add 32-bit PIO support Bartlomiej Zolnierkiewicz
2009-11-25 17:12 ` [PATCH 80/86] libata: make ata_sff_data_xfer_noirq() work with 32-bit PIO Bartlomiej Zolnierkiewicz
2009-11-25 17:12 ` [PATCH 81/86] pata_via: add 32-bit PIO support Bartlomiej Zolnierkiewicz
2009-11-25 17:12 ` [PATCH 82/86] pata_via: clear UDMA transfer mode bit for PIO and MWDMA Bartlomiej Zolnierkiewicz
2009-11-25 17:52 ` Alan Cox
2009-11-25 17:58 ` Bartlomiej Zolnierkiewicz
2009-11-25 18:06 ` Alan Cox
2009-11-25 18:10 ` Bartlomiej Zolnierkiewicz
2009-11-25 19:34 ` Alan Cox
2009-11-25 19:53 ` Bartlomiej Zolnierkiewicz
2009-11-25 17:12 ` Bartlomiej Zolnierkiewicz [this message]
2009-11-25 17:12 ` [PATCH 84/86] libata: add ata_mwdma_to_pio() inline helper Bartlomiej Zolnierkiewicz
2009-12-04 18:07 ` Sergei Shtylyov
2009-11-25 17:12 ` [PATCH 85/86] libata: add ->init_host method Bartlomiej Zolnierkiewicz
2009-11-25 17:56 ` Alan Cox
2009-11-25 17:12 ` [PATCH 86/86] libata: add private driver field to struct ata_device Bartlomiej Zolnierkiewicz
2009-11-25 17:56 ` Alan Cox
2009-11-25 18:02 ` Bartlomiej Zolnierkiewicz
2009-11-25 18:17 ` Alan Cox
2009-12-03 8:04 ` Jeff Garzik
2009-12-03 12:37 ` Bartlomiej Zolnierkiewicz
2009-12-03 17:45 ` Jeff Garzik
2009-11-25 17:19 ` [PATCH 00/86] PATA fixes Jeff Garzik
2009-11-25 17:24 ` Bartlomiej Zolnierkiewicz
2009-11-25 18:01 ` Alan Cox
2009-12-03 8:07 ` Jeff Garzik
2009-12-03 12:39 ` Bartlomiej Zolnierkiewicz
2009-12-03 17:53 ` Jeff Garzik
2009-12-03 19:45 ` Bartlomiej Zolnierkiewicz
2009-12-03 20:11 ` Jeff Garzik
2009-12-03 20:26 ` Bartlomiej Zolnierkiewicz
2009-12-03 20:39 ` Jeff Garzik
2009-12-03 21:01 ` Bartlomiej Zolnierkiewicz
2009-12-03 21:28 ` Jeff Garzik
2009-12-12 2:02 ` david
2009-12-12 3:23 ` Bartlomiej Zolnierkiewicz
2009-12-03 21:16 ` Jeff Garzik
2009-12-03 21:42 ` Bartlomiej Zolnierkiewicz
2009-12-03 21:51 ` Jeff Garzik
2009-12-03 21:56 ` Bartlomiej Zolnierkiewicz
2009-12-03 22:02 ` Jeff Garzik
2009-12-03 22:06 ` Bartlomiej Zolnierkiewicz
2009-12-03 22:10 ` Jeff Garzik
2009-12-03 22:22 ` Jeff Garzik
2009-12-03 22:23 ` Bartlomiej Zolnierkiewicz
2009-12-03 22:30 ` Jeff Garzik
2009-12-03 22:45 ` Bartlomiej Zolnierkiewicz
2009-12-03 22:02 ` Sergei Shtylyov
2009-12-03 22:08 ` Jeff Garzik
2009-12-04 0:17 ` Alan Cox
2009-12-03 22:57 ` Jeff Garzik
2009-12-04 12:16 ` Alan Cox
2009-12-03 16:59 ` Alan Cox
2009-12-03 17:39 ` Jeff Garzik
2009-12-03 20:48 ` David Miller
2009-12-03 21:32 ` Jeff Garzik
2009-12-03 21:41 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091125171225.5446.58040.sendpatchset@localhost \
--to=bzolnier@gmail.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).