aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan <alan@lxorguk.ukuu.org.uk>2007-01-08 11:11:07 -0500
committerJeff Garzik <jeff@garzik.org>2007-02-09 17:39:34 -0500
commit9b14dec5adf47287a2b52fc9fdedd6a0e245daca (patch)
tree7f668908385c18c957b076797c558033f2e370f5
parent5924b74c1cde5ef0246cf0dfbe689b27ffbe815b (diff)
sata_sis: Support for PATA supports
This is quick rework of the patch Uwe proposed but using Kconfig not ifdefs and user selection to sort out PATA support. Instead of ifdefs and requiring the user to select both drivers the SATA driver selects the PATA one. For neatness I've also moved the extern into the function that uses it. Signed-off-by: Alan Cox Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r--drivers/ata/Kconfig9
-rw-r--r--drivers/ata/pata_sis.c2
-rw-r--r--drivers/ata/sata_sis.c34
3 files changed, 33 insertions, 12 deletions
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index ea102c089222..9e101aa638d1 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -116,11 +116,14 @@ config SATA_SIL24
116 If unsure, say N. 116 If unsure, say N.
117 117
118config SATA_SIS 118config SATA_SIS
119 tristate "SiS 964/180 SATA support" 119 tristate "SiS 964/965/966/180 SATA support"
120 depends on PCI 120 depends on PCI
121 select PATA_SIS
121 help 122 help
122 This option enables support for SiS Serial ATA 964/180. 123 This option enables support for SiS Serial ATA on
123 124 SiS 964/965/966/180 and Parallel ATA on SiS 180.
125 The PATA support for SiS 180 requires additionally to
126 enable the PATA_SIS driver in the config.
124 If unsure, say N. 127 If unsure, say N.
125 128
126config SATA_ULI 129config SATA_ULI
diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c
index d9486fcd59f2..6746f3fb0876 100644
--- a/drivers/ata/pata_sis.c
+++ b/drivers/ata/pata_sis.c
@@ -796,6 +796,8 @@ static struct ata_port_info sis_info133_early = {
796 .port_ops = &sis_133_early_ops, 796 .port_ops = &sis_133_early_ops,
797}; 797};
798 798
799/* Privately shared with the SiS180 SATA driver, not for use elsewhere */
800EXPORT_SYMBOL_GPL(sis_info133);
799 801
800static void sis_fixup(struct pci_dev *pdev, struct sis_chipset *sis) 802static void sis_fixup(struct pci_dev *pdev, struct sis_chipset *sis)
801{ 803{
diff --git a/drivers/ata/sata_sis.c b/drivers/ata/sata_sis.c
index c90fb1319dfe..a915822ae63c 100644
--- a/drivers/ata/sata_sis.c
+++ b/drivers/ata/sata_sis.c
@@ -138,22 +138,25 @@ static struct ata_port_info sis_port_info = {
138 .port_ops = &sis_ops, 138 .port_ops = &sis_ops,
139}; 139};
140 140
141
142MODULE_AUTHOR("Uwe Koziolek"); 141MODULE_AUTHOR("Uwe Koziolek");
143MODULE_DESCRIPTION("low-level driver for Silicon Integratad Systems SATA controller"); 142MODULE_DESCRIPTION("low-level driver for Silicon Integratad Systems SATA controller");
144MODULE_LICENSE("GPL"); 143MODULE_LICENSE("GPL");
145MODULE_DEVICE_TABLE(pci, sis_pci_tbl); 144MODULE_DEVICE_TABLE(pci, sis_pci_tbl);
146MODULE_VERSION(DRV_VERSION); 145MODULE_VERSION(DRV_VERSION);
147 146
148static unsigned int get_scr_cfg_addr(unsigned int port_no, unsigned int sc_reg, struct pci_dev *pdev) 147static unsigned int get_scr_cfg_addr(struct ata_port *ap, unsigned int sc_reg)
149{ 148{
149 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
150 unsigned int addr = SIS_SCR_BASE + (4 * sc_reg); 150 unsigned int addr = SIS_SCR_BASE + (4 * sc_reg);
151 u8 pmr;
151 152
152 if (port_no) { 153 if (ap->port_no) {
153 switch (pdev->device) { 154 switch (pdev->device) {
154 case 0x0180: 155 case 0x0180:
155 case 0x0181: 156 case 0x0181:
156 addr += SIS180_SATA1_OFS; 157 pci_read_config_byte(pdev, SIS_PMR, &pmr);
158 if ((pmr & SIS_PMR_COMBINED) == 0)
159 addr += SIS180_SATA1_OFS;
157 break; 160 break;
158 161
159 case 0x0182: 162 case 0x0182:
@@ -170,7 +173,7 @@ static unsigned int get_scr_cfg_addr(unsigned int port_no, unsigned int sc_reg,
170static u32 sis_scr_cfg_read (struct ata_port *ap, unsigned int sc_reg) 173static u32 sis_scr_cfg_read (struct ata_port *ap, unsigned int sc_reg)
171{ 174{
172 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 175 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
173 unsigned int cfg_addr = get_scr_cfg_addr(ap->port_no, sc_reg, pdev); 176 unsigned int cfg_addr = get_scr_cfg_addr(ap, sc_reg);
174 u32 val, val2 = 0; 177 u32 val, val2 = 0;
175 u8 pmr; 178 u8 pmr;
176 179
@@ -188,13 +191,13 @@ static u32 sis_scr_cfg_read (struct ata_port *ap, unsigned int sc_reg)
188 return (val|val2) & 0xfffffffb; /* avoid problems with powerdowned ports */ 191 return (val|val2) & 0xfffffffb; /* avoid problems with powerdowned ports */
189} 192}
190 193
191static void sis_scr_cfg_write (struct ata_port *ap, unsigned int scr, u32 val) 194static void sis_scr_cfg_write (struct ata_port *ap, unsigned int sc_reg, u32 val)
192{ 195{
193 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 196 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
194 unsigned int cfg_addr = get_scr_cfg_addr(ap->port_no, scr, pdev); 197 unsigned int cfg_addr = get_scr_cfg_addr(ap, sc_reg);
195 u8 pmr; 198 u8 pmr;
196 199
197 if (scr == SCR_ERROR) /* doesn't exist in PCI cfg space */ 200 if (sc_reg == SCR_ERROR) /* doesn't exist in PCI cfg space */
198 return; 201 return;
199 202
200 pci_read_config_byte(pdev, SIS_PMR, &pmr); 203 pci_read_config_byte(pdev, SIS_PMR, &pmr);
@@ -251,6 +254,9 @@ static void sis_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val)
251 254
252static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) 255static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
253{ 256{
257 /* Provided by the PATA driver */
258 extern struct ata_port_info sis_info133;
259
254 static int printed_version; 260 static int printed_version;
255 struct ata_probe_ent *probe_ent = NULL; 261 struct ata_probe_ent *probe_ent = NULL;
256 int rc; 262 int rc;
@@ -300,6 +306,17 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
300 switch (ent->device) { 306 switch (ent->device) {
301 case 0x0180: 307 case 0x0180:
302 case 0x0181: 308 case 0x0181:
309
310 /* The PATA-handling is provided by pata_sis */
311 switch (pmr & 0x30) {
312 case 0x10:
313 ppi[1] = &sis_info133;
314 break;
315
316 case 0x30:
317 ppi[0] = &sis_info133;
318 break;
319 }
303 if ((pmr & SIS_PMR_COMBINED) == 0) { 320 if ((pmr & SIS_PMR_COMBINED) == 0) {
304 dev_printk(KERN_INFO, &pdev->dev, 321 dev_printk(KERN_INFO, &pdev->dev,
305 "Detected SiS 180/181/964 chipset in SATA mode\n"); 322 "Detected SiS 180/181/964 chipset in SATA mode\n");
@@ -379,4 +396,3 @@ static void __exit sis_exit(void)
379 396
380module_init(sis_init); 397module_init(sis_init);
381module_exit(sis_exit); 398module_exit(sis_exit);
382