]> git.pld-linux.org Git - packages/kernel.git/blame - linux-2.6-sata-promise-pata-ports.patch
- try to fix ppc builds for external modules (untested yet)
[packages/kernel.git] / linux-2.6-sata-promise-pata-ports.patch
CommitLineData
5130d962 1--- linux-2.6.19/drivers/ata/libata-core.c.~1~ 2006-12-05 20:42:18.000000000 +0100
2+++ linux-2.6.19/drivers/ata/libata-core.c 2006-12-05 21:01:26.000000000 +0100
cb2ed5dc 3@@ -5298,13 +5298,13 @@ void ata_port_init(struct ata_port *ap,
4 ap->pio_mask = ent->pinfo2->pio_mask;
5 ap->mwdma_mask = ent->pinfo2->mwdma_mask;
6 ap->udma_mask = ent->pinfo2->udma_mask;
7- ap->flags |= ent->pinfo2->flags;
5130d962 8+ ap->flags |= ent->pinfo2->flags | ent->_port_flags[port_no];
cb2ed5dc 9 ap->ops = ent->pinfo2->port_ops;
10 } else {
11 ap->pio_mask = ent->pio_mask;
12 ap->mwdma_mask = ent->mwdma_mask;
13 ap->udma_mask = ent->udma_mask;
14- ap->flags |= ent->port_flags;
5130d962 15+ ap->flags |= ent->port_flags | ent->_port_flags[port_no];
cb2ed5dc 16 ap->ops = ent->port_ops;
17 }
93fe23ce 18 ap->hw_sata_spd_limit = UINT_MAX;
5130d962 19--- linux-2.6.19/drivers/ata/sata_promise.c.~1~ 2006-12-05 20:42:18.000000000 +0100
20+++ linux-2.6.19/drivers/ata/sata_promise.c 2006-12-05 21:01:26.000000000 +0100
cb2ed5dc 21@@ -175,7 +175,7 @@ static const struct ata_port_info pdc_po
2d190c33 22 /* board_2037x */
23 {
24 .sht = &pdc_ata_sht,
cb2ed5dc 25- .flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA,
5130d962 26+ .flags = PDC_COMMON_FLAGS,
2d190c33 27 .pio_mask = 0x1f, /* pio0-4 */
28 .mwdma_mask = 0x07, /* mwdma0-2 */
29 .udma_mask = 0x7f, /* udma0-6 ; FIXME */
5130d962 30@@ -213,7 +213,7 @@ static const struct ata_port_info pdc_po
31 /* board_2057x */
32 {
33 .sht = &pdc_ata_sht,
34- .flags = PDC_COMMON_FLAGS | ATA_FLAG_SATA,
35+ .flags = PDC_COMMON_FLAGS /* | ATA_FLAG_SATA*/,
36 .pio_mask = 0x1f, /* pio0-4 */
37 .mwdma_mask = 0x07, /* mwdma0-2 */
38 .udma_mask = 0x7f, /* udma0-6 ; FIXME */
39@@ -355,23 +355,27 @@ static void pdc_reset_port(struct ata_po
2d190c33 40 static void pdc_sata_phy_reset(struct ata_port *ap)
41 {
5130d962 42 pdc_reset_port(ap);
2d190c33 43- sata_phy_reset(ap);
5130d962 44+ if (ap->flags & ATA_FLAG_SATA)
45+ sata_phy_reset(ap);
46+ else
47+ pdc_pata_phy_reset(ap);
2d190c33 48 }
49
93fe23ce 50 static void pdc_pata_cbl_detect(struct ata_port *ap)
5130d962 51 {
52 u8 tmp;
53- void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr + PDC_CTLSTAT + 0x03;
54+ void __iomem *mmio =
55+ (void __iomem *) ap->ioaddr.cmd_addr + PDC_CTLSTAT + 0x03;
56
57 tmp = readb(mmio);
58-
59+
60 if (tmp & 0x01) {
61 ap->cbl = ATA_CBL_PATA40;
62 ap->udma_mask &= ATA_UDMA_MASK_40C;
63 } else
64 ap->cbl = ATA_CBL_PATA80;
65 }
66-
67+
68 static void pdc_pata_phy_reset(struct ata_port *ap)
69 {
70 pdc_pata_cbl_detect(ap);
71@@ -384,6 +388,20 @@ static u32 pdc_sata_scr_read (struct ata
72 {
73 if (sc_reg > SCR_CONTROL)
74 return 0xffffffffU;
75+ if (ap->flags & ATA_FLAG_SLAVE_POSS)
76+ {
77+ switch (sc_reg) {
78+ case SCR_STATUS:
79+ return 0x113;
80+ case SCR_CONTROL:
81+ return 0x300;
82+ case SCR_ERROR:
83+ case SCR_ACTIVE:
84+ default:
85+ return 0xffffffffU;
86+ }
87+ }
88+
89 return readl((void __iomem *) ap->ioaddr.scr_addr + (sc_reg * 4));
90 }
91
92@@ -391,7 +409,7 @@ static u32 pdc_sata_scr_read (struct ata
93 static void pdc_sata_scr_write (struct ata_port *ap, unsigned int sc_reg,
94 u32 val)
95 {
96- if (sc_reg > SCR_CONTROL)
97+ if ((sc_reg > SCR_CONTROL) || (ap->flags & ATA_FLAG_SLAVE_POSS))
98 return;
99 writel(val, (void __iomem *) ap->ioaddr.scr_addr + (sc_reg * 4));
100 }
101@@ -679,6 +697,7 @@ static int pdc_ata_init_one (struct pci_
2d190c33 102 unsigned int board_idx = (unsigned int) ent->driver_data;
103 int pci_dev_busy = 0;
104 int rc;
5130d962 105+ u8 tmp;
2d190c33 106
107 if (!printed_version++)
108 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
5130d962 109@@ -743,6 +762,9 @@ static int pdc_ata_init_one (struct pci_
2d190c33 110 probe_ent->port[0].scr_addr = base + 0x400;
111 probe_ent->port[1].scr_addr = base + 0x500;
112
5130d962 113+ probe_ent->_port_flags[0] = ATA_FLAG_SATA;
114+ probe_ent->_port_flags[1] = ATA_FLAG_SATA;
2d190c33 115+
116 /* notice 4-port boards */
117 switch (board_idx) {
7cec6161 118 case board_40518:
5130d962 119@@ -757,13 +779,27 @@ static int pdc_ata_init_one (struct pci_
2d190c33 120
121 probe_ent->port[2].scr_addr = base + 0x600;
122 probe_ent->port[3].scr_addr = base + 0x700;
5130d962 123+
124+ probe_ent->_port_flags[2] = ATA_FLAG_SATA;
125+ probe_ent->_port_flags[3] = ATA_FLAG_SATA;
2d190c33 126 break;
7cec6161 127 case board_2057x:
128 /* Override hotplug offset for SATAII150 */
129 hp->hotplug_offset = PDC2_SATA_PLUG_CSR;
130 /* Fall through */
2d190c33 131 case board_2037x:
5130d962 132+ /* Some boards have also PATA port */
133 probe_ent->n_ports = 2;
134+ probe_ent->_port_flags[0] = ATA_FLAG_SATA;
135+ probe_ent->_port_flags[1] = ATA_FLAG_SATA;
136+ tmp = readb(mmio_base + PDC_FLASH_CTL+1);
137+ if (!(tmp & 0x80))
138+ {
139+ probe_ent->n_ports = 3;
140+ pdc_ata_setup_port(&probe_ent->port[2], base + 0x300);
141+ probe_ent->_port_flags[2] = ATA_FLAG_SLAVE_POSS;
142+ printk(KERN_INFO DRV_NAME " PATA port found\n");
143+ }
2d190c33 144 break;
145 case board_20771:
146 probe_ent->n_ports = 2;
5130d962 147--- linux-2.6.19/include/linux/libata.h.~1~ 2006-12-05 20:42:18.000000000 +0100
148+++ linux-2.6.19/include/linux/libata.h 2006-12-05 21:01:26.000000000 +0100
149@@ -377,6 +377,7 @@ struct ata_probe_ent {
150 unsigned int irq_flags;
151 unsigned long port_flags;
152 unsigned long _host_flags;
153+ unsigned long _port_flags[ATA_MAX_PORTS];
154 void __iomem *mmio_base;
155 void *private_data;
2d190c33 156
This page took 0.100146 seconds and 4 git commands to generate.