aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/sn
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/sn')
-rw-r--r--drivers/sn/Kconfig4
-rw-r--r--drivers/sn/ioc3.c41
2 files changed, 20 insertions, 25 deletions
diff --git a/drivers/sn/Kconfig b/drivers/sn/Kconfig
index d95265b187a3..a34731625877 100644
--- a/drivers/sn/Kconfig
+++ b/drivers/sn/Kconfig
@@ -3,10 +3,11 @@
3# 3#
4 4
5menu "SN Devices" 5menu "SN Devices"
6 depends on SGI_SN
6 7
7config SGI_IOC4 8config SGI_IOC4
8 tristate "SGI IOC4 Base IO support" 9 tristate "SGI IOC4 Base IO support"
9 depends on (IA64_GENERIC || IA64_SGI_SN2) && MMTIMER 10 depends on MMTIMER
10 default m 11 default m
11 ---help--- 12 ---help---
12 This option enables basic support for the SGI IOC4-based Base IO 13 This option enables basic support for the SGI IOC4-based Base IO
@@ -19,7 +20,6 @@ config SGI_IOC4
19 20
20config SGI_IOC3 21config SGI_IOC3
21 tristate "SGI IOC3 Base IO support" 22 tristate "SGI IOC3 Base IO support"
22 depends on (IA64_GENERIC || IA64_SGI_SN2)
23 default m 23 default m
24 ---help--- 24 ---help---
25 This option enables basic support for the SGI IOC3-based Base IO 25 This option enables basic support for the SGI IOC3-based Base IO
diff --git a/drivers/sn/ioc3.c b/drivers/sn/ioc3.c
index aaa009f4a7bf..93449a1a0065 100644
--- a/drivers/sn/ioc3.c
+++ b/drivers/sn/ioc3.c
@@ -38,10 +38,10 @@ static inline unsigned mcr_pack(unsigned pulse, unsigned sample)
38 38
39static int nic_wait(struct ioc3_driver_data *idd) 39static int nic_wait(struct ioc3_driver_data *idd)
40{ 40{
41 volatile unsigned mcr; 41 unsigned mcr;
42 42
43 do { 43 do {
44 mcr = (volatile unsigned)idd->vma->mcr; 44 mcr = readl(&idd->vma->mcr);
45 } while (!(mcr & 2)); 45 } while (!(mcr & 2));
46 46
47 return mcr & 1; 47 return mcr & 1;
@@ -53,7 +53,7 @@ static int nic_reset(struct ioc3_driver_data *idd)
53 unsigned long flags; 53 unsigned long flags;
54 54
55 local_irq_save(flags); 55 local_irq_save(flags);
56 idd->vma->mcr = mcr_pack(500, 65); 56 writel(mcr_pack(500, 65), &idd->vma->mcr);
57 presence = nic_wait(idd); 57 presence = nic_wait(idd);
58 local_irq_restore(flags); 58 local_irq_restore(flags);
59 59
@@ -62,13 +62,13 @@ static int nic_reset(struct ioc3_driver_data *idd)
62 return presence; 62 return presence;
63} 63}
64 64
65static inline int nic_read_bit(struct ioc3_driver_data *idd) 65static int nic_read_bit(struct ioc3_driver_data *idd)
66{ 66{
67 int result; 67 int result;
68 unsigned long flags; 68 unsigned long flags;
69 69
70 local_irq_save(flags); 70 local_irq_save(flags);
71 idd->vma->mcr = mcr_pack(6, 13); 71 writel(mcr_pack(6, 13), &idd->vma->mcr);
72 result = nic_wait(idd); 72 result = nic_wait(idd);
73 local_irq_restore(flags); 73 local_irq_restore(flags);
74 74
@@ -77,12 +77,12 @@ static inline int nic_read_bit(struct ioc3_driver_data *idd)
77 return result; 77 return result;
78} 78}
79 79
80static inline void nic_write_bit(struct ioc3_driver_data *idd, int bit) 80static void nic_write_bit(struct ioc3_driver_data *idd, int bit)
81{ 81{
82 if (bit) 82 if (bit)
83 idd->vma->mcr = mcr_pack(6, 110); 83 writel(mcr_pack(6, 110), &idd->vma->mcr);
84 else 84 else
85 idd->vma->mcr = mcr_pack(80, 30); 85 writel(mcr_pack(80, 30), &idd->vma->mcr);
86 86
87 nic_wait(idd); 87 nic_wait(idd);
88} 88}
@@ -337,7 +337,7 @@ static void probe_nic(struct ioc3_driver_data *idd)
337 int save = 0, loops = 3; 337 int save = 0, loops = 3;
338 unsigned long first, addr; 338 unsigned long first, addr;
339 339
340 idd->vma->gpcr_s = GPCR_MLAN_EN; 340 writel(GPCR_MLAN_EN, &idd->vma->gpcr_s);
341 341
342 while(loops>0) { 342 while(loops>0) {
343 idd->nic_part[0] = 0; 343 idd->nic_part[0] = 0;
@@ -371,8 +371,7 @@ static void probe_nic(struct ioc3_driver_data *idd)
371 371
372/* Interrupts */ 372/* Interrupts */
373 373
374static inline void 374static void write_ireg(struct ioc3_driver_data *idd, uint32_t val, int which)
375write_ireg(struct ioc3_driver_data *idd, uint32_t val, int which)
376{ 375{
377 unsigned long flags; 376 unsigned long flags;
378 377
@@ -408,7 +407,7 @@ static irqreturn_t ioc3_intr_io(int irq, void *arg, struct pt_regs *regs)
408 407
409 read_lock_irqsave(&ioc3_submodules_lock, flags); 408 read_lock_irqsave(&ioc3_submodules_lock, flags);
410 409
411 if(idd->dual_irq && idd->vma->eisr) { 410 if(idd->dual_irq && readb(&idd->vma->eisr)) {
412 /* send Ethernet IRQ to the driver */ 411 /* send Ethernet IRQ to the driver */
413 if(ioc3_ethernet && idd->active[ioc3_ethernet->id] && 412 if(ioc3_ethernet && idd->active[ioc3_ethernet->id] &&
414 ioc3_ethernet->intr) { 413 ioc3_ethernet->intr) {
@@ -682,7 +681,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)
682 idd->id = ioc3_counter++; 681 idd->id = ioc3_counter++;
683 up_write(&ioc3_devices_rwsem); 682 up_write(&ioc3_devices_rwsem);
684 683
685 idd->gpdr_shadow = idd->vma->gpdr; 684 idd->gpdr_shadow = readl(&idd->vma->gpdr);
686 685
687 /* Read IOC3 NIC contents */ 686 /* Read IOC3 NIC contents */
688 probe_nic(idd); 687 probe_nic(idd);
@@ -735,14 +734,12 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)
735 } 734 }
736 735
737 /* Add this IOC3 to all submodules */ 736 /* Add this IOC3 to all submodules */
738 read_lock(&ioc3_submodules_lock);
739 for(id=0;id<IOC3_MAX_SUBMODULES;id++) 737 for(id=0;id<IOC3_MAX_SUBMODULES;id++)
740 if(ioc3_submodules[id] && ioc3_submodules[id]->probe) { 738 if(ioc3_submodules[id] && ioc3_submodules[id]->probe) {
741 idd->active[id] = 1; 739 idd->active[id] = 1;
742 idd->active[id] = !ioc3_submodules[id]->probe 740 idd->active[id] = !ioc3_submodules[id]->probe
743 (ioc3_submodules[id], idd); 741 (ioc3_submodules[id], idd);
744 } 742 }
745 read_unlock(&ioc3_submodules_lock);
746 743
747 printk(KERN_INFO "IOC3 Master Driver loaded for %s\n", pci_name(pdev)); 744 printk(KERN_INFO "IOC3 Master Driver loaded for %s\n", pci_name(pdev));
748 745
@@ -767,7 +764,6 @@ static void ioc3_remove(struct pci_dev *pdev)
767 idd = pci_get_drvdata(pdev); 764 idd = pci_get_drvdata(pdev);
768 765
769 /* Remove this IOC3 from all submodules */ 766 /* Remove this IOC3 from all submodules */
770 read_lock(&ioc3_submodules_lock);
771 for(id=0;id<IOC3_MAX_SUBMODULES;id++) 767 for(id=0;id<IOC3_MAX_SUBMODULES;id++)
772 if(idd->active[id]) { 768 if(idd->active[id]) {
773 if(ioc3_submodules[id] && ioc3_submodules[id]->remove) 769 if(ioc3_submodules[id] && ioc3_submodules[id]->remove)
@@ -781,7 +777,6 @@ static void ioc3_remove(struct pci_dev *pdev)
781 pci_name(pdev)); 777 pci_name(pdev));
782 idd->active[id] = 0; 778 idd->active[id] = 0;
783 } 779 }
784 read_unlock(&ioc3_submodules_lock);
785 780
786 /* Clear and disable all IRQs */ 781 /* Clear and disable all IRQs */
787 write_ireg(idd, ~0, IOC3_W_IEC); 782 write_ireg(idd, ~0, IOC3_W_IEC);
@@ -843,9 +838,9 @@ MODULE_AUTHOR("Stanislaw Skowronek <skylark@linux-mips.org>");
843MODULE_DESCRIPTION("PCI driver for SGI IOC3"); 838MODULE_DESCRIPTION("PCI driver for SGI IOC3");
844MODULE_LICENSE("GPL"); 839MODULE_LICENSE("GPL");
845 840
846EXPORT_SYMBOL(ioc3_register_submodule); 841EXPORT_SYMBOL_GPL(ioc3_register_submodule);
847EXPORT_SYMBOL(ioc3_unregister_submodule); 842EXPORT_SYMBOL_GPL(ioc3_unregister_submodule);
848EXPORT_SYMBOL(ioc3_ack); 843EXPORT_SYMBOL_GPL(ioc3_ack);
849EXPORT_SYMBOL(ioc3_gpcr_set); 844EXPORT_SYMBOL_GPL(ioc3_gpcr_set);
850EXPORT_SYMBOL(ioc3_disable); 845EXPORT_SYMBOL_GPL(ioc3_disable);
851EXPORT_SYMBOL(ioc3_enable); 846EXPORT_SYMBOL_GPL(ioc3_enable);