Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 269320
b: refs/heads/master
c: 023a017
h: refs/heads/master
v: v3
  • Loading branch information
Dan McGee authored and Jeff Garzik committed Oct 8, 2011
1 parent 338158b commit 86f3d8e
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 19 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 904c04feaf13ed58790a34a0b11cd7b885b94b4b
refs/heads/master: 023a0175ad4beaa14b303e133963c971ad31c338
46 changes: 28 additions & 18 deletions trunk/drivers/ata/pata_sis.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,29 @@ static int sis_old_port_base(struct ata_device *adev)
return 0x40 + (4 * adev->link->ap->port_no) + (2 * adev->devno);
}

/**
* sis_port_base - return PCI configuration base for dev
* @adev: device
*
* Returns the base of the PCI configuration registers for this port
* number.
*/

static int sis_port_base(struct ata_device *adev)
{
struct ata_port *ap = adev->link->ap;
struct pci_dev *pdev = to_pci_dev(ap->host->dev);
int port = 0x40;
u32 reg54;

/* If bit 30 is set then the registers are mapped at 0x70 not 0x40 */
pci_read_config_dword(pdev, 0x54, &reg54);
if (reg54 & 0x40000000)
port = 0x70;

return port + (8 * ap->port_no) + (4 * adev->devno);
}

/**
* sis_133_cable_detect - check for 40/80 pin
* @ap: Port
Expand Down Expand Up @@ -266,9 +289,8 @@ static void sis_100_set_piomode (struct ata_port *ap, struct ata_device *adev)
static void sis_133_set_piomode (struct ata_port *ap, struct ata_device *adev)
{
struct pci_dev *pdev = to_pci_dev(ap->host->dev);
int port = 0x40;
int port;
u32 t1;
u32 reg54;
int speed = adev->pio_mode - XFER_PIO_0;

const u32 timing133[] = {
Expand All @@ -288,12 +310,7 @@ static void sis_133_set_piomode (struct ata_port *ap, struct ata_device *adev)

sis_set_fifo(ap, adev);

/* If bit 14 is set then the registers are mapped at 0x70 not 0x40 */
pci_read_config_dword(pdev, 0x54, &reg54);
if (reg54 & 0x40000000)
port = 0x70;
port += 8 * ap->port_no + 4 * adev->devno;

port = sis_port_base(adev);
pci_read_config_dword(pdev, port, &t1);
t1 &= 0xC0C00FFF; /* Mask out timing */

Expand Down Expand Up @@ -465,29 +482,22 @@ static void sis_133_early_set_dmamode (struct ata_port *ap, struct ata_device *a
static void sis_133_set_dmamode (struct ata_port *ap, struct ata_device *adev)
{
struct pci_dev *pdev = to_pci_dev(ap->host->dev);
int speed = adev->dma_mode - XFER_MW_DMA_0;
int port = 0x40;
int port;
u32 t1;
u32 reg54;

/* bits 4- cycle time 8 - cvs time */
static const u32 timing_u100[] = { 0x6B0, 0x470, 0x350, 0x140, 0x120, 0x110, 0x000 };
static const u32 timing_u133[] = { 0x9F0, 0x6A0, 0x470, 0x250, 0x230, 0x220, 0x210 };

/* If bit 14 is set then the registers are mapped at 0x70 not 0x40 */
pci_read_config_dword(pdev, 0x54, &reg54);
if (reg54 & 0x40000000)
port = 0x70;
port += (8 * ap->port_no) + (4 * adev->devno);

port = sis_port_base(adev);
pci_read_config_dword(pdev, port, &t1);

if (adev->dma_mode < XFER_UDMA_0) {
t1 &= ~0x00000004;
/* FIXME: need data sheet to add MWDMA here. Also lacking on
ide/pci driver */
} else {
speed = adev->dma_mode - XFER_UDMA_0;
int speed = adev->dma_mode - XFER_UDMA_0;
/* if & 8 no UDMA133 - need info for ... */
t1 &= ~0x00000FF0;
t1 |= 0x00000004;
Expand Down

0 comments on commit 86f3d8e

Please sign in to comment.