aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-26 15:48:06 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-26 15:48:06 -0500
commitb0138a6cb7923a997d278b47c176778534d1095b (patch)
tree4fcb8822a69631baba568e4e1942847747123887 /drivers
parent6572d6d7d0f965dda19d02af804ed3ae4b3bf1fc (diff)
parent1055a8af093fea7490445bd15cd671020e542035 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/kyle/parisc-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/kyle/parisc-2.6: (78 commits) [PARISC] Use symbolic last syscall in __NR_Linux_syscalls [PARISC] Add missing statfs64 and fstatfs64 syscalls Revert "[PARISC] Optimize TLB flush on SMP systems" [PARISC] Compat signal fixes for 64-bit parisc [PARISC] Reorder syscalls to match unistd.h Revert "[PATCH] make kernel/signal.c:kill_proc_info() static" [PARISC] fix sys_rt_sigqueueinfo [PARISC] fix section mismatch warnings in harmony sound driver [PARISC] do not export get_register/set_register [PARISC] add ENTRY()/ENDPROC() and simplify assembly of HP/UX emulation code [PARISC] convert to use CONFIG_64BIT instead of __LP64__ [PARISC] use CONFIG_64BIT instead of __LP64__ [PARISC] add ASM_EXCEPTIONTABLE_ENTRY() macro [PARISC] more ENTRY(), ENDPROC(), END() conversions [PARISC] fix ENTRY() and ENDPROC() for 64bit-parisc [PARISC] Fixes /proc/cpuinfo cache output on B160L [PARISC] implement standard ENTRY(), END() and ENDPROC() [PARISC] kill ENTRY_SYS_CPUS [PARISC] clean up debugging printks in smp.c [PARISC] factor syscall_restart code out of do_signal ... Fix conflict in include/linux/sched.h due to kill_proc_info() being made publicly available to PARISC again.
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/agp/parisc-agp.c2
-rw-r--r--drivers/net/Kconfig6
-rw-r--r--drivers/net/lasi_82596.c34
-rw-r--r--drivers/parisc/hppb.c14
-rw-r--r--drivers/parisc/iosapic_private.h2
-rw-r--r--drivers/parisc/lba_pci.c90
-rw-r--r--drivers/parisc/led.c14
-rw-r--r--drivers/parisc/power.c201
-rw-r--r--drivers/parisc/sba_iommu.c4
-rw-r--r--drivers/serial/mux.c167
10 files changed, 297 insertions, 237 deletions
diff --git a/drivers/char/agp/parisc-agp.c b/drivers/char/agp/parisc-agp.c
index 36d07e3635c6..3c8f3d633625 100644
--- a/drivers/char/agp/parisc-agp.c
+++ b/drivers/char/agp/parisc-agp.c
@@ -236,7 +236,7 @@ static int __init
236agp_ioc_init(void __iomem *ioc_regs) 236agp_ioc_init(void __iomem *ioc_regs)
237{ 237{
238 struct _parisc_agp_info *info = &parisc_agp_info; 238 struct _parisc_agp_info *info = &parisc_agp_info;
239 u64 *iova_base, *io_pdir, io_tlb_ps; 239 u64 iova_base, *io_pdir, io_tlb_ps;
240 int io_tlb_shift; 240 int io_tlb_shift;
241 241
242 printk(KERN_INFO DRVPFX "IO PDIR shared with sba_iommu\n"); 242 printk(KERN_INFO DRVPFX "IO PDIR shared with sba_iommu\n");
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 9d5c083f3339..38ac6796fc48 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -430,10 +430,10 @@ config HPLANCE
430 430
431config LASI_82596 431config LASI_82596
432 tristate "Lasi ethernet" 432 tristate "Lasi ethernet"
433 depends on NET_ETHERNET && PARISC && GSC_LASI 433 depends on NET_ETHERNET && GSC
434 help 434 help
435 Say Y here to support the on-board Intel 82596 ethernet controller 435 Say Y here to support the builtin Intel 82596 ethernet controller
436 built into Hewlett-Packard PA-RISC machines. 436 found in Hewlett-Packard PA-RISC machines with 10Mbit ethernet.
437 437
438config MIPS_JAZZ_SONIC 438config MIPS_JAZZ_SONIC
439 tristate "MIPS JAZZ onboard SONIC Ethernet support" 439 tristate "MIPS JAZZ onboard SONIC Ethernet support"
diff --git a/drivers/net/lasi_82596.c b/drivers/net/lasi_82596.c
index ea392f2a5aa2..452863d5d498 100644
--- a/drivers/net/lasi_82596.c
+++ b/drivers/net/lasi_82596.c
@@ -384,7 +384,7 @@ struct i596_private {
384 struct device *dev; 384 struct device *dev;
385}; 385};
386 386
387static char init_setup[] = 387static const char init_setup[] =
388{ 388{
389 0x8E, /* length, prefetch on */ 389 0x8E, /* length, prefetch on */
390 0xC8, /* fifo to 8, monitor off */ 390 0xC8, /* fifo to 8, monitor off */
@@ -683,7 +683,7 @@ static int init_i596_mem(struct net_device *dev)
683 enable_irq(dev->irq); /* enable IRQs from LAN */ 683 enable_irq(dev->irq); /* enable IRQs from LAN */
684 684
685 DEB(DEB_INIT, printk("%s: queuing CmdConfigure\n", dev->name)); 685 DEB(DEB_INIT, printk("%s: queuing CmdConfigure\n", dev->name));
686 memcpy(lp->cf_cmd.i596_config, init_setup, 14); 686 memcpy(lp->cf_cmd.i596_config, init_setup, sizeof(init_setup));
687 lp->cf_cmd.cmd.command = CmdConfigure; 687 lp->cf_cmd.cmd.command = CmdConfigure;
688 CHECK_WBACK(lp, &(lp->cf_cmd), sizeof(struct cf_cmd)); 688 CHECK_WBACK(lp, &(lp->cf_cmd), sizeof(struct cf_cmd));
689 i596_add_cmd(dev, &lp->cf_cmd.cmd); 689 i596_add_cmd(dev, &lp->cf_cmd.cmd);
@@ -1156,32 +1156,12 @@ static int __devinit i82596_probe(struct net_device *dev,
1156 dma_addr_t dma_addr; 1156 dma_addr_t dma_addr;
1157 1157
1158 /* This lot is ensure things have been cache line aligned. */ 1158 /* This lot is ensure things have been cache line aligned. */
1159 if (sizeof(struct i596_rfd) != 32) { 1159 BUILD_BUG_ON(sizeof(struct i596_rfd) != 32);
1160 printk("82596: sizeof(struct i596_rfd) = %d\n", 1160 BUILD_BUG_ON(sizeof(struct i596_rbd) & 31);
1161 (int)sizeof(struct i596_rfd)); 1161 BUILD_BUG_ON(sizeof(struct tx_cmd) & 31);
1162 return -ENODEV; 1162 BUILD_BUG_ON(sizeof(struct i596_tbd) != 32);
1163 }
1164 if ((sizeof(struct i596_rbd) % 32) != 0) {
1165 printk("82596: sizeof(struct i596_rbd) = %d\n",
1166 (int)sizeof(struct i596_rbd));
1167 return -ENODEV;
1168 }
1169 if ((sizeof(struct tx_cmd) % 32) != 0) {
1170 printk("82596: sizeof(struct tx_cmd) = %d\n",
1171 (int)sizeof(struct tx_cmd));
1172 return -ENODEV;
1173 }
1174 if (sizeof(struct i596_tbd) != 32) {
1175 printk("82596: sizeof(struct i596_tbd) = %d\n",
1176 (int)sizeof(struct i596_tbd));
1177 return -ENODEV;
1178 }
1179#ifndef __LP64__ 1163#ifndef __LP64__
1180 if (sizeof(struct i596_private) > 4096) { 1164 BUILD_BUG_ON(sizeof(struct i596_private) > 4096);
1181 printk("82596: sizeof(struct i596_private) = %d\n",
1182 (int)sizeof(struct i596_private));
1183 return -ENODEV;
1184 }
1185#endif 1165#endif
1186 1166
1187 if (!dev->base_addr || !dev->irq) 1167 if (!dev->base_addr || !dev->irq)
diff --git a/drivers/parisc/hppb.c b/drivers/parisc/hppb.c
index 07dc2b6d4e93..9bb4db552f3c 100644
--- a/drivers/parisc/hppb.c
+++ b/drivers/parisc/hppb.c
@@ -10,10 +10,6 @@
10** the Free Software Foundation; either version 2 of the License, or 10** the Free Software Foundation; either version 2 of the License, or
11** (at your option) any later version. 11** (at your option) any later version.
12** 12**
13** This Driver currently only supports the console (port 0) on the MUX.
14** Additional work will be needed on this driver to enable the full
15** functionality of the MUX.
16**
17*/ 13*/
18 14
19#include <linux/types.h> 15#include <linux/types.h>
@@ -67,7 +63,7 @@ static int hppb_probe(struct parisc_device *dev)
67 } 63 }
68 card = card->next; 64 card = card->next;
69 } 65 }
70 printk(KERN_INFO "Found GeckoBoa at 0x%lx\n", dev->hpa.start); 66 printk(KERN_INFO "Found GeckoBoa at 0x%x\n", dev->hpa.start);
71 67
72 card->hpa = dev->hpa.start; 68 card->hpa = dev->hpa.start;
73 card->mmio_region.name = "HP-PB Bus"; 69 card->mmio_region.name = "HP-PB Bus";
@@ -78,16 +74,18 @@ static int hppb_probe(struct parisc_device *dev)
78 74
79 status = ccio_request_resource(dev, &card->mmio_region); 75 status = ccio_request_resource(dev, &card->mmio_region);
80 if(status < 0) { 76 if(status < 0) {
81 printk(KERN_ERR "%s: failed to claim HP-PB bus space (%08lx, %08lx)\n", 77 printk(KERN_ERR "%s: failed to claim HP-PB bus space (%08x, %08x)\n",
82 __FILE__, card->mmio_region.start, card->mmio_region.end); 78 __FILE__, card->mmio_region.start, card->mmio_region.end);
83 } 79 }
84 80
85 return 0; 81 return 0;
86} 82}
87 83
88
89static struct parisc_device_id hppb_tbl[] = { 84static struct parisc_device_id hppb_tbl[] = {
90 { HPHW_BCPORT, HVERSION_REV_ANY_ID, 0x500, 0xc }, 85 { HPHW_BCPORT, HVERSION_REV_ANY_ID, 0x500, 0xc }, /* E25 and K */
86 { HPHW_BCPORT, 0x0, 0x501, 0xc }, /* E35 */
87 { HPHW_BCPORT, 0x0, 0x502, 0xc }, /* E45 */
88 { HPHW_BCPORT, 0x0, 0x503, 0xc }, /* E55 */
91 { 0, } 89 { 0, }
92}; 90};
93 91
diff --git a/drivers/parisc/iosapic_private.h b/drivers/parisc/iosapic_private.h
index 41e7ec2a44aa..6e05e30a2450 100644
--- a/drivers/parisc/iosapic_private.h
+++ b/drivers/parisc/iosapic_private.h
@@ -132,7 +132,7 @@ struct iosapic_irt {
132struct vector_info { 132struct vector_info {
133 struct iosapic_info *iosapic; /* I/O SAPIC this vector is on */ 133 struct iosapic_info *iosapic; /* I/O SAPIC this vector is on */
134 struct irt_entry *irte; /* IRT entry */ 134 struct irt_entry *irte; /* IRT entry */
135 u32 *eoi_addr; /* precalculate EOI reg address */ 135 u32 __iomem *eoi_addr; /* precalculate EOI reg address */
136 u32 eoi_data; /* IA64: ? PA: swapped txn_data */ 136 u32 eoi_data; /* IA64: ? PA: swapped txn_data */
137 int txn_irq; /* virtual IRQ number for processor */ 137 int txn_irq; /* virtual IRQ number for processor */
138 ulong txn_addr; /* IA64: id_eid PA: partial HPA */ 138 ulong txn_addr; /* IA64: id_eid PA: partial HPA */
diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c
index ba6769934c77..21c4c299b3d6 100644
--- a/drivers/parisc/lba_pci.c
+++ b/drivers/parisc/lba_pci.c
@@ -168,7 +168,8 @@ lba_dump_res(struct resource *r, int d)
168 168
169 printk(KERN_DEBUG "(%p)", r->parent); 169 printk(KERN_DEBUG "(%p)", r->parent);
170 for (i = d; i ; --i) printk(" "); 170 for (i = d; i ; --i) printk(" ");
171 printk(KERN_DEBUG "%p [%lx,%lx]/%lx\n", r, r->start, r->end, r->flags); 171 printk(KERN_DEBUG "%p [%lx,%lx]/%lx\n", r,
172 (long)r->start, (long)r->end, r->flags);
172 lba_dump_res(r->child, d+2); 173 lba_dump_res(r->child, d+2);
173 lba_dump_res(r->sibling, d); 174 lba_dump_res(r->sibling, d);
174} 175}
@@ -647,7 +648,7 @@ truncate_pat_collision(struct resource *root, struct resource *new)
647 printk(KERN_WARNING "LBA: Truncating lmmio_space [%lx/%lx] " 648 printk(KERN_WARNING "LBA: Truncating lmmio_space [%lx/%lx] "
648 "to [%lx,%lx]\n", 649 "to [%lx,%lx]\n",
649 start, end, 650 start, end,
650 new->start, new->end ); 651 (long)new->start, (long)new->end );
651 652
652 return 0; /* truncation successful */ 653 return 0; /* truncation successful */
653} 654}
@@ -715,8 +716,8 @@ lba_fixup_bus(struct pci_bus *bus)
715 716
716 printk("FAILED: lba_fixup_bus() request for " 717 printk("FAILED: lba_fixup_bus() request for "
717 "elmmio_space [%lx/%lx]\n", 718 "elmmio_space [%lx/%lx]\n",
718 ldev->hba.elmmio_space.start, 719 (long)ldev->hba.elmmio_space.start,
719 ldev->hba.elmmio_space.end); 720 (long)ldev->hba.elmmio_space.end);
720 721
721 /* lba_dump_res(&iomem_resource, 2); */ 722 /* lba_dump_res(&iomem_resource, 2); */
722 /* BUG(); */ 723 /* BUG(); */
@@ -738,15 +739,15 @@ lba_fixup_bus(struct pci_bus *bus)
738 &(ldev->hba.lmmio_space))) { 739 &(ldev->hba.lmmio_space))) {
739 740
740 printk(KERN_WARNING "LBA: lmmio_space [%lx/%lx] duplicate!\n", 741 printk(KERN_WARNING "LBA: lmmio_space [%lx/%lx] duplicate!\n",
741 ldev->hba.lmmio_space.start, 742 (long)ldev->hba.lmmio_space.start,
742 ldev->hba.lmmio_space.end); 743 (long)ldev->hba.lmmio_space.end);
743 } else { 744 } else {
744 err = request_resource(&iomem_resource, &(ldev->hba.lmmio_space)); 745 err = request_resource(&iomem_resource, &(ldev->hba.lmmio_space));
745 if (err < 0) { 746 if (err < 0) {
746 printk(KERN_ERR "FAILED: lba_fixup_bus() request for " 747 printk(KERN_ERR "FAILED: lba_fixup_bus() request for "
747 "lmmio_space [%lx/%lx]\n", 748 "lmmio_space [%lx/%lx]\n",
748 ldev->hba.lmmio_space.start, 749 (long)ldev->hba.lmmio_space.start,
749 ldev->hba.lmmio_space.end); 750 (long)ldev->hba.lmmio_space.end);
750 } else 751 } else
751 bus->resource[i++] = &(ldev->hba.lmmio_space); 752 bus->resource[i++] = &(ldev->hba.lmmio_space);
752 } 753 }
@@ -758,8 +759,8 @@ lba_fixup_bus(struct pci_bus *bus)
758 if (err < 0) { 759 if (err < 0) {
759 printk("FAILED: lba_fixup_bus() request for " 760 printk("FAILED: lba_fixup_bus() request for "
760 "gmmio_space [%lx/%lx]\n", 761 "gmmio_space [%lx/%lx]\n",
761 ldev->hba.gmmio_space.start, 762 (long)ldev->hba.gmmio_space.start,
762 ldev->hba.gmmio_space.end); 763 (long)ldev->hba.gmmio_space.end);
763 lba_dump_res(&iomem_resource, 2); 764 lba_dump_res(&iomem_resource, 2);
764 BUG(); 765 BUG();
765 } 766 }
@@ -980,7 +981,7 @@ LBA_PORT_IN(32, 0)
980#define LBA_PORT_OUT(size, mask) \ 981#define LBA_PORT_OUT(size, mask) \
981static void lba_pat_out##size (struct pci_hba_data *l, u16 addr, u##size val) \ 982static void lba_pat_out##size (struct pci_hba_data *l, u16 addr, u##size val) \
982{ \ 983{ \
983 void *where = (void *) PIOP_TO_GMMIO(LBA_DEV(l), addr); \ 984 void __iomem *where = PIOP_TO_GMMIO(LBA_DEV(l), addr); \
984 DBG_PORT("%s(0x%p, 0x%x, 0x%x)\n", __FUNCTION__, l, addr, val); \ 985 DBG_PORT("%s(0x%p, 0x%x, 0x%x)\n", __FUNCTION__, l, addr, val); \
985 WRITE_REG##size(val, where); \ 986 WRITE_REG##size(val, where); \
986 /* flush the I/O down to the elroy at least */ \ 987 /* flush the I/O down to the elroy at least */ \
@@ -1063,16 +1064,16 @@ lba_pat_resources(struct parisc_device *pa_dev, struct lba_device *lba_dev)
1063 /* used to fix up pre-initialized MEM BARs */ 1064 /* used to fix up pre-initialized MEM BARs */
1064 if (!lba_dev->hba.lmmio_space.start) { 1065 if (!lba_dev->hba.lmmio_space.start) {
1065 sprintf(lba_dev->hba.lmmio_name, 1066 sprintf(lba_dev->hba.lmmio_name,
1066 "PCI%02lx LMMIO", 1067 "PCI%02x LMMIO",
1067 lba_dev->hba.bus_num.start); 1068 (int)lba_dev->hba.bus_num.start);
1068 lba_dev->hba.lmmio_space_offset = p->start - 1069 lba_dev->hba.lmmio_space_offset = p->start -
1069 io->start; 1070 io->start;
1070 r = &lba_dev->hba.lmmio_space; 1071 r = &lba_dev->hba.lmmio_space;
1071 r->name = lba_dev->hba.lmmio_name; 1072 r->name = lba_dev->hba.lmmio_name;
1072 } else if (!lba_dev->hba.elmmio_space.start) { 1073 } else if (!lba_dev->hba.elmmio_space.start) {
1073 sprintf(lba_dev->hba.elmmio_name, 1074 sprintf(lba_dev->hba.elmmio_name,
1074 "PCI%02lx ELMMIO", 1075 "PCI%02x ELMMIO",
1075 lba_dev->hba.bus_num.start); 1076 (int)lba_dev->hba.bus_num.start);
1076 r = &lba_dev->hba.elmmio_space; 1077 r = &lba_dev->hba.elmmio_space;
1077 r->name = lba_dev->hba.elmmio_name; 1078 r->name = lba_dev->hba.elmmio_name;
1078 } else { 1079 } else {
@@ -1089,8 +1090,8 @@ lba_pat_resources(struct parisc_device *pa_dev, struct lba_device *lba_dev)
1089 1090
1090 case PAT_GMMIO: 1091 case PAT_GMMIO:
1091 /* MMIO space > 4GB phys addr; for 64-bit BAR */ 1092 /* MMIO space > 4GB phys addr; for 64-bit BAR */
1092 sprintf(lba_dev->hba.gmmio_name, "PCI%02lx GMMIO", 1093 sprintf(lba_dev->hba.gmmio_name, "PCI%02x GMMIO",
1093 lba_dev->hba.bus_num.start); 1094 (int)lba_dev->hba.bus_num.start);
1094 r = &lba_dev->hba.gmmio_space; 1095 r = &lba_dev->hba.gmmio_space;
1095 r->name = lba_dev->hba.gmmio_name; 1096 r->name = lba_dev->hba.gmmio_name;
1096 r->start = p->start; 1097 r->start = p->start;
@@ -1112,8 +1113,8 @@ lba_pat_resources(struct parisc_device *pa_dev, struct lba_device *lba_dev)
1112 */ 1113 */
1113 lba_dev->iop_base = ioremap_nocache(p->start, 64 * 1024 * 1024); 1114 lba_dev->iop_base = ioremap_nocache(p->start, 64 * 1024 * 1024);
1114 1115
1115 sprintf(lba_dev->hba.io_name, "PCI%02lx Ports", 1116 sprintf(lba_dev->hba.io_name, "PCI%02x Ports",
1116 lba_dev->hba.bus_num.start); 1117 (int)lba_dev->hba.bus_num.start);
1117 r = &lba_dev->hba.io_space; 1118 r = &lba_dev->hba.io_space;
1118 r->name = lba_dev->hba.io_name; 1119 r->name = lba_dev->hba.io_name;
1119 r->start = HBA_PORT_BASE(lba_dev->hba.hba_num); 1120 r->start = HBA_PORT_BASE(lba_dev->hba.hba_num);
@@ -1166,8 +1167,8 @@ lba_legacy_resources(struct parisc_device *pa_dev, struct lba_device *lba_dev)
1166 ** Legacy boxes but it's nice to see in /proc/iomem. 1167 ** Legacy boxes but it's nice to see in /proc/iomem.
1167 */ 1168 */
1168 r = &(lba_dev->hba.lmmio_space); 1169 r = &(lba_dev->hba.lmmio_space);
1169 sprintf(lba_dev->hba.lmmio_name, "PCI%02lx LMMIO", 1170 sprintf(lba_dev->hba.lmmio_name, "PCI%02x LMMIO",
1170 lba_dev->hba.bus_num.start); 1171 (int)lba_dev->hba.bus_num.start);
1171 r->name = lba_dev->hba.lmmio_name; 1172 r->name = lba_dev->hba.lmmio_name;
1172 1173
1173#if 1 1174#if 1
@@ -1275,8 +1276,8 @@ lba_legacy_resources(struct parisc_device *pa_dev, struct lba_device *lba_dev)
1275 ** an existing (but unused portion of) distributed range. 1276 ** an existing (but unused portion of) distributed range.
1276 */ 1277 */
1277 r = &(lba_dev->hba.elmmio_space); 1278 r = &(lba_dev->hba.elmmio_space);
1278 sprintf(lba_dev->hba.elmmio_name, "PCI%02lx ELMMIO", 1279 sprintf(lba_dev->hba.elmmio_name, "PCI%02x ELMMIO",
1279 lba_dev->hba.bus_num.start); 1280 (int)lba_dev->hba.bus_num.start);
1280 r->name = lba_dev->hba.elmmio_name; 1281 r->name = lba_dev->hba.elmmio_name;
1281 1282
1282#if 1 1283#if 1
@@ -1297,8 +1298,8 @@ lba_legacy_resources(struct parisc_device *pa_dev, struct lba_device *lba_dev)
1297#endif 1298#endif
1298 1299
1299 r = &(lba_dev->hba.io_space); 1300 r = &(lba_dev->hba.io_space);
1300 sprintf(lba_dev->hba.io_name, "PCI%02lx Ports", 1301 sprintf(lba_dev->hba.io_name, "PCI%02x Ports",
1301 lba_dev->hba.bus_num.start); 1302 (int)lba_dev->hba.bus_num.start);
1302 r->name = lba_dev->hba.io_name; 1303 r->name = lba_dev->hba.io_name;
1303 r->flags = IORESOURCE_IO; 1304 r->flags = IORESOURCE_IO;
1304 r->start = READ_REG32(lba_dev->hba.base_addr + LBA_IOS_BASE) & ~1L; 1305 r->start = READ_REG32(lba_dev->hba.base_addr + LBA_IOS_BASE) & ~1L;
@@ -1406,13 +1407,20 @@ lba_hw_init(struct lba_device *d)
1406 return 0; 1407 return 0;
1407} 1408}
1408 1409
1409 1410/*
1411 * Unfortunately, when firmware numbers busses, it doesn't take into account
1412 * Cardbus bridges. So we have to renumber the busses to suit ourselves.
1413 * Elroy/Mercury don't actually know what bus number they're attached to;
1414 * we use bus 0 to indicate the directly attached bus and any other bus
1415 * number will be taken care of by the PCI-PCI bridge.
1416 */
1417static unsigned int lba_next_bus = 0;
1410 1418
1411/* 1419/*
1412** Determine if lba should claim this chip (return 0) or not (return 1). 1420 * Determine if lba should claim this chip (return 0) or not (return 1).
1413** If so, initialize the chip and tell other partners in crime they 1421 * If so, initialize the chip and tell other partners in crime they
1414** have work to do. 1422 * have work to do.
1415*/ 1423 */
1416static int __init 1424static int __init
1417lba_driver_probe(struct parisc_device *dev) 1425lba_driver_probe(struct parisc_device *dev)
1418{ 1426{
@@ -1440,7 +1448,7 @@ lba_driver_probe(struct parisc_device *dev)
1440 } 1448 }
1441 1449
1442 printk(KERN_INFO "Elroy version %s (0x%x) found at 0x%lx\n", 1450 printk(KERN_INFO "Elroy version %s (0x%x) found at 0x%lx\n",
1443 version, func_class & 0xf, dev->hpa.start); 1451 version, func_class & 0xf, (long)dev->hpa.start);
1444 1452
1445 if (func_class < 2) { 1453 if (func_class < 2) {
1446 printk(KERN_WARNING "Can't support LBA older than " 1454 printk(KERN_WARNING "Can't support LBA older than "
@@ -1470,17 +1478,16 @@ lba_driver_probe(struct parisc_device *dev)
1470 */ 1478 */
1471 printk(KERN_INFO "%s version TR%d.%d (0x%x) found at 0x%lx\n", 1479 printk(KERN_INFO "%s version TR%d.%d (0x%x) found at 0x%lx\n",
1472 IS_MERCURY(dev) ? "Mercury" : "Quicksilver", major, 1480 IS_MERCURY(dev) ? "Mercury" : "Quicksilver", major,
1473 minor, func_class, dev->hpa.start); 1481 minor, func_class, (long)dev->hpa.start);
1474 1482
1475 cfg_ops = &mercury_cfg_ops; 1483 cfg_ops = &mercury_cfg_ops;
1476 } else { 1484 } else {
1477 printk(KERN_ERR "Unknown LBA found at 0x%lx\n", dev->hpa.start); 1485 printk(KERN_ERR "Unknown LBA found at 0x%lx\n",
1486 (long)dev->hpa.start);
1478 return -ENODEV; 1487 return -ENODEV;
1479 } 1488 }
1480 1489
1481 /* 1490 /* Tell I/O SAPIC driver we have a IRQ handler/region. */
1482 ** Tell I/O SAPIC driver we have a IRQ handler/region.
1483 */
1484 tmp_obj = iosapic_register(dev->hpa.start + LBA_IOSAPIC_BASE); 1491 tmp_obj = iosapic_register(dev->hpa.start + LBA_IOSAPIC_BASE);
1485 1492
1486 /* NOTE: PCI devices (e.g. 103c:1005 graphics card) which don't 1493 /* NOTE: PCI devices (e.g. 103c:1005 graphics card) which don't
@@ -1529,16 +1536,17 @@ lba_driver_probe(struct parisc_device *dev)
1529 lba_legacy_resources(dev, lba_dev); 1536 lba_legacy_resources(dev, lba_dev);
1530 } 1537 }
1531 1538
1532 /* 1539 if (lba_dev->hba.bus_num.start < lba_next_bus)
1533 ** Tell PCI support another PCI bus was found. 1540 lba_dev->hba.bus_num.start = lba_next_bus;
1534 ** Walks PCI bus for us too. 1541
1535 */
1536 dev->dev.platform_data = lba_dev; 1542 dev->dev.platform_data = lba_dev;
1537 lba_bus = lba_dev->hba.hba_bus = 1543 lba_bus = lba_dev->hba.hba_bus =
1538 pci_scan_bus_parented(&dev->dev, lba_dev->hba.bus_num.start, 1544 pci_scan_bus_parented(&dev->dev, lba_dev->hba.bus_num.start,
1539 cfg_ops, NULL); 1545 cfg_ops, NULL);
1540 if (lba_bus) 1546 if (lba_bus) {
1547 lba_next_bus = lba_bus->subordinate + 1;
1541 pci_bus_add_devices(lba_bus); 1548 pci_bus_add_devices(lba_bus);
1549 }
1542 1550
1543 /* This is in lieu of calling pci_assign_unassigned_resources() */ 1551 /* This is in lieu of calling pci_assign_unassigned_resources() */
1544 if (is_pdc_pat()) { 1552 if (is_pdc_pat()) {
diff --git a/drivers/parisc/led.c b/drivers/parisc/led.c
index 9a731c101d10..d190c05d87ed 100644
--- a/drivers/parisc/led.c
+++ b/drivers/parisc/led.c
@@ -66,8 +66,8 @@ static char lcd_text_default[32] __read_mostly;
66 66
67 67
68static struct workqueue_struct *led_wq; 68static struct workqueue_struct *led_wq;
69static void led_work_func(void *); 69static void led_work_func(struct work_struct *);
70static DECLARE_WORK(led_task, led_work_func, NULL); 70static DECLARE_DELAYED_WORK(led_task, led_work_func);
71 71
72#if 0 72#if 0
73#define DPRINTK(x) printk x 73#define DPRINTK(x) printk x
@@ -136,7 +136,7 @@ static int start_task(void)
136 136
137 /* Create the work queue and queue the LED task */ 137 /* Create the work queue and queue the LED task */
138 led_wq = create_singlethread_workqueue("led_wq"); 138 led_wq = create_singlethread_workqueue("led_wq");
139 queue_work(led_wq, &led_task); 139 queue_delayed_work(led_wq, &led_task, 0);
140 140
141 return 0; 141 return 0;
142} 142}
@@ -441,7 +441,7 @@ static __inline__ int led_get_diskio_activity(void)
441 441
442#define LED_UPDATE_INTERVAL (1 + (HZ*19/1000)) 442#define LED_UPDATE_INTERVAL (1 + (HZ*19/1000))
443 443
444static void led_work_func (void *unused) 444static void led_work_func (struct work_struct *unused)
445{ 445{
446 static unsigned long last_jiffies; 446 static unsigned long last_jiffies;
447 static unsigned long count_HZ; /* counter in range 0..HZ */ 447 static unsigned long count_HZ; /* counter in range 0..HZ */
@@ -588,7 +588,7 @@ int __init register_led_driver(int model, unsigned long cmd_reg, unsigned long d
588 588
589 /* Ensure the work is queued */ 589 /* Ensure the work is queued */
590 if (led_wq) { 590 if (led_wq) {
591 queue_work(led_wq, &led_task); 591 queue_delayed_work(led_wq, &led_task, 0);
592 } 592 }
593 593
594 return 0; 594 return 0;
@@ -629,7 +629,7 @@ void __init register_led_regions(void)
629 ** avoid a race condition while writing the CMD/DATA register pair. 629 ** avoid a race condition while writing the CMD/DATA register pair.
630 ** 630 **
631 */ 631 */
632int lcd_print( char *str ) 632int lcd_print( const char *str )
633{ 633{
634 int i; 634 int i;
635 635
@@ -658,7 +658,7 @@ int lcd_print( char *str )
658 658
659 /* re-queue the work */ 659 /* re-queue the work */
660 if (led_wq) { 660 if (led_wq) {
661 queue_work(led_wq, &led_task); 661 queue_delayed_work(led_wq, &led_task, 0);
662 } 662 }
663 663
664 return lcd_info.lcd_width; 664 return lcd_info.lcd_width;
diff --git a/drivers/parisc/power.c b/drivers/parisc/power.c
index 97e9dc066f95..6dedbdef7106 100644
--- a/drivers/parisc/power.c
+++ b/drivers/parisc/power.c
@@ -2,7 +2,7 @@
2 * linux/drivers/parisc/power.c 2 * linux/drivers/parisc/power.c
3 * HP PARISC soft power switch support driver 3 * HP PARISC soft power switch support driver
4 * 4 *
5 * Copyright (c) 2001-2005 Helge Deller <deller@gmx.de> 5 * Copyright (c) 2001-2007 Helge Deller <deller@gmx.de>
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * 8 *
@@ -29,7 +29,6 @@
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * 30 *
31 * 31 *
32 *
33 * HINT: 32 * HINT:
34 * Support of the soft power switch button may be enabled or disabled at 33 * Support of the soft power switch button may be enabled or disabled at
35 * runtime through the "/proc/sys/kernel/power" procfs entry. 34 * runtime through the "/proc/sys/kernel/power" procfs entry.
@@ -38,34 +37,28 @@
38#include <linux/module.h> 37#include <linux/module.h>
39#include <linux/init.h> 38#include <linux/init.h>
40#include <linux/kernel.h> 39#include <linux/kernel.h>
41#include <linux/string.h>
42#include <linux/notifier.h> 40#include <linux/notifier.h>
43#include <linux/reboot.h> 41#include <linux/reboot.h>
44#include <linux/sched.h> 42#include <linux/sched.h>
45#include <linux/interrupt.h> 43#include <linux/kthread.h>
46#include <linux/workqueue.h>
47 44
48#include <asm/pdc.h> 45#include <asm/pdc.h>
49#include <asm/io.h> 46#include <asm/io.h>
50#include <asm/led.h> 47#include <asm/led.h>
51#include <asm/uaccess.h>
52 48
49#define DRIVER_NAME "powersw"
50#define KTHREAD_NAME "kpowerswd"
53 51
54#ifdef DEBUG 52/* how often should the power button be polled ? */
55# define DPRINTK(x...) printk(x) 53#define POWERSWITCH_POLL_PER_SEC 2
56#else
57# define DPRINTK(x...)
58#endif
59
60
61/* filename in /proc which can be used to enable/disable the power switch */
62#define SYSCTL_FILENAME "sys/kernel/power"
63 54
55/* how long does the power button needs to be down until we react ? */
56#define POWERSWITCH_DOWN_SEC 2
64 57
58/* assembly code to access special registers */
59/* taken from PCXL ERS page 82 */
65#define DIAG_CODE(code) (0x14000000 + ((code)<<5)) 60#define DIAG_CODE(code) (0x14000000 + ((code)<<5))
66 61
67/* this will go to processor.h or any other place... */
68/* taken from PCXL ERS page 82 */
69#define MFCPU_X(rDiagReg, t_ch, t_th, code) \ 62#define MFCPU_X(rDiagReg, t_ch, t_th, code) \
70 (DIAG_CODE(code) + ((rDiagReg)<<21) + ((t_ch)<<16) + ((t_th)<<0) ) 63 (DIAG_CODE(code) + ((rDiagReg)<<21) + ((t_ch)<<16) + ((t_th)<<0) )
71 64
@@ -76,111 +69,95 @@
76#define __getDIAG(dr) ( { \ 69#define __getDIAG(dr) ( { \
77 register unsigned long __res asm("r28");\ 70 register unsigned long __res asm("r28");\
78 __asm__ __volatile__ ( \ 71 __asm__ __volatile__ ( \
79 ".word %1\n nop\n" : "=&r" (__res) : "i" (MFCPU_T(dr,28)) \ 72 ".word %1" : "=&r" (__res) : "i" (MFCPU_T(dr,28) ) \
80 ); \ 73 ); \
81 __res; \ 74 __res; \
82} ) 75} )
83 76
84 77/* local shutdown counter */
85static void deferred_poweroff(void *dummy)
86{
87 if (kill_cad_pid(SIGINT, 1)) {
88 /* just in case killing init process failed */
89 machine_power_off();
90 }
91}
92
93/*
94 * This function gets called from interrupt context.
95 * As it's called within an interrupt, it wouldn't sync if we don't
96 * use schedule_work().
97 */
98
99static DECLARE_WORK(poweroff_work, deferred_poweroff, NULL);
100
101static void poweroff(void)
102{
103 static int powering_off __read_mostly;
104
105 if (powering_off)
106 return;
107
108 powering_off++;
109 schedule_work(&poweroff_work);
110}
111
112
113/* local time-counter for shutdown */
114static int shutdown_timer __read_mostly; 78static int shutdown_timer __read_mostly;
115 79
116/* check, give feedback and start shutdown after one second */ 80/* check, give feedback and start shutdown after one second */
117static void process_shutdown(void) 81static void process_shutdown(void)
118{ 82{
119 if (shutdown_timer == 0) 83 if (shutdown_timer == 0)
120 DPRINTK(KERN_INFO "Shutdown requested...\n"); 84 printk(KERN_ALERT KTHREAD_NAME ": Shutdown requested...\n");
121 85
122 shutdown_timer++; 86 shutdown_timer++;
123 87
124 /* wait until the button was pressed for 1 second */ 88 /* wait until the button was pressed for 1 second */
125 if (shutdown_timer == HZ) { 89 if (shutdown_timer == (POWERSWITCH_DOWN_SEC*POWERSWITCH_POLL_PER_SEC)) {
126#if defined (DEBUG) || defined(CONFIG_CHASSIS_LCD_LED) 90 static const char msg[] = "Shutting down...";
127 static char msg[] = "Shutting down..."; 91 printk(KERN_INFO KTHREAD_NAME ": %s\n", msg);
128#endif
129 DPRINTK(KERN_INFO "%s\n", msg);
130 lcd_print(msg); 92 lcd_print(msg);
131 poweroff(); 93
94 /* send kill signal */
95 if (kill_cad_pid(SIGINT, 1)) {
96 /* just in case killing init process failed */
97 if (pm_power_off)
98 pm_power_off();
99 }
132 } 100 }
133} 101}
134 102
135 103
136/* main power switch tasklet struct (scheduled from time.c) */ 104/* main power switch task struct */
137DECLARE_TASKLET_DISABLED(power_tasklet, NULL, 0); 105static struct task_struct *power_task;
106
107/* filename in /proc which can be used to enable/disable the power switch */
108#define SYSCTL_FILENAME "sys/kernel/power"
138 109
139/* soft power switch enabled/disabled */ 110/* soft power switch enabled/disabled */
140int pwrsw_enabled __read_mostly = 1; 111int pwrsw_enabled __read_mostly = 1;
141 112
142/* 113/* main kernel thread worker. It polls the button state */
143 * On gecko style machines (e.g. 712/xx and 715/xx) 114static int kpowerswd(void *param)
144 * the power switch status is stored in Bit 0 ("the highest bit")
145 * of CPU diagnose register 25.
146 *
147 */
148static void gecko_tasklet_func(unsigned long unused)
149{ 115{
150 if (unlikely(!pwrsw_enabled)) 116 __set_current_state(TASK_RUNNING);
151 return; 117
152 118 do {
153 if (__getDIAG(25) & 0x80000000) { 119 int button_not_pressed;
154 /* power switch button not pressed or released again */ 120 unsigned long soft_power_reg = (unsigned long) param;
155 /* Warning: Some machines do never reset this DIAG flag! */ 121
156 shutdown_timer = 0; 122 schedule_timeout_interruptible(pwrsw_enabled ? HZ : HZ/POWERSWITCH_POLL_PER_SEC);
157 } else { 123 __set_current_state(TASK_RUNNING);
158 process_shutdown(); 124
159 } 125 if (unlikely(!pwrsw_enabled))
160} 126 continue;
161 127
128 if (soft_power_reg) {
129 /*
130 * Non-Gecko-style machines:
131 * Check the power switch status which is read from the
132 * real I/O location at soft_power_reg.
133 * Bit 31 ("the lowest bit) is the status of the power switch.
134 * This bit is "1" if the button is NOT pressed.
135 */
136 button_not_pressed = (gsc_readl(soft_power_reg) & 0x1);
137 } else {
138 /*
139 * On gecko style machines (e.g. 712/xx and 715/xx)
140 * the power switch status is stored in Bit 0 ("the highest bit")
141 * of CPU diagnose register 25.
142 * Warning: Some machines never reset the DIAG flag, even if
143 * the button has been released again.
144 */
145 button_not_pressed = (__getDIAG(25) & 0x80000000);
146 }
147
148 if (likely(button_not_pressed)) {
149 if (unlikely(shutdown_timer && /* avoid writing if not necessary */
150 shutdown_timer < (POWERSWITCH_DOWN_SEC*POWERSWITCH_POLL_PER_SEC))) {
151 shutdown_timer = 0;
152 printk(KERN_INFO KTHREAD_NAME ": Shutdown request aborted.\n");
153 }
154 } else
155 process_shutdown();
156
157
158 } while (!kthread_should_stop());
162 159
163 160 return 0;
164/*
165 * Check the power switch status which is read from the
166 * real I/O location at soft_power_reg.
167 * Bit 31 ("the lowest bit) is the status of the power switch.
168 */
169
170static void polling_tasklet_func(unsigned long soft_power_reg)
171{
172 unsigned long current_status;
173
174 if (unlikely(!pwrsw_enabled))
175 return;
176
177 current_status = gsc_readl(soft_power_reg);
178 if (current_status & 0x1) {
179 /* power switch button not pressed */
180 shutdown_timer = 0;
181 } else {
182 process_shutdown();
183 }
184} 161}
185 162
186 163
@@ -220,7 +197,7 @@ static struct notifier_block parisc_panic_block = {
220static int __init power_init(void) 197static int __init power_init(void)
221{ 198{
222 unsigned long ret; 199 unsigned long ret;
223 unsigned long soft_power_reg = 0; 200 unsigned long soft_power_reg;
224 201
225#if 0 202#if 0
226 request_irq( IRQ_FROM_REGION(CPU_IRQ_REGION)+2, &powerfail_interrupt, 203 request_irq( IRQ_FROM_REGION(CPU_IRQ_REGION)+2, &powerfail_interrupt,
@@ -235,44 +212,44 @@ static int __init power_init(void)
235 soft_power_reg = -1UL; 212 soft_power_reg = -1UL;
236 213
237 switch (soft_power_reg) { 214 switch (soft_power_reg) {
238 case 0: printk(KERN_INFO "Gecko-style soft power switch enabled.\n"); 215 case 0: printk(KERN_INFO DRIVER_NAME ": Gecko-style soft power switch enabled.\n");
239 power_tasklet.func = gecko_tasklet_func;
240 break; 216 break;
241 217
242 case -1UL: printk(KERN_INFO "Soft power switch support not available.\n"); 218 case -1UL: printk(KERN_INFO DRIVER_NAME ": Soft power switch support not available.\n");
243 return -ENODEV; 219 return -ENODEV;
244 220
245 default: printk(KERN_INFO "Soft power switch enabled, polling @ 0x%08lx.\n", 221 default: printk(KERN_INFO DRIVER_NAME ": Soft power switch at 0x%08lx enabled.\n",
246 soft_power_reg); 222 soft_power_reg);
247 power_tasklet.data = soft_power_reg; 223 }
248 power_tasklet.func = polling_tasklet_func; 224
225 power_task = kthread_run(kpowerswd, (void*)soft_power_reg, KTHREAD_NAME);
226 if (IS_ERR(power_task)) {
227 printk(KERN_ERR DRIVER_NAME ": thread creation failed. Driver not loaded.\n");
228 pdc_soft_power_button(0);
229 return -EIO;
249 } 230 }
250 231
251 /* Register a call for panic conditions. */ 232 /* Register a call for panic conditions. */
252 atomic_notifier_chain_register(&panic_notifier_list, 233 atomic_notifier_chain_register(&panic_notifier_list,
253 &parisc_panic_block); 234 &parisc_panic_block);
254 235
255 tasklet_enable(&power_tasklet);
256
257 return 0; 236 return 0;
258} 237}
259 238
260static void __exit power_exit(void) 239static void __exit power_exit(void)
261{ 240{
262 if (!power_tasklet.func) 241 kthread_stop(power_task);
263 return;
264 242
265 tasklet_disable(&power_tasklet);
266 atomic_notifier_chain_unregister(&panic_notifier_list, 243 atomic_notifier_chain_unregister(&panic_notifier_list,
267 &parisc_panic_block); 244 &parisc_panic_block);
268 power_tasklet.func = NULL; 245
269 pdc_soft_power_button(0); 246 pdc_soft_power_button(0);
270} 247}
271 248
272module_init(power_init); 249arch_initcall(power_init);
273module_exit(power_exit); 250module_exit(power_exit);
274 251
275 252
276MODULE_AUTHOR("Helge Deller"); 253MODULE_AUTHOR("Helge Deller <deller@gmx.de>");
277MODULE_DESCRIPTION("Soft power switch driver"); 254MODULE_DESCRIPTION("Soft power switch driver");
278MODULE_LICENSE("Dual BSD/GPL"); 255MODULE_LICENSE("Dual BSD/GPL");
diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c
index 76a29dadd519..322957ac2ad1 100644
--- a/drivers/parisc/sba_iommu.c
+++ b/drivers/parisc/sba_iommu.c
@@ -109,7 +109,7 @@ static unsigned long piranha_bad_128k = 0;
109 109
110#ifdef SBA_AGP_SUPPORT 110#ifdef SBA_AGP_SUPPORT
111static int sba_reserve_agpgart = 1; 111static int sba_reserve_agpgart = 1;
112module_param(sba_reserve_agpgart, int, 1); 112module_param(sba_reserve_agpgart, int, 0444);
113MODULE_PARM_DESC(sba_reserve_agpgart, "Reserve half of IO pdir as AGPGART"); 113MODULE_PARM_DESC(sba_reserve_agpgart, "Reserve half of IO pdir as AGPGART");
114#endif 114#endif
115 115
@@ -846,7 +846,7 @@ static void *sba_alloc_consistent(struct device *hwdev, size_t size,
846 if (!hwdev) { 846 if (!hwdev) {
847 /* only support PCI */ 847 /* only support PCI */
848 *dma_handle = 0; 848 *dma_handle = 0;
849 return 0; 849 return NULL;
850 } 850 }
851 851
852 ret = (void *) __get_free_pages(gfp, get_order(size)); 852 ret = (void *) __get_free_pages(gfp, get_order(size));
diff --git a/drivers/serial/mux.c b/drivers/serial/mux.c
index ccb8fa1800a5..83211013deb8 100644
--- a/drivers/serial/mux.c
+++ b/drivers/serial/mux.c
@@ -51,7 +51,11 @@
51 51
52#define MUX_NR 256 52#define MUX_NR 256
53static unsigned int port_cnt __read_mostly; 53static unsigned int port_cnt __read_mostly;
54static struct uart_port mux_ports[MUX_NR]; 54struct mux_port {
55 struct uart_port port;
56 int enabled;
57};
58static struct mux_port mux_ports[MUX_NR];
55 59
56static struct uart_driver mux_driver = { 60static struct uart_driver mux_driver = {
57 .owner = THIS_MODULE, 61 .owner = THIS_MODULE,
@@ -66,7 +70,36 @@ static struct timer_list mux_timer;
66 70
67#define UART_PUT_CHAR(p, c) __raw_writel((c), (p)->membase + IO_DATA_REG_OFFSET) 71#define UART_PUT_CHAR(p, c) __raw_writel((c), (p)->membase + IO_DATA_REG_OFFSET)
68#define UART_GET_FIFO_CNT(p) __raw_readl((p)->membase + IO_DCOUNT_REG_OFFSET) 72#define UART_GET_FIFO_CNT(p) __raw_readl((p)->membase + IO_DCOUNT_REG_OFFSET)
69#define GET_MUX_PORTS(iodc_data) ((((iodc_data)[4] & 0xf0) >> 4) * 8) + 8 73
74/**
75 * get_mux_port_count - Get the number of available ports on the Mux.
76 * @dev: The parisc device.
77 *
78 * This function is used to determine the number of ports the Mux
79 * supports. The IODC data reports the number of ports the Mux
80 * can support, but there are cases where not all the Mux ports
81 * are connected. This function can override the IODC and
82 * return the true port count.
83 */
84static int __init get_mux_port_count(struct parisc_device *dev)
85{
86 int status;
87 u8 iodc_data[32];
88 unsigned long bytecnt;
89
90 /* If this is the built-in Mux for the K-Class (Eole CAP/MUX),
91 * we only need to allocate resources for 1 port since the
92 * other 7 ports are not connected.
93 */
94 if(dev->id.hversion == 0x15)
95 return 1;
96
97 status = pdc_iodc_read(&bytecnt, dev->hpa.start, 0, iodc_data, 32);
98 BUG_ON(status != PDC_OK);
99
100 /* Return the number of ports specified in the iodc data. */
101 return ((((iodc_data)[4] & 0xf0) >> 4) * 8) + 8;
102}
70 103
71/** 104/**
72 * mux_tx_empty - Check if the transmitter fifo is empty. 105 * mux_tx_empty - Check if the transmitter fifo is empty.
@@ -250,7 +283,7 @@ static void mux_read(struct uart_port *port)
250 */ 283 */
251static int mux_startup(struct uart_port *port) 284static int mux_startup(struct uart_port *port)
252{ 285{
253 mod_timer(&mux_timer, jiffies + MUX_POLL_DELAY); 286 mux_ports[port->line].enabled = 1;
254 return 0; 287 return 0;
255} 288}
256 289
@@ -262,6 +295,7 @@ static int mux_startup(struct uart_port *port)
262 */ 295 */
263static void mux_shutdown(struct uart_port *port) 296static void mux_shutdown(struct uart_port *port)
264{ 297{
298 mux_ports[port->line].enabled = 0;
265} 299}
266 300
267/** 301/**
@@ -319,7 +353,7 @@ static int mux_request_port(struct uart_port *port)
319 * @port: Ptr to the uart_port. 353 * @port: Ptr to the uart_port.
320 * @type: Bitmask of required configurations. 354 * @type: Bitmask of required configurations.
321 * 355 *
322 * Perform any autoconfiguration steps for the port. This functino is 356 * Perform any autoconfiguration steps for the port. This function is
323 * called if the UPF_BOOT_AUTOCONF flag is specified for the port. 357 * called if the UPF_BOOT_AUTOCONF flag is specified for the port.
324 * [Note: This is required for now because of a bug in the Serial core. 358 * [Note: This is required for now because of a bug in the Serial core.
325 * rmk has already submitted a patch to linus, should be available for 359 * rmk has already submitted a patch to linus, should be available for
@@ -357,11 +391,11 @@ static void mux_poll(unsigned long unused)
357 int i; 391 int i;
358 392
359 for(i = 0; i < port_cnt; ++i) { 393 for(i = 0; i < port_cnt; ++i) {
360 if(!mux_ports[i].info) 394 if(!mux_ports[i].enabled)
361 continue; 395 continue;
362 396
363 mux_read(&mux_ports[i]); 397 mux_read(&mux_ports[i].port);
364 mux_write(&mux_ports[i]); 398 mux_write(&mux_ports[i].port);
365 } 399 }
366 400
367 mod_timer(&mux_timer, jiffies + MUX_POLL_DELAY); 401 mod_timer(&mux_timer, jiffies + MUX_POLL_DELAY);
@@ -371,8 +405,17 @@ static void mux_poll(unsigned long unused)
371#ifdef CONFIG_SERIAL_MUX_CONSOLE 405#ifdef CONFIG_SERIAL_MUX_CONSOLE
372static void mux_console_write(struct console *co, const char *s, unsigned count) 406static void mux_console_write(struct console *co, const char *s, unsigned count)
373{ 407{
374 while(count--) 408 /* Wait until the FIFO drains. */
375 pdc_iodc_putc(*s++); 409 while(UART_GET_FIFO_CNT(&mux_ports[0].port))
410 udelay(1);
411
412 while(count--) {
413 if(*s == '\n') {
414 UART_PUT_CHAR(&mux_ports[0].port, '\r');
415 }
416 UART_PUT_CHAR(&mux_ports[0].port, *s++);
417 }
418
376} 419}
377 420
378static int mux_console_setup(struct console *co, char *options) 421static int mux_console_setup(struct console *co, char *options)
@@ -428,19 +471,14 @@ static struct uart_ops mux_pops = {
428 */ 471 */
429static int __init mux_probe(struct parisc_device *dev) 472static int __init mux_probe(struct parisc_device *dev)
430{ 473{
431 int i, status, ports; 474 int i, status;
432 u8 iodc_data[32];
433 unsigned long bytecnt;
434 struct uart_port *port;
435 475
436 status = pdc_iodc_read(&bytecnt, dev->hpa.start, 0, iodc_data, 32); 476 int port_count = get_mux_port_count(dev);
437 if(status != PDC_OK) { 477 printk(KERN_INFO "Serial mux driver (%d ports) Revision: 0.6\n", port_count);
438 printk(KERN_ERR "Serial mux: Unable to read IODC.\n");
439 return 1;
440 }
441 478
442 ports = GET_MUX_PORTS(iodc_data); 479 dev_set_drvdata(&dev->dev, (void *)(long)port_count);
443 printk(KERN_INFO "Serial mux driver (%d ports) Revision: 0.3\n", ports); 480 request_mem_region(dev->hpa.start + MUX_OFFSET,
481 port_count * MUX_LINE_OFFSET, "Mux");
444 482
445 if(!port_cnt) { 483 if(!port_cnt) {
446 mux_driver.cons = MUX_CONSOLE; 484 mux_driver.cons = MUX_CONSOLE;
@@ -450,13 +488,10 @@ static int __init mux_probe(struct parisc_device *dev)
450 printk(KERN_ERR "Serial mux: Unable to register driver.\n"); 488 printk(KERN_ERR "Serial mux: Unable to register driver.\n");
451 return 1; 489 return 1;
452 } 490 }
453
454 init_timer(&mux_timer);
455 mux_timer.function = mux_poll;
456 } 491 }
457 492
458 for(i = 0; i < ports; ++i, ++port_cnt) { 493 for(i = 0; i < port_count; ++i, ++port_cnt) {
459 port = &mux_ports[port_cnt]; 494 struct uart_port *port = &mux_ports[port_cnt].port;
460 port->iobase = 0; 495 port->iobase = 0;
461 port->mapbase = dev->hpa.start + MUX_OFFSET + 496 port->mapbase = dev->hpa.start + MUX_OFFSET +
462 (i * MUX_LINE_OFFSET); 497 (i * MUX_LINE_OFFSET);
@@ -477,27 +512,73 @@ static int __init mux_probe(struct parisc_device *dev)
477 */ 512 */
478 port->timeout = HZ / 50; 513 port->timeout = HZ / 50;
479 spin_lock_init(&port->lock); 514 spin_lock_init(&port->lock);
515
480 status = uart_add_one_port(&mux_driver, port); 516 status = uart_add_one_port(&mux_driver, port);
481 BUG_ON(status); 517 BUG_ON(status);
482 } 518 }
483 519
484#ifdef CONFIG_SERIAL_MUX_CONSOLE
485 register_console(&mux_console);
486#endif
487 return 0; 520 return 0;
488} 521}
489 522
523static int __devexit mux_remove(struct parisc_device *dev)
524{
525 int i, j;
526 int port_count = (long)dev_get_drvdata(&dev->dev);
527
528 /* Find Port 0 for this card in the mux_ports list. */
529 for(i = 0; i < port_cnt; ++i) {
530 if(mux_ports[i].port.mapbase == dev->hpa.start + MUX_OFFSET)
531 break;
532 }
533 BUG_ON(i + port_count > port_cnt);
534
535 /* Release the resources associated with each port on the device. */
536 for(j = 0; j < port_count; ++j, ++i) {
537 struct uart_port *port = &mux_ports[i].port;
538
539 uart_remove_one_port(&mux_driver, port);
540 if(port->membase)
541 iounmap(port->membase);
542 }
543
544 release_mem_region(dev->hpa.start + MUX_OFFSET, port_count * MUX_LINE_OFFSET);
545 return 0;
546}
547
548/* Hack. This idea was taken from the 8250_gsc.c on how to properly order
549 * the serial port detection in the proper order. The idea is we always
550 * want the builtin mux to be detected before addin mux cards, so we
551 * specifically probe for the builtin mux cards first.
552 *
553 * This table only contains the parisc_device_id of known builtin mux
554 * devices. All other mux cards will be detected by the generic mux_tbl.
555 */
556static struct parisc_device_id builtin_mux_tbl[] = {
557 { HPHW_A_DIRECT, HVERSION_REV_ANY_ID, 0x15, 0x0000D }, /* All K-class */
558 { HPHW_A_DIRECT, HVERSION_REV_ANY_ID, 0x44, 0x0000D }, /* E35, E45, and E55 */
559 { 0, }
560};
561
490static struct parisc_device_id mux_tbl[] = { 562static struct parisc_device_id mux_tbl[] = {
491 { HPHW_A_DIRECT, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0000D }, 563 { HPHW_A_DIRECT, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0000D },
492 { 0, } 564 { 0, }
493}; 565};
494 566
567MODULE_DEVICE_TABLE(parisc, builtin_mux_tbl);
495MODULE_DEVICE_TABLE(parisc, mux_tbl); 568MODULE_DEVICE_TABLE(parisc, mux_tbl);
496 569
570static struct parisc_driver builtin_serial_mux_driver = {
571 .name = "builtin_serial_mux",
572 .id_table = builtin_mux_tbl,
573 .probe = mux_probe,
574 .remove = __devexit_p(mux_remove),
575};
576
497static struct parisc_driver serial_mux_driver = { 577static struct parisc_driver serial_mux_driver = {
498 .name = "serial_mux", 578 .name = "serial_mux",
499 .id_table = mux_tbl, 579 .id_table = mux_tbl,
500 .probe = mux_probe, 580 .probe = mux_probe,
581 .remove = __devexit_p(mux_remove),
501}; 582};
502 583
503/** 584/**
@@ -507,7 +588,21 @@ static struct parisc_driver serial_mux_driver = {
507 */ 588 */
508static int __init mux_init(void) 589static int __init mux_init(void)
509{ 590{
510 return register_parisc_driver(&serial_mux_driver); 591 register_parisc_driver(&builtin_serial_mux_driver);
592 register_parisc_driver(&serial_mux_driver);
593
594 if(port_cnt > 0) {
595 /* Start the Mux timer */
596 init_timer(&mux_timer);
597 mux_timer.function = mux_poll;
598 mod_timer(&mux_timer, jiffies + MUX_POLL_DELAY);
599
600#ifdef CONFIG_SERIAL_MUX_CONSOLE
601 register_console(&mux_console);
602#endif
603 }
604
605 return 0;
511} 606}
512 607
513/** 608/**
@@ -517,14 +612,16 @@ static int __init mux_init(void)
517 */ 612 */
518static void __exit mux_exit(void) 613static void __exit mux_exit(void)
519{ 614{
520 int i; 615 /* Delete the Mux timer. */
521 616 if(port_cnt > 0) {
522 for (i = 0; i < port_cnt; i++) { 617 del_timer(&mux_timer);
523 uart_remove_one_port(&mux_driver, &mux_ports[i]); 618#ifdef CONFIG_SERIAL_MUX_CONSOLE
524 if (mux_ports[i].membase) 619 unregister_console(&mux_console);
525 iounmap(mux_ports[i].membase); 620#endif
526 } 621 }
527 622
623 unregister_parisc_driver(&builtin_serial_mux_driver);
624 unregister_parisc_driver(&serial_mux_driver);
528 uart_unregister_driver(&mux_driver); 625 uart_unregister_driver(&mux_driver);
529} 626}
530 627