aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/kernel/stacktrace.c2
-rw-r--r--arch/i386/mm/discontig.c9
-rw-r--r--arch/sh64/Kconfig3
-rw-r--r--arch/sh64/configs/cayman_defconfig199
-rw-r--r--arch/sh64/kernel/entry.S4
-rw-r--r--arch/sh64/kernel/irq.c4
-rw-r--r--arch/sh64/kernel/pci_sh5.c17
-rw-r--r--arch/sh64/kernel/pci_sh5.h2
-rw-r--r--arch/sh64/kernel/process.c2
-rw-r--r--arch/sh64/kernel/signal.c33
-rw-r--r--arch/sh64/kernel/syscalls.S36
-rw-r--r--arch/sh64/kernel/time.c18
-rw-r--r--arch/sh64/lib/.gitignore1
-rw-r--r--arch/sh64/mach-cayman/irq.c4
-rw-r--r--arch/sh64/mach-cayman/setup.c2
-rw-r--r--arch/sh64/mm/fault.c2
-rw-r--r--arch/sh64/mm/init.c2
-rw-r--r--arch/sh64/mm/tlbmiss.c4
-rw-r--r--arch/um/include/sysdep-x86_64/kernel-offsets.h9
-rw-r--r--arch/um/include/sysdep-x86_64/syscalls.h3
-rw-r--r--arch/um/sys-x86_64/syscall_table.c5
-rw-r--r--drivers/firewire/fw-ohci.c1
-rw-r--r--drivers/ide/Kconfig15
-rw-r--r--drivers/ide/cris/ide-cris.c14
-rw-r--r--drivers/ide/ide-dma.c53
-rw-r--r--drivers/ide/ide-io.c1
-rw-r--r--drivers/ide/ide-lib.c12
-rw-r--r--drivers/ide/ide.c1
-rw-r--r--drivers/ide/pci/alim15x3.c69
-rw-r--r--drivers/ide/pci/cmd64x.c15
-rw-r--r--drivers/ide/pci/cs5530.c160
-rw-r--r--drivers/ide/pci/it821x.c21
-rw-r--r--drivers/ide/pci/pdc202xx_new.c29
-rw-r--r--drivers/ide/pci/pdc202xx_old.c184
-rw-r--r--drivers/ide/pci/sc1200.c161
-rw-r--r--drivers/ide/pci/scc_pata.c22
-rw-r--r--drivers/ide/pci/serverworks.c77
-rw-r--r--drivers/ide/pci/siimage.c24
-rw-r--r--drivers/ide/pci/sis5513.c85
-rw-r--r--drivers/ide/pci/sl82c105.c76
-rw-r--r--drivers/input/joystick/Kconfig1
-rw-r--r--drivers/input/misc/Kconfig5
-rw-r--r--drivers/input/mouse/Kconfig1
-rw-r--r--drivers/input/tablet/Kconfig4
-rw-r--r--drivers/input/touchscreen/Kconfig1
-rw-r--r--drivers/media/video/em28xx/Kconfig2
-rw-r--r--drivers/media/video/ivtv/Kconfig2
-rw-r--r--drivers/net/mlx4/alloc.c1
-rw-r--r--drivers/net/mlx4/eq.c1
-rw-r--r--drivers/net/mlx4/icm.c1
-rw-r--r--drivers/net/mlx4/reset.c1
-rw-r--r--drivers/net/pasemi_mac.c45
-rw-r--r--drivers/net/pasemi_mac.h4
-rw-r--r--drivers/net/smc911x.c6
-rw-r--r--drivers/net/ucc_geth.c40
-rw-r--r--drivers/net/ucc_geth_mii.c9
-rw-r--r--drivers/net/ucc_geth_mii.h10
-rw-r--r--drivers/pci/hotplug/rpadlpar_sysfs.c5
-rw-r--r--include/asm-m32r/system.h3
-rw-r--r--include/asm-sh64/dma-mapping.h14
-rw-r--r--include/asm-sh64/irq_regs.h1
-rw-r--r--include/asm-sh64/pgalloc.h100
-rw-r--r--include/asm-sh64/sci.h1
-rw-r--r--include/asm-sh64/thread_info.h6
-rw-r--r--include/asm-sh64/unistd.h43
-rw-r--r--include/linux/ide.h3
-rw-r--r--kernel/auditfilter.c2
-rw-r--r--mm/Kconfig2
68 files changed, 739 insertions, 956 deletions
diff --git a/arch/arm/kernel/stacktrace.c b/arch/arm/kernel/stacktrace.c
index 398d0c0511eb..8b63ad89d0a8 100644
--- a/arch/arm/kernel/stacktrace.c
+++ b/arch/arm/kernel/stacktrace.c
@@ -1,3 +1,4 @@
1#include <linux/module.h>
1#include <linux/sched.h> 2#include <linux/sched.h>
2#include <linux/stacktrace.h> 3#include <linux/stacktrace.h>
3 4
@@ -30,6 +31,7 @@ int walk_stackframe(unsigned long fp, unsigned long low, unsigned long high,
30 31
31 return 0; 32 return 0;
32} 33}
34EXPORT_SYMBOL(walk_stackframe);
33 35
34#ifdef CONFIG_STACKTRACE 36#ifdef CONFIG_STACKTRACE
35struct stack_trace_data { 37struct stack_trace_data {
diff --git a/arch/i386/mm/discontig.c b/arch/i386/mm/discontig.c
index aa58720f6871..860e912a3fbb 100644
--- a/arch/i386/mm/discontig.c
+++ b/arch/i386/mm/discontig.c
@@ -31,6 +31,7 @@
31#include <linux/module.h> 31#include <linux/module.h>
32#include <linux/kexec.h> 32#include <linux/kexec.h>
33#include <linux/pfn.h> 33#include <linux/pfn.h>
34#include <linux/swap.h>
34 35
35#include <asm/e820.h> 36#include <asm/e820.h>
36#include <asm/setup.h> 37#include <asm/setup.h>
@@ -97,14 +98,8 @@ unsigned long node_memmap_size_bytes(int nid, unsigned long start_pfn,
97#endif 98#endif
98 99
99extern unsigned long find_max_low_pfn(void); 100extern unsigned long find_max_low_pfn(void);
100extern void find_max_pfn(void);
101extern void add_one_highpage_init(struct page *, int, int); 101extern void add_one_highpage_init(struct page *, int, int);
102
103extern struct e820map e820;
104extern unsigned long highend_pfn, highstart_pfn; 102extern unsigned long highend_pfn, highstart_pfn;
105extern unsigned long max_low_pfn;
106extern unsigned long totalram_pages;
107extern unsigned long totalhigh_pages;
108 103
109#define LARGE_PAGE_BYTES (PTRS_PER_PTE * PAGE_SIZE) 104#define LARGE_PAGE_BYTES (PTRS_PER_PTE * PAGE_SIZE)
110 105
@@ -360,7 +355,9 @@ void __init zone_sizes_init(void)
360 max_zone_pfns[ZONE_DMA] = 355 max_zone_pfns[ZONE_DMA] =
361 virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT; 356 virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
362 max_zone_pfns[ZONE_NORMAL] = max_low_pfn; 357 max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
358#ifdef CONFIG_HIGHMEM
363 max_zone_pfns[ZONE_HIGHMEM] = highend_pfn; 359 max_zone_pfns[ZONE_HIGHMEM] = highend_pfn;
360#endif
364 361
365 /* If SRAT has not registered memory, register it now */ 362 /* If SRAT has not registered memory, register it now */
366 if (find_max_pfn_with_active_regions() == 0) { 363 if (find_max_pfn_with_active_regions() == 0) {
diff --git a/arch/sh64/Kconfig b/arch/sh64/Kconfig
index e14b533558c8..ff654204b7d4 100644
--- a/arch/sh64/Kconfig
+++ b/arch/sh64/Kconfig
@@ -17,6 +17,9 @@ config MMU
17 bool 17 bool
18 default y 18 default y
19 19
20config QUICKLIST
21 def_bool y
22
20config RWSEM_GENERIC_SPINLOCK 23config RWSEM_GENERIC_SPINLOCK
21 bool 24 bool
22 default y 25 default y
diff --git a/arch/sh64/configs/cayman_defconfig b/arch/sh64/configs/cayman_defconfig
index d81df574a7f7..ed035084b053 100644
--- a/arch/sh64/configs/cayman_defconfig
+++ b/arch/sh64/configs/cayman_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.18 3# Linux kernel version: 2.6.22-rc1
4# Tue Oct 3 13:30:51 2006 4# Mon May 14 08:43:31 2007
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH64=y 7CONFIG_SUPERH64=y
@@ -10,6 +10,8 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
10CONFIG_GENERIC_FIND_NEXT_BIT=y 10CONFIG_GENERIC_FIND_NEXT_BIT=y
11CONFIG_GENERIC_HWEIGHT=y 11CONFIG_GENERIC_HWEIGHT=y
12CONFIG_GENERIC_CALIBRATE_DELAY=y 12CONFIG_GENERIC_CALIBRATE_DELAY=y
13# CONFIG_ARCH_HAS_ILOG2_U32 is not set
14# CONFIG_ARCH_HAS_ILOG2_U64 is not set
13CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 15CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
14 16
15# 17#
@@ -33,13 +35,15 @@ CONFIG_POSIX_MQUEUE=y
33# CONFIG_UTS_NS is not set 35# CONFIG_UTS_NS is not set
34# CONFIG_AUDIT is not set 36# CONFIG_AUDIT is not set
35# CONFIG_IKCONFIG is not set 37# CONFIG_IKCONFIG is not set
38CONFIG_LOG_BUF_SHIFT=14
39CONFIG_SYSFS_DEPRECATED=y
36# CONFIG_RELAY is not set 40# CONFIG_RELAY is not set
37CONFIG_INITRAMFS_SOURCE="" 41# CONFIG_BLK_DEV_INITRD is not set
38# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 42# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
39CONFIG_SYSCTL=y 43CONFIG_SYSCTL=y
40# CONFIG_EMBEDDED is not set 44# CONFIG_EMBEDDED is not set
41CONFIG_UID16=y 45CONFIG_UID16=y
42# CONFIG_SYSCTL_SYSCALL is not set 46CONFIG_SYSCTL_SYSCALL=y
43CONFIG_KALLSYMS=y 47CONFIG_KALLSYMS=y
44# CONFIG_KALLSYMS_ALL is not set 48# CONFIG_KALLSYMS_ALL is not set
45# CONFIG_KALLSYMS_EXTRA_PASS is not set 49# CONFIG_KALLSYMS_EXTRA_PASS is not set
@@ -49,14 +53,19 @@ CONFIG_BUG=y
49CONFIG_ELF_CORE=y 53CONFIG_ELF_CORE=y
50CONFIG_BASE_FULL=y 54CONFIG_BASE_FULL=y
51CONFIG_FUTEX=y 55CONFIG_FUTEX=y
56CONFIG_ANON_INODES=y
52CONFIG_EPOLL=y 57CONFIG_EPOLL=y
58CONFIG_SIGNALFD=y
59CONFIG_TIMERFD=y
60CONFIG_EVENTFD=y
53CONFIG_SHMEM=y 61CONFIG_SHMEM=y
54CONFIG_SLAB=y
55CONFIG_VM_EVENT_COUNTERS=y 62CONFIG_VM_EVENT_COUNTERS=y
63CONFIG_SLAB=y
64# CONFIG_SLUB is not set
65# CONFIG_SLOB is not set
56CONFIG_RT_MUTEXES=y 66CONFIG_RT_MUTEXES=y
57# CONFIG_TINY_SHMEM is not set 67# CONFIG_TINY_SHMEM is not set
58CONFIG_BASE_SMALL=0 68CONFIG_BASE_SMALL=0
59# CONFIG_SLOB is not set
60 69
61# 70#
62# Loadable module support 71# Loadable module support
@@ -135,7 +144,7 @@ CONFIG_SH64_ID2815_WORKAROUND=y
135# 144#
136CONFIG_HEARTBEAT=y 145CONFIG_HEARTBEAT=y
137CONFIG_HDSP253_LED=y 146CONFIG_HDSP253_LED=y
138CONFIG_SH_DMA=y 147# CONFIG_SH_DMA is not set
139CONFIG_PREEMPT=y 148CONFIG_PREEMPT=y
140CONFIG_SELECT_MEMORY_MODEL=y 149CONFIG_SELECT_MEMORY_MODEL=y
141CONFIG_FLATMEM_MANUAL=y 150CONFIG_FLATMEM_MANUAL=y
@@ -146,23 +155,20 @@ CONFIG_FLAT_NODE_MEM_MAP=y
146# CONFIG_SPARSEMEM_STATIC is not set 155# CONFIG_SPARSEMEM_STATIC is not set
147CONFIG_SPLIT_PTLOCK_CPUS=4 156CONFIG_SPLIT_PTLOCK_CPUS=4
148# CONFIG_RESOURCES_64BIT is not set 157# CONFIG_RESOURCES_64BIT is not set
158CONFIG_ZONE_DMA_FLAG=0
149 159
150# 160#
151# Bus options (PCI, PCMCIA, EISA, MCA, ISA) 161# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
152# 162#
153CONFIG_PCI=y 163CONFIG_PCI=y
154CONFIG_SH_PCIDMA_NONCOHERENT=y 164CONFIG_SH_PCIDMA_NONCOHERENT=y
155# CONFIG_PCI_MULTITHREAD_PROBE is not set 165# CONFIG_ARCH_SUPPORTS_MSI is not set
156# CONFIG_PCI_DEBUG is not set 166# CONFIG_PCI_DEBUG is not set
157 167
158# 168#
159# PCCARD (PCMCIA/CardBus) support 169# PCCARD (PCMCIA/CardBus) support
160# 170#
161# CONFIG_PCCARD is not set 171# CONFIG_PCCARD is not set
162
163#
164# PCI Hotplug Support
165#
166# CONFIG_HOTPLUG_PCI is not set 172# CONFIG_HOTPLUG_PCI is not set
167 173
168# 174#
@@ -180,13 +186,13 @@ CONFIG_NET=y
180# 186#
181# Networking options 187# Networking options
182# 188#
183# CONFIG_NETDEBUG is not set
184CONFIG_PACKET=y 189CONFIG_PACKET=y
185# CONFIG_PACKET_MMAP is not set 190# CONFIG_PACKET_MMAP is not set
186CONFIG_UNIX=y 191CONFIG_UNIX=y
187CONFIG_XFRM=y 192CONFIG_XFRM=y
188# CONFIG_XFRM_USER is not set 193# CONFIG_XFRM_USER is not set
189# CONFIG_XFRM_SUB_POLICY is not set 194# CONFIG_XFRM_SUB_POLICY is not set
195# CONFIG_XFRM_MIGRATE is not set
190# CONFIG_NET_KEY is not set 196# CONFIG_NET_KEY is not set
191CONFIG_INET=y 197CONFIG_INET=y
192# CONFIG_IP_MULTICAST is not set 198# CONFIG_IP_MULTICAST is not set
@@ -207,11 +213,13 @@ CONFIG_IP_PNP=y
207# CONFIG_INET_TUNNEL is not set 213# CONFIG_INET_TUNNEL is not set
208CONFIG_INET_XFRM_MODE_TRANSPORT=y 214CONFIG_INET_XFRM_MODE_TRANSPORT=y
209CONFIG_INET_XFRM_MODE_TUNNEL=y 215CONFIG_INET_XFRM_MODE_TUNNEL=y
216CONFIG_INET_XFRM_MODE_BEET=y
210CONFIG_INET_DIAG=y 217CONFIG_INET_DIAG=y
211CONFIG_INET_TCP_DIAG=y 218CONFIG_INET_TCP_DIAG=y
212# CONFIG_TCP_CONG_ADVANCED is not set 219# CONFIG_TCP_CONG_ADVANCED is not set
213CONFIG_TCP_CONG_CUBIC=y 220CONFIG_TCP_CONG_CUBIC=y
214CONFIG_DEFAULT_TCP_CONG="cubic" 221CONFIG_DEFAULT_TCP_CONG="cubic"
222# CONFIG_TCP_MD5SIG is not set
215# CONFIG_IPV6 is not set 223# CONFIG_IPV6 is not set
216# CONFIG_INET6_XFRM_TUNNEL is not set 224# CONFIG_INET6_XFRM_TUNNEL is not set
217# CONFIG_INET6_TUNNEL is not set 225# CONFIG_INET6_TUNNEL is not set
@@ -256,7 +264,16 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
256# CONFIG_HAMRADIO is not set 264# CONFIG_HAMRADIO is not set
257# CONFIG_IRDA is not set 265# CONFIG_IRDA is not set
258# CONFIG_BT is not set 266# CONFIG_BT is not set
267# CONFIG_AF_RXRPC is not set
268
269#
270# Wireless
271#
272# CONFIG_CFG80211 is not set
273# CONFIG_WIRELESS_EXT is not set
274# CONFIG_MAC80211 is not set
259# CONFIG_IEEE80211 is not set 275# CONFIG_IEEE80211 is not set
276# CONFIG_RFKILL is not set
260 277
261# 278#
262# Device Drivers 279# Device Drivers
@@ -269,16 +286,13 @@ CONFIG_STANDALONE=y
269CONFIG_PREVENT_FIRMWARE_BUILD=y 286CONFIG_PREVENT_FIRMWARE_BUILD=y
270# CONFIG_FW_LOADER is not set 287# CONFIG_FW_LOADER is not set
271# CONFIG_DEBUG_DRIVER is not set 288# CONFIG_DEBUG_DRIVER is not set
289# CONFIG_DEBUG_DEVRES is not set
272# CONFIG_SYS_HYPERVISOR is not set 290# CONFIG_SYS_HYPERVISOR is not set
273 291
274# 292#
275# Connector - unified userspace <-> kernelspace linker 293# Connector - unified userspace <-> kernelspace linker
276# 294#
277# CONFIG_CONNECTOR is not set 295# CONFIG_CONNECTOR is not set
278
279#
280# Memory Technology Devices (MTD)
281#
282# CONFIG_MTD is not set 296# CONFIG_MTD is not set
283 297
284# 298#
@@ -289,6 +303,7 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
289# 303#
290# Plug and Play support 304# Plug and Play support
291# 305#
306# CONFIG_PNPACPI is not set
292 307
293# 308#
294# Block devices 309# Block devices
@@ -306,11 +321,18 @@ CONFIG_BLK_DEV_RAM=y
306CONFIG_BLK_DEV_RAM_COUNT=16 321CONFIG_BLK_DEV_RAM_COUNT=16
307CONFIG_BLK_DEV_RAM_SIZE=4096 322CONFIG_BLK_DEV_RAM_SIZE=4096
308CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 323CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
309# CONFIG_BLK_DEV_INITRD is not set
310# CONFIG_CDROM_PKTCDVD is not set 324# CONFIG_CDROM_PKTCDVD is not set
311# CONFIG_ATA_OVER_ETH is not set 325# CONFIG_ATA_OVER_ETH is not set
312 326
313# 327#
328# Misc devices
329#
330# CONFIG_PHANTOM is not set
331# CONFIG_SGI_IOC4 is not set
332# CONFIG_TIFM_CORE is not set
333# CONFIG_BLINK is not set
334
335#
314# ATA/ATAPI/MFM/RLL support 336# ATA/ATAPI/MFM/RLL support
315# 337#
316# CONFIG_IDE is not set 338# CONFIG_IDE is not set
@@ -320,6 +342,7 @@ CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
320# 342#
321# CONFIG_RAID_ATTRS is not set 343# CONFIG_RAID_ATTRS is not set
322CONFIG_SCSI=y 344CONFIG_SCSI=y
345# CONFIG_SCSI_TGT is not set
323# CONFIG_SCSI_NETLINK is not set 346# CONFIG_SCSI_NETLINK is not set
324CONFIG_SCSI_PROC_FS=y 347CONFIG_SCSI_PROC_FS=y
325 348
@@ -339,6 +362,7 @@ CONFIG_BLK_DEV_SD=y
339CONFIG_SCSI_MULTI_LUN=y 362CONFIG_SCSI_MULTI_LUN=y
340# CONFIG_SCSI_CONSTANTS is not set 363# CONFIG_SCSI_CONSTANTS is not set
341# CONFIG_SCSI_LOGGING is not set 364# CONFIG_SCSI_LOGGING is not set
365# CONFIG_SCSI_SCAN_ASYNC is not set
342 366
343# 367#
344# SCSI Transports 368# SCSI Transports
@@ -378,18 +402,16 @@ CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0
378CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16 402CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
379CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64 403CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
380CONFIG_SCSI_SYM53C8XX_MMIO=y 404CONFIG_SCSI_SYM53C8XX_MMIO=y
381# CONFIG_SCSI_IPR is not set
382# CONFIG_SCSI_QLOGIC_1280 is not set 405# CONFIG_SCSI_QLOGIC_1280 is not set
383# CONFIG_SCSI_QLA_FC is not set 406# CONFIG_SCSI_QLA_FC is not set
407# CONFIG_SCSI_QLA_ISCSI is not set
384# CONFIG_SCSI_LPFC is not set 408# CONFIG_SCSI_LPFC is not set
385# CONFIG_SCSI_DC395x is not set 409# CONFIG_SCSI_DC395x is not set
386# CONFIG_SCSI_DC390T is not set 410# CONFIG_SCSI_DC390T is not set
387# CONFIG_SCSI_NSP32 is not set 411# CONFIG_SCSI_NSP32 is not set
388# CONFIG_SCSI_DEBUG is not set 412# CONFIG_SCSI_DEBUG is not set
389 413# CONFIG_SCSI_ESP_CORE is not set
390# 414# CONFIG_SCSI_SRP is not set
391# Serial ATA (prod) and Parallel ATA (experimental) drivers
392#
393# CONFIG_ATA is not set 415# CONFIG_ATA is not set
394 416
395# 417#
@@ -408,6 +430,7 @@ CONFIG_SCSI_SYM53C8XX_MMIO=y
408# 430#
409# IEEE 1394 (FireWire) support 431# IEEE 1394 (FireWire) support
410# 432#
433# CONFIG_FIREWIRE is not set
411# CONFIG_IEEE1394 is not set 434# CONFIG_IEEE1394 is not set
412 435
413# 436#
@@ -428,10 +451,6 @@ CONFIG_NETDEVICES=y
428# ARCnet devices 451# ARCnet devices
429# 452#
430# CONFIG_ARCNET is not set 453# CONFIG_ARCNET is not set
431
432#
433# PHY device support
434#
435# CONFIG_PHYLIB is not set 454# CONFIG_PHYLIB is not set
436 455
437# 456#
@@ -479,10 +498,8 @@ CONFIG_NET_PCI=y
479# CONFIG_SUNDANCE is not set 498# CONFIG_SUNDANCE is not set
480# CONFIG_TLAN is not set 499# CONFIG_TLAN is not set
481# CONFIG_VIA_RHINE is not set 500# CONFIG_VIA_RHINE is not set
482 501# CONFIG_SC92031 is not set
483# 502CONFIG_NETDEV_1000=y
484# Ethernet (1000 Mbit)
485#
486# CONFIG_ACENIC is not set 503# CONFIG_ACENIC is not set
487# CONFIG_DL2K is not set 504# CONFIG_DL2K is not set
488# CONFIG_E1000 is not set 505# CONFIG_E1000 is not set
@@ -498,14 +515,16 @@ CONFIG_NET_PCI=y
498# CONFIG_TIGON3 is not set 515# CONFIG_TIGON3 is not set
499# CONFIG_BNX2 is not set 516# CONFIG_BNX2 is not set
500# CONFIG_QLA3XXX is not set 517# CONFIG_QLA3XXX is not set
501 518# CONFIG_ATL1 is not set
502# 519CONFIG_NETDEV_10000=y
503# Ethernet (10000 Mbit)
504#
505# CONFIG_CHELSIO_T1 is not set 520# CONFIG_CHELSIO_T1 is not set
521# CONFIG_CHELSIO_T3 is not set
506# CONFIG_IXGB is not set 522# CONFIG_IXGB is not set
507# CONFIG_S2IO is not set 523# CONFIG_S2IO is not set
508# CONFIG_MYRI10GE is not set 524# CONFIG_MYRI10GE is not set
525# CONFIG_NETXEN_NIC is not set
526# CONFIG_MLX4_CORE is not set
527CONFIG_MLX4_DEBUG=y
509 528
510# 529#
511# Token Ring devices 530# Token Ring devices
@@ -513,13 +532,10 @@ CONFIG_NET_PCI=y
513# CONFIG_TR is not set 532# CONFIG_TR is not set
514 533
515# 534#
516# Wireless LAN (non-hamradio) 535# Wireless LAN
517#
518# CONFIG_NET_RADIO is not set
519
520#
521# Wan interfaces
522# 536#
537# CONFIG_WLAN_PRE80211 is not set
538# CONFIG_WLAN_80211 is not set
523# CONFIG_WAN is not set 539# CONFIG_WAN is not set
524# CONFIG_FDDI is not set 540# CONFIG_FDDI is not set
525# CONFIG_HIPPI is not set 541# CONFIG_HIPPI is not set
@@ -571,9 +587,17 @@ CONFIG_KEYBOARD_ATKBD=y
571# CONFIG_KEYBOARD_STOWAWAY is not set 587# CONFIG_KEYBOARD_STOWAWAY is not set
572CONFIG_INPUT_MOUSE=y 588CONFIG_INPUT_MOUSE=y
573CONFIG_MOUSE_PS2=y 589CONFIG_MOUSE_PS2=y
590CONFIG_MOUSE_PS2_ALPS=y
591CONFIG_MOUSE_PS2_LOGIPS2PP=y
592CONFIG_MOUSE_PS2_SYNAPTICS=y
593CONFIG_MOUSE_PS2_LIFEBOOK=y
594CONFIG_MOUSE_PS2_TRACKPOINT=y
595# CONFIG_MOUSE_PS2_TOUCHKIT is not set
574# CONFIG_MOUSE_SERIAL is not set 596# CONFIG_MOUSE_SERIAL is not set
597# CONFIG_MOUSE_APPLETOUCH is not set
575# CONFIG_MOUSE_VSXXXAA is not set 598# CONFIG_MOUSE_VSXXXAA is not set
576# CONFIG_INPUT_JOYSTICK is not set 599# CONFIG_INPUT_JOYSTICK is not set
600# CONFIG_INPUT_TABLET is not set
577# CONFIG_INPUT_TOUCHSCREEN is not set 601# CONFIG_INPUT_TOUCHSCREEN is not set
578# CONFIG_INPUT_MISC is not set 602# CONFIG_INPUT_MISC is not set
579 603
@@ -619,10 +643,6 @@ CONFIG_LEGACY_PTY_COUNT=256
619# IPMI 643# IPMI
620# 644#
621# CONFIG_IPMI_HANDLER is not set 645# CONFIG_IPMI_HANDLER is not set
622
623#
624# Watchdog Cards
625#
626CONFIG_WATCHDOG=y 646CONFIG_WATCHDOG=y
627# CONFIG_WATCHDOG_NOWAYOUT is not set 647# CONFIG_WATCHDOG_NOWAYOUT is not set
628 648
@@ -639,13 +659,8 @@ CONFIG_WATCHDOG=y
639# CONFIG_WDTPCI is not set 659# CONFIG_WDTPCI is not set
640CONFIG_HW_RANDOM=y 660CONFIG_HW_RANDOM=y
641# CONFIG_GEN_RTC is not set 661# CONFIG_GEN_RTC is not set
642# CONFIG_DTLK is not set
643# CONFIG_R3964 is not set 662# CONFIG_R3964 is not set
644# CONFIG_APPLICOM is not set 663# CONFIG_APPLICOM is not set
645
646#
647# Ftape, the floppy tape device driver
648#
649# CONFIG_DRM is not set 664# CONFIG_DRM is not set
650# CONFIG_RAW_DRIVER is not set 665# CONFIG_RAW_DRIVER is not set
651 666
@@ -653,11 +668,7 @@ CONFIG_HW_RANDOM=y
653# TPM devices 668# TPM devices
654# 669#
655# CONFIG_TCG_TPM is not set 670# CONFIG_TCG_TPM is not set
656# CONFIG_TELCLOCK is not set 671CONFIG_DEVPORT=y
657
658#
659# I2C support
660#
661# CONFIG_I2C is not set 672# CONFIG_I2C is not set
662 673
663# 674#
@@ -669,44 +680,60 @@ CONFIG_HW_RANDOM=y
669# 680#
670# Dallas's 1-wire bus 681# Dallas's 1-wire bus
671# 682#
672 683# CONFIG_W1 is not set
673#
674# Hardware Monitoring support
675#
676CONFIG_HWMON=y 684CONFIG_HWMON=y
677# CONFIG_HWMON_VID is not set 685# CONFIG_HWMON_VID is not set
678# CONFIG_SENSORS_ABITUGURU is not set 686# CONFIG_SENSORS_ABITUGURU is not set
679# CONFIG_SENSORS_F71805F is not set 687# CONFIG_SENSORS_F71805F is not set
688# CONFIG_SENSORS_PC87427 is not set
689# CONFIG_SENSORS_SMSC47M1 is not set
690# CONFIG_SENSORS_SMSC47B397 is not set
680# CONFIG_SENSORS_VT1211 is not set 691# CONFIG_SENSORS_VT1211 is not set
692# CONFIG_SENSORS_W83627HF is not set
681# CONFIG_HWMON_DEBUG_CHIP is not set 693# CONFIG_HWMON_DEBUG_CHIP is not set
682 694
683# 695#
684# Misc devices 696# Multifunction device drivers
685# 697#
698# CONFIG_MFD_SM501 is not set
686 699
687# 700#
688# Multimedia devices 701# Multimedia devices
689# 702#
690# CONFIG_VIDEO_DEV is not set 703# CONFIG_VIDEO_DEV is not set
691CONFIG_VIDEO_V4L2=y 704# CONFIG_DVB_CORE is not set
705CONFIG_DAB=y
692 706
693# 707#
694# Digital Video Broadcasting Devices 708# Graphics support
695# 709#
696# CONFIG_DVB is not set 710# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
697 711
698# 712#
699# Graphics support 713# Display device support
700# 714#
701CONFIG_FIRMWARE_EDID=y 715# CONFIG_DISPLAY_SUPPORT is not set
716# CONFIG_VGASTATE is not set
702CONFIG_FB=y 717CONFIG_FB=y
718CONFIG_FIRMWARE_EDID=y
719# CONFIG_FB_DDC is not set
703CONFIG_FB_CFB_FILLRECT=y 720CONFIG_FB_CFB_FILLRECT=y
704CONFIG_FB_CFB_COPYAREA=y 721CONFIG_FB_CFB_COPYAREA=y
705CONFIG_FB_CFB_IMAGEBLIT=y 722CONFIG_FB_CFB_IMAGEBLIT=y
723# CONFIG_FB_SYS_FILLRECT is not set
724# CONFIG_FB_SYS_COPYAREA is not set
725# CONFIG_FB_SYS_IMAGEBLIT is not set
726# CONFIG_FB_SYS_FOPS is not set
727CONFIG_FB_DEFERRED_IO=y
728# CONFIG_FB_SVGALIB is not set
706# CONFIG_FB_MACMODES is not set 729# CONFIG_FB_MACMODES is not set
707# CONFIG_FB_BACKLIGHT is not set 730# CONFIG_FB_BACKLIGHT is not set
708CONFIG_FB_MODE_HELPERS=y 731CONFIG_FB_MODE_HELPERS=y
709# CONFIG_FB_TILEBLITTING is not set 732# CONFIG_FB_TILEBLITTING is not set
733
734#
735# Frame buffer hardware drivers
736#
710# CONFIG_FB_CIRRUS is not set 737# CONFIG_FB_CIRRUS is not set
711# CONFIG_FB_PM2 is not set 738# CONFIG_FB_PM2 is not set
712# CONFIG_FB_CYBER2000 is not set 739# CONFIG_FB_CYBER2000 is not set
@@ -720,13 +747,17 @@ CONFIG_FB_MODE_HELPERS=y
720# CONFIG_FB_RADEON is not set 747# CONFIG_FB_RADEON is not set
721# CONFIG_FB_ATY128 is not set 748# CONFIG_FB_ATY128 is not set
722# CONFIG_FB_ATY is not set 749# CONFIG_FB_ATY is not set
750# CONFIG_FB_S3 is not set
723# CONFIG_FB_SAVAGE is not set 751# CONFIG_FB_SAVAGE is not set
724# CONFIG_FB_SIS is not set 752# CONFIG_FB_SIS is not set
725# CONFIG_FB_NEOMAGIC is not set 753# CONFIG_FB_NEOMAGIC is not set
726CONFIG_FB_KYRO=y 754CONFIG_FB_KYRO=y
727# CONFIG_FB_3DFX is not set 755# CONFIG_FB_3DFX is not set
728# CONFIG_FB_VOODOO1 is not set 756# CONFIG_FB_VOODOO1 is not set
757# CONFIG_FB_VT8623 is not set
729# CONFIG_FB_TRIDENT is not set 758# CONFIG_FB_TRIDENT is not set
759# CONFIG_FB_ARK is not set
760# CONFIG_FB_PM3 is not set
730# CONFIG_FB_VIRTUAL is not set 761# CONFIG_FB_VIRTUAL is not set
731 762
732# 763#
@@ -746,10 +777,6 @@ CONFIG_FONT_8x16=y
746# CONFIG_FONT_SUN8x16 is not set 777# CONFIG_FONT_SUN8x16 is not set
747# CONFIG_FONT_SUN12x22 is not set 778# CONFIG_FONT_SUN12x22 is not set
748# CONFIG_FONT_10x18 is not set 779# CONFIG_FONT_10x18 is not set
749
750#
751# Logo configuration
752#
753CONFIG_LOGO=y 780CONFIG_LOGO=y
754# CONFIG_LOGO_LINUX_MONO is not set 781# CONFIG_LOGO_LINUX_MONO is not set
755# CONFIG_LOGO_LINUX_VGA16 is not set 782# CONFIG_LOGO_LINUX_VGA16 is not set
@@ -757,7 +784,6 @@ CONFIG_LOGO=y
757# CONFIG_LOGO_SUPERH_MONO is not set 784# CONFIG_LOGO_SUPERH_MONO is not set
758# CONFIG_LOGO_SUPERH_VGA16 is not set 785# CONFIG_LOGO_SUPERH_VGA16 is not set
759CONFIG_LOGO_SUPERH_CLUT224=y 786CONFIG_LOGO_SUPERH_CLUT224=y
760# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
761 787
762# 788#
763# Sound 789# Sound
@@ -765,6 +791,12 @@ CONFIG_LOGO_SUPERH_CLUT224=y
765# CONFIG_SOUND is not set 791# CONFIG_SOUND is not set
766 792
767# 793#
794# HID Devices
795#
796CONFIG_HID=y
797# CONFIG_HID_DEBUG is not set
798
799#
768# USB support 800# USB support
769# 801#
770CONFIG_USB_ARCH_HAS_HCD=y 802CONFIG_USB_ARCH_HAS_HCD=y
@@ -780,10 +812,6 @@ CONFIG_USB_ARCH_HAS_EHCI=y
780# USB Gadget Support 812# USB Gadget Support
781# 813#
782# CONFIG_USB_GADGET is not set 814# CONFIG_USB_GADGET is not set
783
784#
785# MMC/SD Card support
786#
787# CONFIG_MMC is not set 815# CONFIG_MMC is not set
788 816
789# 817#
@@ -836,6 +864,7 @@ CONFIG_EXT3_FS=y
836CONFIG_EXT3_FS_XATTR=y 864CONFIG_EXT3_FS_XATTR=y
837# CONFIG_EXT3_FS_POSIX_ACL is not set 865# CONFIG_EXT3_FS_POSIX_ACL is not set
838# CONFIG_EXT3_FS_SECURITY is not set 866# CONFIG_EXT3_FS_SECURITY is not set
867# CONFIG_EXT4DEV_FS is not set
839CONFIG_JBD=y 868CONFIG_JBD=y
840# CONFIG_JBD_DEBUG is not set 869# CONFIG_JBD_DEBUG is not set
841CONFIG_FS_MBCACHE=y 870CONFIG_FS_MBCACHE=y
@@ -843,6 +872,7 @@ CONFIG_FS_MBCACHE=y
843# CONFIG_JFS_FS is not set 872# CONFIG_JFS_FS is not set
844# CONFIG_FS_POSIX_ACL is not set 873# CONFIG_FS_POSIX_ACL is not set
845# CONFIG_XFS_FS is not set 874# CONFIG_XFS_FS is not set
875# CONFIG_GFS2_FS is not set
846# CONFIG_OCFS2_FS is not set 876# CONFIG_OCFS2_FS is not set
847CONFIG_MINIX_FS=y 877CONFIG_MINIX_FS=y
848CONFIG_ROMFS_FS=y 878CONFIG_ROMFS_FS=y
@@ -912,6 +942,7 @@ CONFIG_LOCKD=y
912CONFIG_LOCKD_V4=y 942CONFIG_LOCKD_V4=y
913CONFIG_NFS_COMMON=y 943CONFIG_NFS_COMMON=y
914CONFIG_SUNRPC=y 944CONFIG_SUNRPC=y
945# CONFIG_SUNRPC_BIND34 is not set
915# CONFIG_RPCSEC_GSS_KRB5 is not set 946# CONFIG_RPCSEC_GSS_KRB5 is not set
916# CONFIG_RPCSEC_GSS_SPKM3 is not set 947# CONFIG_RPCSEC_GSS_SPKM3 is not set
917# CONFIG_SMB_FS is not set 948# CONFIG_SMB_FS is not set
@@ -941,6 +972,7 @@ CONFIG_MSDOS_PARTITION=y
941# CONFIG_SUN_PARTITION is not set 972# CONFIG_SUN_PARTITION is not set
942# CONFIG_KARMA_PARTITION is not set 973# CONFIG_KARMA_PARTITION is not set
943# CONFIG_EFI_PARTITION is not set 974# CONFIG_EFI_PARTITION is not set
975# CONFIG_SYSV68_PARTITION is not set
944 976
945# 977#
946# Native Language Support 978# Native Language Support
@@ -948,6 +980,11 @@ CONFIG_MSDOS_PARTITION=y
948# CONFIG_NLS is not set 980# CONFIG_NLS is not set
949 981
950# 982#
983# Distributed Lock Manager
984#
985# CONFIG_DLM is not set
986
987#
951# Profiling support 988# Profiling support
952# 989#
953# CONFIG_PROFILING is not set 990# CONFIG_PROFILING is not set
@@ -959,28 +996,29 @@ CONFIG_MSDOS_PARTITION=y
959CONFIG_ENABLE_MUST_CHECK=y 996CONFIG_ENABLE_MUST_CHECK=y
960CONFIG_MAGIC_SYSRQ=y 997CONFIG_MAGIC_SYSRQ=y
961# CONFIG_UNUSED_SYMBOLS is not set 998# CONFIG_UNUSED_SYMBOLS is not set
999CONFIG_DEBUG_FS=y
1000# CONFIG_HEADERS_CHECK is not set
962CONFIG_DEBUG_KERNEL=y 1001CONFIG_DEBUG_KERNEL=y
963CONFIG_LOG_BUF_SHIFT=14 1002# CONFIG_DEBUG_SHIRQ is not set
964CONFIG_DETECT_SOFTLOCKUP=y 1003CONFIG_DETECT_SOFTLOCKUP=y
965CONFIG_SCHEDSTATS=y 1004CONFIG_SCHEDSTATS=y
1005# CONFIG_TIMER_STATS is not set
966# CONFIG_DEBUG_SLAB is not set 1006# CONFIG_DEBUG_SLAB is not set
967# CONFIG_DEBUG_RT_MUTEXES is not set 1007# CONFIG_DEBUG_RT_MUTEXES is not set
968# CONFIG_RT_MUTEX_TESTER is not set 1008# CONFIG_RT_MUTEX_TESTER is not set
969# CONFIG_DEBUG_SPINLOCK is not set 1009# CONFIG_DEBUG_SPINLOCK is not set
970# CONFIG_DEBUG_MUTEXES is not set 1010# CONFIG_DEBUG_MUTEXES is not set
971# CONFIG_DEBUG_RWSEMS is not set
972# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1011# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
973# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set 1012# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
974# CONFIG_DEBUG_KOBJECT is not set 1013# CONFIG_DEBUG_KOBJECT is not set
975CONFIG_DEBUG_BUGVERBOSE=y 1014CONFIG_DEBUG_BUGVERBOSE=y
976# CONFIG_DEBUG_INFO is not set 1015# CONFIG_DEBUG_INFO is not set
977CONFIG_DEBUG_FS=y
978# CONFIG_DEBUG_VM is not set 1016# CONFIG_DEBUG_VM is not set
979# CONFIG_DEBUG_LIST is not set 1017# CONFIG_DEBUG_LIST is not set
980CONFIG_FRAME_POINTER=y 1018CONFIG_FRAME_POINTER=y
981# CONFIG_UNWIND_INFO is not set
982CONFIG_FORCED_INLINING=y 1019CONFIG_FORCED_INLINING=y
983# CONFIG_RCU_TORTURE_TEST is not set 1020# CONFIG_RCU_TORTURE_TEST is not set
1021# CONFIG_FAULT_INJECTION is not set
984# CONFIG_EARLY_PRINTK is not set 1022# CONFIG_EARLY_PRINTK is not set
985# CONFIG_DEBUG_KERNEL_WITH_GDB_STUB is not set 1023# CONFIG_DEBUG_KERNEL_WITH_GDB_STUB is not set
986CONFIG_SH64_PROC_TLB=y 1024CONFIG_SH64_PROC_TLB=y
@@ -1004,10 +1042,15 @@ CONFIG_SH64_SR_WATCH=y
1004# 1042#
1005# Library routines 1043# Library routines
1006# 1044#
1045CONFIG_BITREVERSE=y
1007# CONFIG_CRC_CCITT is not set 1046# CONFIG_CRC_CCITT is not set
1008# CONFIG_CRC16 is not set 1047# CONFIG_CRC16 is not set
1048# CONFIG_CRC_ITU_T is not set
1009CONFIG_CRC32=y 1049CONFIG_CRC32=y
1010# CONFIG_LIBCRC32C is not set 1050# CONFIG_LIBCRC32C is not set
1011CONFIG_PLIST=y 1051CONFIG_PLIST=y
1052CONFIG_HAS_IOMEM=y
1053CONFIG_HAS_IOPORT=y
1054CONFIG_HAS_DMA=y
1012CONFIG_GENERIC_HARDIRQS=y 1055CONFIG_GENERIC_HARDIRQS=y
1013CONFIG_GENERIC_IRQ_PROBE=y 1056CONFIG_GENERIC_IRQ_PROBE=y
diff --git a/arch/sh64/kernel/entry.S b/arch/sh64/kernel/entry.S
index 40d45346248d..7013fcb6665c 100644
--- a/arch/sh64/kernel/entry.S
+++ b/arch/sh64/kernel/entry.S
@@ -947,14 +947,14 @@ ret_with_reschedule:
947 ! FIXME:!!! 947 ! FIXME:!!!
948 ! no handling of TIF_SYSCALL_TRACE yet!! 948 ! no handling of TIF_SYSCALL_TRACE yet!!
949 949
950 movi (1 << TIF_NEED_RESCHED), r8 950 movi _TIF_NEED_RESCHED, r8
951 and r8, r7, r8 951 and r8, r7, r8
952 pta work_resched, tr0 952 pta work_resched, tr0
953 bne r8, ZERO, tr0 953 bne r8, ZERO, tr0
954 954
955 pta restore_all, tr1 955 pta restore_all, tr1
956 956
957 movi (1 << TIF_SIGPENDING), r8 957 movi (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK), r8
958 and r8, r7, r8 958 and r8, r7, r8
959 pta work_notifysig, tr0 959 pta work_notifysig, tr0
960 bne r8, ZERO, tr0 960 bne r8, ZERO, tr0
diff --git a/arch/sh64/kernel/irq.c b/arch/sh64/kernel/irq.c
index f68b4f6c9b31..9412b7166700 100644
--- a/arch/sh64/kernel/irq.c
+++ b/arch/sh64/kernel/irq.c
@@ -94,6 +94,7 @@ asmlinkage void do_NMI(unsigned long vector_num, struct pt_regs * regs)
94 */ 94 */
95asmlinkage int do_IRQ(unsigned long vector_num, struct pt_regs * regs) 95asmlinkage int do_IRQ(unsigned long vector_num, struct pt_regs * regs)
96{ 96{
97 struct pt_regs *old_regs = set_irq_regs(regs);
97 int irq; 98 int irq;
98 99
99 irq_enter(); 100 irq_enter();
@@ -101,13 +102,14 @@ asmlinkage int do_IRQ(unsigned long vector_num, struct pt_regs * regs)
101 irq = irq_demux(vector_num); 102 irq = irq_demux(vector_num);
102 103
103 if (irq >= 0) { 104 if (irq >= 0) {
104 __do_IRQ(irq, regs); 105 __do_IRQ(irq);
105 } else { 106 } else {
106 printk("unexpected IRQ trap at vector %03lx\n", vector_num); 107 printk("unexpected IRQ trap at vector %03lx\n", vector_num);
107 } 108 }
108 109
109 irq_exit(); 110 irq_exit();
110 111
112 set_irq_regs(old_regs);
111 return 1; 113 return 1;
112} 114}
113 115
diff --git a/arch/sh64/kernel/pci_sh5.c b/arch/sh64/kernel/pci_sh5.c
index 49862e165c06..fb51660847c8 100644
--- a/arch/sh64/kernel/pci_sh5.c
+++ b/arch/sh64/kernel/pci_sh5.c
@@ -340,8 +340,9 @@ static int __init map_cayman_irq(struct pci_dev *dev, u8 slot, u8 pin)
340 return result; 340 return result;
341} 341}
342 342
343irqreturn_t pcish5_err_irq(int irq, void *dev_id, struct pt_regs *regs) 343static irqreturn_t pcish5_err_irq(int irq, void *dev_id)
344{ 344{
345 struct pt_regs *regs = get_irq_regs();
345 unsigned pci_int, pci_air, pci_cir, pci_aint; 346 unsigned pci_int, pci_air, pci_cir, pci_aint;
346 347
347 pci_int = SH5PCI_READ(INT); 348 pci_int = SH5PCI_READ(INT);
@@ -368,15 +369,13 @@ irqreturn_t pcish5_err_irq(int irq, void *dev_id, struct pt_regs *regs)
368 return IRQ_HANDLED; 369 return IRQ_HANDLED;
369} 370}
370 371
371irqreturn_t pcish5_serr_irq(int irq, void *dev_id, struct pt_regs *regs) 372static irqreturn_t pcish5_serr_irq(int irq, void *dev_id)
372{ 373{
373 printk("SERR IRQ\n"); 374 printk("SERR IRQ\n");
374 375
375 return IRQ_NONE; 376 return IRQ_NONE;
376} 377}
377 378
378#define ROUND_UP(x, a) (((x) + (a) - 1) & ~((a) - 1))
379
380static void __init 379static void __init
381pcibios_size_bridge(struct pci_bus *bus, struct resource *ior, 380pcibios_size_bridge(struct pci_bus *bus, struct resource *ior,
382 struct resource *memr) 381 struct resource *memr)
@@ -433,8 +432,8 @@ pcibios_size_bridge(struct pci_bus *bus, struct resource *ior,
433 mem_res.end -= mem_res.start; 432 mem_res.end -= mem_res.start;
434 433
435 /* Align the sizes up by bridge rules */ 434 /* Align the sizes up by bridge rules */
436 io_res.end = ROUND_UP(io_res.end, 4*1024) - 1; 435 io_res.end = ALIGN(io_res.end, 4*1024) - 1;
437 mem_res.end = ROUND_UP(mem_res.end, 1*1024*1024) - 1; 436 mem_res.end = ALIGN(mem_res.end, 1*1024*1024) - 1;
438 437
439 /* Adjust the bridge's allocation requirements */ 438 /* Adjust the bridge's allocation requirements */
440 bridge->resource[0].end = bridge->resource[0].start + io_res.end; 439 bridge->resource[0].end = bridge->resource[0].start + io_res.end;
@@ -447,18 +446,16 @@ pcibios_size_bridge(struct pci_bus *bus, struct resource *ior,
447 446
448 /* adjust parent's resource requirements */ 447 /* adjust parent's resource requirements */
449 if (ior) { 448 if (ior) {
450 ior->end = ROUND_UP(ior->end, 4*1024); 449 ior->end = ALIGN(ior->end, 4*1024);
451 ior->end += io_res.end; 450 ior->end += io_res.end;
452 } 451 }
453 452
454 if (memr) { 453 if (memr) {
455 memr->end = ROUND_UP(memr->end, 1*1024*1024); 454 memr->end = ALIGN(memr->end, 1*1024*1024);
456 memr->end += mem_res.end; 455 memr->end += mem_res.end;
457 } 456 }
458} 457}
459 458
460#undef ROUND_UP
461
462static void __init pcibios_size_bridges(void) 459static void __init pcibios_size_bridges(void)
463{ 460{
464 struct resource io_res, mem_res; 461 struct resource io_res, mem_res;
diff --git a/arch/sh64/kernel/pci_sh5.h b/arch/sh64/kernel/pci_sh5.h
index 8f21f5d2aa3e..c71159dd04b9 100644
--- a/arch/sh64/kernel/pci_sh5.h
+++ b/arch/sh64/kernel/pci_sh5.h
@@ -4,7 +4,7 @@
4 * May be copied or modified under the terms of the GNU General Public 4 * May be copied or modified under the terms of the GNU General Public
5 * License. See linux/COPYING for more information. 5 * License. See linux/COPYING for more information.
6 * 6 *
7 * Defintions for the SH5 PCI hardware. 7 * Definitions for the SH5 PCI hardware.
8 */ 8 */
9 9
10/* Product ID */ 10/* Product ID */
diff --git a/arch/sh64/kernel/process.c b/arch/sh64/kernel/process.c
index 525d0ec19b78..1b89c9dfb93d 100644
--- a/arch/sh64/kernel/process.c
+++ b/arch/sh64/kernel/process.c
@@ -387,7 +387,7 @@ ATTRIB_NORET void kernel_thread_helper(void *arg, int (*fn)(void *))
387 * NOTE! Only a kernel-only process(ie the swapper or direct descendants 387 * NOTE! Only a kernel-only process(ie the swapper or direct descendants
388 * who haven't done an "execve()") should use this: it will work within 388 * who haven't done an "execve()") should use this: it will work within
389 * a system call from a "real" process, but the process memory space will 389 * a system call from a "real" process, but the process memory space will
390 * not be free'd until both the parent and the child have exited. 390 * not be freed until both the parent and the child have exited.
391 */ 391 */
392int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) 392int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
393{ 393{
diff --git a/arch/sh64/kernel/signal.c b/arch/sh64/kernel/signal.c
index b76bdfa473d6..c8525ade0564 100644
--- a/arch/sh64/kernel/signal.c
+++ b/arch/sh64/kernel/signal.c
@@ -698,7 +698,9 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset)
698 if (try_to_freeze()) 698 if (try_to_freeze())
699 goto no_signal; 699 goto no_signal;
700 700
701 if (!oldset) 701 if (test_thread_flag(TIF_RESTORE_SIGMASK))
702 oldset = &current->saved_sigmask;
703 else if (!oldset)
702 oldset = &current->blocked; 704 oldset = &current->blocked;
703 705
704 signr = get_signal_to_deliver(&info, &ka, regs, 0); 706 signr = get_signal_to_deliver(&info, &ka, regs, 0);
@@ -706,6 +708,15 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset)
706 if (signr > 0) { 708 if (signr > 0) {
707 /* Whee! Actually deliver the signal. */ 709 /* Whee! Actually deliver the signal. */
708 handle_signal(signr, &info, &ka, oldset, regs); 710 handle_signal(signr, &info, &ka, oldset, regs);
711
712 /*
713 * If a signal was successfully delivered, the saved sigmask
714 * is in its frame, and we can clear the TIF_RESTORE_SIGMASK
715 * flag.
716 */
717 if (test_thread_flag(TIF_RESTORE_SIGMASK))
718 clear_thread_flag(TIF_RESTORE_SIGMASK);
719
709 return 1; 720 return 1;
710 } 721 }
711 722
@@ -713,13 +724,27 @@ no_signal:
713 /* Did we come from a system call? */ 724 /* Did we come from a system call? */
714 if (regs->syscall_nr >= 0) { 725 if (regs->syscall_nr >= 0) {
715 /* Restart the system call - no handlers present */ 726 /* Restart the system call - no handlers present */
716 if (regs->regs[REG_RET] == -ERESTARTNOHAND || 727 switch (regs->regs[REG_RET]) {
717 regs->regs[REG_RET] == -ERESTARTSYS || 728 case -ERESTARTNOHAND:
718 regs->regs[REG_RET] == -ERESTARTNOINTR) { 729 case -ERESTARTSYS:
730 case -ERESTARTNOINTR:
719 /* Decode Syscall # */ 731 /* Decode Syscall # */
720 regs->regs[REG_RET] = regs->syscall_nr; 732 regs->regs[REG_RET] = regs->syscall_nr;
721 regs->pc -= 4; 733 regs->pc -= 4;
734 break;
735
736 case -ERESTART_RESTARTBLOCK:
737 regs->regs[REG_RET] = __NR_restart_syscall;
738 regs->pc -= 4;
739 break;
722 } 740 }
723 } 741 }
742
743 /* No signal to deliver -- put the saved sigmask back */
744 if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
745 clear_thread_flag(TIF_RESTORE_SIGMASK);
746 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
747 }
748
724 return 0; 749 return 0;
725} 750}
diff --git a/arch/sh64/kernel/syscalls.S b/arch/sh64/kernel/syscalls.S
index c0079d54c850..a5c680d29384 100644
--- a/arch/sh64/kernel/syscalls.S
+++ b/arch/sh64/kernel/syscalls.S
@@ -2,7 +2,7 @@
2 * arch/sh64/kernel/syscalls.S 2 * arch/sh64/kernel/syscalls.S
3 * 3 *
4 * Copyright (C) 2000, 2001 Paolo Alberelli 4 * Copyright (C) 2000, 2001 Paolo Alberelli
5 * Copyright (C) 2004 Paul Mundt 5 * Copyright (C) 2004 - 2007 Paul Mundt
6 * Copyright (C) 2003, 2004 Richard Curnow 6 * Copyright (C) 2003, 2004 Richard Curnow
7 * 7 *
8 * This file is subject to the terms and conditions of the GNU General Public 8 * This file is subject to the terms and conditions of the GNU General Public
@@ -20,7 +20,7 @@
20 */ 20 */
21 .globl sys_call_table 21 .globl sys_call_table
22sys_call_table: 22sys_call_table:
23 .long sys_ni_syscall /* 0 - old "setup()" system call */ 23 .long sys_restart_syscall /* 0 - old "setup()" system call */
24 .long sys_exit 24 .long sys_exit
25 .long sys_fork 25 .long sys_fork
26 .long sys_read 26 .long sys_read
@@ -347,4 +347,34 @@ sys_call_table:
347 .long sys_inotify_init 347 .long sys_inotify_init
348 .long sys_inotify_add_watch 348 .long sys_inotify_add_watch
349 .long sys_inotify_rm_watch /* 320 */ 349 .long sys_inotify_rm_watch /* 320 */
350 350 .long sys_ni_syscall
351 .long sys_migrate_pages
352 .long sys_openat
353 .long sys_mkdirat
354 .long sys_mknodat /* 325 */
355 .long sys_fchownat
356 .long sys_futimesat
357 .long sys_fstatat64
358 .long sys_unlinkat
359 .long sys_renameat /* 330 */
360 .long sys_linkat
361 .long sys_symlinkat
362 .long sys_readlinkat
363 .long sys_fchmodat
364 .long sys_faccessat /* 335 */
365 .long sys_pselect6
366 .long sys_ppoll
367 .long sys_unshare
368 .long sys_set_robust_list
369 .long sys_get_robust_list /* 340 */
370 .long sys_splice
371 .long sys_sync_file_range
372 .long sys_tee
373 .long sys_vmsplice
374 .long sys_move_pages /* 345 */
375 .long sys_getcpu
376 .long sys_epoll_pwait
377 .long sys_utimensat
378 .long sys_signalfd
379 .long sys_timerfd /* 350 */
380 .long sys_eventfd
diff --git a/arch/sh64/kernel/time.c b/arch/sh64/kernel/time.c
index 390b40de7cef..b37f4f4981d2 100644
--- a/arch/sh64/kernel/time.c
+++ b/arch/sh64/kernel/time.c
@@ -123,7 +123,7 @@ static unsigned long long usecs_per_jiffy = 1000000/HZ; /* Approximation */
123static unsigned long long scaled_recip_ctc_ticks_per_jiffy; 123static unsigned long long scaled_recip_ctc_ticks_per_jiffy;
124 124
125/* Estimate number of microseconds that have elapsed since the last timer tick, 125/* Estimate number of microseconds that have elapsed since the last timer tick,
126 by scaling the delta that has occured in the CTC register. 126 by scaling the delta that has occurred in the CTC register.
127 127
128 WARNING WARNING WARNING : This algorithm relies on the CTC decrementing at 128 WARNING WARNING WARNING : This algorithm relies on the CTC decrementing at
129 the CPU clock rate. If the CPU sleeps, the CTC stops counting. Bear this 129 the CPU clock rate. If the CPU sleeps, the CTC stops counting. Bear this
@@ -282,7 +282,7 @@ static long last_rtc_update = 0;
282 * timer_interrupt() needs to keep up the real-time clock, 282 * timer_interrupt() needs to keep up the real-time clock,
283 * as well as call the "do_timer()" routine every clocktick 283 * as well as call the "do_timer()" routine every clocktick
284 */ 284 */
285static inline void do_timer_interrupt(int irq, struct pt_regs *regs) 285static inline void do_timer_interrupt(void)
286{ 286{
287 unsigned long long current_ctc; 287 unsigned long long current_ctc;
288 asm ("getcon cr62, %0" : "=r" (current_ctc)); 288 asm ("getcon cr62, %0" : "=r" (current_ctc));
@@ -290,9 +290,10 @@ static inline void do_timer_interrupt(int irq, struct pt_regs *regs)
290 290
291 do_timer(1); 291 do_timer(1);
292#ifndef CONFIG_SMP 292#ifndef CONFIG_SMP
293 update_process_times(user_mode(regs)); 293 update_process_times(user_mode(get_irq_regs()));
294#endif 294#endif
295 profile_tick(CPU_PROFILING, regs); 295 if (current->pid)
296 profile_tick(CPU_PROFILING);
296 297
297#ifdef CONFIG_HEARTBEAT 298#ifdef CONFIG_HEARTBEAT
298 { 299 {
@@ -323,7 +324,7 @@ static inline void do_timer_interrupt(int irq, struct pt_regs *regs)
323 * Time Stamp Counter value at the time of the timer interrupt, so that 324 * Time Stamp Counter value at the time of the timer interrupt, so that
324 * we later on can estimate the time of day more exactly. 325 * we later on can estimate the time of day more exactly.
325 */ 326 */
326static irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) 327static irqreturn_t timer_interrupt(int irq, void *dev_id)
327{ 328{
328 unsigned long timer_status; 329 unsigned long timer_status;
329 330
@@ -340,7 +341,7 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
340 * locally disabled. -arca 341 * locally disabled. -arca
341 */ 342 */
342 write_lock(&xtime_lock); 343 write_lock(&xtime_lock);
343 do_timer_interrupt(irq, regs); 344 do_timer_interrupt();
344 write_unlock(&xtime_lock); 345 write_unlock(&xtime_lock);
345 346
346 return IRQ_HANDLED; 347 return IRQ_HANDLED;
@@ -465,9 +466,10 @@ static __init unsigned int get_cpu_hz(void)
465#endif 466#endif
466} 467}
467 468
468static irqreturn_t sh64_rtc_interrupt(int irq, void *dev_id, 469static irqreturn_t sh64_rtc_interrupt(int irq, void *dev_id)
469 struct pt_regs *regs)
470{ 470{
471 struct pt_regs *regs = get_irq_regs();
472
471 ctrl_outb(0, RCR1); /* Disable Carry Interrupts */ 473 ctrl_outb(0, RCR1); /* Disable Carry Interrupts */
472 regs->regs[3] = 1; /* Using r3 */ 474 regs->regs[3] = 1; /* Using r3 */
473 475
diff --git a/arch/sh64/lib/.gitignore b/arch/sh64/lib/.gitignore
new file mode 100644
index 000000000000..3508c2cb23c4
--- /dev/null
+++ b/arch/sh64/lib/.gitignore
@@ -0,0 +1 @@
syscalltab.h
diff --git a/arch/sh64/mach-cayman/irq.c b/arch/sh64/mach-cayman/irq.c
index 228ce61c3515..aaad36d37d1f 100644
--- a/arch/sh64/mach-cayman/irq.c
+++ b/arch/sh64/mach-cayman/irq.c
@@ -29,13 +29,13 @@ unsigned long epld_virt;
29/* Note the SMSC SuperIO chip and SMSC LAN chip interrupts are all muxed onto 29/* Note the SMSC SuperIO chip and SMSC LAN chip interrupts are all muxed onto
30 the same SH-5 interrupt */ 30 the same SH-5 interrupt */
31 31
32static irqreturn_t cayman_interrupt_smsc(int irq, void *dev_id, struct pt_regs *regs) 32static irqreturn_t cayman_interrupt_smsc(int irq, void *dev_id)
33{ 33{
34 printk(KERN_INFO "CAYMAN: spurious SMSC interrupt\n"); 34 printk(KERN_INFO "CAYMAN: spurious SMSC interrupt\n");
35 return IRQ_NONE; 35 return IRQ_NONE;
36} 36}
37 37
38static irqreturn_t cayman_interrupt_pci2(int irq, void *dev_id, struct pt_regs *regs) 38static irqreturn_t cayman_interrupt_pci2(int irq, void *dev_id)
39{ 39{
40 printk(KERN_INFO "CAYMAN: spurious PCI interrupt, IRQ %d\n", irq); 40 printk(KERN_INFO "CAYMAN: spurious PCI interrupt, IRQ %d\n", irq);
41 return IRQ_NONE; 41 return IRQ_NONE;
diff --git a/arch/sh64/mach-cayman/setup.c b/arch/sh64/mach-cayman/setup.c
index 3ed87cd059d0..c3611cc2735f 100644
--- a/arch/sh64/mach-cayman/setup.c
+++ b/arch/sh64/mach-cayman/setup.c
@@ -213,7 +213,7 @@ static int __init smsc_superio_setup(void)
213 SMSC_SUPERIO_WRITE_INDEXED(0x00, 0xc7); /* GP47 = nIOWOP */ 213 SMSC_SUPERIO_WRITE_INDEXED(0x00, 0xc7); /* GP47 = nIOWOP */
214#endif 214#endif
215 215
216 /* Exit the configuraton state */ 216 /* Exit the configuration state */
217 outb(SMSC_EXIT_CONFIG_KEY, SMSC_CONFIG_PORT_ADDR); 217 outb(SMSC_EXIT_CONFIG_KEY, SMSC_CONFIG_PORT_ADDR);
218 218
219 return 0; 219 return 0;
diff --git a/arch/sh64/mm/fault.c b/arch/sh64/mm/fault.c
index 4dd8ee8f01ce..3cd93ba5d826 100644
--- a/arch/sh64/mm/fault.c
+++ b/arch/sh64/mm/fault.c
@@ -135,7 +135,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long writeaccess,
135 /* SIM 135 /* SIM
136 * Note this is now called with interrupts still disabled 136 * Note this is now called with interrupts still disabled
137 * This is to cope with being called for a missing IO port 137 * This is to cope with being called for a missing IO port
138 * address with interupts disabled. This should be fixed as 138 * address with interrupts disabled. This should be fixed as
139 * soon as we have a better 'fast path' miss handler. 139 * soon as we have a better 'fast path' miss handler.
140 * 140 *
141 * Plus take care how you try and debug this stuff. 141 * Plus take care how you try and debug this stuff.
diff --git a/arch/sh64/mm/init.c b/arch/sh64/mm/init.c
index 5dc08787259c..559717f30d1f 100644
--- a/arch/sh64/mm/init.c
+++ b/arch/sh64/mm/init.c
@@ -84,7 +84,7 @@ void show_mem(void)
84 printk("%d reserved pages\n",reserved); 84 printk("%d reserved pages\n",reserved);
85 printk("%d pages shared\n",shared); 85 printk("%d pages shared\n",shared);
86 printk("%d pages swap cached\n",cached); 86 printk("%d pages swap cached\n",cached);
87 printk("%ld pages in page table cache\n",pgtable_cache_size); 87 printk("%ld pages in page table cache\n", quicklist_total_size());
88} 88}
89 89
90/* 90/*
diff --git a/arch/sh64/mm/tlbmiss.c b/arch/sh64/mm/tlbmiss.c
index d4c5334186d0..b767d6cff72f 100644
--- a/arch/sh64/mm/tlbmiss.c
+++ b/arch/sh64/mm/tlbmiss.c
@@ -14,7 +14,7 @@
14 * IMPORTANT NOTES : 14 * IMPORTANT NOTES :
15 * The do_fast_page_fault function is called from a context in entry.S where very few registers 15 * The do_fast_page_fault function is called from a context in entry.S where very few registers
16 * have been saved. In particular, the code in this file must be compiled not to use ANY 16 * have been saved. In particular, the code in this file must be compiled not to use ANY
17 * caller-save regiseters that are not part of the restricted save set. Also, it means that 17 * caller-save registers that are not part of the restricted save set. Also, it means that
18 * code in this file must not make calls to functions elsewhere in the kernel, or else the 18 * code in this file must not make calls to functions elsewhere in the kernel, or else the
19 * excepting context will see corruption in its caller-save registers. Plus, the entry.S save 19 * excepting context will see corruption in its caller-save registers. Plus, the entry.S save
20 * area is non-reentrant, so this code has to run with SR.BL==1, i.e. no interrupts taken inside 20 * area is non-reentrant, so this code has to run with SR.BL==1, i.e. no interrupts taken inside
@@ -249,7 +249,7 @@ asmlinkage int do_fast_page_fault(unsigned long long ssr_md, unsigned long long
249 /* SIM 249 /* SIM
250 * Note this is now called with interrupts still disabled 250 * Note this is now called with interrupts still disabled
251 * This is to cope with being called for a missing IO port 251 * This is to cope with being called for a missing IO port
252 * address with interupts disabled. This should be fixed as 252 * address with interrupts disabled. This should be fixed as
253 * soon as we have a better 'fast path' miss handler. 253 * soon as we have a better 'fast path' miss handler.
254 * 254 *
255 * Plus take care how you try and debug this stuff. 255 * Plus take care how you try and debug this stuff.
diff --git a/arch/um/include/sysdep-x86_64/kernel-offsets.h b/arch/um/include/sysdep-x86_64/kernel-offsets.h
index a307237b7964..c978b589df41 100644
--- a/arch/um/include/sysdep-x86_64/kernel-offsets.h
+++ b/arch/um/include/sysdep-x86_64/kernel-offsets.h
@@ -17,7 +17,16 @@
17#define OFFSET(sym, str, mem) \ 17#define OFFSET(sym, str, mem) \
18 DEFINE(sym, offsetof(struct str, mem)); 18 DEFINE(sym, offsetof(struct str, mem));
19 19
20#define __NO_STUBS 1
21#undef __SYSCALL
22#undef _ASM_X86_64_UNISTD_H_
23#define __SYSCALL(nr, sym) [nr] = 1,
24static char syscalls[] = {
25#include <asm/arch/unistd.h>
26};
27
20void foo(void) 28void foo(void)
21{ 29{
22#include <common-offsets.h> 30#include <common-offsets.h>
31DEFINE(UM_NR_syscall_max, sizeof(syscalls) - 1);
23} 32}
diff --git a/arch/um/include/sysdep-x86_64/syscalls.h b/arch/um/include/sysdep-x86_64/syscalls.h
index 5e86aa047b2b..cf72256609e4 100644
--- a/arch/um/include/sysdep-x86_64/syscalls.h
+++ b/arch/um/include/sysdep-x86_64/syscalls.h
@@ -9,6 +9,7 @@
9 9
10#include <linux/msg.h> 10#include <linux/msg.h>
11#include <linux/shm.h> 11#include <linux/shm.h>
12#include <kern_constants.h>
12 13
13typedef long syscall_handler_t(void); 14typedef long syscall_handler_t(void);
14 15
@@ -29,6 +30,6 @@ extern long old_mmap(unsigned long addr, unsigned long len,
29extern syscall_handler_t sys_modify_ldt; 30extern syscall_handler_t sys_modify_ldt;
30extern syscall_handler_t sys_arch_prctl; 31extern syscall_handler_t sys_arch_prctl;
31 32
32#define NR_syscalls (__NR_syscall_max + 1) 33#define NR_syscalls (UM_NR_syscall_max + 1)
33 34
34#endif 35#endif
diff --git a/arch/um/sys-x86_64/syscall_table.c b/arch/um/sys-x86_64/syscall_table.c
index 9e9ad72c2ba4..5133988d3610 100644
--- a/arch/um/sys-x86_64/syscall_table.c
+++ b/arch/um/sys-x86_64/syscall_table.c
@@ -4,6 +4,7 @@
4#include <linux/linkage.h> 4#include <linux/linkage.h>
5#include <linux/sys.h> 5#include <linux/sys.h>
6#include <linux/cache.h> 6#include <linux/cache.h>
7#include <kern_constants.h>
7 8
8#define __NO_STUBS 9#define __NO_STUBS
9 10
@@ -45,8 +46,8 @@ typedef void (*sys_call_ptr_t)(void);
45 46
46extern void sys_ni_syscall(void); 47extern void sys_ni_syscall(void);
47 48
48sys_call_ptr_t sys_call_table[__NR_syscall_max+1] __cacheline_aligned = { 49sys_call_ptr_t sys_call_table[UM_NR_syscall_max+1] __cacheline_aligned = {
49 /* Smells like a like a compiler bug -- it doesn't work when the & below is removed. */ 50 /* Smells like a like a compiler bug -- it doesn't work when the & below is removed. */
50 [0 ... __NR_syscall_max] = &sys_ni_syscall, 51 [0 ... UM_NR_syscall_max] = &sys_ni_syscall,
51#include <asm-x86_64/unistd.h> 52#include <asm-x86_64/unistd.h>
52}; 53};
diff --git a/drivers/firewire/fw-ohci.c b/drivers/firewire/fw-ohci.c
index 1f5c70461b8b..c17342d3e6fd 100644
--- a/drivers/firewire/fw-ohci.c
+++ b/drivers/firewire/fw-ohci.c
@@ -26,6 +26,7 @@
26#include <linux/delay.h> 26#include <linux/delay.h>
27#include <linux/poll.h> 27#include <linux/poll.h>
28#include <linux/dma-mapping.h> 28#include <linux/dma-mapping.h>
29#include <linux/mm.h>
29 30
30#include <asm/uaccess.h> 31#include <asm/uaccess.h>
31#include <asm/semaphore.h> 32#include <asm/semaphore.h>
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig
index 9040809d2c25..b1a9b81c211f 100644
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
@@ -4,13 +4,10 @@
4# Andre Hedrick <andre@linux-ide.org> 4# Andre Hedrick <andre@linux-ide.org>
5# 5#
6 6
7if BLOCK 7menuconfig IDE
8
9menu "ATA/ATAPI/MFM/RLL support"
10 depends on HAS_IOMEM
11
12config IDE
13 tristate "ATA/ATAPI/MFM/RLL support" 8 tristate "ATA/ATAPI/MFM/RLL support"
9 depends on BLOCK
10 depends on HAS_IOMEM
14 ---help--- 11 ---help---
15 If you say Y here, your kernel will be able to manage low cost mass 12 If you say Y here, your kernel will be able to manage low cost mass
16 storage units such as ATA/(E)IDE and ATAPI units. The most common 13 storage units such as ATA/(E)IDE and ATAPI units. The most common
@@ -1099,8 +1096,4 @@ config BLK_DEV_HD_ONLY
1099config BLK_DEV_HD 1096config BLK_DEV_HD
1100 def_bool BLK_DEV_HD_IDE || BLK_DEV_HD_ONLY 1097 def_bool BLK_DEV_HD_IDE || BLK_DEV_HD_ONLY
1101 1098
1102endif 1099endif # IDE
1103
1104endmenu
1105
1106endif
diff --git a/drivers/ide/cris/ide-cris.c b/drivers/ide/cris/ide-cris.c
index c04cb25a01ff..ca0341c05e55 100644
--- a/drivers/ide/cris/ide-cris.c
+++ b/drivers/ide/cris/ide-cris.c
@@ -1002,18 +1002,6 @@ static int cris_ide_build_dmatable (ide_drive_t *drive)
1002 return 1; /* let the PIO routines handle this weirdness */ 1002 return 1; /* let the PIO routines handle this weirdness */
1003} 1003}
1004 1004
1005static int cris_config_drive_for_dma (ide_drive_t *drive)
1006{
1007 u8 speed = ide_max_dma_mode(drive);
1008
1009 if (!speed)
1010 return 0;
1011
1012 speed_cris_ide(drive, speed);
1013
1014 return ide_dma_enable(drive);
1015}
1016
1017/* 1005/*
1018 * cris_dma_intr() is the handler for disk read/write DMA interrupts 1006 * cris_dma_intr() is the handler for disk read/write DMA interrupts
1019 */ 1007 */
@@ -1043,7 +1031,7 @@ static ide_startstop_t cris_dma_intr (ide_drive_t *drive)
1043 1031
1044static int cris_dma_check(ide_drive_t *drive) 1032static int cris_dma_check(ide_drive_t *drive)
1045{ 1033{
1046 if (ide_use_dma(drive) && cris_config_drive_for_dma(drive)) 1034 if (ide_tune_dma(drive))
1047 return 0; 1035 return 0;
1048 1036
1049 return -1; 1037 return -1;
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
index 5fe85191d49c..b77b7d138c49 100644
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -670,41 +670,6 @@ int __ide_dma_good_drive (ide_drive_t *drive)
670 670
671EXPORT_SYMBOL(__ide_dma_good_drive); 671EXPORT_SYMBOL(__ide_dma_good_drive);
672 672
673int ide_use_dma(ide_drive_t *drive)
674{
675 struct hd_driveid *id = drive->id;
676 ide_hwif_t *hwif = drive->hwif;
677
678 if ((id->capability & 1) == 0 || drive->autodma == 0)
679 return 0;
680
681 /* consult the list of known "bad" drives */
682 if (__ide_dma_bad_drive(drive))
683 return 0;
684
685 /* capable of UltraDMA modes */
686 if (id->field_valid & 4) {
687 if (hwif->ultra_mask & id->dma_ultra)
688 return 1;
689 }
690
691 /* capable of regular DMA modes */
692 if (id->field_valid & 2) {
693 if (hwif->mwdma_mask & id->dma_mword)
694 return 1;
695 if (hwif->swdma_mask & id->dma_1word)
696 return 1;
697 }
698
699 /* consult the list of known "good" drives */
700 if (__ide_dma_good_drive(drive) && id->eide_dma_time < 150)
701 return 1;
702
703 return 0;
704}
705
706EXPORT_SYMBOL_GPL(ide_use_dma);
707
708static const u8 xfer_mode_bases[] = { 673static const u8 xfer_mode_bases[] = {
709 XFER_UDMA_0, 674 XFER_UDMA_0,
710 XFER_MW_DMA_0, 675 XFER_MW_DMA_0,
@@ -731,10 +696,12 @@ static unsigned int ide_get_mode_mask(ide_drive_t *drive, u8 base)
731 mask &= 0x07; 696 mask &= 0x07;
732 break; 697 break;
733 case XFER_MW_DMA_0: 698 case XFER_MW_DMA_0:
734 mask = id->dma_mword & hwif->mwdma_mask; 699 if (id->field_valid & 2)
700 mask = id->dma_mword & hwif->mwdma_mask;
735 break; 701 break;
736 case XFER_SW_DMA_0: 702 case XFER_SW_DMA_0:
737 mask = id->dma_1word & hwif->swdma_mask; 703 if (id->field_valid & 2)
704 mask = id->dma_1word & hwif->swdma_mask;
738 break; 705 break;
739 default: 706 default:
740 BUG(); 707 BUG();
@@ -783,8 +750,11 @@ int ide_tune_dma(ide_drive_t *drive)
783{ 750{
784 u8 speed; 751 u8 speed;
785 752
786 /* TODO: use only ide_max_dma_mode() */ 753 if ((drive->id->capability & 1) == 0 || drive->autodma == 0)
787 if (!ide_use_dma(drive)) 754 return 0;
755
756 /* consult the list of known "bad" drives */
757 if (__ide_dma_bad_drive(drive))
788 return 0; 758 return 0;
789 759
790 speed = ide_max_dma_mode(drive); 760 speed = ide_max_dma_mode(drive);
@@ -792,9 +762,10 @@ int ide_tune_dma(ide_drive_t *drive)
792 if (!speed) 762 if (!speed)
793 return 0; 763 return 0;
794 764
795 drive->hwif->speedproc(drive, speed); 765 if (drive->hwif->speedproc(drive, speed))
766 return 0;
796 767
797 return ide_dma_enable(drive); 768 return 1;
798} 769}
799 770
800EXPORT_SYMBOL_GPL(ide_tune_dma); 771EXPORT_SYMBOL_GPL(ide_tune_dma);
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index 8e568143d90d..bfe8f1b712ba 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -223,6 +223,7 @@ static ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *
223 break; 223 break;
224 if (drive->hwif->ide_dma_check == NULL) 224 if (drive->hwif->ide_dma_check == NULL)
225 break; 225 break;
226 drive->hwif->dma_off_quietly(drive);
226 ide_set_dma(drive); 227 ide_set_dma(drive);
227 break; 228 break;
228 } 229 }
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c
index 3be3c69383f2..074bb32a4a40 100644
--- a/drivers/ide/ide-lib.c
+++ b/drivers/ide/ide-lib.c
@@ -111,18 +111,6 @@ u8 ide_rate_filter(ide_drive_t *drive, u8 speed)
111 111
112EXPORT_SYMBOL(ide_rate_filter); 112EXPORT_SYMBOL(ide_rate_filter);
113 113
114int ide_dma_enable (ide_drive_t *drive)
115{
116 ide_hwif_t *hwif = HWIF(drive);
117 struct hd_driveid *id = drive->id;
118
119 return ((int) ((((id->dma_ultra >> 8) & hwif->ultra_mask) ||
120 ((id->dma_mword >> 8) & hwif->mwdma_mask) ||
121 ((id->dma_1word >> 8) & hwif->swdma_mask)) ? 1 : 0));
122}
123
124EXPORT_SYMBOL(ide_dma_enable);
125
126int ide_use_fast_pio(ide_drive_t *drive) 114int ide_use_fast_pio(ide_drive_t *drive)
127{ 115{
128 struct hd_driveid *id = drive->id; 116 struct hd_driveid *id = drive->id;
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index f2b547ff7722..6002713a20a1 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -910,6 +910,7 @@ int set_using_dma(ide_drive_t *drive, int arg)
910 err = 0; 910 err = 0;
911 911
912 if (arg) { 912 if (arg) {
913 hwif->dma_off_quietly(drive);
913 if (ide_set_dma(drive) || hwif->ide_dma_on(drive)) 914 if (ide_set_dma(drive) || hwif->ide_dma_on(drive))
914 err = -EIO; 915 err = -EIO;
915 } else 916 } else
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c
index 428efdae0c7b..27525ec2e19a 100644
--- a/drivers/ide/pci/alim15x3.c
+++ b/drivers/ide/pci/alim15x3.c
@@ -455,28 +455,6 @@ static int ali15x3_tune_chipset (ide_drive_t *drive, u8 xferspeed)
455 return (ide_config_drive_speed(drive, speed)); 455 return (ide_config_drive_speed(drive, speed));
456} 456}
457 457
458
459/**
460 * config_chipset_for_dma - set up DMA mode
461 * @drive: drive to configure for
462 *
463 * Place a drive into DMA mode and tune the chipset for
464 * the selected speed.
465 *
466 * Returns true if DMA mode can be used
467 */
468
469static int config_chipset_for_dma (ide_drive_t *drive)
470{
471 u8 speed = ide_max_dma_mode(drive);
472
473 if (!(speed))
474 return 0;
475
476 (void) ali15x3_tune_chipset(drive, speed);
477 return ide_dma_enable(drive);
478}
479
480/** 458/**
481 * ali15x3_config_drive_for_dma - configure for DMA 459 * ali15x3_config_drive_for_dma - configure for DMA
482 * @drive: drive to configure 460 * @drive: drive to configure
@@ -487,48 +465,14 @@ static int config_chipset_for_dma (ide_drive_t *drive)
487 465
488static int ali15x3_config_drive_for_dma(ide_drive_t *drive) 466static int ali15x3_config_drive_for_dma(ide_drive_t *drive)
489{ 467{
490 ide_hwif_t *hwif = HWIF(drive);
491 struct hd_driveid *id = drive->id;
492
493 if ((m5229_revision<=0x20) && (drive->media!=ide_disk))
494 goto ata_pio;
495
496 drive->init_speed = 0; 468 drive->init_speed = 0;
497 469
498 if ((id != NULL) && ((id->capability & 1) != 0) && drive->autodma) { 470 if (ide_tune_dma(drive))
499 /* Consult the list of known "bad" drives */ 471 return 0;
500 if (__ide_dma_bad_drive(drive))
501 goto ata_pio;
502 if ((id->field_valid & 4) && (m5229_revision >= 0xC2)) {
503 if (id->dma_ultra & hwif->ultra_mask) {
504 /* Force if Capable UltraDMA */
505 int dma = config_chipset_for_dma(drive);
506 if ((id->field_valid & 2) && !dma)
507 goto try_dma_modes;
508 }
509 } else if (id->field_valid & 2) {
510try_dma_modes:
511 if ((id->dma_mword & hwif->mwdma_mask) ||
512 (id->dma_1word & hwif->swdma_mask)) {
513 /* Force if Capable regular DMA modes */
514 if (!config_chipset_for_dma(drive))
515 goto ata_pio;
516 }
517 } else if (__ide_dma_good_drive(drive) &&
518 (id->eide_dma_time < 150)) {
519 /* Consult the list of known "good" drives */
520 if (!config_chipset_for_dma(drive))
521 goto ata_pio;
522 } else {
523 goto ata_pio;
524 }
525 } else {
526ata_pio:
527 hwif->tuneproc(drive, 255);
528 return -1;
529 }
530 472
531 return 0; 473 ali15x3_tune_drive(drive, 255);
474
475 return -1;
532} 476}
533 477
534/** 478/**
@@ -739,7 +683,8 @@ static void __devinit init_hwif_common_ali15x3 (ide_hwif_t *hwif)
739 return; 683 return;
740 } 684 }
741 685
742 hwif->atapi_dma = 1; 686 if (m5229_revision > 0x20)
687 hwif->atapi_dma = 1;
743 688
744 if (m5229_revision <= 0x20) 689 if (m5229_revision <= 0x20)
745 hwif->ultra_mask = 0x00; /* no udma */ 690 hwif->ultra_mask = 0x00; /* no udma */
diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c
index 61ea96b5555c..7c57dc696f52 100644
--- a/drivers/ide/pci/cmd64x.c
+++ b/drivers/ide/pci/cmd64x.c
@@ -352,22 +352,9 @@ static int cmd64x_tune_chipset (ide_drive_t *drive, u8 speed)
352 return ide_config_drive_speed(drive, speed); 352 return ide_config_drive_speed(drive, speed);
353} 353}
354 354
355static int config_chipset_for_dma (ide_drive_t *drive)
356{
357 u8 speed = ide_max_dma_mode(drive);
358
359 if (!speed)
360 return 0;
361
362 if (cmd64x_tune_chipset(drive, speed))
363 return 0;
364
365 return ide_dma_enable(drive);
366}
367
368static int cmd64x_config_drive_for_dma (ide_drive_t *drive) 355static int cmd64x_config_drive_for_dma (ide_drive_t *drive)
369{ 356{
370 if (ide_use_dma(drive) && config_chipset_for_dma(drive)) 357 if (ide_tune_dma(drive))
371 return 0; 358 return 0;
372 359
373 if (ide_use_fast_pio(drive)) 360 if (ide_use_fast_pio(drive))
diff --git a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c
index b2d7c132ef4b..1eec1f308d16 100644
--- a/drivers/ide/pci/cs5530.c
+++ b/drivers/ide/pci/cs5530.c
@@ -1,10 +1,10 @@
1/* 1/*
2 * linux/drivers/ide/pci/cs5530.c Version 0.7 Sept 10, 2002 2 * linux/drivers/ide/pci/cs5530.c Version 0.73 Mar 10 2007
3 * 3 *
4 * Copyright (C) 2000 Andre Hedrick <andre@linux-ide.org> 4 * Copyright (C) 2000 Andre Hedrick <andre@linux-ide.org>
5 * Ditto of GNU General Public License.
6 *
7 * Copyright (C) 2000 Mark Lord <mlord@pobox.com> 5 * Copyright (C) 2000 Mark Lord <mlord@pobox.com>
6 * Copyright (C) 2007 Bartlomiej Zolnierkiewicz
7 *
8 * May be copied or modified under the terms of the GNU General Public License 8 * May be copied or modified under the terms of the GNU General Public License
9 * 9 *
10 * Development of this chipset driver was funded 10 * Development of this chipset driver was funded
@@ -62,6 +62,14 @@ static unsigned int cs5530_pio_timings[2][5] = {
62#define CS5530_BAD_PIO(timings) (((timings)&~0x80000000)==0x0000e132) 62#define CS5530_BAD_PIO(timings) (((timings)&~0x80000000)==0x0000e132)
63#define CS5530_BASEREG(hwif) (((hwif)->dma_base & ~0xf) + ((hwif)->channel ? 0x30 : 0x20)) 63#define CS5530_BASEREG(hwif) (((hwif)->dma_base & ~0xf) + ((hwif)->channel ? 0x30 : 0x20))
64 64
65static void cs5530_tunepio(ide_drive_t *drive, u8 pio)
66{
67 unsigned long basereg = CS5530_BASEREG(drive->hwif);
68 unsigned int format = (inl(basereg + 4) >> 31) & 1;
69
70 outl(cs5530_pio_timings[format][pio], basereg + ((drive->dn & 1)<<3));
71}
72
65/** 73/**
66 * cs5530_tuneproc - select/set PIO modes 74 * cs5530_tuneproc - select/set PIO modes
67 * 75 *
@@ -74,98 +82,78 @@ static unsigned int cs5530_pio_timings[2][5] = {
74 82
75static void cs5530_tuneproc (ide_drive_t *drive, u8 pio) /* pio=255 means "autotune" */ 83static void cs5530_tuneproc (ide_drive_t *drive, u8 pio) /* pio=255 means "autotune" */
76{ 84{
77 ide_hwif_t *hwif = HWIF(drive);
78 unsigned int format;
79 unsigned long basereg = CS5530_BASEREG(hwif);
80 static u8 modes[5] = { XFER_PIO_0, XFER_PIO_1, XFER_PIO_2, XFER_PIO_3, XFER_PIO_4};
81
82 pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 85 pio = ide_get_best_pio_mode(drive, pio, 4, NULL);
83 if (!cs5530_set_xfer_mode(drive, modes[pio])) { 86
84 format = (inl(basereg + 4) >> 31) & 1; 87 if (cs5530_set_xfer_mode(drive, XFER_PIO_0 + pio) == 0)
85 outl(cs5530_pio_timings[format][pio], 88 cs5530_tunepio(drive, pio);
86 basereg+(drive->select.b.unit<<3)); 89}
90
91/**
92 * cs5530_udma_filter - UDMA filter
93 * @drive: drive
94 *
95 * cs5530_udma_filter() does UDMA mask filtering for the given drive
96 * taking into the consideration capabilities of the mate device.
97 *
98 * The CS5530 specifies that two drives sharing a cable cannot mix
99 * UDMA/MDMA. It has to be one or the other, for the pair, though
100 * different timings can still be chosen for each drive. We could
101 * set the appropriate timing bits on the fly, but that might be
102 * a bit confusing. So, for now we statically handle this requirement
103 * by looking at our mate drive to see what it is capable of, before
104 * choosing a mode for our own drive.
105 *
106 * Note: This relies on the fact we never fail from UDMA to MWDMA2
107 * but instead drop to PIO.
108 */
109
110static u8 cs5530_udma_filter(ide_drive_t *drive)
111{
112 ide_hwif_t *hwif = drive->hwif;
113 ide_drive_t *mate = &hwif->drives[(drive->dn & 1) ^ 1];
114 struct hd_driveid *mateid = mate->id;
115 u8 mask = hwif->ultra_mask;
116
117 if (mate->present == 0)
118 goto out;
119
120 if ((mateid->capability & 1) && __ide_dma_bad_drive(mate) == 0) {
121 if ((mateid->field_valid & 4) && (mateid->dma_ultra & 7))
122 goto out;
123 if ((mateid->field_valid & 2) && (mateid->dma_mword & 7))
124 mask = 0;
87 } 125 }
126out:
127 return mask;
88} 128}
89 129
90/** 130/**
91 * cs5530_config_dma - select/set DMA and UDMA modes 131 * cs5530_config_dma - set DMA/UDMA mode
92 * @drive: drive to tune 132 * @drive: drive to tune
93 * 133 *
94 * cs5530_config_dma() handles selection/setting of DMA/UDMA modes 134 * cs5530_config_dma() handles setting of DMA/UDMA mode
95 * for both the chipset and drive. The CS5530 has limitations about 135 * for both the chipset and drive.
96 * mixing DMA/UDMA on the same cable.
97 */ 136 */
98 137
99static int cs5530_config_dma (ide_drive_t *drive) 138static int cs5530_config_dma(ide_drive_t *drive)
100{ 139{
101 int udma_ok = 1, mode = 0; 140 if (ide_tune_dma(drive))
102 ide_hwif_t *hwif = HWIF(drive); 141 return 0;
103 int unit = drive->select.b.unit;
104 ide_drive_t *mate = &hwif->drives[unit^1];
105 struct hd_driveid *id = drive->id;
106 unsigned int reg, timings = 0;
107 unsigned long basereg;
108 142
109 /* 143 return 1;
110 * Default to DMA-off in case we run into trouble here. 144}
111 */
112 hwif->dma_off_quietly(drive);
113 145
114 /* 146static int cs5530_tune_chipset(ide_drive_t *drive, u8 mode)
115 * The CS5530 specifies that two drives sharing a cable cannot 147{
116 * mix UDMA/MDMA. It has to be one or the other, for the pair, 148 unsigned long basereg;
117 * though different timings can still be chosen for each drive. 149 unsigned int reg, timings = 0;
118 * We could set the appropriate timing bits on the fly,
119 * but that might be a bit confusing. So, for now we statically
120 * handle this requirement by looking at our mate drive to see
121 * what it is capable of, before choosing a mode for our own drive.
122 *
123 * Note: This relies on the fact we never fail from UDMA to MWDMA_2
124 * but instead drop to PIO
125 */
126 if (mate->present) {
127 struct hd_driveid *mateid = mate->id;
128 if (mateid && (mateid->capability & 1) &&
129 !__ide_dma_bad_drive(mate)) {
130 if ((mateid->field_valid & 4) &&
131 (mateid->dma_ultra & 7))
132 udma_ok = 1;
133 else if ((mateid->field_valid & 2) &&
134 (mateid->dma_mword & 7))
135 udma_ok = 0;
136 else
137 udma_ok = 1;
138 }
139 }
140 150
141 /* 151 mode = ide_rate_filter(drive, mode);
142 * Now see what the current drive is capable of,
143 * selecting UDMA only if the mate said it was ok.
144 */
145 if (id && (id->capability & 1) && drive->autodma &&
146 !__ide_dma_bad_drive(drive)) {
147 if (udma_ok && (id->field_valid & 4) && (id->dma_ultra & 7)) {
148 if (id->dma_ultra & 4)
149 mode = XFER_UDMA_2;
150 else if (id->dma_ultra & 2)
151 mode = XFER_UDMA_1;
152 else if (id->dma_ultra & 1)
153 mode = XFER_UDMA_0;
154 }
155 if (!mode && (id->field_valid & 2) && (id->dma_mword & 7)) {
156 if (id->dma_mword & 4)
157 mode = XFER_MW_DMA_2;
158 else if (id->dma_mword & 2)
159 mode = XFER_MW_DMA_1;
160 else if (id->dma_mword & 1)
161 mode = XFER_MW_DMA_0;
162 }
163 }
164 152
165 /* 153 /*
166 * Tell the drive to switch to the new mode; abort on failure. 154 * Tell the drive to switch to the new mode; abort on failure.
167 */ 155 */
168 if (!mode || cs5530_set_xfer_mode(drive, mode)) 156 if (cs5530_set_xfer_mode(drive, mode))
169 return 1; /* failure */ 157 return 1; /* failure */
170 158
171 /* 159 /*
@@ -178,14 +166,21 @@ static int cs5530_config_dma (ide_drive_t *drive)
178 case XFER_MW_DMA_0: timings = 0x00077771; break; 166 case XFER_MW_DMA_0: timings = 0x00077771; break;
179 case XFER_MW_DMA_1: timings = 0x00012121; break; 167 case XFER_MW_DMA_1: timings = 0x00012121; break;
180 case XFER_MW_DMA_2: timings = 0x00002020; break; 168 case XFER_MW_DMA_2: timings = 0x00002020; break;
169 case XFER_PIO_4:
170 case XFER_PIO_3:
171 case XFER_PIO_2:
172 case XFER_PIO_1:
173 case XFER_PIO_0:
174 cs5530_tunepio(drive, mode - XFER_PIO_0);
175 return 0;
181 default: 176 default:
182 BUG(); 177 BUG();
183 break; 178 break;
184 } 179 }
185 basereg = CS5530_BASEREG(hwif); 180 basereg = CS5530_BASEREG(drive->hwif);
186 reg = inl(basereg + 4); /* get drive0 config register */ 181 reg = inl(basereg + 4); /* get drive0 config register */
187 timings |= reg & 0x80000000; /* preserve PIO format bit */ 182 timings |= reg & 0x80000000; /* preserve PIO format bit */
188 if (unit == 0) { /* are we configuring drive0? */ 183 if ((drive-> dn & 1) == 0) { /* are we configuring drive0? */
189 outl(timings, basereg + 4); /* write drive0 config register */ 184 outl(timings, basereg + 4); /* write drive0 config register */
190 } else { 185 } else {
191 if (timings & 0x00100000) 186 if (timings & 0x00100000)
@@ -311,6 +306,8 @@ static void __devinit init_hwif_cs5530 (ide_hwif_t *hwif)
311 hwif->serialized = hwif->mate->serialized = 1; 306 hwif->serialized = hwif->mate->serialized = 1;
312 307
313 hwif->tuneproc = &cs5530_tuneproc; 308 hwif->tuneproc = &cs5530_tuneproc;
309 hwif->speedproc = &cs5530_tune_chipset;
310
314 basereg = CS5530_BASEREG(hwif); 311 basereg = CS5530_BASEREG(hwif);
315 d0_timings = inl(basereg + 0); 312 d0_timings = inl(basereg + 0);
316 if (CS5530_BAD_PIO(d0_timings)) { 313 if (CS5530_BAD_PIO(d0_timings)) {
@@ -332,6 +329,7 @@ static void __devinit init_hwif_cs5530 (ide_hwif_t *hwif)
332 hwif->ultra_mask = 0x07; 329 hwif->ultra_mask = 0x07;
333 hwif->mwdma_mask = 0x07; 330 hwif->mwdma_mask = 0x07;
334 331
332 hwif->udma_filter = cs5530_udma_filter;
335 hwif->ide_dma_check = &cs5530_config_dma; 333 hwif->ide_dma_check = &cs5530_config_dma;
336 if (!noautodma) 334 if (!noautodma)
337 hwif->autodma = 1; 335 hwif->autodma = 1;
diff --git a/drivers/ide/pci/it821x.c b/drivers/ide/pci/it821x.c
index 442f658c6ae7..5faaff87d580 100644
--- a/drivers/ide/pci/it821x.c
+++ b/drivers/ide/pci/it821x.c
@@ -464,25 +464,6 @@ static int it821x_tune_chipset (ide_drive_t *drive, byte xferspeed)
464} 464}
465 465
466/** 466/**
467 * config_chipset_for_dma - configure for DMA
468 * @drive: drive to configure
469 *
470 * Called by the IDE layer when it wants the timings set up.
471 */
472
473static int config_chipset_for_dma (ide_drive_t *drive)
474{
475 u8 speed = ide_max_dma_mode(drive);
476
477 if (speed == 0)
478 return 0;
479
480 it821x_tune_chipset(drive, speed);
481
482 return ide_dma_enable(drive);
483}
484
485/**
486 * it821x_configure_drive_for_dma - set up for DMA transfers 467 * it821x_configure_drive_for_dma - set up for DMA transfers
487 * @drive: drive we are going to set up 468 * @drive: drive we are going to set up
488 * 469 *
@@ -494,7 +475,7 @@ static int config_chipset_for_dma (ide_drive_t *drive)
494 475
495static int it821x_config_drive_for_dma (ide_drive_t *drive) 476static int it821x_config_drive_for_dma (ide_drive_t *drive)
496{ 477{
497 if (ide_use_dma(drive) && config_chipset_for_dma(drive)) 478 if (ide_tune_dma(drive))
498 return 0; 479 return 0;
499 480
500 it821x_tuneproc(drive, 255); 481 it821x_tuneproc(drive, 255);
diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c
index 65b1e124edf7..cc0bfdcf1f19 100644
--- a/drivers/ide/pci/pdc202xx_new.c
+++ b/drivers/ide/pci/pdc202xx_new.c
@@ -228,38 +228,11 @@ static u8 pdcnew_cable_detect(ide_hwif_t *hwif)
228 return get_indexed_reg(hwif, 0x0b) & 0x04; 228 return get_indexed_reg(hwif, 0x0b) & 0x04;
229} 229}
230 230
231static int config_chipset_for_dma(ide_drive_t *drive)
232{
233 struct hd_driveid *id = drive->id;
234 ide_hwif_t *hwif = HWIF(drive);
235 u8 speed;
236
237 if (id->capability & 4) {
238 /*
239 * Set IORDY_EN & PREFETCH_EN (this seems to have
240 * NO real effect since this register is reloaded
241 * by hardware when the transfer mode is selected)
242 */
243 u8 tmp, adj = (drive->dn & 1) ? 0x08 : 0x00;
244
245 tmp = get_indexed_reg(hwif, 0x13 + adj);
246 set_indexed_reg(hwif, 0x13 + adj, tmp | 0x03);
247 }
248
249 speed = ide_max_dma_mode(drive);
250
251 if (!speed)
252 return 0;
253
254 (void) hwif->speedproc(drive, speed);
255 return ide_dma_enable(drive);
256}
257
258static int pdcnew_config_drive_xfer_rate(ide_drive_t *drive) 231static int pdcnew_config_drive_xfer_rate(ide_drive_t *drive)
259{ 232{
260 drive->init_speed = 0; 233 drive->init_speed = 0;
261 234
262 if (ide_use_dma(drive) && config_chipset_for_dma(drive)) 235 if (ide_tune_dma(drive))
263 return 0; 236 return 0;
264 237
265 if (ide_use_fast_pio(drive)) 238 if (ide_use_fast_pio(drive))
diff --git a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c
index 7146fe3f6ba7..23844687deea 100644
--- a/drivers/ide/pci/pdc202xx_old.c
+++ b/drivers/ide/pci/pdc202xx_old.c
@@ -1,8 +1,9 @@
1/* 1/*
2 * linux/drivers/ide/pci/pdc202xx_old.c Version 0.36 Sept 11, 2002 2 * linux/drivers/ide/pci/pdc202xx_old.c Version 0.50 Mar 3, 2007
3 * 3 *
4 * Copyright (C) 1998-2002 Andre Hedrick <andre@linux-ide.org> 4 * Copyright (C) 1998-2002 Andre Hedrick <andre@linux-ide.org>
5 * Copyright (C) 2006-2007 MontaVista Software, Inc. 5 * Copyright (C) 2006-2007 MontaVista Software, Inc.
6 * Copyright (C) 2007 Bartlomiej Zolnierkiewicz
6 * 7 *
7 * Promise Ultra33 cards with BIOS v1.20 through 1.28 will need this 8 * Promise Ultra33 cards with BIOS v1.20 through 1.28 will need this
8 * compiled into the kernel if you have more than one card installed. 9 * compiled into the kernel if you have more than one card installed.
@@ -60,45 +61,7 @@ static const char *pdc_quirk_drives[] = {
60 NULL 61 NULL
61}; 62};
62 63
63/* A Register */ 64static void pdc_old_disable_66MHz_clock(ide_hwif_t *);
64#define SYNC_ERRDY_EN 0xC0
65
66#define SYNC_IN 0x80 /* control bit, different for master vs. slave drives */
67#define ERRDY_EN 0x40 /* control bit, different for master vs. slave drives */
68#define IORDY_EN 0x20 /* PIO: IOREADY */
69#define PREFETCH_EN 0x10 /* PIO: PREFETCH */
70
71#define PA3 0x08 /* PIO"A" timing */
72#define PA2 0x04 /* PIO"A" timing */
73#define PA1 0x02 /* PIO"A" timing */
74#define PA0 0x01 /* PIO"A" timing */
75
76/* B Register */
77
78#define MB2 0x80 /* DMA"B" timing */
79#define MB1 0x40 /* DMA"B" timing */
80#define MB0 0x20 /* DMA"B" timing */
81
82#define PB4 0x10 /* PIO_FORCE 1:0 */
83
84#define PB3 0x08 /* PIO"B" timing */ /* PIO flow Control mode */
85#define PB2 0x04 /* PIO"B" timing */ /* PIO 4 */
86#define PB1 0x02 /* PIO"B" timing */ /* PIO 3 half */
87#define PB0 0x01 /* PIO"B" timing */ /* PIO 3 other half */
88
89/* C Register */
90#define IORDYp_NO_SPEED 0x4F
91#define SPEED_DIS 0x0F
92
93#define DMARQp 0x80
94#define IORDYp 0x40
95#define DMAR_EN 0x20
96#define DMAW_EN 0x10
97
98#define MC3 0x08 /* DMA"C" timing */
99#define MC2 0x04 /* DMA"C" timing */
100#define MC1 0x02 /* DMA"C" timing */
101#define MC0 0x01 /* DMA"C" timing */
102 65
103static int pdc202xx_tune_chipset (ide_drive_t *drive, u8 xferspeed) 66static int pdc202xx_tune_chipset (ide_drive_t *drive, u8 xferspeed)
104{ 67{
@@ -107,52 +70,25 @@ static int pdc202xx_tune_chipset (ide_drive_t *drive, u8 xferspeed)
107 u8 drive_pci = 0x60 + (drive->dn << 2); 70 u8 drive_pci = 0x60 + (drive->dn << 2);
108 u8 speed = ide_rate_filter(drive, xferspeed); 71 u8 speed = ide_rate_filter(drive, xferspeed);
109 72
110 u32 drive_conf; 73 u8 AP = 0, BP = 0, CP = 0;
111 u8 AP, BP, CP, DP;
112 u8 TA = 0, TB = 0, TC = 0; 74 u8 TA = 0, TB = 0, TC = 0;
113 75
114 if (drive->media != ide_disk && 76#if PDC202XX_DEBUG_DRIVE_INFO
115 drive->media != ide_cdrom && speed < XFER_SW_DMA_0) 77 u32 drive_conf = 0;
116 return -1;
117
118 pci_read_config_dword(dev, drive_pci, &drive_conf); 78 pci_read_config_dword(dev, drive_pci, &drive_conf);
119 pci_read_config_byte(dev, (drive_pci), &AP); 79#endif
120 pci_read_config_byte(dev, (drive_pci)|0x01, &BP);
121 pci_read_config_byte(dev, (drive_pci)|0x02, &CP);
122 pci_read_config_byte(dev, (drive_pci)|0x03, &DP);
123 80
124 if (speed < XFER_SW_DMA_0) { 81 /*
125 if ((AP & 0x0F) || (BP & 0x07)) { 82 * TODO: do this once per channel
126 /* clear PIO modes of lower 8421 bits of A Register */ 83 */
127 pci_write_config_byte(dev, (drive_pci), AP &~0x0F); 84 if (dev->device != PCI_DEVICE_ID_PROMISE_20246)
128 pci_read_config_byte(dev, (drive_pci), &AP); 85 pdc_old_disable_66MHz_clock(hwif);
129
130 /* clear PIO modes of lower 421 bits of B Register */
131 pci_write_config_byte(dev, (drive_pci)|0x01, BP &~0x07);
132 pci_read_config_byte(dev, (drive_pci)|0x01, &BP);
133
134 pci_read_config_byte(dev, (drive_pci), &AP);
135 pci_read_config_byte(dev, (drive_pci)|0x01, &BP);
136 }
137 } else {
138 if ((BP & 0xF0) && (CP & 0x0F)) {
139 /* clear DMA modes of upper 842 bits of B Register */
140 /* clear PIO forced mode upper 1 bit of B Register */
141 pci_write_config_byte(dev, (drive_pci)|0x01, BP &~0xF0);
142 pci_read_config_byte(dev, (drive_pci)|0x01, &BP);
143
144 /* clear DMA modes of lower 8421 bits of C Register */
145 pci_write_config_byte(dev, (drive_pci)|0x02, CP &~0x0F);
146 pci_read_config_byte(dev, (drive_pci)|0x02, &CP);
147 }
148 }
149 86
150 pci_read_config_byte(dev, (drive_pci), &AP); 87 pci_read_config_byte(dev, drive_pci, &AP);
151 pci_read_config_byte(dev, (drive_pci)|0x01, &BP); 88 pci_read_config_byte(dev, drive_pci + 1, &BP);
152 pci_read_config_byte(dev, (drive_pci)|0x02, &CP); 89 pci_read_config_byte(dev, drive_pci + 2, &CP);
153 90
154 switch(speed) { 91 switch(speed) {
155 case XFER_UDMA_6: speed = XFER_UDMA_5;
156 case XFER_UDMA_5: 92 case XFER_UDMA_5:
157 case XFER_UDMA_4: TB = 0x20; TC = 0x01; break; 93 case XFER_UDMA_4: TB = 0x20; TC = 0x01; break;
158 case XFER_UDMA_2: TB = 0x20; TC = 0x01; break; 94 case XFER_UDMA_2: TB = 0x20; TC = 0x01; break;
@@ -161,7 +97,7 @@ static int pdc202xx_tune_chipset (ide_drive_t *drive, u8 xferspeed)
161 case XFER_UDMA_0: 97 case XFER_UDMA_0:
162 case XFER_MW_DMA_2: TB = 0x60; TC = 0x03; break; 98 case XFER_MW_DMA_2: TB = 0x60; TC = 0x03; break;
163 case XFER_MW_DMA_1: TB = 0x60; TC = 0x04; break; 99 case XFER_MW_DMA_1: TB = 0x60; TC = 0x04; break;
164 case XFER_MW_DMA_0: 100 case XFER_MW_DMA_0: TB = 0xE0; TC = 0x0F; break;
165 case XFER_SW_DMA_2: TB = 0x60; TC = 0x05; break; 101 case XFER_SW_DMA_2: TB = 0x60; TC = 0x05; break;
166 case XFER_SW_DMA_1: TB = 0x80; TC = 0x06; break; 102 case XFER_SW_DMA_1: TB = 0x80; TC = 0x06; break;
167 case XFER_SW_DMA_0: TB = 0xC0; TC = 0x0B; break; 103 case XFER_SW_DMA_0: TB = 0xC0; TC = 0x0B; break;
@@ -174,25 +110,39 @@ static int pdc202xx_tune_chipset (ide_drive_t *drive, u8 xferspeed)
174 } 110 }
175 111
176 if (speed < XFER_SW_DMA_0) { 112 if (speed < XFER_SW_DMA_0) {
177 pci_write_config_byte(dev, (drive_pci), AP|TA); 113 /*
178 pci_write_config_byte(dev, (drive_pci)|0x01, BP|TB); 114 * preserve SYNC_INT / ERDDY_EN bits while clearing
115 * Prefetch_EN / IORDY_EN / PA[3:0] bits of register A
116 */
117 AP &= ~0x3f;
118 if (drive->id->capability & 4)
119 AP |= 0x20; /* set IORDY_EN bit */
120 if (drive->media == ide_disk)
121 AP |= 0x10; /* set Prefetch_EN bit */
122 /* clear PB[4:0] bits of register B */
123 BP &= ~0x1f;
124 pci_write_config_byte(dev, drive_pci, AP | TA);
125 pci_write_config_byte(dev, drive_pci + 1, BP | TB);
179 } else { 126 } else {
180 pci_write_config_byte(dev, (drive_pci)|0x01, BP|TB); 127 /* clear MB[2:0] bits of register B */
181 pci_write_config_byte(dev, (drive_pci)|0x02, CP|TC); 128 BP &= ~0xe0;
129 /* clear MC[3:0] bits of register C */
130 CP &= ~0x0f;
131 pci_write_config_byte(dev, drive_pci + 1, BP | TB);
132 pci_write_config_byte(dev, drive_pci + 2, CP | TC);
182 } 133 }
183 134
184#if PDC202XX_DEBUG_DRIVE_INFO 135#if PDC202XX_DEBUG_DRIVE_INFO
185 printk(KERN_DEBUG "%s: %s drive%d 0x%08x ", 136 printk(KERN_DEBUG "%s: %s drive%d 0x%08x ",
186 drive->name, ide_xfer_verbose(speed), 137 drive->name, ide_xfer_verbose(speed),
187 drive->dn, drive_conf); 138 drive->dn, drive_conf);
188 pci_read_config_dword(dev, drive_pci, &drive_conf); 139 pci_read_config_dword(dev, drive_pci, &drive_conf);
189 printk("0x%08x\n", drive_conf); 140 printk("0x%08x\n", drive_conf);
190#endif /* PDC202XX_DEBUG_DRIVE_INFO */ 141#endif
191 142
192 return (ide_config_drive_speed(drive, speed)); 143 return ide_config_drive_speed(drive, speed);
193} 144}
194 145
195
196static void pdc202xx_tune_drive(ide_drive_t *drive, u8 pio) 146static void pdc202xx_tune_drive(ide_drive_t *drive, u8 pio)
197{ 147{
198 pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 148 pio = ide_get_best_pio_mode(drive, pio, 4, NULL);
@@ -210,6 +160,8 @@ static u8 pdc202xx_old_cable_detect (ide_hwif_t *hwif)
210 * Set the control register to use the 66MHz system 160 * Set the control register to use the 66MHz system
211 * clock for UDMA 3/4/5 mode operation when necessary. 161 * clock for UDMA 3/4/5 mode operation when necessary.
212 * 162 *
163 * FIXME: this register is shared by both channels, some locking is needed
164 *
213 * It may also be possible to leave the 66MHz clock on 165 * It may also be possible to leave the 66MHz clock on
214 * and readjust the timing parameters. 166 * and readjust the timing parameters.
215 */ 167 */
@@ -229,65 +181,11 @@ static void pdc_old_disable_66MHz_clock(ide_hwif_t *hwif)
229 outb(clock & ~(hwif->channel ? 0x08 : 0x02), clock_reg); 181 outb(clock & ~(hwif->channel ? 0x08 : 0x02), clock_reg);
230} 182}
231 183
232static int config_chipset_for_dma (ide_drive_t *drive)
233{
234 struct hd_driveid *id = drive->id;
235 ide_hwif_t *hwif = HWIF(drive);
236 struct pci_dev *dev = hwif->pci_dev;
237 u32 drive_conf = 0;
238 u8 drive_pci = 0x60 + (drive->dn << 2);
239 u8 test1 = 0, test2 = 0, speed = -1;
240 u8 AP = 0;
241
242 if (dev->device != PCI_DEVICE_ID_PROMISE_20246)
243 pdc_old_disable_66MHz_clock(drive->hwif);
244
245 drive_pci = 0x60 + (drive->dn << 2);
246 pci_read_config_dword(dev, drive_pci, &drive_conf);
247 if ((drive_conf != 0x004ff304) && (drive_conf != 0x004ff3c4))
248 goto chipset_is_set;
249
250 pci_read_config_byte(dev, drive_pci, &test1);
251 if (!(test1 & SYNC_ERRDY_EN)) {
252 if (drive->select.b.unit & 0x01) {
253 pci_read_config_byte(dev, drive_pci - 4, &test2);
254 if ((test2 & SYNC_ERRDY_EN) &&
255 !(test1 & SYNC_ERRDY_EN)) {
256 pci_write_config_byte(dev, drive_pci,
257 test1|SYNC_ERRDY_EN);
258 }
259 } else {
260 pci_write_config_byte(dev, drive_pci,
261 test1|SYNC_ERRDY_EN);
262 }
263 }
264
265chipset_is_set:
266
267 pci_read_config_byte(dev, (drive_pci), &AP);
268 if (id->capability & 4) /* IORDY_EN */
269 pci_write_config_byte(dev, (drive_pci), AP|IORDY_EN);
270 pci_read_config_byte(dev, (drive_pci), &AP);
271 if (drive->media == ide_disk) /* PREFETCH_EN */
272 pci_write_config_byte(dev, (drive_pci), AP|PREFETCH_EN);
273
274 speed = ide_max_dma_mode(drive);
275
276 if (!(speed)) {
277 /* restore original pci-config space */
278 pci_write_config_dword(dev, drive_pci, drive_conf);
279 return 0;
280 }
281
282 (void) hwif->speedproc(drive, speed);
283 return ide_dma_enable(drive);
284}
285
286static int pdc202xx_config_drive_xfer_rate (ide_drive_t *drive) 184static int pdc202xx_config_drive_xfer_rate (ide_drive_t *drive)
287{ 185{
288 drive->init_speed = 0; 186 drive->init_speed = 0;
289 187
290 if (ide_use_dma(drive) && config_chipset_for_dma(drive)) 188 if (ide_tune_dma(drive))
291 return 0; 189 return 0;
292 190
293 if (ide_use_fast_pio(drive)) 191 if (ide_use_fast_pio(drive))
diff --git a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c
index b5ae0c50e216..523363c93794 100644
--- a/drivers/ide/pci/sc1200.c
+++ b/drivers/ide/pci/sc1200.c
@@ -1,7 +1,9 @@
1/* 1/*
2 * linux/drivers/ide/pci/sc1200.c Version 0.91 28-Jan-2003 2 * linux/drivers/ide/pci/sc1200.c Version 0.94 Mar 10 2007
3 * 3 *
4 * Copyright (C) 2000-2002 Mark Lord <mlord@pobox.com> 4 * Copyright (C) 2000-2002 Mark Lord <mlord@pobox.com>
5 * Copyright (C) 2007 Bartlomiej Zolnierkiewicz
6 *
5 * May be copied or modified under the terms of the GNU General Public License 7 * May be copied or modified under the terms of the GNU General Public License
6 * 8 *
7 * Development of this chipset driver was funded 9 * Development of this chipset driver was funded
@@ -93,64 +95,50 @@ static const unsigned int sc1200_pio_timings[4][5] =
93 */ 95 */
94//#define SC1200_BAD_PIO(timings) (((timings)&~0x80000000)==0x00009172) 96//#define SC1200_BAD_PIO(timings) (((timings)&~0x80000000)==0x00009172)
95 97
96static int sc1200_autoselect_dma_mode (ide_drive_t *drive) 98static void sc1200_tunepio(ide_drive_t *drive, u8 pio)
97{ 99{
98 int udma_ok = 1, mode = 0; 100 ide_hwif_t *hwif = drive->hwif;
99 ide_hwif_t *hwif = HWIF(drive); 101 struct pci_dev *pdev = hwif->pci_dev;
100 int unit = drive->select.b.unit; 102 unsigned int basereg = hwif->channel ? 0x50 : 0x40, format = 0;
101 ide_drive_t *mate = &hwif->drives[unit^1]; 103
102 struct hd_driveid *id = drive->id; 104 pci_read_config_dword(pdev, basereg + 4, &format);
103 105 format = (format >> 31) & 1;
104 /* 106 if (format)
105 * The SC1200 specifies that two drives sharing a cable cannot 107 format += sc1200_get_pci_clock();
106 * mix UDMA/MDMA. It has to be one or the other, for the pair, 108 pci_write_config_dword(pdev, basereg + ((drive->dn & 1) << 3),
107 * though different timings can still be chosen for each drive. 109 sc1200_pio_timings[format][pio]);
108 * We could set the appropriate timing bits on the fly,
109 * but that might be a bit confusing. So, for now we statically
110 * handle this requirement by looking at our mate drive to see
111 * what it is capable of, before choosing a mode for our own drive.
112 */
113 if (mate->present) {
114 struct hd_driveid *mateid = mate->id;
115 if (mateid && (mateid->capability & 1) && !__ide_dma_bad_drive(mate)) {
116 if ((mateid->field_valid & 4) && (mateid->dma_ultra & 7))
117 udma_ok = 1;
118 else if ((mateid->field_valid & 2) && (mateid->dma_mword & 7))
119 udma_ok = 0;
120 else
121 udma_ok = 1;
122 }
123 }
124 /*
125 * Now see what the current drive is capable of,
126 * selecting UDMA only if the mate said it was ok.
127 */
128 if (id && (id->capability & 1) && hwif->autodma && !__ide_dma_bad_drive(drive)) {
129 if (udma_ok && (id->field_valid & 4) && (id->dma_ultra & 7)) {
130 if (id->dma_ultra & 4)
131 mode = XFER_UDMA_2;
132 else if (id->dma_ultra & 2)
133 mode = XFER_UDMA_1;
134 else if (id->dma_ultra & 1)
135 mode = XFER_UDMA_0;
136 }
137 if (!mode && (id->field_valid & 2) && (id->dma_mword & 7)) {
138 if (id->dma_mword & 4)
139 mode = XFER_MW_DMA_2;
140 else if (id->dma_mword & 2)
141 mode = XFER_MW_DMA_1;
142 else if (id->dma_mword & 1)
143 mode = XFER_MW_DMA_0;
144 }
145 }
146 return mode;
147} 110}
148 111
149/* 112/*
150 * sc1200_config_dma2() handles selection/setting of DMA/UDMA modes 113 * The SC1200 specifies that two drives sharing a cable cannot mix
151 * for both the chipset and drive. 114 * UDMA/MDMA. It has to be one or the other, for the pair, though
115 * different timings can still be chosen for each drive. We could
116 * set the appropriate timing bits on the fly, but that might be
117 * a bit confusing. So, for now we statically handle this requirement
118 * by looking at our mate drive to see what it is capable of, before
119 * choosing a mode for our own drive.
152 */ 120 */
153static int sc1200_config_dma2 (ide_drive_t *drive, int mode) 121static u8 sc1200_udma_filter(ide_drive_t *drive)
122{
123 ide_hwif_t *hwif = drive->hwif;
124 ide_drive_t *mate = &hwif->drives[(drive->dn & 1) ^ 1];
125 struct hd_driveid *mateid = mate->id;
126 u8 mask = hwif->ultra_mask;
127
128 if (mate->present == 0)
129 goto out;
130
131 if ((mateid->capability & 1) && __ide_dma_bad_drive(mate) == 0) {
132 if ((mateid->field_valid & 4) && (mateid->dma_ultra & 7))
133 goto out;
134 if ((mateid->field_valid & 2) && (mateid->dma_mword & 7))
135 mask = 0;
136 }
137out:
138 return mask;
139}
140
141static int sc1200_tune_chipset(ide_drive_t *drive, u8 mode)
154{ 142{
155 ide_hwif_t *hwif = HWIF(drive); 143 ide_hwif_t *hwif = HWIF(drive);
156 int unit = drive->select.b.unit; 144 int unit = drive->select.b.unit;
@@ -158,20 +146,26 @@ static int sc1200_config_dma2 (ide_drive_t *drive, int mode)
158 unsigned short pci_clock; 146 unsigned short pci_clock;
159 unsigned int basereg = hwif->channel ? 0x50 : 0x40; 147 unsigned int basereg = hwif->channel ? 0x50 : 0x40;
160 148
161 /* 149 mode = ide_rate_filter(drive, mode);
162 * Default to DMA-off in case we run into trouble here.
163 */
164 hwif->dma_off_quietly(drive); /* turn off DMA while we fiddle */
165 outb(inb(hwif->dma_base+2)&~(unit?0x40:0x20), hwif->dma_base+2); /* clear DMA_capable bit */
166 150
167 /* 151 /*
168 * Tell the drive to switch to the new mode; abort on failure. 152 * Tell the drive to switch to the new mode; abort on failure.
169 */ 153 */
170 if (!mode || sc1200_set_xfer_mode(drive, mode)) { 154 if (sc1200_set_xfer_mode(drive, mode)) {
171 printk("SC1200: set xfer mode failure\n"); 155 printk("SC1200: set xfer mode failure\n");
172 return 1; /* failure */ 156 return 1; /* failure */
173 } 157 }
174 158
159 switch (mode) {
160 case XFER_PIO_4:
161 case XFER_PIO_3:
162 case XFER_PIO_2:
163 case XFER_PIO_1:
164 case XFER_PIO_0:
165 sc1200_tunepio(drive, mode - XFER_PIO_0);
166 return 0;
167 }
168
175 pci_clock = sc1200_get_pci_clock(); 169 pci_clock = sc1200_get_pci_clock();
176 170
177 /* 171 /*
@@ -224,11 +218,9 @@ static int sc1200_config_dma2 (ide_drive_t *drive, int mode)
224 case PCI_CLK_66: timings = 0x00015151; break; 218 case PCI_CLK_66: timings = 0x00015151; break;
225 } 219 }
226 break; 220 break;
227 } 221 default:
228 222 BUG();
229 if (timings == 0) { 223 break;
230 printk("%s: sc1200_config_dma: huh? mode=%02x clk=%x \n", drive->name, mode, pci_clock);
231 return 1; /* failure */
232 } 224 }
233 225
234 if (unit == 0) { /* are we configuring drive0? */ 226 if (unit == 0) { /* are we configuring drive0? */
@@ -239,8 +231,6 @@ static int sc1200_config_dma2 (ide_drive_t *drive, int mode)
239 pci_write_config_dword(hwif->pci_dev, basereg+12, timings); 231 pci_write_config_dword(hwif->pci_dev, basereg+12, timings);
240 } 232 }
241 233
242 outb(inb(hwif->dma_base+2)|(unit?0x40:0x20), hwif->dma_base+2); /* set DMA_capable bit */
243
244 return 0; /* success */ 234 return 0; /* success */
245} 235}
246 236
@@ -250,7 +240,10 @@ static int sc1200_config_dma2 (ide_drive_t *drive, int mode)
250 */ 240 */
251static int sc1200_config_dma (ide_drive_t *drive) 241static int sc1200_config_dma (ide_drive_t *drive)
252{ 242{
253 return sc1200_config_dma2(drive, sc1200_autoselect_dma_mode(drive)); 243 if (ide_tune_dma(drive))
244 return 0;
245
246 return 1;
254} 247}
255 248
256 249
@@ -290,10 +283,11 @@ static int sc1200_ide_dma_end (ide_drive_t *drive)
290static void sc1200_tuneproc (ide_drive_t *drive, byte pio) /* mode=255 means "autotune" */ 283static void sc1200_tuneproc (ide_drive_t *drive, byte pio) /* mode=255 means "autotune" */
291{ 284{
292 ide_hwif_t *hwif = HWIF(drive); 285 ide_hwif_t *hwif = HWIF(drive);
293 unsigned int format;
294 static byte modes[5] = {XFER_PIO_0, XFER_PIO_1, XFER_PIO_2, XFER_PIO_3, XFER_PIO_4};
295 int mode = -1; 286 int mode = -1;
296 287
288 /*
289 * bad abuse of ->tuneproc interface
290 */
297 switch (pio) { 291 switch (pio) {
298 case 200: mode = XFER_UDMA_0; break; 292 case 200: mode = XFER_UDMA_0; break;
299 case 201: mode = XFER_UDMA_1; break; 293 case 201: mode = XFER_UDMA_1; break;
@@ -304,20 +298,17 @@ static void sc1200_tuneproc (ide_drive_t *drive, byte pio) /* mode=255 means "au
304 } 298 }
305 if (mode != -1) { 299 if (mode != -1) {
306 printk("SC1200: %s: changing (U)DMA mode\n", drive->name); 300 printk("SC1200: %s: changing (U)DMA mode\n", drive->name);
307 (void)sc1200_config_dma2(drive, mode); 301 hwif->dma_off_quietly(drive);
302 if (sc1200_tune_chipset(drive, mode) == 0)
303 hwif->dma_host_on(drive);
308 return; 304 return;
309 } 305 }
310 306
311 pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 307 pio = ide_get_best_pio_mode(drive, pio, 4, NULL);
312 printk("SC1200: %s: setting PIO mode%d\n", drive->name, pio); 308 printk("SC1200: %s: setting PIO mode%d\n", drive->name, pio);
313 if (!sc1200_set_xfer_mode(drive, modes[pio])) { 309
314 unsigned int basereg = hwif->channel ? 0x50 : 0x40; 310 if (sc1200_set_xfer_mode(drive, XFER_PIO_0 + pio) == 0)
315 pci_read_config_dword (hwif->pci_dev, basereg+4, &format); 311 sc1200_tunepio(drive, pio);
316 format = (format >> 31) & 1;
317 if (format)
318 format += sc1200_get_pci_clock();
319 pci_write_config_dword(hwif->pci_dev, basereg + (drive->select.b.unit << 3), sc1200_pio_timings[format][pio]);
320 }
321} 312}
322 313
323#ifdef CONFIG_PM 314#ifdef CONFIG_PM
@@ -438,12 +429,12 @@ static int sc1200_resume (struct pci_dev *dev)
438 for (d = 0; d < MAX_DRIVES; ++d) { 429 for (d = 0; d < MAX_DRIVES; ++d) {
439 ide_drive_t *drive = &(hwif->drives[d]); 430 ide_drive_t *drive = &(hwif->drives[d]);
440 if (drive->present && !__ide_dma_bad_drive(drive)) { 431 if (drive->present && !__ide_dma_bad_drive(drive)) {
441 int was_using_dma = drive->using_dma; 432 int enable_dma = drive->using_dma;
442 hwif->dma_off_quietly(drive); 433 hwif->dma_off_quietly(drive);
443 sc1200_config_dma(drive); 434 if (sc1200_config_dma(drive))
444 if (!was_using_dma && drive->using_dma) { 435 enable_dma = 0;
445 hwif->dma_off_quietly(drive); 436 if (enable_dma)
446 } 437 hwif->dma_host_on(drive);
447 } 438 }
448 } 439 }
449 } 440 }
@@ -461,11 +452,13 @@ static void __devinit init_hwif_sc1200 (ide_hwif_t *hwif)
461 hwif->serialized = hwif->mate->serialized = 1; 452 hwif->serialized = hwif->mate->serialized = 1;
462 hwif->autodma = 0; 453 hwif->autodma = 0;
463 if (hwif->dma_base) { 454 if (hwif->dma_base) {
455 hwif->udma_filter = sc1200_udma_filter;
464 hwif->ide_dma_check = &sc1200_config_dma; 456 hwif->ide_dma_check = &sc1200_config_dma;
465 hwif->ide_dma_end = &sc1200_ide_dma_end; 457 hwif->ide_dma_end = &sc1200_ide_dma_end;
466 if (!noautodma) 458 if (!noautodma)
467 hwif->autodma = 1; 459 hwif->autodma = 1;
468 hwif->tuneproc = &sc1200_tuneproc; 460 hwif->tuneproc = &sc1200_tuneproc;
461 hwif->speedproc = &sc1200_tune_chipset;
469 } 462 }
470 hwif->atapi_dma = 1; 463 hwif->atapi_dma = 1;
471 hwif->ultra_mask = 0x07; 464 hwif->ultra_mask = 0x07;
diff --git a/drivers/ide/pci/scc_pata.c b/drivers/ide/pci/scc_pata.c
index cbf936325355..55bc0a32e34f 100644
--- a/drivers/ide/pci/scc_pata.c
+++ b/drivers/ide/pci/scc_pata.c
@@ -322,26 +322,6 @@ static int scc_tune_chipset(ide_drive_t *drive, byte xferspeed)
322} 322}
323 323
324/** 324/**
325 * scc_config_chipset_for_dma - configure for DMA
326 * @drive: drive to configure
327 *
328 * Called by scc_config_drive_for_dma().
329 */
330
331static int scc_config_chipset_for_dma(ide_drive_t *drive)
332{
333 u8 speed = ide_max_dma_mode(drive);
334
335 if (!speed)
336 return 0;
337
338 if (scc_tune_chipset(drive, speed))
339 return 0;
340
341 return ide_dma_enable(drive);
342}
343
344/**
345 * scc_configure_drive_for_dma - set up for DMA transfers 325 * scc_configure_drive_for_dma - set up for DMA transfers
346 * @drive: drive we are going to set up 326 * @drive: drive we are going to set up
347 * 327 *
@@ -354,7 +334,7 @@ static int scc_config_chipset_for_dma(ide_drive_t *drive)
354 334
355static int scc_config_drive_for_dma(ide_drive_t *drive) 335static int scc_config_drive_for_dma(ide_drive_t *drive)
356{ 336{
357 if (ide_use_dma(drive) && scc_config_chipset_for_dma(drive)) 337 if (ide_tune_dma(drive))
358 return 0; 338 return 0;
359 339
360 if (ide_use_fast_pio(drive)) 340 if (ide_use_fast_pio(drive))
diff --git a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c
index 2fa6d92d16cc..6234f806c6b5 100644
--- a/drivers/ide/pci/serverworks.c
+++ b/drivers/ide/pci/serverworks.c
@@ -1,9 +1,10 @@
1/* 1/*
2 * linux/drivers/ide/pci/serverworks.c Version 0.8 25 Ebr 2003 2 * linux/drivers/ide/pci/serverworks.c Version 0.9 Mar 4 2007
3 * 3 *
4 * Copyright (C) 1998-2000 Michel Aubry 4 * Copyright (C) 1998-2000 Michel Aubry
5 * Copyright (C) 1998-2000 Andrzej Krzysztofowicz 5 * Copyright (C) 1998-2000 Andrzej Krzysztofowicz
6 * Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org> 6 * Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org>
7 * Copyright (C) 2007 Bartlomiej Zolnierkiewicz
7 * Portions copyright (c) 2001 Sun Microsystems 8 * Portions copyright (c) 2001 Sun Microsystems
8 * 9 *
9 * 10 *
@@ -136,19 +137,14 @@ static int svwks_tune_chipset (ide_drive_t *drive, u8 xferspeed)
136 137
137 ide_hwif_t *hwif = HWIF(drive); 138 ide_hwif_t *hwif = HWIF(drive);
138 struct pci_dev *dev = hwif->pci_dev; 139 struct pci_dev *dev = hwif->pci_dev;
139 u8 speed; 140 u8 speed = ide_rate_filter(drive, xferspeed);
140 u8 pio = ide_get_best_pio_mode(drive, 255, 5, NULL); 141 u8 pio = ide_get_best_pio_mode(drive, 255, 4, NULL);
141 u8 unit = (drive->select.b.unit & 0x01); 142 u8 unit = (drive->select.b.unit & 0x01);
142 u8 csb5 = svwks_csb_check(dev); 143 u8 csb5 = svwks_csb_check(dev);
143 u8 ultra_enable = 0, ultra_timing = 0; 144 u8 ultra_enable = 0, ultra_timing = 0;
144 u8 dma_timing = 0, pio_timing = 0; 145 u8 dma_timing = 0, pio_timing = 0;
145 u16 csb5_pio = 0; 146 u16 csb5_pio = 0;
146 147
147 if (xferspeed == 255) /* PIO auto-tuning */
148 speed = XFER_PIO_0 + pio;
149 else
150 speed = ide_rate_filter(drive, xferspeed);
151
152 /* If we are about to put a disk into UDMA mode we screwed up. 148 /* If we are about to put a disk into UDMA mode we screwed up.
153 Our code assumes we never _ever_ do this on an OSB4 */ 149 Our code assumes we never _ever_ do this on an OSB4 */
154 150
@@ -231,6 +227,9 @@ oem_setup_failed:
231 case XFER_MW_DMA_2: 227 case XFER_MW_DMA_2:
232 case XFER_MW_DMA_1: 228 case XFER_MW_DMA_1:
233 case XFER_MW_DMA_0: 229 case XFER_MW_DMA_0:
230 /*
231 * TODO: always setup PIO mode so this won't be needed
232 */
234 pio_timing |= pio_modes[pio]; 233 pio_timing |= pio_modes[pio];
235 csb5_pio |= (pio << (4*drive->dn)); 234 csb5_pio |= (pio << (4*drive->dn));
236 dma_timing |= dma_modes[speed - XFER_MW_DMA_0]; 235 dma_timing |= dma_modes[speed - XFER_MW_DMA_0];
@@ -242,6 +241,9 @@ oem_setup_failed:
242 case XFER_UDMA_2: 241 case XFER_UDMA_2:
243 case XFER_UDMA_1: 242 case XFER_UDMA_1:
244 case XFER_UDMA_0: 243 case XFER_UDMA_0:
244 /*
245 * TODO: always setup PIO mode so this won't be needed
246 */
245 pio_timing |= pio_modes[pio]; 247 pio_timing |= pio_modes[pio];
246 csb5_pio |= (pio << (4*drive->dn)); 248 csb5_pio |= (pio << (4*drive->dn));
247 dma_timing |= dma_modes[2]; 249 dma_timing |= dma_modes[2];
@@ -262,72 +264,21 @@ oem_setup_failed:
262 return (ide_config_drive_speed(drive, speed)); 264 return (ide_config_drive_speed(drive, speed));
263} 265}
264 266
265static void config_chipset_for_pio (ide_drive_t *drive)
266{
267 u16 eide_pio_timing[6] = {960, 480, 240, 180, 120, 90};
268 u16 xfer_pio = drive->id->eide_pio_modes;
269 u8 timing, speed, pio;
270
271 pio = ide_get_best_pio_mode(drive, 255, 5, NULL);
272
273 if (xfer_pio > 4)
274 xfer_pio = 0;
275
276 if (drive->id->eide_pio_iordy > 0)
277 for (xfer_pio = 5;
278 xfer_pio>0 &&
279 drive->id->eide_pio_iordy>eide_pio_timing[xfer_pio];
280 xfer_pio--);
281 else
282 xfer_pio = (drive->id->eide_pio_modes & 4) ? 0x05 :
283 (drive->id->eide_pio_modes & 2) ? 0x04 :
284 (drive->id->eide_pio_modes & 1) ? 0x03 :
285 (drive->id->tPIO & 2) ? 0x02 :
286 (drive->id->tPIO & 1) ? 0x01 : xfer_pio;
287
288 timing = (xfer_pio >= pio) ? xfer_pio : pio;
289
290 switch(timing) {
291 case 4: speed = XFER_PIO_4;break;
292 case 3: speed = XFER_PIO_3;break;
293 case 2: speed = XFER_PIO_2;break;
294 case 1: speed = XFER_PIO_1;break;
295 default:
296 speed = (!drive->id->tPIO) ? XFER_PIO_0 : XFER_PIO_SLOW;
297 break;
298 }
299 (void) svwks_tune_chipset(drive, speed);
300 drive->current_speed = speed;
301}
302
303static void svwks_tune_drive (ide_drive_t *drive, u8 pio) 267static void svwks_tune_drive (ide_drive_t *drive, u8 pio)
304{ 268{
305 if(pio == 255) 269 pio = ide_get_best_pio_mode(drive, pio, 4, NULL);
306 (void) svwks_tune_chipset(drive, 255); 270 (void)svwks_tune_chipset(drive, XFER_PIO_0 + pio);
307 else
308 (void) svwks_tune_chipset(drive, (XFER_PIO_0 + pio));
309}
310
311static int config_chipset_for_dma (ide_drive_t *drive)
312{
313 u8 speed = ide_max_dma_mode(drive);
314
315 if (!(speed))
316 speed = XFER_PIO_0 + ide_get_best_pio_mode(drive, 255, 5, NULL);
317
318 (void) svwks_tune_chipset(drive, speed);
319 return ide_dma_enable(drive);
320} 271}
321 272
322static int svwks_config_drive_xfer_rate (ide_drive_t *drive) 273static int svwks_config_drive_xfer_rate (ide_drive_t *drive)
323{ 274{
324 drive->init_speed = 0; 275 drive->init_speed = 0;
325 276
326 if (ide_use_dma(drive) && config_chipset_for_dma(drive)) 277 if (ide_tune_dma(drive))
327 return 0; 278 return 0;
328 279
329 if (ide_use_fast_pio(drive)) 280 if (ide_use_fast_pio(drive))
330 config_chipset_for_pio(drive); 281 svwks_tune_drive(drive, 255);
331 282
332 return -1; 283 return -1;
333} 284}
diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c
index d09e74c2996e..1a4444e7226a 100644
--- a/drivers/ide/pci/siimage.c
+++ b/drivers/ide/pci/siimage.c
@@ -375,28 +375,6 @@ static int siimage_tune_chipset (ide_drive_t *drive, byte xferspeed)
375} 375}
376 376
377/** 377/**
378 * config_chipset_for_dma - configure for DMA
379 * @drive: drive to configure
380 *
381 * Called by the IDE layer when it wants the timings set up.
382 * For the CMD680 we also need to set up the PIO timings and
383 * enable DMA.
384 */
385
386static int config_chipset_for_dma (ide_drive_t *drive)
387{
388 u8 speed = ide_max_dma_mode(drive);
389
390 if (!speed)
391 return 0;
392
393 if (siimage_tune_chipset(drive, speed))
394 return 0;
395
396 return ide_dma_enable(drive);
397}
398
399/**
400 * siimage_configure_drive_for_dma - set up for DMA transfers 378 * siimage_configure_drive_for_dma - set up for DMA transfers
401 * @drive: drive we are going to set up 379 * @drive: drive we are going to set up
402 * 380 *
@@ -408,7 +386,7 @@ static int config_chipset_for_dma (ide_drive_t *drive)
408 386
409static int siimage_config_drive_for_dma (ide_drive_t *drive) 387static int siimage_config_drive_for_dma (ide_drive_t *drive)
410{ 388{
411 if (ide_use_dma(drive) && config_chipset_for_dma(drive)) 389 if (ide_tune_dma(drive))
412 return 0; 390 return 0;
413 391
414 if (ide_use_fast_pio(drive)) 392 if (ide_use_fast_pio(drive))
diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c
index 2bde1b92784a..bb6cc4aedd63 100644
--- a/drivers/ide/pci/sis5513.c
+++ b/drivers/ide/pci/sis5513.c
@@ -1,9 +1,11 @@
1/* 1/*
2 * linux/drivers/ide/pci/sis5513.c Version 0.16ac+vp Jun 18, 2003 2 * linux/drivers/ide/pci/sis5513.c Version 0.20 Mar 4, 2007
3 * 3 *
4 * Copyright (C) 1999-2000 Andre Hedrick <andre@linux-ide.org> 4 * Copyright (C) 1999-2000 Andre Hedrick <andre@linux-ide.org>
5 * Copyright (C) 2002 Lionel Bouton <Lionel.Bouton@inet6.fr>, Maintainer 5 * Copyright (C) 2002 Lionel Bouton <Lionel.Bouton@inet6.fr>, Maintainer
6 * Copyright (C) 2003 Vojtech Pavlik <vojtech@suse.cz> 6 * Copyright (C) 2003 Vojtech Pavlik <vojtech@suse.cz>
7 * Copyright (C) 2007 Bartlomiej Zolnierkiewicz
8 *
7 * May be copied or modified under the terms of the GNU General Public License 9 * May be copied or modified under the terms of the GNU General Public License
8 * 10 *
9 * 11 *
@@ -448,36 +450,15 @@ static void config_drive_art_rwp (ide_drive_t *drive)
448 pci_write_config_byte(dev, 0x4b, reg4bh|rw_prefetch); 450 pci_write_config_byte(dev, 0x4b, reg4bh|rw_prefetch);
449} 451}
450 452
451
452/* Set per-drive active and recovery time */ 453/* Set per-drive active and recovery time */
453static void config_art_rwp_pio (ide_drive_t *drive, u8 pio) 454static void config_art_rwp_pio (ide_drive_t *drive, u8 pio)
454{ 455{
455 ide_hwif_t *hwif = HWIF(drive); 456 ide_hwif_t *hwif = HWIF(drive);
456 struct pci_dev *dev = hwif->pci_dev; 457 struct pci_dev *dev = hwif->pci_dev;
457 458
458 u8 timing, drive_pci, test1, test2; 459 u8 drive_pci, test1, test2;
459
460 u16 eide_pio_timing[6] = {600, 390, 240, 180, 120, 90};
461 u16 xfer_pio = drive->id->eide_pio_modes;
462 460
463 config_drive_art_rwp(drive); 461 config_drive_art_rwp(drive);
464 pio = ide_get_best_pio_mode(drive, 255, pio, NULL);
465
466 if (xfer_pio> 4)
467 xfer_pio = 0;
468
469 if (drive->id->eide_pio_iordy > 0) {
470 for (xfer_pio = 5;
471 (xfer_pio > 0) &&
472 (drive->id->eide_pio_iordy > eide_pio_timing[xfer_pio]);
473 xfer_pio--);
474 } else {
475 xfer_pio = (drive->id->eide_pio_modes & 4) ? 0x05 :
476 (drive->id->eide_pio_modes & 2) ? 0x04 :
477 (drive->id->eide_pio_modes & 1) ? 0x03 : xfer_pio;
478 }
479
480 timing = (xfer_pio >= pio) ? xfer_pio : pio;
481 462
482 /* In pre ATA_133 case, drives sit at 0x40 + 4*drive->dn */ 463 /* In pre ATA_133 case, drives sit at 0x40 + 4*drive->dn */
483 drive_pci = 0x40; 464 drive_pci = 0x40;
@@ -500,17 +481,18 @@ static void config_art_rwp_pio (ide_drive_t *drive, u8 pio)
500 test1 &= ~0x0F; 481 test1 &= ~0x0F;
501 test2 &= ~0x07; 482 test2 &= ~0x07;
502 483
503 switch(timing) { 484 switch(pio) {
504 case 4: test1 |= 0x01; test2 |= 0x03; break; 485 case 4: test1 |= 0x01; test2 |= 0x03; break;
505 case 3: test1 |= 0x03; test2 |= 0x03; break; 486 case 3: test1 |= 0x03; test2 |= 0x03; break;
506 case 2: test1 |= 0x04; test2 |= 0x04; break; 487 case 2: test1 |= 0x04; test2 |= 0x04; break;
507 case 1: test1 |= 0x07; test2 |= 0x06; break; 488 case 1: test1 |= 0x07; test2 |= 0x06; break;
489 case 0: /* PIO0: register setting == X000 */
508 default: break; 490 default: break;
509 } 491 }
510 pci_write_config_byte(dev, drive_pci, test1); 492 pci_write_config_byte(dev, drive_pci, test1);
511 pci_write_config_byte(dev, drive_pci+1, test2); 493 pci_write_config_byte(dev, drive_pci+1, test2);
512 } else if (chipset_family < ATA_133) { 494 } else if (chipset_family < ATA_133) {
513 switch(timing) { /* active recovery 495 switch(pio) { /* active recovery
514 v v */ 496 v v */
515 case 4: test1 = 0x30|0x01; break; 497 case 4: test1 = 0x30|0x01; break;
516 case 3: test1 = 0x30|0x03; break; 498 case 3: test1 = 0x30|0x03; break;
@@ -525,24 +507,28 @@ static void config_art_rwp_pio (ide_drive_t *drive, u8 pio)
525 pci_read_config_dword(dev, drive_pci, &test3); 507 pci_read_config_dword(dev, drive_pci, &test3);
526 test3 &= 0xc0c00fff; 508 test3 &= 0xc0c00fff;
527 if (test3 & 0x08) { 509 if (test3 & 0x08) {
528 test3 |= (unsigned long)ini_time_value[ATA_133][timing] << 12; 510 test3 |= ini_time_value[ATA_133][pio] << 12;
529 test3 |= (unsigned long)act_time_value[ATA_133][timing] << 16; 511 test3 |= act_time_value[ATA_133][pio] << 16;
530 test3 |= (unsigned long)rco_time_value[ATA_133][timing] << 24; 512 test3 |= rco_time_value[ATA_133][pio] << 24;
531 } else { 513 } else {
532 test3 |= (unsigned long)ini_time_value[ATA_100][timing] << 12; 514 test3 |= ini_time_value[ATA_100][pio] << 12;
533 test3 |= (unsigned long)act_time_value[ATA_100][timing] << 16; 515 test3 |= act_time_value[ATA_100][pio] << 16;
534 test3 |= (unsigned long)rco_time_value[ATA_100][timing] << 24; 516 test3 |= rco_time_value[ATA_100][pio] << 24;
535 } 517 }
536 pci_write_config_dword(dev, drive_pci, test3); 518 pci_write_config_dword(dev, drive_pci, test3);
537 } 519 }
538} 520}
539 521
540static int config_chipset_for_pio (ide_drive_t *drive, u8 pio) 522static int sis5513_tune_drive(ide_drive_t *drive, u8 pio)
541{ 523{
542 if (pio == 255) 524 pio = ide_get_best_pio_mode(drive, pio, 4, NULL);
543 pio = ide_find_best_mode(drive, XFER_PIO | XFER_EPIO) - XFER_PIO_0;
544 config_art_rwp_pio(drive, pio); 525 config_art_rwp_pio(drive, pio);
545 return ide_config_drive_speed(drive, XFER_PIO_0 + min_t(u8, pio, 4)); 526 return ide_config_drive_speed(drive, XFER_PIO_0 + pio);
527}
528
529static void sis5513_tuneproc(ide_drive_t *drive, u8 pio)
530{
531 (void)sis5513_tune_drive(drive, pio);
546} 532}
547 533
548static int sis5513_tune_chipset (ide_drive_t *drive, u8 xferspeed) 534static int sis5513_tune_chipset (ide_drive_t *drive, u8 xferspeed)
@@ -622,25 +608,26 @@ static int sis5513_tune_chipset (ide_drive_t *drive, u8 xferspeed)
622 case XFER_SW_DMA_1: 608 case XFER_SW_DMA_1:
623 case XFER_SW_DMA_0: 609 case XFER_SW_DMA_0:
624 break; 610 break;
625 case XFER_PIO_4: return((int) config_chipset_for_pio(drive, 4)); 611 case XFER_PIO_4:
626 case XFER_PIO_3: return((int) config_chipset_for_pio(drive, 3)); 612 case XFER_PIO_3:
627 case XFER_PIO_2: return((int) config_chipset_for_pio(drive, 2)); 613 case XFER_PIO_2:
628 case XFER_PIO_1: return((int) config_chipset_for_pio(drive, 1)); 614 case XFER_PIO_1:
629 case XFER_PIO_0: 615 case XFER_PIO_0:
630 default: return((int) config_chipset_for_pio(drive, 0)); 616 return sis5513_tune_drive(drive, speed - XFER_PIO_0);
617 default:
618 BUG();
619 break;
631 } 620 }
632 621
633 return ((int) ide_config_drive_speed(drive, speed)); 622 return ide_config_drive_speed(drive, speed);
634}
635
636static void sis5513_tune_drive (ide_drive_t *drive, u8 pio)
637{
638 (void) config_chipset_for_pio(drive, pio);
639} 623}
640 624
641static int sis5513_config_xfer_rate(ide_drive_t *drive) 625static int sis5513_config_xfer_rate(ide_drive_t *drive)
642{ 626{
643 config_art_rwp_pio(drive, 5); 627 /*
628 * TODO: always set PIO mode and remove this
629 */
630 sis5513_tuneproc(drive, 255);
644 631
645 drive->init_speed = 0; 632 drive->init_speed = 0;
646 633
@@ -648,7 +635,7 @@ static int sis5513_config_xfer_rate(ide_drive_t *drive)
648 return 0; 635 return 0;
649 636
650 if (ide_use_fast_pio(drive)) 637 if (ide_use_fast_pio(drive))
651 sis5513_tune_drive(drive, 5); 638 sis5513_tuneproc(drive, 255);
652 639
653 return -1; 640 return -1;
654} 641}
@@ -836,7 +823,7 @@ static void __devinit init_hwif_sis5513 (ide_hwif_t *hwif)
836 if (!hwif->irq) 823 if (!hwif->irq)
837 hwif->irq = hwif->channel ? 15 : 14; 824 hwif->irq = hwif->channel ? 15 : 14;
838 825
839 hwif->tuneproc = &sis5513_tune_drive; 826 hwif->tuneproc = &sis5513_tuneproc;
840 hwif->speedproc = &sis5513_tune_chipset; 827 hwif->speedproc = &sis5513_tune_chipset;
841 828
842 if (!(hwif->dma_base)) { 829 if (!(hwif->dma_base)) {
diff --git a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c
index fe3b4b91f854..7c383d9cc472 100644
--- a/drivers/ide/pci/sl82c105.c
+++ b/drivers/ide/pci/sl82c105.c
@@ -82,7 +82,14 @@ static u8 sl82c105_tune_pio(ide_drive_t *drive, u8 pio)
82 82
83 pio = ide_get_best_pio_mode(drive, pio, 5, &p); 83 pio = ide_get_best_pio_mode(drive, pio, 5, &p);
84 84
85 drive->drive_data = drv_ctrl = get_pio_timings(&p); 85 drv_ctrl = get_pio_timings(&p);
86
87 /*
88 * Store the PIO timings so that we can restore them
89 * in case DMA will be turned off...
90 */
91 drive->drive_data &= 0xffff0000;
92 drive->drive_data |= drv_ctrl;
86 93
87 if (!drive->using_dma) { 94 if (!drive->using_dma) {
88 /* 95 /*
@@ -100,17 +107,55 @@ static u8 sl82c105_tune_pio(ide_drive_t *drive, u8 pio)
100} 107}
101 108
102/* 109/*
103 * Configure the drive for DMA. 110 * Configure the drive and chipset for a new transfer speed.
104 * We'll program the chipset only when DMA is actually turned on.
105 */ 111 */
106static int config_for_dma(ide_drive_t *drive) 112static int sl82c105_tune_chipset(ide_drive_t *drive, u8 speed)
107{ 113{
108 DBG(("config_for_dma(drive:%s)\n", drive->name)); 114 static u16 mwdma_timings[] = {0x0707, 0x0201, 0x0200};
115 u16 drv_ctrl;
109 116
110 if (ide_config_drive_speed(drive, XFER_MW_DMA_2) != 0) 117 DBG(("sl82c105_tune_chipset(drive:%s, speed:%s)\n",
111 return 0; 118 drive->name, ide_xfer_verbose(speed)));
112 119
113 return ide_dma_enable(drive); 120 speed = ide_rate_filter(drive, speed);
121
122 switch (speed) {
123 case XFER_MW_DMA_2:
124 case XFER_MW_DMA_1:
125 case XFER_MW_DMA_0:
126 drv_ctrl = mwdma_timings[speed - XFER_MW_DMA_0];
127
128 /*
129 * Store the DMA timings so that we can actually program
130 * them when DMA will be turned on...
131 */
132 drive->drive_data &= 0x0000ffff;
133 drive->drive_data |= (unsigned long)drv_ctrl << 16;
134
135 /*
136 * If we are already using DMA, we just reprogram
137 * the drive control register.
138 */
139 if (drive->using_dma) {
140 struct pci_dev *dev = HWIF(drive)->pci_dev;
141 int reg = 0x44 + drive->dn * 4;
142
143 pci_write_config_word(dev, reg, drv_ctrl);
144 }
145 break;
146 case XFER_PIO_5:
147 case XFER_PIO_4:
148 case XFER_PIO_3:
149 case XFER_PIO_2:
150 case XFER_PIO_1:
151 case XFER_PIO_0:
152 (void) sl82c105_tune_pio(drive, speed - XFER_PIO_0);
153 break;
154 default:
155 return -1;
156 }
157
158 return ide_config_drive_speed(drive, speed);
114} 159}
115 160
116/* 161/*
@@ -120,7 +165,7 @@ static int sl82c105_ide_dma_check(ide_drive_t *drive)
120{ 165{
121 DBG(("sl82c105_ide_dma_check(drive:%s)\n", drive->name)); 166 DBG(("sl82c105_ide_dma_check(drive:%s)\n", drive->name));
122 167
123 if (ide_use_dma(drive) && config_for_dma(drive)) 168 if (ide_tune_dma(drive))
124 return 0; 169 return 0;
125 170
126 return -1; 171 return -1;
@@ -219,7 +264,7 @@ static int sl82c105_ide_dma_on(ide_drive_t *drive)
219 264
220 rc = __ide_dma_on(drive); 265 rc = __ide_dma_on(drive);
221 if (rc == 0) { 266 if (rc == 0) {
222 pci_write_config_word(dev, reg, 0x0200); 267 pci_write_config_word(dev, reg, drive->drive_data >> 16);
223 268
224 printk(KERN_INFO "%s: DMA enabled\n", drive->name); 269 printk(KERN_INFO "%s: DMA enabled\n", drive->name);
225 } 270 }
@@ -304,7 +349,7 @@ static unsigned int sl82c105_bridge_revision(struct pci_dev *dev)
304 /* 349 /*
305 * The bridge should be part of the same device, but function 0. 350 * The bridge should be part of the same device, but function 0.
306 */ 351 */
307 bridge = pci_find_slot(dev->bus->number, 352 bridge = pci_get_bus_and_slot(dev->bus->number,
308 PCI_DEVFN(PCI_SLOT(dev->devfn), 0)); 353 PCI_DEVFN(PCI_SLOT(dev->devfn), 0));
309 if (!bridge) 354 if (!bridge)
310 return -1; 355 return -1;
@@ -314,13 +359,15 @@ static unsigned int sl82c105_bridge_revision(struct pci_dev *dev)
314 */ 359 */
315 if (bridge->vendor != PCI_VENDOR_ID_WINBOND || 360 if (bridge->vendor != PCI_VENDOR_ID_WINBOND ||
316 bridge->device != PCI_DEVICE_ID_WINBOND_83C553 || 361 bridge->device != PCI_DEVICE_ID_WINBOND_83C553 ||
317 bridge->class >> 8 != PCI_CLASS_BRIDGE_ISA) 362 bridge->class >> 8 != PCI_CLASS_BRIDGE_ISA) {
363 pci_dev_put(bridge);
318 return -1; 364 return -1;
319 365 }
320 /* 366 /*
321 * We need to find function 0's revision, not function 1 367 * We need to find function 0's revision, not function 1
322 */ 368 */
323 pci_read_config_byte(bridge, PCI_REVISION_ID, &rev); 369 pci_read_config_byte(bridge, PCI_REVISION_ID, &rev);
370 pci_dev_put(bridge);
324 371
325 return rev; 372 return rev;
326} 373}
@@ -357,6 +404,7 @@ static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif)
357 DBG(("init_hwif_sl82c105(hwif: ide%d)\n", hwif->index)); 404 DBG(("init_hwif_sl82c105(hwif: ide%d)\n", hwif->index));
358 405
359 hwif->tuneproc = &sl82c105_tune_drive; 406 hwif->tuneproc = &sl82c105_tune_drive;
407 hwif->speedproc = &sl82c105_tune_chipset;
360 hwif->selectproc = &sl82c105_selectproc; 408 hwif->selectproc = &sl82c105_selectproc;
361 hwif->resetproc = &sl82c105_resetproc; 409 hwif->resetproc = &sl82c105_resetproc;
362 410
@@ -388,7 +436,7 @@ static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif)
388 } 436 }
389 437
390 hwif->atapi_dma = 1; 438 hwif->atapi_dma = 1;
391 hwif->mwdma_mask = 0x04; 439 hwif->mwdma_mask = 0x07;
392 440
393 hwif->ide_dma_check = &sl82c105_ide_dma_check; 441 hwif->ide_dma_check = &sl82c105_ide_dma_check;
394 hwif->ide_dma_on = &sl82c105_ide_dma_on; 442 hwif->ide_dma_on = &sl82c105_ide_dma_on;
diff --git a/drivers/input/joystick/Kconfig b/drivers/input/joystick/Kconfig
index 82f563e24fdb..b0023452ec90 100644
--- a/drivers/input/joystick/Kconfig
+++ b/drivers/input/joystick/Kconfig
@@ -255,6 +255,7 @@ config JOYSTICK_JOYDUMP
255 255
256config JOYSTICK_XPAD 256config JOYSTICK_XPAD
257 tristate "X-Box gamepad support" 257 tristate "X-Box gamepad support"
258 depends on USB_ARCH_HAS_HCD
258 select USB 259 select USB
259 help 260 help
260 Say Y here if you want to use the X-Box pad with your computer. 261 Say Y here if you want to use the X-Box pad with your computer.
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 6013ace94d98..842a7b4d16f8 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -84,6 +84,7 @@ config INPUT_ATLAS_BTNS
84 84
85config INPUT_ATI_REMOTE 85config INPUT_ATI_REMOTE
86 tristate "ATI / X10 USB RF remote control" 86 tristate "ATI / X10 USB RF remote control"
87 depends on USB_ARCH_HAS_HCD
87 select USB 88 select USB
88 help 89 help
89 Say Y here if you want to use an ATI or X10 "Lola" USB remote control. 90 Say Y here if you want to use an ATI or X10 "Lola" USB remote control.
@@ -99,6 +100,7 @@ config INPUT_ATI_REMOTE
99 100
100config INPUT_ATI_REMOTE2 101config INPUT_ATI_REMOTE2
101 tristate "ATI / Philips USB RF remote control" 102 tristate "ATI / Philips USB RF remote control"
103 depends on USB_ARCH_HAS_HCD
102 select USB 104 select USB
103 help 105 help
104 Say Y here if you want to use an ATI or Philips USB RF remote control. 106 Say Y here if you want to use an ATI or Philips USB RF remote control.
@@ -114,6 +116,7 @@ config INPUT_ATI_REMOTE2
114config INPUT_KEYSPAN_REMOTE 116config INPUT_KEYSPAN_REMOTE
115 tristate "Keyspan DMR USB remote control (EXPERIMENTAL)" 117 tristate "Keyspan DMR USB remote control (EXPERIMENTAL)"
116 depends on EXPERIMENTAL 118 depends on EXPERIMENTAL
119 depends on USB_ARCH_HAS_HCD
117 select USB 120 select USB
118 help 121 help
119 Say Y here if you want to use a Keyspan DMR USB remote control. 122 Say Y here if you want to use a Keyspan DMR USB remote control.
@@ -128,6 +131,7 @@ config INPUT_KEYSPAN_REMOTE
128 131
129config INPUT_POWERMATE 132config INPUT_POWERMATE
130 tristate "Griffin PowerMate and Contour Jog support" 133 tristate "Griffin PowerMate and Contour Jog support"
134 depends on USB_ARCH_HAS_HCD
131 select USB 135 select USB
132 help 136 help
133 Say Y here if you want to use Griffin PowerMate or Contour Jog devices. 137 Say Y here if you want to use Griffin PowerMate or Contour Jog devices.
@@ -144,6 +148,7 @@ config INPUT_POWERMATE
144config INPUT_YEALINK 148config INPUT_YEALINK
145 tristate "Yealink usb-p1k voip phone" 149 tristate "Yealink usb-p1k voip phone"
146 depends EXPERIMENTAL 150 depends EXPERIMENTAL
151 depends on USB_ARCH_HAS_HCD
147 select USB 152 select USB
148 help 153 help
149 Say Y here if you want to enable keyboard and LCD functions of the 154 Say Y here if you want to enable keyboard and LCD functions of the
diff --git a/drivers/input/mouse/Kconfig b/drivers/input/mouse/Kconfig
index 2ccc114b3ff6..eb0167e9f0cb 100644
--- a/drivers/input/mouse/Kconfig
+++ b/drivers/input/mouse/Kconfig
@@ -111,6 +111,7 @@ config MOUSE_SERIAL
111 111
112config MOUSE_APPLETOUCH 112config MOUSE_APPLETOUCH
113 tristate "Apple USB Touchpad support" 113 tristate "Apple USB Touchpad support"
114 depends on USB_ARCH_HAS_HCD
114 select USB 115 select USB
115 help 116 help
116 Say Y here if you want to use an Apple USB Touchpad. 117 Say Y here if you want to use an Apple USB Touchpad.
diff --git a/drivers/input/tablet/Kconfig b/drivers/input/tablet/Kconfig
index 12dfb0eb3262..d371c0bdc0bd 100644
--- a/drivers/input/tablet/Kconfig
+++ b/drivers/input/tablet/Kconfig
@@ -13,6 +13,7 @@ if INPUT_TABLET
13 13
14config TABLET_USB_ACECAD 14config TABLET_USB_ACECAD
15 tristate "Acecad Flair tablet support (USB)" 15 tristate "Acecad Flair tablet support (USB)"
16 depends on USB_ARCH_HAS_HCD
16 select USB 17 select USB
17 help 18 help
18 Say Y here if you want to use the USB version of the Acecad Flair 19 Say Y here if you want to use the USB version of the Acecad Flair
@@ -25,6 +26,7 @@ config TABLET_USB_ACECAD
25 26
26config TABLET_USB_AIPTEK 27config TABLET_USB_AIPTEK
27 tristate "Aiptek 6000U/8000U tablet support (USB)" 28 tristate "Aiptek 6000U/8000U tablet support (USB)"
29 depends on USB_ARCH_HAS_HCD
28 select USB 30 select USB
29 help 31 help
30 Say Y here if you want to use the USB version of the Aiptek 6000U 32 Say Y here if you want to use the USB version of the Aiptek 6000U
@@ -49,6 +51,7 @@ config TABLET_USB_GTCO
49 51
50config TABLET_USB_KBTAB 52config TABLET_USB_KBTAB
51 tristate "KB Gear JamStudio tablet support (USB)" 53 tristate "KB Gear JamStudio tablet support (USB)"
54 depends on USB_ARCH_HAS_HCD
52 select USB 55 select USB
53 help 56 help
54 Say Y here if you want to use the USB version of the KB Gear 57 Say Y here if you want to use the USB version of the KB Gear
@@ -61,6 +64,7 @@ config TABLET_USB_KBTAB
61 64
62config TABLET_USB_WACOM 65config TABLET_USB_WACOM
63 tristate "Wacom Intuos/Graphire tablet support (USB)" 66 tristate "Wacom Intuos/Graphire tablet support (USB)"
67 depends on USB_ARCH_HAS_HCD
64 select USB 68 select USB
65 help 69 help
66 Say Y here if you want to use the USB version of the Wacom Intuos 70 Say Y here if you want to use the USB version of the Wacom Intuos
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index 5e640aeb03cd..4f091800bfeb 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -166,6 +166,7 @@ config TOUCHSCREEN_UCB1400
166 166
167config TOUCHSCREEN_USB_COMPOSITE 167config TOUCHSCREEN_USB_COMPOSITE
168 tristate "USB Touchscreen Driver" 168 tristate "USB Touchscreen Driver"
169 depends on USB_ARCH_HAS_HCD
169 select USB 170 select USB
170 help 171 help
171 USB Touchscreen driver for: 172 USB Touchscreen driver for:
diff --git a/drivers/media/video/em28xx/Kconfig b/drivers/media/video/em28xx/Kconfig
index 3823b62da4a4..2c450bd05af5 100644
--- a/drivers/media/video/em28xx/Kconfig
+++ b/drivers/media/video/em28xx/Kconfig
@@ -1,6 +1,6 @@
1config VIDEO_EM28XX 1config VIDEO_EM28XX
2 tristate "Empia EM2800/2820/2840 USB video capture support" 2 tristate "Empia EM2800/2820/2840 USB video capture support"
3 depends on VIDEO_V4L1 && I2C 3 depends on VIDEO_V4L1 && I2C && PCI
4 select VIDEO_BUF 4 select VIDEO_BUF
5 select VIDEO_TUNER 5 select VIDEO_TUNER
6 select VIDEO_TVEEPROM 6 select VIDEO_TVEEPROM
diff --git a/drivers/media/video/ivtv/Kconfig b/drivers/media/video/ivtv/Kconfig
index e854f3f1b70f..0cc98a0e2496 100644
--- a/drivers/media/video/ivtv/Kconfig
+++ b/drivers/media/video/ivtv/Kconfig
@@ -1,6 +1,6 @@
1config VIDEO_IVTV 1config VIDEO_IVTV
2 tristate "Conexant cx23416/cx23415 MPEG encoder/decoder support" 2 tristate "Conexant cx23416/cx23415 MPEG encoder/decoder support"
3 depends on VIDEO_V4L1 && VIDEO_V4L2 && USB && I2C && EXPERIMENTAL 3 depends on VIDEO_V4L1 && VIDEO_V4L2 && USB && I2C && EXPERIMENTAL && PCI
4 select FW_LOADER 4 select FW_LOADER
5 select VIDEO_TUNER 5 select VIDEO_TUNER
6 select VIDEO_TVEEPROM 6 select VIDEO_TVEEPROM
diff --git a/drivers/net/mlx4/alloc.c b/drivers/net/mlx4/alloc.c
index 9ffdb9d29da9..dfbd5809d744 100644
--- a/drivers/net/mlx4/alloc.c
+++ b/drivers/net/mlx4/alloc.c
@@ -33,6 +33,7 @@
33#include <linux/errno.h> 33#include <linux/errno.h>
34#include <linux/slab.h> 34#include <linux/slab.h>
35#include <linux/bitmap.h> 35#include <linux/bitmap.h>
36#include <linux/dma-mapping.h>
36 37
37#include "mlx4.h" 38#include "mlx4.h"
38 39
diff --git a/drivers/net/mlx4/eq.c b/drivers/net/mlx4/eq.c
index af016d0ea1c6..0f11adb8eb4a 100644
--- a/drivers/net/mlx4/eq.c
+++ b/drivers/net/mlx4/eq.c
@@ -33,6 +33,7 @@
33 33
34#include <linux/init.h> 34#include <linux/init.h>
35#include <linux/interrupt.h> 35#include <linux/interrupt.h>
36#include <linux/dma-mapping.h>
36 37
37#include <linux/mlx4/cmd.h> 38#include <linux/mlx4/cmd.h>
38 39
diff --git a/drivers/net/mlx4/icm.c b/drivers/net/mlx4/icm.c
index e96feaed6ed4..b7a4aa8476fb 100644
--- a/drivers/net/mlx4/icm.c
+++ b/drivers/net/mlx4/icm.c
@@ -33,6 +33,7 @@
33 33
34#include <linux/init.h> 34#include <linux/init.h>
35#include <linux/errno.h> 35#include <linux/errno.h>
36#include <linux/mm.h>
36 37
37#include <linux/mlx4/cmd.h> 38#include <linux/mlx4/cmd.h>
38 39
diff --git a/drivers/net/mlx4/reset.c b/drivers/net/mlx4/reset.c
index 51eef8492e93..e4dfd4b11a4a 100644
--- a/drivers/net/mlx4/reset.c
+++ b/drivers/net/mlx4/reset.c
@@ -35,6 +35,7 @@
35#include <linux/pci.h> 35#include <linux/pci.h>
36#include <linux/delay.h> 36#include <linux/delay.h>
37#include <linux/slab.h> 37#include <linux/slab.h>
38#include <linux/jiffies.h>
38 39
39#include "mlx4.h" 40#include "mlx4.h"
40 41
diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c
index bc7f3dee6e5b..8d38425e46c3 100644
--- a/drivers/net/pasemi_mac.c
+++ b/drivers/net/pasemi_mac.c
@@ -85,6 +85,7 @@ static int pasemi_get_mac_addr(struct pasemi_mac *mac)
85{ 85{
86 struct pci_dev *pdev = mac->pdev; 86 struct pci_dev *pdev = mac->pdev;
87 struct device_node *dn = pci_device_to_OF_node(pdev); 87 struct device_node *dn = pci_device_to_OF_node(pdev);
88 int len;
88 const u8 *maddr; 89 const u8 *maddr;
89 u8 addr[6]; 90 u8 addr[6];
90 91
@@ -94,9 +95,17 @@ static int pasemi_get_mac_addr(struct pasemi_mac *mac)
94 return -ENOENT; 95 return -ENOENT;
95 } 96 }
96 97
97 maddr = of_get_property(dn, "local-mac-address", NULL); 98 maddr = of_get_property(dn, "local-mac-address", &len);
99
100 if (maddr && len == 6) {
101 memcpy(mac->mac_addr, maddr, 6);
102 return 0;
103 }
104
105 /* Some old versions of firmware mistakenly uses mac-address
106 * (and as a string) instead of a byte array in local-mac-address.
107 */
98 108
99 /* Fall back to mac-address for older firmware */
100 if (maddr == NULL) 109 if (maddr == NULL)
101 maddr = of_get_property(dn, "mac-address", NULL); 110 maddr = of_get_property(dn, "mac-address", NULL);
102 111
@@ -106,6 +115,7 @@ static int pasemi_get_mac_addr(struct pasemi_mac *mac)
106 return -ENOENT; 115 return -ENOENT;
107 } 116 }
108 117
118
109 if (sscanf(maddr, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &addr[0], 119 if (sscanf(maddr, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &addr[0],
110 &addr[1], &addr[2], &addr[3], &addr[4], &addr[5]) != 6) { 120 &addr[1], &addr[2], &addr[3], &addr[4], &addr[5]) != 6) {
111 dev_warn(&pdev->dev, 121 dev_warn(&pdev->dev,
@@ -113,7 +123,8 @@ static int pasemi_get_mac_addr(struct pasemi_mac *mac)
113 return -EINVAL; 123 return -EINVAL;
114 } 124 }
115 125
116 memcpy(mac->mac_addr, addr, sizeof(addr)); 126 memcpy(mac->mac_addr, addr, 6);
127
117 return 0; 128 return 0;
118} 129}
119 130
@@ -384,17 +395,14 @@ static void pasemi_mac_replenish_rx_ring(struct net_device *dev)
384 395
385static void pasemi_mac_restart_rx_intr(struct pasemi_mac *mac) 396static void pasemi_mac_restart_rx_intr(struct pasemi_mac *mac)
386{ 397{
387 unsigned int reg, stat; 398 unsigned int reg, pcnt;
388 /* Re-enable packet count interrupts: finally 399 /* Re-enable packet count interrupts: finally
389 * ack the packet count interrupt we got in rx_intr. 400 * ack the packet count interrupt we got in rx_intr.
390 */ 401 */
391 402
392 pci_read_config_dword(mac->iob_pdev, 403 pcnt = *mac->rx_status & PAS_STATUS_PCNT_M;
393 PAS_IOB_DMA_RXCH_STAT(mac->dma_rxch),
394 &stat);
395 404
396 reg = PAS_IOB_DMA_RXCH_RESET_PCNT(stat & PAS_IOB_DMA_RXCH_STAT_CNTDEL_M) 405 reg = PAS_IOB_DMA_RXCH_RESET_PCNT(pcnt) | PAS_IOB_DMA_RXCH_RESET_PINTC;
397 | PAS_IOB_DMA_RXCH_RESET_PINTC;
398 406
399 pci_write_config_dword(mac->iob_pdev, 407 pci_write_config_dword(mac->iob_pdev,
400 PAS_IOB_DMA_RXCH_RESET(mac->dma_rxch), 408 PAS_IOB_DMA_RXCH_RESET(mac->dma_rxch),
@@ -403,14 +411,12 @@ static void pasemi_mac_restart_rx_intr(struct pasemi_mac *mac)
403 411
404static void pasemi_mac_restart_tx_intr(struct pasemi_mac *mac) 412static void pasemi_mac_restart_tx_intr(struct pasemi_mac *mac)
405{ 413{
406 unsigned int reg, stat; 414 unsigned int reg, pcnt;
407 415
408 /* Re-enable packet count interrupts */ 416 /* Re-enable packet count interrupts */
409 pci_read_config_dword(mac->iob_pdev, 417 pcnt = *mac->tx_status & PAS_STATUS_PCNT_M;
410 PAS_IOB_DMA_TXCH_STAT(mac->dma_txch), &stat);
411 418
412 reg = PAS_IOB_DMA_TXCH_RESET_PCNT(stat & PAS_IOB_DMA_TXCH_STAT_CNTDEL_M) 419 reg = PAS_IOB_DMA_TXCH_RESET_PCNT(pcnt) | PAS_IOB_DMA_TXCH_RESET_PINTC;
413 | PAS_IOB_DMA_TXCH_RESET_PINTC;
414 420
415 pci_write_config_dword(mac->iob_pdev, 421 pci_write_config_dword(mac->iob_pdev,
416 PAS_IOB_DMA_TXCH_RESET(mac->dma_txch), reg); 422 PAS_IOB_DMA_TXCH_RESET(mac->dma_txch), reg);
@@ -591,21 +597,24 @@ static irqreturn_t pasemi_mac_tx_intr(int irq, void *data)
591{ 597{
592 struct net_device *dev = data; 598 struct net_device *dev = data;
593 struct pasemi_mac *mac = netdev_priv(dev); 599 struct pasemi_mac *mac = netdev_priv(dev);
594 unsigned int reg; 600 unsigned int reg, pcnt;
595 601
596 if (!(*mac->tx_status & PAS_STATUS_CAUSE_M)) 602 if (!(*mac->tx_status & PAS_STATUS_CAUSE_M))
597 return IRQ_NONE; 603 return IRQ_NONE;
598 604
599 pasemi_mac_clean_tx(mac); 605 pasemi_mac_clean_tx(mac);
600 606
601 reg = PAS_IOB_DMA_TXCH_RESET_PINTC; 607 pcnt = *mac->tx_status & PAS_STATUS_PCNT_M;
608
609 reg = PAS_IOB_DMA_TXCH_RESET_PCNT(pcnt) | PAS_IOB_DMA_TXCH_RESET_PINTC;
602 610
603 if (*mac->tx_status & PAS_STATUS_SOFT) 611 if (*mac->tx_status & PAS_STATUS_SOFT)
604 reg |= PAS_IOB_DMA_TXCH_RESET_SINTC; 612 reg |= PAS_IOB_DMA_TXCH_RESET_SINTC;
605 if (*mac->tx_status & PAS_STATUS_ERROR) 613 if (*mac->tx_status & PAS_STATUS_ERROR)
606 reg |= PAS_IOB_DMA_TXCH_RESET_DINTC; 614 reg |= PAS_IOB_DMA_TXCH_RESET_DINTC;
607 615
608 pci_write_config_dword(mac->iob_pdev, PAS_IOB_DMA_TXCH_RESET(mac->dma_txch), 616 pci_write_config_dword(mac->iob_pdev,
617 PAS_IOB_DMA_TXCH_RESET(mac->dma_txch),
609 reg); 618 reg);
610 619
611 return IRQ_HANDLED; 620 return IRQ_HANDLED;
@@ -974,6 +983,7 @@ static int pasemi_mac_start_tx(struct sk_buff *skb, struct net_device *dev)
974 if (txring->next_to_clean - txring->next_to_use == TX_RING_SIZE) { 983 if (txring->next_to_clean - txring->next_to_use == TX_RING_SIZE) {
975 spin_unlock_irqrestore(&txring->lock, flags); 984 spin_unlock_irqrestore(&txring->lock, flags);
976 pasemi_mac_clean_tx(mac); 985 pasemi_mac_clean_tx(mac);
986 pasemi_mac_restart_tx_intr(mac);
977 spin_lock_irqsave(&txring->lock, flags); 987 spin_lock_irqsave(&txring->lock, flags);
978 988
979 if (txring->next_to_clean - txring->next_to_use == 989 if (txring->next_to_clean - txring->next_to_use ==
@@ -1210,6 +1220,7 @@ static void __devexit pasemi_mac_remove(struct pci_dev *pdev)
1210static struct pci_device_id pasemi_mac_pci_tbl[] = { 1220static struct pci_device_id pasemi_mac_pci_tbl[] = {
1211 { PCI_DEVICE(PCI_VENDOR_ID_PASEMI, 0xa005) }, 1221 { PCI_DEVICE(PCI_VENDOR_ID_PASEMI, 0xa005) },
1212 { PCI_DEVICE(PCI_VENDOR_ID_PASEMI, 0xa006) }, 1222 { PCI_DEVICE(PCI_VENDOR_ID_PASEMI, 0xa006) },
1223 { },
1213}; 1224};
1214 1225
1215MODULE_DEVICE_TABLE(pci, pasemi_mac_pci_tbl); 1226MODULE_DEVICE_TABLE(pci, pasemi_mac_pci_tbl);
diff --git a/drivers/net/pasemi_mac.h b/drivers/net/pasemi_mac.h
index 8bc0cea8b145..c29ee159c33d 100644
--- a/drivers/net/pasemi_mac.h
+++ b/drivers/net/pasemi_mac.h
@@ -341,7 +341,7 @@ enum {
341 PAS_IOB_DMA_TXCH_STAT_CNTDEL_M) 341 PAS_IOB_DMA_TXCH_STAT_CNTDEL_M)
342#define PAS_IOB_DMA_RXCH_RESET(i) (0x1500 + (i)*4) 342#define PAS_IOB_DMA_RXCH_RESET(i) (0x1500 + (i)*4)
343#define PAS_IOB_DMA_RXCH_RESET_PCNT_M 0xffff0000 343#define PAS_IOB_DMA_RXCH_RESET_PCNT_M 0xffff0000
344#define PAS_IOB_DMA_RXCH_RESET_PCNT_S 0 344#define PAS_IOB_DMA_RXCH_RESET_PCNT_S 16
345#define PAS_IOB_DMA_RXCH_RESET_PCNT(x) (((x) << PAS_IOB_DMA_RXCH_RESET_PCNT_S) & \ 345#define PAS_IOB_DMA_RXCH_RESET_PCNT(x) (((x) << PAS_IOB_DMA_RXCH_RESET_PCNT_S) & \
346 PAS_IOB_DMA_RXCH_RESET_PCNT_M) 346 PAS_IOB_DMA_RXCH_RESET_PCNT_M)
347#define PAS_IOB_DMA_RXCH_RESET_PCNTRST 0x00000020 347#define PAS_IOB_DMA_RXCH_RESET_PCNTRST 0x00000020
@@ -352,7 +352,7 @@ enum {
352#define PAS_IOB_DMA_RXCH_RESET_PINTC 0x00000001 352#define PAS_IOB_DMA_RXCH_RESET_PINTC 0x00000001
353#define PAS_IOB_DMA_TXCH_RESET(i) (0x1600 + (i)*4) 353#define PAS_IOB_DMA_TXCH_RESET(i) (0x1600 + (i)*4)
354#define PAS_IOB_DMA_TXCH_RESET_PCNT_M 0xffff0000 354#define PAS_IOB_DMA_TXCH_RESET_PCNT_M 0xffff0000
355#define PAS_IOB_DMA_TXCH_RESET_PCNT_S 0 355#define PAS_IOB_DMA_TXCH_RESET_PCNT_S 16
356#define PAS_IOB_DMA_TXCH_RESET_PCNT(x) (((x) << PAS_IOB_DMA_TXCH_RESET_PCNT_S) & \ 356#define PAS_IOB_DMA_TXCH_RESET_PCNT(x) (((x) << PAS_IOB_DMA_TXCH_RESET_PCNT_S) & \
357 PAS_IOB_DMA_TXCH_RESET_PCNT_M) 357 PAS_IOB_DMA_TXCH_RESET_PCNT_M)
358#define PAS_IOB_DMA_TXCH_RESET_PCNTRST 0x00000020 358#define PAS_IOB_DMA_TXCH_RESET_PCNTRST 0x00000020
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index 81f24847c963..db43e42bee35 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -77,7 +77,6 @@ static const char version[] =
77#include <linux/skbuff.h> 77#include <linux/skbuff.h>
78 78
79#include <asm/io.h> 79#include <asm/io.h>
80#include <asm/irq.h>
81 80
82#include "smc911x.h" 81#include "smc911x.h"
83 82
@@ -2084,12 +2083,11 @@ static int __init smc911x_probe(struct net_device *dev, unsigned long ioaddr)
2084 lp->ctl_rspeed = 100; 2083 lp->ctl_rspeed = 100;
2085 2084
2086 /* Grab the IRQ */ 2085 /* Grab the IRQ */
2087 retval = request_irq(dev->irq, &smc911x_interrupt, IRQF_SHARED, dev->name, dev); 2086 retval = request_irq(dev->irq, &smc911x_interrupt,
2087 IRQF_SHARED | IRQF_TRIGGER_FALLING, dev->name, dev);
2088 if (retval) 2088 if (retval)
2089 goto err_out; 2089 goto err_out;
2090 2090
2091 set_irq_type(dev->irq, IRQT_FALLING);
2092
2093#ifdef SMC_USE_DMA 2091#ifdef SMC_USE_DMA
2094 lp->rxdma = SMC_DMA_REQUEST(dev, smc911x_rx_dma_irq); 2092 lp->rxdma = SMC_DMA_REQUEST(dev, smc911x_rx_dma_irq);
2095 lp->txdma = SMC_DMA_REQUEST(dev, smc911x_tx_dma_irq); 2093 lp->txdma = SMC_DMA_REQUEST(dev, smc911x_tx_dma_irq);
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 0f667652fda9..c2ccbd098f53 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) Freescale Semicondutor, Inc. 2006. All rights reserved. 2 * Copyright (C) 2006-2007 Freescale Semicondutor, Inc. All rights reserved.
3 * 3 *
4 * Author: Shlomi Gridish <gridish@freescale.com> 4 * Author: Shlomi Gridish <gridish@freescale.com>
5 * Li Yang <leoli@freescale.com> 5 * Li Yang <leoli@freescale.com>
@@ -3737,21 +3737,21 @@ static int ucc_geth_close(struct net_device *dev)
3737 3737
3738const struct ethtool_ops ucc_geth_ethtool_ops = { }; 3738const struct ethtool_ops ucc_geth_ethtool_ops = { };
3739 3739
3740static phy_interface_t to_phy_interface(const char *interface_type) 3740static phy_interface_t to_phy_interface(const char *phy_connection_type)
3741{ 3741{
3742 if (strcasecmp(interface_type, "mii") == 0) 3742 if (strcasecmp(phy_connection_type, "mii") == 0)
3743 return PHY_INTERFACE_MODE_MII; 3743 return PHY_INTERFACE_MODE_MII;
3744 if (strcasecmp(interface_type, "gmii") == 0) 3744 if (strcasecmp(phy_connection_type, "gmii") == 0)
3745 return PHY_INTERFACE_MODE_GMII; 3745 return PHY_INTERFACE_MODE_GMII;
3746 if (strcasecmp(interface_type, "tbi") == 0) 3746 if (strcasecmp(phy_connection_type, "tbi") == 0)
3747 return PHY_INTERFACE_MODE_TBI; 3747 return PHY_INTERFACE_MODE_TBI;
3748 if (strcasecmp(interface_type, "rmii") == 0) 3748 if (strcasecmp(phy_connection_type, "rmii") == 0)
3749 return PHY_INTERFACE_MODE_RMII; 3749 return PHY_INTERFACE_MODE_RMII;
3750 if (strcasecmp(interface_type, "rgmii") == 0) 3750 if (strcasecmp(phy_connection_type, "rgmii") == 0)
3751 return PHY_INTERFACE_MODE_RGMII; 3751 return PHY_INTERFACE_MODE_RGMII;
3752 if (strcasecmp(interface_type, "rgmii-id") == 0) 3752 if (strcasecmp(phy_connection_type, "rgmii-id") == 0)
3753 return PHY_INTERFACE_MODE_RGMII_ID; 3753 return PHY_INTERFACE_MODE_RGMII_ID;
3754 if (strcasecmp(interface_type, "rtbi") == 0) 3754 if (strcasecmp(phy_connection_type, "rtbi") == 0)
3755 return PHY_INTERFACE_MODE_RTBI; 3755 return PHY_INTERFACE_MODE_RTBI;
3756 3756
3757 return PHY_INTERFACE_MODE_MII; 3757 return PHY_INTERFACE_MODE_MII;
@@ -3819,29 +3819,21 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
3819 ug_info->phy_address = *prop; 3819 ug_info->phy_address = *prop;
3820 3820
3821 /* get the phy interface type, or default to MII */ 3821 /* get the phy interface type, or default to MII */
3822 prop = of_get_property(np, "interface-type", NULL); 3822 prop = of_get_property(np, "phy-connection-type", NULL);
3823 if (!prop) { 3823 if (!prop) {
3824 /* handle interface property present in old trees */ 3824 /* handle interface property present in old trees */
3825 prop = of_get_property(phy, "interface", NULL); 3825 prop = of_get_property(phy, "interface", NULL);
3826 if (prop != NULL) 3826 if (prop != NULL) {
3827 phy_interface = enet_to_phy_interface[*prop]; 3827 phy_interface = enet_to_phy_interface[*prop];
3828 else 3828 max_speed = enet_to_speed[*prop];
3829 } else
3829 phy_interface = PHY_INTERFACE_MODE_MII; 3830 phy_interface = PHY_INTERFACE_MODE_MII;
3830 } else { 3831 } else {
3831 phy_interface = to_phy_interface((const char *)prop); 3832 phy_interface = to_phy_interface((const char *)prop);
3832 } 3833 }
3833 3834
3834 /* get speed, or derive from interface */ 3835 /* get speed, or derive from PHY interface */
3835 prop = of_get_property(np, "max-speed", NULL); 3836 if (max_speed == 0)
3836 if (!prop) {
3837 /* handle interface property present in old trees */
3838 prop = of_get_property(phy, "interface", NULL);
3839 if (prop != NULL)
3840 max_speed = enet_to_speed[*prop];
3841 } else {
3842 max_speed = *prop;
3843 }
3844 if (!max_speed) {
3845 switch (phy_interface) { 3837 switch (phy_interface) {
3846 case PHY_INTERFACE_MODE_GMII: 3838 case PHY_INTERFACE_MODE_GMII:
3847 case PHY_INTERFACE_MODE_RGMII: 3839 case PHY_INTERFACE_MODE_RGMII:
@@ -3854,9 +3846,9 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
3854 max_speed = SPEED_100; 3846 max_speed = SPEED_100;
3855 break; 3847 break;
3856 } 3848 }
3857 }
3858 3849
3859 if (max_speed == SPEED_1000) { 3850 if (max_speed == SPEED_1000) {
3851 /* configure muram FIFOs for gigabit operation */
3860 ug_info->uf_info.urfs = UCC_GETH_URFS_GIGA_INIT; 3852 ug_info->uf_info.urfs = UCC_GETH_URFS_GIGA_INIT;
3861 ug_info->uf_info.urfet = UCC_GETH_URFET_GIGA_INIT; 3853 ug_info->uf_info.urfet = UCC_GETH_URFET_GIGA_INIT;
3862 ug_info->uf_info.urfset = UCC_GETH_URFSET_GIGA_INIT; 3854 ug_info->uf_info.urfset = UCC_GETH_URFSET_GIGA_INIT;
diff --git a/drivers/net/ucc_geth_mii.c b/drivers/net/ucc_geth_mii.c
index 27a1ef3b7b06..f96966d4bcc2 100644
--- a/drivers/net/ucc_geth_mii.c
+++ b/drivers/net/ucc_geth_mii.c
@@ -1,12 +1,13 @@
1/* 1/*
2 * drivers/net/ucc_geth_mii.c 2 * drivers/net/ucc_geth_mii.c
3 * 3 *
4 * Gianfar Ethernet Driver -- MIIM bus implementation 4 * QE UCC Gigabit Ethernet Driver -- MII Management Bus Implementation
5 * Provides Bus interface for MIIM regs 5 * Provides Bus interface for MII Management regs in the UCC register space
6 * 6 *
7 * Author: Li Yang 7 * Copyright (C) 2007 Freescale Semiconductor, Inc.
8 * 8 *
9 * Copyright (c) 2002-2004 Freescale Semiconductor, Inc. 9 * Authors: Li Yang <leoli@freescale.com>
10 * Kim Phillips <kim.phillips@freescale.com>
10 * 11 *
11 * This program is free software; you can redistribute it and/or modify it 12 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the 13 * under the terms of the GNU General Public License as published by the
diff --git a/drivers/net/ucc_geth_mii.h b/drivers/net/ucc_geth_mii.h
index 98430fe0bfc6..d83437039919 100644
--- a/drivers/net/ucc_geth_mii.h
+++ b/drivers/net/ucc_geth_mii.h
@@ -1,13 +1,13 @@
1/* 1/*
2 * drivers/net/ucc_geth_mii.h 2 * drivers/net/ucc_geth_mii.h
3 * 3 *
4 * Gianfar Ethernet Driver -- MII Management Bus Implementation 4 * QE UCC Gigabit Ethernet Driver -- MII Management Bus Implementation
5 * Driver for the MDIO bus controller in the Gianfar register space 5 * Provides Bus interface for MII Management regs in the UCC register space
6 * 6 *
7 * Author: Andy Fleming 7 * Copyright (C) 2007 Freescale Semiconductor, Inc.
8 * Maintainer: Kumar Gala
9 * 8 *
10 * Copyright (c) 2002-2004 Freescale Semiconductor, Inc. 9 * Authors: Li Yang <leoli@freescale.com>
10 * Kim Phillips <kim.phillips@freescale.com>
11 * 11 *
12 * This program is free software; you can redistribute it and/or modify it 12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the 13 * under the terms of the GNU General Public License as published by the
diff --git a/drivers/pci/hotplug/rpadlpar_sysfs.c b/drivers/pci/hotplug/rpadlpar_sysfs.c
index 6c5be3ff578c..df076064a3e0 100644
--- a/drivers/pci/hotplug/rpadlpar_sysfs.c
+++ b/drivers/pci/hotplug/rpadlpar_sysfs.c
@@ -129,8 +129,9 @@ struct kobj_type ktype_dlpar_io = {
129}; 129};
130 130
131struct kset dlpar_io_kset = { 131struct kset dlpar_io_kset = {
132 .subsys = &pci_hotplug_slots_subsys, 132 .kobj = {.name = DLPAR_KOBJ_NAME,
133 .kobj = {.name = DLPAR_KOBJ_NAME, .ktype=&ktype_dlpar_io,}, 133 .ktype = &ktype_dlpar_io,
134 .parent = &pci_hotplug_slots_subsys.kobj},
134 .ktype = &ktype_dlpar_io, 135 .ktype = &ktype_dlpar_io,
135}; 136};
136 137
diff --git a/include/asm-m32r/system.h b/include/asm-m32r/system.h
index b291b2f72954..8ee73d3f316d 100644
--- a/include/asm-m32r/system.h
+++ b/include/asm-m32r/system.h
@@ -10,6 +10,7 @@
10 * Copyright (C) 2004, 2006 Hirokazu Takata <takata at linux-m32r.org> 10 * Copyright (C) 2004, 2006 Hirokazu Takata <takata at linux-m32r.org>
11 */ 11 */
12 12
13#include <linux/compiler.h>
13#include <asm/assembler.h> 14#include <asm/assembler.h>
14 15
15#ifdef __KERNEL__ 16#ifdef __KERNEL__
@@ -154,7 +155,7 @@ extern void __xchg_called_with_bad_pointer(void);
154#define DCACHE_CLEAR(reg0, reg1, addr) 155#define DCACHE_CLEAR(reg0, reg1, addr)
155#endif /* CONFIG_CHIP_M32700_TS1 */ 156#endif /* CONFIG_CHIP_M32700_TS1 */
156 157
157static inline unsigned long 158static __always_inline unsigned long
158__xchg(unsigned long x, volatile void * ptr, int size) 159__xchg(unsigned long x, volatile void * ptr, int size)
159{ 160{
160 unsigned long flags; 161 unsigned long flags;
diff --git a/include/asm-sh64/dma-mapping.h b/include/asm-sh64/dma-mapping.h
index 5efe906c59f7..c7c0f059cdc4 100644
--- a/include/asm-sh64/dma-mapping.h
+++ b/include/asm-sh64/dma-mapping.h
@@ -35,6 +35,10 @@ static inline void dma_free_coherent(struct device *dev, size_t size,
35 consistent_free(NULL, size, vaddr, dma_handle); 35 consistent_free(NULL, size, vaddr, dma_handle);
36} 36}
37 37
38#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
39#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
40#define dma_is_consistent(d, h) (1)
41
38static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size, 42static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
39 enum dma_data_direction dir) 43 enum dma_data_direction dir)
40{ 44{
@@ -49,7 +53,7 @@ static inline dma_addr_t dma_map_single(struct device *dev,
49 if (dev->bus == &pci_bus_type) 53 if (dev->bus == &pci_bus_type)
50 return virt_to_bus(ptr); 54 return virt_to_bus(ptr);
51#endif 55#endif
52 dma_cache_sync(ptr, size, dir); 56 dma_cache_sync(dev, ptr, size, dir);
53 57
54 return virt_to_bus(ptr); 58 return virt_to_bus(ptr);
55} 59}
@@ -63,7 +67,7 @@ static inline int dma_map_sg(struct device *dev, struct scatterlist *sg,
63 67
64 for (i = 0; i < nents; i++) { 68 for (i = 0; i < nents; i++) {
65#if !defined(CONFIG_PCI) || defined(CONFIG_SH_PCIDMA_NONCOHERENT) 69#if !defined(CONFIG_PCI) || defined(CONFIG_SH_PCIDMA_NONCOHERENT)
66 dma_cache_sync(page_address(sg[i].page) + sg[i].offset, 70 dma_cache_sync(dev, page_address(sg[i].page) + sg[i].offset,
67 sg[i].length, dir); 71 sg[i].length, dir);
68#endif 72#endif
69 sg[i].dma_address = page_to_phys(sg[i].page) + sg[i].offset; 73 sg[i].dma_address = page_to_phys(sg[i].page) + sg[i].offset;
@@ -94,7 +98,7 @@ static inline void dma_sync_single(struct device *dev, dma_addr_t dma_handle,
94 if (dev->bus == &pci_bus_type) 98 if (dev->bus == &pci_bus_type)
95 return; 99 return;
96#endif 100#endif
97 dma_cache_sync(bus_to_virt(dma_handle), size, dir); 101 dma_cache_sync(dev, bus_to_virt(dma_handle), size, dir);
98} 102}
99 103
100static inline void dma_sync_single_range(struct device *dev, 104static inline void dma_sync_single_range(struct device *dev,
@@ -106,7 +110,7 @@ static inline void dma_sync_single_range(struct device *dev,
106 if (dev->bus == &pci_bus_type) 110 if (dev->bus == &pci_bus_type)
107 return; 111 return;
108#endif 112#endif
109 dma_cache_sync(bus_to_virt(dma_handle) + offset, size, dir); 113 dma_cache_sync(dev, bus_to_virt(dma_handle) + offset, size, dir);
110} 114}
111 115
112static inline void dma_sync_sg(struct device *dev, struct scatterlist *sg, 116static inline void dma_sync_sg(struct device *dev, struct scatterlist *sg,
@@ -116,7 +120,7 @@ static inline void dma_sync_sg(struct device *dev, struct scatterlist *sg,
116 120
117 for (i = 0; i < nelems; i++) { 121 for (i = 0; i < nelems; i++) {
118#if !defined(CONFIG_PCI) || defined(CONFIG_SH_PCIDMA_NONCOHERENT) 122#if !defined(CONFIG_PCI) || defined(CONFIG_SH_PCIDMA_NONCOHERENT)
119 dma_cache_sync(page_address(sg[i].page) + sg[i].offset, 123 dma_cache_sync(dev, page_address(sg[i].page) + sg[i].offset,
120 sg[i].length, dir); 124 sg[i].length, dir);
121#endif 125#endif
122 sg[i].dma_address = page_to_phys(sg[i].page) + sg[i].offset; 126 sg[i].dma_address = page_to_phys(sg[i].page) + sg[i].offset;
diff --git a/include/asm-sh64/irq_regs.h b/include/asm-sh64/irq_regs.h
new file mode 100644
index 000000000000..3dd9c0b70270
--- /dev/null
+++ b/include/asm-sh64/irq_regs.h
@@ -0,0 +1 @@
#include <asm-generic/irq_regs.h>
diff --git a/include/asm-sh64/pgalloc.h b/include/asm-sh64/pgalloc.h
index cb803e56cb64..6eccab770a6d 100644
--- a/include/asm-sh64/pgalloc.h
+++ b/include/asm-sh64/pgalloc.h
@@ -14,13 +14,9 @@
14 * 14 *
15 */ 15 */
16 16
17#include <linux/threads.h>
18#include <linux/mm.h> 17#include <linux/mm.h>
19 18#include <linux/quicklist.h>
20#define pgd_quicklist (current_cpu_data.pgd_quick) 19#include <asm/page.h>
21#define pmd_quicklist (current_cpu_data.pmd_quick)
22#define pte_quicklist (current_cpu_data.pte_quick)
23#define pgtable_cache_size (current_cpu_data.pgtable_cache_sz)
24 20
25static inline void pgd_init(unsigned long page) 21static inline void pgd_init(unsigned long page)
26{ 22{
@@ -45,84 +41,37 @@ static inline pgd_t *get_pgd_slow(void)
45 return ret; 41 return ret;
46} 42}
47 43
48static inline pgd_t *get_pgd_fast(void) 44static inline pgd_t *pgd_alloc(struct mm_struct *mm)
49{
50 unsigned long *ret;
51
52 if ((ret = pgd_quicklist) != NULL) {
53 pgd_quicklist = (unsigned long *)(*ret);
54 ret[0] = 0;
55 pgtable_cache_size--;
56 } else
57 ret = (unsigned long *)get_pgd_slow();
58
59 if (ret) {
60 memset(ret, 0, USER_PTRS_PER_PGD * sizeof(pgd_t));
61 }
62 return (pgd_t *)ret;
63}
64
65static inline void free_pgd_fast(pgd_t *pgd)
66{
67 *(unsigned long *)pgd = (unsigned long) pgd_quicklist;
68 pgd_quicklist = (unsigned long *) pgd;
69 pgtable_cache_size++;
70}
71
72static inline void free_pgd_slow(pgd_t *pgd)
73{ 45{
74 kfree((void *)pgd); 46 return quicklist_alloc(0, GFP_KERNEL, NULL);
75} 47}
76 48
77extern pte_t *get_pte_slow(pmd_t *pmd, unsigned long address_preadjusted); 49static inline void pgd_free(pgd_t *pgd)
78extern pte_t *get_pte_kernel_slow(pmd_t *pmd, unsigned long address_preadjusted);
79
80static inline pte_t *get_pte_fast(void)
81{ 50{
82 unsigned long *ret; 51 quicklist_free(0, NULL, pgd);
83
84 if((ret = (unsigned long *)pte_quicklist) != NULL) {
85 pte_quicklist = (unsigned long *)(*ret);
86 ret[0] = ret[1];
87 pgtable_cache_size--;
88 }
89 return (pte_t *)ret;
90} 52}
91 53
92static inline void free_pte_fast(pte_t *pte) 54static inline struct page *pte_alloc_one(struct mm_struct *mm,
55 unsigned long address)
93{ 56{
94 *(unsigned long *)pte = (unsigned long) pte_quicklist; 57 void *pg = quicklist_alloc(0, GFP_KERNEL, NULL);
95 pte_quicklist = (unsigned long *) pte; 58 return pg ? virt_to_page(pg) : NULL;
96 pgtable_cache_size++;
97} 59}
98 60
99static inline void pte_free_kernel(pte_t *pte) 61static inline void pte_free_kernel(pte_t *pte)
100{ 62{
101 free_page((unsigned long)pte); 63 quicklist_free(0, NULL, pte);
102} 64}
103 65
104static inline void pte_free(struct page *pte) 66static inline void pte_free(struct page *pte)
105{ 67{
106 __free_page(pte); 68 quicklist_free_page(0, NULL, pte);
107} 69}
108 70
109static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, 71static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
110 unsigned long address) 72 unsigned long address)
111{ 73{
112 pte_t *pte; 74 return quicklist_alloc(0, GFP_KERNEL, NULL);
113
114 pte = (pte_t *)__get_free_page(GFP_KERNEL | __GFP_REPEAT|__GFP_ZERO);
115
116 return pte;
117}
118
119static inline struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address)
120{
121 struct page *pte;
122
123 pte = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0);
124
125 return pte;
126} 75}
127 76
128#define __pte_free_tlb(tlb,pte) tlb_remove_page((tlb),(pte)) 77#define __pte_free_tlb(tlb,pte) tlb_remove_page((tlb),(pte))
@@ -142,31 +91,23 @@ static inline struct page *pte_alloc_one(struct mm_struct *mm, unsigned long add
142 91
143#elif defined(CONFIG_SH64_PGTABLE_3_LEVEL) 92#elif defined(CONFIG_SH64_PGTABLE_3_LEVEL)
144 93
145static __inline__ pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) 94static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
146{ 95{
147 pmd_t *pmd; 96 return quicklist_alloc(0, GFP_KERNEL, NULL);
148 pmd = (pmd_t *) __get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
149 return pmd;
150} 97}
151 98
152static __inline__ void pmd_free(pmd_t *pmd) 99static inline void pmd_free(pmd_t *pmd)
153{ 100{
154 free_page((unsigned long) pmd); 101 quicklist_free(0, NULL, pmd);
155} 102}
156 103
157#define pgd_populate(mm, pgd, pmd) pgd_set(pgd, pmd) 104#define pgd_populate(mm, pgd, pmd) pgd_set(pgd, pmd)
158#define __pmd_free_tlb(tlb,pmd) pmd_free(pmd) 105#define __pmd_free_tlb(tlb,pmd) pmd_free(pmd)
159 106
160#else 107#else
161#error "No defined page table size" 108#error "No defined page table size"
162#endif 109#endif
163 110
164#define check_pgt_cache() do { } while (0)
165#define pgd_free(pgd) free_pgd_slow(pgd)
166#define pgd_alloc(mm) get_pgd_fast()
167
168extern int do_check_pgt_cache(int, int);
169
170#define pmd_populate_kernel(mm, pmd, pte) \ 111#define pmd_populate_kernel(mm, pmd, pte) \
171 set_pmd(pmd, __pmd(_PAGE_TABLE + (unsigned long) (pte))) 112 set_pmd(pmd, __pmd(_PAGE_TABLE + (unsigned long) (pte)))
172 113
@@ -176,4 +117,9 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
176 set_pmd(pmd, __pmd(_PAGE_TABLE + (unsigned long) page_address (pte))); 117 set_pmd(pmd, __pmd(_PAGE_TABLE + (unsigned long) page_address (pte)));
177} 118}
178 119
120static inline void check_pgt_cache(void)
121{
122 quicklist_trim(0, NULL, 25, 16);
123}
124
179#endif /* __ASM_SH64_PGALLOC_H */ 125#endif /* __ASM_SH64_PGALLOC_H */
diff --git a/include/asm-sh64/sci.h b/include/asm-sh64/sci.h
new file mode 100644
index 000000000000..793c568b7820
--- /dev/null
+++ b/include/asm-sh64/sci.h
@@ -0,0 +1 @@
#include <asm-sh/sci.h>
diff --git a/include/asm-sh64/thread_info.h b/include/asm-sh64/thread_info.h
index 1f825cb163c3..f6d5117c53af 100644
--- a/include/asm-sh64/thread_info.h
+++ b/include/asm-sh64/thread_info.h
@@ -78,7 +78,13 @@ static inline struct thread_info *current_thread_info(void)
78#define TIF_SIGPENDING 2 /* signal pending */ 78#define TIF_SIGPENDING 2 /* signal pending */
79#define TIF_NEED_RESCHED 3 /* rescheduling necessary */ 79#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
80#define TIF_MEMDIE 4 80#define TIF_MEMDIE 4
81#define TIF_RESTORE_SIGMASK 5 /* Restore signal mask in do_signal */
81 82
83#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
84#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
85#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
86#define _TIF_MEMDIE (1 << TIF_MEMDIE)
87#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK)
82 88
83#endif /* __KERNEL__ */ 89#endif /* __KERNEL__ */
84 90
diff --git a/include/asm-sh64/unistd.h b/include/asm-sh64/unistd.h
index 1f38a7aacaaf..ea3adc600b41 100644
--- a/include/asm-sh64/unistd.h
+++ b/include/asm-sh64/unistd.h
@@ -9,14 +9,14 @@
9 * include/asm-sh64/unistd.h 9 * include/asm-sh64/unistd.h
10 * 10 *
11 * Copyright (C) 2000, 2001 Paolo Alberelli 11 * Copyright (C) 2000, 2001 Paolo Alberelli
12 * Copyright (C) 2003 Paul Mundt 12 * Copyright (C) 2003 - 2007 Paul Mundt
13 * Copyright (C) 2004 Sean McGoogan 13 * Copyright (C) 2004 Sean McGoogan
14 * 14 *
15 * This file contains the system call numbers. 15 * This file contains the system call numbers.
16 * 16 *
17 */ 17 */
18 18
19#define __NR_setup 0 /* used only by init, to get system going */ 19#define __NR_restart_syscall 0
20#define __NR_exit 1 20#define __NR_exit 1
21#define __NR_fork 2 21#define __NR_fork 2
22#define __NR_read 3 22#define __NR_read 3
@@ -196,8 +196,8 @@
196#define __NR_rt_sigtimedwait 177 196#define __NR_rt_sigtimedwait 177
197#define __NR_rt_sigqueueinfo 178 197#define __NR_rt_sigqueueinfo 178
198#define __NR_rt_sigsuspend 179 198#define __NR_rt_sigsuspend 179
199#define __NR_pread 180 199#define __NR_pread64 180
200#define __NR_pwrite 181 200#define __NR_pwrite64 181
201#define __NR_chown 182 201#define __NR_chown 182
202#define __NR_getcwd 183 202#define __NR_getcwd 183
203#define __NR_capget 184 203#define __NR_capget 184
@@ -343,10 +343,41 @@
343#define __NR_inotify_init 318 343#define __NR_inotify_init 318
344#define __NR_inotify_add_watch 319 344#define __NR_inotify_add_watch 319
345#define __NR_inotify_rm_watch 320 345#define __NR_inotify_rm_watch 320
346/* 321 is unused */
347#define __NR_migrate_pages 322
348#define __NR_openat 323
349#define __NR_mkdirat 324
350#define __NR_mknodat 325
351#define __NR_fchownat 326
352#define __NR_futimesat 327
353#define __NR_fstatat64 328
354#define __NR_unlinkat 329
355#define __NR_renameat 330
356#define __NR_linkat 331
357#define __NR_symlinkat 332
358#define __NR_readlinkat 333
359#define __NR_fchmodat 334
360#define __NR_faccessat 335
361#define __NR_pselect6 336
362#define __NR_ppoll 337
363#define __NR_unshare 338
364#define __NR_set_robust_list 339
365#define __NR_get_robust_list 340
366#define __NR_splice 341
367#define __NR_sync_file_range 342
368#define __NR_tee 343
369#define __NR_vmsplice 344
370#define __NR_move_pages 345
371#define __NR_getcpu 346
372#define __NR_epoll_pwait 347
373#define __NR_utimensat 348
374#define __NR_signalfd 349
375#define __NR_timerfd 350
376#define __NR_eventfd 351
346 377
347#ifdef __KERNEL__ 378#ifdef __KERNEL__
348 379
349#define NR_syscalls 321 380#define NR_syscalls 352
350 381
351#define __ARCH_WANT_IPC_PARSE_VERSION 382#define __ARCH_WANT_IPC_PARSE_VERSION
352#define __ARCH_WANT_OLD_READDIR 383#define __ARCH_WANT_OLD_READDIR
diff --git a/include/linux/ide.h b/include/linux/ide.h
index df4e6a510310..07aba87d369d 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1281,7 +1281,6 @@ struct drive_list_entry {
1281int ide_in_drive_list(struct hd_driveid *, const struct drive_list_entry *); 1281int ide_in_drive_list(struct hd_driveid *, const struct drive_list_entry *);
1282int __ide_dma_bad_drive(ide_drive_t *); 1282int __ide_dma_bad_drive(ide_drive_t *);
1283int __ide_dma_good_drive(ide_drive_t *); 1283int __ide_dma_good_drive(ide_drive_t *);
1284int ide_use_dma(ide_drive_t *);
1285u8 ide_max_dma_mode(ide_drive_t *); 1284u8 ide_max_dma_mode(ide_drive_t *);
1286int ide_tune_dma(ide_drive_t *); 1285int ide_tune_dma(ide_drive_t *);
1287void ide_dma_off(ide_drive_t *); 1286void ide_dma_off(ide_drive_t *);
@@ -1309,7 +1308,6 @@ extern int __ide_dma_timeout(ide_drive_t *);
1309#endif /* CONFIG_BLK_DEV_IDEDMA_PCI */ 1308#endif /* CONFIG_BLK_DEV_IDEDMA_PCI */
1310 1309
1311#else 1310#else
1312static inline int ide_use_dma(ide_drive_t *drive) { return 0; }
1313static inline u8 ide_max_dma_mode(ide_drive_t *drive) { return 0; } 1311static inline u8 ide_max_dma_mode(ide_drive_t *drive) { return 0; }
1314static inline int ide_tune_dma(ide_drive_t *drive) { return 0; } 1312static inline int ide_tune_dma(ide_drive_t *drive) { return 0; }
1315static inline void ide_dma_off(ide_drive_t *drive) { ; } 1313static inline void ide_dma_off(ide_drive_t *drive) { ; }
@@ -1357,7 +1355,6 @@ static inline void ide_set_hwifdata (ide_hwif_t * hwif, void *data)
1357 1355
1358/* ide-lib.c */ 1356/* ide-lib.c */
1359u8 ide_rate_filter(ide_drive_t *, u8); 1357u8 ide_rate_filter(ide_drive_t *, u8);
1360extern int ide_dma_enable(ide_drive_t *drive);
1361extern char *ide_xfer_verbose(u8 xfer_rate); 1358extern char *ide_xfer_verbose(u8 xfer_rate);
1362extern void ide_toggle_bounce(ide_drive_t *drive, int on); 1359extern void ide_toggle_bounce(ide_drive_t *drive, int on);
1363extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate); 1360extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate);
diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c
index 6c61263ff96d..74cc0fc6bb81 100644
--- a/kernel/auditfilter.c
+++ b/kernel/auditfilter.c
@@ -311,6 +311,7 @@ int audit_match_class(int class, unsigned syscall)
311 return classes[class][AUDIT_WORD(syscall)] & AUDIT_BIT(syscall); 311 return classes[class][AUDIT_WORD(syscall)] & AUDIT_BIT(syscall);
312} 312}
313 313
314#ifdef CONFIG_AUDITSYSCALL
314static inline int audit_match_class_bits(int class, u32 *mask) 315static inline int audit_match_class_bits(int class, u32 *mask)
315{ 316{
316 int i; 317 int i;
@@ -347,6 +348,7 @@ static int audit_match_signal(struct audit_entry *entry)
347 return 1; 348 return 1;
348 } 349 }
349} 350}
351#endif
350 352
351/* Common user-space to kernel rule translation. */ 353/* Common user-space to kernel rule translation. */
352static inline struct audit_entry *audit_to_entry_common(struct audit_rule *rule) 354static inline struct audit_entry *audit_to_entry_common(struct audit_rule *rule)
diff --git a/mm/Kconfig b/mm/Kconfig
index a17da8bafe62..8ac412b45f18 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -166,5 +166,5 @@ config ZONE_DMA_FLAG
166config NR_QUICK 166config NR_QUICK
167 int 167 int
168 depends on QUICKLIST 168 depends on QUICKLIST
169 default "2" if SUPERH 169 default "2" if (SUPERH && !SUPERH64)
170 default "1" 170 default "1"