diff options
Diffstat (limited to 'drivers/ata/pata_ninja32.c')
-rw-r--r-- | drivers/ata/pata_ninja32.c | 51 |
1 files changed, 40 insertions, 11 deletions
diff --git a/drivers/ata/pata_ninja32.c b/drivers/ata/pata_ninja32.c index 565e67cd13fa..4dd9a3b031e4 100644 --- a/drivers/ata/pata_ninja32.c +++ b/drivers/ata/pata_ninja32.c | |||
@@ -1,7 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * pata_ninja32.c - Ninja32 PATA for new ATA layer | 2 | * pata_ninja32.c - Ninja32 PATA for new ATA layer |
3 | * (C) 2007 Red Hat Inc | 3 | * (C) 2007 Red Hat Inc |
4 | * Alan Cox <alan@redhat.com> | ||
5 | * | 4 | * |
6 | * Note: The controller like many controllers has shared timings for | 5 | * Note: The controller like many controllers has shared timings for |
7 | * PIO and DMA. We thus flip to the DMA timings in dma_start and flip back | 6 | * PIO and DMA. We thus flip to the DMA timings in dma_start and flip back |
@@ -45,7 +44,7 @@ | |||
45 | #include <linux/libata.h> | 44 | #include <linux/libata.h> |
46 | 45 | ||
47 | #define DRV_NAME "pata_ninja32" | 46 | #define DRV_NAME "pata_ninja32" |
48 | #define DRV_VERSION "0.0.1" | 47 | #define DRV_VERSION "0.1.3" |
49 | 48 | ||
50 | 49 | ||
51 | /** | 50 | /** |
@@ -89,6 +88,17 @@ static struct ata_port_operations ninja32_port_ops = { | |||
89 | .set_piomode = ninja32_set_piomode, | 88 | .set_piomode = ninja32_set_piomode, |
90 | }; | 89 | }; |
91 | 90 | ||
91 | static void ninja32_program(void __iomem *base) | ||
92 | { | ||
93 | iowrite8(0x05, base + 0x01); /* Enable interrupt lines */ | ||
94 | iowrite8(0xBE, base + 0x02); /* Burst, ?? setup */ | ||
95 | iowrite8(0x01, base + 0x03); /* Unknown */ | ||
96 | iowrite8(0x20, base + 0x04); /* WAIT0 */ | ||
97 | iowrite8(0x8f, base + 0x05); /* Unknown */ | ||
98 | iowrite8(0xa4, base + 0x1c); /* Unknown */ | ||
99 | iowrite8(0x83, base + 0x1d); /* BMDMA control: WAIT0 */ | ||
100 | } | ||
101 | |||
92 | static int ninja32_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 102 | static int ninja32_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
93 | { | 103 | { |
94 | struct ata_host *host; | 104 | struct ata_host *host; |
@@ -120,7 +130,8 @@ static int ninja32_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
120 | return rc; | 130 | return rc; |
121 | pci_set_master(dev); | 131 | pci_set_master(dev); |
122 | 132 | ||
123 | /* Set up the register mappings */ | 133 | /* Set up the register mappings. We use the I/O mapping as only the |
134 | older chips also have MMIO on BAR 1 */ | ||
124 | base = host->iomap[0]; | 135 | base = host->iomap[0]; |
125 | if (!base) | 136 | if (!base) |
126 | return -ENOMEM; | 137 | return -ENOMEM; |
@@ -134,21 +145,35 @@ static int ninja32_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
134 | ap->ioaddr.bmdma_addr = base; | 145 | ap->ioaddr.bmdma_addr = base; |
135 | ata_sff_std_ports(&ap->ioaddr); | 146 | ata_sff_std_ports(&ap->ioaddr); |
136 | 147 | ||
137 | iowrite8(0x05, base + 0x01); /* Enable interrupt lines */ | 148 | ninja32_program(base); |
138 | iowrite8(0xBE, base + 0x02); /* Burst, ?? setup */ | ||
139 | iowrite8(0x01, base + 0x03); /* Unknown */ | ||
140 | iowrite8(0x20, base + 0x04); /* WAIT0 */ | ||
141 | iowrite8(0x8f, base + 0x05); /* Unknown */ | ||
142 | iowrite8(0xa4, base + 0x1c); /* Unknown */ | ||
143 | iowrite8(0x83, base + 0x1d); /* BMDMA control: WAIT0 */ | ||
144 | /* FIXME: Should we disable them at remove ? */ | 149 | /* FIXME: Should we disable them at remove ? */ |
145 | return ata_host_activate(host, dev->irq, ata_sff_interrupt, | 150 | return ata_host_activate(host, dev->irq, ata_sff_interrupt, |
146 | IRQF_SHARED, &ninja32_sht); | 151 | IRQF_SHARED, &ninja32_sht); |
147 | } | 152 | } |
148 | 153 | ||
154 | #ifdef CONFIG_PM | ||
155 | |||
156 | static int ninja32_reinit_one(struct pci_dev *pdev) | ||
157 | { | ||
158 | struct ata_host *host = dev_get_drvdata(&pdev->dev); | ||
159 | int rc; | ||
160 | |||
161 | rc = ata_pci_device_do_resume(pdev); | ||
162 | if (rc) | ||
163 | return rc; | ||
164 | ninja32_program(host->iomap[0]); | ||
165 | ata_host_resume(host); | ||
166 | return 0; | ||
167 | } | ||
168 | #endif | ||
169 | |||
149 | static const struct pci_device_id ninja32[] = { | 170 | static const struct pci_device_id ninja32[] = { |
171 | { 0x10FC, 0x0003, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, | ||
172 | { 0x1145, 0x8008, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, | ||
173 | { 0x1145, 0xf008, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, | ||
150 | { 0x1145, 0xf021, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, | 174 | { 0x1145, 0xf021, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, |
151 | { 0x1145, 0xf024, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, | 175 | { 0x1145, 0xf024, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, |
176 | { 0x1145, 0xf02C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, | ||
152 | { }, | 177 | { }, |
153 | }; | 178 | }; |
154 | 179 | ||
@@ -156,7 +181,11 @@ static struct pci_driver ninja32_pci_driver = { | |||
156 | .name = DRV_NAME, | 181 | .name = DRV_NAME, |
157 | .id_table = ninja32, | 182 | .id_table = ninja32, |
158 | .probe = ninja32_init_one, | 183 | .probe = ninja32_init_one, |
159 | .remove = ata_pci_remove_one | 184 | .remove = ata_pci_remove_one, |
185 | #ifdef CONFIG_PM | ||
186 | .suspend = ata_pci_device_suspend, | ||
187 | .resume = ninja32_reinit_one, | ||
188 | #endif | ||
160 | }; | 189 | }; |
161 | 190 | ||
162 | static int __init ninja32_init(void) | 191 | static int __init ninja32_init(void) |