diff options
author | Alan <alan@lxorguk.ukuu.org.uk> | 2007-01-08 11:11:07 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-02-09 17:39:34 -0500 |
commit | 9b14dec5adf47287a2b52fc9fdedd6a0e245daca (patch) | |
tree | 7f668908385c18c957b076797c558033f2e370f5 /drivers/ata/sata_sis.c | |
parent | 5924b74c1cde5ef0246cf0dfbe689b27ffbe815b (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>
Diffstat (limited to 'drivers/ata/sata_sis.c')
-rw-r--r-- | drivers/ata/sata_sis.c | 34 |
1 files changed, 25 insertions, 9 deletions
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 | |||
142 | MODULE_AUTHOR("Uwe Koziolek"); | 141 | MODULE_AUTHOR("Uwe Koziolek"); |
143 | MODULE_DESCRIPTION("low-level driver for Silicon Integratad Systems SATA controller"); | 142 | MODULE_DESCRIPTION("low-level driver for Silicon Integratad Systems SATA controller"); |
144 | MODULE_LICENSE("GPL"); | 143 | MODULE_LICENSE("GPL"); |
145 | MODULE_DEVICE_TABLE(pci, sis_pci_tbl); | 144 | MODULE_DEVICE_TABLE(pci, sis_pci_tbl); |
146 | MODULE_VERSION(DRV_VERSION); | 145 | MODULE_VERSION(DRV_VERSION); |
147 | 146 | ||
148 | static unsigned int get_scr_cfg_addr(unsigned int port_no, unsigned int sc_reg, struct pci_dev *pdev) | 147 | static 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, | |||
170 | static u32 sis_scr_cfg_read (struct ata_port *ap, unsigned int sc_reg) | 173 | static 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 | ||
191 | static void sis_scr_cfg_write (struct ata_port *ap, unsigned int scr, u32 val) | 194 | static 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 | ||
252 | static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | 255 | static 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 | ||
380 | module_init(sis_init); | 397 | module_init(sis_init); |
381 | module_exit(sis_exit); | 398 | module_exit(sis_exit); |
382 | |||