aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/DocBook/Makefile5
-rw-r--r--Documentation/filesystems/Locking24
-rw-r--r--Documentation/input/bcm5974.txt65
-rw-r--r--Documentation/input/multi-touch-protocol.txt140
-rw-r--r--Documentation/kernel-doc-nano-HOWTO.txt7
-rw-r--r--Documentation/sysctl/vm.txt4
-rw-r--r--MAINTAINERS19
-rw-r--r--Makefile10
-rw-r--r--arch/alpha/include/asm/barrier.h2
-rw-r--r--arch/alpha/include/asm/futex.h118
-rw-r--r--arch/alpha/include/asm/uaccess.h2
-rw-r--r--arch/alpha/kernel/Makefile6
-rw-r--r--arch/alpha/kernel/binfmt_loader.c2
-rw-r--r--arch/alpha/kernel/err_ev6.c2
-rw-r--r--arch/alpha/kernel/err_ev7.c4
-rw-r--r--arch/alpha/kernel/err_impl.h10
-rw-r--r--arch/alpha/kernel/err_marvel.c2
-rw-r--r--arch/alpha/kernel/err_titan.c4
-rw-r--r--arch/alpha/kernel/proto.h5
-rw-r--r--arch/alpha/mm/extable.c40
-rw-r--r--arch/arm/Kconfig60
-rw-r--r--arch/arm/configs/davinci_all_defconfig1784
-rw-r--r--arch/arm/configs/viper_defconfig1
-rw-r--r--arch/arm/mach-davinci/Kconfig47
-rw-r--r--arch/arm/mach-davinci/Makefile9
-rw-r--r--arch/arm/mach-davinci/board-dm644x-evm.c (renamed from arch/arm/mach-davinci/board-evm.c)322
-rw-r--r--arch/arm/mach-davinci/clock.c385
-rw-r--r--arch/arm/mach-davinci/clock.h87
-rw-r--r--arch/arm/mach-davinci/devices.c7
-rw-r--r--arch/arm/mach-davinci/dm644x.c461
-rw-r--r--arch/arm/mach-davinci/dma.c1135
-rw-r--r--arch/arm/mach-davinci/gpio.c82
-rw-r--r--arch/arm/mach-davinci/id.c35
-rw-r--r--arch/arm/mach-davinci/include/mach/board-dm6446evm.h20
-rw-r--r--arch/arm/mach-davinci/include/mach/clkdev.h13
-rw-r--r--arch/arm/mach-davinci/include/mach/clock.h1
-rw-r--r--arch/arm/mach-davinci/include/mach/common.h6
-rw-r--r--arch/arm/mach-davinci/include/mach/cputype.h49
-rw-r--r--arch/arm/mach-davinci/include/mach/dm644x.h37
-rw-r--r--arch/arm/mach-davinci/include/mach/edma.h228
-rw-r--r--arch/arm/mach-davinci/include/mach/gpio.h27
-rw-r--r--arch/arm/mach-davinci/include/mach/hardware.h51
-rw-r--r--arch/arm/mach-davinci/include/mach/io.h20
-rw-r--r--arch/arm/mach-davinci/include/mach/irqs.h103
-rw-r--r--arch/arm/mach-davinci/include/mach/mux.h220
-rw-r--r--arch/arm/mach-davinci/include/mach/psc.h53
-rw-r--r--arch/arm/mach-davinci/include/mach/serial.h21
-rw-r--r--arch/arm/mach-davinci/io.c23
-rw-r--r--arch/arm/mach-davinci/irq.c156
-rw-r--r--arch/arm/mach-davinci/mux.c100
-rw-r--r--arch/arm/mach-davinci/mux.h51
-rw-r--r--arch/arm/mach-davinci/psc.c98
-rw-r--r--arch/arm/mach-davinci/serial.c95
-rw-r--r--arch/arm/mach-davinci/time.c103
-rw-r--r--arch/arm/mach-davinci/usb.c2
-rw-r--r--arch/arm/mach-omap1/board-h2-mmc.c14
-rw-r--r--arch/arm/mach-omap1/board-h3-mmc.c6
-rw-r--r--arch/arm/mach-omap1/board-h3.c101
-rw-r--r--arch/arm/mach-omap1/board-nokia770.c6
-rw-r--r--arch/arm/mach-omap1/mcbsp.c4
-rw-r--r--arch/arm/mach-omap2/board-h4.c95
-rw-r--r--arch/arm/mach-omap2/board-omap3beagle.c4
-rw-r--r--arch/arm/mach-omap2/board-rx51.c1
-rw-r--r--arch/arm/mach-omap2/clock24xx.c19
-rw-r--r--arch/arm/mach-omap2/clock24xx.h10
-rw-r--r--arch/arm/mach-omap2/clock34xx.h7
-rw-r--r--arch/arm/mach-omap2/devices.c33
-rw-r--r--arch/arm/mach-omap2/irq.c4
-rw-r--r--arch/arm/mach-omap2/timer-gp.c48
-rw-r--r--arch/arm/mach-omap2/usb-tusb6010.c2
-rw-r--r--arch/arm/mach-pxa/corgi.c10
-rw-r--r--arch/arm/mach-pxa/littleton.c9
-rw-r--r--arch/arm/mach-pxa/spitz.c10
-rw-r--r--arch/arm/mach-pxa/zylonite_pxa300.c5
-rw-r--r--arch/arm/mach-pxa/zylonite_pxa320.c1
-rw-r--r--arch/arm/mach-sa1100/lart.c1
-rw-r--r--arch/arm/mm/cache-v6.S33
-rw-r--r--arch/arm/mm/flush.c23
-rw-r--r--arch/arm/mm/proc-v7.S19
-rw-r--r--arch/arm/plat-omap/clock.c7
-rw-r--r--arch/arm/plat-omap/dma.c13
-rw-r--r--arch/arm/plat-omap/dmtimer.c28
-rw-r--r--arch/arm/plat-omap/gpio.c20
-rw-r--r--arch/arm/plat-omap/include/mach/dmtimer.h2
-rw-r--r--arch/arm/plat-omap/include/mach/eac.h100
-rw-r--r--arch/arm/plat-omap/include/mach/gpioexpander.h35
-rw-r--r--arch/arm/plat-omap/include/mach/irda.h4
-rw-r--r--arch/arm/plat-omap/include/mach/mmc.h1
-rw-r--r--arch/arm/plat-omap/include/mach/timer-gp.h17
-rw-r--r--arch/arm/plat-pxa/gpio.c23
-rw-r--r--arch/avr32/Makefile2
-rw-r--r--arch/m32r/boot/compressed/Makefile1
-rw-r--r--arch/m32r/include/asm/assembler.h7
-rw-r--r--arch/m32r/kernel/Makefile2
-rw-r--r--arch/microblaze/include/asm/of_platform.h10
-rw-r--r--arch/powerpc/Kconfig4
-rw-r--r--arch/powerpc/boot/Makefile67
-rw-r--r--arch/powerpc/boot/simpleboot.c2
-rw-r--r--arch/powerpc/include/asm/of_platform.h10
-rw-r--r--arch/x86/include/asm/mce.h1
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_64.c33
-rw-r--r--drivers/Makefile4
-rw-r--r--drivers/acpi/acpica/rscalc.c7
-rw-r--r--drivers/firmware/iscsi_ibft.c4
-rw-r--r--drivers/hid/hid-apple.c2
-rw-r--r--drivers/hid/hid-core.c4
-rw-r--r--drivers/hid/hid-ids.h1
-rw-r--r--drivers/hid/hid-lg.c2
-rw-r--r--drivers/hid/hidraw.c12
-rw-r--r--drivers/hid/usbhid/hid-core.c2
-rw-r--r--drivers/ide/ide-cd.c9
-rw-r--r--drivers/infiniband/ulp/iser/iscsi_iser.c1
-rw-r--r--drivers/input/input.c36
-rw-r--r--drivers/input/keyboard/omap-keypad.c16
-rw-r--r--drivers/input/mouse/alps.c1
-rw-r--r--drivers/input/mouse/appletouch.c24
-rw-r--r--drivers/input/mouse/bcm5974.c108
-rw-r--r--drivers/input/mouse/elantech.c48
-rw-r--r--drivers/input/mouse/elantech.h5
-rw-r--r--drivers/input/mouse/lifebook.c6
-rw-r--r--drivers/input/serio/sa1111ps2.c2
-rw-r--r--drivers/input/tablet/wacom.h5
-rw-r--r--drivers/input/tablet/wacom_sys.c13
-rw-r--r--drivers/input/touchscreen/tsc2007.c2
-rw-r--r--drivers/input/touchscreen/ucb1400_ts.c2
-rw-r--r--drivers/media/video/au0828/au0828-core.c6
-rw-r--r--drivers/media/video/cx18/cx18-audio.c2
-rw-r--r--drivers/media/video/cx18/cx18-i2c.c16
-rw-r--r--drivers/media/video/cx231xx/Kconfig44
-rw-r--r--drivers/media/video/cx23885/cx23885-cards.c4
-rw-r--r--drivers/media/video/cx23885/cx23885-dvb.c1
-rw-r--r--drivers/media/video/mx3_camera.c4
-rw-r--r--drivers/media/video/s2255drv.c2
-rw-r--r--drivers/media/video/saa5246a.c3
-rw-r--r--drivers/media/video/saa5249.c4
-rw-r--r--drivers/mmc/card/block.c8
-rw-r--r--drivers/mmc/core/core.c4
-rw-r--r--drivers/mmc/host/mmci.c2
-rw-r--r--drivers/mmc/host/mvsdio.c11
-rw-r--r--drivers/mmc/host/omap.c2
-rw-r--r--drivers/mmc/host/sdhci-pci.c8
-rw-r--r--drivers/mmc/host/sdhci.h2
-rw-r--r--drivers/s390/scsi/zfcp_aux.c11
-rw-r--r--drivers/s390/scsi/zfcp_ccw.c1
-rw-r--r--drivers/s390/scsi/zfcp_cfdc.c3
-rw-r--r--drivers/s390/scsi/zfcp_def.h2
-rw-r--r--drivers/s390/scsi/zfcp_erp.c60
-rw-r--r--drivers/s390/scsi/zfcp_ext.h2
-rw-r--r--drivers/s390/scsi/zfcp_fc.c33
-rw-r--r--drivers/s390/scsi/zfcp_fsf.c59
-rw-r--r--drivers/s390/scsi/zfcp_scsi.c44
-rw-r--r--drivers/s390/scsi/zfcp_sysfs.c21
-rw-r--r--drivers/scsi/cxgb3i/cxgb3i.h2
-rw-r--r--drivers/scsi/cxgb3i/cxgb3i_ddp.c32
-rw-r--r--drivers/scsi/cxgb3i/cxgb3i_iscsi.c5
-rw-r--r--drivers/scsi/cxgb3i/cxgb3i_offload.c4
-rw-r--r--drivers/scsi/cxgb3i/cxgb3i_pdu.c19
-rw-r--r--drivers/scsi/fcoe/fcoe.c59
-rw-r--r--drivers/scsi/fcoe/libfcoe.c2
-rw-r--r--drivers/scsi/ipr.c13
-rw-r--r--drivers/scsi/iscsi_tcp.c3
-rw-r--r--drivers/scsi/libfc/fc_disc.c54
-rw-r--r--drivers/scsi/libfc/fc_elsct.c2
-rw-r--r--drivers/scsi/libfc/fc_fcp.c7
-rw-r--r--drivers/scsi/libfc/fc_lport.c74
-rw-r--r--drivers/scsi/libfc/fc_rport.c82
-rw-r--r--drivers/scsi/libiscsi.c10
-rw-r--r--drivers/scsi/libiscsi_tcp.c5
-rw-r--r--drivers/scsi/lpfc/lpfc.h2
-rw-r--r--drivers/scsi/lpfc/lpfc_attr.c266
-rw-r--r--drivers/scsi/lpfc/lpfc_crtn.h2
-rw-r--r--drivers/scsi/lpfc/lpfc_debugfs.c45
-rw-r--r--drivers/scsi/lpfc/lpfc_disc.h1
-rw-r--r--drivers/scsi/lpfc/lpfc_els.c245
-rw-r--r--drivers/scsi/lpfc/lpfc_hbadisc.c88
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c205
-rw-r--r--drivers/scsi/lpfc/lpfc_logmsg.h2
-rw-r--r--drivers/scsi/lpfc/lpfc_mbox.c63
-rw-r--r--drivers/scsi/lpfc/lpfc_mem.c19
-rw-r--r--drivers/scsi/lpfc/lpfc_nportdisc.c18
-rw-r--r--drivers/scsi/lpfc/lpfc_scsi.c126
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c401
-rw-r--r--drivers/scsi/lpfc/lpfc_version.h6
-rw-r--r--drivers/scsi/lpfc/lpfc_vport.c10
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_base.c75
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_base.h30
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_ctl.c216
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_ctl.h7
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_scsih.c29
-rw-r--r--drivers/scsi/osd/osd_initiator.c125
-rw-r--r--drivers/scsi/scsi_lib.c4
-rw-r--r--drivers/scsi/sd.c15
-rw-r--r--drivers/scsi/sg.c13
-rw-r--r--drivers/scsi/sr_ioctl.c5
-rw-r--r--drivers/serial/crisv10.c173
-rw-r--r--drivers/video/console/vgacon.c2
-rw-r--r--fs/autofs4/expire.c4
-rw-r--r--fs/binfmt_elf_fdpic.c4
-rw-r--r--fs/buffer.c10
-rw-r--r--fs/configfs/symlink.c2
-rw-r--r--fs/ecryptfs/inode.c4
-rw-r--r--fs/exec.c7
-rw-r--r--fs/nfs/file.c6
-rw-r--r--fs/ocfs2/dcache.c15
-rw-r--r--fs/ocfs2/dir.c4
-rw-r--r--fs/ocfs2/export.c9
-rw-r--r--fs/ocfs2/journal.h5
-rw-r--r--fs/ocfs2/namei.c4
-rw-r--r--fs/ocfs2/suballoc.c21
-rw-r--r--fs/proc/array.c13
-rw-r--r--fs/proc/base.c5
-rw-r--r--fs/proc/meminfo.c2
-rw-r--r--fs/proc/task_mmu.c4
-rw-r--r--fs/xfs/xfs_bmap.c192
-rw-r--r--fs/xfs/xfs_inode.c2
-rw-r--r--fs/xfs/xfs_mount.c3
-rw-r--r--include/asm-generic/atomic.h4
-rw-r--r--include/linux/binfmts.h14
-rw-r--r--include/linux/blkdev.h1
-rw-r--r--include/linux/input.h24
-rw-r--r--include/linux/memcontrol.h4
-rw-r--r--include/linux/mman.h9
-rw-r--r--include/linux/of_platform.h10
-rw-r--r--include/linux/sunrpc/xprt.h1
-rw-r--r--include/net/9p/client.h1
-rw-r--r--include/scsi/fc/fc_fs.h1
-rw-r--r--include/scsi/libfc.h1
-rw-r--r--include/scsi/libiscsi.h2
-rw-r--r--include/scsi/osd_protocol.h96
-rw-r--r--kernel/sysctl.c5
-rw-r--r--mm/memcontrol.c38
-rw-r--r--mm/memory.c112
-rw-r--r--mm/mmap.c12
-rw-r--r--mm/nommu.c13
-rw-r--r--mm/shmem.c8
-rw-r--r--mm/swap.c46
-rw-r--r--mm/vmscan.c2
-rw-r--r--net/9p/client.c114
-rw-r--r--net/9p/trans_fd.c14
-rw-r--r--net/9p/trans_rdma.c1
-rw-r--r--net/9p/trans_virtio.c1
-rw-r--r--net/sunrpc/xprt.c6
-rw-r--r--net/sunrpc/xprtsock.c26
-rw-r--r--scripts/Makefile1
-rw-r--r--scripts/dtc/Makefile54
-rw-r--r--scripts/dtc/Makefile.dtc (renamed from arch/powerpc/boot/dtc-src/Makefile.dtc)0
-rw-r--r--scripts/dtc/checks.c (renamed from arch/powerpc/boot/dtc-src/checks.c)0
-rw-r--r--scripts/dtc/data.c (renamed from arch/powerpc/boot/dtc-src/data.c)0
-rw-r--r--scripts/dtc/dtc-lexer.l (renamed from arch/powerpc/boot/dtc-src/dtc-lexer.l)0
-rw-r--r--scripts/dtc/dtc-lexer.lex.c_shipped (renamed from arch/powerpc/boot/dtc-src/dtc-lexer.lex.c_shipped)0
-rw-r--r--scripts/dtc/dtc-parser.tab.c_shipped (renamed from arch/powerpc/boot/dtc-src/dtc-parser.tab.c_shipped)0
-rw-r--r--scripts/dtc/dtc-parser.tab.h_shipped (renamed from arch/powerpc/boot/dtc-src/dtc-parser.tab.h_shipped)0
-rw-r--r--scripts/dtc/dtc-parser.y (renamed from arch/powerpc/boot/dtc-src/dtc-parser.y)0
-rw-r--r--scripts/dtc/dtc.c (renamed from arch/powerpc/boot/dtc-src/dtc.c)0
-rw-r--r--scripts/dtc/dtc.h (renamed from arch/powerpc/boot/dtc-src/dtc.h)0
-rw-r--r--scripts/dtc/flattree.c (renamed from arch/powerpc/boot/dtc-src/flattree.c)0
-rw-r--r--scripts/dtc/fstree.c (renamed from arch/powerpc/boot/dtc-src/fstree.c)0
-rw-r--r--scripts/dtc/libfdt/Makefile.libfdt (renamed from arch/powerpc/boot/libfdt/Makefile.libfdt)0
-rw-r--r--scripts/dtc/libfdt/fdt.c (renamed from arch/powerpc/boot/libfdt/fdt.c)0
-rw-r--r--scripts/dtc/libfdt/fdt.h (renamed from arch/powerpc/boot/libfdt/fdt.h)0
-rw-r--r--scripts/dtc/libfdt/fdt_ro.c (renamed from arch/powerpc/boot/libfdt/fdt_ro.c)0
-rw-r--r--scripts/dtc/libfdt/fdt_rw.c (renamed from arch/powerpc/boot/libfdt/fdt_rw.c)0
-rw-r--r--scripts/dtc/libfdt/fdt_strerror.c (renamed from arch/powerpc/boot/libfdt/fdt_strerror.c)0
-rw-r--r--scripts/dtc/libfdt/fdt_sw.c (renamed from arch/powerpc/boot/libfdt/fdt_sw.c)0
-rw-r--r--scripts/dtc/libfdt/fdt_wip.c (renamed from arch/powerpc/boot/libfdt/fdt_wip.c)0
-rw-r--r--scripts/dtc/libfdt/libfdt.h (renamed from arch/powerpc/boot/libfdt/libfdt.h)0
-rw-r--r--scripts/dtc/libfdt/libfdt_env.h (renamed from arch/powerpc/boot/dtc-src/libfdt_env.h)0
-rw-r--r--scripts/dtc/libfdt/libfdt_internal.h (renamed from arch/powerpc/boot/libfdt/libfdt_internal.h)0
-rw-r--r--scripts/dtc/livetree.c (renamed from arch/powerpc/boot/dtc-src/livetree.c)0
-rw-r--r--scripts/dtc/srcpos.c (renamed from arch/powerpc/boot/dtc-src/srcpos.c)0
-rw-r--r--scripts/dtc/srcpos.h (renamed from arch/powerpc/boot/dtc-src/srcpos.h)0
-rw-r--r--scripts/dtc/treesource.c (renamed from arch/powerpc/boot/dtc-src/treesource.c)0
-rw-r--r--scripts/dtc/version_gen.h (renamed from arch/powerpc/boot/dtc-src/version_gen.h)0
-rwxr-xr-xscripts/kernel-doc7
-rw-r--r--scripts/mod/modpost.c55
-rwxr-xr-xscripts/setlocalversion13
-rwxr-xr-xscripts/tags.sh2
-rw-r--r--security/selinux/hooks.c2
-rw-r--r--sound/core/pcm_lib.c7
-rw-r--r--sound/isa/msnd/msnd.c6
-rw-r--r--sound/pci/bt87x.c6
-rw-r--r--sound/pci/echoaudio/indigodjx.c1
-rw-r--r--sound/pci/echoaudio/indigoiox.c1
-rw-r--r--sound/pci/korg1212/korg1212.c6
-rw-r--r--sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c3
-rw-r--r--sound/soc/au1x/dbdma2.c2
-rw-r--r--sound/soc/codecs/twl4030.c8
-rw-r--r--sound/soc/codecs/wm8350.c2
-rw-r--r--sound/soc/fsl/mpc5200_psc_i2s.c3
-rw-r--r--sound/soc/sh/dma-sh7760.c3
-rw-r--r--sound/sparc/dbri.c3
-rw-r--r--sound/usb/usx2y/usbusx2yaudio.c3
292 files changed, 8706 insertions, 2822 deletions
diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile
index 8918a32c6b3..b1eb661e630 100644
--- a/Documentation/DocBook/Makefile
+++ b/Documentation/DocBook/Makefile
@@ -143,7 +143,8 @@ quiet_cmd_db2pdf = PDF $@
143 $(call cmd,db2pdf) 143 $(call cmd,db2pdf)
144 144
145 145
146main_idx = Documentation/DocBook/index.html 146index = index.html
147main_idx = Documentation/DocBook/$(index)
147build_main_index = rm -rf $(main_idx) && \ 148build_main_index = rm -rf $(main_idx) && \
148 echo '<h1>Linux Kernel HTML Documentation</h1>' >> $(main_idx) && \ 149 echo '<h1>Linux Kernel HTML Documentation</h1>' >> $(main_idx) && \
149 echo '<h2>Kernel Version: $(KERNELVERSION)</h2>' >> $(main_idx) && \ 150 echo '<h2>Kernel Version: $(KERNELVERSION)</h2>' >> $(main_idx) && \
@@ -232,7 +233,7 @@ clean-files := $(DOCBOOKS) \
232 $(patsubst %.xml, %.pdf, $(DOCBOOKS)) \ 233 $(patsubst %.xml, %.pdf, $(DOCBOOKS)) \
233 $(patsubst %.xml, %.html, $(DOCBOOKS)) \ 234 $(patsubst %.xml, %.html, $(DOCBOOKS)) \
234 $(patsubst %.xml, %.9, $(DOCBOOKS)) \ 235 $(patsubst %.xml, %.9, $(DOCBOOKS)) \
235 $(C-procfs-example) 236 $(C-procfs-example) $(index)
236 237
237clean-dirs := $(patsubst %.xml,%,$(DOCBOOKS)) man 238clean-dirs := $(patsubst %.xml,%,$(DOCBOOKS)) man
238 239
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking
index 76efe5b71d7..3120f8dd2c3 100644
--- a/Documentation/filesystems/Locking
+++ b/Documentation/filesystems/Locking
@@ -512,16 +512,24 @@ locking rules:
512 BKL mmap_sem PageLocked(page) 512 BKL mmap_sem PageLocked(page)
513open: no yes 513open: no yes
514close: no yes 514close: no yes
515fault: no yes 515fault: no yes can return with page locked
516page_mkwrite: no yes no 516page_mkwrite: no yes can return with page locked
517access: no yes 517access: no yes
518 518
519 ->page_mkwrite() is called when a previously read-only page is 519 ->fault() is called when a previously not present pte is about
520about to become writeable. The file system is responsible for 520to be faulted in. The filesystem must find and return the page associated
521protecting against truncate races. Once appropriate action has been 521with the passed in "pgoff" in the vm_fault structure. If it is possible that
522taking to lock out truncate, the page range should be verified to be 522the page may be truncated and/or invalidated, then the filesystem must lock
523within i_size. The page mapping should also be checked that it is not 523the page, then ensure it is not already truncated (the page lock will block
524NULL. 524subsequent truncate), and then return with VM_FAULT_LOCKED, and the page
525locked. The VM will unlock the page.
526
527 ->page_mkwrite() is called when a previously read-only pte is
528about to become writeable. The filesystem again must ensure that there are
529no truncate/invalidate races, and then return with the page locked. If
530the page has been truncated, the filesystem should not look up a new page
531like the ->fault() handler, but simply return with VM_FAULT_NOPAGE, which
532will cause the VM to retry the fault.
525 533
526 ->access() is called when get_user_pages() fails in 534 ->access() is called when get_user_pages() fails in
527acces_process_vm(), typically used to debug a process through 535acces_process_vm(), typically used to debug a process through
diff --git a/Documentation/input/bcm5974.txt b/Documentation/input/bcm5974.txt
new file mode 100644
index 00000000000..5e22dcf6d48
--- /dev/null
+++ b/Documentation/input/bcm5974.txt
@@ -0,0 +1,65 @@
1BCM5974 Driver (bcm5974)
2------------------------
3 Copyright (C) 2008-2009 Henrik Rydberg <rydberg@euromail.se>
4
5The USB initialization and package decoding was made by Scott Shawcroft as
6part of the touchd user-space driver project:
7 Copyright (C) 2008 Scott Shawcroft (scott.shawcroft@gmail.com)
8
9The BCM5974 driver is based on the appletouch driver:
10 Copyright (C) 2001-2004 Greg Kroah-Hartman (greg@kroah.com)
11 Copyright (C) 2005 Johannes Berg (johannes@sipsolutions.net)
12 Copyright (C) 2005 Stelian Pop (stelian@popies.net)
13 Copyright (C) 2005 Frank Arnold (frank@scirocco-5v-turbo.de)
14 Copyright (C) 2005 Peter Osterlund (petero2@telia.com)
15 Copyright (C) 2005 Michael Hanselmann (linux-kernel@hansmi.ch)
16 Copyright (C) 2006 Nicolas Boichat (nicolas@boichat.ch)
17
18This driver adds support for the multi-touch trackpad on the new Apple
19Macbook Air and Macbook Pro laptops. It replaces the appletouch driver on
20those computers, and integrates well with the synaptics driver of the Xorg
21system.
22
23Known to work on Macbook Air, Macbook Pro Penryn and the new unibody
24Macbook 5 and Macbook Pro 5.
25
26Usage
27-----
28
29The driver loads automatically for the supported usb device ids, and
30becomes available both as an event device (/dev/input/event*) and as a
31mouse via the mousedev driver (/dev/input/mice).
32
33USB Race
34--------
35
36The Apple multi-touch trackpads report both mouse and keyboard events via
37different interfaces of the same usb device. This creates a race condition
38with the HID driver, which, if not told otherwise, will find the standard
39HID mouse and keyboard, and claim the whole device. To remedy, the usb
40product id must be listed in the mouse_ignore list of the hid driver.
41
42Debug output
43------------
44
45To ease the development for new hardware version, verbose packet output can
46be switched on with the debug kernel module parameter. The range [1-9]
47yields different levels of verbosity. Example (as root):
48
49echo -n 9 > /sys/module/bcm5974/parameters/debug
50
51tail -f /var/log/debug
52
53echo -n 0 > /sys/module/bcm5974/parameters/debug
54
55Trivia
56------
57
58The driver was developed at the ubuntu forums in June 2008 [1], and now has
59a more permanent home at bitmath.org [2].
60
61Links
62-----
63
64[1] http://ubuntuforums.org/showthread.php?t=840040
65[2] http://http://bitmath.org/code/
diff --git a/Documentation/input/multi-touch-protocol.txt b/Documentation/input/multi-touch-protocol.txt
new file mode 100644
index 00000000000..9f09557aea3
--- /dev/null
+++ b/Documentation/input/multi-touch-protocol.txt
@@ -0,0 +1,140 @@
1Multi-touch (MT) Protocol
2-------------------------
3 Copyright (C) 2009 Henrik Rydberg <rydberg@euromail.se>
4
5
6Introduction
7------------
8
9In order to utilize the full power of the new multi-touch devices, a way to
10report detailed finger data to user space is needed. This document
11describes the multi-touch (MT) protocol which allows kernel drivers to
12report details for an arbitrary number of fingers.
13
14
15Usage
16-----
17
18Anonymous finger details are sent sequentially as separate packets of ABS
19events. Only the ABS_MT events are recognized as part of a finger
20packet. The end of a packet is marked by calling the input_mt_sync()
21function, which generates a SYN_MT_REPORT event. The end of multi-touch
22transfer is marked by calling the usual input_sync() function.
23
24A set of ABS_MT events with the desired properties is defined. The events
25are divided into categories, to allow for partial implementation. The
26minimum set consists of ABS_MT_TOUCH_MAJOR, ABS_MT_POSITION_X and
27ABS_MT_POSITION_Y, which allows for multiple fingers to be tracked. If the
28device supports it, the ABS_MT_WIDTH_MAJOR may be used to provide the size
29of the approaching finger. Anisotropy and direction may be specified with
30ABS_MT_TOUCH_MINOR, ABS_MT_WIDTH_MINOR and ABS_MT_ORIENTATION. Devices with
31more granular information may specify general shapes as blobs, i.e., as a
32sequence of rectangular shapes grouped together by an
33ABS_MT_BLOB_ID. Finally, the ABS_MT_TOOL_TYPE may be used to specify
34whether the touching tool is a finger or a pen or something else.
35
36
37Event Semantics
38---------------
39
40The word "contact" is used to describe a tool which is in direct contact
41with the surface. A finger, a pen or a rubber all classify as contacts.
42
43ABS_MT_TOUCH_MAJOR
44
45The length of the major axis of the contact. The length should be given in
46surface units. If the surface has an X times Y resolution, the largest
47possible value of ABS_MT_TOUCH_MAJOR is sqrt(X^2 + Y^2), the diagonal.
48
49ABS_MT_TOUCH_MINOR
50
51The length, in surface units, of the minor axis of the contact. If the
52contact is circular, this event can be omitted.
53
54ABS_MT_WIDTH_MAJOR
55
56The length, in surface units, of the major axis of the approaching
57tool. This should be understood as the size of the tool itself. The
58orientation of the contact and the approaching tool are assumed to be the
59same.
60
61ABS_MT_WIDTH_MINOR
62
63The length, in surface units, of the minor axis of the approaching
64tool. Omit if circular.
65
66The above four values can be used to derive additional information about
67the contact. The ratio ABS_MT_TOUCH_MAJOR / ABS_MT_WIDTH_MAJOR approximates
68the notion of pressure. The fingers of the hand and the palm all have
69different characteristic widths [1].
70
71ABS_MT_ORIENTATION
72
73The orientation of the ellipse. The value should describe half a revolution
74clockwise around the touch center. The scale of the value is arbitrary, but
75zero should be returned for an ellipse aligned along the Y axis of the
76surface. As an example, an index finger placed straight onto the axis could
77return zero orientation, something negative when twisted to the left, and
78something positive when twisted to the right. This value can be omitted if
79the touching object is circular, or if the information is not available in
80the kernel driver.
81
82ABS_MT_POSITION_X
83
84The surface X coordinate of the center of the touching ellipse.
85
86ABS_MT_POSITION_Y
87
88The surface Y coordinate of the center of the touching ellipse.
89
90ABS_MT_TOOL_TYPE
91
92The type of approaching tool. A lot of kernel drivers cannot distinguish
93between different tool types, such as a finger or a pen. In such cases, the
94event should be omitted. The protocol currently supports MT_TOOL_FINGER and
95MT_TOOL_PEN [2].
96
97ABS_MT_BLOB_ID
98
99The BLOB_ID groups several packets together into one arbitrarily shaped
100contact. This is a low-level anonymous grouping, and should not be confused
101with the high-level contactID, explained below. Most kernel drivers will
102not have this capability, and can safely omit the event.
103
104
105Finger Tracking
106---------------
107
108The kernel driver should generate an arbitrary enumeration of the set of
109anonymous contacts currently on the surface. The order in which the packets
110appear in the event stream is not important.
111
112The process of finger tracking, i.e., to assign a unique contactID to each
113initiated contact on the surface, is left to user space; preferably the
114multi-touch X driver [3]. In that driver, the contactID stays the same and
115unique until the contact vanishes (when the finger leaves the surface). The
116problem of assigning a set of anonymous fingers to a set of identified
117fingers is a euclidian bipartite matching problem at each event update, and
118relies on a sufficiently rapid update rate.
119
120Notes
121-----
122
123In order to stay compatible with existing applications, the data
124reported in a finger packet must not be recognized as single-touch
125events. In addition, all finger data must bypass input filtering,
126since subsequent events of the same type refer to different fingers.
127
128The first kernel driver to utilize the MT protocol is the bcm5974 driver,
129where examples can be found.
130
131[1] With the extension ABS_MT_APPROACH_X and ABS_MT_APPROACH_Y, the
132difference between the contact position and the approaching tool position
133could be used to derive tilt.
134[2] The list can of course be extended.
135[3] The multi-touch X driver is currently in the prototyping stage. At the
136time of writing (April 2009), the MT protocol is not yet merged, and the
137prototype implements finger matching, basic mouse support and two-finger
138scrolling. The project aims at improving the quality of current multi-touch
139functionality available in the synaptics X driver, and in addition
140implement more advanced gestures.
diff --git a/Documentation/kernel-doc-nano-HOWTO.txt b/Documentation/kernel-doc-nano-HOWTO.txt
index 026ec7d5738..4d04572b654 100644
--- a/Documentation/kernel-doc-nano-HOWTO.txt
+++ b/Documentation/kernel-doc-nano-HOWTO.txt
@@ -269,7 +269,10 @@ Use the argument mechanism to document members or constants.
269 269
270Inside a struct description, you can use the "private:" and "public:" 270Inside a struct description, you can use the "private:" and "public:"
271comment tags. Structure fields that are inside a "private:" area 271comment tags. Structure fields that are inside a "private:" area
272are not listed in the generated output documentation. 272are not listed in the generated output documentation. The "private:"
273and "public:" tags must begin immediately following a "/*" comment
274marker. They may optionally include comments between the ":" and the
275ending "*/" marker.
273 276
274Example: 277Example:
275 278
@@ -283,7 +286,7 @@ Example:
283struct my_struct { 286struct my_struct {
284 int a; 287 int a;
285 int b; 288 int b;
286/* private: */ 289/* private: internal use only */
287 int c; 290 int c;
288}; 291};
289 292
diff --git a/Documentation/sysctl/vm.txt b/Documentation/sysctl/vm.txt
index 97c4b328432..b716d33912d 100644
--- a/Documentation/sysctl/vm.txt
+++ b/Documentation/sysctl/vm.txt
@@ -90,6 +90,10 @@ will itself start writeback.
90If dirty_bytes is written, dirty_ratio becomes a function of its value 90If dirty_bytes is written, dirty_ratio becomes a function of its value
91(dirty_bytes / the amount of dirtyable system memory). 91(dirty_bytes / the amount of dirtyable system memory).
92 92
93Note: the minimum value allowed for dirty_bytes is two pages (in bytes); any
94value lower than this limit will be ignored and the old configuration will be
95retained.
96
93============================================================== 97==============================================================
94 98
95dirty_expire_centisecs 99dirty_expire_centisecs
diff --git a/MAINTAINERS b/MAINTAINERS
index 30cc6af4661..2b349ba4add 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4189,7 +4189,7 @@ P: Joel Becker
4189M: joel.becker@oracle.com 4189M: joel.becker@oracle.com
4190L: ocfs2-devel@oss.oracle.com (moderated for non-subscribers) 4190L: ocfs2-devel@oss.oracle.com (moderated for non-subscribers)
4191W: http://oss.oracle.com/projects/ocfs2/ 4191W: http://oss.oracle.com/projects/ocfs2/
4192T: git git://git.kernel.org/pub/scm/linux/kernel/git/mfasheh/ocfs2.git 4192T: git git://git.kernel.org/pub/scm/linux/kernel/git/jlbec/ocfs2.git
4193S: Supported 4193S: Supported
4194F: Documentation/filesystems/ocfs2.txt 4194F: Documentation/filesystems/ocfs2.txt
4195F: Documentation/filesystems/dlmfs.txt 4195F: Documentation/filesystems/dlmfs.txt
@@ -4521,6 +4521,19 @@ M: jim@jtan.com
4521L: cbe-oss-dev@ozlabs.org 4521L: cbe-oss-dev@ozlabs.org
4522S: Maintained 4522S: Maintained
4523 4523
4524PTRACE SUPPORT
4525P: Roland McGrath
4526M: roland@redhat.com
4527P: Oleg Nesterov
4528M: oleg@redhat.com
4529L: linux-kernel@vger.kernel.org
4530S: Maintained
4531F: include/asm-generic/syscall.h
4532F: include/linux/ptrace.h
4533F: include/linux/regset.h
4534F: include/linux/tracehook.h
4535F: kernel/ptrace.c
4536
4524PVRUSB2 VIDEO4LINUX DRIVER 4537PVRUSB2 VIDEO4LINUX DRIVER
4525P: Mike Isely 4538P: Mike Isely
4526M: isely@pobox.com 4539M: isely@pobox.com
@@ -4666,13 +4679,13 @@ F: kernel/rcutorture.c
4666 4679
4667RDC R-321X SoC 4680RDC R-321X SoC
4668P: Florian Fainelli 4681P: Florian Fainelli
4669M: florian.fainelli@telecomint.eu 4682M: florian@openwrt.org
4670L: linux-kernel@vger.kernel.org 4683L: linux-kernel@vger.kernel.org
4671S: Maintained 4684S: Maintained
4672 4685
4673RDC R6040 FAST ETHERNET DRIVER 4686RDC R6040 FAST ETHERNET DRIVER
4674P: Florian Fainelli 4687P: Florian Fainelli
4675M: florian.fainelli@telecomint.eu 4688M: florian@openwrt.org
4676L: netdev@vger.kernel.org 4689L: netdev@vger.kernel.org
4677S: Maintained 4690S: Maintained
4678F: drivers/net/r6040.c 4691F: drivers/net/r6040.c
diff --git a/Makefile b/Makefile
index 9e5dc8f0ef4..b18afad2e10 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,8 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 30 3SUBLEVEL = 30
4EXTRAVERSION = -rc3 4EXTRAVERSION = -rc4
5NAME = Temporary Tasmanian Devil 5NAME = Vindictive Armadillo
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
8# To see a list of typical targets execute "make help" 8# To see a list of typical targets execute "make help"
@@ -1293,7 +1293,7 @@ help:
1293 @echo ' dir/ - Build all files in dir and below' 1293 @echo ' dir/ - Build all files in dir and below'
1294 @echo ' dir/file.[ois] - Build specified target only' 1294 @echo ' dir/file.[ois] - Build specified target only'
1295 @echo ' dir/file.ko - Build module including final link' 1295 @echo ' dir/file.ko - Build module including final link'
1296 @echo ' prepare - Set up for building external modules' 1296 @echo ' modules_prepare - Set up for building external modules'
1297 @echo ' tags/TAGS - Generate tags file for editors' 1297 @echo ' tags/TAGS - Generate tags file for editors'
1298 @echo ' cscope - Generate cscope index' 1298 @echo ' cscope - Generate cscope index'
1299 @echo ' kernelrelease - Output the release version string' 1299 @echo ' kernelrelease - Output the release version string'
@@ -1421,7 +1421,9 @@ $(clean-dirs):
1421 $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@) 1421 $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
1422 1422
1423clean: rm-dirs := $(MODVERDIR) 1423clean: rm-dirs := $(MODVERDIR)
1424clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers 1424clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers \
1425 $(KBUILD_EXTMOD)/Module.markers \
1426 $(KBUILD_EXTMOD)/modules.order
1425clean: $(clean-dirs) 1427clean: $(clean-dirs)
1426 $(call cmd,rmdirs) 1428 $(call cmd,rmdirs)
1427 $(call cmd,rmfiles) 1429 $(call cmd,rmfiles)
diff --git a/arch/alpha/include/asm/barrier.h b/arch/alpha/include/asm/barrier.h
index ac78eba909b..ce8860a0b32 100644
--- a/arch/alpha/include/asm/barrier.h
+++ b/arch/alpha/include/asm/barrier.h
@@ -16,11 +16,13 @@ __asm__ __volatile__("wmb": : :"memory")
16__asm__ __volatile__("mb": : :"memory") 16__asm__ __volatile__("mb": : :"memory")
17 17
18#ifdef CONFIG_SMP 18#ifdef CONFIG_SMP
19#define __ASM_SMP_MB "\tmb\n"
19#define smp_mb() mb() 20#define smp_mb() mb()
20#define smp_rmb() rmb() 21#define smp_rmb() rmb()
21#define smp_wmb() wmb() 22#define smp_wmb() wmb()
22#define smp_read_barrier_depends() read_barrier_depends() 23#define smp_read_barrier_depends() read_barrier_depends()
23#else 24#else
25#define __ASM_SMP_MB
24#define smp_mb() barrier() 26#define smp_mb() barrier()
25#define smp_rmb() barrier() 27#define smp_rmb() barrier()
26#define smp_wmb() barrier() 28#define smp_wmb() barrier()
diff --git a/arch/alpha/include/asm/futex.h b/arch/alpha/include/asm/futex.h
index 6a332a9f099..945de222ab9 100644
--- a/arch/alpha/include/asm/futex.h
+++ b/arch/alpha/include/asm/futex.h
@@ -1,6 +1,116 @@
1#ifndef _ASM_FUTEX_H 1#ifndef _ASM_ALPHA_FUTEX_H
2#define _ASM_FUTEX_H 2#define _ASM_ALPHA_FUTEX_H
3 3
4#include <asm-generic/futex.h> 4#ifdef __KERNEL__
5 5
6#endif 6#include <linux/futex.h>
7#include <linux/uaccess.h>
8#include <asm/errno.h>
9#include <asm/barrier.h>
10
11#define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \
12 __asm__ __volatile__( \
13 __ASM_SMP_MB \
14 "1: ldl_l %0,0(%2)\n" \
15 insn \
16 "2: stl_c %1,0(%2)\n" \
17 " beq %1,4f\n" \
18 " mov $31,%1\n" \
19 "3: .subsection 2\n" \
20 "4: br 1b\n" \
21 " .previous\n" \
22 " .section __ex_table,\"a\"\n" \
23 " .long 1b-.\n" \
24 " lda $31,3b-1b(%1)\n" \
25 " .long 2b-.\n" \
26 " lda $31,3b-2b(%1)\n" \
27 " .previous\n" \
28 : "=&r" (oldval), "=&r"(ret) \
29 : "r" (uaddr), "r"(oparg) \
30 : "memory")
31
32static inline int futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
33{
34 int op = (encoded_op >> 28) & 7;
35 int cmp = (encoded_op >> 24) & 15;
36 int oparg = (encoded_op << 8) >> 20;
37 int cmparg = (encoded_op << 20) >> 20;
38 int oldval = 0, ret;
39 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
40 oparg = 1 << oparg;
41
42 if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))
43 return -EFAULT;
44
45 pagefault_disable();
46
47 switch (op) {
48 case FUTEX_OP_SET:
49 __futex_atomic_op("mov %3,%1\n", ret, oldval, uaddr, oparg);
50 break;
51 case FUTEX_OP_ADD:
52 __futex_atomic_op("addl %0,%3,%1\n", ret, oldval, uaddr, oparg);
53 break;
54 case FUTEX_OP_OR:
55 __futex_atomic_op("or %0,%3,%1\n", ret, oldval, uaddr, oparg);
56 break;
57 case FUTEX_OP_ANDN:
58 __futex_atomic_op("andnot %0,%3,%1\n", ret, oldval, uaddr, oparg);
59 break;
60 case FUTEX_OP_XOR:
61 __futex_atomic_op("xor %0,%3,%1\n", ret, oldval, uaddr, oparg);
62 break;
63 default:
64 ret = -ENOSYS;
65 }
66
67 pagefault_enable();
68
69 if (!ret) {
70 switch (cmp) {
71 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
72 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
73 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
74 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
75 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
76 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
77 default: ret = -ENOSYS;
78 }
79 }
80 return ret;
81}
82
83static inline int
84futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
85{
86 int prev, cmp;
87
88 if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))
89 return -EFAULT;
90
91 __asm__ __volatile__ (
92 __ASM_SMP_MB
93 "1: ldl_l %0,0(%2)\n"
94 " cmpeq %0,%3,%1\n"
95 " beq %1,3f\n"
96 " mov %4,%1\n"
97 "2: stl_c %1,0(%2)\n"
98 " beq %1,4f\n"
99 "3: .subsection 2\n"
100 "4: br 1b\n"
101 " .previous\n"
102 " .section __ex_table,\"a\"\n"
103 " .long 1b-.\n"
104 " lda $31,3b-1b(%0)\n"
105 " .long 2b-.\n"
106 " lda $31,3b-2b(%0)\n"
107 " .previous\n"
108 : "=&r"(prev), "=&r"(cmp)
109 : "r"(uaddr), "r"((long)oldval), "r"(newval)
110 : "memory");
111
112 return prev;
113}
114
115#endif /* __KERNEL__ */
116#endif /* _ASM_ALPHA_FUTEX_H */
diff --git a/arch/alpha/include/asm/uaccess.h b/arch/alpha/include/asm/uaccess.h
index 163f3053001..b49ec2f8d6e 100644
--- a/arch/alpha/include/asm/uaccess.h
+++ b/arch/alpha/include/asm/uaccess.h
@@ -507,5 +507,7 @@ struct exception_table_entry
507 (pc) + (_fixup)->fixup.bits.nextinsn; \ 507 (pc) + (_fixup)->fixup.bits.nextinsn; \
508}) 508})
509 509
510#define ARCH_HAS_SORT_EXTABLE
511#define ARCH_HAS_SEARCH_EXTABLE
510 512
511#endif /* __ALPHA_UACCESS_H */ 513#endif /* __ALPHA_UACCESS_H */
diff --git a/arch/alpha/kernel/Makefile b/arch/alpha/kernel/Makefile
index a427538252f..7739a62440a 100644
--- a/arch/alpha/kernel/Makefile
+++ b/arch/alpha/kernel/Makefile
@@ -8,7 +8,7 @@ EXTRA_CFLAGS := -Werror -Wno-sign-compare
8 8
9obj-y := entry.o traps.o process.o init_task.o osf_sys.o irq.o \ 9obj-y := entry.o traps.o process.o init_task.o osf_sys.o irq.o \
10 irq_alpha.o signal.o setup.o ptrace.o time.o \ 10 irq_alpha.o signal.o setup.o ptrace.o time.o \
11 alpha_ksyms.o systbls.o err_common.o io.o binfmt_loader.o 11 alpha_ksyms.o systbls.o err_common.o io.o
12 12
13obj-$(CONFIG_VGA_HOSE) += console.o 13obj-$(CONFIG_VGA_HOSE) += console.o
14obj-$(CONFIG_SMP) += smp.o 14obj-$(CONFIG_SMP) += smp.o
@@ -43,6 +43,10 @@ else
43# Misc support 43# Misc support
44obj-$(CONFIG_ALPHA_SRM) += srmcons.o 44obj-$(CONFIG_ALPHA_SRM) += srmcons.o
45 45
46ifdef CONFIG_BINFMT_AOUT
47obj-y += binfmt_loader.o
48endif
49
46# Core logic support 50# Core logic support
47obj-$(CONFIG_ALPHA_APECS) += core_apecs.o 51obj-$(CONFIG_ALPHA_APECS) += core_apecs.o
48obj-$(CONFIG_ALPHA_CIA) += core_cia.o 52obj-$(CONFIG_ALPHA_CIA) += core_cia.o
diff --git a/arch/alpha/kernel/binfmt_loader.c b/arch/alpha/kernel/binfmt_loader.c
index 4a0af906b00..3fcfad41013 100644
--- a/arch/alpha/kernel/binfmt_loader.c
+++ b/arch/alpha/kernel/binfmt_loader.c
@@ -46,6 +46,6 @@ static struct linux_binfmt loader_format = {
46 46
47static int __init init_loader_binfmt(void) 47static int __init init_loader_binfmt(void)
48{ 48{
49 return register_binfmt(&loader_format); 49 return insert_binfmt(&loader_format);
50} 50}
51arch_initcall(init_loader_binfmt); 51arch_initcall(init_loader_binfmt);
diff --git a/arch/alpha/kernel/err_ev6.c b/arch/alpha/kernel/err_ev6.c
index 985e5c1681a..8ca6345bf13 100644
--- a/arch/alpha/kernel/err_ev6.c
+++ b/arch/alpha/kernel/err_ev6.c
@@ -229,7 +229,7 @@ ev6_process_logout_frame(struct el_common *mchk_header, int print)
229} 229}
230 230
231void 231void
232ev6_machine_check(u64 vector, u64 la_ptr) 232ev6_machine_check(unsigned long vector, unsigned long la_ptr)
233{ 233{
234 struct el_common *mchk_header = (struct el_common *)la_ptr; 234 struct el_common *mchk_header = (struct el_common *)la_ptr;
235 235
diff --git a/arch/alpha/kernel/err_ev7.c b/arch/alpha/kernel/err_ev7.c
index 73770c6ca01..d738a67112d 100644
--- a/arch/alpha/kernel/err_ev7.c
+++ b/arch/alpha/kernel/err_ev7.c
@@ -117,7 +117,7 @@ ev7_collect_logout_frame_subpackets(struct el_subpacket *el_ptr,
117} 117}
118 118
119void 119void
120ev7_machine_check(u64 vector, u64 la_ptr) 120ev7_machine_check(unsigned long vector, unsigned long la_ptr)
121{ 121{
122 struct el_subpacket *el_ptr = (struct el_subpacket *)la_ptr; 122 struct el_subpacket *el_ptr = (struct el_subpacket *)la_ptr;
123 char *saved_err_prefix = err_print_prefix; 123 char *saved_err_prefix = err_print_prefix;
@@ -246,7 +246,7 @@ ev7_process_pal_subpacket(struct el_subpacket *header)
246 246
247 switch(header->type) { 247 switch(header->type) {
248 case EL_TYPE__PAL__LOGOUT_FRAME: 248 case EL_TYPE__PAL__LOGOUT_FRAME:
249 printk("%s*** MCHK occurred on LPID %ld (RBOX %llx)\n", 249 printk("%s*** MCHK occurred on LPID %lld (RBOX %llx)\n",
250 err_print_prefix, 250 err_print_prefix,
251 packet->by_type.logout.whami, 251 packet->by_type.logout.whami,
252 packet->by_type.logout.rbox_whami); 252 packet->by_type.logout.rbox_whami);
diff --git a/arch/alpha/kernel/err_impl.h b/arch/alpha/kernel/err_impl.h
index 3c12258158e..0c010ca4611 100644
--- a/arch/alpha/kernel/err_impl.h
+++ b/arch/alpha/kernel/err_impl.h
@@ -60,26 +60,26 @@ extern struct ev7_lf_subpackets *
60ev7_collect_logout_frame_subpackets(struct el_subpacket *, 60ev7_collect_logout_frame_subpackets(struct el_subpacket *,
61 struct ev7_lf_subpackets *); 61 struct ev7_lf_subpackets *);
62extern void ev7_register_error_handlers(void); 62extern void ev7_register_error_handlers(void);
63extern void ev7_machine_check(u64, u64); 63extern void ev7_machine_check(unsigned long, unsigned long);
64 64
65/* 65/*
66 * err_ev6.c 66 * err_ev6.c
67 */ 67 */
68extern void ev6_register_error_handlers(void); 68extern void ev6_register_error_handlers(void);
69extern int ev6_process_logout_frame(struct el_common *, int); 69extern int ev6_process_logout_frame(struct el_common *, int);
70extern void ev6_machine_check(u64, u64); 70extern void ev6_machine_check(unsigned long, unsigned long);
71 71
72/* 72/*
73 * err_marvel.c 73 * err_marvel.c
74 */ 74 */
75extern void marvel_machine_check(u64, u64); 75extern void marvel_machine_check(unsigned long, unsigned long);
76extern void marvel_register_error_handlers(void); 76extern void marvel_register_error_handlers(void);
77 77
78/* 78/*
79 * err_titan.c 79 * err_titan.c
80 */ 80 */
81extern int titan_process_logout_frame(struct el_common *, int); 81extern int titan_process_logout_frame(struct el_common *, int);
82extern void titan_machine_check(u64, u64); 82extern void titan_machine_check(unsigned long, unsigned long);
83extern void titan_register_error_handlers(void); 83extern void titan_register_error_handlers(void);
84extern int privateer_process_logout_frame(struct el_common *, int); 84extern int privateer_process_logout_frame(struct el_common *, int);
85extern void privateer_machine_check(u64, u64); 85extern void privateer_machine_check(unsigned long, unsigned long);
diff --git a/arch/alpha/kernel/err_marvel.c b/arch/alpha/kernel/err_marvel.c
index 6bfd243efba..52a79dfc13c 100644
--- a/arch/alpha/kernel/err_marvel.c
+++ b/arch/alpha/kernel/err_marvel.c
@@ -1042,7 +1042,7 @@ marvel_process_logout_frame(struct ev7_lf_subpackets *lf_subpackets, int print)
1042} 1042}
1043 1043
1044void 1044void
1045marvel_machine_check(u64 vector, u64 la_ptr) 1045marvel_machine_check(unsigned long vector, unsigned long la_ptr)
1046{ 1046{
1047 struct el_subpacket *el_ptr = (struct el_subpacket *)la_ptr; 1047 struct el_subpacket *el_ptr = (struct el_subpacket *)la_ptr;
1048 int (*process_frame)(struct ev7_lf_subpackets *, int) = NULL; 1048 int (*process_frame)(struct ev7_lf_subpackets *, int) = NULL;
diff --git a/arch/alpha/kernel/err_titan.c b/arch/alpha/kernel/err_titan.c
index c7e28a88d6e..f7ed97ce0df 100644
--- a/arch/alpha/kernel/err_titan.c
+++ b/arch/alpha/kernel/err_titan.c
@@ -380,7 +380,7 @@ titan_process_logout_frame(struct el_common *mchk_header, int print)
380} 380}
381 381
382void 382void
383titan_machine_check(u64 vector, u64 la_ptr) 383titan_machine_check(unsigned long vector, unsigned long la_ptr)
384{ 384{
385 struct el_common *mchk_header = (struct el_common *)la_ptr; 385 struct el_common *mchk_header = (struct el_common *)la_ptr;
386 struct el_TITAN_sysdata_mcheck *tmchk = 386 struct el_TITAN_sysdata_mcheck *tmchk =
@@ -702,7 +702,7 @@ privateer_process_logout_frame(struct el_common *mchk_header, int print)
702} 702}
703 703
704void 704void
705privateer_machine_check(u64 vector, u64 la_ptr) 705privateer_machine_check(unsigned long vector, unsigned long la_ptr)
706{ 706{
707 struct el_common *mchk_header = (struct el_common *)la_ptr; 707 struct el_common *mchk_header = (struct el_common *)la_ptr;
708 struct el_TITAN_sysdata_mcheck *tmchk = 708 struct el_TITAN_sysdata_mcheck *tmchk =
diff --git a/arch/alpha/kernel/proto.h b/arch/alpha/kernel/proto.h
index 567f2598d09..3d2627ec986 100644
--- a/arch/alpha/kernel/proto.h
+++ b/arch/alpha/kernel/proto.h
@@ -36,7 +36,6 @@ extern void cia_pci_tbi(struct pci_controller *, dma_addr_t, dma_addr_t);
36extern struct pci_ops irongate_pci_ops; 36extern struct pci_ops irongate_pci_ops;
37extern int irongate_pci_clr_err(void); 37extern int irongate_pci_clr_err(void);
38extern void irongate_init_arch(void); 38extern void irongate_init_arch(void);
39extern void irongate_machine_check(u64, u64);
40#define irongate_pci_tbi ((void *)0) 39#define irongate_pci_tbi ((void *)0)
41 40
42/* core_lca.c */ 41/* core_lca.c */
@@ -49,7 +48,7 @@ extern void lca_pci_tbi(struct pci_controller *, dma_addr_t, dma_addr_t);
49extern struct pci_ops marvel_pci_ops; 48extern struct pci_ops marvel_pci_ops;
50extern void marvel_init_arch(void); 49extern void marvel_init_arch(void);
51extern void marvel_kill_arch(int); 50extern void marvel_kill_arch(int);
52extern void marvel_machine_check(u64, u64); 51extern void marvel_machine_check(unsigned long, unsigned long);
53extern void marvel_pci_tbi(struct pci_controller *, dma_addr_t, dma_addr_t); 52extern void marvel_pci_tbi(struct pci_controller *, dma_addr_t, dma_addr_t);
54extern int marvel_pa_to_nid(unsigned long); 53extern int marvel_pa_to_nid(unsigned long);
55extern int marvel_cpuid_to_nid(int); 54extern int marvel_cpuid_to_nid(int);
@@ -86,7 +85,7 @@ extern void t2_pci_tbi(struct pci_controller *, dma_addr_t, dma_addr_t);
86extern struct pci_ops titan_pci_ops; 85extern struct pci_ops titan_pci_ops;
87extern void titan_init_arch(void); 86extern void titan_init_arch(void);
88extern void titan_kill_arch(int); 87extern void titan_kill_arch(int);
89extern void titan_machine_check(u64, u64); 88extern void titan_machine_check(unsigned long, unsigned long);
90extern void titan_pci_tbi(struct pci_controller *, dma_addr_t, dma_addr_t); 89extern void titan_pci_tbi(struct pci_controller *, dma_addr_t, dma_addr_t);
91extern struct _alpha_agp_info *titan_agp_info(void); 90extern struct _alpha_agp_info *titan_agp_info(void);
92 91
diff --git a/arch/alpha/mm/extable.c b/arch/alpha/mm/extable.c
index dc7aeda1577..62dc379d301 100644
--- a/arch/alpha/mm/extable.c
+++ b/arch/alpha/mm/extable.c
@@ -3,11 +3,49 @@
3 */ 3 */
4 4
5#include <linux/module.h> 5#include <linux/module.h>
6#include <linux/sort.h>
6#include <asm/uaccess.h> 7#include <asm/uaccess.h>
7 8
9static inline unsigned long ex_to_addr(const struct exception_table_entry *x)
10{
11 return (unsigned long)&x->insn + x->insn;
12}
13
14static void swap_ex(void *a, void *b, int size)
15{
16 struct exception_table_entry *ex_a = a, *ex_b = b;
17 unsigned long addr_a = ex_to_addr(ex_a), addr_b = ex_to_addr(ex_b);
18 unsigned int t = ex_a->fixup.unit;
19
20 ex_a->fixup.unit = ex_b->fixup.unit;
21 ex_b->fixup.unit = t;
22 ex_a->insn = (int)(addr_b - (unsigned long)&ex_a->insn);
23 ex_b->insn = (int)(addr_a - (unsigned long)&ex_b->insn);
24}
25
26/*
27 * The exception table needs to be sorted so that the binary
28 * search that we use to find entries in it works properly.
29 * This is used both for the kernel exception table and for
30 * the exception tables of modules that get loaded.
31 */
32static int cmp_ex(const void *a, const void *b)
33{
34 const struct exception_table_entry *x = a, *y = b;
35
36 /* avoid overflow */
37 if (ex_to_addr(x) > ex_to_addr(y))
38 return 1;
39 if (ex_to_addr(x) < ex_to_addr(y))
40 return -1;
41 return 0;
42}
43
8void sort_extable(struct exception_table_entry *start, 44void sort_extable(struct exception_table_entry *start,
9 struct exception_table_entry *finish) 45 struct exception_table_entry *finish)
10{ 46{
47 sort(start, finish - start, sizeof(struct exception_table_entry),
48 cmp_ex, swap_ex);
11} 49}
12 50
13const struct exception_table_entry * 51const struct exception_table_entry *
@@ -20,7 +58,7 @@ search_extable(const struct exception_table_entry *first,
20 unsigned long mid_value; 58 unsigned long mid_value;
21 59
22 mid = (last - first) / 2 + first; 60 mid = (last - first) / 2 + first;
23 mid_value = (unsigned long)&mid->insn + mid->insn; 61 mid_value = ex_to_addr(mid);
24 if (mid_value == value) 62 if (mid_value == value)
25 return mid; 63 return mid;
26 else if (mid_value < value) 64 else if (mid_value < value)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index e02b893fb90..9faccc411c2 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -486,8 +486,6 @@ config ARCH_PXA
486 select HAVE_CLK 486 select HAVE_CLK
487 select COMMON_CLKDEV 487 select COMMON_CLKDEV
488 select ARCH_REQUIRE_GPIOLIB 488 select ARCH_REQUIRE_GPIOLIB
489 select HAVE_CLK
490 select COMMON_CLKDEV
491 select GENERIC_TIME 489 select GENERIC_TIME
492 select GENERIC_CLOCKEVENTS 490 select GENERIC_CLOCKEVENTS
493 select TICK_ONESHOT 491 select TICK_ONESHOT
@@ -585,6 +583,8 @@ config ARCH_DAVINCI
585 select ARCH_REQUIRE_GPIOLIB 583 select ARCH_REQUIRE_GPIOLIB
586 select HAVE_CLK 584 select HAVE_CLK
587 select ZONE_DMA 585 select ZONE_DMA
586 select HAVE_IDE
587 select COMMON_CLKDEV
588 help 588 help
589 Support for TI's DaVinci platform. 589 Support for TI's DaVinci platform.
590 590
@@ -740,6 +740,56 @@ if !MMU
740source "arch/arm/Kconfig-nommu" 740source "arch/arm/Kconfig-nommu"
741endif 741endif
742 742
743config ARM_ERRATA_411920
744 bool "ARM errata: Invalidation of the Instruction Cache operation can fail"
745 depends on CPU_V6 && !SMP
746 help
747 Invalidation of the Instruction Cache operation can
748 fail. This erratum is present in 1136 (before r1p4), 1156 and 1176.
749 It does not affect the MPCore. This option enables the ARM Ltd.
750 recommended workaround.
751
752config ARM_ERRATA_430973
753 bool "ARM errata: Stale prediction on replaced interworking branch"
754 depends on CPU_V7
755 help
756 This option enables the workaround for the 430973 Cortex-A8
757 (r1p0..r1p2) erratum. If a code sequence containing an ARM/Thumb
758 interworking branch is replaced with another code sequence at the
759 same virtual address, whether due to self-modifying code or virtual
760 to physical address re-mapping, Cortex-A8 does not recover from the
761 stale interworking branch prediction. This results in Cortex-A8
762 executing the new code sequence in the incorrect ARM or Thumb state.
763 The workaround enables the BTB/BTAC operations by setting ACTLR.IBE
764 and also flushes the branch target cache at every context switch.
765 Note that setting specific bits in the ACTLR register may not be
766 available in non-secure mode.
767
768config ARM_ERRATA_458693
769 bool "ARM errata: Processor deadlock when a false hazard is created"
770 depends on CPU_V7
771 help
772 This option enables the workaround for the 458693 Cortex-A8 (r2p0)
773 erratum. For very specific sequences of memory operations, it is
774 possible for a hazard condition intended for a cache line to instead
775 be incorrectly associated with a different cache line. This false
776 hazard might then cause a processor deadlock. The workaround enables
777 the L1 caching of the NEON accesses and disables the PLD instruction
778 in the ACTLR register. Note that setting specific bits in the ACTLR
779 register may not be available in non-secure mode.
780
781config ARM_ERRATA_460075
782 bool "ARM errata: Data written to the L2 cache can be overwritten with stale data"
783 depends on CPU_V7
784 help
785 This option enables the workaround for the 460075 Cortex-A8 (r2p0)
786 erratum. Any asynchronous access to the L2 cache may encounter a
787 situation in which recent store transactions to the L2 cache are lost
788 and overwritten with stale memory contents from external memory. The
789 workaround disables the write-allocate mode for the L2 cache via the
790 ACTLR register. Note that setting specific bits in the ACTLR register
791 may not be available in non-secure mode.
792
743endmenu 793endmenu
744 794
745source "arch/arm/common/Kconfig" 795source "arch/arm/common/Kconfig"
@@ -1171,12 +1221,6 @@ config CPU_FREQ_IMX
1171 1221
1172 If in doubt, say N. 1222 If in doubt, say N.
1173 1223
1174config CPU_FREQ_PXA
1175 bool
1176 depends on CPU_FREQ && ARCH_PXA && PXA25x
1177 default y
1178 select CPU_FREQ_DEFAULT_GOV_USERSPACE
1179
1180endif 1224endif
1181 1225
1182source "drivers/cpuidle/Kconfig" 1226source "drivers/cpuidle/Kconfig"
diff --git a/arch/arm/configs/davinci_all_defconfig b/arch/arm/configs/davinci_all_defconfig
new file mode 100644
index 00000000000..eb2738b5be5
--- /dev/null
+++ b/arch/arm/configs/davinci_all_defconfig
@@ -0,0 +1,1784 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.30-rc2
4# Wed Apr 15 08:16:53 2009
5#
6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8CONFIG_GENERIC_GPIO=y
9CONFIG_GENERIC_TIME=y
10CONFIG_GENERIC_CLOCKEVENTS=y
11CONFIG_MMU=y
12# CONFIG_NO_IOPORT is not set
13CONFIG_GENERIC_HARDIRQS=y
14CONFIG_STACKTRACE_SUPPORT=y
15CONFIG_HAVE_LATENCYTOP_SUPPORT=y
16CONFIG_LOCKDEP_SUPPORT=y
17CONFIG_TRACE_IRQFLAGS_SUPPORT=y
18CONFIG_HARDIRQS_SW_RESEND=y
19CONFIG_GENERIC_IRQ_PROBE=y
20CONFIG_RWSEM_GENERIC_SPINLOCK=y
21# CONFIG_ARCH_HAS_ILOG2_U32 is not set
22# CONFIG_ARCH_HAS_ILOG2_U64 is not set
23CONFIG_GENERIC_HWEIGHT=y
24CONFIG_GENERIC_CALIBRATE_DELAY=y
25CONFIG_ZONE_DMA=y
26CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
27CONFIG_VECTORS_BASE=0xffff0000
28CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
29
30#
31# General setup
32#
33CONFIG_EXPERIMENTAL=y
34CONFIG_BROKEN_ON_SMP=y
35CONFIG_LOCK_KERNEL=y
36CONFIG_INIT_ENV_ARG_LIMIT=32
37CONFIG_LOCALVERSION=""
38CONFIG_LOCALVERSION_AUTO=y
39# CONFIG_SWAP is not set
40CONFIG_SYSVIPC=y
41CONFIG_SYSVIPC_SYSCTL=y
42CONFIG_POSIX_MQUEUE=y
43CONFIG_POSIX_MQUEUE_SYSCTL=y
44# CONFIG_BSD_PROCESS_ACCT is not set
45# CONFIG_TASKSTATS is not set
46# CONFIG_AUDIT is not set
47
48#
49# RCU Subsystem
50#
51CONFIG_CLASSIC_RCU=y
52# CONFIG_TREE_RCU is not set
53# CONFIG_PREEMPT_RCU is not set
54# CONFIG_TREE_RCU_TRACE is not set
55# CONFIG_PREEMPT_RCU_TRACE is not set
56CONFIG_IKCONFIG=y
57CONFIG_IKCONFIG_PROC=y
58CONFIG_LOG_BUF_SHIFT=14
59CONFIG_GROUP_SCHED=y
60CONFIG_FAIR_GROUP_SCHED=y
61# CONFIG_RT_GROUP_SCHED is not set
62CONFIG_USER_SCHED=y
63# CONFIG_CGROUP_SCHED is not set
64# CONFIG_CGROUPS is not set
65CONFIG_SYSFS_DEPRECATED=y
66CONFIG_SYSFS_DEPRECATED_V2=y
67# CONFIG_RELAY is not set
68# CONFIG_NAMESPACES is not set
69CONFIG_BLK_DEV_INITRD=y
70CONFIG_INITRAMFS_SOURCE=""
71CONFIG_RD_GZIP=y
72# CONFIG_RD_BZIP2 is not set
73# CONFIG_RD_LZMA is not set
74CONFIG_CC_OPTIMIZE_FOR_SIZE=y
75CONFIG_SYSCTL=y
76CONFIG_ANON_INODES=y
77CONFIG_EMBEDDED=y
78CONFIG_UID16=y
79CONFIG_SYSCTL_SYSCALL=y
80CONFIG_KALLSYMS=y
81# CONFIG_KALLSYMS_ALL is not set
82# CONFIG_KALLSYMS_EXTRA_PASS is not set
83# CONFIG_STRIP_ASM_SYMS is not set
84CONFIG_HOTPLUG=y
85CONFIG_PRINTK=y
86CONFIG_BUG=y
87CONFIG_ELF_CORE=y
88CONFIG_BASE_FULL=y
89CONFIG_FUTEX=y
90CONFIG_EPOLL=y
91CONFIG_SIGNALFD=y
92CONFIG_TIMERFD=y
93CONFIG_EVENTFD=y
94CONFIG_SHMEM=y
95CONFIG_AIO=y
96CONFIG_VM_EVENT_COUNTERS=y
97CONFIG_SLUB_DEBUG=y
98CONFIG_COMPAT_BRK=y
99# CONFIG_SLAB is not set
100CONFIG_SLUB=y
101# CONFIG_SLOB is not set
102# CONFIG_PROFILING is not set
103# CONFIG_MARKERS is not set
104CONFIG_HAVE_OPROFILE=y
105# CONFIG_KPROBES is not set
106CONFIG_HAVE_KPROBES=y
107CONFIG_HAVE_KRETPROBES=y
108CONFIG_HAVE_CLK=y
109# CONFIG_SLOW_WORK is not set
110CONFIG_HAVE_GENERIC_DMA_COHERENT=y
111CONFIG_SLABINFO=y
112CONFIG_RT_MUTEXES=y
113CONFIG_BASE_SMALL=0
114CONFIG_MODULES=y
115# CONFIG_MODULE_FORCE_LOAD is not set
116CONFIG_MODULE_UNLOAD=y
117CONFIG_MODULE_FORCE_UNLOAD=y
118CONFIG_MODVERSIONS=y
119# CONFIG_MODULE_SRCVERSION_ALL is not set
120CONFIG_BLOCK=y
121# CONFIG_LBD is not set
122# CONFIG_BLK_DEV_BSG is not set
123# CONFIG_BLK_DEV_INTEGRITY is not set
124
125#
126# IO Schedulers
127#
128CONFIG_IOSCHED_NOOP=y
129CONFIG_IOSCHED_AS=y
130# CONFIG_IOSCHED_DEADLINE is not set
131# CONFIG_IOSCHED_CFQ is not set
132CONFIG_DEFAULT_AS=y
133# CONFIG_DEFAULT_DEADLINE is not set
134# CONFIG_DEFAULT_CFQ is not set
135# CONFIG_DEFAULT_NOOP is not set
136CONFIG_DEFAULT_IOSCHED="anticipatory"
137# CONFIG_FREEZER is not set
138
139#
140# System Type
141#
142# CONFIG_ARCH_AAEC2000 is not set
143# CONFIG_ARCH_INTEGRATOR is not set
144# CONFIG_ARCH_REALVIEW is not set
145# CONFIG_ARCH_VERSATILE is not set
146# CONFIG_ARCH_AT91 is not set
147# CONFIG_ARCH_CLPS711X is not set
148# CONFIG_ARCH_EBSA110 is not set
149# CONFIG_ARCH_EP93XX is not set
150# CONFIG_ARCH_GEMINI is not set
151# CONFIG_ARCH_FOOTBRIDGE is not set
152# CONFIG_ARCH_NETX is not set
153# CONFIG_ARCH_H720X is not set
154# CONFIG_ARCH_IMX is not set
155# CONFIG_ARCH_IOP13XX is not set
156# CONFIG_ARCH_IOP32X is not set
157# CONFIG_ARCH_IOP33X is not set
158# CONFIG_ARCH_IXP23XX is not set
159# CONFIG_ARCH_IXP2000 is not set
160# CONFIG_ARCH_IXP4XX is not set
161# CONFIG_ARCH_L7200 is not set
162# CONFIG_ARCH_KIRKWOOD is not set
163# CONFIG_ARCH_KS8695 is not set
164# CONFIG_ARCH_NS9XXX is not set
165# CONFIG_ARCH_LOKI is not set
166# CONFIG_ARCH_MV78XX0 is not set
167# CONFIG_ARCH_MXC is not set
168# CONFIG_ARCH_ORION5X is not set
169# CONFIG_ARCH_PNX4008 is not set
170# CONFIG_ARCH_PXA is not set
171# CONFIG_ARCH_MMP is not set
172# CONFIG_ARCH_RPC is not set
173# CONFIG_ARCH_SA1100 is not set
174# CONFIG_ARCH_S3C2410 is not set
175# CONFIG_ARCH_S3C64XX is not set
176# CONFIG_ARCH_SHARK is not set
177# CONFIG_ARCH_LH7A40X is not set
178CONFIG_ARCH_DAVINCI=y
179# CONFIG_ARCH_OMAP is not set
180# CONFIG_ARCH_MSM is not set
181# CONFIG_ARCH_W90X900 is not set
182
183#
184# TI DaVinci Implementations
185#
186
187#
188# DaVinci Core Type
189#
190CONFIG_ARCH_DAVINCI_DM644x=y
191
192#
193# DaVinci Board Type
194#
195CONFIG_MACH_DAVINCI_EVM=y
196CONFIG_DAVINCI_MUX=y
197CONFIG_DAVINCI_MUX_DEBUG=y
198CONFIG_DAVINCI_MUX_WARNINGS=y
199CONFIG_DAVINCI_RESET_CLOCKS=y
200
201#
202# Processor Type
203#
204CONFIG_CPU_32=y
205CONFIG_CPU_ARM926T=y
206CONFIG_CPU_32v5=y
207CONFIG_CPU_ABRT_EV5TJ=y
208CONFIG_CPU_PABRT_NOIFAR=y
209CONFIG_CPU_CACHE_VIVT=y
210CONFIG_CPU_COPY_V4WB=y
211CONFIG_CPU_TLB_V4WBI=y
212CONFIG_CPU_CP15=y
213CONFIG_CPU_CP15_MMU=y
214
215#
216# Processor Features
217#
218CONFIG_ARM_THUMB=y
219# CONFIG_CPU_ICACHE_DISABLE is not set
220# CONFIG_CPU_DCACHE_DISABLE is not set
221# CONFIG_CPU_DCACHE_WRITETHROUGH is not set
222# CONFIG_CPU_CACHE_ROUND_ROBIN is not set
223# CONFIG_OUTER_CACHE is not set
224CONFIG_COMMON_CLKDEV=y
225
226#
227# Bus support
228#
229# CONFIG_PCI_SYSCALL is not set
230# CONFIG_ARCH_SUPPORTS_MSI is not set
231# CONFIG_PCCARD is not set
232
233#
234# Kernel Features
235#
236CONFIG_TICK_ONESHOT=y
237CONFIG_NO_HZ=y
238CONFIG_HIGH_RES_TIMERS=y
239CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
240CONFIG_VMSPLIT_3G=y
241# CONFIG_VMSPLIT_2G is not set
242# CONFIG_VMSPLIT_1G is not set
243CONFIG_PAGE_OFFSET=0xC0000000
244CONFIG_PREEMPT=y
245CONFIG_HZ=100
246CONFIG_AEABI=y
247# CONFIG_OABI_COMPAT is not set
248CONFIG_ARCH_FLATMEM_HAS_HOLES=y
249# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set
250# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set
251# CONFIG_HIGHMEM is not set
252CONFIG_SELECT_MEMORY_MODEL=y
253CONFIG_FLATMEM_MANUAL=y
254# CONFIG_DISCONTIGMEM_MANUAL is not set
255# CONFIG_SPARSEMEM_MANUAL is not set
256CONFIG_FLATMEM=y
257CONFIG_FLAT_NODE_MEM_MAP=y
258CONFIG_PAGEFLAGS_EXTENDED=y
259CONFIG_SPLIT_PTLOCK_CPUS=4096
260# CONFIG_PHYS_ADDR_T_64BIT is not set
261CONFIG_ZONE_DMA_FLAG=1
262CONFIG_BOUNCE=y
263CONFIG_VIRT_TO_BUS=y
264CONFIG_UNEVICTABLE_LRU=y
265CONFIG_HAVE_MLOCK=y
266CONFIG_HAVE_MLOCKED_PAGE_BIT=y
267CONFIG_LEDS=y
268# CONFIG_LEDS_CPU is not set
269CONFIG_ALIGNMENT_TRAP=y
270
271#
272# Boot options
273#
274CONFIG_ZBOOT_ROM_TEXT=0x0
275CONFIG_ZBOOT_ROM_BSS=0x0
276CONFIG_CMDLINE=""
277# CONFIG_XIP_KERNEL is not set
278# CONFIG_KEXEC is not set
279
280#
281# CPU Power Management
282#
283# CONFIG_CPU_IDLE is not set
284
285#
286# Floating point emulation
287#
288
289#
290# At least one emulation must be selected
291#
292# CONFIG_VFP is not set
293
294#
295# Userspace binary formats
296#
297CONFIG_BINFMT_ELF=y
298# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
299CONFIG_HAVE_AOUT=y
300# CONFIG_BINFMT_AOUT is not set
301# CONFIG_BINFMT_MISC is not set
302
303#
304# Power management options
305#
306# CONFIG_PM is not set
307CONFIG_ARCH_SUSPEND_POSSIBLE=y
308CONFIG_NET=y
309
310#
311# Networking options
312#
313CONFIG_PACKET=y
314# CONFIG_PACKET_MMAP is not set
315CONFIG_UNIX=y
316CONFIG_XFRM=y
317# CONFIG_XFRM_USER is not set
318# CONFIG_XFRM_SUB_POLICY is not set
319# CONFIG_XFRM_MIGRATE is not set
320# CONFIG_XFRM_STATISTICS is not set
321# CONFIG_NET_KEY is not set
322CONFIG_INET=y
323# CONFIG_IP_MULTICAST is not set
324# CONFIG_IP_ADVANCED_ROUTER is not set
325CONFIG_IP_FIB_HASH=y
326CONFIG_IP_PNP=y
327CONFIG_IP_PNP_DHCP=y
328# CONFIG_IP_PNP_BOOTP is not set
329# CONFIG_IP_PNP_RARP is not set
330# CONFIG_NET_IPIP is not set
331# CONFIG_NET_IPGRE is not set
332# CONFIG_ARPD is not set
333# CONFIG_SYN_COOKIES is not set
334# CONFIG_INET_AH is not set
335# CONFIG_INET_ESP is not set
336# CONFIG_INET_IPCOMP is not set
337# CONFIG_INET_XFRM_TUNNEL is not set
338CONFIG_INET_TUNNEL=m
339CONFIG_INET_XFRM_MODE_TRANSPORT=y
340CONFIG_INET_XFRM_MODE_TUNNEL=y
341CONFIG_INET_XFRM_MODE_BEET=y
342# CONFIG_INET_LRO is not set
343CONFIG_INET_DIAG=y
344CONFIG_INET_TCP_DIAG=y
345# CONFIG_TCP_CONG_ADVANCED is not set
346CONFIG_TCP_CONG_CUBIC=y
347CONFIG_DEFAULT_TCP_CONG="cubic"
348# CONFIG_TCP_MD5SIG is not set
349CONFIG_IPV6=m
350# CONFIG_IPV6_PRIVACY is not set
351# CONFIG_IPV6_ROUTER_PREF is not set
352# CONFIG_IPV6_OPTIMISTIC_DAD is not set
353# CONFIG_INET6_AH is not set
354# CONFIG_INET6_ESP is not set
355# CONFIG_INET6_IPCOMP is not set
356# CONFIG_IPV6_MIP6 is not set
357# CONFIG_INET6_XFRM_TUNNEL is not set
358# CONFIG_INET6_TUNNEL is not set
359CONFIG_INET6_XFRM_MODE_TRANSPORT=m
360CONFIG_INET6_XFRM_MODE_TUNNEL=m
361CONFIG_INET6_XFRM_MODE_BEET=m
362# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
363CONFIG_IPV6_SIT=m
364CONFIG_IPV6_NDISC_NODETYPE=y
365# CONFIG_IPV6_TUNNEL is not set
366# CONFIG_IPV6_MULTIPLE_TABLES is not set
367# CONFIG_IPV6_MROUTE is not set
368# CONFIG_NETWORK_SECMARK is not set
369CONFIG_NETFILTER=y
370# CONFIG_NETFILTER_DEBUG is not set
371CONFIG_NETFILTER_ADVANCED=y
372
373#
374# Core Netfilter Configuration
375#
376# CONFIG_NETFILTER_NETLINK_QUEUE is not set
377# CONFIG_NETFILTER_NETLINK_LOG is not set
378# CONFIG_NF_CONNTRACK is not set
379# CONFIG_NETFILTER_XTABLES is not set
380# CONFIG_IP_VS is not set
381
382#
383# IP: Netfilter Configuration
384#
385# CONFIG_NF_DEFRAG_IPV4 is not set
386# CONFIG_IP_NF_QUEUE is not set
387# CONFIG_IP_NF_IPTABLES is not set
388# CONFIG_IP_NF_ARPTABLES is not set
389
390#
391# IPv6: Netfilter Configuration
392#
393# CONFIG_IP6_NF_QUEUE is not set
394# CONFIG_IP6_NF_IPTABLES is not set
395# CONFIG_IP_DCCP is not set
396# CONFIG_IP_SCTP is not set
397# CONFIG_TIPC is not set
398# CONFIG_ATM is not set
399# CONFIG_BRIDGE is not set
400# CONFIG_NET_DSA is not set
401# CONFIG_VLAN_8021Q is not set
402# CONFIG_DECNET is not set
403# CONFIG_LLC2 is not set
404# CONFIG_IPX is not set
405# CONFIG_ATALK is not set
406# CONFIG_X25 is not set
407# CONFIG_LAPB is not set
408# CONFIG_ECONET is not set
409# CONFIG_WAN_ROUTER is not set
410# CONFIG_PHONET is not set
411# CONFIG_NET_SCHED is not set
412# CONFIG_DCB is not set
413
414#
415# Network testing
416#
417# CONFIG_NET_PKTGEN is not set
418# CONFIG_HAMRADIO is not set
419# CONFIG_CAN is not set
420# CONFIG_IRDA is not set
421# CONFIG_BT is not set
422# CONFIG_AF_RXRPC is not set
423# CONFIG_WIRELESS is not set
424# CONFIG_WIMAX is not set
425# CONFIG_RFKILL is not set
426# CONFIG_NET_9P is not set
427
428#
429# Device Drivers
430#
431
432#
433# Generic Driver Options
434#
435CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
436CONFIG_STANDALONE=y
437CONFIG_PREVENT_FIRMWARE_BUILD=y
438# CONFIG_FW_LOADER is not set
439# CONFIG_DEBUG_DRIVER is not set
440# CONFIG_DEBUG_DEVRES is not set
441# CONFIG_SYS_HYPERVISOR is not set
442# CONFIG_CONNECTOR is not set
443CONFIG_MTD=m
444# CONFIG_MTD_DEBUG is not set
445# CONFIG_MTD_CONCAT is not set
446CONFIG_MTD_PARTITIONS=y
447# CONFIG_MTD_TESTS is not set
448# CONFIG_MTD_REDBOOT_PARTS is not set
449# CONFIG_MTD_AFS_PARTS is not set
450# CONFIG_MTD_AR7_PARTS is not set
451
452#
453# User Modules And Translation Layers
454#
455CONFIG_MTD_CHAR=m
456CONFIG_MTD_BLKDEVS=m
457CONFIG_MTD_BLOCK=m
458# CONFIG_MTD_BLOCK_RO is not set
459# CONFIG_FTL is not set
460# CONFIG_NFTL is not set
461# CONFIG_INFTL is not set
462# CONFIG_RFD_FTL is not set
463# CONFIG_SSFDC is not set
464# CONFIG_MTD_OOPS is not set
465
466#
467# RAM/ROM/Flash chip drivers
468#
469CONFIG_MTD_CFI=m
470# CONFIG_MTD_JEDECPROBE is not set
471CONFIG_MTD_GEN_PROBE=m
472# CONFIG_MTD_CFI_ADV_OPTIONS is not set
473CONFIG_MTD_MAP_BANK_WIDTH_1=y
474CONFIG_MTD_MAP_BANK_WIDTH_2=y
475CONFIG_MTD_MAP_BANK_WIDTH_4=y
476# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
477# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
478# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
479CONFIG_MTD_CFI_I1=y
480CONFIG_MTD_CFI_I2=y
481# CONFIG_MTD_CFI_I4 is not set
482# CONFIG_MTD_CFI_I8 is not set
483# CONFIG_MTD_CFI_INTELEXT is not set
484CONFIG_MTD_CFI_AMDSTD=m
485# CONFIG_MTD_CFI_STAA is not set
486CONFIG_MTD_CFI_UTIL=m
487# CONFIG_MTD_RAM is not set
488# CONFIG_MTD_ROM is not set
489# CONFIG_MTD_ABSENT is not set
490
491#
492# Mapping drivers for chip access
493#
494# CONFIG_MTD_COMPLEX_MAPPINGS is not set
495CONFIG_MTD_PHYSMAP=m
496# CONFIG_MTD_PHYSMAP_COMPAT is not set
497# CONFIG_MTD_ARM_INTEGRATOR is not set
498# CONFIG_MTD_PLATRAM is not set
499
500#
501# Self-contained MTD device drivers
502#
503# CONFIG_MTD_SLRAM is not set
504# CONFIG_MTD_PHRAM is not set
505# CONFIG_MTD_MTDRAM is not set
506# CONFIG_MTD_BLOCK2MTD is not set
507
508#
509# Disk-On-Chip Device Drivers
510#
511# CONFIG_MTD_DOC2000 is not set
512# CONFIG_MTD_DOC2001 is not set
513# CONFIG_MTD_DOC2001PLUS is not set
514CONFIG_MTD_NAND=m
515# CONFIG_MTD_NAND_VERIFY_WRITE is not set
516# CONFIG_MTD_NAND_ECC_SMC is not set
517# CONFIG_MTD_NAND_MUSEUM_IDS is not set
518# CONFIG_MTD_NAND_GPIO is not set
519CONFIG_MTD_NAND_IDS=m
520# CONFIG_MTD_NAND_DISKONCHIP is not set
521# CONFIG_MTD_NAND_NANDSIM is not set
522# CONFIG_MTD_NAND_PLATFORM is not set
523# CONFIG_MTD_ALAUDA is not set
524CONFIG_MTD_NAND_DAVINCI=m
525# CONFIG_MTD_ONENAND is not set
526
527#
528# LPDDR flash memory drivers
529#
530# CONFIG_MTD_LPDDR is not set
531
532#
533# UBI - Unsorted block images
534#
535# CONFIG_MTD_UBI is not set
536# CONFIG_PARPORT is not set
537CONFIG_BLK_DEV=y
538# CONFIG_BLK_DEV_COW_COMMON is not set
539CONFIG_BLK_DEV_LOOP=m
540# CONFIG_BLK_DEV_CRYPTOLOOP is not set
541# CONFIG_BLK_DEV_NBD is not set
542# CONFIG_BLK_DEV_UB is not set
543CONFIG_BLK_DEV_RAM=y
544CONFIG_BLK_DEV_RAM_COUNT=1
545CONFIG_BLK_DEV_RAM_SIZE=32768
546# CONFIG_BLK_DEV_XIP is not set
547# CONFIG_CDROM_PKTCDVD is not set
548# CONFIG_ATA_OVER_ETH is not set
549CONFIG_MISC_DEVICES=y
550# CONFIG_ICS932S401 is not set
551# CONFIG_ENCLOSURE_SERVICES is not set
552# CONFIG_ISL29003 is not set
553# CONFIG_C2PORT is not set
554
555#
556# EEPROM support
557#
558CONFIG_EEPROM_AT24=y
559# CONFIG_EEPROM_LEGACY is not set
560# CONFIG_EEPROM_93CX6 is not set
561CONFIG_HAVE_IDE=y
562CONFIG_IDE=m
563
564#
565# Please see Documentation/ide/ide.txt for help/info on IDE drives
566#
567CONFIG_IDE_XFER_MODE=y
568CONFIG_IDE_TIMINGS=y
569# CONFIG_BLK_DEV_IDE_SATA is not set
570CONFIG_IDE_GD=m
571CONFIG_IDE_GD_ATA=y
572# CONFIG_IDE_GD_ATAPI is not set
573# CONFIG_BLK_DEV_IDECD is not set
574# CONFIG_BLK_DEV_IDETAPE is not set
575# CONFIG_IDE_TASK_IOCTL is not set
576CONFIG_IDE_PROC_FS=y
577
578#
579# IDE chipset support/bugfixes
580#
581# CONFIG_BLK_DEV_PLATFORM is not set
582CONFIG_BLK_DEV_IDEDMA_SFF=y
583CONFIG_BLK_DEV_PALMCHIP_BK3710=m
584CONFIG_BLK_DEV_IDEDMA=y
585
586#
587# SCSI device support
588#
589# CONFIG_RAID_ATTRS is not set
590CONFIG_SCSI=m
591CONFIG_SCSI_DMA=y
592# CONFIG_SCSI_TGT is not set
593# CONFIG_SCSI_NETLINK is not set
594CONFIG_SCSI_PROC_FS=y
595
596#
597# SCSI support type (disk, tape, CD-ROM)
598#
599CONFIG_BLK_DEV_SD=m
600# CONFIG_CHR_DEV_ST is not set
601# CONFIG_CHR_DEV_OSST is not set
602# CONFIG_BLK_DEV_SR is not set
603# CONFIG_CHR_DEV_SG is not set
604# CONFIG_CHR_DEV_SCH is not set
605
606#
607# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
608#
609# CONFIG_SCSI_MULTI_LUN is not set
610# CONFIG_SCSI_CONSTANTS is not set
611# CONFIG_SCSI_LOGGING is not set
612# CONFIG_SCSI_SCAN_ASYNC is not set
613CONFIG_SCSI_WAIT_SCAN=m
614
615#
616# SCSI Transports
617#
618# CONFIG_SCSI_SPI_ATTRS is not set
619# CONFIG_SCSI_FC_ATTRS is not set
620# CONFIG_SCSI_ISCSI_ATTRS is not set
621# CONFIG_SCSI_SAS_LIBSAS is not set
622# CONFIG_SCSI_SRP_ATTRS is not set
623CONFIG_SCSI_LOWLEVEL=y
624# CONFIG_ISCSI_TCP is not set
625# CONFIG_LIBFC is not set
626# CONFIG_LIBFCOE is not set
627# CONFIG_SCSI_DEBUG is not set
628# CONFIG_SCSI_DH is not set
629# CONFIG_SCSI_OSD_INITIATOR is not set
630# CONFIG_ATA is not set
631# CONFIG_MD is not set
632CONFIG_NETDEVICES=y
633CONFIG_COMPAT_NET_DEV_OPS=y
634# CONFIG_DUMMY is not set
635# CONFIG_BONDING is not set
636# CONFIG_MACVLAN is not set
637# CONFIG_EQUALIZER is not set
638CONFIG_TUN=m
639# CONFIG_VETH is not set
640CONFIG_PHYLIB=y
641
642#
643# MII PHY device drivers
644#
645# CONFIG_MARVELL_PHY is not set
646# CONFIG_DAVICOM_PHY is not set
647# CONFIG_QSEMI_PHY is not set
648CONFIG_LXT_PHY=y
649# CONFIG_CICADA_PHY is not set
650# CONFIG_VITESSE_PHY is not set
651# CONFIG_SMSC_PHY is not set
652# CONFIG_BROADCOM_PHY is not set
653# CONFIG_ICPLUS_PHY is not set
654# CONFIG_REALTEK_PHY is not set
655# CONFIG_NATIONAL_PHY is not set
656# CONFIG_STE10XP is not set
657CONFIG_LSI_ET1011C_PHY=y
658# CONFIG_FIXED_PHY is not set
659# CONFIG_MDIO_BITBANG is not set
660CONFIG_NET_ETHERNET=y
661CONFIG_MII=y
662# CONFIG_AX88796 is not set
663# CONFIG_SMC91X is not set
664# CONFIG_DM9000 is not set
665# CONFIG_ETHOC is not set
666# CONFIG_SMC911X is not set
667# CONFIG_SMSC911X is not set
668# CONFIG_DNET is not set
669# CONFIG_IBM_NEW_EMAC_ZMII is not set
670# CONFIG_IBM_NEW_EMAC_RGMII is not set
671# CONFIG_IBM_NEW_EMAC_TAH is not set
672# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
673# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
674# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
675# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
676# CONFIG_B44 is not set
677# CONFIG_NETDEV_1000 is not set
678# CONFIG_NETDEV_10000 is not set
679
680#
681# Wireless LAN
682#
683# CONFIG_WLAN_PRE80211 is not set
684# CONFIG_WLAN_80211 is not set
685
686#
687# Enable WiMAX (Networking options) to see the WiMAX drivers
688#
689
690#
691# USB Network Adapters
692#
693# CONFIG_USB_CATC is not set
694# CONFIG_USB_KAWETH is not set
695# CONFIG_USB_PEGASUS is not set
696# CONFIG_USB_RTL8150 is not set
697# CONFIG_USB_USBNET is not set
698# CONFIG_WAN is not set
699CONFIG_PPP=m
700# CONFIG_PPP_MULTILINK is not set
701# CONFIG_PPP_FILTER is not set
702CONFIG_PPP_ASYNC=m
703CONFIG_PPP_SYNC_TTY=m
704CONFIG_PPP_DEFLATE=m
705# CONFIG_PPP_BSDCOMP is not set
706# CONFIG_PPP_MPPE is not set
707# CONFIG_PPPOE is not set
708# CONFIG_PPPOL2TP is not set
709# CONFIG_SLIP is not set
710CONFIG_SLHC=m
711CONFIG_NETCONSOLE=y
712# CONFIG_NETCONSOLE_DYNAMIC is not set
713CONFIG_NETPOLL=y
714CONFIG_NETPOLL_TRAP=y
715CONFIG_NET_POLL_CONTROLLER=y
716# CONFIG_ISDN is not set
717
718#
719# Input device support
720#
721CONFIG_INPUT=y
722# CONFIG_INPUT_FF_MEMLESS is not set
723# CONFIG_INPUT_POLLDEV is not set
724
725#
726# Userland interfaces
727#
728CONFIG_INPUT_MOUSEDEV=m
729CONFIG_INPUT_MOUSEDEV_PSAUX=y
730CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
731CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
732# CONFIG_INPUT_JOYDEV is not set
733CONFIG_INPUT_EVDEV=m
734CONFIG_INPUT_EVBUG=m
735
736#
737# Input Device Drivers
738#
739CONFIG_INPUT_KEYBOARD=y
740CONFIG_KEYBOARD_ATKBD=m
741# CONFIG_KEYBOARD_SUNKBD is not set
742# CONFIG_KEYBOARD_LKKBD is not set
743CONFIG_KEYBOARD_XTKBD=m
744# CONFIG_KEYBOARD_NEWTON is not set
745# CONFIG_KEYBOARD_STOWAWAY is not set
746CONFIG_KEYBOARD_GPIO=y
747# CONFIG_INPUT_MOUSE is not set
748# CONFIG_INPUT_JOYSTICK is not set
749# CONFIG_INPUT_TABLET is not set
750CONFIG_INPUT_TOUCHSCREEN=y
751# CONFIG_TOUCHSCREEN_AD7879_I2C is not set
752# CONFIG_TOUCHSCREEN_AD7879 is not set
753# CONFIG_TOUCHSCREEN_FUJITSU is not set
754# CONFIG_TOUCHSCREEN_GUNZE is not set
755# CONFIG_TOUCHSCREEN_ELO is not set
756# CONFIG_TOUCHSCREEN_WACOM_W8001 is not set
757# CONFIG_TOUCHSCREEN_MTOUCH is not set
758# CONFIG_TOUCHSCREEN_INEXIO is not set
759# CONFIG_TOUCHSCREEN_MK712 is not set
760# CONFIG_TOUCHSCREEN_PENMOUNT is not set
761# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
762# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
763# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set
764# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set
765# CONFIG_TOUCHSCREEN_TSC2007 is not set
766# CONFIG_INPUT_MISC is not set
767
768#
769# Hardware I/O ports
770#
771CONFIG_SERIO=y
772CONFIG_SERIO_SERPORT=y
773CONFIG_SERIO_LIBPS2=y
774# CONFIG_SERIO_RAW is not set
775# CONFIG_GAMEPORT is not set
776
777#
778# Character devices
779#
780CONFIG_VT=y
781CONFIG_CONSOLE_TRANSLATIONS=y
782# CONFIG_VT_CONSOLE is not set
783CONFIG_HW_CONSOLE=y
784# CONFIG_VT_HW_CONSOLE_BINDING is not set
785CONFIG_DEVKMEM=y
786# CONFIG_SERIAL_NONSTANDARD is not set
787
788#
789# Serial drivers
790#
791CONFIG_SERIAL_8250=y
792CONFIG_SERIAL_8250_CONSOLE=y
793CONFIG_SERIAL_8250_NR_UARTS=3
794CONFIG_SERIAL_8250_RUNTIME_UARTS=3
795# CONFIG_SERIAL_8250_EXTENDED is not set
796
797#
798# Non-8250 serial port support
799#
800CONFIG_SERIAL_CORE=y
801CONFIG_SERIAL_CORE_CONSOLE=y
802CONFIG_UNIX98_PTYS=y
803# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
804CONFIG_LEGACY_PTYS=y
805CONFIG_LEGACY_PTY_COUNT=256
806# CONFIG_IPMI_HANDLER is not set
807CONFIG_HW_RANDOM=m
808# CONFIG_HW_RANDOM_TIMERIOMEM is not set
809# CONFIG_R3964 is not set
810# CONFIG_RAW_DRIVER is not set
811# CONFIG_TCG_TPM is not set
812CONFIG_I2C=y
813CONFIG_I2C_BOARDINFO=y
814CONFIG_I2C_CHARDEV=y
815CONFIG_I2C_HELPER_AUTO=y
816
817#
818# I2C Hardware Bus support
819#
820
821#
822# I2C system bus drivers (mostly embedded / system-on-chip)
823#
824CONFIG_I2C_DAVINCI=y
825# CONFIG_I2C_GPIO is not set
826# CONFIG_I2C_OCORES is not set
827# CONFIG_I2C_SIMTEC is not set
828
829#
830# External I2C/SMBus adapter drivers
831#
832# CONFIG_I2C_PARPORT_LIGHT is not set
833# CONFIG_I2C_TAOS_EVM is not set
834# CONFIG_I2C_TINY_USB is not set
835
836#
837# Other I2C/SMBus bus drivers
838#
839# CONFIG_I2C_PCA_PLATFORM is not set
840# CONFIG_I2C_STUB is not set
841
842#
843# Miscellaneous I2C Chip support
844#
845# CONFIG_DS1682 is not set
846# CONFIG_SENSORS_PCA9539 is not set
847# CONFIG_SENSORS_MAX6875 is not set
848# CONFIG_SENSORS_TSL2550 is not set
849# CONFIG_I2C_DEBUG_CORE is not set
850# CONFIG_I2C_DEBUG_ALGO is not set
851# CONFIG_I2C_DEBUG_BUS is not set
852# CONFIG_I2C_DEBUG_CHIP is not set
853# CONFIG_SPI is not set
854CONFIG_ARCH_REQUIRE_GPIOLIB=y
855CONFIG_GPIOLIB=y
856# CONFIG_DEBUG_GPIO is not set
857# CONFIG_GPIO_SYSFS is not set
858
859#
860# Memory mapped GPIO expanders:
861#
862
863#
864# I2C GPIO expanders:
865#
866# CONFIG_GPIO_MAX732X is not set
867# CONFIG_GPIO_PCA953X is not set
868CONFIG_GPIO_PCF857X=m
869
870#
871# PCI GPIO expanders:
872#
873
874#
875# SPI GPIO expanders:
876#
877# CONFIG_W1 is not set
878# CONFIG_POWER_SUPPLY is not set
879CONFIG_HWMON=y
880# CONFIG_HWMON_VID is not set
881# CONFIG_SENSORS_AD7414 is not set
882# CONFIG_SENSORS_AD7418 is not set
883# CONFIG_SENSORS_ADM1021 is not set
884# CONFIG_SENSORS_ADM1025 is not set
885# CONFIG_SENSORS_ADM1026 is not set
886# CONFIG_SENSORS_ADM1029 is not set
887# CONFIG_SENSORS_ADM1031 is not set
888# CONFIG_SENSORS_ADM9240 is not set
889# CONFIG_SENSORS_ADT7462 is not set
890# CONFIG_SENSORS_ADT7470 is not set
891# CONFIG_SENSORS_ADT7473 is not set
892# CONFIG_SENSORS_ADT7475 is not set
893# CONFIG_SENSORS_ATXP1 is not set
894# CONFIG_SENSORS_DS1621 is not set
895# CONFIG_SENSORS_F71805F is not set
896# CONFIG_SENSORS_F71882FG is not set
897# CONFIG_SENSORS_F75375S is not set
898# CONFIG_SENSORS_G760A is not set
899# CONFIG_SENSORS_GL518SM is not set
900# CONFIG_SENSORS_GL520SM is not set
901# CONFIG_SENSORS_IT87 is not set
902# CONFIG_SENSORS_LM63 is not set
903# CONFIG_SENSORS_LM75 is not set
904# CONFIG_SENSORS_LM77 is not set
905# CONFIG_SENSORS_LM78 is not set
906# CONFIG_SENSORS_LM80 is not set
907# CONFIG_SENSORS_LM83 is not set
908# CONFIG_SENSORS_LM85 is not set
909# CONFIG_SENSORS_LM87 is not set
910# CONFIG_SENSORS_LM90 is not set
911# CONFIG_SENSORS_LM92 is not set
912# CONFIG_SENSORS_LM93 is not set
913# CONFIG_SENSORS_LTC4215 is not set
914# CONFIG_SENSORS_LTC4245 is not set
915# CONFIG_SENSORS_LM95241 is not set
916# CONFIG_SENSORS_MAX1619 is not set
917# CONFIG_SENSORS_MAX6650 is not set
918# CONFIG_SENSORS_PC87360 is not set
919# CONFIG_SENSORS_PC87427 is not set
920# CONFIG_SENSORS_PCF8591 is not set
921# CONFIG_SENSORS_SHT15 is not set
922# CONFIG_SENSORS_DME1737 is not set
923# CONFIG_SENSORS_SMSC47M1 is not set
924# CONFIG_SENSORS_SMSC47M192 is not set
925# CONFIG_SENSORS_SMSC47B397 is not set
926# CONFIG_SENSORS_ADS7828 is not set
927# CONFIG_SENSORS_THMC50 is not set
928# CONFIG_SENSORS_VT1211 is not set
929# CONFIG_SENSORS_W83781D is not set
930# CONFIG_SENSORS_W83791D is not set
931# CONFIG_SENSORS_W83792D is not set
932# CONFIG_SENSORS_W83793 is not set
933# CONFIG_SENSORS_W83L785TS is not set
934# CONFIG_SENSORS_W83L786NG is not set
935# CONFIG_SENSORS_W83627HF is not set
936# CONFIG_SENSORS_W83627EHF is not set
937# CONFIG_HWMON_DEBUG_CHIP is not set
938# CONFIG_THERMAL is not set
939# CONFIG_THERMAL_HWMON is not set
940CONFIG_WATCHDOG=y
941# CONFIG_WATCHDOG_NOWAYOUT is not set
942
943#
944# Watchdog Device Drivers
945#
946# CONFIG_SOFT_WATCHDOG is not set
947CONFIG_DAVINCI_WATCHDOG=m
948
949#
950# USB-based Watchdog Cards
951#
952# CONFIG_USBPCWATCHDOG is not set
953CONFIG_SSB_POSSIBLE=y
954
955#
956# Sonics Silicon Backplane
957#
958# CONFIG_SSB is not set
959
960#
961# Multifunction device drivers
962#
963# CONFIG_MFD_CORE is not set
964# CONFIG_MFD_SM501 is not set
965# CONFIG_MFD_ASIC3 is not set
966# CONFIG_HTC_EGPIO is not set
967# CONFIG_HTC_PASIC3 is not set
968# CONFIG_TPS65010 is not set
969# CONFIG_TWL4030_CORE is not set
970# CONFIG_MFD_TMIO is not set
971# CONFIG_MFD_T7L66XB is not set
972# CONFIG_MFD_TC6387XB is not set
973# CONFIG_MFD_TC6393XB is not set
974# CONFIG_PMIC_DA903X is not set
975# CONFIG_MFD_WM8400 is not set
976# CONFIG_MFD_WM8350_I2C is not set
977# CONFIG_MFD_PCF50633 is not set
978
979#
980# Multimedia devices
981#
982
983#
984# Multimedia core support
985#
986CONFIG_VIDEO_DEV=y
987CONFIG_VIDEO_V4L2_COMMON=y
988CONFIG_VIDEO_ALLOW_V4L1=y
989CONFIG_VIDEO_V4L1_COMPAT=y
990# CONFIG_DVB_CORE is not set
991CONFIG_VIDEO_MEDIA=y
992
993#
994# Multimedia drivers
995#
996# CONFIG_MEDIA_ATTACH is not set
997CONFIG_MEDIA_TUNER=y
998# CONFIG_MEDIA_TUNER_CUSTOMISE is not set
999CONFIG_MEDIA_TUNER_SIMPLE=y
1000CONFIG_MEDIA_TUNER_TDA8290=y
1001CONFIG_MEDIA_TUNER_TDA9887=y
1002CONFIG_MEDIA_TUNER_TEA5761=y
1003CONFIG_MEDIA_TUNER_TEA5767=y
1004CONFIG_MEDIA_TUNER_MT20XX=y
1005CONFIG_MEDIA_TUNER_XC2028=y
1006CONFIG_MEDIA_TUNER_XC5000=y
1007CONFIG_MEDIA_TUNER_MC44S803=y
1008CONFIG_VIDEO_V4L2=y
1009CONFIG_VIDEO_V4L1=y
1010CONFIG_VIDEO_CAPTURE_DRIVERS=y
1011# CONFIG_VIDEO_ADV_DEBUG is not set
1012# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set
1013CONFIG_VIDEO_HELPER_CHIPS_AUTO=y
1014# CONFIG_VIDEO_VIVI is not set
1015# CONFIG_VIDEO_CPIA is not set
1016# CONFIG_VIDEO_CPIA2 is not set
1017# CONFIG_VIDEO_SAA5246A is not set
1018# CONFIG_VIDEO_SAA5249 is not set
1019# CONFIG_SOC_CAMERA is not set
1020# CONFIG_V4L_USB_DRIVERS is not set
1021# CONFIG_RADIO_ADAPTERS is not set
1022CONFIG_DAB=y
1023# CONFIG_USB_DABUSB is not set
1024
1025#
1026# Graphics support
1027#
1028# CONFIG_VGASTATE is not set
1029CONFIG_VIDEO_OUTPUT_CONTROL=m
1030CONFIG_FB=y
1031CONFIG_FIRMWARE_EDID=y
1032# CONFIG_FB_DDC is not set
1033# CONFIG_FB_BOOT_VESA_SUPPORT is not set
1034# CONFIG_FB_CFB_FILLRECT is not set
1035# CONFIG_FB_CFB_COPYAREA is not set
1036# CONFIG_FB_CFB_IMAGEBLIT is not set
1037# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
1038# CONFIG_FB_SYS_FILLRECT is not set
1039# CONFIG_FB_SYS_COPYAREA is not set
1040# CONFIG_FB_SYS_IMAGEBLIT is not set
1041# CONFIG_FB_FOREIGN_ENDIAN is not set
1042# CONFIG_FB_SYS_FOPS is not set
1043# CONFIG_FB_SVGALIB is not set
1044# CONFIG_FB_MACMODES is not set
1045# CONFIG_FB_BACKLIGHT is not set
1046# CONFIG_FB_MODE_HELPERS is not set
1047# CONFIG_FB_TILEBLITTING is not set
1048
1049#
1050# Frame buffer hardware drivers
1051#
1052# CONFIG_FB_S1D13XXX is not set
1053# CONFIG_FB_VIRTUAL is not set
1054# CONFIG_FB_METRONOME is not set
1055# CONFIG_FB_MB862XX is not set
1056# CONFIG_FB_BROADSHEET is not set
1057# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
1058
1059#
1060# Display device support
1061#
1062# CONFIG_DISPLAY_SUPPORT is not set
1063
1064#
1065# Console display driver support
1066#
1067# CONFIG_VGA_CONSOLE is not set
1068CONFIG_DUMMY_CONSOLE=y
1069CONFIG_FRAMEBUFFER_CONSOLE=y
1070# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
1071# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
1072# CONFIG_FONTS is not set
1073CONFIG_FONT_8x8=y
1074CONFIG_FONT_8x16=y
1075CONFIG_LOGO=y
1076CONFIG_LOGO_LINUX_MONO=y
1077CONFIG_LOGO_LINUX_VGA16=y
1078CONFIG_LOGO_LINUX_CLUT224=y
1079CONFIG_SOUND=m
1080# CONFIG_SOUND_OSS_CORE is not set
1081CONFIG_SND=m
1082CONFIG_SND_TIMER=m
1083CONFIG_SND_PCM=m
1084CONFIG_SND_JACK=y
1085# CONFIG_SND_SEQUENCER is not set
1086# CONFIG_SND_MIXER_OSS is not set
1087# CONFIG_SND_PCM_OSS is not set
1088# CONFIG_SND_HRTIMER is not set
1089# CONFIG_SND_DYNAMIC_MINORS is not set
1090CONFIG_SND_SUPPORT_OLD_API=y
1091CONFIG_SND_VERBOSE_PROCFS=y
1092# CONFIG_SND_VERBOSE_PRINTK is not set
1093# CONFIG_SND_DEBUG is not set
1094CONFIG_SND_DRIVERS=y
1095# CONFIG_SND_DUMMY is not set
1096# CONFIG_SND_MTPAV is not set
1097# CONFIG_SND_SERIAL_U16550 is not set
1098# CONFIG_SND_MPU401 is not set
1099CONFIG_SND_ARM=y
1100CONFIG_SND_USB=y
1101# CONFIG_SND_USB_AUDIO is not set
1102# CONFIG_SND_USB_CAIAQ is not set
1103CONFIG_SND_SOC=m
1104# CONFIG_SND_DAVINCI_SOC is not set
1105CONFIG_SND_SOC_I2C_AND_SPI=m
1106# CONFIG_SND_SOC_ALL_CODECS is not set
1107# CONFIG_SOUND_PRIME is not set
1108CONFIG_HID_SUPPORT=y
1109CONFIG_HID=m
1110# CONFIG_HID_DEBUG is not set
1111# CONFIG_HIDRAW is not set
1112
1113#
1114# USB Input Devices
1115#
1116CONFIG_USB_HID=m
1117# CONFIG_HID_PID is not set
1118# CONFIG_USB_HIDDEV is not set
1119
1120#
1121# USB HID Boot Protocol drivers
1122#
1123# CONFIG_USB_KBD is not set
1124# CONFIG_USB_MOUSE is not set
1125
1126#
1127# Special HID drivers
1128#
1129CONFIG_HID_A4TECH=m
1130CONFIG_HID_APPLE=m
1131CONFIG_HID_BELKIN=m
1132CONFIG_HID_CHERRY=m
1133CONFIG_HID_CHICONY=m
1134CONFIG_HID_CYPRESS=m
1135# CONFIG_DRAGONRISE_FF is not set
1136CONFIG_HID_EZKEY=m
1137# CONFIG_HID_KYE is not set
1138CONFIG_HID_GYRATION=m
1139# CONFIG_HID_KENSINGTON is not set
1140CONFIG_HID_LOGITECH=m
1141# CONFIG_LOGITECH_FF is not set
1142# CONFIG_LOGIRUMBLEPAD2_FF is not set
1143CONFIG_HID_MICROSOFT=m
1144CONFIG_HID_MONTEREY=m
1145# CONFIG_HID_NTRIG is not set
1146CONFIG_HID_PANTHERLORD=m
1147# CONFIG_PANTHERLORD_FF is not set
1148CONFIG_HID_PETALYNX=m
1149CONFIG_HID_SAMSUNG=m
1150CONFIG_HID_SONY=m
1151CONFIG_HID_SUNPLUS=m
1152# CONFIG_GREENASIA_FF is not set
1153# CONFIG_HID_TOPSEED is not set
1154# CONFIG_THRUSTMASTER_FF is not set
1155# CONFIG_ZEROPLUS_FF is not set
1156CONFIG_USB_SUPPORT=y
1157CONFIG_USB_ARCH_HAS_HCD=y
1158# CONFIG_USB_ARCH_HAS_OHCI is not set
1159# CONFIG_USB_ARCH_HAS_EHCI is not set
1160CONFIG_USB=m
1161# CONFIG_USB_DEBUG is not set
1162# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
1163
1164#
1165# Miscellaneous USB options
1166#
1167CONFIG_USB_DEVICEFS=y
1168CONFIG_USB_DEVICE_CLASS=y
1169# CONFIG_USB_DYNAMIC_MINORS is not set
1170# CONFIG_USB_OTG is not set
1171# CONFIG_USB_OTG_WHITELIST is not set
1172# CONFIG_USB_OTG_BLACKLIST_HUB is not set
1173CONFIG_USB_MON=m
1174# CONFIG_USB_WUSB is not set
1175# CONFIG_USB_WUSB_CBAF is not set
1176
1177#
1178# USB Host Controller Drivers
1179#
1180# CONFIG_USB_C67X00_HCD is not set
1181# CONFIG_USB_OXU210HP_HCD is not set
1182# CONFIG_USB_ISP116X_HCD is not set
1183# CONFIG_USB_ISP1760_HCD is not set
1184# CONFIG_USB_SL811_HCD is not set
1185# CONFIG_USB_R8A66597_HCD is not set
1186# CONFIG_USB_HWA_HCD is not set
1187CONFIG_USB_MUSB_HDRC=m
1188CONFIG_USB_MUSB_SOC=y
1189
1190#
1191# DaVinci 35x and 644x USB support
1192#
1193# CONFIG_USB_MUSB_HOST is not set
1194CONFIG_USB_MUSB_PERIPHERAL=y
1195# CONFIG_USB_MUSB_OTG is not set
1196CONFIG_USB_GADGET_MUSB_HDRC=y
1197CONFIG_MUSB_PIO_ONLY=y
1198# CONFIG_USB_MUSB_DEBUG is not set
1199
1200#
1201# USB Device Class drivers
1202#
1203# CONFIG_USB_ACM is not set
1204# CONFIG_USB_PRINTER is not set
1205# CONFIG_USB_WDM is not set
1206# CONFIG_USB_TMC is not set
1207
1208#
1209# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
1210#
1211
1212#
1213# also be needed; see USB_STORAGE Help for more info
1214#
1215CONFIG_USB_STORAGE=m
1216# CONFIG_USB_STORAGE_DEBUG is not set
1217# CONFIG_USB_STORAGE_DATAFAB is not set
1218# CONFIG_USB_STORAGE_FREECOM is not set
1219# CONFIG_USB_STORAGE_ISD200 is not set
1220# CONFIG_USB_STORAGE_USBAT is not set
1221# CONFIG_USB_STORAGE_SDDR09 is not set
1222# CONFIG_USB_STORAGE_SDDR55 is not set
1223# CONFIG_USB_STORAGE_JUMPSHOT is not set
1224# CONFIG_USB_STORAGE_ALAUDA is not set
1225# CONFIG_USB_STORAGE_ONETOUCH is not set
1226# CONFIG_USB_STORAGE_KARMA is not set
1227# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
1228# CONFIG_USB_LIBUSUAL is not set
1229
1230#
1231# USB Imaging devices
1232#
1233# CONFIG_USB_MDC800 is not set
1234# CONFIG_USB_MICROTEK is not set
1235
1236#
1237# USB port drivers
1238#
1239# CONFIG_USB_SERIAL is not set
1240
1241#
1242# USB Miscellaneous drivers
1243#
1244# CONFIG_USB_EMI62 is not set
1245# CONFIG_USB_EMI26 is not set
1246# CONFIG_USB_ADUTUX is not set
1247# CONFIG_USB_SEVSEG is not set
1248# CONFIG_USB_RIO500 is not set
1249# CONFIG_USB_LEGOTOWER is not set
1250# CONFIG_USB_LCD is not set
1251# CONFIG_USB_BERRY_CHARGE is not set
1252# CONFIG_USB_LED is not set
1253# CONFIG_USB_CYPRESS_CY7C63 is not set
1254# CONFIG_USB_CYTHERM is not set
1255# CONFIG_USB_IDMOUSE is not set
1256# CONFIG_USB_FTDI_ELAN is not set
1257# CONFIG_USB_APPLEDISPLAY is not set
1258# CONFIG_USB_LD is not set
1259# CONFIG_USB_TRANCEVIBRATOR is not set
1260# CONFIG_USB_IOWARRIOR is not set
1261CONFIG_USB_TEST=m
1262# CONFIG_USB_ISIGHTFW is not set
1263# CONFIG_USB_VST is not set
1264CONFIG_USB_GADGET=m
1265# CONFIG_USB_GADGET_DEBUG is not set
1266CONFIG_USB_GADGET_DEBUG_FILES=y
1267CONFIG_USB_GADGET_DEBUG_FS=y
1268CONFIG_USB_GADGET_VBUS_DRAW=2
1269CONFIG_USB_GADGET_SELECTED=y
1270# CONFIG_USB_GADGET_AT91 is not set
1271# CONFIG_USB_GADGET_ATMEL_USBA is not set
1272# CONFIG_USB_GADGET_FSL_USB2 is not set
1273# CONFIG_USB_GADGET_LH7A40X is not set
1274# CONFIG_USB_GADGET_OMAP is not set
1275# CONFIG_USB_GADGET_PXA25X is not set
1276# CONFIG_USB_GADGET_PXA27X is not set
1277# CONFIG_USB_GADGET_S3C2410 is not set
1278# CONFIG_USB_GADGET_IMX is not set
1279# CONFIG_USB_GADGET_M66592 is not set
1280# CONFIG_USB_GADGET_AMD5536UDC is not set
1281# CONFIG_USB_GADGET_FSL_QE is not set
1282# CONFIG_USB_GADGET_CI13XXX is not set
1283# CONFIG_USB_GADGET_NET2280 is not set
1284# CONFIG_USB_GADGET_GOKU is not set
1285# CONFIG_USB_GADGET_DUMMY_HCD is not set
1286CONFIG_USB_GADGET_DUALSPEED=y
1287CONFIG_USB_ZERO=m
1288CONFIG_USB_ETH=m
1289CONFIG_USB_ETH_RNDIS=y
1290CONFIG_USB_GADGETFS=m
1291CONFIG_USB_FILE_STORAGE=m
1292# CONFIG_USB_FILE_STORAGE_TEST is not set
1293CONFIG_USB_G_SERIAL=m
1294# CONFIG_USB_MIDI_GADGET is not set
1295CONFIG_USB_G_PRINTER=m
1296CONFIG_USB_CDC_COMPOSITE=m
1297
1298#
1299# OTG and related infrastructure
1300#
1301CONFIG_USB_OTG_UTILS=y
1302# CONFIG_USB_GPIO_VBUS is not set
1303# CONFIG_NOP_USB_XCEIV is not set
1304CONFIG_MMC=m
1305# CONFIG_MMC_DEBUG is not set
1306# CONFIG_MMC_UNSAFE_RESUME is not set
1307
1308#
1309# MMC/SD/SDIO Card Drivers
1310#
1311CONFIG_MMC_BLOCK=m
1312# CONFIG_MMC_BLOCK_BOUNCE is not set
1313# CONFIG_SDIO_UART is not set
1314# CONFIG_MMC_TEST is not set
1315
1316#
1317# MMC/SD/SDIO Host Controller Drivers
1318#
1319# CONFIG_MMC_SDHCI is not set
1320# CONFIG_MEMSTICK is not set
1321# CONFIG_ACCESSIBILITY is not set
1322CONFIG_NEW_LEDS=y
1323CONFIG_LEDS_CLASS=m
1324
1325#
1326# LED drivers
1327#
1328# CONFIG_LEDS_PCA9532 is not set
1329CONFIG_LEDS_GPIO=m
1330CONFIG_LEDS_GPIO_PLATFORM=y
1331# CONFIG_LEDS_LP5521 is not set
1332# CONFIG_LEDS_PCA955X is not set
1333# CONFIG_LEDS_BD2802 is not set
1334
1335#
1336# LED Triggers
1337#
1338CONFIG_LEDS_TRIGGERS=y
1339CONFIG_LEDS_TRIGGER_TIMER=m
1340# CONFIG_LEDS_TRIGGER_IDE_DISK is not set
1341CONFIG_LEDS_TRIGGER_HEARTBEAT=m
1342# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set
1343# CONFIG_LEDS_TRIGGER_GPIO is not set
1344# CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set
1345
1346#
1347# iptables trigger is under Netfilter config (LED target)
1348#
1349CONFIG_RTC_LIB=y
1350CONFIG_RTC_CLASS=m
1351
1352#
1353# RTC interfaces
1354#
1355CONFIG_RTC_INTF_SYSFS=y
1356CONFIG_RTC_INTF_PROC=y
1357CONFIG_RTC_INTF_DEV=y
1358# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
1359# CONFIG_RTC_DRV_TEST is not set
1360
1361#
1362# I2C RTC drivers
1363#
1364# CONFIG_RTC_DRV_DS1307 is not set
1365# CONFIG_RTC_DRV_DS1374 is not set
1366# CONFIG_RTC_DRV_DS1672 is not set
1367# CONFIG_RTC_DRV_MAX6900 is not set
1368# CONFIG_RTC_DRV_RS5C372 is not set
1369# CONFIG_RTC_DRV_ISL1208 is not set
1370# CONFIG_RTC_DRV_X1205 is not set
1371# CONFIG_RTC_DRV_PCF8563 is not set
1372# CONFIG_RTC_DRV_PCF8583 is not set
1373# CONFIG_RTC_DRV_M41T80 is not set
1374# CONFIG_RTC_DRV_S35390A is not set
1375# CONFIG_RTC_DRV_FM3130 is not set
1376# CONFIG_RTC_DRV_RX8581 is not set
1377
1378#
1379# SPI RTC drivers
1380#
1381
1382#
1383# Platform RTC drivers
1384#
1385# CONFIG_RTC_DRV_CMOS is not set
1386# CONFIG_RTC_DRV_DS1286 is not set
1387# CONFIG_RTC_DRV_DS1511 is not set
1388# CONFIG_RTC_DRV_DS1553 is not set
1389# CONFIG_RTC_DRV_DS1742 is not set
1390# CONFIG_RTC_DRV_STK17TA8 is not set
1391# CONFIG_RTC_DRV_M48T86 is not set
1392# CONFIG_RTC_DRV_M48T35 is not set
1393# CONFIG_RTC_DRV_M48T59 is not set
1394# CONFIG_RTC_DRV_BQ4802 is not set
1395# CONFIG_RTC_DRV_V3020 is not set
1396
1397#
1398# on-CPU RTC drivers
1399#
1400# CONFIG_DMADEVICES is not set
1401# CONFIG_AUXDISPLAY is not set
1402# CONFIG_REGULATOR is not set
1403# CONFIG_UIO is not set
1404# CONFIG_STAGING is not set
1405
1406#
1407# File systems
1408#
1409CONFIG_EXT2_FS=y
1410# CONFIG_EXT2_FS_XATTR is not set
1411# CONFIG_EXT2_FS_XIP is not set
1412CONFIG_EXT3_FS=y
1413# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
1414CONFIG_EXT3_FS_XATTR=y
1415# CONFIG_EXT3_FS_POSIX_ACL is not set
1416# CONFIG_EXT3_FS_SECURITY is not set
1417# CONFIG_EXT4_FS is not set
1418CONFIG_JBD=y
1419# CONFIG_JBD_DEBUG is not set
1420CONFIG_FS_MBCACHE=y
1421# CONFIG_REISERFS_FS is not set
1422# CONFIG_JFS_FS is not set
1423# CONFIG_FS_POSIX_ACL is not set
1424CONFIG_FILE_LOCKING=y
1425CONFIG_XFS_FS=m
1426# CONFIG_XFS_QUOTA is not set
1427# CONFIG_XFS_POSIX_ACL is not set
1428# CONFIG_XFS_RT is not set
1429# CONFIG_XFS_DEBUG is not set
1430# CONFIG_OCFS2_FS is not set
1431# CONFIG_BTRFS_FS is not set
1432CONFIG_DNOTIFY=y
1433CONFIG_INOTIFY=y
1434CONFIG_INOTIFY_USER=y
1435# CONFIG_QUOTA is not set
1436# CONFIG_AUTOFS_FS is not set
1437CONFIG_AUTOFS4_FS=m
1438# CONFIG_FUSE_FS is not set
1439
1440#
1441# Caches
1442#
1443# CONFIG_FSCACHE is not set
1444
1445#
1446# CD-ROM/DVD Filesystems
1447#
1448# CONFIG_ISO9660_FS is not set
1449# CONFIG_UDF_FS is not set
1450
1451#
1452# DOS/FAT/NT Filesystems
1453#
1454CONFIG_FAT_FS=y
1455CONFIG_MSDOS_FS=y
1456CONFIG_VFAT_FS=y
1457CONFIG_FAT_DEFAULT_CODEPAGE=437
1458CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1459# CONFIG_NTFS_FS is not set
1460
1461#
1462# Pseudo filesystems
1463#
1464CONFIG_PROC_FS=y
1465CONFIG_PROC_SYSCTL=y
1466CONFIG_PROC_PAGE_MONITOR=y
1467CONFIG_SYSFS=y
1468CONFIG_TMPFS=y
1469# CONFIG_TMPFS_POSIX_ACL is not set
1470# CONFIG_HUGETLB_PAGE is not set
1471# CONFIG_CONFIGFS_FS is not set
1472CONFIG_MISC_FILESYSTEMS=y
1473# CONFIG_ADFS_FS is not set
1474# CONFIG_AFFS_FS is not set
1475# CONFIG_HFS_FS is not set
1476# CONFIG_HFSPLUS_FS is not set
1477# CONFIG_BEFS_FS is not set
1478# CONFIG_BFS_FS is not set
1479# CONFIG_EFS_FS is not set
1480CONFIG_JFFS2_FS=m
1481CONFIG_JFFS2_FS_DEBUG=0
1482CONFIG_JFFS2_FS_WRITEBUFFER=y
1483# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
1484# CONFIG_JFFS2_SUMMARY is not set
1485# CONFIG_JFFS2_FS_XATTR is not set
1486# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
1487CONFIG_JFFS2_ZLIB=y
1488# CONFIG_JFFS2_LZO is not set
1489CONFIG_JFFS2_RTIME=y
1490# CONFIG_JFFS2_RUBIN is not set
1491CONFIG_CRAMFS=y
1492# CONFIG_SQUASHFS is not set
1493# CONFIG_VXFS_FS is not set
1494CONFIG_MINIX_FS=m
1495# CONFIG_OMFS_FS is not set
1496# CONFIG_HPFS_FS is not set
1497# CONFIG_QNX4FS_FS is not set
1498# CONFIG_ROMFS_FS is not set
1499# CONFIG_SYSV_FS is not set
1500# CONFIG_UFS_FS is not set
1501# CONFIG_NILFS2_FS is not set
1502CONFIG_NETWORK_FILESYSTEMS=y
1503CONFIG_NFS_FS=y
1504CONFIG_NFS_V3=y
1505# CONFIG_NFS_V3_ACL is not set
1506# CONFIG_NFS_V4 is not set
1507CONFIG_ROOT_NFS=y
1508CONFIG_NFSD=m
1509CONFIG_NFSD_V3=y
1510# CONFIG_NFSD_V3_ACL is not set
1511# CONFIG_NFSD_V4 is not set
1512CONFIG_LOCKD=y
1513CONFIG_LOCKD_V4=y
1514CONFIG_EXPORTFS=m
1515CONFIG_NFS_COMMON=y
1516CONFIG_SUNRPC=y
1517# CONFIG_RPCSEC_GSS_KRB5 is not set
1518# CONFIG_RPCSEC_GSS_SPKM3 is not set
1519CONFIG_SMB_FS=m
1520# CONFIG_SMB_NLS_DEFAULT is not set
1521# CONFIG_CIFS is not set
1522# CONFIG_NCP_FS is not set
1523# CONFIG_CODA_FS is not set
1524# CONFIG_AFS_FS is not set
1525
1526#
1527# Partition Types
1528#
1529CONFIG_PARTITION_ADVANCED=y
1530# CONFIG_ACORN_PARTITION is not set
1531# CONFIG_OSF_PARTITION is not set
1532# CONFIG_AMIGA_PARTITION is not set
1533# CONFIG_ATARI_PARTITION is not set
1534# CONFIG_MAC_PARTITION is not set
1535CONFIG_MSDOS_PARTITION=y
1536# CONFIG_BSD_DISKLABEL is not set
1537# CONFIG_MINIX_SUBPARTITION is not set
1538# CONFIG_SOLARIS_X86_PARTITION is not set
1539# CONFIG_UNIXWARE_DISKLABEL is not set
1540# CONFIG_LDM_PARTITION is not set
1541# CONFIG_SGI_PARTITION is not set
1542# CONFIG_ULTRIX_PARTITION is not set
1543# CONFIG_SUN_PARTITION is not set
1544# CONFIG_KARMA_PARTITION is not set
1545# CONFIG_EFI_PARTITION is not set
1546# CONFIG_SYSV68_PARTITION is not set
1547CONFIG_NLS=y
1548CONFIG_NLS_DEFAULT="iso8859-1"
1549CONFIG_NLS_CODEPAGE_437=y
1550# CONFIG_NLS_CODEPAGE_737 is not set
1551# CONFIG_NLS_CODEPAGE_775 is not set
1552# CONFIG_NLS_CODEPAGE_850 is not set
1553# CONFIG_NLS_CODEPAGE_852 is not set
1554# CONFIG_NLS_CODEPAGE_855 is not set
1555# CONFIG_NLS_CODEPAGE_857 is not set
1556# CONFIG_NLS_CODEPAGE_860 is not set
1557# CONFIG_NLS_CODEPAGE_861 is not set
1558# CONFIG_NLS_CODEPAGE_862 is not set
1559# CONFIG_NLS_CODEPAGE_863 is not set
1560# CONFIG_NLS_CODEPAGE_864 is not set
1561# CONFIG_NLS_CODEPAGE_865 is not set
1562# CONFIG_NLS_CODEPAGE_866 is not set
1563# CONFIG_NLS_CODEPAGE_869 is not set
1564# CONFIG_NLS_CODEPAGE_936 is not set
1565# CONFIG_NLS_CODEPAGE_950 is not set
1566# CONFIG_NLS_CODEPAGE_932 is not set
1567# CONFIG_NLS_CODEPAGE_949 is not set
1568# CONFIG_NLS_CODEPAGE_874 is not set
1569# CONFIG_NLS_ISO8859_8 is not set
1570# CONFIG_NLS_CODEPAGE_1250 is not set
1571# CONFIG_NLS_CODEPAGE_1251 is not set
1572CONFIG_NLS_ASCII=m
1573CONFIG_NLS_ISO8859_1=y
1574# CONFIG_NLS_ISO8859_2 is not set
1575# CONFIG_NLS_ISO8859_3 is not set
1576# CONFIG_NLS_ISO8859_4 is not set
1577# CONFIG_NLS_ISO8859_5 is not set
1578# CONFIG_NLS_ISO8859_6 is not set
1579# CONFIG_NLS_ISO8859_7 is not set
1580# CONFIG_NLS_ISO8859_9 is not set
1581# CONFIG_NLS_ISO8859_13 is not set
1582# CONFIG_NLS_ISO8859_14 is not set
1583# CONFIG_NLS_ISO8859_15 is not set
1584# CONFIG_NLS_KOI8_R is not set
1585# CONFIG_NLS_KOI8_U is not set
1586CONFIG_NLS_UTF8=m
1587# CONFIG_DLM is not set
1588
1589#
1590# Kernel hacking
1591#
1592# CONFIG_PRINTK_TIME is not set
1593CONFIG_ENABLE_WARN_DEPRECATED=y
1594CONFIG_ENABLE_MUST_CHECK=y
1595CONFIG_FRAME_WARN=1024
1596# CONFIG_MAGIC_SYSRQ is not set
1597# CONFIG_UNUSED_SYMBOLS is not set
1598CONFIG_DEBUG_FS=y
1599# CONFIG_HEADERS_CHECK is not set
1600CONFIG_DEBUG_KERNEL=y
1601# CONFIG_DEBUG_SHIRQ is not set
1602CONFIG_DETECT_SOFTLOCKUP=y
1603# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
1604CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
1605CONFIG_DETECT_HUNG_TASK=y
1606# CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set
1607CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0
1608CONFIG_SCHED_DEBUG=y
1609# CONFIG_SCHEDSTATS is not set
1610CONFIG_TIMER_STATS=y
1611# CONFIG_DEBUG_OBJECTS is not set
1612# CONFIG_SLUB_DEBUG_ON is not set
1613# CONFIG_SLUB_STATS is not set
1614CONFIG_DEBUG_PREEMPT=y
1615CONFIG_DEBUG_RT_MUTEXES=y
1616CONFIG_DEBUG_PI_LIST=y
1617# CONFIG_RT_MUTEX_TESTER is not set
1618# CONFIG_DEBUG_SPINLOCK is not set
1619CONFIG_DEBUG_MUTEXES=y
1620# CONFIG_DEBUG_LOCK_ALLOC is not set
1621# CONFIG_PROVE_LOCKING is not set
1622# CONFIG_LOCK_STAT is not set
1623# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1624# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1625# CONFIG_DEBUG_KOBJECT is not set
1626CONFIG_DEBUG_BUGVERBOSE=y
1627# CONFIG_DEBUG_INFO is not set
1628# CONFIG_DEBUG_VM is not set
1629# CONFIG_DEBUG_WRITECOUNT is not set
1630# CONFIG_DEBUG_MEMORY_INIT is not set
1631# CONFIG_DEBUG_LIST is not set
1632# CONFIG_DEBUG_SG is not set
1633# CONFIG_DEBUG_NOTIFIERS is not set
1634# CONFIG_BOOT_PRINTK_DELAY is not set
1635# CONFIG_RCU_TORTURE_TEST is not set
1636# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1637# CONFIG_BACKTRACE_SELF_TEST is not set
1638# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
1639# CONFIG_FAULT_INJECTION is not set
1640# CONFIG_LATENCYTOP is not set
1641# CONFIG_SYSCTL_SYSCALL_CHECK is not set
1642# CONFIG_PAGE_POISONING is not set
1643CONFIG_HAVE_FUNCTION_TRACER=y
1644CONFIG_TRACING_SUPPORT=y
1645
1646#
1647# Tracers
1648#
1649# CONFIG_FUNCTION_TRACER is not set
1650# CONFIG_IRQSOFF_TRACER is not set
1651# CONFIG_PREEMPT_TRACER is not set
1652# CONFIG_SCHED_TRACER is not set
1653# CONFIG_CONTEXT_SWITCH_TRACER is not set
1654# CONFIG_EVENT_TRACER is not set
1655# CONFIG_BOOT_TRACER is not set
1656# CONFIG_TRACE_BRANCH_PROFILING is not set
1657# CONFIG_STACK_TRACER is not set
1658# CONFIG_KMEMTRACE is not set
1659# CONFIG_WORKQUEUE_TRACER is not set
1660# CONFIG_BLK_DEV_IO_TRACE is not set
1661# CONFIG_DYNAMIC_DEBUG is not set
1662# CONFIG_SAMPLES is not set
1663CONFIG_HAVE_ARCH_KGDB=y
1664# CONFIG_KGDB is not set
1665CONFIG_ARM_UNWIND=y
1666CONFIG_DEBUG_USER=y
1667CONFIG_DEBUG_ERRORS=y
1668# CONFIG_DEBUG_STACK_USAGE is not set
1669# CONFIG_DEBUG_LL is not set
1670
1671#
1672# Security options
1673#
1674# CONFIG_KEYS is not set
1675# CONFIG_SECURITY is not set
1676# CONFIG_SECURITYFS is not set
1677# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1678CONFIG_CRYPTO=y
1679
1680#
1681# Crypto core or helper
1682#
1683# CONFIG_CRYPTO_FIPS is not set
1684# CONFIG_CRYPTO_MANAGER is not set
1685# CONFIG_CRYPTO_MANAGER2 is not set
1686# CONFIG_CRYPTO_GF128MUL is not set
1687# CONFIG_CRYPTO_NULL is not set
1688# CONFIG_CRYPTO_CRYPTD is not set
1689# CONFIG_CRYPTO_AUTHENC is not set
1690# CONFIG_CRYPTO_TEST is not set
1691
1692#
1693# Authenticated Encryption with Associated Data
1694#
1695# CONFIG_CRYPTO_CCM is not set
1696# CONFIG_CRYPTO_GCM is not set
1697# CONFIG_CRYPTO_SEQIV is not set
1698
1699#
1700# Block modes
1701#
1702# CONFIG_CRYPTO_CBC is not set
1703# CONFIG_CRYPTO_CTR is not set
1704# CONFIG_CRYPTO_CTS is not set
1705# CONFIG_CRYPTO_ECB is not set
1706# CONFIG_CRYPTO_LRW is not set
1707# CONFIG_CRYPTO_PCBC is not set
1708# CONFIG_CRYPTO_XTS is not set
1709
1710#
1711# Hash modes
1712#
1713# CONFIG_CRYPTO_HMAC is not set
1714# CONFIG_CRYPTO_XCBC is not set
1715
1716#
1717# Digest
1718#
1719# CONFIG_CRYPTO_CRC32C is not set
1720# CONFIG_CRYPTO_MD4 is not set
1721# CONFIG_CRYPTO_MD5 is not set
1722# CONFIG_CRYPTO_MICHAEL_MIC is not set
1723# CONFIG_CRYPTO_RMD128 is not set
1724# CONFIG_CRYPTO_RMD160 is not set
1725# CONFIG_CRYPTO_RMD256 is not set
1726# CONFIG_CRYPTO_RMD320 is not set
1727# CONFIG_CRYPTO_SHA1 is not set
1728# CONFIG_CRYPTO_SHA256 is not set
1729# CONFIG_CRYPTO_SHA512 is not set
1730# CONFIG_CRYPTO_TGR192 is not set
1731# CONFIG_CRYPTO_WP512 is not set
1732
1733#
1734# Ciphers
1735#
1736# CONFIG_CRYPTO_AES is not set
1737# CONFIG_CRYPTO_ANUBIS is not set
1738# CONFIG_CRYPTO_ARC4 is not set
1739# CONFIG_CRYPTO_BLOWFISH is not set
1740# CONFIG_CRYPTO_CAMELLIA is not set
1741# CONFIG_CRYPTO_CAST5 is not set
1742# CONFIG_CRYPTO_CAST6 is not set
1743# CONFIG_CRYPTO_DES is not set
1744# CONFIG_CRYPTO_FCRYPT is not set
1745# CONFIG_CRYPTO_KHAZAD is not set
1746# CONFIG_CRYPTO_SALSA20 is not set
1747# CONFIG_CRYPTO_SEED is not set
1748# CONFIG_CRYPTO_SERPENT is not set
1749# CONFIG_CRYPTO_TEA is not set
1750# CONFIG_CRYPTO_TWOFISH is not set
1751
1752#
1753# Compression
1754#
1755# CONFIG_CRYPTO_DEFLATE is not set
1756# CONFIG_CRYPTO_ZLIB is not set
1757# CONFIG_CRYPTO_LZO is not set
1758
1759#
1760# Random Number Generation
1761#
1762# CONFIG_CRYPTO_ANSI_CPRNG is not set
1763# CONFIG_CRYPTO_HW is not set
1764# CONFIG_BINARY_PRINTF is not set
1765
1766#
1767# Library routines
1768#
1769CONFIG_BITREVERSE=y
1770CONFIG_GENERIC_FIND_LAST_BIT=y
1771CONFIG_CRC_CCITT=m
1772# CONFIG_CRC16 is not set
1773CONFIG_CRC_T10DIF=m
1774# CONFIG_CRC_ITU_T is not set
1775CONFIG_CRC32=y
1776# CONFIG_CRC7 is not set
1777# CONFIG_LIBCRC32C is not set
1778CONFIG_ZLIB_INFLATE=y
1779CONFIG_ZLIB_DEFLATE=m
1780CONFIG_DECOMPRESS_GZIP=y
1781CONFIG_HAS_IOMEM=y
1782CONFIG_HAS_IOPORT=y
1783CONFIG_HAS_DMA=y
1784CONFIG_NLATTR=y
diff --git a/arch/arm/configs/viper_defconfig b/arch/arm/configs/viper_defconfig
index 30f463d2fa8..6ab5dd5868d 100644
--- a/arch/arm/configs/viper_defconfig
+++ b/arch/arm/configs/viper_defconfig
@@ -298,7 +298,6 @@ CONFIG_CPU_FREQ_GOV_POWERSAVE=m
298CONFIG_CPU_FREQ_GOV_USERSPACE=m 298CONFIG_CPU_FREQ_GOV_USERSPACE=m
299CONFIG_CPU_FREQ_GOV_ONDEMAND=m 299CONFIG_CPU_FREQ_GOV_ONDEMAND=m
300CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m 300CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m
301CONFIG_CPU_FREQ_PXA=y
302 301
303# 302#
304# Floating point emulation 303# Floating point emulation
diff --git a/arch/arm/mach-davinci/Kconfig b/arch/arm/mach-davinci/Kconfig
index bac988e7a4c..a9c78bc72b8 100644
--- a/arch/arm/mach-davinci/Kconfig
+++ b/arch/arm/mach-davinci/Kconfig
@@ -4,19 +4,56 @@ menu "TI DaVinci Implementations"
4 4
5comment "DaVinci Core Type" 5comment "DaVinci Core Type"
6 6
7config ARCH_DAVINCI644x 7config ARCH_DAVINCI_DM644x
8 default y
9 bool "DaVinci 644x based system" 8 bool "DaVinci 644x based system"
10 9
11comment "DaVinci Board Type" 10comment "DaVinci Board Type"
12 11
13config MACH_DAVINCI_EVM 12config MACH_DAVINCI_EVM
14 bool "TI DaVinci EVM" 13 bool "TI DM644x EVM"
15 default y 14 default y
16 depends on ARCH_DAVINCI644x 15 depends on ARCH_DAVINCI_DM644x
17 help 16 help
18 Configure this option to specify the whether the board used 17 Configure this option to specify the whether the board used
19 for development is a DaVinci EVM 18 for development is a DM644x EVM
19
20
21config DAVINCI_MUX
22 bool "DAVINCI multiplexing support"
23 depends on ARCH_DAVINCI
24 default y
25 help
26 Pin multiplexing support for DAVINCI boards. If your bootloader
27 sets the multiplexing correctly, say N. Otherwise, or if unsure,
28 say Y.
29
30config DAVINCI_MUX_DEBUG
31 bool "Multiplexing debug output"
32 depends on DAVINCI_MUX
33 help
34 Makes the multiplexing functions print out a lot of debug info.
35 This is useful if you want to find out the correct values of the
36 multiplexing registers.
37
38config DAVINCI_MUX_WARNINGS
39 bool "Warn about pins the bootloader didn't set up"
40 depends on DAVINCI_MUX
41 help
42 Choose Y here to warn whenever driver initialization logic needs
43 to change the pin multiplexing setup. When there are no warnings
44 printed, it's safe to deselect DAVINCI_MUX for your product.
45
46config DAVINCI_RESET_CLOCKS
47 bool "Reset unused clocks during boot"
48 depends on ARCH_DAVINCI
49 help
50 Say Y if you want to reset unused clocks during boot.
51 This option saves power, but assumes all drivers are
52 using the clock framework. Broken drivers that do not
53 yet use clock framework may not work with this option.
54 If you are booting from another operating system, you
55 probably do not want this option enabled until your
56 device drivers work properly.
20 57
21endmenu 58endmenu
22 59
diff --git a/arch/arm/mach-davinci/Makefile b/arch/arm/mach-davinci/Makefile
index 4dc458597f4..1674661942f 100644
--- a/arch/arm/mach-davinci/Makefile
+++ b/arch/arm/mach-davinci/Makefile
@@ -5,7 +5,12 @@
5 5
6# Common objects 6# Common objects
7obj-y := time.o irq.o clock.o serial.o io.o id.o psc.o \ 7obj-y := time.o irq.o clock.o serial.o io.o id.o psc.o \
8 gpio.o mux.o devices.o usb.o 8 gpio.o devices.o dma.o usb.o
9
10obj-$(CONFIG_DAVINCI_MUX) += mux.o
11
12# Chip specific
13obj-$(CONFIG_ARCH_DAVINCI_DM644x) += dm644x.o
9 14
10# Board specific 15# Board specific
11obj-$(CONFIG_MACH_DAVINCI_EVM) += board-evm.o 16obj-$(CONFIG_MACH_DAVINCI_EVM) += board-dm644x-evm.o
diff --git a/arch/arm/mach-davinci/board-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c
index 0b97a528902..c039674fe99 100644
--- a/arch/arm/mach-davinci/board-evm.c
+++ b/arch/arm/mach-davinci/board-dm644x-evm.c
@@ -15,15 +15,20 @@
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/gpio.h> 16#include <linux/gpio.h>
17#include <linux/leds.h> 17#include <linux/leds.h>
18#include <linux/memory.h>
19#include <linux/etherdevice.h>
18 20
19#include <linux/i2c.h> 21#include <linux/i2c.h>
20#include <linux/i2c/pcf857x.h> 22#include <linux/i2c/pcf857x.h>
21#include <linux/i2c/at24.h> 23#include <linux/i2c/at24.h>
22 24
23#include <linux/mtd/mtd.h> 25#include <linux/mtd/mtd.h>
26#include <linux/mtd/nand.h>
24#include <linux/mtd/partitions.h> 27#include <linux/mtd/partitions.h>
25#include <linux/mtd/physmap.h> 28#include <linux/mtd/physmap.h>
26#include <linux/io.h> 29#include <linux/io.h>
30#include <linux/phy.h>
31#include <linux/clk.h>
27 32
28#include <asm/setup.h> 33#include <asm/setup.h>
29#include <asm/mach-types.h> 34#include <asm/mach-types.h>
@@ -32,25 +37,34 @@
32#include <asm/mach/map.h> 37#include <asm/mach/map.h>
33#include <asm/mach/flash.h> 38#include <asm/mach/flash.h>
34 39
35#include <mach/hardware.h> 40#include <mach/dm644x.h>
36#include <mach/common.h> 41#include <mach/common.h>
37#include <mach/i2c.h> 42#include <mach/i2c.h>
43#include <mach/serial.h>
44#include <mach/mux.h>
45#include <mach/psc.h>
46#include <mach/nand.h>
38 47
39/* other misc. init functions */ 48#define DM644X_EVM_PHY_MASK (0x2)
40void __init davinci_psc_init(void); 49#define DM644X_EVM_MDIO_FREQUENCY (2200000) /* PHY bus frequency */
41void __init davinci_irq_init(void);
42void __init davinci_map_common_io(void);
43void __init davinci_init_common_hw(void);
44 50
45#if defined(CONFIG_MTD_PHYSMAP) || \ 51#define DAVINCI_CFC_ATA_BASE 0x01C66000
46 defined(CONFIG_MTD_PHYSMAP_MODULE) 52
53#define DAVINCI_ASYNC_EMIF_CONTROL_BASE 0x01e00000
54#define DAVINCI_ASYNC_EMIF_DATA_CE0_BASE 0x02000000
55#define DAVINCI_ASYNC_EMIF_DATA_CE1_BASE 0x04000000
56#define DAVINCI_ASYNC_EMIF_DATA_CE2_BASE 0x06000000
57#define DAVINCI_ASYNC_EMIF_DATA_CE3_BASE 0x08000000
58
59#define LXT971_PHY_ID (0x001378e2)
60#define LXT971_PHY_MASK (0xfffffff0)
47 61
48static struct mtd_partition davinci_evm_norflash_partitions[] = { 62static struct mtd_partition davinci_evm_norflash_partitions[] = {
49 /* bootloader (U-Boot, etc) in first 4 sectors */ 63 /* bootloader (UBL, U-Boot, etc) in first 5 sectors */
50 { 64 {
51 .name = "bootloader", 65 .name = "bootloader",
52 .offset = 0, 66 .offset = 0,
53 .size = 4 * SZ_64K, 67 .size = 5 * SZ_64K,
54 .mask_flags = MTD_WRITEABLE, /* force read-only */ 68 .mask_flags = MTD_WRITEABLE, /* force read-only */
55 }, 69 },
56 /* bootloader params in the next 1 sectors */ 70 /* bootloader params in the next 1 sectors */
@@ -100,10 +114,89 @@ static struct platform_device davinci_evm_norflash_device = {
100 .resource = &davinci_evm_norflash_resource, 114 .resource = &davinci_evm_norflash_resource,
101}; 115};
102 116
103#endif 117/* DM644x EVM includes a 64 MByte small-page NAND flash (16K blocks).
118 * It may used instead of the (default) NOR chip to boot, using TI's
119 * tools to install the secondary boot loader (UBL) and U-Boot.
120 */
121struct mtd_partition davinci_evm_nandflash_partition[] = {
122 /* Bootloader layout depends on whose u-boot is installed, but we
123 * can hide all the details.
124 * - block 0 for u-boot environment ... in mainline u-boot
125 * - block 1 for UBL (plus up to four backup copies in blocks 2..5)
126 * - blocks 6...? for u-boot
127 * - blocks 16..23 for u-boot environment ... in TI's u-boot
128 */
129 {
130 .name = "bootloader",
131 .offset = 0,
132 .size = SZ_256K + SZ_128K,
133 .mask_flags = MTD_WRITEABLE, /* force read-only */
134 },
135 /* Kernel */
136 {
137 .name = "kernel",
138 .offset = MTDPART_OFS_APPEND,
139 .size = SZ_4M,
140 .mask_flags = 0,
141 },
142 /* File system (older GIT kernels started this on the 5MB mark) */
143 {
144 .name = "filesystem",
145 .offset = MTDPART_OFS_APPEND,
146 .size = MTDPART_SIZ_FULL,
147 .mask_flags = 0,
148 }
149 /* A few blocks at end hold a flash BBT ... created by TI's CCS
150 * using flashwriter_nand.out, but ignored by TI's versions of
151 * Linux and u-boot. We boot faster by using them.
152 */
153};
104 154
105#if defined(CONFIG_BLK_DEV_PALMCHIP_BK3710) || \ 155static struct davinci_nand_pdata davinci_evm_nandflash_data = {
106 defined(CONFIG_BLK_DEV_PALMCHIP_BK3710_MODULE) 156 .parts = davinci_evm_nandflash_partition,
157 .nr_parts = ARRAY_SIZE(davinci_evm_nandflash_partition),
158 .ecc_mode = NAND_ECC_HW,
159 .options = NAND_USE_FLASH_BBT,
160};
161
162static struct resource davinci_evm_nandflash_resource[] = {
163 {
164 .start = DAVINCI_ASYNC_EMIF_DATA_CE0_BASE,
165 .end = DAVINCI_ASYNC_EMIF_DATA_CE0_BASE + SZ_16M - 1,
166 .flags = IORESOURCE_MEM,
167 }, {
168 .start = DAVINCI_ASYNC_EMIF_CONTROL_BASE,
169 .end = DAVINCI_ASYNC_EMIF_CONTROL_BASE + SZ_4K - 1,
170 .flags = IORESOURCE_MEM,
171 },
172};
173
174static struct platform_device davinci_evm_nandflash_device = {
175 .name = "davinci_nand",
176 .id = 0,
177 .dev = {
178 .platform_data = &davinci_evm_nandflash_data,
179 },
180 .num_resources = ARRAY_SIZE(davinci_evm_nandflash_resource),
181 .resource = davinci_evm_nandflash_resource,
182};
183
184static u64 davinci_fb_dma_mask = DMA_BIT_MASK(32);
185
186static struct platform_device davinci_fb_device = {
187 .name = "davincifb",
188 .id = -1,
189 .dev = {
190 .dma_mask = &davinci_fb_dma_mask,
191 .coherent_dma_mask = DMA_BIT_MASK(32),
192 },
193 .num_resources = 0,
194};
195
196static struct platform_device rtc_dev = {
197 .name = "rtc_davinci_evm",
198 .id = -1,
199};
107 200
108static struct resource ide_resources[] = { 201static struct resource ide_resources[] = {
109 { 202 {
@@ -118,7 +211,7 @@ static struct resource ide_resources[] = {
118 }, 211 },
119}; 212};
120 213
121static u64 ide_dma_mask = DMA_BIT_MASK(32); 214static u64 ide_dma_mask = DMA_32BIT_MASK;
122 215
123static struct platform_device ide_dev = { 216static struct platform_device ide_dev = {
124 .name = "palm_bk3710", 217 .name = "palm_bk3710",
@@ -127,12 +220,10 @@ static struct platform_device ide_dev = {
127 .num_resources = ARRAY_SIZE(ide_resources), 220 .num_resources = ARRAY_SIZE(ide_resources),
128 .dev = { 221 .dev = {
129 .dma_mask = &ide_dma_mask, 222 .dma_mask = &ide_dma_mask,
130 .coherent_dma_mask = DMA_BIT_MASK(32), 223 .coherent_dma_mask = DMA_32BIT_MASK,
131 }, 224 },
132}; 225};
133 226
134#endif
135
136/*----------------------------------------------------------------------*/ 227/*----------------------------------------------------------------------*/
137 228
138/* 229/*
@@ -311,7 +402,9 @@ evm_u35_setup(struct i2c_client *client, int gpio, unsigned ngpio, void *c)
311 gpio_request(gpio + 7, "nCF_SEL"); 402 gpio_request(gpio + 7, "nCF_SEL");
312 gpio_direction_output(gpio + 7, 1); 403 gpio_direction_output(gpio + 7, 1);
313 404
314 /* irlml6401 sustains over 3A, switches 5V in under 8 msec */ 405 /* irlml6401 switches over 1A, in under 8 msec;
406 * now it can be managed by nDRV_VBUS ...
407 */
315 setup_usb(500, 8); 408 setup_usb(500, 8);
316 409
317 return 0; 410 return 0;
@@ -343,14 +436,120 @@ static struct pcf857x_platform_data pcf_data_u35 = {
343 * - 0x0039, 1 byte NTSC vs PAL (bit 0x80 == PAL) 436 * - 0x0039, 1 byte NTSC vs PAL (bit 0x80 == PAL)
344 * - ... newer boards may have more 437 * - ... newer boards may have more
345 */ 438 */
439static struct memory_accessor *at24_mem_acc;
440
441static void at24_setup(struct memory_accessor *mem_acc, void *context)
442{
443 DECLARE_MAC_BUF(mac_str);
444 char mac_addr[6];
445
446 at24_mem_acc = mem_acc;
447
448 /* Read MAC addr from EEPROM */
449 if (at24_mem_acc->read(at24_mem_acc, mac_addr, 0x7f00, 6) == 6) {
450 printk(KERN_INFO "Read MAC addr from EEPROM: %s\n",
451 print_mac(mac_str, mac_addr));
452 }
453}
454
346static struct at24_platform_data eeprom_info = { 455static struct at24_platform_data eeprom_info = {
347 .byte_len = (256*1024) / 8, 456 .byte_len = (256*1024) / 8,
348 .page_size = 64, 457 .page_size = 64,
349 .flags = AT24_FLAG_ADDR16, 458 .flags = AT24_FLAG_ADDR16,
459 .setup = at24_setup,
350}; 460};
351 461
462int dm6446evm_eeprom_read(void *buf, off_t off, size_t count)
463{
464 if (at24_mem_acc)
465 return at24_mem_acc->read(at24_mem_acc, buf, off, count);
466 return -ENODEV;
467}
468EXPORT_SYMBOL(dm6446evm_eeprom_read);
469
470int dm6446evm_eeprom_write(void *buf, off_t off, size_t count)
471{
472 if (at24_mem_acc)
473 return at24_mem_acc->write(at24_mem_acc, buf, off, count);
474 return -ENODEV;
475}
476EXPORT_SYMBOL(dm6446evm_eeprom_write);
477
478/*
479 * MSP430 supports RTC, card detection, input from IR remote, and
480 * a bit more. It triggers interrupts on GPIO(7) from pressing
481 * buttons on the IR remote, and for card detect switches.
482 */
483static struct i2c_client *dm6446evm_msp;
484
485static int dm6446evm_msp_probe(struct i2c_client *client,
486 const struct i2c_device_id *id)
487{
488 dm6446evm_msp = client;
489 return 0;
490}
491
492static int dm6446evm_msp_remove(struct i2c_client *client)
493{
494 dm6446evm_msp = NULL;
495 return 0;
496}
497
498static const struct i2c_device_id dm6446evm_msp_ids[] = {
499 { "dm6446evm_msp", 0, },
500 { /* end of list */ },
501};
502
503static struct i2c_driver dm6446evm_msp_driver = {
504 .driver.name = "dm6446evm_msp",
505 .id_table = dm6446evm_msp_ids,
506 .probe = dm6446evm_msp_probe,
507 .remove = dm6446evm_msp_remove,
508};
509
510static int dm6444evm_msp430_get_pins(void)
511{
512 static const char txbuf[2] = { 2, 4, };
513 char buf[4];
514 struct i2c_msg msg[2] = {
515 {
516 .addr = dm6446evm_msp->addr,
517 .flags = 0,
518 .len = 2,
519 .buf = (void __force *)txbuf,
520 },
521 {
522 .addr = dm6446evm_msp->addr,
523 .flags = I2C_M_RD,
524 .len = 4,
525 .buf = buf,
526 },
527 };
528 int status;
529
530 if (!dm6446evm_msp)
531 return -ENXIO;
532
533 /* Command 4 == get input state, returns port 2 and port3 data
534 * S Addr W [A] len=2 [A] cmd=4 [A]
535 * RS Addr R [A] [len=4] A [cmd=4] A [port2] A [port3] N P
536 */
537 status = i2c_transfer(dm6446evm_msp->adapter, msg, 2);
538 if (status < 0)
539 return status;
540
541 dev_dbg(&dm6446evm_msp->dev,
542 "PINS: %02x %02x %02x %02x\n",
543 buf[0], buf[1], buf[2], buf[3]);
544
545 return (buf[3] << 8) | buf[2];
546}
547
352static struct i2c_board_info __initdata i2c_info[] = { 548static struct i2c_board_info __initdata i2c_info[] = {
353 { 549 {
550 I2C_BOARD_INFO("dm6446evm_msp", 0x23),
551 },
552 {
354 I2C_BOARD_INFO("pcf8574", 0x38), 553 I2C_BOARD_INFO("pcf8574", 0x38),
355 .platform_data = &pcf_data_u2, 554 .platform_data = &pcf_data_u2,
356 }, 555 },
@@ -368,7 +567,6 @@ static struct i2c_board_info __initdata i2c_info[] = {
368 }, 567 },
369 /* ALSO: 568 /* ALSO:
370 * - tvl320aic33 audio codec (0x1b) 569 * - tvl320aic33 audio codec (0x1b)
371 * - msp430 microcontroller (0x23)
372 * - tvp5146 video decoder (0x5d) 570 * - tvp5146 video decoder (0x5d)
373 */ 571 */
374}; 572};
@@ -384,51 +582,109 @@ static struct davinci_i2c_platform_data i2c_pdata = {
384static void __init evm_init_i2c(void) 582static void __init evm_init_i2c(void)
385{ 583{
386 davinci_init_i2c(&i2c_pdata); 584 davinci_init_i2c(&i2c_pdata);
585 i2c_add_driver(&dm6446evm_msp_driver);
387 i2c_register_board_info(1, i2c_info, ARRAY_SIZE(i2c_info)); 586 i2c_register_board_info(1, i2c_info, ARRAY_SIZE(i2c_info));
388} 587}
389 588
390static struct platform_device *davinci_evm_devices[] __initdata = { 589static struct platform_device *davinci_evm_devices[] __initdata = {
391#if defined(CONFIG_MTD_PHYSMAP) || \ 590 &davinci_fb_device,
392 defined(CONFIG_MTD_PHYSMAP_MODULE) 591 &rtc_dev,
393 &davinci_evm_norflash_device, 592};
394#endif 593
395#if defined(CONFIG_BLK_DEV_PALMCHIP_BK3710) || \ 594static struct davinci_uart_config uart_config __initdata = {
396 defined(CONFIG_BLK_DEV_PALMCHIP_BK3710_MODULE) 595 .enabled_uarts = (1 << 0),
397 &ide_dev,
398#endif
399}; 596};
400 597
401static void __init 598static void __init
402davinci_evm_map_io(void) 599davinci_evm_map_io(void)
403{ 600{
404 davinci_map_common_io(); 601 davinci_map_common_io();
602 dm644x_init();
405} 603}
406 604
407static __init void davinci_evm_init(void) 605static int davinci_phy_fixup(struct phy_device *phydev)
408{ 606{
409 davinci_psc_init(); 607 unsigned int control;
608 /* CRITICAL: Fix for increasing PHY signal drive strength for
609 * TX lockup issue. On DaVinci EVM, the Intel LXT971 PHY
610 * signal strength was low causing TX to fail randomly. The
611 * fix is to Set bit 11 (Increased MII drive strength) of PHY
612 * register 26 (Digital Config register) on this phy. */
613 control = phy_read(phydev, 26);
614 phy_write(phydev, 26, (control | 0x800));
615 return 0;
616}
410 617
411#if defined(CONFIG_BLK_DEV_PALMCHIP_BK3710) || \ 618#if defined(CONFIG_BLK_DEV_PALMCHIP_BK3710) || \
412 defined(CONFIG_BLK_DEV_PALMCHIP_BK3710_MODULE) 619 defined(CONFIG_BLK_DEV_PALMCHIP_BK3710_MODULE)
620#define HAS_ATA 1
621#else
622#define HAS_ATA 0
623#endif
624
413#if defined(CONFIG_MTD_PHYSMAP) || \ 625#if defined(CONFIG_MTD_PHYSMAP) || \
414 defined(CONFIG_MTD_PHYSMAP_MODULE) 626 defined(CONFIG_MTD_PHYSMAP_MODULE)
415 printk(KERN_WARNING "WARNING: both IDE and NOR flash are enabled, " 627#define HAS_NOR 1
416 "but share pins.\n\t Disable IDE for NOR support.\n"); 628#else
629#define HAS_NOR 0
417#endif 630#endif
631
632#if defined(CONFIG_MTD_NAND_DAVINCI) || \
633 defined(CONFIG_MTD_NAND_DAVINCI_MODULE)
634#define HAS_NAND 1
635#else
636#define HAS_NAND 0
418#endif 637#endif
419 638
639static __init void davinci_evm_init(void)
640{
641 struct clk *aemif_clk;
642
643 aemif_clk = clk_get(NULL, "aemif");
644 clk_enable(aemif_clk);
645
646 if (HAS_ATA) {
647 if (HAS_NAND || HAS_NOR)
648 pr_warning("WARNING: both IDE and Flash are "
649 "enabled, but they share AEMIF pins.\n"
650 "\tDisable IDE for NAND/NOR support.\n");
651 davinci_cfg_reg(DM644X_HPIEN_DISABLE);
652 davinci_cfg_reg(DM644X_ATAEN);
653 davinci_cfg_reg(DM644X_HDIREN);
654 platform_device_register(&ide_dev);
655 } else if (HAS_NAND || HAS_NOR) {
656 davinci_cfg_reg(DM644X_HPIEN_DISABLE);
657 davinci_cfg_reg(DM644X_ATAEN_DISABLE);
658
659 /* only one device will be jumpered and detected */
660 if (HAS_NAND) {
661 platform_device_register(&davinci_evm_nandflash_device);
662 evm_leds[7].default_trigger = "nand-disk";
663 if (HAS_NOR)
664 pr_warning("WARNING: both NAND and NOR flash "
665 "are enabled; disable one of them.\n");
666 } else if (HAS_NOR)
667 platform_device_register(&davinci_evm_norflash_device);
668 }
669
420 platform_add_devices(davinci_evm_devices, 670 platform_add_devices(davinci_evm_devices,
421 ARRAY_SIZE(davinci_evm_devices)); 671 ARRAY_SIZE(davinci_evm_devices));
422 evm_init_i2c(); 672 evm_init_i2c();
673
674 davinci_serial_init(&uart_config);
675
676 /* Register the fixup for PHY on DaVinci */
677 phy_register_fixup_for_uid(LXT971_PHY_ID, LXT971_PHY_MASK,
678 davinci_phy_fixup);
679
423} 680}
424 681
425static __init void davinci_evm_irq_init(void) 682static __init void davinci_evm_irq_init(void)
426{ 683{
427 davinci_init_common_hw();
428 davinci_irq_init(); 684 davinci_irq_init();
429} 685}
430 686
431MACHINE_START(DAVINCI_EVM, "DaVinci EVM") 687MACHINE_START(DAVINCI_EVM, "DaVinci DM644x EVM")
432 /* Maintainer: MontaVista Software <source@mvista.com> */ 688 /* Maintainer: MontaVista Software <source@mvista.com> */
433 .phys_io = IO_PHYS, 689 .phys_io = IO_PHYS,
434 .io_pg_offst = (__IO_ADDRESS(IO_PHYS) >> 18) & 0xfffc, 690 .io_pg_offst = (__IO_ADDRESS(IO_PHYS) >> 18) & 0xfffc,
diff --git a/arch/arm/mach-davinci/clock.c b/arch/arm/mach-davinci/clock.c
index abb92b7eca0..f0baaa15a57 100644
--- a/arch/arm/mach-davinci/clock.c
+++ b/arch/arm/mach-davinci/clock.c
@@ -1,7 +1,8 @@
1/* 1/*
2 * TI DaVinci clock config file 2 * Clock and PLL control for DaVinci devices
3 * 3 *
4 * Copyright (C) 2006 Texas Instruments. 4 * Copyright (C) 2006-2007 Texas Instruments.
5 * Copyright (C) 2008-2009 Deep Root Systems, LLC
5 * 6 *
6 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -13,6 +14,7 @@
13#include <linux/kernel.h> 14#include <linux/kernel.h>
14#include <linux/init.h> 15#include <linux/init.h>
15#include <linux/errno.h> 16#include <linux/errno.h>
17#include <linux/clk.h>
16#include <linux/err.h> 18#include <linux/err.h>
17#include <linux/mutex.h> 19#include <linux/mutex.h>
18#include <linux/platform_device.h> 20#include <linux/platform_device.h>
@@ -21,98 +23,50 @@
21#include <mach/hardware.h> 23#include <mach/hardware.h>
22 24
23#include <mach/psc.h> 25#include <mach/psc.h>
26#include <mach/cputype.h>
24#include "clock.h" 27#include "clock.h"
25 28
26/* PLL/Reset register offsets */
27#define PLLM 0x110
28
29static LIST_HEAD(clocks); 29static LIST_HEAD(clocks);
30static DEFINE_MUTEX(clocks_mutex); 30static DEFINE_MUTEX(clocks_mutex);
31static DEFINE_SPINLOCK(clockfw_lock); 31static DEFINE_SPINLOCK(clockfw_lock);
32 32
33static unsigned int commonrate; 33static unsigned psc_domain(struct clk *clk)
34static unsigned int armrate;
35static unsigned int fixedrate = 27000000; /* 27 MHZ */
36
37extern void davinci_psc_config(unsigned int domain, unsigned int id, char enable);
38
39/*
40 * Returns a clock. Note that we first try to use device id on the bus
41 * and clock name. If this fails, we try to use clock name only.
42 */
43struct clk *clk_get(struct device *dev, const char *id)
44{ 34{
45 struct clk *p, *clk = ERR_PTR(-ENOENT); 35 return (clk->flags & PSC_DSP)
46 int idno; 36 ? DAVINCI_GPSC_DSPDOMAIN
47 37 : DAVINCI_GPSC_ARMDOMAIN;
48 if (dev == NULL || dev->bus != &platform_bus_type)
49 idno = -1;
50 else
51 idno = to_platform_device(dev)->id;
52
53 mutex_lock(&clocks_mutex);
54
55 list_for_each_entry(p, &clocks, node) {
56 if (p->id == idno &&
57 strcmp(id, p->name) == 0 && try_module_get(p->owner)) {
58 clk = p;
59 goto found;
60 }
61 }
62
63 list_for_each_entry(p, &clocks, node) {
64 if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) {
65 clk = p;
66 break;
67 }
68 }
69
70found:
71 mutex_unlock(&clocks_mutex);
72
73 return clk;
74} 38}
75EXPORT_SYMBOL(clk_get);
76 39
77void clk_put(struct clk *clk) 40static void __clk_enable(struct clk *clk)
78{ 41{
79 if (clk && !IS_ERR(clk)) 42 if (clk->parent)
80 module_put(clk->owner); 43 __clk_enable(clk->parent);
81} 44 if (clk->usecount++ == 0 && (clk->flags & CLK_PSC))
82EXPORT_SYMBOL(clk_put); 45 davinci_psc_config(psc_domain(clk), clk->lpsc, 1);
83
84static int __clk_enable(struct clk *clk)
85{
86 if (clk->flags & ALWAYS_ENABLED)
87 return 0;
88
89 davinci_psc_config(DAVINCI_GPSC_ARMDOMAIN, clk->lpsc, 1);
90 return 0;
91} 46}
92 47
93static void __clk_disable(struct clk *clk) 48static void __clk_disable(struct clk *clk)
94{ 49{
95 if (clk->usecount) 50 if (WARN_ON(clk->usecount == 0))
96 return; 51 return;
97 52 if (--clk->usecount == 0 && !(clk->flags & CLK_PLL))
98 davinci_psc_config(DAVINCI_GPSC_ARMDOMAIN, clk->lpsc, 0); 53 davinci_psc_config(psc_domain(clk), clk->lpsc, 0);
54 if (clk->parent)
55 __clk_disable(clk->parent);
99} 56}
100 57
101int clk_enable(struct clk *clk) 58int clk_enable(struct clk *clk)
102{ 59{
103 unsigned long flags; 60 unsigned long flags;
104 int ret = 0;
105 61
106 if (clk == NULL || IS_ERR(clk)) 62 if (clk == NULL || IS_ERR(clk))
107 return -EINVAL; 63 return -EINVAL;
108 64
109 if (clk->usecount++ == 0) { 65 spin_lock_irqsave(&clockfw_lock, flags);
110 spin_lock_irqsave(&clockfw_lock, flags); 66 __clk_enable(clk);
111 ret = __clk_enable(clk); 67 spin_unlock_irqrestore(&clockfw_lock, flags);
112 spin_unlock_irqrestore(&clockfw_lock, flags);
113 }
114 68
115 return ret; 69 return 0;
116} 70}
117EXPORT_SYMBOL(clk_enable); 71EXPORT_SYMBOL(clk_enable);
118 72
@@ -123,11 +77,9 @@ void clk_disable(struct clk *clk)
123 if (clk == NULL || IS_ERR(clk)) 77 if (clk == NULL || IS_ERR(clk))
124 return; 78 return;
125 79
126 if (clk->usecount > 0 && !(--clk->usecount)) { 80 spin_lock_irqsave(&clockfw_lock, flags);
127 spin_lock_irqsave(&clockfw_lock, flags); 81 __clk_disable(clk);
128 __clk_disable(clk); 82 spin_unlock_irqrestore(&clockfw_lock, flags);
129 spin_unlock_irqrestore(&clockfw_lock, flags);
130 }
131} 83}
132EXPORT_SYMBOL(clk_disable); 84EXPORT_SYMBOL(clk_disable);
133 85
@@ -136,7 +88,7 @@ unsigned long clk_get_rate(struct clk *clk)
136 if (clk == NULL || IS_ERR(clk)) 88 if (clk == NULL || IS_ERR(clk))
137 return -EINVAL; 89 return -EINVAL;
138 90
139 return *(clk->rate); 91 return clk->rate;
140} 92}
141EXPORT_SYMBOL(clk_get_rate); 93EXPORT_SYMBOL(clk_get_rate);
142 94
@@ -145,7 +97,7 @@ long clk_round_rate(struct clk *clk, unsigned long rate)
145 if (clk == NULL || IS_ERR(clk)) 97 if (clk == NULL || IS_ERR(clk))
146 return -EINVAL; 98 return -EINVAL;
147 99
148 return *(clk->rate); 100 return clk->rate;
149} 101}
150EXPORT_SYMBOL(clk_round_rate); 102EXPORT_SYMBOL(clk_round_rate);
151 103
@@ -164,10 +116,23 @@ int clk_register(struct clk *clk)
164 if (clk == NULL || IS_ERR(clk)) 116 if (clk == NULL || IS_ERR(clk))
165 return -EINVAL; 117 return -EINVAL;
166 118
119 if (WARN(clk->parent && !clk->parent->rate,
120 "CLK: %s parent %s has no rate!\n",
121 clk->name, clk->parent->name))
122 return -EINVAL;
123
167 mutex_lock(&clocks_mutex); 124 mutex_lock(&clocks_mutex);
168 list_add(&clk->node, &clocks); 125 list_add_tail(&clk->node, &clocks);
169 mutex_unlock(&clocks_mutex); 126 mutex_unlock(&clocks_mutex);
170 127
128 /* If rate is already set, use it */
129 if (clk->rate)
130 return 0;
131
132 /* Otherwise, default to parent rate */
133 if (clk->parent)
134 clk->rate = clk->parent->rate;
135
171 return 0; 136 return 0;
172} 137}
173EXPORT_SYMBOL(clk_register); 138EXPORT_SYMBOL(clk_register);
@@ -183,84 +148,150 @@ void clk_unregister(struct clk *clk)
183} 148}
184EXPORT_SYMBOL(clk_unregister); 149EXPORT_SYMBOL(clk_unregister);
185 150
186static struct clk davinci_clks[] = { 151#ifdef CONFIG_DAVINCI_RESET_CLOCKS
187 { 152/*
188 .name = "ARMCLK", 153 * Disable any unused clocks left on by the bootloader
189 .rate = &armrate, 154 */
190 .lpsc = -1, 155static int __init clk_disable_unused(void)
191 .flags = ALWAYS_ENABLED, 156{
192 }, 157 struct clk *ck;
193 { 158
194 .name = "UART", 159 spin_lock_irq(&clockfw_lock);
195 .rate = &fixedrate, 160 list_for_each_entry(ck, &clocks, node) {
196 .lpsc = DAVINCI_LPSC_UART0, 161 if (ck->usecount > 0)
197 }, 162 continue;
198 { 163 if (!(ck->flags & CLK_PSC))
199 .name = "EMACCLK", 164 continue;
200 .rate = &commonrate, 165
201 .lpsc = DAVINCI_LPSC_EMAC_WRAPPER, 166 /* ignore if in Disabled or SwRstDisable states */
202 }, 167 if (!davinci_psc_is_clk_active(ck->lpsc))
203 { 168 continue;
204 .name = "I2CCLK", 169
205 .rate = &fixedrate, 170 pr_info("Clocks: disable unused %s\n", ck->name);
206 .lpsc = DAVINCI_LPSC_I2C, 171 davinci_psc_config(psc_domain(ck), ck->lpsc, 0);
207 },
208 {
209 .name = "IDECLK",
210 .rate = &commonrate,
211 .lpsc = DAVINCI_LPSC_ATA,
212 },
213 {
214 .name = "McBSPCLK",
215 .rate = &commonrate,
216 .lpsc = DAVINCI_LPSC_McBSP,
217 },
218 {
219 .name = "MMCSDCLK",
220 .rate = &commonrate,
221 .lpsc = DAVINCI_LPSC_MMC_SD,
222 },
223 {
224 .name = "SPICLK",
225 .rate = &commonrate,
226 .lpsc = DAVINCI_LPSC_SPI,
227 },
228 {
229 .name = "gpio",
230 .rate = &commonrate,
231 .lpsc = DAVINCI_LPSC_GPIO,
232 },
233 {
234 .name = "usb",
235 .rate = &commonrate,
236 .lpsc = DAVINCI_LPSC_USB,
237 },
238 {
239 .name = "AEMIFCLK",
240 .rate = &commonrate,
241 .lpsc = DAVINCI_LPSC_AEMIF,
242 .usecount = 1,
243 } 172 }
244}; 173 spin_unlock_irq(&clockfw_lock);
174
175 return 0;
176}
177late_initcall(clk_disable_unused);
178#endif
245 179
246int __init davinci_clk_init(void) 180static void clk_sysclk_recalc(struct clk *clk)
247{ 181{
248 struct clk *clkp; 182 u32 v, plldiv;
249 int count = 0; 183 struct pll_data *pll;
250 u32 pll_mult; 184
251 185 /* If this is the PLL base clock, no more calculations needed */
252 pll_mult = davinci_readl(DAVINCI_PLL_CNTRL0_BASE + PLLM); 186 if (clk->pll_data)
253 commonrate = ((pll_mult + 1) * 27000000) / 6; 187 return;
254 armrate = ((pll_mult + 1) * 27000000) / 2; 188
255 189 if (WARN_ON(!clk->parent))
256 for (clkp = davinci_clks; count < ARRAY_SIZE(davinci_clks); 190 return;
257 count++, clkp++) { 191
258 clk_register(clkp); 192 clk->rate = clk->parent->rate;
259 193
260 /* Turn on clocks that have been enabled in the 194 /* Otherwise, the parent must be a PLL */
261 * table above */ 195 if (WARN_ON(!clk->parent->pll_data))
262 if (clkp->usecount) 196 return;
263 clk_enable(clkp); 197
198 pll = clk->parent->pll_data;
199
200 /* If pre-PLL, source clock is before the multiplier and divider(s) */
201 if (clk->flags & PRE_PLL)
202 clk->rate = pll->input_rate;
203
204 if (!clk->div_reg)
205 return;
206
207 v = __raw_readl(pll->base + clk->div_reg);
208 if (v & PLLDIV_EN) {
209 plldiv = (v & PLLDIV_RATIO_MASK) + 1;
210 if (plldiv)
211 clk->rate /= plldiv;
212 }
213}
214
215static void __init clk_pll_init(struct clk *clk)
216{
217 u32 ctrl, mult = 1, prediv = 1, postdiv = 1;
218 u8 bypass;
219 struct pll_data *pll = clk->pll_data;
220
221 pll->base = IO_ADDRESS(pll->phys_base);
222 ctrl = __raw_readl(pll->base + PLLCTL);
223 clk->rate = pll->input_rate = clk->parent->rate;
224
225 if (ctrl & PLLCTL_PLLEN) {
226 bypass = 0;
227 mult = __raw_readl(pll->base + PLLM);
228 mult = (mult & PLLM_PLLM_MASK) + 1;
229 } else
230 bypass = 1;
231
232 if (pll->flags & PLL_HAS_PREDIV) {
233 prediv = __raw_readl(pll->base + PREDIV);
234 if (prediv & PLLDIV_EN)
235 prediv = (prediv & PLLDIV_RATIO_MASK) + 1;
236 else
237 prediv = 1;
238 }
239
240 /* pre-divider is fixed, but (some?) chips won't report that */
241 if (cpu_is_davinci_dm355() && pll->num == 1)
242 prediv = 8;
243
244 if (pll->flags & PLL_HAS_POSTDIV) {
245 postdiv = __raw_readl(pll->base + POSTDIV);
246 if (postdiv & PLLDIV_EN)
247 postdiv = (postdiv & PLLDIV_RATIO_MASK) + 1;
248 else
249 postdiv = 1;
250 }
251
252 if (!bypass) {
253 clk->rate /= prediv;
254 clk->rate *= mult;
255 clk->rate /= postdiv;
256 }
257
258 pr_debug("PLL%d: input = %lu MHz [ ",
259 pll->num, clk->parent->rate / 1000000);
260 if (bypass)
261 pr_debug("bypass ");
262 if (prediv > 1)
263 pr_debug("/ %d ", prediv);
264 if (mult > 1)
265 pr_debug("* %d ", mult);
266 if (postdiv > 1)
267 pr_debug("/ %d ", postdiv);
268 pr_debug("] --> %lu MHz output.\n", clk->rate / 1000000);
269}
270
271int __init davinci_clk_init(struct davinci_clk *clocks)
272 {
273 struct davinci_clk *c;
274 struct clk *clk;
275
276 for (c = clocks; c->lk.clk; c++) {
277 clk = c->lk.clk;
278
279 if (clk->pll_data)
280 clk_pll_init(clk);
281
282 /* Calculate rates for PLL-derived clocks */
283 else if (clk->flags & CLK_PLL)
284 clk_sysclk_recalc(clk);
285
286 if (clk->lpsc)
287 clk->flags |= CLK_PSC;
288
289 clkdev_add(&c->lk);
290 clk_register(clk);
291
292 /* Turn on clocks that Linux doesn't otherwise manage */
293 if (clk->flags & ALWAYS_ENABLED)
294 clk_enable(clk);
264 } 295 }
265 296
266 return 0; 297 return 0;
@@ -285,12 +316,52 @@ static void davinci_ck_stop(struct seq_file *m, void *v)
285{ 316{
286} 317}
287 318
288static int davinci_ck_show(struct seq_file *m, void *v) 319#define CLKNAME_MAX 10 /* longest clock name */
320#define NEST_DELTA 2
321#define NEST_MAX 4
322
323static void
324dump_clock(struct seq_file *s, unsigned nest, struct clk *parent)
289{ 325{
290 struct clk *cp; 326 char *state;
327 char buf[CLKNAME_MAX + NEST_DELTA * NEST_MAX];
328 struct clk *clk;
329 unsigned i;
330
331 if (parent->flags & CLK_PLL)
332 state = "pll";
333 else if (parent->flags & CLK_PSC)
334 state = "psc";
335 else
336 state = "";
337
338 /* <nest spaces> name <pad to end> */
339 memset(buf, ' ', sizeof(buf) - 1);
340 buf[sizeof(buf) - 1] = 0;
341 i = strlen(parent->name);
342 memcpy(buf + nest, parent->name,
343 min(i, (unsigned)(sizeof(buf) - 1 - nest)));
344
345 seq_printf(s, "%s users=%2d %-3s %9ld Hz\n",
346 buf, parent->usecount, state, clk_get_rate(parent));
347 /* REVISIT show device associations too */
348
349 /* cost is now small, but not linear... */
350 list_for_each_entry(clk, &clocks, node) {
351 if (clk->parent == parent)
352 dump_clock(s, nest + NEST_DELTA, clk);
353 }
354}
291 355
292 list_for_each_entry(cp, &clocks, node) 356static int davinci_ck_show(struct seq_file *m, void *v)
293 seq_printf(m,"%s %d %d\n", cp->name, *(cp->rate), cp->usecount); 357{
358 /* Show clock tree; we know the main oscillator is first.
359 * We trust nonzero usecounts equate to PSC enables...
360 */
361 mutex_lock(&clocks_mutex);
362 if (!list_empty(&clocks))
363 dump_clock(m, 0, list_first_entry(&clocks, struct clk, node));
364 mutex_unlock(&clocks_mutex);
294 365
295 return 0; 366 return 0;
296} 367}
@@ -321,4 +392,4 @@ static int __init davinci_ck_proc_init(void)
321 392
322} 393}
323__initcall(davinci_ck_proc_init); 394__initcall(davinci_ck_proc_init);
324#endif /* CONFIG_DEBUG_PROC_FS */ 395#endif /* CONFIG_DEBUG_PROC_FS */
diff --git a/arch/arm/mach-davinci/clock.h b/arch/arm/mach-davinci/clock.h
index ed47079a52e..35736ec202f 100644
--- a/arch/arm/mach-davinci/clock.h
+++ b/arch/arm/mach-davinci/clock.h
@@ -1,7 +1,8 @@
1/* 1/*
2 * TI DaVinci clock definitions 2 * TI DaVinci clock definitions
3 * 3 *
4 * Copyright (C) 2006 Texas Instruments. 4 * Copyright (C) 2006-2007 Texas Instruments.
5 * Copyright (C) 2008-2009 Deep Root Systems, LLC
5 * 6 *
6 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as 8 * it under the terms of the GNU General Public License version 2 as
@@ -11,23 +12,85 @@
11#ifndef __ARCH_ARM_DAVINCI_CLOCK_H 12#ifndef __ARCH_ARM_DAVINCI_CLOCK_H
12#define __ARCH_ARM_DAVINCI_CLOCK_H 13#define __ARCH_ARM_DAVINCI_CLOCK_H
13 14
15#include <linux/list.h>
16#include <asm/clkdev.h>
17
18#define DAVINCI_PLL1_BASE 0x01c40800
19#define DAVINCI_PLL2_BASE 0x01c40c00
20#define MAX_PLL 2
21
22/* PLL/Reset register offsets */
23#define PLLCTL 0x100
24#define PLLCTL_PLLEN BIT(0)
25#define PLLCTL_CLKMODE BIT(8)
26
27#define PLLM 0x110
28#define PLLM_PLLM_MASK 0xff
29
30#define PREDIV 0x114
31#define PLLDIV1 0x118
32#define PLLDIV2 0x11c
33#define PLLDIV3 0x120
34#define POSTDIV 0x128
35#define BPDIV 0x12c
36#define PLLCMD 0x138
37#define PLLSTAT 0x13c
38#define PLLALNCTL 0x140
39#define PLLDCHANGE 0x144
40#define PLLCKEN 0x148
41#define PLLCKSTAT 0x14c
42#define PLLSYSTAT 0x150
43#define PLLDIV4 0x160
44#define PLLDIV5 0x164
45#define PLLDIV6 0x168
46#define PLLDIV7 0x16c
47#define PLLDIV8 0x170
48#define PLLDIV9 0x174
49#define PLLDIV_EN BIT(15)
50#define PLLDIV_RATIO_MASK 0x1f
51
52struct pll_data {
53 u32 phys_base;
54 void __iomem *base;
55 u32 num;
56 u32 flags;
57 u32 input_rate;
58};
59#define PLL_HAS_PREDIV 0x01
60#define PLL_HAS_POSTDIV 0x02
61
14struct clk { 62struct clk {
15 struct list_head node; 63 struct list_head node;
16 struct module *owner; 64 struct module *owner;
17 const char *name; 65 const char *name;
18 unsigned int *rate; 66 unsigned long rate;
19 int id; 67 u8 usecount;
20 __s8 usecount; 68 u8 flags;
21 __u8 flags; 69 u8 lpsc;
22 __u8 lpsc; 70 struct clk *parent;
71 struct pll_data *pll_data;
72 u32 div_reg;
23}; 73};
24 74
25/* Clock flags */ 75/* Clock flags */
26#define RATE_CKCTL 1 76#define ALWAYS_ENABLED BIT(1)
27#define RATE_FIXED 2 77#define CLK_PSC BIT(2)
28#define RATE_PROPAGATES 4 78#define PSC_DSP BIT(3) /* PSC uses DSP domain, not ARM */
29#define VIRTUAL_CLOCK 8 79#define CLK_PLL BIT(4) /* PLL-derived clock */
30#define ALWAYS_ENABLED 16 80#define PRE_PLL BIT(5) /* source is before PLL mult/div */
31#define ENABLE_REG_32BIT 32 81
82struct davinci_clk {
83 struct clk_lookup lk;
84};
85
86#define CLK(dev, con, ck) \
87 { \
88 .lk = { \
89 .dev_id = dev, \
90 .con_id = con, \
91 .clk = ck, \
92 }, \
93 }
32 94
95int davinci_clk_init(struct davinci_clk *clocks);
33#endif 96#endif
diff --git a/arch/arm/mach-davinci/devices.c b/arch/arm/mach-davinci/devices.c
index 808633f9f03..a31370b93dd 100644
--- a/arch/arm/mach-davinci/devices.c
+++ b/arch/arm/mach-davinci/devices.c
@@ -21,6 +21,10 @@
21#include <mach/hardware.h> 21#include <mach/hardware.h>
22#include <mach/i2c.h> 22#include <mach/i2c.h>
23#include <mach/irqs.h> 23#include <mach/irqs.h>
24#include <mach/cputype.h>
25#include <mach/mux.h>
26
27#define DAVINCI_I2C_BASE 0x01C21000
24 28
25static struct resource i2c_resources[] = { 29static struct resource i2c_resources[] = {
26 { 30 {
@@ -43,6 +47,9 @@ static struct platform_device davinci_i2c_device = {
43 47
44void __init davinci_init_i2c(struct davinci_i2c_platform_data *pdata) 48void __init davinci_init_i2c(struct davinci_i2c_platform_data *pdata)
45{ 49{
50 if (cpu_is_davinci_dm644x())
51 davinci_cfg_reg(DM644X_I2C);
52
46 davinci_i2c_device.dev.platform_data = pdata; 53 davinci_i2c_device.dev.platform_data = pdata;
47 (void) platform_device_register(&davinci_i2c_device); 54 (void) platform_device_register(&davinci_i2c_device);
48} 55}
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
new file mode 100644
index 00000000000..d428ef192ea
--- /dev/null
+++ b/arch/arm/mach-davinci/dm644x.c
@@ -0,0 +1,461 @@
1/*
2 * TI DaVinci DM644x chip specific setup
3 *
4 * Author: Kevin Hilman, Deep Root Systems, LLC
5 *
6 * 2007 (c) Deep Root Systems, LLC. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10 */
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/clk.h>
14#include <linux/platform_device.h>
15
16#include <mach/dm644x.h>
17#include <mach/clock.h>
18#include <mach/cputype.h>
19#include <mach/edma.h>
20#include <mach/irqs.h>
21#include <mach/psc.h>
22#include <mach/mux.h>
23
24#include "clock.h"
25#include "mux.h"
26
27/*
28 * Device specific clocks
29 */
30#define DM644X_REF_FREQ 27000000
31
32static struct pll_data pll1_data = {
33 .num = 1,
34 .phys_base = DAVINCI_PLL1_BASE,
35};
36
37static struct pll_data pll2_data = {
38 .num = 2,
39 .phys_base = DAVINCI_PLL2_BASE,
40};
41
42static struct clk ref_clk = {
43 .name = "ref_clk",
44 .rate = DM644X_REF_FREQ,
45};
46
47static struct clk pll1_clk = {
48 .name = "pll1",
49 .parent = &ref_clk,
50 .pll_data = &pll1_data,
51 .flags = CLK_PLL,
52};
53
54static struct clk pll1_sysclk1 = {
55 .name = "pll1_sysclk1",
56 .parent = &pll1_clk,
57 .flags = CLK_PLL,
58 .div_reg = PLLDIV1,
59};
60
61static struct clk pll1_sysclk2 = {
62 .name = "pll1_sysclk2",
63 .parent = &pll1_clk,
64 .flags = CLK_PLL,
65 .div_reg = PLLDIV2,
66};
67
68static struct clk pll1_sysclk3 = {
69 .name = "pll1_sysclk3",
70 .parent = &pll1_clk,
71 .flags = CLK_PLL,
72 .div_reg = PLLDIV3,
73};
74
75static struct clk pll1_sysclk5 = {
76 .name = "pll1_sysclk5",
77 .parent = &pll1_clk,
78 .flags = CLK_PLL,
79 .div_reg = PLLDIV5,
80};
81
82static struct clk pll1_aux_clk = {
83 .name = "pll1_aux_clk",
84 .parent = &pll1_clk,
85 .flags = CLK_PLL | PRE_PLL,
86};
87
88static struct clk pll1_sysclkbp = {
89 .name = "pll1_sysclkbp",
90 .parent = &pll1_clk,
91 .flags = CLK_PLL | PRE_PLL,
92 .div_reg = BPDIV
93};
94
95static struct clk pll2_clk = {
96 .name = "pll2",
97 .parent = &ref_clk,
98 .pll_data = &pll2_data,
99 .flags = CLK_PLL,
100};
101
102static struct clk pll2_sysclk1 = {
103 .name = "pll2_sysclk1",
104 .parent = &pll2_clk,
105 .flags = CLK_PLL,
106 .div_reg = PLLDIV1,
107};
108
109static struct clk pll2_sysclk2 = {
110 .name = "pll2_sysclk2",
111 .parent = &pll2_clk,
112 .flags = CLK_PLL,
113 .div_reg = PLLDIV2,
114};
115
116static struct clk pll2_sysclkbp = {
117 .name = "pll2_sysclkbp",
118 .parent = &pll2_clk,
119 .flags = CLK_PLL | PRE_PLL,
120 .div_reg = BPDIV
121};
122
123static struct clk dsp_clk = {
124 .name = "dsp",
125 .parent = &pll1_sysclk1,
126 .lpsc = DAVINCI_LPSC_GEM,
127 .flags = PSC_DSP,
128 .usecount = 1, /* REVISIT how to disable? */
129};
130
131static struct clk arm_clk = {
132 .name = "arm",
133 .parent = &pll1_sysclk2,
134 .lpsc = DAVINCI_LPSC_ARM,
135 .flags = ALWAYS_ENABLED,
136};
137
138static struct clk vicp_clk = {
139 .name = "vicp",
140 .parent = &pll1_sysclk2,
141 .lpsc = DAVINCI_LPSC_IMCOP,
142 .flags = PSC_DSP,
143 .usecount = 1, /* REVISIT how to disable? */
144};
145
146static struct clk vpss_master_clk = {
147 .name = "vpss_master",
148 .parent = &pll1_sysclk3,
149 .lpsc = DAVINCI_LPSC_VPSSMSTR,
150 .flags = CLK_PSC,
151};
152
153static struct clk vpss_slave_clk = {
154 .name = "vpss_slave",
155 .parent = &pll1_sysclk3,
156 .lpsc = DAVINCI_LPSC_VPSSSLV,
157};
158
159static struct clk uart0_clk = {
160 .name = "uart0",
161 .parent = &pll1_aux_clk,
162 .lpsc = DAVINCI_LPSC_UART0,
163};
164
165static struct clk uart1_clk = {
166 .name = "uart1",
167 .parent = &pll1_aux_clk,
168 .lpsc = DAVINCI_LPSC_UART1,
169};
170
171static struct clk uart2_clk = {
172 .name = "uart2",
173 .parent = &pll1_aux_clk,
174 .lpsc = DAVINCI_LPSC_UART2,
175};
176
177static struct clk emac_clk = {
178 .name = "emac",
179 .parent = &pll1_sysclk5,
180 .lpsc = DAVINCI_LPSC_EMAC_WRAPPER,
181};
182
183static struct clk i2c_clk = {
184 .name = "i2c",
185 .parent = &pll1_aux_clk,
186 .lpsc = DAVINCI_LPSC_I2C,
187};
188
189static struct clk ide_clk = {
190 .name = "ide",
191 .parent = &pll1_sysclk5,
192 .lpsc = DAVINCI_LPSC_ATA,
193};
194
195static struct clk asp_clk = {
196 .name = "asp0",
197 .parent = &pll1_sysclk5,
198 .lpsc = DAVINCI_LPSC_McBSP,
199};
200
201static struct clk mmcsd_clk = {
202 .name = "mmcsd",
203 .parent = &pll1_sysclk5,
204 .lpsc = DAVINCI_LPSC_MMC_SD,
205};
206
207static struct clk spi_clk = {
208 .name = "spi",
209 .parent = &pll1_sysclk5,
210 .lpsc = DAVINCI_LPSC_SPI,
211};
212
213static struct clk gpio_clk = {
214 .name = "gpio",
215 .parent = &pll1_sysclk5,
216 .lpsc = DAVINCI_LPSC_GPIO,
217};
218
219static struct clk usb_clk = {
220 .name = "usb",
221 .parent = &pll1_sysclk5,
222 .lpsc = DAVINCI_LPSC_USB,
223};
224
225static struct clk vlynq_clk = {
226 .name = "vlynq",
227 .parent = &pll1_sysclk5,
228 .lpsc = DAVINCI_LPSC_VLYNQ,
229};
230
231static struct clk aemif_clk = {
232 .name = "aemif",
233 .parent = &pll1_sysclk5,
234 .lpsc = DAVINCI_LPSC_AEMIF,
235};
236
237static struct clk pwm0_clk = {
238 .name = "pwm0",
239 .parent = &pll1_aux_clk,
240 .lpsc = DAVINCI_LPSC_PWM0,
241};
242
243static struct clk pwm1_clk = {
244 .name = "pwm1",
245 .parent = &pll1_aux_clk,
246 .lpsc = DAVINCI_LPSC_PWM1,
247};
248
249static struct clk pwm2_clk = {
250 .name = "pwm2",
251 .parent = &pll1_aux_clk,
252 .lpsc = DAVINCI_LPSC_PWM2,
253};
254
255static struct clk timer0_clk = {
256 .name = "timer0",
257 .parent = &pll1_aux_clk,
258 .lpsc = DAVINCI_LPSC_TIMER0,
259};
260
261static struct clk timer1_clk = {
262 .name = "timer1",
263 .parent = &pll1_aux_clk,
264 .lpsc = DAVINCI_LPSC_TIMER1,
265};
266
267static struct clk timer2_clk = {
268 .name = "timer2",
269 .parent = &pll1_aux_clk,
270 .lpsc = DAVINCI_LPSC_TIMER2,
271 .usecount = 1, /* REVISIT: why cant' this be disabled? */
272};
273
274struct davinci_clk dm644x_clks[] = {
275 CLK(NULL, "ref", &ref_clk),
276 CLK(NULL, "pll1", &pll1_clk),
277 CLK(NULL, "pll1_sysclk1", &pll1_sysclk1),
278 CLK(NULL, "pll1_sysclk2", &pll1_sysclk2),
279 CLK(NULL, "pll1_sysclk3", &pll1_sysclk3),
280 CLK(NULL, "pll1_sysclk5", &pll1_sysclk5),
281 CLK(NULL, "pll1_aux", &pll1_aux_clk),
282 CLK(NULL, "pll1_sysclkbp", &pll1_sysclkbp),
283 CLK(NULL, "pll2", &pll2_clk),
284 CLK(NULL, "pll2_sysclk1", &pll2_sysclk1),
285 CLK(NULL, "pll2_sysclk2", &pll2_sysclk2),
286 CLK(NULL, "pll2_sysclkbp", &pll2_sysclkbp),
287 CLK(NULL, "dsp", &dsp_clk),
288 CLK(NULL, "arm", &arm_clk),
289 CLK(NULL, "vicp", &vicp_clk),
290 CLK(NULL, "vpss_master", &vpss_master_clk),
291 CLK(NULL, "vpss_slave", &vpss_slave_clk),
292 CLK(NULL, "arm", &arm_clk),
293 CLK(NULL, "uart0", &uart0_clk),
294 CLK(NULL, "uart1", &uart1_clk),
295 CLK(NULL, "uart2", &uart2_clk),
296 CLK("davinci_emac.1", NULL, &emac_clk),
297 CLK("i2c_davinci.1", NULL, &i2c_clk),
298 CLK("palm_bk3710", NULL, &ide_clk),
299 CLK("soc-audio.0", NULL, &asp_clk),
300 CLK("davinci_mmc.0", NULL, &mmcsd_clk),
301 CLK(NULL, "spi", &spi_clk),
302 CLK(NULL, "gpio", &gpio_clk),
303 CLK(NULL, "usb", &usb_clk),
304 CLK(NULL, "vlynq", &vlynq_clk),
305 CLK(NULL, "aemif", &aemif_clk),
306 CLK(NULL, "pwm0", &pwm0_clk),
307 CLK(NULL, "pwm1", &pwm1_clk),
308 CLK(NULL, "pwm2", &pwm2_clk),
309 CLK(NULL, "timer0", &timer0_clk),
310 CLK(NULL, "timer1", &timer1_clk),
311 CLK("watchdog", NULL, &timer2_clk),
312 CLK(NULL, NULL, NULL),
313};
314
315#if defined(CONFIG_TI_DAVINCI_EMAC) || defined(CONFIG_TI_DAVINCI_EMAC_MODULE)
316
317static struct resource dm644x_emac_resources[] = {
318 {
319 .start = DM644X_EMAC_BASE,
320 .end = DM644X_EMAC_BASE + 0x47ff,
321 .flags = IORESOURCE_MEM,
322 },
323 {
324 .start = IRQ_EMACINT,
325 .end = IRQ_EMACINT,
326 .flags = IORESOURCE_IRQ,
327 },
328};
329
330static struct platform_device dm644x_emac_device = {
331 .name = "davinci_emac",
332 .id = 1,
333 .num_resources = ARRAY_SIZE(dm644x_emac_resources),
334 .resource = dm644x_emac_resources,
335};
336
337#endif
338
339/*
340 * Device specific mux setup
341 *
342 * soc description mux mode mode mux dbg
343 * reg offset mask mode
344 */
345static const struct mux_config dm644x_pins[] = {
346MUX_CFG(DM644X, HDIREN, 0, 16, 1, 1, true)
347MUX_CFG(DM644X, ATAEN, 0, 17, 1, 1, true)
348MUX_CFG(DM644X, ATAEN_DISABLE, 0, 17, 1, 0, true)
349
350MUX_CFG(DM644X, HPIEN_DISABLE, 0, 29, 1, 0, true)
351
352MUX_CFG(DM644X, AEAW, 0, 0, 31, 31, true)
353
354MUX_CFG(DM644X, MSTK, 1, 9, 1, 0, false)
355
356MUX_CFG(DM644X, I2C, 1, 7, 1, 1, false)
357
358MUX_CFG(DM644X, MCBSP, 1, 10, 1, 1, false)
359
360MUX_CFG(DM644X, UART1, 1, 1, 1, 1, true)
361MUX_CFG(DM644X, UART2, 1, 2, 1, 1, true)
362
363MUX_CFG(DM644X, PWM0, 1, 4, 1, 1, false)
364
365MUX_CFG(DM644X, PWM1, 1, 5, 1, 1, false)
366
367MUX_CFG(DM644X, PWM2, 1, 6, 1, 1, false)
368
369MUX_CFG(DM644X, VLYNQEN, 0, 15, 1, 1, false)
370MUX_CFG(DM644X, VLSCREN, 0, 14, 1, 1, false)
371MUX_CFG(DM644X, VLYNQWD, 0, 12, 3, 3, false)
372
373MUX_CFG(DM644X, EMACEN, 0, 31, 1, 1, true)
374
375MUX_CFG(DM644X, GPIO3V, 0, 31, 1, 0, true)
376
377MUX_CFG(DM644X, GPIO0, 0, 24, 1, 0, true)
378MUX_CFG(DM644X, GPIO3, 0, 25, 1, 0, false)
379MUX_CFG(DM644X, GPIO43_44, 1, 7, 1, 0, false)
380MUX_CFG(DM644X, GPIO46_47, 0, 22, 1, 0, true)
381
382MUX_CFG(DM644X, RGB666, 0, 22, 1, 1, true)
383
384MUX_CFG(DM644X, LOEEN, 0, 24, 1, 1, true)
385MUX_CFG(DM644X, LFLDEN, 0, 25, 1, 1, false)
386};
387
388
389/*----------------------------------------------------------------------*/
390
391static const s8 dma_chan_dm644x_no_event[] = {
392 0, 1, 12, 13, 14,
393 15, 25, 30, 31, 45,
394 46, 47, 55, 56, 57,
395 58, 59, 60, 61, 62,
396 63,
397 -1
398};
399
400static struct edma_soc_info dm644x_edma_info = {
401 .n_channel = 64,
402 .n_region = 4,
403 .n_slot = 128,
404 .n_tc = 2,
405 .noevent = dma_chan_dm644x_no_event,
406};
407
408static struct resource edma_resources[] = {
409 {
410 .name = "edma_cc",
411 .start = 0x01c00000,
412 .end = 0x01c00000 + SZ_64K - 1,
413 .flags = IORESOURCE_MEM,
414 },
415 {
416 .name = "edma_tc0",
417 .start = 0x01c10000,
418 .end = 0x01c10000 + SZ_1K - 1,
419 .flags = IORESOURCE_MEM,
420 },
421 {
422 .name = "edma_tc1",
423 .start = 0x01c10400,
424 .end = 0x01c10400 + SZ_1K - 1,
425 .flags = IORESOURCE_MEM,
426 },
427 {
428 .start = IRQ_CCINT0,
429 .flags = IORESOURCE_IRQ,
430 },
431 {
432 .start = IRQ_CCERRINT,
433 .flags = IORESOURCE_IRQ,
434 },
435 /* not using TC*_ERR */
436};
437
438static struct platform_device dm644x_edma_device = {
439 .name = "edma",
440 .id = -1,
441 .dev.platform_data = &dm644x_edma_info,
442 .num_resources = ARRAY_SIZE(edma_resources),
443 .resource = edma_resources,
444};
445
446/*----------------------------------------------------------------------*/
447void __init dm644x_init(void)
448{
449 davinci_clk_init(dm644x_clks);
450 davinci_mux_register(dm644x_pins, ARRAY_SIZE(dm644x_pins));
451}
452
453static int __init dm644x_init_devices(void)
454{
455 if (!cpu_is_davinci_dm644x())
456 return 0;
457
458 platform_device_register(&dm644x_edma_device);
459 return 0;
460}
461postcore_initcall(dm644x_init_devices);
diff --git a/arch/arm/mach-davinci/dma.c b/arch/arm/mach-davinci/dma.c
new file mode 100644
index 00000000000..15e9eb158bb
--- /dev/null
+++ b/arch/arm/mach-davinci/dma.c
@@ -0,0 +1,1135 @@
1/*
2 * EDMA3 support for DaVinci
3 *
4 * Copyright (C) 2006-2009 Texas Instruments.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20#include <linux/kernel.h>
21#include <linux/sched.h>
22#include <linux/init.h>
23#include <linux/module.h>
24#include <linux/interrupt.h>
25#include <linux/platform_device.h>
26#include <linux/spinlock.h>
27#include <linux/compiler.h>
28#include <linux/io.h>
29
30#include <mach/cputype.h>
31#include <mach/memory.h>
32#include <mach/hardware.h>
33#include <mach/irqs.h>
34#include <mach/edma.h>
35#include <mach/mux.h>
36
37
38/* Offsets matching "struct edmacc_param" */
39#define PARM_OPT 0x00
40#define PARM_SRC 0x04
41#define PARM_A_B_CNT 0x08
42#define PARM_DST 0x0c
43#define PARM_SRC_DST_BIDX 0x10
44#define PARM_LINK_BCNTRLD 0x14
45#define PARM_SRC_DST_CIDX 0x18
46#define PARM_CCNT 0x1c
47
48#define PARM_SIZE 0x20
49
50/* Offsets for EDMA CC global channel registers and their shadows */
51#define SH_ER 0x00 /* 64 bits */
52#define SH_ECR 0x08 /* 64 bits */
53#define SH_ESR 0x10 /* 64 bits */
54#define SH_CER 0x18 /* 64 bits */
55#define SH_EER 0x20 /* 64 bits */
56#define SH_EECR 0x28 /* 64 bits */
57#define SH_EESR 0x30 /* 64 bits */
58#define SH_SER 0x38 /* 64 bits */
59#define SH_SECR 0x40 /* 64 bits */
60#define SH_IER 0x50 /* 64 bits */
61#define SH_IECR 0x58 /* 64 bits */
62#define SH_IESR 0x60 /* 64 bits */
63#define SH_IPR 0x68 /* 64 bits */
64#define SH_ICR 0x70 /* 64 bits */
65#define SH_IEVAL 0x78
66#define SH_QER 0x80
67#define SH_QEER 0x84
68#define SH_QEECR 0x88
69#define SH_QEESR 0x8c
70#define SH_QSER 0x90
71#define SH_QSECR 0x94
72#define SH_SIZE 0x200
73
74/* Offsets for EDMA CC global registers */
75#define EDMA_REV 0x0000
76#define EDMA_CCCFG 0x0004
77#define EDMA_QCHMAP 0x0200 /* 8 registers */
78#define EDMA_DMAQNUM 0x0240 /* 8 registers (4 on OMAP-L1xx) */
79#define EDMA_QDMAQNUM 0x0260
80#define EDMA_QUETCMAP 0x0280
81#define EDMA_QUEPRI 0x0284
82#define EDMA_EMR 0x0300 /* 64 bits */
83#define EDMA_EMCR 0x0308 /* 64 bits */
84#define EDMA_QEMR 0x0310
85#define EDMA_QEMCR 0x0314
86#define EDMA_CCERR 0x0318
87#define EDMA_CCERRCLR 0x031c
88#define EDMA_EEVAL 0x0320
89#define EDMA_DRAE 0x0340 /* 4 x 64 bits*/
90#define EDMA_QRAE 0x0380 /* 4 registers */
91#define EDMA_QUEEVTENTRY 0x0400 /* 2 x 16 registers */
92#define EDMA_QSTAT 0x0600 /* 2 registers */
93#define EDMA_QWMTHRA 0x0620
94#define EDMA_QWMTHRB 0x0624
95#define EDMA_CCSTAT 0x0640
96
97#define EDMA_M 0x1000 /* global channel registers */
98#define EDMA_ECR 0x1008
99#define EDMA_ECRH 0x100C
100#define EDMA_SHADOW0 0x2000 /* 4 regions shadowing global channels */
101#define EDMA_PARM 0x4000 /* 128 param entries */
102
103#define DAVINCI_DMA_3PCC_BASE 0x01C00000
104
105#define PARM_OFFSET(param_no) (EDMA_PARM + ((param_no) << 5))
106
107#define EDMA_MAX_DMACH 64
108#define EDMA_MAX_PARAMENTRY 512
109#define EDMA_MAX_EVQUE 2 /* FIXME too small */
110
111
112/*****************************************************************************/
113
114static void __iomem *edmacc_regs_base;
115
116static inline unsigned int edma_read(int offset)
117{
118 return (unsigned int)__raw_readl(edmacc_regs_base + offset);
119}
120
121static inline void edma_write(int offset, int val)
122{
123 __raw_writel(val, edmacc_regs_base + offset);
124}
125static inline void edma_modify(int offset, unsigned and, unsigned or)
126{
127 unsigned val = edma_read(offset);
128 val &= and;
129 val |= or;
130 edma_write(offset, val);
131}
132static inline void edma_and(int offset, unsigned and)
133{
134 unsigned val = edma_read(offset);
135 val &= and;
136 edma_write(offset, val);
137}
138static inline void edma_or(int offset, unsigned or)
139{
140 unsigned val = edma_read(offset);
141 val |= or;
142 edma_write(offset, val);
143}
144static inline unsigned int edma_read_array(int offset, int i)
145{
146 return edma_read(offset + (i << 2));
147}
148static inline void edma_write_array(int offset, int i, unsigned val)
149{
150 edma_write(offset + (i << 2), val);
151}
152static inline void edma_modify_array(int offset, int i,
153 unsigned and, unsigned or)
154{
155 edma_modify(offset + (i << 2), and, or);
156}
157static inline void edma_or_array(int offset, int i, unsigned or)
158{
159 edma_or(offset + (i << 2), or);
160}
161static inline void edma_or_array2(int offset, int i, int j, unsigned or)
162{
163 edma_or(offset + ((i*2 + j) << 2), or);
164}
165static inline void edma_write_array2(int offset, int i, int j, unsigned val)
166{
167 edma_write(offset + ((i*2 + j) << 2), val);
168}
169static inline unsigned int edma_shadow0_read(int offset)
170{
171 return edma_read(EDMA_SHADOW0 + offset);
172}
173static inline unsigned int edma_shadow0_read_array(int offset, int i)
174{
175 return edma_read(EDMA_SHADOW0 + offset + (i << 2));
176}
177static inline void edma_shadow0_write(int offset, unsigned val)
178{
179 edma_write(EDMA_SHADOW0 + offset, val);
180}
181static inline void edma_shadow0_write_array(int offset, int i, unsigned val)
182{
183 edma_write(EDMA_SHADOW0 + offset + (i << 2), val);
184}
185static inline unsigned int edma_parm_read(int offset, int param_no)
186{
187 return edma_read(EDMA_PARM + offset + (param_no << 5));
188}
189static inline void edma_parm_write(int offset, int param_no, unsigned val)
190{
191 edma_write(EDMA_PARM + offset + (param_no << 5), val);
192}
193static inline void edma_parm_modify(int offset, int param_no,
194 unsigned and, unsigned or)
195{
196 edma_modify(EDMA_PARM + offset + (param_no << 5), and, or);
197}
198static inline void edma_parm_and(int offset, int param_no, unsigned and)
199{
200 edma_and(EDMA_PARM + offset + (param_no << 5), and);
201}
202static inline void edma_parm_or(int offset, int param_no, unsigned or)
203{
204 edma_or(EDMA_PARM + offset + (param_no << 5), or);
205}
206
207/*****************************************************************************/
208
209/* actual number of DMA channels and slots on this silicon */
210static unsigned num_channels;
211static unsigned num_slots;
212
213static struct dma_interrupt_data {
214 void (*callback)(unsigned channel, unsigned short ch_status,
215 void *data);
216 void *data;
217} intr_data[EDMA_MAX_DMACH];
218
219/* The edma_inuse bit for each PaRAM slot is clear unless the
220 * channel is in use ... by ARM or DSP, for QDMA, or whatever.
221 */
222static DECLARE_BITMAP(edma_inuse, EDMA_MAX_PARAMENTRY);
223
224/* The edma_noevent bit for each channel is clear unless
225 * it doesn't trigger DMA events on this platform. It uses a
226 * bit of SOC-specific initialization code.
227 */
228static DECLARE_BITMAP(edma_noevent, EDMA_MAX_DMACH);
229
230/* dummy param set used to (re)initialize parameter RAM slots */
231static const struct edmacc_param dummy_paramset = {
232 .link_bcntrld = 0xffff,
233 .ccnt = 1,
234};
235
236static const int __initconst
237queue_tc_mapping[EDMA_MAX_EVQUE + 1][2] = {
238/* {event queue no, TC no} */
239 {0, 0},
240 {1, 1},
241 {-1, -1}
242};
243
244static const int __initconst
245queue_priority_mapping[EDMA_MAX_EVQUE + 1][2] = {
246 /* {event queue no, Priority} */
247 {0, 3},
248 {1, 7},
249 {-1, -1}
250};
251
252/*****************************************************************************/
253
254static void map_dmach_queue(unsigned ch_no, enum dma_event_q queue_no)
255{
256 int bit = (ch_no & 0x7) * 4;
257
258 /* default to low priority queue */
259 if (queue_no == EVENTQ_DEFAULT)
260 queue_no = EVENTQ_1;
261
262 queue_no &= 7;
263 edma_modify_array(EDMA_DMAQNUM, (ch_no >> 3),
264 ~(0x7 << bit), queue_no << bit);
265}
266
267static void __init map_queue_tc(int queue_no, int tc_no)
268{
269 int bit = queue_no * 4;
270 edma_modify(EDMA_QUETCMAP, ~(0x7 << bit), ((tc_no & 0x7) << bit));
271}
272
273static void __init assign_priority_to_queue(int queue_no, int priority)
274{
275 int bit = queue_no * 4;
276 edma_modify(EDMA_QUEPRI, ~(0x7 << bit), ((priority & 0x7) << bit));
277}
278
279static inline void
280setup_dma_interrupt(unsigned lch,
281 void (*callback)(unsigned channel, u16 ch_status, void *data),
282 void *data)
283{
284 if (!callback) {
285 edma_shadow0_write_array(SH_IECR, lch >> 5,
286 (1 << (lch & 0x1f)));
287 }
288
289 intr_data[lch].callback = callback;
290 intr_data[lch].data = data;
291
292 if (callback) {
293 edma_shadow0_write_array(SH_ICR, lch >> 5,
294 (1 << (lch & 0x1f)));
295 edma_shadow0_write_array(SH_IESR, lch >> 5,
296 (1 << (lch & 0x1f)));
297 }
298}
299
300/******************************************************************************
301 *
302 * DMA interrupt handler
303 *
304 *****************************************************************************/
305static irqreturn_t dma_irq_handler(int irq, void *data)
306{
307 int i;
308 unsigned int cnt = 0;
309
310 dev_dbg(data, "dma_irq_handler\n");
311
312 if ((edma_shadow0_read_array(SH_IPR, 0) == 0)
313 && (edma_shadow0_read_array(SH_IPR, 1) == 0))
314 return IRQ_NONE;
315
316 while (1) {
317 int j;
318 if (edma_shadow0_read_array(SH_IPR, 0))
319 j = 0;
320 else if (edma_shadow0_read_array(SH_IPR, 1))
321 j = 1;
322 else
323 break;
324 dev_dbg(data, "IPR%d %08x\n", j,
325 edma_shadow0_read_array(SH_IPR, j));
326 for (i = 0; i < 32; i++) {
327 int k = (j << 5) + i;
328 if (edma_shadow0_read_array(SH_IPR, j) & (1 << i)) {
329 /* Clear the corresponding IPR bits */
330 edma_shadow0_write_array(SH_ICR, j, (1 << i));
331 if (intr_data[k].callback) {
332 intr_data[k].callback(k, DMA_COMPLETE,
333 intr_data[k].data);
334 }
335 }
336 }
337 cnt++;
338 if (cnt > 10)
339 break;
340 }
341 edma_shadow0_write(SH_IEVAL, 1);
342 return IRQ_HANDLED;
343}
344
345/******************************************************************************
346 *
347 * DMA error interrupt handler
348 *
349 *****************************************************************************/
350static irqreturn_t dma_ccerr_handler(int irq, void *data)
351{
352 int i;
353 unsigned int cnt = 0;
354
355 dev_dbg(data, "dma_ccerr_handler\n");
356
357 if ((edma_read_array(EDMA_EMR, 0) == 0) &&
358 (edma_read_array(EDMA_EMR, 1) == 0) &&
359 (edma_read(EDMA_QEMR) == 0) && (edma_read(EDMA_CCERR) == 0))
360 return IRQ_NONE;
361
362 while (1) {
363 int j = -1;
364 if (edma_read_array(EDMA_EMR, 0))
365 j = 0;
366 else if (edma_read_array(EDMA_EMR, 1))
367 j = 1;
368 if (j >= 0) {
369 dev_dbg(data, "EMR%d %08x\n", j,
370 edma_read_array(EDMA_EMR, j));
371 for (i = 0; i < 32; i++) {
372 int k = (j << 5) + i;
373 if (edma_read_array(EDMA_EMR, j) & (1 << i)) {
374 /* Clear the corresponding EMR bits */
375 edma_write_array(EDMA_EMCR, j, 1 << i);
376 /* Clear any SER */
377 edma_shadow0_write_array(SH_SECR, j,
378 (1 << i));
379 if (intr_data[k].callback) {
380 intr_data[k].callback(k,
381 DMA_CC_ERROR,
382 intr_data
383 [k].data);
384 }
385 }
386 }
387 } else if (edma_read(EDMA_QEMR)) {
388 dev_dbg(data, "QEMR %02x\n",
389 edma_read(EDMA_QEMR));
390 for (i = 0; i < 8; i++) {
391 if (edma_read(EDMA_QEMR) & (1 << i)) {
392 /* Clear the corresponding IPR bits */
393 edma_write(EDMA_QEMCR, 1 << i);
394 edma_shadow0_write(SH_QSECR, (1 << i));
395
396 /* NOTE: not reported!! */
397 }
398 }
399 } else if (edma_read(EDMA_CCERR)) {
400 dev_dbg(data, "CCERR %08x\n",
401 edma_read(EDMA_CCERR));
402 /* FIXME: CCERR.BIT(16) ignored! much better
403 * to just write CCERRCLR with CCERR value...
404 */
405 for (i = 0; i < 8; i++) {
406 if (edma_read(EDMA_CCERR) & (1 << i)) {
407 /* Clear the corresponding IPR bits */
408 edma_write(EDMA_CCERRCLR, 1 << i);
409
410 /* NOTE: not reported!! */
411 }
412 }
413 }
414 if ((edma_read_array(EDMA_EMR, 0) == 0)
415 && (edma_read_array(EDMA_EMR, 1) == 0)
416 && (edma_read(EDMA_QEMR) == 0)
417 && (edma_read(EDMA_CCERR) == 0)) {
418 break;
419 }
420 cnt++;
421 if (cnt > 10)
422 break;
423 }
424 edma_write(EDMA_EEVAL, 1);
425 return IRQ_HANDLED;
426}
427
428/******************************************************************************
429 *
430 * Transfer controller error interrupt handlers
431 *
432 *****************************************************************************/
433
434#define tc_errs_handled false /* disabled as long as they're NOPs */
435
436static irqreturn_t dma_tc0err_handler(int irq, void *data)
437{
438 dev_dbg(data, "dma_tc0err_handler\n");
439 return IRQ_HANDLED;
440}
441
442static irqreturn_t dma_tc1err_handler(int irq, void *data)
443{
444 dev_dbg(data, "dma_tc1err_handler\n");
445 return IRQ_HANDLED;
446}
447
448/*-----------------------------------------------------------------------*/
449
450/* Resource alloc/free: dma channels, parameter RAM slots */
451
452/**
453 * edma_alloc_channel - allocate DMA channel and paired parameter RAM
454 * @channel: specific channel to allocate; negative for "any unmapped channel"
455 * @callback: optional; to be issued on DMA completion or errors
456 * @data: passed to callback
457 * @eventq_no: an EVENTQ_* constant, used to choose which Transfer
458 * Controller (TC) executes requests using this channel. Use
459 * EVENTQ_DEFAULT unless you really need a high priority queue.
460 *
461 * This allocates a DMA channel and its associated parameter RAM slot.
462 * The parameter RAM is initialized to hold a dummy transfer.
463 *
464 * Normal use is to pass a specific channel number as @channel, to make
465 * use of hardware events mapped to that channel. When the channel will
466 * be used only for software triggering or event chaining, channels not
467 * mapped to hardware events (or mapped to unused events) are preferable.
468 *
469 * DMA transfers start from a channel using edma_start(), or by
470 * chaining. When the transfer described in that channel's parameter RAM
471 * slot completes, that slot's data may be reloaded through a link.
472 *
473 * DMA errors are only reported to the @callback associated with the
474 * channel driving that transfer, but transfer completion callbacks can
475 * be sent to another channel under control of the TCC field in
476 * the option word of the transfer's parameter RAM set. Drivers must not
477 * use DMA transfer completion callbacks for channels they did not allocate.
478 * (The same applies to TCC codes used in transfer chaining.)
479 *
480 * Returns the number of the channel, else negative errno.
481 */
482int edma_alloc_channel(int channel,
483 void (*callback)(unsigned channel, u16 ch_status, void *data),
484 void *data,
485 enum dma_event_q eventq_no)
486{
487 if (channel < 0) {
488 channel = 0;
489 for (;;) {
490 channel = find_next_bit(edma_noevent,
491 num_channels, channel);
492 if (channel == num_channels)
493 return -ENOMEM;
494 if (!test_and_set_bit(channel, edma_inuse))
495 break;
496 channel++;
497 }
498 } else if (channel >= num_channels) {
499 return -EINVAL;
500 } else if (test_and_set_bit(channel, edma_inuse)) {
501 return -EBUSY;
502 }
503
504 /* ensure access through shadow region 0 */
505 edma_or_array2(EDMA_DRAE, 0, channel >> 5, 1 << (channel & 0x1f));
506
507 /* ensure no events are pending */
508 edma_stop(channel);
509 memcpy_toio(edmacc_regs_base + PARM_OFFSET(channel),
510 &dummy_paramset, PARM_SIZE);
511
512 if (callback)
513 setup_dma_interrupt(channel, callback, data);
514
515 map_dmach_queue(channel, eventq_no);
516
517 return channel;
518}
519EXPORT_SYMBOL(edma_alloc_channel);
520
521
522/**
523 * edma_free_channel - deallocate DMA channel
524 * @channel: dma channel returned from edma_alloc_channel()
525 *
526 * This deallocates the DMA channel and associated parameter RAM slot
527 * allocated by edma_alloc_channel().
528 *
529 * Callers are responsible for ensuring the channel is inactive, and
530 * will not be reactivated by linking, chaining, or software calls to
531 * edma_start().
532 */
533void edma_free_channel(unsigned channel)
534{
535 if (channel >= num_channels)
536 return;
537
538 setup_dma_interrupt(channel, NULL, NULL);
539 /* REVISIT should probably take out of shadow region 0 */
540
541 memcpy_toio(edmacc_regs_base + PARM_OFFSET(channel),
542 &dummy_paramset, PARM_SIZE);
543 clear_bit(channel, edma_inuse);
544}
545EXPORT_SYMBOL(edma_free_channel);
546
547/**
548 * edma_alloc_slot - allocate DMA parameter RAM
549 * @slot: specific slot to allocate; negative for "any unused slot"
550 *
551 * This allocates a parameter RAM slot, initializing it to hold a
552 * dummy transfer. Slots allocated using this routine have not been
553 * mapped to a hardware DMA channel, and will normally be used by
554 * linking to them from a slot associated with a DMA channel.
555 *
556 * Normal use is to pass EDMA_SLOT_ANY as the @slot, but specific
557 * slots may be allocated on behalf of DSP firmware.
558 *
559 * Returns the number of the slot, else negative errno.
560 */
561int edma_alloc_slot(int slot)
562{
563 if (slot < 0) {
564 slot = num_channels;
565 for (;;) {
566 slot = find_next_zero_bit(edma_inuse,
567 num_slots, slot);
568 if (slot == num_slots)
569 return -ENOMEM;
570 if (!test_and_set_bit(slot, edma_inuse))
571 break;
572 }
573 } else if (slot < num_channels || slot >= num_slots) {
574 return -EINVAL;
575 } else if (test_and_set_bit(slot, edma_inuse)) {
576 return -EBUSY;
577 }
578
579 memcpy_toio(edmacc_regs_base + PARM_OFFSET(slot),
580 &dummy_paramset, PARM_SIZE);
581
582 return slot;
583}
584EXPORT_SYMBOL(edma_alloc_slot);
585
586/**
587 * edma_free_slot - deallocate DMA parameter RAM
588 * @slot: parameter RAM slot returned from edma_alloc_slot()
589 *
590 * This deallocates the parameter RAM slot allocated by edma_alloc_slot().
591 * Callers are responsible for ensuring the slot is inactive, and will
592 * not be activated.
593 */
594void edma_free_slot(unsigned slot)
595{
596 if (slot < num_channels || slot >= num_slots)
597 return;
598
599 memcpy_toio(edmacc_regs_base + PARM_OFFSET(slot),
600 &dummy_paramset, PARM_SIZE);
601 clear_bit(slot, edma_inuse);
602}
603EXPORT_SYMBOL(edma_free_slot);
604
605/*-----------------------------------------------------------------------*/
606
607/* Parameter RAM operations (i) -- read/write partial slots */
608
609/**
610 * edma_set_src - set initial DMA source address in parameter RAM slot
611 * @slot: parameter RAM slot being configured
612 * @src_port: physical address of source (memory, controller FIFO, etc)
613 * @addressMode: INCR, except in very rare cases
614 * @fifoWidth: ignored unless @addressMode is FIFO, else specifies the
615 * width to use when addressing the fifo (e.g. W8BIT, W32BIT)
616 *
617 * Note that the source address is modified during the DMA transfer
618 * according to edma_set_src_index().
619 */
620void edma_set_src(unsigned slot, dma_addr_t src_port,
621 enum address_mode mode, enum fifo_width width)
622{
623 if (slot < num_slots) {
624 unsigned int i = edma_parm_read(PARM_OPT, slot);
625
626 if (mode) {
627 /* set SAM and program FWID */
628 i = (i & ~(EDMA_FWID)) | (SAM | ((width & 0x7) << 8));
629 } else {
630 /* clear SAM */
631 i &= ~SAM;
632 }
633 edma_parm_write(PARM_OPT, slot, i);
634
635 /* set the source port address
636 in source register of param structure */
637 edma_parm_write(PARM_SRC, slot, src_port);
638 }
639}
640EXPORT_SYMBOL(edma_set_src);
641
642/**
643 * edma_set_dest - set initial DMA destination address in parameter RAM slot
644 * @slot: parameter RAM slot being configured
645 * @dest_port: physical address of destination (memory, controller FIFO, etc)
646 * @addressMode: INCR, except in very rare cases
647 * @fifoWidth: ignored unless @addressMode is FIFO, else specifies the
648 * width to use when addressing the fifo (e.g. W8BIT, W32BIT)
649 *
650 * Note that the destination address is modified during the DMA transfer
651 * according to edma_set_dest_index().
652 */
653void edma_set_dest(unsigned slot, dma_addr_t dest_port,
654 enum address_mode mode, enum fifo_width width)
655{
656 if (slot < num_slots) {
657 unsigned int i = edma_parm_read(PARM_OPT, slot);
658
659 if (mode) {
660 /* set DAM and program FWID */
661 i = (i & ~(EDMA_FWID)) | (DAM | ((width & 0x7) << 8));
662 } else {
663 /* clear DAM */
664 i &= ~DAM;
665 }
666 edma_parm_write(PARM_OPT, slot, i);
667 /* set the destination port address
668 in dest register of param structure */
669 edma_parm_write(PARM_DST, slot, dest_port);
670 }
671}
672EXPORT_SYMBOL(edma_set_dest);
673
674/**
675 * edma_get_position - returns the current transfer points
676 * @slot: parameter RAM slot being examined
677 * @src: pointer to source port position
678 * @dst: pointer to destination port position
679 *
680 * Returns current source and destination addresses for a particular
681 * parameter RAM slot. Its channel should not be active when this is called.
682 */
683void edma_get_position(unsigned slot, dma_addr_t *src, dma_addr_t *dst)
684{
685 struct edmacc_param temp;
686
687 edma_read_slot(slot, &temp);
688 if (src != NULL)
689 *src = temp.src;
690 if (dst != NULL)
691 *dst = temp.dst;
692}
693EXPORT_SYMBOL(edma_get_position);
694
695/**
696 * edma_set_src_index - configure DMA source address indexing
697 * @slot: parameter RAM slot being configured
698 * @src_bidx: byte offset between source arrays in a frame
699 * @src_cidx: byte offset between source frames in a block
700 *
701 * Offsets are specified to support either contiguous or discontiguous
702 * memory transfers, or repeated access to a hardware register, as needed.
703 * When accessing hardware registers, both offsets are normally zero.
704 */
705void edma_set_src_index(unsigned slot, s16 src_bidx, s16 src_cidx)
706{
707 if (slot < num_slots) {
708 edma_parm_modify(PARM_SRC_DST_BIDX, slot,
709 0xffff0000, src_bidx);
710 edma_parm_modify(PARM_SRC_DST_CIDX, slot,
711 0xffff0000, src_cidx);
712 }
713}
714EXPORT_SYMBOL(edma_set_src_index);
715
716/**
717 * edma_set_dest_index - configure DMA destination address indexing
718 * @slot: parameter RAM slot being configured
719 * @dest_bidx: byte offset between destination arrays in a frame
720 * @dest_cidx: byte offset between destination frames in a block
721 *
722 * Offsets are specified to support either contiguous or discontiguous
723 * memory transfers, or repeated access to a hardware register, as needed.
724 * When accessing hardware registers, both offsets are normally zero.
725 */
726void edma_set_dest_index(unsigned slot, s16 dest_bidx, s16 dest_cidx)
727{
728 if (slot < num_slots) {
729 edma_parm_modify(PARM_SRC_DST_BIDX, slot,
730 0x0000ffff, dest_bidx << 16);
731 edma_parm_modify(PARM_SRC_DST_CIDX, slot,
732 0x0000ffff, dest_cidx << 16);
733 }
734}
735EXPORT_SYMBOL(edma_set_dest_index);
736
737/**
738 * edma_set_transfer_params - configure DMA transfer parameters
739 * @slot: parameter RAM slot being configured
740 * @acnt: how many bytes per array (at least one)
741 * @bcnt: how many arrays per frame (at least one)
742 * @ccnt: how many frames per block (at least one)
743 * @bcnt_rld: used only for A-Synchronized transfers; this specifies
744 * the value to reload into bcnt when it decrements to zero
745 * @sync_mode: ASYNC or ABSYNC
746 *
747 * See the EDMA3 documentation to understand how to configure and link
748 * transfers using the fields in PaRAM slots. If you are not doing it
749 * all at once with edma_write_slot(), you will use this routine
750 * plus two calls each for source and destination, setting the initial
751 * address and saying how to index that address.
752 *
753 * An example of an A-Synchronized transfer is a serial link using a
754 * single word shift register. In that case, @acnt would be equal to
755 * that word size; the serial controller issues a DMA synchronization
756 * event to transfer each word, and memory access by the DMA transfer
757 * controller will be word-at-a-time.
758 *
759 * An example of an AB-Synchronized transfer is a device using a FIFO.
760 * In that case, @acnt equals the FIFO width and @bcnt equals its depth.
761 * The controller with the FIFO issues DMA synchronization events when
762 * the FIFO threshold is reached, and the DMA transfer controller will
763 * transfer one frame to (or from) the FIFO. It will probably use
764 * efficient burst modes to access memory.
765 */
766void edma_set_transfer_params(unsigned slot,
767 u16 acnt, u16 bcnt, u16 ccnt,
768 u16 bcnt_rld, enum sync_dimension sync_mode)
769{
770 if (slot < num_slots) {
771 edma_parm_modify(PARM_LINK_BCNTRLD, slot,
772 0x0000ffff, bcnt_rld << 16);
773 if (sync_mode == ASYNC)
774 edma_parm_and(PARM_OPT, slot, ~SYNCDIM);
775 else
776 edma_parm_or(PARM_OPT, slot, SYNCDIM);
777 /* Set the acount, bcount, ccount registers */
778 edma_parm_write(PARM_A_B_CNT, slot, (bcnt << 16) | acnt);
779 edma_parm_write(PARM_CCNT, slot, ccnt);
780 }
781}
782EXPORT_SYMBOL(edma_set_transfer_params);
783
784/**
785 * edma_link - link one parameter RAM slot to another
786 * @from: parameter RAM slot originating the link
787 * @to: parameter RAM slot which is the link target
788 *
789 * The originating slot should not be part of any active DMA transfer.
790 */
791void edma_link(unsigned from, unsigned to)
792{
793 if (from >= num_slots)
794 return;
795 if (to >= num_slots)
796 return;
797 edma_parm_modify(PARM_LINK_BCNTRLD, from, 0xffff0000, PARM_OFFSET(to));
798}
799EXPORT_SYMBOL(edma_link);
800
801/**
802 * edma_unlink - cut link from one parameter RAM slot
803 * @from: parameter RAM slot originating the link
804 *
805 * The originating slot should not be part of any active DMA transfer.
806 * Its link is set to 0xffff.
807 */
808void edma_unlink(unsigned from)
809{
810 if (from >= num_slots)
811 return;
812 edma_parm_or(PARM_LINK_BCNTRLD, from, 0xffff);
813}
814EXPORT_SYMBOL(edma_unlink);
815
816/*-----------------------------------------------------------------------*/
817
818/* Parameter RAM operations (ii) -- read/write whole parameter sets */
819
820/**
821 * edma_write_slot - write parameter RAM data for slot
822 * @slot: number of parameter RAM slot being modified
823 * @param: data to be written into parameter RAM slot
824 *
825 * Use this to assign all parameters of a transfer at once. This
826 * allows more efficient setup of transfers than issuing multiple
827 * calls to set up those parameters in small pieces, and provides
828 * complete control over all transfer options.
829 */
830void edma_write_slot(unsigned slot, const struct edmacc_param *param)
831{
832 if (slot >= num_slots)
833 return;
834 memcpy_toio(edmacc_regs_base + PARM_OFFSET(slot), param, PARM_SIZE);
835}
836EXPORT_SYMBOL(edma_write_slot);
837
838/**
839 * edma_read_slot - read parameter RAM data from slot
840 * @slot: number of parameter RAM slot being copied
841 * @param: where to store copy of parameter RAM data
842 *
843 * Use this to read data from a parameter RAM slot, perhaps to
844 * save them as a template for later reuse.
845 */
846void edma_read_slot(unsigned slot, struct edmacc_param *param)
847{
848 if (slot >= num_slots)
849 return;
850 memcpy_fromio(param, edmacc_regs_base + PARM_OFFSET(slot), PARM_SIZE);
851}
852EXPORT_SYMBOL(edma_read_slot);
853
854/*-----------------------------------------------------------------------*/
855
856/* Various EDMA channel control operations */
857
858/**
859 * edma_pause - pause dma on a channel
860 * @channel: on which edma_start() has been called
861 *
862 * This temporarily disables EDMA hardware events on the specified channel,
863 * preventing them from triggering new transfers on its behalf
864 */
865void edma_pause(unsigned channel)
866{
867 if (channel < num_channels) {
868 unsigned int mask = (1 << (channel & 0x1f));
869
870 edma_shadow0_write_array(SH_EECR, channel >> 5, mask);
871 }
872}
873EXPORT_SYMBOL(edma_pause);
874
875/**
876 * edma_resume - resumes dma on a paused channel
877 * @channel: on which edma_pause() has been called
878 *
879 * This re-enables EDMA hardware events on the specified channel.
880 */
881void edma_resume(unsigned channel)
882{
883 if (channel < num_channels) {
884 unsigned int mask = (1 << (channel & 0x1f));
885
886 edma_shadow0_write_array(SH_EESR, channel >> 5, mask);
887 }
888}
889EXPORT_SYMBOL(edma_resume);
890
891/**
892 * edma_start - start dma on a channel
893 * @channel: channel being activated
894 *
895 * Channels with event associations will be triggered by their hardware
896 * events, and channels without such associations will be triggered by
897 * software. (At this writing there is no interface for using software
898 * triggers except with channels that don't support hardware triggers.)
899 *
900 * Returns zero on success, else negative errno.
901 */
902int edma_start(unsigned channel)
903{
904 if (channel < num_channels) {
905 int j = channel >> 5;
906 unsigned int mask = (1 << (channel & 0x1f));
907
908 /* EDMA channels without event association */
909 if (test_bit(channel, edma_noevent)) {
910 pr_debug("EDMA: ESR%d %08x\n", j,
911 edma_shadow0_read_array(SH_ESR, j));
912 edma_shadow0_write_array(SH_ESR, j, mask);
913 return 0;
914 }
915
916 /* EDMA channel with event association */
917 pr_debug("EDMA: ER%d %08x\n", j,
918 edma_shadow0_read_array(SH_ER, j));
919 /* Clear any pending error */
920 edma_write_array(EDMA_EMCR, j, mask);
921 /* Clear any SER */
922 edma_shadow0_write_array(SH_SECR, j, mask);
923 edma_shadow0_write_array(SH_EESR, j, mask);
924 pr_debug("EDMA: EER%d %08x\n", j,
925 edma_shadow0_read_array(SH_EER, j));
926 return 0;
927 }
928
929 return -EINVAL;
930}
931EXPORT_SYMBOL(edma_start);
932
933/**
934 * edma_stop - stops dma on the channel passed
935 * @channel: channel being deactivated
936 *
937 * When @lch is a channel, any active transfer is paused and
938 * all pending hardware events are cleared. The current transfer
939 * may not be resumed, and the channel's Parameter RAM should be
940 * reinitialized before being reused.
941 */
942void edma_stop(unsigned channel)
943{
944 if (channel < num_channels) {
945 int j = channel >> 5;
946 unsigned int mask = (1 << (channel & 0x1f));
947
948 edma_shadow0_write_array(SH_EECR, j, mask);
949 edma_shadow0_write_array(SH_ECR, j, mask);
950 edma_shadow0_write_array(SH_SECR, j, mask);
951 edma_write_array(EDMA_EMCR, j, mask);
952
953 pr_debug("EDMA: EER%d %08x\n", j,
954 edma_shadow0_read_array(SH_EER, j));
955
956 /* REVISIT: consider guarding against inappropriate event
957 * chaining by overwriting with dummy_paramset.
958 */
959 }
960}
961EXPORT_SYMBOL(edma_stop);
962
963/******************************************************************************
964 *
965 * It cleans ParamEntry qand bring back EDMA to initial state if media has
966 * been removed before EDMA has finished.It is usedful for removable media.
967 * Arguments:
968 * ch_no - channel no
969 *
970 * Return: zero on success, or corresponding error no on failure
971 *
972 * FIXME this should not be needed ... edma_stop() should suffice.
973 *
974 *****************************************************************************/
975
976void edma_clean_channel(unsigned channel)
977{
978 if (channel < num_channels) {
979 int j = (channel >> 5);
980 unsigned int mask = 1 << (channel & 0x1f);
981
982 pr_debug("EDMA: EMR%d %08x\n", j,
983 edma_read_array(EDMA_EMR, j));
984 edma_shadow0_write_array(SH_ECR, j, mask);
985 /* Clear the corresponding EMR bits */
986 edma_write_array(EDMA_EMCR, j, mask);
987 /* Clear any SER */
988 edma_shadow0_write_array(SH_SECR, j, mask);
989 edma_write(EDMA_CCERRCLR, (1 << 16) | 0x3);
990 }
991}
992EXPORT_SYMBOL(edma_clean_channel);
993
994/*
995 * edma_clear_event - clear an outstanding event on the DMA channel
996 * Arguments:
997 * channel - channel number
998 */
999void edma_clear_event(unsigned channel)
1000{
1001 if (channel >= num_channels)
1002 return;
1003 if (channel < 32)
1004 edma_write(EDMA_ECR, 1 << channel);
1005 else
1006 edma_write(EDMA_ECRH, 1 << (channel - 32));
1007}
1008EXPORT_SYMBOL(edma_clear_event);
1009
1010/*-----------------------------------------------------------------------*/
1011
1012static int __init edma_probe(struct platform_device *pdev)
1013{
1014 struct edma_soc_info *info = pdev->dev.platform_data;
1015 int i;
1016 int status;
1017 const s8 *noevent;
1018 int irq = 0, err_irq = 0;
1019 struct resource *r;
1020 resource_size_t len;
1021
1022 if (!info)
1023 return -ENODEV;
1024
1025 r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "edma_cc");
1026 if (!r)
1027 return -ENODEV;
1028
1029 len = r->end - r->start + 1;
1030
1031 r = request_mem_region(r->start, len, r->name);
1032 if (!r)
1033 return -EBUSY;
1034
1035 edmacc_regs_base = ioremap(r->start, len);
1036 if (!edmacc_regs_base) {
1037 status = -EBUSY;
1038 goto fail1;
1039 }
1040
1041 num_channels = min_t(unsigned, info->n_channel, EDMA_MAX_DMACH);
1042 num_slots = min_t(unsigned, info->n_slot, EDMA_MAX_PARAMENTRY);
1043
1044 dev_dbg(&pdev->dev, "DMA REG BASE ADDR=%p\n", edmacc_regs_base);
1045
1046 for (i = 0; i < num_slots; i++)
1047 memcpy_toio(edmacc_regs_base + PARM_OFFSET(i),
1048 &dummy_paramset, PARM_SIZE);
1049
1050 noevent = info->noevent;
1051 if (noevent) {
1052 while (*noevent != -1)
1053 set_bit(*noevent++, edma_noevent);
1054 }
1055
1056 irq = platform_get_irq(pdev, 0);
1057 status = request_irq(irq, dma_irq_handler, 0, "edma", &pdev->dev);
1058 if (status < 0) {
1059 dev_dbg(&pdev->dev, "request_irq %d failed --> %d\n",
1060 irq, status);
1061 goto fail;
1062 }
1063
1064 err_irq = platform_get_irq(pdev, 1);
1065 status = request_irq(err_irq, dma_ccerr_handler, 0,
1066 "edma_error", &pdev->dev);
1067 if (status < 0) {
1068 dev_dbg(&pdev->dev, "request_irq %d failed --> %d\n",
1069 err_irq, status);
1070 goto fail;
1071 }
1072
1073 if (tc_errs_handled) {
1074 status = request_irq(IRQ_TCERRINT0, dma_tc0err_handler, 0,
1075 "edma_tc0", &pdev->dev);
1076 if (status < 0) {
1077 dev_dbg(&pdev->dev, "request_irq %d failed --> %d\n",
1078 IRQ_TCERRINT0, status);
1079 return status;
1080 }
1081 status = request_irq(IRQ_TCERRINT, dma_tc1err_handler, 0,
1082 "edma_tc1", &pdev->dev);
1083 if (status < 0) {
1084 dev_dbg(&pdev->dev, "request_irq %d --> %d\n",
1085 IRQ_TCERRINT, status);
1086 return status;
1087 }
1088 }
1089
1090 /* Everything lives on transfer controller 1 until otherwise specified.
1091 * This way, long transfers on the low priority queue
1092 * started by the codec engine will not cause audio defects.
1093 */
1094 for (i = 0; i < num_channels; i++)
1095 map_dmach_queue(i, EVENTQ_1);
1096
1097 /* Event queue to TC mapping */
1098 for (i = 0; queue_tc_mapping[i][0] != -1; i++)
1099 map_queue_tc(queue_tc_mapping[i][0], queue_tc_mapping[i][1]);
1100
1101 /* Event queue priority mapping */
1102 for (i = 0; queue_priority_mapping[i][0] != -1; i++)
1103 assign_priority_to_queue(queue_priority_mapping[i][0],
1104 queue_priority_mapping[i][1]);
1105
1106 for (i = 0; i < info->n_region; i++) {
1107 edma_write_array2(EDMA_DRAE, i, 0, 0x0);
1108 edma_write_array2(EDMA_DRAE, i, 1, 0x0);
1109 edma_write_array(EDMA_QRAE, i, 0x0);
1110 }
1111
1112 return 0;
1113
1114fail:
1115 if (err_irq)
1116 free_irq(err_irq, NULL);
1117 if (irq)
1118 free_irq(irq, NULL);
1119 iounmap(edmacc_regs_base);
1120fail1:
1121 release_mem_region(r->start, len);
1122 return status;
1123}
1124
1125
1126static struct platform_driver edma_driver = {
1127 .driver.name = "edma",
1128};
1129
1130static int __init edma_init(void)
1131{
1132 return platform_driver_probe(&edma_driver, edma_probe);
1133}
1134arch_initcall(edma_init);
1135
diff --git a/arch/arm/mach-davinci/gpio.c b/arch/arm/mach-davinci/gpio.c
index b49e9d092aa..1aba41c6351 100644
--- a/arch/arm/mach-davinci/gpio.c
+++ b/arch/arm/mach-davinci/gpio.c
@@ -20,6 +20,7 @@
20#include <linux/irq.h> 20#include <linux/irq.h>
21#include <linux/bitops.h> 21#include <linux/bitops.h>
22 22
23#include <mach/cputype.h>
23#include <mach/irqs.h> 24#include <mach/irqs.h>
24#include <mach/hardware.h> 25#include <mach/hardware.h>
25#include <mach/gpio.h> 26#include <mach/gpio.h>
@@ -36,9 +37,10 @@ struct davinci_gpio {
36 37
37static struct davinci_gpio chips[DIV_ROUND_UP(DAVINCI_N_GPIO, 32)]; 38static struct davinci_gpio chips[DIV_ROUND_UP(DAVINCI_N_GPIO, 32)];
38 39
40static unsigned __initdata ngpio;
39 41
40/* create a non-inlined version */ 42/* create a non-inlined version */
41static struct gpio_controller *__iomem __init gpio2controller(unsigned gpio) 43static struct gpio_controller __iomem * __init gpio2controller(unsigned gpio)
42{ 44{
43 return __gpio_to_controller(gpio); 45 return __gpio_to_controller(gpio);
44} 46}
@@ -114,9 +116,30 @@ static int __init davinci_gpio_setup(void)
114{ 116{
115 int i, base; 117 int i, base;
116 118
117 for (i = 0, base = 0; 119 /* The gpio banks conceptually expose a segmented bitmap,
118 i < ARRAY_SIZE(chips); 120 * and "ngpio" is one more than the largest zero-based
119 i++, base += 32) { 121 * bit index that's valid.
122 */
123 if (cpu_is_davinci_dm355()) { /* or dm335() */
124 ngpio = 104;
125 } else if (cpu_is_davinci_dm644x()) { /* or dm337() */
126 ngpio = 71;
127 } else if (cpu_is_davinci_dm646x()) {
128 /* NOTE: each bank has several "reserved" bits,
129 * unusable as GPIOs. Only 33 of the GPIO numbers
130 * are usable, and we're not rejecting the others.
131 */
132 ngpio = 43;
133 } else {
134 /* if cpu_is_davinci_dm643x() ngpio = 111 */
135 pr_err("GPIO setup: how many GPIOs?\n");
136 return -EINVAL;
137 }
138
139 if (WARN_ON(DAVINCI_N_GPIO < ngpio))
140 ngpio = DAVINCI_N_GPIO;
141
142 for (i = 0, base = 0; base < ngpio; i++, base += 32) {
120 chips[i].chip.label = "DaVinci"; 143 chips[i].chip.label = "DaVinci";
121 144
122 chips[i].chip.direction_input = davinci_direction_in; 145 chips[i].chip.direction_input = davinci_direction_in;
@@ -125,7 +148,7 @@ static int __init davinci_gpio_setup(void)
125 chips[i].chip.set = davinci_gpio_set; 148 chips[i].chip.set = davinci_gpio_set;
126 149
127 chips[i].chip.base = base; 150 chips[i].chip.base = base;
128 chips[i].chip.ngpio = DAVINCI_N_GPIO - base; 151 chips[i].chip.ngpio = ngpio - base;
129 if (chips[i].chip.ngpio > 32) 152 if (chips[i].chip.ngpio > 32)
130 chips[i].chip.ngpio = 32; 153 chips[i].chip.ngpio = 32;
131 154
@@ -143,11 +166,11 @@ pure_initcall(davinci_gpio_setup);
143 * We expect irqs will normally be set up as input pins, but they can also be 166 * We expect irqs will normally be set up as input pins, but they can also be
144 * used as output pins ... which is convenient for testing. 167 * used as output pins ... which is convenient for testing.
145 * 168 *
146 * NOTE: GPIO0..GPIO7 also have direct INTC hookups, which work in addition 169 * NOTE: The first few GPIOs also have direct INTC hookups in addition
147 * to their GPIOBNK0 irq (but with a bit less overhead). But we don't have 170 * to their GPIOBNK0 irq, with a bit less overhead but less flexibility
148 * a good way to hook those up ... 171 * on triggering (e.g. no edge options). We don't try to use those.
149 * 172 *
150 * All those INTC hookups (GPIO0..GPIO7 plus five IRQ banks) can also 173 * All those INTC hookups (direct, plus several IRQ banks) can also
151 * serve as EDMA event triggers. 174 * serve as EDMA event triggers.
152 */ 175 */
153 176
@@ -235,29 +258,42 @@ gpio_irq_handler(unsigned irq, struct irq_desc *desc)
235} 258}
236 259
237/* 260/*
238 * NOTE: for suspend/resume, probably best to make a sysdev (and class) 261 * NOTE: for suspend/resume, probably best to make a platform_device with
239 * with its suspend/resume calls hooking into the results of the set_wake() 262 * suspend_late/resume_resume calls hooking into results of the set_wake()
240 * calls ... so if no gpios are wakeup events the clock can be disabled, 263 * calls ... so if no gpios are wakeup events the clock can be disabled,
241 * with outputs left at previously set levels, and so that VDD3P3V.IOPWDN0 264 * with outputs left at previously set levels, and so that VDD3P3V.IOPWDN0
242 * can be set appropriately for GPIOV33 pins. 265 * (dm6446) can be set appropriately for GPIOV33 pins.
243 */ 266 */
244 267
245static int __init davinci_gpio_irq_setup(void) 268static int __init davinci_gpio_irq_setup(void)
246{ 269{
247 unsigned gpio, irq, bank; 270 unsigned gpio, irq, bank;
271 unsigned bank_irq;
248 struct clk *clk; 272 struct clk *clk;
273 u32 binten = 0;
274
275 if (cpu_is_davinci_dm355()) { /* or dm335() */
276 bank_irq = IRQ_DM355_GPIOBNK0;
277 } else if (cpu_is_davinci_dm644x()) {
278 bank_irq = IRQ_GPIOBNK0;
279 } else if (cpu_is_davinci_dm646x()) {
280 bank_irq = IRQ_DM646X_GPIOBNK0;
281 } else {
282 printk(KERN_ERR "Don't know first GPIO bank IRQ.\n");
283 return -EINVAL;
284 }
249 285
250 clk = clk_get(NULL, "gpio"); 286 clk = clk_get(NULL, "gpio");
251 if (IS_ERR(clk)) { 287 if (IS_ERR(clk)) {
252 printk(KERN_ERR "Error %ld getting gpio clock?\n", 288 printk(KERN_ERR "Error %ld getting gpio clock?\n",
253 PTR_ERR(clk)); 289 PTR_ERR(clk));
254 return 0; 290 return PTR_ERR(clk);
255 } 291 }
256
257 clk_enable(clk); 292 clk_enable(clk);
258 293
259 for (gpio = 0, irq = gpio_to_irq(0), bank = IRQ_GPIOBNK0; 294 for (gpio = 0, irq = gpio_to_irq(0), bank = 0;
260 gpio < DAVINCI_N_GPIO; bank++) { 295 gpio < ngpio;
296 bank++, bank_irq++) {
261 struct gpio_controller *__iomem g = gpio2controller(gpio); 297 struct gpio_controller *__iomem g = gpio2controller(gpio);
262 unsigned i; 298 unsigned i;
263 299
@@ -265,28 +301,28 @@ static int __init davinci_gpio_irq_setup(void)
265 __raw_writel(~0, &g->clr_rising); 301 __raw_writel(~0, &g->clr_rising);
266 302
267 /* set up all irqs in this bank */ 303 /* set up all irqs in this bank */
268 set_irq_chained_handler(bank, gpio_irq_handler); 304 set_irq_chained_handler(bank_irq, gpio_irq_handler);
269 set_irq_chip_data(bank, g); 305 set_irq_chip_data(bank_irq, g);
270 set_irq_data(bank, (void *)irq); 306 set_irq_data(bank_irq, (void *)irq);
271 307
272 for (i = 0; i < 16 && gpio < DAVINCI_N_GPIO; 308 for (i = 0; i < 16 && gpio < ngpio; i++, irq++, gpio++) {
273 i++, irq++, gpio++) {
274 set_irq_chip(irq, &gpio_irqchip); 309 set_irq_chip(irq, &gpio_irqchip);
275 set_irq_chip_data(irq, g); 310 set_irq_chip_data(irq, g);
276 set_irq_handler(irq, handle_simple_irq); 311 set_irq_handler(irq, handle_simple_irq);
277 set_irq_flags(irq, IRQF_VALID); 312 set_irq_flags(irq, IRQF_VALID);
278 } 313 }
314
315 binten |= BIT(bank);
279 } 316 }
280 317
281 /* BINTEN -- per-bank interrupt enable. genirq would also let these 318 /* BINTEN -- per-bank interrupt enable. genirq would also let these
282 * bits be set/cleared dynamically. 319 * bits be set/cleared dynamically.
283 */ 320 */
284 __raw_writel(0x1f, (void *__iomem) 321 __raw_writel(binten, (void *__iomem)
285 IO_ADDRESS(DAVINCI_GPIO_BASE + 0x08)); 322 IO_ADDRESS(DAVINCI_GPIO_BASE + 0x08));
286 323
287 printk(KERN_INFO "DaVinci: %d gpio irqs\n", irq - gpio_to_irq(0)); 324 printk(KERN_INFO "DaVinci: %d gpio irqs\n", irq - gpio_to_irq(0));
288 325
289 return 0; 326 return 0;
290} 327}
291
292arch_initcall(davinci_gpio_irq_setup); 328arch_initcall(davinci_gpio_irq_setup);
diff --git a/arch/arm/mach-davinci/id.c b/arch/arm/mach-davinci/id.c
index bf067d60491..018b994cd79 100644
--- a/arch/arm/mach-davinci/id.c
+++ b/arch/arm/mach-davinci/id.c
@@ -15,7 +15,9 @@
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/io.h> 16#include <linux/io.h>
17 17
18#define JTAG_ID_BASE 0x01c40028 18#define JTAG_ID_BASE IO_ADDRESS(0x01c40028)
19
20static unsigned int davinci_revision;
19 21
20struct davinci_id { 22struct davinci_id {
21 u8 variant; /* JTAG ID bits 31:28 */ 23 u8 variant; /* JTAG ID bits 31:28 */
@@ -33,6 +35,20 @@ static struct davinci_id davinci_ids[] __initdata = {
33 .manufacturer = 0x017, 35 .manufacturer = 0x017,
34 .type = 0x64460000, 36 .type = 0x64460000,
35 }, 37 },
38 {
39 /* DM646X */
40 .part_no = 0xb770,
41 .variant = 0x0,
42 .manufacturer = 0x017,
43 .type = 0x64670000,
44 },
45 {
46 /* DM355 */
47 .part_no = 0xb73b,
48 .variant = 0x0,
49 .manufacturer = 0x00f,
50 .type = 0x03550000,
51 },
36}; 52};
37 53
38/* 54/*
@@ -42,7 +58,7 @@ static u16 __init davinci_get_part_no(void)
42{ 58{
43 u32 dev_id, part_no; 59 u32 dev_id, part_no;
44 60
45 dev_id = davinci_readl(JTAG_ID_BASE); 61 dev_id = __raw_readl(JTAG_ID_BASE);
46 62
47 part_no = ((dev_id >> 12) & 0xffff); 63 part_no = ((dev_id >> 12) & 0xffff);
48 64
@@ -56,13 +72,19 @@ static u8 __init davinci_get_variant(void)
56{ 72{
57 u32 variant; 73 u32 variant;
58 74
59 variant = davinci_readl(JTAG_ID_BASE); 75 variant = __raw_readl(JTAG_ID_BASE);
60 76
61 variant = (variant >> 28) & 0xf; 77 variant = (variant >> 28) & 0xf;
62 78
63 return variant; 79 return variant;
64} 80}
65 81
82unsigned int davinci_rev(void)
83{
84 return davinci_revision >> 16;
85}
86EXPORT_SYMBOL(davinci_rev);
87
66void __init davinci_check_revision(void) 88void __init davinci_check_revision(void)
67{ 89{
68 int i; 90 int i;
@@ -75,7 +97,7 @@ void __init davinci_check_revision(void)
75 /* First check only the major version in a safe way */ 97 /* First check only the major version in a safe way */
76 for (i = 0; i < ARRAY_SIZE(davinci_ids); i++) { 98 for (i = 0; i < ARRAY_SIZE(davinci_ids); i++) {
77 if (part_no == (davinci_ids[i].part_no)) { 99 if (part_no == (davinci_ids[i].part_no)) {
78 system_rev = davinci_ids[i].type; 100 davinci_revision = davinci_ids[i].type;
79 break; 101 break;
80 } 102 }
81 } 103 }
@@ -84,10 +106,11 @@ void __init davinci_check_revision(void)
84 for (i = 0; i < ARRAY_SIZE(davinci_ids); i++) { 106 for (i = 0; i < ARRAY_SIZE(davinci_ids); i++) {
85 if (part_no == davinci_ids[i].part_no && 107 if (part_no == davinci_ids[i].part_no &&
86 variant == davinci_ids[i].variant) { 108 variant == davinci_ids[i].variant) {
87 system_rev = davinci_ids[i].type; 109 davinci_revision = davinci_ids[i].type;
88 break; 110 break;
89 } 111 }
90 } 112 }
91 113
92 printk("DaVinci DM%04x variant 0x%x\n", system_rev >> 16, variant); 114 printk(KERN_INFO "DaVinci DM%04x variant 0x%x\n",
115 davinci_rev(), variant);
93} 116}
diff --git a/arch/arm/mach-davinci/include/mach/board-dm6446evm.h b/arch/arm/mach-davinci/include/mach/board-dm6446evm.h
new file mode 100644
index 00000000000..3216f21c123
--- /dev/null
+++ b/arch/arm/mach-davinci/include/mach/board-dm6446evm.h
@@ -0,0 +1,20 @@
1/*
2 * DaVinci DM6446 EVM board specific headers
3 *
4 * Author: Kevin Hilman, Deep Root Systems, LLC
5 *
6 * 2007 (c) Deep Root Systems, LLC. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or ifndef.
10 */
11
12#ifndef _MACH_DAVINCI_DM6446EVM_H
13#define _MACH_DAVINCI_DM6446EVM_H
14
15#include <linux/types.h>
16
17int dm6446evm_eeprom_read(char *buf, off_t off, size_t count);
18int dm6446evm_eeprom_write(char *buf, off_t off, size_t count);
19
20#endif
diff --git a/arch/arm/mach-davinci/include/mach/clkdev.h b/arch/arm/mach-davinci/include/mach/clkdev.h
new file mode 100644
index 00000000000..730c49d1ebd
--- /dev/null
+++ b/arch/arm/mach-davinci/include/mach/clkdev.h
@@ -0,0 +1,13 @@
1#ifndef __MACH_CLKDEV_H
2#define __MACH_CLKDEV_H
3
4static inline int __clk_get(struct clk *clk)
5{
6 return 1;
7}
8
9static inline void __clk_put(struct clk *clk)
10{
11}
12
13#endif
diff --git a/arch/arm/mach-davinci/include/mach/clock.h b/arch/arm/mach-davinci/include/mach/clock.h
index 38bdd49bc18..a3b04021987 100644
--- a/arch/arm/mach-davinci/include/mach/clock.h
+++ b/arch/arm/mach-davinci/include/mach/clock.h
@@ -17,6 +17,5 @@ struct clk;
17 17
18extern int clk_register(struct clk *clk); 18extern int clk_register(struct clk *clk);
19extern void clk_unregister(struct clk *clk); 19extern void clk_unregister(struct clk *clk);
20extern int davinci_clk_init(void);
21 20
22#endif 21#endif
diff --git a/arch/arm/mach-davinci/include/mach/common.h b/arch/arm/mach-davinci/include/mach/common.h
index 4b522e5c70e..19177097625 100644
--- a/arch/arm/mach-davinci/include/mach/common.h
+++ b/arch/arm/mach-davinci/include/mach/common.h
@@ -16,6 +16,12 @@ struct sys_timer;
16 16
17extern struct sys_timer davinci_timer; 17extern struct sys_timer davinci_timer;
18 18
19extern void davinci_irq_init(void);
20extern void davinci_map_common_io(void);
21
22/* parameters describe VBUS sourcing for host mode */
23extern void setup_usb(unsigned mA, unsigned potpgt_msec);
24
19/* parameters describe VBUS sourcing for host mode */ 25/* parameters describe VBUS sourcing for host mode */
20extern void setup_usb(unsigned mA, unsigned potpgt_msec); 26extern void setup_usb(unsigned mA, unsigned potpgt_msec);
21 27
diff --git a/arch/arm/mach-davinci/include/mach/cputype.h b/arch/arm/mach-davinci/include/mach/cputype.h
new file mode 100644
index 00000000000..27cfb1b3a66
--- /dev/null
+++ b/arch/arm/mach-davinci/include/mach/cputype.h
@@ -0,0 +1,49 @@
1/*
2 * DaVinci CPU type detection
3 *
4 * Author: Kevin Hilman, Deep Root Systems, LLC
5 *
6 * Defines the cpu_is_*() macros for runtime detection of DaVinci
7 * device type. In addtion, if support for a given device is not
8 * compiled in to the kernel, the macros return 0 so that
9 * resulting code can be optimized out.
10 *
11 * 2009 (c) Deep Root Systems, LLC. This file is licensed under
12 * the terms of the GNU General Public License version 2. This program
13 * is licensed "as is" without any warranty of any kind, whether express
14 * or implied.
15 */
16#ifndef _ASM_ARCH_CPU_H
17#define _ASM_ARCH_CPU_H
18
19extern unsigned int davinci_rev(void);
20
21#define IS_DAVINCI_CPU(type, id) \
22static inline int is_davinci_dm ##type(void) \
23{ \
24 return (davinci_rev() == (id)) ? 1 : 0; \
25}
26
27IS_DAVINCI_CPU(644x, 0x6446)
28IS_DAVINCI_CPU(646x, 0x6467)
29IS_DAVINCI_CPU(355, 0x355)
30
31#ifdef CONFIG_ARCH_DAVINCI_DM644x
32#define cpu_is_davinci_dm644x() is_davinci_dm644x()
33#else
34#define cpu_is_davinci_dm644x() 0
35#endif
36
37#ifdef CONFIG_ARCH_DAVINCI_DM646x
38#define cpu_is_davinci_dm646x() is_davinci_dm646x()
39#else
40#define cpu_is_davinci_dm646x() 0
41#endif
42
43#ifdef CONFIG_ARCH_DAVINCI_DM355
44#define cpu_is_davinci_dm355() is_davinci_dm355()
45#else
46#define cpu_is_davinci_dm355() 0
47#endif
48
49#endif
diff --git a/arch/arm/mach-davinci/include/mach/dm644x.h b/arch/arm/mach-davinci/include/mach/dm644x.h
new file mode 100644
index 00000000000..3dcb9f4e58b
--- /dev/null
+++ b/arch/arm/mach-davinci/include/mach/dm644x.h
@@ -0,0 +1,37 @@
1/*
2 * This file contains the processor specific definitions
3 * of the TI DM644x.
4 *
5 * Copyright (C) 2008 Texas Instruments.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 */
22#ifndef __ASM_ARCH_DM644X_H
23#define __ASM_ARCH_DM644X_H
24
25#include <linux/platform_device.h>
26#include <mach/hardware.h>
27
28#define DM644X_EMAC_BASE (0x01C80000)
29#define DM644X_EMAC_CNTRL_OFFSET (0x0000)
30#define DM644X_EMAC_CNTRL_MOD_OFFSET (0x1000)
31#define DM644X_EMAC_CNTRL_RAM_OFFSET (0x2000)
32#define DM644X_EMAC_MDIO_OFFSET (0x4000)
33#define DM644X_EMAC_CNTRL_RAM_SIZE (0x2000)
34
35void __init dm644x_init(void);
36
37#endif /* __ASM_ARCH_DM644X_H */
diff --git a/arch/arm/mach-davinci/include/mach/edma.h b/arch/arm/mach-davinci/include/mach/edma.h
new file mode 100644
index 00000000000..f6fc5396daf
--- /dev/null
+++ b/arch/arm/mach-davinci/include/mach/edma.h
@@ -0,0 +1,228 @@
1/*
2 * TI DAVINCI dma definitions
3 *
4 * Copyright (C) 2006-2009 Texas Instruments.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
12 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
14 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
15 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
16 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
17 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
18 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
19 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
20 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21 *
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 675 Mass Ave, Cambridge, MA 02139, USA.
25 *
26 */
27
28/*
29 * This EDMA3 programming framework exposes two basic kinds of resource:
30 *
31 * Channel Triggers transfers, usually from a hardware event but
32 * also manually or by "chaining" from DMA completions.
33 * Each channel is coupled to a Parameter RAM (PaRAM) slot.
34 *
35 * Slot Each PaRAM slot holds a DMA transfer descriptor (PaRAM
36 * "set"), source and destination addresses, a link to a
37 * next PaRAM slot (if any), options for the transfer, and
38 * instructions for updating those addresses. There are
39 * more than twice as many slots as event channels.
40 *
41 * Each PaRAM set describes a sequence of transfers, either for one large
42 * buffer or for several discontiguous smaller buffers. An EDMA transfer
43 * is driven only from a channel, which performs the transfers specified
44 * in its PaRAM slot until there are no more transfers. When that last
45 * transfer completes, the "link" field may be used to reload the channel's
46 * PaRAM slot with a new transfer descriptor.
47 *
48 * The EDMA Channel Controller (CC) maps requests from channels into physical
49 * Transfer Controller (TC) requests when the channel triggers (by hardware
50 * or software events, or by chaining). The two physical DMA channels provided
51 * by the TCs are thus shared by many logical channels.
52 *
53 * DaVinci hardware also has a "QDMA" mechanism which is not currently
54 * supported through this interface. (DSP firmware uses it though.)
55 */
56
57#ifndef EDMA_H_
58#define EDMA_H_
59
60/* PaRAM slots are laid out like this */
61struct edmacc_param {
62 unsigned int opt;
63 unsigned int src;
64 unsigned int a_b_cnt;
65 unsigned int dst;
66 unsigned int src_dst_bidx;
67 unsigned int link_bcntrld;
68 unsigned int src_dst_cidx;
69 unsigned int ccnt;
70};
71
72#define CCINT0_INTERRUPT 16
73#define CCERRINT_INTERRUPT 17
74#define TCERRINT0_INTERRUPT 18
75#define TCERRINT1_INTERRUPT 19
76
77/* fields in edmacc_param.opt */
78#define SAM BIT(0)
79#define DAM BIT(1)
80#define SYNCDIM BIT(2)
81#define STATIC BIT(3)
82#define EDMA_FWID (0x07 << 8)
83#define TCCMODE BIT(11)
84#define EDMA_TCC(t) ((t) << 12)
85#define TCINTEN BIT(20)
86#define ITCINTEN BIT(21)
87#define TCCHEN BIT(22)
88#define ITCCHEN BIT(23)
89
90#define TRWORD (0x7<<2)
91#define PAENTRY (0x1ff<<5)
92
93/* Drivers should avoid using these symbolic names for dm644x
94 * channels, and use platform_device IORESOURCE_DMA resources
95 * instead. (Other DaVinci chips have different peripherals
96 * and thus have different DMA channel mappings.)
97 */
98#define DAVINCI_DMA_MCBSP_TX 2
99#define DAVINCI_DMA_MCBSP_RX 3
100#define DAVINCI_DMA_VPSS_HIST 4
101#define DAVINCI_DMA_VPSS_H3A 5
102#define DAVINCI_DMA_VPSS_PRVU 6
103#define DAVINCI_DMA_VPSS_RSZ 7
104#define DAVINCI_DMA_IMCOP_IMXINT 8
105#define DAVINCI_DMA_IMCOP_VLCDINT 9
106#define DAVINCI_DMA_IMCO_PASQINT 10
107#define DAVINCI_DMA_IMCOP_DSQINT 11
108#define DAVINCI_DMA_SPI_SPIX 16
109#define DAVINCI_DMA_SPI_SPIR 17
110#define DAVINCI_DMA_UART0_URXEVT0 18
111#define DAVINCI_DMA_UART0_UTXEVT0 19
112#define DAVINCI_DMA_UART1_URXEVT1 20
113#define DAVINCI_DMA_UART1_UTXEVT1 21
114#define DAVINCI_DMA_UART2_URXEVT2 22
115#define DAVINCI_DMA_UART2_UTXEVT2 23
116#define DAVINCI_DMA_MEMSTK_MSEVT 24
117#define DAVINCI_DMA_MMCRXEVT 26
118#define DAVINCI_DMA_MMCTXEVT 27
119#define DAVINCI_DMA_I2C_ICREVT 28
120#define DAVINCI_DMA_I2C_ICXEVT 29
121#define DAVINCI_DMA_GPIO_GPINT0 32
122#define DAVINCI_DMA_GPIO_GPINT1 33
123#define DAVINCI_DMA_GPIO_GPINT2 34
124#define DAVINCI_DMA_GPIO_GPINT3 35
125#define DAVINCI_DMA_GPIO_GPINT4 36
126#define DAVINCI_DMA_GPIO_GPINT5 37
127#define DAVINCI_DMA_GPIO_GPINT6 38
128#define DAVINCI_DMA_GPIO_GPINT7 39
129#define DAVINCI_DMA_GPIO_GPBNKINT0 40
130#define DAVINCI_DMA_GPIO_GPBNKINT1 41
131#define DAVINCI_DMA_GPIO_GPBNKINT2 42
132#define DAVINCI_DMA_GPIO_GPBNKINT3 43
133#define DAVINCI_DMA_GPIO_GPBNKINT4 44
134#define DAVINCI_DMA_TIMER0_TINT0 48
135#define DAVINCI_DMA_TIMER1_TINT1 49
136#define DAVINCI_DMA_TIMER2_TINT2 50
137#define DAVINCI_DMA_TIMER3_TINT3 51
138#define DAVINCI_DMA_PWM0 52
139#define DAVINCI_DMA_PWM1 53
140#define DAVINCI_DMA_PWM2 54
141
142/*ch_status paramater of callback function possible values*/
143#define DMA_COMPLETE 1
144#define DMA_CC_ERROR 2
145#define DMA_TC1_ERROR 3
146#define DMA_TC2_ERROR 4
147
148enum address_mode {
149 INCR = 0,
150 FIFO = 1
151};
152
153enum fifo_width {
154 W8BIT = 0,
155 W16BIT = 1,
156 W32BIT = 2,
157 W64BIT = 3,
158 W128BIT = 4,
159 W256BIT = 5
160};
161
162enum dma_event_q {
163 EVENTQ_0 = 0,
164 EVENTQ_1 = 1,
165 EVENTQ_DEFAULT = -1
166};
167
168enum sync_dimension {
169 ASYNC = 0,
170 ABSYNC = 1
171};
172
173#define EDMA_CHANNEL_ANY -1 /* for edma_alloc_channel() */
174#define EDMA_SLOT_ANY -1 /* for edma_alloc_slot() */
175
176/* alloc/free DMA channels and their dedicated parameter RAM slots */
177int edma_alloc_channel(int channel,
178 void (*callback)(unsigned channel, u16 ch_status, void *data),
179 void *data, enum dma_event_q);
180void edma_free_channel(unsigned channel);
181
182/* alloc/free parameter RAM slots */
183int edma_alloc_slot(int slot);
184void edma_free_slot(unsigned slot);
185
186/* calls that operate on part of a parameter RAM slot */
187void edma_set_src(unsigned slot, dma_addr_t src_port,
188 enum address_mode mode, enum fifo_width);
189void edma_set_dest(unsigned slot, dma_addr_t dest_port,
190 enum address_mode mode, enum fifo_width);
191void edma_get_position(unsigned slot, dma_addr_t *src, dma_addr_t *dst);
192void edma_set_src_index(unsigned slot, s16 src_bidx, s16 src_cidx);
193void edma_set_dest_index(unsigned slot, s16 dest_bidx, s16 dest_cidx);
194void edma_set_transfer_params(unsigned slot, u16 acnt, u16 bcnt, u16 ccnt,
195 u16 bcnt_rld, enum sync_dimension sync_mode);
196void edma_link(unsigned from, unsigned to);
197void edma_unlink(unsigned from);
198
199/* calls that operate on an entire parameter RAM slot */
200void edma_write_slot(unsigned slot, const struct edmacc_param *params);
201void edma_read_slot(unsigned slot, struct edmacc_param *params);
202
203/* channel control operations */
204int edma_start(unsigned channel);
205void edma_stop(unsigned channel);
206void edma_clean_channel(unsigned channel);
207void edma_clear_event(unsigned channel);
208void edma_pause(unsigned channel);
209void edma_resume(unsigned channel);
210
211/* UNRELATED TO DMA */
212int davinci_alloc_iram(unsigned size);
213void davinci_free_iram(unsigned addr, unsigned size);
214
215/* platform_data for EDMA driver */
216struct edma_soc_info {
217
218 /* how many dma resources of each type */
219 unsigned n_channel;
220 unsigned n_region;
221 unsigned n_slot;
222 unsigned n_tc;
223
224 /* list of channels with no even trigger; terminated by "-1" */
225 const s8 *noevent;
226};
227
228#endif
diff --git a/arch/arm/mach-davinci/include/mach/gpio.h b/arch/arm/mach-davinci/include/mach/gpio.h
index b456f079f43..efe3281364e 100644
--- a/arch/arm/mach-davinci/include/mach/gpio.h
+++ b/arch/arm/mach-davinci/include/mach/gpio.h
@@ -15,9 +15,11 @@
15 15
16#include <linux/io.h> 16#include <linux/io.h>
17#include <asm-generic/gpio.h> 17#include <asm-generic/gpio.h>
18#include <mach/hardware.h> 18
19#include <mach/irqs.h> 19#include <mach/irqs.h>
20 20
21#define DAVINCI_GPIO_BASE 0x01C67000
22
21/* 23/*
22 * basic gpio routines 24 * basic gpio routines
23 * 25 *
@@ -26,23 +28,18 @@
26 * go through boot loaders. 28 * go through boot loaders.
27 * 29 *
28 * the gpio clock will be turned on when gpios are used, and you may also 30 * the gpio clock will be turned on when gpios are used, and you may also
29 * need to pay attention to PINMUX0 and PINMUX1 to be sure those pins are 31 * need to pay attention to PINMUX registers to be sure those pins are
30 * used as gpios, not with other peripherals. 32 * used as gpios, not with other peripherals.
31 * 33 *
32 * On-chip GPIOs are numbered 0..(DAVINCI_N_GPIO-1). For documentation, 34 * On-chip GPIOs are numbered 0..(DAVINCI_N_GPIO-1). For documentation,
33 * and maybe for later updates, code should write GPIO(N) or: 35 * and maybe for later updates, code may write GPIO(N). These may be
34 * - GPIOV18(N) for 1.8V pins, N in 0..53; same as GPIO(0)..GPIO(53) 36 * all 1.8V signals, all 3.3V ones, or a mix of the two. A given chip
35 * - GPIOV33(N) for 3.3V pins, N in 0..17; same as GPIO(54)..GPIO(70) 37 * may not support all the GPIOs in that range.
36 *
37 * For GPIO IRQs use gpio_to_irq(GPIO(N)) or gpio_to_irq(GPIOV33(N)) etc
38 * for now, that's != GPIO(N)
39 * 38 *
40 * GPIOs can also be on external chips, numbered after the ones built-in 39 * GPIOs can also be on external chips, numbered after the ones built-in
41 * to the DaVinci chip. For now, they won't be usable as IRQ sources. 40 * to the DaVinci chip. For now, they won't be usable as IRQ sources.
42 */ 41 */
43#define GPIO(X) (X) /* 0 <= X <= 70 */ 42#define GPIO(X) (X) /* 0 <= X <= (DAVINCI_N_GPIO - 1) */
44#define GPIOV18(X) (X) /* 1.8V i/o; 0 <= X <= 53 */
45#define GPIOV33(X) ((X)+54) /* 3.3V i/o; 0 <= X <= 17 */
46 43
47struct gpio_controller { 44struct gpio_controller {
48 u32 dir; 45 u32 dir;
@@ -71,12 +68,14 @@ __gpio_to_controller(unsigned gpio)
71{ 68{
72 void *__iomem ptr; 69 void *__iomem ptr;
73 70
74 if (gpio < 32) 71 if (gpio < 32 * 1)
75 ptr = IO_ADDRESS(DAVINCI_GPIO_BASE + 0x10); 72 ptr = IO_ADDRESS(DAVINCI_GPIO_BASE + 0x10);
76 else if (gpio < 64) 73 else if (gpio < 32 * 2)
77 ptr = IO_ADDRESS(DAVINCI_GPIO_BASE + 0x38); 74 ptr = IO_ADDRESS(DAVINCI_GPIO_BASE + 0x38);
78 else if (gpio < DAVINCI_N_GPIO) 75 else if (gpio < 32 * 3)
79 ptr = IO_ADDRESS(DAVINCI_GPIO_BASE + 0x60); 76 ptr = IO_ADDRESS(DAVINCI_GPIO_BASE + 0x60);
77 else if (gpio < 32 * 4)
78 ptr = IO_ADDRESS(DAVINCI_GPIO_BASE + 0x88);
80 else 79 else
81 ptr = NULL; 80 ptr = NULL;
82 return ptr; 81 return ptr;
diff --git a/arch/arm/mach-davinci/include/mach/hardware.h b/arch/arm/mach-davinci/include/mach/hardware.h
index a2e8969afac..48c77934d51 100644
--- a/arch/arm/mach-davinci/include/mach/hardware.h
+++ b/arch/arm/mach-davinci/include/mach/hardware.h
@@ -1,9 +1,9 @@
1/* 1/*
2 * Common hardware definitions 2 * Hardware definitions common to all DaVinci family processors
3 * 3 *
4 * Author: Kevin Hilman, MontaVista Software, Inc. <source@mvista.com> 4 * Author: Kevin Hilman, Deep Root Systems, LLC
5 * 5 *
6 * 2007 (c) MontaVista Software, Inc. This file is licensed under 6 * 2007 (c) Deep Root Systems, LLC. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program 7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express 8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied. 9 * or implied.
@@ -12,41 +12,16 @@
12#define __ASM_ARCH_HARDWARE_H 12#define __ASM_ARCH_HARDWARE_H
13 13
14/* 14/*
15 * Base register addresses 15 * Before you add anything to ths file:
16 *
17 * This header is for defines common to ALL DaVinci family chips.
18 * Anything that is chip specific should go in <chipname>.h,
19 * and the chip/board init code should then explicitly include
20 * <chipname>.h
16 */ 21 */
17#define DAVINCI_DMA_3PCC_BASE (0x01C00000) 22#define DAVINCI_SYSTEM_MODULE_BASE 0x01C40000
18#define DAVINCI_DMA_3PTC0_BASE (0x01C10000) 23
19#define DAVINCI_DMA_3PTC1_BASE (0x01C10400) 24/* System control register offsets */
20#define DAVINCI_I2C_BASE (0x01C21000) 25#define DM64XX_VDD3P3V_PWDN 0x48
21#define DAVINCI_PWM0_BASE (0x01C22000)
22#define DAVINCI_PWM1_BASE (0x01C22400)
23#define DAVINCI_PWM2_BASE (0x01C22800)
24#define DAVINCI_SYSTEM_MODULE_BASE (0x01C40000)
25#define DAVINCI_PLL_CNTRL0_BASE (0x01C40800)
26#define DAVINCI_PLL_CNTRL1_BASE (0x01C40C00)
27#define DAVINCI_PWR_SLEEP_CNTRL_BASE (0x01C41000)
28#define DAVINCI_SYSTEM_DFT_BASE (0x01C42000)
29#define DAVINCI_IEEE1394_BASE (0x01C60000)
30#define DAVINCI_USB_OTG_BASE (0x01C64000)
31#define DAVINCI_CFC_ATA_BASE (0x01C66000)
32#define DAVINCI_SPI_BASE (0x01C66800)
33#define DAVINCI_GPIO_BASE (0x01C67000)
34#define DAVINCI_UHPI_BASE (0x01C67800)
35#define DAVINCI_VPSS_REGS_BASE (0x01C70000)
36#define DAVINCI_EMAC_CNTRL_REGS_BASE (0x01C80000)
37#define DAVINCI_EMAC_WRAPPER_CNTRL_REGS_BASE (0x01C81000)
38#define DAVINCI_EMAC_WRAPPER_RAM_BASE (0x01C82000)
39#define DAVINCI_MDIO_CNTRL_REGS_BASE (0x01C84000)
40#define DAVINCI_IMCOP_BASE (0x01CC0000)
41#define DAVINCI_ASYNC_EMIF_CNTRL_BASE (0x01E00000)
42#define DAVINCI_VLYNQ_BASE (0x01E01000)
43#define DAVINCI_MCBSP_BASE (0x01E02000)
44#define DAVINCI_MMC_SD_BASE (0x01E10000)
45#define DAVINCI_MS_BASE (0x01E20000)
46#define DAVINCI_ASYNC_EMIF_DATA_CE0_BASE (0x02000000)
47#define DAVINCI_ASYNC_EMIF_DATA_CE1_BASE (0x04000000)
48#define DAVINCI_ASYNC_EMIF_DATA_CE2_BASE (0x06000000)
49#define DAVINCI_ASYNC_EMIF_DATA_CE3_BASE (0x08000000)
50#define DAVINCI_VLYNQ_REMOTE_BASE (0x0C000000)
51 26
52#endif /* __ASM_ARCH_HARDWARE_H */ 27#endif /* __ASM_ARCH_HARDWARE_H */
diff --git a/arch/arm/mach-davinci/include/mach/io.h b/arch/arm/mach-davinci/include/mach/io.h
index a48795fd241..2479785405a 100644
--- a/arch/arm/mach-davinci/include/mach/io.h
+++ b/arch/arm/mach-davinci/include/mach/io.h
@@ -40,22 +40,12 @@
40#else 40#else
41#define IOMEM(x) ((void __force __iomem *)(x)) 41#define IOMEM(x) ((void __force __iomem *)(x))
42 42
43/* 43#define __arch_ioremap(p, s, t) davinci_ioremap(p, s, t)
44 * Functions to access the DaVinci IO region 44#define __arch_iounmap(v) davinci_iounmap(v)
45 *
46 * NOTE: - Use davinci_read/write[bwl] for physical register addresses
47 * - Use __raw_read/write[bwl]() for virtual register addresses
48 * - Use IO_ADDRESS(phys_addr) to convert registers to virtual addresses
49 * - DO NOT use hardcoded virtual addresses to allow changing the
50 * IO address space again if needed
51 */
52#define davinci_readb(a) __raw_readb(IO_ADDRESS(a))
53#define davinci_readw(a) __raw_readw(IO_ADDRESS(a))
54#define davinci_readl(a) __raw_readl(IO_ADDRESS(a))
55 45
56#define davinci_writeb(v, a) __raw_writeb(v, IO_ADDRESS(a)) 46void __iomem *davinci_ioremap(unsigned long phys, size_t size,
57#define davinci_writew(v, a) __raw_writew(v, IO_ADDRESS(a)) 47 unsigned int type);
58#define davinci_writel(v, a) __raw_writel(v, IO_ADDRESS(a)) 48void davinci_iounmap(volatile void __iomem *addr);
59 49
60#endif /* __ASSEMBLER__ */ 50#endif /* __ASSEMBLER__ */
61#endif /* __ASM_ARCH_IO_H */ 51#endif /* __ASM_ARCH_IO_H */
diff --git a/arch/arm/mach-davinci/include/mach/irqs.h b/arch/arm/mach-davinci/include/mach/irqs.h
index f4c5ca6da9f..18066074c99 100644
--- a/arch/arm/mach-davinci/include/mach/irqs.h
+++ b/arch/arm/mach-davinci/include/mach/irqs.h
@@ -96,10 +96,111 @@
96#define IRQ_EMUINT 63 96#define IRQ_EMUINT 63
97 97
98#define DAVINCI_N_AINTC_IRQ 64 98#define DAVINCI_N_AINTC_IRQ 64
99#define DAVINCI_N_GPIO 71 99#define DAVINCI_N_GPIO 104
100 100
101#define NR_IRQS (DAVINCI_N_AINTC_IRQ + DAVINCI_N_GPIO) 101#define NR_IRQS (DAVINCI_N_AINTC_IRQ + DAVINCI_N_GPIO)
102 102
103#define ARCH_TIMER_IRQ IRQ_TINT1_TINT34 103#define ARCH_TIMER_IRQ IRQ_TINT1_TINT34
104 104
105/* DaVinci DM6467-specific Interrupts */
106#define IRQ_DM646X_VP_VERTINT0 0
107#define IRQ_DM646X_VP_VERTINT1 1
108#define IRQ_DM646X_VP_VERTINT2 2
109#define IRQ_DM646X_VP_VERTINT3 3
110#define IRQ_DM646X_VP_ERRINT 4
111#define IRQ_DM646X_RESERVED_1 5
112#define IRQ_DM646X_RESERVED_2 6
113#define IRQ_DM646X_WDINT 7
114#define IRQ_DM646X_CRGENINT0 8
115#define IRQ_DM646X_CRGENINT1 9
116#define IRQ_DM646X_TSIFINT0 10
117#define IRQ_DM646X_TSIFINT1 11
118#define IRQ_DM646X_VDCEINT 12
119#define IRQ_DM646X_USBINT 13
120#define IRQ_DM646X_USBDMAINT 14
121#define IRQ_DM646X_PCIINT 15
122#define IRQ_DM646X_TCERRINT2 20
123#define IRQ_DM646X_TCERRINT3 21
124#define IRQ_DM646X_IDE 22
125#define IRQ_DM646X_HPIINT 23
126#define IRQ_DM646X_EMACRXTHINT 24
127#define IRQ_DM646X_EMACRXINT 25
128#define IRQ_DM646X_EMACTXINT 26
129#define IRQ_DM646X_EMACMISCINT 27
130#define IRQ_DM646X_MCASP0TXINT 28
131#define IRQ_DM646X_MCASP0RXINT 29
132#define IRQ_DM646X_RESERVED_3 31
133#define IRQ_DM646X_MCASP1TXINT 32
134#define IRQ_DM646X_VLQINT 38
135#define IRQ_DM646X_UARTINT2 42
136#define IRQ_DM646X_SPINT0 43
137#define IRQ_DM646X_SPINT1 44
138#define IRQ_DM646X_DSP2ARMINT 45
139#define IRQ_DM646X_RESERVED_4 46
140#define IRQ_DM646X_PSCINT 47
141#define IRQ_DM646X_GPIO0 48
142#define IRQ_DM646X_GPIO1 49
143#define IRQ_DM646X_GPIO2 50
144#define IRQ_DM646X_GPIO3 51
145#define IRQ_DM646X_GPIO4 52
146#define IRQ_DM646X_GPIO5 53
147#define IRQ_DM646X_GPIO6 54
148#define IRQ_DM646X_GPIO7 55
149#define IRQ_DM646X_GPIOBNK0 56
150#define IRQ_DM646X_GPIOBNK1 57
151#define IRQ_DM646X_GPIOBNK2 58
152#define IRQ_DM646X_DDRINT 59
153#define IRQ_DM646X_AEMIFINT 60
154
155/* DaVinci DM355-specific Interrupts */
156#define IRQ_DM355_CCDC_VDINT0 0
157#define IRQ_DM355_CCDC_VDINT1 1
158#define IRQ_DM355_CCDC_VDINT2 2
159#define IRQ_DM355_IPIPE_HST 3
160#define IRQ_DM355_H3AINT 4
161#define IRQ_DM355_IPIPE_SDR 5
162#define IRQ_DM355_IPIPEIFINT 6
163#define IRQ_DM355_OSDINT 7
164#define IRQ_DM355_VENCINT 8
165#define IRQ_DM355_IMCOPINT 11
166#define IRQ_DM355_RTOINT 13
167#define IRQ_DM355_TINT4 13
168#define IRQ_DM355_TINT2_TINT12 13
169#define IRQ_DM355_UARTINT2 14
170#define IRQ_DM355_TINT5 14
171#define IRQ_DM355_TINT2_TINT34 14
172#define IRQ_DM355_TINT6 15
173#define IRQ_DM355_TINT3_TINT12 15
174#define IRQ_DM355_SPINT1_0 17
175#define IRQ_DM355_SPINT1_1 18
176#define IRQ_DM355_SPINT2_0 19
177#define IRQ_DM355_SPINT2_1 21
178#define IRQ_DM355_TINT7 22
179#define IRQ_DM355_TINT3_TINT34 22
180#define IRQ_DM355_SDIOINT0 23
181#define IRQ_DM355_MMCINT0 26
182#define IRQ_DM355_MSINT 26
183#define IRQ_DM355_MMCINT1 27
184#define IRQ_DM355_PWMINT3 28
185#define IRQ_DM355_SDIOINT1 31
186#define IRQ_DM355_SPINT0_0 42
187#define IRQ_DM355_SPINT0_1 43
188#define IRQ_DM355_GPIO0 44
189#define IRQ_DM355_GPIO1 45
190#define IRQ_DM355_GPIO2 46
191#define IRQ_DM355_GPIO3 47
192#define IRQ_DM355_GPIO4 48
193#define IRQ_DM355_GPIO5 49
194#define IRQ_DM355_GPIO6 50
195#define IRQ_DM355_GPIO7 51
196#define IRQ_DM355_GPIO8 52
197#define IRQ_DM355_GPIO9 53
198#define IRQ_DM355_GPIOBNK0 54
199#define IRQ_DM355_GPIOBNK1 55
200#define IRQ_DM355_GPIOBNK2 56
201#define IRQ_DM355_GPIOBNK3 57
202#define IRQ_DM355_GPIOBNK4 58
203#define IRQ_DM355_GPIOBNK5 59
204#define IRQ_DM355_GPIOBNK6 60
205
105#endif /* __ASM_ARCH_IRQS_H */ 206#endif /* __ASM_ARCH_IRQS_H */
diff --git a/arch/arm/mach-davinci/include/mach/mux.h b/arch/arm/mach-davinci/include/mach/mux.h
index c24b6782804..bae22cb3e27 100644
--- a/arch/arm/mach-davinci/include/mach/mux.h
+++ b/arch/arm/mach-davinci/include/mach/mux.h
@@ -1,55 +1,183 @@
1/* 1/*
2 * DaVinci pin multiplexing defines 2 * Table of the DAVINCI register configurations for the PINMUX combinations
3 * 3 *
4 * Author: Vladimir Barinov, MontaVista Software, Inc. <source@mvista.com> 4 * Author: Vladimir Barinov, MontaVista Software, Inc. <source@mvista.com>
5 * 5 *
6 * Based on linux/include/asm-arm/arch-omap/mux.h:
7 * Copyright (C) 2003 - 2005 Nokia Corporation
8 *
9 * Written by Tony Lindgren
10 *
6 * 2007 (c) MontaVista Software, Inc. This file is licensed under 11 * 2007 (c) MontaVista Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program 12 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express 13 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied. 14 * or implied.
15 *
16 * Copyright (C) 2008 Texas Instruments.
10 */ 17 */
11#ifndef __ASM_ARCH_MUX_H 18
12#define __ASM_ARCH_MUX_H 19#ifndef __INC_MACH_MUX_H
13 20#define __INC_MACH_MUX_H
14#define DAVINCI_MUX_AEAW0 0 21
15#define DAVINCI_MUX_AEAW1 1 22/* System module registers */
16#define DAVINCI_MUX_AEAW2 2 23#define PINMUX0 0x00
17#define DAVINCI_MUX_AEAW3 3 24#define PINMUX1 0x04
18#define DAVINCI_MUX_AEAW4 4 25/* dm355 only */
19#define DAVINCI_MUX_AECS4 10 26#define PINMUX2 0x08
20#define DAVINCI_MUX_AECS5 11 27#define PINMUX3 0x0c
21#define DAVINCI_MUX_VLYNQWD0 12 28#define PINMUX4 0x10
22#define DAVINCI_MUX_VLYNQWD1 13 29#define INTMUX 0x18
23#define DAVINCI_MUX_VLSCREN 14 30#define EVTMUX 0x1c
24#define DAVINCI_MUX_VLYNQEN 15 31
25#define DAVINCI_MUX_HDIREN 16 32struct mux_config {
26#define DAVINCI_MUX_ATAEN 17 33 const char *name;
27#define DAVINCI_MUX_RGB666 22 34 const char *mux_reg_name;
28#define DAVINCI_MUX_RGB888 23 35 const unsigned char mux_reg;
29#define DAVINCI_MUX_LOEEN 24 36 const unsigned char mask_offset;
30#define DAVINCI_MUX_LFLDEN 25 37 const unsigned char mask;
31#define DAVINCI_MUX_CWEN 26 38 const unsigned char mode;
32#define DAVINCI_MUX_CFLDEN 27 39 bool debug;
33#define DAVINCI_MUX_HPIEN 29 40};
34#define DAVINCI_MUX_1394EN 30 41
35#define DAVINCI_MUX_EMACEN 31 42enum davinci_dm644x_index {
36 43 /* ATA and HDDIR functions */
37#define DAVINCI_MUX_LEVEL2 32 44 DM644X_HDIREN,
38#define DAVINCI_MUX_UART0 (DAVINCI_MUX_LEVEL2 + 0) 45 DM644X_ATAEN,
39#define DAVINCI_MUX_UART1 (DAVINCI_MUX_LEVEL2 + 1) 46 DM644X_ATAEN_DISABLE,
40#define DAVINCI_MUX_UART2 (DAVINCI_MUX_LEVEL2 + 2) 47
41#define DAVINCI_MUX_U2FLO (DAVINCI_MUX_LEVEL2 + 3) 48 /* HPI functions */
42#define DAVINCI_MUX_PWM0 (DAVINCI_MUX_LEVEL2 + 4) 49 DM644X_HPIEN_DISABLE,
43#define DAVINCI_MUX_PWM1 (DAVINCI_MUX_LEVEL2 + 5) 50
44#define DAVINCI_MUX_PWM2 (DAVINCI_MUX_LEVEL2 + 6) 51 /* AEAW functions */
45#define DAVINCI_MUX_I2C (DAVINCI_MUX_LEVEL2 + 7) 52 DM644X_AEAW,
46#define DAVINCI_MUX_SPI (DAVINCI_MUX_LEVEL2 + 8) 53
47#define DAVINCI_MUX_MSTK (DAVINCI_MUX_LEVEL2 + 9) 54 /* Memory Stick */
48#define DAVINCI_MUX_ASP (DAVINCI_MUX_LEVEL2 + 10) 55 DM644X_MSTK,
49#define DAVINCI_MUX_CLK0 (DAVINCI_MUX_LEVEL2 + 16) 56
50#define DAVINCI_MUX_CLK1 (DAVINCI_MUX_LEVEL2 + 17) 57 /* I2C */
51#define DAVINCI_MUX_TIMIN (DAVINCI_MUX_LEVEL2 + 18) 58 DM644X_I2C,
52 59
53extern void davinci_mux_peripheral(unsigned int mux, unsigned int enable); 60 /* ASP function */
54 61 DM644X_MCBSP,
55#endif /* __ASM_ARCH_MUX_H */ 62
63 /* UART1 */
64 DM644X_UART1,
65
66 /* UART2 */
67 DM644X_UART2,
68
69 /* PWM0 */
70 DM644X_PWM0,
71
72 /* PWM1 */
73 DM644X_PWM1,
74
75 /* PWM2 */
76 DM644X_PWM2,
77
78 /* VLYNQ function */
79 DM644X_VLYNQEN,
80 DM644X_VLSCREN,
81 DM644X_VLYNQWD,
82
83 /* EMAC and MDIO function */
84 DM644X_EMACEN,
85
86 /* GPIO3V[0:16] pins */
87 DM644X_GPIO3V,
88
89 /* GPIO pins */
90 DM644X_GPIO0,
91 DM644X_GPIO3,
92 DM644X_GPIO43_44,
93 DM644X_GPIO46_47,
94
95 /* VPBE */
96 DM644X_RGB666,
97
98 /* LCD */
99 DM644X_LOEEN,
100 DM644X_LFLDEN,
101};
102
103enum davinci_dm646x_index {
104 /* ATA function */
105 DM646X_ATAEN,
106
107 /* AUDIO Clock */
108 DM646X_AUDCK1,
109 DM646X_AUDCK0,
110
111 /* CRGEN Control */
112 DM646X_CRGMUX,
113
114 /* VPIF Control */
115 DM646X_STSOMUX_DISABLE,
116 DM646X_STSIMUX_DISABLE,
117 DM646X_PTSOMUX_DISABLE,
118 DM646X_PTSIMUX_DISABLE,
119
120 /* TSIF Control */
121 DM646X_STSOMUX,
122 DM646X_STSIMUX,
123 DM646X_PTSOMUX_PARALLEL,
124 DM646X_PTSIMUX_PARALLEL,
125 DM646X_PTSOMUX_SERIAL,
126 DM646X_PTSIMUX_SERIAL,
127};
128
129enum davinci_dm355_index {
130 /* MMC/SD 0 */
131 DM355_MMCSD0,
132
133 /* MMC/SD 1 */
134 DM355_SD1_CLK,
135 DM355_SD1_CMD,
136 DM355_SD1_DATA3,
137 DM355_SD1_DATA2,
138 DM355_SD1_DATA1,
139 DM355_SD1_DATA0,
140
141 /* I2C */
142 DM355_I2C_SDA,
143 DM355_I2C_SCL,
144
145 /* ASP0 function */
146 DM355_MCBSP0_BDX,
147 DM355_MCBSP0_X,
148 DM355_MCBSP0_BFSX,
149 DM355_MCBSP0_BDR,
150 DM355_MCBSP0_R,
151 DM355_MCBSP0_BFSR,
152
153 /* SPI0 */
154 DM355_SPI0_SDI,
155 DM355_SPI0_SDENA0,
156 DM355_SPI0_SDENA1,
157
158 /* IRQ muxing */
159 DM355_INT_EDMA_CC,
160 DM355_INT_EDMA_TC0_ERR,
161 DM355_INT_EDMA_TC1_ERR,
162
163 /* EDMA event muxing */
164 DM355_EVT8_ASP1_TX,
165 DM355_EVT9_ASP1_RX,
166 DM355_EVT26_MMC0_RX,
167};
168
169#ifdef CONFIG_DAVINCI_MUX
170/* setup pin muxing */
171extern void davinci_mux_init(void);
172extern int davinci_mux_register(const struct mux_config *pins,
173 unsigned long size);
174extern int davinci_cfg_reg(unsigned long reg_cfg);
175#else
176/* boot loader does it all (no warnings from CONFIG_DAVINCI_MUX_WARNINGS) */
177static inline void davinci_mux_init(void) {}
178static inline int davinci_mux_register(const struct mux_config *pins,
179 unsigned long size) { return 0; }
180static inline int davinci_cfg_reg(unsigned long reg_cfg) { return 0; }
181#endif
182
183#endif /* __INC_MACH_MUX_H */
diff --git a/arch/arm/mach-davinci/include/mach/psc.h b/arch/arm/mach-davinci/include/mach/psc.h
index 4977aa071e1..55a90d419fa 100644
--- a/arch/arm/mach-davinci/include/mach/psc.h
+++ b/arch/arm/mach-davinci/include/mach/psc.h
@@ -38,8 +38,6 @@
38#define DAVINCI_LPSC_TPTC1 4 38#define DAVINCI_LPSC_TPTC1 4
39#define DAVINCI_LPSC_EMAC 5 39#define DAVINCI_LPSC_EMAC 5
40#define DAVINCI_LPSC_EMAC_WRAPPER 6 40#define DAVINCI_LPSC_EMAC_WRAPPER 6
41#define DAVINCI_LPSC_MDIO 7
42#define DAVINCI_LPSC_IEEE1394 8
43#define DAVINCI_LPSC_USB 9 41#define DAVINCI_LPSC_USB 9
44#define DAVINCI_LPSC_ATA 10 42#define DAVINCI_LPSC_ATA 10
45#define DAVINCI_LPSC_VLYNQ 11 43#define DAVINCI_LPSC_VLYNQ 11
@@ -47,7 +45,6 @@
47#define DAVINCI_LPSC_DDR_EMIF 13 45#define DAVINCI_LPSC_DDR_EMIF 13
48#define DAVINCI_LPSC_AEMIF 14 46#define DAVINCI_LPSC_AEMIF 14
49#define DAVINCI_LPSC_MMC_SD 15 47#define DAVINCI_LPSC_MMC_SD 15
50#define DAVINCI_LPSC_MEMSTICK 16
51#define DAVINCI_LPSC_McBSP 17 48#define DAVINCI_LPSC_McBSP 17
52#define DAVINCI_LPSC_I2C 18 49#define DAVINCI_LPSC_I2C 18
53#define DAVINCI_LPSC_UART0 19 50#define DAVINCI_LPSC_UART0 19
@@ -73,4 +70,54 @@
73#define DAVINCI_LPSC_GEM 39 70#define DAVINCI_LPSC_GEM 39
74#define DAVINCI_LPSC_IMCOP 40 71#define DAVINCI_LPSC_IMCOP 40
75 72
73#define DM355_LPSC_TIMER3 5
74#define DM355_LPSC_SPI1 6
75#define DM355_LPSC_MMC_SD1 7
76#define DM355_LPSC_McBSP1 8
77#define DM355_LPSC_PWM3 10
78#define DM355_LPSC_SPI2 11
79#define DM355_LPSC_RTO 12
80#define DM355_LPSC_VPSS_DAC 41
81
82/*
83 * LPSC Assignments
84 */
85#define DM646X_LPSC_ARM 0
86#define DM646X_LPSC_C64X_CPU 1
87#define DM646X_LPSC_HDVICP0 2
88#define DM646X_LPSC_HDVICP1 3
89#define DM646X_LPSC_TPCC 4
90#define DM646X_LPSC_TPTC0 5
91#define DM646X_LPSC_TPTC1 6
92#define DM646X_LPSC_TPTC2 7
93#define DM646X_LPSC_TPTC3 8
94#define DM646X_LPSC_PCI 13
95#define DM646X_LPSC_EMAC 14
96#define DM646X_LPSC_VDCE 15
97#define DM646X_LPSC_VPSSMSTR 16
98#define DM646X_LPSC_VPSSSLV 17
99#define DM646X_LPSC_TSIF0 18
100#define DM646X_LPSC_TSIF1 19
101#define DM646X_LPSC_DDR_EMIF 20
102#define DM646X_LPSC_AEMIF 21
103#define DM646X_LPSC_McASP0 22
104#define DM646X_LPSC_McASP1 23
105#define DM646X_LPSC_CRGEN0 24
106#define DM646X_LPSC_CRGEN1 25
107#define DM646X_LPSC_UART0 26
108#define DM646X_LPSC_UART1 27
109#define DM646X_LPSC_UART2 28
110#define DM646X_LPSC_PWM0 29
111#define DM646X_LPSC_PWM1 30
112#define DM646X_LPSC_I2C 31
113#define DM646X_LPSC_SPI 32
114#define DM646X_LPSC_GPIO 33
115#define DM646X_LPSC_TIMER0 34
116#define DM646X_LPSC_TIMER1 35
117#define DM646X_LPSC_ARM_INTC 45
118
119extern int davinci_psc_is_clk_active(unsigned int id);
120extern void davinci_psc_config(unsigned int domain, unsigned int id,
121 char enable);
122
76#endif /* __ASM_ARCH_PSC_H */ 123#endif /* __ASM_ARCH_PSC_H */
diff --git a/arch/arm/mach-davinci/include/mach/serial.h b/arch/arm/mach-davinci/include/mach/serial.h
index fb8cb229bfd..632847d74a1 100644
--- a/arch/arm/mach-davinci/include/mach/serial.h
+++ b/arch/arm/mach-davinci/include/mach/serial.h
@@ -13,8 +13,23 @@
13 13
14#include <mach/io.h> 14#include <mach/io.h>
15 15
16#define DAVINCI_UART0_BASE (IO_PHYS + 0x20000) 16#define DAVINCI_MAX_NR_UARTS 3
17#define DAVINCI_UART1_BASE (IO_PHYS + 0x20400) 17#define DAVINCI_UART0_BASE (IO_PHYS + 0x20000)
18#define DAVINCI_UART2_BASE (IO_PHYS + 0x20800) 18#define DAVINCI_UART1_BASE (IO_PHYS + 0x20400)
19#define DAVINCI_UART2_BASE (IO_PHYS + 0x20800)
20
21#define DM355_UART2_BASE (IO_PHYS + 0x206000)
22
23/* DaVinci UART register offsets */
24#define UART_DAVINCI_PWREMU 0x0c
25#define UART_DM646X_SCR 0x10
26#define UART_DM646X_SCR_TX_WATERMARK 0x08
27
28struct davinci_uart_config {
29 /* Bit field of UARTs present; bit 0 --> UART1 */
30 unsigned int enabled_uarts;
31};
32
33extern void davinci_serial_init(struct davinci_uart_config *);
19 34
20#endif /* __ASM_ARCH_SERIAL_H */ 35#endif /* __ASM_ARCH_SERIAL_H */
diff --git a/arch/arm/mach-davinci/io.c b/arch/arm/mach-davinci/io.c
index 299515f70b8..a548abb513e 100644
--- a/arch/arm/mach-davinci/io.c
+++ b/arch/arm/mach-davinci/io.c
@@ -51,7 +51,26 @@ void __init davinci_map_common_io(void)
51 davinci_check_revision(); 51 davinci_check_revision();
52} 52}
53 53
54void __init davinci_init_common_hw(void) 54#define BETWEEN(p, st, sz) ((p) >= (st) && (p) < ((st) + (sz)))
55#define XLATE(p, pst, vst) ((void __iomem *)((p) - (pst) + (vst)))
56
57/*
58 * Intercept ioremap() requests for addresses in our fixed mapping regions.
59 */
60void __iomem *davinci_ioremap(unsigned long p, size_t size, unsigned int type)
61{
62 if (BETWEEN(p, IO_PHYS, IO_SIZE))
63 return XLATE(p, IO_PHYS, IO_VIRT);
64
65 return __arm_ioremap(p, size, type);
66}
67EXPORT_SYMBOL(davinci_ioremap);
68
69void davinci_iounmap(volatile void __iomem *addr)
55{ 70{
56 davinci_clk_init(); 71 unsigned long virt = (unsigned long)addr;
72
73 if (virt >= VMALLOC_START && virt < VMALLOC_END)
74 __iounmap(addr);
57} 75}
76EXPORT_SYMBOL(davinci_iounmap);
diff --git a/arch/arm/mach-davinci/irq.c b/arch/arm/mach-davinci/irq.c
index 38021af8359..5a324c90e29 100644
--- a/arch/arm/mach-davinci/irq.c
+++ b/arch/arm/mach-davinci/irq.c
@@ -25,6 +25,7 @@
25#include <linux/io.h> 25#include <linux/io.h>
26 26
27#include <mach/hardware.h> 27#include <mach/hardware.h>
28#include <mach/cputype.h>
28#include <asm/mach/irq.h> 29#include <asm/mach/irq.h>
29 30
30#define IRQ_BIT(irq) ((irq) & 0x1f) 31#define IRQ_BIT(irq) ((irq) & 0x1f)
@@ -40,14 +41,18 @@
40#define IRQ_INTPRI0_REG_OFFSET 0x0030 41#define IRQ_INTPRI0_REG_OFFSET 0x0030
41#define IRQ_INTPRI7_REG_OFFSET 0x004C 42#define IRQ_INTPRI7_REG_OFFSET 0x004C
42 43
44const u8 *davinci_def_priorities;
45
46#define INTC_BASE IO_ADDRESS(DAVINCI_ARM_INTC_BASE)
47
43static inline unsigned int davinci_irq_readl(int offset) 48static inline unsigned int davinci_irq_readl(int offset)
44{ 49{
45 return davinci_readl(DAVINCI_ARM_INTC_BASE + offset); 50 return __raw_readl(INTC_BASE + offset);
46} 51}
47 52
48static inline void davinci_irq_writel(unsigned long value, int offset) 53static inline void davinci_irq_writel(unsigned long value, int offset)
49{ 54{
50 davinci_writel(value, DAVINCI_ARM_INTC_BASE + offset); 55 __raw_writel(value, INTC_BASE + offset);
51} 56}
52 57
53/* Disable interrupt */ 58/* Disable interrupt */
@@ -108,9 +113,8 @@ static struct irq_chip davinci_irq_chip_0 = {
108 .unmask = davinci_unmask_irq, 113 .unmask = davinci_unmask_irq,
109}; 114};
110 115
111
112/* FIQ are pri 0-1; otherwise 2-7, with 7 lowest priority */ 116/* FIQ are pri 0-1; otherwise 2-7, with 7 lowest priority */
113static const u8 default_priorities[DAVINCI_N_AINTC_IRQ] __initdata = { 117static const u8 dm644x_default_priorities[DAVINCI_N_AINTC_IRQ] __initdata = {
114 [IRQ_VDINT0] = 2, 118 [IRQ_VDINT0] = 2,
115 [IRQ_VDINT1] = 6, 119 [IRQ_VDINT1] = 6,
116 [IRQ_VDINT2] = 6, 120 [IRQ_VDINT2] = 6,
@@ -177,11 +181,149 @@ static const u8 default_priorities[DAVINCI_N_AINTC_IRQ] __initdata = {
177 [IRQ_EMUINT] = 7, 181 [IRQ_EMUINT] = 7,
178}; 182};
179 183
184static const u8 dm646x_default_priorities[DAVINCI_N_AINTC_IRQ] = {
185 [IRQ_DM646X_VP_VERTINT0] = 7,
186 [IRQ_DM646X_VP_VERTINT1] = 7,
187 [IRQ_DM646X_VP_VERTINT2] = 7,
188 [IRQ_DM646X_VP_VERTINT3] = 7,
189 [IRQ_DM646X_VP_ERRINT] = 7,
190 [IRQ_DM646X_RESERVED_1] = 7,
191 [IRQ_DM646X_RESERVED_2] = 7,
192 [IRQ_DM646X_WDINT] = 7,
193 [IRQ_DM646X_CRGENINT0] = 7,
194 [IRQ_DM646X_CRGENINT1] = 7,
195 [IRQ_DM646X_TSIFINT0] = 7,
196 [IRQ_DM646X_TSIFINT1] = 7,
197 [IRQ_DM646X_VDCEINT] = 7,
198 [IRQ_DM646X_USBINT] = 7,
199 [IRQ_DM646X_USBDMAINT] = 7,
200 [IRQ_DM646X_PCIINT] = 7,
201 [IRQ_CCINT0] = 7, /* dma */
202 [IRQ_CCERRINT] = 7, /* dma */
203 [IRQ_TCERRINT0] = 7, /* dma */
204 [IRQ_TCERRINT] = 7, /* dma */
205 [IRQ_DM646X_TCERRINT2] = 7,
206 [IRQ_DM646X_TCERRINT3] = 7,
207 [IRQ_DM646X_IDE] = 7,
208 [IRQ_DM646X_HPIINT] = 7,
209 [IRQ_DM646X_EMACRXTHINT] = 7,
210 [IRQ_DM646X_EMACRXINT] = 7,
211 [IRQ_DM646X_EMACTXINT] = 7,
212 [IRQ_DM646X_EMACMISCINT] = 7,
213 [IRQ_DM646X_MCASP0TXINT] = 7,
214 [IRQ_DM646X_MCASP0RXINT] = 7,
215 [IRQ_AEMIFINT] = 7,
216 [IRQ_DM646X_RESERVED_3] = 7,
217 [IRQ_DM646X_MCASP1TXINT] = 7, /* clockevent */
218 [IRQ_TINT0_TINT34] = 7, /* clocksource */
219 [IRQ_TINT1_TINT12] = 7, /* DSP timer */
220 [IRQ_TINT1_TINT34] = 7, /* system tick */
221 [IRQ_PWMINT0] = 7,
222 [IRQ_PWMINT1] = 7,
223 [IRQ_DM646X_VLQINT] = 7,
224 [IRQ_I2C] = 7,
225 [IRQ_UARTINT0] = 7,
226 [IRQ_UARTINT1] = 7,
227 [IRQ_DM646X_UARTINT2] = 7,
228 [IRQ_DM646X_SPINT0] = 7,
229 [IRQ_DM646X_SPINT1] = 7,
230 [IRQ_DM646X_DSP2ARMINT] = 7,
231 [IRQ_DM646X_RESERVED_4] = 7,
232 [IRQ_DM646X_PSCINT] = 7,
233 [IRQ_DM646X_GPIO0] = 7,
234 [IRQ_DM646X_GPIO1] = 7,
235 [IRQ_DM646X_GPIO2] = 7,
236 [IRQ_DM646X_GPIO3] = 7,
237 [IRQ_DM646X_GPIO4] = 7,
238 [IRQ_DM646X_GPIO5] = 7,
239 [IRQ_DM646X_GPIO6] = 7,
240 [IRQ_DM646X_GPIO7] = 7,
241 [IRQ_DM646X_GPIOBNK0] = 7,
242 [IRQ_DM646X_GPIOBNK1] = 7,
243 [IRQ_DM646X_GPIOBNK2] = 7,
244 [IRQ_DM646X_DDRINT] = 7,
245 [IRQ_DM646X_AEMIFINT] = 7,
246 [IRQ_COMMTX] = 7,
247 [IRQ_COMMRX] = 7,
248 [IRQ_EMUINT] = 7,
249};
250
251static const u8 dm355_default_priorities[DAVINCI_N_AINTC_IRQ] = {
252 [IRQ_DM355_CCDC_VDINT0] = 2,
253 [IRQ_DM355_CCDC_VDINT1] = 6,
254 [IRQ_DM355_CCDC_VDINT2] = 6,
255 [IRQ_DM355_IPIPE_HST] = 6,
256 [IRQ_DM355_H3AINT] = 6,
257 [IRQ_DM355_IPIPE_SDR] = 6,
258 [IRQ_DM355_IPIPEIFINT] = 6,
259 [IRQ_DM355_OSDINT] = 7,
260 [IRQ_DM355_VENCINT] = 6,
261 [IRQ_ASQINT] = 6,
262 [IRQ_IMXINT] = 6,
263 [IRQ_USBINT] = 4,
264 [IRQ_DM355_RTOINT] = 4,
265 [IRQ_DM355_UARTINT2] = 7,
266 [IRQ_DM355_TINT6] = 7,
267 [IRQ_CCINT0] = 5, /* dma */
268 [IRQ_CCERRINT] = 5, /* dma */
269 [IRQ_TCERRINT0] = 5, /* dma */
270 [IRQ_TCERRINT] = 5, /* dma */
271 [IRQ_DM355_SPINT2_1] = 7,
272 [IRQ_DM355_TINT7] = 4,
273 [IRQ_DM355_SDIOINT0] = 7,
274 [IRQ_MBXINT] = 7,
275 [IRQ_MBRINT] = 7,
276 [IRQ_MMCINT] = 7,
277 [IRQ_DM355_MMCINT1] = 7,
278 [IRQ_DM355_PWMINT3] = 7,
279 [IRQ_DDRINT] = 7,
280 [IRQ_AEMIFINT] = 7,
281 [IRQ_DM355_SDIOINT1] = 4,
282 [IRQ_TINT0_TINT12] = 2, /* clockevent */
283 [IRQ_TINT0_TINT34] = 2, /* clocksource */
284 [IRQ_TINT1_TINT12] = 7, /* DSP timer */
285 [IRQ_TINT1_TINT34] = 7, /* system tick */
286 [IRQ_PWMINT0] = 7,
287 [IRQ_PWMINT1] = 7,
288 [IRQ_PWMINT2] = 7,
289 [IRQ_I2C] = 3,
290 [IRQ_UARTINT0] = 3,
291 [IRQ_UARTINT1] = 3,
292 [IRQ_DM355_SPINT0_0] = 3,
293 [IRQ_DM355_SPINT0_1] = 3,
294 [IRQ_DM355_GPIO0] = 3,
295 [IRQ_DM355_GPIO1] = 7,
296 [IRQ_DM355_GPIO2] = 4,
297 [IRQ_DM355_GPIO3] = 4,
298 [IRQ_DM355_GPIO4] = 7,
299 [IRQ_DM355_GPIO5] = 7,
300 [IRQ_DM355_GPIO6] = 7,
301 [IRQ_DM355_GPIO7] = 7,
302 [IRQ_DM355_GPIO8] = 7,
303 [IRQ_DM355_GPIO9] = 7,
304 [IRQ_DM355_GPIOBNK0] = 7,
305 [IRQ_DM355_GPIOBNK1] = 7,
306 [IRQ_DM355_GPIOBNK2] = 7,
307 [IRQ_DM355_GPIOBNK3] = 7,
308 [IRQ_DM355_GPIOBNK4] = 7,
309 [IRQ_DM355_GPIOBNK5] = 7,
310 [IRQ_DM355_GPIOBNK6] = 7,
311 [IRQ_COMMTX] = 7,
312 [IRQ_COMMRX] = 7,
313 [IRQ_EMUINT] = 7,
314};
315
180/* ARM Interrupt Controller Initialization */ 316/* ARM Interrupt Controller Initialization */
181void __init davinci_irq_init(void) 317void __init davinci_irq_init(void)
182{ 318{
183 unsigned i; 319 unsigned i;
184 const u8 *priority = default_priorities; 320
321 if (cpu_is_davinci_dm644x())
322 davinci_def_priorities = dm644x_default_priorities;
323 else if (cpu_is_davinci_dm646x())
324 davinci_def_priorities = dm646x_default_priorities;
325 else if (cpu_is_davinci_dm355())
326 davinci_def_priorities = dm355_default_priorities;
185 327
186 /* Clear all interrupt requests */ 328 /* Clear all interrupt requests */
187 davinci_irq_writel(~0x0, FIQ_REG0_OFFSET); 329 davinci_irq_writel(~0x0, FIQ_REG0_OFFSET);
@@ -209,8 +351,8 @@ void __init davinci_irq_init(void)
209 unsigned j; 351 unsigned j;
210 u32 pri; 352 u32 pri;
211 353
212 for (j = 0, pri = 0; j < 32; j += 4, priority++) 354 for (j = 0, pri = 0; j < 32; j += 4, davinci_def_priorities++)
213 pri |= (*priority & 0x07) << j; 355 pri |= (*davinci_def_priorities & 0x07) << j;
214 davinci_irq_writel(pri, i); 356 davinci_irq_writel(pri, i);
215 } 357 }
216 358
diff --git a/arch/arm/mach-davinci/mux.c b/arch/arm/mach-davinci/mux.c
index 8ff9d8aca60..bbba0b247a4 100644
--- a/arch/arm/mach-davinci/mux.c
+++ b/arch/arm/mach-davinci/mux.c
@@ -1,41 +1,103 @@
1/* 1/*
2 * DaVinci pin multiplexing configurations 2 * Utility to set the DAVINCI MUX register from a table in mux.h
3 * 3 *
4 * Author: Vladimir Barinov, MontaVista Software, Inc. <source@mvista.com> 4 * Author: Vladimir Barinov, MontaVista Software, Inc. <source@mvista.com>
5 * 5 *
6 * Based on linux/arch/arm/plat-omap/mux.c:
7 * Copyright (C) 2003 - 2005 Nokia Corporation
8 *
9 * Written by Tony Lindgren
10 *
6 * 2007 (c) MontaVista Software, Inc. This file is licensed under 11 * 2007 (c) MontaVista Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program 12 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express 13 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied. 14 * or implied.
15 *
16 * Copyright (C) 2008 Texas Instruments.
10 */ 17 */
11#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/module.h>
12#include <linux/spinlock.h> 20#include <linux/spinlock.h>
13 21
14#include <mach/hardware.h> 22#include <mach/hardware.h>
15
16#include <mach/mux.h> 23#include <mach/mux.h>
17 24
18/* System control register offsets */ 25static const struct mux_config *mux_table;
19#define PINMUX0 0x00 26static unsigned long pin_table_sz;
20#define PINMUX1 0x04 27
28int __init davinci_mux_register(const struct mux_config *pins,
29 unsigned long size)
30{
31 mux_table = pins;
32 pin_table_sz = size;
21 33
22static DEFINE_SPINLOCK(mux_lock); 34 return 0;
35}
23 36
24void davinci_mux_peripheral(unsigned int mux, unsigned int enable) 37/*
38 * Sets the DAVINCI MUX register based on the table
39 */
40int __init_or_module davinci_cfg_reg(const unsigned long index)
25{ 41{
26 u32 pinmux, muxreg = PINMUX0; 42 static DEFINE_SPINLOCK(mux_spin_lock);
43 void __iomem *base = IO_ADDRESS(DAVINCI_SYSTEM_MODULE_BASE);
44 unsigned long flags;
45 const struct mux_config *cfg;
46 unsigned int reg_orig = 0, reg = 0;
47 unsigned int mask, warn = 0;
48
49 if (!mux_table)
50 BUG();
51
52 if (index >= pin_table_sz) {
53 printk(KERN_ERR "Invalid pin mux index: %lu (%lu)\n",
54 index, pin_table_sz);
55 dump_stack();
56 return -ENODEV;
57 }
58
59 cfg = &mux_table[index];
60
61 if (cfg->name == NULL) {
62 printk(KERN_ERR "No entry for the specified index\n");
63 return -ENODEV;
64 }
65
66 /* Update the mux register in question */
67 if (cfg->mask) {
68 unsigned tmp1, tmp2;
69
70 spin_lock_irqsave(&mux_spin_lock, flags);
71 reg_orig = __raw_readl(base + cfg->mux_reg);
72
73 mask = (cfg->mask << cfg->mask_offset);
74 tmp1 = reg_orig & mask;
75 reg = reg_orig & ~mask;
76
77 tmp2 = (cfg->mode << cfg->mask_offset);
78 reg |= tmp2;
79
80 if (tmp1 != tmp2)
81 warn = 1;
82
83 __raw_writel(reg, base + cfg->mux_reg);
84 spin_unlock_irqrestore(&mux_spin_lock, flags);
85 }
86
87 if (warn) {
88#ifdef CONFIG_DAVINCI_MUX_WARNINGS
89 printk(KERN_WARNING "MUX: initialized %s\n", cfg->name);
90#endif
91 }
27 92
28 if (mux >= DAVINCI_MUX_LEVEL2) { 93#ifdef CONFIG_DAVINCI_MUX_DEBUG
29 muxreg = PINMUX1; 94 if (cfg->debug || warn) {
30 mux -= DAVINCI_MUX_LEVEL2; 95 printk(KERN_WARNING "MUX: Setting register %s\n", cfg->name);
96 printk(KERN_WARNING " %s (0x%08x) = 0x%08x -> 0x%08x\n",
97 cfg->mux_reg_name, cfg->mux_reg, reg_orig, reg);
31 } 98 }
99#endif
32 100
33 spin_lock(&mux_lock); 101 return 0;
34 pinmux = davinci_readl(DAVINCI_SYSTEM_MODULE_BASE + muxreg);
35 if (enable)
36 pinmux |= (1 << mux);
37 else
38 pinmux &= ~(1 << mux);
39 davinci_writel(pinmux, DAVINCI_SYSTEM_MODULE_BASE + muxreg);
40 spin_unlock(&mux_lock);
41} 102}
103EXPORT_SYMBOL(davinci_cfg_reg);
diff --git a/arch/arm/mach-davinci/mux.h b/arch/arm/mach-davinci/mux.h
new file mode 100644
index 00000000000..adc86941337
--- /dev/null
+++ b/arch/arm/mach-davinci/mux.h
@@ -0,0 +1,51 @@
1/*
2 * Pin-multiplex helper macros for TI DaVinci family devices
3 *
4 * Author: Vladimir Barinov, MontaVista Software, Inc. <source@mvista.com>
5 *
6 * 2007 (c) MontaVista Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10 *
11 * Copyright (C) 2008 Texas Instruments.
12 */
13#ifndef _MACH_DAVINCI_MUX_H_
14#define _MACH_DAVINCI_MUX_H_
15
16#include <mach/mux.h>
17
18#define MUX_CFG(soc, desc, muxreg, mode_offset, mode_mask, mux_mode, dbg)\
19[soc##_##desc] = { \
20 .name = #desc, \
21 .debug = dbg, \
22 .mux_reg_name = "PINMUX"#muxreg, \
23 .mux_reg = PINMUX##muxreg, \
24 .mask_offset = mode_offset, \
25 .mask = mode_mask, \
26 .mode = mux_mode, \
27 },
28
29#define INT_CFG(soc, desc, mode_offset, mode_mask, mux_mode, dbg) \
30[soc##_##desc] = { \
31 .name = #desc, \
32 .debug = dbg, \
33 .mux_reg_name = "INTMUX", \
34 .mux_reg = INTMUX, \
35 .mask_offset = mode_offset, \
36 .mask = mode_mask, \
37 .mode = mux_mode, \
38 },
39
40#define EVT_CFG(soc, desc, mode_offset, mode_mask, mux_mode, dbg) \
41[soc##_##desc] = { \
42 .name = #desc, \
43 .debug = dbg, \
44 .mux_reg_name = "EVTMUX", \
45 .mux_reg = EVTMUX, \
46 .mask_offset = mode_offset, \
47 .mask = mode_mask, \
48 .mode = mux_mode, \
49 },
50
51#endif /* _MACH_DAVINCI_MUX_H */
diff --git a/arch/arm/mach-davinci/psc.c b/arch/arm/mach-davinci/psc.c
index 58754f066d5..84171abf5f7 100644
--- a/arch/arm/mach-davinci/psc.c
+++ b/arch/arm/mach-davinci/psc.c
@@ -23,10 +23,13 @@
23#include <linux/init.h> 23#include <linux/init.h>
24#include <linux/io.h> 24#include <linux/io.h>
25 25
26#include <mach/cputype.h>
26#include <mach/hardware.h> 27#include <mach/hardware.h>
27#include <mach/psc.h> 28#include <mach/psc.h>
28#include <mach/mux.h> 29#include <mach/mux.h>
29 30
31#define DAVINCI_PWR_SLEEP_CNTRL_BASE 0x01C41000
32
30/* PSC register offsets */ 33/* PSC register offsets */
31#define EPCPR 0x070 34#define EPCPR 0x070
32#define PTCMD 0x120 35#define PTCMD 0x120
@@ -36,102 +39,61 @@
36#define MDSTAT 0x800 39#define MDSTAT 0x800
37#define MDCTL 0xA00 40#define MDCTL 0xA00
38 41
39/* System control register offsets */ 42#define MDSTAT_STATE_MASK 0x1f
40#define VDD3P3V_PWDN 0x48
41 43
42static void davinci_psc_mux(unsigned int id) 44/* Return nonzero iff the domain's clock is active */
45int __init davinci_psc_is_clk_active(unsigned int id)
43{ 46{
44 switch (id) { 47 void __iomem *psc_base = IO_ADDRESS(DAVINCI_PWR_SLEEP_CNTRL_BASE);
45 case DAVINCI_LPSC_ATA: 48 u32 mdstat = __raw_readl(psc_base + MDSTAT + 4 * id);
46 davinci_mux_peripheral(DAVINCI_MUX_HDIREN, 1); 49
47 davinci_mux_peripheral(DAVINCI_MUX_ATAEN, 1); 50 /* if clocked, state can be "Enable" or "SyncReset" */
48 break; 51 return mdstat & BIT(12);
49 case DAVINCI_LPSC_MMC_SD:
50 /* VDD power manupulations are done in U-Boot for CPMAC
51 * so applies to MMC as well
52 */
53 /*Set up the pull regiter for MMC */
54 davinci_writel(0, DAVINCI_SYSTEM_MODULE_BASE + VDD3P3V_PWDN);
55 davinci_mux_peripheral(DAVINCI_MUX_MSTK, 0);
56 break;
57 case DAVINCI_LPSC_I2C:
58 davinci_mux_peripheral(DAVINCI_MUX_I2C, 1);
59 break;
60 case DAVINCI_LPSC_McBSP:
61 davinci_mux_peripheral(DAVINCI_MUX_ASP, 1);
62 break;
63 default:
64 break;
65 }
66} 52}
67 53
68/* Enable or disable a PSC domain */ 54/* Enable or disable a PSC domain */
69void davinci_psc_config(unsigned int domain, unsigned int id, char enable) 55void davinci_psc_config(unsigned int domain, unsigned int id, char enable)
70{ 56{
71 u32 epcpr, ptcmd, ptstat, pdstat, pdctl1, mdstat, mdctl, mdstat_mask; 57 u32 epcpr, ptcmd, ptstat, pdstat, pdctl1, mdstat, mdctl;
58 void __iomem *psc_base = IO_ADDRESS(DAVINCI_PWR_SLEEP_CNTRL_BASE);
59 u32 next_state = enable ? 0x3 : 0x2; /* 0x3 enables, 0x2 disables */
72 60
73 mdctl = davinci_readl(DAVINCI_PWR_SLEEP_CNTRL_BASE + MDCTL + 4 * id); 61 mdctl = __raw_readl(psc_base + MDCTL + 4 * id);
74 if (enable) 62 mdctl &= ~MDSTAT_STATE_MASK;
75 mdctl |= 0x00000003; /* Enable Module */ 63 mdctl |= next_state;
76 else 64 __raw_writel(mdctl, psc_base + MDCTL + 4 * id);
77 mdctl &= 0xFFFFFFF2; /* Disable Module */
78 davinci_writel(mdctl, DAVINCI_PWR_SLEEP_CNTRL_BASE + MDCTL + 4 * id);
79 65
80 pdstat = davinci_readl(DAVINCI_PWR_SLEEP_CNTRL_BASE + PDSTAT); 66 pdstat = __raw_readl(psc_base + PDSTAT);
81 if ((pdstat & 0x00000001) == 0) { 67 if ((pdstat & 0x00000001) == 0) {
82 pdctl1 = davinci_readl(DAVINCI_PWR_SLEEP_CNTRL_BASE + PDCTL1); 68 pdctl1 = __raw_readl(psc_base + PDCTL1);
83 pdctl1 |= 0x1; 69 pdctl1 |= 0x1;
84 davinci_writel(pdctl1, DAVINCI_PWR_SLEEP_CNTRL_BASE + PDCTL1); 70 __raw_writel(pdctl1, psc_base + PDCTL1);
85 71
86 ptcmd = 1 << domain; 72 ptcmd = 1 << domain;
87 davinci_writel(ptcmd, DAVINCI_PWR_SLEEP_CNTRL_BASE + PTCMD); 73 __raw_writel(ptcmd, psc_base + PTCMD);
88 74
89 do { 75 do {
90 epcpr = davinci_readl(DAVINCI_PWR_SLEEP_CNTRL_BASE + 76 epcpr = __raw_readl(psc_base + EPCPR);
91 EPCPR);
92 } while ((((epcpr >> domain) & 1) == 0)); 77 } while ((((epcpr >> domain) & 1) == 0));
93 78
94 pdctl1 = davinci_readl(DAVINCI_PWR_SLEEP_CNTRL_BASE + PDCTL1); 79 pdctl1 = __raw_readl(psc_base + PDCTL1);
95 pdctl1 |= 0x100; 80 pdctl1 |= 0x100;
96 davinci_writel(pdctl1, DAVINCI_PWR_SLEEP_CNTRL_BASE + PDCTL1); 81 __raw_writel(pdctl1, psc_base + PDCTL1);
97 82
98 do { 83 do {
99 ptstat = davinci_readl(DAVINCI_PWR_SLEEP_CNTRL_BASE + 84 ptstat = __raw_readl(psc_base +
100 PTSTAT); 85 PTSTAT);
101 } while (!(((ptstat >> domain) & 1) == 0)); 86 } while (!(((ptstat >> domain) & 1) == 0));
102 } else { 87 } else {
103 ptcmd = 1 << domain; 88 ptcmd = 1 << domain;
104 davinci_writel(ptcmd, DAVINCI_PWR_SLEEP_CNTRL_BASE + PTCMD); 89 __raw_writel(ptcmd, psc_base + PTCMD);
105 90
106 do { 91 do {
107 ptstat = davinci_readl(DAVINCI_PWR_SLEEP_CNTRL_BASE + 92 ptstat = __raw_readl(psc_base + PTSTAT);
108 PTSTAT);
109 } while (!(((ptstat >> domain) & 1) == 0)); 93 } while (!(((ptstat >> domain) & 1) == 0));
110 } 94 }
111 95
112 if (enable)
113 mdstat_mask = 0x3;
114 else
115 mdstat_mask = 0x2;
116
117 do { 96 do {
118 mdstat = davinci_readl(DAVINCI_PWR_SLEEP_CNTRL_BASE + 97 mdstat = __raw_readl(psc_base + MDSTAT + 4 * id);
119 MDSTAT + 4 * id); 98 } while (!((mdstat & MDSTAT_STATE_MASK) == next_state));
120 } while (!((mdstat & 0x0000001F) == mdstat_mask));
121
122 if (enable)
123 davinci_psc_mux(id);
124}
125
126void __init davinci_psc_init(void)
127{
128 davinci_psc_config(DAVINCI_GPSC_ARMDOMAIN, DAVINCI_LPSC_VPSSMSTR, 1);
129 davinci_psc_config(DAVINCI_GPSC_ARMDOMAIN, DAVINCI_LPSC_VPSSSLV, 1);
130 davinci_psc_config(DAVINCI_GPSC_ARMDOMAIN, DAVINCI_LPSC_TPCC, 1);
131 davinci_psc_config(DAVINCI_GPSC_ARMDOMAIN, DAVINCI_LPSC_TPTC0, 1);
132 davinci_psc_config(DAVINCI_GPSC_ARMDOMAIN, DAVINCI_LPSC_TPTC1, 1);
133 davinci_psc_config(DAVINCI_GPSC_ARMDOMAIN, DAVINCI_LPSC_GPIO, 1);
134
135 /* Turn on WatchDog timer LPSC. Needed for RESET to work */
136 davinci_psc_config(DAVINCI_GPSC_ARMDOMAIN, DAVINCI_LPSC_TIMER2, 1);
137} 99}
diff --git a/arch/arm/mach-davinci/serial.c b/arch/arm/mach-davinci/serial.c
index 3010f997125..69507579652 100644
--- a/arch/arm/mach-davinci/serial.c
+++ b/arch/arm/mach-davinci/serial.c
@@ -32,32 +32,47 @@
32#include <mach/hardware.h> 32#include <mach/hardware.h>
33#include <mach/serial.h> 33#include <mach/serial.h>
34#include <mach/irqs.h> 34#include <mach/irqs.h>
35#include <mach/cputype.h>
36#include "clock.h"
35 37
36#define UART_DAVINCI_PWREMU 0x0c 38static inline unsigned int serial_read_reg(struct plat_serial8250_port *up,
37 39 int offset)
38static inline unsigned int davinci_serial_in(struct plat_serial8250_port *up,
39 int offset)
40{ 40{
41 offset <<= up->regshift; 41 offset <<= up->regshift;
42 return (unsigned int)__raw_readb(up->membase + offset); 42 return (unsigned int)__raw_readl(IO_ADDRESS(up->mapbase) + offset);
43} 43}
44 44
45static inline void davinci_serial_outp(struct plat_serial8250_port *p, 45static inline void serial_write_reg(struct plat_serial8250_port *p, int offset,
46 int offset, int value) 46 int value)
47{ 47{
48 offset <<= p->regshift; 48 offset <<= p->regshift;
49 __raw_writeb(value, p->membase + offset); 49 __raw_writel(value, IO_ADDRESS(p->mapbase) + offset);
50} 50}
51 51
52static struct plat_serial8250_port serial_platform_data[] = { 52static struct plat_serial8250_port serial_platform_data[] = {
53 { 53 {
54 .membase = (char *)IO_ADDRESS(DAVINCI_UART0_BASE), 54 .mapbase = DAVINCI_UART0_BASE,
55 .mapbase = (unsigned long)DAVINCI_UART0_BASE,
56 .irq = IRQ_UARTINT0, 55 .irq = IRQ_UARTINT0,
57 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, 56 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST |
57 UPF_IOREMAP,
58 .iotype = UPIO_MEM,
59 .regshift = 2,
60 },
61 {
62 .mapbase = DAVINCI_UART1_BASE,
63 .irq = IRQ_UARTINT1,
64 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST |
65 UPF_IOREMAP,
66 .iotype = UPIO_MEM,
67 .regshift = 2,
68 },
69 {
70 .mapbase = DAVINCI_UART2_BASE,
71 .irq = IRQ_UARTINT2,
72 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST |
73 UPF_IOREMAP,
58 .iotype = UPIO_MEM, 74 .iotype = UPIO_MEM,
59 .regshift = 2, 75 .regshift = 2,
60 .uartclk = 27000000,
61 }, 76 },
62 { 77 {
63 .flags = 0 78 .flags = 0
@@ -74,22 +89,68 @@ static struct platform_device serial_device = {
74 89
75static void __init davinci_serial_reset(struct plat_serial8250_port *p) 90static void __init davinci_serial_reset(struct plat_serial8250_port *p)
76{ 91{
77 /* reset both transmitter and receiver: bits 14,13 = UTRST, URRST */
78 unsigned int pwremu = 0; 92 unsigned int pwremu = 0;
79 93
80 davinci_serial_outp(p, UART_IER, 0); /* disable all interrupts */ 94 serial_write_reg(p, UART_IER, 0); /* disable all interrupts */
81 95
82 davinci_serial_outp(p, UART_DAVINCI_PWREMU, pwremu); 96 /* reset both transmitter and receiver: bits 14,13 = UTRST, URRST */
97 serial_write_reg(p, UART_DAVINCI_PWREMU, pwremu);
83 mdelay(10); 98 mdelay(10);
84 99
85 pwremu |= (0x3 << 13); 100 pwremu |= (0x3 << 13);
86 pwremu |= 0x1; 101 pwremu |= 0x1;
87 davinci_serial_outp(p, UART_DAVINCI_PWREMU, pwremu); 102 serial_write_reg(p, UART_DAVINCI_PWREMU, pwremu);
103
104 if (cpu_is_davinci_dm646x())
105 serial_write_reg(p, UART_DM646X_SCR,
106 UART_DM646X_SCR_TX_WATERMARK);
107}
108
109void __init davinci_serial_init(struct davinci_uart_config *info)
110{
111 int i;
112 char name[16];
113 struct clk *uart_clk;
114 struct device *dev = &serial_device.dev;
115
116 /*
117 * Make sure the serial ports are muxed on at this point.
118 * You have to mux them off in device drivers later on
119 * if not needed.
120 */
121 for (i = 0; i < DAVINCI_MAX_NR_UARTS; i++) {
122 struct plat_serial8250_port *p = serial_platform_data + i;
123
124 if (!(info->enabled_uarts & (1 << i))) {
125 p->flags = 0;
126 continue;
127 }
128
129 if (cpu_is_davinci_dm646x())
130 p->iotype = UPIO_MEM32;
131
132 if (cpu_is_davinci_dm355()) {
133 if (i == 2) {
134 p->mapbase = (unsigned long)DM355_UART2_BASE;
135 p->irq = IRQ_DM355_UARTINT2;
136 }
137 }
138
139 sprintf(name, "uart%d", i);
140 uart_clk = clk_get(dev, name);
141 if (IS_ERR(uart_clk))
142 printk(KERN_ERR "%s:%d: failed to get UART%d clock\n",
143 __func__, __LINE__, i);
144 else {
145 clk_enable(uart_clk);
146 p->uartclk = clk_get_rate(uart_clk);
147 davinci_serial_reset(p);
148 }
149 }
88} 150}
89 151
90static int __init davinci_init(void) 152static int __init davinci_init(void)
91{ 153{
92 davinci_serial_reset(&serial_platform_data[0]);
93 return platform_device_register(&serial_device); 154 return platform_device_register(&serial_device);
94} 155}
95 156
diff --git a/arch/arm/mach-davinci/time.c b/arch/arm/mach-davinci/time.c
index 6c227d4ba99..494e01bff5c 100644
--- a/arch/arm/mach-davinci/time.c
+++ b/arch/arm/mach-davinci/time.c
@@ -16,6 +16,9 @@
16#include <linux/clockchips.h> 16#include <linux/clockchips.h>
17#include <linux/spinlock.h> 17#include <linux/spinlock.h>
18#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/clk.h>
20#include <linux/err.h>
21#include <linux/device.h>
19 22
20#include <mach/hardware.h> 23#include <mach/hardware.h>
21#include <asm/system.h> 24#include <asm/system.h>
@@ -24,8 +27,11 @@
24#include <asm/mach/time.h> 27#include <asm/mach/time.h>
25#include <asm/errno.h> 28#include <asm/errno.h>
26#include <mach/io.h> 29#include <mach/io.h>
30#include <mach/cputype.h>
31#include "clock.h"
27 32
28static struct clock_event_device clockevent_davinci; 33static struct clock_event_device clockevent_davinci;
34static unsigned int davinci_clock_tick_rate;
29 35
30#define DAVINCI_TIMER0_BASE (IO_PHYS + 0x21400) 36#define DAVINCI_TIMER0_BASE (IO_PHYS + 0x21400)
31#define DAVINCI_TIMER1_BASE (IO_PHYS + 0x21800) 37#define DAVINCI_TIMER1_BASE (IO_PHYS + 0x21800)
@@ -99,9 +105,9 @@ struct timer_s {
99 unsigned int id; 105 unsigned int id;
100 unsigned long period; 106 unsigned long period;
101 unsigned long opts; 107 unsigned long opts;
102 unsigned long reg_base; 108 void __iomem *base;
103 unsigned long tim_reg; 109 unsigned long tim_off;
104 unsigned long prd_reg; 110 unsigned long prd_off;
105 unsigned long enamode_shift; 111 unsigned long enamode_shift;
106 struct irqaction irqaction; 112 struct irqaction irqaction;
107}; 113};
@@ -114,15 +120,15 @@ static struct timer_s timers[];
114 120
115static int timer32_config(struct timer_s *t) 121static int timer32_config(struct timer_s *t)
116{ 122{
117 u32 tcr = davinci_readl(t->reg_base + TCR); 123 u32 tcr = __raw_readl(t->base + TCR);
118 124
119 /* disable timer */ 125 /* disable timer */
120 tcr &= ~(TCR_ENAMODE_MASK << t->enamode_shift); 126 tcr &= ~(TCR_ENAMODE_MASK << t->enamode_shift);
121 davinci_writel(tcr, t->reg_base + TCR); 127 __raw_writel(tcr, t->base + TCR);
122 128
123 /* reset counter to zero, set new period */ 129 /* reset counter to zero, set new period */
124 davinci_writel(0, t->tim_reg); 130 __raw_writel(0, t->base + t->tim_off);
125 davinci_writel(t->period, t->prd_reg); 131 __raw_writel(t->period, t->base + t->prd_off);
126 132
127 /* Set enable mode */ 133 /* Set enable mode */
128 if (t->opts & TIMER_OPTS_ONESHOT) { 134 if (t->opts & TIMER_OPTS_ONESHOT) {
@@ -131,13 +137,13 @@ static int timer32_config(struct timer_s *t)
131 tcr |= TCR_ENAMODE_PERIODIC << t->enamode_shift; 137 tcr |= TCR_ENAMODE_PERIODIC << t->enamode_shift;
132 } 138 }
133 139
134 davinci_writel(tcr, t->reg_base + TCR); 140 __raw_writel(tcr, t->base + TCR);
135 return 0; 141 return 0;
136} 142}
137 143
138static inline u32 timer32_read(struct timer_s *t) 144static inline u32 timer32_read(struct timer_s *t)
139{ 145{
140 return davinci_readl(t->tim_reg); 146 return __raw_readl(t->base + t->tim_off);
141} 147}
142 148
143static irqreturn_t timer_interrupt(int irq, void *dev_id) 149static irqreturn_t timer_interrupt(int irq, void *dev_id)
@@ -176,51 +182,54 @@ static struct timer_s timers[] = {
176 182
177static void __init timer_init(void) 183static void __init timer_init(void)
178{ 184{
179 u32 bases[] = {DAVINCI_TIMER0_BASE, DAVINCI_TIMER1_BASE}; 185 u32 phys_bases[] = {DAVINCI_TIMER0_BASE, DAVINCI_TIMER1_BASE};
180 int i; 186 int i;
181 187
182 /* Global init of each 64-bit timer as a whole */ 188 /* Global init of each 64-bit timer as a whole */
183 for(i=0; i<2; i++) { 189 for(i=0; i<2; i++) {
184 u32 tgcr, base = bases[i]; 190 u32 tgcr;
191 void __iomem *base = IO_ADDRESS(phys_bases[i]);
185 192
186 /* Disabled, Internal clock source */ 193 /* Disabled, Internal clock source */
187 davinci_writel(0, base + TCR); 194 __raw_writel(0, base + TCR);
188 195
189 /* reset both timers, no pre-scaler for timer34 */ 196 /* reset both timers, no pre-scaler for timer34 */
190 tgcr = 0; 197 tgcr = 0;
191 davinci_writel(tgcr, base + TGCR); 198 __raw_writel(tgcr, base + TGCR);
192 199
193 /* Set both timers to unchained 32-bit */ 200 /* Set both timers to unchained 32-bit */
194 tgcr = TGCR_TIMMODE_32BIT_UNCHAINED << TGCR_TIMMODE_SHIFT; 201 tgcr = TGCR_TIMMODE_32BIT_UNCHAINED << TGCR_TIMMODE_SHIFT;
195 davinci_writel(tgcr, base + TGCR); 202 __raw_writel(tgcr, base + TGCR);
196 203
197 /* Unreset timers */ 204 /* Unreset timers */
198 tgcr |= (TGCR_UNRESET << TGCR_TIM12RS_SHIFT) | 205 tgcr |= (TGCR_UNRESET << TGCR_TIM12RS_SHIFT) |
199 (TGCR_UNRESET << TGCR_TIM34RS_SHIFT); 206 (TGCR_UNRESET << TGCR_TIM34RS_SHIFT);
200 davinci_writel(tgcr, base + TGCR); 207 __raw_writel(tgcr, base + TGCR);
201 208
202 /* Init both counters to zero */ 209 /* Init both counters to zero */
203 davinci_writel(0, base + TIM12); 210 __raw_writel(0, base + TIM12);
204 davinci_writel(0, base + TIM34); 211 __raw_writel(0, base + TIM34);
205 } 212 }
206 213
207 /* Init of each timer as a 32-bit timer */ 214 /* Init of each timer as a 32-bit timer */
208 for (i=0; i< ARRAY_SIZE(timers); i++) { 215 for (i=0; i< ARRAY_SIZE(timers); i++) {
209 struct timer_s *t = &timers[i]; 216 struct timer_s *t = &timers[i];
217 u32 phys_base;
210 218
211 if (t->name) { 219 if (t->name) {
212 t->id = i; 220 t->id = i;
213 t->reg_base = (IS_TIMER1(t->id) ? 221 phys_base = (IS_TIMER1(t->id) ?
214 DAVINCI_TIMER1_BASE : DAVINCI_TIMER0_BASE); 222 DAVINCI_TIMER1_BASE : DAVINCI_TIMER0_BASE);
223 t->base = IO_ADDRESS(phys_base);
215 224
216 if (IS_TIMER_BOT(t->id)) { 225 if (IS_TIMER_BOT(t->id)) {
217 t->enamode_shift = 6; 226 t->enamode_shift = 6;
218 t->tim_reg = t->reg_base + TIM12; 227 t->tim_off = TIM12;
219 t->prd_reg = t->reg_base + PRD12; 228 t->prd_off = PRD12;
220 } else { 229 } else {
221 t->enamode_shift = 22; 230 t->enamode_shift = 22;
222 t->tim_reg = t->reg_base + TIM34; 231 t->tim_off = TIM34;
223 t->prd_reg = t->reg_base + PRD34; 232 t->prd_off = PRD34;
224 } 233 }
225 234
226 /* Register interrupt */ 235 /* Register interrupt */
@@ -274,7 +283,7 @@ static void davinci_set_mode(enum clock_event_mode mode,
274 283
275 switch (mode) { 284 switch (mode) {
276 case CLOCK_EVT_MODE_PERIODIC: 285 case CLOCK_EVT_MODE_PERIODIC:
277 t->period = CLOCK_TICK_RATE / (HZ); 286 t->period = davinci_clock_tick_rate / (HZ);
278 t->opts = TIMER_OPTS_PERIODIC; 287 t->opts = TIMER_OPTS_PERIODIC;
279 timer32_config(t); 288 timer32_config(t);
280 break; 289 break;
@@ -301,21 +310,29 @@ static struct clock_event_device clockevent_davinci = {
301 310
302static void __init davinci_timer_init(void) 311static void __init davinci_timer_init(void)
303{ 312{
313 struct clk *timer_clk;
314
304 static char err[] __initdata = KERN_ERR 315 static char err[] __initdata = KERN_ERR
305 "%s: can't register clocksource!\n"; 316 "%s: can't register clocksource!\n";
306 317
307 /* init timer hw */ 318 /* init timer hw */
308 timer_init(); 319 timer_init();
309 320
321 timer_clk = clk_get(NULL, "timer0");
322 BUG_ON(IS_ERR(timer_clk));
323 clk_enable(timer_clk);
324
325 davinci_clock_tick_rate = clk_get_rate(timer_clk);
326
310 /* setup clocksource */ 327 /* setup clocksource */
311 clocksource_davinci.mult = 328 clocksource_davinci.mult =
312 clocksource_khz2mult(CLOCK_TICK_RATE/1000, 329 clocksource_khz2mult(davinci_clock_tick_rate/1000,
313 clocksource_davinci.shift); 330 clocksource_davinci.shift);
314 if (clocksource_register(&clocksource_davinci)) 331 if (clocksource_register(&clocksource_davinci))
315 printk(err, clocksource_davinci.name); 332 printk(err, clocksource_davinci.name);
316 333
317 /* setup clockevent */ 334 /* setup clockevent */
318 clockevent_davinci.mult = div_sc(CLOCK_TICK_RATE, NSEC_PER_SEC, 335 clockevent_davinci.mult = div_sc(davinci_clock_tick_rate, NSEC_PER_SEC,
319 clockevent_davinci.shift); 336 clockevent_davinci.shift);
320 clockevent_davinci.max_delta_ns = 337 clockevent_davinci.max_delta_ns =
321 clockevent_delta2ns(0xfffffffe, &clockevent_davinci); 338 clockevent_delta2ns(0xfffffffe, &clockevent_davinci);
@@ -333,42 +350,52 @@ struct sys_timer davinci_timer = {
333 350
334/* reset board using watchdog timer */ 351/* reset board using watchdog timer */
335void davinci_watchdog_reset(void) { 352void davinci_watchdog_reset(void) {
336 u32 tgcr, wdtcr, base = DAVINCI_WDOG_BASE; 353 u32 tgcr, wdtcr;
354 void __iomem *base = IO_ADDRESS(DAVINCI_WDOG_BASE);
355 struct device dev;
356 struct clk *wd_clk;
357 char *name = "watchdog";
358
359 dev_set_name(&dev, name);
360 wd_clk = clk_get(&dev, NULL);
361 if (WARN_ON(IS_ERR(wd_clk)))
362 return;
363 clk_enable(wd_clk);
337 364
338 /* disable, internal clock source */ 365 /* disable, internal clock source */
339 davinci_writel(0, base + TCR); 366 __raw_writel(0, base + TCR);
340 367
341 /* reset timer, set mode to 64-bit watchdog, and unreset */ 368 /* reset timer, set mode to 64-bit watchdog, and unreset */
342 tgcr = 0; 369 tgcr = 0;
343 davinci_writel(tgcr, base + TCR); 370 __raw_writel(tgcr, base + TCR);
344 tgcr = TGCR_TIMMODE_64BIT_WDOG << TGCR_TIMMODE_SHIFT; 371 tgcr = TGCR_TIMMODE_64BIT_WDOG << TGCR_TIMMODE_SHIFT;
345 tgcr |= (TGCR_UNRESET << TGCR_TIM12RS_SHIFT) | 372 tgcr |= (TGCR_UNRESET << TGCR_TIM12RS_SHIFT) |
346 (TGCR_UNRESET << TGCR_TIM34RS_SHIFT); 373 (TGCR_UNRESET << TGCR_TIM34RS_SHIFT);
347 davinci_writel(tgcr, base + TCR); 374 __raw_writel(tgcr, base + TCR);
348 375
349 /* clear counter and period regs */ 376 /* clear counter and period regs */
350 davinci_writel(0, base + TIM12); 377 __raw_writel(0, base + TIM12);
351 davinci_writel(0, base + TIM34); 378 __raw_writel(0, base + TIM34);
352 davinci_writel(0, base + PRD12); 379 __raw_writel(0, base + PRD12);
353 davinci_writel(0, base + PRD34); 380 __raw_writel(0, base + PRD34);
354 381
355 /* enable */ 382 /* enable */
356 wdtcr = davinci_readl(base + WDTCR); 383 wdtcr = __raw_readl(base + WDTCR);
357 wdtcr |= WDTCR_WDEN_ENABLE << WDTCR_WDEN_SHIFT; 384 wdtcr |= WDTCR_WDEN_ENABLE << WDTCR_WDEN_SHIFT;
358 davinci_writel(wdtcr, base + WDTCR); 385 __raw_writel(wdtcr, base + WDTCR);
359 386
360 /* put watchdog in pre-active state */ 387 /* put watchdog in pre-active state */
361 wdtcr = (WDTCR_WDKEY_SEQ0 << WDTCR_WDKEY_SHIFT) | 388 wdtcr = (WDTCR_WDKEY_SEQ0 << WDTCR_WDKEY_SHIFT) |
362 (WDTCR_WDEN_ENABLE << WDTCR_WDEN_SHIFT); 389 (WDTCR_WDEN_ENABLE << WDTCR_WDEN_SHIFT);
363 davinci_writel(wdtcr, base + WDTCR); 390 __raw_writel(wdtcr, base + WDTCR);
364 391
365 /* put watchdog in active state */ 392 /* put watchdog in active state */
366 wdtcr = (WDTCR_WDKEY_SEQ1 << WDTCR_WDKEY_SHIFT) | 393 wdtcr = (WDTCR_WDKEY_SEQ1 << WDTCR_WDKEY_SHIFT) |
367 (WDTCR_WDEN_ENABLE << WDTCR_WDEN_SHIFT); 394 (WDTCR_WDEN_ENABLE << WDTCR_WDEN_SHIFT);
368 davinci_writel(wdtcr, base + WDTCR); 395 __raw_writel(wdtcr, base + WDTCR);
369 396
370 /* write an invalid value to the WDKEY field to trigger 397 /* write an invalid value to the WDKEY field to trigger
371 * a watchdog reset */ 398 * a watchdog reset */
372 wdtcr = 0x00004000; 399 wdtcr = 0x00004000;
373 davinci_writel(wdtcr, base + WDTCR); 400 __raw_writel(wdtcr, base + WDTCR);
374} 401}
diff --git a/arch/arm/mach-davinci/usb.c b/arch/arm/mach-davinci/usb.c
index 2429b79f6da..abedb633718 100644
--- a/arch/arm/mach-davinci/usb.c
+++ b/arch/arm/mach-davinci/usb.c
@@ -14,6 +14,8 @@
14#include <mach/hardware.h> 14#include <mach/hardware.h>
15#include <mach/irqs.h> 15#include <mach/irqs.h>
16 16
17#define DAVINCI_USB_OTG_BASE 0x01C64000
18
17#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE) 19#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
18static struct musb_hdrc_eps_bits musb_eps[] = { 20static struct musb_hdrc_eps_bits musb_eps[] = {
19 { "ep1_tx", 8, }, 21 { "ep1_tx", 8, },
diff --git a/arch/arm/mach-omap1/board-h2-mmc.c b/arch/arm/mach-omap1/board-h2-mmc.c
index 44d4a966bed..46098f54682 100644
--- a/arch/arm/mach-omap1/board-h2-mmc.c
+++ b/arch/arm/mach-omap1/board-h2-mmc.c
@@ -26,19 +26,13 @@
26static int mmc_set_power(struct device *dev, int slot, int power_on, 26static int mmc_set_power(struct device *dev, int slot, int power_on,
27 int vdd) 27 int vdd)
28{ 28{
29 if (power_on) 29 gpio_set_value(H2_TPS_GPIO_MMC_PWR_EN, power_on);
30 gpio_direction_output(H2_TPS_GPIO_MMC_PWR_EN, 1);
31 else
32 gpio_direction_output(H2_TPS_GPIO_MMC_PWR_EN, 0);
33
34 return 0; 30 return 0;
35} 31}
36 32
37static int mmc_late_init(struct device *dev) 33static int mmc_late_init(struct device *dev)
38{ 34{
39 int ret; 35 int ret = gpio_request(H2_TPS_GPIO_MMC_PWR_EN, "MMC power");
40
41 ret = gpio_request(H2_TPS_GPIO_MMC_PWR_EN, "MMC power");
42 if (ret < 0) 36 if (ret < 0)
43 return ret; 37 return ret;
44 38
@@ -47,7 +41,7 @@ static int mmc_late_init(struct device *dev)
47 return ret; 41 return ret;
48} 42}
49 43
50static void mmc_shutdown(struct device *dev) 44static void mmc_cleanup(struct device *dev)
51{ 45{
52 gpio_free(H2_TPS_GPIO_MMC_PWR_EN); 46 gpio_free(H2_TPS_GPIO_MMC_PWR_EN);
53} 47}
@@ -60,7 +54,7 @@ static void mmc_shutdown(struct device *dev)
60static struct omap_mmc_platform_data mmc1_data = { 54static struct omap_mmc_platform_data mmc1_data = {
61 .nr_slots = 1, 55 .nr_slots = 1,
62 .init = mmc_late_init, 56 .init = mmc_late_init,
63 .shutdown = mmc_shutdown, 57 .cleanup = mmc_cleanup,
64 .dma_mask = 0xffffffff, 58 .dma_mask = 0xffffffff,
65 .slots[0] = { 59 .slots[0] = {
66 .set_power = mmc_set_power, 60 .set_power = mmc_set_power,
diff --git a/arch/arm/mach-omap1/board-h3-mmc.c b/arch/arm/mach-omap1/board-h3-mmc.c
index 0d8a3c195e2..5e8877ce35e 100644
--- a/arch/arm/mach-omap1/board-h3-mmc.c
+++ b/arch/arm/mach-omap1/board-h3-mmc.c
@@ -26,11 +26,7 @@
26static int mmc_set_power(struct device *dev, int slot, int power_on, 26static int mmc_set_power(struct device *dev, int slot, int power_on,
27 int vdd) 27 int vdd)
28{ 28{
29 if (power_on) 29 gpio_set_value(H3_TPS_GPIO_MMC_PWR_EN, power_on);
30 gpio_direction_output(H3_TPS_GPIO_MMC_PWR_EN, 1);
31 else
32 gpio_direction_output(H3_TPS_GPIO_MMC_PWR_EN, 0);
33
34 return 0; 30 return 0;
35} 31}
36 32
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index 4695965114c..f597968733b 100644
--- a/arch/arm/mach-omap1/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -39,12 +39,10 @@
39#include <asm/mach/flash.h> 39#include <asm/mach/flash.h>
40#include <asm/mach/map.h> 40#include <asm/mach/map.h>
41 41
42#include <mach/gpioexpander.h>
43#include <mach/irqs.h> 42#include <mach/irqs.h>
44#include <mach/mux.h> 43#include <mach/mux.h>
45#include <mach/tc.h> 44#include <mach/tc.h>
46#include <mach/nand.h> 45#include <mach/nand.h>
47#include <mach/irda.h>
48#include <mach/usb.h> 46#include <mach/usb.h>
49#include <mach/keypad.h> 47#include <mach/keypad.h>
50#include <mach/dma.h> 48#include <mach/dma.h>
@@ -276,104 +274,6 @@ static struct platform_device h3_kp_device = {
276 .resource = h3_kp_resources, 274 .resource = h3_kp_resources,
277}; 275};
278 276
279
280/* Select between the IrDA and aGPS module
281 */
282static int h3_select_irda(struct device *dev, int state)
283{
284 unsigned char expa;
285 int err = 0;
286
287 if ((err = read_gpio_expa(&expa, 0x26))) {
288 printk(KERN_ERR "Error reading from I/O EXPANDER \n");
289 return err;
290 }
291
292 /* 'P6' enable/disable IRDA_TX and IRDA_RX */
293 if (state & IR_SEL) { /* IrDA */
294 if ((err = write_gpio_expa(expa | 0x40, 0x26))) {
295 printk(KERN_ERR "Error writing to I/O EXPANDER \n");
296 return err;
297 }
298 } else {
299 if ((err = write_gpio_expa(expa & ~0x40, 0x26))) {
300 printk(KERN_ERR "Error writing to I/O EXPANDER \n");
301 return err;
302 }
303 }
304 return err;
305}
306
307static void set_trans_mode(struct work_struct *work)
308{
309 struct omap_irda_config *irda_config =
310 container_of(work, struct omap_irda_config, gpio_expa.work);
311 int mode = irda_config->mode;
312 unsigned char expa;
313 int err = 0;
314
315 if ((err = read_gpio_expa(&expa, 0x27)) != 0) {
316 printk(KERN_ERR "Error reading from I/O expander\n");
317 }
318
319 expa &= ~0x03;
320
321 if (mode & IR_SIRMODE) {
322 expa |= 0x01;
323 } else { /* MIR/FIR */
324 expa |= 0x03;
325 }
326
327 if ((err = write_gpio_expa(expa, 0x27)) != 0) {
328 printk(KERN_ERR "Error writing to I/O expander\n");
329 }
330}
331
332static int h3_transceiver_mode(struct device *dev, int mode)
333{
334 struct omap_irda_config *irda_config = dev->platform_data;
335
336 irda_config->mode = mode;
337 cancel_delayed_work(&irda_config->gpio_expa);
338 PREPARE_DELAYED_WORK(&irda_config->gpio_expa, set_trans_mode);
339 schedule_delayed_work(&irda_config->gpio_expa, 0);
340
341 return 0;
342}
343
344static struct omap_irda_config h3_irda_data = {
345 .transceiver_cap = IR_SIRMODE | IR_MIRMODE | IR_FIRMODE,
346 .transceiver_mode = h3_transceiver_mode,
347 .select_irda = h3_select_irda,
348 .rx_channel = OMAP_DMA_UART3_RX,
349 .tx_channel = OMAP_DMA_UART3_TX,
350 .dest_start = UART3_THR,
351 .src_start = UART3_RHR,
352 .tx_trigger = 0,
353 .rx_trigger = 0,
354};
355
356static struct resource h3_irda_resources[] = {
357 [0] = {
358 .start = INT_UART3,
359 .end = INT_UART3,
360 .flags = IORESOURCE_IRQ,
361 },
362};
363
364static u64 irda_dmamask = 0xffffffff;
365
366static struct platform_device h3_irda_device = {
367 .name = "omapirda",
368 .id = 0,
369 .dev = {
370 .platform_data = &h3_irda_data,
371 .dma_mask = &irda_dmamask,
372 },
373 .num_resources = ARRAY_SIZE(h3_irda_resources),
374 .resource = h3_irda_resources,
375};
376
377static struct platform_device h3_lcd_device = { 277static struct platform_device h3_lcd_device = {
378 .name = "lcd_h3", 278 .name = "lcd_h3",
379 .id = -1, 279 .id = -1,
@@ -395,7 +295,6 @@ static struct platform_device *devices[] __initdata = {
395 &nand_device, 295 &nand_device,
396 &smc91x_device, 296 &smc91x_device,
397 &intlat_device, 297 &intlat_device,
398 &h3_irda_device,
399 &h3_kp_device, 298 &h3_kp_device,
400 &h3_lcd_device, 299 &h3_lcd_device,
401}; 300};
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index 7bc7a3cb9c5..d1ed1365319 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -181,11 +181,7 @@ static struct omap_usb_config nokia770_usb_config __initdata = {
181static int nokia770_mmc_set_power(struct device *dev, int slot, int power_on, 181static int nokia770_mmc_set_power(struct device *dev, int slot, int power_on,
182 int vdd) 182 int vdd)
183{ 183{
184 if (power_on) 184 gpio_set_value(NOKIA770_GPIO_MMC_POWER, power_on);
185 gpio_set_value(NOKIA770_GPIO_MMC_POWER, 1);
186 else
187 gpio_set_value(NOKIA770_GPIO_MMC_POWER, 0);
188
189 return 0; 185 return 0;
190} 186}
191 187
diff --git a/arch/arm/mach-omap1/mcbsp.c b/arch/arm/mach-omap1/mcbsp.c
index d040c3f1027..a2d7814896b 100644
--- a/arch/arm/mach-omap1/mcbsp.c
+++ b/arch/arm/mach-omap1/mcbsp.c
@@ -40,8 +40,8 @@ static void omap1_mcbsp_request(unsigned int id)
40 */ 40 */
41 if (id == OMAP_MCBSP1 || id == OMAP_MCBSP3) { 41 if (id == OMAP_MCBSP1 || id == OMAP_MCBSP3) {
42 if (dsp_use++ == 0) { 42 if (dsp_use++ == 0) {
43 api_clk = clk_get(NULL, "api_clk"); 43 api_clk = clk_get(NULL, "api_ck");
44 dsp_clk = clk_get(NULL, "dsp_clk"); 44 dsp_clk = clk_get(NULL, "dsp_ck");
45 if (!IS_ERR(api_clk) && !IS_ERR(dsp_clk)) { 45 if (!IS_ERR(api_clk) && !IS_ERR(dsp_clk)) {
46 clk_enable(api_clk); 46 clk_enable(api_clk);
47 clk_enable(dsp_clk); 47 clk_enable(dsp_clk);
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c
index a0267a9ab46..e7d017cdc43 100644
--- a/arch/arm/mach-omap2/board-h4.c
+++ b/arch/arm/mach-omap2/board-h4.c
@@ -33,10 +33,8 @@
33 33
34#include <mach/control.h> 34#include <mach/control.h>
35#include <mach/gpio.h> 35#include <mach/gpio.h>
36#include <mach/gpioexpander.h>
37#include <mach/mux.h> 36#include <mach/mux.h>
38#include <mach/usb.h> 37#include <mach/usb.h>
39#include <mach/irda.h>
40#include <mach/board.h> 38#include <mach/board.h>
41#include <mach/common.h> 39#include <mach/common.h>
42#include <mach/keypad.h> 40#include <mach/keypad.h>
@@ -138,98 +136,6 @@ static struct platform_device h4_flash_device = {
138 .resource = &h4_flash_resource, 136 .resource = &h4_flash_resource,
139}; 137};
140 138
141/* Select between the IrDA and aGPS module
142 */
143static int h4_select_irda(struct device *dev, int state)
144{
145 unsigned char expa;
146 int err = 0;
147
148 if ((err = read_gpio_expa(&expa, 0x21))) {
149 printk(KERN_ERR "Error reading from I/O expander\n");
150 return err;
151 }
152
153 /* 'P6' enable/disable IRDA_TX and IRDA_RX */
154 if (state & IR_SEL) { /* IrDa */
155 if ((err = write_gpio_expa(expa | 0x01, 0x21))) {
156 printk(KERN_ERR "Error writing to I/O expander\n");
157 return err;
158 }
159 } else {
160 if ((err = write_gpio_expa(expa & ~0x01, 0x21))) {
161 printk(KERN_ERR "Error writing to I/O expander\n");
162 return err;
163 }
164 }
165 return err;
166}
167
168static void set_trans_mode(struct work_struct *work)
169{
170 struct omap_irda_config *irda_config =
171 container_of(work, struct omap_irda_config, gpio_expa.work);
172 int mode = irda_config->mode;
173 unsigned char expa;
174 int err = 0;
175
176 if ((err = read_gpio_expa(&expa, 0x20)) != 0) {
177 printk(KERN_ERR "Error reading from I/O expander\n");
178 }
179
180 expa &= ~0x01;
181
182 if (!(mode & IR_SIRMODE)) { /* MIR/FIR */
183 expa |= 0x01;
184 }
185
186 if ((err = write_gpio_expa(expa, 0x20)) != 0) {
187 printk(KERN_ERR "Error writing to I/O expander\n");
188 }
189}
190
191static int h4_transceiver_mode(struct device *dev, int mode)
192{
193 struct omap_irda_config *irda_config = dev->platform_data;
194
195 irda_config->mode = mode;
196 cancel_delayed_work(&irda_config->gpio_expa);
197 PREPARE_DELAYED_WORK(&irda_config->gpio_expa, set_trans_mode);
198 schedule_delayed_work(&irda_config->gpio_expa, 0);
199
200 return 0;
201}
202
203static struct omap_irda_config h4_irda_data = {
204 .transceiver_cap = IR_SIRMODE | IR_MIRMODE | IR_FIRMODE,
205 .transceiver_mode = h4_transceiver_mode,
206 .select_irda = h4_select_irda,
207 .rx_channel = OMAP24XX_DMA_UART3_RX,
208 .tx_channel = OMAP24XX_DMA_UART3_TX,
209 .dest_start = OMAP_UART3_BASE,
210 .src_start = OMAP_UART3_BASE,
211 .tx_trigger = OMAP24XX_DMA_UART3_TX,
212 .rx_trigger = OMAP24XX_DMA_UART3_RX,
213};
214
215static struct resource h4_irda_resources[] = {
216 [0] = {
217 .start = INT_24XX_UART3_IRQ,
218 .end = INT_24XX_UART3_IRQ,
219 .flags = IORESOURCE_IRQ,
220 },
221};
222
223static struct platform_device h4_irda_device = {
224 .name = "omapirda",
225 .id = -1,
226 .dev = {
227 .platform_data = &h4_irda_data,
228 },
229 .num_resources = 1,
230 .resource = h4_irda_resources,
231};
232
233static struct omap_kp_platform_data h4_kp_data = { 139static struct omap_kp_platform_data h4_kp_data = {
234 .rows = 6, 140 .rows = 6,
235 .cols = 7, 141 .cols = 7,
@@ -255,7 +161,6 @@ static struct platform_device h4_lcd_device = {
255 161
256static struct platform_device *h4_devices[] __initdata = { 162static struct platform_device *h4_devices[] __initdata = {
257 &h4_flash_device, 163 &h4_flash_device,
258 &h4_irda_device,
259 &h4_kp_device, 164 &h4_kp_device,
260 &h4_lcd_device, 165 &h4_lcd_device,
261}; 166};
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 744740ae1b9..3a7a29d1f9a 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -42,6 +42,7 @@
42#include <mach/nand.h> 42#include <mach/nand.h>
43#include <mach/mux.h> 43#include <mach/mux.h>
44#include <mach/usb.h> 44#include <mach/usb.h>
45#include <mach/timer-gp.h>
45 46
46#include "mmc-twl4030.h" 47#include "mmc-twl4030.h"
47 48
@@ -186,6 +187,9 @@ static void __init omap3_beagle_init_irq(void)
186{ 187{
187 omap2_init_common_hw(NULL); 188 omap2_init_common_hw(NULL);
188 omap_init_irq(); 189 omap_init_irq();
190#ifdef CONFIG_OMAP_32K_TIMER
191 omap2_gp_clockevent_set_gptimer(12);
192#endif
189 omap_gpio_init(); 193 omap_gpio_init();
190} 194}
191 195
diff --git a/arch/arm/mach-omap2/board-rx51.c b/arch/arm/mach-omap2/board-rx51.c
index 3a0daac6c83..374ff63c3eb 100644
--- a/arch/arm/mach-omap2/board-rx51.c
+++ b/arch/arm/mach-omap2/board-rx51.c
@@ -15,7 +15,6 @@
15#include <linux/err.h> 15#include <linux/err.h>
16#include <linux/clk.h> 16#include <linux/clk.h>
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/delay.h>
19#include <linux/gpio.h> 18#include <linux/gpio.h>
20 19
21#include <mach/hardware.h> 20#include <mach/hardware.h>
diff --git a/arch/arm/mach-omap2/clock24xx.c b/arch/arm/mach-omap2/clock24xx.c
index 1e839c5a28c..efc59c49341 100644
--- a/arch/arm/mach-omap2/clock24xx.c
+++ b/arch/arm/mach-omap2/clock24xx.c
@@ -60,12 +60,13 @@ struct omap_clk {
60 }, \ 60 }, \
61 } 61 }
62 62
63#define CK_243X (1 << 0) 63#define CK_243X RATE_IN_243X
64#define CK_242X (1 << 1) 64#define CK_242X RATE_IN_242X
65 65
66static struct omap_clk omap24xx_clks[] = { 66static struct omap_clk omap24xx_clks[] = {
67 /* external root sources */ 67 /* external root sources */
68 CLK(NULL, "func_32k_ck", &func_32k_ck, CK_243X | CK_242X), 68 CLK(NULL, "func_32k_ck", &func_32k_ck, CK_243X | CK_242X),
69 CLK(NULL, "secure_32k_ck", &secure_32k_ck, CK_243X | CK_242X),
69 CLK(NULL, "osc_ck", &osc_ck, CK_243X | CK_242X), 70 CLK(NULL, "osc_ck", &osc_ck, CK_243X | CK_242X),
70 CLK(NULL, "sys_ck", &sys_ck, CK_243X | CK_242X), 71 CLK(NULL, "sys_ck", &sys_ck, CK_243X | CK_242X),
71 CLK(NULL, "alt_ck", &alt_ck, CK_243X | CK_242X), 72 CLK(NULL, "alt_ck", &alt_ck, CK_243X | CK_242X),
@@ -711,7 +712,7 @@ int __init omap2_clk_init(void)
711{ 712{
712 struct prcm_config *prcm; 713 struct prcm_config *prcm;
713 struct omap_clk *c; 714 struct omap_clk *c;
714 u32 clkrate, cpu_mask; 715 u32 clkrate;
715 716
716 if (cpu_is_omap242x()) 717 if (cpu_is_omap242x())
717 cpu_mask = RATE_IN_242X; 718 cpu_mask = RATE_IN_242X;
@@ -720,21 +721,15 @@ int __init omap2_clk_init(void)
720 721
721 clk_init(&omap2_clk_functions); 722 clk_init(&omap2_clk_functions);
722 723
724 for (c = omap24xx_clks; c < omap24xx_clks + ARRAY_SIZE(omap24xx_clks); c++)
725 clk_init_one(c->lk.clk);
726
723 osc_ck.rate = omap2_osc_clk_recalc(&osc_ck); 727 osc_ck.rate = omap2_osc_clk_recalc(&osc_ck);
724 propagate_rate(&osc_ck); 728 propagate_rate(&osc_ck);
725 sys_ck.rate = omap2_sys_clk_recalc(&sys_ck); 729 sys_ck.rate = omap2_sys_clk_recalc(&sys_ck);
726 propagate_rate(&sys_ck); 730 propagate_rate(&sys_ck);
727 731
728 for (c = omap24xx_clks; c < omap24xx_clks + ARRAY_SIZE(omap24xx_clks); c++) 732 for (c = omap24xx_clks; c < omap24xx_clks + ARRAY_SIZE(omap24xx_clks); c++)
729 clk_init_one(c->lk.clk);
730
731 cpu_mask = 0;
732 if (cpu_is_omap2420())
733 cpu_mask |= CK_242X;
734 if (cpu_is_omap2430())
735 cpu_mask |= CK_243X;
736
737 for (c = omap24xx_clks; c < omap24xx_clks + ARRAY_SIZE(omap24xx_clks); c++)
738 if (c->cpu & cpu_mask) { 733 if (c->cpu & cpu_mask) {
739 clkdev_add(&c->lk); 734 clkdev_add(&c->lk);
740 clk_register(c->lk.clk); 735 clk_register(c->lk.clk);
diff --git a/arch/arm/mach-omap2/clock24xx.h b/arch/arm/mach-omap2/clock24xx.h
index 33c3e5b1432..88c5acb40fc 100644
--- a/arch/arm/mach-omap2/clock24xx.h
+++ b/arch/arm/mach-omap2/clock24xx.h
@@ -625,6 +625,14 @@ static struct clk func_32k_ck = {
625 .clkdm_name = "wkup_clkdm", 625 .clkdm_name = "wkup_clkdm",
626}; 626};
627 627
628static struct clk secure_32k_ck = {
629 .name = "secure_32k_ck",
630 .ops = &clkops_null,
631 .rate = 32768,
632 .flags = RATE_FIXED,
633 .clkdm_name = "wkup_clkdm",
634};
635
628/* Typical 12/13MHz in standalone mode, will be 26Mhz in chassis mode */ 636/* Typical 12/13MHz in standalone mode, will be 26Mhz in chassis mode */
629static struct clk osc_ck = { /* (*12, *13, 19.2, *26, 38.4)MHz */ 637static struct clk osc_ck = { /* (*12, *13, 19.2, *26, 38.4)MHz */
630 .name = "osc_ck", 638 .name = "osc_ck",
@@ -1790,7 +1798,7 @@ static struct clk gpt12_ick = {
1790static struct clk gpt12_fck = { 1798static struct clk gpt12_fck = {
1791 .name = "gpt12_fck", 1799 .name = "gpt12_fck",
1792 .ops = &clkops_omap2_dflt_wait, 1800 .ops = &clkops_omap2_dflt_wait,
1793 .parent = &func_32k_ck, 1801 .parent = &secure_32k_ck,
1794 .clkdm_name = "core_l4_clkdm", 1802 .clkdm_name = "core_l4_clkdm",
1795 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 1803 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1796 .enable_bit = OMAP24XX_EN_GPT12_SHIFT, 1804 .enable_bit = OMAP24XX_EN_GPT12_SHIFT,
diff --git a/arch/arm/mach-omap2/clock34xx.h b/arch/arm/mach-omap2/clock34xx.h
index 70ec10deb65..6763b8f7302 100644
--- a/arch/arm/mach-omap2/clock34xx.h
+++ b/arch/arm/mach-omap2/clock34xx.h
@@ -2052,7 +2052,7 @@ static struct clk dss_ick = {
2052 2052
2053static struct clk cam_mclk = { 2053static struct clk cam_mclk = {
2054 .name = "cam_mclk", 2054 .name = "cam_mclk",
2055 .ops = &clkops_omap2_dflt_wait, 2055 .ops = &clkops_omap2_dflt,
2056 .parent = &dpll4_m5x2_ck, 2056 .parent = &dpll4_m5x2_ck,
2057 .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_FCLKEN), 2057 .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_FCLKEN),
2058 .enable_bit = OMAP3430_EN_CAM_SHIFT, 2058 .enable_bit = OMAP3430_EN_CAM_SHIFT,
@@ -2063,7 +2063,7 @@ static struct clk cam_mclk = {
2063static struct clk cam_ick = { 2063static struct clk cam_ick = {
2064 /* Handles both L3 and L4 clocks */ 2064 /* Handles both L3 and L4 clocks */
2065 .name = "cam_ick", 2065 .name = "cam_ick",
2066 .ops = &clkops_omap2_dflt_wait, 2066 .ops = &clkops_omap2_dflt,
2067 .parent = &l4_ick, 2067 .parent = &l4_ick,
2068 .init = &omap2_init_clk_clkdm, 2068 .init = &omap2_init_clk_clkdm,
2069 .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_ICLKEN), 2069 .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_ICLKEN),
@@ -2074,7 +2074,7 @@ static struct clk cam_ick = {
2074 2074
2075static struct clk csi2_96m_fck = { 2075static struct clk csi2_96m_fck = {
2076 .name = "csi2_96m_fck", 2076 .name = "csi2_96m_fck",
2077 .ops = &clkops_omap2_dflt_wait, 2077 .ops = &clkops_omap2_dflt,
2078 .parent = &core_96m_fck, 2078 .parent = &core_96m_fck,
2079 .init = &omap2_init_clk_clkdm, 2079 .init = &omap2_init_clk_clkdm,
2080 .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_FCLKEN), 2080 .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_FCLKEN),
@@ -2901,7 +2901,6 @@ static struct clk sr_l4_ick = {
2901 2901
2902/* SECURE_32K_FCK clocks */ 2902/* SECURE_32K_FCK clocks */
2903 2903
2904/* XXX This clock no longer exists in 3430 TRM rev F */
2905static struct clk gpt12_fck = { 2904static struct clk gpt12_fck = {
2906 .name = "gpt12_fck", 2905 .name = "gpt12_fck",
2907 .ops = &clkops_null, 2906 .ops = &clkops_null,
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index d6b4b2f8722..496983ade97 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -25,7 +25,6 @@
25#include <mach/board.h> 25#include <mach/board.h>
26#include <mach/mux.h> 26#include <mach/mux.h>
27#include <mach/gpio.h> 27#include <mach/gpio.h>
28#include <mach/eac.h>
29#include <mach/mmc.h> 28#include <mach/mmc.h>
30 29
31#if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE) 30#if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE)
@@ -366,38 +365,6 @@ static void omap_init_mcspi(void)
366static inline void omap_init_mcspi(void) {} 365static inline void omap_init_mcspi(void) {}
367#endif 366#endif
368 367
369#ifdef CONFIG_SND_OMAP24XX_EAC
370
371#define OMAP2_EAC_BASE 0x48090000
372
373static struct resource omap2_eac_resources[] = {
374 {
375 .start = OMAP2_EAC_BASE,
376 .end = OMAP2_EAC_BASE + 0x109,
377 .flags = IORESOURCE_MEM,
378 },
379};
380
381static struct platform_device omap2_eac_device = {
382 .name = "omap24xx-eac",
383 .id = -1,
384 .num_resources = ARRAY_SIZE(omap2_eac_resources),
385 .resource = omap2_eac_resources,
386 .dev = {
387 .platform_data = NULL,
388 },
389};
390
391void omap_init_eac(struct eac_platform_data *pdata)
392{
393 omap2_eac_device.dev.platform_data = pdata;
394 platform_device_register(&omap2_eac_device);
395}
396
397#else
398void omap_init_eac(struct eac_platform_data *pdata) {}
399#endif
400
401#ifdef CONFIG_OMAP_SHA1_MD5 368#ifdef CONFIG_OMAP_SHA1_MD5
402static struct resource sha1_md5_resources[] = { 369static struct resource sha1_md5_resources[] = {
403 { 370 {
diff --git a/arch/arm/mach-omap2/irq.c b/arch/arm/mach-omap2/irq.c
index 9ba20d985dd..998c5c45587 100644
--- a/arch/arm/mach-omap2/irq.c
+++ b/arch/arm/mach-omap2/irq.c
@@ -73,9 +73,9 @@ static int omap_check_spurious(unsigned int irq)
73 u32 sir, spurious; 73 u32 sir, spurious;
74 74
75 sir = intc_bank_read_reg(&irq_banks[0], INTC_SIR); 75 sir = intc_bank_read_reg(&irq_banks[0], INTC_SIR);
76 spurious = sir >> 6; 76 spurious = sir >> 7;
77 77
78 if (spurious > 1) { 78 if (spurious) {
79 printk(KERN_WARNING "Spurious irq %i: 0x%08x, please flush " 79 printk(KERN_WARNING "Spurious irq %i: 0x%08x, please flush "
80 "posted write for irq %i\n", 80 "posted write for irq %i\n",
81 irq, sir, previous_irq); 81 irq, sir, previous_irq);
diff --git a/arch/arm/mach-omap2/timer-gp.c b/arch/arm/mach-omap2/timer-gp.c
index 1cb2c0909c2..f36aba12090 100644
--- a/arch/arm/mach-omap2/timer-gp.c
+++ b/arch/arm/mach-omap2/timer-gp.c
@@ -3,6 +3,8 @@
3 * 3 *
4 * OMAP2 GP timer support. 4 * OMAP2 GP timer support.
5 * 5 *
6 * Copyright (C) 2009 Nokia Corporation
7 *
6 * Update to use new clocksource/clockevent layers 8 * Update to use new clocksource/clockevent layers
7 * Author: Kevin Hilman, MontaVista Software, Inc. <source@mvista.com> 9 * Author: Kevin Hilman, MontaVista Software, Inc. <source@mvista.com>
8 * Copyright (C) 2007 MontaVista Software, Inc. 10 * Copyright (C) 2007 MontaVista Software, Inc.
@@ -36,8 +38,13 @@
36#include <asm/mach/time.h> 38#include <asm/mach/time.h>
37#include <mach/dmtimer.h> 39#include <mach/dmtimer.h>
38 40
41/* MAX_GPTIMER_ID: number of GPTIMERs on the chip */
42#define MAX_GPTIMER_ID 12
43
39static struct omap_dm_timer *gptimer; 44static struct omap_dm_timer *gptimer;
40static struct clock_event_device clockevent_gpt; 45static struct clock_event_device clockevent_gpt;
46static u8 __initdata gptimer_id = 1;
47static u8 __initdata inited;
41 48
42static irqreturn_t omap2_gp_timer_interrupt(int irq, void *dev_id) 49static irqreturn_t omap2_gp_timer_interrupt(int irq, void *dev_id)
43{ 50{
@@ -95,20 +102,53 @@ static struct clock_event_device clockevent_gpt = {
95 .set_mode = omap2_gp_timer_set_mode, 102 .set_mode = omap2_gp_timer_set_mode,
96}; 103};
97 104
105/**
106 * omap2_gp_clockevent_set_gptimer - set which GPTIMER is used for clockevents
107 * @id: GPTIMER to use (1..MAX_GPTIMER_ID)
108 *
109 * Define the GPTIMER that the system should use for the tick timer.
110 * Meant to be called from board-*.c files in the event that GPTIMER1, the
111 * default, is unsuitable. Returns -EINVAL on error or 0 on success.
112 */
113int __init omap2_gp_clockevent_set_gptimer(u8 id)
114{
115 if (id < 1 || id > MAX_GPTIMER_ID)
116 return -EINVAL;
117
118 BUG_ON(inited);
119
120 gptimer_id = id;
121
122 return 0;
123}
124
98static void __init omap2_gp_clockevent_init(void) 125static void __init omap2_gp_clockevent_init(void)
99{ 126{
100 u32 tick_rate; 127 u32 tick_rate;
128 int src;
129
130 inited = 1;
101 131
102 gptimer = omap_dm_timer_request_specific(1); 132 gptimer = omap_dm_timer_request_specific(gptimer_id);
103 BUG_ON(gptimer == NULL); 133 BUG_ON(gptimer == NULL);
104 134
105#if defined(CONFIG_OMAP_32K_TIMER) 135#if defined(CONFIG_OMAP_32K_TIMER)
106 omap_dm_timer_set_source(gptimer, OMAP_TIMER_SRC_32_KHZ); 136 src = OMAP_TIMER_SRC_32_KHZ;
107#else 137#else
108 omap_dm_timer_set_source(gptimer, OMAP_TIMER_SRC_SYS_CLK); 138 src = OMAP_TIMER_SRC_SYS_CLK;
139 WARN(gptimer_id == 12, "WARNING: GPTIMER12 can only use the "
140 "secure 32KiHz clock source\n");
109#endif 141#endif
142
143 if (gptimer_id != 12)
144 WARN(IS_ERR_VALUE(omap_dm_timer_set_source(gptimer, src)),
145 "timer-gp: omap_dm_timer_set_source() failed\n");
146
110 tick_rate = clk_get_rate(omap_dm_timer_get_fclk(gptimer)); 147 tick_rate = clk_get_rate(omap_dm_timer_get_fclk(gptimer));
111 148
149 pr_info("OMAP clockevent source: GPTIMER%d at %u Hz\n",
150 gptimer_id, tick_rate);
151
112 omap2_gp_timer_irq.dev_id = (void *)gptimer; 152 omap2_gp_timer_irq.dev_id = (void *)gptimer;
113 setup_irq(omap_dm_timer_get_irq(gptimer), &omap2_gp_timer_irq); 153 setup_irq(omap_dm_timer_get_irq(gptimer), &omap2_gp_timer_irq);
114 omap_dm_timer_set_int_enable(gptimer, OMAP_TIMER_INT_OVERFLOW); 154 omap_dm_timer_set_int_enable(gptimer, OMAP_TIMER_INT_OVERFLOW);
@@ -125,6 +165,8 @@ static void __init omap2_gp_clockevent_init(void)
125 clockevents_register_device(&clockevent_gpt); 165 clockevents_register_device(&clockevent_gpt);
126} 166}
127 167
168/* Clocksource code */
169
128#ifdef CONFIG_OMAP_32K_TIMER 170#ifdef CONFIG_OMAP_32K_TIMER
129/* 171/*
130 * When 32k-timer is enabled, don't use GPTimer for clocksource 172 * When 32k-timer is enabled, don't use GPTimer for clocksource
diff --git a/arch/arm/mach-omap2/usb-tusb6010.c b/arch/arm/mach-omap2/usb-tusb6010.c
index 15e509013de..8df55f40f4c 100644
--- a/arch/arm/mach-omap2/usb-tusb6010.c
+++ b/arch/arm/mach-omap2/usb-tusb6010.c
@@ -187,7 +187,7 @@ int tusb6010_platform_retime(unsigned is_refclk)
187 unsigned sysclk_ps; 187 unsigned sysclk_ps;
188 int status; 188 int status;
189 189
190 if (!refclk_psec) 190 if (!refclk_psec || sysclk_ps == 0)
191 return -ENODEV; 191 return -ENODEV;
192 192
193 sysclk_ps = is_refclk ? refclk_psec : TUSB6010_OSCCLK_60; 193 sysclk_ps = is_refclk ? refclk_psec : TUSB6010_OSCCLK_60;
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
index cdf21dd135b..930e364ccde 100644
--- a/arch/arm/mach-pxa/corgi.c
+++ b/arch/arm/mach-pxa/corgi.c
@@ -427,12 +427,22 @@ static struct pxa2xx_spi_master corgi_spi_info = {
427 .num_chipselect = 3, 427 .num_chipselect = 3,
428}; 428};
429 429
430static void corgi_wait_for_hsync(void)
431{
432 while (gpio_get_value(CORGI_GPIO_HSYNC))
433 cpu_relax();
434
435 while (!gpio_get_value(CORGI_GPIO_HSYNC))
436 cpu_relax();
437}
438
430static struct ads7846_platform_data corgi_ads7846_info = { 439static struct ads7846_platform_data corgi_ads7846_info = {
431 .model = 7846, 440 .model = 7846,
432 .vref_delay_usecs = 100, 441 .vref_delay_usecs = 100,
433 .x_plate_ohms = 419, 442 .x_plate_ohms = 419,
434 .y_plate_ohms = 486, 443 .y_plate_ohms = 486,
435 .gpio_pendown = CORGI_GPIO_TP_INT, 444 .gpio_pendown = CORGI_GPIO_TP_INT,
445 .wait_for_sync = corgi_wait_for_hsync,
436}; 446};
437 447
438static void corgi_ads7846_cs(u32 command) 448static void corgi_ads7846_cs(u32 command)
diff --git a/arch/arm/mach-pxa/littleton.c b/arch/arm/mach-pxa/littleton.c
index e13f6a81c22..c872b9feb4d 100644
--- a/arch/arm/mach-pxa/littleton.c
+++ b/arch/arm/mach-pxa/littleton.c
@@ -334,6 +334,11 @@ static struct led_info littleton_da9034_leds[] = {
334 }, 334 },
335}; 335};
336 336
337static struct da9034_touch_pdata littleton_da9034_touch = {
338 .x_inverted = 1,
339 .interval_ms = 20,
340};
341
337static struct da903x_subdev_info littleton_da9034_subdevs[] = { 342static struct da903x_subdev_info littleton_da9034_subdevs[] = {
338 { 343 {
339 .name = "da903x-led", 344 .name = "da903x-led",
@@ -350,6 +355,10 @@ static struct da903x_subdev_info littleton_da9034_subdevs[] = {
350 }, { 355 }, {
351 .name = "da903x-backlight", 356 .name = "da903x-backlight",
352 .id = DA9034_ID_WLED, 357 .id = DA9034_ID_WLED,
358 }, {
359 .name = "da9034-touch",
360 .id = DA9034_ID_TOUCH,
361 .platform_data = &littleton_da9034_touch,
353 }, 362 },
354}; 363};
355 364
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index 8c61ddac119..c18e34acafc 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -299,12 +299,22 @@ static struct pxa2xx_spi_master spitz_spi_info = {
299 .num_chipselect = 3, 299 .num_chipselect = 3,
300}; 300};
301 301
302static void spitz_wait_for_hsync(void)
303{
304 while (gpio_get_value(SPITZ_GPIO_HSYNC))
305 cpu_relax();
306
307 while (!gpio_get_value(SPITZ_GPIO_HSYNC))
308 cpu_relax();
309}
310
302static struct ads7846_platform_data spitz_ads7846_info = { 311static struct ads7846_platform_data spitz_ads7846_info = {
303 .model = 7846, 312 .model = 7846,
304 .vref_delay_usecs = 100, 313 .vref_delay_usecs = 100,
305 .x_plate_ohms = 419, 314 .x_plate_ohms = 419,
306 .y_plate_ohms = 486, 315 .y_plate_ohms = 486,
307 .gpio_pendown = SPITZ_GPIO_TP_INT, 316 .gpio_pendown = SPITZ_GPIO_TP_INT,
317 .wait_for_sync = spitz_wait_for_hsync,
308}; 318};
309 319
310static void spitz_ads7846_cs(u32 command) 320static void spitz_ads7846_cs(u32 command)
diff --git a/arch/arm/mach-pxa/zylonite_pxa300.c b/arch/arm/mach-pxa/zylonite_pxa300.c
index c1f73205d07..c256c57642c 100644
--- a/arch/arm/mach-pxa/zylonite_pxa300.c
+++ b/arch/arm/mach-pxa/zylonite_pxa300.c
@@ -72,6 +72,7 @@ static mfp_cfg_t common_mfp_cfg[] __initdata = {
72 GPIO25_AC97_SDATA_IN_0, 72 GPIO25_AC97_SDATA_IN_0,
73 GPIO27_AC97_SDATA_OUT, 73 GPIO27_AC97_SDATA_OUT,
74 GPIO28_AC97_SYNC, 74 GPIO28_AC97_SYNC,
75 GPIO17_GPIO, /* SDATA_IN_1 but unused - configure to GPIO */
75 76
76 /* SSP3 */ 77 /* SSP3 */
77 GPIO91_SSP3_SCLK, 78 GPIO91_SSP3_SCLK,
@@ -126,6 +127,10 @@ static mfp_cfg_t common_mfp_cfg[] __initdata = {
126 /* Standard I2C */ 127 /* Standard I2C */
127 GPIO21_I2C_SCL, 128 GPIO21_I2C_SCL,
128 GPIO22_I2C_SDA, 129 GPIO22_I2C_SDA,
130
131 /* GPIO */
132 GPIO18_GPIO, /* GPIO Expander #0 INT_N */
133 GPIO19_GPIO, /* GPIO Expander #1 INT_N */
129}; 134};
130 135
131static mfp_cfg_t pxa300_mfp_cfg[] __initdata = { 136static mfp_cfg_t pxa300_mfp_cfg[] __initdata = {
diff --git a/arch/arm/mach-pxa/zylonite_pxa320.c b/arch/arm/mach-pxa/zylonite_pxa320.c
index 4e1c488c690..cc5a2283360 100644
--- a/arch/arm/mach-pxa/zylonite_pxa320.c
+++ b/arch/arm/mach-pxa/zylonite_pxa320.c
@@ -68,6 +68,7 @@ static mfp_cfg_t mfp_cfg[] __initdata = {
68 GPIO38_AC97_SYNC, 68 GPIO38_AC97_SYNC,
69 GPIO39_AC97_BITCLK, 69 GPIO39_AC97_BITCLK,
70 GPIO40_AC97_nACRESET, 70 GPIO40_AC97_nACRESET,
71 GPIO36_GPIO, /* SDATA_IN_1 but unused - configure to GPIO */
71 72
72 /* SSP3 */ 73 /* SSP3 */
73 GPIO89_SSP3_SCLK, 74 GPIO89_SSP3_SCLK,
diff --git a/arch/arm/mach-sa1100/lart.c b/arch/arm/mach-sa1100/lart.c
index 0cd52692d2f..1f940df0e5a 100644
--- a/arch/arm/mach-sa1100/lart.c
+++ b/arch/arm/mach-sa1100/lart.c
@@ -9,6 +9,7 @@
9#include <mach/hardware.h> 9#include <mach/hardware.h>
10#include <asm/setup.h> 10#include <asm/setup.h>
11#include <asm/mach-types.h> 11#include <asm/mach-types.h>
12#include <asm/page.h>
12 13
13#include <asm/mach/arch.h> 14#include <asm/mach/arch.h>
14#include <asm/mach/map.h> 15#include <asm/mach/map.h>
diff --git a/arch/arm/mm/cache-v6.S b/arch/arm/mm/cache-v6.S
index 2c6c2a7c05a..8f5c13f4c93 100644
--- a/arch/arm/mm/cache-v6.S
+++ b/arch/arm/mm/cache-v6.S
@@ -20,6 +20,31 @@
20#define D_CACHE_LINE_SIZE 32 20#define D_CACHE_LINE_SIZE 32
21#define BTB_FLUSH_SIZE 8 21#define BTB_FLUSH_SIZE 8
22 22
23#ifdef CONFIG_ARM_ERRATA_411920
24/*
25 * Invalidate the entire I cache (this code is a workaround for the ARM1136
26 * erratum 411920 - Invalidate Instruction Cache operation can fail. This
27 * erratum is present in 1136, 1156 and 1176. It does not affect the MPCore.
28 *
29 * Registers:
30 * r0 - set to 0
31 * r1 - corrupted
32 */
33ENTRY(v6_icache_inval_all)
34 mov r0, #0
35 mrs r1, cpsr
36 cpsid ifa @ disable interrupts
37 mcr p15, 0, r0, c7, c5, 0 @ invalidate entire I-cache
38 mcr p15, 0, r0, c7, c5, 0 @ invalidate entire I-cache
39 mcr p15, 0, r0, c7, c5, 0 @ invalidate entire I-cache
40 mcr p15, 0, r0, c7, c5, 0 @ invalidate entire I-cache
41 msr cpsr_cx, r1 @ restore interrupts
42 .rept 11 @ ARM Ltd recommends at least
43 nop @ 11 NOPs
44 .endr
45 mov pc, lr
46#endif
47
23/* 48/*
24 * v6_flush_cache_all() 49 * v6_flush_cache_all()
25 * 50 *
@@ -31,8 +56,12 @@ ENTRY(v6_flush_kern_cache_all)
31 mov r0, #0 56 mov r0, #0
32#ifdef HARVARD_CACHE 57#ifdef HARVARD_CACHE
33 mcr p15, 0, r0, c7, c14, 0 @ D cache clean+invalidate 58 mcr p15, 0, r0, c7, c14, 0 @ D cache clean+invalidate
59#ifndef CONFIG_ARM_ERRATA_411920
34 mcr p15, 0, r0, c7, c5, 0 @ I+BTB cache invalidate 60 mcr p15, 0, r0, c7, c5, 0 @ I+BTB cache invalidate
35#else 61#else
62 b v6_icache_inval_all
63#endif
64#else
36 mcr p15, 0, r0, c7, c15, 0 @ Cache clean+invalidate 65 mcr p15, 0, r0, c7, c15, 0 @ Cache clean+invalidate
37#endif 66#endif
38 mov pc, lr 67 mov pc, lr
@@ -103,8 +132,12 @@ ENTRY(v6_coherent_user_range)
103 mov r0, #0 132 mov r0, #0
104#ifdef HARVARD_CACHE 133#ifdef HARVARD_CACHE
105 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer 134 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer
135#ifndef CONFIG_ARM_ERRATA_411920
106 mcr p15, 0, r0, c7, c5, 0 @ I+BTB cache invalidate 136 mcr p15, 0, r0, c7, c5, 0 @ I+BTB cache invalidate
107#else 137#else
138 b v6_icache_inval_all
139#endif
140#else
108 mcr p15, 0, r0, c7, c5, 6 @ invalidate BTB 141 mcr p15, 0, r0, c7, c5, 6 @ invalidate BTB
109#endif 142#endif
110 mov pc, lr 143 mov pc, lr
diff --git a/arch/arm/mm/flush.c b/arch/arm/mm/flush.c
index 4e283481cee..c07222eb5ce 100644
--- a/arch/arm/mm/flush.c
+++ b/arch/arm/mm/flush.c
@@ -18,6 +18,10 @@
18 18
19#include "mm.h" 19#include "mm.h"
20 20
21#ifdef CONFIG_ARM_ERRATA_411920
22extern void v6_icache_inval_all(void);
23#endif
24
21#ifdef CONFIG_CPU_CACHE_VIPT 25#ifdef CONFIG_CPU_CACHE_VIPT
22 26
23#define ALIAS_FLUSH_START 0xffff4000 27#define ALIAS_FLUSH_START 0xffff4000
@@ -32,10 +36,15 @@ static void flush_pfn_alias(unsigned long pfn, unsigned long vaddr)
32 36
33 asm( "mcrr p15, 0, %1, %0, c14\n" 37 asm( "mcrr p15, 0, %1, %0, c14\n"
34 " mcr p15, 0, %2, c7, c10, 4\n" 38 " mcr p15, 0, %2, c7, c10, 4\n"
39#ifndef CONFIG_ARM_ERRATA_411920
35 " mcr p15, 0, %2, c7, c5, 0\n" 40 " mcr p15, 0, %2, c7, c5, 0\n"
41#endif
36 : 42 :
37 : "r" (to), "r" (to + PAGE_SIZE - L1_CACHE_BYTES), "r" (zero) 43 : "r" (to), "r" (to + PAGE_SIZE - L1_CACHE_BYTES), "r" (zero)
38 : "cc"); 44 : "cc");
45#ifdef CONFIG_ARM_ERRATA_411920
46 v6_icache_inval_all();
47#endif
39} 48}
40 49
41void flush_cache_mm(struct mm_struct *mm) 50void flush_cache_mm(struct mm_struct *mm)
@@ -48,11 +57,16 @@ void flush_cache_mm(struct mm_struct *mm)
48 57
49 if (cache_is_vipt_aliasing()) { 58 if (cache_is_vipt_aliasing()) {
50 asm( "mcr p15, 0, %0, c7, c14, 0\n" 59 asm( "mcr p15, 0, %0, c7, c14, 0\n"
60 " mcr p15, 0, %0, c7, c10, 4\n"
61#ifndef CONFIG_ARM_ERRATA_411920
51 " mcr p15, 0, %0, c7, c5, 0\n" 62 " mcr p15, 0, %0, c7, c5, 0\n"
52 " mcr p15, 0, %0, c7, c10, 4" 63#endif
53 : 64 :
54 : "r" (0) 65 : "r" (0)
55 : "cc"); 66 : "cc");
67#ifdef CONFIG_ARM_ERRATA_411920
68 v6_icache_inval_all();
69#endif
56 } 70 }
57} 71}
58 72
@@ -67,11 +81,16 @@ void flush_cache_range(struct vm_area_struct *vma, unsigned long start, unsigned
67 81
68 if (cache_is_vipt_aliasing()) { 82 if (cache_is_vipt_aliasing()) {
69 asm( "mcr p15, 0, %0, c7, c14, 0\n" 83 asm( "mcr p15, 0, %0, c7, c14, 0\n"
84 " mcr p15, 0, %0, c7, c10, 4\n"
85#ifndef CONFIG_ARM_ERRATA_411920
70 " mcr p15, 0, %0, c7, c5, 0\n" 86 " mcr p15, 0, %0, c7, c5, 0\n"
71 " mcr p15, 0, %0, c7, c10, 4" 87#endif
72 : 88 :
73 : "r" (0) 89 : "r" (0)
74 : "cc"); 90 : "cc");
91#ifdef CONFIG_ARM_ERRATA_411920
92 v6_icache_inval_all();
93#endif
75 } 94 }
76} 95}
77 96
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
index c221e26ac1d..3397f1e64d7 100644
--- a/arch/arm/mm/proc-v7.S
+++ b/arch/arm/mm/proc-v7.S
@@ -96,6 +96,9 @@ ENTRY(cpu_v7_switch_mm)
96 mov r2, #0 96 mov r2, #0
97 ldr r1, [r1, #MM_CONTEXT_ID] @ get mm->context.id 97 ldr r1, [r1, #MM_CONTEXT_ID] @ get mm->context.id
98 orr r0, r0, #TTB_FLAGS 98 orr r0, r0, #TTB_FLAGS
99#ifdef CONFIG_ARM_ERRATA_430973
100 mcr p15, 0, r2, c7, c5, 6 @ flush BTAC/BTB
101#endif
99 mcr p15, 0, r2, c13, c0, 1 @ set reserved context ID 102 mcr p15, 0, r2, c13, c0, 1 @ set reserved context ID
100 isb 103 isb
1011: mcr p15, 0, r0, c2, c0, 0 @ set TTB 0 1041: mcr p15, 0, r0, c2, c0, 0 @ set TTB 0
@@ -181,6 +184,22 @@ __v7_setup:
181 stmia r12, {r0-r5, r7, r9, r11, lr} 184 stmia r12, {r0-r5, r7, r9, r11, lr}
182 bl v7_flush_dcache_all 185 bl v7_flush_dcache_all
183 ldmia r12, {r0-r5, r7, r9, r11, lr} 186 ldmia r12, {r0-r5, r7, r9, r11, lr}
187#ifdef CONFIG_ARM_ERRATA_430973
188 mrc p15, 0, r10, c1, c0, 1 @ read aux control register
189 orr r10, r10, #(1 << 6) @ set IBE to 1
190 mcr p15, 0, r10, c1, c0, 1 @ write aux control register
191#endif
192#ifdef CONFIG_ARM_ERRATA_458693
193 mrc p15, 0, r10, c1, c0, 1 @ read aux control register
194 orr r10, r10, #(1 << 5) @ set L1NEON to 1
195 orr r10, r10, #(1 << 9) @ set PLDNOP to 1
196 mcr p15, 0, r10, c1, c0, 1 @ write aux control register
197#endif
198#ifdef CONFIG_ARM_ERRATA_460075
199 mrc p15, 1, r10, c9, c0, 2 @ read L2 cache aux ctrl register
200 orr r10, r10, #(1 << 22) @ set the Write Allocate disable bit
201 mcr p15, 1, r10, c9, c0, 2 @ write the L2 cache aux ctrl register
202#endif
184 mov r10, #0 203 mov r10, #0
185#ifdef HARVARD_CACHE 204#ifdef HARVARD_CACHE
186 mcr p15, 0, r10, c7, c5, 0 @ I+BTB cache invalidate 205 mcr p15, 0, r10, c7, c5, 0 @ I+BTB cache invalidate
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
index 2e0614552ac..29efc279287 100644
--- a/arch/arm/plat-omap/clock.c
+++ b/arch/arm/plat-omap/clock.c
@@ -239,6 +239,13 @@ void recalculate_root_clocks(void)
239 } 239 }
240} 240}
241 241
242/**
243 * clk_init_one - initialize any fields in the struct clk before clk init
244 * @clk: struct clk * to initialize
245 *
246 * Initialize any struct clk fields needed before normal clk initialization
247 * can run. No return value.
248 */
242void clk_init_one(struct clk *clk) 249void clk_init_one(struct clk *clk)
243{ 250{
244 INIT_LIST_HEAD(&clk->children); 251 INIT_LIST_HEAD(&clk->children);
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index 21cc0142b97..7fc8c045ad5 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -760,19 +760,12 @@ void omap_free_dma(int lch)
760{ 760{
761 unsigned long flags; 761 unsigned long flags;
762 762
763 spin_lock_irqsave(&dma_chan_lock, flags);
764 if (dma_chan[lch].dev_id == -1) { 763 if (dma_chan[lch].dev_id == -1) {
765 pr_err("omap_dma: trying to free unallocated DMA channel %d\n", 764 pr_err("omap_dma: trying to free unallocated DMA channel %d\n",
766 lch); 765 lch);
767 spin_unlock_irqrestore(&dma_chan_lock, flags);
768 return; 766 return;
769 } 767 }
770 768
771 dma_chan[lch].dev_id = -1;
772 dma_chan[lch].next_lch = -1;
773 dma_chan[lch].callback = NULL;
774 spin_unlock_irqrestore(&dma_chan_lock, flags);
775
776 if (cpu_class_is_omap1()) { 769 if (cpu_class_is_omap1()) {
777 /* Disable all DMA interrupts for the channel. */ 770 /* Disable all DMA interrupts for the channel. */
778 dma_write(0, CICR(lch)); 771 dma_write(0, CICR(lch));
@@ -798,6 +791,12 @@ void omap_free_dma(int lch)
798 dma_write(0, CCR(lch)); 791 dma_write(0, CCR(lch));
799 omap_clear_dma(lch); 792 omap_clear_dma(lch);
800 } 793 }
794
795 spin_lock_irqsave(&dma_chan_lock, flags);
796 dma_chan[lch].dev_id = -1;
797 dma_chan[lch].next_lch = -1;
798 dma_chan[lch].callback = NULL;
799 spin_unlock_irqrestore(&dma_chan_lock, flags);
801} 800}
802EXPORT_SYMBOL(omap_free_dma); 801EXPORT_SYMBOL(omap_free_dma);
803 802
diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index bfd47570cc9..55bb9963129 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -238,7 +238,7 @@ static struct omap_dm_timer omap3_dm_timers[] = {
238 { .phys_base = 0x49040000, .irq = INT_24XX_GPTIMER9 }, 238 { .phys_base = 0x49040000, .irq = INT_24XX_GPTIMER9 },
239 { .phys_base = 0x48086000, .irq = INT_24XX_GPTIMER10 }, 239 { .phys_base = 0x48086000, .irq = INT_24XX_GPTIMER10 },
240 { .phys_base = 0x48088000, .irq = INT_24XX_GPTIMER11 }, 240 { .phys_base = 0x48088000, .irq = INT_24XX_GPTIMER11 },
241 { .phys_base = 0x48304000, .irq = INT_24XX_GPTIMER12 }, 241 { .phys_base = 0x48304000, .irq = INT_34XX_GPT12_IRQ },
242}; 242};
243 243
244static const char *omap3_dm_source_names[] __initdata = { 244static const char *omap3_dm_source_names[] __initdata = {
@@ -321,11 +321,9 @@ static void omap_dm_timer_reset(struct omap_dm_timer *timer)
321 l |= 0x2 << 8; /* Set clock activity to perserve f-clock on idle */ 321 l |= 0x2 << 8; /* Set clock activity to perserve f-clock on idle */
322 322
323 /* 323 /*
324 * Enable wake-up only for GPT1 on OMAP2 CPUs. 324 * Enable wake-up on OMAP2 CPUs.
325 * FIXME: All timers should have wake-up enabled and clear
326 * PRCM status.
327 */ 325 */
328 if (cpu_class_is_omap2() && (timer == &dm_timers[0])) 326 if (cpu_class_is_omap2())
329 l |= 1 << 2; 327 l |= 1 << 2;
330 omap_dm_timer_write_reg(timer, OMAP_TIMER_OCP_CFG_REG, l); 328 omap_dm_timer_write_reg(timer, OMAP_TIMER_OCP_CFG_REG, l);
331 329
@@ -511,7 +509,7 @@ EXPORT_SYMBOL_GPL(omap_dm_timer_stop);
511 509
512#ifdef CONFIG_ARCH_OMAP1 510#ifdef CONFIG_ARCH_OMAP1
513 511
514void omap_dm_timer_set_source(struct omap_dm_timer *timer, int source) 512int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source)
515{ 513{
516 int n = (timer - dm_timers) << 1; 514 int n = (timer - dm_timers) << 1;
517 u32 l; 515 u32 l;
@@ -519,23 +517,31 @@ void omap_dm_timer_set_source(struct omap_dm_timer *timer, int source)
519 l = omap_readl(MOD_CONF_CTRL_1) & ~(0x03 << n); 517 l = omap_readl(MOD_CONF_CTRL_1) & ~(0x03 << n);
520 l |= source << n; 518 l |= source << n;
521 omap_writel(l, MOD_CONF_CTRL_1); 519 omap_writel(l, MOD_CONF_CTRL_1);
520
521 return 0;
522} 522}
523EXPORT_SYMBOL_GPL(omap_dm_timer_set_source); 523EXPORT_SYMBOL_GPL(omap_dm_timer_set_source);
524 524
525#else 525#else
526 526
527void omap_dm_timer_set_source(struct omap_dm_timer *timer, int source) 527int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source)
528{ 528{
529 int ret = -EINVAL;
530
529 if (source < 0 || source >= 3) 531 if (source < 0 || source >= 3)
530 return; 532 return -EINVAL;
531 533
532 clk_disable(timer->fclk); 534 clk_disable(timer->fclk);
533 clk_set_parent(timer->fclk, dm_source_clocks[source]); 535 ret = clk_set_parent(timer->fclk, dm_source_clocks[source]);
534 clk_enable(timer->fclk); 536 clk_enable(timer->fclk);
535 537
536 /* When the functional clock disappears, too quick writes seem to 538 /*
537 * cause an abort. */ 539 * When the functional clock disappears, too quick writes seem
540 * to cause an abort. XXX Is this still necessary?
541 */
538 __delay(150000); 542 __delay(150000);
543
544 return ret;
539} 545}
540EXPORT_SYMBOL_GPL(omap_dm_timer_set_source); 546EXPORT_SYMBOL_GPL(omap_dm_timer_set_source);
541 547
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index d3fa41e3d8c..17d7afe42b8 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -758,8 +758,12 @@ static void _clear_gpio_irqbank(struct gpio_bank *bank, int gpio_mask)
758 758
759 /* Workaround for clearing DSP GPIO interrupts to allow retention */ 759 /* Workaround for clearing DSP GPIO interrupts to allow retention */
760#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 760#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX)
761 reg = bank->base + OMAP24XX_GPIO_IRQSTATUS2;
761 if (cpu_is_omap24xx() || cpu_is_omap34xx()) 762 if (cpu_is_omap24xx() || cpu_is_omap34xx())
762 __raw_writel(gpio_mask, bank->base + OMAP24XX_GPIO_IRQSTATUS2); 763 __raw_writel(gpio_mask, reg);
764
765 /* Flush posted write for the irq status to avoid spurious interrupts */
766 __raw_readl(reg);
763#endif 767#endif
764} 768}
765 769
@@ -921,13 +925,10 @@ static int _set_gpio_wakeup(struct gpio_bank *bank, int gpio, int enable)
921 case METHOD_MPUIO: 925 case METHOD_MPUIO:
922 case METHOD_GPIO_1610: 926 case METHOD_GPIO_1610:
923 spin_lock_irqsave(&bank->lock, flags); 927 spin_lock_irqsave(&bank->lock, flags);
924 if (enable) { 928 if (enable)
925 bank->suspend_wakeup |= (1 << gpio); 929 bank->suspend_wakeup |= (1 << gpio);
926 enable_irq_wake(bank->irq); 930 else
927 } else {
928 disable_irq_wake(bank->irq);
929 bank->suspend_wakeup &= ~(1 << gpio); 931 bank->suspend_wakeup &= ~(1 << gpio);
930 }
931 spin_unlock_irqrestore(&bank->lock, flags); 932 spin_unlock_irqrestore(&bank->lock, flags);
932 return 0; 933 return 0;
933#endif 934#endif
@@ -940,13 +941,10 @@ static int _set_gpio_wakeup(struct gpio_bank *bank, int gpio, int enable)
940 return -EINVAL; 941 return -EINVAL;
941 } 942 }
942 spin_lock_irqsave(&bank->lock, flags); 943 spin_lock_irqsave(&bank->lock, flags);
943 if (enable) { 944 if (enable)
944 bank->suspend_wakeup |= (1 << gpio); 945 bank->suspend_wakeup |= (1 << gpio);
945 enable_irq_wake(bank->irq); 946 else
946 } else {
947 disable_irq_wake(bank->irq);
948 bank->suspend_wakeup &= ~(1 << gpio); 947 bank->suspend_wakeup &= ~(1 << gpio);
949 }
950 spin_unlock_irqrestore(&bank->lock, flags); 948 spin_unlock_irqrestore(&bank->lock, flags);
951 return 0; 949 return 0;
952#endif 950#endif
diff --git a/arch/arm/plat-omap/include/mach/dmtimer.h b/arch/arm/plat-omap/include/mach/dmtimer.h
index 6dc70313821..20f1054c0a8 100644
--- a/arch/arm/plat-omap/include/mach/dmtimer.h
+++ b/arch/arm/plat-omap/include/mach/dmtimer.h
@@ -64,7 +64,7 @@ void omap_dm_timer_trigger(struct omap_dm_timer *timer);
64void omap_dm_timer_start(struct omap_dm_timer *timer); 64void omap_dm_timer_start(struct omap_dm_timer *timer);
65void omap_dm_timer_stop(struct omap_dm_timer *timer); 65void omap_dm_timer_stop(struct omap_dm_timer *timer);
66 66
67void omap_dm_timer_set_source(struct omap_dm_timer *timer, int source); 67int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source);
68void omap_dm_timer_set_load(struct omap_dm_timer *timer, int autoreload, unsigned int value); 68void omap_dm_timer_set_load(struct omap_dm_timer *timer, int autoreload, unsigned int value);
69void omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload, unsigned int value); 69void omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload, unsigned int value);
70void omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable, unsigned int match); 70void omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable, unsigned int match);
diff --git a/arch/arm/plat-omap/include/mach/eac.h b/arch/arm/plat-omap/include/mach/eac.h
deleted file mode 100644
index 9e62cf03027..00000000000
--- a/arch/arm/plat-omap/include/mach/eac.h
+++ /dev/null
@@ -1,100 +0,0 @@
1/*
2 * arch/arm/plat-omap/include/mach2/eac.h
3 *
4 * Defines for Enhanced Audio Controller
5 *
6 * Contact: Jarkko Nikula <jarkko.nikula@nokia.com>
7 *
8 * Copyright (C) 2006 Nokia Corporation
9 * Copyright (C) 2004 Texas Instruments, Inc.
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * version 2 as published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
23 * 02110-1301 USA
24 *
25 */
26
27#ifndef __ASM_ARM_ARCH_OMAP2_EAC_H
28#define __ASM_ARM_ARCH_OMAP2_EAC_H
29
30#include <mach/io.h>
31#include <mach/hardware.h>
32#include <asm/irq.h>
33
34#include <sound/core.h>
35
36/* master codec clock source */
37#define EAC_MCLK_EXT_MASK 0x100
38enum eac_mclk_src {
39 EAC_MCLK_INT_11290000, /* internal 96 MHz / 8.5 = 11.29 Mhz */
40 EAC_MCLK_EXT_11289600 = EAC_MCLK_EXT_MASK,
41 EAC_MCLK_EXT_12288000,
42 EAC_MCLK_EXT_2x11289600,
43 EAC_MCLK_EXT_2x12288000,
44};
45
46/* codec port interface mode */
47enum eac_codec_mode {
48 EAC_CODEC_PCM,
49 EAC_CODEC_AC97,
50 EAC_CODEC_I2S_MASTER, /* codec port, I.e. EAC is the master */
51 EAC_CODEC_I2S_SLAVE,
52};
53
54/* configuration structure for I2S mode */
55struct eac_i2s_conf {
56 /* if enabled, then first data slot (left channel) is signaled as
57 * positive level of frame sync EAC.AC_FS */
58 unsigned polarity_changed_mode:1;
59 /* if enabled, then serial data starts one clock cycle after the
60 * of EAC.AC_FS for first audio slot */
61 unsigned sync_delay_enable:1;
62};
63
64/* configuration structure for EAC codec port */
65struct eac_codec {
66 enum eac_mclk_src mclk_src;
67
68 enum eac_codec_mode codec_mode;
69 union {
70 struct eac_i2s_conf i2s;
71 } codec_conf;
72
73 int default_rate; /* audio sampling rate */
74
75 int (* set_power)(void *private_data, int dac, int adc);
76 int (* register_controls)(void *private_data,
77 struct snd_card *card);
78 const char *short_name;
79
80 void *private_data;
81};
82
83/* structure for passing platform dependent data to the EAC driver */
84struct eac_platform_data {
85 int (* init)(struct device *eac_dev);
86 void (* cleanup)(struct device *eac_dev);
87 /* these callbacks are used to configure & control external MCLK
88 * source. NULL if not used */
89 int (* enable_ext_clocks)(struct device *eac_dev);
90 void (* disable_ext_clocks)(struct device *eac_dev);
91};
92
93extern void omap_init_eac(struct eac_platform_data *pdata);
94
95extern int eac_register_codec(struct device *eac_dev, struct eac_codec *codec);
96extern void eac_unregister_codec(struct device *eac_dev);
97
98extern int eac_set_mode(struct device *eac_dev, int play, int rec);
99
100#endif /* __ASM_ARM_ARCH_OMAP2_EAC_H */
diff --git a/arch/arm/plat-omap/include/mach/gpioexpander.h b/arch/arm/plat-omap/include/mach/gpioexpander.h
deleted file mode 100644
index 90444a0d6b1..00000000000
--- a/arch/arm/plat-omap/include/mach/gpioexpander.h
+++ /dev/null
@@ -1,35 +0,0 @@
1/*
2 * arch/arm/plat-omap/include/mach/gpioexpander.h
3 *
4 *
5 * Copyright (C) 2004 Texas Instruments, Inc.
6 *
7 * This package is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
12 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
13 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14 */
15
16#ifndef __ASM_ARCH_OMAP_GPIOEXPANDER_H
17#define __ASM_ARCH_OMAP_GPIOEXPANDER_H
18
19/* Function Prototypes for GPIO Expander functions */
20
21#ifdef CONFIG_GPIOEXPANDER_OMAP
22int read_gpio_expa(u8 *, int);
23int write_gpio_expa(u8 , int);
24#else
25static inline int read_gpio_expa(u8 *val, int addr)
26{
27 return 0;
28}
29static inline int write_gpio_expa(u8 val, int addr)
30{
31 return 0;
32}
33#endif
34
35#endif /* __ASM_ARCH_OMAP_GPIOEXPANDER_H */
diff --git a/arch/arm/plat-omap/include/mach/irda.h b/arch/arm/plat-omap/include/mach/irda.h
index 8372a00d8e0..40f60339d1c 100644
--- a/arch/arm/plat-omap/include/mach/irda.h
+++ b/arch/arm/plat-omap/include/mach/irda.h
@@ -21,10 +21,6 @@ struct omap_irda_config {
21 int transceiver_cap; 21 int transceiver_cap;
22 int (*transceiver_mode)(struct device *dev, int mode); 22 int (*transceiver_mode)(struct device *dev, int mode);
23 int (*select_irda)(struct device *dev, int state); 23 int (*select_irda)(struct device *dev, int state);
24 /* Very specific to the needs of some platforms (h3,h4)
25 * having calls which can sleep in irda_set_speed.
26 */
27 struct delayed_work gpio_expa;
28 int rx_channel; 24 int rx_channel;
29 int tx_channel; 25 int tx_channel;
30 unsigned long dest_start; 26 unsigned long dest_start;
diff --git a/arch/arm/plat-omap/include/mach/mmc.h b/arch/arm/plat-omap/include/mach/mmc.h
index 4435bd434e1..81d5b36534b 100644
--- a/arch/arm/plat-omap/include/mach/mmc.h
+++ b/arch/arm/plat-omap/include/mach/mmc.h
@@ -79,7 +79,6 @@ struct omap_mmc_platform_data {
79 79
80 /* use the internal clock */ 80 /* use the internal clock */
81 unsigned internal_clock:1; 81 unsigned internal_clock:1;
82 s16 power_pin;
83 82
84 int switch_pin; /* gpio (card detect) */ 83 int switch_pin; /* gpio (card detect) */
85 int gpio_wp; /* gpio (write protect) */ 84 int gpio_wp; /* gpio (write protect) */
diff --git a/arch/arm/plat-omap/include/mach/timer-gp.h b/arch/arm/plat-omap/include/mach/timer-gp.h
new file mode 100644
index 00000000000..c88d346b59d
--- /dev/null
+++ b/arch/arm/plat-omap/include/mach/timer-gp.h
@@ -0,0 +1,17 @@
1/*
2 * OMAP2/3 GPTIMER support.headers
3 *
4 * Copyright (C) 2009 Nokia Corporation
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10
11#ifndef __ARCH_ARM_PLAT_OMAP_INCLUDE_MACH_TIMER_GP_H
12#define __ARCH_ARM_PLAT_OMAP_INCLUDE_MACH_TIMER_GP_H
13
14int __init omap2_gp_clockevent_set_gptimer(u8 id);
15
16#endif
17
diff --git a/arch/arm/plat-pxa/gpio.c b/arch/arm/plat-pxa/gpio.c
index af819bf21b6..abc79d44aca 100644
--- a/arch/arm/plat-pxa/gpio.c
+++ b/arch/arm/plat-pxa/gpio.c
@@ -121,6 +121,8 @@ static int __init pxa_init_gpio_chip(int gpio_end)
121 return -ENOMEM; 121 return -ENOMEM;
122 } 122 }
123 123
124 memset(chips, 0, nbanks * sizeof(struct pxa_gpio_chip));
125
124 for (i = 0, gpio = 0; i < nbanks; i++, gpio += 32) { 126 for (i = 0, gpio = 0; i < nbanks; i++, gpio += 32) {
125 struct gpio_chip *c = &chips[i].chip; 127 struct gpio_chip *c = &chips[i].chip;
126 128
@@ -143,6 +145,21 @@ static int __init pxa_init_gpio_chip(int gpio_end)
143 return 0; 145 return 0;
144} 146}
145 147
148/* Update only those GRERx and GFERx edge detection register bits if those
149 * bits are set in c->irq_mask
150 */
151static inline void update_edge_detect(struct pxa_gpio_chip *c)
152{
153 uint32_t grer, gfer;
154
155 grer = __raw_readl(c->regbase + GRER_OFFSET) & ~c->irq_mask;
156 gfer = __raw_readl(c->regbase + GFER_OFFSET) & ~c->irq_mask;
157 grer |= c->irq_edge_rise & c->irq_mask;
158 gfer |= c->irq_edge_fall & c->irq_mask;
159 __raw_writel(grer, c->regbase + GRER_OFFSET);
160 __raw_writel(gfer, c->regbase + GFER_OFFSET);
161}
162
146static int pxa_gpio_irq_type(unsigned int irq, unsigned int type) 163static int pxa_gpio_irq_type(unsigned int irq, unsigned int type)
147{ 164{
148 struct pxa_gpio_chip *c; 165 struct pxa_gpio_chip *c;
@@ -181,8 +198,7 @@ static int pxa_gpio_irq_type(unsigned int irq, unsigned int type)
181 else 198 else
182 c->irq_edge_fall &= ~mask; 199 c->irq_edge_fall &= ~mask;
183 200
184 __raw_writel(c->irq_edge_rise & c->irq_mask, c->regbase + GRER_OFFSET); 201 update_edge_detect(c);
185 __raw_writel(c->irq_edge_fall & c->irq_mask, c->regbase + GFER_OFFSET);
186 202
187 pr_debug("%s: IRQ%d (GPIO%d) - edge%s%s\n", __func__, irq, gpio, 203 pr_debug("%s: IRQ%d (GPIO%d) - edge%s%s\n", __func__, irq, gpio,
188 ((type & IRQ_TYPE_EDGE_RISING) ? " rising" : ""), 204 ((type & IRQ_TYPE_EDGE_RISING) ? " rising" : ""),
@@ -244,8 +260,7 @@ static void pxa_unmask_muxed_gpio(unsigned int irq)
244 struct pxa_gpio_chip *c = gpio_to_chip(gpio); 260 struct pxa_gpio_chip *c = gpio_to_chip(gpio);
245 261
246 c->irq_mask |= GPIO_bit(gpio); 262 c->irq_mask |= GPIO_bit(gpio);
247 __raw_writel(c->irq_edge_rise & c->irq_mask, c->regbase + GRER_OFFSET); 263 update_edge_detect(c);
248 __raw_writel(c->irq_edge_fall & c->irq_mask, c->regbase + GFER_OFFSET);
249} 264}
250 265
251static struct irq_chip pxa_muxed_gpio_chip = { 266static struct irq_chip pxa_muxed_gpio_chip = {
diff --git a/arch/avr32/Makefile b/arch/avr32/Makefile
index 0b97e14f73f..c21a3290d54 100644
--- a/arch/avr32/Makefile
+++ b/arch/avr32/Makefile
@@ -43,8 +43,6 @@ core-y += arch/avr32/mm/
43drivers-$(CONFIG_OPROFILE) += arch/avr32/oprofile/ 43drivers-$(CONFIG_OPROFILE) += arch/avr32/oprofile/
44libs-y += arch/avr32/lib/ 44libs-y += arch/avr32/lib/
45 45
46CLEAN_FILES += include/asm-avr32/.arch include/asm-avr32/arch
47
48BOOT_TARGETS := vmlinux.elf vmlinux.bin uImage uImage.srec 46BOOT_TARGETS := vmlinux.elf vmlinux.bin uImage uImage.srec
49 47
50.PHONY: $(BOOT_TARGETS) install 48.PHONY: $(BOOT_TARGETS) install
diff --git a/arch/m32r/boot/compressed/Makefile b/arch/m32r/boot/compressed/Makefile
index d908e1d3c07..560484ae35e 100644
--- a/arch/m32r/boot/compressed/Makefile
+++ b/arch/m32r/boot/compressed/Makefile
@@ -6,7 +6,6 @@
6 6
7targets := vmlinux vmlinux.bin vmlinux.bin.gz head.o misc.o \ 7targets := vmlinux vmlinux.bin vmlinux.bin.gz head.o misc.o \
8 piggy.o vmlinux.lds 8 piggy.o vmlinux.lds
9EXTRA_AFLAGS := -traditional
10 9
11OBJECTS = $(obj)/head.o $(obj)/misc.o 10OBJECTS = $(obj)/head.o $(obj)/misc.o
12 11
diff --git a/arch/m32r/include/asm/assembler.h b/arch/m32r/include/asm/assembler.h
index 26351539b5f..728799fc70a 100644
--- a/arch/m32r/include/asm/assembler.h
+++ b/arch/m32r/include/asm/assembler.h
@@ -9,14 +9,15 @@
9 * This file contains M32R architecture specific macro definitions. 9 * This file contains M32R architecture specific macro definitions.
10 */ 10 */
11 11
12#include <linux/stringify.h>
13
14#undef __STR
12 15
13#ifndef __STR
14#ifdef __ASSEMBLY__ 16#ifdef __ASSEMBLY__
15#define __STR(x) x 17#define __STR(x) x
16#else 18#else
17#define __STR(x) #x 19#define __STR(x) __stringify(x)
18#endif 20#endif
19#endif /* __STR */
20 21
21#ifdef CONFIG_SMP 22#ifdef CONFIG_SMP
22#define M32R_LOCK __STR(lock) 23#define M32R_LOCK __STR(lock)
diff --git a/arch/m32r/kernel/Makefile b/arch/m32r/kernel/Makefile
index 09200d4886e..b1a4b603659 100644
--- a/arch/m32r/kernel/Makefile
+++ b/arch/m32r/kernel/Makefile
@@ -9,5 +9,3 @@ obj-y := process.o entry.o traps.o align.o irq.o setup.o time.o \
9 9
10obj-$(CONFIG_SMP) += smp.o smpboot.o 10obj-$(CONFIG_SMP) += smp.o smpboot.o
11obj-$(CONFIG_MODULES) += module.o 11obj-$(CONFIG_MODULES) += module.o
12
13EXTRA_AFLAGS := -traditional
diff --git a/arch/microblaze/include/asm/of_platform.h b/arch/microblaze/include/asm/of_platform.h
index 187c0eedaec..37491276c6c 100644
--- a/arch/microblaze/include/asm/of_platform.h
+++ b/arch/microblaze/include/asm/of_platform.h
@@ -36,16 +36,6 @@ static const struct of_device_id of_default_bus_ids[] = {
36 {}, 36 {},
37}; 37};
38 38
39/* Platform drivers register/unregister */
40static inline int of_register_platform_driver(struct of_platform_driver *drv)
41{
42 return of_register_driver(drv, &of_platform_bus_type);
43}
44static inline void of_unregister_platform_driver(struct of_platform_driver *drv)
45{
46 of_unregister_driver(drv);
47}
48
49/* Platform devices and busses creation */ 39/* Platform devices and busses creation */
50extern struct of_device *of_platform_device_create(struct device_node *np, 40extern struct of_device *of_platform_device_create(struct device_node *np,
51 const char *bus_id, 41 const char *bus_id,
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 4c780455136..a0d1146a057 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -181,6 +181,10 @@ config SYS_SUPPORTS_APM_EMULATION
181 default y if PMAC_APM_EMU 181 default y if PMAC_APM_EMU
182 bool 182 bool
183 183
184config DTC
185 bool
186 default y
187
184config DEFAULT_UIMAGE 188config DEFAULT_UIMAGE
185 bool 189 bool
186 help 190 help
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 4458abb67c5..8da2bf963b5 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -33,7 +33,7 @@ ifeq ($(call cc-option-yn, -fstack-protector),y)
33BOOTCFLAGS += -fno-stack-protector 33BOOTCFLAGS += -fno-stack-protector
34endif 34endif
35 35
36BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj) -I$(srctree)/$(src)/libfdt 36BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj)
37 37
38DTS_FLAGS ?= -p 1024 38DTS_FLAGS ?= -p 1024
39 39
@@ -53,9 +53,14 @@ zliblinuxheader := zlib.h zconf.h zutil.h
53$(addprefix $(obj)/,$(zlib) cuboot-c2k.o gunzip_util.o main.o prpmc2800.o): \ 53$(addprefix $(obj)/,$(zlib) cuboot-c2k.o gunzip_util.o main.o prpmc2800.o): \
54 $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader)) 54 $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader))
55 55
56src-libfdt := fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c 56libfdt := fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c
57libfdtheader := fdt.h libfdt.h libfdt_internal.h
58
59$(addprefix $(obj)/,$(libfdt) libfdt-wrapper.o simpleboot.o): \
60 $(addprefix $(obj)/,$(libfdtheader))
61
57src-wlib := string.S crt0.S crtsavres.S stdio.c main.c \ 62src-wlib := string.S crt0.S crtsavres.S stdio.c main.c \
58 $(addprefix libfdt/,$(src-libfdt)) libfdt-wrapper.c \ 63 $(libfdt) libfdt-wrapper.c \
59 ns16550.c serial.c simple_alloc.c div64.S util.S \ 64 ns16550.c serial.c simple_alloc.c div64.S util.S \
60 gunzip_util.c elf_util.c $(zlib) devtree.c oflib.c ofconsole.c \ 65 gunzip_util.c elf_util.c $(zlib) devtree.c oflib.c ofconsole.c \
61 4xx.c ebony.c mv64x60.c mpsc.c mv64x60_i2c.c cuboot.c bamboo.c \ 66 4xx.c ebony.c mv64x60.c mpsc.c mv64x60_i2c.c cuboot.c bamboo.c \
@@ -96,6 +101,12 @@ $(addprefix $(obj)/,$(zlibheader)): $(obj)/%: $(srctree)/lib/zlib_inflate/%
96$(addprefix $(obj)/,$(zliblinuxheader)): $(obj)/%: $(srctree)/include/linux/% 101$(addprefix $(obj)/,$(zliblinuxheader)): $(obj)/%: $(srctree)/include/linux/%
97 $(call cmd,copy_zliblinuxheader) 102 $(call cmd,copy_zliblinuxheader)
98 103
104quiet_cmd_copy_libfdt = COPY $@
105 cmd_copy_libfdt = cp $< $@
106
107$(addprefix $(obj)/,$(libfdt) $(libfdtheader)): $(obj)/%: $(srctree)/scripts/dtc/libfdt/%
108 $(call cmd,copy_libfdt)
109
99$(obj)/empty.c: 110$(obj)/empty.c:
100 @touch $@ 111 @touch $@
101 112
@@ -103,6 +114,7 @@ $(obj)/zImage.lds $(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds: $(obj)/%: $(srct
103 @cp $< $@ 114 @cp $< $@
104 115
105clean-files := $(zlib) $(zlibheader) $(zliblinuxheader) \ 116clean-files := $(zlib) $(zlibheader) $(zliblinuxheader) \
117 $(libfdt) $(libfdtheader) \
106 empty.c zImage.coff.lds zImage.ps3.lds zImage.lds 118 empty.c zImage.coff.lds zImage.ps3.lds zImage.lds
107 119
108quiet_cmd_bootcc = BOOTCC $@ 120quiet_cmd_bootcc = BOOTCC $@
@@ -114,6 +126,8 @@ quiet_cmd_bootas = BOOTAS $@
114quiet_cmd_bootar = BOOTAR $@ 126quiet_cmd_bootar = BOOTAR $@
115 cmd_bootar = $(CROSS32AR) -cr $@.$$$$ $(filter-out FORCE,$^); mv $@.$$$$ $@ 127 cmd_bootar = $(CROSS32AR) -cr $@.$$$$ $(filter-out FORCE,$^); mv $@.$$$$ $@
116 128
129$(obj-libfdt): $(obj)/%.o: $(srctree)/scripts/dtc/libfdt/%.c FORCE
130 $(call if_changed_dep,bootcc)
117$(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c FORCE 131$(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c FORCE
118 $(Q)mkdir -p $(dir $@) 132 $(Q)mkdir -p $(dir $@)
119 $(call if_changed_dep,bootcc) 133 $(call if_changed_dep,bootcc)
@@ -124,7 +138,7 @@ $(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S FORCE
124$(obj)/wrapper.a: $(obj-wlib) FORCE 138$(obj)/wrapper.a: $(obj-wlib) FORCE
125 $(call if_changed,bootar) 139 $(call if_changed,bootar)
126 140
127hostprogs-y := addnote addRamDisk hack-coff mktree dtc 141hostprogs-y := addnote addRamDisk hack-coff mktree
128 142
129targets += $(patsubst $(obj)/%,%,$(obj-boot) wrapper.a) 143targets += $(patsubst $(obj)/%,%,$(obj-boot) wrapper.a)
130extra-y := $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \ 144extra-y := $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \
@@ -133,47 +147,10 @@ extra-y := $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \
133dtstree := $(srctree)/$(src)/dts 147dtstree := $(srctree)/$(src)/dts
134 148
135wrapper :=$(srctree)/$(src)/wrapper 149wrapper :=$(srctree)/$(src)/wrapper
136wrapperbits := $(extra-y) $(addprefix $(obj)/,addnote hack-coff mktree dtc) \ 150wrapperbits := $(extra-y) $(addprefix $(obj)/,addnote hack-coff mktree) \
137 $(wrapper) FORCE 151 $(wrapper) FORCE
138 152
139############# 153#############
140# Bits for building dtc
141# DTC_GENPARSER := 1 # Uncomment to rebuild flex/bison output
142
143dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o srcpos.o checks.o
144dtc-objs += dtc-lexer.lex.o dtc-parser.tab.o
145dtc-objs := $(addprefix dtc-src/, $(dtc-objs))
146
147# prerequisites on generated files needs to be explicit
148$(obj)/dtc-src/dtc-parser.tab.o: $(obj)/dtc-src/dtc-parser.tab.c $(obj)/dtc-src/dtc-parser.tab.h
149$(obj)/dtc-src/dtc-lexer.lex.o: $(obj)/dtc-src/dtc-lexer.lex.c $(obj)/dtc-src/dtc-parser.tab.h
150
151HOSTCFLAGS += -I$(src)/dtc-src/ -I$(src)/libfdt/
152
153targets += dtc-src/dtc-parser.tab.c
154targets += dtc-src/dtc-lexer.lex.c
155
156clean-files += dtc-src/dtc-parser.tab.h
157
158ifdef DTC_GENPARSER
159BISON = bison
160FLEX = flex
161
162quiet_cmd_bison = BISON $@
163 cmd_bison = $(BISON) -o$@ -d $<; cp $@ $@_shipped
164quiet_cmd_flex = FLEX $@
165 cmd_flex = $(FLEX) -o$@ $<; cp $@ $@_shipped
166
167$(obj)/dtc-src/dtc-parser.tab.c: $(src)/dtc-src/dtc-parser.y FORCE
168 $(call if_changed,bison)
169
170$(obj)/dtc-src/dtc-parser.tab.h: $(obj)/dtc-src/dtc-parser.tab.c
171
172$(obj)/dtc-src/dtc-lexer.lex.c: $(src)/dtc-src/dtc-lexer.l FORCE
173 $(call if_changed,flex)
174endif
175
176#############
177# Bits for building various flavours of zImage 154# Bits for building various flavours of zImage
178 155
179ifneq ($(CROSS32_COMPILE),) 156ifneq ($(CROSS32_COMPILE),)
@@ -347,8 +324,10 @@ $(obj)/treeImage.%: vmlinux $(obj)/%.dtb $(wrapperbits)
347 $(call if_changed,wrap,treeboot-$*,,$(obj)/$*.dtb) 324 $(call if_changed,wrap,treeboot-$*,,$(obj)/$*.dtb)
348 325
349# Rule to build device tree blobs 326# Rule to build device tree blobs
350$(obj)/%.dtb: $(dtstree)/%.dts $(obj)/dtc 327DTC = $(objtree)/scripts/dtc/dtc
351 $(obj)/dtc -O dtb -o $(obj)/$*.dtb -b 0 $(DTS_FLAGS) $(dtstree)/$*.dts 328
329$(obj)/%.dtb: $(dtstree)/%.dts
330 $(DTC) -O dtb -o $(obj)/$*.dtb -b 0 $(DTS_FLAGS) $(dtstree)/$*.dts
352 331
353# If there isn't a platform selected then just strip the vmlinux. 332# If there isn't a platform selected then just strip the vmlinux.
354ifeq (,$(image-y)) 333ifeq (,$(image-y))
diff --git a/arch/powerpc/boot/simpleboot.c b/arch/powerpc/boot/simpleboot.c
index c58a0dada99..21cd48074ec 100644
--- a/arch/powerpc/boot/simpleboot.c
+++ b/arch/powerpc/boot/simpleboot.c
@@ -19,7 +19,7 @@
19#include "types.h" 19#include "types.h"
20#include "io.h" 20#include "io.h"
21#include "stdio.h" 21#include "stdio.h"
22#include "libfdt/libfdt.h" 22#include <libfdt.h>
23 23
24BSS_STACK(4*1024); 24BSS_STACK(4*1024);
25 25
diff --git a/arch/powerpc/include/asm/of_platform.h b/arch/powerpc/include/asm/of_platform.h
index 53b46507ffd..d4aaa348944 100644
--- a/arch/powerpc/include/asm/of_platform.h
+++ b/arch/powerpc/include/asm/of_platform.h
@@ -11,16 +11,6 @@
11 * 11 *
12 */ 12 */
13 13
14/* Platform drivers register/unregister */
15static inline int of_register_platform_driver(struct of_platform_driver *drv)
16{
17 return of_register_driver(drv, &of_platform_bus_type);
18}
19static inline void of_unregister_platform_driver(struct of_platform_driver *drv)
20{
21 of_unregister_driver(drv);
22}
23
24/* Platform devices and busses creation */ 14/* Platform devices and busses creation */
25extern struct of_device *of_platform_device_create(struct device_node *np, 15extern struct of_device *of_platform_device_create(struct device_node *np,
26 const char *bus_id, 16 const char *bus_id,
diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h
index 563933e06a3..4f8c199584e 100644
--- a/arch/x86/include/asm/mce.h
+++ b/arch/x86/include/asm/mce.h
@@ -137,6 +137,7 @@ DECLARE_PER_CPU(mce_banks_t, mce_poll_banks);
137enum mcp_flags { 137enum mcp_flags {
138 MCP_TIMESTAMP = (1 << 0), /* log time stamp */ 138 MCP_TIMESTAMP = (1 << 0), /* log time stamp */
139 MCP_UC = (1 << 1), /* log uncorrected errors */ 139 MCP_UC = (1 << 1), /* log uncorrected errors */
140 MCP_DONTLOG = (1 << 2), /* only clear, don't log */
140}; 141};
141extern void machine_check_poll(enum mcp_flags flags, mce_banks_t *b); 142extern void machine_check_poll(enum mcp_flags flags, mce_banks_t *b);
142 143
diff --git a/arch/x86/kernel/cpu/mcheck/mce_64.c b/arch/x86/kernel/cpu/mcheck/mce_64.c
index 863f89568b1..6fb0b359d2a 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_64.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_64.c
@@ -239,9 +239,10 @@ void machine_check_poll(enum mcp_flags flags, mce_banks_t *b)
239 * Don't get the IP here because it's unlikely to 239 * Don't get the IP here because it's unlikely to
240 * have anything to do with the actual error location. 240 * have anything to do with the actual error location.
241 */ 241 */
242 242 if (!(flags & MCP_DONTLOG)) {
243 mce_log(&m); 243 mce_log(&m);
244 add_taint(TAINT_MACHINE_CHECK); 244 add_taint(TAINT_MACHINE_CHECK);
245 }
245 246
246 /* 247 /*
247 * Clear state for this bank. 248 * Clear state for this bank.
@@ -452,13 +453,14 @@ void mce_log_therm_throt_event(__u64 status)
452 */ 453 */
453 454
454static int check_interval = 5 * 60; /* 5 minutes */ 455static int check_interval = 5 * 60; /* 5 minutes */
455static int next_interval; /* in jiffies */ 456static DEFINE_PER_CPU(int, next_interval); /* in jiffies */
456static void mcheck_timer(unsigned long); 457static void mcheck_timer(unsigned long);
457static DEFINE_PER_CPU(struct timer_list, mce_timer); 458static DEFINE_PER_CPU(struct timer_list, mce_timer);
458 459
459static void mcheck_timer(unsigned long data) 460static void mcheck_timer(unsigned long data)
460{ 461{
461 struct timer_list *t = &per_cpu(mce_timer, data); 462 struct timer_list *t = &per_cpu(mce_timer, data);
463 int *n;
462 464
463 WARN_ON(smp_processor_id() != data); 465 WARN_ON(smp_processor_id() != data);
464 466
@@ -470,14 +472,14 @@ static void mcheck_timer(unsigned long data)
470 * Alert userspace if needed. If we logged an MCE, reduce the 472 * Alert userspace if needed. If we logged an MCE, reduce the
471 * polling interval, otherwise increase the polling interval. 473 * polling interval, otherwise increase the polling interval.
472 */ 474 */
475 n = &__get_cpu_var(next_interval);
473 if (mce_notify_user()) { 476 if (mce_notify_user()) {
474 next_interval = max(next_interval/2, HZ/100); 477 *n = max(*n/2, HZ/100);
475 } else { 478 } else {
476 next_interval = min(next_interval * 2, 479 *n = min(*n*2, (int)round_jiffies_relative(check_interval*HZ));
477 (int)round_jiffies_relative(check_interval*HZ));
478 } 480 }
479 481
480 t->expires = jiffies + next_interval; 482 t->expires = jiffies + *n;
481 add_timer(t); 483 add_timer(t);
482} 484}
483 485
@@ -584,7 +586,7 @@ static void mce_init(void *dummy)
584 * Log the machine checks left over from the previous reset. 586 * Log the machine checks left over from the previous reset.
585 */ 587 */
586 bitmap_fill(all_banks, MAX_NR_BANKS); 588 bitmap_fill(all_banks, MAX_NR_BANKS);
587 machine_check_poll(MCP_UC, &all_banks); 589 machine_check_poll(MCP_UC|(!mce_bootlog ? MCP_DONTLOG : 0), &all_banks);
588 590
589 set_in_cr4(X86_CR4_MCE); 591 set_in_cr4(X86_CR4_MCE);
590 592
@@ -632,14 +634,13 @@ static void mce_cpu_features(struct cpuinfo_x86 *c)
632static void mce_init_timer(void) 634static void mce_init_timer(void)
633{ 635{
634 struct timer_list *t = &__get_cpu_var(mce_timer); 636 struct timer_list *t = &__get_cpu_var(mce_timer);
637 int *n = &__get_cpu_var(next_interval);
635 638
636 /* data race harmless because everyone sets to the same value */ 639 *n = check_interval * HZ;
637 if (!next_interval) 640 if (!*n)
638 next_interval = check_interval * HZ;
639 if (!next_interval)
640 return; 641 return;
641 setup_timer(t, mcheck_timer, smp_processor_id()); 642 setup_timer(t, mcheck_timer, smp_processor_id());
642 t->expires = round_jiffies(jiffies + next_interval); 643 t->expires = round_jiffies(jiffies + *n);
643 add_timer(t); 644 add_timer(t);
644} 645}
645 646
@@ -907,7 +908,6 @@ static void mce_cpu_restart(void *data)
907/* Reinit MCEs after user configuration changes */ 908/* Reinit MCEs after user configuration changes */
908static void mce_restart(void) 909static void mce_restart(void)
909{ 910{
910 next_interval = check_interval * HZ;
911 on_each_cpu(mce_cpu_restart, NULL, 1); 911 on_each_cpu(mce_cpu_restart, NULL, 1);
912} 912}
913 913
@@ -1110,7 +1110,8 @@ static int __cpuinit mce_cpu_callback(struct notifier_block *nfb,
1110 break; 1110 break;
1111 case CPU_DOWN_FAILED: 1111 case CPU_DOWN_FAILED:
1112 case CPU_DOWN_FAILED_FROZEN: 1112 case CPU_DOWN_FAILED_FROZEN:
1113 t->expires = round_jiffies(jiffies + next_interval); 1113 t->expires = round_jiffies(jiffies +
1114 __get_cpu_var(next_interval));
1114 add_timer_on(t, cpu); 1115 add_timer_on(t, cpu);
1115 smp_call_function_single(cpu, mce_reenable_cpu, &action, 1); 1116 smp_call_function_single(cpu, mce_reenable_cpu, &action, 1);
1116 break; 1117 break;
diff --git a/drivers/Makefile b/drivers/Makefile
index 2618a6169a1..1266ead6ace 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -36,7 +36,7 @@ obj-$(CONFIG_FB_INTEL) += video/intelfb/
36 36
37obj-y += serial/ 37obj-y += serial/
38obj-$(CONFIG_PARPORT) += parport/ 38obj-$(CONFIG_PARPORT) += parport/
39obj-y += base/ block/ misc/ mfd/ media/ 39obj-y += base/ block/ misc/ mfd/
40obj-$(CONFIG_NUBUS) += nubus/ 40obj-$(CONFIG_NUBUS) += nubus/
41obj-y += macintosh/ 41obj-y += macintosh/
42obj-$(CONFIG_IDE) += ide/ 42obj-$(CONFIG_IDE) += ide/
@@ -71,7 +71,7 @@ obj-$(CONFIG_GAMEPORT) += input/gameport/
71obj-$(CONFIG_INPUT) += input/ 71obj-$(CONFIG_INPUT) += input/
72obj-$(CONFIG_I2O) += message/ 72obj-$(CONFIG_I2O) += message/
73obj-$(CONFIG_RTC_LIB) += rtc/ 73obj-$(CONFIG_RTC_LIB) += rtc/
74obj-y += i2c/ 74obj-y += i2c/ media/
75obj-$(CONFIG_W1) += w1/ 75obj-$(CONFIG_W1) += w1/
76obj-$(CONFIG_POWER_SUPPLY) += power/ 76obj-$(CONFIG_POWER_SUPPLY) += power/
77obj-$(CONFIG_HWMON) += hwmon/ 77obj-$(CONFIG_HWMON) += hwmon/
diff --git a/drivers/acpi/acpica/rscalc.c b/drivers/acpi/acpica/rscalc.c
index b6667ff059e..88b5a2c4814 100644
--- a/drivers/acpi/acpica/rscalc.c
+++ b/drivers/acpi/acpica/rscalc.c
@@ -543,6 +543,13 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
543 543
544 package_element = *top_object_list; 544 package_element = *top_object_list;
545 545
546 /* We must have a valid Package object */
547
548 if (!package_element ||
549 (package_element->common.type != ACPI_TYPE_PACKAGE)) {
550 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
551 }
552
546 /* 553 /*
547 * The sub_object_list will now point to an array of the 554 * The sub_object_list will now point to an array of the
548 * four IRQ elements: Address, Pin, Source and source_index 555 * four IRQ elements: Address, Pin, Source and source_index
diff --git a/drivers/firmware/iscsi_ibft.c b/drivers/firmware/iscsi_ibft.c
index 7b7ddc2d51c..420a96e7f2d 100644
--- a/drivers/firmware/iscsi_ibft.c
+++ b/drivers/firmware/iscsi_ibft.c
@@ -754,11 +754,11 @@ static int __init ibft_check_nic_for(struct ibft_nic *nic, int entry)
754 rc = 1; 754 rc = 1;
755 break; 755 break;
756 case ibft_eth_ip_addr: 756 case ibft_eth_ip_addr:
757 if (!memcmp(nic->dhcp, nulls, sizeof(nic->dhcp))) 757 if (memcmp(nic->ip_addr, nulls, sizeof(nic->ip_addr)))
758 rc = 1; 758 rc = 1;
759 break; 759 break;
760 case ibft_eth_subnet_mask: 760 case ibft_eth_subnet_mask:
761 if (!memcmp(nic->dhcp, nulls, sizeof(nic->dhcp))) 761 if (nic->subnet_mask_prefix)
762 rc = 1; 762 rc = 1;
763 break; 763 break;
764 case ibft_eth_origin: 764 case ibft_eth_origin:
diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
index 7359d9d88e4..acbce5745b0 100644
--- a/drivers/hid/hid-apple.c
+++ b/drivers/hid/hid-apple.c
@@ -151,7 +151,7 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
151 if (fnmode) { 151 if (fnmode) {
152 int do_translate; 152 int do_translate;
153 153
154 trans = apple_find_translation((hid->product < 0x220 || 154 trans = apple_find_translation((hid->product < 0x21d ||
155 hid->product >= 0x300) ? 155 hid->product >= 0x300) ?
156 powerbook_fn_keys : apple_fn_keys, 156 powerbook_fn_keys : apple_fn_keys,
157 usage->code); 157 usage->code);
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 5746a5903bc..8551693d645 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1293,6 +1293,7 @@ static const struct hid_device_id hid_blacklist[] = {
1293 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FORCE3D_PRO) }, 1293 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FORCE3D_PRO) },
1294 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL) }, 1294 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL) },
1295 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2) }, 1295 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2) },
1296 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G25_WHEEL) },
1296 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2) }, 1297 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2) },
1297 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_SIDEWINDER_GV) }, 1298 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_SIDEWINDER_GV) },
1298 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K) }, 1299 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K) },
@@ -1824,6 +1825,9 @@ int hid_check_keys_pressed(struct hid_device *hid)
1824 struct hid_input *hidinput; 1825 struct hid_input *hidinput;
1825 int i; 1826 int i;
1826 1827
1828 if (!(hid->claimed & HID_CLAIMED_INPUT))
1829 return 0;
1830
1827 list_for_each_entry(hidinput, &hid->inputs, list) { 1831 list_for_each_entry(hidinput, &hid->inputs, list) {
1828 for (i = 0; i < BITS_TO_LONGS(KEY_MAX); i++) 1832 for (i = 0; i < BITS_TO_LONGS(KEY_MAX); i++)
1829 if (hidinput->input->key[i]) 1833 if (hidinput->input->key[i])
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index bdeda4c7cc1..aa1b995dd03 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -292,6 +292,7 @@
292#define USB_DEVICE_ID_LOGITECH_FORCE3D_PRO 0xc286 292#define USB_DEVICE_ID_LOGITECH_FORCE3D_PRO 0xc286
293#define USB_DEVICE_ID_LOGITECH_WHEEL 0xc294 293#define USB_DEVICE_ID_LOGITECH_WHEEL 0xc294
294#define USB_DEVICE_ID_LOGITECH_MOMO_WHEEL 0xc295 294#define USB_DEVICE_ID_LOGITECH_MOMO_WHEEL 0xc295
295#define USB_DEVICE_ID_LOGITECH_G25_WHEEL 0xc299
295#define USB_DEVICE_ID_LOGITECH_ELITE_KBD 0xc30a 296#define USB_DEVICE_ID_LOGITECH_ELITE_KBD 0xc30a
296#define USB_DEVICE_ID_S510_RECEIVER 0xc50c 297#define USB_DEVICE_ID_S510_RECEIVER 0xc50c
297#define USB_DEVICE_ID_S510_RECEIVER_2 0xc517 298#define USB_DEVICE_ID_S510_RECEIVER_2 0xc517
diff --git a/drivers/hid/hid-lg.c b/drivers/hid/hid-lg.c
index 7b80cb69498..7afbaa0efd1 100644
--- a/drivers/hid/hid-lg.c
+++ b/drivers/hid/hid-lg.c
@@ -297,6 +297,8 @@ static const struct hid_device_id lg_devices[] = {
297 .driver_data = LG_FF }, 297 .driver_data = LG_FF },
298 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2), 298 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2),
299 .driver_data = LG_FF }, 299 .driver_data = LG_FF },
300 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G25_WHEEL),
301 .driver_data = LG_FF },
300 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2), 302 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2),
301 .driver_data = LG_FF2 }, 303 .driver_data = LG_FF2 },
302 { } 304 { }
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
index e263d473117..00ccf4b1985 100644
--- a/drivers/hid/hidraw.c
+++ b/drivers/hid/hidraw.c
@@ -285,8 +285,10 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd,
285 285
286 if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWNAME(0))) { 286 if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWNAME(0))) {
287 int len; 287 int len;
288 if (!hid->name) 288 if (!hid->name) {
289 return 0; 289 ret = 0;
290 break;
291 }
290 len = strlen(hid->name) + 1; 292 len = strlen(hid->name) + 1;
291 if (len > _IOC_SIZE(cmd)) 293 if (len > _IOC_SIZE(cmd))
292 len = _IOC_SIZE(cmd); 294 len = _IOC_SIZE(cmd);
@@ -297,8 +299,10 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd,
297 299
298 if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWPHYS(0))) { 300 if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWPHYS(0))) {
299 int len; 301 int len;
300 if (!hid->phys) 302 if (!hid->phys) {
301 return 0; 303 ret = 0;
304 break;
305 }
302 len = strlen(hid->phys) + 1; 306 len = strlen(hid->phys) + 1;
303 if (len > _IOC_SIZE(cmd)) 307 if (len > _IOC_SIZE(cmd))
304 len = _IOC_SIZE(cmd); 308 len = _IOC_SIZE(cmd);
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index 4306cb1b8ce..900ce18dd54 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -662,8 +662,8 @@ void usbhid_close(struct hid_device *hid)
662 spin_lock_irq(&usbhid->lock); 662 spin_lock_irq(&usbhid->lock);
663 if (!--hid->open) { 663 if (!--hid->open) {
664 spin_unlock_irq(&usbhid->lock); 664 spin_unlock_irq(&usbhid->lock);
665 hid_cancel_delayed_stuff(usbhid);
665 usb_kill_urb(usbhid->urbin); 666 usb_kill_urb(usbhid->urbin);
666 flush_scheduled_work();
667 usbhid->intf->needs_remote_wakeup = 0; 667 usbhid->intf->needs_remote_wakeup = 0;
668 } else { 668 } else {
669 spin_unlock_irq(&usbhid->lock); 669 spin_unlock_irq(&usbhid->lock);
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 3d4e0996976..925eb9e245d 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -312,7 +312,6 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
312 ide_hwif_t *hwif = drive->hwif; 312 ide_hwif_t *hwif = drive->hwif;
313 struct request *rq = hwif->rq; 313 struct request *rq = hwif->rq;
314 int err, sense_key, do_end_request = 0; 314 int err, sense_key, do_end_request = 0;
315 u8 quiet = rq->cmd_flags & REQ_QUIET;
316 315
317 /* get the IDE error register */ 316 /* get the IDE error register */
318 err = ide_read_error(drive); 317 err = ide_read_error(drive);
@@ -347,7 +346,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
347 } else { 346 } else {
348 cdrom_saw_media_change(drive); 347 cdrom_saw_media_change(drive);
349 348
350 if (blk_fs_request(rq) && !quiet) 349 if (blk_fs_request(rq) && !blk_rq_quiet(rq))
351 printk(KERN_ERR PFX "%s: tray open\n", 350 printk(KERN_ERR PFX "%s: tray open\n",
352 drive->name); 351 drive->name);
353 } 352 }
@@ -382,7 +381,7 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
382 * No point in retrying after an illegal request or data 381 * No point in retrying after an illegal request or data
383 * protect error. 382 * protect error.
384 */ 383 */
385 if (!quiet) 384 if (!blk_rq_quiet(rq))
386 ide_dump_status(drive, "command error", stat); 385 ide_dump_status(drive, "command error", stat);
387 do_end_request = 1; 386 do_end_request = 1;
388 break; 387 break;
@@ -391,14 +390,14 @@ static int cdrom_decode_status(ide_drive_t *drive, u8 stat)
391 * No point in re-trying a zillion times on a bad sector. 390 * No point in re-trying a zillion times on a bad sector.
392 * If we got here the error is not correctable. 391 * If we got here the error is not correctable.
393 */ 392 */
394 if (!quiet) 393 if (!blk_rq_quiet(rq))
395 ide_dump_status(drive, "media error " 394 ide_dump_status(drive, "media error "
396 "(bad sector)", stat); 395 "(bad sector)", stat);
397 do_end_request = 1; 396 do_end_request = 1;
398 break; 397 break;
399 case BLANK_CHECK: 398 case BLANK_CHECK:
400 /* disk appears blank? */ 399 /* disk appears blank? */
401 if (!quiet) 400 if (!blk_rq_quiet(rq))
402 ide_dump_status(drive, "media error (blank)", 401 ide_dump_status(drive, "media error (blank)",
403 stat); 402 stat);
404 do_end_request = 1; 403 do_end_request = 1;
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c
index 13d7674b293..75223f50de5 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.c
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.c
@@ -599,6 +599,7 @@ static struct scsi_host_template iscsi_iser_sht = {
599 .eh_abort_handler = iscsi_eh_abort, 599 .eh_abort_handler = iscsi_eh_abort,
600 .eh_device_reset_handler= iscsi_eh_device_reset, 600 .eh_device_reset_handler= iscsi_eh_device_reset,
601 .eh_target_reset_handler= iscsi_eh_target_reset, 601 .eh_target_reset_handler= iscsi_eh_target_reset,
602 .target_alloc = iscsi_target_alloc,
602 .use_clustering = DISABLE_CLUSTERING, 603 .use_clustering = DISABLE_CLUSTERING,
603 .proc_name = "iscsi_iser", 604 .proc_name = "iscsi_iser",
604 .this_id = -1, 605 .this_id = -1,
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 935a1835de2..e54e002665b 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -29,6 +29,23 @@ MODULE_LICENSE("GPL");
29 29
30#define INPUT_DEVICES 256 30#define INPUT_DEVICES 256
31 31
32/*
33 * EV_ABS events which should not be cached are listed here.
34 */
35static unsigned int input_abs_bypass_init_data[] __initdata = {
36 ABS_MT_TOUCH_MAJOR,
37 ABS_MT_TOUCH_MINOR,
38 ABS_MT_WIDTH_MAJOR,
39 ABS_MT_WIDTH_MINOR,
40 ABS_MT_ORIENTATION,
41 ABS_MT_POSITION_X,
42 ABS_MT_POSITION_Y,
43 ABS_MT_TOOL_TYPE,
44 ABS_MT_BLOB_ID,
45 0
46};
47static unsigned long input_abs_bypass[BITS_TO_LONGS(ABS_CNT)];
48
32static LIST_HEAD(input_dev_list); 49static LIST_HEAD(input_dev_list);
33static LIST_HEAD(input_handler_list); 50static LIST_HEAD(input_handler_list);
34 51
@@ -161,6 +178,10 @@ static void input_handle_event(struct input_dev *dev,
161 disposition = INPUT_PASS_TO_HANDLERS; 178 disposition = INPUT_PASS_TO_HANDLERS;
162 } 179 }
163 break; 180 break;
181 case SYN_MT_REPORT:
182 dev->sync = 0;
183 disposition = INPUT_PASS_TO_HANDLERS;
184 break;
164 } 185 }
165 break; 186 break;
166 187
@@ -192,6 +213,11 @@ static void input_handle_event(struct input_dev *dev,
192 case EV_ABS: 213 case EV_ABS:
193 if (is_event_supported(code, dev->absbit, ABS_MAX)) { 214 if (is_event_supported(code, dev->absbit, ABS_MAX)) {
194 215
216 if (test_bit(code, input_abs_bypass)) {
217 disposition = INPUT_PASS_TO_HANDLERS;
218 break;
219 }
220
195 value = input_defuzz_abs_event(value, 221 value = input_defuzz_abs_event(value,
196 dev->abs[code], dev->absfuzz[code]); 222 dev->abs[code], dev->absfuzz[code]);
197 223
@@ -1634,10 +1660,20 @@ static const struct file_operations input_fops = {
1634 .open = input_open_file, 1660 .open = input_open_file,
1635}; 1661};
1636 1662
1663static void __init input_init_abs_bypass(void)
1664{
1665 const unsigned int *p;
1666
1667 for (p = input_abs_bypass_init_data; *p; p++)
1668 input_abs_bypass[BIT_WORD(*p)] |= BIT_MASK(*p);
1669}
1670
1637static int __init input_init(void) 1671static int __init input_init(void)
1638{ 1672{
1639 int err; 1673 int err;
1640 1674
1675 input_init_abs_bypass();
1676
1641 err = class_register(&input_class); 1677 err = class_register(&input_class);
1642 if (err) { 1678 if (err) {
1643 printk(KERN_ERR "input: unable to register input_dev class\n"); 1679 printk(KERN_ERR "input: unable to register input_dev class\n");
diff --git a/drivers/input/keyboard/omap-keypad.c b/drivers/input/keyboard/omap-keypad.c
index 058fa8b02c2..87ec7b18ac6 100644
--- a/drivers/input/keyboard/omap-keypad.c
+++ b/drivers/input/keyboard/omap-keypad.c
@@ -100,8 +100,20 @@ static irqreturn_t omap_kp_interrupt(int irq, void *dev_id)
100 /* disable keyboard interrupt and schedule for handling */ 100 /* disable keyboard interrupt and schedule for handling */
101 if (cpu_is_omap24xx()) { 101 if (cpu_is_omap24xx()) {
102 int i; 102 int i;
103 for (i = 0; i < omap_kp->rows; i++) 103
104 disable_irq(gpio_to_irq(row_gpios[i])); 104 for (i = 0; i < omap_kp->rows; i++) {
105 int gpio_irq = gpio_to_irq(row_gpios[i]);
106 /*
107 * The interrupt which we're currently handling should
108 * be disabled _nosync() to avoid deadlocks waiting
109 * for this handler to complete. All others should
110 * be disabled the regular way for SMP safety.
111 */
112 if (gpio_irq == irq)
113 disable_irq_nosync(gpio_irq);
114 else
115 disable_irq(gpio_irq);
116 }
105 } else 117 } else
106 /* disable keyboard interrupt and schedule for handling */ 118 /* disable keyboard interrupt and schedule for handling */
107 omap_writew(1, OMAP_MPUIO_BASE + OMAP_MPUIO_KBD_MASKIT); 119 omap_writew(1, OMAP_MPUIO_BASE + OMAP_MPUIO_KBD_MASKIT);
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index cbedf957cc5..daecc75c72e 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -37,6 +37,7 @@
37#define ALPS_FW_BK_2 0x40 37#define ALPS_FW_BK_2 0x40
38 38
39static const struct alps_model_info alps_model_data[] = { 39static const struct alps_model_info alps_model_data[] = {
40 { { 0x32, 0x02, 0x14 }, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, /* Toshiba Salellite Pro M10 */
40 { { 0x33, 0x02, 0x0a }, 0x88, 0xf8, ALPS_OLDPROTO }, /* UMAX-530T */ 41 { { 0x33, 0x02, 0x0a }, 0x88, 0xf8, ALPS_OLDPROTO }, /* UMAX-530T */
41 { { 0x53, 0x02, 0x0a }, 0xf8, 0xf8, 0 }, 42 { { 0x53, 0x02, 0x0a }, 0xf8, 0xf8, 0 },
42 { { 0x53, 0x02, 0x14 }, 0xf8, 0xf8, 0 }, 43 { { 0x53, 0x02, 0x14 }, 0xf8, 0xf8, 0 },
diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
index 454b96112f0..e0140fdc02a 100644
--- a/drivers/input/mouse/appletouch.c
+++ b/drivers/input/mouse/appletouch.c
@@ -255,15 +255,22 @@ MODULE_PARM_DESC(debug, "Activate debugging output");
255 */ 255 */
256static int atp_geyser_init(struct usb_device *udev) 256static int atp_geyser_init(struct usb_device *udev)
257{ 257{
258 char data[8]; 258 char *data;
259 int size; 259 int size;
260 int i; 260 int i;
261 int ret;
262
263 data = kmalloc(8, GFP_KERNEL);
264 if (!data) {
265 err("Out of memory");
266 return -ENOMEM;
267 }
261 268
262 size = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 269 size = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
263 ATP_GEYSER_MODE_READ_REQUEST_ID, 270 ATP_GEYSER_MODE_READ_REQUEST_ID,
264 USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE, 271 USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
265 ATP_GEYSER_MODE_REQUEST_VALUE, 272 ATP_GEYSER_MODE_REQUEST_VALUE,
266 ATP_GEYSER_MODE_REQUEST_INDEX, &data, 8, 5000); 273 ATP_GEYSER_MODE_REQUEST_INDEX, data, 8, 5000);
267 274
268 if (size != 8) { 275 if (size != 8) {
269 dprintk("atp_geyser_init: read error\n"); 276 dprintk("atp_geyser_init: read error\n");
@@ -271,7 +278,8 @@ static int atp_geyser_init(struct usb_device *udev)
271 dprintk("appletouch[%d]: %d\n", i, data[i]); 278 dprintk("appletouch[%d]: %d\n", i, data[i]);
272 279
273 err("Failed to read mode from device."); 280 err("Failed to read mode from device.");
274 return -EIO; 281 ret = -EIO;
282 goto out_free;
275 } 283 }
276 284
277 /* Apply the mode switch */ 285 /* Apply the mode switch */
@@ -281,7 +289,7 @@ static int atp_geyser_init(struct usb_device *udev)
281 ATP_GEYSER_MODE_WRITE_REQUEST_ID, 289 ATP_GEYSER_MODE_WRITE_REQUEST_ID,
282 USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE, 290 USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
283 ATP_GEYSER_MODE_REQUEST_VALUE, 291 ATP_GEYSER_MODE_REQUEST_VALUE,
284 ATP_GEYSER_MODE_REQUEST_INDEX, &data, 8, 5000); 292 ATP_GEYSER_MODE_REQUEST_INDEX, data, 8, 5000);
285 293
286 if (size != 8) { 294 if (size != 8) {
287 dprintk("atp_geyser_init: write error\n"); 295 dprintk("atp_geyser_init: write error\n");
@@ -289,9 +297,13 @@ static int atp_geyser_init(struct usb_device *udev)
289 dprintk("appletouch[%d]: %d\n", i, data[i]); 297 dprintk("appletouch[%d]: %d\n", i, data[i]);
290 298
291 err("Failed to request geyser raw mode"); 299 err("Failed to request geyser raw mode");
292 return -EIO; 300 ret = -EIO;
301 goto out_free;
293 } 302 }
294 return 0; 303 ret = 0;
304out_free:
305 kfree(data);
306 return ret;
295} 307}
296 308
297/* 309/*
diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c
index 2998a6ac9ae..2d8fc0bf692 100644
--- a/drivers/input/mouse/bcm5974.c
+++ b/drivers/input/mouse/bcm5974.c
@@ -51,6 +51,10 @@
51#define USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI 0x0230 51#define USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI 0x0230
52#define USB_DEVICE_ID_APPLE_WELLSPRING2_ISO 0x0231 52#define USB_DEVICE_ID_APPLE_WELLSPRING2_ISO 0x0231
53#define USB_DEVICE_ID_APPLE_WELLSPRING2_JIS 0x0232 53#define USB_DEVICE_ID_APPLE_WELLSPRING2_JIS 0x0232
54/* Macbook5,1 (unibody), aka wellspring3 */
55#define USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI 0x0236
56#define USB_DEVICE_ID_APPLE_WELLSPRING3_ISO 0x0237
57#define USB_DEVICE_ID_APPLE_WELLSPRING3_JIS 0x0238
54 58
55#define BCM5974_DEVICE(prod) { \ 59#define BCM5974_DEVICE(prod) { \
56 .match_flags = (USB_DEVICE_ID_MATCH_DEVICE | \ 60 .match_flags = (USB_DEVICE_ID_MATCH_DEVICE | \
@@ -72,6 +76,10 @@ static const struct usb_device_id bcm5974_table[] = {
72 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI), 76 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI),
73 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING2_ISO), 77 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING2_ISO),
74 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING2_JIS), 78 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING2_JIS),
79 /* Macbook5,1 */
80 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI),
81 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING3_ISO),
82 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING3_JIS),
75 /* Terminating entry */ 83 /* Terminating entry */
76 {} 84 {}
77}; 85};
@@ -96,14 +104,23 @@ struct bt_data {
96 u8 rel_y; /* relative y coordinate */ 104 u8 rel_y; /* relative y coordinate */
97}; 105};
98 106
99/* trackpad header structure */ 107/* trackpad header types */
100struct tp_header { 108enum tp_type {
101 u8 unknown1[16]; /* constants, timers, etc */ 109 TYPE1, /* plain trackpad */
102 u8 fingers; /* number of fingers on trackpad */ 110 TYPE2 /* button integrated in trackpad */
103 u8 unknown2[9]; /* constants, timers, etc */
104}; 111};
105 112
106/* trackpad finger structure */ 113/* trackpad finger data offsets, le16-aligned */
114#define FINGER_TYPE1 (13 * sizeof(__le16))
115#define FINGER_TYPE2 (15 * sizeof(__le16))
116
117/* trackpad button data offsets */
118#define BUTTON_TYPE2 15
119
120/* list of device capability bits */
121#define HAS_INTEGRATED_BUTTON 1
122
123/* trackpad finger structure, le16-aligned */
107struct tp_finger { 124struct tp_finger {
108 __le16 origin; /* zero when switching track finger */ 125 __le16 origin; /* zero when switching track finger */
109 __le16 abs_x; /* absolute x coodinate */ 126 __le16 abs_x; /* absolute x coodinate */
@@ -117,13 +134,11 @@ struct tp_finger {
117 __le16 force_minor; /* trackpad force, minor axis? */ 134 __le16 force_minor; /* trackpad force, minor axis? */
118 __le16 unused[3]; /* zeros */ 135 __le16 unused[3]; /* zeros */
119 __le16 multi; /* one finger: varies, more fingers: constant */ 136 __le16 multi; /* one finger: varies, more fingers: constant */
120}; 137} __attribute__((packed,aligned(2)));
121 138
122/* trackpad data structure, empirically at least ten fingers */ 139/* trackpad finger data size, empirically at least ten fingers */
123struct tp_data { 140#define SIZEOF_FINGER sizeof(struct tp_finger)
124 struct tp_header header; 141#define SIZEOF_ALL_FINGERS (16 * SIZEOF_FINGER)
125 struct tp_finger finger[16];
126};
127 142
128/* device-specific parameters */ 143/* device-specific parameters */
129struct bcm5974_param { 144struct bcm5974_param {
@@ -136,9 +151,12 @@ struct bcm5974_param {
136/* device-specific configuration */ 151/* device-specific configuration */
137struct bcm5974_config { 152struct bcm5974_config {
138 int ansi, iso, jis; /* the product id of this device */ 153 int ansi, iso, jis; /* the product id of this device */
154 int caps; /* device capability bitmask */
139 int bt_ep; /* the endpoint of the button interface */ 155 int bt_ep; /* the endpoint of the button interface */
140 int bt_datalen; /* data length of the button interface */ 156 int bt_datalen; /* data length of the button interface */
141 int tp_ep; /* the endpoint of the trackpad interface */ 157 int tp_ep; /* the endpoint of the trackpad interface */
158 enum tp_type tp_type; /* type of trackpad interface */
159 int tp_offset; /* offset to trackpad finger data */
142 int tp_datalen; /* data length of the trackpad interface */ 160 int tp_datalen; /* data length of the trackpad interface */
143 struct bcm5974_param p; /* finger pressure limits */ 161 struct bcm5974_param p; /* finger pressure limits */
144 struct bcm5974_param w; /* finger width limits */ 162 struct bcm5974_param w; /* finger width limits */
@@ -158,7 +176,7 @@ struct bcm5974 {
158 struct urb *bt_urb; /* button usb request block */ 176 struct urb *bt_urb; /* button usb request block */
159 struct bt_data *bt_data; /* button transferred data */ 177 struct bt_data *bt_data; /* button transferred data */
160 struct urb *tp_urb; /* trackpad usb request block */ 178 struct urb *tp_urb; /* trackpad usb request block */
161 struct tp_data *tp_data; /* trackpad transferred data */ 179 u8 *tp_data; /* trackpad transferred data */
162 int fingers; /* number of fingers on trackpad */ 180 int fingers; /* number of fingers on trackpad */
163}; 181};
164 182
@@ -183,8 +201,9 @@ static const struct bcm5974_config bcm5974_config_table[] = {
183 USB_DEVICE_ID_APPLE_WELLSPRING_ANSI, 201 USB_DEVICE_ID_APPLE_WELLSPRING_ANSI,
184 USB_DEVICE_ID_APPLE_WELLSPRING_ISO, 202 USB_DEVICE_ID_APPLE_WELLSPRING_ISO,
185 USB_DEVICE_ID_APPLE_WELLSPRING_JIS, 203 USB_DEVICE_ID_APPLE_WELLSPRING_JIS,
204 0,
186 0x84, sizeof(struct bt_data), 205 0x84, sizeof(struct bt_data),
187 0x81, sizeof(struct tp_data), 206 0x81, TYPE1, FINGER_TYPE1, FINGER_TYPE1 + SIZEOF_ALL_FINGERS,
188 { DIM_PRESSURE, DIM_PRESSURE / SN_PRESSURE, 0, 256 }, 207 { DIM_PRESSURE, DIM_PRESSURE / SN_PRESSURE, 0, 256 },
189 { DIM_WIDTH, DIM_WIDTH / SN_WIDTH, 0, 2048 }, 208 { DIM_WIDTH, DIM_WIDTH / SN_WIDTH, 0, 2048 },
190 { DIM_X, DIM_X / SN_COORD, -4824, 5342 }, 209 { DIM_X, DIM_X / SN_COORD, -4824, 5342 },
@@ -194,13 +213,26 @@ static const struct bcm5974_config bcm5974_config_table[] = {
194 USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI, 213 USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI,
195 USB_DEVICE_ID_APPLE_WELLSPRING2_ISO, 214 USB_DEVICE_ID_APPLE_WELLSPRING2_ISO,
196 USB_DEVICE_ID_APPLE_WELLSPRING2_JIS, 215 USB_DEVICE_ID_APPLE_WELLSPRING2_JIS,
216 0,
197 0x84, sizeof(struct bt_data), 217 0x84, sizeof(struct bt_data),
198 0x81, sizeof(struct tp_data), 218 0x81, TYPE1, FINGER_TYPE1, FINGER_TYPE1 + SIZEOF_ALL_FINGERS,
199 { DIM_PRESSURE, DIM_PRESSURE / SN_PRESSURE, 0, 256 }, 219 { DIM_PRESSURE, DIM_PRESSURE / SN_PRESSURE, 0, 256 },
200 { DIM_WIDTH, DIM_WIDTH / SN_WIDTH, 0, 2048 }, 220 { DIM_WIDTH, DIM_WIDTH / SN_WIDTH, 0, 2048 },
201 { DIM_X, DIM_X / SN_COORD, -4824, 4824 }, 221 { DIM_X, DIM_X / SN_COORD, -4824, 4824 },
202 { DIM_Y, DIM_Y / SN_COORD, -172, 4290 } 222 { DIM_Y, DIM_Y / SN_COORD, -172, 4290 }
203 }, 223 },
224 {
225 USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI,
226 USB_DEVICE_ID_APPLE_WELLSPRING3_ISO,
227 USB_DEVICE_ID_APPLE_WELLSPRING3_JIS,
228 HAS_INTEGRATED_BUTTON,
229 0x84, sizeof(struct bt_data),
230 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS,
231 { DIM_PRESSURE, DIM_PRESSURE / SN_PRESSURE, 0, 300 },
232 { DIM_WIDTH, DIM_WIDTH / SN_WIDTH, 0, 2048 },
233 { DIM_X, DIM_X / SN_COORD, -4460, 5166 },
234 { DIM_Y, DIM_Y / SN_COORD, -75, 6700 }
235 },
204 {} 236 {}
205}; 237};
206 238
@@ -257,6 +289,7 @@ static void setup_events_to_report(struct input_dev *input_dev,
257 __set_bit(BTN_TOOL_FINGER, input_dev->keybit); 289 __set_bit(BTN_TOOL_FINGER, input_dev->keybit);
258 __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit); 290 __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit);
259 __set_bit(BTN_TOOL_TRIPLETAP, input_dev->keybit); 291 __set_bit(BTN_TOOL_TRIPLETAP, input_dev->keybit);
292 __set_bit(BTN_TOOL_QUADTAP, input_dev->keybit);
260 __set_bit(BTN_LEFT, input_dev->keybit); 293 __set_bit(BTN_LEFT, input_dev->keybit);
261} 294}
262 295
@@ -266,6 +299,11 @@ static int report_bt_state(struct bcm5974 *dev, int size)
266 if (size != sizeof(struct bt_data)) 299 if (size != sizeof(struct bt_data))
267 return -EIO; 300 return -EIO;
268 301
302 dprintk(7,
303 "bcm5974: button data: %x %x %x %x\n",
304 dev->bt_data->unknown1, dev->bt_data->button,
305 dev->bt_data->rel_x, dev->bt_data->rel_y);
306
269 input_report_key(dev->input, BTN_LEFT, dev->bt_data->button); 307 input_report_key(dev->input, BTN_LEFT, dev->bt_data->button);
270 input_sync(dev->input); 308 input_sync(dev->input);
271 309
@@ -276,29 +314,37 @@ static int report_bt_state(struct bcm5974 *dev, int size)
276static int report_tp_state(struct bcm5974 *dev, int size) 314static int report_tp_state(struct bcm5974 *dev, int size)
277{ 315{
278 const struct bcm5974_config *c = &dev->cfg; 316 const struct bcm5974_config *c = &dev->cfg;
279 const struct tp_finger *f = dev->tp_data->finger; 317 const struct tp_finger *f;
280 struct input_dev *input = dev->input; 318 struct input_dev *input = dev->input;
281 const int fingers = (size - 26) / 28; 319 int raw_p, raw_w, raw_x, raw_y, raw_n;
282 int raw_p, raw_w, raw_x, raw_y; 320 int ptest = 0, origin = 0, ibt = 0, nmin = 0, nmax = 0;
283 int ptest = 0, origin = 0, nmin = 0, nmax = 0;
284 int abs_p = 0, abs_w = 0, abs_x = 0, abs_y = 0; 321 int abs_p = 0, abs_w = 0, abs_x = 0, abs_y = 0;
285 322
286 if (size < 26 || (size - 26) % 28 != 0) 323 if (size < c->tp_offset || (size - c->tp_offset) % SIZEOF_FINGER != 0)
287 return -EIO; 324 return -EIO;
288 325
326 /* finger data, le16-aligned */
327 f = (const struct tp_finger *)(dev->tp_data + c->tp_offset);
328 raw_n = (size - c->tp_offset) / SIZEOF_FINGER;
329
289 /* always track the first finger; when detached, start over */ 330 /* always track the first finger; when detached, start over */
290 if (fingers) { 331 if (raw_n) {
291 raw_p = raw2int(f->force_major); 332 raw_p = raw2int(f->force_major);
292 raw_w = raw2int(f->size_major); 333 raw_w = raw2int(f->size_major);
293 raw_x = raw2int(f->abs_x); 334 raw_x = raw2int(f->abs_x);
294 raw_y = raw2int(f->abs_y); 335 raw_y = raw2int(f->abs_y);
295 336
296 dprintk(9, 337 dprintk(9,
297 "bcm5974: raw: p: %+05d w: %+05d x: %+05d y: %+05d\n", 338 "bcm5974: "
298 raw_p, raw_w, raw_x, raw_y); 339 "raw: p: %+05d w: %+05d x: %+05d y: %+05d n: %d\n",
340 raw_p, raw_w, raw_x, raw_y, raw_n);
299 341
300 ptest = int2bound(&c->p, raw_p); 342 ptest = int2bound(&c->p, raw_p);
301 origin = raw2int(f->origin); 343 origin = raw2int(f->origin);
344
345 /* set the integrated button if applicable */
346 if (c->tp_type == TYPE2)
347 ibt = raw2int(dev->tp_data[BUTTON_TYPE2]);
302 } 348 }
303 349
304 /* while tracking finger still valid, count all fingers */ 350 /* while tracking finger still valid, count all fingers */
@@ -307,12 +353,13 @@ static int report_tp_state(struct bcm5974 *dev, int size)
307 abs_w = int2bound(&c->w, raw_w); 353 abs_w = int2bound(&c->w, raw_w);
308 abs_x = int2bound(&c->x, raw_x - c->x.devmin); 354 abs_x = int2bound(&c->x, raw_x - c->x.devmin);
309 abs_y = int2bound(&c->y, c->y.devmax - raw_y); 355 abs_y = int2bound(&c->y, c->y.devmax - raw_y);
310 for (; f != dev->tp_data->finger + fingers; f++) { 356 while (raw_n--) {
311 ptest = int2bound(&c->p, raw2int(f->force_major)); 357 ptest = int2bound(&c->p, raw2int(f->force_major));
312 if (ptest > PRESSURE_LOW) 358 if (ptest > PRESSURE_LOW)
313 nmax++; 359 nmax++;
314 if (ptest > PRESSURE_HIGH) 360 if (ptest > PRESSURE_HIGH)
315 nmin++; 361 nmin++;
362 f++;
316 } 363 }
317 } 364 }
318 365
@@ -324,7 +371,8 @@ static int report_tp_state(struct bcm5974 *dev, int size)
324 input_report_key(input, BTN_TOUCH, dev->fingers > 0); 371 input_report_key(input, BTN_TOUCH, dev->fingers > 0);
325 input_report_key(input, BTN_TOOL_FINGER, dev->fingers == 1); 372 input_report_key(input, BTN_TOOL_FINGER, dev->fingers == 1);
326 input_report_key(input, BTN_TOOL_DOUBLETAP, dev->fingers == 2); 373 input_report_key(input, BTN_TOOL_DOUBLETAP, dev->fingers == 2);
327 input_report_key(input, BTN_TOOL_TRIPLETAP, dev->fingers > 2); 374 input_report_key(input, BTN_TOOL_TRIPLETAP, dev->fingers == 3);
375 input_report_key(input, BTN_TOOL_QUADTAP, dev->fingers > 3);
328 376
329 input_report_abs(input, ABS_PRESSURE, abs_p); 377 input_report_abs(input, ABS_PRESSURE, abs_p);
330 input_report_abs(input, ABS_TOOL_WIDTH, abs_w); 378 input_report_abs(input, ABS_TOOL_WIDTH, abs_w);
@@ -335,11 +383,15 @@ static int report_tp_state(struct bcm5974 *dev, int size)
335 383
336 dprintk(8, 384 dprintk(8,
337 "bcm5974: abs: p: %+05d w: %+05d x: %+05d y: %+05d " 385 "bcm5974: abs: p: %+05d w: %+05d x: %+05d y: %+05d "
338 "nmin: %d nmax: %d n: %d\n", 386 "nmin: %d nmax: %d n: %d ibt: %d\n", abs_p, abs_w,
339 abs_p, abs_w, abs_x, abs_y, nmin, nmax, dev->fingers); 387 abs_x, abs_y, nmin, nmax, dev->fingers, ibt);
340 388
341 } 389 }
342 390
391 /* type 2 reports button events via ibt only */
392 if (c->tp_type == TYPE2)
393 input_report_key(input, BTN_LEFT, ibt);
394
343 input_sync(input); 395 input_sync(input);
344 396
345 return 0; 397 return 0;
@@ -649,6 +701,8 @@ static int bcm5974_probe(struct usb_interface *iface,
649 input_dev->name = "bcm5974"; 701 input_dev->name = "bcm5974";
650 input_dev->phys = dev->phys; 702 input_dev->phys = dev->phys;
651 usb_to_input_id(dev->udev, &input_dev->id); 703 usb_to_input_id(dev->udev, &input_dev->id);
704 /* report driver capabilities via the version field */
705 input_dev->id.version = cfg->caps;
652 input_dev->dev.parent = &iface->dev; 706 input_dev->dev.parent = &iface->dev;
653 707
654 input_set_drvdata(input_dev, dev); 708 input_set_drvdata(input_dev, dev);
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index 6ab0eb1ada1..4bc78892ba9 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Elantech Touchpad driver (v5) 2 * Elantech Touchpad driver (v6)
3 * 3 *
4 * Copyright (C) 2007-2008 Arjan Opmeer <arjan@opmeer.net> 4 * Copyright (C) 2007-2009 Arjan Opmeer <arjan@opmeer.net>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published 7 * under the terms of the GNU General Public License version 2 as published
@@ -178,6 +178,7 @@ static void elantech_report_absolute_v1(struct psmouse *psmouse)
178 struct elantech_data *etd = psmouse->private; 178 struct elantech_data *etd = psmouse->private;
179 unsigned char *packet = psmouse->packet; 179 unsigned char *packet = psmouse->packet;
180 int fingers; 180 int fingers;
181 static int old_fingers;
181 182
182 if (etd->fw_version_maj == 0x01) { 183 if (etd->fw_version_maj == 0x01) {
183 /* byte 0: D U p1 p2 1 p3 R L 184 /* byte 0: D U p1 p2 1 p3 R L
@@ -190,6 +191,14 @@ static void elantech_report_absolute_v1(struct psmouse *psmouse)
190 fingers = (packet[0] & 0xc0) >> 6; 191 fingers = (packet[0] & 0xc0) >> 6;
191 } 192 }
192 193
194 if (etd->jumpy_cursor) {
195 /* Discard packets that are likely to have bogus coordinates */
196 if (fingers > old_fingers) {
197 elantech_debug("elantech.c: discarding packet\n");
198 goto discard_packet_v1;
199 }
200 }
201
193 input_report_key(dev, BTN_TOUCH, fingers != 0); 202 input_report_key(dev, BTN_TOUCH, fingers != 0);
194 203
195 /* byte 2: x7 x6 x5 x4 x3 x2 x1 x0 204 /* byte 2: x7 x6 x5 x4 x3 x2 x1 x0
@@ -216,6 +225,9 @@ static void elantech_report_absolute_v1(struct psmouse *psmouse)
216 } 225 }
217 226
218 input_sync(dev); 227 input_sync(dev);
228
229 discard_packet_v1:
230 old_fingers = fingers;
219} 231}
220 232
221/* 233/*
@@ -363,9 +375,14 @@ static int elantech_set_absolute_mode(struct psmouse *psmouse)
363 rc = -1; 375 rc = -1;
364 break; 376 break;
365 } 377 }
378 }
379
380 if (rc == 0) {
366 /* 381 /*
367 * Read back reg 0x10. The touchpad is probably initalising 382 * Read back reg 0x10. For hardware version 1 we must make
368 * and not ready until we read back the value we just wrote. 383 * sure the absolute mode bit is set. For hardware version 2
384 * the touchpad is probably initalising and not ready until
385 * we read back the value we just wrote.
369 */ 386 */
370 do { 387 do {
371 rc = elantech_read_reg(psmouse, 0x10, &val); 388 rc = elantech_read_reg(psmouse, 0x10, &val);
@@ -373,12 +390,18 @@ static int elantech_set_absolute_mode(struct psmouse *psmouse)
373 break; 390 break;
374 tries--; 391 tries--;
375 elantech_debug("elantech.c: retrying read (%d).\n", 392 elantech_debug("elantech.c: retrying read (%d).\n",
376 tries); 393 tries);
377 msleep(ETP_READ_BACK_DELAY); 394 msleep(ETP_READ_BACK_DELAY);
378 } while (tries > 0); 395 } while (tries > 0);
379 if (rc) 396
397 if (rc) {
380 pr_err("elantech.c: failed to read back register 0x10.\n"); 398 pr_err("elantech.c: failed to read back register 0x10.\n");
381 break; 399 } else if (etd->hw_version == 1 &&
400 !(val & ETP_R10_ABSOLUTE_MODE)) {
401 pr_err("elantech.c: touchpad refuses "
402 "to switch to absolute mode.\n");
403 rc = -1;
404 }
382 } 405 }
383 406
384 if (rc) 407 if (rc)
@@ -662,6 +685,17 @@ int elantech_init(struct psmouse *psmouse)
662 param[0], param[1], param[2]); 685 param[0], param[1], param[2]);
663 etd->capabilities = param[0]; 686 etd->capabilities = param[0];
664 687
688 /*
689 * This firmware seems to suffer from misreporting coordinates when
690 * a touch action starts causing the mouse cursor or scrolled page
691 * to jump. Enable a workaround.
692 */
693 if (etd->fw_version_maj == 0x02 && etd->fw_version_min == 0x22) {
694 pr_info("elantech.c: firmware version 2.34 detected, "
695 "enabling jumpy cursor workaround\n");
696 etd->jumpy_cursor = 1;
697 }
698
665 if (elantech_set_absolute_mode(psmouse)) { 699 if (elantech_set_absolute_mode(psmouse)) {
666 pr_err("elantech.c: failed to put touchpad into absolute mode.\n"); 700 pr_err("elantech.c: failed to put touchpad into absolute mode.\n");
667 goto init_fail; 701 goto init_fail;
diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h
index bee282b540b..ed848cc8081 100644
--- a/drivers/input/mouse/elantech.h
+++ b/drivers/input/mouse/elantech.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Elantech Touchpad driver (v5) 2 * Elantech Touchpad driver (v6)
3 * 3 *
4 * Copyright (C) 2007-2008 Arjan Opmeer <arjan@opmeer.net> 4 * Copyright (C) 2007-2009 Arjan Opmeer <arjan@opmeer.net>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published 7 * under the terms of the GNU General Public License version 2 as published
@@ -104,6 +104,7 @@ struct elantech_data {
104 unsigned char fw_version_min; 104 unsigned char fw_version_min;
105 unsigned char hw_version; 105 unsigned char hw_version;
106 unsigned char paritycheck; 106 unsigned char paritycheck;
107 unsigned char jumpy_cursor;
107 unsigned char parity[256]; 108 unsigned char parity[256];
108}; 109};
109 110
diff --git a/drivers/input/mouse/lifebook.c b/drivers/input/mouse/lifebook.c
index df81b0aaa9f..15ac3205ac0 100644
--- a/drivers/input/mouse/lifebook.c
+++ b/drivers/input/mouse/lifebook.c
@@ -61,6 +61,12 @@ static const struct dmi_system_id lifebook_dmi_table[] = {
61 }, 61 },
62 }, 62 },
63 { 63 {
64 .ident = "Lifebook B-2130",
65 .matches = {
66 DMI_MATCH(DMI_BOARD_NAME, "ZEPHYR"),
67 },
68 },
69 {
64 .ident = "Lifebook B213x/B2150", 70 .ident = "Lifebook B213x/B2150",
65 .matches = { 71 .matches = {
66 DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B2131/B2133/B2150"), 72 DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B2131/B2133/B2150"),
diff --git a/drivers/input/serio/sa1111ps2.c b/drivers/input/serio/sa1111ps2.c
index 57953c0eb82..f412c69478a 100644
--- a/drivers/input/serio/sa1111ps2.c
+++ b/drivers/input/serio/sa1111ps2.c
@@ -77,7 +77,7 @@ static irqreturn_t ps2_txint(int irq, void *dev_id)
77 spin_lock(&ps2if->lock); 77 spin_lock(&ps2if->lock);
78 status = sa1111_readl(ps2if->base + SA1111_PS2STAT); 78 status = sa1111_readl(ps2if->base + SA1111_PS2STAT);
79 if (ps2if->head == ps2if->tail) { 79 if (ps2if->head == ps2if->tail) {
80 disable_irq(irq); 80 disable_irq_nosync(irq);
81 /* done */ 81 /* done */
82 } else if (status & PS2STAT_TXE) { 82 } else if (status & PS2STAT_TXE) {
83 sa1111_writel(ps2if->buf[ps2if->tail], ps2if->base + SA1111_PS2DATA); 83 sa1111_writel(ps2if->buf[ps2if->tail], ps2if->base + SA1111_PS2DATA);
diff --git a/drivers/input/tablet/wacom.h b/drivers/input/tablet/wacom.h
index 677680e9f54..9710bfd49cf 100644
--- a/drivers/input/tablet/wacom.h
+++ b/drivers/input/tablet/wacom.h
@@ -11,7 +11,7 @@
11 * Copyright (c) 2000 Daniel Egger <egger@suse.de> 11 * Copyright (c) 2000 Daniel Egger <egger@suse.de>
12 * Copyright (c) 2001 Frederic Lepied <flepied@mandrakesoft.com> 12 * Copyright (c) 2001 Frederic Lepied <flepied@mandrakesoft.com>
13 * Copyright (c) 2004 Panagiotis Issaris <panagiotis.issaris@mech.kuleuven.ac.be> 13 * Copyright (c) 2004 Panagiotis Issaris <panagiotis.issaris@mech.kuleuven.ac.be>
14 * Copyright (c) 2002-2008 Ping Cheng <pingc@wacom.com> 14 * Copyright (c) 2002-2009 Ping Cheng <pingc@wacom.com>
15 * 15 *
16 * ChangeLog: 16 * ChangeLog:
17 * v0.1 (vp) - Initial release 17 * v0.1 (vp) - Initial release
@@ -67,6 +67,7 @@
67 * v1.47 (pc) - Added support for Bamboo 67 * v1.47 (pc) - Added support for Bamboo
68 * v1.48 (pc) - Added support for Bamboo1, BambooFun, and Cintiq 12WX 68 * v1.48 (pc) - Added support for Bamboo1, BambooFun, and Cintiq 12WX
69 * v1.49 (pc) - Added support for USB Tablet PC (0x90, 0x93, and 0x9A) 69 * v1.49 (pc) - Added support for USB Tablet PC (0x90, 0x93, and 0x9A)
70 * v1.50 (pc) - Fixed a TabletPC touch bug in 2.6.28
70 */ 71 */
71 72
72/* 73/*
@@ -87,7 +88,7 @@
87/* 88/*
88 * Version Information 89 * Version Information
89 */ 90 */
90#define DRIVER_VERSION "v1.49" 91#define DRIVER_VERSION "v1.50"
91#define DRIVER_AUTHOR "Vojtech Pavlik <vojtech@ucw.cz>" 92#define DRIVER_AUTHOR "Vojtech Pavlik <vojtech@ucw.cz>"
92#define DRIVER_DESC "USB Wacom Graphire and Wacom Intuos tablet driver" 93#define DRIVER_DESC "USB Wacom Graphire and Wacom Intuos tablet driver"
93#define DRIVER_LICENSE "GPL" 94#define DRIVER_LICENSE "GPL"
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index 484496daa0f..b8624f27abf 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -289,6 +289,7 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi
289 5000); /* 5 secs */ 289 5000); /* 5 secs */
290 } while (result < 0 && limit++ < 5); 290 } while (result < 0 && limit++ < 5);
291 291
292 /* No need to parse the Descriptor. It isn't an error though */
292 if (result < 0) 293 if (result < 0)
293 goto out; 294 goto out;
294 295
@@ -368,9 +369,8 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi
368 } 369 }
369 } 370 }
370 371
371 result = 0;
372
373 out: 372 out:
373 result = 0;
374 kfree(report); 374 kfree(report);
375 return result; 375 return result;
376} 376}
@@ -425,6 +425,15 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
425 425
426 endpoint = &intf->cur_altsetting->endpoint[0].desc; 426 endpoint = &intf->cur_altsetting->endpoint[0].desc;
427 427
428 /* Initialize touch_x_max and touch_y_max in case it is not defined */
429 if (wacom_wac->features->type == TABLETPC) {
430 features->touch_x_max = 1023;
431 features->touch_y_max = 1023;
432 } else {
433 features->touch_x_max = 0;
434 features->touch_y_max = 0;
435 }
436
428 /* TabletPC need to retrieve the physical and logical maximum from report descriptor */ 437 /* TabletPC need to retrieve the physical and logical maximum from report descriptor */
429 if (wacom_wac->features->type == TABLETPC) { 438 if (wacom_wac->features->type == TABLETPC) {
430 if (usb_get_extra_descriptor(interface, HID_DEVICET_HID, &hid_desc)) { 439 if (usb_get_extra_descriptor(interface, HID_DEVICET_HID, &hid_desc)) {
diff --git a/drivers/input/touchscreen/tsc2007.c b/drivers/input/touchscreen/tsc2007.c
index 4ab07024689..536668fbda2 100644
--- a/drivers/input/touchscreen/tsc2007.c
+++ b/drivers/input/touchscreen/tsc2007.c
@@ -235,7 +235,7 @@ static irqreturn_t tsc2007_irq(int irq, void *handle)
235 spin_lock_irqsave(&ts->lock, flags); 235 spin_lock_irqsave(&ts->lock, flags);
236 236
237 if (likely(ts->get_pendown_state())) { 237 if (likely(ts->get_pendown_state())) {
238 disable_irq(ts->irq); 238 disable_irq_nosync(ts->irq);
239 hrtimer_start(&ts->timer, ktime_set(0, TS_POLL_DELAY), 239 hrtimer_start(&ts->timer, ktime_set(0, TS_POLL_DELAY),
240 HRTIMER_MODE_REL); 240 HRTIMER_MODE_REL);
241 } 241 }
diff --git a/drivers/input/touchscreen/ucb1400_ts.c b/drivers/input/touchscreen/ucb1400_ts.c
index e868264fe79..f100c7f4c1d 100644
--- a/drivers/input/touchscreen/ucb1400_ts.c
+++ b/drivers/input/touchscreen/ucb1400_ts.c
@@ -256,7 +256,7 @@ static irqreturn_t ucb1400_hard_irq(int irqnr, void *devid)
256 struct ucb1400_ts *ucb = devid; 256 struct ucb1400_ts *ucb = devid;
257 257
258 if (irqnr == ucb->irq) { 258 if (irqnr == ucb->irq) {
259 disable_irq(ucb->irq); 259 disable_irq_nosync(ucb->irq);
260 ucb->irq_pending = 1; 260 ucb->irq_pending = 1;
261 wake_up(&ucb->ts_wait); 261 wake_up(&ucb->ts_wait);
262 return IRQ_HANDLED; 262 return IRQ_HANDLED;
diff --git a/drivers/media/video/au0828/au0828-core.c b/drivers/media/video/au0828/au0828-core.c
index 4cee0b92eee..a1e4c0d769a 100644
--- a/drivers/media/video/au0828/au0828-core.c
+++ b/drivers/media/video/au0828/au0828-core.c
@@ -192,8 +192,6 @@ static int au0828_usb_probe(struct usb_interface *interface,
192 dev->usbdev = usbdev; 192 dev->usbdev = usbdev;
193 dev->boardnr = id->driver_info; 193 dev->boardnr = id->driver_info;
194 194
195 usb_set_intfdata(interface, dev);
196
197 /* Create the v4l2_device */ 195 /* Create the v4l2_device */
198 retval = v4l2_device_register(&interface->dev, &dev->v4l2_dev); 196 retval = v4l2_device_register(&interface->dev, &dev->v4l2_dev);
199 if (retval) { 197 if (retval) {
@@ -222,6 +220,10 @@ static int au0828_usb_probe(struct usb_interface *interface,
222 /* Digital TV */ 220 /* Digital TV */
223 au0828_dvb_register(dev); 221 au0828_dvb_register(dev);
224 222
223 /* Store the pointer to the au0828_dev so it can be accessed in
224 au0828_usb_disconnect */
225 usb_set_intfdata(interface, dev);
226
225 printk(KERN_INFO "Registered device AU0828 [%s]\n", 227 printk(KERN_INFO "Registered device AU0828 [%s]\n",
226 dev->board.name == NULL ? "Unset" : dev->board.name); 228 dev->board.name == NULL ? "Unset" : dev->board.name);
227 229
diff --git a/drivers/media/video/cx18/cx18-audio.c b/drivers/media/video/cx18/cx18-audio.c
index 1519e91c677..7a8ad5963de 100644
--- a/drivers/media/video/cx18/cx18-audio.c
+++ b/drivers/media/video/cx18/cx18-audio.c
@@ -44,7 +44,7 @@ int cx18_audio_set_io(struct cx18 *cx)
44 44
45 /* handle muxer chips */ 45 /* handle muxer chips */
46 v4l2_subdev_call(cx->sd_extmux, audio, s_routing, 46 v4l2_subdev_call(cx->sd_extmux, audio, s_routing,
47 in->audio_input, 0, 0); 47 (u32) in->muxer_input, 0, 0);
48 48
49 err = cx18_call_hw_err(cx, cx->card->hw_audio_ctrl, 49 err = cx18_call_hw_err(cx, cx->card->hw_audio_ctrl,
50 audio, s_routing, in->audio_input, 0, 0); 50 audio, s_routing, in->audio_input, 0, 0);
diff --git a/drivers/media/video/cx18/cx18-i2c.c b/drivers/media/video/cx18/cx18-i2c.c
index b9b7064a2be..8591e4fc359 100644
--- a/drivers/media/video/cx18/cx18-i2c.c
+++ b/drivers/media/video/cx18/cx18-i2c.c
@@ -211,7 +211,7 @@ static struct i2c_algo_bit_data cx18_i2c_algo_template = {
211/* init + register i2c algo-bit adapter */ 211/* init + register i2c algo-bit adapter */
212int init_cx18_i2c(struct cx18 *cx) 212int init_cx18_i2c(struct cx18 *cx)
213{ 213{
214 int i; 214 int i, err;
215 CX18_DEBUG_I2C("i2c init\n"); 215 CX18_DEBUG_I2C("i2c init\n");
216 216
217 for (i = 0; i < 2; i++) { 217 for (i = 0; i < 2; i++) {
@@ -268,8 +268,18 @@ int init_cx18_i2c(struct cx18 *cx)
268 cx18_call_hw(cx, CX18_HW_GPIO_RESET_CTRL, 268 cx18_call_hw(cx, CX18_HW_GPIO_RESET_CTRL,
269 core, reset, (u32) CX18_GPIO_RESET_I2C); 269 core, reset, (u32) CX18_GPIO_RESET_I2C);
270 270
271 return i2c_bit_add_bus(&cx->i2c_adap[0]) || 271 err = i2c_bit_add_bus(&cx->i2c_adap[0]);
272 i2c_bit_add_bus(&cx->i2c_adap[1]); 272 if (err)
273 goto err;
274 err = i2c_bit_add_bus(&cx->i2c_adap[1]);
275 if (err)
276 goto err_del_bus_0;
277 return 0;
278
279 err_del_bus_0:
280 i2c_del_adapter(&cx->i2c_adap[0]);
281 err:
282 return err;
273} 283}
274 284
275void exit_cx18_i2c(struct cx18 *cx) 285void exit_cx18_i2c(struct cx18 *cx)
diff --git a/drivers/media/video/cx231xx/Kconfig b/drivers/media/video/cx231xx/Kconfig
index 91156546a07..477d4ab5e9a 100644
--- a/drivers/media/video/cx231xx/Kconfig
+++ b/drivers/media/video/cx231xx/Kconfig
@@ -1,12 +1,11 @@
1config VIDEO_CX231XX 1config VIDEO_CX231XX
2 tristate "Conexant cx231xx USB video capture support" 2 tristate "Conexant cx231xx USB video capture support"
3 depends on VIDEO_DEV && I2C && INPUT 3 depends on VIDEO_DEV && I2C && INPUT
4 select VIDEO_TUNER 4 select VIDEO_TUNER
5 select VIDEO_TVEEPROM 5 select VIDEO_TVEEPROM
6 select VIDEO_IR 6 select VIDEO_IR
7 select VIDEOBUF_VMALLOC 7 select VIDEOBUF_VMALLOC
8 select VIDEO_CX25840 8 select VIDEO_CX25840
9 select VIDEO_CX231XX_ALSA
10 9
11 ---help--- 10 ---help---
12 This is a video4linux driver for Conexant 231xx USB based TV cards. 11 This is a video4linux driver for Conexant 231xx USB based TV cards.
@@ -15,21 +14,22 @@ config VIDEO_CX231XX
15 module will be called cx231xx 14 module will be called cx231xx
16 15
17config VIDEO_CX231XX_ALSA 16config VIDEO_CX231XX_ALSA
18 tristate "Conexant Cx231xx ALSA audio module" 17 tristate "Conexant Cx231xx ALSA audio module"
19 depends on VIDEO_CX231XX && SND 18 depends on VIDEO_CX231XX && SND
20 select SND_PCM 19 select SND_PCM
21 20
22 ---help--- 21 ---help---
23 This is an ALSA driver for Cx231xx USB based TV cards. 22 This is an ALSA driver for Cx231xx USB based TV cards.
24 23
25 To compile this driver as a module, choose M here: the 24 To compile this driver as a module, choose M here: the
26 module will be called cx231xx-alsa 25 module will be called cx231xx-alsa
27 26
28config VIDEO_CX231XX_DVB 27config VIDEO_CX231XX_DVB
29 tristate "DVB/ATSC Support for Cx231xx based TV cards" 28 tristate "DVB/ATSC Support for Cx231xx based TV cards"
30 depends on VIDEO_CX231XX && DVB_CORE 29 depends on VIDEO_CX231XX && DVB_CORE
31 select VIDEOBUF_DVB 30 select VIDEOBUF_DVB
32 select MEDIA_TUNER_XC5000 if !DVB_FE_CUSTOMISE 31 select MEDIA_TUNER_XC5000 if !DVB_FE_CUSTOMISE
33 ---help--- 32
34 This adds support for DVB cards based on the 33 ---help---
35 Conexant cx231xx chips. 34 This adds support for DVB cards based on the
35 Conexant cx231xx chips.
diff --git a/drivers/media/video/cx23885/cx23885-cards.c b/drivers/media/video/cx23885/cx23885-cards.c
index a3c0565be1a..6d6293f7d42 100644
--- a/drivers/media/video/cx23885/cx23885-cards.c
+++ b/drivers/media/video/cx23885/cx23885-cards.c
@@ -441,9 +441,9 @@ int cx23885_tuner_callback(void *priv, int component, int command, int arg)
441 case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP: 441 case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP:
442 /* Two identical tuners on two different i2c buses, 442 /* Two identical tuners on two different i2c buses,
443 * we need to reset the correct gpio. */ 443 * we need to reset the correct gpio. */
444 if (port->nr == 0) 444 if (port->nr == 1)
445 bitmask = 0x01; 445 bitmask = 0x01;
446 else if (port->nr == 1) 446 else if (port->nr == 2)
447 bitmask = 0x04; 447 bitmask = 0x04;
448 break; 448 break;
449 } 449 }
diff --git a/drivers/media/video/cx23885/cx23885-dvb.c b/drivers/media/video/cx23885/cx23885-dvb.c
index f48454ab390..0c49a98213c 100644
--- a/drivers/media/video/cx23885/cx23885-dvb.c
+++ b/drivers/media/video/cx23885/cx23885-dvb.c
@@ -314,6 +314,7 @@ static struct zl10353_config dvico_fusionhdtv_xc3028 = {
314 .demod_address = 0x0f, 314 .demod_address = 0x0f,
315 .if2 = 45600, 315 .if2 = 45600,
316 .no_tuner = 1, 316 .no_tuner = 1,
317 .disable_i2c_gate_ctrl = 1,
317}; 318};
318 319
319static struct stv0900_config netup_stv0900_config = { 320static struct stv0900_config netup_stv0900_config = {
diff --git a/drivers/media/video/mx3_camera.c b/drivers/media/video/mx3_camera.c
index c462b811e99..2d0781118eb 100644
--- a/drivers/media/video/mx3_camera.c
+++ b/drivers/media/video/mx3_camera.c
@@ -1063,10 +1063,6 @@ static struct soc_camera_host_ops mx3_soc_camera_host_ops = {
1063 .owner = THIS_MODULE, 1063 .owner = THIS_MODULE,
1064 .add = mx3_camera_add_device, 1064 .add = mx3_camera_add_device,
1065 .remove = mx3_camera_remove_device, 1065 .remove = mx3_camera_remove_device,
1066#ifdef CONFIG_PM
1067 .suspend = mx3_camera_suspend,
1068 .resume = mx3_camera_resume,
1069#endif
1070 .set_crop = mx3_camera_set_crop, 1066 .set_crop = mx3_camera_set_crop,
1071 .set_fmt = mx3_camera_set_fmt, 1067 .set_fmt = mx3_camera_set_fmt,
1072 .try_fmt = mx3_camera_try_fmt, 1068 .try_fmt = mx3_camera_try_fmt,
diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c
index 5202cadb2aa..30f4698be90 100644
--- a/drivers/media/video/s2255drv.c
+++ b/drivers/media/video/s2255drv.c
@@ -1237,6 +1237,7 @@ static int s2255_set_mode(struct s2255_dev *dev, unsigned long chn,
1237 buffer[1] = (u32) chn_rev; 1237 buffer[1] = (u32) chn_rev;
1238 buffer[2] = CMD_SET_MODE; 1238 buffer[2] = CMD_SET_MODE;
1239 memcpy(&buffer[3], &dev->mode[chn], sizeof(struct s2255_mode)); 1239 memcpy(&buffer[3], &dev->mode[chn], sizeof(struct s2255_mode));
1240 dev->setmode_ready[chn] = 0;
1240 res = s2255_write_config(dev->udev, (unsigned char *)buffer, 512); 1241 res = s2255_write_config(dev->udev, (unsigned char *)buffer, 512);
1241 if (debug) 1242 if (debug)
1242 dump_verify_mode(dev, mode); 1243 dump_verify_mode(dev, mode);
@@ -1245,7 +1246,6 @@ static int s2255_set_mode(struct s2255_dev *dev, unsigned long chn,
1245 1246
1246 /* wait at least 3 frames before continuing */ 1247 /* wait at least 3 frames before continuing */
1247 if (mode->restart) { 1248 if (mode->restart) {
1248 dev->setmode_ready[chn] = 0;
1249 wait_event_timeout(dev->wait_setmode[chn], 1249 wait_event_timeout(dev->wait_setmode[chn],
1250 (dev->setmode_ready[chn] != 0), 1250 (dev->setmode_ready[chn] != 0),
1251 msecs_to_jiffies(S2255_SETMODE_TIMEOUT)); 1251 msecs_to_jiffies(S2255_SETMODE_TIMEOUT));
diff --git a/drivers/media/video/saa5246a.c b/drivers/media/video/saa5246a.c
index da47b2f0528..155804b061e 100644
--- a/drivers/media/video/saa5246a.c
+++ b/drivers/media/video/saa5246a.c
@@ -1092,9 +1092,8 @@ static int saa5246a_probe(struct i2c_client *client,
1092 /* Register it */ 1092 /* Register it */
1093 err = video_register_device(t->vdev, VFL_TYPE_VTX, -1); 1093 err = video_register_device(t->vdev, VFL_TYPE_VTX, -1);
1094 if (err < 0) { 1094 if (err < 0) {
1095 kfree(t);
1096 video_device_release(t->vdev); 1095 video_device_release(t->vdev);
1097 t->vdev = NULL; 1096 kfree(t);
1098 return err; 1097 return err;
1099 } 1098 }
1100 return 0; 1099 return 0;
diff --git a/drivers/media/video/saa5249.c b/drivers/media/video/saa5249.c
index 48b27fe4808..271d6e931b7 100644
--- a/drivers/media/video/saa5249.c
+++ b/drivers/media/video/saa5249.c
@@ -598,6 +598,7 @@ static int saa5249_probe(struct i2c_client *client,
598 /* Now create a video4linux device */ 598 /* Now create a video4linux device */
599 t->vdev = video_device_alloc(); 599 t->vdev = video_device_alloc();
600 if (t->vdev == NULL) { 600 if (t->vdev == NULL) {
601 kfree(t);
601 kfree(client); 602 kfree(client);
602 return -ENOMEM; 603 return -ENOMEM;
603 } 604 }
@@ -617,9 +618,8 @@ static int saa5249_probe(struct i2c_client *client,
617 /* Register it */ 618 /* Register it */
618 err = video_register_device(t->vdev, VFL_TYPE_VTX, -1); 619 err = video_register_device(t->vdev, VFL_TYPE_VTX, -1);
619 if (err < 0) { 620 if (err < 0) {
620 kfree(t);
621 video_device_release(t->vdev); 621 video_device_release(t->vdev);
622 t->vdev = NULL; 622 kfree(t);
623 return err; 623 return err;
624 } 624 }
625 return 0; 625 return 0;
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index fe8041e619e..b25e9b6516a 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -254,6 +254,14 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
254 brq.data.blocks = req->nr_sectors; 254 brq.data.blocks = req->nr_sectors;
255 255
256 /* 256 /*
257 * The block layer doesn't support all sector count
258 * restrictions, so we need to be prepared for too big
259 * requests.
260 */
261 if (brq.data.blocks > card->host->max_blk_count)
262 brq.data.blocks = card->host->max_blk_count;
263
264 /*
257 * After a read error, we redo the request one sector at a time 265 * After a read error, we redo the request one sector at a time
258 * in order to accurately determine which sectors can be read 266 * in order to accurately determine which sectors can be read
259 * successfully. 267 * successfully.
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index fa073ab3fa3..26491173275 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -706,7 +706,7 @@ static void mmc_power_up(struct mmc_host *host)
706 * This delay should be sufficient to allow the power supply 706 * This delay should be sufficient to allow the power supply
707 * to reach the minimum voltage. 707 * to reach the minimum voltage.
708 */ 708 */
709 mmc_delay(2); 709 mmc_delay(10);
710 710
711 host->ios.clock = host->f_min; 711 host->ios.clock = host->f_min;
712 host->ios.power_mode = MMC_POWER_ON; 712 host->ios.power_mode = MMC_POWER_ON;
@@ -716,7 +716,7 @@ static void mmc_power_up(struct mmc_host *host)
716 * This delay must be at least 74 clock sizes, or 1 ms, or the 716 * This delay must be at least 74 clock sizes, or 1 ms, or the
717 * time required to reach a stable voltage. 717 * time required to reach a stable voltage.
718 */ 718 */
719 mmc_delay(2); 719 mmc_delay(10);
720} 720}
721 721
722static void mmc_power_off(struct mmc_host *host) 722static void mmc_power_off(struct mmc_host *host)
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index a663429b3d5..36875dcfa49 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -514,6 +514,7 @@ static int __devinit mmci_probe(struct amba_device *dev, void *id)
514 } 514 }
515 515
516 host = mmc_priv(mmc); 516 host = mmc_priv(mmc);
517 host->mmc = mmc;
517 /* Bits 12 thru 19 is the designer */ 518 /* Bits 12 thru 19 is the designer */
518 host->hw_designer = (dev->periphid >> 12) & 0xff; 519 host->hw_designer = (dev->periphid >> 12) & 0xff;
519 /* Bits 20 thru 23 is the revison */ 520 /* Bits 20 thru 23 is the revison */
@@ -545,7 +546,6 @@ static int __devinit mmci_probe(struct amba_device *dev, void *id)
545 host->mclk = clk_get_rate(host->clk); 546 host->mclk = clk_get_rate(host->clk);
546 DBG(host, "eventual mclk rate: %u Hz\n", host->mclk); 547 DBG(host, "eventual mclk rate: %u Hz\n", host->mclk);
547 } 548 }
548 host->mmc = mmc;
549 host->base = ioremap(dev->res.start, SZ_4K); 549 host->base = ioremap(dev->res.start, SZ_4K);
550 if (!host->base) { 550 if (!host->base) {
551 ret = -ENOMEM; 551 ret = -ENOMEM;
diff --git a/drivers/mmc/host/mvsdio.c b/drivers/mmc/host/mvsdio.c
index b5c375d94ab..c643d0fe118 100644
--- a/drivers/mmc/host/mvsdio.c
+++ b/drivers/mmc/host/mvsdio.c
@@ -825,24 +825,23 @@ static int __exit mvsd_remove(struct platform_device *pdev)
825} 825}
826 826
827#ifdef CONFIG_PM 827#ifdef CONFIG_PM
828static int mvsd_suspend(struct platform_device *dev, pm_message_t state, 828static int mvsd_suspend(struct platform_device *dev, pm_message_t state)
829 u32 level)
830{ 829{
831 struct mmc_host *mmc = platform_get_drvdata(dev); 830 struct mmc_host *mmc = platform_get_drvdata(dev);
832 int ret = 0; 831 int ret = 0;
833 832
834 if (mmc && level == SUSPEND_DISABLE) 833 if (mmc)
835 ret = mmc_suspend_host(mmc, state); 834 ret = mmc_suspend_host(mmc, state);
836 835
837 return ret; 836 return ret;
838} 837}
839 838
840static int mvsd_resume(struct platform_device *dev, u32 level) 839static int mvsd_resume(struct platform_device *dev)
841{ 840{
842 struct mmc_host *mmc = platform_dev_get_drvdata(dev); 841 struct mmc_host *mmc = platform_get_drvdata(dev);
843 int ret = 0; 842 int ret = 0;
844 843
845 if (mmc && level == RESUME_ENABLE) 844 if (mmc)
846 ret = mmc_resume_host(mmc); 845 ret = mmc_resume_host(mmc);
847 846
848 return ret; 847 return ret;
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index 5570849188c..bfa25c01c87 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -157,8 +157,6 @@ struct mmc_omap_host {
157 struct timer_list dma_timer; 157 struct timer_list dma_timer;
158 unsigned dma_len; 158 unsigned dma_len;
159 159
160 short power_pin;
161
162 struct mmc_omap_slot *slots[OMAP_MMC_MAX_SLOTS]; 160 struct mmc_omap_slot *slots[OMAP_MMC_MAX_SLOTS];
163 struct mmc_omap_slot *current_slot; 161 struct mmc_omap_slot *current_slot;
164 spinlock_t slot_lock; 162 spinlock_t slot_lock;
diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
index cd37962ec44..65be27995d5 100644
--- a/drivers/mmc/host/sdhci-pci.c
+++ b/drivers/mmc/host/sdhci-pci.c
@@ -522,8 +522,8 @@ static struct sdhci_pci_slot * __devinit sdhci_pci_probe_slot(
522 522
523 host = sdhci_alloc_host(&pdev->dev, sizeof(struct sdhci_pci_slot)); 523 host = sdhci_alloc_host(&pdev->dev, sizeof(struct sdhci_pci_slot));
524 if (IS_ERR(host)) { 524 if (IS_ERR(host)) {
525 ret = PTR_ERR(host); 525 dev_err(&pdev->dev, "cannot allocate host\n");
526 goto unmap; 526 return ERR_PTR(PTR_ERR(host));
527 } 527 }
528 528
529 slot = sdhci_priv(host); 529 slot = sdhci_priv(host);
@@ -541,7 +541,7 @@ static struct sdhci_pci_slot * __devinit sdhci_pci_probe_slot(
541 ret = pci_request_region(pdev, bar, mmc_hostname(host->mmc)); 541 ret = pci_request_region(pdev, bar, mmc_hostname(host->mmc));
542 if (ret) { 542 if (ret) {
543 dev_err(&pdev->dev, "cannot request region\n"); 543 dev_err(&pdev->dev, "cannot request region\n");
544 return ERR_PTR(ret); 544 goto free;
545 } 545 }
546 546
547 addr = pci_resource_start(pdev, bar); 547 addr = pci_resource_start(pdev, bar);
@@ -572,6 +572,8 @@ unmap:
572 572
573release: 573release:
574 pci_release_region(pdev, bar); 574 pci_release_region(pdev, bar);
575
576free:
575 sdhci_free_host(host); 577 sdhci_free_host(host);
576 578
577 return ERR_PTR(ret); 579 return ERR_PTR(ret);
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index f20a834f430..65c6f996bbd 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -125,7 +125,7 @@
125#define SDHCI_INT_DATA_MASK (SDHCI_INT_DATA_END | SDHCI_INT_DMA_END | \ 125#define SDHCI_INT_DATA_MASK (SDHCI_INT_DATA_END | SDHCI_INT_DMA_END | \
126 SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL | \ 126 SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL | \
127 SDHCI_INT_DATA_TIMEOUT | SDHCI_INT_DATA_CRC | \ 127 SDHCI_INT_DATA_TIMEOUT | SDHCI_INT_DATA_CRC | \
128 SDHCI_INT_DATA_END_BIT) 128 SDHCI_INT_DATA_END_BIT | SDHCI_ADMA_ERROR)
129#define SDHCI_INT_ALL_MASK ((unsigned int)-1) 129#define SDHCI_INT_ALL_MASK ((unsigned int)-1)
130 130
131#define SDHCI_ACMD12_ERR 0x3C 131#define SDHCI_ACMD12_ERR 0x3C
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
index 616c60ffcf2..3ac27ee4739 100644
--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -97,9 +97,7 @@ static void __init zfcp_init_device_configure(char *busid, u64 wwpn, u64 lun)
97 ccw_device_set_online(adapter->ccw_device); 97 ccw_device_set_online(adapter->ccw_device);
98 98
99 zfcp_erp_wait(adapter); 99 zfcp_erp_wait(adapter);
100 wait_event(adapter->erp_done_wqh, 100 flush_work(&unit->scsi_work);
101 !(atomic_read(&unit->status) &
102 ZFCP_STATUS_UNIT_SCSI_WORK_PENDING));
103 101
104 down(&zfcp_data.config_sema); 102 down(&zfcp_data.config_sema);
105 zfcp_unit_put(unit); 103 zfcp_unit_put(unit);
@@ -279,6 +277,7 @@ struct zfcp_unit *zfcp_unit_enqueue(struct zfcp_port *port, u64 fcp_lun)
279 277
280 atomic_set(&unit->refcount, 0); 278 atomic_set(&unit->refcount, 0);
281 init_waitqueue_head(&unit->remove_wq); 279 init_waitqueue_head(&unit->remove_wq);
280 INIT_WORK(&unit->scsi_work, zfcp_scsi_scan);
282 281
283 unit->port = port; 282 unit->port = port;
284 unit->fcp_lun = fcp_lun; 283 unit->fcp_lun = fcp_lun;
@@ -525,6 +524,8 @@ int zfcp_adapter_enqueue(struct ccw_device *ccw_device)
525 524
526 atomic_clear_mask(ZFCP_STATUS_COMMON_REMOVE, &adapter->status); 525 atomic_clear_mask(ZFCP_STATUS_COMMON_REMOVE, &adapter->status);
527 526
527 zfcp_fc_nameserver_init(adapter);
528
528 if (!zfcp_adapter_scsi_register(adapter)) 529 if (!zfcp_adapter_scsi_register(adapter))
529 return 0; 530 return 0;
530 531
@@ -553,7 +554,6 @@ void zfcp_adapter_dequeue(struct zfcp_adapter *adapter)
553 554
554 cancel_work_sync(&adapter->scan_work); 555 cancel_work_sync(&adapter->scan_work);
555 cancel_work_sync(&adapter->stat_work); 556 cancel_work_sync(&adapter->stat_work);
556 cancel_delayed_work_sync(&adapter->nsp.work);
557 zfcp_adapter_scsi_unregister(adapter); 557 zfcp_adapter_scsi_unregister(adapter);
558 sysfs_remove_group(&adapter->ccw_device->dev.kobj, 558 sysfs_remove_group(&adapter->ccw_device->dev.kobj,
559 &zfcp_sysfs_adapter_attrs); 559 &zfcp_sysfs_adapter_attrs);
@@ -671,8 +671,7 @@ void zfcp_port_dequeue(struct zfcp_port *port)
671 list_del(&port->list); 671 list_del(&port->list);
672 write_unlock_irq(&zfcp_data.config_lock); 672 write_unlock_irq(&zfcp_data.config_lock);
673 if (port->rport) 673 if (port->rport)
674 fc_remote_port_delete(port->rport); 674 port->rport->dd_data = NULL;
675 port->rport = NULL;
676 zfcp_adapter_put(port->adapter); 675 zfcp_adapter_put(port->adapter);
677 sysfs_remove_group(&port->sysfs_device.kobj, &zfcp_sysfs_port_attrs); 676 sysfs_remove_group(&port->sysfs_device.kobj, &zfcp_sysfs_port_attrs);
678 device_unregister(&port->sysfs_device); 677 device_unregister(&port->sysfs_device);
diff --git a/drivers/s390/scsi/zfcp_ccw.c b/drivers/s390/scsi/zfcp_ccw.c
index cfb0dcb6e3f..733fe3bf628 100644
--- a/drivers/s390/scsi/zfcp_ccw.c
+++ b/drivers/s390/scsi/zfcp_ccw.c
@@ -108,7 +108,6 @@ static int zfcp_ccw_set_online(struct ccw_device *ccw_device)
108 /* initialize request counter */ 108 /* initialize request counter */
109 BUG_ON(!zfcp_reqlist_isempty(adapter)); 109 BUG_ON(!zfcp_reqlist_isempty(adapter));
110 adapter->req_no = 0; 110 adapter->req_no = 0;
111 zfcp_fc_nameserver_init(adapter);
112 111
113 zfcp_erp_modify_adapter_status(adapter, "ccsonl1", NULL, 112 zfcp_erp_modify_adapter_status(adapter, "ccsonl1", NULL,
114 ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET); 113 ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET);
diff --git a/drivers/s390/scsi/zfcp_cfdc.c b/drivers/s390/scsi/zfcp_cfdc.c
index 10cbfd172a2..8305c874e86 100644
--- a/drivers/s390/scsi/zfcp_cfdc.c
+++ b/drivers/s390/scsi/zfcp_cfdc.c
@@ -4,7 +4,7 @@
4 * Userspace interface for accessing the 4 * Userspace interface for accessing the
5 * Access Control Lists / Control File Data Channel 5 * Access Control Lists / Control File Data Channel
6 * 6 *
7 * Copyright IBM Corporation 2008 7 * Copyright IBM Corporation 2008, 2009
8 */ 8 */
9 9
10#define KMSG_COMPONENT "zfcp" 10#define KMSG_COMPONENT "zfcp"
@@ -197,6 +197,7 @@ static long zfcp_cfdc_dev_ioctl(struct file *file, unsigned int command,
197 retval = -ENXIO; 197 retval = -ENXIO;
198 goto free_buffer; 198 goto free_buffer;
199 } 199 }
200 zfcp_adapter_get(adapter);
200 201
201 retval = zfcp_cfdc_sg_setup(data->command, fsf_cfdc->sg, 202 retval = zfcp_cfdc_sg_setup(data->command, fsf_cfdc->sg,
202 data_user->control_file); 203 data_user->control_file);
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h
index a0318630f04..4c362a9069f 100644
--- a/drivers/s390/scsi/zfcp_def.h
+++ b/drivers/s390/scsi/zfcp_def.h
@@ -255,7 +255,6 @@ enum zfcp_wka_status {
255/* logical unit status */ 255/* logical unit status */
256#define ZFCP_STATUS_UNIT_SHARED 0x00000004 256#define ZFCP_STATUS_UNIT_SHARED 0x00000004
257#define ZFCP_STATUS_UNIT_READONLY 0x00000008 257#define ZFCP_STATUS_UNIT_READONLY 0x00000008
258#define ZFCP_STATUS_UNIT_SCSI_WORK_PENDING 0x00000020
259 258
260/* FSF request status (this does not have a common part) */ 259/* FSF request status (this does not have a common part) */
261#define ZFCP_STATUS_FSFREQ_TASK_MANAGEMENT 0x00000002 260#define ZFCP_STATUS_FSFREQ_TASK_MANAGEMENT 0x00000002
@@ -530,6 +529,7 @@ struct zfcp_unit {
530 struct zfcp_erp_action erp_action; /* pending error recovery */ 529 struct zfcp_erp_action erp_action; /* pending error recovery */
531 atomic_t erp_counter; 530 atomic_t erp_counter;
532 struct zfcp_latencies latencies; 531 struct zfcp_latencies latencies;
532 struct work_struct scsi_work;
533}; 533};
534 534
535/* FSF request */ 535/* FSF request */
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
index 631bdb1dfd6..fdc9b4352a6 100644
--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -719,6 +719,7 @@ static void zfcp_erp_adapter_strategy_close(struct zfcp_erp_action *act)
719 zfcp_qdio_close(adapter); 719 zfcp_qdio_close(adapter);
720 zfcp_fsf_req_dismiss_all(adapter); 720 zfcp_fsf_req_dismiss_all(adapter);
721 adapter->fsf_req_seq_no = 0; 721 adapter->fsf_req_seq_no = 0;
722 zfcp_fc_wka_port_force_offline(&adapter->nsp);
722 /* all ports and units are closed */ 723 /* all ports and units are closed */
723 zfcp_erp_modify_adapter_status(adapter, "erascl1", NULL, 724 zfcp_erp_modify_adapter_status(adapter, "erascl1", NULL,
724 ZFCP_STATUS_COMMON_OPEN, ZFCP_CLEAR); 725 ZFCP_STATUS_COMMON_OPEN, ZFCP_CLEAR);
@@ -1176,48 +1177,6 @@ static void zfcp_erp_action_dequeue(struct zfcp_erp_action *erp_action)
1176 } 1177 }
1177} 1178}
1178 1179
1179struct zfcp_erp_add_work {
1180 struct zfcp_unit *unit;
1181 struct work_struct work;
1182};
1183
1184static void zfcp_erp_scsi_scan(struct work_struct *work)
1185{
1186 struct zfcp_erp_add_work *p =
1187 container_of(work, struct zfcp_erp_add_work, work);
1188 struct zfcp_unit *unit = p->unit;
1189 struct fc_rport *rport = unit->port->rport;
1190
1191 if (rport && rport->port_state == FC_PORTSTATE_ONLINE)
1192 scsi_scan_target(&rport->dev, 0, rport->scsi_target_id,
1193 scsilun_to_int((struct scsi_lun *)&unit->fcp_lun), 0);
1194 atomic_clear_mask(ZFCP_STATUS_UNIT_SCSI_WORK_PENDING, &unit->status);
1195 zfcp_unit_put(unit);
1196 wake_up(&unit->port->adapter->erp_done_wqh);
1197 kfree(p);
1198}
1199
1200static void zfcp_erp_schedule_work(struct zfcp_unit *unit)
1201{
1202 struct zfcp_erp_add_work *p;
1203
1204 p = kzalloc(sizeof(*p), GFP_KERNEL);
1205 if (!p) {
1206 dev_err(&unit->port->adapter->ccw_device->dev,
1207 "Registering unit 0x%016Lx on port 0x%016Lx failed\n",
1208 (unsigned long long)unit->fcp_lun,
1209 (unsigned long long)unit->port->wwpn);
1210 return;
1211 }
1212
1213 zfcp_unit_get(unit);
1214 atomic_set_mask(ZFCP_STATUS_UNIT_SCSI_WORK_PENDING, &unit->status);
1215 INIT_WORK(&p->work, zfcp_erp_scsi_scan);
1216 p->unit = unit;
1217 if (!queue_work(zfcp_data.work_queue, &p->work))
1218 zfcp_unit_put(unit);
1219}
1220
1221static void zfcp_erp_action_cleanup(struct zfcp_erp_action *act, int result) 1180static void zfcp_erp_action_cleanup(struct zfcp_erp_action *act, int result)
1222{ 1181{
1223 struct zfcp_adapter *adapter = act->adapter; 1182 struct zfcp_adapter *adapter = act->adapter;
@@ -1226,11 +1185,11 @@ static void zfcp_erp_action_cleanup(struct zfcp_erp_action *act, int result)
1226 1185
1227 switch (act->action) { 1186 switch (act->action) {
1228 case ZFCP_ERP_ACTION_REOPEN_UNIT: 1187 case ZFCP_ERP_ACTION_REOPEN_UNIT:
1229 flush_work(&port->rport_work);
1230 if ((result == ZFCP_ERP_SUCCEEDED) && !unit->device) { 1188 if ((result == ZFCP_ERP_SUCCEEDED) && !unit->device) {
1231 if (!(atomic_read(&unit->status) & 1189 zfcp_unit_get(unit);
1232 ZFCP_STATUS_UNIT_SCSI_WORK_PENDING)) 1190 if (scsi_queue_work(unit->port->adapter->scsi_host,
1233 zfcp_erp_schedule_work(unit); 1191 &unit->scsi_work) <= 0)
1192 zfcp_unit_put(unit);
1234 } 1193 }
1235 zfcp_unit_put(unit); 1194 zfcp_unit_put(unit);
1236 break; 1195 break;
@@ -1352,6 +1311,11 @@ static int zfcp_erp_thread(void *data)
1352 1311
1353 while (!(atomic_read(&adapter->status) & 1312 while (!(atomic_read(&adapter->status) &
1354 ZFCP_STATUS_ADAPTER_ERP_THREAD_KILL)) { 1313 ZFCP_STATUS_ADAPTER_ERP_THREAD_KILL)) {
1314
1315 zfcp_rec_dbf_event_thread_lock("erthrd1", adapter);
1316 ignore = down_interruptible(&adapter->erp_ready_sem);
1317 zfcp_rec_dbf_event_thread_lock("erthrd2", adapter);
1318
1355 write_lock_irqsave(&adapter->erp_lock, flags); 1319 write_lock_irqsave(&adapter->erp_lock, flags);
1356 next = adapter->erp_ready_head.next; 1320 next = adapter->erp_ready_head.next;
1357 write_unlock_irqrestore(&adapter->erp_lock, flags); 1321 write_unlock_irqrestore(&adapter->erp_lock, flags);
@@ -1363,10 +1327,6 @@ static int zfcp_erp_thread(void *data)
1363 if (zfcp_erp_strategy(act) != ZFCP_ERP_DISMISSED) 1327 if (zfcp_erp_strategy(act) != ZFCP_ERP_DISMISSED)
1364 zfcp_erp_wakeup(adapter); 1328 zfcp_erp_wakeup(adapter);
1365 } 1329 }
1366
1367 zfcp_rec_dbf_event_thread_lock("erthrd1", adapter);
1368 ignore = down_interruptible(&adapter->erp_ready_sem);
1369 zfcp_rec_dbf_event_thread_lock("erthrd2", adapter);
1370 } 1330 }
1371 1331
1372 atomic_clear_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_UP, &adapter->status); 1332 atomic_clear_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_UP, &adapter->status);
diff --git a/drivers/s390/scsi/zfcp_ext.h b/drivers/s390/scsi/zfcp_ext.h
index f6399ca97bc..2e31b536548 100644
--- a/drivers/s390/scsi/zfcp_ext.h
+++ b/drivers/s390/scsi/zfcp_ext.h
@@ -106,6 +106,7 @@ extern void zfcp_fc_plogi_evaluate(struct zfcp_port *, struct fsf_plogi *);
106extern void zfcp_test_link(struct zfcp_port *); 106extern void zfcp_test_link(struct zfcp_port *);
107extern void zfcp_fc_link_test_work(struct work_struct *); 107extern void zfcp_fc_link_test_work(struct work_struct *);
108extern void zfcp_fc_nameserver_init(struct zfcp_adapter *); 108extern void zfcp_fc_nameserver_init(struct zfcp_adapter *);
109extern void zfcp_fc_wka_port_force_offline(struct zfcp_wka_port *);
109 110
110/* zfcp_fsf.c */ 111/* zfcp_fsf.c */
111extern int zfcp_fsf_open_port(struct zfcp_erp_action *); 112extern int zfcp_fsf_open_port(struct zfcp_erp_action *);
@@ -158,6 +159,7 @@ extern void zfcp_scsi_rport_work(struct work_struct *);
158extern void zfcp_scsi_schedule_rport_register(struct zfcp_port *); 159extern void zfcp_scsi_schedule_rport_register(struct zfcp_port *);
159extern void zfcp_scsi_schedule_rport_block(struct zfcp_port *); 160extern void zfcp_scsi_schedule_rport_block(struct zfcp_port *);
160extern void zfcp_scsi_schedule_rports_block(struct zfcp_adapter *); 161extern void zfcp_scsi_schedule_rports_block(struct zfcp_adapter *);
162extern void zfcp_scsi_scan(struct work_struct *);
161 163
162/* zfcp_sysfs.c */ 164/* zfcp_sysfs.c */
163extern struct attribute_group zfcp_sysfs_unit_attrs; 165extern struct attribute_group zfcp_sysfs_unit_attrs;
diff --git a/drivers/s390/scsi/zfcp_fc.c b/drivers/s390/scsi/zfcp_fc.c
index e8d032b9dfb..19ae0842047 100644
--- a/drivers/s390/scsi/zfcp_fc.c
+++ b/drivers/s390/scsi/zfcp_fc.c
@@ -98,13 +98,6 @@ static void zfcp_wka_port_offline(struct work_struct *work)
98 struct zfcp_wka_port *wka_port = 98 struct zfcp_wka_port *wka_port =
99 container_of(dw, struct zfcp_wka_port, work); 99 container_of(dw, struct zfcp_wka_port, work);
100 100
101 /* Don't wait forvever. If the wka_port is too busy take it offline
102 through a new call later */
103 if (!wait_event_timeout(wka_port->completion_wq,
104 atomic_read(&wka_port->refcount) == 0,
105 HZ >> 1))
106 return;
107
108 mutex_lock(&wka_port->mutex); 101 mutex_lock(&wka_port->mutex);
109 if ((atomic_read(&wka_port->refcount) != 0) || 102 if ((atomic_read(&wka_port->refcount) != 0) ||
110 (wka_port->status != ZFCP_WKA_PORT_ONLINE)) 103 (wka_port->status != ZFCP_WKA_PORT_ONLINE))
@@ -142,6 +135,14 @@ void zfcp_fc_nameserver_init(struct zfcp_adapter *adapter)
142 INIT_DELAYED_WORK(&wka_port->work, zfcp_wka_port_offline); 135 INIT_DELAYED_WORK(&wka_port->work, zfcp_wka_port_offline);
143} 136}
144 137
138void zfcp_fc_wka_port_force_offline(struct zfcp_wka_port *wka)
139{
140 cancel_delayed_work_sync(&wka->work);
141 mutex_lock(&wka->mutex);
142 wka->status = ZFCP_WKA_PORT_OFFLINE;
143 mutex_unlock(&wka->mutex);
144}
145
145static void _zfcp_fc_incoming_rscn(struct zfcp_fsf_req *fsf_req, u32 range, 146static void _zfcp_fc_incoming_rscn(struct zfcp_fsf_req *fsf_req, u32 range,
146 struct fcp_rscn_element *elem) 147 struct fcp_rscn_element *elem)
147{ 148{
@@ -372,7 +373,8 @@ static void zfcp_fc_adisc_handler(unsigned long data)
372 373
373 if (adisc->els.status) { 374 if (adisc->els.status) {
374 /* request rejected or timed out */ 375 /* request rejected or timed out */
375 zfcp_erp_port_forced_reopen(port, 0, "fcadh_1", NULL); 376 zfcp_erp_port_forced_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED,
377 "fcadh_1", NULL);
376 goto out; 378 goto out;
377 } 379 }
378 380
@@ -431,11 +433,6 @@ void zfcp_fc_link_test_work(struct work_struct *work)
431 container_of(work, struct zfcp_port, test_link_work); 433 container_of(work, struct zfcp_port, test_link_work);
432 int retval; 434 int retval;
433 435
434 if (!(atomic_read(&port->status) & ZFCP_STATUS_COMMON_UNBLOCKED)) {
435 zfcp_port_put(port);
436 return; /* port erp is running and will update rport status */
437 }
438
439 zfcp_port_get(port); 436 zfcp_port_get(port);
440 port->rport_task = RPORT_DEL; 437 port->rport_task = RPORT_DEL;
441 zfcp_scsi_rport_work(&port->rport_work); 438 zfcp_scsi_rport_work(&port->rport_work);
@@ -542,6 +539,9 @@ static void zfcp_validate_port(struct zfcp_port *port)
542{ 539{
543 struct zfcp_adapter *adapter = port->adapter; 540 struct zfcp_adapter *adapter = port->adapter;
544 541
542 if (!(atomic_read(&port->status) & ZFCP_STATUS_COMMON_NOESC))
543 return;
544
545 atomic_clear_mask(ZFCP_STATUS_COMMON_NOESC, &port->status); 545 atomic_clear_mask(ZFCP_STATUS_COMMON_NOESC, &port->status);
546 546
547 if ((port->supported_classes != 0) || 547 if ((port->supported_classes != 0) ||
@@ -602,10 +602,8 @@ static int zfcp_scan_eval_gpn_ft(struct zfcp_gpn_ft *gpn_ft, int max_entries)
602 if (acc->wwpn == fc_host_port_name(adapter->scsi_host)) 602 if (acc->wwpn == fc_host_port_name(adapter->scsi_host))
603 continue; 603 continue;
604 port = zfcp_get_port_by_wwpn(adapter, acc->wwpn); 604 port = zfcp_get_port_by_wwpn(adapter, acc->wwpn);
605 if (port) { 605 if (port)
606 zfcp_port_get(port);
607 continue; 606 continue;
608 }
609 607
610 port = zfcp_port_enqueue(adapter, acc->wwpn, 608 port = zfcp_port_enqueue(adapter, acc->wwpn,
611 ZFCP_STATUS_COMMON_NOESC, d_id); 609 ZFCP_STATUS_COMMON_NOESC, d_id);
@@ -637,7 +635,8 @@ int zfcp_scan_ports(struct zfcp_adapter *adapter)
637 max_entries = chain ? ZFCP_GPN_FT_MAX_ENTRIES : ZFCP_GPN_FT_ENTRIES; 635 max_entries = chain ? ZFCP_GPN_FT_MAX_ENTRIES : ZFCP_GPN_FT_ENTRIES;
638 max_bytes = chain ? ZFCP_GPN_FT_MAX_SIZE : ZFCP_CT_SIZE_ONE_PAGE; 636 max_bytes = chain ? ZFCP_GPN_FT_MAX_SIZE : ZFCP_CT_SIZE_ONE_PAGE;
639 637
640 if (fc_host_port_type(adapter->scsi_host) != FC_PORTTYPE_NPORT) 638 if (fc_host_port_type(adapter->scsi_host) != FC_PORTTYPE_NPORT &&
639 fc_host_port_type(adapter->scsi_host) != FC_PORTTYPE_NPIV)
641 return 0; 640 return 0;
642 641
643 ret = zfcp_wka_port_get(&adapter->nsp); 642 ret = zfcp_wka_port_get(&adapter->nsp);
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index b29f3121b66..74dee32afba 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -172,12 +172,16 @@ static void zfcp_fsf_link_down_info_eval(struct zfcp_fsf_req *req, char *id,
172 struct fsf_link_down_info *link_down) 172 struct fsf_link_down_info *link_down)
173{ 173{
174 struct zfcp_adapter *adapter = req->adapter; 174 struct zfcp_adapter *adapter = req->adapter;
175 unsigned long flags;
175 176
176 if (atomic_read(&adapter->status) & ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED) 177 if (atomic_read(&adapter->status) & ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED)
177 return; 178 return;
178 179
179 atomic_set_mask(ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED, &adapter->status); 180 atomic_set_mask(ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED, &adapter->status);
181
182 read_lock_irqsave(&zfcp_data.config_lock, flags);
180 zfcp_scsi_schedule_rports_block(adapter); 183 zfcp_scsi_schedule_rports_block(adapter);
184 read_unlock_irqrestore(&zfcp_data.config_lock, flags);
181 185
182 if (!link_down) 186 if (!link_down)
183 goto out; 187 goto out;
@@ -645,30 +649,30 @@ static void zfcp_fsf_exchange_port_data_handler(struct zfcp_fsf_req *req)
645 } 649 }
646} 650}
647 651
648static int zfcp_fsf_req_sbal_get(struct zfcp_adapter *adapter) 652static int zfcp_fsf_sbal_check(struct zfcp_adapter *adapter)
649 __releases(&adapter->req_q_lock)
650 __acquires(&adapter->req_q_lock)
651{ 653{
652 struct zfcp_qdio_queue *req_q = &adapter->req_q; 654 struct zfcp_qdio_queue *req_q = &adapter->req_q;
653 long ret;
654 655
655 if (atomic_read(&req_q->count) <= -REQUEST_LIST_SIZE) 656 spin_lock_bh(&adapter->req_q_lock);
656 return -EIO; 657 if (atomic_read(&req_q->count))
657 if (atomic_read(&req_q->count) > 0) 658 return 1;
658 return 0; 659 spin_unlock_bh(&adapter->req_q_lock);
660 return 0;
661}
662
663static int zfcp_fsf_req_sbal_get(struct zfcp_adapter *adapter)
664{
665 long ret;
659 666
660 atomic_dec(&req_q->count);
661 spin_unlock_bh(&adapter->req_q_lock); 667 spin_unlock_bh(&adapter->req_q_lock);
662 ret = wait_event_interruptible_timeout(adapter->request_wq, 668 ret = wait_event_interruptible_timeout(adapter->request_wq,
663 atomic_read(&req_q->count) >= 0, 669 zfcp_fsf_sbal_check(adapter), 5 * HZ);
664 5 * HZ);
665 spin_lock_bh(&adapter->req_q_lock);
666 atomic_inc(&req_q->count);
667
668 if (ret > 0) 670 if (ret > 0)
669 return 0; 671 return 0;
670 if (!ret) 672 if (!ret)
671 atomic_inc(&adapter->qdio_outb_full); 673 atomic_inc(&adapter->qdio_outb_full);
674
675 spin_lock_bh(&adapter->req_q_lock);
672 return -EIO; 676 return -EIO;
673} 677}
674 678
@@ -766,8 +770,9 @@ static struct zfcp_fsf_req *zfcp_fsf_req_create(struct zfcp_adapter *adapter,
766static int zfcp_fsf_req_send(struct zfcp_fsf_req *req) 770static int zfcp_fsf_req_send(struct zfcp_fsf_req *req)
767{ 771{
768 struct zfcp_adapter *adapter = req->adapter; 772 struct zfcp_adapter *adapter = req->adapter;
769 unsigned long flags; 773 unsigned long flags;
770 int idx; 774 int idx;
775 int with_qtcb = (req->qtcb != NULL);
771 776
772 /* put allocated FSF request into hash table */ 777 /* put allocated FSF request into hash table */
773 spin_lock_irqsave(&adapter->req_list_lock, flags); 778 spin_lock_irqsave(&adapter->req_list_lock, flags);
@@ -789,7 +794,7 @@ static int zfcp_fsf_req_send(struct zfcp_fsf_req *req)
789 } 794 }
790 795
791 /* Don't increase for unsolicited status */ 796 /* Don't increase for unsolicited status */
792 if (req->qtcb) 797 if (with_qtcb)
793 adapter->fsf_req_seq_no++; 798 adapter->fsf_req_seq_no++;
794 adapter->req_no++; 799 adapter->req_no++;
795 800
@@ -1253,13 +1258,13 @@ int zfcp_fsf_exchange_config_data_sync(struct zfcp_adapter *adapter,
1253 1258
1254 spin_lock_bh(&adapter->req_q_lock); 1259 spin_lock_bh(&adapter->req_q_lock);
1255 if (zfcp_fsf_req_sbal_get(adapter)) 1260 if (zfcp_fsf_req_sbal_get(adapter))
1256 goto out; 1261 goto out_unlock;
1257 1262
1258 req = zfcp_fsf_req_create(adapter, FSF_QTCB_EXCHANGE_CONFIG_DATA, 1263 req = zfcp_fsf_req_create(adapter, FSF_QTCB_EXCHANGE_CONFIG_DATA,
1259 0, NULL); 1264 0, NULL);
1260 if (IS_ERR(req)) { 1265 if (IS_ERR(req)) {
1261 retval = PTR_ERR(req); 1266 retval = PTR_ERR(req);
1262 goto out; 1267 goto out_unlock;
1263 } 1268 }
1264 1269
1265 sbale = zfcp_qdio_sbale_req(req); 1270 sbale = zfcp_qdio_sbale_req(req);
@@ -1278,14 +1283,16 @@ int zfcp_fsf_exchange_config_data_sync(struct zfcp_adapter *adapter,
1278 1283
1279 zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT); 1284 zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT);
1280 retval = zfcp_fsf_req_send(req); 1285 retval = zfcp_fsf_req_send(req);
1281out:
1282 spin_unlock_bh(&adapter->req_q_lock); 1286 spin_unlock_bh(&adapter->req_q_lock);
1283 if (!retval) 1287 if (!retval)
1284 wait_event(req->completion_wq, 1288 wait_event(req->completion_wq,
1285 req->status & ZFCP_STATUS_FSFREQ_COMPLETED); 1289 req->status & ZFCP_STATUS_FSFREQ_COMPLETED);
1286 1290
1287 zfcp_fsf_req_free(req); 1291 zfcp_fsf_req_free(req);
1292 return retval;
1288 1293
1294out_unlock:
1295 spin_unlock_bh(&adapter->req_q_lock);
1289 return retval; 1296 return retval;
1290} 1297}
1291 1298
@@ -1352,13 +1359,13 @@ int zfcp_fsf_exchange_port_data_sync(struct zfcp_adapter *adapter,
1352 1359
1353 spin_lock_bh(&adapter->req_q_lock); 1360 spin_lock_bh(&adapter->req_q_lock);
1354 if (zfcp_fsf_req_sbal_get(adapter)) 1361 if (zfcp_fsf_req_sbal_get(adapter))
1355 goto out; 1362 goto out_unlock;
1356 1363
1357 req = zfcp_fsf_req_create(adapter, FSF_QTCB_EXCHANGE_PORT_DATA, 0, 1364 req = zfcp_fsf_req_create(adapter, FSF_QTCB_EXCHANGE_PORT_DATA, 0,
1358 NULL); 1365 NULL);
1359 if (IS_ERR(req)) { 1366 if (IS_ERR(req)) {
1360 retval = PTR_ERR(req); 1367 retval = PTR_ERR(req);
1361 goto out; 1368 goto out_unlock;
1362 } 1369 }
1363 1370
1364 if (data) 1371 if (data)
@@ -1371,14 +1378,18 @@ int zfcp_fsf_exchange_port_data_sync(struct zfcp_adapter *adapter,
1371 req->handler = zfcp_fsf_exchange_port_data_handler; 1378 req->handler = zfcp_fsf_exchange_port_data_handler;
1372 zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT); 1379 zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT);
1373 retval = zfcp_fsf_req_send(req); 1380 retval = zfcp_fsf_req_send(req);
1374out:
1375 spin_unlock_bh(&adapter->req_q_lock); 1381 spin_unlock_bh(&adapter->req_q_lock);
1382
1376 if (!retval) 1383 if (!retval)
1377 wait_event(req->completion_wq, 1384 wait_event(req->completion_wq,
1378 req->status & ZFCP_STATUS_FSFREQ_COMPLETED); 1385 req->status & ZFCP_STATUS_FSFREQ_COMPLETED);
1379 zfcp_fsf_req_free(req); 1386 zfcp_fsf_req_free(req);
1380 1387
1381 return retval; 1388 return retval;
1389
1390out_unlock:
1391 spin_unlock_bh(&adapter->req_q_lock);
1392 return retval;
1382} 1393}
1383 1394
1384static void zfcp_fsf_open_port_handler(struct zfcp_fsf_req *req) 1395static void zfcp_fsf_open_port_handler(struct zfcp_fsf_req *req)
@@ -2472,8 +2483,6 @@ out:
2472 2483
2473static void zfcp_fsf_control_file_handler(struct zfcp_fsf_req *req) 2484static void zfcp_fsf_control_file_handler(struct zfcp_fsf_req *req)
2474{ 2485{
2475 if (req->qtcb->header.fsf_status != FSF_GOOD)
2476 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2477} 2486}
2478 2487
2479/** 2488/**
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c
index 58201e1ae47..e8fbeaeb5fb 100644
--- a/drivers/s390/scsi/zfcp_scsi.c
+++ b/drivers/s390/scsi/zfcp_scsi.c
@@ -171,7 +171,7 @@ static int zfcp_scsi_eh_abort_handler(struct scsi_cmnd *scpnt)
171 write_unlock_irqrestore(&adapter->abort_lock, flags); 171 write_unlock_irqrestore(&adapter->abort_lock, flags);
172 zfcp_scsi_dbf_event_abort("lte1", adapter, scpnt, NULL, 172 zfcp_scsi_dbf_event_abort("lte1", adapter, scpnt, NULL,
173 old_req_id); 173 old_req_id);
174 return SUCCESS; 174 return FAILED; /* completion could be in progress */
175 } 175 }
176 old_req->data = NULL; 176 old_req->data = NULL;
177 177
@@ -486,10 +486,12 @@ static void zfcp_set_rport_dev_loss_tmo(struct fc_rport *rport, u32 timeout)
486 */ 486 */
487static void zfcp_scsi_dev_loss_tmo_callbk(struct fc_rport *rport) 487static void zfcp_scsi_dev_loss_tmo_callbk(struct fc_rport *rport)
488{ 488{
489 struct zfcp_port *port = rport->dd_data; 489 struct zfcp_port *port;
490 490
491 write_lock_irq(&zfcp_data.config_lock); 491 write_lock_irq(&zfcp_data.config_lock);
492 port->rport = NULL; 492 port = rport->dd_data;
493 if (port)
494 port->rport = NULL;
493 write_unlock_irq(&zfcp_data.config_lock); 495 write_unlock_irq(&zfcp_data.config_lock);
494} 496}
495 497
@@ -503,9 +505,18 @@ static void zfcp_scsi_dev_loss_tmo_callbk(struct fc_rport *rport)
503 */ 505 */
504static void zfcp_scsi_terminate_rport_io(struct fc_rport *rport) 506static void zfcp_scsi_terminate_rport_io(struct fc_rport *rport)
505{ 507{
506 struct zfcp_port *port = rport->dd_data; 508 struct zfcp_port *port;
509
510 write_lock_irq(&zfcp_data.config_lock);
511 port = rport->dd_data;
512 if (port)
513 zfcp_port_get(port);
514 write_unlock_irq(&zfcp_data.config_lock);
507 515
508 zfcp_erp_port_reopen(port, 0, "sctrpi1", NULL); 516 if (port) {
517 zfcp_erp_port_reopen(port, 0, "sctrpi1", NULL);
518 zfcp_port_put(port);
519 }
509} 520}
510 521
511static void zfcp_scsi_rport_register(struct zfcp_port *port) 522static void zfcp_scsi_rport_register(struct zfcp_port *port)
@@ -534,8 +545,10 @@ static void zfcp_scsi_rport_register(struct zfcp_port *port)
534 545
535static void zfcp_scsi_rport_block(struct zfcp_port *port) 546static void zfcp_scsi_rport_block(struct zfcp_port *port)
536{ 547{
537 if (port->rport) 548 struct fc_rport *rport = port->rport;
538 fc_remote_port_delete(port->rport); 549
550 if (rport)
551 fc_remote_port_delete(rport);
539} 552}
540 553
541void zfcp_scsi_schedule_rport_register(struct zfcp_port *port) 554void zfcp_scsi_schedule_rport_register(struct zfcp_port *port)
@@ -583,6 +596,23 @@ void zfcp_scsi_rport_work(struct work_struct *work)
583} 596}
584 597
585 598
599void zfcp_scsi_scan(struct work_struct *work)
600{
601 struct zfcp_unit *unit = container_of(work, struct zfcp_unit,
602 scsi_work);
603 struct fc_rport *rport;
604
605 flush_work(&unit->port->rport_work);
606 rport = unit->port->rport;
607
608 if (rport && rport->port_state == FC_PORTSTATE_ONLINE)
609 scsi_scan_target(&rport->dev, 0, rport->scsi_target_id,
610 scsilun_to_int((struct scsi_lun *)
611 &unit->fcp_lun), 0);
612
613 zfcp_unit_put(unit);
614}
615
586struct fc_function_template zfcp_transport_functions = { 616struct fc_function_template zfcp_transport_functions = {
587 .show_starget_port_id = 1, 617 .show_starget_port_id = 1,
588 .show_starget_port_name = 1, 618 .show_starget_port_name = 1,
diff --git a/drivers/s390/scsi/zfcp_sysfs.c b/drivers/s390/scsi/zfcp_sysfs.c
index 9a3b8e261c0..3e51e64d110 100644
--- a/drivers/s390/scsi/zfcp_sysfs.c
+++ b/drivers/s390/scsi/zfcp_sysfs.c
@@ -254,12 +254,21 @@ static ssize_t zfcp_sysfs_unit_remove_store(struct device *dev,
254 254
255 write_lock_irq(&zfcp_data.config_lock); 255 write_lock_irq(&zfcp_data.config_lock);
256 unit = zfcp_get_unit_by_lun(port, fcp_lun); 256 unit = zfcp_get_unit_by_lun(port, fcp_lun);
257 if (unit && (atomic_read(&unit->refcount) == 0)) { 257 if (unit) {
258 zfcp_unit_get(unit); 258 write_unlock_irq(&zfcp_data.config_lock);
259 atomic_set_mask(ZFCP_STATUS_COMMON_REMOVE, &unit->status); 259 /* wait for possible timeout during SCSI probe */
260 list_move(&unit->list, &unit_remove_lh); 260 flush_work(&unit->scsi_work);
261 } else 261 write_lock_irq(&zfcp_data.config_lock);
262 unit = NULL; 262
263 if (atomic_read(&unit->refcount) == 0) {
264 zfcp_unit_get(unit);
265 atomic_set_mask(ZFCP_STATUS_COMMON_REMOVE,
266 &unit->status);
267 list_move(&unit->list, &unit_remove_lh);
268 } else {
269 unit = NULL;
270 }
271 }
263 272
264 write_unlock_irq(&zfcp_data.config_lock); 273 write_unlock_irq(&zfcp_data.config_lock);
265 274
diff --git a/drivers/scsi/cxgb3i/cxgb3i.h b/drivers/scsi/cxgb3i/cxgb3i.h
index d362860e750..59b0958d2d1 100644
--- a/drivers/scsi/cxgb3i/cxgb3i.h
+++ b/drivers/scsi/cxgb3i/cxgb3i.h
@@ -34,7 +34,7 @@
34#include "cxgb3i_offload.h" 34#include "cxgb3i_offload.h"
35#include "cxgb3i_ddp.h" 35#include "cxgb3i_ddp.h"
36 36
37#define CXGB3I_SCSI_QDEPTH_DFLT 128 37#define CXGB3I_SCSI_HOST_QDEPTH 1024
38#define CXGB3I_MAX_TARGET CXGB3I_MAX_CONN 38#define CXGB3I_MAX_TARGET CXGB3I_MAX_CONN
39#define CXGB3I_MAX_LUN 512 39#define CXGB3I_MAX_LUN 512
40#define ISCSI_PDU_NONPAYLOAD_MAX \ 40#define ISCSI_PDU_NONPAYLOAD_MAX \
diff --git a/drivers/scsi/cxgb3i/cxgb3i_ddp.c b/drivers/scsi/cxgb3i/cxgb3i_ddp.c
index d06a661c209..99c91254790 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_ddp.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_ddp.c
@@ -120,20 +120,26 @@ static void clear_ddp_map(struct cxgb3i_ddp_info *ddp, unsigned int tag,
120} 120}
121 121
122static inline int ddp_find_unused_entries(struct cxgb3i_ddp_info *ddp, 122static inline int ddp_find_unused_entries(struct cxgb3i_ddp_info *ddp,
123 int start, int max, int count, 123 unsigned int start, unsigned int max,
124 unsigned int count,
124 struct cxgb3i_gather_list *gl) 125 struct cxgb3i_gather_list *gl)
125{ 126{
126 unsigned int i, j; 127 unsigned int i, j, k;
127 128
129 /* not enough entries */
130 if ((max - start) < count)
131 return -EBUSY;
132
133 max -= count;
128 spin_lock(&ddp->map_lock); 134 spin_lock(&ddp->map_lock);
129 for (i = start; i <= max;) { 135 for (i = start; i < max;) {
130 for (j = 0; j < count; j++) { 136 for (j = 0, k = i; j < count; j++, k++) {
131 if (ddp->gl_map[i + j]) 137 if (ddp->gl_map[k])
132 break; 138 break;
133 } 139 }
134 if (j == count) { 140 if (j == count) {
135 for (j = 0; j < count; j++) 141 for (j = 0, k = i; j < count; j++, k++)
136 ddp->gl_map[i + j] = gl; 142 ddp->gl_map[k] = gl;
137 spin_unlock(&ddp->map_lock); 143 spin_unlock(&ddp->map_lock);
138 return i; 144 return i;
139 } 145 }
@@ -354,7 +360,7 @@ int cxgb3i_ddp_tag_reserve(struct t3cdev *tdev, unsigned int tid,
354 struct cxgb3i_ddp_info *ddp = tdev->ulp_iscsi; 360 struct cxgb3i_ddp_info *ddp = tdev->ulp_iscsi;
355 struct pagepod_hdr hdr; 361 struct pagepod_hdr hdr;
356 unsigned int npods; 362 unsigned int npods;
357 int idx = -1, idx_max; 363 int idx = -1;
358 int err = -ENOMEM; 364 int err = -ENOMEM;
359 u32 sw_tag = *tagp; 365 u32 sw_tag = *tagp;
360 u32 tag; 366 u32 tag;
@@ -367,17 +373,17 @@ int cxgb3i_ddp_tag_reserve(struct t3cdev *tdev, unsigned int tid,
367 } 373 }
368 374
369 npods = (gl->nelem + PPOD_PAGES_MAX - 1) >> PPOD_PAGES_SHIFT; 375 npods = (gl->nelem + PPOD_PAGES_MAX - 1) >> PPOD_PAGES_SHIFT;
370 idx_max = ddp->nppods - npods + 1;
371 376
372 if (ddp->idx_last == ddp->nppods) 377 if (ddp->idx_last == ddp->nppods)
373 idx = ddp_find_unused_entries(ddp, 0, idx_max, npods, gl); 378 idx = ddp_find_unused_entries(ddp, 0, ddp->nppods, npods, gl);
374 else { 379 else {
375 idx = ddp_find_unused_entries(ddp, ddp->idx_last + 1, 380 idx = ddp_find_unused_entries(ddp, ddp->idx_last + 1,
376 idx_max, npods, gl); 381 ddp->nppods, npods, gl);
377 if (idx < 0 && ddp->idx_last >= npods) 382 if (idx < 0 && ddp->idx_last >= npods) {
378 idx = ddp_find_unused_entries(ddp, 0, 383 idx = ddp_find_unused_entries(ddp, 0,
379 ddp->idx_last - npods + 1, 384 min(ddp->idx_last + npods, ddp->nppods),
380 npods, gl); 385 npods, gl);
386 }
381 } 387 }
382 if (idx < 0) { 388 if (idx < 0) {
383 ddp_log_debug("xferlen %u, gl %u, npods %u NO DDP.\n", 389 ddp_log_debug("xferlen %u, gl %u, npods %u NO DDP.\n",
diff --git a/drivers/scsi/cxgb3i/cxgb3i_iscsi.c b/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
index fff8e432764..9212400b9b1 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
@@ -876,13 +876,14 @@ static struct scsi_host_template cxgb3i_host_template = {
876 .proc_name = "cxgb3i", 876 .proc_name = "cxgb3i",
877 .queuecommand = iscsi_queuecommand, 877 .queuecommand = iscsi_queuecommand,
878 .change_queue_depth = iscsi_change_queue_depth, 878 .change_queue_depth = iscsi_change_queue_depth,
879 .can_queue = CXGB3I_SCSI_QDEPTH_DFLT - 1, 879 .can_queue = CXGB3I_SCSI_HOST_QDEPTH,
880 .sg_tablesize = SG_ALL, 880 .sg_tablesize = SG_ALL,
881 .max_sectors = 0xFFFF, 881 .max_sectors = 0xFFFF,
882 .cmd_per_lun = CXGB3I_SCSI_QDEPTH_DFLT, 882 .cmd_per_lun = ISCSI_DEF_CMD_PER_LUN,
883 .eh_abort_handler = iscsi_eh_abort, 883 .eh_abort_handler = iscsi_eh_abort,
884 .eh_device_reset_handler = iscsi_eh_device_reset, 884 .eh_device_reset_handler = iscsi_eh_device_reset,
885 .eh_target_reset_handler = iscsi_eh_target_reset, 885 .eh_target_reset_handler = iscsi_eh_target_reset,
886 .target_alloc = iscsi_target_alloc,
886 .use_clustering = DISABLE_CLUSTERING, 887 .use_clustering = DISABLE_CLUSTERING,
887 .this_id = -1, 888 .this_id = -1,
888}; 889};
diff --git a/drivers/scsi/cxgb3i/cxgb3i_offload.c b/drivers/scsi/cxgb3i/cxgb3i_offload.c
index 4d8654cdbda..e11c9c180f3 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_offload.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_offload.c
@@ -1737,7 +1737,7 @@ int cxgb3i_c3cn_send_pdus(struct s3_conn *c3cn, struct sk_buff *skb)
1737 c3cn_tx_debug("c3cn 0x%p, snd %u - %u > %u.\n", 1737 c3cn_tx_debug("c3cn 0x%p, snd %u - %u > %u.\n",
1738 c3cn, c3cn->write_seq, c3cn->snd_una, 1738 c3cn, c3cn->write_seq, c3cn->snd_una,
1739 cxgb3_snd_win); 1739 cxgb3_snd_win);
1740 err = -EAGAIN; 1740 err = -ENOBUFS;
1741 goto out_err; 1741 goto out_err;
1742 } 1742 }
1743 1743
@@ -1775,6 +1775,8 @@ done:
1775out_err: 1775out_err:
1776 if (copied == 0 && err == -EPIPE) 1776 if (copied == 0 && err == -EPIPE)
1777 copied = c3cn->err ? c3cn->err : -EPIPE; 1777 copied = c3cn->err ? c3cn->err : -EPIPE;
1778 else
1779 copied = err;
1778 goto done; 1780 goto done;
1779} 1781}
1780 1782
diff --git a/drivers/scsi/cxgb3i/cxgb3i_pdu.c b/drivers/scsi/cxgb3i/cxgb3i_pdu.c
index 7eebc9a7cb3..70910507117 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_pdu.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_pdu.c
@@ -400,17 +400,18 @@ int cxgb3i_conn_xmit_pdu(struct iscsi_task *task)
400 return 0; 400 return 0;
401 } 401 }
402 402
403 if (err < 0 && err != -EAGAIN) { 403 if (err == -EAGAIN || err == -ENOBUFS) {
404 kfree_skb(skb); 404 /* reset skb to send when we are called again */
405 cxgb3i_tx_debug("itt 0x%x, skb 0x%p, len %u/%u, xmit err %d.\n", 405 tdata->skb = skb;
406 task->itt, skb, skb->len, skb->data_len, err);
407 iscsi_conn_printk(KERN_ERR, task->conn, "xmit err %d.\n", err);
408 iscsi_conn_failure(task->conn, ISCSI_ERR_XMIT_FAILED);
409 return err; 406 return err;
410 } 407 }
411 /* reset skb to send when we are called again */ 408
412 tdata->skb = skb; 409 kfree_skb(skb);
413 return -EAGAIN; 410 cxgb3i_tx_debug("itt 0x%x, skb 0x%p, len %u/%u, xmit err %d.\n",
411 task->itt, skb, skb->len, skb->data_len, err);
412 iscsi_conn_printk(KERN_ERR, task->conn, "xmit err %d.\n", err);
413 iscsi_conn_failure(task->conn, ISCSI_ERR_XMIT_FAILED);
414 return err;
414} 415}
415 416
416int cxgb3i_pdu_init(void) 417int cxgb3i_pdu_init(void)
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index 94e1e318977..03e1926f40b 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -57,7 +57,7 @@ DEFINE_RWLOCK(fcoe_hostlist_lock);
57DEFINE_TIMER(fcoe_timer, NULL, 0, 0); 57DEFINE_TIMER(fcoe_timer, NULL, 0, 0);
58DEFINE_PER_CPU(struct fcoe_percpu_s, fcoe_percpu); 58DEFINE_PER_CPU(struct fcoe_percpu_s, fcoe_percpu);
59 59
60/* Function Prototyes */ 60/* Function Prototypes */
61static int fcoe_reset(struct Scsi_Host *shost); 61static int fcoe_reset(struct Scsi_Host *shost);
62static int fcoe_xmit(struct fc_lport *, struct fc_frame *); 62static int fcoe_xmit(struct fc_lport *, struct fc_frame *);
63static int fcoe_rcv(struct sk_buff *, struct net_device *, 63static int fcoe_rcv(struct sk_buff *, struct net_device *,
@@ -138,7 +138,6 @@ static struct scsi_host_template fcoe_shost_template = {
138/** 138/**
139 * fcoe_lport_config() - sets up the fc_lport 139 * fcoe_lport_config() - sets up the fc_lport
140 * @lp: ptr to the fc_lport 140 * @lp: ptr to the fc_lport
141 * @shost: ptr to the parent scsi host
142 * 141 *
143 * Returns: 0 for success 142 * Returns: 0 for success
144 */ 143 */
@@ -256,6 +255,7 @@ static int fcoe_netdev_config(struct fc_lport *lp, struct net_device *netdev)
256 rtnl_lock(); 255 rtnl_lock();
257 memcpy(flogi_maddr, (u8[6]) FC_FCOE_FLOGI_MAC, ETH_ALEN); 256 memcpy(flogi_maddr, (u8[6]) FC_FCOE_FLOGI_MAC, ETH_ALEN);
258 dev_unicast_add(fc->real_dev, flogi_maddr, ETH_ALEN); 257 dev_unicast_add(fc->real_dev, flogi_maddr, ETH_ALEN);
258 dev_mc_add(fc->real_dev, FIP_ALL_ENODE_MACS, ETH_ALEN, 0);
259 rtnl_unlock(); 259 rtnl_unlock();
260 260
261 /* 261 /*
@@ -380,7 +380,7 @@ static int fcoe_if_destroy(struct net_device *netdev)
380 dev_mc_delete(fc->real_dev, FIP_ALL_ENODE_MACS, ETH_ALEN, 0); 380 dev_mc_delete(fc->real_dev, FIP_ALL_ENODE_MACS, ETH_ALEN, 0);
381 rtnl_unlock(); 381 rtnl_unlock();
382 382
383 /* Free the per-CPU revieve threads */ 383 /* Free the per-CPU receive threads */
384 fcoe_percpu_clean(lp); 384 fcoe_percpu_clean(lp);
385 385
386 /* Free existing skbs */ 386 /* Free existing skbs */
@@ -720,7 +720,7 @@ static void fcoe_percpu_thread_destroy(unsigned int cpu)
720 } 720 }
721#else 721#else
722 /* 722 /*
723 * This a non-SMP scenario where the singluar Rx thread is 723 * This a non-SMP scenario where the singular Rx thread is
724 * being removed. Free all skbs and stop the thread. 724 * being removed. Free all skbs and stop the thread.
725 */ 725 */
726 spin_lock_bh(&p->fcoe_rx_list.lock); 726 spin_lock_bh(&p->fcoe_rx_list.lock);
@@ -777,7 +777,7 @@ static struct notifier_block fcoe_cpu_notifier = {
777 * @skb: the receive skb 777 * @skb: the receive skb
778 * @dev: associated net device 778 * @dev: associated net device
779 * @ptype: context 779 * @ptype: context
780 * @odldev: last device 780 * @olddev: last device
781 * 781 *
782 * this function will receive the packet and build fc frame and pass it up 782 * this function will receive the packet and build fc frame and pass it up
783 * 783 *
@@ -884,7 +884,6 @@ err2:
884 kfree_skb(skb); 884 kfree_skb(skb);
885 return -1; 885 return -1;
886} 886}
887EXPORT_SYMBOL_GPL(fcoe_rcv);
888 887
889/** 888/**
890 * fcoe_start_io() - pass to netdev to start xmit for fcoe 889 * fcoe_start_io() - pass to netdev to start xmit for fcoe
@@ -905,7 +904,7 @@ static inline int fcoe_start_io(struct sk_buff *skb)
905} 904}
906 905
907/** 906/**
908 * fcoe_get_paged_crc_eof() - in case we need alloc a page for crc_eof 907 * fcoe_get_paged_crc_eof() - in case we need to alloc a page for crc_eof
909 * @skb: the skb to be xmitted 908 * @skb: the skb to be xmitted
910 * @tlen: total len 909 * @tlen: total len
911 * 910 *
@@ -947,7 +946,7 @@ static int fcoe_get_paged_crc_eof(struct sk_buff *skb, int tlen)
947 946
948/** 947/**
949 * fcoe_fc_crc() - calculates FC CRC in this fcoe skb 948 * fcoe_fc_crc() - calculates FC CRC in this fcoe skb
950 * @fp: the fc_frame containg data to be checksummed 949 * @fp: the fc_frame containing data to be checksummed
951 * 950 *
952 * This uses crc32() to calculate the crc for fc frame 951 * This uses crc32() to calculate the crc for fc frame
953 * Return : 32 bit crc 952 * Return : 32 bit crc
@@ -1011,7 +1010,7 @@ int fcoe_xmit(struct fc_lport *lp, struct fc_frame *fp)
1011 wlen = skb->len / FCOE_WORD_TO_BYTE; 1010 wlen = skb->len / FCOE_WORD_TO_BYTE;
1012 1011
1013 if (!lp->link_up) { 1012 if (!lp->link_up) {
1014 kfree(skb); 1013 kfree_skb(skb);
1015 return 0; 1014 return 0;
1016 } 1015 }
1017 1016
@@ -1062,7 +1061,7 @@ int fcoe_xmit(struct fc_lport *lp, struct fc_frame *fp)
1062 cp = NULL; 1061 cp = NULL;
1063 } 1062 }
1064 1063
1065 /* adjust skb netowrk/transport offsets to match mac/fcoe/fc */ 1064 /* adjust skb network/transport offsets to match mac/fcoe/fc */
1066 skb_push(skb, elen + hlen); 1065 skb_push(skb, elen + hlen);
1067 skb_reset_mac_header(skb); 1066 skb_reset_mac_header(skb);
1068 skb_reset_network_header(skb); 1067 skb_reset_network_header(skb);
@@ -1123,7 +1122,6 @@ int fcoe_xmit(struct fc_lport *lp, struct fc_frame *fp)
1123 1122
1124 return 0; 1123 return 0;
1125} 1124}
1126EXPORT_SYMBOL_GPL(fcoe_xmit);
1127 1125
1128/** 1126/**
1129 * fcoe_percpu_receive_thread() - recv thread per cpu 1127 * fcoe_percpu_receive_thread() - recv thread per cpu
@@ -1296,17 +1294,16 @@ void fcoe_watchdog(ulong vp)
1296 1294
1297 1295
1298/** 1296/**
1299 * fcoe_check_wait_queue() - put the skb into fcoe pending xmit queue 1297 * fcoe_check_wait_queue() - attempt to clear the transmit backlog
1300 * @lp: the fc_port for this skb 1298 * @lp: the fc_lport
1301 * @skb: the associated skb to be xmitted
1302 * 1299 *
1303 * This empties the wait_queue, dequeue the head of the wait_queue queue 1300 * This empties the wait_queue, dequeue the head of the wait_queue queue
1304 * and calls fcoe_start_io() for each packet, if all skb have been 1301 * and calls fcoe_start_io() for each packet, if all skb have been
1305 * transmitted, return qlen or -1 if a error occurs, then restore 1302 * transmitted, return qlen or -1 if a error occurs, then restore
1306 * wait_queue and try again later. 1303 * wait_queue and try again later.
1307 * 1304 *
1308 * The wait_queue is used when the skb transmit fails. skb will go 1305 * The wait_queue is used when the skb transmit fails. skb will go
1309 * in the wait_queue which will be emptied by the time function OR 1306 * in the wait_queue which will be emptied by the timer function or
1310 * by the next skb transmit. 1307 * by the next skb transmit.
1311 * 1308 *
1312 * Returns: 0 for success 1309 * Returns: 0 for success
@@ -1355,10 +1352,6 @@ out:
1355 */ 1352 */
1356static void fcoe_dev_setup() 1353static void fcoe_dev_setup()
1357{ 1354{
1358 /*
1359 * here setup a interface specific wd time to
1360 * monitor the link state
1361 */
1362 register_netdevice_notifier(&fcoe_notifier); 1355 register_netdevice_notifier(&fcoe_notifier);
1363} 1356}
1364 1357
@@ -1437,10 +1430,9 @@ out:
1437 1430
1438/** 1431/**
1439 * fcoe_if_to_netdev() - parse a name buffer to get netdev 1432 * fcoe_if_to_netdev() - parse a name buffer to get netdev
1440 * @ifname: fixed array for output parsed ifname
1441 * @buffer: incoming buffer to be copied 1433 * @buffer: incoming buffer to be copied
1442 * 1434 *
1443 * Returns: NULL or ptr to netdeive 1435 * Returns: NULL or ptr to net_device
1444 */ 1436 */
1445static struct net_device *fcoe_if_to_netdev(const char *buffer) 1437static struct net_device *fcoe_if_to_netdev(const char *buffer)
1446{ 1438{
@@ -1458,7 +1450,7 @@ static struct net_device *fcoe_if_to_netdev(const char *buffer)
1458} 1450}
1459 1451
1460/** 1452/**
1461 * fcoe_netdev_to_module_owner() - finds out the nic drive moddule of the netdev 1453 * fcoe_netdev_to_module_owner() - finds out the driver module of the netdev
1462 * @netdev: the target netdev 1454 * @netdev: the target netdev
1463 * 1455 *
1464 * Returns: ptr to the struct module, NULL for failure 1456 * Returns: ptr to the struct module, NULL for failure
@@ -1488,7 +1480,7 @@ fcoe_netdev_to_module_owner(const struct net_device *netdev)
1488 * Holds the Ethernet driver module by try_module_get() for 1480 * Holds the Ethernet driver module by try_module_get() for
1489 * the corresponding netdev. 1481 * the corresponding netdev.
1490 * 1482 *
1491 * Returns: 0 for succsss 1483 * Returns: 0 for success
1492 */ 1484 */
1493static int fcoe_ethdrv_get(const struct net_device *netdev) 1485static int fcoe_ethdrv_get(const struct net_device *netdev)
1494{ 1486{
@@ -1510,7 +1502,7 @@ static int fcoe_ethdrv_get(const struct net_device *netdev)
1510 * Releases the Ethernet driver module by module_put for 1502 * Releases the Ethernet driver module by module_put for
1511 * the corresponding netdev. 1503 * the corresponding netdev.
1512 * 1504 *
1513 * Returns: 0 for succsss 1505 * Returns: 0 for success
1514 */ 1506 */
1515static int fcoe_ethdrv_put(const struct net_device *netdev) 1507static int fcoe_ethdrv_put(const struct net_device *netdev)
1516{ 1508{
@@ -1528,7 +1520,7 @@ static int fcoe_ethdrv_put(const struct net_device *netdev)
1528 1520
1529/** 1521/**
1530 * fcoe_destroy() - handles the destroy from sysfs 1522 * fcoe_destroy() - handles the destroy from sysfs
1531 * @buffer: expcted to be a eth if name 1523 * @buffer: expected to be an eth if name
1532 * @kp: associated kernel param 1524 * @kp: associated kernel param
1533 * 1525 *
1534 * Returns: 0 for success 1526 * Returns: 0 for success
@@ -1565,7 +1557,7 @@ out_nodev:
1565 1557
1566/** 1558/**
1567 * fcoe_create() - Handles the create call from sysfs 1559 * fcoe_create() - Handles the create call from sysfs
1568 * @buffer: expcted to be a eth if name 1560 * @buffer: expected to be an eth if name
1569 * @kp: associated kernel param 1561 * @kp: associated kernel param
1570 * 1562 *
1571 * Returns: 0 for success 1563 * Returns: 0 for success
@@ -1652,7 +1644,6 @@ int fcoe_link_ok(struct fc_lport *lp)
1652 1644
1653 return rc; 1645 return rc;
1654} 1646}
1655EXPORT_SYMBOL_GPL(fcoe_link_ok);
1656 1647
1657/** 1648/**
1658 * fcoe_percpu_clean() - Clear the pending skbs for an lport 1649 * fcoe_percpu_clean() - Clear the pending skbs for an lport
@@ -1684,7 +1675,6 @@ void fcoe_percpu_clean(struct fc_lport *lp)
1684 spin_unlock_bh(&pp->fcoe_rx_list.lock); 1675 spin_unlock_bh(&pp->fcoe_rx_list.lock);
1685 } 1676 }
1686} 1677}
1687EXPORT_SYMBOL_GPL(fcoe_percpu_clean);
1688 1678
1689/** 1679/**
1690 * fcoe_clean_pending_queue() - Dequeue a skb and free it 1680 * fcoe_clean_pending_queue() - Dequeue a skb and free it
@@ -1705,7 +1695,6 @@ void fcoe_clean_pending_queue(struct fc_lport *lp)
1705 } 1695 }
1706 spin_unlock_bh(&fc->fcoe_pending_queue.lock); 1696 spin_unlock_bh(&fc->fcoe_pending_queue.lock);
1707} 1697}
1708EXPORT_SYMBOL_GPL(fcoe_clean_pending_queue);
1709 1698
1710/** 1699/**
1711 * fcoe_reset() - Resets the fcoe 1700 * fcoe_reset() - Resets the fcoe
@@ -1719,11 +1708,10 @@ int fcoe_reset(struct Scsi_Host *shost)
1719 fc_lport_reset(lport); 1708 fc_lport_reset(lport);
1720 return 0; 1709 return 0;
1721} 1710}
1722EXPORT_SYMBOL_GPL(fcoe_reset);
1723 1711
1724/** 1712/**
1725 * fcoe_hostlist_lookup_softc() - find the corresponding lport by a given device 1713 * fcoe_hostlist_lookup_softc() - find the corresponding lport by a given device
1726 * @device: this is currently ptr to net_device 1714 * @dev: this is currently ptr to net_device
1727 * 1715 *
1728 * Returns: NULL or the located fcoe_softc 1716 * Returns: NULL or the located fcoe_softc
1729 */ 1717 */
@@ -1757,11 +1745,10 @@ struct fc_lport *fcoe_hostlist_lookup(const struct net_device *netdev)
1757 1745
1758 return (fc) ? fc->ctlr.lp : NULL; 1746 return (fc) ? fc->ctlr.lp : NULL;
1759} 1747}
1760EXPORT_SYMBOL_GPL(fcoe_hostlist_lookup);
1761 1748
1762/** 1749/**
1763 * fcoe_hostlist_add() - Add a lport to lports list 1750 * fcoe_hostlist_add() - Add a lport to lports list
1764 * @lp: ptr to the fc_lport to badded 1751 * @lp: ptr to the fc_lport to be added
1765 * 1752 *
1766 * Returns: 0 for success 1753 * Returns: 0 for success
1767 */ 1754 */
@@ -1778,11 +1765,10 @@ int fcoe_hostlist_add(const struct fc_lport *lp)
1778 } 1765 }
1779 return 0; 1766 return 0;
1780} 1767}
1781EXPORT_SYMBOL_GPL(fcoe_hostlist_add);
1782 1768
1783/** 1769/**
1784 * fcoe_hostlist_remove() - remove a lport from lports list 1770 * fcoe_hostlist_remove() - remove a lport from lports list
1785 * @lp: ptr to the fc_lport to badded 1771 * @lp: ptr to the fc_lport to be removed
1786 * 1772 *
1787 * Returns: 0 for success 1773 * Returns: 0 for success
1788 */ 1774 */
@@ -1798,7 +1784,6 @@ int fcoe_hostlist_remove(const struct fc_lport *lp)
1798 1784
1799 return 0; 1785 return 0;
1800} 1786}
1801EXPORT_SYMBOL_GPL(fcoe_hostlist_remove);
1802 1787
1803/** 1788/**
1804 * fcoe_init() - fcoe module loading initialization 1789 * fcoe_init() - fcoe module loading initialization
diff --git a/drivers/scsi/fcoe/libfcoe.c b/drivers/scsi/fcoe/libfcoe.c
index f410f4abb54..62ba0f39c6b 100644
--- a/drivers/scsi/fcoe/libfcoe.c
+++ b/drivers/scsi/fcoe/libfcoe.c
@@ -122,7 +122,7 @@ static void fcoe_ctlr_reset_fcfs(struct fcoe_ctlr *fip)
122} 122}
123 123
124/** 124/**
125 * fcoe_ctrl_destroy() - Disable and tear-down the FCoE controller. 125 * fcoe_ctlr_destroy() - Disable and tear-down the FCoE controller.
126 * @fip: FCoE controller. 126 * @fip: FCoE controller.
127 * 127 *
128 * This is called by FCoE drivers before freeing the &fcoe_ctlr. 128 * This is called by FCoE drivers before freeing the &fcoe_ctlr.
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index c09d77591f9..dd689ded860 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -3654,6 +3654,7 @@ static int ipr_slave_configure(struct scsi_device *sdev)
3654{ 3654{
3655 struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *) sdev->host->hostdata; 3655 struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *) sdev->host->hostdata;
3656 struct ipr_resource_entry *res; 3656 struct ipr_resource_entry *res;
3657 struct ata_port *ap = NULL;
3657 unsigned long lock_flags = 0; 3658 unsigned long lock_flags = 0;
3658 3659
3659 spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); 3660 spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
@@ -3672,12 +3673,16 @@ static int ipr_slave_configure(struct scsi_device *sdev)
3672 } 3673 }
3673 if (ipr_is_vset_device(res) || ipr_is_scsi_disk(res)) 3674 if (ipr_is_vset_device(res) || ipr_is_scsi_disk(res))
3674 sdev->allow_restart = 1; 3675 sdev->allow_restart = 1;
3675 if (ipr_is_gata(res) && res->sata_port) { 3676 if (ipr_is_gata(res) && res->sata_port)
3677 ap = res->sata_port->ap;
3678 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
3679
3680 if (ap) {
3676 scsi_adjust_queue_depth(sdev, 0, IPR_MAX_CMD_PER_ATA_LUN); 3681 scsi_adjust_queue_depth(sdev, 0, IPR_MAX_CMD_PER_ATA_LUN);
3677 ata_sas_slave_configure(sdev, res->sata_port->ap); 3682 ata_sas_slave_configure(sdev, ap);
3678 } else { 3683 } else
3679 scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun); 3684 scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun);
3680 } 3685 return 0;
3681 } 3686 }
3682 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); 3687 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
3683 return 0; 3688 return 0;
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index b3e5e08e44a..b7c092d63bb 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -463,7 +463,7 @@ static int iscsi_sw_tcp_pdu_init(struct iscsi_task *task,
463 } 463 }
464 464
465 if (err) { 465 if (err) {
466 iscsi_conn_failure(conn, err); 466 /* got invalid offset/len */
467 return -EIO; 467 return -EIO;
468 } 468 }
469 return 0; 469 return 0;
@@ -851,6 +851,7 @@ static struct scsi_host_template iscsi_sw_tcp_sht = {
851 .use_clustering = DISABLE_CLUSTERING, 851 .use_clustering = DISABLE_CLUSTERING,
852 .slave_alloc = iscsi_sw_tcp_slave_alloc, 852 .slave_alloc = iscsi_sw_tcp_slave_alloc,
853 .slave_configure = iscsi_sw_tcp_slave_configure, 853 .slave_configure = iscsi_sw_tcp_slave_configure,
854 .target_alloc = iscsi_target_alloc,
854 .proc_name = "iscsi_tcp", 855 .proc_name = "iscsi_tcp",
855 .this_id = -1, 856 .this_id = -1,
856}; 857};
diff --git a/drivers/scsi/libfc/fc_disc.c b/drivers/scsi/libfc/fc_disc.c
index e57556ea5b4..4c880656990 100644
--- a/drivers/scsi/libfc/fc_disc.c
+++ b/drivers/scsi/libfc/fc_disc.c
@@ -113,6 +113,11 @@ void fc_disc_stop_rports(struct fc_disc *disc)
113 lport->tt.rport_logoff(rport); 113 lport->tt.rport_logoff(rport);
114 } 114 }
115 115
116 list_for_each_entry_safe(rdata, next, &disc->rogue_rports, peers) {
117 rport = PRIV_TO_RPORT(rdata);
118 lport->tt.rport_logoff(rport);
119 }
120
116 mutex_unlock(&disc->disc_mutex); 121 mutex_unlock(&disc->disc_mutex);
117} 122}
118 123
@@ -131,23 +136,32 @@ static void fc_disc_rport_callback(struct fc_lport *lport,
131{ 136{
132 struct fc_rport_libfc_priv *rdata = rport->dd_data; 137 struct fc_rport_libfc_priv *rdata = rport->dd_data;
133 struct fc_disc *disc = &lport->disc; 138 struct fc_disc *disc = &lport->disc;
134 int found = 0;
135 139
136 FC_DEBUG_DISC("Received a %d event for port (%6x)\n", event, 140 FC_DEBUG_DISC("Received a %d event for port (%6x)\n", event,
137 rport->port_id); 141 rport->port_id);
138 142
139 if (event == RPORT_EV_CREATED) { 143 switch (event) {
144 case RPORT_EV_CREATED:
140 if (disc) { 145 if (disc) {
141 found = 1;
142 mutex_lock(&disc->disc_mutex); 146 mutex_lock(&disc->disc_mutex);
143 list_add_tail(&rdata->peers, &disc->rports); 147 list_add_tail(&rdata->peers, &disc->rports);
144 mutex_unlock(&disc->disc_mutex); 148 mutex_unlock(&disc->disc_mutex);
145 } 149 }
150 break;
151 case RPORT_EV_LOGO:
152 case RPORT_EV_FAILED:
153 case RPORT_EV_STOP:
154 mutex_lock(&disc->disc_mutex);
155 mutex_lock(&rdata->rp_mutex);
156 if (rdata->trans_state == FC_PORTSTATE_ROGUE)
157 list_del(&rdata->peers);
158 mutex_unlock(&rdata->rp_mutex);
159 mutex_unlock(&disc->disc_mutex);
160 break;
161 default:
162 break;
146 } 163 }
147 164
148 if (!found)
149 FC_DEBUG_DISC("The rport (%6x) is not maintained "
150 "by the discovery layer\n", rport->port_id);
151} 165}
152 166
153/** 167/**
@@ -439,6 +453,7 @@ static int fc_disc_new_target(struct fc_disc *disc,
439 rdata = rport->dd_data; 453 rdata = rport->dd_data;
440 rdata->ops = &fc_disc_rport_ops; 454 rdata->ops = &fc_disc_rport_ops;
441 rdata->rp_state = RPORT_ST_INIT; 455 rdata->rp_state = RPORT_ST_INIT;
456 list_add_tail(&rdata->peers, &disc->rogue_rports);
442 lport->tt.rport_login(rport); 457 lport->tt.rport_login(rport);
443 } 458 }
444 } 459 }
@@ -461,21 +476,29 @@ static void fc_disc_del_target(struct fc_disc *disc, struct fc_rport *rport)
461/** 476/**
462 * fc_disc_done() - Discovery has been completed 477 * fc_disc_done() - Discovery has been completed
463 * @disc: FC discovery context 478 * @disc: FC discovery context
479 * Locking Note: This function expects that the disc mutex is locked before
480 * it is called. The discovery callback is then made with the lock released,
481 * and the lock is re-taken before returning from this function
464 */ 482 */
465static void fc_disc_done(struct fc_disc *disc) 483static void fc_disc_done(struct fc_disc *disc)
466{ 484{
467 struct fc_lport *lport = disc->lport; 485 struct fc_lport *lport = disc->lport;
486 enum fc_disc_event event;
468 487
469 FC_DEBUG_DISC("Discovery complete for port (%6x)\n", 488 FC_DEBUG_DISC("Discovery complete for port (%6x)\n",
470 fc_host_port_id(lport->host)); 489 fc_host_port_id(lport->host));
471 490
472 disc->disc_callback(lport, disc->event); 491 event = disc->event;
473 disc->event = DISC_EV_NONE; 492 disc->event = DISC_EV_NONE;
474 493
475 if (disc->requested) 494 if (disc->requested)
476 fc_disc_gpn_ft_req(disc); 495 fc_disc_gpn_ft_req(disc);
477 else 496 else
478 disc->pending = 0; 497 disc->pending = 0;
498
499 mutex_unlock(&disc->disc_mutex);
500 disc->disc_callback(lport, event);
501 mutex_lock(&disc->disc_mutex);
479} 502}
480 503
481/** 504/**
@@ -622,6 +645,8 @@ static int fc_disc_gpn_ft_parse(struct fc_disc *disc, void *buf, size_t len)
622 rdata = rport->dd_data; 645 rdata = rport->dd_data;
623 rdata->ops = &fc_disc_rport_ops; 646 rdata->ops = &fc_disc_rport_ops;
624 rdata->local_port = lport; 647 rdata->local_port = lport;
648 list_add_tail(&rdata->peers,
649 &disc->rogue_rports);
625 lport->tt.rport_login(rport); 650 lport->tt.rport_login(rport);
626 } else 651 } else
627 FC_DBG("Failed to allocate memory for " 652 FC_DBG("Failed to allocate memory for "
@@ -681,8 +706,8 @@ static void fc_disc_timeout(struct work_struct *work)
681 * @fp: response frame 706 * @fp: response frame
682 * @lp_arg: Fibre Channel host port instance 707 * @lp_arg: Fibre Channel host port instance
683 * 708 *
684 * Locking Note: This function expects that the disc_mutex is locked 709 * Locking Note: This function is called without disc mutex held, and
685 * before it is called. 710 * should do all its processing with the mutex held
686 */ 711 */
687static void fc_disc_gpn_ft_resp(struct fc_seq *sp, struct fc_frame *fp, 712static void fc_disc_gpn_ft_resp(struct fc_seq *sp, struct fc_frame *fp,
688 void *disc_arg) 713 void *disc_arg)
@@ -695,11 +720,13 @@ static void fc_disc_gpn_ft_resp(struct fc_seq *sp, struct fc_frame *fp,
695 unsigned int len; 720 unsigned int len;
696 int error; 721 int error;
697 722
723 mutex_lock(&disc->disc_mutex);
698 FC_DEBUG_DISC("Received a GPN_FT response on port (%6x)\n", 724 FC_DEBUG_DISC("Received a GPN_FT response on port (%6x)\n",
699 fc_host_port_id(disc->lport->host)); 725 fc_host_port_id(disc->lport->host));
700 726
701 if (IS_ERR(fp)) { 727 if (IS_ERR(fp)) {
702 fc_disc_error(disc, fp); 728 fc_disc_error(disc, fp);
729 mutex_unlock(&disc->disc_mutex);
703 return; 730 return;
704 } 731 }
705 732
@@ -744,6 +771,8 @@ static void fc_disc_gpn_ft_resp(struct fc_seq *sp, struct fc_frame *fp,
744 disc->seq_count++; 771 disc->seq_count++;
745 } 772 }
746 fc_frame_free(fp); 773 fc_frame_free(fp);
774
775 mutex_unlock(&disc->disc_mutex);
747} 776}
748 777
749/** 778/**
@@ -757,7 +786,6 @@ static void fc_disc_gpn_ft_resp(struct fc_seq *sp, struct fc_frame *fp,
757static void fc_disc_single(struct fc_disc *disc, struct fc_disc_port *dp) 786static void fc_disc_single(struct fc_disc *disc, struct fc_disc_port *dp)
758{ 787{
759 struct fc_lport *lport; 788 struct fc_lport *lport;
760 struct fc_rport *rport;
761 struct fc_rport *new_rport; 789 struct fc_rport *new_rport;
762 struct fc_rport_libfc_priv *rdata; 790 struct fc_rport_libfc_priv *rdata;
763 791
@@ -766,15 +794,12 @@ static void fc_disc_single(struct fc_disc *disc, struct fc_disc_port *dp)
766 if (dp->ids.port_id == fc_host_port_id(lport->host)) 794 if (dp->ids.port_id == fc_host_port_id(lport->host))
767 goto out; 795 goto out;
768 796
769 rport = lport->tt.rport_lookup(lport, dp->ids.port_id);
770 if (rport)
771 fc_disc_del_target(disc, rport);
772
773 new_rport = lport->tt.rport_create(dp); 797 new_rport = lport->tt.rport_create(dp);
774 if (new_rport) { 798 if (new_rport) {
775 rdata = new_rport->dd_data; 799 rdata = new_rport->dd_data;
776 rdata->ops = &fc_disc_rport_ops; 800 rdata->ops = &fc_disc_rport_ops;
777 kfree(dp); 801 kfree(dp);
802 list_add_tail(&rdata->peers, &disc->rogue_rports);
778 lport->tt.rport_login(new_rport); 803 lport->tt.rport_login(new_rport);
779 } 804 }
780 return; 805 return;
@@ -836,6 +861,7 @@ int fc_disc_init(struct fc_lport *lport)
836 INIT_DELAYED_WORK(&disc->disc_work, fc_disc_timeout); 861 INIT_DELAYED_WORK(&disc->disc_work, fc_disc_timeout);
837 mutex_init(&disc->disc_mutex); 862 mutex_init(&disc->disc_mutex);
838 INIT_LIST_HEAD(&disc->rports); 863 INIT_LIST_HEAD(&disc->rports);
864 INIT_LIST_HEAD(&disc->rogue_rports);
839 865
840 disc->lport = lport; 866 disc->lport = lport;
841 disc->delay = FC_DISC_DELAY; 867 disc->delay = FC_DISC_DELAY;
diff --git a/drivers/scsi/libfc/fc_elsct.c b/drivers/scsi/libfc/fc_elsct.c
index dd47fe619d1..5878b34bff1 100644
--- a/drivers/scsi/libfc/fc_elsct.c
+++ b/drivers/scsi/libfc/fc_elsct.c
@@ -41,7 +41,7 @@ static struct fc_seq *fc_elsct_send(struct fc_lport *lport,
41 void *arg, u32 timer_msec) 41 void *arg, u32 timer_msec)
42{ 42{
43 enum fc_rctl r_ctl; 43 enum fc_rctl r_ctl;
44 u32 did; 44 u32 did = FC_FID_NONE;
45 enum fc_fh_type fh_type; 45 enum fc_fh_type fh_type;
46 int rc; 46 int rc;
47 47
diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
index f555ae99ad4..521f996f9b1 100644
--- a/drivers/scsi/libfc/fc_fcp.c
+++ b/drivers/scsi/libfc/fc_fcp.c
@@ -713,7 +713,7 @@ done:
713static void fc_fcp_recv(struct fc_seq *seq, struct fc_frame *fp, void *arg) 713static void fc_fcp_recv(struct fc_seq *seq, struct fc_frame *fp, void *arg)
714{ 714{
715 struct fc_fcp_pkt *fsp = (struct fc_fcp_pkt *)arg; 715 struct fc_fcp_pkt *fsp = (struct fc_fcp_pkt *)arg;
716 struct fc_lport *lp; 716 struct fc_lport *lport = fsp->lp;
717 struct fc_frame_header *fh; 717 struct fc_frame_header *fh;
718 struct fcp_txrdy *dd; 718 struct fcp_txrdy *dd;
719 u8 r_ctl; 719 u8 r_ctl;
@@ -724,9 +724,8 @@ static void fc_fcp_recv(struct fc_seq *seq, struct fc_frame *fp, void *arg)
724 724
725 fh = fc_frame_header_get(fp); 725 fh = fc_frame_header_get(fp);
726 r_ctl = fh->fh_r_ctl; 726 r_ctl = fh->fh_r_ctl;
727 lp = fsp->lp;
728 727
729 if (!(lp->state & LPORT_ST_READY)) 728 if (!(lport->state & LPORT_ST_READY))
730 goto out; 729 goto out;
731 if (fc_fcp_lock_pkt(fsp)) 730 if (fc_fcp_lock_pkt(fsp))
732 goto out; 731 goto out;
@@ -779,7 +778,7 @@ errout:
779 if (IS_ERR(fp)) 778 if (IS_ERR(fp))
780 fc_fcp_error(fsp, fp); 779 fc_fcp_error(fsp, fp);
781 else if (rc == -ENOMEM) 780 else if (rc == -ENOMEM)
782 fc_fcp_reduce_can_queue(lp); 781 fc_fcp_reduce_can_queue(lport);
783} 782}
784 783
785static void fc_fcp_resp(struct fc_fcp_pkt *fsp, struct fc_frame *fp) 784static void fc_fcp_resp(struct fc_fcp_pkt *fsp, struct fc_frame *fp)
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index b8178ef398d..e0c247724d2 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -618,6 +618,11 @@ int fc_fabric_logoff(struct fc_lport *lport)
618{ 618{
619 lport->tt.disc_stop_final(lport); 619 lport->tt.disc_stop_final(lport);
620 mutex_lock(&lport->lp_mutex); 620 mutex_lock(&lport->lp_mutex);
621 if (lport->dns_rp)
622 lport->tt.rport_logoff(lport->dns_rp);
623 mutex_unlock(&lport->lp_mutex);
624 lport->tt.rport_flush_queue();
625 mutex_lock(&lport->lp_mutex);
621 fc_lport_enter_logo(lport); 626 fc_lport_enter_logo(lport);
622 mutex_unlock(&lport->lp_mutex); 627 mutex_unlock(&lport->lp_mutex);
623 cancel_delayed_work_sync(&lport->retry_work); 628 cancel_delayed_work_sync(&lport->retry_work);
@@ -639,7 +644,12 @@ EXPORT_SYMBOL(fc_fabric_logoff);
639 */ 644 */
640int fc_lport_destroy(struct fc_lport *lport) 645int fc_lport_destroy(struct fc_lport *lport)
641{ 646{
647 mutex_lock(&lport->lp_mutex);
648 lport->state = LPORT_ST_NONE;
649 lport->link_up = 0;
642 lport->tt.frame_send = fc_frame_drop; 650 lport->tt.frame_send = fc_frame_drop;
651 mutex_unlock(&lport->lp_mutex);
652
643 lport->tt.fcp_abort_io(lport); 653 lport->tt.fcp_abort_io(lport);
644 lport->tt.exch_mgr_reset(lport, 0, 0); 654 lport->tt.exch_mgr_reset(lport, 0, 0);
645 return 0; 655 return 0;
@@ -1032,17 +1042,19 @@ static void fc_lport_rft_id_resp(struct fc_seq *sp, struct fc_frame *fp,
1032 1042
1033 FC_DEBUG_LPORT("Received a RFT_ID response\n"); 1043 FC_DEBUG_LPORT("Received a RFT_ID response\n");
1034 1044
1035 if (IS_ERR(fp)) {
1036 fc_lport_error(lport, fp);
1037 goto err;
1038 }
1039
1040 if (lport->state != LPORT_ST_RFT_ID) { 1045 if (lport->state != LPORT_ST_RFT_ID) {
1041 FC_DBG("Received a RFT_ID response, but in state %s\n", 1046 FC_DBG("Received a RFT_ID response, but in state %s\n",
1042 fc_lport_state(lport)); 1047 fc_lport_state(lport));
1048 if (IS_ERR(fp))
1049 goto err;
1043 goto out; 1050 goto out;
1044 } 1051 }
1045 1052
1053 if (IS_ERR(fp)) {
1054 fc_lport_error(lport, fp);
1055 goto err;
1056 }
1057
1046 fh = fc_frame_header_get(fp); 1058 fh = fc_frame_header_get(fp);
1047 ct = fc_frame_payload_get(fp, sizeof(*ct)); 1059 ct = fc_frame_payload_get(fp, sizeof(*ct));
1048 1060
@@ -1084,17 +1096,19 @@ static void fc_lport_rpn_id_resp(struct fc_seq *sp, struct fc_frame *fp,
1084 1096
1085 FC_DEBUG_LPORT("Received a RPN_ID response\n"); 1097 FC_DEBUG_LPORT("Received a RPN_ID response\n");
1086 1098
1087 if (IS_ERR(fp)) {
1088 fc_lport_error(lport, fp);
1089 goto err;
1090 }
1091
1092 if (lport->state != LPORT_ST_RPN_ID) { 1099 if (lport->state != LPORT_ST_RPN_ID) {
1093 FC_DBG("Received a RPN_ID response, but in state %s\n", 1100 FC_DBG("Received a RPN_ID response, but in state %s\n",
1094 fc_lport_state(lport)); 1101 fc_lport_state(lport));
1102 if (IS_ERR(fp))
1103 goto err;
1095 goto out; 1104 goto out;
1096 } 1105 }
1097 1106
1107 if (IS_ERR(fp)) {
1108 fc_lport_error(lport, fp);
1109 goto err;
1110 }
1111
1098 fh = fc_frame_header_get(fp); 1112 fh = fc_frame_header_get(fp);
1099 ct = fc_frame_payload_get(fp, sizeof(*ct)); 1113 ct = fc_frame_payload_get(fp, sizeof(*ct));
1100 if (fh && ct && fh->fh_type == FC_TYPE_CT && 1114 if (fh && ct && fh->fh_type == FC_TYPE_CT &&
@@ -1134,17 +1148,19 @@ static void fc_lport_scr_resp(struct fc_seq *sp, struct fc_frame *fp,
1134 1148
1135 FC_DEBUG_LPORT("Received a SCR response\n"); 1149 FC_DEBUG_LPORT("Received a SCR response\n");
1136 1150
1137 if (IS_ERR(fp)) {
1138 fc_lport_error(lport, fp);
1139 goto err;
1140 }
1141
1142 if (lport->state != LPORT_ST_SCR) { 1151 if (lport->state != LPORT_ST_SCR) {
1143 FC_DBG("Received a SCR response, but in state %s\n", 1152 FC_DBG("Received a SCR response, but in state %s\n",
1144 fc_lport_state(lport)); 1153 fc_lport_state(lport));
1154 if (IS_ERR(fp))
1155 goto err;
1145 goto out; 1156 goto out;
1146 } 1157 }
1147 1158
1159 if (IS_ERR(fp)) {
1160 fc_lport_error(lport, fp);
1161 goto err;
1162 }
1163
1148 op = fc_frame_payload_op(fp); 1164 op = fc_frame_payload_op(fp);
1149 if (op == ELS_LS_ACC) 1165 if (op == ELS_LS_ACC)
1150 fc_lport_enter_ready(lport); 1166 fc_lport_enter_ready(lport);
@@ -1360,17 +1376,19 @@ static void fc_lport_logo_resp(struct fc_seq *sp, struct fc_frame *fp,
1360 1376
1361 FC_DEBUG_LPORT("Received a LOGO response\n"); 1377 FC_DEBUG_LPORT("Received a LOGO response\n");
1362 1378
1363 if (IS_ERR(fp)) {
1364 fc_lport_error(lport, fp);
1365 goto err;
1366 }
1367
1368 if (lport->state != LPORT_ST_LOGO) { 1379 if (lport->state != LPORT_ST_LOGO) {
1369 FC_DBG("Received a LOGO response, but in state %s\n", 1380 FC_DBG("Received a LOGO response, but in state %s\n",
1370 fc_lport_state(lport)); 1381 fc_lport_state(lport));
1382 if (IS_ERR(fp))
1383 goto err;
1371 goto out; 1384 goto out;
1372 } 1385 }
1373 1386
1387 if (IS_ERR(fp)) {
1388 fc_lport_error(lport, fp);
1389 goto err;
1390 }
1391
1374 op = fc_frame_payload_op(fp); 1392 op = fc_frame_payload_op(fp);
1375 if (op == ELS_LS_ACC) 1393 if (op == ELS_LS_ACC)
1376 fc_lport_enter_reset(lport); 1394 fc_lport_enter_reset(lport);
@@ -1400,10 +1418,6 @@ static void fc_lport_enter_logo(struct fc_lport *lport)
1400 1418
1401 fc_lport_state_enter(lport, LPORT_ST_LOGO); 1419 fc_lport_state_enter(lport, LPORT_ST_LOGO);
1402 1420
1403 /* DNS session should be closed so we can release it here */
1404 if (lport->dns_rp)
1405 lport->tt.rport_logoff(lport->dns_rp);
1406
1407 fp = fc_frame_alloc(lport, sizeof(*logo)); 1421 fp = fc_frame_alloc(lport, sizeof(*logo));
1408 if (!fp) { 1422 if (!fp) {
1409 fc_lport_error(lport, fp); 1423 fc_lport_error(lport, fp);
@@ -1444,17 +1458,19 @@ static void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp,
1444 1458
1445 FC_DEBUG_LPORT("Received a FLOGI response\n"); 1459 FC_DEBUG_LPORT("Received a FLOGI response\n");
1446 1460
1447 if (IS_ERR(fp)) {
1448 fc_lport_error(lport, fp);
1449 goto err;
1450 }
1451
1452 if (lport->state != LPORT_ST_FLOGI) { 1461 if (lport->state != LPORT_ST_FLOGI) {
1453 FC_DBG("Received a FLOGI response, but in state %s\n", 1462 FC_DBG("Received a FLOGI response, but in state %s\n",
1454 fc_lport_state(lport)); 1463 fc_lport_state(lport));
1464 if (IS_ERR(fp))
1465 goto err;
1455 goto out; 1466 goto out;
1456 } 1467 }
1457 1468
1469 if (IS_ERR(fp)) {
1470 fc_lport_error(lport, fp);
1471 goto err;
1472 }
1473
1458 fh = fc_frame_header_get(fp); 1474 fh = fc_frame_header_get(fp);
1459 did = ntoh24(fh->fh_d_id); 1475 did = ntoh24(fh->fh_d_id);
1460 if (fc_frame_payload_op(fp) == ELS_LS_ACC && did != 0) { 1476 if (fc_frame_payload_op(fp) == ELS_LS_ACC && did != 0) {
diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c
index 0472bb73221..747d73c5c8a 100644
--- a/drivers/scsi/libfc/fc_rport.c
+++ b/drivers/scsi/libfc/fc_rport.c
@@ -267,6 +267,10 @@ static void fc_rport_work(struct work_struct *work)
267 "(%6x).\n", ids.port_id); 267 "(%6x).\n", ids.port_id);
268 event = RPORT_EV_FAILED; 268 event = RPORT_EV_FAILED;
269 } 269 }
270 if (rport->port_id != FC_FID_DIR_SERV)
271 if (rport_ops->event_callback)
272 rport_ops->event_callback(lport, rport,
273 RPORT_EV_FAILED);
270 put_device(&rport->dev); 274 put_device(&rport->dev);
271 rport = new_rport; 275 rport = new_rport;
272 rdata = new_rport->dd_data; 276 rdata = new_rport->dd_data;
@@ -325,11 +329,20 @@ int fc_rport_login(struct fc_rport *rport)
325int fc_rport_logoff(struct fc_rport *rport) 329int fc_rport_logoff(struct fc_rport *rport)
326{ 330{
327 struct fc_rport_libfc_priv *rdata = rport->dd_data; 331 struct fc_rport_libfc_priv *rdata = rport->dd_data;
332 struct fc_lport *lport = rdata->local_port;
328 333
329 mutex_lock(&rdata->rp_mutex); 334 mutex_lock(&rdata->rp_mutex);
330 335
331 FC_DEBUG_RPORT("Remove port (%6x)\n", rport->port_id); 336 FC_DEBUG_RPORT("Remove port (%6x)\n", rport->port_id);
332 337
338 if (rdata->rp_state == RPORT_ST_NONE) {
339 FC_DEBUG_RPORT("(%6x): Port (%6x) in NONE state,"
340 " not removing", fc_host_port_id(lport->host),
341 rport->port_id);
342 mutex_unlock(&rdata->rp_mutex);
343 goto out;
344 }
345
333 fc_rport_enter_logo(rport); 346 fc_rport_enter_logo(rport);
334 347
335 /* 348 /*
@@ -349,6 +362,7 @@ int fc_rport_logoff(struct fc_rport *rport)
349 362
350 mutex_unlock(&rdata->rp_mutex); 363 mutex_unlock(&rdata->rp_mutex);
351 364
365out:
352 return 0; 366 return 0;
353} 367}
354 368
@@ -430,6 +444,7 @@ static void fc_rport_error(struct fc_rport *rport, struct fc_frame *fp)
430 case RPORT_ST_PRLI: 444 case RPORT_ST_PRLI:
431 case RPORT_ST_LOGO: 445 case RPORT_ST_LOGO:
432 rdata->event = RPORT_EV_FAILED; 446 rdata->event = RPORT_EV_FAILED;
447 fc_rport_state_enter(rport, RPORT_ST_NONE);
433 queue_work(rport_event_queue, 448 queue_work(rport_event_queue,
434 &rdata->event_work); 449 &rdata->event_work);
435 break; 450 break;
@@ -494,7 +509,7 @@ static void fc_rport_plogi_resp(struct fc_seq *sp, struct fc_frame *fp,
494 struct fc_rport *rport = rp_arg; 509 struct fc_rport *rport = rp_arg;
495 struct fc_rport_libfc_priv *rdata = rport->dd_data; 510 struct fc_rport_libfc_priv *rdata = rport->dd_data;
496 struct fc_lport *lport = rdata->local_port; 511 struct fc_lport *lport = rdata->local_port;
497 struct fc_els_flogi *plp; 512 struct fc_els_flogi *plp = NULL;
498 unsigned int tov; 513 unsigned int tov;
499 u16 csp_seq; 514 u16 csp_seq;
500 u16 cssp_seq; 515 u16 cssp_seq;
@@ -505,17 +520,19 @@ static void fc_rport_plogi_resp(struct fc_seq *sp, struct fc_frame *fp,
505 FC_DEBUG_RPORT("Received a PLOGI response from port (%6x)\n", 520 FC_DEBUG_RPORT("Received a PLOGI response from port (%6x)\n",
506 rport->port_id); 521 rport->port_id);
507 522
508 if (IS_ERR(fp)) {
509 fc_rport_error_retry(rport, fp);
510 goto err;
511 }
512
513 if (rdata->rp_state != RPORT_ST_PLOGI) { 523 if (rdata->rp_state != RPORT_ST_PLOGI) {
514 FC_DBG("Received a PLOGI response, but in state %s\n", 524 FC_DBG("Received a PLOGI response, but in state %s\n",
515 fc_rport_state(rport)); 525 fc_rport_state(rport));
526 if (IS_ERR(fp))
527 goto err;
516 goto out; 528 goto out;
517 } 529 }
518 530
531 if (IS_ERR(fp)) {
532 fc_rport_error_retry(rport, fp);
533 goto err;
534 }
535
519 op = fc_frame_payload_op(fp); 536 op = fc_frame_payload_op(fp);
520 if (op == ELS_LS_ACC && 537 if (op == ELS_LS_ACC &&
521 (plp = fc_frame_payload_get(fp, sizeof(*plp))) != NULL) { 538 (plp = fc_frame_payload_get(fp, sizeof(*plp))) != NULL) {
@@ -614,17 +631,19 @@ static void fc_rport_prli_resp(struct fc_seq *sp, struct fc_frame *fp,
614 FC_DEBUG_RPORT("Received a PRLI response from port (%6x)\n", 631 FC_DEBUG_RPORT("Received a PRLI response from port (%6x)\n",
615 rport->port_id); 632 rport->port_id);
616 633
617 if (IS_ERR(fp)) {
618 fc_rport_error_retry(rport, fp);
619 goto err;
620 }
621
622 if (rdata->rp_state != RPORT_ST_PRLI) { 634 if (rdata->rp_state != RPORT_ST_PRLI) {
623 FC_DBG("Received a PRLI response, but in state %s\n", 635 FC_DBG("Received a PRLI response, but in state %s\n",
624 fc_rport_state(rport)); 636 fc_rport_state(rport));
637 if (IS_ERR(fp))
638 goto err;
625 goto out; 639 goto out;
626 } 640 }
627 641
642 if (IS_ERR(fp)) {
643 fc_rport_error_retry(rport, fp);
644 goto err;
645 }
646
628 op = fc_frame_payload_op(fp); 647 op = fc_frame_payload_op(fp);
629 if (op == ELS_LS_ACC) { 648 if (op == ELS_LS_ACC) {
630 pp = fc_frame_payload_get(fp, sizeof(*pp)); 649 pp = fc_frame_payload_get(fp, sizeof(*pp));
@@ -646,6 +665,7 @@ static void fc_rport_prli_resp(struct fc_seq *sp, struct fc_frame *fp,
646 } else { 665 } else {
647 FC_DBG("Bad ELS response\n"); 666 FC_DBG("Bad ELS response\n");
648 rdata->event = RPORT_EV_FAILED; 667 rdata->event = RPORT_EV_FAILED;
668 fc_rport_state_enter(rport, RPORT_ST_NONE);
649 queue_work(rport_event_queue, &rdata->event_work); 669 queue_work(rport_event_queue, &rdata->event_work);
650 } 670 }
651 671
@@ -678,23 +698,26 @@ static void fc_rport_logo_resp(struct fc_seq *sp, struct fc_frame *fp,
678 FC_DEBUG_RPORT("Received a LOGO response from port (%6x)\n", 698 FC_DEBUG_RPORT("Received a LOGO response from port (%6x)\n",
679 rport->port_id); 699 rport->port_id);
680 700
681 if (IS_ERR(fp)) {
682 fc_rport_error_retry(rport, fp);
683 goto err;
684 }
685
686 if (rdata->rp_state != RPORT_ST_LOGO) { 701 if (rdata->rp_state != RPORT_ST_LOGO) {
687 FC_DEBUG_RPORT("Received a LOGO response, but in state %s\n", 702 FC_DEBUG_RPORT("Received a LOGO response, but in state %s\n",
688 fc_rport_state(rport)); 703 fc_rport_state(rport));
704 if (IS_ERR(fp))
705 goto err;
689 goto out; 706 goto out;
690 } 707 }
691 708
709 if (IS_ERR(fp)) {
710 fc_rport_error_retry(rport, fp);
711 goto err;
712 }
713
692 op = fc_frame_payload_op(fp); 714 op = fc_frame_payload_op(fp);
693 if (op == ELS_LS_ACC) { 715 if (op == ELS_LS_ACC) {
694 fc_rport_enter_rtv(rport); 716 fc_rport_enter_rtv(rport);
695 } else { 717 } else {
696 FC_DBG("Bad ELS response\n"); 718 FC_DBG("Bad ELS response\n");
697 rdata->event = RPORT_EV_LOGO; 719 rdata->event = RPORT_EV_LOGO;
720 fc_rport_state_enter(rport, RPORT_ST_NONE);
698 queue_work(rport_event_queue, &rdata->event_work); 721 queue_work(rport_event_queue, &rdata->event_work);
699 } 722 }
700 723
@@ -764,17 +787,19 @@ static void fc_rport_rtv_resp(struct fc_seq *sp, struct fc_frame *fp,
764 FC_DEBUG_RPORT("Received a RTV response from port (%6x)\n", 787 FC_DEBUG_RPORT("Received a RTV response from port (%6x)\n",
765 rport->port_id); 788 rport->port_id);
766 789
767 if (IS_ERR(fp)) {
768 fc_rport_error(rport, fp);
769 goto err;
770 }
771
772 if (rdata->rp_state != RPORT_ST_RTV) { 790 if (rdata->rp_state != RPORT_ST_RTV) {
773 FC_DBG("Received a RTV response, but in state %s\n", 791 FC_DBG("Received a RTV response, but in state %s\n",
774 fc_rport_state(rport)); 792 fc_rport_state(rport));
793 if (IS_ERR(fp))
794 goto err;
775 goto out; 795 goto out;
776 } 796 }
777 797
798 if (IS_ERR(fp)) {
799 fc_rport_error(rport, fp);
800 goto err;
801 }
802
778 op = fc_frame_payload_op(fp); 803 op = fc_frame_payload_op(fp);
779 if (op == ELS_LS_ACC) { 804 if (op == ELS_LS_ACC) {
780 struct fc_els_rtv_acc *rtv; 805 struct fc_els_rtv_acc *rtv;
@@ -1007,6 +1032,8 @@ static void fc_rport_recv_plogi_req(struct fc_rport *rport,
1007 default: 1032 default:
1008 FC_DEBUG_RPORT("incoming PLOGI from %x in unexpected " 1033 FC_DEBUG_RPORT("incoming PLOGI from %x in unexpected "
1009 "state %d\n", sid, rdata->rp_state); 1034 "state %d\n", sid, rdata->rp_state);
1035 fc_frame_free(fp);
1036 return;
1010 break; 1037 break;
1011 } 1038 }
1012 1039
@@ -1098,6 +1125,8 @@ static void fc_rport_recv_prli_req(struct fc_rport *rport,
1098 reason = ELS_RJT_NONE; 1125 reason = ELS_RJT_NONE;
1099 break; 1126 break;
1100 default: 1127 default:
1128 fc_frame_free(rx_fp);
1129 return;
1101 break; 1130 break;
1102 } 1131 }
1103 len = fr_len(rx_fp) - sizeof(*fh); 1132 len = fr_len(rx_fp) - sizeof(*fh);
@@ -1227,6 +1256,11 @@ static void fc_rport_recv_prlo_req(struct fc_rport *rport, struct fc_seq *sp,
1227 "while in state %s\n", ntoh24(fh->fh_s_id), 1256 "while in state %s\n", ntoh24(fh->fh_s_id),
1228 fc_rport_state(rport)); 1257 fc_rport_state(rport));
1229 1258
1259 if (rdata->rp_state == RPORT_ST_NONE) {
1260 fc_frame_free(fp);
1261 return;
1262 }
1263
1230 rjt_data.fp = NULL; 1264 rjt_data.fp = NULL;
1231 rjt_data.reason = ELS_RJT_UNAB; 1265 rjt_data.reason = ELS_RJT_UNAB;
1232 rjt_data.explan = ELS_EXPL_NONE; 1266 rjt_data.explan = ELS_EXPL_NONE;
@@ -1256,7 +1290,13 @@ static void fc_rport_recv_logo_req(struct fc_rport *rport, struct fc_seq *sp,
1256 "while in state %s\n", ntoh24(fh->fh_s_id), 1290 "while in state %s\n", ntoh24(fh->fh_s_id),
1257 fc_rport_state(rport)); 1291 fc_rport_state(rport));
1258 1292
1293 if (rdata->rp_state == RPORT_ST_NONE) {
1294 fc_frame_free(fp);
1295 return;
1296 }
1297
1259 rdata->event = RPORT_EV_LOGO; 1298 rdata->event = RPORT_EV_LOGO;
1299 fc_rport_state_enter(rport, RPORT_ST_NONE);
1260 queue_work(rport_event_queue, &rdata->event_work); 1300 queue_work(rport_event_queue, &rdata->event_work);
1261 1301
1262 lport->tt.seq_els_rsp_send(sp, ELS_LS_ACC, NULL); 1302 lport->tt.seq_els_rsp_send(sp, ELS_LS_ACC, NULL);
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 68962835916..e72b4ad47d3 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -1463,6 +1463,16 @@ int iscsi_change_queue_depth(struct scsi_device *sdev, int depth)
1463} 1463}
1464EXPORT_SYMBOL_GPL(iscsi_change_queue_depth); 1464EXPORT_SYMBOL_GPL(iscsi_change_queue_depth);
1465 1465
1466int iscsi_target_alloc(struct scsi_target *starget)
1467{
1468 struct iscsi_cls_session *cls_session = starget_to_session(starget);
1469 struct iscsi_session *session = cls_session->dd_data;
1470
1471 starget->can_queue = session->scsi_cmds_max;
1472 return 0;
1473}
1474EXPORT_SYMBOL_GPL(iscsi_target_alloc);
1475
1466void iscsi_session_recovery_timedout(struct iscsi_cls_session *cls_session) 1476void iscsi_session_recovery_timedout(struct iscsi_cls_session *cls_session)
1467{ 1477{
1468 struct iscsi_session *session = cls_session->dd_data; 1478 struct iscsi_session *session = cls_session->dd_data;
diff --git a/drivers/scsi/libiscsi_tcp.c b/drivers/scsi/libiscsi_tcp.c
index 91f8ce4d8d0..b579ca9f483 100644
--- a/drivers/scsi/libiscsi_tcp.c
+++ b/drivers/scsi/libiscsi_tcp.c
@@ -1036,8 +1036,11 @@ flush:
1036 1036
1037 rc = conn->session->tt->init_pdu(task, r2t->data_offset + r2t->sent, 1037 rc = conn->session->tt->init_pdu(task, r2t->data_offset + r2t->sent,
1038 r2t->data_count); 1038 r2t->data_count);
1039 if (rc) 1039 if (rc) {
1040 iscsi_conn_failure(conn, ISCSI_ERR_XMIT_FAILED);
1040 return rc; 1041 return rc;
1042 }
1043
1041 r2t->sent += r2t->data_count; 1044 r2t->sent += r2t->data_count;
1042 goto flush; 1045 goto flush;
1043} 1046}
diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
index dcba267db71..1105f9a111b 100644
--- a/drivers/scsi/lpfc/lpfc.h
+++ b/drivers/scsi/lpfc/lpfc.h
@@ -443,6 +443,7 @@ struct lpfc_hba {
443 uint32_t hba_flag; /* hba generic flags */ 443 uint32_t hba_flag; /* hba generic flags */
444#define HBA_ERATT_HANDLED 0x1 /* This flag is set when eratt handled */ 444#define HBA_ERATT_HANDLED 0x1 /* This flag is set when eratt handled */
445 445
446#define DEFER_ERATT 0x4 /* Deferred error attention in progress */
446 struct lpfc_dmabuf slim2p; 447 struct lpfc_dmabuf slim2p;
447 448
448 MAILBOX_t *mbox; 449 MAILBOX_t *mbox;
@@ -723,4 +724,3 @@ lpfc_sli_read_hs(struct lpfc_hba *phba)
723 724
724 return; 725 return;
725} 726}
726
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index 40cf0f4f327..c14f0cbdb12 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -51,7 +51,7 @@
51#define LPFC_LINK_SPEED_STRING "0, 1, 2, 4, 8" 51#define LPFC_LINK_SPEED_STRING "0, 1, 2, 4, 8"
52 52
53/** 53/**
54 * lpfc_jedec_to_ascii: Hex to ascii convertor according to JEDEC rules. 54 * lpfc_jedec_to_ascii - Hex to ascii convertor according to JEDEC rules
55 * @incr: integer to convert. 55 * @incr: integer to convert.
56 * @hdw: ascii string holding converted integer plus a string terminator. 56 * @hdw: ascii string holding converted integer plus a string terminator.
57 * 57 *
@@ -82,7 +82,7 @@ lpfc_jedec_to_ascii(int incr, char hdw[])
82} 82}
83 83
84/** 84/**
85 * lpfc_drvr_version_show: Return the Emulex driver string with version number. 85 * lpfc_drvr_version_show - Return the Emulex driver string with version number
86 * @dev: class unused variable. 86 * @dev: class unused variable.
87 * @attr: device attribute, not used. 87 * @attr: device attribute, not used.
88 * @buf: on return contains the module description text. 88 * @buf: on return contains the module description text.
@@ -152,7 +152,7 @@ lpfc_bg_reftag_err_show(struct device *dev, struct device_attribute *attr,
152} 152}
153 153
154/** 154/**
155 * lpfc_info_show: Return some pci info about the host in ascii. 155 * lpfc_info_show - Return some pci info about the host in ascii
156 * @dev: class converted to a Scsi_host structure. 156 * @dev: class converted to a Scsi_host structure.
157 * @attr: device attribute, not used. 157 * @attr: device attribute, not used.
158 * @buf: on return contains the formatted text from lpfc_info(). 158 * @buf: on return contains the formatted text from lpfc_info().
@@ -169,7 +169,7 @@ lpfc_info_show(struct device *dev, struct device_attribute *attr,
169} 169}
170 170
171/** 171/**
172 * lpfc_serialnum_show: Return the hba serial number in ascii. 172 * lpfc_serialnum_show - Return the hba serial number in ascii
173 * @dev: class converted to a Scsi_host structure. 173 * @dev: class converted to a Scsi_host structure.
174 * @attr: device attribute, not used. 174 * @attr: device attribute, not used.
175 * @buf: on return contains the formatted text serial number. 175 * @buf: on return contains the formatted text serial number.
@@ -188,7 +188,7 @@ lpfc_serialnum_show(struct device *dev, struct device_attribute *attr,
188} 188}
189 189
190/** 190/**
191 * lpfc_temp_sensor_show: Return the temperature sensor level. 191 * lpfc_temp_sensor_show - Return the temperature sensor level
192 * @dev: class converted to a Scsi_host structure. 192 * @dev: class converted to a Scsi_host structure.
193 * @attr: device attribute, not used. 193 * @attr: device attribute, not used.
194 * @buf: on return contains the formatted support level. 194 * @buf: on return contains the formatted support level.
@@ -210,7 +210,7 @@ lpfc_temp_sensor_show(struct device *dev, struct device_attribute *attr,
210} 210}
211 211
212/** 212/**
213 * lpfc_modeldesc_show: Return the model description of the hba. 213 * lpfc_modeldesc_show - Return the model description of the hba
214 * @dev: class converted to a Scsi_host structure. 214 * @dev: class converted to a Scsi_host structure.
215 * @attr: device attribute, not used. 215 * @attr: device attribute, not used.
216 * @buf: on return contains the scsi vpd model description. 216 * @buf: on return contains the scsi vpd model description.
@@ -229,7 +229,7 @@ lpfc_modeldesc_show(struct device *dev, struct device_attribute *attr,
229} 229}
230 230
231/** 231/**
232 * lpfc_modelname_show: Return the model name of the hba. 232 * lpfc_modelname_show - Return the model name of the hba
233 * @dev: class converted to a Scsi_host structure. 233 * @dev: class converted to a Scsi_host structure.
234 * @attr: device attribute, not used. 234 * @attr: device attribute, not used.
235 * @buf: on return contains the scsi vpd model name. 235 * @buf: on return contains the scsi vpd model name.
@@ -248,7 +248,7 @@ lpfc_modelname_show(struct device *dev, struct device_attribute *attr,
248} 248}
249 249
250/** 250/**
251 * lpfc_programtype_show: Return the program type of the hba. 251 * lpfc_programtype_show - Return the program type of the hba
252 * @dev: class converted to a Scsi_host structure. 252 * @dev: class converted to a Scsi_host structure.
253 * @attr: device attribute, not used. 253 * @attr: device attribute, not used.
254 * @buf: on return contains the scsi vpd program type. 254 * @buf: on return contains the scsi vpd program type.
@@ -267,7 +267,7 @@ lpfc_programtype_show(struct device *dev, struct device_attribute *attr,
267} 267}
268 268
269/** 269/**
270 * lpfc_mlomgmt_show: Return the Menlo Maintenance sli flag. 270 * lpfc_mlomgmt_show - Return the Menlo Maintenance sli flag
271 * @dev: class converted to a Scsi_host structure. 271 * @dev: class converted to a Scsi_host structure.
272 * @attr: device attribute, not used. 272 * @attr: device attribute, not used.
273 * @buf: on return contains the Menlo Maintenance sli flag. 273 * @buf: on return contains the Menlo Maintenance sli flag.
@@ -286,7 +286,7 @@ lpfc_mlomgmt_show(struct device *dev, struct device_attribute *attr, char *buf)
286} 286}
287 287
288/** 288/**
289 * lpfc_vportnum_show: Return the port number in ascii of the hba. 289 * lpfc_vportnum_show - Return the port number in ascii of the hba
290 * @dev: class converted to a Scsi_host structure. 290 * @dev: class converted to a Scsi_host structure.
291 * @attr: device attribute, not used. 291 * @attr: device attribute, not used.
292 * @buf: on return contains scsi vpd program type. 292 * @buf: on return contains scsi vpd program type.
@@ -305,7 +305,7 @@ lpfc_vportnum_show(struct device *dev, struct device_attribute *attr,
305} 305}
306 306
307/** 307/**
308 * lpfc_fwrev_show: Return the firmware rev running in the hba. 308 * lpfc_fwrev_show - Return the firmware rev running in the hba
309 * @dev: class converted to a Scsi_host structure. 309 * @dev: class converted to a Scsi_host structure.
310 * @attr: device attribute, not used. 310 * @attr: device attribute, not used.
311 * @buf: on return contains the scsi vpd program type. 311 * @buf: on return contains the scsi vpd program type.
@@ -326,7 +326,7 @@ lpfc_fwrev_show(struct device *dev, struct device_attribute *attr,
326} 326}
327 327
328/** 328/**
329 * lpfc_hdw_show: Return the jedec information about the hba. 329 * lpfc_hdw_show - Return the jedec information about the hba
330 * @dev: class converted to a Scsi_host structure. 330 * @dev: class converted to a Scsi_host structure.
331 * @attr: device attribute, not used. 331 * @attr: device attribute, not used.
332 * @buf: on return contains the scsi vpd program type. 332 * @buf: on return contains the scsi vpd program type.
@@ -347,7 +347,7 @@ lpfc_hdw_show(struct device *dev, struct device_attribute *attr, char *buf)
347} 347}
348 348
349/** 349/**
350 * lpfc_option_rom_version_show: Return the adapter ROM FCode version. 350 * lpfc_option_rom_version_show - Return the adapter ROM FCode version
351 * @dev: class converted to a Scsi_host structure. 351 * @dev: class converted to a Scsi_host structure.
352 * @attr: device attribute, not used. 352 * @attr: device attribute, not used.
353 * @buf: on return contains the ROM and FCode ascii strings. 353 * @buf: on return contains the ROM and FCode ascii strings.
@@ -366,7 +366,7 @@ lpfc_option_rom_version_show(struct device *dev, struct device_attribute *attr,
366} 366}
367 367
368/** 368/**
369 * lpfc_state_show: Return the link state of the port. 369 * lpfc_state_show - Return the link state of the port
370 * @dev: class converted to a Scsi_host structure. 370 * @dev: class converted to a Scsi_host structure.
371 * @attr: device attribute, not used. 371 * @attr: device attribute, not used.
372 * @buf: on return contains text describing the state of the link. 372 * @buf: on return contains text describing the state of the link.
@@ -451,7 +451,7 @@ lpfc_link_state_show(struct device *dev, struct device_attribute *attr,
451} 451}
452 452
453/** 453/**
454 * lpfc_num_discovered_ports_show: Return sum of mapped and unmapped vports. 454 * lpfc_num_discovered_ports_show - Return sum of mapped and unmapped vports
455 * @dev: class device that is converted into a Scsi_host. 455 * @dev: class device that is converted into a Scsi_host.
456 * @attr: device attribute, not used. 456 * @attr: device attribute, not used.
457 * @buf: on return contains the sum of fc mapped and unmapped. 457 * @buf: on return contains the sum of fc mapped and unmapped.
@@ -474,7 +474,7 @@ lpfc_num_discovered_ports_show(struct device *dev,
474} 474}
475 475
476/** 476/**
477 * lpfc_issue_lip: Misnomer, name carried over from long ago. 477 * lpfc_issue_lip - Misnomer, name carried over from long ago
478 * @shost: Scsi_Host pointer. 478 * @shost: Scsi_Host pointer.
479 * 479 *
480 * Description: 480 * Description:
@@ -529,7 +529,7 @@ lpfc_issue_lip(struct Scsi_Host *shost)
529} 529}
530 530
531/** 531/**
532 * lpfc_do_offline: Issues a mailbox command to bring the link down. 532 * lpfc_do_offline - Issues a mailbox command to bring the link down
533 * @phba: lpfc_hba pointer. 533 * @phba: lpfc_hba pointer.
534 * @type: LPFC_EVT_OFFLINE, LPFC_EVT_WARM_START, LPFC_EVT_KILL. 534 * @type: LPFC_EVT_OFFLINE, LPFC_EVT_WARM_START, LPFC_EVT_KILL.
535 * 535 *
@@ -537,7 +537,7 @@ lpfc_issue_lip(struct Scsi_Host *shost)
537 * Assumes any error from lpfc_do_offline() will be negative. 537 * Assumes any error from lpfc_do_offline() will be negative.
538 * Can wait up to 5 seconds for the port ring buffers count 538 * Can wait up to 5 seconds for the port ring buffers count
539 * to reach zero, prints a warning if it is not zero and continues. 539 * to reach zero, prints a warning if it is not zero and continues.
540 * lpfc_workq_post_event() returns a non-zero return coce if call fails. 540 * lpfc_workq_post_event() returns a non-zero return code if call fails.
541 * 541 *
542 * Returns: 542 * Returns:
543 * -EIO error posting the event 543 * -EIO error posting the event
@@ -591,7 +591,7 @@ lpfc_do_offline(struct lpfc_hba *phba, uint32_t type)
591} 591}
592 592
593/** 593/**
594 * lpfc_selective_reset: Offline then onlines the port. 594 * lpfc_selective_reset - Offline then onlines the port
595 * @phba: lpfc_hba pointer. 595 * @phba: lpfc_hba pointer.
596 * 596 *
597 * Description: 597 * Description:
@@ -632,7 +632,7 @@ lpfc_selective_reset(struct lpfc_hba *phba)
632} 632}
633 633
634/** 634/**
635 * lpfc_issue_reset: Selectively resets an adapter. 635 * lpfc_issue_reset - Selectively resets an adapter
636 * @dev: class device that is converted into a Scsi_host. 636 * @dev: class device that is converted into a Scsi_host.
637 * @attr: device attribute, not used. 637 * @attr: device attribute, not used.
638 * @buf: containing the string "selective". 638 * @buf: containing the string "selective".
@@ -672,7 +672,7 @@ lpfc_issue_reset(struct device *dev, struct device_attribute *attr,
672} 672}
673 673
674/** 674/**
675 * lpfc_nport_evt_cnt_show: Return the number of nport events. 675 * lpfc_nport_evt_cnt_show - Return the number of nport events
676 * @dev: class device that is converted into a Scsi_host. 676 * @dev: class device that is converted into a Scsi_host.
677 * @attr: device attribute, not used. 677 * @attr: device attribute, not used.
678 * @buf: on return contains the ascii number of nport events. 678 * @buf: on return contains the ascii number of nport events.
@@ -691,7 +691,7 @@ lpfc_nport_evt_cnt_show(struct device *dev, struct device_attribute *attr,
691} 691}
692 692
693/** 693/**
694 * lpfc_board_mode_show: Return the state of the board. 694 * lpfc_board_mode_show - Return the state of the board
695 * @dev: class device that is converted into a Scsi_host. 695 * @dev: class device that is converted into a Scsi_host.
696 * @attr: device attribute, not used. 696 * @attr: device attribute, not used.
697 * @buf: on return contains the state of the adapter. 697 * @buf: on return contains the state of the adapter.
@@ -720,7 +720,7 @@ lpfc_board_mode_show(struct device *dev, struct device_attribute *attr,
720} 720}
721 721
722/** 722/**
723 * lpfc_board_mode_store: Puts the hba in online, offline, warm or error state. 723 * lpfc_board_mode_store - Puts the hba in online, offline, warm or error state
724 * @dev: class device that is converted into a Scsi_host. 724 * @dev: class device that is converted into a Scsi_host.
725 * @attr: device attribute, not used. 725 * @attr: device attribute, not used.
726 * @buf: containing one of the strings "online", "offline", "warm" or "error". 726 * @buf: containing one of the strings "online", "offline", "warm" or "error".
@@ -766,14 +766,14 @@ lpfc_board_mode_store(struct device *dev, struct device_attribute *attr,
766} 766}
767 767
768/** 768/**
769 * lpfc_get_hba_info: Return various bits of informaton about the adapter. 769 * lpfc_get_hba_info - Return various bits of informaton about the adapter
770 * @phba: pointer to the adapter structure. 770 * @phba: pointer to the adapter structure.
771 * @mxri max xri count. 771 * @mxri: max xri count.
772 * @axri available xri count. 772 * @axri: available xri count.
773 * @mrpi max rpi count. 773 * @mrpi: max rpi count.
774 * @arpi available rpi count. 774 * @arpi: available rpi count.
775 * @mvpi max vpi count. 775 * @mvpi: max vpi count.
776 * @avpi available vpi count. 776 * @avpi: available vpi count.
777 * 777 *
778 * Description: 778 * Description:
779 * If an integer pointer for an count is not null then the value for the 779 * If an integer pointer for an count is not null then the value for the
@@ -846,7 +846,7 @@ lpfc_get_hba_info(struct lpfc_hba *phba,
846} 846}
847 847
848/** 848/**
849 * lpfc_max_rpi_show: Return maximum rpi. 849 * lpfc_max_rpi_show - Return maximum rpi
850 * @dev: class device that is converted into a Scsi_host. 850 * @dev: class device that is converted into a Scsi_host.
851 * @attr: device attribute, not used. 851 * @attr: device attribute, not used.
852 * @buf: on return contains the maximum rpi count in decimal or "Unknown". 852 * @buf: on return contains the maximum rpi count in decimal or "Unknown".
@@ -874,7 +874,7 @@ lpfc_max_rpi_show(struct device *dev, struct device_attribute *attr,
874} 874}
875 875
876/** 876/**
877 * lpfc_used_rpi_show: Return maximum rpi minus available rpi. 877 * lpfc_used_rpi_show - Return maximum rpi minus available rpi
878 * @dev: class device that is converted into a Scsi_host. 878 * @dev: class device that is converted into a Scsi_host.
879 * @attr: device attribute, not used. 879 * @attr: device attribute, not used.
880 * @buf: containing the used rpi count in decimal or "Unknown". 880 * @buf: containing the used rpi count in decimal or "Unknown".
@@ -902,7 +902,7 @@ lpfc_used_rpi_show(struct device *dev, struct device_attribute *attr,
902} 902}
903 903
904/** 904/**
905 * lpfc_max_xri_show: Return maximum xri. 905 * lpfc_max_xri_show - Return maximum xri
906 * @dev: class device that is converted into a Scsi_host. 906 * @dev: class device that is converted into a Scsi_host.
907 * @attr: device attribute, not used. 907 * @attr: device attribute, not used.
908 * @buf: on return contains the maximum xri count in decimal or "Unknown". 908 * @buf: on return contains the maximum xri count in decimal or "Unknown".
@@ -930,7 +930,7 @@ lpfc_max_xri_show(struct device *dev, struct device_attribute *attr,
930} 930}
931 931
932/** 932/**
933 * lpfc_used_xri_show: Return maximum xpi minus the available xpi. 933 * lpfc_used_xri_show - Return maximum xpi minus the available xpi
934 * @dev: class device that is converted into a Scsi_host. 934 * @dev: class device that is converted into a Scsi_host.
935 * @attr: device attribute, not used. 935 * @attr: device attribute, not used.
936 * @buf: on return contains the used xri count in decimal or "Unknown". 936 * @buf: on return contains the used xri count in decimal or "Unknown".
@@ -958,7 +958,7 @@ lpfc_used_xri_show(struct device *dev, struct device_attribute *attr,
958} 958}
959 959
960/** 960/**
961 * lpfc_max_vpi_show: Return maximum vpi. 961 * lpfc_max_vpi_show - Return maximum vpi
962 * @dev: class device that is converted into a Scsi_host. 962 * @dev: class device that is converted into a Scsi_host.
963 * @attr: device attribute, not used. 963 * @attr: device attribute, not used.
964 * @buf: on return contains the maximum vpi count in decimal or "Unknown". 964 * @buf: on return contains the maximum vpi count in decimal or "Unknown".
@@ -986,7 +986,7 @@ lpfc_max_vpi_show(struct device *dev, struct device_attribute *attr,
986} 986}
987 987
988/** 988/**
989 * lpfc_used_vpi_show: Return maximum vpi minus the available vpi. 989 * lpfc_used_vpi_show - Return maximum vpi minus the available vpi
990 * @dev: class device that is converted into a Scsi_host. 990 * @dev: class device that is converted into a Scsi_host.
991 * @attr: device attribute, not used. 991 * @attr: device attribute, not used.
992 * @buf: on return contains the used vpi count in decimal or "Unknown". 992 * @buf: on return contains the used vpi count in decimal or "Unknown".
@@ -1014,7 +1014,7 @@ lpfc_used_vpi_show(struct device *dev, struct device_attribute *attr,
1014} 1014}
1015 1015
1016/** 1016/**
1017 * lpfc_npiv_info_show: Return text about NPIV support for the adapter. 1017 * lpfc_npiv_info_show - Return text about NPIV support for the adapter
1018 * @dev: class device that is converted into a Scsi_host. 1018 * @dev: class device that is converted into a Scsi_host.
1019 * @attr: device attribute, not used. 1019 * @attr: device attribute, not used.
1020 * @buf: text that must be interpreted to determine if npiv is supported. 1020 * @buf: text that must be interpreted to determine if npiv is supported.
@@ -1042,7 +1042,7 @@ lpfc_npiv_info_show(struct device *dev, struct device_attribute *attr,
1042} 1042}
1043 1043
1044/** 1044/**
1045 * lpfc_poll_show: Return text about poll support for the adapter. 1045 * lpfc_poll_show - Return text about poll support for the adapter
1046 * @dev: class device that is converted into a Scsi_host. 1046 * @dev: class device that is converted into a Scsi_host.
1047 * @attr: device attribute, not used. 1047 * @attr: device attribute, not used.
1048 * @buf: on return contains the cfg_poll in hex. 1048 * @buf: on return contains the cfg_poll in hex.
@@ -1064,7 +1064,7 @@ lpfc_poll_show(struct device *dev, struct device_attribute *attr,
1064} 1064}
1065 1065
1066/** 1066/**
1067 * lpfc_poll_store: Set the value of cfg_poll for the adapter. 1067 * lpfc_poll_store - Set the value of cfg_poll for the adapter
1068 * @dev: class device that is converted into a Scsi_host. 1068 * @dev: class device that is converted into a Scsi_host.
1069 * @attr: device attribute, not used. 1069 * @attr: device attribute, not used.
1070 * @buf: one or more lpfc_polling_flags values. 1070 * @buf: one or more lpfc_polling_flags values.
@@ -1136,7 +1136,7 @@ lpfc_poll_store(struct device *dev, struct device_attribute *attr,
1136} 1136}
1137 1137
1138/** 1138/**
1139 * lpfc_param_show: Return a cfg attribute value in decimal. 1139 * lpfc_param_show - Return a cfg attribute value in decimal
1140 * 1140 *
1141 * Description: 1141 * Description:
1142 * Macro that given an attr e.g. hba_queue_depth expands 1142 * Macro that given an attr e.g. hba_queue_depth expands
@@ -1164,7 +1164,7 @@ lpfc_##attr##_show(struct device *dev, struct device_attribute *attr, \
1164} 1164}
1165 1165
1166/** 1166/**
1167 * lpfc_param_hex_show: Return a cfg attribute value in hex. 1167 * lpfc_param_hex_show - Return a cfg attribute value in hex
1168 * 1168 *
1169 * Description: 1169 * Description:
1170 * Macro that given an attr e.g. hba_queue_depth expands 1170 * Macro that given an attr e.g. hba_queue_depth expands
@@ -1173,7 +1173,7 @@ lpfc_##attr##_show(struct device *dev, struct device_attribute *attr, \
1173 * lpfc_##attr##_show: Return the hex value of an adapters cfg_xxx field. 1173 * lpfc_##attr##_show: Return the hex value of an adapters cfg_xxx field.
1174 * @dev: class device that is converted into a Scsi_host. 1174 * @dev: class device that is converted into a Scsi_host.
1175 * @attr: device attribute, not used. 1175 * @attr: device attribute, not used.
1176 * @buf: on return contains the attribute value in hexidecimal. 1176 * @buf: on return contains the attribute value in hexadecimal.
1177 * 1177 *
1178 * Returns: size of formatted string. 1178 * Returns: size of formatted string.
1179 **/ 1179 **/
@@ -1192,7 +1192,7 @@ lpfc_##attr##_show(struct device *dev, struct device_attribute *attr, \
1192} 1192}
1193 1193
1194/** 1194/**
1195 * lpfc_param_init: Intializes a cfg attribute. 1195 * lpfc_param_init - Intializes a cfg attribute
1196 * 1196 *
1197 * Description: 1197 * Description:
1198 * Macro that given an attr e.g. hba_queue_depth expands 1198 * Macro that given an attr e.g. hba_queue_depth expands
@@ -1226,7 +1226,7 @@ lpfc_##attr##_init(struct lpfc_hba *phba, int val) \
1226} 1226}
1227 1227
1228/** 1228/**
1229 * lpfc_param_set: Set a cfg attribute value. 1229 * lpfc_param_set - Set a cfg attribute value
1230 * 1230 *
1231 * Description: 1231 * Description:
1232 * Macro that given an attr e.g. hba_queue_depth expands 1232 * Macro that given an attr e.g. hba_queue_depth expands
@@ -1260,7 +1260,7 @@ lpfc_##attr##_set(struct lpfc_hba *phba, int val) \
1260} 1260}
1261 1261
1262/** 1262/**
1263 * lpfc_param_store: Set a vport attribute value. 1263 * lpfc_param_store - Set a vport attribute value
1264 * 1264 *
1265 * Description: 1265 * Description:
1266 * Macro that given an attr e.g. hba_queue_depth expands 1266 * Macro that given an attr e.g. hba_queue_depth expands
@@ -1300,7 +1300,7 @@ lpfc_##attr##_store(struct device *dev, struct device_attribute *attr, \
1300} 1300}
1301 1301
1302/** 1302/**
1303 * lpfc_vport_param_show: Return decimal formatted cfg attribute value. 1303 * lpfc_vport_param_show - Return decimal formatted cfg attribute value
1304 * 1304 *
1305 * Description: 1305 * Description:
1306 * Macro that given an attr e.g. hba_queue_depth expands 1306 * Macro that given an attr e.g. hba_queue_depth expands
@@ -1326,17 +1326,17 @@ lpfc_##attr##_show(struct device *dev, struct device_attribute *attr, \
1326} 1326}
1327 1327
1328/** 1328/**
1329 * lpfc_vport_param_hex_show: Return hex formatted attribute value. 1329 * lpfc_vport_param_hex_show - Return hex formatted attribute value
1330 * 1330 *
1331 * Description: 1331 * Description:
1332 * Macro that given an attr e.g. 1332 * Macro that given an attr e.g.
1333 * hba_queue_depth expands into a function with the name 1333 * hba_queue_depth expands into a function with the name
1334 * lpfc_hba_queue_depth_show 1334 * lpfc_hba_queue_depth_show
1335 * 1335 *
1336 * lpfc_##attr##_show: prints the attribute value in hexidecimal. 1336 * lpfc_##attr##_show: prints the attribute value in hexadecimal.
1337 * @dev: class device that is converted into a Scsi_host. 1337 * @dev: class device that is converted into a Scsi_host.
1338 * @attr: device attribute, not used. 1338 * @attr: device attribute, not used.
1339 * @buf: on return contains the attribute value in hexidecimal. 1339 * @buf: on return contains the attribute value in hexadecimal.
1340 * 1340 *
1341 * Returns: length of formatted string. 1341 * Returns: length of formatted string.
1342 **/ 1342 **/
@@ -1353,7 +1353,7 @@ lpfc_##attr##_show(struct device *dev, struct device_attribute *attr, \
1353} 1353}
1354 1354
1355/** 1355/**
1356 * lpfc_vport_param_init: Initialize a vport cfg attribute. 1356 * lpfc_vport_param_init - Initialize a vport cfg attribute
1357 * 1357 *
1358 * Description: 1358 * Description:
1359 * Macro that given an attr e.g. hba_queue_depth expands 1359 * Macro that given an attr e.g. hba_queue_depth expands
@@ -1386,7 +1386,7 @@ lpfc_##attr##_init(struct lpfc_vport *vport, int val) \
1386} 1386}
1387 1387
1388/** 1388/**
1389 * lpfc_vport_param_set: Set a vport cfg attribute. 1389 * lpfc_vport_param_set - Set a vport cfg attribute
1390 * 1390 *
1391 * Description: 1391 * Description:
1392 * Macro that given an attr e.g. hba_queue_depth expands 1392 * Macro that given an attr e.g. hba_queue_depth expands
@@ -1417,7 +1417,7 @@ lpfc_##attr##_set(struct lpfc_vport *vport, int val) \
1417} 1417}
1418 1418
1419/** 1419/**
1420 * lpfc_vport_param_store: Set a vport attribute. 1420 * lpfc_vport_param_store - Set a vport attribute
1421 * 1421 *
1422 * Description: 1422 * Description:
1423 * Macro that given an attr e.g. hba_queue_depth 1423 * Macro that given an attr e.g. hba_queue_depth
@@ -1576,7 +1576,7 @@ static DEVICE_ATTR(lpfc_temp_sensor, S_IRUGO, lpfc_temp_sensor_show, NULL);
1576static char *lpfc_soft_wwn_key = "C99G71SL8032A"; 1576static char *lpfc_soft_wwn_key = "C99G71SL8032A";
1577 1577
1578/** 1578/**
1579 * lpfc_soft_wwn_enable_store: Allows setting of the wwn if the key is valid. 1579 * lpfc_soft_wwn_enable_store - Allows setting of the wwn if the key is valid
1580 * @dev: class device that is converted into a Scsi_host. 1580 * @dev: class device that is converted into a Scsi_host.
1581 * @attr: device attribute, not used. 1581 * @attr: device attribute, not used.
1582 * @buf: containing the string lpfc_soft_wwn_key. 1582 * @buf: containing the string lpfc_soft_wwn_key.
@@ -1623,10 +1623,10 @@ static DEVICE_ATTR(lpfc_soft_wwn_enable, S_IWUSR, NULL,
1623 lpfc_soft_wwn_enable_store); 1623 lpfc_soft_wwn_enable_store);
1624 1624
1625/** 1625/**
1626 * lpfc_soft_wwpn_show: Return the cfg soft ww port name of the adapter. 1626 * lpfc_soft_wwpn_show - Return the cfg soft ww port name of the adapter
1627 * @dev: class device that is converted into a Scsi_host. 1627 * @dev: class device that is converted into a Scsi_host.
1628 * @attr: device attribute, not used. 1628 * @attr: device attribute, not used.
1629 * @buf: on return contains the wwpn in hexidecimal. 1629 * @buf: on return contains the wwpn in hexadecimal.
1630 * 1630 *
1631 * Returns: size of formatted string. 1631 * Returns: size of formatted string.
1632 **/ 1632 **/
@@ -1643,10 +1643,10 @@ lpfc_soft_wwpn_show(struct device *dev, struct device_attribute *attr,
1643} 1643}
1644 1644
1645/** 1645/**
1646 * lpfc_soft_wwpn_store: Set the ww port name of the adapter. 1646 * lpfc_soft_wwpn_store - Set the ww port name of the adapter
1647 * @dev class device that is converted into a Scsi_host. 1647 * @dev class device that is converted into a Scsi_host.
1648 * @attr: device attribute, not used. 1648 * @attr: device attribute, not used.
1649 * @buf: contains the wwpn in hexidecimal. 1649 * @buf: contains the wwpn in hexadecimal.
1650 * @count: number of wwpn bytes in buf 1650 * @count: number of wwpn bytes in buf
1651 * 1651 *
1652 * Returns: 1652 * Returns:
@@ -1729,10 +1729,10 @@ static DEVICE_ATTR(lpfc_soft_wwpn, S_IRUGO | S_IWUSR,\
1729 lpfc_soft_wwpn_show, lpfc_soft_wwpn_store); 1729 lpfc_soft_wwpn_show, lpfc_soft_wwpn_store);
1730 1730
1731/** 1731/**
1732 * lpfc_soft_wwnn_show: Return the cfg soft ww node name for the adapter. 1732 * lpfc_soft_wwnn_show - Return the cfg soft ww node name for the adapter
1733 * @dev: class device that is converted into a Scsi_host. 1733 * @dev: class device that is converted into a Scsi_host.
1734 * @attr: device attribute, not used. 1734 * @attr: device attribute, not used.
1735 * @buf: on return contains the wwnn in hexidecimal. 1735 * @buf: on return contains the wwnn in hexadecimal.
1736 * 1736 *
1737 * Returns: size of formatted string. 1737 * Returns: size of formatted string.
1738 **/ 1738 **/
@@ -1747,9 +1747,9 @@ lpfc_soft_wwnn_show(struct device *dev, struct device_attribute *attr,
1747} 1747}
1748 1748
1749/** 1749/**
1750 * lpfc_soft_wwnn_store: sets the ww node name of the adapter. 1750 * lpfc_soft_wwnn_store - sets the ww node name of the adapter
1751 * @cdev: class device that is converted into a Scsi_host. 1751 * @cdev: class device that is converted into a Scsi_host.
1752 * @buf: contains the ww node name in hexidecimal. 1752 * @buf: contains the ww node name in hexadecimal.
1753 * @count: number of wwnn bytes in buf. 1753 * @count: number of wwnn bytes in buf.
1754 * 1754 *
1755 * Returns: 1755 * Returns:
@@ -1845,7 +1845,7 @@ MODULE_PARM_DESC(lpfc_nodev_tmo,
1845 "for a device to come back"); 1845 "for a device to come back");
1846 1846
1847/** 1847/**
1848 * lpfc_nodev_tmo_show: Return the hba dev loss timeout value. 1848 * lpfc_nodev_tmo_show - Return the hba dev loss timeout value
1849 * @dev: class converted to a Scsi_host structure. 1849 * @dev: class converted to a Scsi_host structure.
1850 * @attr: device attribute, not used. 1850 * @attr: device attribute, not used.
1851 * @buf: on return contains the dev loss timeout in decimal. 1851 * @buf: on return contains the dev loss timeout in decimal.
@@ -1864,7 +1864,7 @@ lpfc_nodev_tmo_show(struct device *dev, struct device_attribute *attr,
1864} 1864}
1865 1865
1866/** 1866/**
1867 * lpfc_nodev_tmo_init: Set the hba nodev timeout value. 1867 * lpfc_nodev_tmo_init - Set the hba nodev timeout value
1868 * @vport: lpfc vport structure pointer. 1868 * @vport: lpfc vport structure pointer.
1869 * @val: contains the nodev timeout value. 1869 * @val: contains the nodev timeout value.
1870 * 1870 *
@@ -1905,7 +1905,7 @@ lpfc_nodev_tmo_init(struct lpfc_vport *vport, int val)
1905} 1905}
1906 1906
1907/** 1907/**
1908 * lpfc_update_rport_devloss_tmo: Update dev loss tmo value. 1908 * lpfc_update_rport_devloss_tmo - Update dev loss tmo value
1909 * @vport: lpfc vport structure pointer. 1909 * @vport: lpfc vport structure pointer.
1910 * 1910 *
1911 * Description: 1911 * Description:
@@ -1926,7 +1926,7 @@ lpfc_update_rport_devloss_tmo(struct lpfc_vport *vport)
1926} 1926}
1927 1927
1928/** 1928/**
1929 * lpfc_nodev_tmo_set: Set the vport nodev tmo and devloss tmo values. 1929 * lpfc_nodev_tmo_set - Set the vport nodev tmo and devloss tmo values
1930 * @vport: lpfc vport structure pointer. 1930 * @vport: lpfc vport structure pointer.
1931 * @val: contains the tmo value. 1931 * @val: contains the tmo value.
1932 * 1932 *
@@ -1982,7 +1982,7 @@ lpfc_vport_param_init(devloss_tmo, LPFC_DEF_DEVLOSS_TMO,
1982lpfc_vport_param_show(devloss_tmo) 1982lpfc_vport_param_show(devloss_tmo)
1983 1983
1984/** 1984/**
1985 * lpfc_devloss_tmo_set: Sets vport nodev tmo, devloss tmo values, changed bit. 1985 * lpfc_devloss_tmo_set - Sets vport nodev tmo, devloss tmo values, changed bit
1986 * @vport: lpfc vport structure pointer. 1986 * @vport: lpfc vport structure pointer.
1987 * @val: contains the tmo value. 1987 * @val: contains the tmo value.
1988 * 1988 *
@@ -2094,7 +2094,7 @@ MODULE_PARM_DESC(lpfc_restrict_login,
2094lpfc_vport_param_show(restrict_login); 2094lpfc_vport_param_show(restrict_login);
2095 2095
2096/** 2096/**
2097 * lpfc_restrict_login_init: Set the vport restrict login flag. 2097 * lpfc_restrict_login_init - Set the vport restrict login flag
2098 * @vport: lpfc vport structure pointer. 2098 * @vport: lpfc vport structure pointer.
2099 * @val: contains the restrict login value. 2099 * @val: contains the restrict login value.
2100 * 2100 *
@@ -2128,7 +2128,7 @@ lpfc_restrict_login_init(struct lpfc_vport *vport, int val)
2128} 2128}
2129 2129
2130/** 2130/**
2131 * lpfc_restrict_login_set: Set the vport restrict login flag. 2131 * lpfc_restrict_login_set - Set the vport restrict login flag
2132 * @vport: lpfc vport structure pointer. 2132 * @vport: lpfc vport structure pointer.
2133 * @val: contains the restrict login value. 2133 * @val: contains the restrict login value.
2134 * 2134 *
@@ -2201,7 +2201,7 @@ LPFC_VPORT_ATTR_R(scan_down, 1, 0, 1,
2201*/ 2201*/
2202 2202
2203/** 2203/**
2204 * lpfc_topology_set: Set the adapters topology field. 2204 * lpfc_topology_set - Set the adapters topology field
2205 * @phba: lpfc_hba pointer. 2205 * @phba: lpfc_hba pointer.
2206 * @val: topology value. 2206 * @val: topology value.
2207 * 2207 *
@@ -2216,18 +2216,41 @@ LPFC_VPORT_ATTR_R(scan_down, 1, 0, 1,
2216 * non-zero return value from lpfc_issue_lip() 2216 * non-zero return value from lpfc_issue_lip()
2217 * -EINVAL val out of range 2217 * -EINVAL val out of range
2218 **/ 2218 **/
2219static int 2219static ssize_t
2220lpfc_topology_set(struct lpfc_hba *phba, int val) 2220lpfc_topology_store(struct device *dev, struct device_attribute *attr,
2221 const char *buf, size_t count)
2221{ 2222{
2223 struct Scsi_Host *shost = class_to_shost(dev);
2224 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
2225 struct lpfc_hba *phba = vport->phba;
2226 int val = 0;
2227 int nolip = 0;
2228 const char *val_buf = buf;
2222 int err; 2229 int err;
2223 uint32_t prev_val; 2230 uint32_t prev_val;
2231
2232 if (!strncmp(buf, "nolip ", strlen("nolip "))) {
2233 nolip = 1;
2234 val_buf = &buf[strlen("nolip ")];
2235 }
2236
2237 if (!isdigit(val_buf[0]))
2238 return -EINVAL;
2239 if (sscanf(val_buf, "%i", &val) != 1)
2240 return -EINVAL;
2241
2224 if (val >= 0 && val <= 6) { 2242 if (val >= 0 && val <= 6) {
2225 prev_val = phba->cfg_topology; 2243 prev_val = phba->cfg_topology;
2226 phba->cfg_topology = val; 2244 phba->cfg_topology = val;
2245 if (nolip)
2246 return strlen(buf);
2247
2227 err = lpfc_issue_lip(lpfc_shost_from_vport(phba->pport)); 2248 err = lpfc_issue_lip(lpfc_shost_from_vport(phba->pport));
2228 if (err) 2249 if (err) {
2229 phba->cfg_topology = prev_val; 2250 phba->cfg_topology = prev_val;
2230 return err; 2251 return -EINVAL;
2252 } else
2253 return strlen(buf);
2231 } 2254 }
2232 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 2255 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
2233 "%d:0467 lpfc_topology attribute cannot be set to %d, " 2256 "%d:0467 lpfc_topology attribute cannot be set to %d, "
@@ -2240,14 +2263,12 @@ module_param(lpfc_topology, int, 0);
2240MODULE_PARM_DESC(lpfc_topology, "Select Fibre Channel topology"); 2263MODULE_PARM_DESC(lpfc_topology, "Select Fibre Channel topology");
2241lpfc_param_show(topology) 2264lpfc_param_show(topology)
2242lpfc_param_init(topology, 0, 0, 6) 2265lpfc_param_init(topology, 0, 0, 6)
2243lpfc_param_store(topology)
2244static DEVICE_ATTR(lpfc_topology, S_IRUGO | S_IWUSR, 2266static DEVICE_ATTR(lpfc_topology, S_IRUGO | S_IWUSR,
2245 lpfc_topology_show, lpfc_topology_store); 2267 lpfc_topology_show, lpfc_topology_store);
2246 2268
2247 2269
2248/** 2270/**
2249 * lpfc_stat_data_ctrl_store: write call back for lpfc_stat_data_ctrl 2271 * lpfc_stat_data_ctrl_store - write call back for lpfc_stat_data_ctrl sysfs file
2250 * sysfs file.
2251 * @dev: Pointer to class device. 2272 * @dev: Pointer to class device.
2252 * @buf: Data buffer. 2273 * @buf: Data buffer.
2253 * @count: Size of the data buffer. 2274 * @count: Size of the data buffer.
@@ -2282,7 +2303,7 @@ lpfc_stat_data_ctrl_store(struct device *dev, struct device_attribute *attr,
2282 unsigned long base, step, bucket_type; 2303 unsigned long base, step, bucket_type;
2283 2304
2284 if (!strncmp(buf, "setbucket", strlen("setbucket"))) { 2305 if (!strncmp(buf, "setbucket", strlen("setbucket"))) {
2285 if (strlen(buf) > LPFC_MAX_DATA_CTRL_LEN) 2306 if (strlen(buf) > (LPFC_MAX_DATA_CTRL_LEN - 1))
2286 return -EINVAL; 2307 return -EINVAL;
2287 2308
2288 strcpy(bucket_data, buf); 2309 strcpy(bucket_data, buf);
@@ -2411,8 +2432,7 @@ lpfc_stat_data_ctrl_store(struct device *dev, struct device_attribute *attr,
2411 2432
2412 2433
2413/** 2434/**
2414 * lpfc_stat_data_ctrl_show: Read callback function for 2435 * lpfc_stat_data_ctrl_show - Read function for lpfc_stat_data_ctrl sysfs file
2415 * lpfc_stat_data_ctrl sysfs file.
2416 * @dev: Pointer to class device object. 2436 * @dev: Pointer to class device object.
2417 * @buf: Data buffer. 2437 * @buf: Data buffer.
2418 * 2438 *
@@ -2489,8 +2509,7 @@ static DEVICE_ATTR(lpfc_stat_data_ctrl, S_IRUGO | S_IWUSR,
2489 2509
2490 2510
2491/** 2511/**
2492 * sysfs_drvr_stat_data_read: Read callback function for lpfc_drvr_stat_data 2512 * sysfs_drvr_stat_data_read - Read function for lpfc_drvr_stat_data attribute
2493 * sysfs attribute.
2494 * @kobj: Pointer to the kernel object 2513 * @kobj: Pointer to the kernel object
2495 * @bin_attr: Attribute object 2514 * @bin_attr: Attribute object
2496 * @buff: Buffer pointer 2515 * @buff: Buffer pointer
@@ -2585,7 +2604,7 @@ static struct bin_attribute sysfs_drvr_stat_data_attr = {
2585*/ 2604*/
2586 2605
2587/** 2606/**
2588 * lpfc_link_speed_set: Set the adapters link speed. 2607 * lpfc_link_speed_set - Set the adapters link speed
2589 * @phba: lpfc_hba pointer. 2608 * @phba: lpfc_hba pointer.
2590 * @val: link speed value. 2609 * @val: link speed value.
2591 * 2610 *
@@ -2601,12 +2620,29 @@ static struct bin_attribute sysfs_drvr_stat_data_attr = {
2601 * non-zero return value from lpfc_issue_lip() 2620 * non-zero return value from lpfc_issue_lip()
2602 * -EINVAL val out of range 2621 * -EINVAL val out of range
2603 **/ 2622 **/
2604static int 2623static ssize_t
2605lpfc_link_speed_set(struct lpfc_hba *phba, int val) 2624lpfc_link_speed_store(struct device *dev, struct device_attribute *attr,
2625 const char *buf, size_t count)
2606{ 2626{
2627 struct Scsi_Host *shost = class_to_shost(dev);
2628 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
2629 struct lpfc_hba *phba = vport->phba;
2630 int val = 0;
2631 int nolip = 0;
2632 const char *val_buf = buf;
2607 int err; 2633 int err;
2608 uint32_t prev_val; 2634 uint32_t prev_val;
2609 2635
2636 if (!strncmp(buf, "nolip ", strlen("nolip "))) {
2637 nolip = 1;
2638 val_buf = &buf[strlen("nolip ")];
2639 }
2640
2641 if (!isdigit(val_buf[0]))
2642 return -EINVAL;
2643 if (sscanf(val_buf, "%i", &val) != 1)
2644 return -EINVAL;
2645
2610 if (((val == LINK_SPEED_1G) && !(phba->lmt & LMT_1Gb)) || 2646 if (((val == LINK_SPEED_1G) && !(phba->lmt & LMT_1Gb)) ||
2611 ((val == LINK_SPEED_2G) && !(phba->lmt & LMT_2Gb)) || 2647 ((val == LINK_SPEED_2G) && !(phba->lmt & LMT_2Gb)) ||
2612 ((val == LINK_SPEED_4G) && !(phba->lmt & LMT_4Gb)) || 2648 ((val == LINK_SPEED_4G) && !(phba->lmt & LMT_4Gb)) ||
@@ -2614,14 +2650,19 @@ lpfc_link_speed_set(struct lpfc_hba *phba, int val)
2614 ((val == LINK_SPEED_10G) && !(phba->lmt & LMT_10Gb))) 2650 ((val == LINK_SPEED_10G) && !(phba->lmt & LMT_10Gb)))
2615 return -EINVAL; 2651 return -EINVAL;
2616 2652
2617 if ((val >= 0 && val <= LPFC_MAX_LINK_SPEED) 2653 if ((val >= 0 && val <= 8)
2618 && (LPFC_LINK_SPEED_BITMAP & (1 << val))) { 2654 && (LPFC_LINK_SPEED_BITMAP & (1 << val))) {
2619 prev_val = phba->cfg_link_speed; 2655 prev_val = phba->cfg_link_speed;
2620 phba->cfg_link_speed = val; 2656 phba->cfg_link_speed = val;
2657 if (nolip)
2658 return strlen(buf);
2659
2621 err = lpfc_issue_lip(lpfc_shost_from_vport(phba->pport)); 2660 err = lpfc_issue_lip(lpfc_shost_from_vport(phba->pport));
2622 if (err) 2661 if (err) {
2623 phba->cfg_link_speed = prev_val; 2662 phba->cfg_link_speed = prev_val;
2624 return err; 2663 return -EINVAL;
2664 } else
2665 return strlen(buf);
2625 } 2666 }
2626 2667
2627 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 2668 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
@@ -2637,7 +2678,7 @@ MODULE_PARM_DESC(lpfc_link_speed, "Select link speed");
2637lpfc_param_show(link_speed) 2678lpfc_param_show(link_speed)
2638 2679
2639/** 2680/**
2640 * lpfc_link_speed_init: Set the adapters link speed. 2681 * lpfc_link_speed_init - Set the adapters link speed
2641 * @phba: lpfc_hba pointer. 2682 * @phba: lpfc_hba pointer.
2642 * @val: link speed value. 2683 * @val: link speed value.
2643 * 2684 *
@@ -2668,7 +2709,6 @@ lpfc_link_speed_init(struct lpfc_hba *phba, int val)
2668 return -EINVAL; 2709 return -EINVAL;
2669} 2710}
2670 2711
2671lpfc_param_store(link_speed)
2672static DEVICE_ATTR(lpfc_link_speed, S_IRUGO | S_IWUSR, 2712static DEVICE_ATTR(lpfc_link_speed, S_IRUGO | S_IWUSR,
2673 lpfc_link_speed_show, lpfc_link_speed_store); 2713 lpfc_link_speed_show, lpfc_link_speed_store);
2674 2714
@@ -2865,7 +2905,7 @@ MODULE_PARM_DESC(lpfc_prot_guard, "host protection guard type");
2865 2905
2866 2906
2867/* 2907/*
2868 * lpfc_sg_seg_cnt: Initial Maximum DMA Segment Count 2908 * lpfc_sg_seg_cnt - Initial Maximum DMA Segment Count
2869 * This value can be set to values between 64 and 256. The default value is 2909 * This value can be set to values between 64 and 256. The default value is
2870 * 64, but may be increased to allow for larger Max I/O sizes. The scsi layer 2910 * 64, but may be increased to allow for larger Max I/O sizes. The scsi layer
2871 * will be allowed to request I/Os of sizes up to (MAX_SEG_COUNT * SEG_SIZE). 2911 * will be allowed to request I/Os of sizes up to (MAX_SEG_COUNT * SEG_SIZE).
@@ -2967,7 +3007,7 @@ struct device_attribute *lpfc_vport_attrs[] = {
2967}; 3007};
2968 3008
2969/** 3009/**
2970 * sysfs_ctlreg_write: Write method for writing to ctlreg. 3010 * sysfs_ctlreg_write - Write method for writing to ctlreg
2971 * @kobj: kernel kobject that contains the kernel class device. 3011 * @kobj: kernel kobject that contains the kernel class device.
2972 * @bin_attr: kernel attributes passed to us. 3012 * @bin_attr: kernel attributes passed to us.
2973 * @buf: contains the data to be written to the adapter IOREG space. 3013 * @buf: contains the data to be written to the adapter IOREG space.
@@ -3017,7 +3057,7 @@ sysfs_ctlreg_write(struct kobject *kobj, struct bin_attribute *bin_attr,
3017} 3057}
3018 3058
3019/** 3059/**
3020 * sysfs_ctlreg_read: Read method for reading from ctlreg. 3060 * sysfs_ctlreg_read - Read method for reading from ctlreg
3021 * @kobj: kernel kobject that contains the kernel class device. 3061 * @kobj: kernel kobject that contains the kernel class device.
3022 * @bin_attr: kernel attributes passed to us. 3062 * @bin_attr: kernel attributes passed to us.
3023 * @buf: if succesful contains the data from the adapter IOREG space. 3063 * @buf: if succesful contains the data from the adapter IOREG space.
@@ -3078,7 +3118,7 @@ static struct bin_attribute sysfs_ctlreg_attr = {
3078}; 3118};
3079 3119
3080/** 3120/**
3081 * sysfs_mbox_idle: frees the sysfs mailbox. 3121 * sysfs_mbox_idle - frees the sysfs mailbox
3082 * @phba: lpfc_hba pointer 3122 * @phba: lpfc_hba pointer
3083 **/ 3123 **/
3084static void 3124static void
@@ -3095,7 +3135,7 @@ sysfs_mbox_idle(struct lpfc_hba *phba)
3095} 3135}
3096 3136
3097/** 3137/**
3098 * sysfs_mbox_write: Write method for writing information via mbox. 3138 * sysfs_mbox_write - Write method for writing information via mbox
3099 * @kobj: kernel kobject that contains the kernel class device. 3139 * @kobj: kernel kobject that contains the kernel class device.
3100 * @bin_attr: kernel attributes passed to us. 3140 * @bin_attr: kernel attributes passed to us.
3101 * @buf: contains the data to be written to sysfs mbox. 3141 * @buf: contains the data to be written to sysfs mbox.
@@ -3170,7 +3210,7 @@ sysfs_mbox_write(struct kobject *kobj, struct bin_attribute *bin_attr,
3170} 3210}
3171 3211
3172/** 3212/**
3173 * sysfs_mbox_read: Read method for reading information via mbox. 3213 * sysfs_mbox_read - Read method for reading information via mbox
3174 * @kobj: kernel kobject that contains the kernel class device. 3214 * @kobj: kernel kobject that contains the kernel class device.
3175 * @bin_attr: kernel attributes passed to us. 3215 * @bin_attr: kernel attributes passed to us.
3176 * @buf: contains the data to be read from sysfs mbox. 3216 * @buf: contains the data to be read from sysfs mbox.
@@ -3374,7 +3414,7 @@ static struct bin_attribute sysfs_mbox_attr = {
3374}; 3414};
3375 3415
3376/** 3416/**
3377 * lpfc_alloc_sysfs_attr: Creates the ctlreg and mbox entries. 3417 * lpfc_alloc_sysfs_attr - Creates the ctlreg and mbox entries
3378 * @vport: address of lpfc vport structure. 3418 * @vport: address of lpfc vport structure.
3379 * 3419 *
3380 * Return codes: 3420 * Return codes:
@@ -3415,7 +3455,7 @@ out:
3415} 3455}
3416 3456
3417/** 3457/**
3418 * lpfc_free_sysfs_attr: Removes the ctlreg and mbox entries. 3458 * lpfc_free_sysfs_attr - Removes the ctlreg and mbox entries
3419 * @vport: address of lpfc vport structure. 3459 * @vport: address of lpfc vport structure.
3420 **/ 3460 **/
3421void 3461void
@@ -3437,7 +3477,7 @@ lpfc_free_sysfs_attr(struct lpfc_vport *vport)
3437 */ 3477 */
3438 3478
3439/** 3479/**
3440 * lpfc_get_host_port_id: Copy the vport DID into the scsi host port id. 3480 * lpfc_get_host_port_id - Copy the vport DID into the scsi host port id
3441 * @shost: kernel scsi host pointer. 3481 * @shost: kernel scsi host pointer.
3442 **/ 3482 **/
3443static void 3483static void
@@ -3450,7 +3490,7 @@ lpfc_get_host_port_id(struct Scsi_Host *shost)
3450} 3490}
3451 3491
3452/** 3492/**
3453 * lpfc_get_host_port_type: Set the value of the scsi host port type. 3493 * lpfc_get_host_port_type - Set the value of the scsi host port type
3454 * @shost: kernel scsi host pointer. 3494 * @shost: kernel scsi host pointer.
3455 **/ 3495 **/
3456static void 3496static void
@@ -3482,7 +3522,7 @@ lpfc_get_host_port_type(struct Scsi_Host *shost)
3482} 3522}
3483 3523
3484/** 3524/**
3485 * lpfc_get_host_port_state: Set the value of the scsi host port state. 3525 * lpfc_get_host_port_state - Set the value of the scsi host port state
3486 * @shost: kernel scsi host pointer. 3526 * @shost: kernel scsi host pointer.
3487 **/ 3527 **/
3488static void 3528static void
@@ -3520,7 +3560,7 @@ lpfc_get_host_port_state(struct Scsi_Host *shost)
3520} 3560}
3521 3561
3522/** 3562/**
3523 * lpfc_get_host_speed: Set the value of the scsi host speed. 3563 * lpfc_get_host_speed - Set the value of the scsi host speed
3524 * @shost: kernel scsi host pointer. 3564 * @shost: kernel scsi host pointer.
3525 **/ 3565 **/
3526static void 3566static void
@@ -3556,7 +3596,7 @@ lpfc_get_host_speed(struct Scsi_Host *shost)
3556} 3596}
3557 3597
3558/** 3598/**
3559 * lpfc_get_host_fabric_name: Set the value of the scsi host fabric name. 3599 * lpfc_get_host_fabric_name - Set the value of the scsi host fabric name
3560 * @shost: kernel scsi host pointer. 3600 * @shost: kernel scsi host pointer.
3561 **/ 3601 **/
3562static void 3602static void
@@ -3582,7 +3622,7 @@ lpfc_get_host_fabric_name (struct Scsi_Host *shost)
3582} 3622}
3583 3623
3584/** 3624/**
3585 * lpfc_get_stats: Return statistical information about the adapter. 3625 * lpfc_get_stats - Return statistical information about the adapter
3586 * @shost: kernel scsi host pointer. 3626 * @shost: kernel scsi host pointer.
3587 * 3627 *
3588 * Notes: 3628 * Notes:
@@ -3707,7 +3747,7 @@ lpfc_get_stats(struct Scsi_Host *shost)
3707} 3747}
3708 3748
3709/** 3749/**
3710 * lpfc_reset_stats: Copy the adapter link stats information. 3750 * lpfc_reset_stats - Copy the adapter link stats information
3711 * @shost: kernel scsi host pointer. 3751 * @shost: kernel scsi host pointer.
3712 **/ 3752 **/
3713static void 3753static void
@@ -3788,7 +3828,7 @@ lpfc_reset_stats(struct Scsi_Host *shost)
3788 */ 3828 */
3789 3829
3790/** 3830/**
3791 * lpfc_get_node_by_target: Return the nodelist for a target. 3831 * lpfc_get_node_by_target - Return the nodelist for a target
3792 * @starget: kernel scsi target pointer. 3832 * @starget: kernel scsi target pointer.
3793 * 3833 *
3794 * Returns: 3834 * Returns:
@@ -3817,7 +3857,7 @@ lpfc_get_node_by_target(struct scsi_target *starget)
3817} 3857}
3818 3858
3819/** 3859/**
3820 * lpfc_get_starget_port_id: Set the target port id to the ndlp DID or -1. 3860 * lpfc_get_starget_port_id - Set the target port id to the ndlp DID or -1
3821 * @starget: kernel scsi target pointer. 3861 * @starget: kernel scsi target pointer.
3822 **/ 3862 **/
3823static void 3863static void
@@ -3829,7 +3869,7 @@ lpfc_get_starget_port_id(struct scsi_target *starget)
3829} 3869}
3830 3870
3831/** 3871/**
3832 * lpfc_get_starget_node_name: Set the target node name. 3872 * lpfc_get_starget_node_name - Set the target node name
3833 * @starget: kernel scsi target pointer. 3873 * @starget: kernel scsi target pointer.
3834 * 3874 *
3835 * Description: Set the target node name to the ndlp node name wwn or zero. 3875 * Description: Set the target node name to the ndlp node name wwn or zero.
@@ -3844,7 +3884,7 @@ lpfc_get_starget_node_name(struct scsi_target *starget)
3844} 3884}
3845 3885
3846/** 3886/**
3847 * lpfc_get_starget_port_name: Set the target port name. 3887 * lpfc_get_starget_port_name - Set the target port name
3848 * @starget: kernel scsi target pointer. 3888 * @starget: kernel scsi target pointer.
3849 * 3889 *
3850 * Description: set the target port name to the ndlp port name wwn or zero. 3890 * Description: set the target port name to the ndlp port name wwn or zero.
@@ -3859,7 +3899,7 @@ lpfc_get_starget_port_name(struct scsi_target *starget)
3859} 3899}
3860 3900
3861/** 3901/**
3862 * lpfc_set_rport_loss_tmo: Set the rport dev loss tmo. 3902 * lpfc_set_rport_loss_tmo - Set the rport dev loss tmo
3863 * @rport: fc rport address. 3903 * @rport: fc rport address.
3864 * @timeout: new value for dev loss tmo. 3904 * @timeout: new value for dev loss tmo.
3865 * 3905 *
@@ -3877,7 +3917,7 @@ lpfc_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout)
3877} 3917}
3878 3918
3879/** 3919/**
3880 * lpfc_rport_show_function: Return rport target information. 3920 * lpfc_rport_show_function - Return rport target information
3881 * 3921 *
3882 * Description: 3922 * Description:
3883 * Macro that uses field to generate a function with the name lpfc_show_rport_ 3923 * Macro that uses field to generate a function with the name lpfc_show_rport_
@@ -3905,7 +3945,7 @@ lpfc_show_rport_##field (struct device *dev, \
3905static FC_RPORT_ATTR(field, S_IRUGO, lpfc_show_rport_##field, NULL) 3945static FC_RPORT_ATTR(field, S_IRUGO, lpfc_show_rport_##field, NULL)
3906 3946
3907/** 3947/**
3908 * lpfc_set_vport_symbolic_name: Set the vport's symbolic name. 3948 * lpfc_set_vport_symbolic_name - Set the vport's symbolic name
3909 * @fc_vport: The fc_vport who's symbolic name has been changed. 3949 * @fc_vport: The fc_vport who's symbolic name has been changed.
3910 * 3950 *
3911 * Description: 3951 * Description:
@@ -4048,7 +4088,7 @@ struct fc_function_template lpfc_vport_transport_functions = {
4048}; 4088};
4049 4089
4050/** 4090/**
4051 * lpfc_get_cfgparam: Used during probe_one to init the adapter structure. 4091 * lpfc_get_cfgparam - Used during probe_one to init the adapter structure
4052 * @phba: lpfc_hba pointer. 4092 * @phba: lpfc_hba pointer.
4053 **/ 4093 **/
4054void 4094void
@@ -4097,7 +4137,7 @@ lpfc_get_cfgparam(struct lpfc_hba *phba)
4097} 4137}
4098 4138
4099/** 4139/**
4100 * lpfc_get_vport_cfgparam: Used during port create, init the vport structure. 4140 * lpfc_get_vport_cfgparam - Used during port create, init the vport structure
4101 * @vport: lpfc_vport pointer. 4141 * @vport: lpfc_vport pointer.
4102 **/ 4142 **/
4103void 4143void
diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h
index 07f4976319a..f88ce3f2619 100644
--- a/drivers/scsi/lpfc/lpfc_crtn.h
+++ b/drivers/scsi/lpfc/lpfc_crtn.h
@@ -184,6 +184,8 @@ void lpfc_sli_poll_fcp_ring(struct lpfc_hba *);
184struct lpfc_iocbq * lpfc_sli_get_iocbq(struct lpfc_hba *); 184struct lpfc_iocbq * lpfc_sli_get_iocbq(struct lpfc_hba *);
185void lpfc_sli_release_iocbq(struct lpfc_hba *, struct lpfc_iocbq *); 185void lpfc_sli_release_iocbq(struct lpfc_hba *, struct lpfc_iocbq *);
186uint16_t lpfc_sli_next_iotag(struct lpfc_hba *, struct lpfc_iocbq *); 186uint16_t lpfc_sli_next_iotag(struct lpfc_hba *, struct lpfc_iocbq *);
187void lpfc_sli_cancel_iocbs(struct lpfc_hba *, struct list_head *, uint32_t,
188 uint32_t);
187 189
188void lpfc_reset_barrier(struct lpfc_hba * phba); 190void lpfc_reset_barrier(struct lpfc_hba * phba);
189int lpfc_sli_brdready(struct lpfc_hba *, uint32_t); 191int lpfc_sli_brdready(struct lpfc_hba *, uint32_t);
diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c
index 81cdcf46c47..52be5644e07 100644
--- a/drivers/scsi/lpfc/lpfc_debugfs.c
+++ b/drivers/scsi/lpfc/lpfc_debugfs.c
@@ -47,7 +47,7 @@
47#include "lpfc_debugfs.h" 47#include "lpfc_debugfs.h"
48 48
49#ifdef CONFIG_SCSI_LPFC_DEBUG_FS 49#ifdef CONFIG_SCSI_LPFC_DEBUG_FS
50/** 50/*
51 * debugfs interface 51 * debugfs interface
52 * 52 *
53 * To access this interface the user should: 53 * To access this interface the user should:
@@ -95,7 +95,7 @@ module_param(lpfc_debugfs_max_slow_ring_trc, int, 0);
95MODULE_PARM_DESC(lpfc_debugfs_max_slow_ring_trc, 95MODULE_PARM_DESC(lpfc_debugfs_max_slow_ring_trc,
96 "Set debugfs slow ring trace depth"); 96 "Set debugfs slow ring trace depth");
97 97
98int lpfc_debugfs_mask_disc_trc; 98static int lpfc_debugfs_mask_disc_trc;
99module_param(lpfc_debugfs_mask_disc_trc, int, 0); 99module_param(lpfc_debugfs_mask_disc_trc, int, 0);
100MODULE_PARM_DESC(lpfc_debugfs_mask_disc_trc, 100MODULE_PARM_DESC(lpfc_debugfs_mask_disc_trc,
101 "Set debugfs discovery trace mask"); 101 "Set debugfs discovery trace mask");
@@ -127,7 +127,7 @@ static atomic_t lpfc_debugfs_seq_trc_cnt = ATOMIC_INIT(0);
127static unsigned long lpfc_debugfs_start_time = 0L; 127static unsigned long lpfc_debugfs_start_time = 0L;
128 128
129/** 129/**
130 * lpfc_debugfs_disc_trc_data - Dump discovery logging to a buffer. 130 * lpfc_debugfs_disc_trc_data - Dump discovery logging to a buffer
131 * @vport: The vport to gather the log info from. 131 * @vport: The vport to gather the log info from.
132 * @buf: The buffer to dump log into. 132 * @buf: The buffer to dump log into.
133 * @size: The maximum amount of data to process. 133 * @size: The maximum amount of data to process.
@@ -187,7 +187,7 @@ lpfc_debugfs_disc_trc_data(struct lpfc_vport *vport, char *buf, int size)
187} 187}
188 188
189/** 189/**
190 * lpfc_debugfs_slow_ring_trc_data - Dump slow ring logging to a buffer. 190 * lpfc_debugfs_slow_ring_trc_data - Dump slow ring logging to a buffer
191 * @phba: The HBA to gather the log info from. 191 * @phba: The HBA to gather the log info from.
192 * @buf: The buffer to dump log into. 192 * @buf: The buffer to dump log into.
193 * @size: The maximum amount of data to process. 193 * @size: The maximum amount of data to process.
@@ -250,7 +250,7 @@ lpfc_debugfs_slow_ring_trc_data(struct lpfc_hba *phba, char *buf, int size)
250static int lpfc_debugfs_last_hbq = -1; 250static int lpfc_debugfs_last_hbq = -1;
251 251
252/** 252/**
253 * lpfc_debugfs_hbqinfo_data - Dump host buffer queue info to a buffer. 253 * lpfc_debugfs_hbqinfo_data - Dump host buffer queue info to a buffer
254 * @phba: The HBA to gather host buffer info from. 254 * @phba: The HBA to gather host buffer info from.
255 * @buf: The buffer to dump log into. 255 * @buf: The buffer to dump log into.
256 * @size: The maximum amount of data to process. 256 * @size: The maximum amount of data to process.
@@ -369,7 +369,7 @@ skipit:
369static int lpfc_debugfs_last_hba_slim_off; 369static int lpfc_debugfs_last_hba_slim_off;
370 370
371/** 371/**
372 * lpfc_debugfs_dumpHBASlim_data - Dump HBA SLIM info to a buffer. 372 * lpfc_debugfs_dumpHBASlim_data - Dump HBA SLIM info to a buffer
373 * @phba: The HBA to gather SLIM info from. 373 * @phba: The HBA to gather SLIM info from.
374 * @buf: The buffer to dump log into. 374 * @buf: The buffer to dump log into.
375 * @size: The maximum amount of data to process. 375 * @size: The maximum amount of data to process.
@@ -399,8 +399,7 @@ lpfc_debugfs_dumpHBASlim_data(struct lpfc_hba *phba, char *buf, int size)
399 399
400 len += snprintf(buf+len, size-len, "HBA SLIM\n"); 400 len += snprintf(buf+len, size-len, "HBA SLIM\n");
401 lpfc_memcpy_from_slim(buffer, 401 lpfc_memcpy_from_slim(buffer,
402 ((uint8_t *)phba->MBslimaddr) + lpfc_debugfs_last_hba_slim_off, 402 phba->MBslimaddr + lpfc_debugfs_last_hba_slim_off, 1024);
403 1024);
404 403
405 ptr = (uint32_t *)&buffer[0]; 404 ptr = (uint32_t *)&buffer[0];
406 off = lpfc_debugfs_last_hba_slim_off; 405 off = lpfc_debugfs_last_hba_slim_off;
@@ -426,7 +425,7 @@ lpfc_debugfs_dumpHBASlim_data(struct lpfc_hba *phba, char *buf, int size)
426} 425}
427 426
428/** 427/**
429 * lpfc_debugfs_dumpHostSlim_data - Dump host SLIM info to a buffer. 428 * lpfc_debugfs_dumpHostSlim_data - Dump host SLIM info to a buffer
430 * @phba: The HBA to gather Host SLIM info from. 429 * @phba: The HBA to gather Host SLIM info from.
431 * @buf: The buffer to dump log into. 430 * @buf: The buffer to dump log into.
432 * @size: The maximum amount of data to process. 431 * @size: The maximum amount of data to process.
@@ -501,7 +500,7 @@ lpfc_debugfs_dumpHostSlim_data(struct lpfc_hba *phba, char *buf, int size)
501} 500}
502 501
503/** 502/**
504 * lpfc_debugfs_nodelist_data - Dump target node list to a buffer. 503 * lpfc_debugfs_nodelist_data - Dump target node list to a buffer
505 * @vport: The vport to gather target node info from. 504 * @vport: The vport to gather target node info from.
506 * @buf: The buffer to dump log into. 505 * @buf: The buffer to dump log into.
507 * @size: The maximum amount of data to process. 506 * @size: The maximum amount of data to process.
@@ -599,7 +598,7 @@ lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size)
599#endif 598#endif
600 599
601/** 600/**
602 * lpfc_debugfs_disc_trc - Store discovery trace log. 601 * lpfc_debugfs_disc_trc - Store discovery trace log
603 * @vport: The vport to associate this trace string with for retrieval. 602 * @vport: The vport to associate this trace string with for retrieval.
604 * @mask: Log entry classification. 603 * @mask: Log entry classification.
605 * @fmt: Format string to be displayed when dumping the log. 604 * @fmt: Format string to be displayed when dumping the log.
@@ -643,7 +642,7 @@ lpfc_debugfs_disc_trc(struct lpfc_vport *vport, int mask, char *fmt,
643} 642}
644 643
645/** 644/**
646 * lpfc_debugfs_slow_ring_trc - Store slow ring trace log. 645 * lpfc_debugfs_slow_ring_trc - Store slow ring trace log
647 * @phba: The phba to associate this trace string with for retrieval. 646 * @phba: The phba to associate this trace string with for retrieval.
648 * @fmt: Format string to be displayed when dumping the log. 647 * @fmt: Format string to be displayed when dumping the log.
649 * @data1: 1st data parameter to be applied to @fmt. 648 * @data1: 1st data parameter to be applied to @fmt.
@@ -682,7 +681,7 @@ lpfc_debugfs_slow_ring_trc(struct lpfc_hba *phba, char *fmt,
682 681
683#ifdef CONFIG_SCSI_LPFC_DEBUG_FS 682#ifdef CONFIG_SCSI_LPFC_DEBUG_FS
684/** 683/**
685 * lpfc_debugfs_disc_trc_open - Open the discovery trace log. 684 * lpfc_debugfs_disc_trc_open - Open the discovery trace log
686 * @inode: The inode pointer that contains a vport pointer. 685 * @inode: The inode pointer that contains a vport pointer.
687 * @file: The file pointer to attach the log output. 686 * @file: The file pointer to attach the log output.
688 * 687 *
@@ -732,7 +731,7 @@ out:
732} 731}
733 732
734/** 733/**
735 * lpfc_debugfs_slow_ring_trc_open - Open the Slow Ring trace log. 734 * lpfc_debugfs_slow_ring_trc_open - Open the Slow Ring trace log
736 * @inode: The inode pointer that contains a vport pointer. 735 * @inode: The inode pointer that contains a vport pointer.
737 * @file: The file pointer to attach the log output. 736 * @file: The file pointer to attach the log output.
738 * 737 *
@@ -782,7 +781,7 @@ out:
782} 781}
783 782
784/** 783/**
785 * lpfc_debugfs_hbqinfo_open - Open the hbqinfo debugfs buffer. 784 * lpfc_debugfs_hbqinfo_open - Open the hbqinfo debugfs buffer
786 * @inode: The inode pointer that contains a vport pointer. 785 * @inode: The inode pointer that contains a vport pointer.
787 * @file: The file pointer to attach the log output. 786 * @file: The file pointer to attach the log output.
788 * 787 *
@@ -824,7 +823,7 @@ out:
824} 823}
825 824
826/** 825/**
827 * lpfc_debugfs_dumpHBASlim_open - Open the Dump HBA SLIM debugfs buffer. 826 * lpfc_debugfs_dumpHBASlim_open - Open the Dump HBA SLIM debugfs buffer
828 * @inode: The inode pointer that contains a vport pointer. 827 * @inode: The inode pointer that contains a vport pointer.
829 * @file: The file pointer to attach the log output. 828 * @file: The file pointer to attach the log output.
830 * 829 *
@@ -866,7 +865,7 @@ out:
866} 865}
867 866
868/** 867/**
869 * lpfc_debugfs_dumpHostSlim_open - Open the Dump Host SLIM debugfs buffer. 868 * lpfc_debugfs_dumpHostSlim_open - Open the Dump Host SLIM debugfs buffer
870 * @inode: The inode pointer that contains a vport pointer. 869 * @inode: The inode pointer that contains a vport pointer.
871 * @file: The file pointer to attach the log output. 870 * @file: The file pointer to attach the log output.
872 * 871 *
@@ -993,7 +992,7 @@ lpfc_debugfs_dumpDataDif_write(struct file *file, const char __user *buf,
993 992
994 993
995/** 994/**
996 * lpfc_debugfs_nodelist_open - Open the nodelist debugfs file. 995 * lpfc_debugfs_nodelist_open - Open the nodelist debugfs file
997 * @inode: The inode pointer that contains a vport pointer. 996 * @inode: The inode pointer that contains a vport pointer.
998 * @file: The file pointer to attach the log output. 997 * @file: The file pointer to attach the log output.
999 * 998 *
@@ -1035,7 +1034,7 @@ out:
1035} 1034}
1036 1035
1037/** 1036/**
1038 * lpfc_debugfs_lseek - Seek through a debugfs file. 1037 * lpfc_debugfs_lseek - Seek through a debugfs file
1039 * @file: The file pointer to seek through. 1038 * @file: The file pointer to seek through.
1040 * @off: The offset to seek to or the amount to seek by. 1039 * @off: The offset to seek to or the amount to seek by.
1041 * @whence: Indicates how to seek. 1040 * @whence: Indicates how to seek.
@@ -1073,7 +1072,7 @@ lpfc_debugfs_lseek(struct file *file, loff_t off, int whence)
1073} 1072}
1074 1073
1075/** 1074/**
1076 * lpfc_debugfs_read - Read a debugfs file. 1075 * lpfc_debugfs_read - Read a debugfs file
1077 * @file: The file pointer to read from. 1076 * @file: The file pointer to read from.
1078 * @buf: The buffer to copy the data to. 1077 * @buf: The buffer to copy the data to.
1079 * @nbytes: The number of bytes to read. 1078 * @nbytes: The number of bytes to read.
@@ -1098,7 +1097,7 @@ lpfc_debugfs_read(struct file *file, char __user *buf,
1098} 1097}
1099 1098
1100/** 1099/**
1101 * lpfc_debugfs_release - Release the buffer used to store debugfs file data. 1100 * lpfc_debugfs_release - Release the buffer used to store debugfs file data
1102 * @inode: The inode pointer that contains a vport pointer. (unused) 1101 * @inode: The inode pointer that contains a vport pointer. (unused)
1103 * @file: The file pointer that contains the buffer to release. 1102 * @file: The file pointer that contains the buffer to release.
1104 * 1103 *
@@ -1210,7 +1209,7 @@ static atomic_t lpfc_debugfs_hba_count;
1210#endif 1209#endif
1211 1210
1212/** 1211/**
1213 * lpfc_debugfs_initialize - Initialize debugfs for a vport. 1212 * lpfc_debugfs_initialize - Initialize debugfs for a vport
1214 * @vport: The vport pointer to initialize. 1213 * @vport: The vport pointer to initialize.
1215 * 1214 *
1216 * Description: 1215 * Description:
@@ -1434,7 +1433,7 @@ debug_failed:
1434} 1433}
1435 1434
1436/** 1435/**
1437 * lpfc_debugfs_terminate - Tear down debugfs infrastructure for this vport. 1436 * lpfc_debugfs_terminate - Tear down debugfs infrastructure for this vport
1438 * @vport: The vport pointer to remove from debugfs. 1437 * @vport: The vport pointer to remove from debugfs.
1439 * 1438 *
1440 * Description: 1439 * Description:
diff --git a/drivers/scsi/lpfc/lpfc_disc.h b/drivers/scsi/lpfc/lpfc_disc.h
index f29e548a90d..ffd10897207 100644
--- a/drivers/scsi/lpfc/lpfc_disc.h
+++ b/drivers/scsi/lpfc/lpfc_disc.h
@@ -99,6 +99,7 @@ struct lpfc_nodelist {
99#define NLP_USG_FREE_ACK_BIT 0x8 /* Indicate ndlp memory free invoked */ 99#define NLP_USG_FREE_ACK_BIT 0x8 /* Indicate ndlp memory free invoked */
100 100
101 struct timer_list nlp_delayfunc; /* Used for delayed ELS cmds */ 101 struct timer_list nlp_delayfunc; /* Used for delayed ELS cmds */
102 struct lpfc_hba *phba;
102 struct fc_rport *rport; /* Corresponding FC transport 103 struct fc_rport *rport; /* Corresponding FC transport
103 port structure */ 104 port structure */
104 struct lpfc_vport *vport; 105 struct lpfc_vport *vport;
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index a7302480bc4..b8b34cf5c3d 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -55,7 +55,7 @@ static void lpfc_register_new_vport(struct lpfc_hba *phba,
55static int lpfc_max_els_tries = 3; 55static int lpfc_max_els_tries = 3;
56 56
57/** 57/**
58 * lpfc_els_chk_latt: Check host link attention event for a vport. 58 * lpfc_els_chk_latt - Check host link attention event for a vport
59 * @vport: pointer to a host virtual N_Port data structure. 59 * @vport: pointer to a host virtual N_Port data structure.
60 * 60 *
61 * This routine checks whether there is an outstanding host link 61 * This routine checks whether there is an outstanding host link
@@ -116,7 +116,7 @@ lpfc_els_chk_latt(struct lpfc_vport *vport)
116} 116}
117 117
118/** 118/**
119 * lpfc_prep_els_iocb: Allocate and prepare a lpfc iocb data structure. 119 * lpfc_prep_els_iocb - Allocate and prepare a lpfc iocb data structure
120 * @vport: pointer to a host virtual N_Port data structure. 120 * @vport: pointer to a host virtual N_Port data structure.
121 * @expectRsp: flag indicating whether response is expected. 121 * @expectRsp: flag indicating whether response is expected.
122 * @cmdSize: size of the ELS command. 122 * @cmdSize: size of the ELS command.
@@ -290,7 +290,7 @@ els_iocb_free_pcmb_exit:
290} 290}
291 291
292/** 292/**
293 * lpfc_issue_fabric_reglogin: Issue fabric registration login for a vport. 293 * lpfc_issue_fabric_reglogin - Issue fabric registration login for a vport
294 * @vport: pointer to a host virtual N_Port data structure. 294 * @vport: pointer to a host virtual N_Port data structure.
295 * 295 *
296 * This routine issues a fabric registration login for a @vport. An 296 * This routine issues a fabric registration login for a @vport. An
@@ -386,7 +386,7 @@ fail:
386} 386}
387 387
388/** 388/**
389 * lpfc_cmpl_els_flogi_fabric: Completion function for flogi to a fabric port. 389 * lpfc_cmpl_els_flogi_fabric - Completion function for flogi to a fabric port
390 * @vport: pointer to a host virtual N_Port data structure. 390 * @vport: pointer to a host virtual N_Port data structure.
391 * @ndlp: pointer to a node-list data structure. 391 * @ndlp: pointer to a node-list data structure.
392 * @sp: pointer to service parameter data structure. 392 * @sp: pointer to service parameter data structure.
@@ -509,7 +509,7 @@ lpfc_cmpl_els_flogi_fabric(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
509} 509}
510 510
511/** 511/**
512 * lpfc_cmpl_els_flogi_nport: Completion function for flogi to an N_Port. 512 * lpfc_cmpl_els_flogi_nport - Completion function for flogi to an N_Port
513 * @vport: pointer to a host virtual N_Port data structure. 513 * @vport: pointer to a host virtual N_Port data structure.
514 * @ndlp: pointer to a node-list data structure. 514 * @ndlp: pointer to a node-list data structure.
515 * @sp: pointer to service parameter data structure. 515 * @sp: pointer to service parameter data structure.
@@ -626,7 +626,7 @@ fail:
626} 626}
627 627
628/** 628/**
629 * lpfc_cmpl_els_flogi: Completion callback function for flogi. 629 * lpfc_cmpl_els_flogi - Completion callback function for flogi
630 * @phba: pointer to lpfc hba data structure. 630 * @phba: pointer to lpfc hba data structure.
631 * @cmdiocb: pointer to lpfc command iocb data structure. 631 * @cmdiocb: pointer to lpfc command iocb data structure.
632 * @rspiocb: pointer to lpfc response iocb data structure. 632 * @rspiocb: pointer to lpfc response iocb data structure.
@@ -751,7 +751,7 @@ out:
751} 751}
752 752
753/** 753/**
754 * lpfc_issue_els_flogi: Issue an flogi iocb command for a vport. 754 * lpfc_issue_els_flogi - Issue an flogi iocb command for a vport
755 * @vport: pointer to a host virtual N_Port data structure. 755 * @vport: pointer to a host virtual N_Port data structure.
756 * @ndlp: pointer to a node-list data structure. 756 * @ndlp: pointer to a node-list data structure.
757 * @retry: number of retries to the command IOCB. 757 * @retry: number of retries to the command IOCB.
@@ -849,7 +849,7 @@ lpfc_issue_els_flogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
849} 849}
850 850
851/** 851/**
852 * lpfc_els_abort_flogi: Abort all outstanding flogi iocbs. 852 * lpfc_els_abort_flogi - Abort all outstanding flogi iocbs
853 * @phba: pointer to lpfc hba data structure. 853 * @phba: pointer to lpfc hba data structure.
854 * 854 *
855 * This routine aborts all the outstanding Fabric Login (FLOGI) IOCBs 855 * This routine aborts all the outstanding Fabric Login (FLOGI) IOCBs
@@ -898,7 +898,7 @@ lpfc_els_abort_flogi(struct lpfc_hba *phba)
898} 898}
899 899
900/** 900/**
901 * lpfc_initial_flogi: Issue an initial fabric login for a vport. 901 * lpfc_initial_flogi - Issue an initial fabric login for a vport
902 * @vport: pointer to a host virtual N_Port data structure. 902 * @vport: pointer to a host virtual N_Port data structure.
903 * 903 *
904 * This routine issues an initial Fabric Login (FLOGI) for the @vport 904 * This routine issues an initial Fabric Login (FLOGI) for the @vport
@@ -949,7 +949,7 @@ lpfc_initial_flogi(struct lpfc_vport *vport)
949} 949}
950 950
951/** 951/**
952 * lpfc_initial_fdisc: Issue an initial fabric discovery for a vport. 952 * lpfc_initial_fdisc - Issue an initial fabric discovery for a vport
953 * @vport: pointer to a host virtual N_Port data structure. 953 * @vport: pointer to a host virtual N_Port data structure.
954 * 954 *
955 * This routine issues an initial Fabric Discover (FDISC) for the @vport 955 * This routine issues an initial Fabric Discover (FDISC) for the @vport
@@ -998,7 +998,7 @@ lpfc_initial_fdisc(struct lpfc_vport *vport)
998} 998}
999 999
1000/** 1000/**
1001 * lpfc_more_plogi: Check and issue remaining plogis for a vport. 1001 * lpfc_more_plogi - Check and issue remaining plogis for a vport
1002 * @vport: pointer to a host virtual N_Port data structure. 1002 * @vport: pointer to a host virtual N_Port data structure.
1003 * 1003 *
1004 * This routine checks whether there are more remaining Port Logins 1004 * This routine checks whether there are more remaining Port Logins
@@ -1031,7 +1031,7 @@ lpfc_more_plogi(struct lpfc_vport *vport)
1031} 1031}
1032 1032
1033/** 1033/**
1034 * lpfc_plogi_confirm_nport: Confirm pologi wwpn matches stored ndlp. 1034 * lpfc_plogi_confirm_nport - Confirm pologi wwpn matches stored ndlp
1035 * @phba: pointer to lpfc hba data structure. 1035 * @phba: pointer to lpfc hba data structure.
1036 * @prsp: pointer to response IOCB payload. 1036 * @prsp: pointer to response IOCB payload.
1037 * @ndlp: pointer to a node-list data structure. 1037 * @ndlp: pointer to a node-list data structure.
@@ -1165,7 +1165,7 @@ lpfc_plogi_confirm_nport(struct lpfc_hba *phba, uint32_t *prsp,
1165} 1165}
1166 1166
1167/** 1167/**
1168 * lpfc_end_rscn: Check and handle more rscn for a vport. 1168 * lpfc_end_rscn - Check and handle more rscn for a vport
1169 * @vport: pointer to a host virtual N_Port data structure. 1169 * @vport: pointer to a host virtual N_Port data structure.
1170 * 1170 *
1171 * This routine checks whether more Registration State Change 1171 * This routine checks whether more Registration State Change
@@ -1197,7 +1197,7 @@ lpfc_end_rscn(struct lpfc_vport *vport)
1197} 1197}
1198 1198
1199/** 1199/**
1200 * lpfc_cmpl_els_plogi: Completion callback function for plogi. 1200 * lpfc_cmpl_els_plogi - Completion callback function for plogi
1201 * @phba: pointer to lpfc hba data structure. 1201 * @phba: pointer to lpfc hba data structure.
1202 * @cmdiocb: pointer to lpfc command iocb data structure. 1202 * @cmdiocb: pointer to lpfc command iocb data structure.
1203 * @rspiocb: pointer to lpfc response iocb data structure. 1203 * @rspiocb: pointer to lpfc response iocb data structure.
@@ -1322,7 +1322,7 @@ out:
1322} 1322}
1323 1323
1324/** 1324/**
1325 * lpfc_issue_els_plogi: Issue an plogi iocb command for a vport. 1325 * lpfc_issue_els_plogi - Issue an plogi iocb command for a vport
1326 * @vport: pointer to a host virtual N_Port data structure. 1326 * @vport: pointer to a host virtual N_Port data structure.
1327 * @did: destination port identifier. 1327 * @did: destination port identifier.
1328 * @retry: number of retries to the command IOCB. 1328 * @retry: number of retries to the command IOCB.
@@ -1401,7 +1401,7 @@ lpfc_issue_els_plogi(struct lpfc_vport *vport, uint32_t did, uint8_t retry)
1401} 1401}
1402 1402
1403/** 1403/**
1404 * lpfc_cmpl_els_prli: Completion callback function for prli. 1404 * lpfc_cmpl_els_prli - Completion callback function for prli
1405 * @phba: pointer to lpfc hba data structure. 1405 * @phba: pointer to lpfc hba data structure.
1406 * @cmdiocb: pointer to lpfc command iocb data structure. 1406 * @cmdiocb: pointer to lpfc command iocb data structure.
1407 * @rspiocb: pointer to lpfc response iocb data structure. 1407 * @rspiocb: pointer to lpfc response iocb data structure.
@@ -1472,7 +1472,7 @@ out:
1472} 1472}
1473 1473
1474/** 1474/**
1475 * lpfc_issue_els_prli: Issue a prli iocb command for a vport. 1475 * lpfc_issue_els_prli - Issue a prli iocb command for a vport
1476 * @vport: pointer to a host virtual N_Port data structure. 1476 * @vport: pointer to a host virtual N_Port data structure.
1477 * @ndlp: pointer to a node-list data structure. 1477 * @ndlp: pointer to a node-list data structure.
1478 * @retry: number of retries to the command IOCB. 1478 * @retry: number of retries to the command IOCB.
@@ -1562,7 +1562,7 @@ lpfc_issue_els_prli(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
1562} 1562}
1563 1563
1564/** 1564/**
1565 * lpfc_rscn_disc: Perform rscn discovery for a vport. 1565 * lpfc_rscn_disc - Perform rscn discovery for a vport
1566 * @vport: pointer to a host virtual N_Port data structure. 1566 * @vport: pointer to a host virtual N_Port data structure.
1567 * 1567 *
1568 * This routine performs Registration State Change Notification (RSCN) 1568 * This routine performs Registration State Change Notification (RSCN)
@@ -1588,7 +1588,7 @@ lpfc_rscn_disc(struct lpfc_vport *vport)
1588} 1588}
1589 1589
1590/** 1590/**
1591 * lpfc_adisc_done: Complete the adisc phase of discovery. 1591 * lpfc_adisc_done - Complete the adisc phase of discovery
1592 * @vport: pointer to lpfc_vport hba data structure that finished all ADISCs. 1592 * @vport: pointer to lpfc_vport hba data structure that finished all ADISCs.
1593 * 1593 *
1594 * This function is called when the final ADISC is completed during discovery. 1594 * This function is called when the final ADISC is completed during discovery.
@@ -1639,7 +1639,7 @@ lpfc_adisc_done(struct lpfc_vport *vport)
1639} 1639}
1640 1640
1641/** 1641/**
1642 * lpfc_more_adisc: Issue more adisc as needed. 1642 * lpfc_more_adisc - Issue more adisc as needed
1643 * @vport: pointer to a host virtual N_Port data structure. 1643 * @vport: pointer to a host virtual N_Port data structure.
1644 * 1644 *
1645 * This routine determines whether there are more ndlps on a @vport 1645 * This routine determines whether there are more ndlps on a @vport
@@ -1672,7 +1672,7 @@ lpfc_more_adisc(struct lpfc_vport *vport)
1672} 1672}
1673 1673
1674/** 1674/**
1675 * lpfc_cmpl_els_adisc: Completion callback function for adisc. 1675 * lpfc_cmpl_els_adisc - Completion callback function for adisc
1676 * @phba: pointer to lpfc hba data structure. 1676 * @phba: pointer to lpfc hba data structure.
1677 * @cmdiocb: pointer to lpfc command iocb data structure. 1677 * @cmdiocb: pointer to lpfc command iocb data structure.
1678 * @rspiocb: pointer to lpfc response iocb data structure. 1678 * @rspiocb: pointer to lpfc response iocb data structure.
@@ -1760,7 +1760,7 @@ out:
1760} 1760}
1761 1761
1762/** 1762/**
1763 * lpfc_issue_els_adisc: Issue an address discover iocb to an node on a vport. 1763 * lpfc_issue_els_adisc - Issue an address discover iocb to an node on a vport
1764 * @vport: pointer to a virtual N_Port data structure. 1764 * @vport: pointer to a virtual N_Port data structure.
1765 * @ndlp: pointer to a node-list data structure. 1765 * @ndlp: pointer to a node-list data structure.
1766 * @retry: number of retries to the command IOCB. 1766 * @retry: number of retries to the command IOCB.
@@ -1833,7 +1833,7 @@ lpfc_issue_els_adisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
1833} 1833}
1834 1834
1835/** 1835/**
1836 * lpfc_cmpl_els_logo: Completion callback function for logo. 1836 * lpfc_cmpl_els_logo - Completion callback function for logo
1837 * @phba: pointer to lpfc hba data structure. 1837 * @phba: pointer to lpfc hba data structure.
1838 * @cmdiocb: pointer to lpfc command iocb data structure. 1838 * @cmdiocb: pointer to lpfc command iocb data structure.
1839 * @rspiocb: pointer to lpfc response iocb data structure. 1839 * @rspiocb: pointer to lpfc response iocb data structure.
@@ -1910,7 +1910,7 @@ out:
1910} 1910}
1911 1911
1912/** 1912/**
1913 * lpfc_issue_els_logo: Issue a logo to an node on a vport. 1913 * lpfc_issue_els_logo - Issue a logo to an node on a vport
1914 * @vport: pointer to a virtual N_Port data structure. 1914 * @vport: pointer to a virtual N_Port data structure.
1915 * @ndlp: pointer to a node-list data structure. 1915 * @ndlp: pointer to a node-list data structure.
1916 * @retry: number of retries to the command IOCB. 1916 * @retry: number of retries to the command IOCB.
@@ -1991,7 +1991,7 @@ lpfc_issue_els_logo(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
1991} 1991}
1992 1992
1993/** 1993/**
1994 * lpfc_cmpl_els_cmd: Completion callback function for generic els command. 1994 * lpfc_cmpl_els_cmd - Completion callback function for generic els command
1995 * @phba: pointer to lpfc hba data structure. 1995 * @phba: pointer to lpfc hba data structure.
1996 * @cmdiocb: pointer to lpfc command iocb data structure. 1996 * @cmdiocb: pointer to lpfc command iocb data structure.
1997 * @rspiocb: pointer to lpfc response iocb data structure. 1997 * @rspiocb: pointer to lpfc response iocb data structure.
@@ -2031,7 +2031,7 @@ lpfc_cmpl_els_cmd(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
2031} 2031}
2032 2032
2033/** 2033/**
2034 * lpfc_issue_els_scr: Issue a scr to an node on a vport. 2034 * lpfc_issue_els_scr - Issue a scr to an node on a vport
2035 * @vport: pointer to a host virtual N_Port data structure. 2035 * @vport: pointer to a host virtual N_Port data structure.
2036 * @nportid: N_Port identifier to the remote node. 2036 * @nportid: N_Port identifier to the remote node.
2037 * @retry: number of retries to the command IOCB. 2037 * @retry: number of retries to the command IOCB.
@@ -2125,7 +2125,7 @@ lpfc_issue_els_scr(struct lpfc_vport *vport, uint32_t nportid, uint8_t retry)
2125} 2125}
2126 2126
2127/** 2127/**
2128 * lpfc_issue_els_farpr: Issue a farp to an node on a vport. 2128 * lpfc_issue_els_farpr - Issue a farp to an node on a vport
2129 * @vport: pointer to a host virtual N_Port data structure. 2129 * @vport: pointer to a host virtual N_Port data structure.
2130 * @nportid: N_Port identifier to the remote node. 2130 * @nportid: N_Port identifier to the remote node.
2131 * @retry: number of retries to the command IOCB. 2131 * @retry: number of retries to the command IOCB.
@@ -2236,7 +2236,7 @@ lpfc_issue_els_farpr(struct lpfc_vport *vport, uint32_t nportid, uint8_t retry)
2236} 2236}
2237 2237
2238/** 2238/**
2239 * lpfc_cancel_retry_delay_tmo: Cancel the timer with delayed iocb-cmd retry. 2239 * lpfc_cancel_retry_delay_tmo - Cancel the timer with delayed iocb-cmd retry
2240 * @vport: pointer to a host virtual N_Port data structure. 2240 * @vport: pointer to a host virtual N_Port data structure.
2241 * @nlp: pointer to a node-list data structure. 2241 * @nlp: pointer to a node-list data structure.
2242 * 2242 *
@@ -2291,7 +2291,7 @@ lpfc_cancel_retry_delay_tmo(struct lpfc_vport *vport, struct lpfc_nodelist *nlp)
2291} 2291}
2292 2292
2293/** 2293/**
2294 * lpfc_els_retry_delay: Timer function with a ndlp delayed function timer. 2294 * lpfc_els_retry_delay - Timer function with a ndlp delayed function timer
2295 * @ptr: holder for the pointer to the timer function associated data (ndlp). 2295 * @ptr: holder for the pointer to the timer function associated data (ndlp).
2296 * 2296 *
2297 * This routine is invoked by the ndlp delayed-function timer to check 2297 * This routine is invoked by the ndlp delayed-function timer to check
@@ -2333,7 +2333,7 @@ lpfc_els_retry_delay(unsigned long ptr)
2333} 2333}
2334 2334
2335/** 2335/**
2336 * lpfc_els_retry_delay_handler: Work thread handler for ndlp delayed function. 2336 * lpfc_els_retry_delay_handler - Work thread handler for ndlp delayed function
2337 * @ndlp: pointer to a node-list data structure. 2337 * @ndlp: pointer to a node-list data structure.
2338 * 2338 *
2339 * This routine is the worker-thread handler for processing the @ndlp delayed 2339 * This routine is the worker-thread handler for processing the @ndlp delayed
@@ -2404,7 +2404,7 @@ lpfc_els_retry_delay_handler(struct lpfc_nodelist *ndlp)
2404} 2404}
2405 2405
2406/** 2406/**
2407 * lpfc_els_retry: Make retry decision on an els command iocb. 2407 * lpfc_els_retry - Make retry decision on an els command iocb
2408 * @phba: pointer to lpfc hba data structure. 2408 * @phba: pointer to lpfc hba data structure.
2409 * @cmdiocb: pointer to lpfc command iocb data structure. 2409 * @cmdiocb: pointer to lpfc command iocb data structure.
2410 * @rspiocb: pointer to lpfc response iocb data structure. 2410 * @rspiocb: pointer to lpfc response iocb data structure.
@@ -2732,7 +2732,7 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
2732} 2732}
2733 2733
2734/** 2734/**
2735 * lpfc_els_free_data: Free lpfc dma buffer and data structure with an iocb. 2735 * lpfc_els_free_data - Free lpfc dma buffer and data structure with an iocb
2736 * @phba: pointer to lpfc hba data structure. 2736 * @phba: pointer to lpfc hba data structure.
2737 * @buf_ptr1: pointer to the lpfc DMA buffer data structure. 2737 * @buf_ptr1: pointer to the lpfc DMA buffer data structure.
2738 * 2738 *
@@ -2764,7 +2764,7 @@ lpfc_els_free_data(struct lpfc_hba *phba, struct lpfc_dmabuf *buf_ptr1)
2764} 2764}
2765 2765
2766/** 2766/**
2767 * lpfc_els_free_bpl: Free lpfc dma buffer and data structure with bpl. 2767 * lpfc_els_free_bpl - Free lpfc dma buffer and data structure with bpl
2768 * @phba: pointer to lpfc hba data structure. 2768 * @phba: pointer to lpfc hba data structure.
2769 * @buf_ptr: pointer to the lpfc dma buffer data structure. 2769 * @buf_ptr: pointer to the lpfc dma buffer data structure.
2770 * 2770 *
@@ -2784,7 +2784,7 @@ lpfc_els_free_bpl(struct lpfc_hba *phba, struct lpfc_dmabuf *buf_ptr)
2784} 2784}
2785 2785
2786/** 2786/**
2787 * lpfc_els_free_iocb: Free a command iocb and its associated resources. 2787 * lpfc_els_free_iocb - Free a command iocb and its associated resources
2788 * @phba: pointer to lpfc hba data structure. 2788 * @phba: pointer to lpfc hba data structure.
2789 * @elsiocb: pointer to lpfc els command iocb data structure. 2789 * @elsiocb: pointer to lpfc els command iocb data structure.
2790 * 2790 *
@@ -2877,7 +2877,7 @@ lpfc_els_free_iocb(struct lpfc_hba *phba, struct lpfc_iocbq *elsiocb)
2877} 2877}
2878 2878
2879/** 2879/**
2880 * lpfc_cmpl_els_logo_acc: Completion callback function to logo acc response. 2880 * lpfc_cmpl_els_logo_acc - Completion callback function to logo acc response
2881 * @phba: pointer to lpfc hba data structure. 2881 * @phba: pointer to lpfc hba data structure.
2882 * @cmdiocb: pointer to lpfc command iocb data structure. 2882 * @cmdiocb: pointer to lpfc command iocb data structure.
2883 * @rspiocb: pointer to lpfc response iocb data structure. 2883 * @rspiocb: pointer to lpfc response iocb data structure.
@@ -2931,7 +2931,7 @@ lpfc_cmpl_els_logo_acc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
2931} 2931}
2932 2932
2933/** 2933/**
2934 * lpfc_mbx_cmpl_dflt_rpi: Completion callbk func for unreg dflt rpi mbox cmd. 2934 * lpfc_mbx_cmpl_dflt_rpi - Completion callbk func for unreg dflt rpi mbox cmd
2935 * @phba: pointer to lpfc hba data structure. 2935 * @phba: pointer to lpfc hba data structure.
2936 * @pmb: pointer to the driver internal queue element for mailbox command. 2936 * @pmb: pointer to the driver internal queue element for mailbox command.
2937 * 2937 *
@@ -2965,7 +2965,7 @@ lpfc_mbx_cmpl_dflt_rpi(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
2965} 2965}
2966 2966
2967/** 2967/**
2968 * lpfc_cmpl_els_rsp: Completion callback function for els response iocb cmd. 2968 * lpfc_cmpl_els_rsp - Completion callback function for els response iocb cmd
2969 * @phba: pointer to lpfc hba data structure. 2969 * @phba: pointer to lpfc hba data structure.
2970 * @cmdiocb: pointer to lpfc command iocb data structure. 2970 * @cmdiocb: pointer to lpfc command iocb data structure.
2971 * @rspiocb: pointer to lpfc response iocb data structure. 2971 * @rspiocb: pointer to lpfc response iocb data structure.
@@ -3136,7 +3136,7 @@ out:
3136} 3136}
3137 3137
3138/** 3138/**
3139 * lpfc_els_rsp_acc: Prepare and issue an acc response iocb command. 3139 * lpfc_els_rsp_acc - Prepare and issue an acc response iocb command
3140 * @vport: pointer to a host virtual N_Port data structure. 3140 * @vport: pointer to a host virtual N_Port data structure.
3141 * @flag: the els command code to be accepted. 3141 * @flag: the els command code to be accepted.
3142 * @oldiocb: pointer to the original lpfc command iocb data structure. 3142 * @oldiocb: pointer to the original lpfc command iocb data structure.
@@ -3275,7 +3275,7 @@ lpfc_els_rsp_acc(struct lpfc_vport *vport, uint32_t flag,
3275} 3275}
3276 3276
3277/** 3277/**
3278 * lpfc_els_rsp_reject: Propare and issue a rjt response iocb command. 3278 * lpfc_els_rsp_reject - Propare and issue a rjt response iocb command
3279 * @vport: pointer to a virtual N_Port data structure. 3279 * @vport: pointer to a virtual N_Port data structure.
3280 * @rejectError: 3280 * @rejectError:
3281 * @oldiocb: pointer to the original lpfc command iocb data structure. 3281 * @oldiocb: pointer to the original lpfc command iocb data structure.
@@ -3356,7 +3356,7 @@ lpfc_els_rsp_reject(struct lpfc_vport *vport, uint32_t rejectError,
3356} 3356}
3357 3357
3358/** 3358/**
3359 * lpfc_els_rsp_adisc_acc: Prepare and issue acc response to adisc iocb cmd. 3359 * lpfc_els_rsp_adisc_acc - Prepare and issue acc response to adisc iocb cmd
3360 * @vport: pointer to a virtual N_Port data structure. 3360 * @vport: pointer to a virtual N_Port data structure.
3361 * @oldiocb: pointer to the original lpfc command iocb data structure. 3361 * @oldiocb: pointer to the original lpfc command iocb data structure.
3362 * @ndlp: pointer to a node-list data structure. 3362 * @ndlp: pointer to a node-list data structure.
@@ -3431,7 +3431,7 @@ lpfc_els_rsp_adisc_acc(struct lpfc_vport *vport, struct lpfc_iocbq *oldiocb,
3431} 3431}
3432 3432
3433/** 3433/**
3434 * lpfc_els_rsp_prli_acc: Prepare and issue acc response to prli iocb cmd. 3434 * lpfc_els_rsp_prli_acc - Prepare and issue acc response to prli iocb cmd
3435 * @vport: pointer to a virtual N_Port data structure. 3435 * @vport: pointer to a virtual N_Port data structure.
3436 * @oldiocb: pointer to the original lpfc command iocb data structure. 3436 * @oldiocb: pointer to the original lpfc command iocb data structure.
3437 * @ndlp: pointer to a node-list data structure. 3437 * @ndlp: pointer to a node-list data structure.
@@ -3529,7 +3529,7 @@ lpfc_els_rsp_prli_acc(struct lpfc_vport *vport, struct lpfc_iocbq *oldiocb,
3529} 3529}
3530 3530
3531/** 3531/**
3532 * lpfc_els_rsp_rnid_acc: Issue rnid acc response iocb command. 3532 * lpfc_els_rsp_rnid_acc - Issue rnid acc response iocb command
3533 * @vport: pointer to a virtual N_Port data structure. 3533 * @vport: pointer to a virtual N_Port data structure.
3534 * @format: rnid command format. 3534 * @format: rnid command format.
3535 * @oldiocb: pointer to the original lpfc command iocb data structure. 3535 * @oldiocb: pointer to the original lpfc command iocb data structure.
@@ -3635,7 +3635,7 @@ lpfc_els_rsp_rnid_acc(struct lpfc_vport *vport, uint8_t format,
3635} 3635}
3636 3636
3637/** 3637/**
3638 * lpfc_els_disc_adisc: Issue remaining adisc iocbs to npr nodes of a vport. 3638 * lpfc_els_disc_adisc - Issue remaining adisc iocbs to npr nodes of a vport
3639 * @vport: pointer to a host virtual N_Port data structure. 3639 * @vport: pointer to a host virtual N_Port data structure.
3640 * 3640 *
3641 * This routine issues Address Discover (ADISC) ELS commands to those 3641 * This routine issues Address Discover (ADISC) ELS commands to those
@@ -3693,7 +3693,7 @@ lpfc_els_disc_adisc(struct lpfc_vport *vport)
3693} 3693}
3694 3694
3695/** 3695/**
3696 * lpfc_els_disc_plogi: Issue plogi for all npr nodes of a vport before adisc. 3696 * lpfc_els_disc_plogi - Issue plogi for all npr nodes of a vport before adisc
3697 * @vport: pointer to a host virtual N_Port data structure. 3697 * @vport: pointer to a host virtual N_Port data structure.
3698 * 3698 *
3699 * This routine issues Port Login (PLOGI) ELS commands to all the N_Ports 3699 * This routine issues Port Login (PLOGI) ELS commands to all the N_Ports
@@ -3752,7 +3752,7 @@ lpfc_els_disc_plogi(struct lpfc_vport *vport)
3752} 3752}
3753 3753
3754/** 3754/**
3755 * lpfc_els_flush_rscn: Clean up any rscn activities with a vport. 3755 * lpfc_els_flush_rscn - Clean up any rscn activities with a vport
3756 * @vport: pointer to a host virtual N_Port data structure. 3756 * @vport: pointer to a host virtual N_Port data structure.
3757 * 3757 *
3758 * This routine cleans up any Registration State Change Notification 3758 * This routine cleans up any Registration State Change Notification
@@ -3791,7 +3791,7 @@ lpfc_els_flush_rscn(struct lpfc_vport *vport)
3791} 3791}
3792 3792
3793/** 3793/**
3794 * lpfc_rscn_payload_check: Check whether there is a pending rscn to a did. 3794 * lpfc_rscn_payload_check - Check whether there is a pending rscn to a did
3795 * @vport: pointer to a host virtual N_Port data structure. 3795 * @vport: pointer to a host virtual N_Port data structure.
3796 * @did: remote destination port identifier. 3796 * @did: remote destination port identifier.
3797 * 3797 *
@@ -3866,7 +3866,7 @@ return_did_out:
3866} 3866}
3867 3867
3868/** 3868/**
3869 * lpfc_rscn_recovery_check: Send recovery event to vport nodes matching rscn 3869 * lpfc_rscn_recovery_check - Send recovery event to vport nodes matching rscn
3870 * @vport: pointer to a host virtual N_Port data structure. 3870 * @vport: pointer to a host virtual N_Port data structure.
3871 * 3871 *
3872 * This routine sends recovery (NLP_EVT_DEVICE_RECOVERY) event to the 3872 * This routine sends recovery (NLP_EVT_DEVICE_RECOVERY) event to the
@@ -3895,7 +3895,7 @@ lpfc_rscn_recovery_check(struct lpfc_vport *vport)
3895} 3895}
3896 3896
3897/** 3897/**
3898 * lpfc_send_rscn_event: Send an RSCN event to management application. 3898 * lpfc_send_rscn_event - Send an RSCN event to management application
3899 * @vport: pointer to a host virtual N_Port data structure. 3899 * @vport: pointer to a host virtual N_Port data structure.
3900 * @cmdiocb: pointer to lpfc command iocb data structure. 3900 * @cmdiocb: pointer to lpfc command iocb data structure.
3901 * 3901 *
@@ -3938,7 +3938,7 @@ lpfc_send_rscn_event(struct lpfc_vport *vport,
3938} 3938}
3939 3939
3940/** 3940/**
3941 * lpfc_els_rcv_rscn: Process an unsolicited rscn iocb. 3941 * lpfc_els_rcv_rscn - Process an unsolicited rscn iocb
3942 * @vport: pointer to a host virtual N_Port data structure. 3942 * @vport: pointer to a host virtual N_Port data structure.
3943 * @cmdiocb: pointer to lpfc command iocb data structure. 3943 * @cmdiocb: pointer to lpfc command iocb data structure.
3944 * @ndlp: pointer to a node-list data structure. 3944 * @ndlp: pointer to a node-list data structure.
@@ -4134,7 +4134,7 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
4134} 4134}
4135 4135
4136/** 4136/**
4137 * lpfc_els_handle_rscn: Handle rscn for a vport. 4137 * lpfc_els_handle_rscn - Handle rscn for a vport
4138 * @vport: pointer to a host virtual N_Port data structure. 4138 * @vport: pointer to a host virtual N_Port data structure.
4139 * 4139 *
4140 * This routine handles the Registration State Configuration Notification 4140 * This routine handles the Registration State Configuration Notification
@@ -4222,7 +4222,7 @@ lpfc_els_handle_rscn(struct lpfc_vport *vport)
4222} 4222}
4223 4223
4224/** 4224/**
4225 * lpfc_els_rcv_flogi: Process an unsolicited flogi iocb. 4225 * lpfc_els_rcv_flogi - Process an unsolicited flogi iocb
4226 * @vport: pointer to a host virtual N_Port data structure. 4226 * @vport: pointer to a host virtual N_Port data structure.
4227 * @cmdiocb: pointer to lpfc command iocb data structure. 4227 * @cmdiocb: pointer to lpfc command iocb data structure.
4228 * @ndlp: pointer to a node-list data structure. 4228 * @ndlp: pointer to a node-list data structure.
@@ -4336,7 +4336,7 @@ lpfc_els_rcv_flogi(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
4336} 4336}
4337 4337
4338/** 4338/**
4339 * lpfc_els_rcv_rnid: Process an unsolicited rnid iocb. 4339 * lpfc_els_rcv_rnid - Process an unsolicited rnid iocb
4340 * @vport: pointer to a host virtual N_Port data structure. 4340 * @vport: pointer to a host virtual N_Port data structure.
4341 * @cmdiocb: pointer to lpfc command iocb data structure. 4341 * @cmdiocb: pointer to lpfc command iocb data structure.
4342 * @ndlp: pointer to a node-list data structure. 4342 * @ndlp: pointer to a node-list data structure.
@@ -4391,7 +4391,7 @@ lpfc_els_rcv_rnid(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
4391} 4391}
4392 4392
4393/** 4393/**
4394 * lpfc_els_rcv_lirr: Process an unsolicited lirr iocb. 4394 * lpfc_els_rcv_lirr - Process an unsolicited lirr iocb
4395 * @vport: pointer to a host virtual N_Port data structure. 4395 * @vport: pointer to a host virtual N_Port data structure.
4396 * @cmdiocb: pointer to lpfc command iocb data structure. 4396 * @cmdiocb: pointer to lpfc command iocb data structure.
4397 * @ndlp: pointer to a node-list data structure. 4397 * @ndlp: pointer to a node-list data structure.
@@ -4419,7 +4419,7 @@ lpfc_els_rcv_lirr(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
4419} 4419}
4420 4420
4421/** 4421/**
4422 * lpfc_els_rsp_rps_acc: Completion callbk func for MBX_READ_LNK_STAT mbox cmd. 4422 * lpfc_els_rsp_rps_acc - Completion callbk func for MBX_READ_LNK_STAT mbox cmd
4423 * @phba: pointer to lpfc hba data structure. 4423 * @phba: pointer to lpfc hba data structure.
4424 * @pmb: pointer to the driver internal queue element for mailbox command. 4424 * @pmb: pointer to the driver internal queue element for mailbox command.
4425 * 4425 *
@@ -4513,7 +4513,7 @@ lpfc_els_rsp_rps_acc(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
4513} 4513}
4514 4514
4515/** 4515/**
4516 * lpfc_els_rcv_rps: Process an unsolicited rps iocb. 4516 * lpfc_els_rcv_rps - Process an unsolicited rps iocb
4517 * @vport: pointer to a host virtual N_Port data structure. 4517 * @vport: pointer to a host virtual N_Port data structure.
4518 * @cmdiocb: pointer to lpfc command iocb data structure. 4518 * @cmdiocb: pointer to lpfc command iocb data structure.
4519 * @ndlp: pointer to a node-list data structure. 4519 * @ndlp: pointer to a node-list data structure.
@@ -4590,7 +4590,7 @@ reject_out:
4590} 4590}
4591 4591
4592/** 4592/**
4593 * lpfc_els_rsp_rpl_acc: Issue an accept rpl els command. 4593 * lpfc_els_rsp_rpl_acc - Issue an accept rpl els command
4594 * @vport: pointer to a host virtual N_Port data structure. 4594 * @vport: pointer to a host virtual N_Port data structure.
4595 * @cmdsize: size of the ELS command. 4595 * @cmdsize: size of the ELS command.
4596 * @oldiocb: pointer to the original lpfc command iocb data structure. 4596 * @oldiocb: pointer to the original lpfc command iocb data structure.
@@ -4662,7 +4662,7 @@ lpfc_els_rsp_rpl_acc(struct lpfc_vport *vport, uint16_t cmdsize,
4662} 4662}
4663 4663
4664/** 4664/**
4665 * lpfc_els_rcv_rpl: Process an unsolicited rpl iocb. 4665 * lpfc_els_rcv_rpl - Process an unsolicited rpl iocb
4666 * @vport: pointer to a host virtual N_Port data structure. 4666 * @vport: pointer to a host virtual N_Port data structure.
4667 * @cmdiocb: pointer to lpfc command iocb data structure. 4667 * @cmdiocb: pointer to lpfc command iocb data structure.
4668 * @ndlp: pointer to a node-list data structure. 4668 * @ndlp: pointer to a node-list data structure.
@@ -4721,7 +4721,7 @@ lpfc_els_rcv_rpl(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
4721} 4721}
4722 4722
4723/** 4723/**
4724 * lpfc_els_rcv_farp: Process an unsolicited farp request els command. 4724 * lpfc_els_rcv_farp - Process an unsolicited farp request els command
4725 * @vport: pointer to a virtual N_Port data structure. 4725 * @vport: pointer to a virtual N_Port data structure.
4726 * @cmdiocb: pointer to lpfc command iocb data structure. 4726 * @cmdiocb: pointer to lpfc command iocb data structure.
4727 * @ndlp: pointer to a node-list data structure. 4727 * @ndlp: pointer to a node-list data structure.
@@ -4804,7 +4804,7 @@ lpfc_els_rcv_farp(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
4804} 4804}
4805 4805
4806/** 4806/**
4807 * lpfc_els_rcv_farpr: Process an unsolicited farp response iocb. 4807 * lpfc_els_rcv_farpr - Process an unsolicited farp response iocb
4808 * @vport: pointer to a host virtual N_Port data structure. 4808 * @vport: pointer to a host virtual N_Port data structure.
4809 * @cmdiocb: pointer to lpfc command iocb data structure. 4809 * @cmdiocb: pointer to lpfc command iocb data structure.
4810 * @ndlp: pointer to a node-list data structure. 4810 * @ndlp: pointer to a node-list data structure.
@@ -4842,7 +4842,7 @@ lpfc_els_rcv_farpr(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
4842} 4842}
4843 4843
4844/** 4844/**
4845 * lpfc_els_rcv_fan: Process an unsolicited fan iocb command. 4845 * lpfc_els_rcv_fan - Process an unsolicited fan iocb command
4846 * @vport: pointer to a host virtual N_Port data structure. 4846 * @vport: pointer to a host virtual N_Port data structure.
4847 * @cmdiocb: pointer to lpfc command iocb data structure. 4847 * @cmdiocb: pointer to lpfc command iocb data structure.
4848 * @fan_ndlp: pointer to a node-list data structure. 4848 * @fan_ndlp: pointer to a node-list data structure.
@@ -4890,7 +4890,7 @@ lpfc_els_rcv_fan(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
4890} 4890}
4891 4891
4892/** 4892/**
4893 * lpfc_els_timeout: Handler funciton to the els timer. 4893 * lpfc_els_timeout - Handler funciton to the els timer
4894 * @ptr: holder for the timer function associated data. 4894 * @ptr: holder for the timer function associated data.
4895 * 4895 *
4896 * This routine is invoked by the ELS timer after timeout. It posts the ELS 4896 * This routine is invoked by the ELS timer after timeout. It posts the ELS
@@ -4919,7 +4919,7 @@ lpfc_els_timeout(unsigned long ptr)
4919} 4919}
4920 4920
4921/** 4921/**
4922 * lpfc_els_timeout_handler: Process an els timeout event. 4922 * lpfc_els_timeout_handler - Process an els timeout event
4923 * @vport: pointer to a virtual N_Port data structure. 4923 * @vport: pointer to a virtual N_Port data structure.
4924 * 4924 *
4925 * This routine is the actual handler function that processes an ELS timeout 4925 * This routine is the actual handler function that processes an ELS timeout
@@ -4994,7 +4994,7 @@ lpfc_els_timeout_handler(struct lpfc_vport *vport)
4994} 4994}
4995 4995
4996/** 4996/**
4997 * lpfc_els_flush_cmd: Clean up the outstanding els commands to a vport. 4997 * lpfc_els_flush_cmd - Clean up the outstanding els commands to a vport
4998 * @vport: pointer to a host virtual N_Port data structure. 4998 * @vport: pointer to a host virtual N_Port data structure.
4999 * 4999 *
5000 * This routine is used to clean up all the outstanding ELS commands on a 5000 * This routine is used to clean up all the outstanding ELS commands on a
@@ -5058,25 +5058,15 @@ lpfc_els_flush_cmd(struct lpfc_vport *vport)
5058 } 5058 }
5059 spin_unlock_irq(&phba->hbalock); 5059 spin_unlock_irq(&phba->hbalock);
5060 5060
5061 while (!list_empty(&completions)) { 5061 /* Cancell all the IOCBs from the completions list */
5062 piocb = list_get_first(&completions, struct lpfc_iocbq, list); 5062 lpfc_sli_cancel_iocbs(phba, &completions, IOSTAT_LOCAL_REJECT,
5063 cmd = &piocb->iocb; 5063 IOERR_SLI_ABORTED);
5064 list_del_init(&piocb->list);
5065
5066 if (!piocb->iocb_cmpl)
5067 lpfc_sli_release_iocbq(phba, piocb);
5068 else {
5069 cmd->ulpStatus = IOSTAT_LOCAL_REJECT;
5070 cmd->un.ulpWord[4] = IOERR_SLI_ABORTED;
5071 (piocb->iocb_cmpl) (phba, piocb, piocb);
5072 }
5073 }
5074 5064
5075 return; 5065 return;
5076} 5066}
5077 5067
5078/** 5068/**
5079 * lpfc_els_flush_all_cmd: Clean up all the outstanding els commands to a HBA. 5069 * lpfc_els_flush_all_cmd - Clean up all the outstanding els commands to a HBA
5080 * @phba: pointer to lpfc hba data structure. 5070 * @phba: pointer to lpfc hba data structure.
5081 * 5071 *
5082 * This routine is used to clean up all the outstanding ELS commands on a 5072 * This routine is used to clean up all the outstanding ELS commands on a
@@ -5121,23 +5111,16 @@ lpfc_els_flush_all_cmd(struct lpfc_hba *phba)
5121 lpfc_sli_issue_abort_iotag(phba, pring, piocb); 5111 lpfc_sli_issue_abort_iotag(phba, pring, piocb);
5122 } 5112 }
5123 spin_unlock_irq(&phba->hbalock); 5113 spin_unlock_irq(&phba->hbalock);
5124 while (!list_empty(&completions)) { 5114
5125 piocb = list_get_first(&completions, struct lpfc_iocbq, list); 5115 /* Cancel all the IOCBs from the completions list */
5126 cmd = &piocb->iocb; 5116 lpfc_sli_cancel_iocbs(phba, &completions, IOSTAT_LOCAL_REJECT,
5127 list_del_init(&piocb->list); 5117 IOERR_SLI_ABORTED);
5128 if (!piocb->iocb_cmpl) 5118
5129 lpfc_sli_release_iocbq(phba, piocb);
5130 else {
5131 cmd->ulpStatus = IOSTAT_LOCAL_REJECT;
5132 cmd->un.ulpWord[4] = IOERR_SLI_ABORTED;
5133 (piocb->iocb_cmpl) (phba, piocb, piocb);
5134 }
5135 }
5136 return; 5119 return;
5137} 5120}
5138 5121
5139/** 5122/**
5140 * lpfc_send_els_failure_event: Posts an ELS command failure event. 5123 * lpfc_send_els_failure_event - Posts an ELS command failure event
5141 * @phba: Pointer to hba context object. 5124 * @phba: Pointer to hba context object.
5142 * @cmdiocbp: Pointer to command iocb which reported error. 5125 * @cmdiocbp: Pointer to command iocb which reported error.
5143 * @rspiocbp: Pointer to response iocb which reported error. 5126 * @rspiocbp: Pointer to response iocb which reported error.
@@ -5204,7 +5187,7 @@ lpfc_send_els_failure_event(struct lpfc_hba *phba,
5204} 5187}
5205 5188
5206/** 5189/**
5207 * lpfc_send_els_event: Posts unsolicited els event. 5190 * lpfc_send_els_event - Posts unsolicited els event
5208 * @vport: Pointer to vport object. 5191 * @vport: Pointer to vport object.
5209 * @ndlp: Pointer FC node object. 5192 * @ndlp: Pointer FC node object.
5210 * @cmd: ELS command code. 5193 * @cmd: ELS command code.
@@ -5284,7 +5267,7 @@ lpfc_send_els_event(struct lpfc_vport *vport,
5284 5267
5285 5268
5286/** 5269/**
5287 * lpfc_els_unsol_buffer: Process an unsolicited event data buffer. 5270 * lpfc_els_unsol_buffer - Process an unsolicited event data buffer
5288 * @phba: pointer to lpfc hba data structure. 5271 * @phba: pointer to lpfc hba data structure.
5289 * @pring: pointer to a SLI ring. 5272 * @pring: pointer to a SLI ring.
5290 * @vport: pointer to a host virtual N_Port data structure. 5273 * @vport: pointer to a host virtual N_Port data structure.
@@ -5592,7 +5575,7 @@ dropit:
5592} 5575}
5593 5576
5594/** 5577/**
5595 * lpfc_find_vport_by_vpid: Find a vport on a HBA through vport identifier. 5578 * lpfc_find_vport_by_vpid - Find a vport on a HBA through vport identifier
5596 * @phba: pointer to lpfc hba data structure. 5579 * @phba: pointer to lpfc hba data structure.
5597 * @vpi: host virtual N_Port identifier. 5580 * @vpi: host virtual N_Port identifier.
5598 * 5581 *
@@ -5622,7 +5605,7 @@ lpfc_find_vport_by_vpid(struct lpfc_hba *phba, uint16_t vpi)
5622} 5605}
5623 5606
5624/** 5607/**
5625 * lpfc_els_unsol_event: Process an unsolicited event from an els sli ring. 5608 * lpfc_els_unsol_event - Process an unsolicited event from an els sli ring
5626 * @phba: pointer to lpfc hba data structure. 5609 * @phba: pointer to lpfc hba data structure.
5627 * @pring: pointer to a SLI ring. 5610 * @pring: pointer to a SLI ring.
5628 * @elsiocb: pointer to lpfc els iocb data structure. 5611 * @elsiocb: pointer to lpfc els iocb data structure.
@@ -5710,7 +5693,7 @@ lpfc_els_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
5710} 5693}
5711 5694
5712/** 5695/**
5713 * lpfc_do_scr_ns_plogi: Issue a plogi to the name server for scr. 5696 * lpfc_do_scr_ns_plogi - Issue a plogi to the name server for scr
5714 * @phba: pointer to lpfc hba data structure. 5697 * @phba: pointer to lpfc hba data structure.
5715 * @vport: pointer to a virtual N_Port data structure. 5698 * @vport: pointer to a virtual N_Port data structure.
5716 * 5699 *
@@ -5781,7 +5764,7 @@ lpfc_do_scr_ns_plogi(struct lpfc_hba *phba, struct lpfc_vport *vport)
5781} 5764}
5782 5765
5783/** 5766/**
5784 * lpfc_cmpl_reg_new_vport: Completion callback function to register new vport. 5767 * lpfc_cmpl_reg_new_vport - Completion callback function to register new vport
5785 * @phba: pointer to lpfc hba data structure. 5768 * @phba: pointer to lpfc hba data structure.
5786 * @pmb: pointer to the driver internal queue element for mailbox command. 5769 * @pmb: pointer to the driver internal queue element for mailbox command.
5787 * 5770 *
@@ -5850,7 +5833,7 @@ lpfc_cmpl_reg_new_vport(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
5850} 5833}
5851 5834
5852/** 5835/**
5853 * lpfc_register_new_vport: Register a new vport with a HBA. 5836 * lpfc_register_new_vport - Register a new vport with a HBA
5854 * @phba: pointer to lpfc hba data structure. 5837 * @phba: pointer to lpfc hba data structure.
5855 * @vport: pointer to a host virtual N_Port data structure. 5838 * @vport: pointer to a host virtual N_Port data structure.
5856 * @ndlp: pointer to a node-list data structure. 5839 * @ndlp: pointer to a node-list data structure.
@@ -5899,7 +5882,7 @@ mbox_err_exit:
5899} 5882}
5900 5883
5901/** 5884/**
5902 * lpfc_cmpl_els_fdisc: Completion function for fdisc iocb command. 5885 * lpfc_cmpl_els_fdisc - Completion function for fdisc iocb command
5903 * @phba: pointer to lpfc hba data structure. 5886 * @phba: pointer to lpfc hba data structure.
5904 * @cmdiocb: pointer to lpfc command iocb data structure. 5887 * @cmdiocb: pointer to lpfc command iocb data structure.
5905 * @rspiocb: pointer to lpfc response iocb data structure. 5888 * @rspiocb: pointer to lpfc response iocb data structure.
@@ -6007,7 +5990,7 @@ out:
6007} 5990}
6008 5991
6009/** 5992/**
6010 * lpfc_issue_els_fdisc: Issue a fdisc iocb command. 5993 * lpfc_issue_els_fdisc - Issue a fdisc iocb command
6011 * @vport: pointer to a virtual N_Port data structure. 5994 * @vport: pointer to a virtual N_Port data structure.
6012 * @ndlp: pointer to a node-list data structure. 5995 * @ndlp: pointer to a node-list data structure.
6013 * @retry: number of retries to the command IOCB. 5996 * @retry: number of retries to the command IOCB.
@@ -6101,7 +6084,7 @@ lpfc_issue_els_fdisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
6101} 6084}
6102 6085
6103/** 6086/**
6104 * lpfc_cmpl_els_npiv_logo: Completion function with vport logo. 6087 * lpfc_cmpl_els_npiv_logo - Completion function with vport logo
6105 * @phba: pointer to lpfc hba data structure. 6088 * @phba: pointer to lpfc hba data structure.
6106 * @cmdiocb: pointer to lpfc command iocb data structure. 6089 * @cmdiocb: pointer to lpfc command iocb data structure.
6107 * @rspiocb: pointer to lpfc response iocb data structure. 6090 * @rspiocb: pointer to lpfc response iocb data structure.
@@ -6136,7 +6119,7 @@ lpfc_cmpl_els_npiv_logo(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
6136} 6119}
6137 6120
6138/** 6121/**
6139 * lpfc_issue_els_npiv_logo: Issue a logo off a vport. 6122 * lpfc_issue_els_npiv_logo - Issue a logo off a vport
6140 * @vport: pointer to a virtual N_Port data structure. 6123 * @vport: pointer to a virtual N_Port data structure.
6141 * @ndlp: pointer to a node-list data structure. 6124 * @ndlp: pointer to a node-list data structure.
6142 * 6125 *
@@ -6197,7 +6180,7 @@ lpfc_issue_els_npiv_logo(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
6197} 6180}
6198 6181
6199/** 6182/**
6200 * lpfc_fabric_block_timeout: Handler function to the fabric block timer. 6183 * lpfc_fabric_block_timeout - Handler function to the fabric block timer
6201 * @ptr: holder for the timer function associated data. 6184 * @ptr: holder for the timer function associated data.
6202 * 6185 *
6203 * This routine is invoked by the fabric iocb block timer after 6186 * This routine is invoked by the fabric iocb block timer after
@@ -6226,7 +6209,7 @@ lpfc_fabric_block_timeout(unsigned long ptr)
6226} 6209}
6227 6210
6228/** 6211/**
6229 * lpfc_resume_fabric_iocbs: Issue a fabric iocb from driver internal list. 6212 * lpfc_resume_fabric_iocbs - Issue a fabric iocb from driver internal list
6230 * @phba: pointer to lpfc hba data structure. 6213 * @phba: pointer to lpfc hba data structure.
6231 * 6214 *
6232 * This routine issues one fabric iocb from the driver internal list to 6215 * This routine issues one fabric iocb from the driver internal list to
@@ -6285,7 +6268,7 @@ repeat:
6285} 6268}
6286 6269
6287/** 6270/**
6288 * lpfc_unblock_fabric_iocbs: Unblock issuing fabric iocb command. 6271 * lpfc_unblock_fabric_iocbs - Unblock issuing fabric iocb command
6289 * @phba: pointer to lpfc hba data structure. 6272 * @phba: pointer to lpfc hba data structure.
6290 * 6273 *
6291 * This routine unblocks the issuing fabric iocb command. The function 6274 * This routine unblocks the issuing fabric iocb command. The function
@@ -6303,7 +6286,7 @@ lpfc_unblock_fabric_iocbs(struct lpfc_hba *phba)
6303} 6286}
6304 6287
6305/** 6288/**
6306 * lpfc_block_fabric_iocbs: Block issuing fabric iocb command. 6289 * lpfc_block_fabric_iocbs - Block issuing fabric iocb command
6307 * @phba: pointer to lpfc hba data structure. 6290 * @phba: pointer to lpfc hba data structure.
6308 * 6291 *
6309 * This routine blocks the issuing fabric iocb for a specified amount of 6292 * This routine blocks the issuing fabric iocb for a specified amount of
@@ -6325,7 +6308,7 @@ lpfc_block_fabric_iocbs(struct lpfc_hba *phba)
6325} 6308}
6326 6309
6327/** 6310/**
6328 * lpfc_cmpl_fabric_iocb: Completion callback function for fabric iocb. 6311 * lpfc_cmpl_fabric_iocb - Completion callback function for fabric iocb
6329 * @phba: pointer to lpfc hba data structure. 6312 * @phba: pointer to lpfc hba data structure.
6330 * @cmdiocb: pointer to lpfc command iocb data structure. 6313 * @cmdiocb: pointer to lpfc command iocb data structure.
6331 * @rspiocb: pointer to lpfc response iocb data structure. 6314 * @rspiocb: pointer to lpfc response iocb data structure.
@@ -6384,7 +6367,7 @@ lpfc_cmpl_fabric_iocb(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
6384} 6367}
6385 6368
6386/** 6369/**
6387 * lpfc_issue_fabric_iocb: Issue a fabric iocb command. 6370 * lpfc_issue_fabric_iocb - Issue a fabric iocb command
6388 * @phba: pointer to lpfc hba data structure. 6371 * @phba: pointer to lpfc hba data structure.
6389 * @iocb: pointer to lpfc command iocb data structure. 6372 * @iocb: pointer to lpfc command iocb data structure.
6390 * 6373 *
@@ -6453,7 +6436,7 @@ lpfc_issue_fabric_iocb(struct lpfc_hba *phba, struct lpfc_iocbq *iocb)
6453} 6436}
6454 6437
6455/** 6438/**
6456 * lpfc_fabric_abort_vport: Abort a vport's iocbs from driver fabric iocb list. 6439 * lpfc_fabric_abort_vport - Abort a vport's iocbs from driver fabric iocb list
6457 * @vport: pointer to a virtual N_Port data structure. 6440 * @vport: pointer to a virtual N_Port data structure.
6458 * 6441 *
6459 * This routine aborts all the IOCBs associated with a @vport from the 6442 * This routine aborts all the IOCBs associated with a @vport from the
@@ -6468,7 +6451,6 @@ static void lpfc_fabric_abort_vport(struct lpfc_vport *vport)
6468 LIST_HEAD(completions); 6451 LIST_HEAD(completions);
6469 struct lpfc_hba *phba = vport->phba; 6452 struct lpfc_hba *phba = vport->phba;
6470 struct lpfc_iocbq *tmp_iocb, *piocb; 6453 struct lpfc_iocbq *tmp_iocb, *piocb;
6471 IOCB_t *cmd;
6472 6454
6473 spin_lock_irq(&phba->hbalock); 6455 spin_lock_irq(&phba->hbalock);
6474 list_for_each_entry_safe(piocb, tmp_iocb, &phba->fabric_iocb_list, 6456 list_for_each_entry_safe(piocb, tmp_iocb, &phba->fabric_iocb_list,
@@ -6481,19 +6463,13 @@ static void lpfc_fabric_abort_vport(struct lpfc_vport *vport)
6481 } 6463 }
6482 spin_unlock_irq(&phba->hbalock); 6464 spin_unlock_irq(&phba->hbalock);
6483 6465
6484 while (!list_empty(&completions)) { 6466 /* Cancel all the IOCBs from the completions list */
6485 piocb = list_get_first(&completions, struct lpfc_iocbq, list); 6467 lpfc_sli_cancel_iocbs(phba, &completions, IOSTAT_LOCAL_REJECT,
6486 list_del_init(&piocb->list); 6468 IOERR_SLI_ABORTED);
6487
6488 cmd = &piocb->iocb;
6489 cmd->ulpStatus = IOSTAT_LOCAL_REJECT;
6490 cmd->un.ulpWord[4] = IOERR_SLI_ABORTED;
6491 (piocb->iocb_cmpl) (phba, piocb, piocb);
6492 }
6493} 6469}
6494 6470
6495/** 6471/**
6496 * lpfc_fabric_abort_nport: Abort a ndlp's iocbs from driver fabric iocb list. 6472 * lpfc_fabric_abort_nport - Abort a ndlp's iocbs from driver fabric iocb list
6497 * @ndlp: pointer to a node-list data structure. 6473 * @ndlp: pointer to a node-list data structure.
6498 * 6474 *
6499 * This routine aborts all the IOCBs associated with an @ndlp from the 6475 * This routine aborts all the IOCBs associated with an @ndlp from the
@@ -6506,10 +6482,9 @@ static void lpfc_fabric_abort_vport(struct lpfc_vport *vport)
6506void lpfc_fabric_abort_nport(struct lpfc_nodelist *ndlp) 6482void lpfc_fabric_abort_nport(struct lpfc_nodelist *ndlp)
6507{ 6483{
6508 LIST_HEAD(completions); 6484 LIST_HEAD(completions);
6509 struct lpfc_hba *phba = ndlp->vport->phba; 6485 struct lpfc_hba *phba = ndlp->phba;
6510 struct lpfc_iocbq *tmp_iocb, *piocb; 6486 struct lpfc_iocbq *tmp_iocb, *piocb;
6511 struct lpfc_sli_ring *pring = &phba->sli.ring[LPFC_ELS_RING]; 6487 struct lpfc_sli_ring *pring = &phba->sli.ring[LPFC_ELS_RING];
6512 IOCB_t *cmd;
6513 6488
6514 spin_lock_irq(&phba->hbalock); 6489 spin_lock_irq(&phba->hbalock);
6515 list_for_each_entry_safe(piocb, tmp_iocb, &phba->fabric_iocb_list, 6490 list_for_each_entry_safe(piocb, tmp_iocb, &phba->fabric_iocb_list,
@@ -6521,19 +6496,13 @@ void lpfc_fabric_abort_nport(struct lpfc_nodelist *ndlp)
6521 } 6496 }
6522 spin_unlock_irq(&phba->hbalock); 6497 spin_unlock_irq(&phba->hbalock);
6523 6498
6524 while (!list_empty(&completions)) { 6499 /* Cancel all the IOCBs from the completions list */
6525 piocb = list_get_first(&completions, struct lpfc_iocbq, list); 6500 lpfc_sli_cancel_iocbs(phba, &completions, IOSTAT_LOCAL_REJECT,
6526 list_del_init(&piocb->list); 6501 IOERR_SLI_ABORTED);
6527
6528 cmd = &piocb->iocb;
6529 cmd->ulpStatus = IOSTAT_LOCAL_REJECT;
6530 cmd->un.ulpWord[4] = IOERR_SLI_ABORTED;
6531 (piocb->iocb_cmpl) (phba, piocb, piocb);
6532 }
6533} 6502}
6534 6503
6535/** 6504/**
6536 * lpfc_fabric_abort_hba: Abort all iocbs on driver fabric iocb list. 6505 * lpfc_fabric_abort_hba - Abort all iocbs on driver fabric iocb list
6537 * @phba: pointer to lpfc hba data structure. 6506 * @phba: pointer to lpfc hba data structure.
6538 * 6507 *
6539 * This routine aborts all the IOCBs currently on the driver internal 6508 * This routine aborts all the IOCBs currently on the driver internal
@@ -6546,20 +6515,12 @@ void lpfc_fabric_abort_nport(struct lpfc_nodelist *ndlp)
6546void lpfc_fabric_abort_hba(struct lpfc_hba *phba) 6515void lpfc_fabric_abort_hba(struct lpfc_hba *phba)
6547{ 6516{
6548 LIST_HEAD(completions); 6517 LIST_HEAD(completions);
6549 struct lpfc_iocbq *piocb;
6550 IOCB_t *cmd;
6551 6518
6552 spin_lock_irq(&phba->hbalock); 6519 spin_lock_irq(&phba->hbalock);
6553 list_splice_init(&phba->fabric_iocb_list, &completions); 6520 list_splice_init(&phba->fabric_iocb_list, &completions);
6554 spin_unlock_irq(&phba->hbalock); 6521 spin_unlock_irq(&phba->hbalock);
6555 6522
6556 while (!list_empty(&completions)) { 6523 /* Cancel all the IOCBs from the completions list */
6557 piocb = list_get_first(&completions, struct lpfc_iocbq, list); 6524 lpfc_sli_cancel_iocbs(phba, &completions, IOSTAT_LOCAL_REJECT,
6558 list_del_init(&piocb->list); 6525 IOERR_SLI_ABORTED);
6559
6560 cmd = &piocb->iocb;
6561 cmd->ulpStatus = IOSTAT_LOCAL_REJECT;
6562 cmd->un.ulpWord[4] = IOERR_SLI_ABORTED;
6563 (piocb->iocb_cmpl) (phba, piocb, piocb);
6564 }
6565} 6526}
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
index 311ed6dea72..e764ce0bf70 100644
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -78,7 +78,7 @@ lpfc_terminate_rport_io(struct fc_rport *rport)
78 return; 78 return;
79 } 79 }
80 80
81 phba = ndlp->vport->phba; 81 phba = ndlp->phba;
82 82
83 lpfc_debugfs_disc_trc(ndlp->vport, LPFC_DISC_TRC_RPORT, 83 lpfc_debugfs_disc_trc(ndlp->vport, LPFC_DISC_TRC_RPORT,
84 "rport terminate: sid:x%x did:x%x flg:x%x", 84 "rport terminate: sid:x%x did:x%x flg:x%x",
@@ -276,7 +276,7 @@ lpfc_dev_loss_tmo_handler(struct lpfc_nodelist *ndlp)
276} 276}
277 277
278/** 278/**
279 * lpfc_alloc_fast_evt: Allocates data structure for posting event. 279 * lpfc_alloc_fast_evt - Allocates data structure for posting event
280 * @phba: Pointer to hba context object. 280 * @phba: Pointer to hba context object.
281 * 281 *
282 * This function is called from the functions which need to post 282 * This function is called from the functions which need to post
@@ -303,7 +303,7 @@ lpfc_alloc_fast_evt(struct lpfc_hba *phba) {
303} 303}
304 304
305/** 305/**
306 * lpfc_free_fast_evt: Frees event data structure. 306 * lpfc_free_fast_evt - Frees event data structure
307 * @phba: Pointer to hba context object. 307 * @phba: Pointer to hba context object.
308 * @evt: Event object which need to be freed. 308 * @evt: Event object which need to be freed.
309 * 309 *
@@ -319,7 +319,7 @@ lpfc_free_fast_evt(struct lpfc_hba *phba,
319} 319}
320 320
321/** 321/**
322 * lpfc_send_fastpath_evt: Posts events generated from fast path. 322 * lpfc_send_fastpath_evt - Posts events generated from fast path
323 * @phba: Pointer to hba context object. 323 * @phba: Pointer to hba context object.
324 * @evtp: Event data structure. 324 * @evtp: Event data structure.
325 * 325 *
@@ -1858,13 +1858,18 @@ lpfc_disable_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
1858 NLP_STE_UNUSED_NODE); 1858 NLP_STE_UNUSED_NODE);
1859} 1859}
1860/** 1860/**
1861 * lpfc_initialize_node: Initialize all fields of node object. 1861 * lpfc_initialize_node - Initialize all fields of node object
1862 * @vport: Pointer to Virtual Port object. 1862 * @vport: Pointer to Virtual Port object.
1863 * @ndlp: Pointer to FC node object. 1863 * @ndlp: Pointer to FC node object.
1864 * @did: FC_ID of the node. 1864 * @did: FC_ID of the node.
1865 * This function is always called when node object need to 1865 *
1866 * be initialized. It initializes all the fields of the node 1866 * This function is always called when node object need to be initialized.
1867 * object. 1867 * It initializes all the fields of the node object. Although the reference
1868 * to phba from @ndlp can be obtained indirectly through it's reference to
1869 * @vport, a direct reference to phba is taken here by @ndlp. This is due
1870 * to the life-span of the @ndlp might go beyond the existence of @vport as
1871 * the final release of ndlp is determined by its reference count. And, the
1872 * operation on @ndlp needs the reference to phba.
1868 **/ 1873 **/
1869static inline void 1874static inline void
1870lpfc_initialize_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, 1875lpfc_initialize_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
@@ -1877,6 +1882,7 @@ lpfc_initialize_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
1877 ndlp->nlp_delayfunc.data = (unsigned long)ndlp; 1882 ndlp->nlp_delayfunc.data = (unsigned long)ndlp;
1878 ndlp->nlp_DID = did; 1883 ndlp->nlp_DID = did;
1879 ndlp->vport = vport; 1884 ndlp->vport = vport;
1885 ndlp->phba = vport->phba;
1880 ndlp->nlp_sid = NLP_NO_SID; 1886 ndlp->nlp_sid = NLP_NO_SID;
1881 kref_init(&ndlp->kref); 1887 kref_init(&ndlp->kref);
1882 NLP_INT_NODE_ACT(ndlp); 1888 NLP_INT_NODE_ACT(ndlp);
@@ -2086,7 +2092,6 @@ lpfc_no_rpi(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp)
2086 struct lpfc_sli *psli; 2092 struct lpfc_sli *psli;
2087 struct lpfc_sli_ring *pring; 2093 struct lpfc_sli_ring *pring;
2088 struct lpfc_iocbq *iocb, *next_iocb; 2094 struct lpfc_iocbq *iocb, *next_iocb;
2089 IOCB_t *icmd;
2090 uint32_t rpi, i; 2095 uint32_t rpi, i;
2091 2096
2092 lpfc_fabric_abort_nport(ndlp); 2097 lpfc_fabric_abort_nport(ndlp);
@@ -2122,19 +2127,9 @@ lpfc_no_rpi(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp)
2122 } 2127 }
2123 } 2128 }
2124 2129
2125 while (!list_empty(&completions)) { 2130 /* Cancel all the IOCBs from the completions list */
2126 iocb = list_get_first(&completions, struct lpfc_iocbq, list); 2131 lpfc_sli_cancel_iocbs(phba, &completions, IOSTAT_LOCAL_REJECT,
2127 list_del_init(&iocb->list); 2132 IOERR_SLI_ABORTED);
2128
2129 if (!iocb->iocb_cmpl)
2130 lpfc_sli_release_iocbq(phba, iocb);
2131 else {
2132 icmd = &iocb->iocb;
2133 icmd->ulpStatus = IOSTAT_LOCAL_REJECT;
2134 icmd->un.ulpWord[4] = IOERR_SLI_ABORTED;
2135 (iocb->iocb_cmpl)(phba, iocb, iocb);
2136 }
2137 }
2138 2133
2139 return 0; 2134 return 0;
2140} 2135}
@@ -2186,9 +2181,13 @@ lpfc_unreg_all_rpis(struct lpfc_vport *vport)
2186 mbox->mbox_cmpl = lpfc_sli_def_mbox_cmpl; 2181 mbox->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
2187 mbox->context1 = NULL; 2182 mbox->context1 = NULL;
2188 rc = lpfc_sli_issue_mbox_wait(phba, mbox, LPFC_MBOX_TMO); 2183 rc = lpfc_sli_issue_mbox_wait(phba, mbox, LPFC_MBOX_TMO);
2189 if (rc == MBX_NOT_FINISHED) { 2184 if (rc != MBX_TIMEOUT)
2190 mempool_free(mbox, phba->mbox_mem_pool); 2185 mempool_free(mbox, phba->mbox_mem_pool);
2191 } 2186
2187 if ((rc == MBX_TIMEOUT) || (rc == MBX_NOT_FINISHED))
2188 lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX | LOG_VPORT,
2189 "1836 Could not issue "
2190 "unreg_login(all_rpis) status %d\n", rc);
2192 } 2191 }
2193} 2192}
2194 2193
@@ -2206,12 +2205,14 @@ lpfc_unreg_default_rpis(struct lpfc_vport *vport)
2206 mbox->mbox_cmpl = lpfc_sli_def_mbox_cmpl; 2205 mbox->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
2207 mbox->context1 = NULL; 2206 mbox->context1 = NULL;
2208 rc = lpfc_sli_issue_mbox_wait(phba, mbox, LPFC_MBOX_TMO); 2207 rc = lpfc_sli_issue_mbox_wait(phba, mbox, LPFC_MBOX_TMO);
2209 if (rc == MBX_NOT_FINISHED) { 2208 if (rc != MBX_TIMEOUT)
2209 mempool_free(mbox, phba->mbox_mem_pool);
2210
2211 if ((rc == MBX_TIMEOUT) || (rc == MBX_NOT_FINISHED))
2210 lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX | LOG_VPORT, 2212 lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX | LOG_VPORT,
2211 "1815 Could not issue " 2213 "1815 Could not issue "
2212 "unreg_did (default rpis)\n"); 2214 "unreg_did (default rpis) status %d\n",
2213 mempool_free(mbox, phba->mbox_mem_pool); 2215 rc);
2214 }
2215 } 2216 }
2216} 2217}
2217 2218
@@ -2470,14 +2471,13 @@ lpfc_setup_disc_node(struct lpfc_vport *vport, uint32_t did)
2470 if (ndlp->nlp_flag & NLP_RCV_PLOGI) 2471 if (ndlp->nlp_flag & NLP_RCV_PLOGI)
2471 return NULL; 2472 return NULL;
2472 2473
2473 spin_lock_irq(shost->host_lock);
2474 ndlp->nlp_flag |= NLP_NPR_2B_DISC;
2475 spin_unlock_irq(shost->host_lock);
2476
2477 /* Since this node is marked for discovery, 2474 /* Since this node is marked for discovery,
2478 * delay timeout is not needed. 2475 * delay timeout is not needed.
2479 */ 2476 */
2480 lpfc_cancel_retry_delay_tmo(vport, ndlp); 2477 lpfc_cancel_retry_delay_tmo(vport, ndlp);
2478 spin_lock_irq(shost->host_lock);
2479 ndlp->nlp_flag |= NLP_NPR_2B_DISC;
2480 spin_unlock_irq(shost->host_lock);
2481 } else 2481 } else
2482 ndlp = NULL; 2482 ndlp = NULL;
2483 } else { 2483 } else {
@@ -2740,19 +2740,9 @@ lpfc_free_tx(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp)
2740 } 2740 }
2741 spin_unlock_irq(&phba->hbalock); 2741 spin_unlock_irq(&phba->hbalock);
2742 2742
2743 while (!list_empty(&completions)) { 2743 /* Cancel all the IOCBs from the completions list */
2744 iocb = list_get_first(&completions, struct lpfc_iocbq, list); 2744 lpfc_sli_cancel_iocbs(phba, &completions, IOSTAT_LOCAL_REJECT,
2745 list_del_init(&iocb->list); 2745 IOERR_SLI_ABORTED);
2746
2747 if (!iocb->iocb_cmpl)
2748 lpfc_sli_release_iocbq(phba, iocb);
2749 else {
2750 icmd = &iocb->iocb;
2751 icmd->ulpStatus = IOSTAT_LOCAL_REJECT;
2752 icmd->un.ulpWord[4] = IOERR_SLI_ABORTED;
2753 (iocb->iocb_cmpl) (phba, iocb, iocb);
2754 }
2755 }
2756} 2746}
2757 2747
2758static void 2748static void
@@ -3173,7 +3163,7 @@ lpfc_nlp_release(struct kref *kref)
3173 lpfc_nlp_remove(ndlp->vport, ndlp); 3163 lpfc_nlp_remove(ndlp->vport, ndlp);
3174 3164
3175 /* clear the ndlp active flag for all release cases */ 3165 /* clear the ndlp active flag for all release cases */
3176 phba = ndlp->vport->phba; 3166 phba = ndlp->phba;
3177 spin_lock_irqsave(&phba->ndlp_lock, flags); 3167 spin_lock_irqsave(&phba->ndlp_lock, flags);
3178 NLP_CLR_NODE_ACT(ndlp); 3168 NLP_CLR_NODE_ACT(ndlp);
3179 spin_unlock_irqrestore(&phba->ndlp_lock, flags); 3169 spin_unlock_irqrestore(&phba->ndlp_lock, flags);
@@ -3181,7 +3171,7 @@ lpfc_nlp_release(struct kref *kref)
3181 /* free ndlp memory for final ndlp release */ 3171 /* free ndlp memory for final ndlp release */
3182 if (NLP_CHK_FREE_REQ(ndlp)) { 3172 if (NLP_CHK_FREE_REQ(ndlp)) {
3183 kfree(ndlp->lat_data); 3173 kfree(ndlp->lat_data);
3184 mempool_free(ndlp, ndlp->vport->phba->nlp_mem_pool); 3174 mempool_free(ndlp, ndlp->phba->nlp_mem_pool);
3185 } 3175 }
3186} 3176}
3187 3177
@@ -3204,7 +3194,7 @@ lpfc_nlp_get(struct lpfc_nodelist *ndlp)
3204 * ndlp reference count that is in the process of being 3194 * ndlp reference count that is in the process of being
3205 * released. 3195 * released.
3206 */ 3196 */
3207 phba = ndlp->vport->phba; 3197 phba = ndlp->phba;
3208 spin_lock_irqsave(&phba->ndlp_lock, flags); 3198 spin_lock_irqsave(&phba->ndlp_lock, flags);
3209 if (!NLP_CHK_NODE_ACT(ndlp) || NLP_CHK_FREE_ACK(ndlp)) { 3199 if (!NLP_CHK_NODE_ACT(ndlp) || NLP_CHK_FREE_ACK(ndlp)) {
3210 spin_unlock_irqrestore(&phba->ndlp_lock, flags); 3200 spin_unlock_irqrestore(&phba->ndlp_lock, flags);
@@ -3240,7 +3230,7 @@ lpfc_nlp_put(struct lpfc_nodelist *ndlp)
3240 "node put: did:x%x flg:x%x refcnt:x%x", 3230 "node put: did:x%x flg:x%x refcnt:x%x",
3241 ndlp->nlp_DID, ndlp->nlp_flag, 3231 ndlp->nlp_DID, ndlp->nlp_flag,
3242 atomic_read(&ndlp->kref.refcount)); 3232 atomic_read(&ndlp->kref.refcount));
3243 phba = ndlp->vport->phba; 3233 phba = ndlp->phba;
3244 spin_lock_irqsave(&phba->ndlp_lock, flags); 3234 spin_lock_irqsave(&phba->ndlp_lock, flags);
3245 /* Check the ndlp memory free acknowledge flag to avoid the 3235 /* Check the ndlp memory free acknowledge flag to avoid the
3246 * possible race condition that kref_put got invoked again 3236 * possible race condition that kref_put got invoked again
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 06874e6009e..86d1bdcbf2d 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -60,7 +60,7 @@ static struct scsi_transport_template *lpfc_vport_transport_template = NULL;
60static DEFINE_IDR(lpfc_hba_index); 60static DEFINE_IDR(lpfc_hba_index);
61 61
62/** 62/**
63 * lpfc_config_port_prep: Perform lpfc initialization prior to config port. 63 * lpfc_config_port_prep - Perform lpfc initialization prior to config port
64 * @phba: pointer to lpfc hba data structure. 64 * @phba: pointer to lpfc hba data structure.
65 * 65 *
66 * This routine will do LPFC initialization prior to issuing the CONFIG_PORT 66 * This routine will do LPFC initialization prior to issuing the CONFIG_PORT
@@ -221,7 +221,7 @@ out_free_mbox:
221} 221}
222 222
223/** 223/**
224 * lpfc_config_async_cmpl: Completion handler for config async event mbox cmd. 224 * lpfc_config_async_cmpl - Completion handler for config async event mbox cmd
225 * @phba: pointer to lpfc hba data structure. 225 * @phba: pointer to lpfc hba data structure.
226 * @pmboxq: pointer to the driver internal queue element for mailbox command. 226 * @pmboxq: pointer to the driver internal queue element for mailbox command.
227 * 227 *
@@ -242,8 +242,7 @@ lpfc_config_async_cmpl(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmboxq)
242} 242}
243 243
244/** 244/**
245 * lpfc_dump_wakeup_param_cmpl: Completion handler for dump memory mailbox 245 * lpfc_dump_wakeup_param_cmpl - dump memory mailbox command completion handler
246 * command used for getting wake up parameters.
247 * @phba: pointer to lpfc hba data structure. 246 * @phba: pointer to lpfc hba data structure.
248 * @pmboxq: pointer to the driver internal queue element for mailbox command. 247 * @pmboxq: pointer to the driver internal queue element for mailbox command.
249 * 248 *
@@ -287,7 +286,7 @@ lpfc_dump_wakeup_param_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq)
287} 286}
288 287
289/** 288/**
290 * lpfc_config_port_post: Perform lpfc initialization after config port. 289 * lpfc_config_port_post - Perform lpfc initialization after config port
291 * @phba: pointer to lpfc hba data structure. 290 * @phba: pointer to lpfc hba data structure.
292 * 291 *
293 * This routine will do LPFC initialization after the CONFIG_PORT mailbox 292 * This routine will do LPFC initialization after the CONFIG_PORT mailbox
@@ -303,6 +302,7 @@ int
303lpfc_config_port_post(struct lpfc_hba *phba) 302lpfc_config_port_post(struct lpfc_hba *phba)
304{ 303{
305 struct lpfc_vport *vport = phba->pport; 304 struct lpfc_vport *vport = phba->pport;
305 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
306 LPFC_MBOXQ_t *pmb; 306 LPFC_MBOXQ_t *pmb;
307 MAILBOX_t *mb; 307 MAILBOX_t *mb;
308 struct lpfc_dmabuf *mp; 308 struct lpfc_dmabuf *mp;
@@ -360,6 +360,11 @@ lpfc_config_port_post(struct lpfc_hba *phba)
360 sizeof (struct lpfc_name)); 360 sizeof (struct lpfc_name));
361 memcpy(&vport->fc_portname, &vport->fc_sparam.portName, 361 memcpy(&vport->fc_portname, &vport->fc_sparam.portName,
362 sizeof (struct lpfc_name)); 362 sizeof (struct lpfc_name));
363
364 /* Update the fc_host data structures with new wwn. */
365 fc_host_node_name(shost) = wwn_to_u64(vport->fc_nodename.u.wwn);
366 fc_host_port_name(shost) = wwn_to_u64(vport->fc_portname.u.wwn);
367
363 /* If no serial number in VPD data, use low 6 bytes of WWNN */ 368 /* If no serial number in VPD data, use low 6 bytes of WWNN */
364 /* This should be consolidated into parse_vpd ? - mr */ 369 /* This should be consolidated into parse_vpd ? - mr */
365 if (phba->SerialNumber[0] == 0) { 370 if (phba->SerialNumber[0] == 0) {
@@ -551,7 +556,7 @@ lpfc_config_port_post(struct lpfc_hba *phba)
551} 556}
552 557
553/** 558/**
554 * lpfc_hba_down_prep: Perform lpfc uninitialization prior to HBA reset. 559 * lpfc_hba_down_prep - Perform lpfc uninitialization prior to HBA reset
555 * @phba: pointer to lpfc HBA data structure. 560 * @phba: pointer to lpfc HBA data structure.
556 * 561 *
557 * This routine will do LPFC uninitialization before the HBA is reset when 562 * This routine will do LPFC uninitialization before the HBA is reset when
@@ -583,7 +588,7 @@ lpfc_hba_down_prep(struct lpfc_hba *phba)
583} 588}
584 589
585/** 590/**
586 * lpfc_hba_down_post: Perform lpfc uninitialization after HBA reset. 591 * lpfc_hba_down_post - Perform lpfc uninitialization after HBA reset
587 * @phba: pointer to lpfc HBA data structure. 592 * @phba: pointer to lpfc HBA data structure.
588 * 593 *
589 * This routine will do uninitialization after the HBA is reset when bring 594 * This routine will do uninitialization after the HBA is reset when bring
@@ -599,8 +604,6 @@ lpfc_hba_down_post(struct lpfc_hba *phba)
599 struct lpfc_sli *psli = &phba->sli; 604 struct lpfc_sli *psli = &phba->sli;
600 struct lpfc_sli_ring *pring; 605 struct lpfc_sli_ring *pring;
601 struct lpfc_dmabuf *mp, *next_mp; 606 struct lpfc_dmabuf *mp, *next_mp;
602 struct lpfc_iocbq *iocb;
603 IOCB_t *cmd = NULL;
604 LIST_HEAD(completions); 607 LIST_HEAD(completions);
605 int i; 608 int i;
606 609
@@ -628,20 +631,9 @@ lpfc_hba_down_post(struct lpfc_hba *phba)
628 pring->txcmplq_cnt = 0; 631 pring->txcmplq_cnt = 0;
629 spin_unlock_irq(&phba->hbalock); 632 spin_unlock_irq(&phba->hbalock);
630 633
631 while (!list_empty(&completions)) { 634 /* Cancel all the IOCBs from the completions list */
632 iocb = list_get_first(&completions, struct lpfc_iocbq, 635 lpfc_sli_cancel_iocbs(phba, &completions, IOSTAT_LOCAL_REJECT,
633 list); 636 IOERR_SLI_ABORTED);
634 cmd = &iocb->iocb;
635 list_del_init(&iocb->list);
636
637 if (!iocb->iocb_cmpl)
638 lpfc_sli_release_iocbq(phba, iocb);
639 else {
640 cmd->ulpStatus = IOSTAT_LOCAL_REJECT;
641 cmd->un.ulpWord[4] = IOERR_SLI_ABORTED;
642 (iocb->iocb_cmpl) (phba, iocb, iocb);
643 }
644 }
645 637
646 lpfc_sli_abort_iocb_ring(phba, pring); 638 lpfc_sli_abort_iocb_ring(phba, pring);
647 spin_lock_irq(&phba->hbalock); 639 spin_lock_irq(&phba->hbalock);
@@ -652,7 +644,7 @@ lpfc_hba_down_post(struct lpfc_hba *phba)
652} 644}
653 645
654/** 646/**
655 * lpfc_hb_timeout: The HBA-timer timeout handler. 647 * lpfc_hb_timeout - The HBA-timer timeout handler
656 * @ptr: unsigned long holds the pointer to lpfc hba data structure. 648 * @ptr: unsigned long holds the pointer to lpfc hba data structure.
657 * 649 *
658 * This is the HBA-timer timeout handler registered to the lpfc driver. When 650 * This is the HBA-timer timeout handler registered to the lpfc driver. When
@@ -686,7 +678,7 @@ lpfc_hb_timeout(unsigned long ptr)
686} 678}
687 679
688/** 680/**
689 * lpfc_hb_mbox_cmpl: The lpfc heart-beat mailbox command callback function. 681 * lpfc_hb_mbox_cmpl - The lpfc heart-beat mailbox command callback function
690 * @phba: pointer to lpfc hba data structure. 682 * @phba: pointer to lpfc hba data structure.
691 * @pmboxq: pointer to the driver internal queue element for mailbox command. 683 * @pmboxq: pointer to the driver internal queue element for mailbox command.
692 * 684 *
@@ -721,7 +713,7 @@ lpfc_hb_mbox_cmpl(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmboxq)
721} 713}
722 714
723/** 715/**
724 * lpfc_hb_timeout_handler: The HBA-timer timeout handler. 716 * lpfc_hb_timeout_handler - The HBA-timer timeout handler
725 * @phba: pointer to lpfc hba data structure. 717 * @phba: pointer to lpfc hba data structure.
726 * 718 *
727 * This is the actual HBA-timer timeout handler to be invoked by the worker 719 * This is the actual HBA-timer timeout handler to be invoked by the worker
@@ -830,7 +822,7 @@ lpfc_hb_timeout_handler(struct lpfc_hba *phba)
830} 822}
831 823
832/** 824/**
833 * lpfc_offline_eratt: Bring lpfc offline on hardware error attention. 825 * lpfc_offline_eratt - Bring lpfc offline on hardware error attention
834 * @phba: pointer to lpfc hba data structure. 826 * @phba: pointer to lpfc hba data structure.
835 * 827 *
836 * This routine is called to bring the HBA offline when HBA hardware error 828 * This routine is called to bring the HBA offline when HBA hardware error
@@ -857,7 +849,73 @@ lpfc_offline_eratt(struct lpfc_hba *phba)
857} 849}
858 850
859/** 851/**
860 * lpfc_handle_eratt: The HBA hardware error handler. 852 * lpfc_handle_deferred_eratt - The HBA hardware deferred error handler
853 * @phba: pointer to lpfc hba data structure.
854 *
855 * This routine is invoked to handle the deferred HBA hardware error
856 * conditions. This type of error is indicated by HBA by setting ER1
857 * and another ER bit in the host status register. The driver will
858 * wait until the ER1 bit clears before handling the error condition.
859 **/
860static void
861lpfc_handle_deferred_eratt(struct lpfc_hba *phba)
862{
863 uint32_t old_host_status = phba->work_hs;
864 struct lpfc_sli_ring *pring;
865 struct lpfc_sli *psli = &phba->sli;
866
867 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
868 "0479 Deferred Adapter Hardware Error "
869 "Data: x%x x%x x%x\n",
870 phba->work_hs,
871 phba->work_status[0], phba->work_status[1]);
872
873 spin_lock_irq(&phba->hbalock);
874 psli->sli_flag &= ~LPFC_SLI2_ACTIVE;
875 spin_unlock_irq(&phba->hbalock);
876
877
878 /*
879 * Firmware stops when it triggred erratt. That could cause the I/Os
880 * dropped by the firmware. Error iocb (I/O) on txcmplq and let the
881 * SCSI layer retry it after re-establishing link.
882 */
883 pring = &psli->ring[psli->fcp_ring];
884 lpfc_sli_abort_iocb_ring(phba, pring);
885
886 /*
887 * There was a firmware error. Take the hba offline and then
888 * attempt to restart it.
889 */
890 lpfc_offline_prep(phba);
891 lpfc_offline(phba);
892
893 /* Wait for the ER1 bit to clear.*/
894 while (phba->work_hs & HS_FFER1) {
895 msleep(100);
896 phba->work_hs = readl(phba->HSregaddr);
897 /* If driver is unloading let the worker thread continue */
898 if (phba->pport->load_flag & FC_UNLOADING) {
899 phba->work_hs = 0;
900 break;
901 }
902 }
903
904 /*
905 * This is to ptrotect against a race condition in which
906 * first write to the host attention register clear the
907 * host status register.
908 */
909 if ((!phba->work_hs) && (!(phba->pport->load_flag & FC_UNLOADING)))
910 phba->work_hs = old_host_status & ~HS_FFER1;
911
912 phba->hba_flag &= ~DEFER_ERATT;
913 phba->work_status[0] = readl(phba->MBslimaddr + 0xa8);
914 phba->work_status[1] = readl(phba->MBslimaddr + 0xac);
915}
916
917/**
918 * lpfc_handle_eratt - The HBA hardware error handler
861 * @phba: pointer to lpfc hba data structure. 919 * @phba: pointer to lpfc hba data structure.
862 * 920 *
863 * This routine is invoked to handle the following HBA hardware error 921 * This routine is invoked to handle the following HBA hardware error
@@ -895,6 +953,9 @@ lpfc_handle_eratt(struct lpfc_hba *phba)
895 (char *) &board_event, 953 (char *) &board_event,
896 LPFC_NL_VENDOR_ID); 954 LPFC_NL_VENDOR_ID);
897 955
956 if (phba->hba_flag & DEFER_ERATT)
957 lpfc_handle_deferred_eratt(phba);
958
898 if (phba->work_hs & HS_FFER6) { 959 if (phba->work_hs & HS_FFER6) {
899 /* Re-establishing Link */ 960 /* Re-establishing Link */
900 lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT, 961 lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT,
@@ -976,7 +1037,7 @@ lpfc_handle_eratt(struct lpfc_hba *phba)
976} 1037}
977 1038
978/** 1039/**
979 * lpfc_handle_latt: The HBA link event handler. 1040 * lpfc_handle_latt - The HBA link event handler
980 * @phba: pointer to lpfc hba data structure. 1041 * @phba: pointer to lpfc hba data structure.
981 * 1042 *
982 * This routine is invoked from the worker thread to handle a HBA host 1043 * This routine is invoked from the worker thread to handle a HBA host
@@ -1063,7 +1124,7 @@ lpfc_handle_latt_err_exit:
1063} 1124}
1064 1125
1065/** 1126/**
1066 * lpfc_parse_vpd: Parse VPD (Vital Product Data). 1127 * lpfc_parse_vpd - Parse VPD (Vital Product Data)
1067 * @phba: pointer to lpfc hba data structure. 1128 * @phba: pointer to lpfc hba data structure.
1068 * @vpd: pointer to the vital product data. 1129 * @vpd: pointer to the vital product data.
1069 * @len: length of the vital product data in bytes. 1130 * @len: length of the vital product data in bytes.
@@ -1213,7 +1274,7 @@ lpfc_parse_vpd(struct lpfc_hba *phba, uint8_t *vpd, int len)
1213} 1274}
1214 1275
1215/** 1276/**
1216 * lpfc_get_hba_model_desc: Retrieve HBA device model name and description. 1277 * lpfc_get_hba_model_desc - Retrieve HBA device model name and description
1217 * @phba: pointer to lpfc hba data structure. 1278 * @phba: pointer to lpfc hba data structure.
1218 * @mdp: pointer to the data structure to hold the derived model name. 1279 * @mdp: pointer to the data structure to hold the derived model name.
1219 * @descp: pointer to the data structure to hold the derived description. 1280 * @descp: pointer to the data structure to hold the derived description.
@@ -1322,7 +1383,8 @@ lpfc_get_hba_model_desc(struct lpfc_hba *phba, uint8_t *mdp, uint8_t *descp)
1322 m = (typeof(m)){"LPe11000", max_speed, "PCIe"}; 1383 m = (typeof(m)){"LPe11000", max_speed, "PCIe"};
1323 break; 1384 break;
1324 case PCI_DEVICE_ID_ZEPHYR_DCSP: 1385 case PCI_DEVICE_ID_ZEPHYR_DCSP:
1325 m = (typeof(m)){"LPe11002-SP", max_speed, "PCIe"}; 1386 m = (typeof(m)){"LP2105", max_speed, "PCIe"};
1387 GE = 1;
1326 break; 1388 break;
1327 case PCI_DEVICE_ID_ZMID: 1389 case PCI_DEVICE_ID_ZMID:
1328 m = (typeof(m)){"LPe1150", max_speed, "PCIe"}; 1390 m = (typeof(m)){"LPe1150", max_speed, "PCIe"};
@@ -1392,7 +1454,7 @@ lpfc_get_hba_model_desc(struct lpfc_hba *phba, uint8_t *mdp, uint8_t *descp)
1392} 1454}
1393 1455
1394/** 1456/**
1395 * lpfc_post_buffer: Post IOCB(s) with DMA buffer descriptor(s) to a IOCB ring. 1457 * lpfc_post_buffer - Post IOCB(s) with DMA buffer descriptor(s) to a IOCB ring
1396 * @phba: pointer to lpfc hba data structure. 1458 * @phba: pointer to lpfc hba data structure.
1397 * @pring: pointer to a IOCB ring. 1459 * @pring: pointer to a IOCB ring.
1398 * @cnt: the number of IOCBs to be posted to the IOCB ring. 1460 * @cnt: the number of IOCBs to be posted to the IOCB ring.
@@ -1493,7 +1555,7 @@ lpfc_post_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, int cnt)
1493} 1555}
1494 1556
1495/** 1557/**
1496 * lpfc_post_rcv_buf: Post the initial receive IOCB buffers to ELS ring. 1558 * lpfc_post_rcv_buf - Post the initial receive IOCB buffers to ELS ring
1497 * @phba: pointer to lpfc hba data structure. 1559 * @phba: pointer to lpfc hba data structure.
1498 * 1560 *
1499 * This routine posts initial receive IOCB buffers to the ELS ring. The 1561 * This routine posts initial receive IOCB buffers to the ELS ring. The
@@ -1518,7 +1580,7 @@ lpfc_post_rcv_buf(struct lpfc_hba *phba)
1518#define S(N,V) (((V)<<(N))|((V)>>(32-(N)))) 1580#define S(N,V) (((V)<<(N))|((V)>>(32-(N))))
1519 1581
1520/** 1582/**
1521 * lpfc_sha_init: Set up initial array of hash table entries. 1583 * lpfc_sha_init - Set up initial array of hash table entries
1522 * @HashResultPointer: pointer to an array as hash table. 1584 * @HashResultPointer: pointer to an array as hash table.
1523 * 1585 *
1524 * This routine sets up the initial values to the array of hash table entries 1586 * This routine sets up the initial values to the array of hash table entries
@@ -1535,7 +1597,7 @@ lpfc_sha_init(uint32_t * HashResultPointer)
1535} 1597}
1536 1598
1537/** 1599/**
1538 * lpfc_sha_iterate: Iterate initial hash table with the working hash table. 1600 * lpfc_sha_iterate - Iterate initial hash table with the working hash table
1539 * @HashResultPointer: pointer to an initial/result hash table. 1601 * @HashResultPointer: pointer to an initial/result hash table.
1540 * @HashWorkingPointer: pointer to an working hash table. 1602 * @HashWorkingPointer: pointer to an working hash table.
1541 * 1603 *
@@ -1592,7 +1654,7 @@ lpfc_sha_iterate(uint32_t * HashResultPointer, uint32_t * HashWorkingPointer)
1592} 1654}
1593 1655
1594/** 1656/**
1595 * lpfc_challenge_key: Create challenge key based on WWPN of the HBA. 1657 * lpfc_challenge_key - Create challenge key based on WWPN of the HBA
1596 * @RandomChallenge: pointer to the entry of host challenge random number array. 1658 * @RandomChallenge: pointer to the entry of host challenge random number array.
1597 * @HashWorking: pointer to the entry of the working hash array. 1659 * @HashWorking: pointer to the entry of the working hash array.
1598 * 1660 *
@@ -1608,7 +1670,7 @@ lpfc_challenge_key(uint32_t * RandomChallenge, uint32_t * HashWorking)
1608} 1670}
1609 1671
1610/** 1672/**
1611 * lpfc_hba_init: Perform special handling for LC HBA initialization. 1673 * lpfc_hba_init - Perform special handling for LC HBA initialization
1612 * @phba: pointer to lpfc hba data structure. 1674 * @phba: pointer to lpfc hba data structure.
1613 * @hbainit: pointer to an array of unsigned 32-bit integers. 1675 * @hbainit: pointer to an array of unsigned 32-bit integers.
1614 * 1676 *
@@ -1637,7 +1699,7 @@ lpfc_hba_init(struct lpfc_hba *phba, uint32_t *hbainit)
1637} 1699}
1638 1700
1639/** 1701/**
1640 * lpfc_cleanup: Performs vport cleanups before deleting a vport. 1702 * lpfc_cleanup - Performs vport cleanups before deleting a vport
1641 * @vport: pointer to a virtual N_Port data structure. 1703 * @vport: pointer to a virtual N_Port data structure.
1642 * 1704 *
1643 * This routine performs the necessary cleanups before deleting the @vport. 1705 * This routine performs the necessary cleanups before deleting the @vport.
@@ -1724,7 +1786,7 @@ lpfc_cleanup(struct lpfc_vport *vport)
1724} 1786}
1725 1787
1726/** 1788/**
1727 * lpfc_stop_vport_timers: Stop all the timers associated with a vport. 1789 * lpfc_stop_vport_timers - Stop all the timers associated with a vport
1728 * @vport: pointer to a virtual N_Port data structure. 1790 * @vport: pointer to a virtual N_Port data structure.
1729 * 1791 *
1730 * This routine stops all the timers associated with a @vport. This function 1792 * This routine stops all the timers associated with a @vport. This function
@@ -1741,7 +1803,7 @@ lpfc_stop_vport_timers(struct lpfc_vport *vport)
1741} 1803}
1742 1804
1743/** 1805/**
1744 * lpfc_stop_phba_timers: Stop all the timers associated with an HBA. 1806 * lpfc_stop_phba_timers - Stop all the timers associated with an HBA
1745 * @phba: pointer to lpfc hba data structure. 1807 * @phba: pointer to lpfc hba data structure.
1746 * 1808 *
1747 * This routine stops all the timers associated with a HBA. This function is 1809 * This routine stops all the timers associated with a HBA. This function is
@@ -1761,7 +1823,7 @@ lpfc_stop_phba_timers(struct lpfc_hba *phba)
1761} 1823}
1762 1824
1763/** 1825/**
1764 * lpfc_block_mgmt_io: Mark a HBA's management interface as blocked. 1826 * lpfc_block_mgmt_io - Mark a HBA's management interface as blocked
1765 * @phba: pointer to lpfc hba data structure. 1827 * @phba: pointer to lpfc hba data structure.
1766 * 1828 *
1767 * This routine marks a HBA's management interface as blocked. Once the HBA's 1829 * This routine marks a HBA's management interface as blocked. Once the HBA's
@@ -1781,7 +1843,7 @@ lpfc_block_mgmt_io(struct lpfc_hba * phba)
1781} 1843}
1782 1844
1783/** 1845/**
1784 * lpfc_online: Initialize and bring a HBA online. 1846 * lpfc_online - Initialize and bring a HBA online
1785 * @phba: pointer to lpfc hba data structure. 1847 * @phba: pointer to lpfc hba data structure.
1786 * 1848 *
1787 * This routine initializes the HBA and brings a HBA online. During this 1849 * This routine initializes the HBA and brings a HBA online. During this
@@ -1839,7 +1901,7 @@ lpfc_online(struct lpfc_hba *phba)
1839} 1901}
1840 1902
1841/** 1903/**
1842 * lpfc_unblock_mgmt_io: Mark a HBA's management interface to be not blocked. 1904 * lpfc_unblock_mgmt_io - Mark a HBA's management interface to be not blocked
1843 * @phba: pointer to lpfc hba data structure. 1905 * @phba: pointer to lpfc hba data structure.
1844 * 1906 *
1845 * This routine marks a HBA's management interface as not blocked. Once the 1907 * This routine marks a HBA's management interface as not blocked. Once the
@@ -1860,7 +1922,7 @@ lpfc_unblock_mgmt_io(struct lpfc_hba * phba)
1860} 1922}
1861 1923
1862/** 1924/**
1863 * lpfc_offline_prep: Prepare a HBA to be brought offline. 1925 * lpfc_offline_prep - Prepare a HBA to be brought offline
1864 * @phba: pointer to lpfc hba data structure. 1926 * @phba: pointer to lpfc hba data structure.
1865 * 1927 *
1866 * This routine is invoked to prepare a HBA to be brought offline. It performs 1928 * This routine is invoked to prepare a HBA to be brought offline. It performs
@@ -1917,7 +1979,7 @@ lpfc_offline_prep(struct lpfc_hba * phba)
1917} 1979}
1918 1980
1919/** 1981/**
1920 * lpfc_offline: Bring a HBA offline. 1982 * lpfc_offline - Bring a HBA offline
1921 * @phba: pointer to lpfc hba data structure. 1983 * @phba: pointer to lpfc hba data structure.
1922 * 1984 *
1923 * This routine actually brings a HBA offline. It stops all the timers 1985 * This routine actually brings a HBA offline. It stops all the timers
@@ -1962,7 +2024,7 @@ lpfc_offline(struct lpfc_hba *phba)
1962} 2024}
1963 2025
1964/** 2026/**
1965 * lpfc_scsi_free: Free all the SCSI buffers and IOCBs from driver lists. 2027 * lpfc_scsi_free - Free all the SCSI buffers and IOCBs from driver lists
1966 * @phba: pointer to lpfc hba data structure. 2028 * @phba: pointer to lpfc hba data structure.
1967 * 2029 *
1968 * This routine is to free all the SCSI buffers and IOCBs from the driver 2030 * This routine is to free all the SCSI buffers and IOCBs from the driver
@@ -2001,7 +2063,7 @@ lpfc_scsi_free(struct lpfc_hba *phba)
2001} 2063}
2002 2064
2003/** 2065/**
2004 * lpfc_create_port: Create an FC port. 2066 * lpfc_create_port - Create an FC port
2005 * @phba: pointer to lpfc hba data structure. 2067 * @phba: pointer to lpfc hba data structure.
2006 * @instance: a unique integer ID to this FC port. 2068 * @instance: a unique integer ID to this FC port.
2007 * @dev: pointer to the device data structure. 2069 * @dev: pointer to the device data structure.
@@ -2091,7 +2153,7 @@ out:
2091} 2153}
2092 2154
2093/** 2155/**
2094 * destroy_port: Destroy an FC port. 2156 * destroy_port - destroy an FC port
2095 * @vport: pointer to an lpfc virtual N_Port data structure. 2157 * @vport: pointer to an lpfc virtual N_Port data structure.
2096 * 2158 *
2097 * This routine destroys a FC port from the upper layer protocol. All the 2159 * This routine destroys a FC port from the upper layer protocol. All the
@@ -2116,7 +2178,7 @@ destroy_port(struct lpfc_vport *vport)
2116} 2178}
2117 2179
2118/** 2180/**
2119 * lpfc_get_instance: Get a unique integer ID. 2181 * lpfc_get_instance - Get a unique integer ID
2120 * 2182 *
2121 * This routine allocates a unique integer ID from lpfc_hba_index pool. It 2183 * This routine allocates a unique integer ID from lpfc_hba_index pool. It
2122 * uses the kernel idr facility to perform the task. 2184 * uses the kernel idr facility to perform the task.
@@ -2139,7 +2201,7 @@ lpfc_get_instance(void)
2139} 2201}
2140 2202
2141/** 2203/**
2142 * lpfc_scan_finished: method for SCSI layer to detect whether scan is done. 2204 * lpfc_scan_finished - method for SCSI layer to detect whether scan is done
2143 * @shost: pointer to SCSI host data structure. 2205 * @shost: pointer to SCSI host data structure.
2144 * @time: elapsed time of the scan in jiffies. 2206 * @time: elapsed time of the scan in jiffies.
2145 * 2207 *
@@ -2197,7 +2259,7 @@ finished:
2197} 2259}
2198 2260
2199/** 2261/**
2200 * lpfc_host_attrib_init: Initialize SCSI host attributes on a FC port. 2262 * lpfc_host_attrib_init - Initialize SCSI host attributes on a FC port
2201 * @shost: pointer to SCSI host data structure. 2263 * @shost: pointer to SCSI host data structure.
2202 * 2264 *
2203 * This routine initializes a given SCSI host attributes on a FC port. The 2265 * This routine initializes a given SCSI host attributes on a FC port. The
@@ -2252,7 +2314,7 @@ void lpfc_host_attrib_init(struct Scsi_Host *shost)
2252} 2314}
2253 2315
2254/** 2316/**
2255 * lpfc_enable_msix: Enable MSI-X interrupt mode. 2317 * lpfc_enable_msix - Enable MSI-X interrupt mode
2256 * @phba: pointer to lpfc hba data structure. 2318 * @phba: pointer to lpfc hba data structure.
2257 * 2319 *
2258 * This routine is invoked to enable the MSI-X interrupt vectors. The kernel 2320 * This routine is invoked to enable the MSI-X interrupt vectors. The kernel
@@ -2366,7 +2428,7 @@ msi_fail_out:
2366} 2428}
2367 2429
2368/** 2430/**
2369 * lpfc_disable_msix: Disable MSI-X interrupt mode. 2431 * lpfc_disable_msix - Disable MSI-X interrupt mode
2370 * @phba: pointer to lpfc hba data structure. 2432 * @phba: pointer to lpfc hba data structure.
2371 * 2433 *
2372 * This routine is invoked to release the MSI-X vectors and then disable the 2434 * This routine is invoked to release the MSI-X vectors and then disable the
@@ -2385,7 +2447,7 @@ lpfc_disable_msix(struct lpfc_hba *phba)
2385} 2447}
2386 2448
2387/** 2449/**
2388 * lpfc_enable_msi: Enable MSI interrupt mode. 2450 * lpfc_enable_msi - Enable MSI interrupt mode
2389 * @phba: pointer to lpfc hba data structure. 2451 * @phba: pointer to lpfc hba data structure.
2390 * 2452 *
2391 * This routine is invoked to enable the MSI interrupt mode. The kernel 2453 * This routine is invoked to enable the MSI interrupt mode. The kernel
@@ -2423,7 +2485,7 @@ lpfc_enable_msi(struct lpfc_hba *phba)
2423} 2485}
2424 2486
2425/** 2487/**
2426 * lpfc_disable_msi: Disable MSI interrupt mode. 2488 * lpfc_disable_msi - Disable MSI interrupt mode
2427 * @phba: pointer to lpfc hba data structure. 2489 * @phba: pointer to lpfc hba data structure.
2428 * 2490 *
2429 * This routine is invoked to disable the MSI interrupt mode. The driver 2491 * This routine is invoked to disable the MSI interrupt mode. The driver
@@ -2441,7 +2503,7 @@ lpfc_disable_msi(struct lpfc_hba *phba)
2441} 2503}
2442 2504
2443/** 2505/**
2444 * lpfc_log_intr_mode: Log the active interrupt mode 2506 * lpfc_log_intr_mode - Log the active interrupt mode
2445 * @phba: pointer to lpfc hba data structure. 2507 * @phba: pointer to lpfc hba data structure.
2446 * @intr_mode: active interrupt mode adopted. 2508 * @intr_mode: active interrupt mode adopted.
2447 * 2509 *
@@ -2490,7 +2552,7 @@ lpfc_stop_port(struct lpfc_hba *phba)
2490} 2552}
2491 2553
2492/** 2554/**
2493 * lpfc_enable_intr: Enable device interrupt. 2555 * lpfc_enable_intr - Enable device interrupt
2494 * @phba: pointer to lpfc hba data structure. 2556 * @phba: pointer to lpfc hba data structure.
2495 * 2557 *
2496 * This routine is invoked to enable device interrupt and associate driver's 2558 * This routine is invoked to enable device interrupt and associate driver's
@@ -2547,7 +2609,7 @@ lpfc_enable_intr(struct lpfc_hba *phba, uint32_t cfg_mode)
2547} 2609}
2548 2610
2549/** 2611/**
2550 * lpfc_disable_intr: Disable device interrupt. 2612 * lpfc_disable_intr - Disable device interrupt
2551 * @phba: pointer to lpfc hba data structure. 2613 * @phba: pointer to lpfc hba data structure.
2552 * 2614 *
2553 * This routine is invoked to disable device interrupt and disassociate the 2615 * This routine is invoked to disable device interrupt and disassociate the
@@ -2574,7 +2636,7 @@ lpfc_disable_intr(struct lpfc_hba *phba)
2574} 2636}
2575 2637
2576/** 2638/**
2577 * lpfc_pci_probe_one: lpfc PCI probe func to register device to PCI subsystem. 2639 * lpfc_pci_probe_one - lpfc PCI probe func to register device to PCI subsystem
2578 * @pdev: pointer to PCI device 2640 * @pdev: pointer to PCI device
2579 * @pid: pointer to PCI device identifier 2641 * @pid: pointer to PCI device identifier
2580 * 2642 *
@@ -3010,7 +3072,7 @@ out:
3010} 3072}
3011 3073
3012/** 3074/**
3013 * lpfc_pci_remove_one: lpfc PCI func to unregister device from PCI subsystem. 3075 * lpfc_pci_remove_one - lpfc PCI func to unregister device from PCI subsystem
3014 * @pdev: pointer to PCI device 3076 * @pdev: pointer to PCI device
3015 * 3077 *
3016 * This routine is to be registered to the kernel's PCI subsystem. When an 3078 * This routine is to be registered to the kernel's PCI subsystem. When an
@@ -3033,8 +3095,6 @@ lpfc_pci_remove_one(struct pci_dev *pdev)
3033 3095
3034 lpfc_free_sysfs_attr(vport); 3096 lpfc_free_sysfs_attr(vport);
3035 3097
3036 kthread_stop(phba->worker_thread);
3037
3038 /* Release all the vports against this physical port */ 3098 /* Release all the vports against this physical port */
3039 vports = lpfc_create_vport_work_array(phba); 3099 vports = lpfc_create_vport_work_array(phba);
3040 if (vports != NULL) 3100 if (vports != NULL)
@@ -3052,7 +3112,12 @@ lpfc_pci_remove_one(struct pci_dev *pdev)
3052 * clears the rings, discards all mailbox commands, and resets 3112 * clears the rings, discards all mailbox commands, and resets
3053 * the HBA. 3113 * the HBA.
3054 */ 3114 */
3115
3116 /* HBA interrupt will be diabled after this call */
3055 lpfc_sli_hba_down(phba); 3117 lpfc_sli_hba_down(phba);
3118 /* Stop kthread signal shall trigger work_done one more time */
3119 kthread_stop(phba->worker_thread);
3120 /* Final cleanup of txcmplq and reset the HBA */
3056 lpfc_sli_brdrestart(phba); 3121 lpfc_sli_brdrestart(phba);
3057 3122
3058 lpfc_stop_phba_timers(phba); 3123 lpfc_stop_phba_timers(phba);
@@ -3095,7 +3160,7 @@ lpfc_pci_remove_one(struct pci_dev *pdev)
3095} 3160}
3096 3161
3097/** 3162/**
3098 * lpfc_pci_suspend_one: lpfc PCI func to suspend device for power management. 3163 * lpfc_pci_suspend_one - lpfc PCI func to suspend device for power management
3099 * @pdev: pointer to PCI device 3164 * @pdev: pointer to PCI device
3100 * @msg: power management message 3165 * @msg: power management message
3101 * 3166 *
@@ -3139,7 +3204,7 @@ lpfc_pci_suspend_one(struct pci_dev *pdev, pm_message_t msg)
3139} 3204}
3140 3205
3141/** 3206/**
3142 * lpfc_pci_resume_one: lpfc PCI func to resume device for power management. 3207 * lpfc_pci_resume_one - lpfc PCI func to resume device for power management
3143 * @pdev: pointer to PCI device 3208 * @pdev: pointer to PCI device
3144 * 3209 *
3145 * This routine is to be registered to the kernel's PCI subsystem to support 3210 * This routine is to be registered to the kernel's PCI subsystem to support
@@ -3204,7 +3269,7 @@ lpfc_pci_resume_one(struct pci_dev *pdev)
3204} 3269}
3205 3270
3206/** 3271/**
3207 * lpfc_io_error_detected: Driver method for handling PCI I/O error detected. 3272 * lpfc_io_error_detected - Driver method for handling PCI I/O error detected
3208 * @pdev: pointer to PCI device. 3273 * @pdev: pointer to PCI device.
3209 * @state: the current PCI connection state. 3274 * @state: the current PCI connection state.
3210 * 3275 *
@@ -3254,7 +3319,7 @@ static pci_ers_result_t lpfc_io_error_detected(struct pci_dev *pdev,
3254} 3319}
3255 3320
3256/** 3321/**
3257 * lpfc_io_slot_reset: Restart a PCI device from scratch. 3322 * lpfc_io_slot_reset - Restart a PCI device from scratch
3258 * @pdev: pointer to PCI device. 3323 * @pdev: pointer to PCI device.
3259 * 3324 *
3260 * This routine is registered to the PCI subsystem for error handling. This is 3325 * This routine is registered to the PCI subsystem for error handling. This is
@@ -3313,7 +3378,7 @@ static pci_ers_result_t lpfc_io_slot_reset(struct pci_dev *pdev)
3313} 3378}
3314 3379
3315/** 3380/**
3316 * lpfc_io_resume: Resume PCI I/O operation. 3381 * lpfc_io_resume - Resume PCI I/O operation
3317 * @pdev: pointer to PCI device 3382 * @pdev: pointer to PCI device
3318 * 3383 *
3319 * This routine is registered to the PCI subsystem for error handling. It is 3384 * This routine is registered to the PCI subsystem for error handling. It is
@@ -3426,7 +3491,7 @@ static struct pci_driver lpfc_driver = {
3426}; 3491};
3427 3492
3428/** 3493/**
3429 * lpfc_init: lpfc module initialization routine. 3494 * lpfc_init - lpfc module initialization routine
3430 * 3495 *
3431 * This routine is to be invoked when the lpfc module is loaded into the 3496 * This routine is to be invoked when the lpfc module is loaded into the
3432 * kernel. The special kernel macro module_init() is used to indicate the 3497 * kernel. The special kernel macro module_init() is used to indicate the
@@ -3472,7 +3537,7 @@ lpfc_init(void)
3472} 3537}
3473 3538
3474/** 3539/**
3475 * lpfc_exit: lpfc module removal routine. 3540 * lpfc_exit - lpfc module removal routine
3476 * 3541 *
3477 * This routine is invoked when the lpfc module is removed from the kernel. 3542 * This routine is invoked when the lpfc module is removed from the kernel.
3478 * The special kernel macro module_exit() is used to indicate the role of 3543 * The special kernel macro module_exit() is used to indicate the role of
diff --git a/drivers/scsi/lpfc/lpfc_logmsg.h b/drivers/scsi/lpfc/lpfc_logmsg.h
index a85b7c196bb..1aa85709b01 100644
--- a/drivers/scsi/lpfc/lpfc_logmsg.h
+++ b/drivers/scsi/lpfc/lpfc_logmsg.h
@@ -27,7 +27,7 @@
27#define LOG_FCP 0x40 /* FCP traffic history */ 27#define LOG_FCP 0x40 /* FCP traffic history */
28#define LOG_NODE 0x80 /* Node table events */ 28#define LOG_NODE 0x80 /* Node table events */
29#define LOG_TEMP 0x100 /* Temperature sensor events */ 29#define LOG_TEMP 0x100 /* Temperature sensor events */
30#define LOG_BG 0x200 /* BlockBuard events */ 30#define LOG_BG 0x200 /* BlockGuard events */
31#define LOG_MISC 0x400 /* Miscellaneous events */ 31#define LOG_MISC 0x400 /* Miscellaneous events */
32#define LOG_SLI 0x800 /* SLI events */ 32#define LOG_SLI 0x800 /* SLI events */
33#define LOG_FCP_ERROR 0x1000 /* log errors, not underruns */ 33#define LOG_FCP_ERROR 0x1000 /* log errors, not underruns */
diff --git a/drivers/scsi/lpfc/lpfc_mbox.c b/drivers/scsi/lpfc/lpfc_mbox.c
index 34eeb086a66..134fc7fc212 100644
--- a/drivers/scsi/lpfc/lpfc_mbox.c
+++ b/drivers/scsi/lpfc/lpfc_mbox.c
@@ -39,7 +39,7 @@
39#include "lpfc_compat.h" 39#include "lpfc_compat.h"
40 40
41/** 41/**
42 * lpfc_dump_mem: Prepare a mailbox command for retrieving HBA's VPD memory. 42 * lpfc_dump_mem - Prepare a mailbox command for retrieving HBA's VPD memory
43 * @phba: pointer to lpfc hba data structure. 43 * @phba: pointer to lpfc hba data structure.
44 * @pmb: pointer to the driver internal queue element for mailbox command. 44 * @pmb: pointer to the driver internal queue element for mailbox command.
45 * @offset: offset for dumping VPD memory mailbox command. 45 * @offset: offset for dumping VPD memory mailbox command.
@@ -77,9 +77,10 @@ lpfc_dump_mem(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb, uint16_t offset)
77} 77}
78 78
79/** 79/**
80 * lpfc_dump_mem: Prepare a mailbox command for retrieving wakeup params. 80 * lpfc_dump_wakeup_param - Prepare mailbox command for retrieving wakeup params
81 * @phba: pointer to lpfc hba data structure. 81 * @phba: pointer to lpfc hba data structure.
82 * @pmb: pointer to the driver internal queue element for mailbox command. 82 * @pmb: pointer to the driver internal queue element for mailbox command.
83 *
83 * This function create a dump memory mailbox command to dump wake up 84 * This function create a dump memory mailbox command to dump wake up
84 * parameters. 85 * parameters.
85 */ 86 */
@@ -109,7 +110,7 @@ lpfc_dump_wakeup_param(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
109} 110}
110 111
111/** 112/**
112 * lpfc_read_nv: Prepare a mailbox command for reading HBA's NVRAM param. 113 * lpfc_read_nv - Prepare a mailbox command for reading HBA's NVRAM param
113 * @phba: pointer to lpfc hba data structure. 114 * @phba: pointer to lpfc hba data structure.
114 * @pmb: pointer to the driver internal queue element for mailbox command. 115 * @pmb: pointer to the driver internal queue element for mailbox command.
115 * 116 *
@@ -132,7 +133,7 @@ lpfc_read_nv(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
132} 133}
133 134
134/** 135/**
135 * lpfc_config_async: Prepare a mailbox command for enabling HBA async event. 136 * lpfc_config_async - Prepare a mailbox command for enabling HBA async event
136 * @phba: pointer to lpfc hba data structure. 137 * @phba: pointer to lpfc hba data structure.
137 * @pmb: pointer to the driver internal queue element for mailbox command. 138 * @pmb: pointer to the driver internal queue element for mailbox command.
138 * @ring: ring number for the asynchronous event to be configured. 139 * @ring: ring number for the asynchronous event to be configured.
@@ -159,7 +160,7 @@ lpfc_config_async(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb,
159} 160}
160 161
161/** 162/**
162 * lpfc_heart_beat: Prepare a mailbox command for heart beat. 163 * lpfc_heart_beat - Prepare a mailbox command for heart beat
163 * @phba: pointer to lpfc hba data structure. 164 * @phba: pointer to lpfc hba data structure.
164 * @pmb: pointer to the driver internal queue element for mailbox command. 165 * @pmb: pointer to the driver internal queue element for mailbox command.
165 * 166 *
@@ -184,7 +185,7 @@ lpfc_heart_beat(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
184} 185}
185 186
186/** 187/**
187 * lpfc_read_la: Prepare a mailbox command for reading HBA link attention. 188 * lpfc_read_la - Prepare a mailbox command for reading HBA link attention
188 * @phba: pointer to lpfc hba data structure. 189 * @phba: pointer to lpfc hba data structure.
189 * @pmb: pointer to the driver internal queue element for mailbox command. 190 * @pmb: pointer to the driver internal queue element for mailbox command.
190 * @mp: DMA buffer memory for reading the link attention information into. 191 * @mp: DMA buffer memory for reading the link attention information into.
@@ -228,7 +229,7 @@ lpfc_read_la(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb, struct lpfc_dmabuf *mp)
228} 229}
229 230
230/** 231/**
231 * lpfc_clear_la: Prepare a mailbox command for clearing HBA link attention. 232 * lpfc_clear_la - Prepare a mailbox command for clearing HBA link attention
232 * @phba: pointer to lpfc hba data structure. 233 * @phba: pointer to lpfc hba data structure.
233 * @pmb: pointer to the driver internal queue element for mailbox command. 234 * @pmb: pointer to the driver internal queue element for mailbox command.
234 * 235 *
@@ -257,7 +258,7 @@ lpfc_clear_la(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
257} 258}
258 259
259/** 260/**
260 * lpfc_config_link: Prepare a mailbox command for configuring link on a HBA. 261 * lpfc_config_link - Prepare a mailbox command for configuring link on a HBA
261 * @phba: pointer to lpfc hba data structure. 262 * @phba: pointer to lpfc hba data structure.
262 * @pmb: pointer to the driver internal queue element for mailbox command. 263 * @pmb: pointer to the driver internal queue element for mailbox command.
263 * 264 *
@@ -305,7 +306,7 @@ lpfc_config_link(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
305} 306}
306 307
307/** 308/**
308 * lpfc_config_msi: Prepare a mailbox command for configuring msi-x. 309 * lpfc_config_msi - Prepare a mailbox command for configuring msi-x
309 * @phba: pointer to lpfc hba data structure. 310 * @phba: pointer to lpfc hba data structure.
310 * @pmb: pointer to the driver internal queue element for mailbox command. 311 * @pmb: pointer to the driver internal queue element for mailbox command.
311 * 312 *
@@ -383,7 +384,7 @@ lpfc_config_msi(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
383} 384}
384 385
385/** 386/**
386 * lpfc_init_link: Prepare a mailbox command for initialize link on a HBA. 387 * lpfc_init_link - Prepare a mailbox command for initialize link on a HBA
387 * @phba: pointer to lpfc hba data structure. 388 * @phba: pointer to lpfc hba data structure.
388 * @pmb: pointer to the driver internal queue element for mailbox command. 389 * @pmb: pointer to the driver internal queue element for mailbox command.
389 * @topology: the link topology for the link to be initialized to. 390 * @topology: the link topology for the link to be initialized to.
@@ -463,7 +464,7 @@ lpfc_init_link(struct lpfc_hba * phba,
463} 464}
464 465
465/** 466/**
466 * lpfc_read_sparam: Prepare a mailbox command for reading HBA parameters. 467 * lpfc_read_sparam - Prepare a mailbox command for reading HBA parameters
467 * @phba: pointer to lpfc hba data structure. 468 * @phba: pointer to lpfc hba data structure.
468 * @pmb: pointer to the driver internal queue element for mailbox command. 469 * @pmb: pointer to the driver internal queue element for mailbox command.
469 * @vpi: virtual N_Port identifier. 470 * @vpi: virtual N_Port identifier.
@@ -523,7 +524,7 @@ lpfc_read_sparam(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb, int vpi)
523} 524}
524 525
525/** 526/**
526 * lpfc_unreg_did: Prepare a mailbox command for unregistering DID. 527 * lpfc_unreg_did - Prepare a mailbox command for unregistering DID
527 * @phba: pointer to lpfc hba data structure. 528 * @phba: pointer to lpfc hba data structure.
528 * @vpi: virtual N_Port identifier. 529 * @vpi: virtual N_Port identifier.
529 * @did: remote port identifier. 530 * @did: remote port identifier.
@@ -555,7 +556,7 @@ lpfc_unreg_did(struct lpfc_hba * phba, uint16_t vpi, uint32_t did,
555} 556}
556 557
557/** 558/**
558 * lpfc_read_config: Prepare a mailbox command for reading HBA configuration. 559 * lpfc_read_config - Prepare a mailbox command for reading HBA configuration
559 * @phba: pointer to lpfc hba data structure. 560 * @phba: pointer to lpfc hba data structure.
560 * @pmb: pointer to the driver internal queue element for mailbox command. 561 * @pmb: pointer to the driver internal queue element for mailbox command.
561 * 562 *
@@ -581,7 +582,7 @@ lpfc_read_config(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
581} 582}
582 583
583/** 584/**
584 * lpfc_read_lnk_stat: Prepare a mailbox command for reading HBA link stats. 585 * lpfc_read_lnk_stat - Prepare a mailbox command for reading HBA link stats
585 * @phba: pointer to lpfc hba data structure. 586 * @phba: pointer to lpfc hba data structure.
586 * @pmb: pointer to the driver internal queue element for mailbox command. 587 * @pmb: pointer to the driver internal queue element for mailbox command.
587 * 588 *
@@ -606,7 +607,7 @@ lpfc_read_lnk_stat(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
606} 607}
607 608
608/** 609/**
609 * lpfc_reg_login: Prepare a mailbox command for registering remote login. 610 * lpfc_reg_login - Prepare a mailbox command for registering remote login
610 * @phba: pointer to lpfc hba data structure. 611 * @phba: pointer to lpfc hba data structure.
611 * @vpi: virtual N_Port identifier. 612 * @vpi: virtual N_Port identifier.
612 * @did: remote port identifier. 613 * @did: remote port identifier.
@@ -677,7 +678,7 @@ lpfc_reg_login(struct lpfc_hba *phba, uint16_t vpi, uint32_t did,
677} 678}
678 679
679/** 680/**
680 * lpfc_unreg_login: Prepare a mailbox command for unregistering remote login. 681 * lpfc_unreg_login - Prepare a mailbox command for unregistering remote login
681 * @phba: pointer to lpfc hba data structure. 682 * @phba: pointer to lpfc hba data structure.
682 * @vpi: virtual N_Port identifier. 683 * @vpi: virtual N_Port identifier.
683 * @rpi: remote port identifier 684 * @rpi: remote port identifier
@@ -709,7 +710,7 @@ lpfc_unreg_login(struct lpfc_hba *phba, uint16_t vpi, uint32_t rpi,
709} 710}
710 711
711/** 712/**
712 * lpfc_reg_vpi: Prepare a mailbox command for registering vport identifier. 713 * lpfc_reg_vpi - Prepare a mailbox command for registering vport identifier
713 * @phba: pointer to lpfc hba data structure. 714 * @phba: pointer to lpfc hba data structure.
714 * @vpi: virtual N_Port identifier. 715 * @vpi: virtual N_Port identifier.
715 * @sid: Fibre Channel S_ID (N_Port_ID assigned to a virtual N_Port). 716 * @sid: Fibre Channel S_ID (N_Port_ID assigned to a virtual N_Port).
@@ -741,7 +742,7 @@ lpfc_reg_vpi(struct lpfc_hba *phba, uint16_t vpi, uint32_t sid,
741} 742}
742 743
743/** 744/**
744 * lpfc_unreg_vpi: Prepare a mailbox command for unregistering vport id. 745 * lpfc_unreg_vpi - Prepare a mailbox command for unregistering vport id
745 * @phba: pointer to lpfc hba data structure. 746 * @phba: pointer to lpfc hba data structure.
746 * @vpi: virtual N_Port identifier. 747 * @vpi: virtual N_Port identifier.
747 * @pmb: pointer to the driver internal queue element for mailbox command. 748 * @pmb: pointer to the driver internal queue element for mailbox command.
@@ -771,7 +772,7 @@ lpfc_unreg_vpi(struct lpfc_hba *phba, uint16_t vpi, LPFC_MBOXQ_t *pmb)
771} 772}
772 773
773/** 774/**
774 * lpfc_config_pcb_setup: Set up IOCB rings in the Port Control Block (PCB) 775 * lpfc_config_pcb_setup - Set up IOCB rings in the Port Control Block (PCB)
775 * @phba: pointer to lpfc hba data structure. 776 * @phba: pointer to lpfc hba data structure.
776 * 777 *
777 * This routine sets up and initializes the IOCB rings in the Port Control 778 * This routine sets up and initializes the IOCB rings in the Port Control
@@ -835,7 +836,7 @@ lpfc_config_pcb_setup(struct lpfc_hba * phba)
835} 836}
836 837
837/** 838/**
838 * lpfc_read_rev: Prepare a mailbox command for reading HBA revision. 839 * lpfc_read_rev - Prepare a mailbox command for reading HBA revision
839 * @phba: pointer to lpfc hba data structure. 840 * @phba: pointer to lpfc hba data structure.
840 * @pmb: pointer to the driver internal queue element for mailbox command. 841 * @pmb: pointer to the driver internal queue element for mailbox command.
841 * 842 *
@@ -861,7 +862,7 @@ lpfc_read_rev(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
861} 862}
862 863
863/** 864/**
864 * lpfc_build_hbq_profile2: Set up the HBQ Selection Profile 2. 865 * lpfc_build_hbq_profile2 - Set up the HBQ Selection Profile 2
865 * @hbqmb: pointer to the HBQ configuration data structure in mailbox command. 866 * @hbqmb: pointer to the HBQ configuration data structure in mailbox command.
866 * @hbq_desc: pointer to the HBQ selection profile descriptor. 867 * @hbq_desc: pointer to the HBQ selection profile descriptor.
867 * 868 *
@@ -880,7 +881,7 @@ lpfc_build_hbq_profile2(struct config_hbq_var *hbqmb,
880} 881}
881 882
882/** 883/**
883 * lpfc_build_hbq_profile3: Set up the HBQ Selection Profile 3. 884 * lpfc_build_hbq_profile3 - Set up the HBQ Selection Profile 3
884 * @hbqmb: pointer to the HBQ configuration data structure in mailbox command. 885 * @hbqmb: pointer to the HBQ configuration data structure in mailbox command.
885 * @hbq_desc: pointer to the HBQ selection profile descriptor. 886 * @hbq_desc: pointer to the HBQ selection profile descriptor.
886 * 887 *
@@ -902,7 +903,7 @@ lpfc_build_hbq_profile3(struct config_hbq_var *hbqmb,
902} 903}
903 904
904/** 905/**
905 * lpfc_build_hbq_profile5: Set up the HBQ Selection Profile 5. 906 * lpfc_build_hbq_profile5 - Set up the HBQ Selection Profile 5
906 * @hbqmb: pointer to the HBQ configuration data structure in mailbox command. 907 * @hbqmb: pointer to the HBQ configuration data structure in mailbox command.
907 * @hbq_desc: pointer to the HBQ selection profile descriptor. 908 * @hbq_desc: pointer to the HBQ selection profile descriptor.
908 * 909 *
@@ -925,7 +926,7 @@ lpfc_build_hbq_profile5(struct config_hbq_var *hbqmb,
925} 926}
926 927
927/** 928/**
928 * lpfc_config_hbq: Prepare a mailbox command for configuring an HBQ. 929 * lpfc_config_hbq - Prepare a mailbox command for configuring an HBQ
929 * @phba: pointer to lpfc hba data structure. 930 * @phba: pointer to lpfc hba data structure.
930 * @id: HBQ identifier. 931 * @id: HBQ identifier.
931 * @hbq_desc: pointer to the HBA descriptor data structure. 932 * @hbq_desc: pointer to the HBA descriptor data structure.
@@ -999,7 +1000,7 @@ lpfc_config_hbq(struct lpfc_hba *phba, uint32_t id,
999} 1000}
1000 1001
1001/** 1002/**
1002 * lpfc_config_ring: Prepare a mailbox command for configuring an IOCB ring. 1003 * lpfc_config_ring - Prepare a mailbox command for configuring an IOCB ring
1003 * @phba: pointer to lpfc hba data structure. 1004 * @phba: pointer to lpfc hba data structure.
1004 * @ring: 1005 * @ring:
1005 * @pmb: pointer to the driver internal queue element for mailbox command. 1006 * @pmb: pointer to the driver internal queue element for mailbox command.
@@ -1057,7 +1058,7 @@ lpfc_config_ring(struct lpfc_hba * phba, int ring, LPFC_MBOXQ_t * pmb)
1057} 1058}
1058 1059
1059/** 1060/**
1060 * lpfc_config_port: Prepare a mailbox command for configuring port. 1061 * lpfc_config_port - Prepare a mailbox command for configuring port
1061 * @phba: pointer to lpfc hba data structure. 1062 * @phba: pointer to lpfc hba data structure.
1062 * @pmb: pointer to the driver internal queue element for mailbox command. 1063 * @pmb: pointer to the driver internal queue element for mailbox command.
1063 * 1064 *
@@ -1227,7 +1228,7 @@ lpfc_config_port(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
1227} 1228}
1228 1229
1229/** 1230/**
1230 * lpfc_kill_board: Prepare a mailbox command for killing board. 1231 * lpfc_kill_board - Prepare a mailbox command for killing board
1231 * @phba: pointer to lpfc hba data structure. 1232 * @phba: pointer to lpfc hba data structure.
1232 * @pmb: pointer to the driver internal queue element for mailbox command. 1233 * @pmb: pointer to the driver internal queue element for mailbox command.
1233 * 1234 *
@@ -1253,7 +1254,7 @@ lpfc_kill_board(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
1253} 1254}
1254 1255
1255/** 1256/**
1256 * lpfc_mbox_put: Put a mailbox cmd into the tail of driver's mailbox queue. 1257 * lpfc_mbox_put - Put a mailbox cmd into the tail of driver's mailbox queue
1257 * @phba: pointer to lpfc hba data structure. 1258 * @phba: pointer to lpfc hba data structure.
1258 * @mbq: pointer to the driver internal queue element for mailbox command. 1259 * @mbq: pointer to the driver internal queue element for mailbox command.
1259 * 1260 *
@@ -1277,7 +1278,7 @@ lpfc_mbox_put(struct lpfc_hba * phba, LPFC_MBOXQ_t * mbq)
1277} 1278}
1278 1279
1279/** 1280/**
1280 * lpfc_mbox_get: Remove a mailbox cmd from the head of driver's mailbox queue. 1281 * lpfc_mbox_get - Remove a mailbox cmd from the head of driver's mailbox queue
1281 * @phba: pointer to lpfc hba data structure. 1282 * @phba: pointer to lpfc hba data structure.
1282 * 1283 *
1283 * Driver maintains a internal mailbox command queue implemented as a linked 1284 * Driver maintains a internal mailbox command queue implemented as a linked
@@ -1304,7 +1305,7 @@ lpfc_mbox_get(struct lpfc_hba * phba)
1304} 1305}
1305 1306
1306/** 1307/**
1307 * lpfc_mbox_cmpl_put: Put mailbox command into mailbox command complete list. 1308 * lpfc_mbox_cmpl_put - Put mailbox command into mailbox command complete list
1308 * @phba: pointer to lpfc hba data structure. 1309 * @phba: pointer to lpfc hba data structure.
1309 * @mbq: pointer to the driver internal queue element for mailbox command. 1310 * @mbq: pointer to the driver internal queue element for mailbox command.
1310 * 1311 *
@@ -1327,7 +1328,7 @@ lpfc_mbox_cmpl_put(struct lpfc_hba * phba, LPFC_MBOXQ_t * mbq)
1327} 1328}
1328 1329
1329/** 1330/**
1330 * lpfc_mbox_tmo_val: Retrieve mailbox command timeout value. 1331 * lpfc_mbox_tmo_val - Retrieve mailbox command timeout value
1331 * @phba: pointer to lpfc hba data structure. 1332 * @phba: pointer to lpfc hba data structure.
1332 * @cmd: mailbox command code. 1333 * @cmd: mailbox command code.
1333 * 1334 *
diff --git a/drivers/scsi/lpfc/lpfc_mem.c b/drivers/scsi/lpfc/lpfc_mem.c
index a4bba206924..35a97673339 100644
--- a/drivers/scsi/lpfc/lpfc_mem.c
+++ b/drivers/scsi/lpfc/lpfc_mem.c
@@ -41,7 +41,7 @@
41 41
42 42
43/** 43/**
44 * lpfc_mem_alloc: create and allocate all PCI and memory pools 44 * lpfc_mem_alloc - create and allocate all PCI and memory pools
45 * @phba: HBA to allocate pools for 45 * @phba: HBA to allocate pools for
46 * 46 *
47 * Description: Creates and allocates PCI pools lpfc_scsi_dma_buf_pool, 47 * Description: Creates and allocates PCI pools lpfc_scsi_dma_buf_pool,
@@ -136,12 +136,12 @@ lpfc_mem_alloc(struct lpfc_hba * phba)
136} 136}
137 137
138/** 138/**
139 * lpfc_mem_free: Frees all PCI and memory allocated by lpfc_mem_alloc 139 * lpfc_mem_free - Frees all PCI and memory allocated by lpfc_mem_alloc
140 * @phba: HBA to free memory for 140 * @phba: HBA to free memory for
141 * 141 *
142 * Description: Frees PCI pools lpfc_scsi_dma_buf_pool, lpfc_mbuf_pool, 142 * Description: Frees PCI pools lpfc_scsi_dma_buf_pool, lpfc_mbuf_pool,
143 * lpfc_hbq_pool. Frees kmalloc-backed mempools for LPFC_MBOXQ_t and 143 * lpfc_hbq_pool. Frees kmalloc-backed mempools for LPFC_MBOXQ_t and
144 * lpfc_nodelist. Also frees the VPI bitmask. 144 * lpfc_nodelist. Also frees the VPI bitmask
145 * 145 *
146 * Returns: None 146 * Returns: None
147 **/ 147 **/
@@ -212,7 +212,7 @@ lpfc_mem_free(struct lpfc_hba * phba)
212} 212}
213 213
214/** 214/**
215 * lpfc_mbuf_alloc: Allocate an mbuf from the lpfc_mbuf_pool PCI pool 215 * lpfc_mbuf_alloc - Allocate an mbuf from the lpfc_mbuf_pool PCI pool
216 * @phba: HBA which owns the pool to allocate from 216 * @phba: HBA which owns the pool to allocate from
217 * @mem_flags: indicates if this is a priority (MEM_PRI) allocation 217 * @mem_flags: indicates if this is a priority (MEM_PRI) allocation
218 * @handle: used to return the DMA-mapped address of the mbuf 218 * @handle: used to return the DMA-mapped address of the mbuf
@@ -249,7 +249,7 @@ lpfc_mbuf_alloc(struct lpfc_hba *phba, int mem_flags, dma_addr_t *handle)
249} 249}
250 250
251/** 251/**
252 * __lpfc_mem_free: Free an mbuf from the lpfc_mbuf_pool PCI pool (locked) 252 * __lpfc_mbuf_free - Free an mbuf from the lpfc_mbuf_pool PCI pool (locked)
253 * @phba: HBA which owns the pool to return to 253 * @phba: HBA which owns the pool to return to
254 * @virt: mbuf to free 254 * @virt: mbuf to free
255 * @dma: the DMA-mapped address of the lpfc_mbuf_pool to be freed 255 * @dma: the DMA-mapped address of the lpfc_mbuf_pool to be freed
@@ -278,7 +278,7 @@ __lpfc_mbuf_free(struct lpfc_hba * phba, void *virt, dma_addr_t dma)
278} 278}
279 279
280/** 280/**
281 * lpfc_mem_free: Free an mbuf from the lpfc_mbuf_pool PCI pool (unlocked) 281 * lpfc_mbuf_free - Free an mbuf from the lpfc_mbuf_pool PCI pool (unlocked)
282 * @phba: HBA which owns the pool to return to 282 * @phba: HBA which owns the pool to return to
283 * @virt: mbuf to free 283 * @virt: mbuf to free
284 * @dma: the DMA-mapped address of the lpfc_mbuf_pool to be freed 284 * @dma: the DMA-mapped address of the lpfc_mbuf_pool to be freed
@@ -291,7 +291,6 @@ __lpfc_mbuf_free(struct lpfc_hba * phba, void *virt, dma_addr_t dma)
291 * Returns: None 291 * Returns: None
292 **/ 292 **/
293void 293void
294
295lpfc_mbuf_free(struct lpfc_hba * phba, void *virt, dma_addr_t dma) 294lpfc_mbuf_free(struct lpfc_hba * phba, void *virt, dma_addr_t dma)
296{ 295{
297 unsigned long iflags; 296 unsigned long iflags;
@@ -303,7 +302,7 @@ lpfc_mbuf_free(struct lpfc_hba * phba, void *virt, dma_addr_t dma)
303} 302}
304 303
305/** 304/**
306 * lpfc_els_hbq_alloc: Allocate an HBQ buffer 305 * lpfc_els_hbq_alloc - Allocate an HBQ buffer
307 * @phba: HBA to allocate HBQ buffer for 306 * @phba: HBA to allocate HBQ buffer for
308 * 307 *
309 * Description: Allocates a DMA-mapped HBQ buffer from the lpfc_hbq_pool PCI 308 * Description: Allocates a DMA-mapped HBQ buffer from the lpfc_hbq_pool PCI
@@ -335,7 +334,7 @@ lpfc_els_hbq_alloc(struct lpfc_hba *phba)
335} 334}
336 335
337/** 336/**
338 * lpfc_mem_hbq_free: Frees an HBQ buffer allocated with lpfc_els_hbq_alloc 337 * lpfc_mem_hbq_free - Frees an HBQ buffer allocated with lpfc_els_hbq_alloc
339 * @phba: HBA buffer was allocated for 338 * @phba: HBA buffer was allocated for
340 * @hbqbp: HBQ container returned by lpfc_els_hbq_alloc 339 * @hbqbp: HBQ container returned by lpfc_els_hbq_alloc
341 * 340 *
@@ -355,7 +354,7 @@ lpfc_els_hbq_free(struct lpfc_hba *phba, struct hbq_dmabuf *hbqbp)
355} 354}
356 355
357/** 356/**
358 * lpfc_in_buf_free: Free a DMA buffer 357 * lpfc_in_buf_free - Free a DMA buffer
359 * @phba: HBA buffer is associated with 358 * @phba: HBA buffer is associated with
360 * @mp: Buffer to free 359 * @mp: Buffer to free
361 * 360 *
diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c
index 8f548adae9c..08cdc77af41 100644
--- a/drivers/scsi/lpfc/lpfc_nportdisc.c
+++ b/drivers/scsi/lpfc/lpfc_nportdisc.c
@@ -192,7 +192,6 @@ lpfc_els_abort(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp)
192 struct lpfc_sli *psli = &phba->sli; 192 struct lpfc_sli *psli = &phba->sli;
193 struct lpfc_sli_ring *pring = &psli->ring[LPFC_ELS_RING]; 193 struct lpfc_sli_ring *pring = &psli->ring[LPFC_ELS_RING];
194 struct lpfc_iocbq *iocb, *next_iocb; 194 struct lpfc_iocbq *iocb, *next_iocb;
195 IOCB_t *cmd;
196 195
197 /* Abort outstanding I/O on NPort <nlp_DID> */ 196 /* Abort outstanding I/O on NPort <nlp_DID> */
198 lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_DISCOVERY, 197 lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_DISCOVERY,
@@ -223,19 +222,10 @@ lpfc_els_abort(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp)
223 } 222 }
224 spin_unlock_irq(&phba->hbalock); 223 spin_unlock_irq(&phba->hbalock);
225 224
226 while (!list_empty(&completions)) { 225 /* Cancel all the IOCBs from the completions list */
227 iocb = list_get_first(&completions, struct lpfc_iocbq, list); 226 lpfc_sli_cancel_iocbs(phba, &completions, IOSTAT_LOCAL_REJECT,
228 cmd = &iocb->iocb; 227 IOERR_SLI_ABORTED);
229 list_del_init(&iocb->list); 228
230
231 if (!iocb->iocb_cmpl)
232 lpfc_sli_release_iocbq(phba, iocb);
233 else {
234 cmd->ulpStatus = IOSTAT_LOCAL_REJECT;
235 cmd->un.ulpWord[4] = IOERR_SLI_ABORTED;
236 (iocb->iocb_cmpl) (phba, iocb, iocb);
237 }
238 }
239 lpfc_cancel_retry_delay_tmo(phba->pport, ndlp); 229 lpfc_cancel_retry_delay_tmo(phba->pport, ndlp);
240 return 0; 230 return 0;
241} 231}
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index 36fd2e75da1..167b66dd34c 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -112,7 +112,7 @@ lpfc_debug_save_dif(struct scsi_cmnd *cmnd)
112} 112}
113 113
114/** 114/**
115 * lpfc_update_stats: Update statistical data for the command completion. 115 * lpfc_update_stats - Update statistical data for the command completion
116 * @phba: Pointer to HBA object. 116 * @phba: Pointer to HBA object.
117 * @lpfc_cmd: lpfc scsi command object pointer. 117 * @lpfc_cmd: lpfc scsi command object pointer.
118 * 118 *
@@ -165,8 +165,7 @@ lpfc_update_stats(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd)
165} 165}
166 166
167/** 167/**
168 * lpfc_send_sdev_queuedepth_change_event: Posts a queuedepth change 168 * lpfc_send_sdev_queuedepth_change_event - Posts a queuedepth change event
169 * event.
170 * @phba: Pointer to HBA context object. 169 * @phba: Pointer to HBA context object.
171 * @vport: Pointer to vport object. 170 * @vport: Pointer to vport object.
172 * @ndlp: Pointer to FC node associated with the target. 171 * @ndlp: Pointer to FC node associated with the target.
@@ -220,7 +219,7 @@ lpfc_send_sdev_queuedepth_change_event(struct lpfc_hba *phba,
220} 219}
221 220
222/** 221/**
223 * lpfc_rampdown_queue_depth: Post RAMP_DOWN_QUEUE event to worker thread. 222 * lpfc_rampdown_queue_depth - Post RAMP_DOWN_QUEUE event to worker thread
224 * @phba: The Hba for which this call is being executed. 223 * @phba: The Hba for which this call is being executed.
225 * 224 *
226 * This routine is called when there is resource error in driver or firmware. 225 * This routine is called when there is resource error in driver or firmware.
@@ -261,7 +260,7 @@ lpfc_rampdown_queue_depth(struct lpfc_hba *phba)
261} 260}
262 261
263/** 262/**
264 * lpfc_rampup_queue_depth: Post RAMP_UP_QUEUE event for worker thread. 263 * lpfc_rampup_queue_depth - Post RAMP_UP_QUEUE event for worker thread
265 * @phba: The Hba for which this call is being executed. 264 * @phba: The Hba for which this call is being executed.
266 * 265 *
267 * This routine post WORKER_RAMP_UP_QUEUE event for @phba vport. This routine 266 * This routine post WORKER_RAMP_UP_QUEUE event for @phba vport. This routine
@@ -273,14 +272,14 @@ lpfc_rampdown_queue_depth(struct lpfc_hba *phba)
273 **/ 272 **/
274static inline void 273static inline void
275lpfc_rampup_queue_depth(struct lpfc_vport *vport, 274lpfc_rampup_queue_depth(struct lpfc_vport *vport,
276 struct scsi_device *sdev) 275 uint32_t queue_depth)
277{ 276{
278 unsigned long flags; 277 unsigned long flags;
279 struct lpfc_hba *phba = vport->phba; 278 struct lpfc_hba *phba = vport->phba;
280 uint32_t evt_posted; 279 uint32_t evt_posted;
281 atomic_inc(&phba->num_cmd_success); 280 atomic_inc(&phba->num_cmd_success);
282 281
283 if (vport->cfg_lun_queue_depth <= sdev->queue_depth) 282 if (vport->cfg_lun_queue_depth <= queue_depth)
284 return; 283 return;
285 spin_lock_irqsave(&phba->hbalock, flags); 284 spin_lock_irqsave(&phba->hbalock, flags);
286 if (((phba->last_ramp_up_time + QUEUE_RAMP_UP_INTERVAL) > jiffies) || 285 if (((phba->last_ramp_up_time + QUEUE_RAMP_UP_INTERVAL) > jiffies) ||
@@ -303,7 +302,7 @@ lpfc_rampup_queue_depth(struct lpfc_vport *vport,
303} 302}
304 303
305/** 304/**
306 * lpfc_ramp_down_queue_handler: WORKER_RAMP_DOWN_QUEUE event handler. 305 * lpfc_ramp_down_queue_handler - WORKER_RAMP_DOWN_QUEUE event handler
307 * @phba: The Hba for which this call is being executed. 306 * @phba: The Hba for which this call is being executed.
308 * 307 *
309 * This routine is called to process WORKER_RAMP_DOWN_QUEUE event for worker 308 * This routine is called to process WORKER_RAMP_DOWN_QUEUE event for worker
@@ -361,7 +360,7 @@ lpfc_ramp_down_queue_handler(struct lpfc_hba *phba)
361} 360}
362 361
363/** 362/**
364 * lpfc_ramp_up_queue_handler: WORKER_RAMP_UP_QUEUE event handler. 363 * lpfc_ramp_up_queue_handler - WORKER_RAMP_UP_QUEUE event handler
365 * @phba: The Hba for which this call is being executed. 364 * @phba: The Hba for which this call is being executed.
366 * 365 *
367 * This routine is called to process WORKER_RAMP_UP_QUEUE event for worker 366 * This routine is called to process WORKER_RAMP_UP_QUEUE event for worker
@@ -410,7 +409,7 @@ lpfc_ramp_up_queue_handler(struct lpfc_hba *phba)
410} 409}
411 410
412/** 411/**
413 * lpfc_scsi_dev_block: set all scsi hosts to block state. 412 * lpfc_scsi_dev_block - set all scsi hosts to block state
414 * @phba: Pointer to HBA context object. 413 * @phba: Pointer to HBA context object.
415 * 414 *
416 * This function walks vport list and set each SCSI host to block state 415 * This function walks vport list and set each SCSI host to block state
@@ -439,7 +438,7 @@ lpfc_scsi_dev_block(struct lpfc_hba *phba)
439} 438}
440 439
441/** 440/**
442 * lpfc_new_scsi_buf: Scsi buffer allocator. 441 * lpfc_new_scsi_buf - Scsi buffer allocator
443 * @vport: The virtual port for which this call being executed. 442 * @vport: The virtual port for which this call being executed.
444 * 443 *
445 * This routine allocates a scsi buffer, which contains all the necessary 444 * This routine allocates a scsi buffer, which contains all the necessary
@@ -563,7 +562,7 @@ lpfc_new_scsi_buf(struct lpfc_vport *vport)
563} 562}
564 563
565/** 564/**
566 * lpfc_get_scsi_buf: Get a scsi buffer from lpfc_scsi_buf_list list of Hba. 565 * lpfc_get_scsi_buf - Get a scsi buffer from lpfc_scsi_buf_list list of Hba
567 * @phba: The Hba for which this call is being executed. 566 * @phba: The Hba for which this call is being executed.
568 * 567 *
569 * This routine removes a scsi buffer from head of @phba lpfc_scsi_buf_list list 568 * This routine removes a scsi buffer from head of @phba lpfc_scsi_buf_list list
@@ -592,7 +591,7 @@ lpfc_get_scsi_buf(struct lpfc_hba * phba)
592} 591}
593 592
594/** 593/**
595 * lpfc_release_scsi_buf: Return a scsi buffer back to hba lpfc_scsi_buf_list list. 594 * lpfc_release_scsi_buf - Return a scsi buffer back to hba's lpfc_scsi_buf_list
596 * @phba: The Hba for which this call is being executed. 595 * @phba: The Hba for which this call is being executed.
597 * @psb: The scsi buffer which is being released. 596 * @psb: The scsi buffer which is being released.
598 * 597 *
@@ -611,7 +610,7 @@ lpfc_release_scsi_buf(struct lpfc_hba *phba, struct lpfc_scsi_buf *psb)
611} 610}
612 611
613/** 612/**
614 * lpfc_scsi_prep_dma_buf: Routine to do DMA mapping for scsi buffer. 613 * lpfc_scsi_prep_dma_buf - Routine to do DMA mapping for scsi buffer
615 * @phba: The Hba for which this call is being executed. 614 * @phba: The Hba for which this call is being executed.
616 * @lpfc_cmd: The scsi buffer which is going to be mapped. 615 * @lpfc_cmd: The scsi buffer which is going to be mapped.
617 * 616 *
@@ -738,7 +737,7 @@ lpfc_scsi_prep_dma_buf(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd)
738 * Due to difference in data length between DIF/non-DIF paths, 737 * Due to difference in data length between DIF/non-DIF paths,
739 * we need to set word 4 of IOCB here 738 * we need to set word 4 of IOCB here
740 */ 739 */
741 iocb_cmd->un.fcpi.fcpi_parm = le32_to_cpu(scsi_bufflen(scsi_cmnd)); 740 iocb_cmd->un.fcpi.fcpi_parm = scsi_bufflen(scsi_cmnd);
742 return 0; 741 return 0;
743} 742}
744 743
@@ -823,9 +822,9 @@ lpfc_cmd_blksize(struct scsi_cmnd *sc)
823/** 822/**
824 * lpfc_get_cmd_dif_parms - Extract DIF parameters from SCSI command 823 * lpfc_get_cmd_dif_parms - Extract DIF parameters from SCSI command
825 * @sc: in: SCSI command 824 * @sc: in: SCSI command
826 * @apptagmask out: app tag mask 825 * @apptagmask: out: app tag mask
827 * @apptagval out: app tag value 826 * @apptagval: out: app tag value
828 * @reftag out: ref tag (reference tag) 827 * @reftag: out: ref tag (reference tag)
829 * 828 *
830 * Description: 829 * Description:
831 * Extract DIF paramters from the command if possible. Otherwise, 830 * Extract DIF paramters from the command if possible. Otherwise,
@@ -1413,7 +1412,7 @@ out:
1413} 1412}
1414 1413
1415/** 1414/**
1416 * lpfc_send_scsi_error_event: Posts an event when there is SCSI error. 1415 * lpfc_send_scsi_error_event - Posts an event when there is SCSI error
1417 * @phba: Pointer to hba context object. 1416 * @phba: Pointer to hba context object.
1418 * @vport: Pointer to vport object. 1417 * @vport: Pointer to vport object.
1419 * @lpfc_cmd: Pointer to lpfc scsi command which reported the error. 1418 * @lpfc_cmd: Pointer to lpfc scsi command which reported the error.
@@ -1505,7 +1504,7 @@ lpfc_send_scsi_error_event(struct lpfc_hba *phba, struct lpfc_vport *vport,
1505} 1504}
1506 1505
1507/** 1506/**
1508 * lpfc_scsi_unprep_dma_buf: Routine to un-map DMA mapping of scatter gather. 1507 * lpfc_scsi_unprep_dma_buf - Routine to un-map DMA mapping of scatter gather
1509 * @phba: The Hba for which this call is being executed. 1508 * @phba: The Hba for which this call is being executed.
1510 * @psb: The scsi buffer which is going to be un-mapped. 1509 * @psb: The scsi buffer which is going to be un-mapped.
1511 * 1510 *
@@ -1530,7 +1529,7 @@ lpfc_scsi_unprep_dma_buf(struct lpfc_hba * phba, struct lpfc_scsi_buf * psb)
1530} 1529}
1531 1530
1532/** 1531/**
1533 * lpfc_handler_fcp_err: FCP response handler. 1532 * lpfc_handler_fcp_err - FCP response handler
1534 * @vport: The virtual port for which this call is being executed. 1533 * @vport: The virtual port for which this call is being executed.
1535 * @lpfc_cmd: Pointer to lpfc_scsi_buf data structure. 1534 * @lpfc_cmd: Pointer to lpfc_scsi_buf data structure.
1536 * @rsp_iocb: The response IOCB which contains FCP error. 1535 * @rsp_iocb: The response IOCB which contains FCP error.
@@ -1674,7 +1673,7 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
1674} 1673}
1675 1674
1676/** 1675/**
1677 * lpfc_scsi_cmd_iocb_cmpl: Scsi cmnd IOCB completion routine. 1676 * lpfc_scsi_cmd_iocb_cmpl - Scsi cmnd IOCB completion routine
1678 * @phba: The Hba for which this call is being executed. 1677 * @phba: The Hba for which this call is being executed.
1679 * @pIocbIn: The command IOCBQ for the scsi cmnd. 1678 * @pIocbIn: The command IOCBQ for the scsi cmnd.
1680 * @pIocbOut: The response IOCBQ for the scsi cmnd . 1679 * @pIocbOut: The response IOCBQ for the scsi cmnd .
@@ -1694,10 +1693,12 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
1694 struct lpfc_nodelist *pnode = rdata->pnode; 1693 struct lpfc_nodelist *pnode = rdata->pnode;
1695 struct scsi_cmnd *cmd = lpfc_cmd->pCmd; 1694 struct scsi_cmnd *cmd = lpfc_cmd->pCmd;
1696 int result; 1695 int result;
1697 struct scsi_device *sdev, *tmp_sdev; 1696 struct scsi_device *tmp_sdev;
1698 int depth = 0; 1697 int depth = 0;
1699 unsigned long flags; 1698 unsigned long flags;
1700 struct lpfc_fast_path_event *fast_path_evt; 1699 struct lpfc_fast_path_event *fast_path_evt;
1700 struct Scsi_Host *shost = cmd->device->host;
1701 uint32_t queue_depth, scsi_id;
1701 1702
1702 lpfc_cmd->result = pIocbOut->iocb.un.ulpWord[4]; 1703 lpfc_cmd->result = pIocbOut->iocb.un.ulpWord[4];
1703 lpfc_cmd->status = pIocbOut->iocb.ulpStatus; 1704 lpfc_cmd->status = pIocbOut->iocb.ulpStatus;
@@ -1808,11 +1809,10 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
1808 1809
1809 lpfc_update_stats(phba, lpfc_cmd); 1810 lpfc_update_stats(phba, lpfc_cmd);
1810 result = cmd->result; 1811 result = cmd->result;
1811 sdev = cmd->device;
1812 if (vport->cfg_max_scsicmpl_time && 1812 if (vport->cfg_max_scsicmpl_time &&
1813 time_after(jiffies, lpfc_cmd->start_time + 1813 time_after(jiffies, lpfc_cmd->start_time +
1814 msecs_to_jiffies(vport->cfg_max_scsicmpl_time))) { 1814 msecs_to_jiffies(vport->cfg_max_scsicmpl_time))) {
1815 spin_lock_irqsave(sdev->host->host_lock, flags); 1815 spin_lock_irqsave(shost->host_lock, flags);
1816 if (pnode && NLP_CHK_NODE_ACT(pnode)) { 1816 if (pnode && NLP_CHK_NODE_ACT(pnode)) {
1817 if (pnode->cmd_qdepth > 1817 if (pnode->cmd_qdepth >
1818 atomic_read(&pnode->cmd_pending) && 1818 atomic_read(&pnode->cmd_pending) &&
@@ -1825,22 +1825,26 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
1825 1825
1826 pnode->last_change_time = jiffies; 1826 pnode->last_change_time = jiffies;
1827 } 1827 }
1828 spin_unlock_irqrestore(sdev->host->host_lock, flags); 1828 spin_unlock_irqrestore(shost->host_lock, flags);
1829 } else if (pnode && NLP_CHK_NODE_ACT(pnode)) { 1829 } else if (pnode && NLP_CHK_NODE_ACT(pnode)) {
1830 if ((pnode->cmd_qdepth < LPFC_MAX_TGT_QDEPTH) && 1830 if ((pnode->cmd_qdepth < LPFC_MAX_TGT_QDEPTH) &&
1831 time_after(jiffies, pnode->last_change_time + 1831 time_after(jiffies, pnode->last_change_time +
1832 msecs_to_jiffies(LPFC_TGTQ_INTERVAL))) { 1832 msecs_to_jiffies(LPFC_TGTQ_INTERVAL))) {
1833 spin_lock_irqsave(sdev->host->host_lock, flags); 1833 spin_lock_irqsave(shost->host_lock, flags);
1834 pnode->cmd_qdepth += pnode->cmd_qdepth * 1834 pnode->cmd_qdepth += pnode->cmd_qdepth *
1835 LPFC_TGTQ_RAMPUP_PCENT / 100; 1835 LPFC_TGTQ_RAMPUP_PCENT / 100;
1836 if (pnode->cmd_qdepth > LPFC_MAX_TGT_QDEPTH) 1836 if (pnode->cmd_qdepth > LPFC_MAX_TGT_QDEPTH)
1837 pnode->cmd_qdepth = LPFC_MAX_TGT_QDEPTH; 1837 pnode->cmd_qdepth = LPFC_MAX_TGT_QDEPTH;
1838 pnode->last_change_time = jiffies; 1838 pnode->last_change_time = jiffies;
1839 spin_unlock_irqrestore(sdev->host->host_lock, flags); 1839 spin_unlock_irqrestore(shost->host_lock, flags);
1840 } 1840 }
1841 } 1841 }
1842 1842
1843 lpfc_scsi_unprep_dma_buf(phba, lpfc_cmd); 1843 lpfc_scsi_unprep_dma_buf(phba, lpfc_cmd);
1844
1845 /* The sdev is not guaranteed to be valid post scsi_done upcall. */
1846 queue_depth = cmd->device->queue_depth;
1847 scsi_id = cmd->device->id;
1844 cmd->scsi_done(cmd); 1848 cmd->scsi_done(cmd);
1845 1849
1846 if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) { 1850 if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) {
@@ -1848,28 +1852,28 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
1848 * If there is a thread waiting for command completion 1852 * If there is a thread waiting for command completion
1849 * wake up the thread. 1853 * wake up the thread.
1850 */ 1854 */
1851 spin_lock_irqsave(sdev->host->host_lock, flags); 1855 spin_lock_irqsave(shost->host_lock, flags);
1852 lpfc_cmd->pCmd = NULL; 1856 lpfc_cmd->pCmd = NULL;
1853 if (lpfc_cmd->waitq) 1857 if (lpfc_cmd->waitq)
1854 wake_up(lpfc_cmd->waitq); 1858 wake_up(lpfc_cmd->waitq);
1855 spin_unlock_irqrestore(sdev->host->host_lock, flags); 1859 spin_unlock_irqrestore(shost->host_lock, flags);
1856 lpfc_release_scsi_buf(phba, lpfc_cmd); 1860 lpfc_release_scsi_buf(phba, lpfc_cmd);
1857 return; 1861 return;
1858 } 1862 }
1859 1863
1860 1864
1861 if (!result) 1865 if (!result)
1862 lpfc_rampup_queue_depth(vport, sdev); 1866 lpfc_rampup_queue_depth(vport, queue_depth);
1863 1867
1864 if (!result && pnode && NLP_CHK_NODE_ACT(pnode) && 1868 if (!result && pnode && NLP_CHK_NODE_ACT(pnode) &&
1865 ((jiffies - pnode->last_ramp_up_time) > 1869 ((jiffies - pnode->last_ramp_up_time) >
1866 LPFC_Q_RAMP_UP_INTERVAL * HZ) && 1870 LPFC_Q_RAMP_UP_INTERVAL * HZ) &&
1867 ((jiffies - pnode->last_q_full_time) > 1871 ((jiffies - pnode->last_q_full_time) >
1868 LPFC_Q_RAMP_UP_INTERVAL * HZ) && 1872 LPFC_Q_RAMP_UP_INTERVAL * HZ) &&
1869 (vport->cfg_lun_queue_depth > sdev->queue_depth)) { 1873 (vport->cfg_lun_queue_depth > queue_depth)) {
1870 shost_for_each_device(tmp_sdev, sdev->host) { 1874 shost_for_each_device(tmp_sdev, shost) {
1871 if (vport->cfg_lun_queue_depth > tmp_sdev->queue_depth){ 1875 if (vport->cfg_lun_queue_depth > tmp_sdev->queue_depth){
1872 if (tmp_sdev->id != sdev->id) 1876 if (tmp_sdev->id != scsi_id)
1873 continue; 1877 continue;
1874 if (tmp_sdev->ordered_tags) 1878 if (tmp_sdev->ordered_tags)
1875 scsi_adjust_queue_depth(tmp_sdev, 1879 scsi_adjust_queue_depth(tmp_sdev,
@@ -1885,7 +1889,7 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
1885 } 1889 }
1886 lpfc_send_sdev_queuedepth_change_event(phba, vport, pnode, 1890 lpfc_send_sdev_queuedepth_change_event(phba, vport, pnode,
1887 0xFFFFFFFF, 1891 0xFFFFFFFF,
1888 sdev->queue_depth - 1, sdev->queue_depth); 1892 queue_depth , queue_depth + 1);
1889 } 1893 }
1890 1894
1891 /* 1895 /*
@@ -1896,8 +1900,8 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
1896 NLP_CHK_NODE_ACT(pnode)) { 1900 NLP_CHK_NODE_ACT(pnode)) {
1897 pnode->last_q_full_time = jiffies; 1901 pnode->last_q_full_time = jiffies;
1898 1902
1899 shost_for_each_device(tmp_sdev, sdev->host) { 1903 shost_for_each_device(tmp_sdev, shost) {
1900 if (tmp_sdev->id != sdev->id) 1904 if (tmp_sdev->id != scsi_id)
1901 continue; 1905 continue;
1902 depth = scsi_track_queue_full(tmp_sdev, 1906 depth = scsi_track_queue_full(tmp_sdev,
1903 tmp_sdev->queue_depth - 1); 1907 tmp_sdev->queue_depth - 1);
@@ -1909,7 +1913,7 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
1909 * scsi_track_queue_full. 1913 * scsi_track_queue_full.
1910 */ 1914 */
1911 if (depth == -1) 1915 if (depth == -1)
1912 depth = sdev->host->cmd_per_lun; 1916 depth = shost->cmd_per_lun;
1913 1917
1914 if (depth) { 1918 if (depth) {
1915 lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP, 1919 lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP,
@@ -1925,17 +1929,17 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
1925 * If there is a thread waiting for command completion 1929 * If there is a thread waiting for command completion
1926 * wake up the thread. 1930 * wake up the thread.
1927 */ 1931 */
1928 spin_lock_irqsave(sdev->host->host_lock, flags); 1932 spin_lock_irqsave(shost->host_lock, flags);
1929 lpfc_cmd->pCmd = NULL; 1933 lpfc_cmd->pCmd = NULL;
1930 if (lpfc_cmd->waitq) 1934 if (lpfc_cmd->waitq)
1931 wake_up(lpfc_cmd->waitq); 1935 wake_up(lpfc_cmd->waitq);
1932 spin_unlock_irqrestore(sdev->host->host_lock, flags); 1936 spin_unlock_irqrestore(shost->host_lock, flags);
1933 1937
1934 lpfc_release_scsi_buf(phba, lpfc_cmd); 1938 lpfc_release_scsi_buf(phba, lpfc_cmd);
1935} 1939}
1936 1940
1937/** 1941/**
1938 * lpfc_fcpcmd_to_iocb - copy the fcp_cmd data into the IOCB. 1942 * lpfc_fcpcmd_to_iocb - copy the fcp_cmd data into the IOCB
1939 * @data: A pointer to the immediate command data portion of the IOCB. 1943 * @data: A pointer to the immediate command data portion of the IOCB.
1940 * @fcp_cmnd: The FCP Command that is provided by the SCSI layer. 1944 * @fcp_cmnd: The FCP Command that is provided by the SCSI layer.
1941 * 1945 *
@@ -1953,7 +1957,7 @@ lpfc_fcpcmd_to_iocb(uint8_t *data, struct fcp_cmnd *fcp_cmnd)
1953} 1957}
1954 1958
1955/** 1959/**
1956 * lpfc_scsi_prep_cmnd: Routine to convert scsi cmnd to FCP information unit. 1960 * lpfc_scsi_prep_cmnd - Routine to convert scsi cmnd to FCP information unit
1957 * @vport: The virtual port for which this call is being executed. 1961 * @vport: The virtual port for which this call is being executed.
1958 * @lpfc_cmd: The scsi command which needs to send. 1962 * @lpfc_cmd: The scsi command which needs to send.
1959 * @pnode: Pointer to lpfc_nodelist. 1963 * @pnode: Pointer to lpfc_nodelist.
@@ -2047,7 +2051,7 @@ lpfc_scsi_prep_cmnd(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
2047} 2051}
2048 2052
2049/** 2053/**
2050 * lpfc_scsi_prep_task_mgmt_cmnd: Convert scsi TM cmnd to FCP information unit. 2054 * lpfc_scsi_prep_task_mgmt_cmnd - Convert scsi TM cmnd to FCP information unit
2051 * @vport: The virtual port for which this call is being executed. 2055 * @vport: The virtual port for which this call is being executed.
2052 * @lpfc_cmd: Pointer to lpfc_scsi_buf data structure. 2056 * @lpfc_cmd: Pointer to lpfc_scsi_buf data structure.
2053 * @lun: Logical unit number. 2057 * @lun: Logical unit number.
@@ -2110,7 +2114,7 @@ lpfc_scsi_prep_task_mgmt_cmd(struct lpfc_vport *vport,
2110} 2114}
2111 2115
2112/** 2116/**
2113 * lpc_taskmgmt_def_cmpl: IOCB completion routine for task management command. 2117 * lpfc_taskmgmt_def_cmpl - IOCB completion routine for task management command
2114 * @phba: The Hba for which this call is being executed. 2118 * @phba: The Hba for which this call is being executed.
2115 * @cmdiocbq: Pointer to lpfc_iocbq data structure. 2119 * @cmdiocbq: Pointer to lpfc_iocbq data structure.
2116 * @rspiocbq: Pointer to lpfc_iocbq data structure. 2120 * @rspiocbq: Pointer to lpfc_iocbq data structure.
@@ -2131,7 +2135,7 @@ lpfc_tskmgmt_def_cmpl(struct lpfc_hba *phba,
2131} 2135}
2132 2136
2133/** 2137/**
2134 * lpfc_scsi_tgt_reset: Target reset handler. 2138 * lpfc_scsi_tgt_reset - Target reset handler
2135 * @lpfc_cmd: Pointer to lpfc_scsi_buf data structure 2139 * @lpfc_cmd: Pointer to lpfc_scsi_buf data structure
2136 * @vport: The virtual port for which this call is being executed. 2140 * @vport: The virtual port for which this call is being executed.
2137 * @tgt_id: Target ID. 2141 * @tgt_id: Target ID.
@@ -2198,7 +2202,7 @@ lpfc_scsi_tgt_reset(struct lpfc_scsi_buf *lpfc_cmd, struct lpfc_vport *vport,
2198} 2202}
2199 2203
2200/** 2204/**
2201 * lpfc_info: Info entry point of scsi_host_template data structure. 2205 * lpfc_info - Info entry point of scsi_host_template data structure
2202 * @host: The scsi host for which this call is being executed. 2206 * @host: The scsi host for which this call is being executed.
2203 * 2207 *
2204 * This routine provides module information about hba. 2208 * This routine provides module information about hba.
@@ -2236,7 +2240,7 @@ lpfc_info(struct Scsi_Host *host)
2236} 2240}
2237 2241
2238/** 2242/**
2239 * lpfc_poll_rearm_time: Routine to modify fcp_poll timer of hba. 2243 * lpfc_poll_rearm_time - Routine to modify fcp_poll timer of hba
2240 * @phba: The Hba for which this call is being executed. 2244 * @phba: The Hba for which this call is being executed.
2241 * 2245 *
2242 * This routine modifies fcp_poll_timer field of @phba by cfg_poll_tmo. 2246 * This routine modifies fcp_poll_timer field of @phba by cfg_poll_tmo.
@@ -2253,7 +2257,7 @@ static __inline__ void lpfc_poll_rearm_timer(struct lpfc_hba * phba)
2253} 2257}
2254 2258
2255/** 2259/**
2256 * lpfc_poll_start_timer: Routine to start fcp_poll_timer of HBA. 2260 * lpfc_poll_start_timer - Routine to start fcp_poll_timer of HBA
2257 * @phba: The Hba for which this call is being executed. 2261 * @phba: The Hba for which this call is being executed.
2258 * 2262 *
2259 * This routine starts the fcp_poll_timer of @phba. 2263 * This routine starts the fcp_poll_timer of @phba.
@@ -2264,7 +2268,7 @@ void lpfc_poll_start_timer(struct lpfc_hba * phba)
2264} 2268}
2265 2269
2266/** 2270/**
2267 * lpfc_poll_timeout: Restart polling timer. 2271 * lpfc_poll_timeout - Restart polling timer
2268 * @ptr: Map to lpfc_hba data structure pointer. 2272 * @ptr: Map to lpfc_hba data structure pointer.
2269 * 2273 *
2270 * This routine restarts fcp_poll timer, when FCP ring polling is enable 2274 * This routine restarts fcp_poll timer, when FCP ring polling is enable
@@ -2283,8 +2287,7 @@ void lpfc_poll_timeout(unsigned long ptr)
2283} 2287}
2284 2288
2285/** 2289/**
2286 * lpfc_queuecommand: Queuecommand entry point of Scsi Host Templater data 2290 * lpfc_queuecommand - scsi_host_template queuecommand entry point
2287 * structure.
2288 * @cmnd: Pointer to scsi_cmnd data structure. 2291 * @cmnd: Pointer to scsi_cmnd data structure.
2289 * @done: Pointer to done routine. 2292 * @done: Pointer to done routine.
2290 * 2293 *
@@ -2450,7 +2453,7 @@ lpfc_queuecommand(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *))
2450} 2453}
2451 2454
2452/** 2455/**
2453 * lpfc_block_error_handler: Routine to block error handler. 2456 * lpfc_block_error_handler - Routine to block error handler
2454 * @cmnd: Pointer to scsi_cmnd data structure. 2457 * @cmnd: Pointer to scsi_cmnd data structure.
2455 * 2458 *
2456 * This routine blocks execution till fc_rport state is not FC_PORSTAT_BLCOEKD. 2459 * This routine blocks execution till fc_rport state is not FC_PORSTAT_BLCOEKD.
@@ -2472,8 +2475,7 @@ lpfc_block_error_handler(struct scsi_cmnd *cmnd)
2472} 2475}
2473 2476
2474/** 2477/**
2475 * lpfc_abort_handler: Eh_abort_handler entry point of Scsi Host Template data 2478 * lpfc_abort_handler - scsi_host_template eh_abort_handler entry point
2476 *structure.
2477 * @cmnd: Pointer to scsi_cmnd data structure. 2479 * @cmnd: Pointer to scsi_cmnd data structure.
2478 * 2480 *
2479 * This routine aborts @cmnd pending in base driver. 2481 * This routine aborts @cmnd pending in base driver.
@@ -2578,8 +2580,7 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd)
2578} 2580}
2579 2581
2580/** 2582/**
2581 * lpfc_device_reset_handler: eh_device_reset entry point of Scsi Host Template 2583 * lpfc_device_reset_handler - scsi_host_template eh_device_reset entry point
2582 *data structure.
2583 * @cmnd: Pointer to scsi_cmnd data structure. 2584 * @cmnd: Pointer to scsi_cmnd data structure.
2584 * 2585 *
2585 * This routine does a device reset by sending a TARGET_RESET task management 2586 * This routine does a device reset by sending a TARGET_RESET task management
@@ -2587,7 +2588,7 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd)
2587 * 2588 *
2588 * Return code : 2589 * Return code :
2589 * 0x2003 - Error 2590 * 0x2003 - Error
2590 * 0ex2002 - Success 2591 * 0x2002 - Success
2591 **/ 2592 **/
2592static int 2593static int
2593lpfc_device_reset_handler(struct scsi_cmnd *cmnd) 2594lpfc_device_reset_handler(struct scsi_cmnd *cmnd)
@@ -2707,8 +2708,7 @@ lpfc_device_reset_handler(struct scsi_cmnd *cmnd)
2707} 2708}
2708 2709
2709/** 2710/**
2710 * lpfc_bus_reset_handler: eh_bus_reset_handler entry point of Scsi Host 2711 * lpfc_bus_reset_handler - scsi_host_template eh_bus_reset_handler entry point
2711 * Template data structure.
2712 * @cmnd: Pointer to scsi_cmnd data structure. 2712 * @cmnd: Pointer to scsi_cmnd data structure.
2713 * 2713 *
2714 * This routine does target reset to all target on @cmnd->device->host. 2714 * This routine does target reset to all target on @cmnd->device->host.
@@ -2808,8 +2808,7 @@ lpfc_bus_reset_handler(struct scsi_cmnd *cmnd)
2808} 2808}
2809 2809
2810/** 2810/**
2811 * lpfc_slave_alloc: slave_alloc entry point of Scsi Host Template data 2811 * lpfc_slave_alloc - scsi_host_template slave_alloc entry point
2812 * structure.
2813 * @sdev: Pointer to scsi_device. 2812 * @sdev: Pointer to scsi_device.
2814 * 2813 *
2815 * This routine populates the cmds_per_lun count + 2 scsi_bufs into this host's 2814 * This routine populates the cmds_per_lun count + 2 scsi_bufs into this host's
@@ -2883,8 +2882,7 @@ lpfc_slave_alloc(struct scsi_device *sdev)
2883} 2882}
2884 2883
2885/** 2884/**
2886 * lpfc_slave_configure: slave_configure entry point of Scsi Host Templater data 2885 * lpfc_slave_configure - scsi_host_template slave_configure entry point
2887 * structure.
2888 * @sdev: Pointer to scsi_device. 2886 * @sdev: Pointer to scsi_device.
2889 * 2887 *
2890 * This routine configures following items 2888 * This routine configures following items
@@ -2925,7 +2923,7 @@ lpfc_slave_configure(struct scsi_device *sdev)
2925} 2923}
2926 2924
2927/** 2925/**
2928 * lpfc_slave_destroy: slave_destroy entry point of SHT data structure. 2926 * lpfc_slave_destroy - slave_destroy entry point of SHT data structure
2929 * @sdev: Pointer to scsi_device. 2927 * @sdev: Pointer to scsi_device.
2930 * 2928 *
2931 * This routine sets @sdev hostatdata filed to null. 2929 * This routine sets @sdev hostatdata filed to null.
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index a36a120561e..eb5c75c45ba 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -68,7 +68,7 @@ typedef enum _lpfc_iocb_type {
68} lpfc_iocb_type; 68} lpfc_iocb_type;
69 69
70/** 70/**
71 * lpfc_cmd_iocb: Get next command iocb entry in the ring. 71 * lpfc_cmd_iocb - Get next command iocb entry in the ring
72 * @phba: Pointer to HBA context object. 72 * @phba: Pointer to HBA context object.
73 * @pring: Pointer to driver SLI ring object. 73 * @pring: Pointer to driver SLI ring object.
74 * 74 *
@@ -85,7 +85,7 @@ lpfc_cmd_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
85} 85}
86 86
87/** 87/**
88 * lpfc_resp_iocb: Get next response iocb entry in the ring. 88 * lpfc_resp_iocb - Get next response iocb entry in the ring
89 * @phba: Pointer to HBA context object. 89 * @phba: Pointer to HBA context object.
90 * @pring: Pointer to driver SLI ring object. 90 * @pring: Pointer to driver SLI ring object.
91 * 91 *
@@ -102,7 +102,7 @@ lpfc_resp_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
102} 102}
103 103
104/** 104/**
105 * __lpfc_sli_get_iocbq: Allocates an iocb object from iocb pool. 105 * __lpfc_sli_get_iocbq - Allocates an iocb object from iocb pool
106 * @phba: Pointer to HBA context object. 106 * @phba: Pointer to HBA context object.
107 * 107 *
108 * This function is called with hbalock held. This function 108 * This function is called with hbalock held. This function
@@ -121,7 +121,7 @@ __lpfc_sli_get_iocbq(struct lpfc_hba *phba)
121} 121}
122 122
123/** 123/**
124 * lpfc_sli_get_iocbq: Allocates an iocb object from iocb pool. 124 * lpfc_sli_get_iocbq - Allocates an iocb object from iocb pool
125 * @phba: Pointer to HBA context object. 125 * @phba: Pointer to HBA context object.
126 * 126 *
127 * This function is called with no lock held. This function 127 * This function is called with no lock held. This function
@@ -142,7 +142,7 @@ lpfc_sli_get_iocbq(struct lpfc_hba *phba)
142} 142}
143 143
144/** 144/**
145 * __lpfc_sli_release_iocbq: Release iocb to the iocb pool. 145 * __lpfc_sli_release_iocbq - Release iocb to the iocb pool
146 * @phba: Pointer to HBA context object. 146 * @phba: Pointer to HBA context object.
147 * @iocbq: Pointer to driver iocb object. 147 * @iocbq: Pointer to driver iocb object.
148 * 148 *
@@ -164,7 +164,7 @@ __lpfc_sli_release_iocbq(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
164} 164}
165 165
166/** 166/**
167 * lpfc_sli_release_iocbq: Release iocb to the iocb pool. 167 * lpfc_sli_release_iocbq - Release iocb to the iocb pool
168 * @phba: Pointer to HBA context object. 168 * @phba: Pointer to HBA context object.
169 * @iocbq: Pointer to driver iocb object. 169 * @iocbq: Pointer to driver iocb object.
170 * 170 *
@@ -185,8 +185,40 @@ lpfc_sli_release_iocbq(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
185} 185}
186 186
187/** 187/**
188 * lpfc_sli_iocb_cmd_type: Get the iocb type. 188 * lpfc_sli_cancel_iocbs - Cancel all iocbs from a list.
189 * @iocb_cmnd : iocb command code. 189 * @phba: Pointer to HBA context object.
190 * @iocblist: List of IOCBs.
191 * @ulpstatus: ULP status in IOCB command field.
192 * @ulpWord4: ULP word-4 in IOCB command field.
193 *
194 * This function is called with a list of IOCBs to cancel. It cancels the IOCB
195 * on the list by invoking the complete callback function associated with the
196 * IOCB with the provided @ulpstatus and @ulpword4 set to the IOCB commond
197 * fields.
198 **/
199void
200lpfc_sli_cancel_iocbs(struct lpfc_hba *phba, struct list_head *iocblist,
201 uint32_t ulpstatus, uint32_t ulpWord4)
202{
203 struct lpfc_iocbq *piocb;
204
205 while (!list_empty(iocblist)) {
206 list_remove_head(iocblist, piocb, struct lpfc_iocbq, list);
207
208 if (!piocb->iocb_cmpl)
209 lpfc_sli_release_iocbq(phba, piocb);
210 else {
211 piocb->iocb.ulpStatus = ulpstatus;
212 piocb->iocb.un.ulpWord[4] = ulpWord4;
213 (piocb->iocb_cmpl) (phba, piocb, piocb);
214 }
215 }
216 return;
217}
218
219/**
220 * lpfc_sli_iocb_cmd_type - Get the iocb type
221 * @iocb_cmnd: iocb command code.
190 * 222 *
191 * This function is called by ring event handler function to get the iocb type. 223 * This function is called by ring event handler function to get the iocb type.
192 * This function translates the iocb command to an iocb command type used to 224 * This function translates the iocb command to an iocb command type used to
@@ -295,7 +327,7 @@ lpfc_sli_iocb_cmd_type(uint8_t iocb_cmnd)
295} 327}
296 328
297/** 329/**
298 * lpfc_sli_ring_map: Issue config_ring mbox for all rings. 330 * lpfc_sli_ring_map - Issue config_ring mbox for all rings
299 * @phba: Pointer to HBA context object. 331 * @phba: Pointer to HBA context object.
300 * 332 *
301 * This function is called from SLI initialization code 333 * This function is called from SLI initialization code
@@ -338,7 +370,7 @@ lpfc_sli_ring_map(struct lpfc_hba *phba)
338} 370}
339 371
340/** 372/**
341 * lpfc_sli_ringtxcmpl_put: Adds new iocb to the txcmplq. 373 * lpfc_sli_ringtxcmpl_put - Adds new iocb to the txcmplq
342 * @phba: Pointer to HBA context object. 374 * @phba: Pointer to HBA context object.
343 * @pring: Pointer to driver SLI ring object. 375 * @pring: Pointer to driver SLI ring object.
344 * @piocb: Pointer to the driver iocb object. 376 * @piocb: Pointer to the driver iocb object.
@@ -370,7 +402,7 @@ lpfc_sli_ringtxcmpl_put(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
370} 402}
371 403
372/** 404/**
373 * lpfc_sli_ringtx_get: Get first element of the txq. 405 * lpfc_sli_ringtx_get - Get first element of the txq
374 * @phba: Pointer to HBA context object. 406 * @phba: Pointer to HBA context object.
375 * @pring: Pointer to driver SLI ring object. 407 * @pring: Pointer to driver SLI ring object.
376 * 408 *
@@ -391,7 +423,7 @@ lpfc_sli_ringtx_get(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
391} 423}
392 424
393/** 425/**
394 * lpfc_sli_next_iocb_slot: Get next iocb slot in the ring. 426 * lpfc_sli_next_iocb_slot - Get next iocb slot in the ring
395 * @phba: Pointer to HBA context object. 427 * @phba: Pointer to HBA context object.
396 * @pring: Pointer to driver SLI ring object. 428 * @pring: Pointer to driver SLI ring object.
397 * 429 *
@@ -445,7 +477,7 @@ lpfc_sli_next_iocb_slot (struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
445} 477}
446 478
447/** 479/**
448 * lpfc_sli_next_iotag: Get an iotag for the iocb. 480 * lpfc_sli_next_iotag - Get an iotag for the iocb
449 * @phba: Pointer to HBA context object. 481 * @phba: Pointer to HBA context object.
450 * @iocbq: Pointer to driver iocb object. 482 * @iocbq: Pointer to driver iocb object.
451 * 483 *
@@ -520,7 +552,7 @@ lpfc_sli_next_iotag(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
520} 552}
521 553
522/** 554/**
523 * lpfc_sli_submit_iocb: Submit an iocb to the firmware. 555 * lpfc_sli_submit_iocb - Submit an iocb to the firmware
524 * @phba: Pointer to HBA context object. 556 * @phba: Pointer to HBA context object.
525 * @pring: Pointer to driver SLI ring object. 557 * @pring: Pointer to driver SLI ring object.
526 * @iocb: Pointer to iocb slot in the ring. 558 * @iocb: Pointer to iocb slot in the ring.
@@ -577,7 +609,7 @@ lpfc_sli_submit_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
577} 609}
578 610
579/** 611/**
580 * lpfc_sli_update_full_ring: Update the chip attention register. 612 * lpfc_sli_update_full_ring - Update the chip attention register
581 * @phba: Pointer to HBA context object. 613 * @phba: Pointer to HBA context object.
582 * @pring: Pointer to driver SLI ring object. 614 * @pring: Pointer to driver SLI ring object.
583 * 615 *
@@ -608,7 +640,7 @@ lpfc_sli_update_full_ring(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
608} 640}
609 641
610/** 642/**
611 * lpfc_sli_update_ring: Update chip attention register. 643 * lpfc_sli_update_ring - Update chip attention register
612 * @phba: Pointer to HBA context object. 644 * @phba: Pointer to HBA context object.
613 * @pring: Pointer to driver SLI ring object. 645 * @pring: Pointer to driver SLI ring object.
614 * 646 *
@@ -632,7 +664,7 @@ lpfc_sli_update_ring(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
632} 664}
633 665
634/** 666/**
635 * lpfc_sli_resume_iocb: Process iocbs in the txq. 667 * lpfc_sli_resume_iocb - Process iocbs in the txq
636 * @phba: Pointer to HBA context object. 668 * @phba: Pointer to HBA context object.
637 * @pring: Pointer to driver SLI ring object. 669 * @pring: Pointer to driver SLI ring object.
638 * 670 *
@@ -672,7 +704,7 @@ lpfc_sli_resume_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
672} 704}
673 705
674/** 706/**
675 * lpfc_sli_next_hbq_slot: Get next hbq entry for the HBQ. 707 * lpfc_sli_next_hbq_slot - Get next hbq entry for the HBQ
676 * @phba: Pointer to HBA context object. 708 * @phba: Pointer to HBA context object.
677 * @hbqno: HBQ number. 709 * @hbqno: HBQ number.
678 * 710 *
@@ -717,7 +749,7 @@ lpfc_sli_next_hbq_slot(struct lpfc_hba *phba, uint32_t hbqno)
717} 749}
718 750
719/** 751/**
720 * lpfc_sli_hbqbuf_free_all: Free all the hbq buffers. 752 * lpfc_sli_hbqbuf_free_all - Free all the hbq buffers
721 * @phba: Pointer to HBA context object. 753 * @phba: Pointer to HBA context object.
722 * 754 *
723 * This function is called with no lock held to free all the 755 * This function is called with no lock held to free all the
@@ -771,7 +803,7 @@ lpfc_sli_hbqbuf_free_all(struct lpfc_hba *phba)
771} 803}
772 804
773/** 805/**
774 * lpfc_sli_hbq_to_firmware: Post the hbq buffer to firmware. 806 * lpfc_sli_hbq_to_firmware - Post the hbq buffer to firmware
775 * @phba: Pointer to HBA context object. 807 * @phba: Pointer to HBA context object.
776 * @hbqno: HBQ number. 808 * @hbqno: HBQ number.
777 * @hbq_buf: Pointer to HBQ buffer. 809 * @hbq_buf: Pointer to HBQ buffer.
@@ -818,8 +850,8 @@ static struct lpfc_hbq_init lpfc_els_hbq = {
818 .profile = 0, 850 .profile = 0,
819 .ring_mask = (1 << LPFC_ELS_RING), 851 .ring_mask = (1 << LPFC_ELS_RING),
820 .buffer_count = 0, 852 .buffer_count = 0,
821 .init_count = 20, 853 .init_count = 40,
822 .add_count = 5, 854 .add_count = 40,
823}; 855};
824 856
825/* HBQ for the extra ring if needed */ 857/* HBQ for the extra ring if needed */
@@ -841,7 +873,7 @@ struct lpfc_hbq_init *lpfc_hbq_defs[] = {
841}; 873};
842 874
843/** 875/**
844 * lpfc_sli_hbqbuf_fill_hbqs: Post more hbq buffers to HBQ. 876 * lpfc_sli_hbqbuf_fill_hbqs - Post more hbq buffers to HBQ
845 * @phba: Pointer to HBA context object. 877 * @phba: Pointer to HBA context object.
846 * @hbqno: HBQ number. 878 * @hbqno: HBQ number.
847 * @count: Number of HBQ buffers to be posted. 879 * @count: Number of HBQ buffers to be posted.
@@ -901,7 +933,7 @@ err:
901} 933}
902 934
903/** 935/**
904 * lpfc_sli_hbqbuf_add_hbqs: Post more HBQ buffers to firmware. 936 * lpfc_sli_hbqbuf_add_hbqs - Post more HBQ buffers to firmware
905 * @phba: Pointer to HBA context object. 937 * @phba: Pointer to HBA context object.
906 * @qno: HBQ number. 938 * @qno: HBQ number.
907 * 939 *
@@ -917,7 +949,7 @@ lpfc_sli_hbqbuf_add_hbqs(struct lpfc_hba *phba, uint32_t qno)
917} 949}
918 950
919/** 951/**
920 * lpfc_sli_hbqbuf_init_hbqs: Post initial buffers to the HBQ. 952 * lpfc_sli_hbqbuf_init_hbqs - Post initial buffers to the HBQ
921 * @phba: Pointer to HBA context object. 953 * @phba: Pointer to HBA context object.
922 * @qno: HBQ queue number. 954 * @qno: HBQ queue number.
923 * 955 *
@@ -933,7 +965,7 @@ lpfc_sli_hbqbuf_init_hbqs(struct lpfc_hba *phba, uint32_t qno)
933} 965}
934 966
935/** 967/**
936 * lpfc_sli_hbqbuf_find: Find the hbq buffer associated with a tag. 968 * lpfc_sli_hbqbuf_find - Find the hbq buffer associated with a tag
937 * @phba: Pointer to HBA context object. 969 * @phba: Pointer to HBA context object.
938 * @tag: Tag of the hbq buffer. 970 * @tag: Tag of the hbq buffer.
939 * 971 *
@@ -966,7 +998,7 @@ lpfc_sli_hbqbuf_find(struct lpfc_hba *phba, uint32_t tag)
966} 998}
967 999
968/** 1000/**
969 * lpfc_sli_free_hbq: Give back the hbq buffer to firmware. 1001 * lpfc_sli_free_hbq - Give back the hbq buffer to firmware
970 * @phba: Pointer to HBA context object. 1002 * @phba: Pointer to HBA context object.
971 * @hbq_buffer: Pointer to HBQ buffer. 1003 * @hbq_buffer: Pointer to HBQ buffer.
972 * 1004 *
@@ -988,7 +1020,7 @@ lpfc_sli_free_hbq(struct lpfc_hba *phba, struct hbq_dmabuf *hbq_buffer)
988} 1020}
989 1021
990/** 1022/**
991 * lpfc_sli_chk_mbx_command: Check if the mailbox is a legitimate mailbox. 1023 * lpfc_sli_chk_mbx_command - Check if the mailbox is a legitimate mailbox
992 * @mbxCommand: mailbox command code. 1024 * @mbxCommand: mailbox command code.
993 * 1025 *
994 * This function is called by the mailbox event handler function to verify 1026 * This function is called by the mailbox event handler function to verify
@@ -1064,8 +1096,7 @@ lpfc_sli_chk_mbx_command(uint8_t mbxCommand)
1064} 1096}
1065 1097
1066/** 1098/**
1067 * lpfc_sli_wake_mbox_wait: Completion handler for mbox issued from 1099 * lpfc_sli_wake_mbox_wait - lpfc_sli_issue_mbox_wait mbox completion handler
1068 * lpfc_sli_issue_mbox_wait.
1069 * @phba: Pointer to HBA context object. 1100 * @phba: Pointer to HBA context object.
1070 * @pmboxq: Pointer to mailbox command. 1101 * @pmboxq: Pointer to mailbox command.
1071 * 1102 *
@@ -1096,7 +1127,7 @@ lpfc_sli_wake_mbox_wait(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq)
1096 1127
1097 1128
1098/** 1129/**
1099 * lpfc_sli_def_mbox_cmpl: Default mailbox completion handler. 1130 * lpfc_sli_def_mbox_cmpl - Default mailbox completion handler
1100 * @phba: Pointer to HBA context object. 1131 * @phba: Pointer to HBA context object.
1101 * @pmb: Pointer to mailbox object. 1132 * @pmb: Pointer to mailbox object.
1102 * 1133 *
@@ -1140,7 +1171,7 @@ lpfc_sli_def_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
1140} 1171}
1141 1172
1142/** 1173/**
1143 * lpfc_sli_handle_mb_event: Handle mailbox completions from firmware. 1174 * lpfc_sli_handle_mb_event - Handle mailbox completions from firmware
1144 * @phba: Pointer to HBA context object. 1175 * @phba: Pointer to HBA context object.
1145 * 1176 *
1146 * This function is called with no lock held. This function processes all 1177 * This function is called with no lock held. This function processes all
@@ -1260,7 +1291,7 @@ lpfc_sli_handle_mb_event(struct lpfc_hba *phba)
1260} 1291}
1261 1292
1262/** 1293/**
1263 * lpfc_sli_get_buff: Get the buffer associated with the buffer tag. 1294 * lpfc_sli_get_buff - Get the buffer associated with the buffer tag
1264 * @phba: Pointer to HBA context object. 1295 * @phba: Pointer to HBA context object.
1265 * @pring: Pointer to driver SLI ring object. 1296 * @pring: Pointer to driver SLI ring object.
1266 * @tag: buffer tag. 1297 * @tag: buffer tag.
@@ -1288,7 +1319,7 @@ lpfc_sli_get_buff(struct lpfc_hba *phba,
1288 1319
1289 1320
1290/** 1321/**
1291 * lpfc_sli_process_unsol_iocb: Unsolicited iocb handler. 1322 * lpfc_sli_process_unsol_iocb - Unsolicited iocb handler
1292 * @phba: Pointer to HBA context object. 1323 * @phba: Pointer to HBA context object.
1293 * @pring: Pointer to driver SLI ring object. 1324 * @pring: Pointer to driver SLI ring object.
1294 * @saveq: Pointer to the unsolicited iocb. 1325 * @saveq: Pointer to the unsolicited iocb.
@@ -1484,7 +1515,7 @@ lpfc_sli_process_unsol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
1484} 1515}
1485 1516
1486/** 1517/**
1487 * lpfc_sli_iocbq_lookup: Find command iocb for the given response iocb. 1518 * lpfc_sli_iocbq_lookup - Find command iocb for the given response iocb
1488 * @phba: Pointer to HBA context object. 1519 * @phba: Pointer to HBA context object.
1489 * @pring: Pointer to driver SLI ring object. 1520 * @pring: Pointer to driver SLI ring object.
1490 * @prspiocb: Pointer to response iocb object. 1521 * @prspiocb: Pointer to response iocb object.
@@ -1521,7 +1552,7 @@ lpfc_sli_iocbq_lookup(struct lpfc_hba *phba,
1521} 1552}
1522 1553
1523/** 1554/**
1524 * lpfc_sli_process_sol_iocb: process solicited iocb completion. 1555 * lpfc_sli_process_sol_iocb - process solicited iocb completion
1525 * @phba: Pointer to HBA context object. 1556 * @phba: Pointer to HBA context object.
1526 * @pring: Pointer to driver SLI ring object. 1557 * @pring: Pointer to driver SLI ring object.
1527 * @saveq: Pointer to the response iocb to be processed. 1558 * @saveq: Pointer to the response iocb to be processed.
@@ -1597,7 +1628,7 @@ lpfc_sli_process_sol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
1597 * Ring <ringno> handler: unexpected completion IoTag 1628 * Ring <ringno> handler: unexpected completion IoTag
1598 * <IoTag> 1629 * <IoTag>
1599 */ 1630 */
1600 lpfc_printf_vlog(cmdiocbp->vport, KERN_WARNING, LOG_SLI, 1631 lpfc_printf_log(phba, KERN_WARNING, LOG_SLI,
1601 "0322 Ring %d handler: " 1632 "0322 Ring %d handler: "
1602 "unexpected completion IoTag x%x " 1633 "unexpected completion IoTag x%x "
1603 "Data: x%x x%x x%x x%x\n", 1634 "Data: x%x x%x x%x x%x\n",
@@ -1614,7 +1645,7 @@ lpfc_sli_process_sol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
1614} 1645}
1615 1646
1616/** 1647/**
1617 * lpfc_sli_rsp_pointers_error: Response ring pointer error handler. 1648 * lpfc_sli_rsp_pointers_error - Response ring pointer error handler
1618 * @phba: Pointer to HBA context object. 1649 * @phba: Pointer to HBA context object.
1619 * @pring: Pointer to driver SLI ring object. 1650 * @pring: Pointer to driver SLI ring object.
1620 * 1651 *
@@ -1652,7 +1683,7 @@ lpfc_sli_rsp_pointers_error(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
1652} 1683}
1653 1684
1654/** 1685/**
1655 * lpfc_poll_eratt: Error attention polling timer timeout handler. 1686 * lpfc_poll_eratt - Error attention polling timer timeout handler
1656 * @ptr: Pointer to address of HBA context object. 1687 * @ptr: Pointer to address of HBA context object.
1657 * 1688 *
1658 * This function is invoked by the Error Attention polling timer when the 1689 * This function is invoked by the Error Attention polling timer when the
@@ -1682,7 +1713,7 @@ void lpfc_poll_eratt(unsigned long ptr)
1682} 1713}
1683 1714
1684/** 1715/**
1685 * lpfc_sli_poll_fcp_ring: Handle FCP ring completion in polling mode. 1716 * lpfc_sli_poll_fcp_ring - Handle FCP ring completion in polling mode
1686 * @phba: Pointer to HBA context object. 1717 * @phba: Pointer to HBA context object.
1687 * 1718 *
1688 * This function is called from lpfc_queuecommand, lpfc_poll_timeout, 1719 * This function is called from lpfc_queuecommand, lpfc_poll_timeout,
@@ -1845,7 +1876,7 @@ void lpfc_sli_poll_fcp_ring(struct lpfc_hba *phba)
1845} 1876}
1846 1877
1847/** 1878/**
1848 * lpfc_sli_handle_fast_ring_event: Handle ring events on FCP ring. 1879 * lpfc_sli_handle_fast_ring_event - Handle ring events on FCP ring
1849 * @phba: Pointer to HBA context object. 1880 * @phba: Pointer to HBA context object.
1850 * @pring: Pointer to driver SLI ring object. 1881 * @pring: Pointer to driver SLI ring object.
1851 * @mask: Host attention register mask for this ring. 1882 * @mask: Host attention register mask for this ring.
@@ -2037,7 +2068,7 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba,
2037} 2068}
2038 2069
2039/** 2070/**
2040 * lpfc_sli_handle_slow_ring_event: Handle ring events for non-FCP rings. 2071 * lpfc_sli_handle_slow_ring_event - Handle ring events for non-FCP rings
2041 * @phba: Pointer to HBA context object. 2072 * @phba: Pointer to HBA context object.
2042 * @pring: Pointer to driver SLI ring object. 2073 * @pring: Pointer to driver SLI ring object.
2043 * @mask: Host attention register mask for this ring. 2074 * @mask: Host attention register mask for this ring.
@@ -2311,7 +2342,7 @@ lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba,
2311} 2342}
2312 2343
2313/** 2344/**
2314 * lpfc_sli_abort_iocb_ring: Abort all iocbs in the ring. 2345 * lpfc_sli_abort_iocb_ring - Abort all iocbs in the ring
2315 * @phba: Pointer to HBA context object. 2346 * @phba: Pointer to HBA context object.
2316 * @pring: Pointer to driver SLI ring object. 2347 * @pring: Pointer to driver SLI ring object.
2317 * 2348 *
@@ -2325,7 +2356,6 @@ lpfc_sli_abort_iocb_ring(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
2325{ 2356{
2326 LIST_HEAD(completions); 2357 LIST_HEAD(completions);
2327 struct lpfc_iocbq *iocb, *next_iocb; 2358 struct lpfc_iocbq *iocb, *next_iocb;
2328 IOCB_t *cmd = NULL;
2329 2359
2330 if (pring->ringno == LPFC_ELS_RING) { 2360 if (pring->ringno == LPFC_ELS_RING) {
2331 lpfc_fabric_abort_hba(phba); 2361 lpfc_fabric_abort_hba(phba);
@@ -2344,23 +2374,13 @@ lpfc_sli_abort_iocb_ring(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
2344 2374
2345 spin_unlock_irq(&phba->hbalock); 2375 spin_unlock_irq(&phba->hbalock);
2346 2376
2347 while (!list_empty(&completions)) { 2377 /* Cancel all the IOCBs from the completions list */
2348 iocb = list_get_first(&completions, struct lpfc_iocbq, list); 2378 lpfc_sli_cancel_iocbs(phba, &completions, IOSTAT_LOCAL_REJECT,
2349 cmd = &iocb->iocb; 2379 IOERR_SLI_ABORTED);
2350 list_del_init(&iocb->list);
2351
2352 if (!iocb->iocb_cmpl)
2353 lpfc_sli_release_iocbq(phba, iocb);
2354 else {
2355 cmd->ulpStatus = IOSTAT_LOCAL_REJECT;
2356 cmd->un.ulpWord[4] = IOERR_SLI_ABORTED;
2357 (iocb->iocb_cmpl) (phba, iocb, iocb);
2358 }
2359 }
2360} 2380}
2361 2381
2362/** 2382/**
2363 * lpfc_sli_flush_fcp_rings: flush all iocbs in the fcp ring. 2383 * lpfc_sli_flush_fcp_rings - flush all iocbs in the fcp ring
2364 * @phba: Pointer to HBA context object. 2384 * @phba: Pointer to HBA context object.
2365 * 2385 *
2366 * This function flushes all iocbs in the fcp ring and frees all the iocb 2386 * This function flushes all iocbs in the fcp ring and frees all the iocb
@@ -2374,8 +2394,6 @@ lpfc_sli_flush_fcp_rings(struct lpfc_hba *phba)
2374{ 2394{
2375 LIST_HEAD(txq); 2395 LIST_HEAD(txq);
2376 LIST_HEAD(txcmplq); 2396 LIST_HEAD(txcmplq);
2377 struct lpfc_iocbq *iocb;
2378 IOCB_t *cmd = NULL;
2379 struct lpfc_sli *psli = &phba->sli; 2397 struct lpfc_sli *psli = &phba->sli;
2380 struct lpfc_sli_ring *pring; 2398 struct lpfc_sli_ring *pring;
2381 2399
@@ -2393,38 +2411,16 @@ lpfc_sli_flush_fcp_rings(struct lpfc_hba *phba)
2393 spin_unlock_irq(&phba->hbalock); 2411 spin_unlock_irq(&phba->hbalock);
2394 2412
2395 /* Flush the txq */ 2413 /* Flush the txq */
2396 while (!list_empty(&txq)) { 2414 lpfc_sli_cancel_iocbs(phba, &txq, IOSTAT_LOCAL_REJECT,
2397 iocb = list_get_first(&txq, struct lpfc_iocbq, list); 2415 IOERR_SLI_DOWN);
2398 cmd = &iocb->iocb;
2399 list_del_init(&iocb->list);
2400
2401 if (!iocb->iocb_cmpl)
2402 lpfc_sli_release_iocbq(phba, iocb);
2403 else {
2404 cmd->ulpStatus = IOSTAT_LOCAL_REJECT;
2405 cmd->un.ulpWord[4] = IOERR_SLI_DOWN;
2406 (iocb->iocb_cmpl) (phba, iocb, iocb);
2407 }
2408 }
2409 2416
2410 /* Flush the txcmpq */ 2417 /* Flush the txcmpq */
2411 while (!list_empty(&txcmplq)) { 2418 lpfc_sli_cancel_iocbs(phba, &txcmplq, IOSTAT_LOCAL_REJECT,
2412 iocb = list_get_first(&txcmplq, struct lpfc_iocbq, list); 2419 IOERR_SLI_DOWN);
2413 cmd = &iocb->iocb;
2414 list_del_init(&iocb->list);
2415
2416 if (!iocb->iocb_cmpl)
2417 lpfc_sli_release_iocbq(phba, iocb);
2418 else {
2419 cmd->ulpStatus = IOSTAT_LOCAL_REJECT;
2420 cmd->un.ulpWord[4] = IOERR_SLI_DOWN;
2421 (iocb->iocb_cmpl) (phba, iocb, iocb);
2422 }
2423 }
2424} 2420}
2425 2421
2426/** 2422/**
2427 * lpfc_sli_brdready: Check for host status bits. 2423 * lpfc_sli_brdready - Check for host status bits
2428 * @phba: Pointer to HBA context object. 2424 * @phba: Pointer to HBA context object.
2429 * @mask: Bit mask to be checked. 2425 * @mask: Bit mask to be checked.
2430 * 2426 *
@@ -2484,7 +2480,7 @@ lpfc_sli_brdready(struct lpfc_hba *phba, uint32_t mask)
2484#define BARRIER_TEST_PATTERN (0xdeadbeef) 2480#define BARRIER_TEST_PATTERN (0xdeadbeef)
2485 2481
2486/** 2482/**
2487 * lpfc_reset_barrier: Make HBA ready for HBA reset. 2483 * lpfc_reset_barrier - Make HBA ready for HBA reset
2488 * @phba: Pointer to HBA context object. 2484 * @phba: Pointer to HBA context object.
2489 * 2485 *
2490 * This function is called before resetting an HBA. This 2486 * This function is called before resetting an HBA. This
@@ -2564,7 +2560,7 @@ restore_hc:
2564} 2560}
2565 2561
2566/** 2562/**
2567 * lpfc_sli_brdkill: Issue a kill_board mailbox command. 2563 * lpfc_sli_brdkill - Issue a kill_board mailbox command
2568 * @phba: Pointer to HBA context object. 2564 * @phba: Pointer to HBA context object.
2569 * 2565 *
2570 * This function issues a kill_board mailbox command and waits for 2566 * This function issues a kill_board mailbox command and waits for
@@ -2651,7 +2647,7 @@ lpfc_sli_brdkill(struct lpfc_hba *phba)
2651} 2647}
2652 2648
2653/** 2649/**
2654 * lpfc_sli_brdreset: Reset the HBA. 2650 * lpfc_sli_brdreset - Reset the HBA
2655 * @phba: Pointer to HBA context object. 2651 * @phba: Pointer to HBA context object.
2656 * 2652 *
2657 * This function resets the HBA by writing HC_INITFF to the control 2653 * This function resets the HBA by writing HC_INITFF to the control
@@ -2714,7 +2710,7 @@ lpfc_sli_brdreset(struct lpfc_hba *phba)
2714} 2710}
2715 2711
2716/** 2712/**
2717 * lpfc_sli_brdrestart: Restart the HBA. 2713 * lpfc_sli_brdrestart - Restart the HBA
2718 * @phba: Pointer to HBA context object. 2714 * @phba: Pointer to HBA context object.
2719 * 2715 *
2720 * This function is called in the SLI initialization code path to 2716 * This function is called in the SLI initialization code path to
@@ -2781,7 +2777,7 @@ lpfc_sli_brdrestart(struct lpfc_hba *phba)
2781} 2777}
2782 2778
2783/** 2779/**
2784 * lpfc_sli_chipset_init: Wait for the restart of the HBA after a restart. 2780 * lpfc_sli_chipset_init - Wait for the restart of the HBA after a restart
2785 * @phba: Pointer to HBA context object. 2781 * @phba: Pointer to HBA context object.
2786 * 2782 *
2787 * This function is called after a HBA restart to wait for successful 2783 * This function is called after a HBA restart to wait for successful
@@ -2876,7 +2872,7 @@ lpfc_sli_chipset_init(struct lpfc_hba *phba)
2876} 2872}
2877 2873
2878/** 2874/**
2879 * lpfc_sli_hbq_count: Get the number of HBQs to be configured. 2875 * lpfc_sli_hbq_count - Get the number of HBQs to be configured
2880 * 2876 *
2881 * This function calculates and returns the number of HBQs required to be 2877 * This function calculates and returns the number of HBQs required to be
2882 * configured. 2878 * configured.
@@ -2888,7 +2884,7 @@ lpfc_sli_hbq_count(void)
2888} 2884}
2889 2885
2890/** 2886/**
2891 * lpfc_sli_hbq_entry_count: Calculate total number of hbq entries. 2887 * lpfc_sli_hbq_entry_count - Calculate total number of hbq entries
2892 * 2888 *
2893 * This function adds the number of hbq entries in every HBQ to get 2889 * This function adds the number of hbq entries in every HBQ to get
2894 * the total number of hbq entries required for the HBA and returns 2890 * the total number of hbq entries required for the HBA and returns
@@ -2907,7 +2903,7 @@ lpfc_sli_hbq_entry_count(void)
2907} 2903}
2908 2904
2909/** 2905/**
2910 * lpfc_sli_hbq_size: Calculate memory required for all hbq entries. 2906 * lpfc_sli_hbq_size - Calculate memory required for all hbq entries
2911 * 2907 *
2912 * This function calculates amount of memory required for all hbq entries 2908 * This function calculates amount of memory required for all hbq entries
2913 * to be configured and returns the total memory required. 2909 * to be configured and returns the total memory required.
@@ -2919,7 +2915,7 @@ lpfc_sli_hbq_size(void)
2919} 2915}
2920 2916
2921/** 2917/**
2922 * lpfc_sli_hbq_setup: configure and initialize HBQs. 2918 * lpfc_sli_hbq_setup - configure and initialize HBQs
2923 * @phba: Pointer to HBA context object. 2919 * @phba: Pointer to HBA context object.
2924 * 2920 *
2925 * This function is called during the SLI initialization to configure 2921 * This function is called during the SLI initialization to configure
@@ -2988,7 +2984,7 @@ lpfc_sli_hbq_setup(struct lpfc_hba *phba)
2988} 2984}
2989 2985
2990/** 2986/**
2991 * lpfc_sli_config_port: Issue config port mailbox command. 2987 * lpfc_sli_config_port - Issue config port mailbox command
2992 * @phba: Pointer to HBA context object. 2988 * @phba: Pointer to HBA context object.
2993 * @sli_mode: sli mode - 2/3 2989 * @sli_mode: sli mode - 2/3
2994 * 2990 *
@@ -3114,7 +3110,7 @@ do_prep_failed:
3114 3110
3115 3111
3116/** 3112/**
3117 * lpfc_sli_hba_setup: SLI intialization function. 3113 * lpfc_sli_hba_setup - SLI intialization function
3118 * @phba: Pointer to HBA context object. 3114 * @phba: Pointer to HBA context object.
3119 * 3115 *
3120 * This function is the main SLI intialization function. This function 3116 * This function is the main SLI intialization function. This function
@@ -3206,7 +3202,7 @@ lpfc_sli_hba_setup_error:
3206 3202
3207 3203
3208/** 3204/**
3209 * lpfc_mbox_timeout: Timeout call back function for mbox timer. 3205 * lpfc_mbox_timeout - Timeout call back function for mbox timer
3210 * @ptr: context object - pointer to hba structure. 3206 * @ptr: context object - pointer to hba structure.
3211 * 3207 *
3212 * This is the callback function for mailbox timer. The mailbox 3208 * This is the callback function for mailbox timer. The mailbox
@@ -3237,7 +3233,7 @@ lpfc_mbox_timeout(unsigned long ptr)
3237 3233
3238 3234
3239/** 3235/**
3240 * lpfc_mbox_timeout_handler: Worker thread function to handle mailbox timeout. 3236 * lpfc_mbox_timeout_handler - Worker thread function to handle mailbox timeout
3241 * @phba: Pointer to HBA context object. 3237 * @phba: Pointer to HBA context object.
3242 * 3238 *
3243 * This function is called from worker thread when a mailbox command times out. 3239 * This function is called from worker thread when a mailbox command times out.
@@ -3252,6 +3248,21 @@ lpfc_mbox_timeout_handler(struct lpfc_hba *phba)
3252 struct lpfc_sli *psli = &phba->sli; 3248 struct lpfc_sli *psli = &phba->sli;
3253 struct lpfc_sli_ring *pring; 3249 struct lpfc_sli_ring *pring;
3254 3250
3251 /* Check the pmbox pointer first. There is a race condition
3252 * between the mbox timeout handler getting executed in the
3253 * worklist and the mailbox actually completing. When this
3254 * race condition occurs, the mbox_active will be NULL.
3255 */
3256 spin_lock_irq(&phba->hbalock);
3257 if (pmbox == NULL) {
3258 lpfc_printf_log(phba, KERN_WARNING,
3259 LOG_MBOX | LOG_SLI,
3260 "0353 Active Mailbox cleared - mailbox timeout "
3261 "exiting\n");
3262 spin_unlock_irq(&phba->hbalock);
3263 return;
3264 }
3265
3255 /* Mbox cmd <mbxCommand> timeout */ 3266 /* Mbox cmd <mbxCommand> timeout */
3256 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, 3267 lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI,
3257 "0310 Mailbox command x%x timeout Data: x%x x%x x%p\n", 3268 "0310 Mailbox command x%x timeout Data: x%x x%x x%p\n",
@@ -3259,6 +3270,7 @@ lpfc_mbox_timeout_handler(struct lpfc_hba *phba)
3259 phba->pport->port_state, 3270 phba->pport->port_state,
3260 phba->sli.sli_flag, 3271 phba->sli.sli_flag,
3261 phba->sli.mbox_active); 3272 phba->sli.mbox_active);
3273 spin_unlock_irq(&phba->hbalock);
3262 3274
3263 /* Setting state unknown so lpfc_sli_abort_iocb_ring 3275 /* Setting state unknown so lpfc_sli_abort_iocb_ring
3264 * would get IOCB_ERROR from lpfc_sli_issue_iocb, allowing 3276 * would get IOCB_ERROR from lpfc_sli_issue_iocb, allowing
@@ -3295,7 +3307,7 @@ lpfc_mbox_timeout_handler(struct lpfc_hba *phba)
3295} 3307}
3296 3308
3297/** 3309/**
3298 * lpfc_sli_issue_mbox: Issue a mailbox command to firmware. 3310 * lpfc_sli_issue_mbox - Issue a mailbox command to firmware
3299 * @phba: Pointer to HBA context object. 3311 * @phba: Pointer to HBA context object.
3300 * @pmbox: Pointer to mailbox object. 3312 * @pmbox: Pointer to mailbox object.
3301 * @flag: Flag indicating how the mailbox need to be processed. 3313 * @flag: Flag indicating how the mailbox need to be processed.
@@ -3365,6 +3377,12 @@ lpfc_sli_issue_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox, uint32_t flag)
3365 goto out_not_finished; 3377 goto out_not_finished;
3366 } 3378 }
3367 3379
3380 /* If HBA has a deferred error attention, fail the iocb. */
3381 if (unlikely(phba->hba_flag & DEFER_ERATT)) {
3382 spin_unlock_irqrestore(&phba->hbalock, drvr_flag);
3383 goto out_not_finished;
3384 }
3385
3368 psli = &phba->sli; 3386 psli = &phba->sli;
3369 3387
3370 mb = &pmbox->mb; 3388 mb = &pmbox->mb;
@@ -3632,7 +3650,7 @@ out_not_finished:
3632} 3650}
3633 3651
3634/** 3652/**
3635 * __lpfc_sli_ringtx_put: Add an iocb to the txq. 3653 * __lpfc_sli_ringtx_put - Add an iocb to the txq
3636 * @phba: Pointer to HBA context object. 3654 * @phba: Pointer to HBA context object.
3637 * @pring: Pointer to driver SLI ring object. 3655 * @pring: Pointer to driver SLI ring object.
3638 * @piocb: Pointer to address of newly added command iocb. 3656 * @piocb: Pointer to address of newly added command iocb.
@@ -3651,7 +3669,7 @@ __lpfc_sli_ringtx_put(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
3651} 3669}
3652 3670
3653/** 3671/**
3654 * lpfc_sli_next_iocb: Get the next iocb in the txq. 3672 * lpfc_sli_next_iocb - Get the next iocb in the txq
3655 * @phba: Pointer to HBA context object. 3673 * @phba: Pointer to HBA context object.
3656 * @pring: Pointer to driver SLI ring object. 3674 * @pring: Pointer to driver SLI ring object.
3657 * @piocb: Pointer to address of newly added command iocb. 3675 * @piocb: Pointer to address of newly added command iocb.
@@ -3683,7 +3701,7 @@ lpfc_sli_next_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
3683} 3701}
3684 3702
3685/** 3703/**
3686 * __lpfc_sli_issue_iocb: Lockless version of lpfc_sli_issue_iocb. 3704 * __lpfc_sli_issue_iocb - Lockless version of lpfc_sli_issue_iocb
3687 * @phba: Pointer to HBA context object. 3705 * @phba: Pointer to HBA context object.
3688 * @pring: Pointer to driver SLI ring object. 3706 * @pring: Pointer to driver SLI ring object.
3689 * @piocb: Pointer to command iocb. 3707 * @piocb: Pointer to command iocb.
@@ -3729,6 +3747,10 @@ __lpfc_sli_issue_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
3729 if (unlikely(pci_channel_offline(phba->pcidev))) 3747 if (unlikely(pci_channel_offline(phba->pcidev)))
3730 return IOCB_ERROR; 3748 return IOCB_ERROR;
3731 3749
3750 /* If HBA has a deferred error attention, fail the iocb. */
3751 if (unlikely(phba->hba_flag & DEFER_ERATT))
3752 return IOCB_ERROR;
3753
3732 /* 3754 /*
3733 * We should never get an IOCB if we are in a < LINK_DOWN state 3755 * We should never get an IOCB if we are in a < LINK_DOWN state
3734 */ 3756 */
@@ -3813,7 +3835,7 @@ __lpfc_sli_issue_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
3813 3835
3814 3836
3815/** 3837/**
3816 * lpfc_sli_issue_iocb: Wrapper function for __lpfc_sli_issue_iocb. 3838 * lpfc_sli_issue_iocb - Wrapper function for __lpfc_sli_issue_iocb
3817 * @phba: Pointer to HBA context object. 3839 * @phba: Pointer to HBA context object.
3818 * @pring: Pointer to driver SLI ring object. 3840 * @pring: Pointer to driver SLI ring object.
3819 * @piocb: Pointer to command iocb. 3841 * @piocb: Pointer to command iocb.
@@ -3840,7 +3862,7 @@ lpfc_sli_issue_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
3840} 3862}
3841 3863
3842/** 3864/**
3843 * lpfc_extra_ring_setup: Extra ring setup function. 3865 * lpfc_extra_ring_setup - Extra ring setup function
3844 * @phba: Pointer to HBA context object. 3866 * @phba: Pointer to HBA context object.
3845 * 3867 *
3846 * This function is called while driver attaches with the 3868 * This function is called while driver attaches with the
@@ -3886,7 +3908,7 @@ lpfc_extra_ring_setup( struct lpfc_hba *phba)
3886} 3908}
3887 3909
3888/** 3910/**
3889 * lpfc_sli_async_event_handler: ASYNC iocb handler function. 3911 * lpfc_sli_async_event_handler - ASYNC iocb handler function
3890 * @phba: Pointer to HBA context object. 3912 * @phba: Pointer to HBA context object.
3891 * @pring: Pointer to driver SLI ring object. 3913 * @pring: Pointer to driver SLI ring object.
3892 * @iocbq: Pointer to iocb object. 3914 * @iocbq: Pointer to iocb object.
@@ -3907,6 +3929,7 @@ lpfc_sli_async_event_handler(struct lpfc_hba * phba,
3907 uint16_t temp; 3929 uint16_t temp;
3908 struct temp_event temp_event_data; 3930 struct temp_event temp_event_data;
3909 struct Scsi_Host *shost; 3931 struct Scsi_Host *shost;
3932 uint32_t *iocb_w;
3910 3933
3911 icmd = &iocbq->iocb; 3934 icmd = &iocbq->iocb;
3912 evt_code = icmd->un.asyncstat.evt_code; 3935 evt_code = icmd->un.asyncstat.evt_code;
@@ -3914,13 +3937,23 @@ lpfc_sli_async_event_handler(struct lpfc_hba * phba,
3914 3937
3915 if ((evt_code != ASYNC_TEMP_WARN) && 3938 if ((evt_code != ASYNC_TEMP_WARN) &&
3916 (evt_code != ASYNC_TEMP_SAFE)) { 3939 (evt_code != ASYNC_TEMP_SAFE)) {
3940 iocb_w = (uint32_t *) icmd;
3917 lpfc_printf_log(phba, 3941 lpfc_printf_log(phba,
3918 KERN_ERR, 3942 KERN_ERR,
3919 LOG_SLI, 3943 LOG_SLI,
3920 "0346 Ring %d handler: unexpected ASYNC_STATUS" 3944 "0346 Ring %d handler: unexpected ASYNC_STATUS"
3921 " evt_code 0x%x\n", 3945 " evt_code 0x%x \n"
3946 "W0 0x%08x W1 0x%08x W2 0x%08x W3 0x%08x\n"
3947 "W4 0x%08x W5 0x%08x W6 0x%08x W7 0x%08x\n"
3948 "W8 0x%08x W9 0x%08x W10 0x%08x W11 0x%08x\n"
3949 "W12 0x%08x W13 0x%08x W14 0x%08x W15 0x%08x\n",
3922 pring->ringno, 3950 pring->ringno,
3923 icmd->un.asyncstat.evt_code); 3951 icmd->un.asyncstat.evt_code,
3952 iocb_w[0], iocb_w[1], iocb_w[2], iocb_w[3],
3953 iocb_w[4], iocb_w[5], iocb_w[6], iocb_w[7],
3954 iocb_w[8], iocb_w[9], iocb_w[10], iocb_w[11],
3955 iocb_w[12], iocb_w[13], iocb_w[14], iocb_w[15]);
3956
3924 return; 3957 return;
3925 } 3958 }
3926 temp_event_data.data = (uint32_t)temp; 3959 temp_event_data.data = (uint32_t)temp;
@@ -3954,7 +3987,7 @@ lpfc_sli_async_event_handler(struct lpfc_hba * phba,
3954 3987
3955 3988
3956/** 3989/**
3957 * lpfc_sli_setup: SLI ring setup function. 3990 * lpfc_sli_setup - SLI ring setup function
3958 * @phba: Pointer to HBA context object. 3991 * @phba: Pointer to HBA context object.
3959 * 3992 *
3960 * lpfc_sli_setup sets up rings of the SLI interface with 3993 * lpfc_sli_setup sets up rings of the SLI interface with
@@ -4076,7 +4109,7 @@ lpfc_sli_setup(struct lpfc_hba *phba)
4076} 4109}
4077 4110
4078/** 4111/**
4079 * lpfc_sli_queue_setup: Queue initialization function. 4112 * lpfc_sli_queue_setup - Queue initialization function
4080 * @phba: Pointer to HBA context object. 4113 * @phba: Pointer to HBA context object.
4081 * 4114 *
4082 * lpfc_sli_queue_setup sets up mailbox queues and iocb queues for each 4115 * lpfc_sli_queue_setup sets up mailbox queues and iocb queues for each
@@ -4115,7 +4148,7 @@ lpfc_sli_queue_setup(struct lpfc_hba *phba)
4115} 4148}
4116 4149
4117/** 4150/**
4118 * lpfc_sli_host_down: Vport cleanup function. 4151 * lpfc_sli_host_down - Vport cleanup function
4119 * @vport: Pointer to virtual port object. 4152 * @vport: Pointer to virtual port object.
4120 * 4153 *
4121 * lpfc_sli_host_down is called to clean up the resources 4154 * lpfc_sli_host_down is called to clean up the resources
@@ -4179,22 +4212,14 @@ lpfc_sli_host_down(struct lpfc_vport *vport)
4179 4212
4180 spin_unlock_irqrestore(&phba->hbalock, flags); 4213 spin_unlock_irqrestore(&phba->hbalock, flags);
4181 4214
4182 while (!list_empty(&completions)) { 4215 /* Cancel all the IOCBs from the completions list */
4183 list_remove_head(&completions, iocb, struct lpfc_iocbq, list); 4216 lpfc_sli_cancel_iocbs(phba, &completions, IOSTAT_LOCAL_REJECT,
4184 4217 IOERR_SLI_DOWN);
4185 if (!iocb->iocb_cmpl)
4186 lpfc_sli_release_iocbq(phba, iocb);
4187 else {
4188 iocb->iocb.ulpStatus = IOSTAT_LOCAL_REJECT;
4189 iocb->iocb.un.ulpWord[4] = IOERR_SLI_DOWN;
4190 (iocb->iocb_cmpl) (phba, iocb, iocb);
4191 }
4192 }
4193 return 1; 4218 return 1;
4194} 4219}
4195 4220
4196/** 4221/**
4197 * lpfc_sli_hba_down: Resource cleanup function for the HBA. 4222 * lpfc_sli_hba_down - Resource cleanup function for the HBA
4198 * @phba: Pointer to HBA context object. 4223 * @phba: Pointer to HBA context object.
4199 * 4224 *
4200 * This function cleans up all iocb, buffers, mailbox commands 4225 * This function cleans up all iocb, buffers, mailbox commands
@@ -4216,8 +4241,6 @@ lpfc_sli_hba_down(struct lpfc_hba *phba)
4216 struct lpfc_sli_ring *pring; 4241 struct lpfc_sli_ring *pring;
4217 struct lpfc_dmabuf *buf_ptr; 4242 struct lpfc_dmabuf *buf_ptr;
4218 LPFC_MBOXQ_t *pmb; 4243 LPFC_MBOXQ_t *pmb;
4219 struct lpfc_iocbq *iocb;
4220 IOCB_t *cmd = NULL;
4221 int i; 4244 int i;
4222 unsigned long flags = 0; 4245 unsigned long flags = 0;
4223 4246
@@ -4245,18 +4268,9 @@ lpfc_sli_hba_down(struct lpfc_hba *phba)
4245 } 4268 }
4246 spin_unlock_irqrestore(&phba->hbalock, flags); 4269 spin_unlock_irqrestore(&phba->hbalock, flags);
4247 4270
4248 while (!list_empty(&completions)) { 4271 /* Cancel all the IOCBs from the completions list */
4249 list_remove_head(&completions, iocb, struct lpfc_iocbq, list); 4272 lpfc_sli_cancel_iocbs(phba, &completions, IOSTAT_LOCAL_REJECT,
4250 cmd = &iocb->iocb; 4273 IOERR_SLI_DOWN);
4251
4252 if (!iocb->iocb_cmpl)
4253 lpfc_sli_release_iocbq(phba, iocb);
4254 else {
4255 cmd->ulpStatus = IOSTAT_LOCAL_REJECT;
4256 cmd->un.ulpWord[4] = IOERR_SLI_DOWN;
4257 (iocb->iocb_cmpl) (phba, iocb, iocb);
4258 }
4259 }
4260 4274
4261 spin_lock_irqsave(&phba->hbalock, flags); 4275 spin_lock_irqsave(&phba->hbalock, flags);
4262 list_splice_init(&phba->elsbuf, &completions); 4276 list_splice_init(&phba->elsbuf, &completions);
@@ -4299,7 +4313,7 @@ lpfc_sli_hba_down(struct lpfc_hba *phba)
4299} 4313}
4300 4314
4301/** 4315/**
4302 * lpfc_sli_pcimem_bcopy: SLI memory copy function. 4316 * lpfc_sli_pcimem_bcopy - SLI memory copy function
4303 * @srcp: Source memory pointer. 4317 * @srcp: Source memory pointer.
4304 * @destp: Destination memory pointer. 4318 * @destp: Destination memory pointer.
4305 * @cnt: Number of words required to be copied. 4319 * @cnt: Number of words required to be copied.
@@ -4329,7 +4343,7 @@ lpfc_sli_pcimem_bcopy(void *srcp, void *destp, uint32_t cnt)
4329 4343
4330 4344
4331/** 4345/**
4332 * lpfc_sli_ringpostbuf_put: Function to add a buffer to postbufq. 4346 * lpfc_sli_ringpostbuf_put - Function to add a buffer to postbufq
4333 * @phba: Pointer to HBA context object. 4347 * @phba: Pointer to HBA context object.
4334 * @pring: Pointer to driver SLI ring object. 4348 * @pring: Pointer to driver SLI ring object.
4335 * @mp: Pointer to driver buffer object. 4349 * @mp: Pointer to driver buffer object.
@@ -4352,8 +4366,7 @@ lpfc_sli_ringpostbuf_put(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
4352} 4366}
4353 4367
4354/** 4368/**
4355 * lpfc_sli_get_buffer_tag: Tag allocation function for a buffer posted 4369 * lpfc_sli_get_buffer_tag - allocates a tag for a CMD_QUE_XRI64_CX buffer
4356 * using CMD_QUE_XRI64_CX iocb.
4357 * @phba: Pointer to HBA context object. 4370 * @phba: Pointer to HBA context object.
4358 * 4371 *
4359 * When HBQ is enabled, buffers are searched based on tags. This function 4372 * When HBQ is enabled, buffers are searched based on tags. This function
@@ -4378,8 +4391,7 @@ lpfc_sli_get_buffer_tag(struct lpfc_hba *phba)
4378} 4391}
4379 4392
4380/** 4393/**
4381 * lpfc_sli_ring_taggedbuf_get: Search HBQ buffer associated with 4394 * lpfc_sli_ring_taggedbuf_get - find HBQ buffer associated with given tag
4382 * posted using CMD_QUE_XRI64_CX iocb.
4383 * @phba: Pointer to HBA context object. 4395 * @phba: Pointer to HBA context object.
4384 * @pring: Pointer to driver SLI ring object. 4396 * @pring: Pointer to driver SLI ring object.
4385 * @tag: Buffer tag. 4397 * @tag: Buffer tag.
@@ -4422,8 +4434,7 @@ lpfc_sli_ring_taggedbuf_get(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
4422} 4434}
4423 4435
4424/** 4436/**
4425 * lpfc_sli_ringpostbuf_get: SLI2 buffer search function for 4437 * lpfc_sli_ringpostbuf_get - search buffers for unsolicited CT and ELS events
4426 * unsolicited ct and els events.
4427 * @phba: Pointer to HBA context object. 4438 * @phba: Pointer to HBA context object.
4428 * @pring: Pointer to driver SLI ring object. 4439 * @pring: Pointer to driver SLI ring object.
4429 * @phys: DMA address of the buffer. 4440 * @phys: DMA address of the buffer.
@@ -4466,7 +4477,7 @@ lpfc_sli_ringpostbuf_get(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
4466} 4477}
4467 4478
4468/** 4479/**
4469 * lpfc_sli_abort_els_cmpl: Completion handler for the els abort iocbs. 4480 * lpfc_sli_abort_els_cmpl - Completion handler for the els abort iocbs
4470 * @phba: Pointer to HBA context object. 4481 * @phba: Pointer to HBA context object.
4471 * @cmdiocb: Pointer to driver command iocb object. 4482 * @cmdiocb: Pointer to driver command iocb object.
4472 * @rspiocb: Pointer to driver response iocb object. 4483 * @rspiocb: Pointer to driver response iocb object.
@@ -4542,7 +4553,7 @@ lpfc_sli_abort_els_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
4542} 4553}
4543 4554
4544/** 4555/**
4545 * lpfc_ignore_els_cmpl: Completion handler for aborted ELS command. 4556 * lpfc_ignore_els_cmpl - Completion handler for aborted ELS command
4546 * @phba: Pointer to HBA context object. 4557 * @phba: Pointer to HBA context object.
4547 * @cmdiocb: Pointer to driver command iocb object. 4558 * @cmdiocb: Pointer to driver command iocb object.
4548 * @rspiocb: Pointer to driver response iocb object. 4559 * @rspiocb: Pointer to driver response iocb object.
@@ -4572,7 +4583,7 @@ lpfc_ignore_els_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
4572} 4583}
4573 4584
4574/** 4585/**
4575 * lpfc_sli_issue_abort_iotag: Abort function for a command iocb. 4586 * lpfc_sli_issue_abort_iotag - Abort function for a command iocb
4576 * @phba: Pointer to HBA context object. 4587 * @phba: Pointer to HBA context object.
4577 * @pring: Pointer to driver SLI ring object. 4588 * @pring: Pointer to driver SLI ring object.
4578 * @cmdiocb: Pointer to driver command iocb object. 4589 * @cmdiocb: Pointer to driver command iocb object.
@@ -4658,15 +4669,14 @@ abort_iotag_exit:
4658} 4669}
4659 4670
4660/** 4671/**
4661 * lpfc_sli_validate_fcp_iocb: Filtering function, used to find commands 4672 * lpfc_sli_validate_fcp_iocb - find commands associated with a vport or LUN
4662 * associated with a vport/SCSI target/lun.
4663 * @iocbq: Pointer to driver iocb object. 4673 * @iocbq: Pointer to driver iocb object.
4664 * @vport: Pointer to driver virtual port object. 4674 * @vport: Pointer to driver virtual port object.
4665 * @tgt_id: SCSI ID of the target. 4675 * @tgt_id: SCSI ID of the target.
4666 * @lun_id: LUN ID of the scsi device. 4676 * @lun_id: LUN ID of the scsi device.
4667 * @ctx_cmd: LPFC_CTX_LUN/LPFC_CTX_TGT/LPFC_CTX_HOST 4677 * @ctx_cmd: LPFC_CTX_LUN/LPFC_CTX_TGT/LPFC_CTX_HOST
4668 * 4678 *
4669 * This function acts as iocb filter for functions which abort or count 4679 * This function acts as an iocb filter for functions which abort or count
4670 * all FCP iocbs pending on a lun/SCSI target/SCSI host. It will return 4680 * all FCP iocbs pending on a lun/SCSI target/SCSI host. It will return
4671 * 0 if the filtering criteria is met for the given iocb and will return 4681 * 0 if the filtering criteria is met for the given iocb and will return
4672 * 1 if the filtering criteria is not met. 4682 * 1 if the filtering criteria is not met.
@@ -4724,7 +4734,7 @@ lpfc_sli_validate_fcp_iocb(struct lpfc_iocbq *iocbq, struct lpfc_vport *vport,
4724} 4734}
4725 4735
4726/** 4736/**
4727 * lpfc_sli_sum_iocb: Function to count the number of FCP iocbs pending. 4737 * lpfc_sli_sum_iocb - Function to count the number of FCP iocbs pending
4728 * @vport: Pointer to virtual port. 4738 * @vport: Pointer to virtual port.
4729 * @tgt_id: SCSI ID of the target. 4739 * @tgt_id: SCSI ID of the target.
4730 * @lun_id: LUN ID of the scsi device. 4740 * @lun_id: LUN ID of the scsi device.
@@ -4762,8 +4772,7 @@ lpfc_sli_sum_iocb(struct lpfc_vport *vport, uint16_t tgt_id, uint64_t lun_id,
4762} 4772}
4763 4773
4764/** 4774/**
4765 * lpfc_sli_abort_fcp_cmpl: Completion handler function for an aborted 4775 * lpfc_sli_abort_fcp_cmpl - Completion handler function for aborted FCP IOCBs
4766 * FCP iocb.
4767 * @phba: Pointer to HBA context object 4776 * @phba: Pointer to HBA context object
4768 * @cmdiocb: Pointer to command iocb object. 4777 * @cmdiocb: Pointer to command iocb object.
4769 * @rspiocb: Pointer to response iocb object. 4778 * @rspiocb: Pointer to response iocb object.
@@ -4781,8 +4790,7 @@ lpfc_sli_abort_fcp_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
4781} 4790}
4782 4791
4783/** 4792/**
4784 * lpfc_sli_abort_iocb: This function issue abort for all SCSI commands 4793 * lpfc_sli_abort_iocb - issue abort for all commands on a host/target/LUN
4785 * pending on a SCSI host(vport)/target/lun.
4786 * @vport: Pointer to virtual port. 4794 * @vport: Pointer to virtual port.
4787 * @pring: Pointer to driver SLI ring object. 4795 * @pring: Pointer to driver SLI ring object.
4788 * @tgt_id: SCSI ID of the target. 4796 * @tgt_id: SCSI ID of the target.
@@ -4854,8 +4862,7 @@ lpfc_sli_abort_iocb(struct lpfc_vport *vport, struct lpfc_sli_ring *pring,
4854} 4862}
4855 4863
4856/** 4864/**
4857 * lpfc_sli_wake_iocb_wait: iocb completion handler for iocb issued using 4865 * lpfc_sli_wake_iocb_wait - lpfc_sli_issue_iocb_wait's completion handler
4858 * lpfc_sli_issue_iocb_wait.
4859 * @phba: Pointer to HBA context object. 4866 * @phba: Pointer to HBA context object.
4860 * @cmdiocbq: Pointer to command iocb. 4867 * @cmdiocbq: Pointer to command iocb.
4861 * @rspiocbq: Pointer to response iocb. 4868 * @rspiocbq: Pointer to response iocb.
@@ -4893,7 +4900,7 @@ lpfc_sli_wake_iocb_wait(struct lpfc_hba *phba,
4893} 4900}
4894 4901
4895/** 4902/**
4896 * lpfc_sli_issue_iocb_wait: Synchronous function to issue iocb commands. 4903 * lpfc_sli_issue_iocb_wait - Synchronous function to issue iocb commands
4897 * @phba: Pointer to HBA context object.. 4904 * @phba: Pointer to HBA context object..
4898 * @pring: Pointer to sli ring. 4905 * @pring: Pointer to sli ring.
4899 * @piocb: Pointer to command iocb. 4906 * @piocb: Pointer to command iocb.
@@ -5000,7 +5007,7 @@ lpfc_sli_issue_iocb_wait(struct lpfc_hba *phba,
5000} 5007}
5001 5008
5002/** 5009/**
5003 * lpfc_sli_issue_mbox_wait: Synchronous function to issue mailbox. 5010 * lpfc_sli_issue_mbox_wait - Synchronous function to issue mailbox
5004 * @phba: Pointer to HBA context object. 5011 * @phba: Pointer to HBA context object.
5005 * @pmboxq: Pointer to driver mailbox object. 5012 * @pmboxq: Pointer to driver mailbox object.
5006 * @timeout: Timeout in number of seconds. 5013 * @timeout: Timeout in number of seconds.
@@ -5070,7 +5077,7 @@ lpfc_sli_issue_mbox_wait(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq,
5070} 5077}
5071 5078
5072/** 5079/**
5073 * lpfc_sli_flush_mbox_queue: mailbox queue cleanup function. 5080 * lpfc_sli_flush_mbox_queue - mailbox queue cleanup function
5074 * @phba: Pointer to HBA context. 5081 * @phba: Pointer to HBA context.
5075 * 5082 *
5076 * This function is called to cleanup any pending mailbox 5083 * This function is called to cleanup any pending mailbox
@@ -5113,7 +5120,7 @@ lpfc_sli_flush_mbox_queue(struct lpfc_hba * phba)
5113} 5120}
5114 5121
5115/** 5122/**
5116 * lpfc_sli_check_eratt: check error attention events 5123 * lpfc_sli_check_eratt - check error attention events
5117 * @phba: Pointer to HBA context. 5124 * @phba: Pointer to HBA context.
5118 * 5125 *
5119 * This function is called form timer soft interrupt context to check HBA's 5126 * This function is called form timer soft interrupt context to check HBA's
@@ -5145,11 +5152,31 @@ lpfc_sli_check_eratt(struct lpfc_hba *phba)
5145 return 0; 5152 return 0;
5146 } 5153 }
5147 5154
5155 /*
5156 * If there is deferred error attention, do not check for error
5157 * attention
5158 */
5159 if (unlikely(phba->hba_flag & DEFER_ERATT)) {
5160 spin_unlock_irq(&phba->hbalock);
5161 return 0;
5162 }
5163
5148 /* Read chip Host Attention (HA) register */ 5164 /* Read chip Host Attention (HA) register */
5149 ha_copy = readl(phba->HAregaddr); 5165 ha_copy = readl(phba->HAregaddr);
5150 if (ha_copy & HA_ERATT) { 5166 if (ha_copy & HA_ERATT) {
5151 /* Read host status register to retrieve error event */ 5167 /* Read host status register to retrieve error event */
5152 lpfc_sli_read_hs(phba); 5168 lpfc_sli_read_hs(phba);
5169
5170 /* Check if there is a deferred error condition is active */
5171 if ((HS_FFER1 & phba->work_hs) &&
5172 ((HS_FFER2 | HS_FFER3 | HS_FFER4 | HS_FFER5 |
5173 HS_FFER6 | HS_FFER7) & phba->work_hs)) {
5174 phba->hba_flag |= DEFER_ERATT;
5175 /* Clear all interrupt enable conditions */
5176 writel(0, phba->HCregaddr);
5177 readl(phba->HCregaddr);
5178 }
5179
5153 /* Set the driver HA work bitmap */ 5180 /* Set the driver HA work bitmap */
5154 phba->work_ha |= HA_ERATT; 5181 phba->work_ha |= HA_ERATT;
5155 /* Indicate polling handles this ERATT */ 5182 /* Indicate polling handles this ERATT */
@@ -5162,7 +5189,7 @@ lpfc_sli_check_eratt(struct lpfc_hba *phba)
5162} 5189}
5163 5190
5164/** 5191/**
5165 * lpfc_sp_intr_handler: The slow-path interrupt handler of lpfc driver. 5192 * lpfc_sp_intr_handler - The slow-path interrupt handler of lpfc driver
5166 * @irq: Interrupt number. 5193 * @irq: Interrupt number.
5167 * @dev_id: The device context pointer. 5194 * @dev_id: The device context pointer.
5168 * 5195 *
@@ -5238,6 +5265,16 @@ lpfc_sp_intr_handler(int irq, void *dev_id)
5238 /* Indicate interrupt handler handles ERATT */ 5265 /* Indicate interrupt handler handles ERATT */
5239 phba->hba_flag |= HBA_ERATT_HANDLED; 5266 phba->hba_flag |= HBA_ERATT_HANDLED;
5240 } 5267 }
5268
5269 /*
5270 * If there is deferred error attention, do not check for any
5271 * interrupt.
5272 */
5273 if (unlikely(phba->hba_flag & DEFER_ERATT)) {
5274 spin_unlock_irq(&phba->hbalock);
5275 return IRQ_NONE;
5276 }
5277
5241 /* Clear up only attention source related to slow-path */ 5278 /* Clear up only attention source related to slow-path */
5242 writel((ha_copy & (HA_MBATT | HA_R2_CLR_MSK)), 5279 writel((ha_copy & (HA_MBATT | HA_R2_CLR_MSK)),
5243 phba->HAregaddr); 5280 phba->HAregaddr);
@@ -5309,8 +5346,22 @@ lpfc_sp_intr_handler(int irq, void *dev_id)
5309 } 5346 }
5310 } 5347 }
5311 spin_lock_irqsave(&phba->hbalock, iflag); 5348 spin_lock_irqsave(&phba->hbalock, iflag);
5312 if (work_ha_copy & HA_ERATT) 5349 if (work_ha_copy & HA_ERATT) {
5313 lpfc_sli_read_hs(phba); 5350 lpfc_sli_read_hs(phba);
5351 /*
5352 * Check if there is a deferred error condition
5353 * is active
5354 */
5355 if ((HS_FFER1 & phba->work_hs) &&
5356 ((HS_FFER2 | HS_FFER3 | HS_FFER4 | HS_FFER5 |
5357 HS_FFER6 | HS_FFER7) & phba->work_hs)) {
5358 phba->hba_flag |= DEFER_ERATT;
5359 /* Clear all interrupt enable conditions */
5360 writel(0, phba->HCregaddr);
5361 readl(phba->HCregaddr);
5362 }
5363 }
5364
5314 if ((work_ha_copy & HA_MBATT) && (phba->sli.mbox_active)) { 5365 if ((work_ha_copy & HA_MBATT) && (phba->sli.mbox_active)) {
5315 pmb = phba->sli.mbox_active; 5366 pmb = phba->sli.mbox_active;
5316 pmbox = &pmb->mb; 5367 pmbox = &pmb->mb;
@@ -5423,7 +5474,7 @@ send_current_mbox:
5423} /* lpfc_sp_intr_handler */ 5474} /* lpfc_sp_intr_handler */
5424 5475
5425/** 5476/**
5426 * lpfc_fp_intr_handler: The fast-path interrupt handler of lpfc driver. 5477 * lpfc_fp_intr_handler - The fast-path interrupt handler of lpfc driver
5427 * @irq: Interrupt number. 5478 * @irq: Interrupt number.
5428 * @dev_id: The device context pointer. 5479 * @dev_id: The device context pointer.
5429 * 5480 *
@@ -5474,6 +5525,14 @@ lpfc_fp_intr_handler(int irq, void *dev_id)
5474 ha_copy = readl(phba->HAregaddr); 5525 ha_copy = readl(phba->HAregaddr);
5475 /* Clear up only attention source related to fast-path */ 5526 /* Clear up only attention source related to fast-path */
5476 spin_lock_irqsave(&phba->hbalock, iflag); 5527 spin_lock_irqsave(&phba->hbalock, iflag);
5528 /*
5529 * If there is deferred error attention, do not check for
5530 * any interrupt.
5531 */
5532 if (unlikely(phba->hba_flag & DEFER_ERATT)) {
5533 spin_unlock_irq(&phba->hbalock);
5534 return IRQ_NONE;
5535 }
5477 writel((ha_copy & (HA_R0_CLR_MSK | HA_R1_CLR_MSK)), 5536 writel((ha_copy & (HA_R0_CLR_MSK | HA_R1_CLR_MSK)),
5478 phba->HAregaddr); 5537 phba->HAregaddr);
5479 readl(phba->HAregaddr); /* flush */ 5538 readl(phba->HAregaddr); /* flush */
@@ -5510,7 +5569,7 @@ lpfc_fp_intr_handler(int irq, void *dev_id)
5510} /* lpfc_fp_intr_handler */ 5569} /* lpfc_fp_intr_handler */
5511 5570
5512/** 5571/**
5513 * lpfc_intr_handler: The device-level interrupt handler of lpfc driver. 5572 * lpfc_intr_handler - The device-level interrupt handler of lpfc driver
5514 * @irq: Interrupt number. 5573 * @irq: Interrupt number.
5515 * @dev_id: The device context pointer. 5574 * @dev_id: The device context pointer.
5516 * 5575 *
@@ -5566,6 +5625,14 @@ lpfc_intr_handler(int irq, void *dev_id)
5566 phba->hba_flag |= HBA_ERATT_HANDLED; 5625 phba->hba_flag |= HBA_ERATT_HANDLED;
5567 } 5626 }
5568 5627
5628 /*
5629 * If there is deferred error attention, do not check for any interrupt.
5630 */
5631 if (unlikely(phba->hba_flag & DEFER_ERATT)) {
5632 spin_unlock_irq(&phba->hbalock);
5633 return IRQ_NONE;
5634 }
5635
5569 /* Clear attention sources except link and error attentions */ 5636 /* Clear attention sources except link and error attentions */
5570 writel((phba->ha_copy & ~(HA_LATT | HA_ERATT)), phba->HAregaddr); 5637 writel((phba->ha_copy & ~(HA_LATT | HA_ERATT)), phba->HAregaddr);
5571 readl(phba->HAregaddr); /* flush */ 5638 readl(phba->HAregaddr); /* flush */
diff --git a/drivers/scsi/lpfc/lpfc_version.h b/drivers/scsi/lpfc/lpfc_version.h
index 7e32e95c539..e599519e307 100644
--- a/drivers/scsi/lpfc/lpfc_version.h
+++ b/drivers/scsi/lpfc/lpfc_version.h
@@ -1,7 +1,7 @@
1/******************************************************************* 1/*******************************************************************
2 * This file is part of the Emulex Linux Device Driver for * 2 * This file is part of the Emulex Linux Device Driver for *
3 * Fibre Channel Host Bus Adapters. * 3 * Fibre Channel Host Bus Adapters. *
4 * Copyright (C) 2004-2008 Emulex. All rights reserved. * 4 * Copyright (C) 2004-2009 Emulex. All rights reserved. *
5 * EMULEX and SLI are trademarks of Emulex. * 5 * EMULEX and SLI are trademarks of Emulex. *
6 * www.emulex.com * 6 * www.emulex.com *
7 * * 7 * *
@@ -18,7 +18,7 @@
18 * included with this package. * 18 * included with this package. *
19 *******************************************************************/ 19 *******************************************************************/
20 20
21#define LPFC_DRIVER_VERSION "8.3.0" 21#define LPFC_DRIVER_VERSION "8.3.1"
22 22
23#define LPFC_DRIVER_NAME "lpfc" 23#define LPFC_DRIVER_NAME "lpfc"
24#define LPFC_SP_DRIVER_HANDLER_NAME "lpfc:sp" 24#define LPFC_SP_DRIVER_HANDLER_NAME "lpfc:sp"
@@ -26,4 +26,4 @@
26 26
27#define LPFC_MODULE_DESC "Emulex LightPulse Fibre Channel SCSI driver " \ 27#define LPFC_MODULE_DESC "Emulex LightPulse Fibre Channel SCSI driver " \
28 LPFC_DRIVER_VERSION 28 LPFC_DRIVER_VERSION
29#define LPFC_COPYRIGHT "Copyright(c) 2004-2008 Emulex. All rights reserved." 29#define LPFC_COPYRIGHT "Copyright(c) 2004-2009 Emulex. All rights reserved."
diff --git a/drivers/scsi/lpfc/lpfc_vport.c b/drivers/scsi/lpfc/lpfc_vport.c
index 63b54c66756..917ad56b0af 100644
--- a/drivers/scsi/lpfc/lpfc_vport.c
+++ b/drivers/scsi/lpfc/lpfc_vport.c
@@ -206,7 +206,7 @@ lpfc_unique_wwpn(struct lpfc_hba *phba, struct lpfc_vport *new_vport)
206} 206}
207 207
208/** 208/**
209 * lpfc_discovery_wait: Wait for driver discovery to quiesce. 209 * lpfc_discovery_wait - Wait for driver discovery to quiesce
210 * @vport: The virtual port for which this call is being executed. 210 * @vport: The virtual port for which this call is being executed.
211 * 211 *
212 * This driver calls this routine specifically from lpfc_vport_delete 212 * This driver calls this routine specifically from lpfc_vport_delete
@@ -741,7 +741,7 @@ lpfc_destroy_vport_work_array(struct lpfc_hba *phba, struct lpfc_vport **vports)
741 741
742 742
743/** 743/**
744 * lpfc_vport_reset_stat_data: Reset the statistical data for the vport. 744 * lpfc_vport_reset_stat_data - Reset the statistical data for the vport
745 * @vport: Pointer to vport object. 745 * @vport: Pointer to vport object.
746 * 746 *
747 * This function resets the statistical data for the vport. This function 747 * This function resets the statistical data for the vport. This function
@@ -763,8 +763,7 @@ lpfc_vport_reset_stat_data(struct lpfc_vport *vport)
763 763
764 764
765/** 765/**
766 * lpfc_alloc_bucket: Allocate data buffer required for collecting 766 * lpfc_alloc_bucket - Allocate data buffer required for statistical data
767 * statistical data.
768 * @vport: Pointer to vport object. 767 * @vport: Pointer to vport object.
769 * 768 *
770 * This function allocates data buffer required for all the FC 769 * This function allocates data buffer required for all the FC
@@ -797,8 +796,7 @@ lpfc_alloc_bucket(struct lpfc_vport *vport)
797} 796}
798 797
799/** 798/**
800 * lpfc_free_bucket: Free data buffer required for collecting 799 * lpfc_free_bucket - Free data buffer required for statistical data
801 * statistical data.
802 * @vport: Pointer to vport object. 800 * @vport: Pointer to vport object.
803 * 801 *
804 * Th function frees statistical data buffer of all the FC 802 * Th function frees statistical data buffer of all the FC
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c
index a91f5143cea..f3da592f7bc 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
@@ -636,6 +636,14 @@ _base_unmask_interrupts(struct MPT2SAS_ADAPTER *ioc)
636static irqreturn_t 636static irqreturn_t
637_base_interrupt(int irq, void *bus_id) 637_base_interrupt(int irq, void *bus_id)
638{ 638{
639 union reply_descriptor {
640 u64 word;
641 struct {
642 u32 low;
643 u32 high;
644 } u;
645 };
646 union reply_descriptor rd;
639 u32 post_index, post_index_next, completed_cmds; 647 u32 post_index, post_index_next, completed_cmds;
640 u8 request_desript_type; 648 u8 request_desript_type;
641 u16 smid; 649 u16 smid;
@@ -656,7 +664,8 @@ _base_interrupt(int irq, void *bus_id)
656 664
657 completed_cmds = 0; 665 completed_cmds = 0;
658 do { 666 do {
659 if (ioc->reply_post_free[post_index].Words == ~0ULL) 667 rd.word = ioc->reply_post_free[post_index].Words;
668 if (rd.u.low == UINT_MAX || rd.u.high == UINT_MAX)
660 goto out; 669 goto out;
661 reply = 0; 670 reply = 0;
662 cb_idx = 0xFF; 671 cb_idx = 0xFF;
@@ -721,7 +730,7 @@ _base_interrupt(int irq, void *bus_id)
721 for (i = 0 ; i < completed_cmds; i++) { 730 for (i = 0 ; i < completed_cmds; i++) {
722 post_index = post_index_next; 731 post_index = post_index_next;
723 /* poison the reply post descriptor */ 732 /* poison the reply post descriptor */
724 ioc->reply_post_free[post_index_next].Words = ~0ULL; 733 ioc->reply_post_free[post_index_next].Words = ULLONG_MAX;
725 post_index_next = (post_index == 734 post_index_next = (post_index ==
726 (ioc->reply_post_queue_depth - 1)) 735 (ioc->reply_post_queue_depth - 1))
727 ? 0 : post_index + 1; 736 ? 0 : post_index + 1;
@@ -1387,6 +1396,64 @@ mpt2sas_base_put_smid_target_assist(struct MPT2SAS_ADAPTER *ioc, u16 smid,
1387} 1396}
1388 1397
1389/** 1398/**
1399 * _base_display_dell_branding - Disply branding string
1400 * @ioc: per adapter object
1401 *
1402 * Return nothing.
1403 */
1404static void
1405_base_display_dell_branding(struct MPT2SAS_ADAPTER *ioc)
1406{
1407 char dell_branding[MPT2SAS_DELL_BRANDING_SIZE];
1408
1409 if (ioc->pdev->subsystem_vendor != PCI_VENDOR_ID_DELL)
1410 return;
1411
1412 memset(dell_branding, 0, MPT2SAS_DELL_BRANDING_SIZE);
1413 switch (ioc->pdev->subsystem_device) {
1414 case MPT2SAS_DELL_6GBPS_SAS_HBA_SSDID:
1415 strncpy(dell_branding, MPT2SAS_DELL_6GBPS_SAS_HBA_BRANDING,
1416 MPT2SAS_DELL_BRANDING_SIZE - 1);
1417 break;
1418 case MPT2SAS_DELL_PERC_H200_ADAPTER_SSDID:
1419 strncpy(dell_branding, MPT2SAS_DELL_PERC_H200_ADAPTER_BRANDING,
1420 MPT2SAS_DELL_BRANDING_SIZE - 1);
1421 break;
1422 case MPT2SAS_DELL_PERC_H200_INTEGRATED_SSDID:
1423 strncpy(dell_branding,
1424 MPT2SAS_DELL_PERC_H200_INTEGRATED_BRANDING,
1425 MPT2SAS_DELL_BRANDING_SIZE - 1);
1426 break;
1427 case MPT2SAS_DELL_PERC_H200_MODULAR_SSDID:
1428 strncpy(dell_branding,
1429 MPT2SAS_DELL_PERC_H200_MODULAR_BRANDING,
1430 MPT2SAS_DELL_BRANDING_SIZE - 1);
1431 break;
1432 case MPT2SAS_DELL_PERC_H200_EMBEDDED_SSDID:
1433 strncpy(dell_branding,
1434 MPT2SAS_DELL_PERC_H200_EMBEDDED_BRANDING,
1435 MPT2SAS_DELL_BRANDING_SIZE - 1);
1436 break;
1437 case MPT2SAS_DELL_PERC_H200_SSDID:
1438 strncpy(dell_branding, MPT2SAS_DELL_PERC_H200_BRANDING,
1439 MPT2SAS_DELL_BRANDING_SIZE - 1);
1440 break;
1441 case MPT2SAS_DELL_6GBPS_SAS_SSDID:
1442 strncpy(dell_branding, MPT2SAS_DELL_6GBPS_SAS_BRANDING,
1443 MPT2SAS_DELL_BRANDING_SIZE - 1);
1444 break;
1445 default:
1446 sprintf(dell_branding, "0x%4X", ioc->pdev->subsystem_device);
1447 break;
1448 }
1449
1450 printk(MPT2SAS_INFO_FMT "%s: Vendor(0x%04X), Device(0x%04X),"
1451 " SSVID(0x%04X), SSDID(0x%04X)\n", ioc->name, dell_branding,
1452 ioc->pdev->vendor, ioc->pdev->device, ioc->pdev->subsystem_vendor,
1453 ioc->pdev->subsystem_device);
1454}
1455
1456/**
1390 * _base_display_ioc_capabilities - Disply IOC's capabilities. 1457 * _base_display_ioc_capabilities - Disply IOC's capabilities.
1391 * @ioc: per adapter object 1458 * @ioc: per adapter object
1392 * 1459 *
@@ -1427,6 +1494,8 @@ _base_display_ioc_capabilities(struct MPT2SAS_ADAPTER *ioc)
1427 i++; 1494 i++;
1428 } 1495 }
1429 1496
1497 _base_display_dell_branding(ioc);
1498
1430 i = 0; 1499 i = 0;
1431 printk("), "); 1500 printk("), ");
1432 printk("Capabilities=("); 1501 printk("Capabilities=(");
@@ -3068,7 +3137,7 @@ _base_make_ioc_operational(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID,
3068 3137
3069 /* initialize Reply Post Free Queue */ 3138 /* initialize Reply Post Free Queue */
3070 for (i = 0; i < ioc->reply_post_queue_depth; i++) 3139 for (i = 0; i < ioc->reply_post_queue_depth; i++)
3071 ioc->reply_post_free[i].Words = ~0ULL; 3140 ioc->reply_post_free[i].Words = ULLONG_MAX;
3072 3141
3073 r = _base_send_ioc_init(ioc, VF_ID, sleep_flag); 3142 r = _base_send_ioc_init(ioc, VF_ID, sleep_flag);
3074 if (r) 3143 if (r)
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.h b/drivers/scsi/mpt2sas/mpt2sas_base.h
index 6945ff4d382..babd4cc0cb2 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.h
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.h
@@ -68,11 +68,11 @@
68#define MPT2SAS_DRIVER_NAME "mpt2sas" 68#define MPT2SAS_DRIVER_NAME "mpt2sas"
69#define MPT2SAS_AUTHOR "LSI Corporation <DL-MPTFusionLinux@lsi.com>" 69#define MPT2SAS_AUTHOR "LSI Corporation <DL-MPTFusionLinux@lsi.com>"
70#define MPT2SAS_DESCRIPTION "LSI MPT Fusion SAS 2.0 Device Driver" 70#define MPT2SAS_DESCRIPTION "LSI MPT Fusion SAS 2.0 Device Driver"
71#define MPT2SAS_DRIVER_VERSION "00.100.11.16" 71#define MPT2SAS_DRIVER_VERSION "01.100.02.00"
72#define MPT2SAS_MAJOR_VERSION 00 72#define MPT2SAS_MAJOR_VERSION 00
73#define MPT2SAS_MINOR_VERSION 100 73#define MPT2SAS_MINOR_VERSION 100
74#define MPT2SAS_BUILD_VERSION 11 74#define MPT2SAS_BUILD_VERSION 02
75#define MPT2SAS_RELEASE_VERSION 16 75#define MPT2SAS_RELEASE_VERSION 00
76 76
77/* 77/*
78 * Set MPT2SAS_SG_DEPTH value based on user input. 78 * Set MPT2SAS_SG_DEPTH value based on user input.
@@ -130,6 +130,30 @@
130#define MPT2SAS_ERR_FMT KERN_ERR MPT2SAS_FMT 130#define MPT2SAS_ERR_FMT KERN_ERR MPT2SAS_FMT
131 131
132/* 132/*
133 * Dell HBA branding
134 */
135#define MPT2SAS_DELL_BRANDING_SIZE 32
136
137#define MPT2SAS_DELL_6GBPS_SAS_HBA_BRANDING "Dell 6Gbps SAS HBA"
138#define MPT2SAS_DELL_PERC_H200_ADAPTER_BRANDING "Dell PERC H200 Adapter"
139#define MPT2SAS_DELL_PERC_H200_INTEGRATED_BRANDING "Dell PERC H200 Integrated"
140#define MPT2SAS_DELL_PERC_H200_MODULAR_BRANDING "Dell PERC H200 Modular"
141#define MPT2SAS_DELL_PERC_H200_EMBEDDED_BRANDING "Dell PERC H200 Embedded"
142#define MPT2SAS_DELL_PERC_H200_BRANDING "Dell PERC H200"
143#define MPT2SAS_DELL_6GBPS_SAS_BRANDING "Dell 6Gbps SAS"
144
145/*
146 * Dell HBA SSDIDs
147 */
148#define MPT2SAS_DELL_6GBPS_SAS_HBA_SSDID 0x1F1C
149#define MPT2SAS_DELL_PERC_H200_ADAPTER_SSDID 0x1F1D
150#define MPT2SAS_DELL_PERC_H200_INTEGRATED_SSDID 0x1F1E
151#define MPT2SAS_DELL_PERC_H200_MODULAR_SSDID 0x1F1F
152#define MPT2SAS_DELL_PERC_H200_EMBEDDED_SSDID 0x1F20
153#define MPT2SAS_DELL_PERC_H200_SSDID 0x1F21
154#define MPT2SAS_DELL_6GBPS_SAS_SSDID 0x1F22
155
156/*
133 * per target private data 157 * per target private data
134 */ 158 */
135#define MPT_TARGET_FLAGS_RAID_COMPONENT 0x01 159#define MPT_TARGET_FLAGS_RAID_COMPONENT 0x01
diff --git a/drivers/scsi/mpt2sas/mpt2sas_ctl.c b/drivers/scsi/mpt2sas/mpt2sas_ctl.c
index 2d4f85c9d7a..ba6ab170bdf 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_ctl.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_ctl.c
@@ -64,6 +64,9 @@
64static struct fasync_struct *async_queue; 64static struct fasync_struct *async_queue;
65static DECLARE_WAIT_QUEUE_HEAD(ctl_poll_wait); 65static DECLARE_WAIT_QUEUE_HEAD(ctl_poll_wait);
66 66
67static int _ctl_send_release(struct MPT2SAS_ADAPTER *ioc, u8 buffer_type,
68 u8 *issue_reset);
69
67/** 70/**
68 * enum block_state - blocking state 71 * enum block_state - blocking state
69 * @NON_BLOCKING: non blocking 72 * @NON_BLOCKING: non blocking
@@ -378,10 +381,22 @@ _ctl_verify_adapter(int ioc_number, struct MPT2SAS_ADAPTER **iocpp)
378void 381void
379mpt2sas_ctl_reset_handler(struct MPT2SAS_ADAPTER *ioc, int reset_phase) 382mpt2sas_ctl_reset_handler(struct MPT2SAS_ADAPTER *ioc, int reset_phase)
380{ 383{
384 int i;
385 u8 issue_reset;
386
381 switch (reset_phase) { 387 switch (reset_phase) {
382 case MPT2_IOC_PRE_RESET: 388 case MPT2_IOC_PRE_RESET:
383 dtmprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s: " 389 dtmprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s: "
384 "MPT2_IOC_PRE_RESET\n", ioc->name, __func__)); 390 "MPT2_IOC_PRE_RESET\n", ioc->name, __func__));
391 for (i = 0; i < MPI2_DIAG_BUF_TYPE_COUNT; i++) {
392 if (!(ioc->diag_buffer_status[i] &
393 MPT2_DIAG_BUFFER_IS_REGISTERED))
394 continue;
395 if ((ioc->diag_buffer_status[i] &
396 MPT2_DIAG_BUFFER_IS_RELEASED))
397 continue;
398 _ctl_send_release(ioc, i, &issue_reset);
399 }
385 break; 400 break;
386 case MPT2_IOC_AFTER_RESET: 401 case MPT2_IOC_AFTER_RESET:
387 dtmprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s: " 402 dtmprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s: "
@@ -395,6 +410,17 @@ mpt2sas_ctl_reset_handler(struct MPT2SAS_ADAPTER *ioc, int reset_phase)
395 case MPT2_IOC_DONE_RESET: 410 case MPT2_IOC_DONE_RESET:
396 dtmprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s: " 411 dtmprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s: "
397 "MPT2_IOC_DONE_RESET\n", ioc->name, __func__)); 412 "MPT2_IOC_DONE_RESET\n", ioc->name, __func__));
413
414 for (i = 0; i < MPI2_DIAG_BUF_TYPE_COUNT; i++) {
415 if (!(ioc->diag_buffer_status[i] &
416 MPT2_DIAG_BUFFER_IS_REGISTERED))
417 continue;
418 if ((ioc->diag_buffer_status[i] &
419 MPT2_DIAG_BUFFER_IS_RELEASED))
420 continue;
421 ioc->diag_buffer_status[i] |=
422 MPT2_DIAG_BUFFER_IS_DIAG_RESET;
423 }
398 break; 424 break;
399 } 425 }
400} 426}
@@ -714,8 +740,10 @@ _ctl_do_mpt_command(struct MPT2SAS_ADAPTER *ioc,
714 740
715 if (tm_request->TaskType == 741 if (tm_request->TaskType ==
716 MPI2_SCSITASKMGMT_TASKTYPE_ABORT_TASK) { 742 MPI2_SCSITASKMGMT_TASKTYPE_ABORT_TASK) {
717 if (_ctl_do_task_abort(ioc, &karg, tm_request)) 743 if (_ctl_do_task_abort(ioc, &karg, tm_request)) {
744 mpt2sas_base_free_smid(ioc, smid);
718 goto out; 745 goto out;
746 }
719 } 747 }
720 748
721 mutex_lock(&ioc->tm_cmds.mutex); 749 mutex_lock(&ioc->tm_cmds.mutex);
@@ -915,9 +943,9 @@ _ctl_getiocinfo(void __user *arg)
915 karg.pci_information.u.bits.function = PCI_FUNC(ioc->pdev->devfn); 943 karg.pci_information.u.bits.function = PCI_FUNC(ioc->pdev->devfn);
916 karg.pci_information.segment_id = pci_domain_nr(ioc->pdev->bus); 944 karg.pci_information.segment_id = pci_domain_nr(ioc->pdev->bus);
917 karg.firmware_version = ioc->facts.FWVersion.Word; 945 karg.firmware_version = ioc->facts.FWVersion.Word;
918 strncpy(karg.driver_version, MPT2SAS_DRIVER_VERSION, 946 strcpy(karg.driver_version, MPT2SAS_DRIVER_NAME);
919 MPT2_IOCTL_VERSION_LENGTH); 947 strcat(karg.driver_version, "-");
920 karg.driver_version[MPT2_IOCTL_VERSION_LENGTH - 1] = '\0'; 948 strcat(karg.driver_version, MPT2SAS_DRIVER_VERSION);
921 karg.bios_version = le32_to_cpu(ioc->bios_pg3.BiosVersion); 949 karg.bios_version = le32_to_cpu(ioc->bios_pg3.BiosVersion);
922 950
923 if (copy_to_user(arg, &karg, sizeof(karg))) { 951 if (copy_to_user(arg, &karg, sizeof(karg))) {
@@ -1551,81 +1579,38 @@ _ctl_diag_query(void __user *arg)
1551} 1579}
1552 1580
1553/** 1581/**
1554 * _ctl_diag_release - request to send Diag Release Message to firmware 1582 * _ctl_send_release - Diag Release Message
1555 * @arg - user space buffer containing ioctl content 1583 * @ioc: per adapter object
1556 * @state - NON_BLOCKING or BLOCKING 1584 * @buffer_type - specifies either TRACE or SNAPSHOT
1585 * @issue_reset - specifies whether host reset is required.
1557 * 1586 *
1558 * This allows ownership of the specified buffer to returned to the driver,
1559 * allowing an application to read the buffer without fear that firmware is
1560 * overwritting information in the buffer.
1561 */ 1587 */
1562static long 1588static int
1563_ctl_diag_release(void __user *arg, enum block_state state) 1589_ctl_send_release(struct MPT2SAS_ADAPTER *ioc, u8 buffer_type, u8 *issue_reset)
1564{ 1590{
1565 struct mpt2_diag_release karg;
1566 struct MPT2SAS_ADAPTER *ioc;
1567 void *request_data;
1568 int rc;
1569 Mpi2DiagReleaseRequest_t *mpi_request; 1591 Mpi2DiagReleaseRequest_t *mpi_request;
1570 Mpi2DiagReleaseReply_t *mpi_reply; 1592 Mpi2DiagReleaseReply_t *mpi_reply;
1571 u8 buffer_type;
1572 unsigned long timeleft;
1573 u16 smid; 1593 u16 smid;
1574 u16 ioc_status; 1594 u16 ioc_status;
1575 u8 issue_reset = 0; 1595 u32 ioc_state;
1576 1596 int rc;
1577 if (copy_from_user(&karg, arg, sizeof(karg))) { 1597 unsigned long timeleft;
1578 printk(KERN_ERR "failure at %s:%d/%s()!\n",
1579 __FILE__, __LINE__, __func__);
1580 return -EFAULT;
1581 }
1582 if (_ctl_verify_adapter(karg.hdr.ioc_number, &ioc) == -1 || !ioc)
1583 return -ENODEV;
1584 1598
1585 dctlprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s\n", ioc->name, 1599 dctlprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s\n", ioc->name,
1586 __func__)); 1600 __func__));
1587 1601
1588 buffer_type = karg.unique_id & 0x000000ff; 1602 rc = 0;
1589 if (!_ctl_diag_capability(ioc, buffer_type)) { 1603 *issue_reset = 0;
1590 printk(MPT2SAS_ERR_FMT "%s: doesn't have capability for "
1591 "buffer_type(0x%02x)\n", ioc->name, __func__, buffer_type);
1592 return -EPERM;
1593 }
1594
1595 if ((ioc->diag_buffer_status[buffer_type] &
1596 MPT2_DIAG_BUFFER_IS_REGISTERED) == 0) {
1597 printk(MPT2SAS_ERR_FMT "%s: buffer_type(0x%02x) is not "
1598 "registered\n", ioc->name, __func__, buffer_type);
1599 return -EINVAL;
1600 }
1601
1602 if (karg.unique_id != ioc->unique_id[buffer_type]) {
1603 printk(MPT2SAS_ERR_FMT "%s: unique_id(0x%08x) is not "
1604 "registered\n", ioc->name, __func__, karg.unique_id);
1605 return -EINVAL;
1606 }
1607
1608 if (ioc->diag_buffer_status[buffer_type] &
1609 MPT2_DIAG_BUFFER_IS_RELEASED) {
1610 printk(MPT2SAS_ERR_FMT "%s: buffer_type(0x%02x) "
1611 "is already released\n", ioc->name, __func__,
1612 buffer_type);
1613 return 0;
1614 }
1615
1616 request_data = ioc->diag_buffer[buffer_type];
1617 1604
1618 if (!request_data) { 1605 ioc_state = mpt2sas_base_get_iocstate(ioc, 1);
1619 printk(MPT2SAS_ERR_FMT "%s: doesn't have memory allocated for " 1606 if (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
1620 "buffer_type(0x%02x)\n", ioc->name, __func__, buffer_type); 1607 dctlprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s: "
1621 return -ENOMEM; 1608 "skipping due to FAULT state\n", ioc->name,
1609 __func__));
1610 rc = -EAGAIN;
1611 goto out;
1622 } 1612 }
1623 1613
1624 if (state == NON_BLOCKING && !mutex_trylock(&ioc->ctl_cmds.mutex))
1625 return -EAGAIN;
1626 else if (mutex_lock_interruptible(&ioc->ctl_cmds.mutex))
1627 return -ERESTARTSYS;
1628
1629 if (ioc->ctl_cmds.status != MPT2_CMD_NOT_USED) { 1614 if (ioc->ctl_cmds.status != MPT2_CMD_NOT_USED) {
1630 printk(MPT2SAS_ERR_FMT "%s: ctl_cmd in use\n", 1615 printk(MPT2SAS_ERR_FMT "%s: ctl_cmd in use\n",
1631 ioc->name, __func__); 1616 ioc->name, __func__);
@@ -1641,7 +1626,6 @@ _ctl_diag_release(void __user *arg, enum block_state state)
1641 goto out; 1626 goto out;
1642 } 1627 }
1643 1628
1644 rc = 0;
1645 ioc->ctl_cmds.status = MPT2_CMD_PENDING; 1629 ioc->ctl_cmds.status = MPT2_CMD_PENDING;
1646 memset(ioc->ctl_cmds.reply, 0, ioc->reply_sz); 1630 memset(ioc->ctl_cmds.reply, 0, ioc->reply_sz);
1647 mpi_request = mpt2sas_base_get_msg_frame(ioc, smid); 1631 mpi_request = mpt2sas_base_get_msg_frame(ioc, smid);
@@ -1660,8 +1644,9 @@ _ctl_diag_release(void __user *arg, enum block_state state)
1660 _debug_dump_mf(mpi_request, 1644 _debug_dump_mf(mpi_request,
1661 sizeof(Mpi2DiagReleaseRequest_t)/4); 1645 sizeof(Mpi2DiagReleaseRequest_t)/4);
1662 if (!(ioc->ctl_cmds.status & MPT2_CMD_RESET)) 1646 if (!(ioc->ctl_cmds.status & MPT2_CMD_RESET))
1663 issue_reset = 1; 1647 *issue_reset = 1;
1664 goto issue_host_reset; 1648 rc = -EFAULT;
1649 goto out;
1665 } 1650 }
1666 1651
1667 /* process the completed Reply Message Frame */ 1652 /* process the completed Reply Message Frame */
@@ -1687,14 +1672,101 @@ _ctl_diag_release(void __user *arg, enum block_state state)
1687 rc = -EFAULT; 1672 rc = -EFAULT;
1688 } 1673 }
1689 1674
1690 issue_host_reset: 1675 out:
1676 ioc->ctl_cmds.status = MPT2_CMD_NOT_USED;
1677 return rc;
1678}
1679
1680/**
1681 * _ctl_diag_release - request to send Diag Release Message to firmware
1682 * @arg - user space buffer containing ioctl content
1683 * @state - NON_BLOCKING or BLOCKING
1684 *
1685 * This allows ownership of the specified buffer to returned to the driver,
1686 * allowing an application to read the buffer without fear that firmware is
1687 * overwritting information in the buffer.
1688 */
1689static long
1690_ctl_diag_release(void __user *arg, enum block_state state)
1691{
1692 struct mpt2_diag_release karg;
1693 struct MPT2SAS_ADAPTER *ioc;
1694 void *request_data;
1695 int rc;
1696 u8 buffer_type;
1697 u8 issue_reset = 0;
1698
1699 if (copy_from_user(&karg, arg, sizeof(karg))) {
1700 printk(KERN_ERR "failure at %s:%d/%s()!\n",
1701 __FILE__, __LINE__, __func__);
1702 return -EFAULT;
1703 }
1704 if (_ctl_verify_adapter(karg.hdr.ioc_number, &ioc) == -1 || !ioc)
1705 return -ENODEV;
1706
1707 dctlprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s\n", ioc->name,
1708 __func__));
1709
1710 buffer_type = karg.unique_id & 0x000000ff;
1711 if (!_ctl_diag_capability(ioc, buffer_type)) {
1712 printk(MPT2SAS_ERR_FMT "%s: doesn't have capability for "
1713 "buffer_type(0x%02x)\n", ioc->name, __func__, buffer_type);
1714 return -EPERM;
1715 }
1716
1717 if ((ioc->diag_buffer_status[buffer_type] &
1718 MPT2_DIAG_BUFFER_IS_REGISTERED) == 0) {
1719 printk(MPT2SAS_ERR_FMT "%s: buffer_type(0x%02x) is not "
1720 "registered\n", ioc->name, __func__, buffer_type);
1721 return -EINVAL;
1722 }
1723
1724 if (karg.unique_id != ioc->unique_id[buffer_type]) {
1725 printk(MPT2SAS_ERR_FMT "%s: unique_id(0x%08x) is not "
1726 "registered\n", ioc->name, __func__, karg.unique_id);
1727 return -EINVAL;
1728 }
1729
1730 if (ioc->diag_buffer_status[buffer_type] &
1731 MPT2_DIAG_BUFFER_IS_RELEASED) {
1732 printk(MPT2SAS_ERR_FMT "%s: buffer_type(0x%02x) "
1733 "is already released\n", ioc->name, __func__,
1734 buffer_type);
1735 return 0;
1736 }
1737
1738 request_data = ioc->diag_buffer[buffer_type];
1739
1740 if (!request_data) {
1741 printk(MPT2SAS_ERR_FMT "%s: doesn't have memory allocated for "
1742 "buffer_type(0x%02x)\n", ioc->name, __func__, buffer_type);
1743 return -ENOMEM;
1744 }
1745
1746 /* buffers were released by due to host reset */
1747 if ((ioc->diag_buffer_status[buffer_type] &
1748 MPT2_DIAG_BUFFER_IS_DIAG_RESET)) {
1749 ioc->diag_buffer_status[buffer_type] |=
1750 MPT2_DIAG_BUFFER_IS_RELEASED;
1751 ioc->diag_buffer_status[buffer_type] &=
1752 ~MPT2_DIAG_BUFFER_IS_DIAG_RESET;
1753 printk(MPT2SAS_ERR_FMT "%s: buffer_type(0x%02x) "
1754 "was released due to host reset\n", ioc->name, __func__,
1755 buffer_type);
1756 return 0;
1757 }
1758
1759 if (state == NON_BLOCKING && !mutex_trylock(&ioc->ctl_cmds.mutex))
1760 return -EAGAIN;
1761 else if (mutex_lock_interruptible(&ioc->ctl_cmds.mutex))
1762 return -ERESTARTSYS;
1763
1764 rc = _ctl_send_release(ioc, buffer_type, &issue_reset);
1765
1691 if (issue_reset) 1766 if (issue_reset)
1692 mpt2sas_base_hard_reset_handler(ioc, CAN_SLEEP, 1767 mpt2sas_base_hard_reset_handler(ioc, CAN_SLEEP,
1693 FORCE_BIG_HAMMER); 1768 FORCE_BIG_HAMMER);
1694 1769
1695 out:
1696
1697 ioc->ctl_cmds.status = MPT2_CMD_NOT_USED;
1698 mutex_unlock(&ioc->ctl_cmds.mutex); 1770 mutex_unlock(&ioc->ctl_cmds.mutex);
1699 return rc; 1771 return rc;
1700} 1772}
diff --git a/drivers/scsi/mpt2sas/mpt2sas_ctl.h b/drivers/scsi/mpt2sas/mpt2sas_ctl.h
index dbb6c0cf888..4da11435533 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_ctl.h
+++ b/drivers/scsi/mpt2sas/mpt2sas_ctl.h
@@ -50,7 +50,7 @@
50#endif 50#endif
51 51
52#define MPT2SAS_DEV_NAME "mpt2ctl" 52#define MPT2SAS_DEV_NAME "mpt2ctl"
53#define MPT2_MAGIC_NUMBER 'm' 53#define MPT2_MAGIC_NUMBER 'L'
54#define MPT2_IOCTL_DEFAULT_TIMEOUT (10) /* in seconds */ 54#define MPT2_IOCTL_DEFAULT_TIMEOUT (10) /* in seconds */
55 55
56/** 56/**
@@ -295,8 +295,9 @@ struct mpt2_ioctl_btdh_mapping {
295 295
296 296
297/* status bits for ioc->diag_buffer_status */ 297/* status bits for ioc->diag_buffer_status */
298#define MPT2_DIAG_BUFFER_IS_REGISTERED (0x01) 298#define MPT2_DIAG_BUFFER_IS_REGISTERED (0x01)
299#define MPT2_DIAG_BUFFER_IS_RELEASED (0x02) 299#define MPT2_DIAG_BUFFER_IS_RELEASED (0x02)
300#define MPT2_DIAG_BUFFER_IS_DIAG_RESET (0x04)
300 301
301/* application flags for mpt2_diag_register, mpt2_diag_query */ 302/* application flags for mpt2_diag_register, mpt2_diag_query */
302#define MPT2_APP_FLAGS_APP_OWNED (0x0001) 303#define MPT2_APP_FLAGS_APP_OWNED (0x0001)
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
index 0c463c483c0..e3a7967259e 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
@@ -119,7 +119,7 @@ struct sense_info {
119 */ 119 */
120struct fw_event_work { 120struct fw_event_work {
121 struct list_head list; 121 struct list_head list;
122 struct delayed_work work; 122 struct work_struct work;
123 struct MPT2SAS_ADAPTER *ioc; 123 struct MPT2SAS_ADAPTER *ioc;
124 u8 VF_ID; 124 u8 VF_ID;
125 u8 host_reset_handling; 125 u8 host_reset_handling;
@@ -516,12 +516,8 @@ _scsih_sas_device_add(struct MPT2SAS_ADAPTER *ioc,
516 handle = sas_device->handle; 516 handle = sas_device->handle;
517 parent_handle = sas_device->parent_handle; 517 parent_handle = sas_device->parent_handle;
518 sas_address = sas_device->sas_address; 518 sas_address = sas_device->sas_address;
519 if (!mpt2sas_transport_port_add(ioc, handle, parent_handle)) { 519 if (!mpt2sas_transport_port_add(ioc, handle, parent_handle))
520 _scsih_sas_device_remove(ioc, sas_device); 520 _scsih_sas_device_remove(ioc, sas_device);
521 } else if (!sas_device->starget) {
522 mpt2sas_transport_port_remove(ioc, sas_address, parent_handle);
523 _scsih_sas_device_remove(ioc, sas_device);
524 }
525} 521}
526 522
527/** 523/**
@@ -1203,7 +1199,9 @@ scsih_target_destroy(struct scsi_target *starget)
1203 rphy = dev_to_rphy(starget->dev.parent); 1199 rphy = dev_to_rphy(starget->dev.parent);
1204 sas_device = mpt2sas_scsih_sas_device_find_by_sas_address(ioc, 1200 sas_device = mpt2sas_scsih_sas_device_find_by_sas_address(ioc,
1205 rphy->identify.sas_address); 1201 rphy->identify.sas_address);
1206 if (sas_device) 1202 if (sas_device && (sas_device->starget == starget) &&
1203 (sas_device->id == starget->id) &&
1204 (sas_device->channel == starget->channel))
1207 sas_device->starget = NULL; 1205 sas_device->starget = NULL;
1208 1206
1209 spin_unlock_irqrestore(&ioc->sas_device_lock, flags); 1207 spin_unlock_irqrestore(&ioc->sas_device_lock, flags);
@@ -2009,8 +2007,8 @@ _scsih_fw_event_add(struct MPT2SAS_ADAPTER *ioc, struct fw_event_work *fw_event)
2009 2007
2010 spin_lock_irqsave(&ioc->fw_event_lock, flags); 2008 spin_lock_irqsave(&ioc->fw_event_lock, flags);
2011 list_add_tail(&fw_event->list, &ioc->fw_event_list); 2009 list_add_tail(&fw_event->list, &ioc->fw_event_list);
2012 INIT_DELAYED_WORK(&fw_event->work, _firmware_event_work); 2010 INIT_WORK(&fw_event->work, _firmware_event_work);
2013 queue_delayed_work(ioc->firmware_event_thread, &fw_event->work, 1); 2011 queue_work(ioc->firmware_event_thread, &fw_event->work);
2014 spin_unlock_irqrestore(&ioc->fw_event_lock, flags); 2012 spin_unlock_irqrestore(&ioc->fw_event_lock, flags);
2015} 2013}
2016 2014
@@ -2054,7 +2052,7 @@ _scsih_fw_event_requeue(struct MPT2SAS_ADAPTER *ioc, struct fw_event_work
2054 return; 2052 return;
2055 2053
2056 spin_lock_irqsave(&ioc->fw_event_lock, flags); 2054 spin_lock_irqsave(&ioc->fw_event_lock, flags);
2057 queue_delayed_work(ioc->firmware_event_thread, &fw_event->work, delay); 2055 queue_work(ioc->firmware_event_thread, &fw_event->work);
2058 spin_unlock_irqrestore(&ioc->fw_event_lock, flags); 2056 spin_unlock_irqrestore(&ioc->fw_event_lock, flags);
2059} 2057}
2060 2058
@@ -2863,8 +2861,9 @@ scsih_io_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 VF_ID, u32 reply)
2863 struct sense_info data; 2861 struct sense_info data;
2864 const void *sense_data = mpt2sas_base_get_sense_buffer(ioc, 2862 const void *sense_data = mpt2sas_base_get_sense_buffer(ioc,
2865 smid); 2863 smid);
2866 memcpy(scmd->sense_buffer, sense_data, 2864 u32 sz = min_t(u32, SCSI_SENSE_BUFFERSIZE,
2867 le32_to_cpu(mpi_reply->SenseCount)); 2865 le32_to_cpu(mpi_reply->SenseCount));
2866 memcpy(scmd->sense_buffer, sense_data, sz);
2868 _scsih_normalize_sense(scmd->sense_buffer, &data); 2867 _scsih_normalize_sense(scmd->sense_buffer, &data);
2869 /* failure prediction threshold exceeded */ 2868 /* failure prediction threshold exceeded */
2870 if (data.asc == 0x5D) 2869 if (data.asc == 0x5D)
@@ -3923,7 +3922,7 @@ _scsih_sas_broadcast_primative_event(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID,
3923 3922
3924 mpt2sas_scsih_issue_tm(ioc, handle, lun, 3923 mpt2sas_scsih_issue_tm(ioc, handle, lun,
3925 MPI2_SCSITASKMGMT_TASKTYPE_QUERY_TASK, smid, 30); 3924 MPI2_SCSITASKMGMT_TASKTYPE_QUERY_TASK, smid, 30);
3926 termination_count += le32_to_cpu(mpi_reply->TerminationCount); 3925 ioc->tm_cmds.status = MPT2_CMD_NOT_USED;
3927 3926
3928 if ((mpi_reply->IOCStatus == MPI2_IOCSTATUS_SUCCESS) && 3927 if ((mpi_reply->IOCStatus == MPI2_IOCSTATUS_SUCCESS) &&
3929 (mpi_reply->ResponseCode == 3928 (mpi_reply->ResponseCode ==
@@ -3933,10 +3932,10 @@ _scsih_sas_broadcast_primative_event(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID,
3933 continue; 3932 continue;
3934 3933
3935 mpt2sas_scsih_issue_tm(ioc, handle, lun, 3934 mpt2sas_scsih_issue_tm(ioc, handle, lun,
3936 MPI2_SCSITASKMGMT_TASKTYPE_ABRT_TASK_SET, smid, 30); 3935 MPI2_SCSITASKMGMT_TASKTYPE_ABRT_TASK_SET, 0, 30);
3936 ioc->tm_cmds.status = MPT2_CMD_NOT_USED;
3937 termination_count += le32_to_cpu(mpi_reply->TerminationCount); 3937 termination_count += le32_to_cpu(mpi_reply->TerminationCount);
3938 } 3938 }
3939 ioc->tm_cmds.status = MPT2_CMD_NOT_USED;
3940 ioc->broadcast_aen_busy = 0; 3939 ioc->broadcast_aen_busy = 0;
3941 mutex_unlock(&ioc->tm_cmds.mutex); 3940 mutex_unlock(&ioc->tm_cmds.mutex);
3942 3941
@@ -4962,7 +4961,7 @@ static void
4962_firmware_event_work(struct work_struct *work) 4961_firmware_event_work(struct work_struct *work)
4963{ 4962{
4964 struct fw_event_work *fw_event = container_of(work, 4963 struct fw_event_work *fw_event = container_of(work,
4965 struct fw_event_work, work.work); 4964 struct fw_event_work, work);
4966 unsigned long flags; 4965 unsigned long flags;
4967 struct MPT2SAS_ADAPTER *ioc = fw_event->ioc; 4966 struct MPT2SAS_ADAPTER *ioc = fw_event->ioc;
4968 4967
diff --git a/drivers/scsi/osd/osd_initiator.c b/drivers/scsi/osd/osd_initiator.c
index 2a5f0777148..1ce6b24abab 100644
--- a/drivers/scsi/osd/osd_initiator.c
+++ b/drivers/scsi/osd/osd_initiator.c
@@ -205,6 +205,74 @@ static unsigned _osd_req_alist_elem_size(struct osd_request *or, unsigned len)
205 osdv2_attr_list_elem_size(len); 205 osdv2_attr_list_elem_size(len);
206} 206}
207 207
208static void _osd_req_alist_elem_encode(struct osd_request *or,
209 void *attr_last, const struct osd_attr *oa)
210{
211 if (osd_req_is_ver1(or)) {
212 struct osdv1_attributes_list_element *attr = attr_last;
213
214 attr->attr_page = cpu_to_be32(oa->attr_page);
215 attr->attr_id = cpu_to_be32(oa->attr_id);
216 attr->attr_bytes = cpu_to_be16(oa->len);
217 memcpy(attr->attr_val, oa->val_ptr, oa->len);
218 } else {
219 struct osdv2_attributes_list_element *attr = attr_last;
220
221 attr->attr_page = cpu_to_be32(oa->attr_page);
222 attr->attr_id = cpu_to_be32(oa->attr_id);
223 attr->attr_bytes = cpu_to_be16(oa->len);
224 memcpy(attr->attr_val, oa->val_ptr, oa->len);
225 }
226}
227
228static int _osd_req_alist_elem_decode(struct osd_request *or,
229 void *cur_p, struct osd_attr *oa, unsigned max_bytes)
230{
231 unsigned inc;
232 if (osd_req_is_ver1(or)) {
233 struct osdv1_attributes_list_element *attr = cur_p;
234
235 if (max_bytes < sizeof(*attr))
236 return -1;
237
238 oa->len = be16_to_cpu(attr->attr_bytes);
239 inc = _osd_req_alist_elem_size(or, oa->len);
240 if (inc > max_bytes)
241 return -1;
242
243 oa->attr_page = be32_to_cpu(attr->attr_page);
244 oa->attr_id = be32_to_cpu(attr->attr_id);
245
246 /* OSD1: On empty attributes we return a pointer to 2 bytes
247 * of zeros. This keeps similar behaviour with OSD2.
248 * (See below)
249 */
250 oa->val_ptr = likely(oa->len) ? attr->attr_val :
251 (u8 *)&attr->attr_bytes;
252 } else {
253 struct osdv2_attributes_list_element *attr = cur_p;
254
255 if (max_bytes < sizeof(*attr))
256 return -1;
257
258 oa->len = be16_to_cpu(attr->attr_bytes);
259 inc = _osd_req_alist_elem_size(or, oa->len);
260 if (inc > max_bytes)
261 return -1;
262
263 oa->attr_page = be32_to_cpu(attr->attr_page);
264 oa->attr_id = be32_to_cpu(attr->attr_id);
265
266 /* OSD2: For convenience, on empty attributes, we return 8 bytes
267 * of zeros here. This keeps the same behaviour with OSD2r04,
268 * and is nice with null terminating ASCII fields.
269 * oa->val_ptr == NULL marks the end-of-list, or error.
270 */
271 oa->val_ptr = likely(oa->len) ? attr->attr_val : attr->reserved;
272 }
273 return inc;
274}
275
208static unsigned _osd_req_alist_size(struct osd_request *or, void *list_head) 276static unsigned _osd_req_alist_size(struct osd_request *or, void *list_head)
209{ 277{
210 return osd_req_is_ver1(or) ? 278 return osd_req_is_ver1(or) ?
@@ -282,9 +350,9 @@ _osd_req_sec_params(struct osd_request *or)
282 struct osd_cdb *ocdb = &or->cdb; 350 struct osd_cdb *ocdb = &or->cdb;
283 351
284 if (osd_req_is_ver1(or)) 352 if (osd_req_is_ver1(or))
285 return &ocdb->v1.sec_params; 353 return (struct osd_security_parameters *)&ocdb->v1.sec_params;
286 else 354 else
287 return &ocdb->v2.sec_params; 355 return (struct osd_security_parameters *)&ocdb->v2.sec_params;
288} 356}
289 357
290void osd_dev_init(struct osd_dev *osdd, struct scsi_device *scsi_device) 358void osd_dev_init(struct osd_dev *osdd, struct scsi_device *scsi_device)
@@ -612,9 +680,9 @@ static int _osd_req_list_objects(struct osd_request *or,
612 680
613 WARN_ON(or->in.bio); 681 WARN_ON(or->in.bio);
614 bio = bio_map_kern(q, list, len, or->alloc_flags); 682 bio = bio_map_kern(q, list, len, or->alloc_flags);
615 if (!bio) { 683 if (IS_ERR(bio)) {
616 OSD_ERR("!!! Failed to allocate list_objects BIO\n"); 684 OSD_ERR("!!! Failed to allocate list_objects BIO\n");
617 return -ENOMEM; 685 return PTR_ERR(bio);
618 } 686 }
619 687
620 bio->bi_rw &= ~(1 << BIO_RW); 688 bio->bi_rw &= ~(1 << BIO_RW);
@@ -798,7 +866,6 @@ int osd_req_add_set_attr_list(struct osd_request *or,
798 attr_last = or->set_attr.buff + total_bytes; 866 attr_last = or->set_attr.buff + total_bytes;
799 867
800 for (; nelem; --nelem) { 868 for (; nelem; --nelem) {
801 struct osd_attributes_list_element *attr;
802 unsigned elem_size = _osd_req_alist_elem_size(or, oa->len); 869 unsigned elem_size = _osd_req_alist_elem_size(or, oa->len);
803 870
804 total_bytes += elem_size; 871 total_bytes += elem_size;
@@ -811,11 +878,7 @@ int osd_req_add_set_attr_list(struct osd_request *or,
811 or->set_attr.buff + or->set_attr.total_bytes; 878 or->set_attr.buff + or->set_attr.total_bytes;
812 } 879 }
813 880
814 attr = attr_last; 881 _osd_req_alist_elem_encode(or, attr_last, oa);
815 attr->attr_page = cpu_to_be32(oa->attr_page);
816 attr->attr_id = cpu_to_be32(oa->attr_id);
817 attr->attr_bytes = cpu_to_be16(oa->len);
818 memcpy(attr->attr_val, oa->val_ptr, oa->len);
819 882
820 attr_last += elem_size; 883 attr_last += elem_size;
821 ++oa; 884 ++oa;
@@ -1070,15 +1133,10 @@ int osd_req_decode_get_attr_list(struct osd_request *or,
1070 } 1133 }
1071 1134
1072 for (n = 0; (n < *nelem) && (cur_bytes < returned_bytes); ++n) { 1135 for (n = 0; (n < *nelem) && (cur_bytes < returned_bytes); ++n) {
1073 struct osd_attributes_list_element *attr = cur_p; 1136 int inc = _osd_req_alist_elem_decode(or, cur_p, oa,
1074 unsigned inc; 1137 returned_bytes - cur_bytes);
1075 1138
1076 oa->len = be16_to_cpu(attr->attr_bytes); 1139 if (inc < 0) {
1077 inc = _osd_req_alist_elem_size(or, oa->len);
1078 OSD_DEBUG("oa->len=%d inc=%d cur_bytes=%d\n",
1079 oa->len, inc, cur_bytes);
1080 cur_bytes += inc;
1081 if (cur_bytes > returned_bytes) {
1082 OSD_ERR("BAD FOOD from target. list not valid!" 1140 OSD_ERR("BAD FOOD from target. list not valid!"
1083 "c=%d r=%d n=%d\n", 1141 "c=%d r=%d n=%d\n",
1084 cur_bytes, returned_bytes, n); 1142 cur_bytes, returned_bytes, n);
@@ -1086,10 +1144,7 @@ int osd_req_decode_get_attr_list(struct osd_request *or,
1086 break; 1144 break;
1087 } 1145 }
1088 1146
1089 oa->attr_page = be32_to_cpu(attr->attr_page); 1147 cur_bytes += inc;
1090 oa->attr_id = be32_to_cpu(attr->attr_id);
1091 oa->val_ptr = attr->attr_val;
1092
1093 cur_p += inc; 1148 cur_p += inc;
1094 ++oa; 1149 ++oa;
1095 } 1150 }
@@ -1159,6 +1214,24 @@ static int _osd_req_finalize_attr_page(struct osd_request *or)
1159 return ret; 1214 return ret;
1160} 1215}
1161 1216
1217static inline void osd_sec_parms_set_out_offset(bool is_v1,
1218 struct osd_security_parameters *sec_parms, osd_cdb_offset offset)
1219{
1220 if (is_v1)
1221 sec_parms->v1.data_out_integrity_check_offset = offset;
1222 else
1223 sec_parms->v2.data_out_integrity_check_offset = offset;
1224}
1225
1226static inline void osd_sec_parms_set_in_offset(bool is_v1,
1227 struct osd_security_parameters *sec_parms, osd_cdb_offset offset)
1228{
1229 if (is_v1)
1230 sec_parms->v1.data_in_integrity_check_offset = offset;
1231 else
1232 sec_parms->v2.data_in_integrity_check_offset = offset;
1233}
1234
1162static int _osd_req_finalize_data_integrity(struct osd_request *or, 1235static int _osd_req_finalize_data_integrity(struct osd_request *or,
1163 bool has_in, bool has_out, const u8 *cap_key) 1236 bool has_in, bool has_out, const u8 *cap_key)
1164{ 1237{
@@ -1182,8 +1255,8 @@ static int _osd_req_finalize_data_integrity(struct osd_request *or,
1182 or->out_data_integ.get_attributes_bytes = cpu_to_be64( 1255 or->out_data_integ.get_attributes_bytes = cpu_to_be64(
1183 or->enc_get_attr.total_bytes); 1256 or->enc_get_attr.total_bytes);
1184 1257
1185 sec_parms->data_out_integrity_check_offset = 1258 osd_sec_parms_set_out_offset(osd_req_is_ver1(or), sec_parms,
1186 osd_req_encode_offset(or, or->out.total_bytes, &pad); 1259 osd_req_encode_offset(or, or->out.total_bytes, &pad));
1187 1260
1188 ret = _req_append_segment(or, pad, &seg, or->out.last_seg, 1261 ret = _req_append_segment(or, pad, &seg, or->out.last_seg,
1189 &or->out); 1262 &or->out);
@@ -1203,8 +1276,8 @@ static int _osd_req_finalize_data_integrity(struct osd_request *or,
1203 }; 1276 };
1204 unsigned pad; 1277 unsigned pad;
1205 1278
1206 sec_parms->data_in_integrity_check_offset = 1279 osd_sec_parms_set_in_offset(osd_req_is_ver1(or), sec_parms,
1207 osd_req_encode_offset(or, or->in.total_bytes, &pad); 1280 osd_req_encode_offset(or, or->in.total_bytes, &pad));
1208 1281
1209 ret = _req_append_segment(or, pad, &seg, or->in.last_seg, 1282 ret = _req_append_segment(or, pad, &seg, or->in.last_seg,
1210 &or->in); 1283 &or->in);
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index d1cb64ad1a3..bb218c8b6e9 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1291,10 +1291,8 @@ static inline int scsi_target_queue_ready(struct Scsi_Host *shost,
1291 if (--starget->target_blocked == 0) { 1291 if (--starget->target_blocked == 0) {
1292 SCSI_LOG_MLQUEUE(3, starget_printk(KERN_INFO, starget, 1292 SCSI_LOG_MLQUEUE(3, starget_printk(KERN_INFO, starget,
1293 "unblocking target at zero depth\n")); 1293 "unblocking target at zero depth\n"));
1294 } else { 1294 } else
1295 blk_plug_device(sdev->request_queue);
1296 return 0; 1295 return 0;
1297 }
1298 } 1296 }
1299 1297
1300 if (scsi_target_is_busy(starget)) { 1298 if (scsi_target_is_busy(starget)) {
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 3fcb64b91c4..84044233b63 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -50,6 +50,7 @@
50#include <linux/string_helpers.h> 50#include <linux/string_helpers.h>
51#include <linux/async.h> 51#include <linux/async.h>
52#include <asm/uaccess.h> 52#include <asm/uaccess.h>
53#include <asm/unaligned.h>
53 54
54#include <scsi/scsi.h> 55#include <scsi/scsi.h>
55#include <scsi/scsi_cmnd.h> 56#include <scsi/scsi_cmnd.h>
@@ -1344,12 +1345,8 @@ static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp,
1344 return -EINVAL; 1345 return -EINVAL;
1345 } 1346 }
1346 1347
1347 sector_size = (buffer[8] << 24) | (buffer[9] << 16) | 1348 sector_size = get_unaligned_be32(&buffer[8]);
1348 (buffer[10] << 8) | buffer[11]; 1349 lba = get_unaligned_be64(&buffer[0]);
1349 lba = (((u64)buffer[0] << 56) | ((u64)buffer[1] << 48) |
1350 ((u64)buffer[2] << 40) | ((u64)buffer[3] << 32) |
1351 ((u64)buffer[4] << 24) | ((u64)buffer[5] << 16) |
1352 ((u64)buffer[6] << 8) | (u64)buffer[7]);
1353 1350
1354 sd_read_protection_type(sdkp, buffer); 1351 sd_read_protection_type(sdkp, buffer);
1355 1352
@@ -1400,10 +1397,8 @@ static int read_capacity_10(struct scsi_disk *sdkp, struct scsi_device *sdp,
1400 return -EINVAL; 1397 return -EINVAL;
1401 } 1398 }
1402 1399
1403 sector_size = (buffer[4] << 24) | (buffer[5] << 16) | 1400 sector_size = get_unaligned_be32(&buffer[4]);
1404 (buffer[6] << 8) | buffer[7]; 1401 lba = get_unaligned_be32(&buffer[0]);
1405 lba = (buffer[0] << 24) | (buffer[1] << 16) |
1406 (buffer[2] << 8) | buffer[3];
1407 1402
1408 if ((sizeof(sdkp->capacity) == 4) && (lba == 0xffffffff)) { 1403 if ((sizeof(sdkp->capacity) == 4) && (lba == 0xffffffff)) {
1409 sd_printk(KERN_ERR, sdkp, "Too big for this kernel. Use a " 1404 sd_printk(KERN_ERR, sdkp, "Too big for this kernel. Use a "
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 82312df9b0b..e1716f14cd4 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -179,7 +179,7 @@ typedef struct sg_device { /* holds the state of each scsi generic device */
179/* tasklet or soft irq callback */ 179/* tasklet or soft irq callback */
180static void sg_rq_end_io(struct request *rq, int uptodate); 180static void sg_rq_end_io(struct request *rq, int uptodate);
181static int sg_start_req(Sg_request *srp, unsigned char *cmd); 181static int sg_start_req(Sg_request *srp, unsigned char *cmd);
182static void sg_finish_rem_req(Sg_request * srp); 182static int sg_finish_rem_req(Sg_request * srp);
183static int sg_build_indirect(Sg_scatter_hold * schp, Sg_fd * sfp, int buff_size); 183static int sg_build_indirect(Sg_scatter_hold * schp, Sg_fd * sfp, int buff_size);
184static ssize_t sg_new_read(Sg_fd * sfp, char __user *buf, size_t count, 184static ssize_t sg_new_read(Sg_fd * sfp, char __user *buf, size_t count,
185 Sg_request * srp); 185 Sg_request * srp);
@@ -518,7 +518,7 @@ sg_new_read(Sg_fd * sfp, char __user *buf, size_t count, Sg_request * srp)
518 goto err_out; 518 goto err_out;
519 } 519 }
520err_out: 520err_out:
521 sg_finish_rem_req(srp); 521 err = sg_finish_rem_req(srp);
522 return (0 == err) ? count : err; 522 return (0 == err) ? count : err;
523} 523}
524 524
@@ -1696,9 +1696,10 @@ static int sg_start_req(Sg_request *srp, unsigned char *cmd)
1696 return res; 1696 return res;
1697} 1697}
1698 1698
1699static void 1699static int sg_finish_rem_req(Sg_request * srp)
1700sg_finish_rem_req(Sg_request * srp)
1701{ 1700{
1701 int ret = 0;
1702
1702 Sg_fd *sfp = srp->parentfp; 1703 Sg_fd *sfp = srp->parentfp;
1703 Sg_scatter_hold *req_schp = &srp->data; 1704 Sg_scatter_hold *req_schp = &srp->data;
1704 1705
@@ -1710,12 +1711,14 @@ sg_finish_rem_req(Sg_request * srp)
1710 1711
1711 if (srp->rq) { 1712 if (srp->rq) {
1712 if (srp->bio) 1713 if (srp->bio)
1713 blk_rq_unmap_user(srp->bio); 1714 ret = blk_rq_unmap_user(srp->bio);
1714 1715
1715 blk_put_request(srp->rq); 1716 blk_put_request(srp->rq);
1716 } 1717 }
1717 1718
1718 sg_remove_request(sfp, srp); 1719 sg_remove_request(sfp, srp);
1720
1721 return ret;
1719} 1722}
1720 1723
1721static int 1724static int
diff --git a/drivers/scsi/sr_ioctl.c b/drivers/scsi/sr_ioctl.c
index d92ff512d21..291236e6e43 100644
--- a/drivers/scsi/sr_ioctl.c
+++ b/drivers/scsi/sr_ioctl.c
@@ -309,6 +309,11 @@ int sr_drive_status(struct cdrom_device_info *cdi, int slot)
309 if (0 == sr_test_unit_ready(cd->device, &sshdr)) 309 if (0 == sr_test_unit_ready(cd->device, &sshdr))
310 return CDS_DISC_OK; 310 return CDS_DISC_OK;
311 311
312 /* SK/ASC/ASCQ of 2/4/1 means "unit is becoming ready" */
313 if (scsi_sense_valid(&sshdr) && sshdr.sense_key == NOT_READY
314 && sshdr.asc == 0x04 && sshdr.ascq == 0x01)
315 return CDS_DRIVE_NOT_READY;
316
312 if (!cdrom_get_media_event(cdi, &med)) { 317 if (!cdrom_get_media_event(cdi, &med)) {
313 if (med.media_present) 318 if (med.media_present)
314 return CDS_DISC_OK; 319 return CDS_DISC_OK;
diff --git a/drivers/serial/crisv10.c b/drivers/serial/crisv10.c
index 7ba7d70f04d..7be52fe288e 100644
--- a/drivers/serial/crisv10.c
+++ b/drivers/serial/crisv10.c
@@ -23,16 +23,18 @@ static char *serial_version = "$Revision: 1.25 $";
23#include <linux/mm.h> 23#include <linux/mm.h>
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <linux/init.h> 25#include <linux/init.h>
26#include <asm/uaccess.h>
27#include <linux/kernel.h> 26#include <linux/kernel.h>
28#include <linux/mutex.h> 27#include <linux/mutex.h>
29#include <linux/bitops.h> 28#include <linux/bitops.h>
29#include <linux/seq_file.h>
30#include <linux/delay.h>
31#include <linux/module.h>
32#include <linux/uaccess.h>
33#include <linux/io.h>
30 34
31#include <asm/io.h>
32#include <asm/irq.h> 35#include <asm/irq.h>
33#include <asm/dma.h> 36#include <asm/dma.h>
34#include <asm/system.h> 37#include <asm/system.h>
35#include <linux/delay.h>
36 38
37#include <arch/svinto.h> 39#include <arch/svinto.h>
38 40
@@ -456,7 +458,6 @@ static struct e100_serial rs_table[] = {
456 458
457#define NR_PORTS (sizeof(rs_table)/sizeof(struct e100_serial)) 459#define NR_PORTS (sizeof(rs_table)/sizeof(struct e100_serial))
458 460
459static struct ktermios *serial_termios[NR_PORTS];
460#ifdef CONFIG_ETRAX_SERIAL_FAST_TIMER 461#ifdef CONFIG_ETRAX_SERIAL_FAST_TIMER
461static struct fast_timer fast_timers[NR_PORTS]; 462static struct fast_timer fast_timers[NR_PORTS];
462#endif 463#endif
@@ -4257,151 +4258,132 @@ rs_open(struct tty_struct *tty, struct file * filp)
4257 return 0; 4258 return 0;
4258} 4259}
4259 4260
4261#ifdef CONFIG_PROC_FS
4260/* 4262/*
4261 * /proc fs routines.... 4263 * /proc fs routines....
4262 */ 4264 */
4263 4265
4264static int line_info(char *buf, struct e100_serial *info) 4266static void seq_line_info(struct seq_file *m, struct e100_serial *info)
4265{ 4267{
4266 char stat_buf[30];
4267 int ret;
4268 unsigned long tmp; 4268 unsigned long tmp;
4269 4269
4270 ret = sprintf(buf, "%d: uart:E100 port:%lX irq:%d", 4270 seq_printf(m, "%d: uart:E100 port:%lX irq:%d",
4271 info->line, (unsigned long)info->ioport, info->irq); 4271 info->line, (unsigned long)info->ioport, info->irq);
4272 4272
4273 if (!info->ioport || (info->type == PORT_UNKNOWN)) { 4273 if (!info->ioport || (info->type == PORT_UNKNOWN)) {
4274 ret += sprintf(buf+ret, "\n"); 4274 seq_printf(m, "\n");
4275 return ret; 4275 return;
4276 } 4276 }
4277 4277
4278 stat_buf[0] = 0; 4278 seq_printf(m, " baud:%d", info->baud);
4279 stat_buf[1] = 0; 4279 seq_printf(m, " tx:%lu rx:%lu",
4280 if (!E100_RTS_GET(info))
4281 strcat(stat_buf, "|RTS");
4282 if (!E100_CTS_GET(info))
4283 strcat(stat_buf, "|CTS");
4284 if (!E100_DTR_GET(info))
4285 strcat(stat_buf, "|DTR");
4286 if (!E100_DSR_GET(info))
4287 strcat(stat_buf, "|DSR");
4288 if (!E100_CD_GET(info))
4289 strcat(stat_buf, "|CD");
4290 if (!E100_RI_GET(info))
4291 strcat(stat_buf, "|RI");
4292
4293 ret += sprintf(buf+ret, " baud:%d", info->baud);
4294
4295 ret += sprintf(buf+ret, " tx:%lu rx:%lu",
4296 (unsigned long)info->icount.tx, 4280 (unsigned long)info->icount.tx,
4297 (unsigned long)info->icount.rx); 4281 (unsigned long)info->icount.rx);
4298 tmp = CIRC_CNT(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE); 4282 tmp = CIRC_CNT(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE);
4299 if (tmp) { 4283 if (tmp)
4300 ret += sprintf(buf+ret, " tx_pend:%lu/%lu", 4284 seq_printf(m, " tx_pend:%lu/%lu",
4301 (unsigned long)tmp, 4285 (unsigned long)tmp,
4302 (unsigned long)SERIAL_XMIT_SIZE); 4286 (unsigned long)SERIAL_XMIT_SIZE);
4303 }
4304 4287
4305 ret += sprintf(buf+ret, " rx_pend:%lu/%lu", 4288 seq_printf(m, " rx_pend:%lu/%lu",
4306 (unsigned long)info->recv_cnt, 4289 (unsigned long)info->recv_cnt,
4307 (unsigned long)info->max_recv_cnt); 4290 (unsigned long)info->max_recv_cnt);
4308 4291
4309#if 1 4292#if 1
4310 if (info->port.tty) { 4293 if (info->port.tty) {
4311
4312 if (info->port.tty->stopped) 4294 if (info->port.tty->stopped)
4313 ret += sprintf(buf+ret, " stopped:%i", 4295 seq_printf(m, " stopped:%i",
4314 (int)info->port.tty->stopped); 4296 (int)info->port.tty->stopped);
4315 if (info->port.tty->hw_stopped) 4297 if (info->port.tty->hw_stopped)
4316 ret += sprintf(buf+ret, " hw_stopped:%i", 4298 seq_printf(m, " hw_stopped:%i",
4317 (int)info->port.tty->hw_stopped); 4299 (int)info->port.tty->hw_stopped);
4318 } 4300 }
4319 4301
4320 { 4302 {
4321 unsigned char rstat = info->ioport[REG_STATUS]; 4303 unsigned char rstat = info->ioport[REG_STATUS];
4322 if (rstat & IO_MASK(R_SERIAL0_STATUS, xoff_detect) ) 4304 if (rstat & IO_MASK(R_SERIAL0_STATUS, xoff_detect))
4323 ret += sprintf(buf+ret, " xoff_detect:1"); 4305 seq_printf(m, " xoff_detect:1");
4324 } 4306 }
4325 4307
4326#endif 4308#endif
4327 4309
4328
4329
4330
4331 if (info->icount.frame) 4310 if (info->icount.frame)
4332 ret += sprintf(buf+ret, " fe:%lu", 4311 seq_printf(m, " fe:%lu", (unsigned long)info->icount.frame);
4333 (unsigned long)info->icount.frame);
4334 4312
4335 if (info->icount.parity) 4313 if (info->icount.parity)
4336 ret += sprintf(buf+ret, " pe:%lu", 4314 seq_printf(m, " pe:%lu", (unsigned long)info->icount.parity);
4337 (unsigned long)info->icount.parity);
4338 4315
4339 if (info->icount.brk) 4316 if (info->icount.brk)
4340 ret += sprintf(buf+ret, " brk:%lu", 4317 seq_printf(m, " brk:%lu", (unsigned long)info->icount.brk);
4341 (unsigned long)info->icount.brk);
4342 4318
4343 if (info->icount.overrun) 4319 if (info->icount.overrun)
4344 ret += sprintf(buf+ret, " oe:%lu", 4320 seq_printf(m, " oe:%lu", (unsigned long)info->icount.overrun);
4345 (unsigned long)info->icount.overrun);
4346 4321
4347 /* 4322 /*
4348 * Last thing is the RS-232 status lines 4323 * Last thing is the RS-232 status lines
4349 */ 4324 */
4350 ret += sprintf(buf+ret, " %s\n", stat_buf+1); 4325 if (!E100_RTS_GET(info))
4351 return ret; 4326 seq_puts(m, "|RTS");
4327 if (!E100_CTS_GET(info))
4328 seq_puts(m, "|CTS");
4329 if (!E100_DTR_GET(info))
4330 seq_puts(m, "|DTR");
4331 if (!E100_DSR_GET(info))
4332 seq_puts(m, "|DSR");
4333 if (!E100_CD_GET(info))
4334 seq_puts(m, "|CD");
4335 if (!E100_RI_GET(info))
4336 seq_puts(m, "|RI");
4337 seq_puts(m, "\n");
4352} 4338}
4353 4339
4354int rs_read_proc(char *page, char **start, off_t off, int count, 4340
4355 int *eof, void *data) 4341static int crisv10_proc_show(struct seq_file *m, void *v)
4356{ 4342{
4357 int i, len = 0, l; 4343 int i;
4358 off_t begin = 0;
4359 4344
4360 len += sprintf(page, "serinfo:1.0 driver:%s\n", 4345 seq_printf(m, "serinfo:1.0 driver:%s\n", serial_version);
4361 serial_version); 4346
4362 for (i = 0; i < NR_PORTS && len < 4000; i++) { 4347 for (i = 0; i < NR_PORTS; i++) {
4363 if (!rs_table[i].enabled) 4348 if (!rs_table[i].enabled)
4364 continue; 4349 continue;
4365 l = line_info(page + len, &rs_table[i]); 4350 seq_line_info(m, &rs_table[i]);
4366 len += l;
4367 if (len+begin > off+count)
4368 goto done;
4369 if (len+begin < off) {
4370 begin += len;
4371 len = 0;
4372 }
4373 } 4351 }
4374#ifdef DEBUG_LOG_INCLUDED 4352#ifdef DEBUG_LOG_INCLUDED
4375 for (i = 0; i < debug_log_pos; i++) { 4353 for (i = 0; i < debug_log_pos; i++) {
4376 len += sprintf(page + len, "%-4i %lu.%lu ", i, debug_log[i].time, timer_data_to_ns(debug_log[i].timer_data)); 4354 seq_printf(m, "%-4i %lu.%lu ",
4377 len += sprintf(page + len, debug_log[i].string, debug_log[i].value); 4355 i, debug_log[i].time,
4378 if (len+begin > off+count) 4356 timer_data_to_ns(debug_log[i].timer_data));
4379 goto done; 4357 seq_printf(m, debug_log[i].string, debug_log[i].value);
4380 if (len+begin < off) {
4381 begin += len;
4382 len = 0;
4383 }
4384 } 4358 }
4385 len += sprintf(page + len, "debug_log %i/%i %li bytes\n", 4359 seq_printf(m, "debug_log %i/%i\n", i, DEBUG_LOG_SIZE);
4386 i, DEBUG_LOG_SIZE, begin+len);
4387 debug_log_pos = 0; 4360 debug_log_pos = 0;
4388#endif 4361#endif
4362 return 0;
4363}
4389 4364
4390 *eof = 1; 4365static int crisv10_proc_open(struct inode *inode, struct file *file)
4391done: 4366{
4392 if (off >= len+begin) 4367 return single_open(file, crisv10_proc_show, NULL);
4393 return 0;
4394 *start = page + (off-begin);
4395 return ((count < begin+len-off) ? count : begin+len-off);
4396} 4368}
4397 4369
4370static const struct file_operations crisv10_proc_fops = {
4371 .owner = THIS_MODULE,
4372 .open = crisv10_proc_open,
4373 .read = seq_read,
4374 .llseek = seq_lseek,
4375 .release = single_release,
4376};
4377#endif
4378
4379
4398/* Finally, routines used to initialize the serial driver. */ 4380/* Finally, routines used to initialize the serial driver. */
4399 4381
4400static void 4382static void show_serial_version(void)
4401show_serial_version(void)
4402{ 4383{
4403 printk(KERN_INFO 4384 printk(KERN_INFO
4404 "ETRAX 100LX serial-driver %s, (c) 2000-2004 Axis Communications AB\r\n", 4385 "ETRAX 100LX serial-driver %s, "
4386 "(c) 2000-2004 Axis Communications AB\r\n",
4405 &serial_version[11]); /* "$Revision: x.yy" */ 4387 &serial_version[11]); /* "$Revision: x.yy" */
4406} 4388}
4407 4389
@@ -4425,13 +4407,14 @@ static const struct tty_operations rs_ops = {
4425 .break_ctl = rs_break, 4407 .break_ctl = rs_break,
4426 .send_xchar = rs_send_xchar, 4408 .send_xchar = rs_send_xchar,
4427 .wait_until_sent = rs_wait_until_sent, 4409 .wait_until_sent = rs_wait_until_sent,
4428 .read_proc = rs_read_proc,
4429 .tiocmget = rs_tiocmget, 4410 .tiocmget = rs_tiocmget,
4430 .tiocmset = rs_tiocmset 4411 .tiocmset = rs_tiocmset,
4412#ifdef CONFIG_PROC_FS
4413 .proc_fops = &crisv10_proc_fops,
4414#endif
4431}; 4415};
4432 4416
4433static int __init 4417static int __init rs_init(void)
4434rs_init(void)
4435{ 4418{
4436 int i; 4419 int i;
4437 struct e100_serial *info; 4420 struct e100_serial *info;
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
index d012edda6d1..38e86b84dce 100644
--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -1282,7 +1282,7 @@ static int vgacon_font_get(struct vc_data *c, struct console_font *font)
1282 font->charcount = vga_512_chars ? 512 : 256; 1282 font->charcount = vga_512_chars ? 512 : 256;
1283 if (!font->data) 1283 if (!font->data)
1284 return 0; 1284 return 0;
1285 return vgacon_do_font_op(&state, font->data, 0, 0); 1285 return vgacon_do_font_op(&state, font->data, 0, vga_512_chars);
1286} 1286}
1287 1287
1288#else 1288#else
diff --git a/fs/autofs4/expire.c b/fs/autofs4/expire.c
index 75f7ddacf7d..3077d8f1652 100644
--- a/fs/autofs4/expire.c
+++ b/fs/autofs4/expire.c
@@ -70,8 +70,10 @@ static int autofs4_mount_busy(struct vfsmount *mnt, struct dentry *dentry)
70 * Otherwise it's an offset mount and we need to check 70 * Otherwise it's an offset mount and we need to check
71 * if we can umount its mount, if there is one. 71 * if we can umount its mount, if there is one.
72 */ 72 */
73 if (!d_mountpoint(dentry)) 73 if (!d_mountpoint(dentry)) {
74 status = 0;
74 goto done; 75 goto done;
76 }
75 } 77 }
76 78
77 /* Update the expiry counter if fs is busy */ 79 /* Update the expiry counter if fs is busy */
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
index 70cfc4b84ae..fdb66faa24f 100644
--- a/fs/binfmt_elf_fdpic.c
+++ b/fs/binfmt_elf_fdpic.c
@@ -1388,7 +1388,7 @@ static void fill_prstatus(struct elf_prstatus *prstatus,
1388 prstatus->pr_sigpend = p->pending.signal.sig[0]; 1388 prstatus->pr_sigpend = p->pending.signal.sig[0];
1389 prstatus->pr_sighold = p->blocked.sig[0]; 1389 prstatus->pr_sighold = p->blocked.sig[0];
1390 prstatus->pr_pid = task_pid_vnr(p); 1390 prstatus->pr_pid = task_pid_vnr(p);
1391 prstatus->pr_ppid = task_pid_vnr(p->parent); 1391 prstatus->pr_ppid = task_pid_vnr(p->real_parent);
1392 prstatus->pr_pgrp = task_pgrp_vnr(p); 1392 prstatus->pr_pgrp = task_pgrp_vnr(p);
1393 prstatus->pr_sid = task_session_vnr(p); 1393 prstatus->pr_sid = task_session_vnr(p);
1394 if (thread_group_leader(p)) { 1394 if (thread_group_leader(p)) {
@@ -1433,7 +1433,7 @@ static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p,
1433 psinfo->pr_psargs[len] = 0; 1433 psinfo->pr_psargs[len] = 0;
1434 1434
1435 psinfo->pr_pid = task_pid_vnr(p); 1435 psinfo->pr_pid = task_pid_vnr(p);
1436 psinfo->pr_ppid = task_pid_vnr(p->parent); 1436 psinfo->pr_ppid = task_pid_vnr(p->real_parent);
1437 psinfo->pr_pgrp = task_pgrp_vnr(p); 1437 psinfo->pr_pgrp = task_pgrp_vnr(p);
1438 psinfo->pr_sid = task_session_vnr(p); 1438 psinfo->pr_sid = task_session_vnr(p);
1439 1439
diff --git a/fs/buffer.c b/fs/buffer.c
index b3e5be7514f..aed297739eb 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -2397,7 +2397,8 @@ block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf,
2397 if ((page->mapping != inode->i_mapping) || 2397 if ((page->mapping != inode->i_mapping) ||
2398 (page_offset(page) > size)) { 2398 (page_offset(page) > size)) {
2399 /* page got truncated out from underneath us */ 2399 /* page got truncated out from underneath us */
2400 goto out_unlock; 2400 unlock_page(page);
2401 goto out;
2401 } 2402 }
2402 2403
2403 /* page is wholly or partially inside EOF */ 2404 /* page is wholly or partially inside EOF */
@@ -2411,14 +2412,15 @@ block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf,
2411 ret = block_commit_write(page, 0, end); 2412 ret = block_commit_write(page, 0, end);
2412 2413
2413 if (unlikely(ret)) { 2414 if (unlikely(ret)) {
2415 unlock_page(page);
2414 if (ret == -ENOMEM) 2416 if (ret == -ENOMEM)
2415 ret = VM_FAULT_OOM; 2417 ret = VM_FAULT_OOM;
2416 else /* -ENOSPC, -EIO, etc */ 2418 else /* -ENOSPC, -EIO, etc */
2417 ret = VM_FAULT_SIGBUS; 2419 ret = VM_FAULT_SIGBUS;
2418 } 2420 } else
2421 ret = VM_FAULT_LOCKED;
2419 2422
2420out_unlock: 2423out:
2421 unlock_page(page);
2422 return ret; 2424 return ret;
2423} 2425}
2424 2426
diff --git a/fs/configfs/symlink.c b/fs/configfs/symlink.c
index 932a92b3148..c8afa6b1d91 100644
--- a/fs/configfs/symlink.c
+++ b/fs/configfs/symlink.c
@@ -135,7 +135,7 @@ int configfs_symlink(struct inode *dir, struct dentry *dentry, const char *symna
135 struct path path; 135 struct path path;
136 struct configfs_dirent *sd; 136 struct configfs_dirent *sd;
137 struct config_item *parent_item; 137 struct config_item *parent_item;
138 struct config_item *target_item; 138 struct config_item *target_item = NULL;
139 struct config_item_type *type; 139 struct config_item_type *type;
140 140
141 ret = -EPERM; /* What lack-of-symlink returns */ 141 ret = -EPERM; /* What lack-of-symlink returns */
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index 93bc0f8174a..2f0945d6329 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -667,7 +667,7 @@ ecryptfs_readlink(struct dentry *dentry, char __user *buf, int bufsiz)
667 lower_buf = kmalloc(lower_bufsiz, GFP_KERNEL); 667 lower_buf = kmalloc(lower_bufsiz, GFP_KERNEL);
668 if (lower_buf == NULL) { 668 if (lower_buf == NULL) {
669 printk(KERN_ERR "%s: Out of memory whilst attempting to " 669 printk(KERN_ERR "%s: Out of memory whilst attempting to "
670 "kmalloc [%d] bytes\n", __func__, lower_bufsiz); 670 "kmalloc [%zd] bytes\n", __func__, lower_bufsiz);
671 rc = -ENOMEM; 671 rc = -ENOMEM;
672 goto out; 672 goto out;
673 } 673 }
@@ -690,7 +690,7 @@ ecryptfs_readlink(struct dentry *dentry, char __user *buf, int bufsiz)
690 } 690 }
691 /* Check for bufsiz <= 0 done in sys_readlinkat() */ 691 /* Check for bufsiz <= 0 done in sys_readlinkat() */
692 rc = copy_to_user(buf, plaintext_name, 692 rc = copy_to_user(buf, plaintext_name,
693 min((unsigned) bufsiz, plaintext_name_size)); 693 min((size_t) bufsiz, plaintext_name_size));
694 if (rc) 694 if (rc)
695 rc = -EFAULT; 695 rc = -EFAULT;
696 else 696 else
diff --git a/fs/exec.c b/fs/exec.c
index a3a8ce83940..639177b0eea 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -69,17 +69,18 @@ int suid_dumpable = 0;
69static LIST_HEAD(formats); 69static LIST_HEAD(formats);
70static DEFINE_RWLOCK(binfmt_lock); 70static DEFINE_RWLOCK(binfmt_lock);
71 71
72int register_binfmt(struct linux_binfmt * fmt) 72int __register_binfmt(struct linux_binfmt * fmt, int insert)
73{ 73{
74 if (!fmt) 74 if (!fmt)
75 return -EINVAL; 75 return -EINVAL;
76 write_lock(&binfmt_lock); 76 write_lock(&binfmt_lock);
77 list_add(&fmt->lh, &formats); 77 insert ? list_add(&fmt->lh, &formats) :
78 list_add_tail(&fmt->lh, &formats);
78 write_unlock(&binfmt_lock); 79 write_unlock(&binfmt_lock);
79 return 0; 80 return 0;
80} 81}
81 82
82EXPORT_SYMBOL(register_binfmt); 83EXPORT_SYMBOL(__register_binfmt);
83 84
84void unregister_binfmt(struct linux_binfmt * fmt) 85void unregister_binfmt(struct linux_binfmt * fmt)
85{ 86{
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 5a97bcfe03e..ec7e27d00bc 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -517,10 +517,10 @@ static int nfs_vm_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
517 517
518 ret = nfs_updatepage(filp, page, 0, pagelen); 518 ret = nfs_updatepage(filp, page, 0, pagelen);
519out_unlock: 519out_unlock:
520 if (!ret)
521 return VM_FAULT_LOCKED;
520 unlock_page(page); 522 unlock_page(page);
521 if (ret) 523 return VM_FAULT_SIGBUS;
522 ret = VM_FAULT_SIGBUS;
523 return ret;
524} 524}
525 525
526static struct vm_operations_struct nfs_file_vm_ops = { 526static struct vm_operations_struct nfs_file_vm_ops = {
diff --git a/fs/ocfs2/dcache.c b/fs/ocfs2/dcache.c
index 7d604480557..b574431a031 100644
--- a/fs/ocfs2/dcache.c
+++ b/fs/ocfs2/dcache.c
@@ -290,6 +290,21 @@ out_attach:
290 else 290 else
291 mlog_errno(ret); 291 mlog_errno(ret);
292 292
293 /*
294 * In case of error, manually free the allocation and do the iput().
295 * We need to do this because error here means no d_instantiate(),
296 * which means iput() will not be called during dput(dentry).
297 */
298 if (ret < 0 && !alias) {
299 ocfs2_lock_res_free(&dl->dl_lockres);
300 BUG_ON(dl->dl_count != 1);
301 spin_lock(&dentry_attach_lock);
302 dentry->d_fsdata = NULL;
303 spin_unlock(&dentry_attach_lock);
304 kfree(dl);
305 iput(inode);
306 }
307
293 dput(alias); 308 dput(alias);
294 309
295 return ret; 310 return ret;
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c
index e71160cda11..c5752305627 100644
--- a/fs/ocfs2/dir.c
+++ b/fs/ocfs2/dir.c
@@ -2697,7 +2697,7 @@ static int ocfs2_dx_dir_index_block(struct inode *dir,
2697 u32 *num_dx_entries, 2697 u32 *num_dx_entries,
2698 struct buffer_head *dirent_bh) 2698 struct buffer_head *dirent_bh)
2699{ 2699{
2700 int ret, namelen, i; 2700 int ret = 0, namelen, i;
2701 char *de_buf, *limit; 2701 char *de_buf, *limit;
2702 struct ocfs2_dir_entry *de; 2702 struct ocfs2_dir_entry *de;
2703 struct buffer_head *dx_leaf_bh; 2703 struct buffer_head *dx_leaf_bh;
@@ -2934,7 +2934,7 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh,
2934 */ 2934 */
2935 BUG_ON(alloc > 2); 2935 BUG_ON(alloc > 2);
2936 2936
2937 ret = ocfs2_reserve_clusters(osb, alloc, &data_ac); 2937 ret = ocfs2_reserve_clusters(osb, alloc + dx_alloc, &data_ac);
2938 if (ret) { 2938 if (ret) {
2939 mlog_errno(ret); 2939 mlog_errno(ret);
2940 goto out; 2940 goto out;
diff --git a/fs/ocfs2/export.c b/fs/ocfs2/export.c
index de3da8eb558..15713cbb865 100644
--- a/fs/ocfs2/export.c
+++ b/fs/ocfs2/export.c
@@ -100,7 +100,8 @@ static struct dentry *ocfs2_get_dentry(struct super_block *sb,
100 100
101 /* If the inode allocator bit is clear, this inode must be stale */ 101 /* If the inode allocator bit is clear, this inode must be stale */
102 if (!set) { 102 if (!set) {
103 mlog(0, "inode %llu suballoc bit is clear\n", blkno); 103 mlog(0, "inode %llu suballoc bit is clear\n",
104 (unsigned long long)blkno);
104 status = -ESTALE; 105 status = -ESTALE;
105 goto unlock_nfs_sync; 106 goto unlock_nfs_sync;
106 } 107 }
@@ -114,7 +115,7 @@ check_err:
114 if (status < 0) { 115 if (status < 0) {
115 if (status == -ESTALE) { 116 if (status == -ESTALE) {
116 mlog(0, "stale inode ino: %llu generation: %u\n", 117 mlog(0, "stale inode ino: %llu generation: %u\n",
117 blkno, handle->ih_generation); 118 (unsigned long long)blkno, handle->ih_generation);
118 } 119 }
119 result = ERR_PTR(status); 120 result = ERR_PTR(status);
120 goto bail; 121 goto bail;
@@ -129,8 +130,8 @@ check_err:
129check_gen: 130check_gen:
130 if (handle->ih_generation != inode->i_generation) { 131 if (handle->ih_generation != inode->i_generation) {
131 iput(inode); 132 iput(inode);
132 mlog(0, "stale inode ino: %llu generation: %u\n", blkno, 133 mlog(0, "stale inode ino: %llu generation: %u\n",
133 handle->ih_generation); 134 (unsigned long long)blkno, handle->ih_generation);
134 result = ERR_PTR(-ESTALE); 135 result = ERR_PTR(-ESTALE);
135 goto bail; 136 goto bail;
136 } 137 }
diff --git a/fs/ocfs2/journal.h b/fs/ocfs2/journal.h
index 619dd7f6c05..eb7b76331eb 100644
--- a/fs/ocfs2/journal.h
+++ b/fs/ocfs2/journal.h
@@ -437,8 +437,9 @@ static inline int ocfs2_unlink_credits(struct super_block *sb)
437} 437}
438 438
439/* dinode + orphan dir dinode + inode alloc dinode + orphan dir entry + 439/* dinode + orphan dir dinode + inode alloc dinode + orphan dir entry +
440 * inode alloc group descriptor + orphan dir index leaf */ 440 * inode alloc group descriptor + orphan dir index root +
441#define OCFS2_DELETE_INODE_CREDITS (3 * OCFS2_INODE_UPDATE_CREDITS + 3) 441 * orphan dir index leaf */
442#define OCFS2_DELETE_INODE_CREDITS (3 * OCFS2_INODE_UPDATE_CREDITS + 4)
442 443
443/* dinode update, old dir dinode update, new dir dinode update, old 444/* dinode update, old dir dinode update, new dir dinode update, old
444 * dir dir entry, new dir dir entry, dir entry update for renaming 445 * dir dir entry, new dir dir entry, dir entry update for renaming
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index 2220f93f668..33464c6b60a 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -1025,10 +1025,8 @@ static int ocfs2_rename(struct inode *old_dir,
1025 struct inode *orphan_dir = NULL; 1025 struct inode *orphan_dir = NULL;
1026 struct ocfs2_dinode *newfe = NULL; 1026 struct ocfs2_dinode *newfe = NULL;
1027 char orphan_name[OCFS2_ORPHAN_NAMELEN + 1]; 1027 char orphan_name[OCFS2_ORPHAN_NAMELEN + 1];
1028 struct buffer_head *orphan_entry_bh = NULL;
1029 struct buffer_head *newfe_bh = NULL; 1028 struct buffer_head *newfe_bh = NULL;
1030 struct buffer_head *old_inode_bh = NULL; 1029 struct buffer_head *old_inode_bh = NULL;
1031 struct buffer_head *insert_entry_bh = NULL;
1032 struct ocfs2_super *osb = NULL; 1030 struct ocfs2_super *osb = NULL;
1033 u64 newfe_blkno, old_de_ino; 1031 u64 newfe_blkno, old_de_ino;
1034 handle_t *handle = NULL; 1032 handle_t *handle = NULL;
@@ -1455,8 +1453,6 @@ bail:
1455 brelse(old_inode_bh); 1453 brelse(old_inode_bh);
1456 brelse(old_dir_bh); 1454 brelse(old_dir_bh);
1457 brelse(new_dir_bh); 1455 brelse(new_dir_bh);
1458 brelse(orphan_entry_bh);
1459 brelse(insert_entry_bh);
1460 1456
1461 mlog_exit(status); 1457 mlog_exit(status);
1462 1458
diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c
index b4ca5911caa..8439f6b324b 100644
--- a/fs/ocfs2/suballoc.c
+++ b/fs/ocfs2/suballoc.c
@@ -2197,26 +2197,29 @@ static int ocfs2_get_suballoc_slot_bit(struct ocfs2_super *osb, u64 blkno,
2197 struct buffer_head *inode_bh = NULL; 2197 struct buffer_head *inode_bh = NULL;
2198 struct ocfs2_dinode *inode_fe; 2198 struct ocfs2_dinode *inode_fe;
2199 2199
2200 mlog_entry("blkno: %llu\n", blkno); 2200 mlog_entry("blkno: %llu\n", (unsigned long long)blkno);
2201 2201
2202 /* dirty read disk */ 2202 /* dirty read disk */
2203 status = ocfs2_read_blocks_sync(osb, blkno, 1, &inode_bh); 2203 status = ocfs2_read_blocks_sync(osb, blkno, 1, &inode_bh);
2204 if (status < 0) { 2204 if (status < 0) {
2205 mlog(ML_ERROR, "read block %llu failed %d\n", blkno, status); 2205 mlog(ML_ERROR, "read block %llu failed %d\n",
2206 (unsigned long long)blkno, status);
2206 goto bail; 2207 goto bail;
2207 } 2208 }
2208 2209
2209 inode_fe = (struct ocfs2_dinode *) inode_bh->b_data; 2210 inode_fe = (struct ocfs2_dinode *) inode_bh->b_data;
2210 if (!OCFS2_IS_VALID_DINODE(inode_fe)) { 2211 if (!OCFS2_IS_VALID_DINODE(inode_fe)) {
2211 mlog(ML_ERROR, "invalid inode %llu requested\n", blkno); 2212 mlog(ML_ERROR, "invalid inode %llu requested\n",
2213 (unsigned long long)blkno);
2212 status = -EINVAL; 2214 status = -EINVAL;
2213 goto bail; 2215 goto bail;
2214 } 2216 }
2215 2217
2216 if (le16_to_cpu(inode_fe->i_suballoc_slot) != OCFS2_INVALID_SLOT && 2218 if (le16_to_cpu(inode_fe->i_suballoc_slot) != (u16)OCFS2_INVALID_SLOT &&
2217 (u32)le16_to_cpu(inode_fe->i_suballoc_slot) > osb->max_slots - 1) { 2219 (u32)le16_to_cpu(inode_fe->i_suballoc_slot) > osb->max_slots - 1) {
2218 mlog(ML_ERROR, "inode %llu has invalid suballoc slot %u\n", 2220 mlog(ML_ERROR, "inode %llu has invalid suballoc slot %u\n",
2219 blkno, (u32)le16_to_cpu(inode_fe->i_suballoc_slot)); 2221 (unsigned long long)blkno,
2222 (u32)le16_to_cpu(inode_fe->i_suballoc_slot));
2220 status = -EINVAL; 2223 status = -EINVAL;
2221 goto bail; 2224 goto bail;
2222 } 2225 }
@@ -2251,7 +2254,8 @@ static int ocfs2_test_suballoc_bit(struct ocfs2_super *osb,
2251 u64 bg_blkno; 2254 u64 bg_blkno;
2252 int status; 2255 int status;
2253 2256
2254 mlog_entry("blkno: %llu bit: %u\n", blkno, (unsigned int)bit); 2257 mlog_entry("blkno: %llu bit: %u\n", (unsigned long long)blkno,
2258 (unsigned int)bit);
2255 2259
2256 alloc_fe = (struct ocfs2_dinode *)alloc_bh->b_data; 2260 alloc_fe = (struct ocfs2_dinode *)alloc_bh->b_data;
2257 if ((bit + 1) > ocfs2_bits_per_group(&alloc_fe->id2.i_chain)) { 2261 if ((bit + 1) > ocfs2_bits_per_group(&alloc_fe->id2.i_chain)) {
@@ -2266,7 +2270,8 @@ static int ocfs2_test_suballoc_bit(struct ocfs2_super *osb,
2266 status = ocfs2_read_group_descriptor(suballoc, alloc_fe, bg_blkno, 2270 status = ocfs2_read_group_descriptor(suballoc, alloc_fe, bg_blkno,
2267 &group_bh); 2271 &group_bh);
2268 if (status < 0) { 2272 if (status < 0) {
2269 mlog(ML_ERROR, "read group %llu failed %d\n", bg_blkno, status); 2273 mlog(ML_ERROR, "read group %llu failed %d\n",
2274 (unsigned long long)bg_blkno, status);
2270 goto bail; 2275 goto bail;
2271 } 2276 }
2272 2277
@@ -2300,7 +2305,7 @@ int ocfs2_test_inode_bit(struct ocfs2_super *osb, u64 blkno, int *res)
2300 struct inode *inode_alloc_inode; 2305 struct inode *inode_alloc_inode;
2301 struct buffer_head *alloc_bh = NULL; 2306 struct buffer_head *alloc_bh = NULL;
2302 2307
2303 mlog_entry("blkno: %llu", blkno); 2308 mlog_entry("blkno: %llu", (unsigned long long)blkno);
2304 2309
2305 status = ocfs2_get_suballoc_slot_bit(osb, blkno, &suballoc_slot, 2310 status = ocfs2_get_suballoc_slot_bit(osb, blkno, &suballoc_slot,
2306 &suballoc_bit); 2311 &suballoc_bit);
diff --git a/fs/proc/array.c b/fs/proc/array.c
index 7e4877d9dcb..725a650bbbb 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -80,6 +80,7 @@
80#include <linux/delayacct.h> 80#include <linux/delayacct.h>
81#include <linux/seq_file.h> 81#include <linux/seq_file.h>
82#include <linux/pid_namespace.h> 82#include <linux/pid_namespace.h>
83#include <linux/ptrace.h>
83#include <linux/tracehook.h> 84#include <linux/tracehook.h>
84 85
85#include <asm/pgtable.h> 86#include <asm/pgtable.h>
@@ -352,6 +353,7 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
352 char state; 353 char state;
353 pid_t ppid = 0, pgid = -1, sid = -1; 354 pid_t ppid = 0, pgid = -1, sid = -1;
354 int num_threads = 0; 355 int num_threads = 0;
356 int permitted;
355 struct mm_struct *mm; 357 struct mm_struct *mm;
356 unsigned long long start_time; 358 unsigned long long start_time;
357 unsigned long cmin_flt = 0, cmaj_flt = 0; 359 unsigned long cmin_flt = 0, cmaj_flt = 0;
@@ -364,11 +366,14 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
364 366
365 state = *get_task_state(task); 367 state = *get_task_state(task);
366 vsize = eip = esp = 0; 368 vsize = eip = esp = 0;
369 permitted = ptrace_may_access(task, PTRACE_MODE_READ);
367 mm = get_task_mm(task); 370 mm = get_task_mm(task);
368 if (mm) { 371 if (mm) {
369 vsize = task_vsize(mm); 372 vsize = task_vsize(mm);
370 eip = KSTK_EIP(task); 373 if (permitted) {
371 esp = KSTK_ESP(task); 374 eip = KSTK_EIP(task);
375 esp = KSTK_ESP(task);
376 }
372 } 377 }
373 378
374 get_task_comm(tcomm, task); 379 get_task_comm(tcomm, task);
@@ -424,7 +429,7 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
424 unlock_task_sighand(task, &flags); 429 unlock_task_sighand(task, &flags);
425 } 430 }
426 431
427 if (!whole || num_threads < 2) 432 if (permitted && (!whole || num_threads < 2))
428 wchan = get_wchan(task); 433 wchan = get_wchan(task);
429 if (!whole) { 434 if (!whole) {
430 min_flt = task->min_flt; 435 min_flt = task->min_flt;
@@ -476,7 +481,7 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
476 rsslim, 481 rsslim,
477 mm ? mm->start_code : 0, 482 mm ? mm->start_code : 0,
478 mm ? mm->end_code : 0, 483 mm ? mm->end_code : 0,
479 mm ? mm->start_stack : 0, 484 (permitted && mm) ? mm->start_stack : 0,
480 esp, 485 esp,
481 eip, 486 eip,
482 /* The signal information here is obsolete. 487 /* The signal information here is obsolete.
diff --git a/fs/proc/base.c b/fs/proc/base.c
index aa763ab0077..fb45615943c 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -322,7 +322,10 @@ static int proc_pid_wchan(struct task_struct *task, char *buffer)
322 wchan = get_wchan(task); 322 wchan = get_wchan(task);
323 323
324 if (lookup_symbol_name(wchan, symname) < 0) 324 if (lookup_symbol_name(wchan, symname) < 0)
325 return sprintf(buffer, "%lu", wchan); 325 if (!ptrace_may_access(task, PTRACE_MODE_READ))
326 return 0;
327 else
328 return sprintf(buffer, "%lu", wchan);
326 else 329 else
327 return sprintf(buffer, "%s", symname); 330 return sprintf(buffer, "%s", symname);
328} 331}
diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c
index 74ea974f5ca..c6b0302af4c 100644
--- a/fs/proc/meminfo.c
+++ b/fs/proc/meminfo.c
@@ -35,7 +35,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
35#define K(x) ((x) << (PAGE_SHIFT - 10)) 35#define K(x) ((x) << (PAGE_SHIFT - 10))
36 si_meminfo(&i); 36 si_meminfo(&i);
37 si_swapinfo(&i); 37 si_swapinfo(&i);
38 committed = atomic_long_read(&vm_committed_space); 38 committed = percpu_counter_read_positive(&vm_committed_as);
39 allowed = ((totalram_pages - hugetlb_total_pages()) 39 allowed = ((totalram_pages - hugetlb_total_pages())
40 * sysctl_overcommit_ratio / 100) + total_swap_pages; 40 * sysctl_overcommit_ratio / 100) + total_swap_pages;
41 41
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 39e4ad4f59f..6f61b7cc32e 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -665,6 +665,10 @@ static ssize_t pagemap_read(struct file *file, char __user *buf,
665 goto out_task; 665 goto out_task;
666 666
667 ret = 0; 667 ret = 0;
668
669 if (!count)
670 goto out_task;
671
668 mm = get_task_mm(task); 672 mm = get_task_mm(task);
669 if (!mm) 673 if (!mm)
670 goto out_task; 674 goto out_task;
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
index 3a6ed426327..ca7c6005a48 100644
--- a/fs/xfs/xfs_bmap.c
+++ b/fs/xfs/xfs_bmap.c
@@ -5880,7 +5880,7 @@ xfs_getbmap(
5880 void *arg) /* formatter arg */ 5880 void *arg) /* formatter arg */
5881{ 5881{
5882 __int64_t bmvend; /* last block requested */ 5882 __int64_t bmvend; /* last block requested */
5883 int error; /* return value */ 5883 int error = 0; /* return value */
5884 __int64_t fixlen; /* length for -1 case */ 5884 __int64_t fixlen; /* length for -1 case */
5885 int i; /* extent number */ 5885 int i; /* extent number */
5886 int lock; /* lock state */ 5886 int lock; /* lock state */
@@ -5890,39 +5890,18 @@ xfs_getbmap(
5890 int nexleft; /* # of user extents left */ 5890 int nexleft; /* # of user extents left */
5891 int subnex; /* # of bmapi's can do */ 5891 int subnex; /* # of bmapi's can do */
5892 int nmap; /* number of map entries */ 5892 int nmap; /* number of map entries */
5893 struct getbmapx out; /* output structure */ 5893 struct getbmapx *out; /* output structure */
5894 int whichfork; /* data or attr fork */ 5894 int whichfork; /* data or attr fork */
5895 int prealloced; /* this is a file with 5895 int prealloced; /* this is a file with
5896 * preallocated data space */ 5896 * preallocated data space */
5897 int iflags; /* interface flags */ 5897 int iflags; /* interface flags */
5898 int bmapi_flags; /* flags for xfs_bmapi */ 5898 int bmapi_flags; /* flags for xfs_bmapi */
5899 int cur_ext = 0;
5899 5900
5900 mp = ip->i_mount; 5901 mp = ip->i_mount;
5901 iflags = bmv->bmv_iflags; 5902 iflags = bmv->bmv_iflags;
5902
5903 whichfork = iflags & BMV_IF_ATTRFORK ? XFS_ATTR_FORK : XFS_DATA_FORK; 5903 whichfork = iflags & BMV_IF_ATTRFORK ? XFS_ATTR_FORK : XFS_DATA_FORK;
5904 5904
5905 /* If the BMV_IF_NO_DMAPI_READ interface bit specified, do not
5906 * generate a DMAPI read event. Otherwise, if the DM_EVENT_READ
5907 * bit is set for the file, generate a read event in order
5908 * that the DMAPI application may do its thing before we return
5909 * the extents. Usually this means restoring user file data to
5910 * regions of the file that look like holes.
5911 *
5912 * The "old behavior" (from XFS_IOC_GETBMAP) is to not specify
5913 * BMV_IF_NO_DMAPI_READ so that read events are generated.
5914 * If this were not true, callers of ioctl( XFS_IOC_GETBMAP )
5915 * could misinterpret holes in a DMAPI file as true holes,
5916 * when in fact they may represent offline user data.
5917 */
5918 if ((iflags & BMV_IF_NO_DMAPI_READ) == 0 &&
5919 DM_EVENT_ENABLED(ip, DM_EVENT_READ) &&
5920 whichfork == XFS_DATA_FORK) {
5921 error = XFS_SEND_DATA(mp, DM_EVENT_READ, ip, 0, 0, 0, NULL);
5922 if (error)
5923 return XFS_ERROR(error);
5924 }
5925
5926 if (whichfork == XFS_ATTR_FORK) { 5905 if (whichfork == XFS_ATTR_FORK) {
5927 if (XFS_IFORK_Q(ip)) { 5906 if (XFS_IFORK_Q(ip)) {
5928 if (ip->i_d.di_aformat != XFS_DINODE_FMT_EXTENTS && 5907 if (ip->i_d.di_aformat != XFS_DINODE_FMT_EXTENTS &&
@@ -5936,11 +5915,37 @@ xfs_getbmap(
5936 ip->i_mount); 5915 ip->i_mount);
5937 return XFS_ERROR(EFSCORRUPTED); 5916 return XFS_ERROR(EFSCORRUPTED);
5938 } 5917 }
5939 } else if (ip->i_d.di_format != XFS_DINODE_FMT_EXTENTS && 5918
5940 ip->i_d.di_format != XFS_DINODE_FMT_BTREE && 5919 prealloced = 0;
5941 ip->i_d.di_format != XFS_DINODE_FMT_LOCAL) 5920 fixlen = 1LL << 32;
5942 return XFS_ERROR(EINVAL); 5921 } else {
5943 if (whichfork == XFS_DATA_FORK) { 5922 /*
5923 * If the BMV_IF_NO_DMAPI_READ interface bit specified, do
5924 * not generate a DMAPI read event. Otherwise, if the
5925 * DM_EVENT_READ bit is set for the file, generate a read
5926 * event in order that the DMAPI application may do its thing
5927 * before we return the extents. Usually this means restoring
5928 * user file data to regions of the file that look like holes.
5929 *
5930 * The "old behavior" (from XFS_IOC_GETBMAP) is to not specify
5931 * BMV_IF_NO_DMAPI_READ so that read events are generated.
5932 * If this were not true, callers of ioctl(XFS_IOC_GETBMAP)
5933 * could misinterpret holes in a DMAPI file as true holes,
5934 * when in fact they may represent offline user data.
5935 */
5936 if (DM_EVENT_ENABLED(ip, DM_EVENT_READ) &&
5937 !(iflags & BMV_IF_NO_DMAPI_READ)) {
5938 error = XFS_SEND_DATA(mp, DM_EVENT_READ, ip,
5939 0, 0, 0, NULL);
5940 if (error)
5941 return XFS_ERROR(error);
5942 }
5943
5944 if (ip->i_d.di_format != XFS_DINODE_FMT_EXTENTS &&
5945 ip->i_d.di_format != XFS_DINODE_FMT_BTREE &&
5946 ip->i_d.di_format != XFS_DINODE_FMT_LOCAL)
5947 return XFS_ERROR(EINVAL);
5948
5944 if (xfs_get_extsz_hint(ip) || 5949 if (xfs_get_extsz_hint(ip) ||
5945 ip->i_d.di_flags & (XFS_DIFLAG_PREALLOC|XFS_DIFLAG_APPEND)){ 5950 ip->i_d.di_flags & (XFS_DIFLAG_PREALLOC|XFS_DIFLAG_APPEND)){
5946 prealloced = 1; 5951 prealloced = 1;
@@ -5949,42 +5954,41 @@ xfs_getbmap(
5949 prealloced = 0; 5954 prealloced = 0;
5950 fixlen = ip->i_size; 5955 fixlen = ip->i_size;
5951 } 5956 }
5952 } else {
5953 prealloced = 0;
5954 fixlen = 1LL << 32;
5955 } 5957 }
5956 5958
5957 if (bmv->bmv_length == -1) { 5959 if (bmv->bmv_length == -1) {
5958 fixlen = XFS_FSB_TO_BB(mp, XFS_B_TO_FSB(mp, fixlen)); 5960 fixlen = XFS_FSB_TO_BB(mp, XFS_B_TO_FSB(mp, fixlen));
5959 bmv->bmv_length = MAX( (__int64_t)(fixlen - bmv->bmv_offset), 5961 bmv->bmv_length =
5960 (__int64_t)0); 5962 max_t(__int64_t, fixlen - bmv->bmv_offset, 0);
5961 } else if (bmv->bmv_length < 0) 5963 } else if (bmv->bmv_length == 0) {
5962 return XFS_ERROR(EINVAL);
5963 if (bmv->bmv_length == 0) {
5964 bmv->bmv_entries = 0; 5964 bmv->bmv_entries = 0;
5965 return 0; 5965 return 0;
5966 } else if (bmv->bmv_length < 0) {
5967 return XFS_ERROR(EINVAL);
5966 } 5968 }
5969
5967 nex = bmv->bmv_count - 1; 5970 nex = bmv->bmv_count - 1;
5968 if (nex <= 0) 5971 if (nex <= 0)
5969 return XFS_ERROR(EINVAL); 5972 return XFS_ERROR(EINVAL);
5970 bmvend = bmv->bmv_offset + bmv->bmv_length; 5973 bmvend = bmv->bmv_offset + bmv->bmv_length;
5971 5974
5972 xfs_ilock(ip, XFS_IOLOCK_SHARED);
5973 5975
5974 if (((iflags & BMV_IF_DELALLOC) == 0) && 5976 if (bmv->bmv_count > ULONG_MAX / sizeof(struct getbmapx))
5975 (whichfork == XFS_DATA_FORK) && 5977 return XFS_ERROR(ENOMEM);
5976 (ip->i_delayed_blks || ip->i_size > ip->i_d.di_size)) { 5978 out = kmem_zalloc(bmv->bmv_count * sizeof(struct getbmapx), KM_MAYFAIL);
5977 /* xfs_fsize_t last_byte = xfs_file_last_byte(ip); */ 5979 if (!out)
5978 error = xfs_flush_pages(ip, (xfs_off_t)0, 5980 return XFS_ERROR(ENOMEM);
5979 -1, 0, FI_REMAPF); 5981
5980 if (error) { 5982 xfs_ilock(ip, XFS_IOLOCK_SHARED);
5981 xfs_iunlock(ip, XFS_IOLOCK_SHARED); 5983 if (whichfork == XFS_DATA_FORK && !(iflags & BMV_IF_DELALLOC)) {
5982 return error; 5984 if (ip->i_delayed_blks || ip->i_size > ip->i_d.di_size) {
5985 error = xfs_flush_pages(ip, 0, -1, 0, FI_REMAPF);
5986 if (error)
5987 goto out_unlock_iolock;
5983 } 5988 }
5984 }
5985 5989
5986 ASSERT(whichfork == XFS_ATTR_FORK || (iflags & BMV_IF_DELALLOC) || 5990 ASSERT(ip->i_delayed_blks == 0);
5987 ip->i_delayed_blks == 0); 5991 }
5988 5992
5989 lock = xfs_ilock_map_shared(ip); 5993 lock = xfs_ilock_map_shared(ip);
5990 5994
@@ -5995,23 +5999,25 @@ xfs_getbmap(
5995 if (nex > XFS_IFORK_NEXTENTS(ip, whichfork) * 2 + 1) 5999 if (nex > XFS_IFORK_NEXTENTS(ip, whichfork) * 2 + 1)
5996 nex = XFS_IFORK_NEXTENTS(ip, whichfork) * 2 + 1; 6000 nex = XFS_IFORK_NEXTENTS(ip, whichfork) * 2 + 1;
5997 6001
5998 bmapi_flags = xfs_bmapi_aflag(whichfork) | 6002 bmapi_flags = xfs_bmapi_aflag(whichfork);
5999 ((iflags & BMV_IF_PREALLOC) ? 0 : XFS_BMAPI_IGSTATE); 6003 if (!(iflags & BMV_IF_PREALLOC))
6004 bmapi_flags |= XFS_BMAPI_IGSTATE;
6000 6005
6001 /* 6006 /*
6002 * Allocate enough space to handle "subnex" maps at a time. 6007 * Allocate enough space to handle "subnex" maps at a time.
6003 */ 6008 */
6009 error = ENOMEM;
6004 subnex = 16; 6010 subnex = 16;
6005 map = kmem_alloc(subnex * sizeof(*map), KM_SLEEP); 6011 map = kmem_alloc(subnex * sizeof(*map), KM_MAYFAIL);
6012 if (!map)
6013 goto out_unlock_ilock;
6006 6014
6007 bmv->bmv_entries = 0; 6015 bmv->bmv_entries = 0;
6008 6016
6009 if ((XFS_IFORK_NEXTENTS(ip, whichfork) == 0)) { 6017 if (XFS_IFORK_NEXTENTS(ip, whichfork) == 0 &&
6010 if (((iflags & BMV_IF_DELALLOC) == 0) || 6018 (whichfork == XFS_ATTR_FORK || !(iflags & BMV_IF_DELALLOC))) {
6011 whichfork == XFS_ATTR_FORK) { 6019 error = 0;
6012 error = 0; 6020 goto out_free_map;
6013 goto unlock_and_return;
6014 }
6015 } 6021 }
6016 6022
6017 nexleft = nex; 6023 nexleft = nex;
@@ -6023,53 +6029,61 @@ xfs_getbmap(
6023 bmapi_flags, NULL, 0, map, &nmap, 6029 bmapi_flags, NULL, 0, map, &nmap,
6024 NULL, NULL); 6030 NULL, NULL);
6025 if (error) 6031 if (error)
6026 goto unlock_and_return; 6032 goto out_free_map;
6027 ASSERT(nmap <= subnex); 6033 ASSERT(nmap <= subnex);
6028 6034
6029 for (i = 0; i < nmap && nexleft && bmv->bmv_length; i++) { 6035 for (i = 0; i < nmap && nexleft && bmv->bmv_length; i++) {
6030 out.bmv_oflags = 0; 6036 out[cur_ext].bmv_oflags = 0;
6031 if (map[i].br_state == XFS_EXT_UNWRITTEN) 6037 if (map[i].br_state == XFS_EXT_UNWRITTEN)
6032 out.bmv_oflags |= BMV_OF_PREALLOC; 6038 out[cur_ext].bmv_oflags |= BMV_OF_PREALLOC;
6033 else if (map[i].br_startblock == DELAYSTARTBLOCK) 6039 else if (map[i].br_startblock == DELAYSTARTBLOCK)
6034 out.bmv_oflags |= BMV_OF_DELALLOC; 6040 out[cur_ext].bmv_oflags |= BMV_OF_DELALLOC;
6035 out.bmv_offset = XFS_FSB_TO_BB(mp, map[i].br_startoff); 6041 out[cur_ext].bmv_offset =
6036 out.bmv_length = XFS_FSB_TO_BB(mp, map[i].br_blockcount); 6042 XFS_FSB_TO_BB(mp, map[i].br_startoff);
6037 out.bmv_unused1 = out.bmv_unused2 = 0; 6043 out[cur_ext].bmv_length =
6044 XFS_FSB_TO_BB(mp, map[i].br_blockcount);
6045 out[cur_ext].bmv_unused1 = 0;
6046 out[cur_ext].bmv_unused2 = 0;
6038 ASSERT(((iflags & BMV_IF_DELALLOC) != 0) || 6047 ASSERT(((iflags & BMV_IF_DELALLOC) != 0) ||
6039 (map[i].br_startblock != DELAYSTARTBLOCK)); 6048 (map[i].br_startblock != DELAYSTARTBLOCK));
6040 if (map[i].br_startblock == HOLESTARTBLOCK && 6049 if (map[i].br_startblock == HOLESTARTBLOCK &&
6041 whichfork == XFS_ATTR_FORK) { 6050 whichfork == XFS_ATTR_FORK) {
6042 /* came to the end of attribute fork */ 6051 /* came to the end of attribute fork */
6043 out.bmv_oflags |= BMV_OF_LAST; 6052 out[cur_ext].bmv_oflags |= BMV_OF_LAST;
6044 goto unlock_and_return; 6053 goto out_free_map;
6045 } else {
6046 int full = 0; /* user array is full */
6047
6048 if (!xfs_getbmapx_fix_eof_hole(ip, &out,
6049 prealloced, bmvend,
6050 map[i].br_startblock)) {
6051 goto unlock_and_return;
6052 }
6053
6054 /* format results & advance arg */
6055 error = formatter(&arg, &out, &full);
6056 if (error || full)
6057 goto unlock_and_return;
6058 nexleft--;
6059 bmv->bmv_offset =
6060 out.bmv_offset + out.bmv_length;
6061 bmv->bmv_length = MAX((__int64_t)0,
6062 (__int64_t)(bmvend - bmv->bmv_offset));
6063 bmv->bmv_entries++;
6064 } 6054 }
6055
6056 if (!xfs_getbmapx_fix_eof_hole(ip, &out[cur_ext],
6057 prealloced, bmvend,
6058 map[i].br_startblock))
6059 goto out_free_map;
6060
6061 nexleft--;
6062 bmv->bmv_offset =
6063 out[cur_ext].bmv_offset +
6064 out[cur_ext].bmv_length;
6065 bmv->bmv_length =
6066 max_t(__int64_t, 0, bmvend - bmv->bmv_offset);
6067 bmv->bmv_entries++;
6068 cur_ext++;
6065 } 6069 }
6066 } while (nmap && nexleft && bmv->bmv_length); 6070 } while (nmap && nexleft && bmv->bmv_length);
6067 6071
6068unlock_and_return: 6072 out_free_map:
6073 kmem_free(map);
6074 out_unlock_ilock:
6069 xfs_iunlock_map_shared(ip, lock); 6075 xfs_iunlock_map_shared(ip, lock);
6076 out_unlock_iolock:
6070 xfs_iunlock(ip, XFS_IOLOCK_SHARED); 6077 xfs_iunlock(ip, XFS_IOLOCK_SHARED);
6071 6078
6072 kmem_free(map); 6079 for (i = 0; i < cur_ext; i++) {
6080 int full = 0; /* user array is full */
6081
6082 /* format results & advance arg */
6083 error = formatter(&arg, &out[i], &full);
6084 if (error || full)
6085 break;
6086 }
6073 6087
6074 return error; 6088 return error;
6075} 6089}
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index e7ae08d1df4..123b20c8cbf 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -1258,8 +1258,10 @@ xfs_file_last_byte(
1258 * necessary. 1258 * necessary.
1259 */ 1259 */
1260 if (ip->i_df.if_flags & XFS_IFEXTENTS) { 1260 if (ip->i_df.if_flags & XFS_IFEXTENTS) {
1261 xfs_ilock(ip, XFS_ILOCK_SHARED);
1261 error = xfs_bmap_last_offset(NULL, ip, &last_block, 1262 error = xfs_bmap_last_offset(NULL, ip, &last_block,
1262 XFS_DATA_FORK); 1263 XFS_DATA_FORK);
1264 xfs_iunlock(ip, XFS_ILOCK_SHARED);
1263 if (error) { 1265 if (error) {
1264 last_block = 0; 1266 last_block = 0;
1265 } 1267 }
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index b101990df02..65a99725d0c 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -291,14 +291,17 @@ xfs_mount_validate_sb(
291 sbp->sb_sectsize > XFS_MAX_SECTORSIZE || 291 sbp->sb_sectsize > XFS_MAX_SECTORSIZE ||
292 sbp->sb_sectlog < XFS_MIN_SECTORSIZE_LOG || 292 sbp->sb_sectlog < XFS_MIN_SECTORSIZE_LOG ||
293 sbp->sb_sectlog > XFS_MAX_SECTORSIZE_LOG || 293 sbp->sb_sectlog > XFS_MAX_SECTORSIZE_LOG ||
294 sbp->sb_sectsize != (1 << sbp->sb_sectlog) ||
294 sbp->sb_blocksize < XFS_MIN_BLOCKSIZE || 295 sbp->sb_blocksize < XFS_MIN_BLOCKSIZE ||
295 sbp->sb_blocksize > XFS_MAX_BLOCKSIZE || 296 sbp->sb_blocksize > XFS_MAX_BLOCKSIZE ||
296 sbp->sb_blocklog < XFS_MIN_BLOCKSIZE_LOG || 297 sbp->sb_blocklog < XFS_MIN_BLOCKSIZE_LOG ||
297 sbp->sb_blocklog > XFS_MAX_BLOCKSIZE_LOG || 298 sbp->sb_blocklog > XFS_MAX_BLOCKSIZE_LOG ||
299 sbp->sb_blocksize != (1 << sbp->sb_blocklog) ||
298 sbp->sb_inodesize < XFS_DINODE_MIN_SIZE || 300 sbp->sb_inodesize < XFS_DINODE_MIN_SIZE ||
299 sbp->sb_inodesize > XFS_DINODE_MAX_SIZE || 301 sbp->sb_inodesize > XFS_DINODE_MAX_SIZE ||
300 sbp->sb_inodelog < XFS_DINODE_MIN_LOG || 302 sbp->sb_inodelog < XFS_DINODE_MIN_LOG ||
301 sbp->sb_inodelog > XFS_DINODE_MAX_LOG || 303 sbp->sb_inodelog > XFS_DINODE_MAX_LOG ||
304 sbp->sb_inodesize != (1 << sbp->sb_inodelog) ||
302 (sbp->sb_blocklog - sbp->sb_inodelog != sbp->sb_inopblog) || 305 (sbp->sb_blocklog - sbp->sb_inodelog != sbp->sb_inopblog) ||
303 (sbp->sb_rextsize * sbp->sb_blocksize > XFS_MAX_RTEXTSIZE) || 306 (sbp->sb_rextsize * sbp->sb_blocksize > XFS_MAX_RTEXTSIZE) ||
304 (sbp->sb_rextsize * sbp->sb_blocksize < XFS_MIN_RTEXTSIZE) || 307 (sbp->sb_rextsize * sbp->sb_blocksize < XFS_MIN_RTEXTSIZE) ||
diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h
index 7abdaa91ccd..3673a13b670 100644
--- a/include/asm-generic/atomic.h
+++ b/include/asm-generic/atomic.h
@@ -132,9 +132,9 @@ static inline long atomic_long_add_unless(atomic_long_t *l, long a, long u)
132#define atomic_long_inc_not_zero(l) atomic64_inc_not_zero((atomic64_t *)(l)) 132#define atomic_long_inc_not_zero(l) atomic64_inc_not_zero((atomic64_t *)(l))
133 133
134#define atomic_long_cmpxchg(l, old, new) \ 134#define atomic_long_cmpxchg(l, old, new) \
135 (atomic_cmpxchg((atomic64_t *)(l), (old), (new))) 135 (atomic64_cmpxchg((atomic64_t *)(l), (old), (new)))
136#define atomic_long_xchg(v, new) \ 136#define atomic_long_xchg(v, new) \
137 (atomic_xchg((atomic64_t *)(l), (new))) 137 (atomic64_xchg((atomic64_t *)(l), (new)))
138 138
139#else /* BITS_PER_LONG == 64 */ 139#else /* BITS_PER_LONG == 64 */
140 140
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index 6638b8148de..61ee18c1bdb 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -82,7 +82,19 @@ struct linux_binfmt {
82 int hasvdso; 82 int hasvdso;
83}; 83};
84 84
85extern int register_binfmt(struct linux_binfmt *); 85extern int __register_binfmt(struct linux_binfmt *fmt, int insert);
86
87/* Registration of default binfmt handlers */
88static inline int register_binfmt(struct linux_binfmt *fmt)
89{
90 return __register_binfmt(fmt, 0);
91}
92/* Same as above, but adds a new binfmt at the top of the list */
93static inline int insert_binfmt(struct linux_binfmt *fmt)
94{
95 return __register_binfmt(fmt, 1);
96}
97
86extern void unregister_binfmt(struct linux_binfmt *); 98extern void unregister_binfmt(struct linux_binfmt *);
87 99
88extern int prepare_binprm(struct linux_binprm *); 100extern int prepare_binprm(struct linux_binprm *);
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 2755d5c6da2..b4f71f1a4af 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -601,6 +601,7 @@ enum {
601 blk_failfast_driver(rq)) 601 blk_failfast_driver(rq))
602#define blk_rq_started(rq) ((rq)->cmd_flags & REQ_STARTED) 602#define blk_rq_started(rq) ((rq)->cmd_flags & REQ_STARTED)
603#define blk_rq_io_stat(rq) ((rq)->cmd_flags & REQ_IO_STAT) 603#define blk_rq_io_stat(rq) ((rq)->cmd_flags & REQ_IO_STAT)
604#define blk_rq_quiet(rq) ((rq)->cmd_flags & REQ_QUIET)
604 605
605#define blk_account_rq(rq) (blk_rq_started(rq) && (blk_fs_request(rq) || blk_discard_rq(rq))) 606#define blk_account_rq(rq) (blk_rq_started(rq) && (blk_fs_request(rq) || blk_discard_rq(rq)))
606 607
diff --git a/include/linux/input.h b/include/linux/input.h
index 6b28048fc56..0e6ff5de358 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -106,6 +106,7 @@ struct input_absinfo {
106 106
107#define SYN_REPORT 0 107#define SYN_REPORT 0
108#define SYN_CONFIG 1 108#define SYN_CONFIG 1
109#define SYN_MT_REPORT 2
109 110
110/* 111/*
111 * Keys and buttons 112 * Keys and buttons
@@ -445,6 +446,7 @@ struct input_absinfo {
445#define BTN_STYLUS2 0x14c 446#define BTN_STYLUS2 0x14c
446#define BTN_TOOL_DOUBLETAP 0x14d 447#define BTN_TOOL_DOUBLETAP 0x14d
447#define BTN_TOOL_TRIPLETAP 0x14e 448#define BTN_TOOL_TRIPLETAP 0x14e
449#define BTN_TOOL_QUADTAP 0x14f /* Four fingers on trackpad */
448 450
449#define BTN_WHEEL 0x150 451#define BTN_WHEEL 0x150
450#define BTN_GEAR_DOWN 0x150 452#define BTN_GEAR_DOWN 0x150
@@ -644,6 +646,17 @@ struct input_absinfo {
644#define ABS_TOOL_WIDTH 0x1c 646#define ABS_TOOL_WIDTH 0x1c
645#define ABS_VOLUME 0x20 647#define ABS_VOLUME 0x20
646#define ABS_MISC 0x28 648#define ABS_MISC 0x28
649
650#define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */
651#define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */
652#define ABS_MT_WIDTH_MAJOR 0x32 /* Major axis of approaching ellipse */
653#define ABS_MT_WIDTH_MINOR 0x33 /* Minor axis (omit if circular) */
654#define ABS_MT_ORIENTATION 0x34 /* Ellipse orientation */
655#define ABS_MT_POSITION_X 0x35 /* Center X ellipse position */
656#define ABS_MT_POSITION_Y 0x36 /* Center Y ellipse position */
657#define ABS_MT_TOOL_TYPE 0x37 /* Type of touching device */
658#define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */
659
647#define ABS_MAX 0x3f 660#define ABS_MAX 0x3f
648#define ABS_CNT (ABS_MAX+1) 661#define ABS_CNT (ABS_MAX+1)
649 662
@@ -743,6 +756,12 @@ struct input_absinfo {
743#define BUS_ATARI 0x1B 756#define BUS_ATARI 0x1B
744 757
745/* 758/*
759 * MT_TOOL types
760 */
761#define MT_TOOL_FINGER 0
762#define MT_TOOL_PEN 1
763
764/*
746 * Values describing the status of a force-feedback effect 765 * Values describing the status of a force-feedback effect
747 */ 766 */
748#define FF_STATUS_STOPPED 0x00 767#define FF_STATUS_STOPPED 0x00
@@ -1311,6 +1330,11 @@ static inline void input_sync(struct input_dev *dev)
1311 input_event(dev, EV_SYN, SYN_REPORT, 0); 1330 input_event(dev, EV_SYN, SYN_REPORT, 0);
1312} 1331}
1313 1332
1333static inline void input_mt_sync(struct input_dev *dev)
1334{
1335 input_event(dev, EV_SYN, SYN_MT_REPORT, 0);
1336}
1337
1314void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int code); 1338void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int code);
1315 1339
1316static inline void input_set_abs_params(struct input_dev *dev, int axis, int min, int max, int fuzz, int flat) 1340static inline void input_set_abs_params(struct input_dev *dev, int axis, int min, int max, int fuzz, int flat)
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index a9e3b76aa88..25b9ca93d23 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -56,7 +56,7 @@ extern void mem_cgroup_move_lists(struct page *page,
56 enum lru_list from, enum lru_list to); 56 enum lru_list from, enum lru_list to);
57extern void mem_cgroup_uncharge_page(struct page *page); 57extern void mem_cgroup_uncharge_page(struct page *page);
58extern void mem_cgroup_uncharge_cache_page(struct page *page); 58extern void mem_cgroup_uncharge_cache_page(struct page *page);
59extern int mem_cgroup_shrink_usage(struct page *page, 59extern int mem_cgroup_shmem_charge_fallback(struct page *page,
60 struct mm_struct *mm, gfp_t gfp_mask); 60 struct mm_struct *mm, gfp_t gfp_mask);
61 61
62extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan, 62extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
@@ -155,7 +155,7 @@ static inline void mem_cgroup_uncharge_cache_page(struct page *page)
155{ 155{
156} 156}
157 157
158static inline int mem_cgroup_shrink_usage(struct page *page, 158static inline int mem_cgroup_shmem_charge_fallback(struct page *page,
159 struct mm_struct *mm, gfp_t gfp_mask) 159 struct mm_struct *mm, gfp_t gfp_mask)
160{ 160{
161 return 0; 161 return 0;
diff --git a/include/linux/mman.h b/include/linux/mman.h
index 30d1073bac3..9872d6ca58a 100644
--- a/include/linux/mman.h
+++ b/include/linux/mman.h
@@ -12,21 +12,18 @@
12 12
13#ifdef __KERNEL__ 13#ifdef __KERNEL__
14#include <linux/mm.h> 14#include <linux/mm.h>
15#include <linux/percpu_counter.h>
15 16
16#include <asm/atomic.h> 17#include <asm/atomic.h>
17 18
18extern int sysctl_overcommit_memory; 19extern int sysctl_overcommit_memory;
19extern int sysctl_overcommit_ratio; 20extern int sysctl_overcommit_ratio;
20extern atomic_long_t vm_committed_space; 21extern struct percpu_counter vm_committed_as;
21 22
22#ifdef CONFIG_SMP
23extern void vm_acct_memory(long pages);
24#else
25static inline void vm_acct_memory(long pages) 23static inline void vm_acct_memory(long pages)
26{ 24{
27 atomic_long_add(pages, &vm_committed_space); 25 percpu_counter_add(&vm_committed_as, pages);
28} 26}
29#endif
30 27
31static inline void vm_unacct_memory(long pages) 28static inline void vm_unacct_memory(long pages)
32{ 29{
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index 3d327b67d7e..90840665133 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -51,6 +51,16 @@ extern int of_register_driver(struct of_platform_driver *drv,
51 struct bus_type *bus); 51 struct bus_type *bus);
52extern void of_unregister_driver(struct of_platform_driver *drv); 52extern void of_unregister_driver(struct of_platform_driver *drv);
53 53
54/* Platform drivers register/unregister */
55static inline int of_register_platform_driver(struct of_platform_driver *drv)
56{
57 return of_register_driver(drv, &of_platform_bus_type);
58}
59static inline void of_unregister_platform_driver(struct of_platform_driver *drv)
60{
61 of_unregister_driver(drv);
62}
63
54#include <asm/of_platform.h> 64#include <asm/of_platform.h>
55 65
56extern struct of_device *of_find_device_by_node(struct device_node *np); 66extern struct of_device *of_find_device_by_node(struct device_node *np);
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 1758d9f5b5c..08afe43118f 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -261,6 +261,7 @@ void xprt_conditional_disconnect(struct rpc_xprt *xprt, unsigned int cookie);
261#define XPRT_BINDING (5) 261#define XPRT_BINDING (5)
262#define XPRT_CLOSING (6) 262#define XPRT_CLOSING (6)
263#define XPRT_CONNECTION_ABORT (7) 263#define XPRT_CONNECTION_ABORT (7)
264#define XPRT_CONNECTION_CLOSE (8)
264 265
265static inline void xprt_set_connected(struct rpc_xprt *xprt) 266static inline void xprt_set_connected(struct rpc_xprt *xprt)
266{ 267{
diff --git a/include/net/9p/client.h b/include/net/9p/client.h
index 4012e07162e..e26812274b7 100644
--- a/include/net/9p/client.h
+++ b/include/net/9p/client.h
@@ -98,7 +98,6 @@ enum p9_req_status_t {
98struct p9_req_t { 98struct p9_req_t {
99 int status; 99 int status;
100 int t_err; 100 int t_err;
101 u16 flush_tag;
102 wait_queue_head_t *wq; 101 wait_queue_head_t *wq;
103 struct p9_fcall *tc; 102 struct p9_fcall *tc;
104 struct p9_fcall *rc; 103 struct p9_fcall *rc;
diff --git a/include/scsi/fc/fc_fs.h b/include/scsi/fc/fc_fs.h
index 1b7af3a64c7..ac4cd38c860 100644
--- a/include/scsi/fc/fc_fs.h
+++ b/include/scsi/fc/fc_fs.h
@@ -149,6 +149,7 @@ enum fc_rctl {
149 * Well-known fabric addresses. 149 * Well-known fabric addresses.
150 */ 150 */
151enum fc_well_known_fid { 151enum fc_well_known_fid {
152 FC_FID_NONE = 0x000000, /* No destination */
152 FC_FID_BCAST = 0xffffff, /* broadcast */ 153 FC_FID_BCAST = 0xffffff, /* broadcast */
153 FC_FID_FLOGI = 0xfffffe, /* fabric login */ 154 FC_FID_FLOGI = 0xfffffe, /* fabric login */
154 FC_FID_FCTRL = 0xfffffd, /* fabric controller */ 155 FC_FID_FCTRL = 0xfffffd, /* fabric controller */
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index 0303a6a098c..45f9cc642c4 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -637,6 +637,7 @@ struct fc_disc {
637 enum fc_disc_event); 637 enum fc_disc_event);
638 638
639 struct list_head rports; 639 struct list_head rports;
640 struct list_head rogue_rports;
640 struct fc_lport *lport; 641 struct fc_lport *lport;
641 struct mutex disc_mutex; 642 struct mutex disc_mutex;
642 struct fc_gpn_ft_resp partial_buf; /* partial name buffer */ 643 struct fc_gpn_ft_resp partial_buf; /* partial name buffer */
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index 7ffaed2f94d..0289f5745fb 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -36,6 +36,7 @@ struct scsi_transport_template;
36struct scsi_host_template; 36struct scsi_host_template;
37struct scsi_device; 37struct scsi_device;
38struct Scsi_Host; 38struct Scsi_Host;
39struct scsi_target;
39struct scsi_cmnd; 40struct scsi_cmnd;
40struct socket; 41struct socket;
41struct iscsi_transport; 42struct iscsi_transport;
@@ -350,6 +351,7 @@ extern struct Scsi_Host *iscsi_host_alloc(struct scsi_host_template *sht,
350 bool xmit_can_sleep); 351 bool xmit_can_sleep);
351extern void iscsi_host_remove(struct Scsi_Host *shost); 352extern void iscsi_host_remove(struct Scsi_Host *shost);
352extern void iscsi_host_free(struct Scsi_Host *shost); 353extern void iscsi_host_free(struct Scsi_Host *shost);
354extern int iscsi_target_alloc(struct scsi_target *starget);
353 355
354/* 356/*
355 * session management 357 * session management
diff --git a/include/scsi/osd_protocol.h b/include/scsi/osd_protocol.h
index cd3cbf76465..62b2ab8c69d 100644
--- a/include/scsi/osd_protocol.h
+++ b/include/scsi/osd_protocol.h
@@ -24,17 +24,18 @@ enum {
24 OSDv1_ADDITIONAL_CDB_LENGTH = 192, 24 OSDv1_ADDITIONAL_CDB_LENGTH = 192,
25 OSDv1_TOTAL_CDB_LEN = OSDv1_ADDITIONAL_CDB_LENGTH + 8, 25 OSDv1_TOTAL_CDB_LEN = OSDv1_ADDITIONAL_CDB_LENGTH + 8,
26 OSDv1_CAP_LEN = 80, 26 OSDv1_CAP_LEN = 80,
27
27 /* Latest supported version */ 28 /* Latest supported version */
28/* OSD_ADDITIONAL_CDB_LENGTH = 216,*/ 29 OSDv2_ADDITIONAL_CDB_LENGTH = 228,
29 OSD_ADDITIONAL_CDB_LENGTH = 30 OSD_ADDITIONAL_CDB_LENGTH =
30 OSDv1_ADDITIONAL_CDB_LENGTH, /* FIXME: Pete rev-001 sup */ 31 OSDv2_ADDITIONAL_CDB_LENGTH,
31 OSD_TOTAL_CDB_LEN = OSD_ADDITIONAL_CDB_LENGTH + 8, 32 OSD_TOTAL_CDB_LEN = OSD_ADDITIONAL_CDB_LENGTH + 8,
32/* OSD_CAP_LEN = 104,*/ 33 OSD_CAP_LEN = 104,
33 OSD_CAP_LEN = OSDv1_CAP_LEN,/* FIXME: Pete rev-001 sup */
34 34
35 OSD_SYSTEMID_LEN = 20, 35 OSD_SYSTEMID_LEN = 20,
36 OSD_CRYPTO_KEYID_SIZE = 20, 36 OSDv1_CRYPTO_KEYID_SIZE = 20,
37 /*FIXME: OSDv2_CRYPTO_KEYID_SIZE = 32,*/ 37 OSDv2_CRYPTO_KEYID_SIZE = 32,
38 OSD_CRYPTO_KEYID_SIZE = OSDv2_CRYPTO_KEYID_SIZE,
38 OSD_CRYPTO_SEED_SIZE = 4, 39 OSD_CRYPTO_SEED_SIZE = 4,
39 OSD_CRYPTO_NONCE_SIZE = 12, 40 OSD_CRYPTO_NONCE_SIZE = 12,
40 OSD_MAX_SENSE_LEN = 252, /* from SPC-3 */ 41 OSD_MAX_SENSE_LEN = 252, /* from SPC-3 */
@@ -164,7 +165,11 @@ struct osd_cdb_head {
164 /* called allocation_length in some commands */ 165 /* called allocation_length in some commands */
165/*32*/ __be64 length; 166/*32*/ __be64 length;
166/*40*/ __be64 start_address; 167/*40*/ __be64 start_address;
167/*48*/ __be32 list_identifier;/* Rarely used */ 168 union {
169/*48*/ __be32 list_identifier;/* Rarely used */
170 /* OSD2r05 5.2.5 CDB continuation length */
171/*48*/ __be32 cdb_continuation_length;
172 };
168 } __packed v2; 173 } __packed v2;
169 }; 174 };
170/*52*/ union { /* selected attributes mode Page/List/Single */ 175/*52*/ union { /* selected attributes mode Page/List/Single */
@@ -204,29 +209,40 @@ struct osd_cdb_head {
204/*80*/ 209/*80*/
205 210
206/*160 v1*/ 211/*160 v1*/
207/*184 v2*/ 212struct osdv1_security_parameters {
208struct osd_security_parameters { 213/*160*/u8 integrity_check_value[OSDv1_CRYPTO_KEYID_SIZE];
209/*160*/u8 integrity_check_value[OSD_CRYPTO_KEYID_SIZE];
210/*180*/u8 request_nonce[OSD_CRYPTO_NONCE_SIZE]; 214/*180*/u8 request_nonce[OSD_CRYPTO_NONCE_SIZE];
211/*192*/osd_cdb_offset data_in_integrity_check_offset; 215/*192*/osd_cdb_offset data_in_integrity_check_offset;
212/*196*/osd_cdb_offset data_out_integrity_check_offset; 216/*196*/osd_cdb_offset data_out_integrity_check_offset;
213} __packed; 217} __packed;
214/*200 v1*/ 218/*200 v1*/
215/*224 v2*/
216 219
217/* FIXME: osdv2_security_parameters */ 220/*184 v2*/
221struct osdv2_security_parameters {
222/*184*/u8 integrity_check_value[OSDv2_CRYPTO_KEYID_SIZE];
223/*216*/u8 request_nonce[OSD_CRYPTO_NONCE_SIZE];
224/*228*/osd_cdb_offset data_in_integrity_check_offset;
225/*232*/osd_cdb_offset data_out_integrity_check_offset;
226} __packed;
227/*236 v2*/
228
229struct osd_security_parameters {
230 union {
231 struct osdv1_security_parameters v1;
232 struct osdv2_security_parameters v2;
233 };
234};
218 235
219struct osdv1_cdb { 236struct osdv1_cdb {
220 struct osd_cdb_head h; 237 struct osd_cdb_head h;
221 u8 caps[OSDv1_CAP_LEN]; 238 u8 caps[OSDv1_CAP_LEN];
222 struct osd_security_parameters sec_params; 239 struct osdv1_security_parameters sec_params;
223} __packed; 240} __packed;
224 241
225struct osdv2_cdb { 242struct osdv2_cdb {
226 struct osd_cdb_head h; 243 struct osd_cdb_head h;
227 u8 caps[OSD_CAP_LEN]; 244 u8 caps[OSD_CAP_LEN];
228 struct osd_security_parameters sec_params; 245 struct osdv2_security_parameters sec_params;
229 /* FIXME: osdv2_security_parameters */
230} __packed; 246} __packed;
231 247
232struct osd_cdb { 248struct osd_cdb {
@@ -301,14 +317,25 @@ struct osd_attributes_list_attrid {
301} __packed; 317} __packed;
302 318
303/* 319/*
320 * NOTE: v1: is not aligned.
321 */
322struct osdv1_attributes_list_element {
323 __be32 attr_page;
324 __be32 attr_id;
325 __be16 attr_bytes; /* valid bytes at attr_val without padding */
326 u8 attr_val[0];
327} __packed;
328
329/*
304 * osd2r03: 7.1.3.3 List entry format for retrieved attributes and 330 * osd2r03: 7.1.3.3 List entry format for retrieved attributes and
305 * for setting attributes 331 * for setting attributes
306 * NOTE: v2 is 8-bytes aligned, v1 is not aligned. 332 * NOTE: v2 is 8-bytes aligned
307 */ 333 */
308struct osd_attributes_list_element { 334struct osdv2_attributes_list_element {
309 __be32 attr_page; 335 __be32 attr_page;
310 __be32 attr_id; 336 __be32 attr_id;
311 __be16 attr_bytes; 337 u8 reserved[6];
338 __be16 attr_bytes; /* valid bytes at attr_val without padding */
312 u8 attr_val[0]; 339 u8 attr_val[0];
313} __packed; 340} __packed;
314 341
@@ -324,13 +351,13 @@ enum {
324 351
325static inline unsigned osdv1_attr_list_elem_size(unsigned len) 352static inline unsigned osdv1_attr_list_elem_size(unsigned len)
326{ 353{
327 return ALIGN(len + sizeof(struct osd_attributes_list_element), 354 return ALIGN(len + sizeof(struct osdv1_attributes_list_element),
328 OSDv1_ATTRIBUTES_ELEM_ALIGN); 355 OSDv1_ATTRIBUTES_ELEM_ALIGN);
329} 356}
330 357
331static inline unsigned osdv2_attr_list_elem_size(unsigned len) 358static inline unsigned osdv2_attr_list_elem_size(unsigned len)
332{ 359{
333 return ALIGN(len + sizeof(struct osd_attributes_list_element), 360 return ALIGN(len + sizeof(struct osdv2_attributes_list_element),
334 OSD_ATTRIBUTES_ELEM_ALIGN); 361 OSD_ATTRIBUTES_ELEM_ALIGN);
335} 362}
336 363
@@ -419,15 +446,35 @@ struct osd_data_out_integrity_info {
419 __be64 data_bytes; 446 __be64 data_bytes;
420 __be64 set_attributes_bytes; 447 __be64 set_attributes_bytes;
421 __be64 get_attributes_bytes; 448 __be64 get_attributes_bytes;
422 __be64 integrity_check_value; 449 __u8 integrity_check_value[OSD_CRYPTO_KEYID_SIZE];
423} __packed; 450} __packed;
424 451
452/* Same osd_data_out_integrity_info is used for OSD2/OSD1. The only difference
453 * Is the sizeof the structure since in OSD1 the last array is smaller. Use
454 * below for version independent handling of this structure
455 */
456static inline int osd_data_out_integrity_info_sizeof(bool is_ver1)
457{
458 return sizeof(struct osd_data_out_integrity_info) -
459 (is_ver1 * (OSDv2_CRYPTO_KEYID_SIZE - OSDv1_CRYPTO_KEYID_SIZE));
460}
461
425struct osd_data_in_integrity_info { 462struct osd_data_in_integrity_info {
426 __be64 data_bytes; 463 __be64 data_bytes;
427 __be64 retrieved_attributes_bytes; 464 __be64 retrieved_attributes_bytes;
428 __be64 integrity_check_value; 465 __u8 integrity_check_value[OSD_CRYPTO_KEYID_SIZE];
429} __packed; 466} __packed;
430 467
468/* Same osd_data_in_integrity_info is used for OSD2/OSD1. The only difference
469 * Is the sizeof the structure since in OSD1 the last array is smaller. Use
470 * below for version independent handling of this structure
471 */
472static inline int osd_data_in_integrity_info_sizeof(bool is_ver1)
473{
474 return sizeof(struct osd_data_in_integrity_info) -
475 (is_ver1 * (OSDv2_CRYPTO_KEYID_SIZE - OSDv1_CRYPTO_KEYID_SIZE));
476}
477
431struct osd_timestamp { 478struct osd_timestamp {
432 u8 time[6]; /* number of milliseconds since 1/1/1970 UT (big endian) */ 479 u8 time[6]; /* number of milliseconds since 1/1/1970 UT (big endian) */
433} __packed; 480} __packed;
@@ -477,7 +524,7 @@ enum osd_capability_bit_masks {
477 524
478 OSD_SEC_CAP_NONE1 = BIT(8), 525 OSD_SEC_CAP_NONE1 = BIT(8),
479 OSD_SEC_CAP_NONE2 = BIT(9), 526 OSD_SEC_CAP_NONE2 = BIT(9),
480 OSD_SEC_CAP_NONE3 = BIT(10), 527 OSD_SEC_GBL_REM = BIT(10), /*v2 only*/
481 OSD_SEC_CAP_QUERY = BIT(11), /*v2 only*/ 528 OSD_SEC_CAP_QUERY = BIT(11), /*v2 only*/
482 OSD_SEC_CAP_M_OBJECT = BIT(12), /*v2 only*/ 529 OSD_SEC_CAP_M_OBJECT = BIT(12), /*v2 only*/
483 OSD_SEC_CAP_POL_SEC = BIT(13), 530 OSD_SEC_CAP_POL_SEC = BIT(13),
@@ -552,8 +599,7 @@ struct osdv1_capability {
552 599
553struct osd_capability { 600struct osd_capability {
554 struct osd_capability_head h; 601 struct osd_capability_head h;
555/* struct osd_cap_object_descriptor od;*/ 602 struct osd_cap_object_descriptor od;
556 struct osdv1_cap_object_descriptor od; /* FIXME: Pete rev-001 sup */
557} __packed; 603} __packed;
558 604
559/** 605/**
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index e3d2c7dd59b..ea78fa101ad 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -103,6 +103,9 @@ static unsigned long one_ul = 1;
103static int one_hundred = 100; 103static int one_hundred = 100;
104static int one_thousand = 1000; 104static int one_thousand = 1000;
105 105
106/* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
107static unsigned long dirty_bytes_min = 2 * PAGE_SIZE;
108
106/* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */ 109/* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
107static int maxolduid = 65535; 110static int maxolduid = 65535;
108static int minolduid; 111static int minolduid;
@@ -1006,7 +1009,7 @@ static struct ctl_table vm_table[] = {
1006 .mode = 0644, 1009 .mode = 0644,
1007 .proc_handler = &dirty_bytes_handler, 1010 .proc_handler = &dirty_bytes_handler,
1008 .strategy = &sysctl_intvec, 1011 .strategy = &sysctl_intvec,
1009 .extra1 = &one_ul, 1012 .extra1 = &dirty_bytes_min,
1010 }, 1013 },
1011 { 1014 {
1012 .procname = "dirty_writeback_centisecs", 1015 .procname = "dirty_writeback_centisecs",
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index e44fb0fbb80..01c2d8f1468 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1024,9 +1024,7 @@ static struct mem_cgroup *try_get_mem_cgroup_from_swapcache(struct page *page)
1024 return NULL; 1024 return NULL;
1025 1025
1026 pc = lookup_page_cgroup(page); 1026 pc = lookup_page_cgroup(page);
1027 /* 1027 lock_page_cgroup(pc);
1028 * Used bit of swapcache is solid under page lock.
1029 */
1030 if (PageCgroupUsed(pc)) { 1028 if (PageCgroupUsed(pc)) {
1031 mem = pc->mem_cgroup; 1029 mem = pc->mem_cgroup;
1032 if (mem && !css_tryget(&mem->css)) 1030 if (mem && !css_tryget(&mem->css))
@@ -1040,6 +1038,7 @@ static struct mem_cgroup *try_get_mem_cgroup_from_swapcache(struct page *page)
1040 mem = NULL; 1038 mem = NULL;
1041 rcu_read_unlock(); 1039 rcu_read_unlock();
1042 } 1040 }
1041 unlock_page_cgroup(pc);
1043 return mem; 1042 return mem;
1044} 1043}
1045 1044
@@ -1618,37 +1617,28 @@ void mem_cgroup_end_migration(struct mem_cgroup *mem,
1618} 1617}
1619 1618
1620/* 1619/*
1621 * A call to try to shrink memory usage under specified resource controller. 1620 * A call to try to shrink memory usage on charge failure at shmem's swapin.
1622 * This is typically used for page reclaiming for shmem for reducing side 1621 * Calling hierarchical_reclaim is not enough because we should update
1623 * effect of page allocation from shmem, which is used by some mem_cgroup. 1622 * last_oom_jiffies to prevent pagefault_out_of_memory from invoking global OOM.
1623 * Moreover considering hierarchy, we should reclaim from the mem_over_limit,
1624 * not from the memcg which this page would be charged to.
1625 * try_charge_swapin does all of these works properly.
1624 */ 1626 */
1625int mem_cgroup_shrink_usage(struct page *page, 1627int mem_cgroup_shmem_charge_fallback(struct page *page,
1626 struct mm_struct *mm, 1628 struct mm_struct *mm,
1627 gfp_t gfp_mask) 1629 gfp_t gfp_mask)
1628{ 1630{
1629 struct mem_cgroup *mem = NULL; 1631 struct mem_cgroup *mem = NULL;
1630 int progress = 0; 1632 int ret;
1631 int retry = MEM_CGROUP_RECLAIM_RETRIES;
1632 1633
1633 if (mem_cgroup_disabled()) 1634 if (mem_cgroup_disabled())
1634 return 0; 1635 return 0;
1635 if (page)
1636 mem = try_get_mem_cgroup_from_swapcache(page);
1637 if (!mem && mm)
1638 mem = try_get_mem_cgroup_from_mm(mm);
1639 if (unlikely(!mem))
1640 return 0;
1641 1636
1642 do { 1637 ret = mem_cgroup_try_charge_swapin(mm, page, gfp_mask, &mem);
1643 progress = mem_cgroup_hierarchical_reclaim(mem, 1638 if (!ret)
1644 gfp_mask, true, false); 1639 mem_cgroup_cancel_charge_swapin(mem); /* it does !mem check */
1645 progress += mem_cgroup_check_under_limit(mem);
1646 } while (!progress && --retry);
1647 1640
1648 css_put(&mem->css); 1641 return ret;
1649 if (!retry)
1650 return -ENOMEM;
1651 return 0;
1652} 1642}
1653 1643
1654static DEFINE_MUTEX(set_limit_mutex); 1644static DEFINE_MUTEX(set_limit_mutex);
diff --git a/mm/memory.c b/mm/memory.c
index cf6873e91c6..4126dd16778 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1971,6 +1971,15 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma,
1971 ret = tmp; 1971 ret = tmp;
1972 goto unwritable_page; 1972 goto unwritable_page;
1973 } 1973 }
1974 if (unlikely(!(tmp & VM_FAULT_LOCKED))) {
1975 lock_page(old_page);
1976 if (!old_page->mapping) {
1977 ret = 0; /* retry the fault */
1978 unlock_page(old_page);
1979 goto unwritable_page;
1980 }
1981 } else
1982 VM_BUG_ON(!PageLocked(old_page));
1974 1983
1975 /* 1984 /*
1976 * Since we dropped the lock we need to revalidate 1985 * Since we dropped the lock we need to revalidate
@@ -1980,9 +1989,11 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma,
1980 */ 1989 */
1981 page_table = pte_offset_map_lock(mm, pmd, address, 1990 page_table = pte_offset_map_lock(mm, pmd, address,
1982 &ptl); 1991 &ptl);
1983 page_cache_release(old_page); 1992 if (!pte_same(*page_table, orig_pte)) {
1984 if (!pte_same(*page_table, orig_pte)) 1993 unlock_page(old_page);
1994 page_cache_release(old_page);
1985 goto unlock; 1995 goto unlock;
1996 }
1986 1997
1987 page_mkwrite = 1; 1998 page_mkwrite = 1;
1988 } 1999 }
@@ -2094,9 +2105,6 @@ gotten:
2094unlock: 2105unlock:
2095 pte_unmap_unlock(page_table, ptl); 2106 pte_unmap_unlock(page_table, ptl);
2096 if (dirty_page) { 2107 if (dirty_page) {
2097 if (vma->vm_file)
2098 file_update_time(vma->vm_file);
2099
2100 /* 2108 /*
2101 * Yes, Virginia, this is actually required to prevent a race 2109 * Yes, Virginia, this is actually required to prevent a race
2102 * with clear_page_dirty_for_io() from clearing the page dirty 2110 * with clear_page_dirty_for_io() from clearing the page dirty
@@ -2105,16 +2113,41 @@ unlock:
2105 * 2113 *
2106 * do_no_page is protected similarly. 2114 * do_no_page is protected similarly.
2107 */ 2115 */
2108 wait_on_page_locked(dirty_page); 2116 if (!page_mkwrite) {
2109 set_page_dirty_balance(dirty_page, page_mkwrite); 2117 wait_on_page_locked(dirty_page);
2118 set_page_dirty_balance(dirty_page, page_mkwrite);
2119 }
2110 put_page(dirty_page); 2120 put_page(dirty_page);
2121 if (page_mkwrite) {
2122 struct address_space *mapping = dirty_page->mapping;
2123
2124 set_page_dirty(dirty_page);
2125 unlock_page(dirty_page);
2126 page_cache_release(dirty_page);
2127 if (mapping) {
2128 /*
2129 * Some device drivers do not set page.mapping
2130 * but still dirty their pages
2131 */
2132 balance_dirty_pages_ratelimited(mapping);
2133 }
2134 }
2135
2136 /* file_update_time outside page_lock */
2137 if (vma->vm_file)
2138 file_update_time(vma->vm_file);
2111 } 2139 }
2112 return ret; 2140 return ret;
2113oom_free_new: 2141oom_free_new:
2114 page_cache_release(new_page); 2142 page_cache_release(new_page);
2115oom: 2143oom:
2116 if (old_page) 2144 if (old_page) {
2145 if (page_mkwrite) {
2146 unlock_page(old_page);
2147 page_cache_release(old_page);
2148 }
2117 page_cache_release(old_page); 2149 page_cache_release(old_page);
2150 }
2118 return VM_FAULT_OOM; 2151 return VM_FAULT_OOM;
2119 2152
2120unwritable_page: 2153unwritable_page:
@@ -2458,8 +2491,7 @@ static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma,
2458 2491
2459 if (mem_cgroup_try_charge_swapin(mm, page, GFP_KERNEL, &ptr)) { 2492 if (mem_cgroup_try_charge_swapin(mm, page, GFP_KERNEL, &ptr)) {
2460 ret = VM_FAULT_OOM; 2493 ret = VM_FAULT_OOM;
2461 unlock_page(page); 2494 goto out_page;
2462 goto out;
2463 } 2495 }
2464 2496
2465 /* 2497 /*
@@ -2521,6 +2553,7 @@ out:
2521out_nomap: 2553out_nomap:
2522 mem_cgroup_cancel_charge_swapin(ptr); 2554 mem_cgroup_cancel_charge_swapin(ptr);
2523 pte_unmap_unlock(page_table, ptl); 2555 pte_unmap_unlock(page_table, ptl);
2556out_page:
2524 unlock_page(page); 2557 unlock_page(page);
2525 page_cache_release(page); 2558 page_cache_release(page);
2526 return ret; 2559 return ret;
@@ -2664,27 +2697,22 @@ static int __do_fault(struct mm_struct *mm, struct vm_area_struct *vma,
2664 int tmp; 2697 int tmp;
2665 2698
2666 unlock_page(page); 2699 unlock_page(page);
2667 vmf.flags |= FAULT_FLAG_MKWRITE; 2700 vmf.flags = FAULT_FLAG_WRITE|FAULT_FLAG_MKWRITE;
2668 tmp = vma->vm_ops->page_mkwrite(vma, &vmf); 2701 tmp = vma->vm_ops->page_mkwrite(vma, &vmf);
2669 if (unlikely(tmp & 2702 if (unlikely(tmp &
2670 (VM_FAULT_ERROR | VM_FAULT_NOPAGE))) { 2703 (VM_FAULT_ERROR | VM_FAULT_NOPAGE))) {
2671 ret = tmp; 2704 ret = tmp;
2672 anon = 1; /* no anon but release vmf.page */ 2705 goto unwritable_page;
2673 goto out_unlocked;
2674 }
2675 lock_page(page);
2676 /*
2677 * XXX: this is not quite right (racy vs
2678 * invalidate) to unlock and relock the page
2679 * like this, however a better fix requires
2680 * reworking page_mkwrite locking API, which
2681 * is better done later.
2682 */
2683 if (!page->mapping) {
2684 ret = 0;
2685 anon = 1; /* no anon but release vmf.page */
2686 goto out;
2687 } 2706 }
2707 if (unlikely(!(tmp & VM_FAULT_LOCKED))) {
2708 lock_page(page);
2709 if (!page->mapping) {
2710 ret = 0; /* retry the fault */
2711 unlock_page(page);
2712 goto unwritable_page;
2713 }
2714 } else
2715 VM_BUG_ON(!PageLocked(page));
2688 page_mkwrite = 1; 2716 page_mkwrite = 1;
2689 } 2717 }
2690 } 2718 }
@@ -2736,19 +2764,35 @@ static int __do_fault(struct mm_struct *mm, struct vm_area_struct *vma,
2736 pte_unmap_unlock(page_table, ptl); 2764 pte_unmap_unlock(page_table, ptl);
2737 2765
2738out: 2766out:
2739 unlock_page(vmf.page); 2767 if (dirty_page) {
2740out_unlocked: 2768 struct address_space *mapping = page->mapping;
2741 if (anon)
2742 page_cache_release(vmf.page);
2743 else if (dirty_page) {
2744 if (vma->vm_file)
2745 file_update_time(vma->vm_file);
2746 2769
2747 set_page_dirty_balance(dirty_page, page_mkwrite); 2770 if (set_page_dirty(dirty_page))
2771 page_mkwrite = 1;
2772 unlock_page(dirty_page);
2748 put_page(dirty_page); 2773 put_page(dirty_page);
2774 if (page_mkwrite && mapping) {
2775 /*
2776 * Some device drivers do not set page.mapping but still
2777 * dirty their pages
2778 */
2779 balance_dirty_pages_ratelimited(mapping);
2780 }
2781
2782 /* file_update_time outside page_lock */
2783 if (vma->vm_file)
2784 file_update_time(vma->vm_file);
2785 } else {
2786 unlock_page(vmf.page);
2787 if (anon)
2788 page_cache_release(vmf.page);
2749 } 2789 }
2750 2790
2751 return ret; 2791 return ret;
2792
2793unwritable_page:
2794 page_cache_release(page);
2795 return ret;
2752} 2796}
2753 2797
2754static int do_linear_fault(struct mm_struct *mm, struct vm_area_struct *vma, 2798static int do_linear_fault(struct mm_struct *mm, struct vm_area_struct *vma,
diff --git a/mm/mmap.c b/mm/mmap.c
index 3303d1ba8e8..6b7b1a95944 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -85,7 +85,7 @@ EXPORT_SYMBOL(vm_get_page_prot);
85int sysctl_overcommit_memory = OVERCOMMIT_GUESS; /* heuristic overcommit */ 85int sysctl_overcommit_memory = OVERCOMMIT_GUESS; /* heuristic overcommit */
86int sysctl_overcommit_ratio = 50; /* default is 50% */ 86int sysctl_overcommit_ratio = 50; /* default is 50% */
87int sysctl_max_map_count __read_mostly = DEFAULT_MAX_MAP_COUNT; 87int sysctl_max_map_count __read_mostly = DEFAULT_MAX_MAP_COUNT;
88atomic_long_t vm_committed_space = ATOMIC_LONG_INIT(0); 88struct percpu_counter vm_committed_as;
89 89
90/* 90/*
91 * Check that a process has enough memory to allocate a new virtual 91 * Check that a process has enough memory to allocate a new virtual
@@ -179,11 +179,7 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin)
179 if (mm) 179 if (mm)
180 allowed -= mm->total_vm / 32; 180 allowed -= mm->total_vm / 32;
181 181
182 /* 182 if (percpu_counter_read_positive(&vm_committed_as) < allowed)
183 * cast `allowed' as a signed long because vm_committed_space
184 * sometimes has a negative value
185 */
186 if (atomic_long_read(&vm_committed_space) < (long)allowed)
187 return 0; 183 return 0;
188error: 184error:
189 vm_unacct_memory(pages); 185 vm_unacct_memory(pages);
@@ -2481,4 +2477,8 @@ void mm_drop_all_locks(struct mm_struct *mm)
2481 */ 2477 */
2482void __init mmap_init(void) 2478void __init mmap_init(void)
2483{ 2479{
2480 int ret;
2481
2482 ret = percpu_counter_init(&vm_committed_as, 0);
2483 VM_BUG_ON(ret);
2484} 2484}
diff --git a/mm/nommu.c b/mm/nommu.c
index 72eda4aee2c..809998aa7b5 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -62,7 +62,7 @@ void *high_memory;
62struct page *mem_map; 62struct page *mem_map;
63unsigned long max_mapnr; 63unsigned long max_mapnr;
64unsigned long num_physpages; 64unsigned long num_physpages;
65atomic_long_t vm_committed_space = ATOMIC_LONG_INIT(0); 65struct percpu_counter vm_committed_as;
66int sysctl_overcommit_memory = OVERCOMMIT_GUESS; /* heuristic overcommit */ 66int sysctl_overcommit_memory = OVERCOMMIT_GUESS; /* heuristic overcommit */
67int sysctl_overcommit_ratio = 50; /* default is 50% */ 67int sysctl_overcommit_ratio = 50; /* default is 50% */
68int sysctl_max_map_count = DEFAULT_MAX_MAP_COUNT; 68int sysctl_max_map_count = DEFAULT_MAX_MAP_COUNT;
@@ -463,6 +463,10 @@ SYSCALL_DEFINE1(brk, unsigned long, brk)
463 */ 463 */
464void __init mmap_init(void) 464void __init mmap_init(void)
465{ 465{
466 int ret;
467
468 ret = percpu_counter_init(&vm_committed_as, 0);
469 VM_BUG_ON(ret);
466 vm_region_jar = KMEM_CACHE(vm_region, SLAB_PANIC); 470 vm_region_jar = KMEM_CACHE(vm_region, SLAB_PANIC);
467} 471}
468 472
@@ -1847,12 +1851,9 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin)
1847 if (mm) 1851 if (mm)
1848 allowed -= mm->total_vm / 32; 1852 allowed -= mm->total_vm / 32;
1849 1853
1850 /* 1854 if (percpu_counter_read_positive(&vm_committed_as) < allowed)
1851 * cast `allowed' as a signed long because vm_committed_space
1852 * sometimes has a negative value
1853 */
1854 if (atomic_long_read(&vm_committed_space) < (long)allowed)
1855 return 0; 1855 return 0;
1856
1856error: 1857error:
1857 vm_unacct_memory(pages); 1858 vm_unacct_memory(pages);
1858 1859
diff --git a/mm/shmem.c b/mm/shmem.c
index f9cb20ebb99..b25f95ce3db 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1340,8 +1340,12 @@ repeat:
1340 shmem_swp_unmap(entry); 1340 shmem_swp_unmap(entry);
1341 spin_unlock(&info->lock); 1341 spin_unlock(&info->lock);
1342 if (error == -ENOMEM) { 1342 if (error == -ENOMEM) {
1343 /* allow reclaim from this memory cgroup */ 1343 /*
1344 error = mem_cgroup_shrink_usage(swappage, 1344 * reclaim from proper memory cgroup and
1345 * call memcg's OOM if needed.
1346 */
1347 error = mem_cgroup_shmem_charge_fallback(
1348 swappage,
1345 current->mm, 1349 current->mm,
1346 gfp); 1350 gfp);
1347 if (error) { 1351 if (error) {
diff --git a/mm/swap.c b/mm/swap.c
index bede23ce64e..cb29ae5d33a 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -491,49 +491,6 @@ unsigned pagevec_lookup_tag(struct pagevec *pvec, struct address_space *mapping,
491 491
492EXPORT_SYMBOL(pagevec_lookup_tag); 492EXPORT_SYMBOL(pagevec_lookup_tag);
493 493
494#ifdef CONFIG_SMP
495/*
496 * We tolerate a little inaccuracy to avoid ping-ponging the counter between
497 * CPUs
498 */
499#define ACCT_THRESHOLD max(16, NR_CPUS * 2)
500
501static DEFINE_PER_CPU(long, committed_space);
502
503void vm_acct_memory(long pages)
504{
505 long *local;
506
507 preempt_disable();
508 local = &__get_cpu_var(committed_space);
509 *local += pages;
510 if (*local > ACCT_THRESHOLD || *local < -ACCT_THRESHOLD) {
511 atomic_long_add(*local, &vm_committed_space);
512 *local = 0;
513 }
514 preempt_enable();
515}
516
517#ifdef CONFIG_HOTPLUG_CPU
518
519/* Drop the CPU's cached committed space back into the central pool. */
520static int cpu_swap_callback(struct notifier_block *nfb,
521 unsigned long action,
522 void *hcpu)
523{
524 long *committed;
525
526 committed = &per_cpu(committed_space, (long)hcpu);
527 if (action == CPU_DEAD || action == CPU_DEAD_FROZEN) {
528 atomic_long_add(*committed, &vm_committed_space);
529 *committed = 0;
530 drain_cpu_pagevecs((long)hcpu);
531 }
532 return NOTIFY_OK;
533}
534#endif /* CONFIG_HOTPLUG_CPU */
535#endif /* CONFIG_SMP */
536
537/* 494/*
538 * Perform any setup for the swap system 495 * Perform any setup for the swap system
539 */ 496 */
@@ -554,7 +511,4 @@ void __init swap_setup(void)
554 * Right now other parts of the system means that we 511 * Right now other parts of the system means that we
555 * _really_ don't want to cluster much more 512 * _really_ don't want to cluster much more
556 */ 513 */
557#ifdef CONFIG_HOTPLUG_CPU
558 hotcpu_notifier(cpu_swap_callback, 0);
559#endif
560} 514}
diff --git a/mm/vmscan.c b/mm/vmscan.c
index eac9577941f..5fa3eda1f03 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1471,7 +1471,7 @@ static void shrink_zone(int priority, struct zone *zone,
1471 1471
1472 for_each_evictable_lru(l) { 1472 for_each_evictable_lru(l) {
1473 int file = is_file_lru(l); 1473 int file = is_file_lru(l);
1474 int scan; 1474 unsigned long scan;
1475 1475
1476 scan = zone_nr_pages(zone, sc, l); 1476 scan = zone_nr_pages(zone, sc, l);
1477 if (priority) { 1477 if (priority) {
diff --git a/net/9p/client.c b/net/9p/client.c
index 1eb580c38fb..dd43a8289b0 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -203,7 +203,6 @@ static struct p9_req_t *p9_tag_alloc(struct p9_client *c, u16 tag)
203 p9pdu_reset(req->tc); 203 p9pdu_reset(req->tc);
204 p9pdu_reset(req->rc); 204 p9pdu_reset(req->rc);
205 205
206 req->flush_tag = 0;
207 req->tc->tag = tag-1; 206 req->tc->tag = tag-1;
208 req->status = REQ_STATUS_ALLOC; 207 req->status = REQ_STATUS_ALLOC;
209 208
@@ -324,35 +323,9 @@ static void p9_free_req(struct p9_client *c, struct p9_req_t *r)
324 */ 323 */
325void p9_client_cb(struct p9_client *c, struct p9_req_t *req) 324void p9_client_cb(struct p9_client *c, struct p9_req_t *req)
326{ 325{
327 struct p9_req_t *other_req;
328 unsigned long flags;
329
330 P9_DPRINTK(P9_DEBUG_MUX, " tag %d\n", req->tc->tag); 326 P9_DPRINTK(P9_DEBUG_MUX, " tag %d\n", req->tc->tag);
331 327 wake_up(req->wq);
332 if (req->status == REQ_STATUS_ERROR) 328 P9_DPRINTK(P9_DEBUG_MUX, "wakeup: %d\n", req->tc->tag);
333 wake_up(req->wq);
334
335 if (req->flush_tag) { /* flush receive path */
336 P9_DPRINTK(P9_DEBUG_9P, "<<< RFLUSH %d\n", req->tc->tag);
337 spin_lock_irqsave(&c->lock, flags);
338 other_req = p9_tag_lookup(c, req->flush_tag);
339 if (other_req->status != REQ_STATUS_FLSH) /* stale flush */
340 spin_unlock_irqrestore(&c->lock, flags);
341 else {
342 other_req->status = REQ_STATUS_FLSHD;
343 spin_unlock_irqrestore(&c->lock, flags);
344 wake_up(other_req->wq);
345 }
346 p9_free_req(c, req);
347 } else { /* normal receive path */
348 P9_DPRINTK(P9_DEBUG_MUX, "normal: tag %d\n", req->tc->tag);
349 spin_lock_irqsave(&c->lock, flags);
350 if (req->status != REQ_STATUS_FLSHD)
351 req->status = REQ_STATUS_RCVD;
352 spin_unlock_irqrestore(&c->lock, flags);
353 wake_up(req->wq);
354 P9_DPRINTK(P9_DEBUG_MUX, "wakeup: %d\n", req->tc->tag);
355 }
356} 329}
357EXPORT_SYMBOL(p9_client_cb); 330EXPORT_SYMBOL(p9_client_cb);
358 331
@@ -486,9 +459,15 @@ static int p9_client_flush(struct p9_client *c, struct p9_req_t *oldreq)
486 if (IS_ERR(req)) 459 if (IS_ERR(req))
487 return PTR_ERR(req); 460 return PTR_ERR(req);
488 461
489 req->flush_tag = oldtag;
490 462
491 /* we don't free anything here because RPC isn't complete */ 463 /* if we haven't received a response for oldreq,
464 remove it from the list. */
465 spin_lock(&c->lock);
466 if (oldreq->status == REQ_STATUS_FLSH)
467 list_del(&oldreq->req_list);
468 spin_unlock(&c->lock);
469
470 p9_free_req(c, req);
492 return 0; 471 return 0;
493} 472}
494 473
@@ -509,7 +488,6 @@ p9_client_rpc(struct p9_client *c, int8_t type, const char *fmt, ...)
509 struct p9_req_t *req; 488 struct p9_req_t *req;
510 unsigned long flags; 489 unsigned long flags;
511 int sigpending; 490 int sigpending;
512 int flushed = 0;
513 491
514 P9_DPRINTK(P9_DEBUG_MUX, "client %p op %d\n", c, type); 492 P9_DPRINTK(P9_DEBUG_MUX, "client %p op %d\n", c, type);
515 493
@@ -546,42 +524,28 @@ p9_client_rpc(struct p9_client *c, int8_t type, const char *fmt, ...)
546 goto reterr; 524 goto reterr;
547 } 525 }
548 526
549 /* if it was a flush we just transmitted, return our tag */
550 if (type == P9_TFLUSH)
551 return req;
552again:
553 P9_DPRINTK(P9_DEBUG_MUX, "wait %p tag: %d\n", req->wq, tag); 527 P9_DPRINTK(P9_DEBUG_MUX, "wait %p tag: %d\n", req->wq, tag);
554 err = wait_event_interruptible(*req->wq, 528 err = wait_event_interruptible(*req->wq,
555 req->status >= REQ_STATUS_RCVD); 529 req->status >= REQ_STATUS_RCVD);
556 P9_DPRINTK(P9_DEBUG_MUX, "wait %p tag: %d returned %d (flushed=%d)\n", 530 P9_DPRINTK(P9_DEBUG_MUX, "wait %p tag: %d returned %d\n",
557 req->wq, tag, err, flushed); 531 req->wq, tag, err);
558 532
559 if (req->status == REQ_STATUS_ERROR) { 533 if (req->status == REQ_STATUS_ERROR) {
560 P9_DPRINTK(P9_DEBUG_ERROR, "req_status error %d\n", req->t_err); 534 P9_DPRINTK(P9_DEBUG_ERROR, "req_status error %d\n", req->t_err);
561 err = req->t_err; 535 err = req->t_err;
562 } else if (err == -ERESTARTSYS && flushed) {
563 P9_DPRINTK(P9_DEBUG_MUX, "flushed - going again\n");
564 goto again;
565 } else if (req->status == REQ_STATUS_FLSHD) {
566 P9_DPRINTK(P9_DEBUG_MUX, "flushed - erestartsys\n");
567 err = -ERESTARTSYS;
568 } 536 }
569 537
570 if ((err == -ERESTARTSYS) && (c->status == Connected) && (!flushed)) { 538 if ((err == -ERESTARTSYS) && (c->status == Connected)) {
571 P9_DPRINTK(P9_DEBUG_MUX, "flushing\n"); 539 P9_DPRINTK(P9_DEBUG_MUX, "flushing\n");
572 spin_lock_irqsave(&c->lock, flags);
573 if (req->status == REQ_STATUS_SENT)
574 req->status = REQ_STATUS_FLSH;
575 spin_unlock_irqrestore(&c->lock, flags);
576 sigpending = 1; 540 sigpending = 1;
577 flushed = 1;
578 clear_thread_flag(TIF_SIGPENDING); 541 clear_thread_flag(TIF_SIGPENDING);
579 542
580 if (c->trans_mod->cancel(c, req)) { 543 if (c->trans_mod->cancel(c, req))
581 err = p9_client_flush(c, req); 544 p9_client_flush(c, req);
582 if (err == 0) 545
583 goto again; 546 /* if we received the response anyway, don't signal error */
584 } 547 if (req->status == REQ_STATUS_RCVD)
548 err = 0;
585 } 549 }
586 550
587 if (sigpending) { 551 if (sigpending) {
@@ -1244,19 +1208,53 @@ struct p9_wstat *p9_client_stat(struct p9_fid *fid)
1244 ret->name, ret->uid, ret->gid, ret->muid, ret->extension, 1208 ret->name, ret->uid, ret->gid, ret->muid, ret->extension,
1245 ret->n_uid, ret->n_gid, ret->n_muid); 1209 ret->n_uid, ret->n_gid, ret->n_muid);
1246 1210
1211 p9_free_req(clnt, req);
1212 return ret;
1213
1247free_and_error: 1214free_and_error:
1248 p9_free_req(clnt, req); 1215 p9_free_req(clnt, req);
1249error: 1216error:
1250 return ret; 1217 kfree(ret);
1218 return ERR_PTR(err);
1251} 1219}
1252EXPORT_SYMBOL(p9_client_stat); 1220EXPORT_SYMBOL(p9_client_stat);
1253 1221
1222static int p9_client_statsize(struct p9_wstat *wst, int optional)
1223{
1224 int ret;
1225
1226 /* size[2] type[2] dev[4] qid[13] */
1227 /* mode[4] atime[4] mtime[4] length[8]*/
1228 /* name[s] uid[s] gid[s] muid[s] */
1229 ret = 2+2+4+13+4+4+4+8+2+2+2+2;
1230
1231 if (wst->name)
1232 ret += strlen(wst->name);
1233 if (wst->uid)
1234 ret += strlen(wst->uid);
1235 if (wst->gid)
1236 ret += strlen(wst->gid);
1237 if (wst->muid)
1238 ret += strlen(wst->muid);
1239
1240 if (optional) {
1241 ret += 2+4+4+4; /* extension[s] n_uid[4] n_gid[4] n_muid[4] */
1242 if (wst->extension)
1243 ret += strlen(wst->extension);
1244 }
1245
1246 return ret;
1247}
1248
1254int p9_client_wstat(struct p9_fid *fid, struct p9_wstat *wst) 1249int p9_client_wstat(struct p9_fid *fid, struct p9_wstat *wst)
1255{ 1250{
1256 int err; 1251 int err;
1257 struct p9_req_t *req; 1252 struct p9_req_t *req;
1258 struct p9_client *clnt; 1253 struct p9_client *clnt;
1259 1254
1255 err = 0;
1256 clnt = fid->clnt;
1257 wst->size = p9_client_statsize(wst, clnt->dotu);
1260 P9_DPRINTK(P9_DEBUG_9P, ">>> TWSTAT fid %d\n", fid->fid); 1258 P9_DPRINTK(P9_DEBUG_9P, ">>> TWSTAT fid %d\n", fid->fid);
1261 P9_DPRINTK(P9_DEBUG_9P, 1259 P9_DPRINTK(P9_DEBUG_9P,
1262 " sz=%x type=%x dev=%x qid=%x.%llx.%x\n" 1260 " sz=%x type=%x dev=%x qid=%x.%llx.%x\n"
@@ -1268,10 +1266,8 @@ int p9_client_wstat(struct p9_fid *fid, struct p9_wstat *wst)
1268 wst->atime, wst->mtime, (unsigned long long)wst->length, 1266 wst->atime, wst->mtime, (unsigned long long)wst->length,
1269 wst->name, wst->uid, wst->gid, wst->muid, wst->extension, 1267 wst->name, wst->uid, wst->gid, wst->muid, wst->extension,
1270 wst->n_uid, wst->n_gid, wst->n_muid); 1268 wst->n_uid, wst->n_gid, wst->n_muid);
1271 err = 0;
1272 clnt = fid->clnt;
1273 1269
1274 req = p9_client_rpc(clnt, P9_TWSTAT, "dwS", fid->fid, 0, wst); 1270 req = p9_client_rpc(clnt, P9_TWSTAT, "dwS", fid->fid, wst->size, wst);
1275 if (IS_ERR(req)) { 1271 if (IS_ERR(req)) {
1276 err = PTR_ERR(req); 1272 err = PTR_ERR(req);
1277 goto error; 1273 goto error;
diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c
index c613ed08a5e..a2a1814c7a8 100644
--- a/net/9p/trans_fd.c
+++ b/net/9p/trans_fd.c
@@ -213,8 +213,8 @@ static void p9_conn_cancel(struct p9_conn *m, int err)
213 spin_unlock_irqrestore(&m->client->lock, flags); 213 spin_unlock_irqrestore(&m->client->lock, flags);
214 214
215 list_for_each_entry_safe(req, rtmp, &cancel_list, req_list) { 215 list_for_each_entry_safe(req, rtmp, &cancel_list, req_list) {
216 list_del(&req->req_list);
217 P9_DPRINTK(P9_DEBUG_ERROR, "call back req %p\n", req); 216 P9_DPRINTK(P9_DEBUG_ERROR, "call back req %p\n", req);
217 list_del(&req->req_list);
218 p9_client_cb(m->client, req); 218 p9_client_cb(m->client, req);
219 } 219 }
220} 220}
@@ -336,7 +336,8 @@ static void p9_read_work(struct work_struct *work)
336 "mux %p pkt: size: %d bytes tag: %d\n", m, n, tag); 336 "mux %p pkt: size: %d bytes tag: %d\n", m, n, tag);
337 337
338 m->req = p9_tag_lookup(m->client, tag); 338 m->req = p9_tag_lookup(m->client, tag);
339 if (!m->req) { 339 if (!m->req || (m->req->status != REQ_STATUS_SENT &&
340 m->req->status != REQ_STATUS_FLSH)) {
340 P9_DPRINTK(P9_DEBUG_ERROR, "Unexpected packet tag %d\n", 341 P9_DPRINTK(P9_DEBUG_ERROR, "Unexpected packet tag %d\n",
341 tag); 342 tag);
342 err = -EIO; 343 err = -EIO;
@@ -361,10 +362,11 @@ static void p9_read_work(struct work_struct *work)
361 if ((m->req) && (m->rpos == m->rsize)) { /* packet is read in */ 362 if ((m->req) && (m->rpos == m->rsize)) { /* packet is read in */
362 P9_DPRINTK(P9_DEBUG_TRANS, "got new packet\n"); 363 P9_DPRINTK(P9_DEBUG_TRANS, "got new packet\n");
363 spin_lock(&m->client->lock); 364 spin_lock(&m->client->lock);
365 if (m->req->status != REQ_STATUS_ERROR)
366 m->req->status = REQ_STATUS_RCVD;
364 list_del(&m->req->req_list); 367 list_del(&m->req->req_list);
365 spin_unlock(&m->client->lock); 368 spin_unlock(&m->client->lock);
366 p9_client_cb(m->client, m->req); 369 p9_client_cb(m->client, m->req);
367
368 m->rbuf = NULL; 370 m->rbuf = NULL;
369 m->rpos = 0; 371 m->rpos = 0;
370 m->rsize = 0; 372 m->rsize = 0;
@@ -454,6 +456,7 @@ static void p9_write_work(struct work_struct *work)
454 req = list_entry(m->unsent_req_list.next, struct p9_req_t, 456 req = list_entry(m->unsent_req_list.next, struct p9_req_t,
455 req_list); 457 req_list);
456 req->status = REQ_STATUS_SENT; 458 req->status = REQ_STATUS_SENT;
459 P9_DPRINTK(P9_DEBUG_TRANS, "move req %p\n", req);
457 list_move_tail(&req->req_list, &m->req_list); 460 list_move_tail(&req->req_list, &m->req_list);
458 461
459 m->wbuf = req->tc->sdata; 462 m->wbuf = req->tc->sdata;
@@ -683,12 +686,13 @@ static int p9_fd_cancel(struct p9_client *client, struct p9_req_t *req)
683 P9_DPRINTK(P9_DEBUG_TRANS, "client %p req %p\n", client, req); 686 P9_DPRINTK(P9_DEBUG_TRANS, "client %p req %p\n", client, req);
684 687
685 spin_lock(&client->lock); 688 spin_lock(&client->lock);
686 list_del(&req->req_list);
687 689
688 if (req->status == REQ_STATUS_UNSENT) { 690 if (req->status == REQ_STATUS_UNSENT) {
691 list_del(&req->req_list);
689 req->status = REQ_STATUS_FLSHD; 692 req->status = REQ_STATUS_FLSHD;
690 ret = 0; 693 ret = 0;
691 } 694 } else if (req->status == REQ_STATUS_SENT)
695 req->status = REQ_STATUS_FLSH;
692 696
693 spin_unlock(&client->lock); 697 spin_unlock(&client->lock);
694 698
diff --git a/net/9p/trans_rdma.c b/net/9p/trans_rdma.c
index 7fa0eb20b2f..ac4990041eb 100644
--- a/net/9p/trans_rdma.c
+++ b/net/9p/trans_rdma.c
@@ -295,6 +295,7 @@ handle_recv(struct p9_client *client, struct p9_trans_rdma *rdma,
295 goto err_out; 295 goto err_out;
296 296
297 req->rc = c->rc; 297 req->rc = c->rc;
298 req->status = REQ_STATUS_RCVD;
298 p9_client_cb(client, req); 299 p9_client_cb(client, req);
299 300
300 return; 301 return;
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c
index 2d7781ec663..bb8579a141a 100644
--- a/net/9p/trans_virtio.c
+++ b/net/9p/trans_virtio.c
@@ -134,6 +134,7 @@ static void req_done(struct virtqueue *vq)
134 P9_DPRINTK(P9_DEBUG_TRANS, ": rc %p\n", rc); 134 P9_DPRINTK(P9_DEBUG_TRANS, ": rc %p\n", rc);
135 P9_DPRINTK(P9_DEBUG_TRANS, ": lookup tag %d\n", rc->tag); 135 P9_DPRINTK(P9_DEBUG_TRANS, ": lookup tag %d\n", rc->tag);
136 req = p9_tag_lookup(chan->client, rc->tag); 136 req = p9_tag_lookup(chan->client, rc->tag);
137 req->status = REQ_STATUS_RCVD;
137 p9_client_cb(chan->client, req); 138 p9_client_cb(chan->client, req);
138 } 139 }
139} 140}
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index a0bfe53f162..06ca058572f 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -672,10 +672,8 @@ xprt_init_autodisconnect(unsigned long data)
672 if (test_and_set_bit(XPRT_LOCKED, &xprt->state)) 672 if (test_and_set_bit(XPRT_LOCKED, &xprt->state))
673 goto out_abort; 673 goto out_abort;
674 spin_unlock(&xprt->transport_lock); 674 spin_unlock(&xprt->transport_lock);
675 if (xprt_connecting(xprt)) 675 set_bit(XPRT_CONNECTION_CLOSE, &xprt->state);
676 xprt_release_write(xprt, NULL); 676 queue_work(rpciod_workqueue, &xprt->task_cleanup);
677 else
678 queue_work(rpciod_workqueue, &xprt->task_cleanup);
679 return; 677 return;
680out_abort: 678out_abort:
681 spin_unlock(&xprt->transport_lock); 679 spin_unlock(&xprt->transport_lock);
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index d40ff50887a..e1859614601 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -807,6 +807,9 @@ static void xs_reset_transport(struct sock_xprt *transport)
807 * 807 *
808 * This is used when all requests are complete; ie, no DRC state remains 808 * This is used when all requests are complete; ie, no DRC state remains
809 * on the server we want to save. 809 * on the server we want to save.
810 *
811 * The caller _must_ be holding XPRT_LOCKED in order to avoid issues with
812 * xs_reset_transport() zeroing the socket from underneath a writer.
810 */ 813 */
811static void xs_close(struct rpc_xprt *xprt) 814static void xs_close(struct rpc_xprt *xprt)
812{ 815{
@@ -824,6 +827,14 @@ static void xs_close(struct rpc_xprt *xprt)
824 xprt_disconnect_done(xprt); 827 xprt_disconnect_done(xprt);
825} 828}
826 829
830static void xs_tcp_close(struct rpc_xprt *xprt)
831{
832 if (test_and_clear_bit(XPRT_CONNECTION_CLOSE, &xprt->state))
833 xs_close(xprt);
834 else
835 xs_tcp_shutdown(xprt);
836}
837
827/** 838/**
828 * xs_destroy - prepare to shutdown a transport 839 * xs_destroy - prepare to shutdown a transport
829 * @xprt: doomed transport 840 * @xprt: doomed transport
@@ -1772,6 +1783,15 @@ static void xs_tcp_setup_socket(struct rpc_xprt *xprt,
1772 xprt, -status, xprt_connected(xprt), 1783 xprt, -status, xprt_connected(xprt),
1773 sock->sk->sk_state); 1784 sock->sk->sk_state);
1774 switch (status) { 1785 switch (status) {
1786 default:
1787 printk("%s: connect returned unhandled error %d\n",
1788 __func__, status);
1789 case -EADDRNOTAVAIL:
1790 /* We're probably in TIME_WAIT. Get rid of existing socket,
1791 * and retry
1792 */
1793 set_bit(XPRT_CONNECTION_CLOSE, &xprt->state);
1794 xprt_force_disconnect(xprt);
1775 case -ECONNREFUSED: 1795 case -ECONNREFUSED:
1776 case -ECONNRESET: 1796 case -ECONNRESET:
1777 case -ENETUNREACH: 1797 case -ENETUNREACH:
@@ -1782,10 +1802,6 @@ static void xs_tcp_setup_socket(struct rpc_xprt *xprt,
1782 xprt_clear_connecting(xprt); 1802 xprt_clear_connecting(xprt);
1783 return; 1803 return;
1784 } 1804 }
1785 /* get rid of existing socket, and retry */
1786 xs_tcp_shutdown(xprt);
1787 printk("%s: connect returned unhandled error %d\n",
1788 __func__, status);
1789out_eagain: 1805out_eagain:
1790 status = -EAGAIN; 1806 status = -EAGAIN;
1791out: 1807out:
@@ -1994,7 +2010,7 @@ static struct rpc_xprt_ops xs_tcp_ops = {
1994 .buf_free = rpc_free, 2010 .buf_free = rpc_free,
1995 .send_request = xs_tcp_send_request, 2011 .send_request = xs_tcp_send_request,
1996 .set_retrans_timeout = xprt_set_retrans_timeout_def, 2012 .set_retrans_timeout = xprt_set_retrans_timeout_def,
1997 .close = xs_tcp_shutdown, 2013 .close = xs_tcp_close,
1998 .destroy = xs_destroy, 2014 .destroy = xs_destroy,
1999 .print_stats = xs_tcp_print_stats, 2015 .print_stats = xs_tcp_print_stats,
2000}; 2016};
diff --git a/scripts/Makefile b/scripts/Makefile
index aafdf064fee..9dd5b25a1d5 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -21,6 +21,7 @@ hostprogs-y += unifdef
21subdir-$(CONFIG_MODVERSIONS) += genksyms 21subdir-$(CONFIG_MODVERSIONS) += genksyms
22subdir-y += mod 22subdir-y += mod
23subdir-$(CONFIG_SECURITY_SELINUX) += selinux 23subdir-$(CONFIG_SECURITY_SELINUX) += selinux
24subdir-$(CONFIG_DTC) += dtc
24 25
25# Let clean descend into subdirs 26# Let clean descend into subdirs
26subdir- += basic kconfig package selinux 27subdir- += basic kconfig package selinux
diff --git a/scripts/dtc/Makefile b/scripts/dtc/Makefile
new file mode 100644
index 00000000000..01cdb36fc58
--- /dev/null
+++ b/scripts/dtc/Makefile
@@ -0,0 +1,54 @@
1# scripts/dtc makefile
2
3hostprogs-y := dtc
4always := $(hostprogs-y)
5
6dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \
7 srcpos.o checks.o
8dtc-objs += dtc-lexer.lex.o dtc-parser.tab.o
9
10# Source files need to get at the userspace version of libfdt_env.h to compile
11
12HOSTCFLAGS_DTC := -I$(src) -I$(src)/libfdt
13
14HOSTCFLAGS_checks.o := $(HOSTCFLAGS_DTC)
15HOSTCFLAGS_data.o := $(HOSTCFLAGS_DTC)
16HOSTCFLAGS_dtc.o := $(HOSTCFLAGS_DTC)
17HOSTCFLAGS_flattree.o := $(HOSTCFLAGS_DTC)
18HOSTCFLAGS_fstree.o := $(HOSTCFLAGS_DTC)
19HOSTCFLAGS_livetree.o := $(HOSTCFLAGS_DTC)
20HOSTCFLAGS_srcpos.o := $(HOSTCFLAGS_DTC)
21HOSTCFLAGS_treesource.o := $(HOSTCFLAGS_DTC)
22
23HOSTCFLAGS_dtc-lexer.lex.o := $(HOSTCFLAGS_DTC)
24HOSTCFLAGS_dtc-parser.tab.o := $(HOSTCFLAGS_DTC)
25
26# dependencies on generated files need to be listed explicitly
27$(obj)/dtc-parser.tab.o: $(obj)/dtc-parser.tab.c $(obj)/dtc-parser.tab.h
28$(obj)/dtc-lexer.lex.o: $(obj)/dtc-lexer.lex.c $(obj)/dtc-parser.tab.h
29
30targets += dtc-parser.tab.c dtc-lexer.lex.c
31
32clean-files += dtc-parser.tab.h
33
34# GENERATE_PARSER := 1 # Uncomment to rebuild flex/bison output
35
36ifdef GENERATE_PARSER
37
38BISON = bison
39FLEX = flex
40
41quiet_cmd_bison = BISON $@
42 cmd_bison = $(BISON) -o$@ -d $<; cp $@ $@_shipped
43quiet_cmd_flex = FLEX $@
44 cmd_flex = $(FLEX) -o$@ $<; cp $@ $@_shipped
45
46$(obj)/dtc-parser.tab.c: $(src)/dtc-parser.y FORCE
47 $(call if_changed,bison)
48
49$(obj)/dtc-parser.tab.h: $(obj)/dtc-parser.tab.c
50
51$(obj)/dtc-lexer.lex.c: $(src)/dtc-lexer.l FORCE
52 $(call if_changed,flex)
53
54endif
diff --git a/arch/powerpc/boot/dtc-src/Makefile.dtc b/scripts/dtc/Makefile.dtc
index 6ddf9ecac66..6ddf9ecac66 100644
--- a/arch/powerpc/boot/dtc-src/Makefile.dtc
+++ b/scripts/dtc/Makefile.dtc
diff --git a/arch/powerpc/boot/dtc-src/checks.c b/scripts/dtc/checks.c
index 95485796f25..95485796f25 100644
--- a/arch/powerpc/boot/dtc-src/checks.c
+++ b/scripts/dtc/checks.c
diff --git a/arch/powerpc/boot/dtc-src/data.c b/scripts/dtc/data.c
index dd2e3d39d4c..dd2e3d39d4c 100644
--- a/arch/powerpc/boot/dtc-src/data.c
+++ b/scripts/dtc/data.c
diff --git a/arch/powerpc/boot/dtc-src/dtc-lexer.l b/scripts/dtc/dtc-lexer.l
index 44dbfd3f097..44dbfd3f097 100644
--- a/arch/powerpc/boot/dtc-src/dtc-lexer.l
+++ b/scripts/dtc/dtc-lexer.l
diff --git a/arch/powerpc/boot/dtc-src/dtc-lexer.lex.c_shipped b/scripts/dtc/dtc-lexer.lex.c_shipped
index ac392cb040f..ac392cb040f 100644
--- a/arch/powerpc/boot/dtc-src/dtc-lexer.lex.c_shipped
+++ b/scripts/dtc/dtc-lexer.lex.c_shipped
diff --git a/arch/powerpc/boot/dtc-src/dtc-parser.tab.c_shipped b/scripts/dtc/dtc-parser.tab.c_shipped
index 27129377e5d..27129377e5d 100644
--- a/arch/powerpc/boot/dtc-src/dtc-parser.tab.c_shipped
+++ b/scripts/dtc/dtc-parser.tab.c_shipped
diff --git a/arch/powerpc/boot/dtc-src/dtc-parser.tab.h_shipped b/scripts/dtc/dtc-parser.tab.h_shipped
index ba99100d55c..ba99100d55c 100644
--- a/arch/powerpc/boot/dtc-src/dtc-parser.tab.h_shipped
+++ b/scripts/dtc/dtc-parser.tab.h_shipped
diff --git a/arch/powerpc/boot/dtc-src/dtc-parser.y b/scripts/dtc/dtc-parser.y
index b2ab562420e..b2ab562420e 100644
--- a/arch/powerpc/boot/dtc-src/dtc-parser.y
+++ b/scripts/dtc/dtc-parser.y
diff --git a/arch/powerpc/boot/dtc-src/dtc.c b/scripts/dtc/dtc.c
index d8fd43b4ac1..d8fd43b4ac1 100644
--- a/arch/powerpc/boot/dtc-src/dtc.c
+++ b/scripts/dtc/dtc.c
diff --git a/arch/powerpc/boot/dtc-src/dtc.h b/scripts/dtc/dtc.h
index 08d54c87008..08d54c87008 100644
--- a/arch/powerpc/boot/dtc-src/dtc.h
+++ b/scripts/dtc/dtc.h
diff --git a/arch/powerpc/boot/dtc-src/flattree.c b/scripts/dtc/flattree.c
index 76acd28c068..76acd28c068 100644
--- a/arch/powerpc/boot/dtc-src/flattree.c
+++ b/scripts/dtc/flattree.c
diff --git a/arch/powerpc/boot/dtc-src/fstree.c b/scripts/dtc/fstree.c
index 766b2694d93..766b2694d93 100644
--- a/arch/powerpc/boot/dtc-src/fstree.c
+++ b/scripts/dtc/fstree.c
diff --git a/arch/powerpc/boot/libfdt/Makefile.libfdt b/scripts/dtc/libfdt/Makefile.libfdt
index 6c42acfa21e..6c42acfa21e 100644
--- a/arch/powerpc/boot/libfdt/Makefile.libfdt
+++ b/scripts/dtc/libfdt/Makefile.libfdt
diff --git a/arch/powerpc/boot/libfdt/fdt.c b/scripts/dtc/libfdt/fdt.c
index 2acaec5923a..2acaec5923a 100644
--- a/arch/powerpc/boot/libfdt/fdt.c
+++ b/scripts/dtc/libfdt/fdt.c
diff --git a/arch/powerpc/boot/libfdt/fdt.h b/scripts/dtc/libfdt/fdt.h
index 48ccfd91000..48ccfd91000 100644
--- a/arch/powerpc/boot/libfdt/fdt.h
+++ b/scripts/dtc/libfdt/fdt.h
diff --git a/arch/powerpc/boot/libfdt/fdt_ro.c b/scripts/dtc/libfdt/fdt_ro.c
index fbbba44fcd0..fbbba44fcd0 100644
--- a/arch/powerpc/boot/libfdt/fdt_ro.c
+++ b/scripts/dtc/libfdt/fdt_ro.c
diff --git a/arch/powerpc/boot/libfdt/fdt_rw.c b/scripts/dtc/libfdt/fdt_rw.c
index 8e7ec4cb7bc..8e7ec4cb7bc 100644
--- a/arch/powerpc/boot/libfdt/fdt_rw.c
+++ b/scripts/dtc/libfdt/fdt_rw.c
diff --git a/arch/powerpc/boot/libfdt/fdt_strerror.c b/scripts/dtc/libfdt/fdt_strerror.c
index e6c3ceee8c5..e6c3ceee8c5 100644
--- a/arch/powerpc/boot/libfdt/fdt_strerror.c
+++ b/scripts/dtc/libfdt/fdt_strerror.c
diff --git a/arch/powerpc/boot/libfdt/fdt_sw.c b/scripts/dtc/libfdt/fdt_sw.c
index 698329e0cca..698329e0cca 100644
--- a/arch/powerpc/boot/libfdt/fdt_sw.c
+++ b/scripts/dtc/libfdt/fdt_sw.c
diff --git a/arch/powerpc/boot/libfdt/fdt_wip.c b/scripts/dtc/libfdt/fdt_wip.c
index a4652c6e787..a4652c6e787 100644
--- a/arch/powerpc/boot/libfdt/fdt_wip.c
+++ b/scripts/dtc/libfdt/fdt_wip.c
diff --git a/arch/powerpc/boot/libfdt/libfdt.h b/scripts/dtc/libfdt/libfdt.h
index ce80e4fb41b..ce80e4fb41b 100644
--- a/arch/powerpc/boot/libfdt/libfdt.h
+++ b/scripts/dtc/libfdt/libfdt.h
diff --git a/arch/powerpc/boot/dtc-src/libfdt_env.h b/scripts/dtc/libfdt/libfdt_env.h
index 449bf602daf..449bf602daf 100644
--- a/arch/powerpc/boot/dtc-src/libfdt_env.h
+++ b/scripts/dtc/libfdt/libfdt_env.h
diff --git a/arch/powerpc/boot/libfdt/libfdt_internal.h b/scripts/dtc/libfdt/libfdt_internal.h
index 46eb93e4af5..46eb93e4af5 100644
--- a/arch/powerpc/boot/libfdt/libfdt_internal.h
+++ b/scripts/dtc/libfdt/libfdt_internal.h
diff --git a/arch/powerpc/boot/dtc-src/livetree.c b/scripts/dtc/livetree.c
index 0ca3de550b3..0ca3de550b3 100644
--- a/arch/powerpc/boot/dtc-src/livetree.c
+++ b/scripts/dtc/livetree.c
diff --git a/arch/powerpc/boot/dtc-src/srcpos.c b/scripts/dtc/srcpos.c
index 9641b7628b4..9641b7628b4 100644
--- a/arch/powerpc/boot/dtc-src/srcpos.c
+++ b/scripts/dtc/srcpos.c
diff --git a/arch/powerpc/boot/dtc-src/srcpos.h b/scripts/dtc/srcpos.h
index e17c7c04db8..e17c7c04db8 100644
--- a/arch/powerpc/boot/dtc-src/srcpos.h
+++ b/scripts/dtc/srcpos.h
diff --git a/arch/powerpc/boot/dtc-src/treesource.c b/scripts/dtc/treesource.c
index ebeb6eb2790..ebeb6eb2790 100644
--- a/arch/powerpc/boot/dtc-src/treesource.c
+++ b/scripts/dtc/treesource.c
diff --git a/arch/powerpc/boot/dtc-src/version_gen.h b/scripts/dtc/version_gen.h
index 658ff42429d..658ff42429d 100644
--- a/arch/powerpc/boot/dtc-src/version_gen.h
+++ b/scripts/dtc/version_gen.h
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 0f11870116d..3208a3a7e7f 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1411,7 +1411,8 @@ sub dump_struct($$) {
1411 my $file = shift; 1411 my $file = shift;
1412 my $nested; 1412 my $nested;
1413 1413
1414 if ($x =~/(struct|union)\s+(\w+)\s*{(.*)}/) { 1414 if ($x =~ /(struct|union)\s+(\w+)\s*{(.*)}/) {
1415 #my $decl_type = $1;
1415 $declaration_name = $2; 1416 $declaration_name = $2;
1416 my $members = $3; 1417 my $members = $3;
1417 1418
@@ -1420,8 +1421,8 @@ sub dump_struct($$) {
1420 $nested = $1; 1421 $nested = $1;
1421 1422
1422 # ignore members marked private: 1423 # ignore members marked private:
1423 $members =~ s/\/\*.*?private:.*?public:.*?\*\///gos; 1424 $members =~ s/\/\*\s*private:.*?\/\*\s*public:.*?\*\///gos;
1424 $members =~ s/\/\*.*?private:.*//gos; 1425 $members =~ s/\/\*\s*private:.*//gos;
1425 # strip comments: 1426 # strip comments:
1426 $members =~ s/\/\*.*?\*\///gos; 1427 $members =~ s/\/\*.*?\*\///gos;
1427 $nested =~ s/\/\*.*?\*\///gos; 1428 $nested =~ s/\/\*.*?\*\///gos;
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 8d46ea7d671..936b6f8e46f 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -716,41 +716,27 @@ int match(const char *sym, const char * const pat[])
716 716
717/* sections that we do not want to do full section mismatch check on */ 717/* sections that we do not want to do full section mismatch check on */
718static const char *section_white_list[] = 718static const char *section_white_list[] =
719 { ".debug*", ".stab*", ".note*", ".got*", ".toc*", NULL }; 719 { ".comment", ".debug*", ".stab*", ".note*", ".got*", ".toc*", NULL };
720 720
721/* 721/*
722 * Is this section one we do not want to check? 722 * This is used to find sections missing the SHF_ALLOC flag.
723 * This is often debug sections.
724 * If we are going to check this section then
725 * test if section name ends with a dot and a number.
726 * This is used to find sections where the linker have
727 * appended a dot-number to make the name unique.
728 * The cause of this is often a section specified in assembler 723 * The cause of this is often a section specified in assembler
729 * without "ax" / "aw" and the same section used in .c 724 * without "ax" / "aw".
730 * code where gcc add these.
731 */ 725 */
732static int check_section(const char *modname, const char *sec) 726static void check_section(const char *modname, struct elf_info *elf,
733{ 727 Elf_Shdr *sechdr)
734 const char *e = sec + strlen(sec) - 1; 728{
735 if (match(sec, section_white_list)) 729 const char *sec = sech_name(elf, sechdr);
736 return 1; 730
737 731 if (sechdr->sh_type == SHT_PROGBITS &&
738 if (*e && isdigit(*e)) { 732 !(sechdr->sh_flags & SHF_ALLOC) &&
739 /* consume all digits */ 733 !match(sec, section_white_list)) {
740 while (*e && e != sec && isdigit(*e)) 734 warn("%s (%s): unexpected non-allocatable section.\n"
741 e--; 735 "Did you forget to use \"ax\"/\"aw\" in a .S file?\n"
742 if (*e == '.' && !strstr(sec, ".linkonce")) { 736 "Note that for example <linux/init.h> contains\n"
743 warn("%s (%s): unexpected section name.\n" 737 "section definitions for use in .S files.\n\n",
744 "The (.[number]+) following section name are " 738 modname, sec);
745 "ld generated and not expected.\n"
746 "Did you forget to use \"ax\"/\"aw\" "
747 "in a .S file?\n"
748 "Note that for example <linux/init.h> contains\n"
749 "section definitions for use in .S files.\n\n",
750 modname, sec);
751 }
752 } 739 }
753 return 0;
754} 740}
755 741
756 742
@@ -928,8 +914,7 @@ static int section_mismatch(const char *fromsec, const char *tosec)
928 * *probe_one, *_console, *_timer 914 * *probe_one, *_console, *_timer
929 * 915 *
930 * Pattern 3: 916 * Pattern 3:
931 * Whitelist all refereces from .text.head to .init.data 917 * Whitelist all references from .head.text to any init section
932 * Whitelist all refereces from .text.head to .init.text
933 * 918 *
934 * Pattern 4: 919 * Pattern 4:
935 * Some symbols belong to init section but still it is ok to reference 920 * Some symbols belong to init section but still it is ok to reference
@@ -1359,7 +1344,7 @@ static void section_rela(const char *modname, struct elf_info *elf,
1359 fromsec = sech_name(elf, sechdr); 1344 fromsec = sech_name(elf, sechdr);
1360 fromsec += strlen(".rela"); 1345 fromsec += strlen(".rela");
1361 /* if from section (name) is know good then skip it */ 1346 /* if from section (name) is know good then skip it */
1362 if (check_section(modname, fromsec)) 1347 if (match(fromsec, section_white_list))
1363 return; 1348 return;
1364 1349
1365 for (rela = start; rela < stop; rela++) { 1350 for (rela = start; rela < stop; rela++) {
@@ -1403,7 +1388,7 @@ static void section_rel(const char *modname, struct elf_info *elf,
1403 fromsec = sech_name(elf, sechdr); 1388 fromsec = sech_name(elf, sechdr);
1404 fromsec += strlen(".rel"); 1389 fromsec += strlen(".rel");
1405 /* if from section (name) is know good then skip it */ 1390 /* if from section (name) is know good then skip it */
1406 if (check_section(modname, fromsec)) 1391 if (match(fromsec, section_white_list))
1407 return; 1392 return;
1408 1393
1409 for (rel = start; rel < stop; rel++) { 1394 for (rel = start; rel < stop; rel++) {
@@ -1466,6 +1451,7 @@ static void check_sec_ref(struct module *mod, const char *modname,
1466 1451
1467 /* Walk through all sections */ 1452 /* Walk through all sections */
1468 for (i = 0; i < elf->hdr->e_shnum; i++) { 1453 for (i = 0; i < elf->hdr->e_shnum; i++) {
1454 check_section(modname, elf, &elf->sechdrs[i]);
1469 /* We want to process only relocation sections and not .init */ 1455 /* We want to process only relocation sections and not .init */
1470 if (sechdrs[i].sh_type == SHT_RELA) 1456 if (sechdrs[i].sh_type == SHT_RELA)
1471 section_rela(modname, elf, &elf->sechdrs[i]); 1457 section_rela(modname, elf, &elf->sechdrs[i]);
@@ -1990,6 +1976,7 @@ static void read_markers(const char *fname)
1990 if (!mod->skip) 1976 if (!mod->skip)
1991 add_marker(mod, marker, fmt); 1977 add_marker(mod, marker, fmt);
1992 } 1978 }
1979 release_file(file, size);
1993 return; 1980 return;
1994fail: 1981fail:
1995 fatal("parse error in markers list file\n"); 1982 fatal("parse error in markers list file\n");
diff --git a/scripts/setlocalversion b/scripts/setlocalversion
index 47e75b69a2e..32c8554f394 100755
--- a/scripts/setlocalversion
+++ b/scripts/setlocalversion
@@ -10,13 +10,12 @@ cd "${1:-.}" || usage
10 10
11# Check for git and a git repo. 11# Check for git and a git repo.
12if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then 12if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
13 # Do we have an untagged version? 13 # Do we have an untagged tag?
14 if git name-rev --tags HEAD | grep -E '^HEAD[[:space:]]+(.*~[0-9]*|undefined)$' > /dev/null; then 14 if atag=`git describe 2>/dev/null`; then
15 if tag=`git describe 2>/dev/null`; then 15 echo "$atag" | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
16 echo $tag | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}' 16 # add -g${head}, if there is no usable tag
17 else 17 else
18 printf '%s%s' -g $head 18 printf '%s%s' -g $head
19 fi
20 fi 19 fi
21 20
22 # Is this git on svn? 21 # Is this git on svn?
diff --git a/scripts/tags.sh b/scripts/tags.sh
index 5bd8b1003d4..4a34ec591e8 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -164,10 +164,12 @@ case "$1" in
164 ;; 164 ;;
165 165
166 "tags") 166 "tags")
167 rm -f tags
167 xtags ctags 168 xtags ctags
168 ;; 169 ;;
169 170
170 "TAGS") 171 "TAGS")
172 rm -f TAGS
171 xtags etags 173 xtags etags
172 ;; 174 ;;
173esac 175esac
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index ba808ef6bab..2fcad7c33ea 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -3153,7 +3153,7 @@ static int selinux_file_send_sigiotask(struct task_struct *tsk,
3153 struct fown_struct *fown, int signum) 3153 struct fown_struct *fown, int signum)
3154{ 3154{
3155 struct file *file; 3155 struct file *file;
3156 u32 sid = current_sid(); 3156 u32 sid = task_sid(tsk);
3157 u32 perm; 3157 u32 perm;
3158 struct file_security_struct *fsec; 3158 struct file_security_struct *fsec;
3159 3159
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index 63d088f2265..a2a792c18c4 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -249,6 +249,12 @@ static int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *substream)
249 new_hw_ptr = hw_base + pos; 249 new_hw_ptr = hw_base + pos;
250 } 250 }
251 } 251 }
252 /* Skip the jiffies check for hardwares with BATCH flag.
253 * Such hardware usually just increases the position at each IRQ,
254 * thus it can't give any strange position.
255 */
256 if (runtime->hw.info & SNDRV_PCM_INFO_BATCH)
257 goto no_jiffies_check;
252 hdelta = new_hw_ptr - old_hw_ptr; 258 hdelta = new_hw_ptr - old_hw_ptr;
253 jdelta = jiffies - runtime->hw_ptr_jiffies; 259 jdelta = jiffies - runtime->hw_ptr_jiffies;
254 if (((hdelta * HZ) / runtime->rate) > jdelta + HZ/100) { 260 if (((hdelta * HZ) / runtime->rate) > jdelta + HZ/100) {
@@ -272,6 +278,7 @@ static int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *substream)
272 hw_base -= hw_base % runtime->buffer_size; 278 hw_base -= hw_base % runtime->buffer_size;
273 delta = 0; 279 delta = 0;
274 } 280 }
281 no_jiffies_check:
275 if (delta > runtime->period_size + runtime->period_size / 2) { 282 if (delta > runtime->period_size + runtime->period_size / 2) {
276 hw_ptr_error(substream, 283 hw_ptr_error(substream,
277 "Lost interrupts? " 284 "Lost interrupts? "
diff --git a/sound/isa/msnd/msnd.c b/sound/isa/msnd/msnd.c
index 906454413ed..3a1526ae172 100644
--- a/sound/isa/msnd/msnd.c
+++ b/sound/isa/msnd/msnd.c
@@ -438,7 +438,8 @@ static void snd_msnd_capture_reset_queue(struct snd_msnd *chip,
438static struct snd_pcm_hardware snd_msnd_playback = { 438static struct snd_pcm_hardware snd_msnd_playback = {
439 .info = SNDRV_PCM_INFO_MMAP | 439 .info = SNDRV_PCM_INFO_MMAP |
440 SNDRV_PCM_INFO_INTERLEAVED | 440 SNDRV_PCM_INFO_INTERLEAVED |
441 SNDRV_PCM_INFO_MMAP_VALID, 441 SNDRV_PCM_INFO_MMAP_VALID |
442 SNDRV_PCM_INFO_BATCH,
442 .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE, 443 .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE,
443 .rates = SNDRV_PCM_RATE_8000_48000, 444 .rates = SNDRV_PCM_RATE_8000_48000,
444 .rate_min = 8000, 445 .rate_min = 8000,
@@ -456,7 +457,8 @@ static struct snd_pcm_hardware snd_msnd_playback = {
456static struct snd_pcm_hardware snd_msnd_capture = { 457static struct snd_pcm_hardware snd_msnd_capture = {
457 .info = SNDRV_PCM_INFO_MMAP | 458 .info = SNDRV_PCM_INFO_MMAP |
458 SNDRV_PCM_INFO_INTERLEAVED | 459 SNDRV_PCM_INFO_INTERLEAVED |
459 SNDRV_PCM_INFO_MMAP_VALID, 460 SNDRV_PCM_INFO_MMAP_VALID |
461 SNDRV_PCM_INFO_BATCH,
460 .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE, 462 .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE,
461 .rates = SNDRV_PCM_RATE_8000_48000, 463 .rates = SNDRV_PCM_RATE_8000_48000,
462 .rate_min = 8000, 464 .rate_min = 8000,
diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c
index a299340519d..ce3f2e90f4d 100644
--- a/sound/pci/bt87x.c
+++ b/sound/pci/bt87x.c
@@ -349,7 +349,8 @@ static struct snd_pcm_hardware snd_bt87x_digital_hw = {
349 .info = SNDRV_PCM_INFO_MMAP | 349 .info = SNDRV_PCM_INFO_MMAP |
350 SNDRV_PCM_INFO_INTERLEAVED | 350 SNDRV_PCM_INFO_INTERLEAVED |
351 SNDRV_PCM_INFO_BLOCK_TRANSFER | 351 SNDRV_PCM_INFO_BLOCK_TRANSFER |
352 SNDRV_PCM_INFO_MMAP_VALID, 352 SNDRV_PCM_INFO_MMAP_VALID |
353 SNDRV_PCM_INFO_BATCH,
353 .formats = SNDRV_PCM_FMTBIT_S16_LE, 354 .formats = SNDRV_PCM_FMTBIT_S16_LE,
354 .rates = 0, /* set at runtime */ 355 .rates = 0, /* set at runtime */
355 .channels_min = 2, 356 .channels_min = 2,
@@ -365,7 +366,8 @@ static struct snd_pcm_hardware snd_bt87x_analog_hw = {
365 .info = SNDRV_PCM_INFO_MMAP | 366 .info = SNDRV_PCM_INFO_MMAP |
366 SNDRV_PCM_INFO_INTERLEAVED | 367 SNDRV_PCM_INFO_INTERLEAVED |
367 SNDRV_PCM_INFO_BLOCK_TRANSFER | 368 SNDRV_PCM_INFO_BLOCK_TRANSFER |
368 SNDRV_PCM_INFO_MMAP_VALID, 369 SNDRV_PCM_INFO_MMAP_VALID |
370 SNDRV_PCM_INFO_BATCH,
369 .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8, 371 .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8,
370 .rates = SNDRV_PCM_RATE_KNOT, 372 .rates = SNDRV_PCM_RATE_KNOT,
371 .rate_min = ANALOG_CLOCK / CLOCK_DIV_MAX, 373 .rate_min = ANALOG_CLOCK / CLOCK_DIV_MAX,
diff --git a/sound/pci/echoaudio/indigodjx.c b/sound/pci/echoaudio/indigodjx.c
index 3482ef69f49..2e44316530a 100644
--- a/sound/pci/echoaudio/indigodjx.c
+++ b/sound/pci/echoaudio/indigodjx.c
@@ -88,6 +88,7 @@ static struct snd_pcm_hardware pcm_hardware_skel = {
88 .rates = SNDRV_PCM_RATE_32000 | 88 .rates = SNDRV_PCM_RATE_32000 |
89 SNDRV_PCM_RATE_44100 | 89 SNDRV_PCM_RATE_44100 |
90 SNDRV_PCM_RATE_48000 | 90 SNDRV_PCM_RATE_48000 |
91 SNDRV_PCM_RATE_64000 |
91 SNDRV_PCM_RATE_88200 | 92 SNDRV_PCM_RATE_88200 |
92 SNDRV_PCM_RATE_96000, 93 SNDRV_PCM_RATE_96000,
93 .rate_min = 32000, 94 .rate_min = 32000,
diff --git a/sound/pci/echoaudio/indigoiox.c b/sound/pci/echoaudio/indigoiox.c
index aebee27a40f..eb3819f9654 100644
--- a/sound/pci/echoaudio/indigoiox.c
+++ b/sound/pci/echoaudio/indigoiox.c
@@ -89,6 +89,7 @@ static struct snd_pcm_hardware pcm_hardware_skel = {
89 .rates = SNDRV_PCM_RATE_32000 | 89 .rates = SNDRV_PCM_RATE_32000 |
90 SNDRV_PCM_RATE_44100 | 90 SNDRV_PCM_RATE_44100 |
91 SNDRV_PCM_RATE_48000 | 91 SNDRV_PCM_RATE_48000 |
92 SNDRV_PCM_RATE_64000 |
92 SNDRV_PCM_RATE_88200 | 93 SNDRV_PCM_RATE_88200 |
93 SNDRV_PCM_RATE_96000, 94 SNDRV_PCM_RATE_96000,
94 .rate_min = 32000, 95 .rate_min = 32000,
diff --git a/sound/pci/korg1212/korg1212.c b/sound/pci/korg1212/korg1212.c
index 8b79969034b..7cc38a11e99 100644
--- a/sound/pci/korg1212/korg1212.c
+++ b/sound/pci/korg1212/korg1212.c
@@ -1238,7 +1238,8 @@ static struct snd_pcm_hardware snd_korg1212_playback_info =
1238{ 1238{
1239 .info = (SNDRV_PCM_INFO_MMAP | 1239 .info = (SNDRV_PCM_INFO_MMAP |
1240 SNDRV_PCM_INFO_MMAP_VALID | 1240 SNDRV_PCM_INFO_MMAP_VALID |
1241 SNDRV_PCM_INFO_INTERLEAVED), 1241 SNDRV_PCM_INFO_INTERLEAVED |
1242 SNDRV_PCM_INFO_BATCH),
1242 .formats = SNDRV_PCM_FMTBIT_S16_LE, 1243 .formats = SNDRV_PCM_FMTBIT_S16_LE,
1243 .rates = (SNDRV_PCM_RATE_44100 | 1244 .rates = (SNDRV_PCM_RATE_44100 |
1244 SNDRV_PCM_RATE_48000), 1245 SNDRV_PCM_RATE_48000),
@@ -1258,7 +1259,8 @@ static struct snd_pcm_hardware snd_korg1212_capture_info =
1258{ 1259{
1259 .info = (SNDRV_PCM_INFO_MMAP | 1260 .info = (SNDRV_PCM_INFO_MMAP |
1260 SNDRV_PCM_INFO_MMAP_VALID | 1261 SNDRV_PCM_INFO_MMAP_VALID |
1261 SNDRV_PCM_INFO_INTERLEAVED), 1262 SNDRV_PCM_INFO_INTERLEAVED |
1263 SNDRV_PCM_INFO_BATCH),
1262 .formats = SNDRV_PCM_FMTBIT_S16_LE, 1264 .formats = SNDRV_PCM_FMTBIT_S16_LE,
1263 .rates = (SNDRV_PCM_RATE_44100 | 1265 .rates = (SNDRV_PCM_RATE_44100 |
1264 SNDRV_PCM_RATE_48000), 1266 SNDRV_PCM_RATE_48000),
diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c b/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c
index 01066c95580..d057e648964 100644
--- a/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c
+++ b/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c
@@ -240,7 +240,8 @@ static int pdacf_pcm_prepare(struct snd_pcm_substream *subs)
240static struct snd_pcm_hardware pdacf_pcm_capture_hw = { 240static struct snd_pcm_hardware pdacf_pcm_capture_hw = {
241 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 241 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
242 SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME | 242 SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME |
243 SNDRV_PCM_INFO_MMAP_VALID), 243 SNDRV_PCM_INFO_MMAP_VALID |
244 SNDRV_PCM_INFO_BATCH),
244 .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S16_BE | 245 .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S16_BE |
245 SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S24_3BE | 246 SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S24_3BE |
246 SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_S32_BE, 247 SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_S32_BE,
diff --git a/sound/soc/au1x/dbdma2.c b/sound/soc/au1x/dbdma2.c
index 30490a25914..594c6c5b783 100644
--- a/sound/soc/au1x/dbdma2.c
+++ b/sound/soc/au1x/dbdma2.c
@@ -82,7 +82,7 @@ static struct au1xpsc_audio_dmadata *au1xpsc_audio_pcmdma[2];
82/* PCM hardware DMA capabilities - platform specific */ 82/* PCM hardware DMA capabilities - platform specific */
83static const struct snd_pcm_hardware au1xpsc_pcm_hardware = { 83static const struct snd_pcm_hardware au1xpsc_pcm_hardware = {
84 .info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | 84 .info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID |
85 SNDRV_PCM_INFO_INTERLEAVED, 85 SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BATCH,
86 .formats = AU1XPSC_PCM_FMTS, 86 .formats = AU1XPSC_PCM_FMTS,
87 .period_bytes_min = AU1XPSC_PERIOD_MIN_BYTES, 87 .period_bytes_min = AU1XPSC_PERIOD_MIN_BYTES,
88 .period_bytes_max = 4096 * 1024 - 1, 88 .period_bytes_max = 4096 * 1024 - 1,
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index 921b205de28..df7c8c281d2 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -836,6 +836,12 @@ static DECLARE_TLV_DB_SCALE(analog_tlv, -2400, 200, 0);
836static DECLARE_TLV_DB_SCALE(output_tvl, -1200, 600, 1); 836static DECLARE_TLV_DB_SCALE(output_tvl, -1200, 600, 1);
837 837
838/* 838/*
839 * Gain control for earpiece amplifier
840 * 0 dB to 12 dB in 6 dB steps (mute instead of -6)
841 */
842static DECLARE_TLV_DB_SCALE(output_ear_tvl, -600, 600, 1);
843
844/*
839 * Capture gain after the ADCs 845 * Capture gain after the ADCs
840 * from 0 dB to 31 dB in 1 dB steps 846 * from 0 dB to 31 dB in 1 dB steps
841 */ 847 */
@@ -900,7 +906,7 @@ static const struct snd_kcontrol_new twl4030_snd_controls[] = {
900 4, 3, 0, output_tvl), 906 4, 3, 0, output_tvl),
901 907
902 SOC_SINGLE_TLV_TWL4030("Earpiece Playback Volume", 908 SOC_SINGLE_TLV_TWL4030("Earpiece Playback Volume",
903 TWL4030_REG_EAR_CTL, 4, 3, 0, output_tvl), 909 TWL4030_REG_EAR_CTL, 4, 3, 0, output_ear_tvl),
904 910
905 /* Common capture gain controls */ 911 /* Common capture gain controls */
906 SOC_DOUBLE_R_TLV("TX1 Digital Capture Volume", 912 SOC_DOUBLE_R_TLV("TX1 Digital Capture Volume",
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c
index 3b1d0993bed..0275321ff8a 100644
--- a/sound/soc/codecs/wm8350.c
+++ b/sound/soc/codecs/wm8350.c
@@ -968,7 +968,7 @@ static int wm8350_pcm_trigger(struct snd_pcm_substream *substream,
968 * required for LRC in master mode. The DACs or ADCs need a 968 * required for LRC in master mode. The DACs or ADCs need a
969 * valid audio path i.e. pin -> ADC or DAC -> pin before 969 * valid audio path i.e. pin -> ADC or DAC -> pin before
970 * the LRC will be enabled in master mode. */ 970 * the LRC will be enabled in master mode. */
971 if (!master && cmd != SNDRV_PCM_TRIGGER_START) 971 if (!master || cmd != SNDRV_PCM_TRIGGER_START)
972 return 0; 972 return 0;
973 973
974 if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { 974 if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
diff --git a/sound/soc/fsl/mpc5200_psc_i2s.c b/sound/soc/fsl/mpc5200_psc_i2s.c
index 3aa729df27b..1111c710118 100644
--- a/sound/soc/fsl/mpc5200_psc_i2s.c
+++ b/sound/soc/fsl/mpc5200_psc_i2s.c
@@ -504,7 +504,8 @@ static struct snd_soc_dai psc_i2s_dai_template = {
504 504
505static const struct snd_pcm_hardware psc_i2s_pcm_hardware = { 505static const struct snd_pcm_hardware psc_i2s_pcm_hardware = {
506 .info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | 506 .info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID |
507 SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER, 507 SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER |
508 SNDRV_PCM_INFO_BATCH,
508 .formats = SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_BE | 509 .formats = SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_BE |
509 SNDRV_PCM_FMTBIT_S24_BE | SNDRV_PCM_FMTBIT_S32_BE, 510 SNDRV_PCM_FMTBIT_S24_BE | SNDRV_PCM_FMTBIT_S32_BE,
510 .rate_min = 8000, 511 .rate_min = 8000,
diff --git a/sound/soc/sh/dma-sh7760.c b/sound/soc/sh/dma-sh7760.c
index 0dad3a0bb92..baddb1242c7 100644
--- a/sound/soc/sh/dma-sh7760.c
+++ b/sound/soc/sh/dma-sh7760.c
@@ -103,7 +103,8 @@ static struct snd_pcm_hardware camelot_pcm_hardware = {
103 .info = (SNDRV_PCM_INFO_MMAP | 103 .info = (SNDRV_PCM_INFO_MMAP |
104 SNDRV_PCM_INFO_INTERLEAVED | 104 SNDRV_PCM_INFO_INTERLEAVED |
105 SNDRV_PCM_INFO_BLOCK_TRANSFER | 105 SNDRV_PCM_INFO_BLOCK_TRANSFER |
106 SNDRV_PCM_INFO_MMAP_VALID), 106 SNDRV_PCM_INFO_MMAP_VALID |
107 SNDRV_PCM_INFO_BATCH),
107 .formats = DMABRG_FMTS, 108 .formats = DMABRG_FMTS,
108 .rates = DMABRG_RATES, 109 .rates = DMABRG_RATES,
109 .rate_min = 8000, 110 .rate_min = 8000,
diff --git a/sound/sparc/dbri.c b/sound/sparc/dbri.c
index af95ff1e126..1d2e51b3f91 100644
--- a/sound/sparc/dbri.c
+++ b/sound/sparc/dbri.c
@@ -1975,7 +1975,8 @@ static struct snd_pcm_hardware snd_dbri_pcm_hw = {
1975 .info = SNDRV_PCM_INFO_MMAP | 1975 .info = SNDRV_PCM_INFO_MMAP |
1976 SNDRV_PCM_INFO_INTERLEAVED | 1976 SNDRV_PCM_INFO_INTERLEAVED |
1977 SNDRV_PCM_INFO_BLOCK_TRANSFER | 1977 SNDRV_PCM_INFO_BLOCK_TRANSFER |
1978 SNDRV_PCM_INFO_MMAP_VALID, 1978 SNDRV_PCM_INFO_MMAP_VALID |
1979 SNDRV_PCM_INFO_BATCH,
1979 .formats = SNDRV_PCM_FMTBIT_MU_LAW | 1980 .formats = SNDRV_PCM_FMTBIT_MU_LAW |
1980 SNDRV_PCM_FMTBIT_A_LAW | 1981 SNDRV_PCM_FMTBIT_A_LAW |
1981 SNDRV_PCM_FMTBIT_U8 | 1982 SNDRV_PCM_FMTBIT_U8 |
diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c
index 9a608fa8515..dd1ab617784 100644
--- a/sound/usb/usx2y/usbusx2yaudio.c
+++ b/sound/usb/usx2y/usbusx2yaudio.c
@@ -870,7 +870,8 @@ static struct snd_pcm_hardware snd_usX2Y_2c =
870{ 870{
871 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 871 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
872 SNDRV_PCM_INFO_BLOCK_TRANSFER | 872 SNDRV_PCM_INFO_BLOCK_TRANSFER |
873 SNDRV_PCM_INFO_MMAP_VALID), 873 SNDRV_PCM_INFO_MMAP_VALID |
874 SNDRV_PCM_INFO_BATCH),
874 .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_3LE, 875 .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_3LE,
875 .rates = SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000, 876 .rates = SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000,
876 .rate_min = 44100, 877 .rate_min = 44100,